Commit Graph

1769 Commits

Author SHA1 Message Date
Donald Sharp
531d4171c7 pimd: Fix clang issue with -Waddress-of-packed-member
Recent change in commit: 6b73800ba2

Caused this error to pop up in pim_igmp_mtrace.c:

error: taking address of packed member 'rsp_addr' of class or structure 'igmp_mtrace' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]

Follow the pattern used in the code to solve this problem for clang

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-03-15 11:46:44 -04:00
David Lamparter
5145a17261 *: fix printf extension types
Some mistakes have crept in again.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-14 22:56:07 +01:00
Donald Sharp
6b73800ba2 pimd: Use builtin printf functionality
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-03-14 22:56:07 +01:00
Mark Stapp
5bbfea53fc pimd: fix coverity SA warning in pim_nb_config.c
Fix a coverity warning.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-03-09 14:36:58 -05:00
Rafael Zalamena
ee56932473
Merge pull request #8165 from wesleycoakley/misc-qol-fixups
staticd, pimd, tests: small fixups and cov fix
2021-03-05 11:22:47 +00:00
Christian Hopps
e184ea7311 pimd: correctly get interface name for error message
This was found while doing libyang2 work (causes assert); however, it is
also incorrect for libyang1 (empty canonical value for incorrectly
referenced interface vs interface-name node).

While here, fix 2 other incorrect uses of "." on a container node.

Signed-off-by: Christian Hopps <chopps@labn.net>
2021-03-03 21:06:06 -05: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
Mark Stapp
d934e491ca bgpd, pimd: fix coverity SA warnings
Fix a couple of coverity warnings in pim and bgp.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-03-01 08:46:29 -05:00
Quentin Young
e348e10e21 pimd: do static mroute loop check in NB VALIDATE
We can proactively check whether this mroute will be nacked by loopfree
MFC checks so let's do it in the apply phase and emit a useful error
message.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-02-24 17:57:26 -05:00
Igor Ryzhov
2ada626940 lib: register dependency between control plane protocol and vrf nb nodes
When the control plane protocol is created, the vrf structure is
allocated, and its address is stored in the northbound node.
The vrf structure may later be deleted by the user, which will lead to
a stale pointer stored in this node.

Instead of this, allow daemons that use the vrf pointer to register the
dependency between the control plane protocol and vrf nodes. This will
guarantee that the nodes will always be created and deleted together, and
there won't be any stale pointers.

Add such registration to staticd and pimd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-22 18:53:24 +03:00
Donald Sharp
6599008a0f
Merge pull request #8044 from SaiGomathiN/nsg
pimd: json support added
2021-02-15 18:55:01 -05:00
David Lamparter
1d5453d607 *: remove tabs & newlines from log messages
Neither tabs nor newlines are acceptable in syslog messages.  They also
break line-based parsing of file logs.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-14 15:36:51 +01: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
Donatas Abraitis
d6b92dded3
Merge pull request #8032 from donaldsharp/dp_uninited
Some bfd valgrind issues
2021-02-08 12:03:25 +02:00
anlancs
3655f3549e pimd: check debug flag one time
debug flag checked twice, just keep one.

Signed-off-by: anlancs <anlan_cs@tom.com>
2021-02-08 09:15:32 +08:00
Donald Sharp
37a74717c7 *: Fix usage of bfd_adj_event
Valgrind reports:

469901-==469901==
469901-==469901== Conditional jump or move depends on uninitialised value(s)
469901:==469901==    at 0x3A090D: bgp_bfd_dest_update (bgp_bfd.c:416)
469901-==469901==    by 0x497469E: zclient_read (zclient.c:3701)
469901-==469901==    by 0x4955AEC: thread_call (thread.c:1684)
469901-==469901==    by 0x48FF64E: frr_run (libfrr.c:1126)
469901-==469901==    by 0x213AB3: main (bgp_main.c:540)
469901-==469901==  Uninitialised value was created by a stack allocation
469901:==469901==    at 0x3A0725: bgp_bfd_dest_update (bgp_bfd.c:376)
469901-==469901==
469901-==469901== Conditional jump or move depends on uninitialised value(s)
469901:==469901==    at 0x3A093C: bgp_bfd_dest_update (bgp_bfd.c:421)
469901-==469901==    by 0x497469E: zclient_read (zclient.c:3701)
469901-==469901==    by 0x4955AEC: thread_call (thread.c:1684)
469901-==469901==    by 0x48FF64E: frr_run (libfrr.c:1126)
469901-==469901==    by 0x213AB3: main (bgp_main.c:540)
469901-==469901==  Uninitialised value was created by a stack allocation
469901:==469901==    at 0x3A0725: bgp_bfd_dest_update (bgp_bfd.c:376)

On looking at bgp_bfd_dest_update the function call into bfd_get_peer_info
when it fails to lookup the ifindex ifp pointer just returns leaving
the dest and src prefix pointers pointing to whatever was passed in.

Let's do two things:

a) The src pointer was sometimes assumed to be passed in and sometimes not.
Forget that.  Make it always be passed in
b) memset the src and dst pointers to be all zeros.  Then when we look
at either of the pointers we are not making decisions based upon random
data in the pointers.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-07 14:59:53 -05:00
Russ White
98e3dfaee0
Merge pull request #6049 from sarav511/ovrdhold
pimd: SGRpt prune received during prune didn't override holdtime
2021-02-04 07:14:31 -05:00
Igor Ryzhov
1ac88792c0 *: fix all backets
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-02 19:11:25 +03:00
Donald Sharp
af1cc4c84c pimd: Remove #if 0 code from system
Old dead code.
Like a log
jamming your build system

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-28 13:37:53 -05:00
saravanank
d0c866d0d8 pimd: SGRpt prune received during prune didn't override holdtime
RCA: There were 2 problems.
1. SGRpt prune expiry didn't create S,G entry with none oil when no other
interfaces were part of the oil.
2. When restarting the timer with new hold value, comparision was missing and
old timer was not stopping.

Fix:
SGRpt Prune pending expiry will put SG entry with none oil if no other

Signed-off-by: Saravanan K <saravanank@vmware.com>

interfaces present. If present we will be deleting the inherited oif from oil.
Deleting the oif in that scenario will take care of changing mroute.
When alone interface expires in SGRpt prune pending state, we shall detect by
checking installed flag. if not installed, install mroute.
2021-01-28 07:14:48 +00:00
Mark Stapp
ab57fb1280
Merge pull request #7934 from donaldsharp/valgrind_cleanups
pimd: Prevent use after free
2021-01-26 10:55:35 -05:00
Donald Sharp
eaffe5e892 pimd: Prevent use after free
Valgrind is reporting this:
==22220== Invalid read of size 4
==22220==    at 0x11DC2B: pim_if_delete (pim_iface.c:215)
==22220==    by 0x11DD71: pim_if_terminate (pim_iface.c:76)
==22220==    by 0x128E03: pim_instance_terminate (pim_instance.c:66)
==22220==    by 0x128E03: pim_vrf_delete (pim_instance.c:159)
==22220==    by 0x48E0010: vrf_delete (vrf.c:251)
==22220==    by 0x48E0010: vrf_delete (vrf.c:225)
==22220==    by 0x48E02FE: vrf_terminate (vrf.c:551)
==22220==    by 0x149495: pim_terminate (pimd.c:142)
==22220==    by 0x13C61B: pim_sigint (pim_signals.c:44)
==22220==    by 0x48CF862: quagga_sigevent_process (sigevent.c:103)
==22220==    by 0x48DD324: thread_fetch (thread.c:1404)
==22220==    by 0x48A926A: frr_run (libfrr.c:1122)
==22220==    by 0x11B85E: main (pim_main.c:167)
==22220==  Address 0x5912160 is 1,200 bytes inside a block of size 1,624 free'd
==22220==    at 0x48369AB: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==22220==    by 0x128E52: pim_instance_terminate (pim_instance.c:74)
==22220==    by 0x128E52: pim_vrf_delete (pim_instance.c:159)
==22220==    by 0x48E0010: vrf_delete (vrf.c:251)
==22220==    by 0x48E0010: vrf_delete (vrf.c:225)
==22220==    by 0x48F1353: zclient_vrf_delete (zclient.c:1896)
==22220==    by 0x48F1353: zclient_read (zclient.c:3511)
==22220==    by 0x48DD826: thread_call (thread.c:1585)
==22220==    by 0x48A925F: frr_run (libfrr.c:1123)
==22220==    by 0x11B85E: main (pim_main.c:167)
==22220==  Block was alloc'd at
==22220==    at 0x4837B65: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==22220==    by 0x48ADA4F: qcalloc (memory.c:110)
==22220==    by 0x128B9B: pim_instance_init (pim_instance.c:82)
==22220==    by 0x128B9B: pim_vrf_new (pim_instance.c:142)
==22220==    by 0x48E0C5A: vrf_get (vrf.c:217)
==22220==    by 0x48F13C9: zclient_vrf_add (zclient.c:1863)
==22220==    by 0x48F13C9: zclient_read (zclient.c:3508)
==22220==    by 0x48DD826: thread_call (thread.c:1585)
==22220==    by 0x48A925F: frr_run (libfrr.c:1123)
==22220==    by 0x11B85E: main (pim_main.c:167)

On pim vrf deletion, ensure that the vrf->info pointers are NULL as well
as the free'd pim pointer for ->vrf is NULL as well.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-26 07:56:36 -05:00
Donald Sharp
853d21145c pimd: Prevent crash with igmp only config
Issue: #7892 has a startup config where only igmp
interfaces are created and a igmp report comes in.

Effectively we are not creating the regiface device unless
we do a `ip pim`.  This is incorrect we should always create
the regiface.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-21 10:37:50 -05:00
Sarita Patra
6cc30090b8 pimd: fix multiple memory leak
Memleak: pim_jp_agg_single_upstream_send(), static variable are not
released.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2021-01-14 22:38:18 -08:00
Mobashshera Rasool
195427c8fd pimd: SPT-bit is not set to false as per RFC section in one flow
1. As per RFC 4601 Sec 4.5.7:
* JoinDesired(S,G) -> False, set SPTbit to false.

2. Change the debug type.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-01-11 05:23:41 +00:00
Donald Sharp
f467218fd6
Merge pull request #7751 from mobash-rasool/igmp-fixes
pimd: IGMP conformance 5.10 test case is failing
2021-01-09 17:40:31 -05:00
Donald Sharp
bdfc5f45bd
Merge pull request #7753 from mobash-rasool/pim-fixes
pimd: when node changes from non-DR to DR S,G entry not created
2021-01-09 17:36:08 -05: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
Mobashshera Rasool
d1b61cb92d pimd: IGMP conformance 5.10 test case is failing
Test case 5.10 sends leave message to unicast address, the leave
packet is accepted and a query message is sent in response to this.
No validation for address is present in the function

Add check for addresses as per RFC. Leave messages are allowed only
sent to either ALL-ROUTERS (224.0.0.2) or group address.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2020-12-24 06:39:12 +00:00
Mobashshera Rasool
9046b17006 pimd: when node changes from non-DR to DR S,G entry not created
1. When a node changes from non-DR to DR in the given topology,
the node was receiving both PIM Join as well as IGMP join.
Since it was already receiving PIM Join previously, ifchannel was
already present. Hence when it becomes DR, the IGMP source flag is not
set due to issue in the code. Hence it never creates S,G entry thinking
that it is not DR.

2. When pim join expires, the pim flag is not reset when ifchannel is not
deleted.

Issue: #7752

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2020-12-17 13:14:29 +00: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
Patrick Ruddy
a119a429e4
Merge pull request #7637 from AnuradhaKaruppiah/evpn-pim-fixes
evpn-pim: cleanup and display fixes
2020-12-15 17:36:24 +00: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
Donald Sharp
9a4e959bd3
Merge pull request #7601 from patrasar/pim_fix
Pim fix
2020-12-01 15:53:53 -05: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
Donald Sharp
91f20e5cd5 pimd: Remove pim_version.c it is never used
The pim_version.[c|h] files are never used and we are getting
warnings about PIM_VERSION changing pointer sizes from
newer versions of the compiler.  I see no reason to keep this

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-01 07:57:45 -05:00
Donald Sharp
fc54da0966
Merge pull request #7404 from vishaldhingra/pim
pimd: (*,G) Prune processing doesn't remove SGRpt ifchannel
2020-12-01 07:48:54 -05:00
Anuradha Karuppiah
d149c75aa1 pimd: skip displaying pim config on the vxlan termination device ipmr-lo
pim is enabled internally/implicitly on the vxlan termination device
and displaying that can confuse the admin and tools (such as
frr-reload).

Ticket: CM-30180

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-11-30 12:50:33 -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
Mark Stapp
40de528b77 pimd: remove duplicate block from subdir.am
Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-11-20 15:37:11 -05:00
Donald Sharp
2332790973
Merge pull request #7569 from patrasar/pim_coverity_fix
pimd: Fix SA issues found in Coverity Scan
2020-11-20 07:40:06 -05:00
Sarita Patra
e1d1e95123 pimd: Fix SA issues found in Coverity Scan
Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-11-20 01:47:04 -08: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
Mark Stapp
abed797ef5
Merge pull request #7556 from donaldsharp/memory_shenanigans
Memory shenanigans
2020-11-18 17:31:03 -05:00
Donald Sharp
f8ca1bb935 pimd: A buffer may be used uninited
If we screw up and don't have the right flags we'll print
out garbage.  At the very least just print out nothing.

Signed-off-by: Donald Sharp <sharp@nvidia.com>
2020-11-18 11:42:06 -05:00
Mark Stapp
926bc58f78
Merge pull request #7478 from donaldsharp/buffer
Buffer
2020-11-18 08:30:47 -05:00