Commit Graph

2572 Commits

Author SHA1 Message Date
Donald Sharp
fc9d070da4 pimd: Fix various ifdown/ifup scenarios w/ J/P Agg
There exists situations where we may have cleaned not
properly cleaned up the various J/P aggregation lists.
This commit fixes those issues.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-08 08:37:53 -05:00
David Lamparter
dd8376febd lib: remove remaining struct zlog * args
These don't serve any purpose either.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:40 +01:00
David Lamparter
16077f2fc5 *: add frr_run()
Contains the fetch-and-run-thread logic, and vty startup (which is the
last thing happening before entering the main loop).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:39 +01:00
David Lamparter
eb05883f3e *: add frr_config_fork()
Centralise read_config/daemonize/dryrun/pidfile/vty_serv into libfrr.

This also makes multi-instance pid/config handling available as part of
the library.  It's only wired up in ospfd, but the code is in lib/.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:36 +01:00
David Lamparter
857b544649 *: centralize more into frr_init()
Move CLI/VTY/Memory accounting init into frr_*

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 23:07:33 +01:00
David Lamparter
4f04a76b71 *: add frr_init() infrastructure
Start centralising startup & option parsing into the library.

FRR_DAEMON_INFO is a bit weird, but it will become useful later (e.g.
for killing the ZLOG_* enum, and having the daemon name available)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 23:07:20 +01:00
David Lamparter
d7c07bb47a Merge branch 'frr/pull/243' ("Pim jp agg")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 16:42:20 +01:00
Donald Sharp
bba7cd1230 pimd: Add copyright Information to pim_jp_agg.[ch]
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-07 10:40:32 -05:00
Donald Sharp
344cbf76bc pimd: Fix 'show ip pim state' command
The 'show ip pim state' command was not
working quite correctly from when
we moved over to the new vtysh-grammar.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-02 10:57:45 -05:00
Donald Sharp
b8d16be287 pimd: Hide 'ip multicast-routing' command
Automatically turn on pim if the daemon is turned on.
Hide the 'ip multicast-routing' command
Disable the 'no ip multicast-routing' command
Do not display the 'ip multicast-routing' command.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-02 10:33:23 -05:00
Donald Sharp
21419f5932 pimd: Turn on igmp when igmp commands are entered
When you enter these commands, under an interface:

ip igmp version ...
ip igmp query-interval ...
ip igmp query-max-response-time ...
ip igmp query-max-response-time-dsec ...

These commands will now just turn on igmp for the
interface.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-02 10:12:52 -05:00
Donald Sharp
982bff8972 pimd: Join/Prune Aggregation
Add the ability for PIM to send Join/Prunes as an
aggregated message instead of individual messages
for each S,G.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-02 08:13:03 -05:00
Donald Sharp
338988d9cd pimd: Track oil list totals a bit better.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-02 08:12:57 -05:00
Russ White
54b19ceaf9 Merge pull request #224 from donaldsharp/pim_patches_feb
Pim patches feb
2017-03-01 09:52:24 -05:00
Donald Sharp
608a261b2c pimd: Fix use of value after free
Fix the usage of source after it has
been explicitly free'd.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-01 08:36:09 -05:00
Donald Sharp
ce9531309c pimd: Get Static mroutes displaying again
The static mroutes were making the assumption that the vif index
and the ifindex were the same.  This is not necessarily the case.

Additionally if we are displaying a *,G route only display
the G.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:31:34 -05:00
Donald Sharp
79bdcd9974 pimd: Move group handling to it's own function for J/P message
When we are handling a J/P message, move the group handling
to it's own function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:41 -05:00
Donald Sharp
6345a32671 pimd: Add hash lookup for igmp group's
When we receive a group in a IGMP report
let's look it up based upon a hash
instead of a list.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:41 -05:00
Donald Sharp
b7ddd2ec48 pimd: Intelligently drop wrvifwhole packets in some cases
Suppose we have this

(*,G) IIF = swp1  OIL: swp3
(S,G) IIF = swp2  OIL: swp3 swp4

There exists situations where we can receive the mcast
packet for (S,G) on both swp1 and swp2.  In this case
the packet received on swp1 will be sent from the kernel
to us as a WRVIF and WRVIFWHOLE.

As per normal, WRVIF packet processing handles the assert
case so we know we have not received the packet on a downstream
interface, so no assert.

The WRVIFWHOLE packet processing can then check to see if
it received the packet as a result of the (*,G) mroute
from upstream.  If we have then we can safely drop
the packet.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:41 -05:00
Donald Sharp
b5e2377cca pimd: Refactor pim_joinprune_send
Refactor pim_joinprune_send to use 'struct rpf'

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:41 -05:00
Donald Sharp
42a0111b64 pimd: Refactor pim_rpf_update to take a 'struct pim_rpf'
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:41 -05:00
Donald Sharp
d270b2163e pimd: Refactor functions
Refactor the add and delete functions.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:41 -05:00
Donald Sharp
a625e9373b pimd: Make ifchannel lookup a hash lookup
When we are at scale, it is possible that
we have a very large number of ifchannels
per interface.  So make lookup for
that situation to be a hash lookup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:41 -05:00
Donald Sharp
4961e0ad8f pimd: Trust the compiler
When we set a variable to NULL, there is no
need to assert on it the following line.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:41 -05:00
Donald Sharp
9f44d04202 pimd: Narrow inheritance search down to interface we are interested in.
When we are only looking at one ifchannel, for inheritance, narrow
the search down to only the interface/ifchannel we are interested in

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:41 -05:00
Donald Sharp
0ae2a75af4 pimd: Remove unnecessary igmp check
When we receive a igmp packet, there is no need
to ensure that it is a igmp packet, as that is
what we have asked for.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:40 -05:00
Donald Sharp
b50fcf3aa8 pimd: Remove unnecessary ip header length checks on receipt.
The kernel will not hand us a malformed packet.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:40 -05:00
Donald Sharp
910dad7e99 pimd: Remove unnecessary check in packet process path
When we get a packet from the network for pim, we do not
need to check to see that it is a pim packet, since that
is what we've asked to receive.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:40 -05:00
Donald Sharp
116b989af2 pimd: Only debug in the unusual case
When receiving a J/P packet, only check to see if we should
log when the J/P packet is not for us.

Very slight performance improvement additionally

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:40 -05:00
Donald Sharp
c48a612c21 pimd: Remove unneeded parameter
pim_upstream_join_timer_decrease_to_t_override passed in
a `struct in_addr` that in all cases was part of the
upstream data structure that was passed in already.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:40 -05:00
Donald Sharp
74ac496fcb pimd: Add packed data structures for building j/p messages
Switch pim over to using packed data structures for building
Join/Prune messages to be sent.

This is a pre-cursor to the ability to handle the ability
to aggregate Join/Prune messages together.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:40 -05:00
Donald Sharp
f8e7d7992f pimd: Assume buffer size passed in is of sufficient size
For:
pim_msg_build_header
pim_msg_addr_encode_ipv4_ucast
pim_msg_addr_encode_ipv4_group
pim_msg_addr_encode_ipv4_source

Assume that the buffer size passed in is of sufficient size
already.  This is assured already because buffer sizes
are checked for minimum lengths for the entire packet
ahead of time.  So we are double checking.

Additionally at scale we will be calling these functions
a very very large number of times.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:40 -05:00
Donald Sharp
70ce34ae66 pimd: Add 'struct pim_msg_header' packed data structure.
Add the 'struct pim_msg_header' and convert
all places that encoded/decoded the message header
to use it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:40 -05:00
Donald Sharp
09778298e2 pimd: Document the J/P packet format a bit better.
Document the J/P packet format and ensure
that the smallest size packet that we
may send will actually fit.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:40 -05:00
Donald Sharp
811ed42ae5 pimd: Convert sizes to #defines
Convert the const int size of the encoded
types to #defines so that they can be
used elsewhere.

Return Null instead of 0.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:40 -05:00
Donald Sharp
05ea5ceecf pimd: Allow IPDEFTTL to be used for omnios
The omnios OS has no IPDEFTTL defined.
Add the ability to handle it for this
one case.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-14 16:19:16 -05:00
Chirag Shah
e81d9709ff pimd: ifdown sequnce stale report entry
Ticket: CM-14652
Testing Done: Tested via sending IGMP report and flap port and verified pim upstream and mroute, the entry is deleted. Run pim-smoke

Even after Report received port down event, IGMP entry alawys exists in upstream, mroute, kernel.
The entry exist because it was recreated after delete due missing check if group has no more source list,
    mode is exclude, last source address was * means (*, G) so do not trigger to create entry.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-14 15:54:29 -05:00
Chirag Shah
429a291bf0 pimd: mroute entries unresolved IIF issue
Ticket:CM-14056
Reviewed By:sharpd, CCR-5603
Testing Done: verified multiple ifdown/ifup event on submitter setup and dev setup with 2k s,g entries, ran pim-smoke.

1. during ifdown event, pim vif for bridge was not resetting vif_index to -1 due to errno received from
kernel during vif del sequence. It could be timing issue where kernel may have delete prior to pimd sending request.
For vif_del even kernel returns error, reset vif_index to -1 in pimd DB so next if up event VIF receives new vif_index
and reprograms in kernel.
2. during mroute del sequence reset mfcc_parent to MAXVIF.
3. during mroute add check if parent mfcc_parent is MAXVIF then do not download to kernel such mroute entry.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-02-14 15:53:34 -05:00
Chirag Shah
d62c5c0381 pimd: messages to neighbors should have TTL = 1
Ticket:CM-12924
Reviewed By:shapd
Testing Done: configure PIM neighbor, verify PIM hello packet dump for ttl to be 1.

Set TTL to 1 for outgoing multicast control packets destine to ALL-PIM-ROUTERS as oppose to unicast mcast packets.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-02-14 15:52:56 -05:00
Chirag Shah
5637da0501 pimd: non-null register checksum incorrect
Ticket: CM-12041
Reviewed By: sharpd, CCR-5556
Testing Done: Tested on Local setup generating PIM Register (Data/Null) and processing both Tx/Rx with correct checksum.
Provided quagga debian to submitter and checksum cases passed on submitter setup.

1. PIM Register msg checksum only accounts for 8 bytes (4 bytes for PIM header and next 4 byetes before data payload).
In PIM header checksum calculation checked PIM packet type (in this case REGISTER type) then only pass 8 bytes as length
rather than full packet length.
2. PIM Register Rx path also handled with 8 byte and full pim lenth checksum.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-02-14 15:52:09 -05:00
Chirag Shah
48f6dc2dae Fix PIM DBG message
Ticket: CM-13771
Reviewed By: CCR-5537
Testing Done: yes

Fix to CM-13771 where DBG message was out of order.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-02-14 15:51:09 -05:00
David Lamparter
dab8cd005f *: fix ambiguous commands
Some "show [ip] bgp ipv4 encap ..." commands remaining ambiguous.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-10 16:57:20 +01:00
David Lamparter
bae44e4b76 Merge branch 'frr/pull/186' (pimd register length)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-09 13:46:44 +01:00
Donald Sharp
6431763d95 pimd: Send proper length register packets
PIM Register packets are 20 bytes too long.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-08 09:46:43 -05:00
Donald Sharp
90d84f92ae pimd: Cleanup dest buffer to small
Cleanup the in_ifname and out_ifname buffers
to be large enough to hold the actual interface
names.

Additionally move the common variables to be defined
once, instead of inside of multiple for loops

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-07 15:08:56 -05:00
Donald Sharp
7df2e1c379 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-07 13:20:12 -05:00
David Lamparter
f6864de1ab Merge branch 'frr/pull/165' ("Pim vrf")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-07 15:52:52 +01:00
David Lamparter
fa02c492fa Merge branch 'frr/pull/152' ("Lib fixes")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-07 15:48:46 +01:00
Donald Sharp
e5dfe68784 pimd: Refactor pim_sock_open to just need the ifp pointer
In all cases pim_sock_open was called, we just passed
in the pim_ifp->primary_address, which is accessible
from the interface pointer.  So just pass that in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-03 12:37:39 -05:00
Donald Sharp
b35702d0b8 pimd: Allow a interface in a vrf to be configured.
This fixes the issue a crash when we have configured an interface
inside of a vrf, and apply pim commands to it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-03 12:33:37 -05:00
Donald Sharp
55c7280315 *: Convert libzebra -> libfrr
The library libzebra that is installed with FRR will
conflict with Quagga.  So let's rename it to libfrr.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-03 08:29:13 -05:00
Donald Sharp
1a35e2e565 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-02 10:42:51 -05:00
Donald Sharp
540263204c pimd: Fix fd leak
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-01 20:44:21 -05:00
Donald Sharp
28d5da5a53 pimd: Fix cmd issues
Fix possible buffer overwrite and uninitialized idx access.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-01 20:40:10 -05:00
Donald Sharp
35661ffa0c pimd: Fix broken switch statement
Fix broken switch statement that would
allow the case statement to fall through.

Fix possible buffer overwrite.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-01 20:38:02 -05:00
David Lamparter
ff1c42fb9f *: fix warning fallout from set_socket_path
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-01 13:12:16 +01:00
David Lamparter
26df3a33ae Merge branch 'frr/pull/133' ("Pim cleanup")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-31 15:26:07 +01:00
Donald Sharp
a118e71d0e pimd: Fix handling of *,G on RP to allow prune of S,G to go out
When on the RP we received a prune *,G for an established S,G
If join_desired is no longer true we need to prune and
reset some timers, in addition to removing the inherited
interface from the olist.

This was not happening because we were just removing
the inherited oif from the *,G.

Ticket: CM-14561
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 12:54:20 -05:00
Donald Sharp
0b6817c5e7 pimd: Cleanup shutdown a bit more.
Cleanup the shutdown of pim a bit more.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 12:53:47 -05:00
Donald Sharp
98573e196c pimd: Cleanup uninitialized memory access
Valgrind noticed that we have a read of uninitialized memory:

Conditional jump or move depends on uninitialised value(s)
==13749==    at 0x428067: pim_ifassert_winner_set (pim_assert.c:57)
==13749==    by 0x4266F0: pim_ifchannel_add (pim_ifchannel.c:535)
==13749==    by 0x426CC1: pim_ifchannel_join_add (pim_ifchannel.c:730)
==13749==    by 0x427B5B: recv_join (pim_join.c:95)
==13749==    by 0x427B5B: pim_joinprune_recv (pim_join.c:270)
==13749==    by 0x42354F: pim_pim_packet (pim_pim.c:249)
==13749==    by 0x4236C0: pim_sock_read (pim_pim.c:349)
==13749==    by 0x4E60587: thread_call (thread.c:1462)
==13749==    by 0x40C75E: main (pim_main.c:266)
==13749==

This commit fixes that issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 12:53:27 -05:00
Donald Sharp
e34a317acf pimd: Modify pimreg creation
We were creating the pimreg device with a
created ifindex of 255.  This was causing
issues when a interface was assigned a ifindex
of 255 by the kernel.  Subsuquently pim
would stay in a hosed up state.

Modify the ifindex used for the pimreg device
to be 0.

Ticket: CM-14625
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 12:52:06 -05:00
Donald Sharp
f663aa7ad4 pimd: Use correct flag to add an oif
When we are creating the igmp ifchannel we were creating
it with both a P and a I flag.  This was causing
it to not be cleaned up properly when the interface
was shut down.  Subsuquently when the interface
came back up we would attempt to add it back in
but it would fail.

Ticket: CM-14586
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 12:51:45 -05:00
Donald Sharp
dc0665f150 pimd: Handle assignment of vif index better
PIM was handling vif creation deletion poorly
for interface down and up events.  Fix this
issue by keeping track of which vif index'es
we have issued and allow the wholes to be
filled in.

Ticket: CM-14556
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 12:51:20 -05:00
Donald Sharp
781a1745c0 pimd: Fixup tracking of where we got OIF's from.
This commit does these three things:

1) Add code to 'show ip pim state' to show where OIF's got their
decision to include that interface

2) Add code in pim_mroute_[add|del] to display what we think we are
adding to the kernel

3) Add code to properly track where we got the incoming request from and
to appropriately not remove a OIL if we have state still

Ticket: CM-14034
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-01-30 12:49:38 -05:00
Donald Sharp
38f4935a5d pimd: Move qpim_zclient_update -> zclient
Rename the qpim_zclient_update variable to zclient.
This is to follow the naming conventions in the rest
of the code.

Additionally move the struct zclient * pointer into pim_zebra.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 10:19:25 -05:00
Donald Sharp
8799b66b94 pimd: Start abstraction of zclient data structure for pim_zebra.c
Start the abstraction of the zclient data structure out from a
global variable for the entire program to a global variable
to the pim_zebra.c file.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 10:04:05 -05:00
Donald Sharp
59d4564e0f pimd: Remove Double call of routemap_teriminate
"He's dead, Jim"

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 07:47:21 -05:00
Donald Sharp
72e81cf424 pimd: More pim cli fixup
Found some additional issues with the pim
cli.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-26 09:10:54 -05:00
Martin Winter
a8cdea56f4 pimd: Add vty_socket cli option to override the compiled-in location for the VTY Socket
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-01-26 00:41:46 +07:00
Martin Winter
780cff2f08 pimd: Add missing 'socket' getopt cmdline option
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-01-26 00:40:32 +07:00
Donald Sharp
a957a05bb4 pimd: Cleanup some missing help strings.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-25 09:13:46 -05:00
Donald Sharp
c74e219474 pimd: Fix double add of command
We were adding the 'ip msdp ...' command to
the parser 2x.  Some new code added to the
parser apparently catches this for us now.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-25 08:20:06 -05:00
Donald Sharp
83190a40e2 pimd: Cleanup the headers.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-19 10:01:02 -05:00
Donald Sharp
77b7d90beb pimd: PIM_MRT is a linux specific piece of code.
The PIM_MRT and registration for WRVIFWHOLECACHE
is a bit of linux specific code.  Until such
time that this gets implemented we will have
issues being able to work within the context
of PIM-SM.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-19 09:58:53 -05:00
Donald Sharp
3629c61d11 pimd: Fix README file for FRR
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-19 08:57:17 -05:00
Donald Sharp
7a6e656788 pimd: Cleanup compile warnings
Cleanup some compile warnings in pim on *bsd.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-19 08:49:47 -05:00
Donald Sharp
fcd6282c55 pimd: Missing include causes compile failure on some bsd's
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-19 08:49:12 -05:00
Donald Sharp
5fe80c1a8f pimd: Fix compilation error
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
2017-01-18 07:50:19 -05:00
Donald Sharp
de6d2fa72e pimd: Remove bad merges
Two functions were accidentally left around
as part of the merge operation.  Remove them.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-18 07:47:58 -05:00
Donald Sharp
c2403b2598 pimd: 'struct ip_mreqn' is not available on all platforms
Signed-off-by: Donald Sharp <sharpd@cumulusnetowrks.com>
2017-01-18 07:24:24 -05:00
Donald Sharp
f15bf55387 pimd: SO_BINDTODEVICE is not available on some platforms.
Follow bgp's lead and don't allow SO_BINDTODEVICE on *bsd.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-17 22:45:19 -05:00
Donald Sharp
b58ed1f8a8 Merge remote-tracking branch 'origin/master' into pim_lib_work2 2017-01-17 21:01:56 -05:00
Olivier Dugeon
b98f56422e Merge pull request #55 from donaldsharp/monotonic
Monotonic
2017-01-09 15:26:16 +01:00
Donald Sharp
37335ee22a pimd: Remove knowledge of HAVE_CLOCK_MONOTONIC
thread.c fails to build if we do not have CLOCK_MONOTONIC
no need to have pim have any knowledge of it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-07 19:21:21 -05:00
Donald Sharp
3b14d86eed Merge remote-tracking branch 'origin/stable/2.0' 2017-01-06 09:58:21 -05:00
anuradhak
01cb146642 pimd: make the json output a bit more machine-friendly
Mixing well-known and variable property names makes the output difficult
to parse. so wrapped variable-keyed dicts with well-known property
names (such as "oil") in the following outputs -
"show ip mroute json"
"show ip msdp mesh-group json"

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-12-21 20:26:19 -05:00
Donald Sharp
28185336ed pimd: Fix core when bouncing interfaces
When you bounce interfaces and the system is under heavy
load there exists situations where zebra may or may not
have told us the new ifindex, but we've requested a
nexthop lookup, which bypasses normal mechanisms for
zebra communication, we may get back a ifindex that
we may have not created a ifp for yet.

Ticket: CM-14052
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-12-21 20:26:19 -05:00
Donald Sharp
693c9259df pimd: Fix cleanup crash
When shutting down, actually delete the right data
structures.

Stupid cut-n-paste error on my part.

Ticket: CM-14018
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:19 -05:00
Donald Sharp
bfdf409644 pimd: Allow us to repair missed inherited_olists
There exists situations where we have noted that
we need to rescan but have missed the window
of opportunity to actually redo the scan
so for the moment allow the S,G 30 second
scanner notice the missed opportunity and
fix it.  We'll remove this later.

Ticket: CM-13988
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:19 -05:00
Donald Sharp
fa8489cb5c pimd: Don't send (S,G)RPT prune
Sending (S,G)RPT prune was causing issues due to not handling
it properly at this point in time.  So just don't send it right now

Ticket: CM-13969
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:19 -05:00
Donald Sharp
38f380f56d pimd: Fix crash w/ ifp null in pim_mroute.c
When you do a series of ifdown/ifup for
an interface that is receiving packets
through the kernel pim socket, it is
possible that the interface has been
deleted but the kernel is still going
to deliver us a packet.  In that case
do not allow us to crash.

Ticket: CM-13981
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:19 -05:00
Donald Sharp
ef71d1f860 pimd: Allow bridges and bonds to up and down
Bridges and bonds when ifdowned are removed from
the kernel in it's entirety, while pim assumed
that interfaces were kept around in some fashion.

Basically when we had an ifdown event, for all ifchannels
on that interface delete from the OIF.  Also note
the fact that the vif has gone away and we need to
recreate it on the next ifup.

Ticket: CM-13896
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:19 -05:00
Donald Sharp
b5183fd1ae pimd: Tell ourselves to rescan when we discover an issue
When we have network churn and we have an inherited_olist
notice when we may have a situation where we need
to recalculate the inherited_olist.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:19 -05:00
Donald Sharp
be5770d770 pimd: Remove unused zclient_debug variable
Remove code that sets the pim_zclient_debug variable
but is never used.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:19 -05:00
Donald Sharp
5a515ebed0 pimd: Reset neighbor hold time when we receive packet
When we receive a packet from a neighbor, reset the
hold time as that we *know* that they are still
alive.

During heavy packet load, we were seeing cases
where neighbors were being reset because we
were timing out due to not processing the hello
packet in time.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
a85d880293 pimd: Rework zassert code in pim_assert.c
When we encounter an error in the state machine
for an individual ifchannel, do not bring the entirety
of the pim daemon down.  Notice the issue and continue
on.

Ticket-CM-13939
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
67f771b3a3 pimd: Add guard for pim_msg_send_frame
In certain error conditions it is possible to
attempt to send packets when the socket is not ready
instead of dumping to the log a million error messages
only note the issue if we have packet debugs on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
07335c8d08 pimd: Modify pim_upstream_new behavior
Modify pim_usptream_new to auto create the pim
channel oil.  Why?  Because there exists situations
where we have upstream state and we are attempting
to set the inherited_olist on it and we have
not created the channel oil yet.  When that
happens we end up with mroutes that are
being meanies.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
ee1a071806 pimd: Add ability to tweak join/prune send time
Add the ability to tweak how often we can
send the join prune message.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
8d90ffd05d pimd: Correctly associate channel oil with correct IIF
There exists situations where PIM stores a S,G channel oil
and doesn't delete it.  When a new upstream comes in for
it we were not ensuring that the IIF for the S,G channel oil
was correct.

Ticket: CM-13908
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
6a78764e46 pimd: Clarify pim_mroute_[add|del] function debugging
When debugging is turned on for 'debug mroute' we
are unable to tell when a mroute has been added
or deleted from the mrib.  Notice when we
do it and who called it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
eeedae06ee pimd: Cleanup debugs for pim_upstream_sg_running
In the normal case when we have debugs turned on and the
stream is not running, only display one line of output
instead of 2.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
3197cb1eb5 pimd: Cleanup some more debugs
Cleanup some pim debugs:

1) For some reason some PIM_DEBUG_PIM_TRACE were not showing up
switched them to PIM_DEBUG_TRACE

2) Some mroute debugs were a bit redundant.  Reduce.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
4bbcefe91f pimd: Cleanup debugs on 2016-12-21 20:26:18 -05:00
Donald Sharp
6578dfa378 pimd: Fix where we handle the inherited_olist for ifchannel
When we receive a new *,G ifchannel, handle the inherited_olist
for S,G mroutes in a place where it is more appropriate.

Ticket: CM-13892
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
70e7fda8a4 pimd: Stop sending Register under certain situations
When the switch in question is both a FHR and the RP
for the received multicast group stream.  When we go
to send the NULL register to the RP( ourselves )
do not send it if we have not seen packets for
that stream in time greater than PIM_KEEPALIVE_PERIOD
and I_am_RP(G).

Ticket: CM-13880
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
anuradhak
833331fbce pimd: increase the maximum msdp TLV burst to 100 from 12
12 is too slow of a slow-start in scale setup (say with 6000 SAs)
when sources are being learnt one at a time (but in a rapid fire
fashion).

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
anuradhak
3e5e42252e pimd: reset packet size on tcp connection reset
If we were in the middle of a partial read when the tcp connection is
reset we were clearing the buffers but not the packet size. This can be
problematic when the connection is re-established.

There is no easy way to repro and test this without scale (and a timing
pattern that is hard to predict). So this change is mostly untested.

Ticket: CM-13852
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
anuradhak
489e06bbcf pimd: Add debug logs to help find problems with stream_read
Logs only. No functional change
Ticket: CM-13852

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
06d1c450f3 pimd: With igmpv2 turned on don't accept 224.0.0.0/24 groups
When a group is in the 224.0.0.0/24 range and we
have igmp v2 turned on do not allow it to be
considered for inclusion as a mroute.

Ticket: CM-13855
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:
2016-12-21 20:26:18 -05:00
Donald Sharp
f041117e84 pimd: Fix 'no ip igmp query-max-response-time XX' to work
Ticket:CM-13786
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
1e3a513213 pimd: Modify the Prune Pending Timer Pop to not assert
So there exist conditions where we can start the Prune
Pending Timer and receive other packets that cause
us to not stop the pending timer.  This was
due to a missread of the state machine.

Additionally when the prune pending timer pops and
we are not in prune pending state, note the fact
and move on with our life instead of crashing and burning

Ticket: CM-13851
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:
2016-12-21 20:26:18 -05:00
anuradhak
36e466fe98 pimd: Drop local SA reference when the upstream SG is deleted
This is done irrespective of the reason for del and is intended as a
catchall for cases (unclear which ones) where the RP can drop the SG
without KAT expiry.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
1319c91f3b pimd: Fix so creation of prefix happens one time
Fix code so that the creation of the 224 prefix happens
one time.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
b815998a42 pimd: Don't allow invalid groups to be passed for igmp
When we receive a invalid group( say outside of the 224/4
range) don't allow it to create state.  Nicely reject
the rejectable.

Ticket: CM-13821
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
anuradhak
69053fb4f0 pimd: restart the ka timer after the sa adv timer
To avoid unnecessary ka activity in the network. When the SA
advertisment timer fires we build SA TLVs and send them to peers. As a
part of this tx we were also restarting the ka timer to avoid
unnecessary ka generation in the next 60 seconds. However because the
adv timer was restarted after tx (i.e. after ka restart) ka timer would
always endup firing just before the adv timer.
2016-12-21 20:26:17 -05:00
anuradhak
c024cfacea pimd: Fix the number of SAs pushed into one MSDP SA-TLV
The entry_cnt in a SA TLV is one byte. I was trying to push 765 SAs into
each TLV resulting in strange problems in a scale setup.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
d52ff9b703 pimd: Do not allow deletion of output interface.
There exists conditions where PIM will have it's
upstream route removed and an unreachable route
is installed that points out the downstream
interface.  This unreachable route is removed
from bgp as soon as it's path selection algorithim
works properly, but pim has already deleted
the oif and never puts it back in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
a23ee35b2b pimd: Fix show run output to be correct.
When issuing a vtysh -m command it expects the
output it receives to be the complete command
not a partial match.

The 'debug pim packets joins' command
was being outputted as 'debug pim packets join'

This was making quagga-reload.py unhappy.  Adding
the joins word allows it to complete successfully

Ticket: CM-13805
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
cf3cd99f5d pimd: Lower Hello sent to be immediate
There exists situations where an interface flaps
and routing recovers and we attempt to install
an upstream but since we have no neighbor out
that interface still.  Let's cause the hello
to go out immediately for the 3.1 release
to allow mrouting to recover in this situation.

We will need to revisit this issue after
we have proper nexthop tracking in place

Ticket: CM-13185
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
5e9985887e pimd: Fix pim_oil_equal function
We are self testing for c2 being equal to c2.

Bad Donald!  No Donut!

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
80df099b48 pimd: Fix stupidity compile errors
I introduced compile errors using gcc, that worked fine
with clang.

This removes the issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
58344b652e pimd: Make igmp query max response time take input in dsec
Make the 'ip igmp query-max-response-time' command
take input in deci-seconds and make the
'ip igmp query-max-response-time-dsec' command hidden.

Ticket:CM-13786
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
802b226c8d pimd: Cleanup nexthop debugging
When debugging nexthops, we print allot of unnecessary data
Move some debugs to trace detail to reduce log clutter.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
da3dcffb66 pimd: Add more RP rescan points
When we add in or delete ip addresses from an interface
we may need to rescan the rp's that we know of to make
sure that they are still available.

Ticket: CM-12623
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
a04da05a53 pimd: Only check to see if current rp is 'right' or not.
When a new rp is entered, pim is looking at all rp's and failing the check if
any of the RP's have no path to the RP, instead of the one that was
just entered being wrong.

Ticket: CM-12623
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
44521e5d2d pimd: When specifying 224.0.0.0/4 as the RP group inform msdp
When we modify the 224.0.0.0/4 rp address with a:
'ip pim rp A.B.C.D'

We need to let msdp know that this command was entered.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
86abfcb897 pimd: Actually expedite a hello
When we get a new neighbor for an interface, we need
to send a hello out that interface in some situations.
At this time we were tracking this by the pim_ifstat_hello_sent
value but not reseting it when we received a new neighbor.

Ticket: CM-13769
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
anuradhak
7cdb24da72 pim-anycast-rp: Change the reason code on use-source config failure.
Was failing with a vague error -
"Source set failed"

Changed to used the error string (used by the rest of the commands) -
"Pim not enabled on this interface"

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
anuradhak
b9b1e1f2ba pim-msdp: Fix pimd crash on mesh-group delete.
The mesh group contents were being accessed after memory was freed.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
anuradhak
da72c9fdc3 pim-nexthop: mroute and pim-upstream rpf are falling out of sync.
Currently the mroute-IIF and upstream RPF-IIF/neigh are resolved separately.
This must change i.e. be merged together for a couple of reasons -
1. In the case of ECMP we will use a load-share mechanism (based on G or
SG) to pick an RPF neighbor in 3.2.1 (to use the load-sharing cap of
anycast-RP). Using a different resolution mechanism for mroute-IIF will
simply not work.
2. In a non-CLOS topology it is actually possible to have routers that
do not participate in PIM. In this case the tree will be set up using
different routers than the ones chosen for the mroute IIF. And traffic
will not be forwarded.

This change is however too big for 3.2.0. So to handle CM-13714 I have
simply forced rpf update on neigh add which fixes the specific problem
seen on link flap in a clos (it is not very efficient but traffic
recovers).
In problem state -
(jessie-30-dev-switch-amd64-sbuild)root@spine-1:/home/cumulus# ip mr
(0.0.0.0, 225.1.1.1)             Iif: lo         Oifs: swp3 lo
(20.0.11.253, 225.1.1.1)         Iif: swp1       Oifs: swp3
(jessie-30-dev-switch-amd64-sbuild)root@spine-1:/home/cumulus# vtysh -c
"show ip pim upstream"
Iif       Source          Group           State       Uptime   JoinTimer
RSTimer   KATimer   RefCnt
lo        *               225.1.1.1       Joined      00:08:44 00:00:15
--:--:--  --:--:--       1
swp2      20.0.11.253     225.1.1.1       Joined      00:08:35 00:00:56
--:--:--  00:02:59       1
(jessie-30-dev-switch-amd64-sbuild)root@spine-1:/home/cumulus#

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
a770ef9063 pimd: Remove redundant logging
When receiving a JOIN/PRUNE message if we have trace
turned on we output this:

2016/11/28 17:11:46.368827 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.13,103
2016/11/28 17:11:46.368956 PIM: Recv PIM JOINPRUNE packet from 169.254.0.6 to 224.0.0.13 on swp31s1: ttl=255 pim_version=2 pim_msg_size=34 checksum=e623
2016/11/28 17:11:46.369003 PIM: pim_joinprune_recv: from 169.254.0.6 on swp31s1
2016/11/28 17:11:46.369053 PIM: recv_prune: prune (S,G)=(20.0.11.253,229.1.2.3) rpt=0 wc=0 upstream=169.254.0.5 holdtime=210 from 169.254.0.6 on swp31s1
2016/11/28 17:11:46.369099 PIM: nonlocal_upstream: recv prune (S,G)=(20.0.11.253,229.1.2.3) to local upstream=169.254.0.5 on swp31s1

Clean up the messaging to this:

2016/11/28 17:11:46.368956 PIM: Recv PIM JOINPRUNE packet from 169.254.0.6 to 224.0.0.13 on swp31s1: ttl=255 pim_version=2 pim_msg_size=34 checksum=e623
2016/11/28 17:11:46.369053 PIM: recv_prune: prune (S,G)=(20.0.11.253,229.1.2.3) rpt=0 wc=0 upstream=169.254.0.5 holdtime=210 from 169.254.0.6 on swp31s1

Ticket: CM-13752
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
anuradhak
58c51da212 pim-nexthop: set the correct nexthop address in the rpf info.
When a nexthop lookup is done we can get an ECMP output. But not all
nexthops are pim neighbors. If for this reason PIM chose a nexthop other
than the first the rpf info was not being set correctly i.e.
nexthop ip was still the one associated with the first path but
interface was set to the one associated with second path.

This problem is seen on a link flap in the CLOS topology.

Ticket: CM-13714
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
anuradhak
11b7753a89 pim-msdp: Update the RP address in the SA cache entry on peer ip change
The RP address in the SA is only for informational/display purposes. It
is still confusing if we show a stale value.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
anuradhak
886d1e80f6 pim-msdp: cleanup debug commands
And fixup display spacing. No functional change.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
anuradhak
15ad0c71e0 pim-msdp: CLI and debug cleanup
No functional change.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
7923d3178f pimd: Cleanup igmp read socket
With the change over to using the kernel upcall for igmp messages,
we need to add in a read thread for the igmp socket to drain
the igmp socket's receive queue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
anuradhak
4763cd0ed5 pim-anycast-rp: Support in BGP unnumbered networks.
Anycast rp requires multiple ip addresses on the lo. If PIM is used in
an unnumbered BGP network it picks one of the lo addresses as the
pim-primary for the swp interfaces. But if the anycast IP is picked up
by both sides pim nbr will never converge. So a static "use-source" config
is provided to allow the administrator to force the the hello source to the
unique IP address.

Sample output:
=============
dell-s6000-04(config-if)# do show running-config pimd
>>>>>> SNIPPED >>>>>>>>>>>>>>>>>
interface lo
 ip pim sm
 ip pim use-source 100.1.1.5
!
>>>>>> SNIPPED >>>>>>>>>>>>>>>>>
dell-s6000-04(config-if)# do show ip pim interface lo
Interface  : lo
State      : up
Use Source : 100.1.1.5
Address    : 100.1.1.5 (primary)
             100.1.1.100
>>>>>> SNIPPED >>>>>>>>>>>>>>>>>
dell-s6000-04(config-if)# do show ip pim interface lo json
{
  "lo":{
    "name":"lo",
    "state":"up",
    "address":"100.1.1.5",
    "index":1,
    "lanDelayEnabled":true,
    "useSource":"100.1.1.5",
    "secondaryAddressList":[
      "100.1.1.100"
    ],
>>>>>> SNIPPED >>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
18e565fd96 pimd: Only make the pim sockets non blocking.
Only make the pim sockets non-blocking on reads.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
8e4c9ef376 pimd: Add knob to control # of packets read in at one time
Add 'ip pim packets <1-100>' command.

Allows you to control the number of packets read in before
giving control back to another part of the process.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
anuradhak
7176984f74 pim-anycast-rp: Add limited support for secondary addresses.
Anycast requires that the lo interface be associated with multiple
addresses. One is the anycast IP address (which is the same on all RPs
participating in RP redundancy) and the second is the unique IP address
that will be used as the router id by routing protocols.

To accomodate that we maintain a list of secondary addresses per-pim iface
and allow any of them to be the RP address. This lets the I_am_RP macro
succeed on anycast RPs.

Note that the support is limited i.e. we don't actually advertise a
secondary list to the neighbors. This is assuming the anycast IP will never
be used as a router id i.e. will never be an RPF neighbor.

Sample output:
==============
dell-s6000-04# sh ip pim interface lo
Interface : lo
State     : up
Address   : 100.1.1.1 (primary)
            100.1.1.2
            100.1.1.3
            100.1.2.1
>>>>>>> SNIP >>>>>>>>>>>>>>>
dell-s6000-04# sh ip pim interface lo json
{
  "lo":{
    "name":"lo",
    "state":"up",
    "address":"100.1.1.1",
    "index":1,
    "lanDelayEnabled":true,
    "secondaryAddressList":[
      "100.1.1.2",
      "100.1.1.3",
      "100.1.2.1"
    ],
>>>>>>> SNIP >>>>>>>>>>>>>>>
dell-s6000-04#sh ip pim rp-info
RP address       group/prefix-list   OIF         I am RP
100.1.2.1        224.0.0.0/4         lo          yes
dell-s6000-04#

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
55a645a636 pimd: Set pim socket receive buffer to a larger value
There exists situations where we can receive data
faster than we can process it.  Make the buffer
large enough to catch these situations for
the pim sockets.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
6806e04d04 pimd: Modify mroute_read to be non-blocking
Modify mroute_read to be non-blocking and
then to read in up to 3 packets at a time
to be handled.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
db48bcb23e pimd: Modify pim_sock_read to read 3 times before yielding
Modify pim_sock_read to read up to 3 packets before yielding
the cpu to something else.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
5441e69048 pimd: Reduce duplicate debug messages in wrvifwhole
When we get a wrong vif whole callback, reduce
the duplicate debug messages being processed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
0f055c0d5d pimd: Further refine debugs in pim_sock_read path
When we received a packet we were dumping packet information
with debugs on 2 times for each packet where we had overlapping
data being passed.

Since debugs are expensive, reduce the count to 1.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
8bfb8b67ae pimd: Allow storing of sg in string format
Debugs are extremely expensive currently.  Let's
store 'struct prefix_sg sg' string format in
the ifchannel, upstream and msdp_sa structures.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
9d8b5695fe pimd: Cleanup handling of pim_sock_read
Cleanup some turned on debug code that is no longer
needed to be turned on in the pim_sock_read
code path.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
70989c7c20 pimd: Modify wait time for response from Null Register
Give ourselves a few more seconds to wait for a response
for a NULL Register.  This will benefit us under heavy
mroute churn on the RP.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
anuradhak
1bf1644338 pim-kat: changed kat handling to match rfc-4601 more closely.
1. This is needed to layout the MSDP macros for determining what SAs are
originated by a MSDP speaker.
2. We no longer let the kat timer expire on an active flow. Activity
counters/lastuse is polled via a wheel for every SG entry. If new
activity is detected the keepalive timer is started and SPT bit set.
A SRC_STREAM reference is also created for the entry if one doesn't
already exist.
3. If KAT actually expires it means the flow is no longer active. At
this point we stop advertising the SA to MSDP peers. We also pull
the SRC_STREAM reference (deleting the entry if there are no other
references).

PS: Checking counters on KAT expiry will come in the next change.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
2ecd52cd35 pimd: Remove dead code from pim_register.c
Remove the dead test code from pim_register.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
0e3b3d5d10 pimd: Add appropriate (S,G) debugs for register
When we send a register record the S,G if debugs are turned on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
4f7c4a76d8 pimd: Increase kernel socket rcvbuf size.
We are receiving notifications from the linux
kernel that we are filling up the receive buffer
for upcalls into pimd.  Let's increase the size
to something a bit bigger.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
191f5695df pimd: Add 'ip pim register-suppress-time <5-60000>'
Add the 'ip pim register-suppress-time ...' command.
Remove the 'no ip pim rp keep-al...' command as
that the register suppress set that value.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
7a90f85c1a pimd: Move pim_mroute.c global data to file local static
Move the qpim_mroute_socket_reader thread to pim_mroute.c
and make it static to the file.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
def1e80732 pimd: Protect log messages with debug in pim_pim.c
Protect the log messages in pim_pim.c with PIM_DEBUG_PIM_PACKETS

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Daniel Walton
5f9cf1d209 pimd: 'show ip pim rp-info json' should use JSON_C_TO_STRING_PRETTY
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Donald Sharp
980e939362 pimd: Use NULL to signify NULL pointer
Use the NULL c symbol to signify that we are
intentionally setting the pointer to NULL
instead of 0.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Donald Sharp
e30a4d4afe pimd: Allow 'ip pim rp ...' config after bringup
If you specified the 'ip pim rp ...' after the
system has been configured it was not accepting
the new rp.  This fixes that issue.

Ticket:CM-12623
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Donald Sharp
c83778f769 pimd: Allow 'no ip pim sm' to not turn off igmp
When we receive a 'no ip pim sm' for an interface
that has both pim and igmp on it, only turn
off pim.

Ticket: CM-12985
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Donald Sharp
3440bd1573 pimd: Fix crash in pim_rp_show_information
When a 'show ip pim rp-info' is issued shortly
after a restart/start, pim will crash because
nexthop information has not been fully resolved
and the outgoing interface is NULL.

Ticket: CM-13567
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
anuradhak
977d71cc7a pim-msdp: part-4: cli cleanup
1. Add support for mesh-group based configuration that is easy to apply
via automation. The older per-peer configuartion is temporarily hidden
and will be cleaned up later.
Sample config -
ip msdp mesh-group cumulus source 100.1.1.4
ip msdp mesh-group cumulus member 100.1.1.5
ip msdp mesh-group cumulus member 100.1.1.6

2. Added support for detail peer and sa-cache displays. Along with
filter keys.

3. Add json output for all the msdp displays.

With this commit basic support for anycast-RP with MSDP (in numbered
network is complete). Unnumbered support will be added separately.

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
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
Daniel Walton
67656e9b65 all: added CHECK ME for DEFUNs that look at argc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-29 17:48:57 +00:00
Daniel Walton
80d3d26b36 pimd: removed undebug CHECK MEs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-27 00:26:41 +00:00
Daniel Walton
e961923c72 bgpd, etc: changed .LINE to LINE...
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-27 00:07:46 +00:00
Daniel Walton
199d90a10e Expand #defines in command strings
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25 16:49:39 +00:00
Daniel Walton
9ccf14f739 Expand #defines in command strings
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25 14:10:48 +00:00
Daniel Walton
b181fa04e2 pimd: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 20:03:41 +00:00
Christian Franke
0fc452dc57 Make route flags a 32bit field
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-23 12:12:43 -04:00
Donald Sharp
b99c382167 Revert "Make route flags a 32bit field"
This reverts commit 85eda2c985.
2016-09-23 12:11:21 -04:00
Christian Franke
85eda2c985 Make route flags a 32bit field
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-23 09:51:43 -04:00
Renato Westphal
a4b46f4c16 *: remove dead code
Since recently zebra uses only the ZEBRA_REDISTRIBUTE_* messages
to advertise redistributed routes to its clientes. Now the old
ZEBRA_IPV*_ROUTE_* messages are only used for client->zebra communication.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-23 09:31:24 -04:00
Daniel Walton
f412b39a33 ALIAS removal for bgp, ospf, pim, isis, rip, ripng, lib and zebra
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 03:55:26 +00:00
Daniel Walton
91ac1d43ad pimd: argv update
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 00:14:41 +00:00
Daniel Walton
5cee71fb64 Revert "pimd: Convert to the new way of working"
This reverts commit 0564b02e43.
2016-09-22 18:21:49 +00:00
Donald Sharp
0564b02e43 pimd: Convert to the new way of working 2016-09-20 23:35:51 -04:00
David Lamparter
4a1ab8e405 *: split & distribute memtypes and stop (re|ab)using lib/ MTYPEs
This is a rather large mechanical commit that splits up the memory types
defined in lib/memtypes.c and distributes them into *_memory.[ch] files
in the individual daemons.

The zebra change is slightly annoying because there is no nice place to
put the #include "zebra_memory.h" statement.

bgpd, ospf6d, isisd and some tests were reusing MTYPEs defined in the
library for its own use.  This is bad practice and would break when the
memtype are made static.

Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[CF: rebased for cmaster-next]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-19 16:31:04 -04:00
David Lamparter
fc7948fafe lib: migrate to new memory-type handling
Move over to the new allocation counting added in the previous commit.

(This commit is mostly mechanical.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
2016-09-19 18:35:50 +02:00
Daniel Walton
28b0c6b377 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
2016-09-09 20:24:31 +00:00
Donald Sharp
5b30316ea5 bgpd, lib, ospfd, pimd, zebra: Use nexthop_types_t
Use the 'enum nexthop_types_t' instead of
the zebra.h #defines.  And remove code from
zebra.h that does not belong there.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-02 10:36:28 -04:00
Renato Westphal
ea8b7c71a7 build/solaris: fix one error and a few warnings
Signed-off-by: Renato Westphal <renato@openbsd.org>
2016-08-26 20:07:18 -04:00
Donald Sharp
810a8dfc93 Merge remote-tracking branch 'origin/cmaster' into cmaster-next 2016-08-19 12:18:35 -04:00
Paul Jakma
b892f1ddfe *: use an ifindex_t type, defined in lib/if.h, for ifindex values
(cherry picked from commit 9099f9b2a66e86f8a90d7fe18f61bd2bb1bc6744)
2016-08-18 07:35:38 -04:00
Sid Khot
c05795b16b Fix for CM-12450 Ensure quagga logs at startup are sent to syslog (until log configuration is processed)
Ticket: CM-12450
Reviewed By: CCR-5112
Testing Done: Manual
2016-08-17 19:36:54 -07:00
David Lamparter
6bcd6029f1 pimd: don't break with missing SO_BINDTODEVICE
This effectively a partial revert of commit 61ea395...
"pimd: Bind pim sockets to interface they are associated with"

Note this isn't really a proper fix, it just clears the build breakage
on BSD without improving the usage of multiple sockets.

Reported-by: Martin Winter <mwinter@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-08-16 16:10:52 +02:00
Renato Westphal
8f500a1cf1 *: fix trivial build errors on *BSD
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-08-07 21:05:26 -04:00
Renato Westphal
b3f2bf7cbe pimd: add a workaround for *BSD
VIFF_USE_IFINDEX is not available on BSDs and other UNIX systems. In
order to build pimd on these platforms, use 'vifc_lcl_addr' instead of
'vifc_lcl_ifindex' to specify the interfaces we want to enable forwarding
of multicast traffic. In the case of unnumbered interfaces, print an
error and return.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-08-07 21:05:26 -04:00
Quentin Young
9b34069d02 lib: Add newline terminators to pim docstring
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-08-03 19:30:06 +00:00
David Lamparter
5ef104fc41 pimd: relegate pim_igmp_join.c into a header file
pim_igmp_join.c only exists to make some portability hacks available to
test_igmpv3_join.  The function only has 1 call site in each pimd and
the test tool, so it's nicely served as a simple static function in a
header file.

This removes a MTYPE related compiler/linker issue from referencing
lib/if.h in a binary that doesn't link libzebra, as test_igmpv3_join is
now fully independent of lib/.

(Fix by Christian Franke: remove stray leftover ifindex_t)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28 07:27:47 -04:00
David Lamparter
e62d0e2535 pimd: supply VIFF_USE_IFINDEX definition
This fixes compilation if the system libc doesn't have VIFF_USE_IFINDEX.
It'll still break runtime if the kernel is older than 2.6.32.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-27 14:20:51 -04:00
Donald Sharp
4416b1f6c2 pimd: Refactor some encode/decode functions
Some encode/decode functions are needed in multiple places.
Start the refactoring to be able to use them in a more generic
manner.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-12 20:13:32 -04:00
Donald Sharp
86d1f7c49c pimd: Some Initial Groundwork for register stop
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-12 20:11:15 -04:00
Donald Sharp
25a335e0ca pimd: Allow (S,G) pimreg route to time out
When a kernel upcall happens for nocache we create
a (S,G) route to be installed into the kernel.
This code modification starts the ability to
time out the mroute if we stop receiving mcast
packets.

Ticket: CM-11793
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-13 14:22:42 -04:00
Donald Sharp
4669ffbb00 pimd: Remove some extraneous hexdump's
On every kernel upcall we are dumping the packet.  Stop that.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-13 12:46:09 -04:00
Donald Sharp
3667e8a081 pimd: Add generic function to retrieve mroute stats
Add a generic function to retrieve mroute statistics
from the kernel.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-13 11:41:41 -04:00
Donald Sharp
60cd035685 pimd: multicast route not removed from kernel when the if goes down
When a multicast route's rpf changes( for whatever reason ) (*,G)
routes were never updating properly.  This is because we were
attempting to fing the path to the *, instead of the RP.
Modify the code to check if we are attempting to find a
* route and use the RP instead.

Ticket: CM-11736
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-12 15:25:11 -04:00
Donald Sharp
58302dc724 pimd: Track if the mroute is installed or not
Track whether or not if a mroute has been installed
or not.  If not don't display information about it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-12 15:22:10 -04:00
Donald Sharp
c171d6d8c9 pimd: Refactor pim_mroute_add and _del
The struct mfcctl should not be passed around.  Pass around
the channel oil instead.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-12 15:16:53 -04:00
Donald Sharp
9867746afe pimd: Refactor 'struct static_route' to use channel_oil
The 'struct static_route' data structure duplicated a
decent bit of what is the in the struct channel_oil.
Refactor.  This will set us up for further cleanup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-12 15:09:25 -04:00
Donald Sharp
5b1207f72c pimd: Stale IGMP groups left behind
When a toin IGMPv3 join is received, the code
was always auto creating the igmp group associated
with the received packet.  The RFC clearly states
though that if a INCLUDE is received for a group
with 0 sources and we have received nothing the
igmpv3 packet should be ignored.

Ticket: CM-11260
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-12 11:37:19 -04:00
Donald Sharp
2560106c04 pimd: Start naive implementation of anysource_forward_stop
Naive implementation of igmp_anysource_foward_stop.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-12 10:46:01 -04:00
Donald Sharp
60b1960ff7 pimd: IGMPv3 leave not deleting group entry
After sending a IGMPv3 exclude report for a multicast address
with 0 sources, send an include report for the same group and also 0
sources.  This should cause IGMP to GS query and age/delete
the entry.

This fix addresses this issue.

Ticket: CM-11685
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-12 10:46:00 -04:00
Don Slice
2caa9b3957 all: add default log file if none are defined
Added a default log file named /var/log/quagga/Quagga.log to every daemon
to capture log entries if no log file is defined.  This also allows the
capture of logged information prior to reading each daemon's config file.
If a log file is defined manually, it will override this default file name.

Ticket: CM-10987
Signed-off-by: Don Slice
Reviewed By: Donald Sharp
Testing Done: Manual testing
2016-07-11 12:57:24 -07:00
Donald Sharp
74fb6c66da pimd: static joins no longer worked
Static joins were killed by a previous commit, which
has been backed out.  I've recoded the igmp join
code to ignore 224.0.0.0/24 from ourselves a bit
differently now.

Ticket: CM-11751
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-11 13:07:02 -04:00
Donald Sharp
e20883e6bf Revert "pimd: Prevent igmp packet loopback."
This reverts commit 5bbcd1f0fd.

This commit badly breaks local 'ip igmp join XXX YYY' commands.

Revert this and fix the issue a slightly different way

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-11 12:28:36 -04:00
Donald Sharp
f28692a45c pimd: Set default logfile to Quagga.log
Until such time a log file line is generated,
default to using /var/log/quagga/Quagga.log

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-30 00:43:30 -04:00
Donald Sharp
2e948c7813 pim: Show Iif for 'show ip pim upstream' command
Modify the 'show ip pim upstream' command to
show the expected incoming interface for
the source.

Ticket: CM-11220
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-29 15:49:57 -04:00
Donald Sharp
539fba1a52 pimd: Fix igmp isex_excl
When we receive an igmpv3 group report that has
an implied *,g make sure that we look at
the source for the g and handle it appropriately

Ticket: CM-11396
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-29 15:23:01 -04:00
Donald Sharp
d2ccd60b22 pimd: Pass the appropriate data structure around
Several static functions were passing a list around
when the reality is we are going to need to
look at the group information in order to make an
informated decision.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-29 15:01:21 -04:00
Donald Sharp
065bee4b39 pimd: Ensure we should accept a kernel upcall
When we receive a multicast packet from a source
that is not connected to us, silently ignore it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-29 12:12:13 -04:00
Donald Sharp
5bbcd1f0fd pimd: Prevent igmp packet loopback.
pim is joining the 224.0.0.13 and 224.0.0.22 groups
This is causing the creation of (*, 224.0.0.13) and
(*, 224.0.0.22) multicast routes which are immediately
sent to the pim network.

If we are the originator of the igmp report than
there is no need to accept the packet for
processing.

Ticket: CM-11397
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-29 08:53:18 -04:00
Donald Sharp
e6dad1abe5 pimd: Make pim_channel_add_oif failures debugs
Make failure messages of adding a mroute
a debug and wrapper them in PIM_DEBUG_MROUTE

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

re
2016-06-29 08:00:06 -04:00
Donald Sharp
a22e470b39 pimd: Make received packet zlog_err a zlog_debug
When receiving packets and the parse fails
a zlog_err is generated.  This should be
protected by a debug.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-29 07:44:42 -04:00
Donald Sharp
61ea3951a2 pimd: Bind pim sockets to interface they are associated with
When pim is receiving packets, each interface's fd is receiving
packets for all interfaces.  Modify the code to bind the
pim interface sockets to the interface they were created for.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-28 21:50:49 -04:00
Donald Sharp
2ca35b3d73 pimd: When receiving the register packet, create the mroute
When a RP receives the register packet, move the (*,G) to a
(S,G) route and send the pim message upstream to the source.

With this change the multicast packets are sent from the
source to the interested parties.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-27 15:46:02 -04:00
Donald Sharp
8a67a996bc pimd: Refactor pim_scan_oil
Allow the workings of pim_scan_oil to be called
on a per channel basis.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-27 15:09:41 -04:00
Donald Sharp
d3aded9982 pimd: Allow (*,G) to work properly.
When the kernel looks up a *,G route it
expects the incoming interface to be part
of the outgoing interface ttl list.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-27 13:28:14 -04:00
Donald Sharp
83d8ff0074 pimd: Fix register receive pointer arithmetic
When receiving the register packet from another pim
neighbor at the RP, we were adding an incorrect
amount of bytes to find the start of the ip_hdr
of the encapsulated data.  This commit fixes
this issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-23 20:42:19 -04:00
Donald Sharp
09c02cc3c0 pimd: Removing extra asserts
in the igmp_group_free path, the normal deletion path
was causing asserts to happen.  There is no need
to have asserts here for this reason.

Further testing done w/ valgrind.

Ticket: CM-11401
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-23 15:42:03 -04:00
Donald Sharp
d3a8a0f5b3 pimd: Fix igmp Trace logging
In general we don't need to know
when a read is scheduled.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-23 12:24:32 -04:00
Donald Sharp
ce9a064388 pimd: Move timer information to TRACE_DETAIL
Move another timer informational debug to TRACE_DETAIL

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-23 11:54:24 -04:00
Donald Sharp
ae90dfbbb7 pimd: Handle pimreg a bit better
The pimreg device is vif_index == 0.  Allow it
to be used.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-23 11:46:57 -04:00
Donald Sharp
169edb7f12 pimd: Turn some trace information to trace detail
Turn some PIM_TRACE to PIM_TRACE_DETAIL.  Log file
was getting spammed with unneeded information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-23 11:15:45 -04:00
Donald Sharp
8e403a1487 pimd: Allow pimreg device to be output vif
With the change to moving the pimreg to vifindex 0,
when a packet is kicked up from the kernel to us
we need to install the route into the system.

This change allows us to do this now.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-23 11:03:47 -04:00
Donald Sharp
f73209b8d1 pimd: Get proper group on register receive
When we receive a encapsulated packet from another
pim neighbor, the code needs to grab the group
from the ip_hdr->src.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-22 16:44:05 -04:00
Donald Sharp
a920d6e72a pimd: Fix checking to see if we are a RP or not
When we create the pim_ifp we need to see if this
interface allows us to elect our selves the RP.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-22 16:39:31 -04:00
Donald Sharp
0ab092dae0 pimd: Log Rotate is not working properly
The log line was causing confusion when we
were rotating quagga.  None of the other
protocols were logging lines on rotate
so just remove it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-22 11:42:50 -04:00
Donald Sharp
85b62aeab3 pimd: Prevent loopback from forming neighbor
This code prevents pim from forming a neighbor relationship
with itself by preventing pim from sending a hello
out the loopback interface if we have pim configured
on an interface.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-17 21:25:21 -04:00
Donald Sharp
9df994075b pimd: Apparently compilers are evil
Fix up some compiler issues from clang to gcc.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-17 20:53:21 -04:00
Donald Sharp
744d91b3c6 pimd: Separate pim vif index spot from ifindex
Allow pim to separate out the pim vif index from the ifindex.
This change will allow pim to work with up to 255(MAXVIFS)
interfaces, while also allowing the interface ifindex to
be whatever number it needs to be.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-17 20:43:21 -04:00
Donald Sharp
515b39d704 pimd: Remove unneeded shell scripts
Remove some unneeded shell scripts.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-17 18:47:48 -04:00
Donald Sharp
651d0f713e pim: Fix NOCACHE to use incoming interface
When the kernel sends a NOCACHE message to
pim we were looking up the interface to
use for the incoming multicast packet
based upon the source.  No need to do
that trust that the kernel has properly
identified it and use that.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-17 15:40:29 -04:00
Donald Sharp
3010e99a56 pim 2016-06-17 10:38:45 -04:00
Donald Sharp
017454fe07 pimd: Tell code to use ifindex
When creating an vif use the ifindex.

Signed-off-by: Donald Sharp  <sharpd@cumulusnetworks.com>
2016-06-17 09:37:11 -04:00
Donald Sharp
3479bad639 pimd: Use the ifindex to create vif device
It is possible to create multiple interfaces
with the same ip address.  Looking up the
dev to use based upon the ip address will
eventually fail when you keep getting
the same dev device.

Future-Work: I'll need to add a translation
to vif index to actual device to use because
ifindex's are not guaranteed to be under 256.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-17 09:19:38 -04:00
Donald Sharp
e4cc018527 pimd: Fix of using uninitialized Memory
Valgrind is reporting that pimd is using uninitialized
memory for comparisons.  This commit addresses
the issues found there.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-09 15:16:14 -04:00
David Lamparter
7a2fbbf0ee *: make sure zebra.h is always included first
zebra.h pulls in config.h, which results in fiddling with things like
__FILE_OFFSET_BITS. It must always be included first, in order to set
flags that influence the compiler via <features.h>.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 821df2cf18e5978cc7ab532a8695444380d08270)
2016-06-09 10:45:22 -04:00
Donald Sharp
195dd232eb lib/zclient: Consolidate error reporting for zclient_read_header
All functions that call zclient_read_header immediately turn around
and check to ensure that the version and marker fields are correct
Move this code into zclient_read_header

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit a9d4cb33faa6af622240190a80f41c4672374925)
2016-06-09 10:33:27 -04:00
Donald Sharp
f5e6574b65 pimd: Fix register message checksum
The register message checksum was being calculated over
the first 4 bytes of the packet, instead of the first
8 bytes.  From the RFC:

PIM Version, Type, Reserved, Checksum
        Described in Section 4.9. Note that in order to reduce
        encapsulation overhead, the checksum for Registers is done only
        on the first 8 bytes of the packet, including the PIM header and
        the next 4 bytes, excluding the data packet portion.  For
        interoperability reasons, a message carrying a checksum
        calculated over the entire PIM Register message should also be
        accepted.  When calculating the checksum, the IPv6 pseudoheader
        "Upper-Layer Packet Length" is set to 8.

Ticket: CM-11265
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-08 12:21:59 -04:00
Donald Sharp
5d3c5e6dea pimd: Rehookup the redistribution code
Due to rewrite of the redistribution mechanism in ZEBRA,
rehookup the redist statements to pimd from zebra.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-03 06:20:05 -04:00
Donald Sharp
95ff066772 pimd: Make pim_pkt_dump use standard lib functions
pim_pkt_dump was creating a custom function to dump
detailed packet data.  Switch it over to use
zlog_hexdump.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-07 11:00:53 -04:00
Donald Sharp
cab8707e0a pimd: Allow (*,G) igmp joins to work.
Start the implementation of accepting (*,G)
igmpv3 joins.

Ticket: CM-7894
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-06 12:40:00 -04:00
Donald Sharp
915c13b395 pimd: igmp_add_group_by_addr remove unneeded parameter
We were passing in the interface name when we were also
passing in the igmp pointer which has this information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-06 11:43:01 -04:00
Donald Sharp
9bd7302f90 pimd: Remove unnecessary parameter
We were already passing in the interface name, no need
to do it twice.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-06 11:43:00 -04:00
Donald Sharp
9c1e09ba8e pimd: Remove dead code.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-06 11:43:00 -04:00
David Lamparter
9e8da292d1 build: get rid of INCLUDES, use AM_CPPFLAGS
INCLUDES in configure.ac was not used at all, and INCLUDES in
Makefile.am is supposed to be AM_CPPFLAGS these days.

Reduces warnings spewed during bootstrap/autoreconf.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Greg Troxel <gdt@ir.bbn.com>
Acked-by: Feng Lu <lu.feng@6wind.com>
Acked-by: Paul Jakma <paul@jakma.org>
(cherry picked from commit 237aac56960575f6ad2451ba2796d94bd5ae4b33)
2016-06-03 15:46:59 -04:00
Donald Sharp
b45fd5058f pimd: Fix compiler warning in pim_mroute.c
Another compiler another warning.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-03 14:35:47 -04:00
Donald Sharp
f91f89bcd6 pimd: Add support for displaying ip mroute
When you enter a static mroute under an interface
the 'show run' is not displaying this information.
Add code to allow this.

Ticket: CM-11257
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-06-01 15:31:02 -04:00
Donald Sharp
8371bd6008 pim: Fix 'no ip pim sm'
The 'no ip pim sm' command was not being accepted.
Additionally fix the help output

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-01 11:40:00 -04:00
Donald Sharp
78d3e25770 pimd: Allow command zclient to find it's data
pim has two zclient sockets to zebra.  One
is used exclusively to do mrib lookups.  The
other is to do the normal day to day communication
between pim and zebra.  With the change
to the zebra api to send up all data to all
sockets this caused the mrib lookup socket
to accumulate data in between mrib lookups.
So if at some point in time we get upcoming
data but no mrib lookups modify the code
to find the mrib lookup it is looking for.

Long term we need to figure something else out
but this change will get us moving forward again.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-06-01 07:07:04 -04:00
Donald Sharp
e7a2870b47 lib: Fix vrf_id_t data type
We were reading a u_int16_t for vrf_id_t.  While technically
the same thing, I'd like to make sure we think about vrf_id_t's
as vrf_id_t's.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-26 19:52:10 -04:00
Donald Sharp
df696e3f7c pimd: Fixup some clang compiler warnings
clang run on a fairly recent fedora complains
about some code.  Fixup the warnings.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-26 19:33:12 -04:00
Donald Sharp
0e8ce7e607 pimd: Add ability to safely ignore route-maps
pim was not parsing route-map code and causing issues
using vtysh because of this.  Add code to safely
ignore the route-map code and set us up for future
expansion into route-maps if neeeded.

Ticket: CM-11219
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-26 19:31:38 -04:00
Donald Sharp
762e563e52 pimd: Double read of stream
The addition of the zclient_read_header call
reads the entirety of the stream for you and
makes sure it's consistent with the header.
When the function call was added it read the
stream data in zclient_read_header and then
reread the data after that.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-26 19:21:20 -04:00
Donald Sharp
48e8451b8e pimd: Forgot to add the vrf_init call
Forward port of vrf code didn't have the pimd
code.  So when it was forward ported we lost
the vrf_init.  Now that we have pimd let's
add it back in.

Additionally forward port lost the
additional zclient->zebra_connect call.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-26 19:21:20 -04:00
Donald Sharp
832bb13fb2 quagga: Additional centos 6 -enable-werror fixes
This commit fixes these warnings:

1) bgpd/bgp_nexthop.c - dereferencing pointer 'X' does break strict-aliasing rules
2) pimd/pim_igmp_join.c - dereferencing pointer 'X' does break strict-aliasing rules
3) ripd/ripd.c - 'ifaddr.prefixlen' may be used uninitialized in this function

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 26a18eb223d26011ac4f1d608f6775ed7ebf8efb)
2016-05-26 15:33:33 +00:00
Donald Sharp
9eda95bde5 pimd: Fix some static analysis
Using && instead of &.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Paul Jakma
95bb83054b build: Remove the old PIC/PIE patch, let libtool sort it out
* Remove the old change from '08 to add in PIE arguments at automake level.
  Versions of libtool since then know how to deal with -fpie and do the right
  thing according to whether its building shared or executable objects.
  So just pass '-fpie' as CFLAG and let libtool do its thing.
2016-05-25 20:38:35 -04:00
Donald Sharp
9f6d6b12ac pimd: Clean up some more compile warnings
Turns out we were missing $(WERROR) for compiling pimd
so we were not catching compile warning issues.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
f9e0ab5b8e pimd: Fix SPT bit initial setting
The initial setting of the SPT bit was incorrect.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
d8cd119bbc pimd: Fix pim_upstream_find to match on INADDR_ANY for source
Fix the pim_upstream_find code to match on INADDR_ANY for source.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
998af21944 Pimd: pim register send is being sent and received at the RP
Modify the code to send a register packet upstream to the RP.
Packet is currently being received but not properly decoded
currently.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
59471fb885 pimd: Modify NOCACHE code to create (S,G) route
The code was hard-coding the (S,G) route to get the
multicast packet up into pimd.  This code fixes
this issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
c992c9a0c0 pimd: Create special pimreg interface
The linux kernel wants a pimreg vif device.  The pimd
code wants a 'struct interface *' for anything it works
with.  Since the pimreg vif device is not a real linux
device that zebra knows about.  Cheat by creating
a pimreg interface pointer and setup the code to
properly be able to handle the registration of the vif
device.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
37653d4f68 pimd: Fix some file inclusion issues.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
1865a44a83 pimd: Move add_oif into pim_oil.c
This commit does two things:
(A) Sets up #defines for the pimreg to be used in pim_mroute.c
(B) Moves add_oif into pim_oil.c where it belongs

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
0fba6e638a pimd: Add New Source type for where a (S,G) mroute is learned
Add Source type for (S,G) mroute.  This will allow us to know that
a (S,G) route came from an actual Source( ie the kernel called us
back with information about a multicast packet it received with
no mroute for it ).

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
ed66602c64 pimd: Convert the RP(G) code to return a struct pim_rpf
This will facilitate sending packets to the right spot

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
c8ae3ce8b6 pimd: Modify the RP data structure.
Modify the RP data structure to know how to get to it from here.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
84366c7e15 pimd: Move I_am_DR macro to more appropriate place
Move the I_am_DR(ifp) outside of pim_macro.c and into
pim_iface.h where it belongs.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
04b40f027c pimd: Add some code to intelligently handle WHOLEPKT generation
When we get a NOCACHE call from the kernel, there is
no point generating a mcast route for the packet if
there is no RP configured, or if PIM-SSM is configured
on the interface.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
e5d33c8377 pimd: Add some debug code to unknown packet upcalls
When receiving data from the kernel from the kernel socket,
some calls that are received are not known what they are.
Provide some more debug code to handle appropriately

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:35 -04:00
Donald Sharp
80c0d16804 pimd: Fixup some broken code for the register receive
Some of the register receive code was broken.  This fixes that

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
a441b8d708 pimd: Cleanup some comments and documentation
Starting the transition of PIM-SSM to PIM-SM means
that we have to cleanup some internal code comments
so that the code will match the comments.

Signed-off-by: Donald Sharp<sharpd@cumulusnetworks.com
2016-05-25 20:38:34 -04:00
Donald Sharp
77e390e59e pimd: Start handling of pim REGISTER packet type
This code starts the handling of the pim register type.  No guarantees that
it works correctly, just that it compiles and the start of the code is in there.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
8813406fe9 pimd: Cause NOCACHE event to create WHOLEPKT events for pimd
pimd needs the ability to send the multicast packet to the RP.
This code causes the incoming unknown multicast packet to
be send to pimd so it can be sent as a REGISTER packet towards
the RP.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
d5a0a62974 pimd: Fix nexthop resolution breakage
Nexthop resolution was broken due to some ill placed debug statements.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
e355e30fcb pimd: Fixup kernel callbacks to handle them better
This patch sets up the handling of the 3 basic kernel callbacks:
IGMPMSG_WRONGVIF - When a multicast message comes in the wrong vif
IGMPMSG_NOCACHE - There is no multicast route associated with a received(S,G)
IGMPMSG_WHOLEPKT - There is no outgoing interface for a packet.

The code's debugs are cleaned up to be covered by debug statements

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
b45cefcb44 pimd: Register with kernel to get unknown multicast packets
Start the process of creating the pimreg vif device so that
we can get the callbacks from the kernel with the multicast packets

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
cb40b272bf pimd: SwitchToSptDesired addition
Add code to tell us if we want to switch to a SPT for the (S,G)

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com
2016-05-25 20:38:34 -04:00
Donald Sharp
f14248dddb pimd: Add code to start the KAT(S,G) as needed
The KAT(S,G) timer can now be started and on
expiry the timer clears the PMBR(S,G).

More work needs to be done for when this timer pops, but
good enough of a start now.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
4a4c4a07c5 pimd: Create some infrastructure code for RST(S,G) and KAT(S,G)
These two timers have some default values.  Create the
default defines to be used and start setting up the data
structures for them.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
01d68c9bea pimd: Start work for handling of register command
Start the coding of the REGISTER receive and send.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
7bfa617548 pimd: Check to see if we are the RP
Add code to allow on interface up/down events the check of whether
or not this process is the RP.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
d99764f68f 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 <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
2bd9e1bc6c pimd: Start adding the ability to handle the Bridge Router
Add code to allow the check and set the PMBR(S,G) if the register.borderbit
is set.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
7169405764 pimd: Add code to get RP(G)
Add code to figure out who the RP is for group G.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
54b97c74fe pimd: Add RP check code
Add the ability for the node to determine if it is the RP or not.
Currently this only allows static RP's.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
8f5f5e91b6 pimd: Receive and transmit (*,G) to the RP
Receive a (*,G) route and send it upstream to the RP.
The RP at this time does not properly handle the route.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
8044778111 pimd: Fix test_igmp_join code to handle thread_master * changes
Fixup of pimd to be cognizant of thread_master pointer changes

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:34 -04:00
Donald Sharp
981d6c7a1f Implement "ip pim rp X.Y.Z.A" and "ip pim sm" commands
Allow the user to specify the static Rendevous point
as well as specifying that an interface is Sparse Mode.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Donald Sharp
aea6cb942f pimd: Limit pim hello log messages
pimd was outputting allot of data surrounding pim hello packets.
In addition the debugging was inconsistent and not all turned
on via 'debug pim packet hello'.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Paul Jakma
4d114a9423 pimd: Fix size_t zlog_err format string warning
* fc1c114aa / "pimd: Fix warning", the size_t arg should have a %zu format.
2016-05-25 20:38:33 -04:00
Donald Sharp
c5cb17ecec pimd: Cleanup interface startup
This patch cleans up some interface startup, removes duplicate
debug messages and protects against some always being displayed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Donald Sharp
566b83cf72 pimd: Notice when we receive a packet type we can't handle yet
There are PIM packet types that have not been implemented yet.
Notice when we get one of those and safely do nothing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Donald Sharp
b5790b703d pimd: Add knowledge of different packet types
There are several additional packet types that pimd is unaware of
Add code to allow pim to understand them in the future.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Donald Sharp
7adf026098 pimd: Cleanup zebra debugs to be protected by debug commands
pimd is very chatty without any pim debugs turned on.
This commit fixes a bunch of the debugs to be protected
by appropriate pim debug statement.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Donald Sharp
6b775f6120 pimd: Do not display some default values as part of a show run
There is no need to display igmp default values for the query-interval
and the query-max-response-time-dsec

Before change:

!
interface swp4
 description swp4 -> host-212's swp1
 ip igmp
 ip igmp query-interval 125
 ip igmp query-max-response-time-dsec 100
 ip pim ssm
 link-detect
!

After change:
!
interface br1
 ip igmp
 ip pim ssm
 link-detect
!

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Martin Winter
868388e57e pimd: Fix warning
Fix long unsigned / unsigned mixup

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2016-05-25 20:38:33 -04:00
David Lamparter
7ec3063624 pimd: use IPPROTO_IP (not SOL_IP) for IP_PKTINFO
Solaris uses the same socket API for IP_PKTINFO as Linux, but doesn't
have a SOL_IP define.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-05-25 20:38:33 -04:00
Paul Jakma
02e51cad49 pimd: Fix compile warning (error with Werror) on BSD
* ioctl commands can vary in type between systems, cast to an unsigned long
  before passing to format command.
2016-05-25 20:38:33 -04:00
Donald Sharp
18a232959d pimd: Remove stdout zlog changes
Quagga start has unnecessary pim messages to stdout.  Causing some confusion.
Logging is already saving this information in pimd.log

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Donald Sharp
2cd32c6114 pimd: Fix leaked fd
When caling pim_sock_open if the failure cause happens, however
unlikely, don't leak the fd on failure.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Nicolas Dichtel
5511908940 bgpd/pimd: fix zAPI parsing
Commit c99f3481a598 has changed the API. Now, the vrfid has been added in
the header, thus we must read it before parsing the rest of the message.

To ease code maintenance, let's add a new function to read a zAPI header.

Fixes: c99f3481a598 ("*: add VRF ID in the API message header")
Reported-by: Martin Winter <mwinter@opensourcerouting.org>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Tested-by: Martin Winter <mwinter@opensourcerouting.org>
2016-05-25 20:38:33 -04:00
Donald Sharp
7960fa8f75 pimd: Create ability to modify hell and hold timers per interface
Create new per interface command:
'ip pim hello <1-180> {<1-180>}'

The first number is the Hello Timer for this interface
The second number is the Hold Timer to pass to neighbors on this interface.
The second number is optional.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Donald Sharp
6c44fe2294 pimd: Change ioctl call failure from vty_out to zlog_warn
The command 'show ip multicast' when run, iterates over all interfaces
on the router, if you do not have pim configured on that interface
it would generate an error message:

Interface Address         ifi Vif  PktsIn PktsOut    BytesIn   BytesOut
br1       20.0.15.1         7   7       0       0          0          0
swp1      169.254.0.10      3   3       0       0          0          0
swp2      169.254.0.26      4   4       0       0          0          0
ioctl(SIOCGETVIFCNT=35296) failure for interface swp3 vif_index=-1: errno=22: Invalid argument
ioctl(SIOCGETVIFCNT=35296) failure for interface swp4 vif_index=-1: errno=22: Invalid argument

This fixes the issue to display this instead:

Interface Address         ifi Vif  PktsIn PktsOut    BytesIn   BytesOut
br1       20.0.15.1         7   7       0       0          0          0
swp1      169.254.0.10      3   3       0       0          0          0
swp2      169.254.0.26      4   4       0       0          0          0
swp3      0.0.0.0           5  -1       0       0          0          0
swp4      0.0.0.0           6  -1       0       0          0          0

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Donald Sharp
c29c0f61de pimd: Ensure new generation_id is different from previous
The RFC states that an interfaces generation_id must be changed
if it experiences an if down.  From 4.3.1:

The GenID option contains a randomly generated
32-bit value that is regenerated each time PIM forwarding is started
or restarted on the interface, including when the router itself
restarts.

Since we are only grabbing a new generation_id without comparing
it to the previous generation_id, it is possible that random
can generate the exact same number.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Donald Sharp
f6f9c0094a pimd: Stop DR election on every hello
The DR election is occurring on every hello received.
This is because the hello receive packet returns a 0
for any successfully received packet.  PIMD then looked
at the 0 returned and did a DR election.

Code was inspected for the cases where DR should happen:
(A) Interface ip address change
(B) DR priority in hello packet changes
(C) Received a new neighbor on an interface
(D) Neighbor timer pops.

Each of these initiate a DR election in the code currently.

Testing was initiated on a pim network:
tor-11# show ip pim designated-router
NonPri: Number of neighbors missing DR Priority hello option

Interface Address         DR              Uptime   Elections Changes NonPri
br1       20.0.15.1       20.0.15.1       00:08:16         1       1      0
swp1      169.254.0.10    169.254.0.10    00:08:16         2       1      0
swp2      169.254.0.26    169.254.0.26    00:08:16         2       1      0
tor-11#

As you can see Elections == 2.  This is because pimd performs
an election on (A) and (C) above.  I see no need to modify
(A) to check if we have any knowledge of the interface before
this call.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:33 -04:00
Donald Sharp
818a327c24 pimd: Fix first DR Election
The function pim_neighbor_new caused the dr election before
the addition of the neighbor to the pim_ifp->pim_neighbor_list,
in pim_neighbor_add, which is needed to properly elect the
correct DR.

Move the dr_election and hello trigger till after the addition
to the list.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:32 -04:00
Donald Sharp
dedccda63f pimd: Add ability to set DR Priority for an interface
From RFC 4601, Section 4.3.1:

The DR_Priority Option allows a network administrator to give
preference to a particular router in the DR election process by
giving it a numerically larger DR Priority.  The DR_Priority Option
SHOULD be included in every Hello message, even if no DR Priority is
explicitly configured on that interface.  This is necessary because
priority-based DR election is only enabled when all neighbors on an
interface advertise that they are capable of using the DR_Priority
Option.  The default priority is 1.

This modification allows the setting of the DR Priority on a per
interface basis.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:32 -04:00
Jafar Al-Gharaibeh
6250610a59 pimd: add support for configuring multicast static routes
Hi,

This patch adds the ability to configure multicast static routes
directly into pimd. Two source files are introduced to implement the new
feature in addition to changes to existing files.

Here is how it can be used the CLI:

interface <incoming interface>
ip mroute <outgoing interface> <group addr>                          #
for asm
or ip mroute <outgoing interface> <group addr> <source>    # for ssm

Please let me know if you have any questions or concerns,

Regards,
Jafar

Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:32 -04:00
Donald Sharp
7a1d58cec7 pim: 'show debugging' collision
The 'show debugging' cli as setup by pim collided with 'show debugging isis'.
Fix that and clean up cli help commands to actually display correctly.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:32 -04:00
Donald Sharp
2f702571df pimd assert when no route to source from a new igmp join
When pim_upstream_new is called the code looks up the nexthop.
If there is no route to the source, the code silently ignored
the error returned.  When the nexthop lookup fails don't create
the 'struct pim_stream *' to return.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:32 -04:00
Donald Sharp
a724477d97 pim_mroute.h has a different version of code than linux/mroute.h provides
linux/mroutes.h and pim_mroute.h both have copies of the same structures.
This is causing failures in setsockopt(..., MRT_ADD_MFC,...) because
of data structure incompatibilities between the kernel and what
pim_mroute.h was providing.  Modify the code to check for mroute.h
and include it if necessary.  I did not modify the non linux/mroute.h
path because I do not have other systems to test on easily.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:32 -04:00
Donald Sharp
60b40924ea PIMD: Fix code to use srandom/random
pimd rolled it's own solution to random #'s, that was not
terribly random.  Rely on the underlying system to generate
random #'s for us

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:32 -04:00
David Lamparter
6b629fe36b *: assorted warning fixes
A few warnings slipped through the cracks...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-05-25 20:38:32 -04:00
David Lamparter
972db29fe7 pimd: fix out of tree build
pimd/Makefile.am was missing srcdir/lib from its include paths, breaking
out-of-tree build regarding route_types.h

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-05-25 20:38:32 -04:00
David Lamparter
1cb17fc701 pimd: cast ioctl values when printing them
ioctl values might be int or long, cast them to unsigned long for
consistent printing.  (They're long on FreeBSD, but were printed with
%d.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-05-25 20:38:32 -04:00
David Lamparter
59e96cda41 pimd: cast to sockaddr_in to sockaddr
While glibc seems to have something in the system headers that prevents
this from triggering a warning, FreeBSD doesn't.  Fix the warning.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-05-25 20:38:32 -04:00
Donald Sharp
469351b349 pimd: Rework pim to handle changes between us and upstream
The code in pimd needs to be updated to handle the changes
we've made to api's that it depends on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-25 20:38:32 -04:00
David Lamparter
7d16e451c3 pimd: mask unused zclient_broken()
this function is used by the currently not present zclient reconnect
code.  It'll be unmasked again when that code hits master.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-05-25 20:38:32 -04:00
David Lamparter
12e41d03bd pimd: merge pimd as of 2015-01-19
Welcome pimd to the Quagga daemon zoo!

This is a merge of commit 77ae369 ("pimd: Log ifindex found for an
interface when zebra lib reports a new connected address."), with
the intermediate "reconnect" changes removed (c9adf00...d274381).
d274381 is replaced with b162ab7, which includes some changes.  In
addition, 4 reconnect-related changes and 1 cosmetic one have been
bumped out.

The rebase command used to produce the branch that is merged here is:
  git rebase --onto b162ab7 c9adf00 77ae369

Note that 3 patches had their author rewritten from
    "Anonymous SR#108542 <>" (which is not a valid git author ID)
to: "Savannah SR#108542 <nbahr@atcorp.com>" (which is the e-mail address
                               listed in the associated Savannah ticket)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-05-25 20:38:32 -04:00