]> git.proxmox.com Git - mirror_frr.git/blobdiff - pimd/pim_msg.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / pimd / pim_msg.c
index 01fe0deb274225b90dc25e9a45f1c35d61824c83..63688f87e055d92fd918996ab1a53d12f3c58289 100644 (file)
@@ -1,22 +1,21 @@
 /*
-  PIM for Quagga
-  Copyright (C) 2008  Everton da Silva Marques
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING; if not, write to the
-  Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-  MA 02110-1301 USA
-*/
+ * PIM for Quagga
+ * Copyright (C) 2008  Everton da Silva Marques
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
 
 #include <zebra.h>
 
@@ -37,6 +36,7 @@
 #include "pim_rpf.h"
 #include "pim_register.h"
 #include "pim_jp_agg.h"
+#include "pim_oil.h"
 
 void pim_msg_build_header(uint8_t *pim_msg, size_t pim_msg_size,
                          uint8_t pim_msg_type)
@@ -105,13 +105,16 @@ size_t pim_msg_get_jp_group_size(struct list *sources)
        struct pim_jp_sources *js;
        size_t size = 0;
 
+       if (!sources)
+               return 0;
+
        size += sizeof(struct pim_encoded_group_ipv4);
        size += 4; // Joined sources (2) + Pruned Sources (2)
 
        size += sizeof(struct pim_encoded_source_ipv4) * sources->count;
 
        js = listgetdata(listhead(sources));
-       if (js && js->up->sg.src.s_addr == INADDR_ANY) {
+       if (js && js->up->sg.src.s_addr == INADDR_ANY && js->is_join) {
                struct pim_upstream *child, *up;
                struct listnode *up_node;
 
@@ -196,7 +199,8 @@ size_t pim_msg_build_jp_groups(struct pim_jp_groups *grp,
                        grp->prunes++;
 
                if (source->up->sg.src.s_addr == INADDR_ANY) {
-                       struct pim_rpf *rpf = pim_rp_g(source->up->sg.grp);
+                       struct pim_instance *pim = source->up->channel_oil->pim;
+                       struct pim_rpf *rpf = pim_rp_g(pim, source->up->sg.grp);
                        bits = PIM_ENCODE_SPARSE_BIT | PIM_ENCODE_WC_BIT
                               | PIM_ENCODE_RPT_BIT;
                        stosend = rpf->rpf_addr.u.prefix4;