Commit Graph

152 Commits

Author SHA1 Message Date
Donald Sharp
d3cc1e4518 pimd: Remove pim->vrf_id and use pim->vrf->vrf_id
VRF creation can happen from either cli or from
knowledged about the vrf learned from zebra.
In the case where we learn about the vrf from
the cli, the vrf id is UNKNOWN.  Upon actual
creation of the vrf, lib/vrf.c touches up the vrf_id
and calls pim_vrf_enable to turn it on properly.
At this point in time we have a pim->vrf_id of
UNKNOWN and the vrf->vrf_id of the right value.

There is no point in duplicating this data.  So just
remove all pim->vrf_id and use the vrf->vrf_id instead
since we keep a copy of the pim->vrf pointer.

This will remove some crashes where we expect the
pim->vrf_id to be usable and it's not.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-12 14:36:59 -04:00
Donald Sharp
e5981db7e9 pimd: There exists a path where on vrf bringup we do not create the pimreg
When creating configuration for a vrf *Before* the vrf has been
created, pim will not properly create the pimreg device and
we will promptly crash when we try to pass data.

Put some code checks in place to ensure that the pimreg is
created for vrf's.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-12 14:08:07 -04:00
David Lamparter
df5dfb77b5 pimd: zassert => assert
No point in having pimd use zassert() while everything else uses plain
assert().

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-04-23 12:25:47 +02:00
Donatas Abraitis
7c98d487b8 *: Replace typo (supress => suppress)
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-11-17 12:13:38 +02:00
Donatas Abraitis
2dbe669bdf :* Convert prefix2str to %pFX
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-22 09:07:41 +03:00
Nathan Bahr
efe6f18590 pimd: fix IGMP receive handling
IGMP packets received from a source that does not match the subnet
of any configured addresses on the receive interface should be
ignored.
Also, find and use the correct IGMP socket object for the received
IGMP packet.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2020-08-26 10:46:42 -05:00
Donald Sharp
ddba0a04a9 pimd: Allow multiple secondary addresses to work
Suppose you have more than 2 addresses on a pim interface:
lo              up      default         10.255.0.1/32
                                        10.255.0.101/32
                                        10.255.0.254/32

A `show ip pim int lo` gives us this:

eva# show ip pim interface lo
Interface  : lo
State      : up
Address    : 10.255.0.1 (primary)
             10.255.0.101/32

When we go look at the code that pulls secondary addresses in
we are using a prefix_cmp to know if we know about a secondary already
but were expecting true values instead of -1/0/1 being returned.

Modify code so that pim sees all secondary addresses

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-10 10:32:17 -04:00
Donald Sharp
88b5958e31
Merge pull request #6054 from sarav511/dr2ndr
pimd: When DR becomes non DR, Still sends register packets to RP
2020-06-01 07:58:32 -04:00
Rafael Zalamena
5920b3eb38 *: replace all random() calls
Replace all `random()` calls with a function called `frr_weak_random()`
and make it clear that it is only supposed to be used for weak random
applications.

Use the annotation described by the Coverity Scan documentation to
ignore `random()` call warnings.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-17 20:57:43 -03:00
Donald Sharp
eb728e0746
Merge pull request #6027 from sarav511/vrfloop
pimd: crash while finding primary address.
2020-04-10 14:02:28 -04:00
Russ White
e89bb41d80
Merge pull request #6047 from sarav511/hold0
pimd: Pim hello should be sent with 0 hold time on address change onold src ip
2020-03-24 10:19:17 -04:00
saravanank
46a9ea8bfa pimd: When DR becomes non DR, couldreg state events not handled.
RCA: Upstreams which are in register state other than noinfo, doesnt remove
register tunnel from oif after it becomes nonDR

Fix: scan upstreams with iif as the old dr and check if couldReg becomes false.
If couldreg becomes false from true, remove regiface and stop reg timer.
Do not disturb the entry. Later the entry shall be removed by kat expiry.

Signed-off-by: Saravanan K <saravanank@vmware.com>
2020-03-19 18:27:37 -07:00
saravanank
b279f95c70 pimd: Pim hello should be sent with 0 hold time on address change on old src ip
RCA: This was todo item in current code base

Fix: Hello sent with 0 hold time before we update the pim ifp primary address

Signed-off-by: Saravanan K <saravanank@vmware.com>
2020-03-19 03:06:46 -07:00
saravanank
2430f0579a pimd: crash while finding primary address.
RCA:
Trying to get primary address for the interface.
Unnumbered interface pick address from vrf device for non default.
While doing so it ends up in recursion without exit condition if vrf dev doesnt have any address.

Solution:
Break the recursion by checking if it is vrf device.

Signed-off-by: Saravanan K <saravanank@vmware.com>
2020-03-19 02:01:10 -07:00
saravanank
ccf696e85f pimd: Do not allow to configure multicast on more than MAXVIF interfaces
RCA: When configured more than 32(MAXVIS), the inerfaces that are configured
after 32nd interfaces have the value of MAXVIF.
This is used as index to access the free vif tracker of array size 32(MAXVIFS).
So the channel oil list pointer which is present as the next field in pim structure get corrupt, when updating free vif.
This gets accessed during rpf update resulting in crash.

Fix: Refrain from allocating mcast interface structure and throw config error when more than MAXVIFS are attempted to configure.
Max vif checks are exempted for vrf device and pimreg as vrf device will be the first interface and not expected to fail and pimreg has reserved vif.
vxlan tunnel termination device creation has this check and throw warning on max vif.
All other creation are through CLI.

Signed-off-by: Saravanan K <saravanank@vmware.com>
2020-03-16 19:49:18 -07:00
Donald Sharp
5e81f5dd1a *: Finish off the __PRETTY_FUNCTION__ to __func__
FINISH IT

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 09:23:22 -05:00
Donatas Abraitis
15569c58f8 *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__
Just keep the code cool.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05 20:23:23 +02:00
Anuradha Karuppiah
650d9ad1ac pimd: handle ipmr-lo operational state changes
ipmr-lo is an internally added device used for multicast vxlan tunnel
termination. This device is not expected to be managed by the admin
however in the case it is accidentally shut we need to be able handle
it by recovering when it is "no shut" again.

Ticket: CM-24985

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-02-14 09:18:30 -08:00
Donald Sharp
85d25587bf eigrpd, ospfd, pimd: Fix assumption that interface may not be up
Commit: ddbf3e6060

This commit modified the interface up handling code in
ZAPI such that the zclient handled the decoding for you.
Prior to this commit ospf assumed that it could use the
old ifp pointer to know state before reading the stream.
This lead to a situation where ospf would `smartly` track
and do the right thing in this situation.  This commit
changed this assumption and in certain scenarios, say
a interface was changed after it was already up would
lead to situations where ospf would not properly handle
the new interface up.

Modify ospf to track data that is important to it in
it's interface->info pointer.

This code pattern was followed in both eigrp and pim.
In eigrp's case it was just behaving weirdly in any event
so fixing this pattern is not a big deal.  In pim's
case it was not properly using this so it's a no-op
to fix.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-04 14:23:20 -05:00
Stephen Worley
d5c65bf1a2 *: Cleanup interface creation apis
Cleanup the interface creation apis to make it more
clear what they are doing.

Make it explicit that the creation via name/ifindex will
only add it to the appropriate list.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-09 20:24:31 -04:00
Donald Sharp
3c3c325203 *: Convert zapi->interface_delete to ifp callback
Convert the callback of the interface_delete to the new
ifp callback.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
b0b69e59f4 *: Convert interface_down to interface down callback
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
ddbf3e6060 *: Convert from ->interface_up to the interface callback
For all the places we have a zclient->interface_up convert
them to use the interface ifp_up callback instead.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
ef7bd2a3d5 *: Switch all zclient->interface_add to interface create callback
Switch the zclient->interface_add functionality to have everyone
use the interface create callback in lib/if.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
138c5a7450 *: Add infrastructure to support zapi interface callbacks
Start the conversion to allow zapi interface callbacks to be
controlled like vrf creation/destruction/change callbacks.

This will allow us to consolidate control into the interface.c
instead of having each daemon read the stream and react accordingly.
This will hopefully reduce a bunch of cut-n-paste stuff

Create 4 new callback functions that will be controlled by
lib/if.c

create -> A upper level protocol receives an interface creation event
The ifp is brand spanking newly created in the system.
up -> A upper level protocol receives a interface up event
This means the interface is up and ready to go.
down -> A upper level protocol receives a interface down
destroy -> A upper level protocol receives a destroy event
This means to delete the pointers associated with it.

At this point this is just boilerplate setup for future commits.
There is no new functionality.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Quentin Young
2951a7a4c2 *: s/TRUE/true/, s/FALSE/false/
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-07-01 17:26:05 +00:00
Donald Sharp
11884868d4 pimd: ALLOC functions cannot fail.
There is no need to check for ALLOC function failures
in the code base.  If we cannot get more memory we
assert.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-19 19:07:12 -04:00
Donald Sharp
008def8643
Merge pull request #4369 from patrasar/lmqc_lmqt
pimd: new cli to configure last-member-query-count & last-member-quer…
2019-05-30 21:23:11 -04:00
Sarita Patra
59115451a8 pimd: new cli to configure last-member-query-count & last-member-query-interval
Introduce new cli commands ip igmp last-member-query-count <1-7>
ip igmp last-member-query-interval <1-255> deciseconds.

Display the config in show running config and show ip igmp interface

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-05-29 20:36:16 -07:00
saravanank
19de48b981 pimd: Enable BSM processing on all interfaces by default
set the flags for bsm processing and unicast bsm processing to true during pim interface creation
2019-05-14 21:42:22 -07:00
Anuradha Karuppiah
269c1fe1e7 pimd: update vxlan mroute entries when the lo or peerlink vif is updated
For vxlan origination mroutes the IIF is pinned to
a. lo for single VTEPs
b. peerlink-rif for anycast VTEPs

This commit includes the changes to react to  pim-vifi add/del for these
devices.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:23 -07:00
Anuradha Karuppiah
b1891fa084 pimd: API for enabling pim on the vxlan term device ipmr-lo
ipmr-lo is a dummy netdev with no additional addressing requirements -
root@TORS1:~# ip -d link show ipmr-lo
28: ipmr-lo: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether 12:5a:ae:74:51:a2 brd ff:ff:ff:ff:ff:ff promiscuity 0
    dummy addrgenmode eui64
root@TORS1:~#

This device is used by pim-vxlan to signify multicast-vxlan-tunnel
termination.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:21 -07: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
Donald Sharp
414d885aac pimd: Add hidden 'ip pim active-active` command
Add a command to track if an interface should be in active-active
mode or not.  This command is hidden at this time because it
is not finished fully.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31 09:28:39 -05:00
Donald Sharp
5b45753eff pimd: Convert qpim_t_periodic into the struct pim_router structure
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04 12:23:39 -05: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
Donald Sharp
85a13586ed pimd: use bool instead of int to pass true/false
In pim_if_new use bool instead of an int to pass
true/false values for what we should create the
pim interface type for.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-17 14:09:06 -04:00
Donald Sharp
59752d4ea5 pimd: Actually create vif's in non-integrated config
The startup of a non-integrated config was not properly
allowing for startup to create the vif when we have
not learned about the interface we are trying to configure
at this point in time.  Actually notice when we are
trying to create a pimreg device or not to properly
notice when to attempt to create the vif or not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-17 13:58:59 -04:00
Don Slice
fec4ca191e zebra: if multiple connecteds, select loopback or vrf if present
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-23 18:49:48 +00:00
Donald Sharp
c936e76f3c pimd: pim_socket_join_source is only called from one place
The pim_socket_join_source function only ever calls
pim_igmp_join_source and pim_socket_join_source is only
called from 1 place.  Skip the level of indirection.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-02 10:09:09 -04: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
399495806c pimd: Cleanup all pim_ifp pointers on termination
Properly cleanup pim_ifp pointers on termination

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-11 18:36:24 -04:00
Donald Sharp
e55a43d491 pimd: Remove expensive lookup for if a device is a vrf device
Interfaces know if they are a vrf device or not and this data
is passed up to the protocol.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-30 07:56:24 -04:00
Donald Sharp
7f432a28e0 pimd: Cleanup pim_if_is_loopback
The interface itself knows if it is a vrf device or
not, so let's just use a check for that in the decision
if a interface is a loopback or not.

Additionally modify function to return a bool.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-30 07:53:01 -04:00
Mladen Sablic
f83f396624 pimd: mtrace only IGMP sockets
Feature of mtrace only IGMP sockets on pim sm and pim
ssm interfaces. Modifed IGMP socket creation and show
igmp interface command output.

Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-03-08 09:40:48 +01: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
Donald Sharp
55cd0f612a *: Make assignment from RB_ROOT in while loop work better
Fix up the assignment of the variable = RB_ROOT inside of
while loop patter we were using.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-23 07:08:36 -05:00
Donald Sharp
b8ca17c230 pimd: Fix memory allocation error
When creating the pim_ifp, and we run out of memory there
existed a chance that we would dereference the failed memory
pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-12-14 10:43:53 -05:00
Donald Sharp
819f099bdd pimd: Cleanup vrf SA issues exposed by recent commits
A recent commit has shown that we were not consistent with
handling of the vrf lookup.  Adjust pim to do the right
thing with vrf lookup to be consistent and to make SA
happier.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-25 13:43:51 -04: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