This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit ac5e2818724178b030ae3163c9855412bac7c21f Author: Marco Casaroli <[email protected]> AuthorDate: Tue Oct 27 09:34:46 2026 +0100 include/netinet/in.h: Add the multicast options of RFC 3678. Add struct group_req, struct group_source_req and the protocol- independent socket options MCAST_JOIN_GROUP, MCAST_LEAVE_GROUP, MCAST_BLOCK_SOURCE, MCAST_UNBLOCK_SOURCE, MCAST_JOIN_SOURCE_GROUP and MCAST_LEAVE_SOURCE_GROUP. Linux and the BSDs have them, and programs use them without a check (libuv, for example). The options work at the level IPPROTO_IP and IPPROTO_IPV6, so no option of either level may have their values. They have the values of Linux (42 to 47). This commit adds only the names: setsockopt() still gives ENOPROTOOPT for them. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- include/netinet/in.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/netinet/in.h b/include/netinet/in.h index a2fb86f7214..ce0b7646b25 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -137,6 +137,17 @@ #define IPV6_RECVHOPLIMIT (__SO_PROTOCOL + 11) /* Access the hop limit field */ #define IPV6_HOPLIMIT (__SO_PROTOCOL + 12) /* Hop limit */ +/* Protocol-independent multicast options (RFC 3678) for the level + * IPPROTO_IP or IPPROTO_IPV6, with the values of Linux. + */ + +#define MCAST_JOIN_GROUP (__SO_PROTOCOL + 31) /* group_req */ +#define MCAST_BLOCK_SOURCE (__SO_PROTOCOL + 32) /* group_source_req */ +#define MCAST_UNBLOCK_SOURCE (__SO_PROTOCOL + 33) /* group_source_req */ +#define MCAST_LEAVE_GROUP (__SO_PROTOCOL + 34) /* group_req */ +#define MCAST_JOIN_SOURCE_GROUP (__SO_PROTOCOL + 35) /* group_source_req */ +#define MCAST_LEAVE_SOURCE_GROUP (__SO_PROTOCOL + 36) /* group_source_req */ + /* Values used with SIOCSIFMCFILTER and SIOCGIFMCFILTER ioctl's */ #define MCAST_EXCLUDE 0 @@ -368,6 +379,21 @@ struct ipv6_mreq unsigned int ipv6mr_interface; /* Local interface index */ }; +/* Used with the MCAST_* socket options (RFC 3678) */ + +struct group_req +{ + uint32_t gr_interface; /* Interface index */ + struct sockaddr_storage gr_group; /* Multicast group address */ +}; + +struct group_source_req +{ + uint32_t gsr_interface; /* Interface index */ + struct sockaddr_storage gsr_group; /* Multicast group address */ + struct sockaddr_storage gsr_source; /* Source address */ +}; + struct in6_pktinfo { struct in6_addr ipi6_addr; /* src/dst IPv6 address */
