]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Switch all up->fhr to use up->flags
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 12 Sep 2016 17:02:53 +0000 (17:02 +0000)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:09 +0000 (20:26 -0500)
Allow up->flags to know if we are a FHR or not

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_mroute.c
pimd/pim_upstream.c
pimd/pim_upstream.h

index f498bfcd0061fb035c547487168b336bb9f2c2a8..cf98f32c24363a1440ab1a604ccb18c6e9fcfc0a 100644 (file)
@@ -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;
index 13e7c55c55c0c5c8e3d31d1cf1502e4c7635ce71..24e45b576c92afb0ddd9e3c16c074537e3422407 100644 (file)
@@ -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);
index 26a0cd0a7c3128690072a8b913e67fccc993f648..8fe3559c344e2a9a33b04550c8665cdf1813019c 100644 (file)
@@ -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 */