]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Convert the RP(G) code to return a struct pim_rpf
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 28 Oct 2015 14:00:31 +0000 (07:00 -0700)
committerDonald Sharp <sharpd@cumulusnetwroks.com>
Thu, 26 May 2016 00:38:35 +0000 (20:38 -0400)
This will facilitate sending packets to the right spot

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

index 0e2a9cc0044a91091be68cbafc3a627900b3b3a1..cdd2dbc6dd1204148d7f340dff3d90bb9af63f31 100644 (file)
@@ -74,7 +74,7 @@ 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;
+  struct pim_rpf *rpg;
 
   rpg = RP(msg->im_dst);
   /*
@@ -82,7 +82,7 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
    * the Interface type is SSM we don't need to
    * do anything here
    */
-  if ((rpg.s_addr == INADDR_NONE) ||
+  if ((rpg->rpf_addr.s_addr == INADDR_NONE) ||
       (!pim_ifp) ||
       (!PIM_I_am_DR(pim_ifp)) ||
       (pim_ifp->itype == PIM_INTERFACE_SSM))
@@ -114,7 +114,7 @@ pim_mroute_msg_wholepkt (int fd, struct interface *ifp, const char *buf,
 {
   struct pim_interface *pim_ifp = ifp->info;
   struct in_addr group;
-  struct in_addr rpg;
+  struct pim_rpf *rpg;
   const struct ip *ip_hdr;
 
   ip_hdr = (const struct ip *)buf;
@@ -123,7 +123,7 @@ pim_mroute_msg_wholepkt (int fd, struct interface *ifp, const char *buf,
 
   rpg = RP(group);
 
-  if ((rpg.s_addr == INADDR_NONE) ||
+  if ((rpg->rpf_addr.s_addr == INADDR_NONE) ||
       (!pim_ifp) ||
       (!PIM_I_am_DR(pim_ifp)) ||
       (pim_ifp->itype == PIM_INTERFACE_SSM)) {
index 588d2962e54f7e0b8350edfdbc7e57730f3eca75..a8ecbdf90e484e3bec736834a27e31754d2ca6c3 100644 (file)
@@ -158,7 +158,7 @@ pim_register_recv (struct interface *ifp,
   source = ip_hdr->ip_src;
   group = ip_hdr->ip_dst;
 
-  if (I_am_RP (group) && (dest_addr.s_addr == (RP (group).s_addr))) {
+  if (I_am_RP (group) && (dest_addr.s_addr == ((RP (group))->rpf_addr.s_addr))) {
     sentRegisterStop = 0;
 
     if (*bits && PIM_REGISTER_BORDER_BIT) {
index 5ad786bad03f30cc4cda333b5e368c7adbdfa267..6ba8482d4c6a9b6385c918f2ad007784b46d1d86 100644 (file)
@@ -26,6 +26,8 @@
 #include "pimd.h"
 #include "pim_str.h"
 #include "pim_rp.h"
+#include "pim_str.h"
+#include "pim_rpf.h"
 
 static int i_am_rp = 0;
 
@@ -78,13 +80,14 @@ pim_rp_i_am_rp (struct in_addr group)
  *
  * Return the RP that the Group belongs too.
  */
-struct in_addr
+struct pim_rpf *
 pim_rp_g (struct in_addr group)
 {
   /*
    * For staticly configured RP, it is always the qpim_rp
    */
-  return(qpim_rp.rpf_addr);
+  pim_nexthop_lookup(&qpim_rp.source_nexthop, qpim_rp.rpf_addr);
+  return(&qpim_rp);
 }
 
 /*
index 3938e7251c5258cd3993453d20e7330f6b5f1937..bb785e7efc3f1f18cd824130dc9a5a9a7c262b45 100644 (file)
@@ -24,7 +24,7 @@
 void pim_rp_check_rp (struct in_addr old, struct in_addr new);
 int pim_rp_i_am_rp (struct in_addr group);
 int pim_rp_set_upstream_addr (struct in_addr *up, struct in_addr source);
-struct in_addr pim_rp_g (struct in_addr group);
+struct pim_rpf *pim_rp_g (struct in_addr group);
 
 #define I_am_RP(G)  pim_rp_i_am_rp ((G))
 #define RP(G)       pim_rp_g ((G))