Commit graph

149 commits

Author SHA1 Message Date
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
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
David Lamparter df9517c95a pimd: add IGMPv2/MLDv1 immediate-leave
(Somewhat) useful when dealing with an interface that has only one host
attached.  Only works for IGMPv2 and MLDv1, other protocol versions have
no leave message.

Co-authored-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-13 12:45:47 -03:00
David Lamparter f07d379b74 pimd: implement IGMP group/source count limit
For groups we can just look at the length of the list, for sources we
need to count them on a per-interface level.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-02-10 15:40:07 -03:00
Rafael Zalamena 8644524606 pimd: fix DR election race on startup
In case interface address is learnt during configuration, make sure to
run DR election when configuring PIM/PIM passive on interface.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-06 19:30:51 -03:00
Rafael Zalamena d1440dadff pimd: fix memory leak and assign allocation type
Use a memory allocation specific type for filter names (to help detect memory
leaks) and fix a memory leak when releasing peer memory.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-06 10:17:19 -03:00
Nathan Bahr 8b00575fbb pimd,yang: Expand rpf-lookup-mode command
Add options for group-list and source-list, both of which take a prefix list name.
The prefix list is used to determine the lookup mode for specific sources and/or groups.
Any number of lookup modes can be configured as long as the combination of group
and source list is unique.
A global lookup mode (empty group and source lists) is always added and defaults to mrib-then-urib
as it currently functions. The global lookup mode can be changed as it current exists with the command
`rpf-lookup-mode MODE`.
When determinig which mode to use, match source (and group if provided) against the lists, if they are set.
If a lookup does not specify a group, then only use lookup modes that do not have a group list defined.
A lookup by definition will have a source, so no special handling there.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-01-09 21:58:22 +00:00
Rafael Zalamena 3bebb7be92
Merge pull request #17252 from nabahr/mcast-mode
Fix PIMD RPF lookup mode and nexthop tracking
2024-12-16 09:57:31 -03:00
Nathan Bahr 9ce7f9b8e8 pimd: Update nexthops when lookup mode changes
Link up the RPF lookup mode changing to a force update to RP's and
upstreams registered for nexthop lookup cache updates.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-12-13 17:36:34 +00: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
Nathan Bahr 10e2df6530 pimd,yang: Reimplement RPF lookup vty in router pim
Add rpf-lookup-mode MODE vty command under router pim block.
Including NB piping and config write. Using the mode still pending.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-12-13 17:36:34 +00:00
Rafael Zalamena a507ca1163 pimd,pim6d: optimize multicast prefix generation
Fix Coverity Scan CID 1602463: make it impossible for the function to fail.

Hardcode the multicast prefix generation instead of calling `str2prefix()`
which caused unnecessary memory allocations and returned error values.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-13 08:28:42 -03:00
Rafael Zalamena 74834a92f6 pimd: support originator id configuration
Allow user to specify the RP field for the SA messages.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-12 10:34:19 -03:00
Rafael Zalamena 74623166d4 pim6d: ignore more MSDP callbacks
PIMv6 does not implement MSDP, users should use PIMv6 embedded RP
instead.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-11 11:58:25 -03:00
Jafar Al-Gharaibeh ccb57ad10f
Merge pull request #17521 from opensourcerouting/msdp-sa-limit
pimd: MSDP per peer SA limit
2024-12-10 11:36:50 -06: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
Rafael Zalamena a38ed18a4e pimd: implement MSDP peer SA limiting
Implement a command to enable/disable per peer MSDP SA limiting.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-05 10:38:52 -03:00
Rafael Zalamena c8ded86e9e yang,pimd: support shutdown and SA limit
Add MSDP shutdown and SA limiting configuration to YANG model.

(no implementation, just boiler plate code)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-05 10:35:10 -03:00
Rafael Zalamena 379dc9ee2f pimd: implement MSDP shutdown command
Allow MSDP protocol to be disabled.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-11-25 19:23:33 -03:00
Rafael Zalamena a3e04a86d2
Merge pull request #17340 from nabahr/mapping-agent
PIMD: Implement AutoRP mapping-agent
2024-11-21 16:10:42 -03:00
Rafael Zalamena fc39bfaa0a pimd,yang: log MSDP SA events
Add new command to log all SA events.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-11-21 10:26:16 -03:00
Rafael Zalamena 21d1e85db5 pimd,yang: log MSDP neighbor events
Move MSDP neighbor events global debug to per PIM instance.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-11-21 10:26:16 -03:00
Nathan Bahr bd9331e0ae pimd,yang: Add PIMD northbound/yang for AutoRP mapping agent
Reuses the candidate selection logic from BSR configuration

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-11-19 22:33:11 +00:00
Rafael Zalamena 23c7acd232 pim6d: support embedded-rp
Implement embedded RP support and configuration commands.

Embedded RP is disabled by default and can be globally enabled with the
command `embedded-rp` in the PIMv6 configuration node.

It supports the following options:
- Embedded RP maximum limit
- Embedded RP group filtering

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-11-13 12:05:35 -03:00
Rafael Zalamena e1338f5ade pimd: fix northbound error message on delete
`snprintf` doesn't know about `%pPAs` use `snprintfrr` instead.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-09-30 11:13:25 -03:00
Nathan Bahr 17972d104d pimd: Fix igmp proxy null pointer dereference
Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-09-25 13:53:30 +00:00
Nathan Bahr 3b323fc441 pimd,yang: Implement AutoRP CLI and NB config path
New CLI commands added:
router pim [vrf NAME]
  autorp discovery
  autorp announce RP-ADDR [GROUP | group-list PREFIX-LIST]
  autorp announce {scope (1-255) | interval (1-65535) | holdtime (0-65535)}

autorp discovery
  Enables Auto RP discovery for learning dynamic RP information using the
  AutoRP protocol.

autorp announce RP-ADDR [GROUP | group-list PREFIX-LIST]
  Enable announcements of a candidate RP with the given group range, or
  prefix list of group ranges, to an AutoRP mapping agent.

autorp announce {scope (1-255) | interval (1-65535) | holdtime (0-65535)}
  Configure the parameters of the AutoRP announcement messages.
  The scope sets the packet TTL.
  The interval sets the time between TX of announcements.
  The holdtime sets the hold time in the message, the time the mapping
  agent should wait before invalidating the candidate RP information.

debug pim autorp
  Enable debug logging of the AutoRP protocol

show ip pim [vrf NAME] autorp [json]
  Show details of the AutoRP protocol.
  To view learned RP info, use the existing command 'show ip pim rp-info'

Extend pim yang for new configuration:
  augment /frr-rt:routing/frr-rt:control-plane-protocols/frr-rt:control-plane-protocol/frr-pim:pim/frr-pim:address-family:
    +--rw rp
       +--rw auto-rp
          +--rw discovery-enabled?   boolean
          +--rw announce-scope?      uint8
          +--rw announce-interval?   uint16
          +--rw announce-holdtime?   uint16
          +--rw candidate-rp-list* [rp-address]
             +--rw rp-address           inet:ip-address
             +--rw (group-or-prefix-list)?
                +--:(group)
                |  +--rw group?         frr-route-types:ip-multicast-group-prefix
                +--:(prefix-list)
                   +--rw prefix-list?   plist-ref

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-09-24 16:39:17 +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
Barry A. Trent 26b67993d0 pimd, yang: add cli for igmp proxy
Signed-off-by: Barry A. Trent <barry.trent@atcorp.com>
2024-09-20 13:44:27 -07:00
Donald Sharp f3fc33e17b
Merge pull request #16438 from Jafaral/pim-10.1-cand-rp
PIM candidate BSR/RP support
2024-09-13 19:45:57 -04:00
anlan_cs 27b682aae0 pimd: fix crash for two commands
Need "pim-enable" the interface for the two commands, otherwise it will crash.

```
PIM: lib_interface_pim_address_family_bsm_modify+0x68     561aa37a406c     7ffcc7b4cbd0 /usr/lib/frr/pimd (mapped at 0x561aa3726000)
PIM: nb_callback_modify+0xdc            7f6200961aac     7ffcc7b4cc00 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_callback_configuration+0x14e     7f6200962740     7ffcc7b4cc90 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_transaction_process+0x68        7f6200962c79     7ffcc7b4d120 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_candidate_commit_apply+0x36     7f620096144f     7ffcc7b4d170 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_candidate_commit+0x96           7f6200961585     7ffcc7b4d1b0 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_cli_classic_commit+0x9e         7f6200967c4f     7ffcc7b4d200 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_cli_apply_changes_internal+0x1fd     7f62009681ef     7ffcc7b4f250 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_cli_apply_changes+0x2a9         7f6200968554     7ffcc7b51290 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: pim_process_no_bsm_cmd+0x4a        561aa378b7b6     7ffcc7b51b90 /usr/lib/frr/pimd (mapped at 0x561aa3726000)
PIM: no_ip_pim_bsm+0x23                 561aa37d8487     7ffcc7b51bb0 /usr/lib/frr/pimd (mapped at 0x561aa3726000)
PIM: cmd_execute_command_real+0x35a     7f62008f83c6     7ffcc7b51be0 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: cmd_execute_command+0x12f          7f62008f8527     7ffcc7b51c70 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: cmd_execute+0x95                   7f62008f8a75     7ffcc7b51cd0 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: vty_command+0x1b8                  7f62009b621a     7ffcc7b51d20 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: vty_execute+0x59                   7f62009b7fb3     7ffcc7b53db0 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: vtysh_read+0x1f6                   7f62009ba136     7ffcc7b53de0 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: event_call+0xd6                    7f62009af5df     7ffcc7b54040 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: frr_run+0x240                      7f6200935177     7ffcc7b54100 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: main+0x12e                         561aa37e7950     7ffcc7b54210 /usr/lib/frr/pimd (mapped at 0x561aa3726000)
PIM: __libc_start_main+0xea             7f6200681d0a     7ffcc7b54250 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x7f620065b000)
PIM: _start+0x2a                        561aa377c42a     7ffcc7b54320 /usr/lib/frr/pimd (mapped at 0x561aa3726000)
```

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2024-09-12 17:22:53 +08:00
Jafar Al-Gharaibeh 2d0812373c pimd: Candidate-BSR support
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2024-09-09 13:27:49 -05: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
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
Rafael Zalamena a2209b597a lib: define constant for plataforms missing it
Add definition of `TCP_MD5SIG_MAXKEYLEN` in the `sockopt.h` header so
users of it have the definition of the maximum key length for socket
authentication operations.

The following OSes reported failure in CI while building:
 - NetBSD 8
 - FreeBSD 11
 - FreeBSD 12

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-07-29 11:41:39 -03:00
Rafael Zalamena bd838d8c89 pimd: add support for MSDP authentication
Implement MSDP MD5 authentication connection support.

Implementation details:
- Move the MSDP socket creation code to a generic function so it can be
  parametrized to be used with/without authentication.
- The MSDP peer connection will not change when the configuration is
  set, instead it will only be applied next connection or when
  `clear ip msdp peer A.B.C.D` is called.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-07-29 11:40:53 -03:00
Rafael Zalamena be3bfe5daa pimd: MSDP SA filtering
Implement MSDP peer incoming/outgoing SA filter.

Note
----

  Cisco extended access list has a special meaning: the first address is
  the source address to filter.

Example:

  ! The rules below filter some LAN prefix to be leaked out
  access-list filter-lan-source deny ip 192.168.0.0 0.0.255.255 224.0.0.0 0.255.255.255
  access-list filter-lan-source permit any
  router pim
   msdp peer 192.168.0.1 sa-filter filter-lan-source out

  ! The rules below filter some special management group from being
  ! learned
  access-list filter-management-group deny 230.0.0.0 0.255.255.255
  access-list filter-management-group permit any
  router pim
   msdp peer 192.168.0.1 sa-filter filter-management-group in

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-07-27 11:32:30 -03:00
Louis Scalbert 6952bea5cd pimd: fix crash on non-existent interface
Fix the following crash when pim options are (un)configured on an
non-existent interface.

> r1(config)# int fgljdsf
> r1(config-if)# no ip pim unicast-bsm
> vtysh: error reading from pimd: Connection reset by peer (104)Warning: closing connection to pimd because of an I/O error!

> #0  raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1  0x00007f70c8f32249 in core_handler (signo=11, siginfo=0x7fffff88e4f0, context=0x7fffff88e3c0) at lib/sigevent.c:258
> #2  <signal handler called>
> #3  0x0000556cfdd9b16d in lib_interface_pim_address_family_unicast_bsm_modify (args=0x7fffff88f130) at pimd/pim_nb_config.c:1910
> #4  0x00007f70c8efdcb5 in nb_callback_modify (context=0x556d00032b60, nb_node=0x556cffeeb9b0, event=NB_EV_APPLY, dnode=0x556d00031670, resource=0x556d00032b48, errmsg=0x7fffff88f710 "", errmsg_len=8192)
>     at lib/northbound.c:1538
> #5  0x00007f70c8efe949 in nb_callback_configuration (context=0x556d00032b60, event=NB_EV_APPLY, change=0x556d00032b10, errmsg=0x7fffff88f710 "", errmsg_len=8192) at lib/northbound.c:1888
> #6  0x00007f70c8efee82 in nb_transaction_process (event=NB_EV_APPLY, transaction=0x556d00032b60, errmsg=0x7fffff88f710 "", errmsg_len=8192) at lib/northbound.c:2016
> #7  0x00007f70c8efd658 in nb_candidate_commit_apply (transaction=0x556d00032b60, save_transaction=true, transaction_id=0x0, errmsg=0x7fffff88f710 "", errmsg_len=8192) at lib/northbound.c:1356
> #8  0x00007f70c8efd78e in nb_candidate_commit (context=..., candidate=0x556cffeb0e80, save_transaction=true, comment=0x0, transaction_id=0x0, errmsg=0x7fffff88f710 "", errmsg_len=8192) at lib/northbound.c:1389
> #9  0x00007f70c8f03e58 in nb_cli_classic_commit (vty=0x556d00025a80) at lib/northbound_cli.c:51
> #10 0x00007f70c8f043f8 in nb_cli_apply_changes_internal (vty=0x556d00025a80,
>     xpath_base=0x7fffff893bb0 "/frr-interface:lib/interface[name='fgljdsf']/frr-pim:pim/address-family[address-family='frr-routing:ipv4']", clear_pending=false) at lib/northbound_cli.c:178
> #11 0x00007f70c8f0475d in nb_cli_apply_changes (vty=0x556d00025a80, xpath_base_fmt=0x556cfdde9fe0 "./frr-pim:pim/address-family[address-family='%s']") at lib/northbound_cli.c:234
> #12 0x0000556cfdd8298f in pim_process_no_unicast_bsm_cmd (vty=0x556d00025a80) at pimd/pim_cmd_common.c:3493
> #13 0x0000556cfddcf782 in no_ip_pim_ucast_bsm (self=0x556cfde40b20 <no_ip_pim_ucast_bsm_cmd>, vty=0x556d00025a80, argc=4, argv=0x556d00031500) at pimd/pim_cmd.c:4950
> #14 0x00007f70c8e942f0 in cmd_execute_command_real (vline=0x556d00032070, vty=0x556d00025a80, cmd=0x0, up_level=0) at lib/command.c:1002
> #15 0x00007f70c8e94451 in cmd_execute_command (vline=0x556d00032070, vty=0x556d00025a80, cmd=0x0, vtysh=0) at lib/command.c:1061
> #16 0x00007f70c8e9499f in cmd_execute (vty=0x556d00025a80, cmd=0x556d00030320 "no ip pim unicast-bsm", matched=0x0, vtysh=0) at lib/command.c:1227
> #17 0x00007f70c8f51e44 in vty_command (vty=0x556d00025a80, buf=0x556d00030320 "no ip pim unicast-bsm") at lib/vty.c:616
> #18 0x00007f70c8f53bdd in vty_execute (vty=0x556d00025a80) at lib/vty.c:1379
> #19 0x00007f70c8f55d59 in vtysh_read (thread=0x7fffff896600) at lib/vty.c:2374
> #20 0x00007f70c8f4b209 in event_call (thread=0x7fffff896600) at lib/event.c:2011
> #21 0x00007f70c8ed109e in frr_run (master=0x556cffdb4ea0) at lib/libfrr.c:1217
> #22 0x0000556cfdddec12 in main (argc=2, argv=0x7fffff896828, envp=0x7fffff896840) at pimd/pim_main.c:165
> (gdb) f 3
> #3  0x0000556cfdd9b16d in lib_interface_pim_address_family_unicast_bsm_modify (args=0x7fffff88f130) at pimd/pim_nb_config.c:1910
> 1910			pim_ifp->ucast_bsm_accept =
> (gdb) list
> 1905		case NB_EV_ABORT:
> 1906			break;
> 1907		case NB_EV_APPLY:
> 1908			ifp = nb_running_get_entry(args->dnode, NULL, true);
> 1909			pim_ifp = ifp->info;
> 1910			pim_ifp->ucast_bsm_accept =
> 1911				yang_dnode_get_bool(args->dnode, NULL);
> 1912
> 1913			break;
> 1914		}
> (gdb) p pim_ifp
> $1 = (struct pim_interface *) 0x0

Fixes: 3bb513c399 ("lib: adapt to version 2 of libyang")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-07-03 16:13:13 +02:00
Igor Ryzhov 8ffc3640f0 pimd: fix crash when configuring ssmpingd
Command: `ip ssmpingd 1.1.1.1`

Backtrace:
```
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
0x00007fd1d3b02859 in __GI_abort () at abort.c:79
0x00007fd1d3e323e1 in yang_dnode_xpath_get_canon (dnode=<optimized out>, xpath_fmt=<optimized out>, ap=<optimized out>) at lib/yang_wrappers.c:61
0x00007fd1d3e34f41 in yang_dnode_get_ipv4 (addr=addr@entry=0x7ffc368554d4, dnode=<optimized out>, xpath_fmt=xpath_fmt@entry=0x5556af8680d4 "./source-addr") at lib/yang_wrappers.c:826
0x00005556af8216d3 in routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_pingd_source_ip_create (args=0x7ffc36855530) at pimd/pim_nb_config.c:925
0x00007fd1d3dec13f in nb_callback_create (nb_node=0x5556b197ea40, nb_node=0x5556b197ea40, errmsg_len=8192, errmsg=0x7ffc36855a90 "", resource=0x5556b18fa6f8, dnode=0x5556b1ad7a10, event=NB_EV_APPLY, context=0x5556b1ad75c0) at lib/northbound.c:1260
nb_callback_configuration (context=0x5556b1ad75c0, event=NB_EV_APPLY, change=<optimized out>, errmsg=0x7ffc36855a90 "", errmsg_len=8192) at lib/northbound.c:1648
0x00007fd1d3deca6c in nb_transaction_process (event=event@entry=NB_EV_APPLY, transaction=transaction@entry=0x5556b1ad75c0, errmsg=errmsg@entry=0x7ffc36855a90 "", errmsg_len=errmsg_len@entry=8192) at lib/northbound.c:1779
0x00007fd1d3decdd6 in nb_candidate_commit_apply (transaction=0x5556b1ad75c0, save_transaction=save_transaction@entry=true, transaction_id=transaction_id@entry=0x0, errmsg=errmsg@entry=0x7ffc36855a90 "", errmsg_len=errmsg_len@entry=8192) at lib/northbound.c:1129
0x00007fd1d3decf15 in nb_candidate_commit (context=..., candidate=<optimized out>, save_transaction=save_transaction@entry=true, comment=comment@entry=0x0, transaction_id=transaction_id@entry=0x0, errmsg=0x7ffc36855a90 "", errmsg_len=8192) at lib/northbound.c:1162
0x00007fd1d3ded4af in nb_cli_classic_commit (vty=vty@entry=0x5556b1ada2a0) at lib/northbound_cli.c:50
0x00007fd1d3df025f in nb_cli_apply_changes_internal (vty=vty@entry=0x5556b1ada2a0, xpath_base=xpath_base@entry=0x7ffc36859b50 ".", clear_pending=clear_pending@entry=false) at lib/northbound_cli.c:177
0x00007fd1d3df06ad in nb_cli_apply_changes (vty=vty@entry=0x5556b1ada2a0, xpath_base_fmt=xpath_base_fmt@entry=0x0) at lib/northbound_cli.c:233
0x00005556af80fdd5 in pim_process_ssmpingd_cmd (vty=0x5556b1ada2a0, operation=NB_OP_CREATE, src_str=0x5556b1ad9630 "1.1.1.1") at pimd/pim_cmd_common.c:3423
0x00007fd1d3da7b0e in cmd_execute_command_real (vline=vline@entry=0x5556b1ac9520, vty=vty@entry=0x5556b1ada2a0, cmd=cmd@entry=0x0, up_level=up_level@entry=0) at lib/command.c:982
0x00007fd1d3da7cb1 in cmd_execute_command (vline=vline@entry=0x5556b1ac9520, vty=vty@entry=0x5556b1ada2a0, cmd=0x0, vtysh=vtysh@entry=0) at lib/command.c:1040
0x00007fd1d3da7e50 in cmd_execute (vty=vty@entry=0x5556b1ada2a0, cmd=cmd@entry=0x5556b1ae0a30 "ip ssmpingd 1.1.1.1", matched=matched@entry=0x0, vtysh=vtysh@entry=0) at lib/command.c:1207
0x00007fd1d3e278be in vty_command (vty=vty@entry=0x5556b1ada2a0, buf=<optimized out>) at lib/vty.c:591
0x00007fd1d3e27afd in vty_execute (vty=0x5556b1ada2a0) at lib/vty.c:1354
0x00007fd1d3e2bb23 in vtysh_read (thread=<optimized out>) at lib/vty.c:2362
0x00007fd1d3e22254 in event_call (thread=thread@entry=0x7ffc3685cd80) at lib/event.c:2003
0x00007fd1d3dce9e8 in frr_run (master=0x5556b183c830) at lib/libfrr.c:1218
0x00005556af803653 in main (argc=6, argv=<optimized out>, envp=<optimized out>) at pimd/pim_main.c:162
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-23 11:58:50 +02:00
Christian Hopps 2c01083d35 lib: all: remove './' from xpath 22% speedup
fixes #8299

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-11-29 14:37:23 -05:00
Sai Gomathi N dd1e34eff4 pimd,pim6d: Resolving the YANG datatype Inconsistency for PIM Hello Interval
The YANG specification currently designates a uint8 data type for the hello interval,
despite the CLI documentation (ip pim hello (1-65535) [(1-65535)]) indicating a maximum value of 65535.
To address this inconsistency, updating the data type to uint16 allowing for a maximum value for hello intervals.

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2023-08-30 06:02:12 -07:00
Donatas Abraitis ff73a7bdbe
Merge pull request #13664 from routingrocks/pim_nb_fix
pimd: Change in PIM northbound error, when a path to RP is not found …
2023-06-08 20:16:32 +03: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
Rajesh Varatharaj 314a97c164 pimd: Change in PIM northbound error, when a path to RP is not found during config apply
Currently, in PIM Northbound, when a path to RP is not found during config apply, we are treating this as a NB_ERR_INCONSISTENCY.
However, there are two issues with this approach:

When OSPF or IGP convergence is completed, it is possible that the RPF check will succeed.
If we have multiple groups and RPs (e.g. 50 RPs), we will receive 50 logs with inconsistency errors.
example:

2023/05/27 22:57:45 PIM: [G822R-SBMNH] config-from-file# ip pim rp 192.168.100.1 239.100.0.0/28 2023/05/27 22:57:45
PIM: [VAKV3-NMY7B][EC 100663337] error processing configuration change: error [internal inconsistency] event [apply]
operation [create] xpath [/frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-pim:pimd']
[name='pim'][vrf='default']/frr-pim:pim/address-family[address-family='frr-routing:ipv4']/frr-pim-rp:rp/static-rp/rp-list
[rp-address='192.168.100.1']/group-list[.='239.100.0.0/28']] message: No Path to RP address specified: 192.168.100.1

Issue: #13620
Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
2023-06-01 16:13:51 -07:00
Sarita Patra 6d1d2c27a3 pim6d: Fix crash in ipv6 pim command
Problem:
Execute the below commands, pim6d core happens.
interface ens193
 ip address 69.0.0.2/24
 ipv6 address 8000::1/120
 ipv6 mld
 ipv6 pim
We see crash only if the interface is not configured, and
we are executing PIM/MLD commands.

RootCause:
Interface ens193 is not configured. So, it will have
ifindex = 0 and mroute_vif_index = -1.
Currently, we don't enable MLD on an interface if
mroute_vif_index < 0. So, pim_ifp->MLD = NULL.
In the API pim_if_membership_refresh(), we are accessing
pim_ifp->MLD NULL pointer which leads to crash.

Fix:
Added NULL check before accessing pim_ifp->MLD pointer in
the API pim_if_membership_refresh().

Issue: #13385

Signed-off-by: Sarita Patra <saritap@vmware.com>
2023-05-30 00:43:45 -07:00
Donatas Abraitis e7fd314f06
Merge pull request #12550 from AbhishekNR/mld_join
pim6d: Implementing "ipv6 mld join"
2023-04-17 11:01:21 +03:00