summaryrefslogtreecommitdiff
path: root/pimd/pim_sock.c
AgeCommit message (Collapse)Author
2022-08-23pim6d: mroute stuck in register state, multicast traffic getting dropsMobashshera Rasool
IPv4 and IPv6 behaves a little bit differently with the socket options. IPPROTO_RAW socket option is only for IPv4. Therefore the register packet was not properly getting encapculated for PIMv6 and was working fine for PIMv4. So have used IPPROTO_PIM for PIMv6. Fixes: #11846 Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-08-16pim6d: Register message getting dropped in source node, mroute stuck in RegJMobashshera Rasool
The socket created for pimv6 was created using AF_INET for PIMV6 too. Since the api pim_reg_sock is common to both PIMv4 and PIMv6, need to use PIM_AF instead of AF_INET. Fixes: #11815 Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-08-04pimd, pim6d: Send register msg via register socketMobashshera Rasool
The problem here is when the same node is FHR as well as RP, then the node keeps on sending the register packet. Register-stop is not sent as well. This problem has occurred because the RP is the same node and there is no socket created on loopback interface, so the packet is never send out and never received back on the same node, so register recv could not be processed on the node and hence no register-stop is sent. Since register packets are unicast packets, its better to handle the send of register packet via a separate register socket. This fixes the problem mentioned above as well. Fixes: #11331 Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-06-13pim6d: Removal of IPV6_HDRINCL optionBalaji Gurudoss
1. Removal of IPV6_HDRINCL option 2. Removal of IPv6 headers in TX 3. Addition of IPV6_PKTINFO and setting of source ipv6 address for TX. Signed-off-by: Balaji Gurudoss <G_Balaji1@dell.com>
2022-05-11*: Properly use memset() when zeroingDonatas Abraitis
Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-06pimd: un-dependency-hell `pim_instance.h`David Lamparter
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-03-13pimd: Add IGMP join sent/failed statisticsDonatas Abraitis
``` 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-12pim6d: pim6d socket changesBalaji Gurudoss
socket changes to support IPv6 PIM Signed-off-by: Balaji Gurudoss <G_Balaji1@dell.com> [DL: cleaned up & refactored a whole bunch more.] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-12pimd: drop printing IP_MULTICAST_LOOP sockoptDavid Lamparter
This isn't a system or interface setting, it's a socket behavior. It is both irrelevant and confusing to the user since it doesn't affect any system behavior (but it sounds like it does). Whether it is enabled or not is solely relevant to how the code is designed to work. So, remove it from output. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-07-06pimd: IGMP sockets need to be iface-bound tooDavid Lamparter
There's an IGMP socket per interface, so they should be bound to that interface. Which also makes IGMP work in VRFs. Fixes: #7889 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
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-08*: Do not cast to the same typeDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-06*: Finish off the __PRETTY_FUNCTION__ to __func__Donald Sharp
FINISH IT Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.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>
2019-09-23pimd: Mark Default TOS Values for PIM & IGMP Outgoing packetsSatheesh Kumar K
This will facilitate the Hardware to prefer control packets over Normal Data packets while queuing, so that during congestion, the chance of dropping control packet will be minimised. Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-09-03*: frr_elevate_privs -> frr_with_privsDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2018-09-13*: LIB_[ERR|WARN] -> EC_LIBQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14*: use frr_elevate_privs() (1/2: coccinelle)David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
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-08-02pimd: pim_socket_join_source is only called from one placeDonald Sharp
The pim_socket_join_source function only ever calls pim_igmp_join_source and pim_socket_join_source is only called from 1 place. Skip the level of indirection. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-27*: use C99 standard fixed-width integer typesQuentin Young
The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-24pimd: Cleanup a variety of SA issuesDonald Sharp
1) Error check return from setsockopt and sockets 2) Check return codes for str2prefix 3) Clean up some potential NULL References Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08pimd: fix clang warningDavid Lamparter
pimd/pim_sock.c:178:13: error: implicit conversion from 'int' to 'char' changes value from 148 to -108 [-Werror,-Wconstant-conversion] ra[0] = 148; Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-07Merge branch 'frr/pull/165' ("Pim vrf")David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-03pimd: Allow a interface in a vrf to be configured.Donald Sharp
This fixes the issue a crash when we have configured an interface inside of a vrf, and apply pim commands to it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-01pimd: Fix fd leakDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30pimd: Cleanup shutdown a bit more.Donald Sharp
Cleanup the shutdown of pim a bit more. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-18pimd: Fix compilation errorDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
2017-01-18pimd: 'struct ip_mreqn' is not available on all platformsDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetowrks.com>
2017-01-17pimd: SO_BINDTODEVICE is not available on some platforms.Donald Sharp
Follow bgp's lead and don't allow SO_BINDTODEVICE on *bsd. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-17Merge remote-tracking branch 'origin/master' into pim_lib_work2Donald Sharp
2016-12-21pimd: Remove redundant loggingDonald Sharp
When receiving a JOIN/PRUNE message if we have trace turned on we output this: 2016/11/28 17:11:46.368827 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.13,103 2016/11/28 17:11:46.368956 PIM: Recv PIM JOINPRUNE packet from 169.254.0.6 to 224.0.0.13 on swp31s1: ttl=255 pim_version=2 pim_msg_size=34 checksum=e623 2016/11/28 17:11:46.369003 PIM: pim_joinprune_recv: from 169.254.0.6 on swp31s1 2016/11/28 17:11:46.369053 PIM: recv_prune: prune (S,G)=(20.0.11.253,229.1.2.3) rpt=0 wc=0 upstream=169.254.0.5 holdtime=210 from 169.254.0.6 on swp31s1 2016/11/28 17:11:46.369099 PIM: nonlocal_upstream: recv prune (S,G)=(20.0.11.253,229.1.2.3) to local upstream=169.254.0.5 on swp31s1 Clean up the messaging to this: 2016/11/28 17:11:46.368956 PIM: Recv PIM JOINPRUNE packet from 169.254.0.6 to 224.0.0.13 on swp31s1: ttl=255 pim_version=2 pim_msg_size=34 checksum=e623 2016/11/28 17:11:46.369053 PIM: recv_prune: prune (S,G)=(20.0.11.253,229.1.2.3) rpt=0 wc=0 upstream=169.254.0.5 holdtime=210 from 169.254.0.6 on swp31s1 Ticket: CM-13752 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-12-21pimd: Cleanup igmp read socketDonald Sharp
With the change over to using the kernel upcall for igmp messages, we need to add in a read thread for the igmp socket to drain the igmp socket's receive queue. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: Only make the pim sockets non blocking.Donald Sharp
Only make the pim sockets non-blocking on reads. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: Set pim socket receive buffer to a larger valueDonald Sharp
There exists situations where we can receive data faster than we can process it. Make the buffer large enough to catch these situations for the pim sockets. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: replace grp_str[100] with grp_str[INET_ADDRSTRLEN]Daniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-12-21pimd: Fix SA warningDonald Sharp
Restructure code to remove SA warning from clang build. For some reason, the Clang SA system thought that si.sin_port and si.sin_addr where not being set to anything. Fix this problem. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: Allow interfaces to be unnumbered.Donald Sharp
Specify the ifindex of the interface that we want to turn on IP_MULTICAST_IF on instead of the address. If we pass in the address then the fact that we have multiple interfaces with the same ip address causes confusion in the kernel. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: Some SA analysis fixes.Donald Sharp
This commit addresses some SA issues found: 1) double set variables 2) value set but never used. 3) wrong return path used. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: Infrastructure to forward packet down (*,G) treeDonald Sharp
When a register is received, forward the packet as appropriate. This is the infrastructure to make this happen. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: Create pim_socket_bindDonald Sharp
Allow a socket to be bound to a specified interface. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: Remove unnecessary QuaggaIdDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: Fixup some dead codeDonald Sharp
Remove some dead code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-20build: remove $Format tagsDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-25*: create a helper function to set the IP_MULTICAST_LOOP sockoptionRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-25pimd/zebra: fix setting of IP_MULTICAST_LOOP on OpenBSDRenato Westphal
Linux, FreeBSD and NetBSD (and possibly others too) accept both uint8_t and int for the IP_MULTICAST_LOOP sockoption. OpenBSD, in the other hand, accepts only uint8_t. To make setting IP_MULTICAST_LOOP work on every supported platform, always pass a uint8_t variable as a parameter. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>