Commit graph

247 commits

Author SHA1 Message Date
Donald Sharp 2892c20097
Merge pull request #18538 from nabahr/autorp-enabling
pimd: Only create and bind the autorp socket when really needed
2025-04-17 10:14:13 -04:00
Jafar Al-Gharaibeh 3510904f1d
Merge pull request #18526 from donaldsharp/pim_leakage
pimd: Fix memory leak on shutdown
2025-04-08 10:19:33 -05:00
Nathan Bahr 153d9ea3b9 pimd: Initialize gm proxy to false
Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-04-02 21:07:41 +00:00
Donald Sharp 521b58945c pimd: Fix memory leak on shutdown
The gm_join_list has a setup where it attempts to only
create the list upon need and deletes it when the list
is empty.  On interface shutdown it was calling the
function to empty the list but it was not empty so
the list was being left at the end.  Just add a bit
of code to really clean up the list in the shutdown
case.

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    0 0x7f84850b83b7 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
    1 0x7f8484c391c4 in qcalloc lib/memory.c:106
    2 0x7f8484c1ad36 in list_new lib/linklist.c:49
    3 0x55d982827252 in pim_if_gm_join_add pimd/pim_iface.c:1354
    4 0x55d982852b59 in lib_interface_gmp_address_family_join_group_create pimd/pim_nb_config.c:4499
    5 0x7f8484c6a5d3 in nb_callback_create lib/northbound.c:1512
    6 0x7f8484c6a5d3 in nb_callback_configuration lib/northbound.c:1910
    7 0x7f8484c6bb51 in nb_transaction_process lib/northbound.c:2042
    8 0x7f8484c6c164 in nb_candidate_commit_apply lib/northbound.c:1381
    9 0x7f8484c6c39f in nb_candidate_commit lib/northbound.c:1414
    10 0x7f8484c6cf1c in nb_cli_classic_commit lib/northbound_cli.c:57
    11 0x7f8484c72f67 in nb_cli_apply_changes_internal lib/northbound_cli.c:195
    12 0x7f8484c73a2e in nb_cli_apply_changes lib/northbound_cli.c:251
    13 0x55d9828bd30f in interface_ip_igmp_join_magic pimd/pim_cmd.c:5436
    14 0x55d9828bd30f in interface_ip_igmp_join pimd/pim_cmd_clippy.c:6366
    15 0x7f8484bb5cbd in cmd_execute_command_real lib/command.c:1003
    16 0x7f8484bb5fdc in cmd_execute_command lib/command.c:1062
    17 0x7f8484bb6508 in cmd_execute lib/command.c:1228
    18 0x7f8484cfb6ec in vty_command lib/vty.c:626
    19 0x7f8484cfbc3f in vty_execute lib/vty.c:1389
    20 0x7f8484cff9f0 in vtysh_read lib/vty.c:2408
    21 0x7f8484cec846 in event_call lib/event.c:1984
    22 0x7f8484c1a10a in frr_run lib/libfrr.c:1246
    23 0x55d9828fc765 in main pimd/pim_main.c:166
    24 0x7f848470c249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-29 11:54:36 -04:00
Nathan Bahr 133bb5f614 pimd: Only create and bind the autorp socket when really needed
Previously, the autorp socket would get created and bind if needed
by autorp configuration.
This update limits it further to also require pim enabled interfaces
in the vrf before the socket is created and bind.
So now the socket will automatically close if there are no pim
enabled interfaces left, or if autorp is turned off. It will
automatically turn on if autorp is turned on and there are pim
enabled interfaces in the vrf.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-03-28 16:50:09 +00:00
Nathan Bahr d840560b74 pim: Fix autorp group joins
Group joining got broken when moving the autorp socket to open/close
as needed. This fixes it so autorp group joining is properly handled
as part of opening the socket.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-02-21 21:38:32 +00:00
David Lamparter b84493132c pimd: allow restricting neighbors per interface
Just filter incoming packets against a specified prefix-list.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-02-19 09:49:06 -03:00
Rafael Zalamena a98f2b86c4 pim6d: implement MLD source/group limits
Let user configure a source/group limit for MLD protocol.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-10 15:40:07 -03:00
Nathan Bahr 6d30c8f6b5 pimd: Refactor pim NHT
Refactor the next hop tracking in PIM to fully support the configured RPF lookup mode.
Moved many NHT related functions to pim_nht.h/c
NHT now tracks both MRIB and URIB tables and makes nexthop decisions based on the configured lookup mode.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-12-13 17:36:34 +00:00
Corey Siltala 8465ba1dde pimd: Convert boundary_oil_plist to struct prefix_list
Rather than storing the prefix-list name and looking it up every time we use it, store a pointer to the prefix-list itself.

Signed-off-by: Corey Siltala <csiltala@atcorp.com>
2024-12-06 14:44:52 -06:00
Corey Siltala 4de4017d64 pimd,yang: Extend multicast boundary functionality
Add new interface command ip multicast boundary ACCESSLIST4_NAME. This
allows filtering on both source and group using the extended access-list
syntax vs. group-only as with the existing "ip multicast boundary oil"
command, which uses prefix-lists. If both are configured, the prefix-
list is evaluated first. The default behavior for both prefix-lists and
access-lists remains "deny", so the prefix-list must have a terminating
"permit" statement in order to also evaluate against the access-list.

The following example denies groups in range 229.1.1.0/24 and groups in
range 232.1.1.0/24 with source 10.0.20.2:

!
ip prefix-list pim-oil-plist seq 10 deny 229.1.1.0/24
ip prefix-list pim-oil-plist seq 20 permit any
!
access-list pim-acl seq 10 deny ip host 10.0.20.2 232.1.1.0 0.0.0.255
access-list pim-acl seq 20 permit ip any any
!
interface r1-eth0
 ip address 10.0.20.1/24
 ip igmp
 ip pim
 ip multicast boundary oil pim-oil-plist
 ip multicast boundary pim-acl
!

Signed-off-by: Corey Siltala <csiltala@atcorp.com>
2024-12-06 14:44:17 -06:00
Barry A. Trent 693a37ab04 pimd: free igmp proxy joins on interface deletion
Signed-off-by: Barry A. Trent <barry.trent@atcorp.com>
2024-12-04 10:51:54 -08:00
anlan_cs 5291228bf7 pimd: fix missing IPV4 check
In `pim_if_addr_add()`, some code inside `PIM_IPV == 4`
( the case of `igmp->mtrace_only` ) wrongly accepts ipv6 address.

So, clearly add IPV4 check.

Signed-off-by: anlan_cs <anlan_cs@126.com>
2024-09-30 13:31:29 +08:00
Nathan Bahr f182255c0f pimd: Add AutoRP functionality to PIMD
Perform AutoRP discovery and candidate RP announcements using the
AutoRP protocol.
Mapping agent is not yet implemented, but this feature is not
necessary for FRR to support AutoRP as we only need one AutoRP
mapping agent in the network.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-09-24 16:36:53 +00:00
Barry A. Trent f4d3222d10 pimd: add proxy join/prune functionality
Use existing igmp static join infrastructure.
Add an enum to distinguish static from proxy joins.

Signed-off-by: Barry A. Trent <barry.trent@atcorp.com>
2024-09-23 11:43:32 -07:00
Jafar Al-Gharaibeh a110bb7798 pimd: Candidate-RP support
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2024-09-09 12:42:28 -05:00
Donald Sharp 05c17eff06
Merge pull request #16450 from nabahr/static_joins
PIM: Implement static IGMP joins without an IGMP report
2024-08-22 11:32:56 -04:00
anlan_cs cbe50989d9 pimd: fix missing checking the return value for igmp command
`gm_join_new()` will return NULL in the case of running out of
socket/file resources.  Just add the check for it.

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2024-08-16 22:33:59 +08:00
Nathan Bahr 0cb1bf7873 pimd, yang: Implement igmp static-group command
This will add a static IGMP group that does not rely on an underlying
socket join which sends traffic to the cpu unneccesarily. Instead, the
groups are joined directly without any IGMP interactions.
New command is under interfaces, 'ip igmp static-group ...'.
Added an alias for 'ip igmp join ...' to 'ip igmp join-group'.
Moved IGMP join groups to new yang list "join-group" and reused
the "static-group" list for the IGMP static groups.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-08-15 16:20:00 +00:00
mobash-rasool 5ff94749d3
Merge pull request #13627 from anlancs/pimd/pimreg-vrf-add-break
pimd: Set pimreg interface with one master
2024-04-10 16:50:07 +05:30
David Lamparter 8b23c0b0bd *: convert struct interface->connected to DLIST
Replace `struct list *` with `DLIST(if_connected, ...)`.

NB: while converting this, I found multiple places using connected
prefixes assuming they were IPv4 without checking:

- vrrpd/vrrp.c: vrrp_socket()
- zebra/irdp_interface.c: irdp_get_prefix(), irdp_if_start(),
  irdp_advert_off()

(these fixes are really hard to split off into separate commits as that
would require going back and reapplying the change but with the old list
handling)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-22 23:00:30 +01:00
Donald Sharp 07b91ca096 *: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZ
INTERFACE_NAMSIZ is just a redefine of IFNAMSIZ and IFNAMSIZ
is the standard for interface name length on all platforms
that FRR currently compiles on.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-21 08:08:29 -05:00
David Lamparter d889055d8e lib: convert if_zapi_callbacks into actual hooks
...so that multiple functions can be subscribed.

The create/destroy hooks are renamed to real/unreal because that's what
they *actually* signal.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-02 17:10:43 -07:00
mobash-rasool 9b6f41bfbe
Merge pull request #13617 from anlancs/fix/pimd-remove-pimreg-vrf
pimd: Fix missing pimreg interface
2023-10-10 22:10:24 +05:30
Donald Sharp 59742b4550
Merge pull request #13605 from anlancs/fix/pimd-promote-interface
pimd: Fix missing promotion for primary address
2023-07-20 08:16:17 -04:00
Keelan10 24379f0bb2 pimd: Fix memory leak in PIM interface deletion
This commit ensures proper cleanup by deleting the gm_join_list when a PIM interface is deleted. The gm_join_list was previously not being freed, causing a memory leak.

The ASan leak log for reference:
```
***********************************************************************************
Address Sanitizer Error detected in multicast_mld_join_topo1.test_multicast_mld_local_join/r1.asan.pim6d.28070

=================================================================
==28070==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7f3605dbfd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x56230373dd6b in qcalloc lib/memory.c:105
    #2 0x56230372180f in list_new lib/linklist.c:49
    #3 0x56230361b589 in pim_if_gm_join_add pimd/pim_iface.c:1313
    #4 0x562303642247 in lib_interface_gmp_address_family_static_group_create pimd/pim_nb_config.c:2868
    #5 0x562303767280 in nb_callback_create lib/northbound.c:1235
    #6 0x562303767280 in nb_callback_configuration lib/northbound.c:1579
    #7 0x562303768a1d in nb_transaction_process lib/northbound.c:1710
    #8 0x56230376904a in nb_candidate_commit_apply lib/northbound.c:1104
    #9 0x5623037692ba in nb_candidate_commit lib/northbound.c:1137
    #10 0x562303769dec in nb_cli_classic_commit lib/northbound_cli.c:49
    #11 0x56230376fb79 in nb_cli_pending_commit_check lib/northbound_cli.c:88
    #12 0x5623036c5bcb in cmd_execute_command_real lib/command.c:991
    #13 0x5623036c5f1b in cmd_execute_command lib/command.c:1053
    #14 0x5623036c6392 in cmd_execute lib/command.c:1221
    #15 0x5623037e75da in vty_command lib/vty.c:591
    #16 0x5623037e7a74 in vty_execute lib/vty.c:1354
    #17 0x5623037f0253 in vtysh_read lib/vty.c:2362
    #18 0x5623037db4e8 in event_call lib/event.c:1995
    #19 0x562303720f97 in frr_run lib/libfrr.c:1213
    #20 0x56230368615d in main pimd/pim6_main.c:184
    #21 0x7f360461bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 192 byte(s) in 4 object(s) allocated from:
    #0 0x7f3605dbfd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x56230373dd6b in qcalloc lib/memory.c:105
    #2 0x56230361b91d in gm_join_new pimd/pim_iface.c:1288
    #3 0x56230361b91d in pim_if_gm_join_add pimd/pim_iface.c:1326
    #4 0x562303642247 in lib_interface_gmp_address_family_static_group_create pimd/pim_nb_config.c:2868
    #5 0x562303767280 in nb_callback_create lib/northbound.c:1235
    #6 0x562303767280 in nb_callback_configuration lib/northbound.c:1579
    #7 0x562303768a1d in nb_transaction_process lib/northbound.c:1710
    #8 0x56230376904a in nb_candidate_commit_apply lib/northbound.c:1104
    #9 0x5623037692ba in nb_candidate_commit lib/northbound.c:1137
    #10 0x562303769dec in nb_cli_classic_commit lib/northbound_cli.c:49
    #11 0x56230376fb79 in nb_cli_pending_commit_check lib/northbound_cli.c:88
    #12 0x5623036c5bcb in cmd_execute_command_real lib/command.c:991
    #13 0x5623036c5f1b in cmd_execute_command lib/command.c:1053
    #14 0x5623036c6392 in cmd_execute lib/command.c:1221
    #15 0x5623037e75da in vty_command lib/vty.c:591
    #16 0x5623037e7a74 in vty_execute lib/vty.c:1354
    #17 0x5623037f0253 in vtysh_read lib/vty.c:2362
    #18 0x5623037db4e8 in event_call lib/event.c:1995
    #19 0x562303720f97 in frr_run lib/libfrr.c:1213
    #20 0x56230368615d in main pimd/pim6_main.c:184
    #21 0x7f360461bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 96 byte(s) in 4 object(s) allocated from:
    #0 0x7f3605dbfd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x56230373dd6b in qcalloc lib/memory.c:105
    #2 0x562303721651 in listnode_new lib/linklist.c:71
    #3 0x56230372182b in listnode_add lib/linklist.c:92
    #4 0x56230361ba9a in gm_join_new pimd/pim_iface.c:1295
    #5 0x56230361ba9a in pim_if_gm_join_add pimd/pim_iface.c:1326
    #6 0x562303642247 in lib_interface_gmp_address_family_static_group_create pimd/pim_nb_config.c:2868
    #7 0x562303767280 in nb_callback_create lib/northbound.c:1235
    #8 0x562303767280 in nb_callback_configuration lib/northbound.c:1579
    #9 0x562303768a1d in nb_transaction_process lib/northbound.c:1710
    #10 0x56230376904a in nb_candidate_commit_apply lib/northbound.c:1104
    #11 0x5623037692ba in nb_candidate_commit lib/northbound.c:1137
    #12 0x562303769dec in nb_cli_classic_commit lib/northbound_cli.c:49
    #13 0x56230376fb79 in nb_cli_pending_commit_check lib/northbound_cli.c:88
    #14 0x5623036c5bcb in cmd_execute_command_real lib/command.c:991
    #15 0x5623036c5f1b in cmd_execute_command lib/command.c:1053
    #16 0x5623036c6392 in cmd_execute lib/command.c:1221
    #17 0x5623037e75da in vty_command lib/vty.c:591
    #18 0x5623037e7a74 in vty_execute lib/vty.c:1354
    #19 0x5623037f0253 in vtysh_read lib/vty.c:2362
    #20 0x5623037db4e8 in event_call lib/event.c:1995
    #21 0x562303720f97 in frr_run lib/libfrr.c:1213
    #22 0x56230368615d in main pimd/pim6_main.c:184
    #23 0x7f360461bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7f3605dbfd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x56230373dd6b in qcalloc lib/memory.c:105
    #2 0x56230361b91d in gm_join_new pimd/pim_iface.c:1288
    #3 0x56230361b91d in pim_if_gm_join_add pimd/pim_iface.c:1326
    #4 0x562303642247 in lib_interface_gmp_address_family_static_group_create pimd/pim_nb_config.c:2868
    #5 0x562303767280 in nb_callback_create lib/northbound.c:1235
    #6 0x562303767280 in nb_callback_configuration lib/northbound.c:1579
    #7 0x562303768a1d in nb_transaction_process lib/northbound.c:1710
    #8 0x56230376904a in nb_candidate_commit_apply lib/northbound.c:1104
    #9 0x5623037692ba in nb_candidate_commit lib/northbound.c:1137
    #10 0x562303769dec in nb_cli_classic_commit lib/northbound_cli.c:49
    #11 0x56230376fb79 in nb_cli_pending_commit_check lib/northbound_cli.c:88
    #12 0x5623036c5bcb in cmd_execute_command_real lib/command.c:991
    #13 0x5623036c5f6f in cmd_execute_command lib/command.c:1072
    #14 0x5623036c6392 in cmd_execute lib/command.c:1221
    #15 0x5623037e75da in vty_command lib/vty.c:591
    #16 0x5623037e7a74 in vty_execute lib/vty.c:1354
    #17 0x5623037f0253 in vtysh_read lib/vty.c:2362
    #18 0x5623037db4e8 in event_call lib/event.c:1995
    #19 0x562303720f97 in frr_run lib/libfrr.c:1213
    #20 0x56230368615d in main pimd/pim6_main.c:184
    #21 0x7f360461bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f3605dbfd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x56230373dd6b in qcalloc lib/memory.c:105
    #2 0x562303721651 in listnode_new lib/linklist.c:71
    #3 0x56230372182b in listnode_add lib/linklist.c:92
    #4 0x56230361ba9a in gm_join_new pimd/pim_iface.c:1295
    #5 0x56230361ba9a in pim_if_gm_join_add pimd/pim_iface.c:1326
    #6 0x562303642247 in lib_interface_gmp_address_family_static_group_create pimd/pim_nb_config.c:2868
    #7 0x562303767280 in nb_callback_create lib/northbound.c:1235
    #8 0x562303767280 in nb_callback_configuration lib/northbound.c:1579
    #9 0x562303768a1d in nb_transaction_process lib/northbound.c:1710
    #10 0x56230376904a in nb_candidate_commit_apply lib/northbound.c:1104
    #11 0x5623037692ba in nb_candidate_commit lib/northbound.c:1137
    #12 0x562303769dec in nb_cli_classic_commit lib/northbound_cli.c:49
    #13 0x56230376fb79 in nb_cli_pending_commit_check lib/northbound_cli.c:88
    #14 0x5623036c5bcb in cmd_execute_command_real lib/command.c:991
    #15 0x5623036c5f6f in cmd_execute_command lib/command.c:1072
    #16 0x5623036c6392 in cmd_execute lib/command.c:1221
    #17 0x5623037e75da in vty_command lib/vty.c:591
    #18 0x5623037e7a74 in vty_execute lib/vty.c:1354
    #19 0x5623037f0253 in vtysh_read lib/vty.c:2362
    #20 0x5623037db4e8 in event_call lib/event.c:1995
    #21 0x562303720f97 in frr_run lib/libfrr.c:1213
    #22 0x56230368615d in main pimd/pim6_main.c:184
    #23 0x7f360461bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 400 byte(s) leaked in 11 allocation(s).
***********************************************************************************
```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
2023-06-27 09:30:25 +04:00
Mobashshera Rasool b25286add3 pimd, pim6d: Move mld/igmp deletion code to a common api
Move the mld/igmp deletion common code to api pim_gm_interface_delete
code for IPv6 deletion(gm_ifp_teardown) for MLD was missing in this flow
Making the code common fixes this too.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2023-06-07 00:01:05 -07:00
Mobashshera Rasool 692b1f3e97 pimd, pim6d: Rename and move api pim_cmd_interface_delete
Rename pim_cmd_interface_delete to pim_pim_interface_delete
and move the api to pimd/pim_iface.c

Changed the return type of the api from int to void.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2023-06-06 23:59:55 -07:00
Mobashshera Rasool e7356fdba1 pimd, pim6d: Move api pim_if_membership_clear
Move pim_if_membership_clear api from pimd/pim_nb_config.c
to pimd/pim_iface.c
Also fixed curly braces warning
WARNING: braces {} are not necessary for single statement blocks
1773: FILE: /tmp/f1-127504/pim_iface.c:1773:

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2023-06-06 23:58:29 -07:00
anlan_cs b016b552a6 pimd: Fix missing pimreg interface
`pimregX` of specific vrf can be deleted from kernel after this vrf
is deleted.  However, then `pimdregX` will never come back to
kernel after adding it ( the same vrf ) back.  That is to say, it exists
only in daemon, but not in kernel.

The root cause is this `pimregX` is not really deleted for its special
usage, and `pim_if_create_pimreg()` wants reusing it.

I have tried 4 solutions:
1. Remove the `configured` flag of `pimregX`, allow its deletion.
A few timers still use `pimregX` after its deletion.  So, not adopted.
2. Remove `pimregX` by vrf hook in `pim_instance_terminate()`.
It has no vrf id there.  So, not adopted.
3. Reuse `pimregX` in `pim_if_create_pimreg()`.
If `pim->regiface->info` is true, then reuse old `pimregX` and only call
`pim_if_add_vif()` to install it into kernel.  But at that time, it maybe
is in default VRF.  The `pim_zebra_interface_set_master()` doesn't work
at that time because it shouldn't wait there for its changing into
correct VRF.  So, not adopted.
4. Not reuse it.
If `pim->regiface->info` is true, there must have been pim instance with
VRF deleted and created before.  Actually delele old one in
`pim_if_create_pimreg()`, then recreate new one.

Finally, this PR adopted the fourth solution.

Fixes #13454

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-05-30 17:29:38 +08:00
anlan_cs af00ac8072 pimd: Set pimreg interface with one master
Add break for loop, `pimreg` interface should be with one master.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-05-30 14:16:54 +08:00
anlan_cs ce95ba5ab7 pimd: Fix missing promotion for primary address
Assume that `pim_ifp` has two ip (v4) addresses, one is primary, the other
is secondary. After remove primary ip, the secondary ip doesn't be promoted,
so `pim_ifp->primary_address` will wrongly be set to "0.0.0.0", it leads to
`pim_sock_delete(ifp)` on this interface.

Add the promotion for primary address.

Fixed #13590

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-05-26 13:24:55 +08:00
anlan_cs f403844a12 pimd: Use macro for pimreg interface
Some interfaces are special, they have the same `ifindex` with pimreg.
Use macro for `ifindex` of pimreg.

And adjust log.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-05-11 13:52:25 +08:00
Abhishek N R bd2c824a21 pim6d: Impelmenting "ipv6 mld join"
Fixes: #12014

Signed-off-by: Abhishek N R <abnr@vmware.com>
2023-04-03 04:05:17 -07:00
Sai Gomathi N 522ec0a924 pim6d: Do not use interfaces with ifindex as 0
After restarting pim6d, in some cases the ifindex is 0 for the interfaces,
so the vif index is also assigned as 0.
This causes the interface name to be pim6reg.

Fix:
If the ifindex is 0 and the interface name is not "pimreg" or "pim6reg",
the function will return without assigning vifindex with an error message.

Issue: #12744

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2023-03-19 22:58:55 -07:00
Donald Sharp 7ae7a3bfd6 pimd: Prevent crash when pimreg already exists.
If the pimreg device exists but it has not been set to the pim->pimreg pointer we can have
a crash.  Just prevent the crash since it's some sort of startup / re-org the network
issue.

(gdb) bt
0  0x00007f0485b035cb in raise () from /lib/x86_64-linux-gnu/libpthread.so.0
1  0x00007f0485c0fbec in core_handler (signo=6, siginfo=0x7ffdc0198030, context=<optimized out>) at lib/sigevent.c:264
2  <signal handler called>
3  0x00007f04859668eb in raise () from /lib/x86_64-linux-gnu/libc.so.6
4  0x00007f0485951535 in abort () from /lib/x86_64-linux-gnu/libc.so.6
5  0x00007f0485c3af76 in _zlog_assert_failed (xref=xref@entry=0x55692269b940 <_xref.23164>, extra=extra@entry=0x0) at lib/zlog.c:680
6  0x00005569226150d0 in pim_if_new (ifp=0x556922c82900, gm=gm@entry=false, pim=pim@entry=false, ispimreg=ispimreg@entry=true,
    is_vxlan_term=is_vxlan_term@entry=false) at pimd/pim_iface.c:124
7  0x0000556922615140 in pim_if_create_pimreg (pim=pim@entry=0x556922cc11e0) at pimd/pim_iface.c:1549
8  0x0000556922616bc8 in pim_if_create_pimreg (pim=0x556922cc11e0) at pimd/pim_iface.c:1613
9  pim_ifp_create (ifp=0x556922cc0e70) at pimd/pim_iface.c:1641
10 0x00007f0485c32cf9 in zclient_interface_add (cmd=<optimized out>, zclient=<optimized out>, length=<optimized out>, vrf_id=77) at lib/zclient.c:2214
11 0x00007f0485c3346a in zclient_read (thread=<optimized out>) at lib/zclient.c:4003
12 0x00007f0485c215ed in thread_call (thread=thread@entry=0x7ffdc0198880) at lib/thread.c:2008
13 0x00007f0485bdbbc8 in frr_run (master=0x556922a10470) at lib/libfrr.c:1223
14 0x000055692260312b in main (argc=<optimized out>, argv=0x7ffdc0198b98, envp=<optimized out>) at pimd/pim_main.c:176

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-01 14:56:05 -05:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Sarita Patra 78623256b6 pim6d: Handle IPV6 for "no ipv6 pim"
Issue: #11931

Signed-off-by: Sarita Patra <saritap@vmware.com>
2022-11-14 00:17:48 -08:00
Donatas Abraitis e09ce4b894
Merge pull request #11872 from AbhishekNR/const_igmp_gm
pimd, pim6d: Changing IGMP to GM in few macro's.
2022-09-19 17:48:24 +03:00
Abhishek N R de5dc09238 pimd, pim6d: Changing IGMP to GM in few macro's.
Changing
IGMP_DEFAULT_ROBUSTNESS_VARIABLE to GM_DEFAULT_ROBUSTNESS_VARIABLE,
IGMP_GENERAL_QUERY_INTERVAL to GM_GENERAL_QUERY_INTERVAL,
IGMP_QUERY_MAX_RESPONSE_TIME_DSEC to GM_QUERY_MAX_RESPONSE_TIME_DSEC and
IGMP_SPECIFIC_QUERY_MAX_RESPONSE_TIME_DSEC to GM_SPECIFIC_QUERY_MAX_RESPONSE_TIME_DSEC
to accomodate both igmp and mld. And moved it to common file.

Signed-off-by: Abhishek N R <abnr@vmware.com>
2022-09-18 22:15:19 -07:00
Abhishek N R b4460a6b33 pim6d: (*,G) mroutes not learnt after pim6d daemon restart
After restart pim dr address was zero due to which pim (*,G) join
could not get propagated towards RP.

While trying to find primary address ll_highest will be zero initially,
since we have not received address from zebra yet.

So we can get the best address at this point and use it as primary address
whenever ll_highest is zero.

Fixes: #11925

Signed-off-by: Abhishek N R <abnr@vmware.com>
2022-09-16 00:42:39 -07:00
Mobashshera Rasool 2ce3c8ec58 pimd: Fix memleak in bfd profile
In function pim_if_delete, pim_ifp->bfd_config.profile needs to be
freed.
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-09-14 10:34:10 -07:00
Sai Gomathi N 95b13dc512 pimd,pim6d: Modifying IGMP to GM in PIM_DEBUG_IGMP_EVENTS to PIM_DEBUG_GM_EVENTS
Changing the macros to common so that it can be used for pimv6 debugs as well
to be used for both IGMP and MLD debugs.

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2022-09-04 22:46:09 -07:00
Donatas Abraitis b32cf39d45
Merge pull request #11485 from AbhishekNR/ipv6_mld_todo
pim6d: Completing "ipv6 mld" config command.
2022-08-18 09:47:03 +03:00
Mobashshera Rasool 0c7f978ec9 pimd: Simply the code a bit, reduce code complexity
Combine all the if conditions in api pim_if_addr_add_all to
reduce nested loops.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-07-31 23:43:28 -07:00
Mobashshera Rasool 6fe9b9d600 pim6d: clear interface stats on interface shutdown
The clear was happening only for PIMv4. Removed the PIMv4
check.

Fixes: #11628

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-07-18 01:18:16 -07:00
Abhishek N R 5c1b3cd2d9 pim6d: Completing "ipv6 mld" command.
Signed-off-by: Abhishek N R <abnr@vmware.com>
2022-07-07 04:36:33 -07:00
sarita patra 4a8336cfa8 pim6d: Handle rpf_addr in pim_if_addr_add()
Signed-off-by: sarita patra <saritap@vmware.com>
2022-07-06 02:41:47 -07:00
Abhishek N R 4fecac21cb pim6d: Changing igmp_enable to gm_enable.
Modified variable name so that it can be reused in mld.

Signed-off-by: Abhishek N R <abnr@vmware.com>
2022-06-27 05:52:02 -07:00
Donald Sharp 9a18e71314
Merge pull request #11475 from patrasar/pim_if_delete
pimd: fix pim interface deletion flow
2022-06-24 14:49:55 -04:00