Commit graph

96 commits

Author SHA1 Message Date
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
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 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
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
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
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
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
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
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 8a8ad459af
Merge pull request #10775 from opensourcerouting/pim6-mld-pr
pim6d: MLD code
2022-05-17 07:20:08 -04:00
sarita patra 78039cb25d pimd: introduced flags for pim_passive_enable
Signed-off-by: sarita patra <saritap@vmware.com>
2022-05-12 23:51:21 -07:00
David Lamparter 5e5034b0a2 pim6d: add fresh MLD implementation
Fresh ground-up MLD implementation with subscriber-tracking for MLDv2.
Intended to be adapted for IPv4 and replace the IGMP implementation at a
later point.

Tested in ANVL, currently at 94/116.  Some issues/TODOs are left in the
code as CPP_NOTICE markers, but the code is very much good enough to
proceed since otherwise we're blocked on overall PIM v6 progress.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 16:01:59 +02: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
David Lamparter 4f977c8e77 pimd: remove pim_interface->options
I should've removed this in #10960.  It's a hazard in terms of
forgetting to adjust PRs/other changes that might accidentally still
reference the field.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-04-08 10:30:24 +02:00
David Lamparter b6fcc0b7a6 pimd: remove useless PIM_IF_* macros
The only function these macros have is to make the code confusing.
"PIM_IF_DO_PIM" sounds like it triggers some action, but it doesn't.

Replace with "bool" fields in struct pim_interface.

(Note: PIM_IF_*_IGMP_LISTEN_ALLROUTERS was always set, without any way
to unset it.  It is completely removed now and always enabled.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-04-04 14:11:29 +02:00
Donatas Abraitis 3e5d8665f6 pimd: Add additional IGMP stats (peak number of groups)
```
exit1-debian-11# sh ip igmp statistics interface eth2
IGMP statistics
Interface            : eth2
V1 query             : 0
V2 query             : 0
V3 query             : 25
V2 leave             : 0
V1 report            : 0
V2 report            : 0
V3 report            : 34
mtrace response      : 0
mtrace request       : 0
unsupported          : 0
joins failed         : 0
joins sent           : 13
general queries sent : 2
group queries sent   : 24
peak groups          : 9
total groups         : 4
total source groups  : 1
exit1-debian-11# sh ip igmp statistics interface eth2 json
{
  "eth2":{
    "name":"eth2",
    "queryV1":0,
    "queryV2":0,
    "queryV3":25,
    "leaveV2":0,
    "reportV1":0,
    "reportV2":0,
    "reportV3":34,
    "mtraceResponse":0,
    "mtraceRequest":0,
    "unsupported":0,
    "peakGroups":9,
    "totalGroups":4,
    "totalSourceGroups":1,
    "joinsFailed":0,
    "joinsSent":13,
    "generalQueriesSent":2,
    "groupQueriesSent":24
  }
}
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-15 14:08:35 +02:00
Donatas Abraitis f2058cb425 pimd: Add IGMP join sent/failed statistics
```
exit1-debian-11# sh ip igmp statistics
IGMP statistics
Interface           : global
V1 query            : 0
V2 query            : 0
V3 query            : 0
V2 leave            : 0
V1 report           : 0
V2 report           : 0
V3 report           : 16
mtrace response     : 0
mtrace request      : 0
unsupported         : 0
joins failed        : 0
joins sent          : 11
total groups        : 4
total source groups : 0
exit1-debian-11# sh ip igmp statistics json
{
  "global":{
    "name":"global",
    "queryV1":0,
    "queryV2":0,
    "queryV3":0,
    "leaveV3":0,
    "reportV1":0,
    "reportV2":0,
    "reportV3":16,
    "mtraceResponse":0,
    "mtraceRequest":0,
    "unsupported":0,
    "totalGroups":4,
    "totalSourceGroups":0,
    "joinsFailed":0,
    "joinsSent":11
  }
}
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-13 19:31:34 +02:00
David Lamparter cfef61553f pim6d: rework interface address tracking/selection
We only care about link-local addresses for IPv6 operation.  Also, MLD
needs the lowest while PIM needs the highest...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-12 22:47:13 +01:00
David Lamparter 034db86b72 pim6d: IPv6-adjust iface primary/DR addrs
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +01:00
David Lamparter 9bb93fa04e pim6d: IPv6-adjust neigh->source_addr
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +01:00
David Lamparter 883052c6f9 pim6d: convert address comparison in I_am_DR macro
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +01:00
Igor Ryzhov 6b88faa7ff pimd: move iface lib initialization to a proper place
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2022-01-24 20:14:18 +03:00
Sai Gomathi 18adcff1c0 pimd: Modifying members of pim_interface to accommodate IPv6 changes
Modifying the members of pim_interface which are to be used
for both IPv4 and IPv6 to common names(for both MLD and IGMP).

Issues: #10023

Co-authored-by: Mobashshera Rasool <mrasool@vmware.com>
Co-authored-by: Sarita Patra <saritap@vmware.com>
Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2022-01-11 03:18:06 -08:00
sarita patra 568b78b5bd pimd: Modifying in_addr to pim_addr in struct pim_iface_upstream_switch
Changed struct in_addr address to struct pim_addr in struct
pim_iface_upstream_switch which is to be used in both IPv4
and IPv6(Both MLD and IGMP).

Reviewed-by: Mobashshera Rasool <mrasool@vmware.com>
Signed-off-by: sarita patra <saritap@vmware.com>
2022-01-10 21:10:29 -08:00
Mobashshera Rasool 12e7634018 pimd: Modifying in_addr to pim_addr in struct pim_interface for IPv6
Based on compiler option, pim_addr will be changed to in_addr
or in6_addr for pimd and pim6d respectively.
Reviewed-by: Sarita Patra <saritap@vmware.com>
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-01-10 21:10:29 -08:00
David Lamparter 29e5822590
Revert "pimd: Modifying members of pim_interface to accommodate IPv6 changes" 2021-12-14 17:33:24 +01:00
Sai Gomathi ea7d74d702 pimd: Modifying members of pim_interface to accommodate IPv6 changes
Modifying the members of pim_interface which are to be used
for both IPv4 and IPv6 to common names(for both MLD and IGMP).

Issue: #10023

Co-authored-by: Mobashshera Rasool <mrasool@vmware.com>
Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-12-02 23:12:58 -08:00
Donald Sharp d047ba78d2
Merge pull request #9708 from mobash-rasool/new_b
pimd: hello sent stats counter change and new flag addition to decide hello send
2021-12-02 04:05:03 -05:00
Sai Gomathi b850813975 pimd: removing no caller functions
Removing the no caller function declarations and definitions
in pimd directory.

Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-11-25 20:42:54 -08:00
Mobashshera Rasool 79992e8a42 pimd: Add a flag to decide PIM has to send Hello
Problem Statement:
==================
pim maintains two counters hello tx and hello rx at interface level.
At present pim needs to send the hello message prior to other pim
message as per RFC. This logic is getting derived from the tx hello
counters. So when a new neighbor is added, tx counters are set to
zero and then based on this, it is further decided to send hello in
pim_hello_require function.

Fix:
====
Separating the hello statistics and the logic to decide when to send hello
based on a new flag. pim_ifstat_hello_sent will be used to note down
the hello stats while a new flag is added to decide whether to send hello
or not if it is the first packet to a neighbor.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-10-03 22:04:34 -07: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
David Lamparter e34e07e640 pimd: de-circularize includes
pimd's include files are very interdependent.  Let's chop that down a
bit to gain some flexibility.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-27 10:41:23 +02: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
Donatas Abraitis 7c98d487b8 *: Replace typo (supress => suppress)
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-11-17 12:13:38 +02:00
Nathan Bahr efe6f18590 pimd: fix IGMP receive handling
IGMP packets received from a source that does not match the subnet
of any configured addresses on the receive interface should be
ignored.
Also, find and use the correct IGMP socket object for the received
IGMP packet.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2020-08-26 10:46:42 -05:00
saravanank 46a9ea8bfa pimd: When DR becomes non DR, couldreg state events not handled.
RCA: Upstreams which are in register state other than noinfo, doesnt remove
register tunnel from oif after it becomes nonDR

Fix: scan upstreams with iif as the old dr and check if couldReg becomes false.
If couldreg becomes false from true, remove regiface and stop reg timer.
Do not disturb the entry. Later the entry shall be removed by kat expiry.

Signed-off-by: Saravanan K <saravanank@vmware.com>
2020-03-19 18:27:37 -07:00
Satheesh Kumar K 22c35834ea pimd: Use PIM EVPN MLAG Infra for syncing PIM MLAG Entries
Initially, MLAG Sync is happened at pim_ifchannel, this is mainly to
support even config mismatches(missing configuration of dual active).
But this causes more syncs for each entry.

and also it is not In-line with PIM EVPN. to avoid that moving to
pm_upstream based syncing.

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2020-03-06 16:03:36 -05:00
Donald Sharp 138c5a7450 *: Add infrastructure to support zapi interface callbacks
Start the conversion to allow zapi interface callbacks to be
controlled like vrf creation/destruction/change callbacks.

This will allow us to consolidate control into the interface.c
instead of having each daemon read the stream and react accordingly.
This will hopefully reduce a bunch of cut-n-paste stuff

Create 4 new callback functions that will be controlled by
lib/if.c

create -> A upper level protocol receives an interface creation event
The ifp is brand spanking newly created in the system.
up -> A upper level protocol receives a interface up event
This means the interface is up and ready to go.
down -> A upper level protocol receives a interface down
destroy -> A upper level protocol receives a destroy event
This means to delete the pointers associated with it.

At this point this is just boilerplate setup for future commits.
There is no new functionality.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp 008def8643
Merge pull request #4369 from patrasar/lmqc_lmqt
pimd: new cli to configure last-member-query-count & last-member-quer…
2019-05-30 21:23:11 -04:00
Sarita Patra 59115451a8 pimd: new cli to configure last-member-query-count & last-member-query-interval
Introduce new cli commands ip igmp last-member-query-count <1-7>
ip igmp last-member-query-interval <1-255> deciseconds.

Display the config in show running config and show ip igmp interface

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-05-29 20:36:16 -07:00
saravanank 8a4dfb5d45 pimd: Datastructure for BSM interface configuration and statistics
Signed-off-by: Saravanan K <saravanank@vmware.com>
2019-05-14 20:23:15 -07:00
Anuradha Karuppiah b1891fa084 pimd: API for enabling pim on the vxlan term device ipmr-lo
ipmr-lo is a dummy netdev with no additional addressing requirements -
root@TORS1:~# ip -d link show ipmr-lo
28: ipmr-lo: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether 12:5a:ae:74:51:a2 brd ff:ff:ff:ff:ff:ff promiscuity 0
    dummy addrgenmode eui64
root@TORS1:~#

This device is used by pim-vxlan to signify multicast-vxlan-tunnel
termination.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:21 -07:00
Donald Sharp 414d885aac pimd: Add hidden 'ip pim active-active` command
Add a command to track if an interface should be in active-active
mode or not.  This command is hidden at this time because it
is not finished fully.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31 09:28:39 -05:00
Donald Sharp 85a13586ed pimd: use bool instead of int to pass true/false
In pim_if_new use bool instead of an int to pass
true/false values for what we should create the
pim interface type for.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-17 14:09:06 -04:00