From 0bf27c5c4c3128ecfe5da881eb570d9d450cedc8 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 12 Sep 2016 17:02:53 +0000 Subject: [PATCH] pimd: Switch all up->fhr to use up->flags Allow up->flags to know if we are a FHR or not Signed-off-by: Donald Sharp --- pimd/pim_mroute.c | 6 +++--- pimd/pim_upstream.c | 10 +++++----- pimd/pim_upstream.h | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index f498bfcd00..cf98f32c24 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -148,7 +148,7 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg up->channel_oil = oil; up->channel_oil->cc.pktcnt++; - up->fhr = 1; + PIM_UPSTREAM_FLAG_SET_FHR(up->flags); pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM); up->join_state = PIM_UPSTREAM_JOINED; @@ -335,7 +335,7 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf) * If we are the fhr that means we are getting a callback during * the pimreg period, so I believe we can ignore this packet */ - if (!up->fhr) + if (!PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)) { struct pim_nexthop source; struct pim_rpf *rpf = RP (sg.grp); @@ -369,7 +369,7 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf) pim_str_sg_dump (&sg), ifp->name); return -2; } - up->fhr = 1; + PIM_UPSTREAM_FLAG_SET_FHR(up->flags); pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time); up->channel_oil = oil; diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 13e7c55c55..24e45b576c 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -206,7 +206,7 @@ static int on_join_timer(struct thread *t) /* * In the case of a HFR we will not ahve anyone to send this to. */ - if (up->fhr) + if (PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)) return 0; /* @@ -411,7 +411,7 @@ pim_upstream_switch(struct pim_upstream *up, switch (up->join_state) { case PIM_UPSTREAM_PRUNE: - if (!up->fhr) + if (!PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)) { up->join_state = new_state; up->state_transition = pim_time_monotonic_sec (); @@ -432,11 +432,11 @@ pim_upstream_switch(struct pim_upstream *up, if (new_state == PIM_UPSTREAM_JOINED) { if (old_state != PIM_UPSTREAM_JOINED) { - int old_fhr = up->fhr; + int old_fhr = PIM_UPSTREAM_FLAG_TEST_FHR(up->flags); forward_on(up); - up->fhr = pim_upstream_could_register (up); - if (up->fhr) + if (pim_upstream_could_register (up)) { + PIM_UPSTREAM_FLAG_SET_FHR(up->flags); if (!old_fhr) { pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time); diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h index 26a0cd0a7c..8fe3559c34 100644 --- a/pimd/pim_upstream.h +++ b/pimd/pim_upstream.h @@ -64,7 +64,6 @@ enum pim_upstream_sptbit { */ struct pim_upstream { struct pim_upstream *parent; - int fhr; struct in_addr upstream_addr;/* Who we are talking to */ struct in_addr upstream_register; /*Who we received a register from*/ struct prefix_sg sg; /* (S,G) group key */ -- 2.39.5