From: Donald Sharp Date: Thu, 15 Oct 2015 13:58:41 +0000 (-0700) Subject: pimd: Add SPTbit(S,G) support X-Git-Tag: frr-2.0-rc1~831 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=d99764f68f6cb749ee794814dec5793660658832;p=mirror%2Ffrr.git pimd: Add SPTbit(S,G) support Add code to allow pimd to store the SPTbit as needed and to properly test against it. Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_assert.c b/pimd/pim_assert.c index ad21e08efe..5dae675716 100644 --- a/pimd/pim_assert.c +++ b/pimd/pim_assert.c @@ -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); } diff --git a/pimd/pim_macro.c b/pimd/pim_macro.c index 3f56532526..f67636a3fe 100644 --- a/pimd/pim_macro.c +++ b/pimd/pim_macro.c @@ -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 */ diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index e6cbbc61a1..0cc3ff98e2 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -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; diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h index c7cdbc28d5..d6b4ed360f 100644 --- a/pimd/pim_upstream.h +++ b/pimd/pim_upstream.h @@ -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;