From 771ce8ad240b0c620e6cf46a7841fe2b757f9b43 Mon Sep 17 00:00:00 2001 From: Liam McBirnie Date: Thu, 5 Dec 2019 21:57:50 +0100 Subject: 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 --- pimd/pim_igmp_join.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'pimd/pim_igmp_join.h') diff --git a/pimd/pim_igmp_join.h b/pimd/pim_igmp_join.h index 88385bffb..c32390276 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 */ -- cgit v1.2.3