From dc686f820be848d9b80e3f3918228d6eb321c826 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 4 Aug 2016 12:58:47 -0400 Subject: [PATCH] pimd: Fix some null register issues The Null register bit was not properly being set and the total length was wrong as well. Signed-off-by: Donald Sharp --- pimd/pim_join.c | 19 +++++++++++++++---- pimd/pim_register.c | 2 +- pimd/pim_upstream.c | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pimd/pim_join.c b/pimd/pim_join.c index abab730439..80e77ecb32 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -166,7 +166,7 @@ static void recv_prune(struct interface *ifp, sg.src.s_addr = INADDR_ANY; } - + pim_ifchannel_prune(ifp, upstream, &sg, source_flags, holdtime); if (sg.src.s_addr == INADDR_ANY) @@ -179,18 +179,29 @@ static void recv_prune(struct interface *ifp, { if (child->parent == up) { + struct channel_oil *c_oil = child->channel_oil; + struct pim_ifchannel *ch = pim_ifchannel_find (ifp, &child->sg); + struct pim_interface *pim_ifp = ifp->info; + char buff[100]; strcpy (buff, pim_str_sg_dump (&up->sg)); zlog_debug("%s %s: Prune(S,G)=%s from %s", __FILE__, __PRETTY_FUNCTION__, - buff, pim_str_sg_dump (&sg)); + buff, pim_str_sg_dump (&child->sg)); if (!pim_upstream_evaluate_join_desired (child)) - pim_channel_del_oif (child->channel_oil, ifp, PIM_OIF_FLAG_PROTO_PIM); + pim_channel_del_oif (c_oil, ifp, PIM_OIF_FLAG_PROTO_PIM); + + /* + * If the S,G has no if channel and the c_oil still + * has output here then the *,G was supplying the implied + * if channel. So remove it. + */ + if (!ch && c_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index]) + pim_channel_del_oif (c_oil, ifp, PIM_OIF_FLAG_PROTO_PIM); } } } - } int pim_joinprune_recv(struct interface *ifp, diff --git a/pimd/pim_register.c b/pimd/pim_register.c index c43818dfff..15a0e65574 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -188,7 +188,7 @@ pim_register_send (const uint8_t *buf, int buf_size, struct pim_rpf *rpg, int nu memset(buffer, 0, 3000); b1 = buffer + PIM_MSG_HEADER_LEN; - *b1 |= null_register << 31; + *b1 |= null_register << 6; b1 = buffer + PIM_MSG_REGISTER_LEN; memcpy(b1, (const unsigned char *)buf, buf_size); diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 9889264aa6..0d77783738 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -939,7 +939,7 @@ pim_upstream_register_stop_timer (struct thread *t) ip_hdr.ip_v = 4; ip_hdr.ip_src = up->sg.src; ip_hdr.ip_dst = up->sg.grp; - ip_hdr.ip_len = 20; + ip_hdr.ip_len = htons (20); // checksum is broken pim_register_send ((uint8_t *)&ip_hdr, sizeof (struct ip), rpg, 1); pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM); -- 2.39.5