From: Donald Sharp Date: Wed, 28 Oct 2015 14:00:31 +0000 (-0700) Subject: pimd: Convert the RP(G) code to return a struct pim_rpf X-Git-Tag: frr-2.0-rc1~812 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=ed66602c64f18776c79cd7fb999555472f29e031;p=matthieu%2Ffrr.git pimd: Convert the RP(G) code to return a struct pim_rpf This will facilitate sending packets to the right spot Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 0e2a9cc004..cdd2dbc6dd 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -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)) { diff --git a/pimd/pim_register.c b/pimd/pim_register.c index 588d2962e5..a8ecbdf90e 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -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) { diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index 5ad786bad0..6ba8482d4c 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -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); } /* diff --git a/pimd/pim_rp.h b/pimd/pim_rp.h index 3938e7251c..bb785e7efc 100644 --- a/pimd/pim_rp.h +++ b/pimd/pim_rp.h @@ -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))