diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-10-28 15:00:31 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetwroks.com> | 2016-05-26 02:38:35 +0200 |
commit | ed66602c64f18776c79cd7fb999555472f29e031 (patch) | |
tree | 3d0e648ab9ce312c842143aead56ddd7ec43f66b | |
parent | lib: Fix compile warnings with zlog_hexdump (diff) | |
download | frr-ed66602c64f18776c79cd7fb999555472f29e031.tar.xz frr-ed66602c64f18776c79cd7fb999555472f29e031.zip |
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 <sharpd@cumulusnetworks.com>
-rw-r--r-- | pimd/pim_mroute.c | 8 | ||||
-rw-r--r-- | pimd/pim_register.c | 2 | ||||
-rw-r--r-- | pimd/pim_rp.c | 7 | ||||
-rw-r--r-- | pimd/pim_rp.h | 2 |
4 files changed, 11 insertions, 8 deletions
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 0e2a9cc00..cdd2dbc6d 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 588d2962e..a8ecbdf90 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 5ad786bad..6ba8482d4 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 3938e7251..bb785e7ef 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)) |