]> git.proxmox.com Git - mirror_frr.git/blobdiff - pimd/pim_zlookup.c
Merge pull request #561 from donaldsharp/static_config2
[mirror_frr.git] / pimd / pim_zlookup.c
index e1a8e820b70b68e608e6062a7090b94a1a906d8e..9c26745e77b9ce09d55ee87b9940b515d5b18392 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>
 #include "zebra/rib.h"
@@ -77,9 +76,8 @@ static void zclient_lookup_sched(struct zclient *zlookup, int delay)
 {
   zassert(!zlookup->t_connect);
 
-  THREAD_TIMER_ON(master, zlookup->t_connect,
-                 zclient_lookup_connect,
-                 zlookup, delay);
+  thread_add_timer(master, zclient_lookup_connect, zlookup, delay,
+                   &zlookup->t_connect);
 
   zlog_notice("%s: zclient lookup connection scheduled for %d seconds",
              __PRETTY_FUNCTION__, delay);
@@ -89,9 +87,8 @@ static void zclient_lookup_sched(struct zclient *zlookup, int delay)
 static void zclient_lookup_sched_now(struct zclient *zlookup)
 {
   zassert(!zlookup->t_connect);
-
-  zlookup->t_connect = thread_add_event(master, zclient_lookup_connect,
-                                       zlookup, 0);
+  thread_add_event(master, zclient_lookup_connect, zlookup, 0,
+                   &zlookup->t_connect);
 
   zlog_notice("%s: zclient lookup immediate connection scheduled",
              __PRETTY_FUNCTION__);
@@ -222,6 +219,7 @@ static int zclient_read_nexthop(struct zclient *zlookup,
   for (i = 0; i < nexthop_num; ++i) {
     enum nexthop_types_t nexthop_type;
     struct pim_neighbor *nbr;
+    struct prefix p;
 
     nexthop_type = stream_getc(s);
     if (num_ifindex >= tab_size) {
@@ -251,9 +249,24 @@ static int zclient_read_nexthop(struct zclient *zlookup,
       break;
     case NEXTHOP_TYPE_IPV6_IFINDEX:
       nexthop_tab[num_ifindex].nexthop_addr.family = AF_INET6;
-      stream_get (&nexthop_tab[num_ifindex].nexthop_addr.u.prefix6, s, 16);
+      stream_get (&nexthop_tab[num_ifindex].nexthop_addr.u.prefix6,
+                 s,
+                 sizeof(struct in6_addr));
       nexthop_tab[num_ifindex].ifindex = stream_getl (s);
-      nbr = pim_neighbor_find_if (if_lookup_by_index_vrf (nexthop_tab[num_ifindex].ifindex, VRF_DEFAULT));
+
+      p.family = AF_INET6;
+      p.prefixlen = IPV6_MAX_PREFIXLEN;
+      memcpy (&p.u.prefix6,
+             &nexthop_tab[num_ifindex].nexthop_addr.u.prefix6,
+             sizeof(struct in6_addr));
+
+      /*
+       * If we are sending v6 secondary assume we receive v6 secondary
+       */
+      if (pimg->send_v6_secondary)
+        nbr = pim_neighbor_find_by_secondary(if_lookup_by_index (nexthop_tab[num_ifindex].ifindex, VRF_DEFAULT), &p);
+      else
+        nbr = pim_neighbor_find_if (if_lookup_by_index (nexthop_tab[num_ifindex].ifindex, VRF_DEFAULT));
       if (nbr)
         {
           nexthop_tab[num_ifindex].nexthop_addr.family = AF_INET;
@@ -455,7 +468,8 @@ pim_zlookup_sg_statistics (struct channel_oil *c_oil)
 
       more.src = c_oil->oil.mfcc_origin;
       more.grp = c_oil->oil.mfcc_mcastgrp;
-      zlog_debug ("Sending Request for New Channel Oil Information(%s)", pim_str_sg_dump (&more));
+      zlog_debug ("Sending Request for New Channel Oil Information(%s) VIIF %d",
+            pim_str_sg_dump (&more), c_oil->oil.mfcc_parent);
     }
 
   if (!ifp)