Commit graph

214 commits

Author SHA1 Message Date
saravanank 025725f70d pimd: Show RP source in show ip pim rp-info command
Sw3# sh ip pim rp-info
RP address       group/prefix-list   OIF         I am RP     Source
20.0.0.2         225.1.1.1/32        ens192            no           BSR
9.9.9.9          226.1.1.1/32        (Unknown)         no           BSR
30.0.0.100       229.1.1.5/32        ens192            no        Static

Signed-off-by: Saravanan K <saravanank@vmware.com>
2019-05-14 20:23:15 -07:00
saravanank 4533b847ec pimd: PIM nexthop tracking changes for tracking nexthop path of BSR.
Signed-off-by: Saravanan K <saravanank@vmware.com>
2019-05-14 20:23:15 -07:00
Donald Sharp 43763b11d0 pimd: Tracking of RPF is *separate* from the lookup
Start the separation of tracking a Destination from the act
of looking it up.  The cojoining of these two concepts led
to a bunch of code that had to think about both problems leading
to weird situations and code paths.  Simplify the code by making
pim_ecmp_nexthop_search a static function and we only ever
call pim_ecmp_nexthop_lookup when we need to do a RPF().

pim_ecmp_nexthop_lookup will now attempt to find a stored pnc
and if it finds one it will report on the answer from it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-05 11:12:59 -04:00
Donald Sharp 5bd5131435 pimd: Determining if we are the RP should happen always
When creating new RP information from a `ip pim rp A.B.C.D/M A.B.C.D`
we should determine if we are the RP even if we can or cannot
determine if we have a path to the RP via RPF.

This is because we should determine if we are the RP based upon a
connected ip address match not whether or not we have a path to
the RPF.  We would normally think this is not important but
RPF is inherently asynchronous and we can have a state where
we have registered for nht but have not received the actual
path back yet from zebra.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-05 11:12:59 -04:00
Donald Sharp c9cd7fbc3f pimd: Limit lookup of neighbor since we know we have one
When a new pim neighbor comes up, we need to go through and
mark nexthops that we have received from zebra for reachability
tracking so we can refigure stuff.  If we pass in the new neighbor
we can limit the search to those nexthops out the interface that
the new neighbor has come up.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-02 08:20:02 -04:00
Jafar Al-Gharaibeh aee1decce2
Merge pull request #4040 from donaldsharp/pim_cleanup
Pim cleanup
2019-04-01 10:25:07 -05:00
Donald Sharp f43593d958 pimd: Reduce RP checks a bit
The pim_rp_check_is_my_ip_address function was checking to see
if we were the actual RP as well as the pim_register code
was doing the same thing.  Remove the reduncancy a bit and
just make this function check for that we are the actual receiver
of this data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-28 15:51:49 -04:00
Donald Sharp ff415346e6 pimd: Interfaces can be upto 16 characters
The interface column in pim was limited to 8 or 9 columns
all over the place in pim, fix the code up to allow interface
length to be up to 16 columns.

Ticket: CM-23083
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-26 21:01:00 -04:00
Donald Sharp a6170d839a
Merge pull request #3863 from patrasar/RP_addition_deletion_changes
Rp addition deletion changes
2019-03-20 18:31:01 -04:00
Quentin Young 0a22ddfbb1 *: remove null check before XFREE
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:46 +00:00
Sarita Patra 8cfd72682e pimd: update pim upstream structure when RP gets deleted
When a RP gets deleted, find all the (*, G) upstream whose
group belongs to the deleted RP.

case 1: if the group belongs to any other rp, then call
pim_upstream_update() to update the upstream addr and rpf
information.

case 2: If no RP found for the group, then clear the pim
upstream address and rpf information.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-24 23:27:16 -08:00
Sarita Patra 28309df051 pimd: update pim upstream structure when RP gets configured
When a new RP is configured, find all the (*, G) upstream whose
group belongs to the new RP and then update the upstream structure
with the below fields.
1. De-register for the old RP.
2. Set the upstream address as new RP
3. Register for the new RP.
4. Update the upstream rpf information and kernel multicast forwarding
cache(MFC), if the new RP is reachable.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-24 23:27:16 -08:00
Sarita Patra 732c209c98 pimd: create dummy (*,G) upstream when RP not configured/reachable
In this commit, we are creating a dummy upstream & dummy channel_oil
for (*, G) when RP is not configured or not reachable.
Dummy upstream: <upstream_addr = INADDR_ANY, rpf = Unknown>
Dummy channel oil: <iif = MAXVIFS>

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-24 21:30:06 -08:00
Sarita Patra 6b44b40141 pimd: reject inconsistent address/mask "ip pim rp command"
Issue: Configure "ip pim rp x.x.x.x 225.0.0.0/4".
Show running config shows "ip pim rp x.x.x.x 224.0.0.0/4"
This is mis-leading.

Root-cause: Internally 225.0.0.0/4 is getting converted to
224.0.0.0/4 group mask, since the prefix length is 4.

Fix: Restrict the user to configure inconsistent group address
mask by throughing a cli error "Inconsistent address and mask".

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-08 01:35:21 -08:00
David Lamparter 6a154c8812 *: list_delete_and_null() -> list_delete()
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02 11:40:52 +02:00
Quentin Young 1c50c1c0d6 *: style for EC replacements
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:38:57 +00:00
Quentin Young 450971aa99 *: LIB_[ERR|WARN] -> EC_LIB
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:34:28 +00:00
Don Slice 088f109866 bgpd, ospfd, pimd, zebra: Convert more use_json locations to bool
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-09-04 17:39:04 +00:00
Russ White 783d61be04
Merge pull request #2849 from patrasar/memory_leak_nht
Fix memory leak pim nexthop creation
2018-08-16 11:31:21 -04:00
Sarita Patra 1159c202fc pimd: Fix memory leak pim nexthop creation
While terminating pim instance, the memory allocated for pim nexthop
should be released before deallocating the memory of pim nexthop cache(pnc).
This resolves the memory leak detected in pnc->nexthop creation.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2018-08-16 12:15:26 -07:00
Quentin Young af4c27286d *: rename zlog_fer -> flog_err
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Donald Sharp d9ff430273 pimd: Add pim_errors and define some pim specific errors
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Donald Sharp 3613d89844 pimd: Convert over to use LIB_ERR_XXX for zlog_err
Convert, where appropriate, the zlog_err functions to zlog_ferr
for the LIB_ERR_XXX enums

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Donald Sharp 0ce1ca805d *: ALLOC calls cannot fail
There is no need to check for failure of a ALLOC call
as that any failure to do so will result in a assert
happening.  So we can safely remove all of this code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-11 17:14:58 +02:00
F. Aragon 56cb79b6d5
bgpd pimd: return check (Coverity 1472232 1472234)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-08-06 18:17:39 +02:00
Donald Sharp ff823fc915 pimd: Cleanup rp_info->plist
PIM is leaking the plist data structure in some shutdown
cases.  Additionally trust XFREE

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-02 20:02:13 -04:00
Mark Stapp 123214efb8 libs, daemons: use const in route-map apply
Use 'const prefix *' in route-map apply apis; led to some
corresponding changes in several daemons.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-07-23 10:34:35 -04:00
Jafar Al-Gharaibeh 96b3001abc
Merge pull request #2635 from donaldsharp/more_pim_neighbor
More pim neighbor
2018-07-19 10:47:10 -05:00
Donald Sharp 2b57b94834 pimd: Remove unnecessary alloc failures
Remove from pim unnecessary alloc failure testing
as that alloc failure will cause an assert.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-08 12:09:21 -04:00
Donald Sharp ff5d90c2e9 pimd: Fix up > 80 columns
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-07 16:00:48 -04:00
Donald Sharp 53bc94b070 pimd: Make code consistent in regards to lookup
In places where we do a pim_ecmp_nexthop_search, also
use pim_ecmp_nexthop_lookup instead of the single path
case of pim_nexthop_lookup.

This is in preparation of more serious surgery to fix
the weird api of pim_find_or_track_nexthop.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-07 10:15:02 -04:00
Martin Buck 5271457d94 pimd: Fix debug messages
Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2018-06-04 14:27:48 +02:00
Lou Berger 97610b589f
Merge pull request #1921 from donaldsharp/pim_stuff
Pim stuff
2018-03-30 12:03:33 -04:00
Quentin Young d7c0a89a3a
*: use C99 standard fixed-width integer types
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t

Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-27 15:13:34 -04:00
Donald Sharp bfc9201928 pimd: Move some data tracking variables per VRF
There were a few more global variables that needed to be per
vrf.  So move them over.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-17 21:34:55 -04:00
Lou Berger 996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Renato Westphal 451fda4f9a *: use the FOR_ALL_INTERFACES abstraction from babeld
This improves code readability and also future-proofs our codebase
against new changes in the data structure used to store interfaces.

The FOR_ALL_INTERFACES_ADDRESSES macro was also moved to lib/ but
for now only babeld is using it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:05:46 -03:00
Renato Westphal f4e14fdba7 *: use rb-trees to store interfaces instead of sorted linked-lists
This is an important optimization for users running FRR on systems with
a large number of interfaces (e.g. thousands of tunnels). Red-black
trees scale much better than sorted linked-lists and also store the
elements in an ordered way (contrary to hash tables).

This is a big patch but the interesting bits are all in lib/if.[ch].

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:05:02 -03:00
Donald Sharp affe9e9983 *: Convert list_delete(struct list *) to ** to allow nulling
Convert the list_delete(struct list *) function to use
struct list **.  This is to allow the list pointer to be nulled.

I keep running into uses of this list_delete function where we
forget to set the returned pointer to NULL and attempt to use
it and then experience a crash, usually after the developer
has long since left the building.

Let's make the api explicit in it setting the list pointer
to null.

Cynical Prediction:  This code will expose a attempt
to use the NULL'ed list pointer in some obscure bit
of code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05 10:53:13 -04:00
Donald Sharp 4646b86ab1 pimd: Some compilers are complaining about my bp
Fix the bp variable possibly ( yeah not really ) be
initialized upon use.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-27 07:55:53 -04:00
Philippe Guibert 5c4dc90307 Merge pull request #1069 from donaldsharp/rfc_plist
PIM: allow overlapping group ranges for prefix-list and static RP's
2017-09-26 17:33:29 +02:00
Donald Sharp 3d225d48f0 pimd: Add new 'debug pim nht rp' command
All the rp debugs were a mish-mash of TRACE or ZEBRA,
but the reality they were all focused on handling NHT
issues associated with the RP's.  So let's create
a new debug 'debug pim nht rp' if you are having
issues with RP's.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-14 11:17:28 -04:00
Donald Sharp 89b680829e pimd: Add ability to lookup RP group by table.
This feature does this:

Add the ability to store the non-prefix static RP
entries into a table.  Then to lookup the G to
find the RP in that table, finding the longest
prefix match across both prefix-lists and
static RP's.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-31 10:30:19 -04:00
Donald Sharp b77b155068 pimd: Match on longest prefix when searching for RP
When we are searching for a RP to use, amongst
many RP's and separate prefix-lists, Match on
the longest prefix specified to choose the
correct RP.

Example:
ip pim rp 4.3.2.1 prefix-list A
ip pim rp 4.3.2.2 prefix-list B
ip pim rp 4.3.2.3 prefix-list C

ip prefix-list A seq 5 permit 225.0.0.0/8
ip prefix-list B seq 5 permit 225.1.0.0/16
ip prefix-list C seq 5 permit 225.1.1.0/24

Old behavior:  Group 225.1.1.14 comes in and
we need to find the RP to use, we would match
on the first prefix-list A( since we are searching
based on a sorted link list of RP address ) and
select 4.3.2.1 as our RP

New behavior:  Group 225.1.1.14 comes in and
we need to find theRP to use, we now will
match on C( longest prefix match ) and select
4.3.2.3 as our RP.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-31 10:30:19 -04:00
Donald Sharp 093c928fc1 pimd: Improve handling in pim_rp_init
When we are starting up improve the error handling of
pim_rp_init and fix some memory leaks.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-31 10:30:19 -04:00
Donald Sharp e691f179b6 pimd: Cleanup a variety of SA issues
1) Error check return from setsockopt and sockets
2) Check return codes for str2prefix
3) Clean up some potential NULL References

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 20:34:28 -04:00
Donald Sharp 7c59195031 pimd: NHT upstream list is inefficient
The NHT upstream list at scale is horribly inefficient due to keeping
a sorted list of upstream entries.  The attempting to find
the upstream and the insertion of it into the upstream_list
was consuming a large amount of cpu cycles.

Convert to a hash, allow add/deletions to effectively become
O(1) events.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-25 14:18:57 -04:00
Donald Sharp 6e1ef388f3 pimd: Clean PNC cache handling on shutdown
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-25 14:18:57 -04:00
Donald Sharp 64c8653095 pimd: Put 'struct pim_instance *' as the first function parameter
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:41 -04:00
Donald Sharp c68ba0d7bf pimd: Convert pim_cmd.c to use correct pim instance
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:38 -04:00
Donald Sharp 0c8b717ee6 pimd: Add code to write spaces or not before 'ip pim rp'
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:37 -04:00
Donald Sharp 472ad3832c pimd: Make msdp struct pim_instance * aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:37 -04:00
Donald Sharp d9c9a9ee06 pimd: Convert pim_rp.c to use 'struct pim_instance *'
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:36 -04:00
Donald Sharp fec883d95a pimd: pim_rp.c -> convert pimg to pim
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:35 -04:00
Donald Sharp 25b787a287 pimd: Remove pimg from pim_nht.c in totality
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:35 -04:00
Donald Sharp 25bdac421e pimd: Add 'struct pim_instance' to find_or_track_nexthop
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:35 -04:00
Donald Sharp d0a4f55d5d pimd: Make nexthop cache pim instance aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:35 -04:00
Donald Sharp cb9c7c50d3 pimd: Refactor some functions
A bunch of functions had return values that were never
checked for ( and not needed ) and opposite return values
for proper calling function boolean logic.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:35 -04:00
Donald Sharp c2cf4b0230 pimd: Refactor code to be in better spots
1) Create pim_instance.[ch] to allow us to handle the instance information there
2) Refactor some pim_rpf_ and some pim_rp commands into appropriate files and
appropriate includes.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:35 -04:00
Donald Sharp 2e8345c139 pimd: Error check str2prefix
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:34 -04:00
Donald Sharp 0708beb1f4 pimd: Cleanup use of VRF_DEFAULT to pimg->vrf_id
Use the appropriate vrf_id instead of always defaulting
to VRF_DEFAULT

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:33 -04:00
David Lamparter 9d303b37d7 Revert "*: reindent pt. 2"
This reverts commit c14777c6bf.

clang 5 is not widely available enough for people to indent with.  This
is particularly problematic when rebasing/adjusting branches.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-22 14:52:33 +02:00
whitespace / reindent c14777c6bf
*: reindent pt. 2
w/ clang 5

* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
2017-07-17 15:26:02 -04:00
whitespace / reindent d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
David Lamparter 5c7571d43f *: ditch vty_outln(), part 1 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13 20:29:22 +02:00
Quentin Young 96ade3ed77 *: use vty_outln
Saves 400 lines

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:31:28 +00:00
Donald Sharp ad5233c886 pimd: Allow secondary address comparisons to work
The secondary address comparison done to determine if we are
an RP for a specified address was comparing A.B.C.D/32 to A.B.C.D/0
because when we created the rp_info we were not setting the prefixlen

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-23 15:31:37 -04:00
David Lamparter 896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
Donald Sharp 6281320446 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-08 16:51:21 -04:00
Chirag Shah 4ba87bb9e2 pimd: Fix WG/SGRpt & WG J/P processing
During processing of Join/Prune,
for a S,G entry, current state is SGRpt, when only *,G is
received, need to clear SGRpt and add/inherit the *,G OIF to S,G so
it can forward traffic to downstream where *,G is received.
Upon receiving SGRpt prune remove the inherited *,G OIF.

From, downstream router received *,G Prune along with SGRpt
prune. Avoid sending *,G and SGRpt Prune together.
Reset upstream_del reset ifchannel to NULL.

Testing Done:
Run failed smoke test of sending data packets, trigger SPT switchover,
*,G path received SGRpt later data traffic stopped S,G ages out from LHR, sends only
*,G join to upstream, verified S,G entry inherit the OIF.
Upon receiving SGRpt deletes inherited oif and retains in SGRpt state.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-05-06 17:38:18 -07:00
Chirag Shah 815c33c92f pimd: fix channel_oil and upstream RPF in sync
During PIM Neighbor change/UP event, pim_scan_oil api
scans all channel oil to see any rpf impacted. Instead of
passing current upstream's RPF it passes current RPF as 0 and
does query to rib for nexhtop (without ECMP/Rebalance). This creates
inconsist RPF between Upstream and Channel oil.
In Channel Oil keep backward pointer to upstream DB and fetch up's
RPF and passed to channel_oil scan.
Decrement channel_oil ref_count in upstream_del when decrementing
up ref_count and it is not the last.
Created ECMP based FIB lookup API.

Testing Done:
Performed following testing on tester setup:
5 x LHR, 4 x MSDP Spines, 6 Sources each sending to 1023 groups from one of the spines.
Total send rate 8Mpps.
Test that caused problems was to reboot every device at the same time.
After fix performed 5 iterations of reboot devices and show no sign of the problem.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-05-06 17:38:18 -07:00
Donald Sharp 05ba625af7 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-02 15:52:09 -04:00
Chirag Shah 1131c2eb3b pimd: fix pimd crashes around pim rpf
During neighbor down event, all upstream entries rpf lookup may result
into nhop address with 0.0.0.0 and rpf interface info being NULL.
Put preventin check where rpf interface info is accessed.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-04-25 12:52:04 -07:00
Chirag Shah 633988a70d pimd: Pim Nexthop Tracking support with ECMP
In this patch, PIM nexthop tracking uses locally populated nexthop cached list
to determine ECMP based nexthop (w/ ECMP knob enabled), otherwise picks
the first nexthop as RPF.
Introduced '[no] ip pim ecmp' command to enable/disable PIM ECMP knob.
By default, PIM ECMP is disabled.
Intorudced '[no] ip pim ecmp rebalance' command to provide existing mcache
entry to switch new path based on hash chosen path.
Introduced, show command to display pim registered addresses and respective nexthops.
Introuduce, show command to find nexthop and out interface for (S,G) or (RP,G).
Re-Register an address with nexthop when Interface UP event received,
to ensure the PIM nexthop cache is updated (being PIM enabled).
During PIM neighbor UP, traverse all RPs and Upstreams nexthop and determine, if
any of nexthop's IPv4 address changes/resolves due to neigbor UP event.

Testing Done: Run various LHR, RP and FHR related cases to resolve RPF using
nexthop cache with ECMP knob disabled, performed interface/PIM neighbor flap events.
Executed pim-smoke with knob disabled.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
(cherry picked from commit cba4448178)
2017-04-25 12:51:18 -07:00
Renato Westphal 94f6a203b7 Merge pull request #345 from chiragshah6/pim_dev
pimd: Pim ECMP changes along with nexthop tracking using cached DB
2017-04-24 16:59:58 -03:00
Chirag Shah cba4448178 pimd: Pim Nexthop Tracking support with ECMP
In this patch, PIM nexthop tracking uses locally populated nexthop cached list
to determine ECMP based nexthop (w/ ECMP knob enabled), otherwise picks
the first nexthop as RPF.
Introduced '[no] ip pim ecmp' command to enable/disable PIM ECMP knob.
By default, PIM ECMP is disabled.
Intorudced '[no] ip pim ecmp rebalance' command to provide existing mcache
entry to switch new path based on hash chosen path.
Introduced, show command to display pim registered addresses and respective nexthops.
Introuduce, show command to find nexthop and out interface for (S,G) or (RP,G).
Re-Register an address with nexthop when Interface UP event received,
to ensure the PIM nexthop cache is updated (being PIM enabled).
During PIM neighbor UP, traverse all RPs and Upstreams nexthop and determine, if
any of nexthop's IPv4 address changes/resolves due to neigbor UP event.

Testing Done: Run various LHR, RP and FHR related cases to resolve RPF using
nexthop cache with ECMP knob disabled, performed interface/PIM neighbor flap events.
Executed pim-smoke with knob disabled.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-04-06 11:18:07 -07:00
Donald Sharp 096398104b Merge branch 'master' into pim_5549 2017-04-05 12:49:17 -04:00
Donald Sharp ff3745c26a pimd: Remove impossible conditions from test
It is impossible for the list->cmp function to
ever be handed NULL values as the arguments.

Clean up this in the code.

Additionally consolidate the exact same two functions
into 1 function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-31 16:47:00 -04:00
Donald Sharp 7399328a6f pimd: Fix RP determination to handle secondary addresses better
When we are checking RP addresses and looking at the secondary
address.  With the addition of the ability to handle v6 addresses
in the secondary list.  Assuming that the secondary address
is a v4 address is a no go.

Convert to prefix_same.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-30 09:34:03 -04:00
Jafar Al-Gharaibeh 9ef2260577 Merge pull request #280 from donaldsharp/more_pim
More pim
2017-03-21 10:34:40 -05:00
Chirag Shah 1bc9827622 pimd: Nexthop tracking support
Add pim Nexthop tracking feature 1st part where, specific RP or Source address (unicast address)
register with Zebra. Once nexthop update received from Zebra for a given address, scan RP or upstream
entries impacted by the change in nexthop.

Reviewed By: CCR-5761, Donald Sharp <sharpd@cumulusnetworks.com>
Testing Done: Tested with multiple RPs and multiple *,G entries at LHR.
Add new Nexthop or remove one of the link towards RP and verify RP and upstream nexthop update.
similar test done at RP with multiple S,G entries to reach source.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-03-16 18:53:28 -04:00
Donald Sharp c5e2cb11ad lib, pimd, zebra: Convert if_lookup_exact_address to VRF only
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:30:58 -04: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 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
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
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 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 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 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
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
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
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
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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