Commit graph

521 commits

Author SHA1 Message Date
David Lamparter b09bd804ac pimd: move BSM clear into BSM code
... where it actually belongs.  And make a bunch of stuff static, since
it's no longer used across files now.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 11:17:44 +01:00
David Lamparter 4efdb9c628 pimd: clean up BSR NHT & fix parallel links
The Bootstrap message RX path needs a RPF check for the BSR address,
and this is implemented both incorrectly as well as quite ugly.

Clean up and fix case when we have multiple interfaces to the same LAN
and/or ECMP nexthops (both would cause message duplication, the former
can even cause BSM forwarding loops.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 11:17:44 +01:00
Donald Sharp e1d1b1dec7 pimd: Remove default from enum based switch
enum based switches should never use default.  It makes
it very hard to fix and find issues when the enum is
changed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-10 17:35:22 -05:00
Russ White 5393318d81
Merge pull request #9682 from adrianomarto/mesh-group-fix
pimd: fixing command "no ip msdp mesh-group member"
2021-09-28 10:21:17 -04:00
Adriano Marto Reis 4687748973 pimd: fixing command "no ip msdp mesh-group member"
Deleting a mesh-group member no longer deletes the mesh-group.

Complete bug description at:
https://github.com/FRRouting/frr/issues/9664

Signed-off-by: Adriano Marto Reis <adrianomarto@gmail.com>
2021-09-28 12:43:52 +10:00
David Lamparter 200f56710a pimd: fix UAF/heap corruption in BSM code
This `XFREE()` call is in plainly in the wrong spot.  `rp_all` (the
224.0.0.0/4 entry) isn't supposed to be free'd ever, and the
conditional above makes quite clear that it remains in use.

It may be possible to exploit this as a heap corruption bug, maybe even
as RCE.  I haven't tried; I randomly noticed this while working on the
BSM code.  Luckily this code is only run by the CLI for the clear
command, so the surface is very small.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-09-27 10:37:23 +02:00
David Lamparter a1a4295ade pimd: reformat after dropping indent levels
Intentionally separate here because the previous patch does a whole
bunch of "move stuff up 1 level of indentation", and reviewing that is
easier when you can use the ignore-whitespace option on diff.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-27 10:46:53 +02:00
David Lamparter dda4d23cca pimd: IGMP memberships are not querier specific
IGMP group/source memberships are a property of the interface;  the
particular IP address that the querier used to collect the data is
irrelevant.

... and IGMP packets get delivered only once to pimd anyway, since we
receive them on the "global" per-VRF IGMP socket.  (The one in igmp_sock
is only used for sending queries.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-27 10:42:53 +02:00
Christian Hopps 11ca35875c pimd: change ranges to 1..max, type align with IETF YANG.
While defaults are good picks for "reasonable" guesses, min and max
range values really aren't. Operators and experimenters often like to
configure "unreasonable" values to stress test, tests boundary
conditions and explore innovations.

With that in mind, change all ranges to 1..max (of type).

While we're here add optional ignored values in the "no" CLI forms.

Signed-off-by: Christian Hopps <chopps@labn.net>
2021-08-18 22:08:33 -04:00
Donatas Abraitis 7e736c7706
Merge pull request #9253 from donaldsharp/igmp_no
pimd: Allow more permisive versions of some no commands
2021-08-07 22:49:25 +03:00
Donald Sharp bb9ff200b3 pimd: Allow more permisive versions of some no commands
Some no commands were not accepting values and left us in
a situation where a cut-n-paste of the non-no line would
not be properly accepted.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-08-01 20:22:36 -04:00
Igor Ryzhov 9da01b0b7b *: cleanup interface node installation
The only difference in daemons' interface node definition is the config
write function. No need to define the node in every daemon, just pass
the callback as an argument to a library function and define the node
there.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-29 21:35:25 +03:00
Donald Sharp 53dc1b16aa pimd: Allow join prune intervals to be as small as 5 seconds
Allow the join-prune interval to be as small as 5 seconds instead
of limiting the value to 60.

This can and will come at a price of being able to converge less
mroutes.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-07-26 10:02:21 -04:00
Donald Sharp 6afa0b137a
Merge pull request #8983 from mobash-rasool/pim-upstreaming-activity
pimd: Minor fixes for BSM Show CLI and Hold Timer CLI
2021-07-22 08:35:06 -04:00
github login name 142774530a pimd: make pim interface hold interval range 1-630
Making the interface holdtime range to 3.5 times the hello-time

As per 7761, Section 4.11:
The Holdtime in a Hello message should be set to
   (3.5 * Hello_Period), giving a default value of 105 seconds.

Therefore providing the user also to configure max upto 3.5 times
the hello timer interval.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-06 22:51:10 -07:00
github login name 9a7cee2673 pimd: To print querierIP address on the querier and nonQuerier IGMP enabled intf
1. Add the querierIP object to igmp_sock datastruct to save the IP address of the querier.
   Management of the querierIP object is added.
2. To show the querier IP address in the CLI "show ip igmp interface".
3. To add the json object querierIP for querier IP address in the json CLI "show ip igmp interface json".

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-06 00:14:28 -07:00
github login name 6eedc1a5b9 pimd: Adding BSM status in the show commands
Adding BSM status in the CLI and json output for
"show ip pim interface"

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-05 04:29:02 -07:00
Rafael Zalamena 622fd3f11e pimd: support MSDP global timers configuration
Users can now configure:

 * Hold time
 * Keep alive
 * Connection retry

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-07-01 09:59:51 -03:00
Donald Sharp 70ec4ea388
Merge pull request #8871 from opensourcerouting/msdp-peer-rework
pimd: rework MSDP peer and add tests
2021-07-01 07:31:21 -04:00
Jafar Al-Gharaibeh 530b12cf6e pimd: make show ip mroute output consistent
We had 3 different string output formats in various places.
Make them all the same.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2021-06-29 14:19:35 -05:00
Rafael Zalamena 0ce04a08a3 pimd: allow MSDP group name 'default'
Don't assign a default group name for non meshed group peers, instead
use a flag.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-06-25 15:06:20 -03:00
Rafael Zalamena 56697b3e0a pimd: rework MSDP northbound integration
Simplify the MSDP handling functions and allow source changes.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-06-25 15:06:20 -03:00
Rafael Zalamena e2809e618b pimd: rework MSDP mesh-group code
Fully utilize the northbound to hold pointers to our private data
instead of searching for data structures every time we need to change a
configuration.

Highlights:

 * Support multiple mesh groups per PIM instance (instead of one)
 * Use DEFPY instead of DEFUN to reduce code complexity
 * Use northbound private pointers to store data structures
 * Reduce callback names size

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-06-09 12:32:24 -03:00
Martin Winter 202af4abaa
Merge pull request #8616 from donaldsharp/pim_ordering
pimd: There exists a path where on vrf bringup we do not create the p…
2021-05-20 18:49:56 +02:00
Christian Hopps 3bb513c399 lib: adapt to version 2 of libyang
Compile with v2.0.0 tag of `libyang2` branch of:
https://github.com/CESNET/libyang

staticd init load time of 10k routes now 6s vs ly1 time of 150s

Signed-off-by: Christian Hopps <chopps@labn.net>
2021-05-13 16:24:48 -04:00
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
David Lamparter 4666232247
Merge pull request #8631 from dslicenc/pimd-timer-fix 2021-05-09 19:31:36 +02:00
Don Slice bb4b6eb547 pimd: stop displaying global parameters in each vrf
Problem reported that when certain pim commands were entered, they
showed up duplicated in the configuration both under default instance
and every vrf (whether pim was used there or not.) This was because
these particular parameters are global only and the function doing
the display would repeat for each vrf. This fix only displays those
in the default case (and removes them from the help for entering
under a vrf.)

Signed-off-by: Don Slice <dslice@nvidia.com>
2021-05-05 08:11:27 -04:00
Donald Sharp 2fd97fd87d
Merge pull request #8614 from opensourcerouting/msdp-fixes
pimd: MSDP trivial fixes
2021-05-04 07:21:51 -04:00
David Lamparter fdab294037 pimd: cleanup & convert bsm_rpinfo to TS list
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-05-03 20:56:51 +02:00
David Lamparter d4a4525c12 pimd: cleanup & convert bsm_info to TS list
Just some cleanup before I touch this code;  switching to typesafe list
macros & putting the data directly inline.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-05-03 20:55:59 +02:00
Rafael Zalamena 5a1a392032 pimd: reduce code duplication
Standardize a function to get the current VRF node name.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-05-03 12:30:02 -03:00
Rafael Zalamena 745b8d4a68 pimd: support BFD profiles configuration
Allow users to pre configure BFD sessions with a profile.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-04-23 09:29:00 -03:00
Rafael Zalamena 1f3e6bf585 pimd: rework BFD integration
Rewrite the BFD integration code to use the new library.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-04-23 09:28:57 -03:00
Mobashshera Rasool 93839459dc pimd: in 'no ip pim hello' add hold time as optional when hello interval given
Issue:
  User is allowed to configure only hello without hold timer but when undo
  config, the hold timer is mandatory as shown below:
  FRR-4(config-if)# ip pim hello 10
    <cr>
    (1-180)  Time in seconds for Hold Interval
  FRR-4(config-if)# ip pim hello 10
  FRR-4(config-if)# no ip pim hello 10
    (1-180)  Time in seconds for Hold Interval
  FRR-4(config-if)# no ip pim hello 10
  % Command incomplete: no ip pim hello 20

Fix:
  Making the hold timer as optional when undo config.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-03-25 10:27:48 +00:00
Mobashshera Rasool 899dd3392a pimd: Validation that hello should be less than hold time config.
Also included display of hold time in CLI 'show ip pim int <intf>' cmd
and json commands.

Issue:
PIM neighbor not coming up if hold time is less than hello timer
since hello is sent every 4 sec and hold is 1 sec,
because of this nbr is flapping

Fix:
Do not allow configuration of hold timer less than hello timer
Also reset the value of hold timer to 3.5 times to hello whenever
only hello is modified so that the relationship holds good.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-03-25 10:27:40 +00:00
Wesley Coakley cd72ad0133
pimd: show ip mroute column realign
Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
2021-03-02 12:19:53 -05:00
Donald Sharp 6599008a0f
Merge pull request #8044 from SaiGomathiN/nsg
pimd: json support added
2021-02-15 18:55:01 -05:00
nsaigomathi 85c8286666 pimd: json support added
Modify code to add JSON format output in show command.
"show ip igmp [vrf NAME] join" and "show ip igmp vrf all join" with proper formatting

Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-02-09 05:33:14 -08:00
Igor Ryzhov 1ac88792c0 *: fix all backets
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-02 19:11:25 +03:00
vdhingra e7016ceb4c pimd : Added the command to clear the pim bsr data.
This command has been added in the context of
PIM BSM functionality. This command will clear the
data structs having bsr information.

Co-authored-by: Sarita Patra <saritap@vmware.com>
Signed-off-by: vishaldhingra <vdhingra@vmware.com>
2021-01-08 04:45:49 -08:00
Jafar Al-Gharaibeh d1e82cfd18
Merge pull request #7739 from mobash-rasool/pim-fixes
pimd: correcting the  definition for  Mroute flag "R"
2020-12-15 16:14:32 -06:00
Mobashshera Rasool e9376c880a pimd: correcting the definition for Mroute flag "R"
The flag "R" in below display description denotes the
SGRpt Pruned but the description shows something else
hence correcting the definition.

R2(config)# do show ip mroute
IP Multicast Routing Table
Flags: S- Sparse, C - Connected, P - Pruned
R - RP-bit set, F - Register flag

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2020-12-15 12:36:34 +00:00
Donatas Abraitis 3a6290bdd1 *: Replace s_addr check agains 0 with INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-12-14 21:03:38 +02:00
Sarita Patra 851cb2e5de pimd: mesh group not removed when configured for multiple groups
Issue:
Configure msdp mesh mg1 for 2 groups.
ip msdp mesh-group mg1 member 1.1.1.1
ip msdp mesh-group mg1 member 1.1.1.2

Remove mg1 for 1.1.1.1
no ip msdp mesh-group mg1 member 1.1.1.1

mg1 for 1.1.1.1 still present. This is fixed.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-12-01 05:35:57 -08:00
Sarita Patra e224558939 pimd: rp not removed when configured for multiple groups
Issue:
Configure RP.
ip pim rp 20.0.0.1 239.1.1.1/32
ip pim rp 20.0.0.1 239.1.1.2/32

Remove RP.
no ip pim rp 20.0.0.1 239.1.1.1/32
Rp is not removed. This is fixed now.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-12-01 05:34:54 -08:00
Mark Stapp 521c5b9de8 pimd: fix formatting in pim_cmd.c
Fix whitespace/indentation in pim_cmd.c

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-11-20 16:43:42 -05:00
Mark Stapp 5c90f56906 pimd: fix compilation errors in pim_cmd.c
Fix buffer sizes to eliminate compiliation warnings.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-11-20 15:45:32 -05:00
Donald Sharp cac886dd53
Merge pull request #6145 from patrasar/pim_nb_code_upstream
pimd: northbound backend code
2020-11-19 11:03:00 -05:00
Sarita Patra 1dac87c88d pimd: fix indentation issues
Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-11-18 23:20:26 -08:00