]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: Modify the RP data structure.
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 27 Oct 2015 20:13:23 +0000 (13:13 -0700)
committerDonald Sharp <sharpd@cumulusnetwroks.com>
Thu, 26 May 2016 00:38:35 +0000 (20:38 -0400)
Modify the RP data structure to know how to get to it from here.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_cmd.c
pimd/pim_mroute.c
pimd/pim_register.c
pimd/pim_rp.c
pimd/pim_vty.c
pimd/pimd.c
pimd/pimd.h

index 9e9b1ed08ca619e43c28a30f69b583eebd684dbf..f15d6059f0ae77d3717525263c5c8de2eb105bdf 100644 (file)
@@ -2487,12 +2487,17 @@ DEFUN (ip_pim_rp,
 {
   int result;
 
-  result = inet_pton(AF_INET, argv[0], &qpim_rp);
+  result = inet_pton(AF_INET, argv[0], &qpim_rp.rpf_addr.s_addr);
   if (result <= 0) {
     vty_out(vty, "%% Bad RP address specified: %s", argv[0]);
     return CMD_WARNING;
   }
 
+  if (pim_nexthop_lookup(&qpim_rp.source_nexthop, qpim_rp.rpf_addr) != 0) {
+    vty_out(vty, "%% No Path to RP address specified: %s", argv[0]);
+    return CMD_WARNING;
+  }
+
   return CMD_SUCCESS;
 }
 
@@ -2505,7 +2510,7 @@ DEFUN (no_ip_pim_rp,
        "Rendevous Point"
        "ip address of RP")
 {
-  qpim_rp.s_addr = 0;
+  qpim_rp.rpf_addr.s_addr = INADDR_NONE;
 
   return CMD_SUCCESS;
 }
index d804ce86ff0d047511714286d5616a6e91977714..0e2a9cc0044a91091be68cbafc3a627900b3b3a1 100644 (file)
@@ -30,6 +30,7 @@
 #include "pim_time.h"
 #include "pim_iface.h"
 #include "pim_macro.h"
+#include "pim_rp.h"
 
 /* GLOBAL VARS */
 extern struct zebra_privs_t pimd_privs;
@@ -73,13 +74,15 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
 {
   struct mfcctl mc;
   struct pim_interface *pim_ifp = ifp->info;
+  struct in_addr rpg;
 
+  rpg = RP(msg->im_dst);
   /*
    * If the incoming interface is unknown OR
    * the Interface type is SSM we don't need to
    * do anything here
    */
-  if ((qpim_rp.s_addr == INADDR_NONE) ||
+  if ((rpg.s_addr == INADDR_NONE) ||
       (!pim_ifp) ||
       (!PIM_I_am_DR(pim_ifp)) ||
       (pim_ifp->itype == PIM_INTERFACE_SSM))
@@ -106,17 +109,28 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
 }
 
 static int
-pim_mroute_msg_wholepkt (int fd, struct interface *ifp, const struct igmpmsg *msg,
+pim_mroute_msg_wholepkt (int fd, struct interface *ifp, const char *buf,
                         const char *src_str, const char *grp_str)
 {
+  struct pim_interface *pim_ifp = ifp->info;
+  struct in_addr group;
+  struct in_addr rpg;
+  const struct ip *ip_hdr;
 
-  if (qpim_rp.s_addr == INADDR_NONE) {
-    if (PIM_DEBUG_PIM_TRACE) {
-      zlog_debug("%s: Received WHOLEPKT with no RP configured to send it to",
-                __PRETTY_FUNCTION__);
-    }
+  ip_hdr = (const struct ip *)buf;
+
+  group = ip_hdr->ip_dst;
+
+  rpg = RP(group);
+
+  if ((rpg.s_addr == INADDR_NONE) ||
+      (!pim_ifp) ||
+      (!PIM_I_am_DR(pim_ifp)) ||
+      (pim_ifp->itype == PIM_INTERFACE_SSM)) {
+    return 0;
   }
 
+  //pim_register_send(buf, rpg);
   return 0;
 }
 
@@ -261,6 +275,7 @@ int pim_mroute_msg(int fd, const char *buf, int buf_size)
     return pim_mroute_msg_nocache(fd, ifp, msg, src_str, grp_str);
     break;
   case IGMPMSG_WHOLEPKT:
+    zlog_hexdump(buf, buf_size);
     return pim_mroute_msg_wholepkt(fd, ifp, msg, src_str, grp_str);
     break;
   default:
index 6123e1bd5ab4f6b610dd736fe8b10398a7f93b0b..588d2962e54f7e0b8350edfdbc7e57730f3eca75 100644 (file)
@@ -47,7 +47,7 @@ pim_check_is_my_ip_address (struct in_addr dest_addr)
    * type of configuration.
    * Note - Premature optimization might bite our patooeys' here.
    */
-  if (I_am_RP(dest_addr) && (dest_addr.s_addr == qpim_rp.s_addr))
+  if (I_am_RP(dest_addr) && (dest_addr.s_addr == qpim_rp.rpf_addr.s_addr))
     return 1;
 
   if (if_lookup_exact_address (&dest_addr, AF_INET))
index d3cd91673ca7c3081d86933d631174ce305b5b0e..5ad786bad03f30cc4cda333b5e368c7adbdfa267 100644 (file)
@@ -39,22 +39,22 @@ pim_rp_check_rp (struct in_addr old, struct in_addr new)
     char sold[100];
     char snew[100];
     char rp[100];
-    pim_inet4_dump("<rp?>", qpim_rp, rp, sizeof(rp));
+    pim_inet4_dump("<rp?>", qpim_rp.rpf_addr, rp, sizeof(rp));
     pim_inet4_dump("<old?>", old, sold, sizeof(sold));
     pim_inet4_dump("<new?>", new, snew, sizeof(snew));
     zlog_debug("%s: %s for old %s new %s", __func__, rp, sold, snew );
   }
 
-  if (qpim_rp.s_addr == INADDR_NONE)
+  if (qpim_rp.rpf_addr.s_addr == INADDR_NONE)
     return;
 
-  if (new.s_addr == qpim_rp.s_addr)
+  if (new.s_addr == qpim_rp.rpf_addr.s_addr)
     {
       i_am_rp = 1;
       return;
     }
 
-  if (old.s_addr == qpim_rp.s_addr)
+  if (old.s_addr == qpim_rp.rpf_addr.s_addr)
     {
       i_am_rp = 0;
       return;
@@ -84,7 +84,7 @@ pim_rp_g (struct in_addr group)
   /*
    * For staticly configured RP, it is always the qpim_rp
    */
-  return(qpim_rp);
+  return(qpim_rp.rpf_addr);
 }
 
 /*
@@ -98,14 +98,14 @@ pim_rp_g (struct in_addr group)
 int
 pim_rp_set_upstream_addr (struct in_addr *up, struct in_addr source)
 {
-  if ((qpim_rp.s_addr == INADDR_NONE) && (source.s_addr == 0xFFFFFFFF))
+  if ((qpim_rp.rpf_addr.s_addr == INADDR_NONE) && (source.s_addr == INADDR_ANY))
     {
       if (PIM_DEBUG_PIM_TRACE)
        zlog_debug("%s: Received a (*,G) with no RP configured", __PRETTY_FUNCTION__);
       return 0;
     }
 
-  *up = (source.s_addr == 0xFFFFFFFF) ? qpim_rp : source;
+  *up = (source.s_addr == INADDR_ANY) ? qpim_rp.rpf_addr : source;
 
   return 1;
 }
index 1c0c02f7779cea03ef380cc7ee59fc115c8c9121..eeeda9d43fabac790eeb7be6d3daf08e4fd44c55 100644 (file)
@@ -99,8 +99,8 @@ int pim_global_config_write(struct vty *vty)
     vty_out(vty, "%s%s", PIM_CMD_IP_MULTICAST_ROUTING, VTY_NEWLINE);
     ++writes;
   }
-  if (qpim_rp.s_addr) {
-    vty_out(vty, "ip pim rp %s%s", inet_ntop(AF_INET, &qpim_rp, buffer, 32), VTY_NEWLINE);
+  if (qpim_rp.rpf_addr.s_addr != INADDR_NONE) {
+    vty_out(vty, "ip pim rp %s%s", inet_ntop(AF_INET, &qpim_rp.rpf_addr, buffer, 32), VTY_NEWLINE);
     ++writes;
   }
 
index 3b2be7975a7fa732681ffa4c97142f27511351ad..868a2fca263909500d6383ee271d7f88e248ead1 100644 (file)
@@ -69,7 +69,7 @@ int64_t                   qpim_mroute_add_last = 0;
 int64_t                   qpim_mroute_del_events = 0;
 int64_t                   qpim_mroute_del_last = 0;
 struct list              *qpim_static_route_list = 0;
-struct in_addr            qpim_rp = { .s_addr = INADDR_NONE };
+struct pim_rpf            qpim_rp = { .rpf_addr.s_addr = INADDR_NONE };
 
 int32_t qpim_register_suppress_time = PIM_REGISTER_SUPPRESSION_TIME_DEFAULT;
 int32_t qpim_register_probe_time = PIM_REGISTER_PROBE_TIME_DEFAULT;
index 239c61843840d17302337cfbddd9821602325753..3b721072901a11616534cf3255383487652a2dc1 100644 (file)
@@ -101,7 +101,7 @@ int64_t                   qpim_mroute_add_last;
 int64_t                   qpim_mroute_del_events;
 int64_t                   qpim_mroute_del_last;
 struct list              *qpim_static_route_list; /* list of routes added statically */
-extern struct in_addr     qpim_rp;
+struct pim_rpf            qpim_rp;
 
 #define PIM_JP_HOLDTIME (qpim_t_periodic * 7 / 2)