diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-10-27 13:13:23 -0700 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetwroks.com> | 2016-05-25 20:38:35 -0400 |
| commit | c8ae3ce8b6b2c5ec8ce0009118855a60593f29a3 (patch) | |
| tree | fdf3ed494aae829f56d7ebf1ad44b5ff8655069d /pimd/pim_mroute.c | |
| parent | 84366c7e153b3e557b99168d4712539c076d23ea (diff) | |
pimd: Modify the RP data structure.
Modify the RP data structure to know how to get to it from here.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_mroute.c')
| -rw-r--r-- | pimd/pim_mroute.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index d804ce86ff..0e2a9cc004 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -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: |
