summaryrefslogtreecommitdiff
path: root/pimd/pim_igmp.c
AgeCommit message (Collapse)Author
2021-08-27pimd: reformat after dropping indent levelsDavid Lamparter
Intentionally separate here because the previous patch does a whole bunch of "move stuff up 1 level of indentation", and reviewing that is easier when you can use the ignore-whitespace option on diff. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-27pimd: IGMP memberships are not querier specificDavid Lamparter
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-07-28Merge pull request #9194 from idryzhov/pim-bool-falseDonald Sharp
pimd: fix incorrect bool returns
2021-07-27pimd: Validate the fields before accessing itMobashshera Rasool
This commit is to correct the order in which the fields are accessed while verifying it. First the fields should be verified, and if it is valid then access it. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-27pimd: fix incorrect bool returnsIgor Ryzhov
-1 is true when casted to bool. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-22Merge pull request #8986 from mobash-rasool/pim-upst-2Donald Sharp
pimd: To print querierIP address on the querier and nonQuerier IGMP e…
2021-07-19pimd: Add TOS check for IGMP conformanceMobashshera Rasool
IGMPv3 packets with invalid TOS should be dropped. Test Case ID: 4.10 TEST_DESCRIPTION Every IGMP message described in this document is sent with IP Precedence of Internetwork Control (e.g., Type of Service 0xc0) (Tests that IGMPv3 Membership Query Message conforms to above statement) TEST_REFERENCE NEGATIVE: RFC 3376, IGMP Version 3, s4 p7 Message Formats Issue: #9071 Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-19pimd: Add TTL check for IGMP conformanceMobashshera Rasool
IGMPv3 packets with invalid TTL should be dropped. Test Case ID: 4.10 TEST_DESCRIPTION Every IGMP message described in this document is sent with an IP Time-to-Live of 1 (Tests that IGMPv3 Membership Report Message conforms to above statement) TEST_REFERENCE NEGATIVE: RFC 3376, IGMP Version 3, s4 p7 Message Formats Issue: #9070 Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-19pimd: Abstracting header verification for igmpMobashshera Rasool
Moving the header verification checks inside a function. Signed-off-by: Mobashshera Rasool <mrassol@vmware.com>
2021-07-06pimd: To print querierIP address on the querier and nonQuerier IGMP enabled intfgithub login name
1. Add the querierIP object to igmp_sock datastruct to save the IP address of the querier. Management of the querierIP object is added. 2. To show the querier IP address in the CLI "show ip igmp interface". 3. To add the json object querierIP for querier IP address in the json CLI "show ip igmp interface json". Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-05-19pimd: When bind fails give some extra dataDonald Sharp
When bind to a socket fails, let's give some color so we can understand and fix the issue. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-04-23pimd: zassert => assertDavid Lamparter
No point in having pimd use zassert() while everything else uses plain assert(). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-12-24pimd: IGMP conformance 5.10 test case is failingMobashshera Rasool
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-11-17pimd: checksum must be validated before accepting igmp packetsMobashshera Rasool
Issue: When an IGMPv2 leave packet is received, it did not validate the checksum and hence the packet is accepted and group specific query is sent out in response to this. Due to this IGMP conformance test case 6.1 failed. https://github.com/FRRouting/frr/issues/6868 Fix: Validate the checksum for all IGMP packets Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2020-10-22pimd: replace inet_ntoaMark Stapp
Replace all use of inet_ntoa, using %pI4 or inet_ntoa instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-12*: Use proper semantics for turning off threadDonald Sharp
We have this pattern in the code base: if (thread) THREAD_OFF(thread); If we look at THREAD_OFF we check to see if thread is non-null too. So we have a double check. This is unnecessary. Convert to just using THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-09-24pimd: When bind fails we could leave an open socketDonald Sharp
Clean up the rare situation when bind fails to not close the fd that was just opened and have the socket leaked. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-09-24pimd: NULL not 0Donald Sharp
When handling data pointers explicity use NULL not 0. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-08-26pimd: fix IGMP querier electionNathan Bahr
Match by exact address rather than by prefix match to determine if we generated the IGMPP query. Othwerwise we will be ignoring IGMP queries coming from other hosts on the same subnet. Signed-off-by: Nathan Bahr <nbahr@atcorp.com> Reviewed-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2020-08-26pimd: fix IGMP source address on transmitNathan Bahr
IGMP queries should contain the source address of the IGMP socket they are being sent from. Added binding the IGMP sockets to their specific source, otherwise interfaces with multiple addresses will send multiple queries using the same source, which is determined by the kernel. Signed-off-by: Nathan Bahr <nbahr@atcorp.com> Reviewed-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2020-07-14*: un-split strings across linesDavid Lamparter
Remove mid-string line breaks, cf. workflow doc: .. [#tool_style_conflicts] For example, lines over 80 characters are allowed for text strings to make it possible to search the code for them: please see `Linux kernel style (breaking long lines and strings) <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_ and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_. Scripted commit, idempotent to running: ``` python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'` ``` Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-23Merge pull request #6262 from qlyoung/remove-sprintfDavid Lamparter
2020-04-20*: sprintf -> snprintfQuentin Young
Replace sprintf with snprintf where straightforward to do so. - sprintf's into local scope buffers of known size are replaced with the equivalent snprintf call - snprintf's into local scope buffers of known size that use the buffer size expression now use sizeof(buffer) - sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp buffer followed by strlcat Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-08pimd: Implement watermark warning for igmp group count and add igmp group countsaravanank
This CLI will allow user to configure a igmp group limit which will generate a watermark warning when reached. Though watermark may not make sense without setting a limit, this implementation shall serve as a base to implementing limit in future and helps tracking a particular scale currently. Testing: ======= ip igmp watermark-warn <10-60000> on reaching the configured number of group, pim will issue warning 2019/09/18 18:30:55 PIM: SCALE ALERT: igmp group count reached watermak limit: 210(vrf: default) Also added group count and watermark limit configured on cli - show ip igmp groups [json] <snip> Sw3# sh ip igmp groups json { "Total Groups":221, <===== "Watermark limit":210, <========= "ens224":{ "name":"ens224", "state":"up", "address":"40.0.0.1", "index":6, "flagMulticast":true, "flagBroadcast":true, "lanDelayEnabled":true, "groups":[ { "source":"40.0.0.1", "group":"225.1.1.122", "timer":"00:03:56", "sourcesCount":1, "version":2, "uptime":"00:00:24" <\snip> <snip> Sw3(config)# do sh ip igmp group Total IGMP groups: 221 Watermark warn limit(Set) : 210 Interface Address Group Mode Timer Srcs V Uptime ens224 40.0.0.1 225.1.1.122 ---- 00:04:06 1 2 00:13:22 ens224 40.0.0.1 225.1.1.144 ---- 00:04:02 1 2 00:13:22 ens224 40.0.0.1 225.1.1.57 ---- 00:04:01 1 2 00:13:22 ens224 40.0.0.1 225.1.1.210 ---- 00:04:06 1 2 00:13:22 <\snip> Signed-off-by: Saravanan K <saravanank@vmware.com>
2020-03-05*: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__Donatas Abraitis
Just keep the code cool. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-01-03pimd: Do not warn for common occurrence in igmp codeDonald Sharp
Do not warn when we receive a multicast address that matches 224.0.0.0/24. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-22pimd: readd iph length checksQuentin Young
Kernel might not hand us a bad packet, but better safe than sorry here. Validate the IP header length field. Also adds an additional check that the packet length is sufficient for an IGMP packet, and a check that we actually have enough for an ip header at all. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-11-12pimd: Cleanup igmp debugs a tiny bitDonald Sharp
When receiving igmp packets we are spitting out a lot of debugs. Attempt to clean this up to allow us to understand what is going on a bit better by just being able to look at the log file. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-12pimd: Ignore igmp queries from itselfDonald Sharp
We are seeing situations where PIM is sending a IGMP v3 query and immediately receiving back up the pim kernel interface the query from itself: from `show int brief`: swp7 up default 192.168.202.1/24 We are also receiving these debugs: 2019-11-11T20:52:40.452307+00:00 leaf02 pimd[1592]: Send IGMPv3 query to 224.4.0.8 on swp7 for group 224.4.0.8, sources=0 msg_size=12 s_flag=0 QRV=2 QQI=125 QQIC=7d 2019-11-11T20:52:40.452430+00:00 leaf02 pimd[1592]: pim_mroute_msg(default): igmp kernel upcall on swp7(0x55eaa7dc7dc0) for 192.168.202.1 -> 224.4.11.123 2019-11-11T20:52:40.452574+00:00 leaf02 pimd[1592]: Recv IP packet from 192.168.202.1 to 224.4.11.123 on swp7: size=40 ip_header_size=24 ip_proto=2 2019-11-11T20:52:40.452699+00:00 leaf02 pimd[1592]: Recv IGMP packet from 192.168.202.1 to 224.4.11.123 on swp7: ttl=1 msg_type=17 msg_size=16 2019-11-11T20:52:40.452824+00:00 leaf02 pimd[1592]: Recv IGMP query v3 from 192.168.202.1 on swp7 for group 224.4.11.123 This query is causing us to do some weird gyrations around the IGMP state machine for handling queries. Let's just prevent it from happening. Ticket: CM-27247 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-25pimd: Dissallow query to be received from a non-connected sourceDonald Sharp
When we receive an igmp query on a interface, ensure that the source address of the packet is connected to the incoming interface. This will prevent a meanie from crafting a igmp packet with a source address less than ours and causing us to suspend query activities. Fixes: #1692 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-24pimd: Added cli to generate igmp query.rgirada
Fix details : Added a utility cli to generate a igmp query on an interface. This won't impact the existing query generation based on the general query interval. Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2019-05-28pimd: Re-deisgn the "clear ip mroute" command.rgirada
Made changes to clean up the all upstreams and ifchannels in FRR apart from cleanup datapath mroutes when this command issued. Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2019-05-14lib: hashing functions should take const argumentsQuentin Young
It doesn't make much sense for a hash function to modify its argument, so const the hash input. BGP does it in a couple places, those cast away the const. Not great but not any worse than it was. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-01-04pimd: Create a `struct pim_router` and move thread master into itDonald Sharp
Create a `struct pim_router` and move the thread master into it. Future commits will further move global varaibles into the pim_router structure. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-19*: Replace hash_cmp function return value to a boolDonald Sharp
The ->hash_cmp and linked list ->cmp functions were sometimes being used interchangeably and this really is not a good thing. So let's modify the hash_cmp function pointer to return a boolean and convert everything to use the new syntax. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-02*: list_delete_and_null() -> list_delete()David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-13*: LIB_[ERR|WARN] -> EC_LIBQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14*: rename ferr_zlog -> flog_err_sysQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14*: rename zlog_fer -> flog_errQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14pimd: Convert over to use LIB_ERR_XXX for zlog_errDonald Sharp
Convert, where appropriate, the zlog_err functions to zlog_ferr for the LIB_ERR_XXX enums Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-19Merge pull request #2608 from pacovn/PVS-Studio_dead_code_1Donald Sharp
eigrpd lib pimd zebra: dead code (PVS-Studio)
2018-07-08pimd: Remove unnecessary alloc failuresDonald Sharp
Remove from pim unnecessary alloc failure testing as that alloc failure will cause an assert. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-06eigrpd lib pimd zebra: dead code (PVS-Studio)F. Aragon
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-05-04pimd: show ip igmp statistics commandMladen Sablic
Command showing IGMP Rx statistics, useful for analyzing IGMP activity on interfaces. Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-03-08pimd: mtrace only IGMP socketsMladen Sablic
Feature of mtrace only IGMP sockets on pim sm and pim ssm interfaces. Modifed IGMP socket creation and show igmp interface command output. Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-03-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-02-19pimd: Multicast traceroute client and routerMladen Sablic
This commit is the implementation of weak multicast traceroute. It consists of IGMP module dealing with mtrace type IGMP messages and client program mtrace/mtracebis for initiating mtrace queries. Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2017-10-05*: Convert list_delete(struct list *) to ** to allow nullingDonald Sharp
Convert the list_delete(struct list *) function to use struct list **. This is to allow the list pointer to be nulled. I keep running into uses of this list_delete function where we forget to set the returned pointer to NULL and attempt to use it and then experience a crash, usually after the developer has long since left the building. Let's make the api explicit in it setting the list pointer to null. Cynical Prediction: This code will expose a attempt to use the NULL'ed list pointer in some obscure bit of code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-26pimd: add support for boundariesQuentin Young
Adds the ability to filter PIM Joins & IGMP reports on an interface. Enabling a multicast boundary on an interface for a particular group will prevent the interface from appearing in the group's OIL. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-02pimd: Squash some more memory leaksDonald Sharp
When a interface is flapped we were leaking some memory associated with link lists. Especially in the jp_agg code. If your network was/is stable and you are not running at any scale you probably would not see this as impactful at all. Ticket: CM-16392 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>