Enable option ip-add-source-membership only when both IP_ADD_SOURCE_MEMBERSHIP and struct ip_mreq_source are available

This commit is contained in:
Gerhard Rieger 2022-09-15 10:09:05 +02:00
parent d8ee49007e
commit ee23bccee7
4 changed files with 11 additions and 5 deletions

View file

@ -39,6 +39,10 @@ Porting:
Thanks to Martin Dorey for reporting and analyzing this issue, and for
providing an environment for reproduction.
Socat failed to compile on platforms that have
IP_ADD_SOURCE_MEMBERSHIP but not struct ip_mreq_source
Thanks to Justin Yackoski for sending a patch.
Testing:
Unset SOCAT_MAIN_WAIT on informational Socat calls

View file

@ -71,7 +71,7 @@ const struct optdesc opt_ip_pktoptions = { "ip-pktoptions", "pktopts", OPT_IP_PK
#ifdef IP_ADD_MEMBERSHIP
const struct optdesc opt_ip_add_membership = { "ip-add-membership", "membership",OPT_IP_ADD_MEMBERSHIP, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_IP_MREQN, OFUNC_SOCKOPT, SOL_IP, IP_ADD_MEMBERSHIP };
#endif
#ifdef IP_ADD_SOURCE_MEMBERSHIP
#if defined(HAVE_STRUCT_IP_MREQ_SOURCE) && defined(IP_ADD_SOURCE_MEMBERSHIP)
const struct optdesc opt_ip_add_source_membership = { "ip-add-source-membership", "source-membership",OPT_IP_ADD_SOURCE_MEMBERSHIP, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_IP_MREQ_SOURCE, OFUNC_SOCKOPT, SOL_IP, IP_ADD_SOURCE_MEMBERSHIP };
#endif
#ifdef IP_RECVDSTADDR

View file

@ -164,7 +164,7 @@ const struct optname optionnames[] = {
#ifdef IP_ADD_MEMBERSHIP
IF_IP ("add-membership", &opt_ip_add_membership)
#endif
#ifdef IP_ADD_SOURCE_MEMBERSHIP
#if defined(HAVE_STRUCT_IP_MREQ_SOURCE) && defined(IP_ADD_SOURCE_MEMBERSHIP)
IF_IP ("add-source-membership", &opt_ip_add_source_membership)
#endif
IF_TUN ("allmulti", &opt_iff_allmulti)
@ -678,7 +678,7 @@ const struct optname optionnames[] = {
#ifdef IP_ADD_MEMBERSHIP
IF_IP ("ip-add-membership", &opt_ip_add_membership)
#endif
#ifdef IP_ADD_SOURCE_MEMBERSHIP
#if defined(HAVE_STRUCT_IP_MREQ_SOURCE) && defined(IP_ADD_SOURCE_MEMBERSHIP)
IF_IP ("ip-add-source-membership", &opt_ip_add_source_membership)
#endif
#ifdef IP_FREEBIND
@ -1563,7 +1563,7 @@ const struct optname optionnames[] = {
IF_SOCKS4 ("socksport", &opt_socksport)
IF_SOCKS4 ("socksuser", &opt_socksuser)
IF_SOCKET ("socktype", &opt_so_type)
#ifdef IP_ADD_SOURCE_MEMBERSHIP
#if defined(HAVE_STRUCT_IP_MREQ_SOURCE) && defined(IP_ADD_SOURCE_MEMBERSHIP)
IF_IP ("source-membership", &opt_ip_add_source_membership)
#endif
IF_IPAPP ("sourceport", &opt_sourceport)
@ -2507,7 +2507,7 @@ int parseopts_table(const char **a, unsigned int groups, struct opt **opts,
break;
#endif /* defined(HAVE_STRUCT_IP_MREQ) || defined (HAVE_STRUCT_IP_MREQN) */
#if HAVE_STRUCT_IP_MREQ_SOURCE
#if defined(HAVE_STRUCT_IP_MREQ_SOURCE) && defined(IP_ADD_SOURCE_MEMBERSHIP)
case TYPE_IP_MREQ_SOURCE:
xiotype_ip_add_source_membership(token, ent, opt);
break;

View file

@ -9,5 +9,7 @@
#include "xioconfig.h" /* what features are enabled */
#include "sysincludes.h"
//#undef IP_ADD_SOURCE_MEMBERSHIP
#undef HAVE_STRUCT_IP_MREQ_SOURCE
#endif /* !defined(__xiosysincludes_h_included) */