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 Thanks to Martin Dorey for reporting and analyzing this issue, and for
providing an environment for reproduction. 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: Testing:
Unset SOCAT_MAIN_WAIT on informational Socat calls 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 #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 }; 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 #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 }; 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 #endif
#ifdef IP_RECVDSTADDR #ifdef IP_RECVDSTADDR

View file

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

View file

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