]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Add SPTbit(S,G) support
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 15 Oct 2015 13:58:41 +0000 (06:58 -0700)
committerDonald Sharp <sharpd@cumulusnetwroks.com>
Thu, 26 May 2016 00:38:34 +0000 (20:38 -0400)
Add code to allow pimd to store the SPTbit as needed and
to properly test against it.

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

index ad21e08efedccf5ea46a45e4fff3406f6d71dea2..5dae6757164a724cc799e55129ec9f70be4930a8 100644 (file)
@@ -799,9 +799,10 @@ static void assert_action_a6(struct pim_ifchannel *ch,
   /*
     If (I is RPF_interface(S)) AND (UpstreamJPState(S,G) == true) set
     SPTbit(S,G) to TRUE.
-    
-    Notice: For PIM SSM, SPTbit(S,G) is already always true.
   */
+  if (ch->upstream->rpf.source_nexthop.interface == ch->interface)
+   if (ch->upstream->join_state == PIM_UPSTREAM_JOINED)
+     ch->upstream->sptbit = PIM_UPSTREAM_SPTBIT_TRUE;
 
   zassert(ch->ifassert_state == PIM_IFASSERT_I_AM_LOSER);
 }
index 3f56532526ad7736b79e68c6c74a9dc5b5d4bc7f..f67636a3fef132da9a2b9ebd3a037b3a027557ca 100644 (file)
@@ -227,8 +227,6 @@ int pim_macro_ch_could_assert_eval(const struct pim_ifchannel *ch)
 {
   struct interface *ifp;
 
-  /* SPTbit(S,G) is always true for PIM-SSM-Only Routers */
-
   ifp = ch->interface;
   if (!ifp) {
     char src_str[100];
@@ -241,6 +239,10 @@ int pim_macro_ch_could_assert_eval(const struct pim_ifchannel *ch)
     return 0; /* false */
   }
 
+  /* SPTbit(S,G) == TRUE */
+  if (ch->upstream->sptbit == PIM_UPSTREAM_SPTBIT_FALSE)
+    return 0; /* false */
+
   /* RPF_interface(S) != I ? */
   if (ch->upstream->rpf.source_nexthop.interface == ifp)
     return 0; /* false */
index e6cbbc61a175dfc03d40911650b917d3e59c81b2..0cc3ff98e29fe0d4bfc1ee307a73d6ac099605b4 100644 (file)
@@ -377,6 +377,7 @@ static struct pim_upstream *pim_upstream_new(struct in_addr source_addr,
   up->join_state                 = 0;
   up->state_transition           = pim_time_monotonic_sec();
   up->channel_oil                = 0;
+  up->sptbit                     = PIM_UPSTREAM_SPTBIT_TRUE;
 
   up->rpf.source_nexthop.interface                = 0;
   up->rpf.source_nexthop.mrib_nexthop_addr.s_addr = PIM_NET_INADDR_ANY;
index c7cdbc28d55fa0519161002e556881135a93bf84..d6b4ed360fee029d810d29d534294294d80a9ed6 100644 (file)
@@ -72,6 +72,11 @@ enum pim_upstream_state {
   PIM_UPSTREAM_JOINED
 };
 
+enum pim_upstream_sptbit {
+  PIM_UPSTREAM_SPTBIT_FALSE,
+  PIM_UPSTREAM_SPTBIT_TRUE
+};
+
 /*
   Upstream (S,G) channel in Joined state
   
@@ -87,6 +92,8 @@ struct pim_upstream {
   struct channel_oil      *channel_oil;
 
   enum pim_upstream_state  join_state;
+  enum pim_upstream_sptbit sptbit;
+
   int                      ref_count;
 
   struct pim_rpf           rpf;