Commit Graph

710 Commits

Author SHA1 Message Date
Donald Sharp
5cd11e3cd0 pimd: Backing up broken state.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Donald Sharp
27bc3ae3d4 pimd: Removing impossible code
We've already allocated the mp data structure
and am using hash_alloc_intern for the hash_get
function.  This will return the passed
in data structure.  There is no possibility
of mp being NULL.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Donald Sharp
deab75f73a pimd: Reduce pim oil scan timer to 50ms
We need to react to route changes/Interface up/down events
faster in PIM.  Reduce the timer down to 50ms.

Ticket:CM-13549
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Donald Sharp
0490c22d20 pimd: Start handling of wrong interface for (*,G)
When we get a callback for a specific (S,G) and
we have no ifchannel for it, see if we have a
(*,G) channel and handle it appropriately.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
anuradhak
7667c5568f pim-msdp: part-3: use SA cache for setting up SPTs
1. Added a new MSDP source reference flag for creating (S,G) entries
based on the SA-cache. The RFC recommends treating as SA like rxing
a (S, G) join (which is a bit different then treating like a traffic
stream).
2. SA-SPT is only setup if we are RP for the group and a corresponding
(*,G) exists with a non-empty OIL.
3. When an SA is moved we need to let the SPT live if it is active (this
change will come in a subsequent CL).

Testing done:
1. SA first; SPT setup whenever (*, G) comes around.
2. (*, G) first. As soon as SA is added SPT is setup.
3. (*, G) del with valid SA entries around.

Ticket: CM-13306

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Donald Sharp
46c8aab88a pimd: Add (-) PRUNE(S,G,rpt) from interface determination.
When determining the inherited_olist(S,G) add
the determination that we have received a
prune(S,G,rpt) from a neighbor.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Donald Sharp
f21597f04d pimd: Fix the test to see if a upstream is (S,G,rpt)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Donald Sharp
1405c852fc pimd: Add code to handle pim prune(S,G) with sptbit
Add some more code to handle the prune(S,G) with the
sptbit set.  Turns this ifchannel into a (S,G,rpt).

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
ce0ddb4e79 pimd: Write pim_upstream_empty_inherited_olist
A empty inherited_olist implies that we have
no outgoing interfaces.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
b72f79a92b pimd: Fix possible crash when leaving a channel
When leaving a channel, there exists a possibility
that we have not created the channel oil yet.
Ensure that we have channel oil before dereferencing

Ticket: CM-13522
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
b76d6e718e pimd: Modify downstream JP state to take into account all states
When we make a decision about downstream state let's
take into account all states.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
7f8b8a9af6 pimd: Remove unnecessary asserts
When we handle the thread arguments,
there is no need to assert.  As that
if they are wrong, we are going down
shortly anyways.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
220d8a49e6 pimd: Add Handler for Receive (*,G) join for (S,G,rpt)
According to Figure 5( Downstream per-interface (S,G,rpt)
state when we receive a (*,G) we need to move (S,G,rpt)
children of the (*,G) into different states.  This
implements that.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
53e39e140d pimd: Ensure 'struct prefix sg' is inited in right order
When we called pim_parse_addr_group, don't reinitialize
the 'struct prefix_sg' *after* we've parsed the group.

Ensure in other places that we do this work, we initialize
prior as well.

Ticket: CM-13510
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
5349cf9a09 pimd: Fix 'show ip pim join json' output
When we have multiple incoming joins for
a single group on a interface, we need to
allow proper output.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
637a61fa2b pimd: Add ability to know if ifchannel is (S,G,rpt)
Add ability to track (S,G,rpt) ifchannel prunes.
Add ability to display this data in json.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
11757d7b98 pimd: 'show ip pim join json' add by src not grp
If you add to the json by grp, if you have multiple
ifchannels for that group, on the the first one will
be displayed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
45b0c8f3cf pimd: Don't delete ifchannel if expiry timer is still running.
Don't delete the ifchannel if the expiry timer is still running.
We might need to add the prune pending timer as well?  Not sure

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
cf4ea1c4e5 pimd: use 'struct prefix_sg' for recv_join and _prune
When we read in the S,G from the join/prune message,
convert it into a 'struct prefix_sg' at an
earlier point in time.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
a7762e0765 pimd: Modify pim_parse_addr_source to use 'struct prefix_sg'
Modify the pim_parse_addr_source function to take
a 'struct prefix_sg' and to fill in the src data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
bce0e64521 pimd: Modify pim_parse_addr_group to use 'struct prefix_sg'
Modify the pim_parse_addr_group to use 'struct prefix_sg sg'.
This is the first of 2 commits to clean up this parsing to
be a bit better.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
3fdfd9433e pimd: Add ability for ifchannel *,G to know their S,G's
Add the ability for pim ifchannels *,G's to know their
corresponding S,G's.  This will facilitate handling
S,G,rpt state information better.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
1c01dbd8f8 pimd: Send prune(S,G,RPT) with (*,G) join
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
anuradhak
3c72d65495 pim-msdp: part-2: SA cache support
This commit includes -
1. Maintaining SA cache with local and remote entries.
2. Local SA entries - there are two cases where we pick up these -
   - We are RP and got a source-register from the FHR.
   - We are RP and FHR and learnt a new directly connected source on a
     DR interface.
3. Local entries are pushed to peers immediately on addition and
   periodically. An immediate push is also done when peer session is
   established.
4. Remote SA entries - from other peers in the mesh group and passed
   peer-RPF checks.
5. Remote entries are aged out. No other way to del them
   currently. In the future we may add a knob to flush entries on
   peer-down.

Testing done -
Misc topologies with CL routers plus basic interop with another vendor (
we can process their SA updates and they ours).

Sample output -
root@rp:~# vtysh -c "show ip msdp sa"
Source                     Group               RP    Uptime
33.1.1.1               239.1.1.2            local  00:02:34
33.1.1.1               239.1.1.3            local  00:02:19
44.1.1.1               239.1.1.4        100.1.3.1  00:01:12
44.1.1.1               239.1.1.5        100.1.3.1  00:00:55
root@rp:~#

Ticket: CM-13306

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
ea4a71fcf7 pimd: Store ifchannel information in a global list too.
This fix handles two issues:

1) Searching entire vrf_iflist to get per interface pim_ifchannel_list
2) Display of ifchannel information in pim not being ordered correctly.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
340bce7d35 pimd: Allow further refinement of pim join order
When a 'show ip pim join' is issued and we have
(S,G,rpt) being sent back up to us.  We need
to order correctly for this situation.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
8711a53dbc pimd: Protect some zlog_debug messages
Protect some zlog_debug messages with if(...) so we
don't see them all the time.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
fad009d288 pimd: Protect debug messages.
Protect some debug messages from being displayed always.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
ffac1326b2 pimd: Add some explanatory debugging for a error condition.
When we decide to ignore a incoming packet, allow detailed
debugging to give a pointer to where to go to understand the
issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
07d6bab3f2 pimd: Fix test for (S,G,rpt) prune inclusion.
The (S,G,rpt) prune inclusion was incorrectly considering
if the RPF' was the same for (S,G) and (*,G).

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
e5b6b22997 pimd: No need to reset uptime if state is the same
Do not reset the time the mroute has been in it's
current state if we get a transition to the same state.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
3a66b17b69 pimd: Abstract setting of the spt bit a bit more
Allow the spt bit to be set appropriately from multiple
places.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
e43b86973c pimd: Add ability to set SPTBIT on a S,G stream
Implement 4.2.2 for setting the SPT bit.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
9c5e4d6275 pimd: Start addition of timer wheel
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
d67f268e94 pimd: Start coding of sending Prune (s,g,rpt) with *,g prune.
Add logic to show that we are making decisions about
the s,g,rpt prune send.  We are not actually sending
anything yet.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
80d9c3a014 pimd: Add some helper functions.
Currently these are stubs to help debug logic.
Will be filled in as we go.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
66cc32fa0a pimd: Add the ability to test if the RPF' is the same
Test the ability to see if two RPF' are the same
or not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Daniel Walton
0afd31c92b PIM After LHR swp bounce toward rx host, igmp_source_forward_start
failure message repeats in log

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Ticket: CM-13340
2016-12-21 20:26:13 -05:00
Donald Sharp
7d1c3a085a pimd: Add ability to listen to igmp messages on 224.0.0.2
Some igmpv2 messages are sent to 224.0.0.2.  We were
not listening for these messages and as such we
were ignoring some withdrawals.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
a277fb8495 pimd: Fix 'ip igmp join ..'
When a static igmp join is issued, before routing
has come up, the ability to recover was accidently
removed from the code.

Ticket: CM-13379
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
e5009aed2f pimd: When nexthop lookup fails, back out gracefully
When the nexthop lookup fails when establishing the
upstream state as part of a register receive, kill
the upstream state.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
9244dd13db pimd: Allow FHR/RP/LHR to be one and the same
When we have a FHR/RP/LHR all on the same box, we were
experiencing a situation where we were not sending
a register stop nor where we setting the sptbit.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>

fd
2016-12-21 20:26:13 -05:00
Donald Sharp
5d84a3bc9a pimd: Modify Debug to be better
Make debugs of some pim processes easier
to interpret and understand.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
d1b64e31aa pimd: Be more careful looking up mroute statistics
When we get a request to look up the mroute statistics
from the kernel, ensure that the interface returned
is a valid usable interface.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
03417ccd6d pimd: pim upstream child list
Add the ability to keep the list of S,G's associated with
a *,G.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
anuradhak
2a333e0f22 pim-msdp: part-1 - initial protocol infra.
This commit includes the following changes -
1. Support for MSDP peer DB (hash and sorted list).
2. Support for the following timers - keepalive, connect-retry, hold.
3. TCP session management (lower-ip is active, higher-ip is passive).
4. MSDP KA packet rx/tx.
5. Limited temporary config (will be replaced with the more automation
friendly RP-set).

Testing done -
Peer bringup/deletion (including interop with another vendor)

Sample out -
root@dell-s6000-04:~# sudo vtysh -c "show ip msdp peer"
Peer                       Local        Mesh-group        State Uptime
100.1.1.1              100.1.2.1           default  established 00:07:27
100.1.3.1              100.1.2.1           default  established 00:31:50
root@dell-s6000-04:~#

Coming soon -
1. part-2: SA cache management.
2. part-3: SPT setup using source in SA cache.
3. part-4: CLI cleanup.

Ticket: CM-13306

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
06afa136e9 pimd: Fix gcc compile issue.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
f99df3e77a pimd: Pass in upstream to pim_msg_join_prune_encode.
Pass in the upstream data structure to pim_msg_join_prune_encode
so it can decide to send (S,G,rpt) information if it wants to or
not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
8b9c900bd1 pimd: Remove unused/unmaintained test commands
The test commands are not being maintained and
are not out of date with the rest of the system.  There
are better ways to test code and in addition these
commands if entered by a user could seriously impact
their running system.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
372eab92a2 pimd: Convert pim_joinprune_send to receive upstream
When sending a join/prune send in the upstream pointer.
this will allow us to implement some of the other state
machines necessary.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
7f748d9586 pimd: When nexthop_lookup fails allow a retry.
We are seeing situations where nexthop lookups are failing
unexpectedly.  Don't consider the lookup to have succeeded
in this case to allow the next lookup to work?

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
df90067aac pimd: Ignore (S,G) Prunes with no current state
If we get a (S,G) Prune with no current ifchannel state, ignore
the neighbors request.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
9f0edbc93c pimd: Find an interface that is both connected and setup for pim
When we are looking up the incoming interface for the ipmr
call back socket from the kernel, look to see if the src
is connected as well as has a valid pim_ifp to use.

This is to allow vrr configuration in a mlag env.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
be4791f257 pimd: Start (S,G,rpt) coding
Start putting some infrastructure for (S,G,rpt) handling

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
cb24fec45c pimd: Clean up the interface deletion
When cleaning up the interface, actually clean up
data associated with that interface.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
f4075cb472 pimd: Make sure we have valid pointer when printing debugs
When we print a debug in the pim_upstream_add, there
exists failure cases for pim_upstream_new where
we cannot create a upstream data structure.  Make
sure the debug handles it right.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
580d761266 pimd: Fix possible crash using 'struct pim_nexthop'
When passing in a nexthop data structure to nexthop_lookup
ensure that it is zero'ed out.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
f89022af53 pimd: Ensure 'struct nexthop' has been zeroed
When calling nexthop_lookup, the code assumes
that the nexthop passed in has been 0'ed out.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
02e5bd7294 pimd: Fix crash when cannot find igmp
When we look up a igmp data structure, if we
don't find it, safely do nothing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
e71bf8f7bd pimd: Add basic nexthop lookup cached information.
Cache the last time we looked up the nexthop for this particular
address.  Store time to usec accuracy.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
8a9bd91cd9 pimd: Add the ability to get time in usec
Add ability to return a int64_t time in usec.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
e5905a3bc3 pimd: Fix possible double free of upstream
Fix possible double free of upstream and in
addition add some debug code to help find
where the problem is coming from.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
3506072736 pimd: Fix crash when igmp message comes in on non-configured interface
When we receive a igmp message through the kernel upcall, make
sure that we are configured to work on that interface via pim/igmp
before attempting to use that interface.

Ticket: CM-13338
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
7c4002dd3e pimd: Fix child ifchannel overwrite parent ifchannel
When we look for child channels, don't overwrite the
parents ifchannel.  Leave that one alone.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Daniel Walton
7e14782362 pimd: always build json for show commands
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

This cleans up the following so that they always collect the data to
display in json structures and then either dumps the json output or
traverses it to produce the non-json output.

  show ip pim local-membership
  show ip pim interface
2016-12-21 20:26:12 -05:00
Donald Sharp
518e5727b4 pimd: Fix pim_nexthop_lookup
There are situations where we may never look at a better
route for nexthop_lookup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
a447fa9649 pimd: Fix uninitialized value
When handling a igmp request, fill in group address before
we attempt to output debug information on it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
594a78cc8a pimd: Add interface to ifchannel debugs
When outputting data about ifchannels due to debug
include the interface this is happening on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
bebc7290cd pimd: Add debug for packet stats
Allow us to figure out what is going wrong in some
situations, so add some debugs.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
1be8f9d323 pimd: Fix ifchannel being left around
In some situations, the deletion of the ifchannel would
not ocurr if the last flag cleared was the assert flag.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
0da1854cee pimd: Fix show of 'ip pim rp keep-alive-timer
When displaying this changed value, we were
using an incorrect data value.

Signed-off-by: Donald Sharpd <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Daniel Walton
eaa54bdb67 pimd: replace grp_str[100] with grp_str[INET_ADDRSTRLEN]
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Daniel Walton
b05b72e80b pimd: add support for IGMPv2
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Ticket: CM-7962
2016-12-21 20:26:11 -05:00
Donald Sharp
eb7a976a9d pimd: Allow debugs entered in conf t mode to persist
When entering debug commands under 'conf t' mode
allow the debugs to be saved for future fun and
adventure.

Ticket: CM-13213
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
b1d15e151a pimd: Allow mroute to return if incoming interface comes back
If the incoming interface comes back, reinstall the channel oil
if the mroute is not installed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
040d86ade7 pimd: Create channel_oil hash for quicker lookup
When looking up the channel_oil use a hash
to find it.  Keep the list around for quick
walks of the channel oils.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
0f58898971 pimd: Add hash lookups for upstream 2016-12-21 20:26:11 -05:00
Donald Sharp
5ce794664d pimd: Only delete on KAT when created by stream
When we have pim_mroute.c or pim_register.c create
the upstream state, only delete it then when
the KAT timer expires, else we will not have
the refcount right and we will do bad things.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
eab2a32717 pimd: Fix message size read from kernel
When we read data from the kernel allow for
larger packet sizes to be sent to us.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
5b668dd747 pimd: Fix LHR both a receiver and a sender
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
19e550954b pimd: Allow bigger packet sizes when receiving callbacks.
When receiving callbacks from the kernel allow bigger
packet sizes than 3k to be handled appropriately.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
8ccbc80f01 pimd: Fix crash when looking at S,G from *,G
When looping over S,G's associated with a *,G,
there can exist situations where we have not created
the channel oil for the S,G yet.  Don't allow this
to crash the system.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Daniel Walton
8151e2865c pimd: 'sh ip pim int' showed local IP as the DR
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Daniel Walton
17b52be189 pimd: use JSON_C_TO_STRING_PRETTY everywhere
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Daniel Walton
72b39b9ec5 pimd: 'show ip pim state json' use JSON_C_TO_STRING_PRETTY
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Ticket: CM-11812
2016-12-21 20:26:11 -05:00
Daniel Walton
31a21c9cd1 pimd: initial "show ip pim state"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Ticket: CM-11812

superm-redxp-05# show ip pim state

Source           Group            IIF    OIL
20.0.13.253      230.10.10.1      br1    swp1
20.0.13.253      230.20.20.1      br1
0.0.0.0          230.40.40.1      swp1   br1
0.0.0.0          230.42.42.1      swp1   br1
0.0.0.0          230.42.43.1      swp1   br1

superm-redxp-05#
superm-redxp-05# show ip pim state 20.0.13.253

Source           Group            IIF    OIL
20.0.13.253      230.10.10.1      br1    swp1
20.0.13.253      230.20.20.1      br1

superm-redxp-05# show ip pim state 20.0.13.253 230.10.10.1

Source           Group            IIF    OIL
20.0.13.253      230.10.10.1      br1    swp1

superm-redxp-05#
superm-redxp-05# show ip pim state 230.40.40.1

Source           Group            IIF    OIL
0.0.0.0          230.40.40.1      swp1   br1

superm-redxp-05# show ip pim state 230.40.40.1 json
{
  "230.40.40.1":{
    "0.0.0.0":{
      "swp1":{
        "br1":{
          "source":"0.0.0.0",
          "group":"230.40.40.1",
          "inboundInterface":"swp1",
          "outboundInterface":"br1"
        }
      }
    }
  }
}
superm-redxp-05#
2016-12-21 20:26:10 -05:00
Donald Sharp
c0a06968b2 pimd: Print '*' for INADDR_ANY
When INADDR_ANY is sent to the pim dump function, return "*"

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Daniel Walton
bbd64ce1e7 pimd: sort pim_ifchannel_list
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Daniel Walton
0d4f730c58 pimd: sort qpim_channel_oil_list and qpim_upstream_list
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

This allows "show ip mroute" and "show ip pim upstream" to display the
groups in order.
2016-12-21 20:26:10 -05:00
Donald Sharp
98906696cf pimd: Add debug wrapping around rp nexthop lookup
When looking up the RP only print debugs when
debugging is turned on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Daniel Walton
9b91bb50f8 pimd: Added json to 'show ip igmp group'
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

root@superm-redxp-05[quagga-pim]# vtysh -c 'show ip igmp group'
Interface Address         Group           Mode Timer    Srcs V Uptime
br1       20.0.13.1       230.40.40.1     EXCL 00:03:24    1 3 00:01:28
root@superm-redxp-05[quagga-pim]#
root@superm-redxp-05[quagga-pim]#
root@superm-redxp-05[quagga-pim]# vtysh -c 'show ip igmp group json' |
python -m json.tool
{
    "br1": {
        "230.40.40.1": {
            "group": "230.40.40.1",
            "mode": "EXCLUDE",
            "source": "20.0.13.1",
            "sourcesCount": 1,
            "timer": "00:03:23",
            "uptime": "00:01:30",
            "version": 3
        },
        "address": "20.0.13.1",
        "flagBroadcast": true,
        "flagMulticast": true,
        "index": 96,
        "lanDelayEnabled": true,
        "name": "br1",
        "state": "up"
    }
}
root@superm-redxp-05[quagga-pim]#
2016-12-21 20:26:10 -05:00
Donald Sharp
c7b1183fc7 pimd: Don't ask for information when you are notgoing to get an answer
When we have intentionally not installed a mroute( for whatever
reason ), do not ask for information about that mroute from the
kernel when it happens.

Ticket: CM-12986
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
9a5aa7429f pimd,zebra: Pass back error message if received
When zebra asks for mroute information let pim
know that the request failed or succeeded.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
5f8fec8728 lib, pimd: Modify writen to retry on certain failures
When writen fails, allow itto retry on certain failures
until it succeeds.

Ticket: CM-12986
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
05ca4827a6 pimd: Remove some more unprotected warnings/debugs
Pim is outputting a bunch of unprotected debugs.
In a system with a high # of events even with
no logging we will receive lots of messages.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
eccf56d20e pimd: Fix 'show ip mroute count'
Add the lastused data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
5f0336ed02 pimd: Fixup to use new lastused
The kernel now reports lastused as the time in hz since
we last saw any packets.  So let's start tracking it
that way.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
f59a8217d1 pimd: Fixup pim mroute output
Cleanup the 'show ip mroute' command to be a bit
more minimalistic.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
16b7259142 pimd: Track upstream state a bit better.
Track the upstream state if we are adding
a new state to a pre-existing upstream.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
88d6652ede pimd: When sending a register stop don't need a nbr
When you send a register stop it is not necessary to
have a neighbor out the choosen interface.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
905d48fa7e pimd: Stop join/prunes from crashing
When we receive a join/prune for a upstream
that we are unable to create, safely ignore
the request until the situation resolves itself.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
8971ccb29d pimd: Allow igmp query to go out immediately on startup
When starting up allow the 1st query to go out immediately,
well ok 1 second, and then the next queries to go out in
query_interval/4 seconds until startup mode is finished.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
7ef6604658 pimd: Do not send register stop in some cases
When we are disabling pim, there exists some
race conditions where we are attempting
to send a register stop out a interface that
is not setup for pim yet.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
4a40c37aa4 pimd: Further work to fix rpf lookups and nbrs
When we do a RPF lookup return a path that we have
neighbors for in those cases where we need to have
a neighbor to pass along the SG state via a pim
join/prune message.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
a6dc7de682 pimd: Add debug messages as to why a register packet is rejected.
When we reject a register message from someone, give some reasoning
as to the why of it being rejected to help in debugging the situation.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Daniel Walton
91c6aec45f pimd: "show ip mroute" skips entries without an OIF
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

The entry for 230.10.10.4 was not being displayed

root@superm-redxp-05[pimd]# ip mroute show
(20.0.13.253, 230.10.10.4)       Iif: br1
(20.0.13.253, 230.10.10.1)       Iif: br1        Oifs: swp1
root@superm-redxp-05[pimd]#

root@superm-redxp-05[pimd]#
root@superm-redxp-05[pimd]# vtysh -c 'show ip mroute'
Proto: I=IGMP P=PIM S=STATIC O=SOURCE

Source          Group           Proto Input iVifI Output oVifI TTL Uptime
20.0.13.253     230.10.10.1     P     br1       1 swp1       2   1 00:01:09
20.0.13.253     230.10.10.4     P     br1       1 none       0   0 --:--:--
root@superm-redxp-05[pimd]#
2016-12-21 20:26:10 -05:00
Daniel Walton
b3fb2c27cd pimd: JSON support for "show ip mroute"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Ticket: CM-12876

root@superm-redxp-05[pimd]# vtysh -c 'show ip mroute json' | pjson
{
  "230.10.10.1": {
    "20.0.13.253": {
      "br1": {
        "swp1": {
          "group": "230.10.10.1",
          "iVifI": 1,
          "inboundInterface": "br1",
          "oVifI": 2,
          "outboundInterface": "swp1",
          "protocolPim": true,
          "source": "20.0.13.253",
          "ttl": 1,
          "upTime": "00:02:37"
        }
      }
    }
  },
  "230.10.10.4": {
    "20.0.13.253": {
      "br1": {}
    }
  }
}
root@superm-redxp-05[pimd]#
2016-12-21 20:26:09 -05:00
Daniel Walton
e775c0a432 pimd: json support for "show ip pim" commands
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Ticket: CM-12865
2016-12-21 20:26:09 -05:00
Daniel Walton
9c2df635f5 pimd: show ip pim int WORD, show ip pim nei WORD, show ip igmp int WORD
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Ticket: CM-11812
2016-12-21 20:26:09 -05:00
Donald Sharp
02eccbc738 pimd: Turn off neighbor lookup for the moment
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Daniel Walton
a268493f6b pimd: show ip pim int WORD, show ip pim nei WORD, show ip igmp int WORD
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Ticket: CM-11812
2016-12-21 20:26:09 -05:00
Donald Sharp
ca973133ec pimd: Bad Bit shifts
I programmed the bit shifts improperly.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
63b8f7a35e pimd: Rework approach for needing nbrs
Pim sometimes needs the upstream rpf lookup to
only take into account if we have a nbr out
the selected interface or not.  Move
the code for this to a better spot so
we can make a more intelligent decision
here.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
690324215e pimd: Allow loopbacks to resolve
When doing a rpf check ensure that
if we've considered the RP to be a loopback
allow there to be no neighbor on the other
side.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
e446de6a16 pimd: Resolve rp after neighbor come up
When a neighbor comes up, see if we suddenly
have a path to the RP.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
d8ba2f4a30 pimd: Only use paths that we have nbrs on
When looking up nexthops for a path, we
should only allow nexthops that we
actually have neighbors formed for.  Otherwise
when we send join/prune messages they will
do nothing.

Ticket:CM-12754
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
6971955465 pimd: Don't assert when looking up a neighbor
Do not assert when looking up a neighbor, we don't know
if we have a neighbor don't punish us.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
d4a2bc11ad pimd, zebra: Pass the ifindex for NEXTHOP_TYPE_IPV4
NEXTHOP_TYPE_IPV4 has the ifindex of the route.  Pass it
along so the other side can use it if it is needed.

This will make pim much happier in that we will need to do less
recursive lookups.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
7b2c4d167e pimd: Use MULTIPATH_NUM for maxpaths
When looking up nexthops for a address, just
use the MULTIPATH_NUM as the number allowed
to receive instead of an arbitrary limit of 20 paths.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Daniel Walton
9bf3c63317 PIM: json support for "show ip pim" commands
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-12865
2016-12-21 20:26:09 -05:00
Daniel Walton
dfe43e25d8 PIM: prefix-list support for selecting RP
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   CCR-5173

Ticket: CM-12819
2016-12-21 20:26:09 -05:00
Donald Sharp
a9b5987989 pimd: Start noticing where upstream state came from
We need the ability to know where upstream state
comes from and to do the right thing from there.

ticket: CM-12771
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
1d3a62cdce pimd: Add some additional upstream sources
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
0bf27c5c4c 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 <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
69ff3706d4 pimd: Allow flags to know if this is a FHR or not
Start the switch of storing if the upstream (S,G) is located
on the FHR or not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
80219b763a pimd: Vif is not created in some startup conditions
When rebooting a switch, if under unnumbered config
there exists a situation where some interfaces
may not create the vif in the kernel.

Ticket: CM-12830
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
f3f0c4f8cc pimd: Startup does not need to assert
When pim starts up there is no need to assert in pim_init
if state is not set as wanted.  Especially for qpim_debugs
as that I would like to turn on debugs before we even start
doing anything in the code.

As for the PIM_MROUTE_IS_ENABLED, the variable is set
right above it, so no need to assert on it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Donald Sharp
29444f8fee pimd: Fix high cpu load of pim when interface goes down
When a interface goes down we accidently put ourselves into
an infinite loop.

Ticket: CM-12803
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:09 -05:00
Daniel Walton
44a13ae330 Unable to remove route-map from quagga
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-12816

pim was missing route-map hooks

(cherry picked from commit 28b0c6b377)

Conflicts:
	pimd/pimd.c
2016-12-21 20:26:09 -05:00
Donald Sharp
111285870d pimd: Add some MSDP infrastructure
Add some very basic MSDP infrastructure to pim.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
4a4c0d0c55 pimd: Fix unguarded log message
In pim_rpf.c when we receive multiple paths for the
rpf we are complaining that we are not sure what
to do with it yet.  Change the _info to _debug
and don't print out unless we are debugging
stuff.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
12c7b75bce pimd, zebra: Allow v6 based nexthops to work in pim
When we get a v6 address/ifindex combo back from
a v4 lookup.  Check to see if the outgoing
interface only has one neighbor and if so
use that neighbors loopback address as
the route to use.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
99deb321fc pimd: Add the ability to lookup neighbor on a interface
On a specified interface return the single
neighbor on that interface.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
d8424057d9 pimd: Allow ip address selection for BGP unnumbered
When a interface is configured as BGP unnumbered, it
has a v6 LL address as well as no v4 addresses.  In
this case let's look at the lo's ip address as the
primary address to use.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>

rebase
2016-12-21 20:26:08 -05:00
Donald Sharp
c305ed63eb pimd: Allow breaking up of packet.
When a packet is too large to send in one go, break it up.

Ticket: CM-12768
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
60ce8d9b4c pimd: Fix display of rp information in 'show run'
The recent conversion of in_addr_t to struct prefix
caused a display issue in the 'show run' of the rp.

Ticket: CM-12752
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
89f1d91ecc pimd: Refactor pim_find_primary_addr
The pim_find_primary_addr function just called 1 static function
that was called no where else.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
fb5d6e2f41 pimd: Fix SA warning
Restructure code to remove SA warning from clang build.

For some reason, the Clang SA system thought that si.sin_port and
si.sin_addr where not being set to anything.  Fix this problem.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
fa8da98c26 pimd: Fix up rp initialization breakage
When I converted over to using 'struct prefix'
I broke the initialization of the rp.

In addition, I used the wrong AFI type
to switch on in pim_rpf.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
f971788666 pimd: Fix compile error on some platforms.
Fix the failure to build vtysh information for pim
on some platforms.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
63c59d0c9a pimd: switch pim_rpf.h to use 'struct prefix' for address
mrib_nexthop_addr and rpf_addr should be 'struct prefix'
so that we can safely handle unnumbered data from a nexthop
lookup in zebra

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
0252d82d06 pimd: Use Quagga as official bug report place
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
bfea315d4f pimd: Move rpf code into pim_rpf.h
The pim_rpf code needs to be in pim_rpf.h as that it belongs in there.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
ba634917bd pimd: Switch 'struct in_addr' to 'struct prefix' in pim_zlookup.h
This is setup code to allow us to receive v6 addresses from
a nexthop lookup from zebra.  This will allow us to work
with unnumbered interfaces.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
e66dd14ae4 pimd: Add pim_addr_dump to facilitate v4 and v6 address dumping
Allow pim_addr_dump to understand prefixes to print out.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
84a35fdf06 pimd: Fix duplicate code in zlookup
In the nexthop lookup routine, fix the duplicate code
to not check for too many indexes earlier.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
21391ed8d8 pimd: Allow interfaces to be unnumbered.
Specify the ifindex of the interface that we want
to turn on IP_MULTICAST_IF on instead of the
address.  If we pass in the address then the
fact that we have multiple interfaces with the
same ip address causes confusion in the kernel.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
5f6f65b14c pimd: Fix creation of channel oil to happen 1st.
This has 2 fixes:

On nocache event, crate the channel oil first in
case we don't need to actually create the upstream
information

on wrvifwhole, create the channel oil and install
it, then only create the upstream information
if we are connected to the source.

Ticket: CM-12593
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
e8e277d564 pimd: Allow larger range for KAT(S,G)
Allow the KAT(S,G) time be set to up to 60000
seconds.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
d3dd180406 pimd: trigger on nbr up to look at rpf cache
If a neighbor comes up *after* igmp joins and *after* all
the routes are installed into the kernel, then we never
go back and fix up the rpf cache information.  So joins
never go out for those igmp joins.

Ticket: CM-12613
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
ff67a92351 pimd: Fix debugs to be more logical
The rpf debugs really should be zebra debugs
instead of trace debugs.

Additionally fix a return 0; to return NULL;

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:08 -05:00
Donald Sharp
483eef9dd2 pimd: Further refinement of switch on a stick
The original modification to allow the RP to receive
packets on the incoming interface when it has
no outgoing interfaces was a bit aggressive and
turned all register events into a join event.

This further divides up the code to do the
right thing in each situation.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
284b4301e4 pimd: Track the # of times we ask for nexthp information
Keep an idea of how many times we are asking zebra
for nexthop information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
60dbe1a15a pimd: Remove unprotected debug log
Upon receiving *,G joins from downstream we were outputing
a unprotected debug.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
da55afba15 pimd: Another null pointer dereference
When starting up with a large # of streams
it is possible to have a timing where we
do not yet have a pim_ifp.

Ticket: CM-12636
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
3f07087b69 pimd: Do not crash when attempting to install a mroute.
When installing a mroute on rpf change make sure
that we have oil for it at this time.

Ticket: CM-12636
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
dce1a92f31 pimd: Do not display placeholder for 'show ip pim rp-info'
do not display the 224.0.0.0/4 rp information if none-have
been provided.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
75395e6a32 pimd: Fix crash in channel_oil_add_oif
Remove assert, warn user that there is a
problem and move on.

Ticket: CM-12614
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
c8507a1624 pimd: Turn on forwarding for a late added interface.
If we receive a join for a upstream interface that hasn't
yet been added to pim for working under it, we never
go back and add the forwarding on when we get the
interface added to pim.

Ticket: CM-11800
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
8d63c2d932 pimd: Fix unwrappered debug message
When checking with zebra about lastused we were not
protecting a debug message.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
eb345962ce pimd: Do not send join out loopback interfaces
When we the join timer pops for a interface
don't send the join out a loopback interface.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
359175704f pimd: Fix crash with interface not configed under pim.
When the RP's address in PIM is not under the loopback,
we can have a situation where this causes PIM to crash.
Check for NULL pointers.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
6abb1fc25f pimd: Fix double close of socket.
When a interface bounces fix the double close from happening

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
00d07c6fda pimd: Add "show ip pim rp-info" command
List the RP information we have configured.

Fix bug where we were not properly initializing some code

Ticket: CM-12617
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
bb6e291f3b pimd: Fix bad state no FHR after quagga restart
If on the FHR we have an established stream between
interested parties and we stop the stream and restart
quagga we were not coming back up into the correct
state.  For the multicast stream.

Ticket: CM-12462
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
4e85d20983 pimd: Fix crash on RP.
When register stop was received but the upstream
creation fails we are not handling it properly.
Note and return.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
3565202d74 pimd: Move pim_mroute_connected_to_source to pim_iface.c
Move the pim_mroute_conected_to_source function to pim_iface.c
because this is a interface question not a mroute question.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
51e828334e pimd: On RP Allow no output interfaces
On the RP when we receive a register packet for the
same interface that we received the *,G join on
allow the RP to receive the packets but to do
nothing with them.

Additionally check the last_used values even
if the ioctl fails.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
4df01a4e66 pimd: Fix pim to use correct src address for packets
When sending register packets to the RP from the FHR
we should be using the ip address of the incoming interface
that received the mcast packet.

Ticket: CM-12445
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
7747bad6ac pimd: Fix RP upstream Prune -> join state
This fix allows the RP to transition from a Prune'd to Join
state on reception of proper control messages.

Additionally it was noticed on if down -> if up transitions
the prune then join message was going out the wrong interface.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
f24405b1e8 pimd - Fix rpf lookup to what it was originally
I tried to be smart and skirt around rpf lookup if I knew
the incoming interface.  This turns out to be not necessarily
a good thing because we can easily have asymetrical routing.

This fix removes the attempt to cache the ifp we received
the incoming packet on and just lets the lookup work like
it should.

Additionally it removes the weird hardcoding of the rpf
interface from the register stuff.

Ticket: CM-12530
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>

reb
2016-12-21 20:26:07 -05:00
Donald Sharp
7fe1f66279 pimd: When deleting upstream double ensure route is removed
Ensure that when an upstream is removed that we actually
remove the route

Also when we get a callback for whole packet before
we send a register stop make sure we are actually on the
RP.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
04329d4e49 pimd: Fix join received when in Prune or Prune Pending
When we are a FHR, and the upstream state is in Prune or Prune Pending
allow the join because we know we want to forward traffic to the RP.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:07 -05:00
Donald Sharp
c980295412 pimd: Modify pim_upstream_state2str for more usage
Just pass in the actual state to allow us to translate
the state to a string even if we don't have a upstream.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
d5ed8a9cd1 pimd: Fix debug to properly display state
We should display the state the upstream is instead of
the number of the state.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
fa6a18f1c8 pimd: Change RPF cache refresh time to 2 seconds
10 second delay is a bit too long.  Let's crank it down a bit
and see what happens.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
01408ede34 pimd: Allow rp to configure it's keep alive timer
Allow the end user to supply a RP based keep alive
timer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
d854589aba pimd: When the Keep Alive timer Pops Stop timers
When the Keep alive timer Pops stop the timer
and send a prune upstream if we need to
remove the state.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
4304f95c86 pimd: Allow keep alive timer configuration
Allow the user to specify the time to wait
for a keep alive to happen.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
00d2f9e45b pimd: Fix RP handling of Register message
The RP needs to send the join when we want to send it

Also make sure the ka_timer is reset properly.

Ticket: CM-12473
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
bb027ee881 pimd: Fix register stop behavior
Register stop was not being sent on a consistent basis.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
6c7197b142 pimd: Add 'debug mroute detail'
When there is allot of IGMP activity for the
kernel upcall that we are ignoring, just
ignore it for the moment as well.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
34fe48e7de pimd: Restarting Quagga sometimes lost mroutes
When on a intermediate switch between the FHR and RP
when Quagga is restarted. Pimd is coming up so fast
and getting the S,G join before networking is properly
working on the switch.  We would never install the
mroute in this case.

What was happening is that the scan of the S,G was
occurring and we were figuring out who we should talk
to but we were never installing the route for it.

Notice that we've never installed the route and install it
if the mroute has changed.

Ticket: CM-12460
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
8f547471df pimd: Fix typo in debug message
The debug message was wrong.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
30df5c100e pimd: Use correct function to delete upstream information
When the keep alive timer finds that we are no longer
sending packets for that particular S,G, remove
the upstream information but use the function that
makes sure we check the ref count.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
e3be04328f lib, pimd, zebra: Allow pimd to ask the kernel about mroute info
When we need to lookup the mroute info for a route.  Allow
pimd to ask the kernel.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
dfbbce1dce pimd: Fix igmp(*,G) not influencing S,G mroutes
When we receive a (*,G) route decide if we
need to cause any output interfaces to be
added to any S,G route associated.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
4712642e11 pimd: Set spt bit when we receive first packet on RP
When on the RP, if we receive the first correctly routed
mroute from upstream, Set the SPT bit so that the
state machine will work properly.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
79ce47c00d pimd: Fix register stop timer
1) Ensure Timer is actually off
2) I missread the rfc, when we are in prune state, just send the
register stop.  Do not add the tunnel device yet.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
8e38a2cfcc pimd: Fix RP shenanigans
The RP was not properly handling the series of events:

1) When a WRVIFWHOLE is received if we are the RP,
send a pim register stop to the FHR.

2) When a register was received we were sending
a join (S,G) towards the S, then a immediate prune (S,G)
followed by another join (S,G).  Just send the first join

3) Save whom we received the S,G register from so we
can use it later

4) Allow a join timer to restart itself instead
of causing a crash.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
05b0d0d0ec pimd: Properly isolate zlookup
The qpim_zclient_lookup was a global variable.
This is not needed.  Isolate appropriately

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
f0ce50d470 pimd: Remove some impossible error conditions.
It is impossible that we can hit these error conditions.
Remove them from the code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
08e1fe769b pimd: Add WRVIFWHOLE callback.
Naive implementation of the WRVIFWHOLE callback
from the kernel.

signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
c29a58063b pimd: Don't pass in src_str and grp_str
Allow sub functions to call pim_str_sg_dump as
appropriate

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
14315ea899 pimd: Allow RP to clear based upon KAT(S,G)
When the KAT(S,G) pops, allow the RP to clear the
mroute.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
2ecb76d375 pimd: Add the display of the Keep Alive Timer for upstream
Add the ability to see the Keep Alive timer for
upstream information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
469c6aa265 pimd: Fix another SA issue
pim_zebra.c was checking to see if a ifp pointer was null
in some debug statements.  This caused the SA code
to assume that if we were at this point then the ifp
could be null and subsuquent code that doesn't check
for it to be wrong.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
0bc327f7b4 pimd: Fix some SA issues
SA found these two issues:
1) Check of ifp non-null caused other non-checks down code
to assume ifp could be null.  This is not the case.
If we get a callback at this point we must have a valid ifp pointer.

2) We were inadvertently calling igmp_source_reset_gmi with
a possible NULL source pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
a878ba4572 pimd: Some SA analysis fixes.
This commit addresses some SA issues found:

1) double set variables
2) value set but never used.
3) wrong return path used.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
1148de0adb pimd: Send hello immediately with receive of new genid
When we receive a new genid from a neighbor, we need
to form the neigbhor relationship before the join/prune
messages are sent to the neighbor.

Additionally we were calling the
pim_upstream_rpf_genid_changed function 2 times
in a row.  This function just spun throught the upstream
list and marked all relevant upstreams to be sent
immediately

Ticket:CM-11979
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
36d6bd7d34 pimd: multiple rp commands
Allow the user to specify multiple rp commands.

'ip pim rp A.B.C.D'   -> translates to 'ip pim rp A.G.C.D 224.0.0.0/24'
ip pim rp A.B.C.D A.B.C.D/M
  First is the rp, second is the group with mask.

Groups and masks cannot be over each other except 224.0.0.0/24 which
is the fallback if used.

Ticket: CM-7860
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
75a26779e8 pimd: Refactor RP code and start the ability to handle ranges
Refactor the qpim_rp into pim_rp.c so that the global data
is protected.  This will allow us to easily add the group
ranges.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
dc686f820b 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 <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
7a3ddda53f pimd: Fix join_desired for (*,G) states
When we are evaluating if we have a inherited_olist, include
the *,G state in determing what to do.

Additionally when we receive a join or prune of *,G
do the right thing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
6029d31f7c pimd: Was removing the wrong channel.
When receiving a prune (*,G), we were removing
from the wrong channel.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
872439346d pimd: Enable WrongVif and WRWHOLEVIF callbacks.
Turn on Wrong Vif and Whole packet wrong vif callbacks.

Signed-off-by: Donald Sharp <sharpd@cumuusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
02e6923ef3 pimd: Fix broken build
I missed 2 instances of the conversion from struct prefix
to struct prefix_sg

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
4ed0af7013 lib, pimd: Fix borked up prefix code
Fix the struct prefix to be an actual struct prefix_sg.
This cleans up a bunch of code to make it look nicer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
ad6ec47b81 pimd: Add rs_timer display
For the 'show ip pim upstream' command addd the RSTimer to the display

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
81900c5a08 pimd: Fix upstream state machine.
RFC 4601 4.5.7:
Joined
      The downstream state machines and local membership information
      indicate that the router should join the shortest-path tree for
      this (S,G).

The code has a upstream state that is in 'J' state already
due to a S,G multicast packet received on an incoming
interface.  This packet has been forwarded to the RP.
The RP sees this and immediately sends a join towards
the S,G.

The code as originally written assumed that you could
not transition from a J state to a J state.  This is not
true.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
d41b415c8b pimd: Change packet debug to pim register specific debug
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:05 -05:00
Donald Sharp
9add3b8812 pimd: Add ability to debug pim Register packets
Allow the user to specify the ability to debug
pim register packets.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
facebf0509 pimd: Remove Wrong PIMREG ifchannel state
The PIMREG ifchannel state is an evolutionary dead-end.
I should not have introduced this code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
8a294fa2e4 pimd: Make the NOCACHE just set the regiface to the coil
When we receive a NOCACHE upcall, add the pimreg interface
to the oil so that we can receive the data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
fa1a4e366b pimd: Send join when a S,G is pruned
When a *,G is received, and we have S,G that is in a
non-joined state, Send the join to the S,G.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
cfa91a8733 pimd: Add upstream children finding
When we receive a *,g find all S,G that
are related and set pointer appropriately

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
2a05c94c91 pimd: Add Local Genid to 'show ip pim hello'
Display the local idea of what the Genid is

Ticket: CM-11980
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
0365f56bd0 pimd: Allow the kernel to forward encap'ed packets for us
When we get a pim register allow the kernel to forward the
saved packets.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
a459fe85c8 pimd: igmpv3.c was causing prune/join messages to be sent
We were erroneously sending a prune *,G immediately followed
by a join *,G under certain situations

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
3667b0bcf6 pimd: change from ifchannels to oil's
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
13376be4f2 pimd: More macro fallout fix.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
ae4cf53f49 pimd: Fix pim_macro downstream_jpstate
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
c8fa5a1e4f pimd: Create storage for a raw socket.
Each interface needs the ability to send raw packets
at the RP.  Create the data structure to do so.
Further commits will create the socket as necessary
and send the packet.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
978d48a9fe pimd: Fix DownstreamJPState(S,G,I) check.
Fix the
DownStreamJPState(S,G,I) and
DownStreamJPState(*,G,I) macros.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
1a10fc742f pimd: Allow ifchannel S,G's to know their *,G parent
Given a S,G ifchannel, create a parent pointer for any
*,G state for that interface.  When removing a *,G
remove S,G pointers.

We need to think about the case where their is a *,G
but no S,G for a interface when we are determing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
6997705858 pimd: pim_str_sg_dump can't be called 2 times in the same debug
When we call pim_str_sg_dump we cannot call the variable twice
for the same debug.  This fixes this issue in the 2 places it
was borked.

Ticket: CM-12045
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
035f28f683 pimd: Fix *,g pruning
We were not properly handling the receipt of prune *,g messages.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
31c680fc88 pimd: Infrastructure to forward packet down (*,G) tree
When a register is received, forward the packet as appropriate.
This is the infrastructure to make this happen.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
13afbd05fd pimd: Create raw socket for register packets to be forwarded.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
728cd66300 pimd: Create pim_socket_bind
Allow a socket to be bound to a specified
interface.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
346cffe31e pimd: Revamp send of join/prune to actually set bits right.
When a *,G report is sent, the RPT and WC bits
are set as well as the source is the RP address
for the group.

If this routers idea of the RP for this group is
different than the idea of the RP from the sender
than that particular *,G can be dropped.

Ticket: CM-12031
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
984c84f486 pimd: Start abstraction for WC and RPT bits
Start the abstraction of the WC and RPT bits
so we can send the data as appropriate.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
7293a05356 pimd: Fixup pim_oil interface to be a bit more consistent.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:04 -05:00
Donald Sharp
4d99418beb pimd: Find the parent on newly created upstream's
When we create a new upstream data structure find the parent.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
630f76b6f1 pimd: Make kernel upcalls PIM_DEBUG_MROUTE
The kernel upcalls for control messages should
be PIM_DEBUG_MROUTE instead of PIM_DEBUG_PIM_TRACE

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
4950938e0c pimd: Fix Join/Prune logging
For some reason Join/Prune debugs were being
turned on by trace not by the 'debug pim packets join'
command.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
c823065de9 pimd: Add some 'show debug pim' output
Add some missing 'show debug pim' output so that I can
see what I think I'm debugging.

In general the pim debugs need another round of fixing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
216bb84fd5 pimd: Some bug fixes for the register receive code path
When we receive a register receive handle it a bit
better.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
6c62910301 pimd: Allow (*,G) joins to join a (s,g) that pre-exists
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
219e00134c pimd: Add code to handle the inheritance for (s,g)
Add code to handle the inheritance and to send the
join upstream as appropriate.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
7e0cff2f98 pimd: Remove unnecessary QuaggaId
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
4fdc8f3630 pimd: start fix of inherited_olist
We were not correctly determing the inherited olist and
applying it to the s,g.

Start the work to do this.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
7a60249e36 pimd: Stop leaving pim_register_recv early
When we received a pim_register_recv we were shortcutting
the algorithm to determine what to do when we receive
a register pim message.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
a3b58b4a14 pimd: Fix _find and switch_to_spt_desired.
The pim_upstream_find function should not be finding a *,G
Find what is asked of it.

The switch_to_spt_desired should return true on the RP currently.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
65e1fcd766 pimd: pim_br switch to struct prefix
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
ad410c6c7b pimd: SwitchToSptDesired now uses struct prefix *sg.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
01d45d04a3 pimd: More conversion of struct prefix *sg
Some more conversion to use struct prefix *sg in pim_ifchannel.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
1103466bb3 pimd: Convert pim_ifchannel_local_membership_del to struct prefix *sg
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
6928363995 pimd: convert pim_ifchannel_local_membership_add to use struct prefix sg
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
7bd2c6fa0a pimd: Convert pim_ifchannel_prune to use struct prefix *sg
Convert the pim_ifchannel_prune function to use a struct
prefix *sg for the source group.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
ee1a477a04 pimd: Convert pim_ifchannel_join_add to struct prefix *sg
Convert the pim_ifchannel_join_add to use a struct prefix *sg
instead of struct in_addr's.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
5074a4230a pimd: more source,group conversion to prefix sg
Convert more of the code to pass around a 'struct prefix sg'
instead of individual struct addr's.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
05e451f828 pimd: Refactor s,g information to struct prefix in pim_upstream.h
This change allows us to pass the (s,g) state around as a prefix.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:03 -05:00
Donald Sharp
99064df9e3 pimd: Convert ifchannel to using a prefix to store (s,g)
Convert ifchannel to use a prefix to store (s,g) information.
Additionally create pim_str_sg_dump function to output
data when using debugs.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
f6a1dc2ca7 pimd: Fix join in register to use correct nexthop
pim was sending the join from the RP towards the FHR with
a address that was the source instead of the nexthop.  This join
was treated as a non-local and nothing was done with it.

Ticket: CM-11945
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
9fd309db2d pimd: Start switchover to using a PRUNE (S,G) for uninteresting streams
When we receive a register for a (S,G) that we have no interest in
prune it off and send the register stop.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
7fcdfb34ac pimd: Make pim_upstream_switch non static
Allow pim_upstream_switch to be called from outside of pim_upstream.c
Also change the assert to an if test to just correctly stop the
timer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
7f0c1c5fdd pimd: change string to JOINPRUNE
Change the JP message string to JOINPRUNE.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
7643f0a1c6 pimd: Refactor pim message type to an enum
Change the pim message type to an enum and add the ability
to output a string based upon message type.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
36d9e7dcea pimd: Use XCALLOC instead of XMALLOC
Ensure that all data structures start out
as 0 filled.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
0e6ae42582 pimd: Fix PACKETDUMP compile errors.
signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
566387390f pimd: First Schwag at pim_register_stop
Implement the pim_register_stop state machine.  There are still a few
bugs still but this is enough to get us rolling a bit more.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
535db05b57 pimd: Refactor ifchannel creation.
Remove unnecessary function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
64a70f46c3 pimd: Remove unneeded function.
Remove the prune_echo function as that it just took some
data and passed it into another function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
792f4d29ad pimd: Properly initialize and delete t_rs_timer
Ensure that we properly initialize and stop the t_rs_timer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
627ed2a3b7 pimd: Create register stop timer for DR
When a register stop is received, create the register stop
timer and associated state machine.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
b100a4f5b9 pimd: Add null_register bit to pim_register_send
When sending a pim register message to an RP, we need
the ability to set the null bit in the message.  This
adds the ability to do so.

Additionally we need to switch the ip_hdr to a const uint8_t *buf
because pim_register_send really shouldn't know or care about
the fact it's a 'struct ip'.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
887fa0149f pimd: Add pim_channel_del_oif
For a given interface remove the interface from the list
of outgoing interfaces for a mroute and reinstall it
into the kernel.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
d7259eac8b pimd: create pim_upstream_state2str
Allow update of show command to understant all
pim upstream states.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
59ba0ac3e6 pimd: Fix use of 0 for NULL
pimd uses allot of 0's to represent NULL.  Not a good
programming practice.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
2ddab28881 pimd: Add decision point to send register message
When we receive a register stop we will have created a
timer for this.  As such if the t_rs_timer pointer will
be non-NULL at this point.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
4dffc8807e pimd: Refactor pim message receive
We were using a variety of techniques to handle
incoming pim packets.  Refactor to use a switch
statement to handle the incoming packets.

Also add the ability to notice that we are getting
a register stop.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
13c2408c1d pimd: Send Register-Stop from RP
The RP now has the ability to send a register stop message
to the originator of the packet in order to tell it to
stop encapsulating packets to the RP.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
6352a6cf23 pimd: Set correct parameters to pim_register_stop_send
Setup the pim_register_stop_send function to
take the correct parameters.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:02 -05:00
Donald Sharp
3d7765d741 pimd: Fixup some dead code
Remove some dead code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:01 -05:00
Donald Sharp
8f483f924e pimd: Create pim_encode_addr_group
Create the ability to encode the group address in a message.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:01 -05:00
David Lamparter
b2f361571b build: rename (1 of ?): configure.ac + preproc
This replaces Quagga -> FRR in most configure.ac settings as well as
a handful of preprocessor macros in the source code.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-20 17:57:47 +01:00
David Lamparter
8ef0791cb6 build: remove $Format tags
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-20 17:54:03 +01:00
David Lamparter
cdc2d76507 *: coccinelle-replace vty->index
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-09 17:36:25 +01:00
David Lamparter
7ddcfca4fb Merge branch 'queue/osr/vtysh-generic'
WARNING: Merge contains nontrivial fixups in vrf_cmd handling.

Conflicts:
	lib/if.c
	zebra/interface.c
2016-12-05 20:04:08 +01:00
David Lamparter
53dc2b05c7 Merge branch 'stable/2.0'
Conflicts:
	bgpd/bgp_route.c
	lib/if.c
	ripd/rip_interface.c
	zebra/interface.c
	zebra/zebra_vty.c
2016-12-05 19:48:38 +01:00
David Lamparter
a93baa31d3 Merge branch '-rip' into stable/2.0
This fixes up a lot of RIP/RIPng compliance tests that were still
flagged up.

Tested-by: Martin Winter <mwinter@opensourcerouting.org>
2016-12-05 16:25:58 +01:00
David Lamparter
0b84f29490 *: make DEFUN installations file-local
This moves all install_element calls into the file where the DEFUNs are
located.  This fixes several small related bugs:

- ospf6d wasn't installing a "no interface FOO" command
- zebra had a useless copy of "interface FOO"
- pimd's copy of "interface FOO" was not setting qobj_index, which means
  "description LINE" commands would fail with an error

The next commit will do the actual act of making "foo_cmd" static.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-01 17:25:56 +01:00
David Lamparter
0577b824e1 Merge branch 'stable/2.0' 2016-12-01 17:24:03 +01:00
Donald Sharp
94d95cde35 pimd: Fix large integer display of drpriority
When displaying drpriority you can enter unsigned
integer values from 1-2^32.  The display was
turning the unsigned value into a signed value
and thus we were displaying the wrong value.

Ticket: CM-13787
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: David Ahern <dsa@cumulusnetworks.com>
(cherry picked from commit db17265f1025e3ec578998ad537c33b49ed33cde)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-01 16:28:12 +01:00
David Lamparter
82992fed8c Merge branch 'vtysh-grammar'
Conflicts:
	isisd/isisd.c
	lib/Makefile.am
	lib/thread.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-28 17:56:29 +01:00
Renato Westphal
c5bdb09fd9 *: create a helper function to set the IP_MULTICAST_LOOP sockoption
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-25 11:46:06 -02:00
Renato Westphal
5736139d4a pimd/zebra: fix setting of IP_MULTICAST_LOOP on OpenBSD
Linux, FreeBSD and NetBSD (and possibly others too) accept both uint8_t
and int for the IP_MULTICAST_LOOP sockoption. OpenBSD, in the other hand,
accepts only uint8_t. To make setting IP_MULTICAST_LOOP work on every
supported platform, always pass a uint8_t variable as a parameter.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-25 11:46:06 -02:00
David Lamparter
24f5e2fc62 build: massively remove needless checks
Since we have autoconf results from a wide swath of target platforms, we
can go remove checks that have the same result on all systems.

This also removes several "fallback" implementations of functions that,
at some point in the history, weren't available on all target platforms.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-15 14:23:17 +09:00
Quentin Young
d7fa34c1bc all: Fix underfull doc strings, part 2
Add missing docstrings and separating \n.
Also eat some low-hanging refactoring fruit.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-08 01:46:04 +00:00
Quentin Young
39e92c066f Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_encap.c
	bgpd/bgp_route.c
	lib/command.c
	lib/command.h
	ospf6d/ospf6d.c
	vtysh/vtysh.c
2016-10-21 19:27:49 +00:00
Christian Franke
2447614b9c pimd: don't leak original_s_route on error
original_s_route is allocated on the heap and was not freed during the
error case.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-20 20:28:26 -04:00
Quentin Young
0a538fc98f Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	isisd/isis_routemap.c
	zebra/rt_netlink.c
2016-10-20 16:31:49 +00:00
Donald Sharp
b2575bc05b *: Consolidate routemap initialization
Consolidate the routemap initialization into one
function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-10-19 10:55:59 -04:00
Quentin Young
e52702f29d Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_route.c
	bgpd/bgp_routemap.c
	bgpd/bgp_vty.c
	isisd/isis_redist.c
	isisd/isis_routemap.c
	isisd/isis_vty.c
	isisd/isisd.c
	lib/command.c
	lib/distribute.c
	lib/if.c
	lib/keychain.c
	lib/routemap.c
	lib/routemap.h
	ospf6d/ospf6_asbr.c
	ospf6d/ospf6_interface.c
	ospf6d/ospf6_neighbor.c
	ospf6d/ospf6_top.c
	ospf6d/ospf6_zebra.c
	ospf6d/ospf6d.c
	ospfd/ospf_routemap.c
	ospfd/ospf_vty.c
	ripd/rip_routemap.c
	ripngd/ripng_routemap.c
	vtysh/extract.pl.in
	vtysh/vtysh.c
	zebra/interface.c
	zebra/irdp_interface.c
	zebra/rt_netlink.c
	zebra/rtadv.c
	zebra/test_main.c
	zebra/zebra_routemap.c
	zebra/zebra_vty.c
2016-10-17 23:36:21 +00:00
Donald Sharp
0b1442e37b *: Consolidate all double VIEW_NODE and ENABLE_NODE's
If a command is put into the VIEW_NODE, it is going into the
ENABLE_NODE as well.  This is especially true for show commands.
As such if a command is in both consolidate it down to VIEW_NODE.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-07 21:05:06 -04:00
Christian Franke
dc9ffce878 *: Consistently support 32-bit route tags
This patch improves zebra,ripd,ripngd,ospfd and bgpd so that they can
make use of 32-bit route tags in the case of zebra,ospf,bgp or 16-bit
route-tags in the case of ripd,ripngd.

It is based on the following patch:

    commit d25764028829a3a30cdbabe85f32408a63cccadf
    Author: Paul Jakma <paul.jakma@hpe.com>
    Date:   Fri Jul 1 14:23:45 2016 +0100

    *: Widen width of Zserv routing tag field.

But also contains the changes which make this actually useful for all
the daemons.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-10-07 21:05:05 -04:00
Daniel Walton
82f97584fb all: removed all DEFUN command stomps
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-06 19:56:13 +00:00
Daniel Walton
58749582a9 all: scrubbed some argc CHECK MEs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-30 00:16:31 +00:00
Daniel Walton
abddf07563 all: scrubbed some argc CHECK MEs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-29 19:51:56 +00:00