diff options
| author | Liam McBirnie <mcbirnie.l@gmail.com> | 2019-12-05 21:57:50 +0100 | 
|---|---|---|
| committer | Liam McBirnie <liam.mcbirnie@rheinmetall.com> | 2019-12-12 13:09:46 +0100 | 
| commit | 771ce8ad240b0c620e6cf46a7841fe2b757f9b43 (patch) | |
| tree | 21bddb6be208123bb2237da10761bead01b18484 /pimd/pim_igmp_join.h | |
| parent | 670812fd1351f8e396f4d2473dc43c88efd9902c (diff) | |
pimd: Add command to join any-source multicast.
Allow 'ip igmp join' to join group for any source if no source is
specified.
Disallow joining source "0.0.0.0" as it is used to define an
any-source multicast group.
Signed-off-by: Liam McBirnie <liam.mcbirnie@boeing.com>
Diffstat (limited to 'pimd/pim_igmp_join.h')
| -rw-r--r-- | pimd/pim_igmp_join.h | 12 | 
1 files changed, 10 insertions, 2 deletions
diff --git a/pimd/pim_igmp_join.h b/pimd/pim_igmp_join.h index 88385bffba..c323902764 100644 --- a/pimd/pim_igmp_join.h +++ b/pimd/pim_igmp_join.h @@ -26,6 +26,10 @@  #define SOL_IP IPPROTO_IP  #endif +#ifndef MCAST_JOIN_GROUP +#define MCAST_JOIN_GROUP 42 +#endif +  #ifndef MCAST_JOIN_SOURCE_GROUP  #define MCAST_JOIN_SOURCE_GROUP 46  struct group_source_req { @@ -58,8 +62,12 @@ static int pim_igmp_join_source(int fd, ifindex_t ifindex,  	req.gsr_interface = ifindex; -	return setsockopt(fd, SOL_IP, MCAST_JOIN_SOURCE_GROUP, &req, -			  sizeof(req)); +	if (source_addr.s_addr == INADDR_ANY) +		return setsockopt(fd, SOL_IP, MCAST_JOIN_GROUP, &req, +				  sizeof(req)); +	else +		return setsockopt(fd, SOL_IP, MCAST_JOIN_SOURCE_GROUP, &req, +				  sizeof(req));  }  #endif /* PIM_IGMP_JOIN_H */  | 
