Commit graph

116 commits

Author SHA1 Message Date
usrivastava-nvidia 5934b6f402 pimd:Setting the flag PIM_MSDP_PEERF_IN_GROUP for MSDP mesh group peers
Signed-off-by: Utkarsh Srivastava <usrivastava@nvidia.com>
2025-03-20 16:17:39 +00: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 e8d81ab5ce pimd: Implement rpf lookup mode as a list
Add the support to store lookup modes as a sorted list.
List is non-unique and sorts mode with both lists < modes with one list < global mode (no lists).
This way, when finding the right mode, we will match a lookup using a prefix list before the global mode.
Add passing group address into all lookups (using nht cache and/or synchronous lookup).
Many areas don't have a group address, use PIMADDR_ANY if no valid group is needed.

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 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
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 d4da6316c7 pimd: move all MSDP code to its own place
Guard MSDP code to compile only on IPv4 and remove all MSDP code from
PIMv6.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-11 11:58:25 -03:00
Rafael Zalamena 6d759deea1 pimd: move MSDP configuration and initialization
Reorganize the MSDP initialization code and configuration writing code
to its appropriated place.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-11 11:58:25 -03: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 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 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
Rafael Zalamena 1e0629fd04 pimd: constify peer lookup function
Make parameter `const` to document that the variable will not change.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-11-20 12:06:11 -03:00
Rafael Zalamena 8f829b2495 pimd: remove temporary variables from MSDP peer
Remove from MSDP peer data structure two temporary variables
that should only be used when calling library functions.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-11-20 12:06:00 -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
Donatas Abraitis 23c756ce68
Merge pull request #16472 from donaldsharp/msdp_bug
pimd: Fix msdp setting of sa->rp
2024-07-25 21:09:19 +03:00
Donald Sharp c4b4c242ec pimd: Fix msdp setting of sa->rp
The code is clearly incorrect.  After consultation with
the original author this is the decided change.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-07-25 07:50:32 -04:00
Nathan Bahr fd8edc3dfb pimd, lib, vtysh: Added new 'router pim[6] [vrf NAME]' config node
Moved all existing global/vrf PIM config to the new subnode.
Existing configuration updated to be hidden and deprecated.
Both versions of configuration still work together.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-07-16 13:30:35 -05:00
Adriano Marto Reis 95e31a6081 pimd: Indicating the rp in the msdp sa message
Indicating the configured PIM Rendezvous Point (RP) in the MSDP SA
message

The RFC-3618, section 12.2.1, describes the fields included in the MSDP
SA message. The "RP address" field is "the address of the RP in the
domain the source has become active in".

In the most common case, we will establish an MSDP connection from RP to
RP. However, there are cases where we want to establish a MSDP
connection from an interface/address that is not the RP. Section 3 of
RFC-3618 describes that scenario as "intermediate MSDP peer". Moreover,
the RP could be another router in the PIM domain - not the one
establishing the MSDP connection.

The current implementation could be problematic even with a single
router per PIM domain. Consider the following scenario:
* There are two PIM domains, each one with a single router.
* The two routers are connected via two independent networks. Let's say
that is to provide redundancy.
* The routers are configured to establish two MSDP connections, one on
each network (redundancy again).
* A multicast source becomes active on the router 1. It will be
communicated to router 2 via two independent MSDP SA messages, one per
MSDP connection.
* Without these changes, each MSDP SA message will indicate a different
RP.
* Both RP addresses will pass the RPF check, and both MSDP sources will
be accepted.
* If the router has clients interested in that multicast group, it will
send PIM Join messages to both RPs and start receiving the multicast
traffic from both.

With the changes included in this commit, the multicast source available
in router 1 would still be communicated to router 2 twice. But both MSDP
SA messages would indicate the same RP, and one of them would be
discarded due to failure in the RPF-check failure. Also, the changes
allow us to define the RP that will be included in the MSDP SA message,
and it could be one of the interfaces used to establish the MSDP
connection, some other interface on the router, a loopback interface, or
another router in the PIM domain.

These changes should not create compatibility issues. As I mentioned, we
usually establish MSDP connections from RP to RP. In this case, the
result will be the same. We would still indicate the address used to
establish the MSDP connection if the RP is not set - I wonder if that
should even be a valid configuration.

Signed-off-by: Adriano Marto Reis <adrianomarto@gmail.com>
2023-10-04 14:30:44 +10:00
Donald Sharp 24a58196dd *: Convert event.h to frrevent.h
We should probably prevent any type of namespace collision
with something else.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp cd9d053741 *: Convert struct event_master to struct event_loop
Let's find a better name for it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp e16d030c65 *: Convert THREAD_XXX macros to EVENT_XXX macros
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 2453d15dbf *: Convert struct thread_master to struct event_master and it's ilk
Convert the `struct thread_master` to `struct event_master`
across the code base.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 907a2395f4 *: Convert thread_add_XXX functions to event_add_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp e6685141aa *: Rename struct thread to struct event
Effectively a massive search and replace of
`struct thread` to `struct event`.  Using the
term `thread` gives people the thought that
this event system is a pthread when it is not

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp cb37cb336a *: Rename thread.[ch] to event.[ch]
This is a first in a series of commits, whose goal is to rename
the thread system in FRR to an event system.  There is a continual
problem where people are confusing `struct thread` with a true
pthread.  In reality, our entire thread.c is an event system.

In this commit rename the thread.[ch] files to event.[ch].

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:16 -04:00
Donald Sharp d8bc11a592 *: Add a hash_clean_and_free() function
Add a hash_clean_and_free() function as well as convert
the code to use it.  This function also takes a double
pointer to the hash to set it NULL.  Also it cleanly
does nothing if the pointer is NULL( as a bunch of
code tested for ).

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-21 08:54:21 -04: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
David Lamparter 993e3d8e13 pimd: un-dependency-hell pim_instance.h
This is causing build issues on BSD by including (transitively)
`linux/mroute6.h` - try to address by disentangling the headers a bunch.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 15:10:57 +02:00
sarita patra 0332b088d3 pim6d: Adjust mrib_nexthop_addr msdp code
In this PR, we are handling the msdp code
after mrib_nexthop_addr modified from prefix
to pim_addr.

Signed-off-by: sarita patra <saritap@vmware.com>
2022-04-06 22:36:42 -07:00
Donald Sharp cc9f21da22 *: Change thread->func to return void instead of int
The int return value is never used.  Modify the code
base to just return a void instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-23 19:56:04 -05:00
Donald Sharp 76802e5209
Merge pull request #10292 from opensourcerouting/pim6-addr-aux
pimd: start tackling IPv6 address operations
2022-02-08 13:09:08 -05:00
Mobashshera Rasool 2b59c0b901 pimd: remove redundant header include
Removing redundant header inclusion of pim_cmd.h

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-01-18 04:35:37 -08:00
David Lamparter 3ca68c9cf3 pimd: remove PIM_INADDR_IS[NOT]_ANY macros
These really don't serve much of a purpose, especially with how
inconsistently they're used.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:11:08 +01:00
David Lamparter 62f59b58ba pimd: deploy pim_sgaddr_* helpers
Use _cmp/_hash/_match helpers for operations on pim_sgaddr to prepare
IPv6 support.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:08:58 +01:00
David Lamparter 032a741219 pimd: move & deploy pim_addr_cmp() helper
Comparing `s_addr` isn't cutting it for IPv6 support.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:08:29 +01:00
David Lamparter 2a27f13b21 pimd: move, rename and deploy pim_addr_is_any()
Replaces comparison against INADDR_ANY, so we can do IPv6 too.

(Renamed from "pim_is_addr_any" for "pim_addr_*" naming pattern, and
type fixed to bool.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:03:26 +01:00
David Lamparter 98a81d2bff pimd: remove pim_str_sg_dump()
... and replace with `%pSG` printfrr specifier.  This actually used a
static buffer in the formatting function, so subsequent formatting would
overwrite earlier uses.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:02:18 +01:00
David Lamparter 9bace5c2d3 pimd: remove pim_str_sg_set()
... and replace with `%pSG` printfrr specifier.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:00:04 +01:00
David Lamparter 6fff2cc620 pimd: prefix_sg => pim_sgaddr
Mostly just 2 sed calls:

- `sed -e 's%struct prefix_sg%pim_sgaddr%g'`
- `sed -e 's%memset(&sg, 0, sizeof(pim_sgaddr));%memset(\&sg, 0, sizeof(sg));%g'`

Plus a bunch of fixing whatever that broke.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-12 18:24:25 +01:00
Chirag Shah 97495b70b8 pimd: fix msdp mesh grp with wildcard member addr
frr-reload fails to recognize wildcard "*" for
member address in frr.conf/runing-config as cli
syntax expects in v4 address format.

Ticket: #2816923

Testing:

Without fix:
running config:
ip msdp mesh-group foo1 member *
Frr reoad failure log:
2021-11-02 11:05:04,317  INFO: Loading Config object from vtysh show running
line 5: % Unknown command: ip msdp mesh-group foo1 member *

Traceback (most recent call last):
  File "/usr/lib/frr/frr-reload.py", line 1950, in <module>

With fix:
--------
running config displays:
ip msdp mesh-group foo1 member 0.0.0.0

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-11-08 06:50:55 -08:00
Donald Sharp b0a13ffb36 pimd: Prevent uninited usage of nexthop
pim_msdp_peer_rpf_check creates an nexthop to do
a rpf search against and doesn't initialize it
sucht that the pim_nexthop_lookup function is
making decisions against the nexthop just
created that was uninitialized.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-21 07:54:54 -04:00
Igor Ryzhov 3e7ec159bd pimd: fix missing list remove when deleting mesh group
This leads to a crash when you use "show run" after deleting the group.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-28 22:25:31 +03: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
Rafael Zalamena c72d97a5d9 pimd: make function names consistent
Rename functions (`pim_msdp_peer_new` => `pim_msdp_peer_add` and
`pim_msdp_peer_do_del` => `pim_msdp_peer_del`) to keep consistency and
update the `pim_msdp_peer_add` documentation to tell users that this is
also used for non meshed group peers.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-06-25 16:00:09 -03: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 fb35f654e3 pimd: rename some MSDP functions
Rename and shorten function names to make them uniform.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-06-09 12:40:04 -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