check for defines IPV6_*

This commit is contained in:
Gerhard Rieger 2012-07-22 21:20:47 +02:00
parent 709427ab1f
commit 53d969ffe3
4 changed files with 48 additions and 1 deletions

View file

@ -113,6 +113,12 @@ porting:
for fipsld too. Thanks to Andreas Gruenbacher for reporting this for fipsld too. Thanks to Andreas Gruenbacher for reporting this
problem problem
check for netinet6/in6.h only when IPv6 is available and enabled
don't fail to compile when the following defines are missing:
IPV6_PKTINFO IPV6_RTHDR IPV6_DSTOPTS IPV6_HOPOPTS IPV6_HOPLIMIT
Thanks to Jerry Jacobs for reporting this problem (Mac OS X Lion 10.7)
####################### V 2.0.0-b7: ####################### V 2.0.0-b7:
security: security:

View file

@ -215,6 +215,9 @@
/* Define if you have the <netinet/ip6.h> header file. */ /* Define if you have the <netinet/ip6.h> header file. */
#undef HAVE_NETINET_IP6_H #undef HAVE_NETINET_IP6_H
/* Define if you have the <netinet6/in6.h> header file. */
#undef HAVE_NETINET6_IN6_H
/* Define if you have the <arpa/nameser.h> header file. */ /* Define if you have the <arpa/nameser.h> header file. */
#undef HAVE_ARPA_NAMESER_H #undef HAVE_ARPA_NAMESER_H

View file

@ -1,5 +1,5 @@
/* source: xio-ip6.c */ /* source: xio-ip6.c */
/* Copyright Gerhard Rieger 2001-2008 */ /* Copyright Gerhard Rieger 2001-2012 */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
/* this file contains the source for IP6 related functions */ /* this file contains the source for IP6 related functions */
@ -25,29 +25,39 @@ const struct optdesc opt_ipv6_v6only = { "ipv6-v6only", "ipv6only", OPT_IPV6_V6O
#ifdef IPV6_JOIN_GROUP #ifdef IPV6_JOIN_GROUP
const struct optdesc opt_ipv6_join_group = { "ipv6-join-group", "join-group", OPT_IPV6_JOIN_GROUP, GROUP_SOCK_IP6, PH_PASTBIND, TYPE_IP_MREQN, OFUNC_SOCKOPT, SOL_IPV6, IPV6_JOIN_GROUP }; const struct optdesc opt_ipv6_join_group = { "ipv6-join-group", "join-group", OPT_IPV6_JOIN_GROUP, GROUP_SOCK_IP6, PH_PASTBIND, TYPE_IP_MREQN, OFUNC_SOCKOPT, SOL_IPV6, IPV6_JOIN_GROUP };
#endif #endif
#ifdef IPV6_PKTINFO
const struct optdesc opt_ipv6_pktinfo = { "ipv6-pktinfo", "pktinfo", OPT_IPV6_PKTINFO, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_PKTINFO }; const struct optdesc opt_ipv6_pktinfo = { "ipv6-pktinfo", "pktinfo", OPT_IPV6_PKTINFO, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_PKTINFO };
#endif
#ifdef IPV6_RECVPKTINFO #ifdef IPV6_RECVPKTINFO
const struct optdesc opt_ipv6_recvpktinfo = { "ipv6-recvpktinfo", "recvpktinfo", OPT_IPV6_RECVPKTINFO, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVPKTINFO }; const struct optdesc opt_ipv6_recvpktinfo = { "ipv6-recvpktinfo", "recvpktinfo", OPT_IPV6_RECVPKTINFO, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVPKTINFO };
#endif #endif
#ifdef IPV6_RTHDR
const struct optdesc opt_ipv6_rthdr = { "ipv6-rthdr", "rthdr", OPT_IPV6_RTHDR, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RTHDR }; const struct optdesc opt_ipv6_rthdr = { "ipv6-rthdr", "rthdr", OPT_IPV6_RTHDR, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RTHDR };
#endif
#ifdef IPV6_RECVRTHDR #ifdef IPV6_RECVRTHDR
const struct optdesc opt_ipv6_recvrthdr = { "ipv6-recvrthdr", "recvrthdr", OPT_IPV6_RECVRTHDR, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVRTHDR }; const struct optdesc opt_ipv6_recvrthdr = { "ipv6-recvrthdr", "recvrthdr", OPT_IPV6_RECVRTHDR, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVRTHDR };
#endif #endif
#ifdef IPV6_AUTHHDR #ifdef IPV6_AUTHHDR
const struct optdesc opt_ipv6_authhdr = { "ipv6-authhdr", "authhdr", OPT_IPV6_AUTHHDR, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_AUTHHDR }; const struct optdesc opt_ipv6_authhdr = { "ipv6-authhdr", "authhdr", OPT_IPV6_AUTHHDR, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_AUTHHDR };
#endif #endif
#ifdef IPV6_DSTOPTS
const struct optdesc opt_ipv6_dstopts = { "ipv6-dstopts", "dstopts", OPT_IPV6_DSTOPTS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_DSTOPTS }; const struct optdesc opt_ipv6_dstopts = { "ipv6-dstopts", "dstopts", OPT_IPV6_DSTOPTS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_DSTOPTS };
#endif
#ifdef IPV6_RECVDSTOPTS #ifdef IPV6_RECVDSTOPTS
const struct optdesc opt_ipv6_recvdstopts = { "ipv6-recvdstopts", "recvdstopts", OPT_IPV6_RECVDSTOPTS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVDSTOPTS }; const struct optdesc opt_ipv6_recvdstopts = { "ipv6-recvdstopts", "recvdstopts", OPT_IPV6_RECVDSTOPTS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVDSTOPTS };
#endif #endif
#ifdef IPV6_HOPOPTS
const struct optdesc opt_ipv6_hopopts = { "ipv6-hopopts", "hopopts", OPT_IPV6_HOPOPTS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_HOPOPTS }; const struct optdesc opt_ipv6_hopopts = { "ipv6-hopopts", "hopopts", OPT_IPV6_HOPOPTS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_HOPOPTS };
#endif
#ifdef IPV6_RECVHOPOPTS #ifdef IPV6_RECVHOPOPTS
const struct optdesc opt_ipv6_recvhopopts = { "ipv6-recvhopopts", "recvhopopts", OPT_IPV6_RECVHOPOPTS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVHOPOPTS }; const struct optdesc opt_ipv6_recvhopopts = { "ipv6-recvhopopts", "recvhopopts", OPT_IPV6_RECVHOPOPTS, GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVHOPOPTS };
#endif #endif
#ifdef IPV6_FLOWINFO /* is in linux/in6.h */ #ifdef IPV6_FLOWINFO /* is in linux/in6.h */
const struct optdesc opt_ipv6_flowinfo= { "ipv6-flowinfo","flowinfo",OPT_IPV6_FLOWINFO,GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_FLOWINFO }; const struct optdesc opt_ipv6_flowinfo= { "ipv6-flowinfo","flowinfo",OPT_IPV6_FLOWINFO,GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_FLOWINFO };
#endif #endif
#ifdef IPV6_HOPLIMIT
const struct optdesc opt_ipv6_hoplimit= { "ipv6-hoplimit","hoplimit",OPT_IPV6_HOPLIMIT,GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_HOPLIMIT }; const struct optdesc opt_ipv6_hoplimit= { "ipv6-hoplimit","hoplimit",OPT_IPV6_HOPLIMIT,GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_HOPLIMIT };
#endif
const struct optdesc opt_ipv6_unicast_hops= { "ipv6-unicast-hops","unicast-hops",OPT_IPV6_UNICAST_HOPS,GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IPV6, IPV6_UNICAST_HOPS }; const struct optdesc opt_ipv6_unicast_hops= { "ipv6-unicast-hops","unicast-hops",OPT_IPV6_UNICAST_HOPS,GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IPV6, IPV6_UNICAST_HOPS };
#ifdef IPV6_RECVHOPLIMIT #ifdef IPV6_RECVHOPLIMIT
const struct optdesc opt_ipv6_recvhoplimit= { "ipv6-recvhoplimit","recvhoplimit",OPT_IPV6_RECVHOPLIMIT,GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVHOPLIMIT }; const struct optdesc opt_ipv6_recvhoplimit= { "ipv6-recvhoplimit","recvhoplimit",OPT_IPV6_RECVHOPLIMIT,GROUP_SOCK_IP6, PH_PASTSOCKET, TYPE_BOOL, OFUNC_SOCKOPT, SOL_IPV6, IPV6_RECVHOPLIMIT };
@ -203,6 +213,7 @@ int xiolog_ancillary_ip6(struct cmsghdr *cmsg, int *num,
msglen = cmsg->cmsg_len-((char *)CMSG_DATA(cmsg)-(char *)cmsg); msglen = cmsg->cmsg_len-((char *)CMSG_DATA(cmsg)-(char *)cmsg);
envbuff[0] = '\0'; envbuff[0] = '\0';
switch (cmsg->cmsg_type) { switch (cmsg->cmsg_type) {
#ifdef IPV6_PKTINFO
case IPV6_PKTINFO: { case IPV6_PKTINFO: {
struct in6_pktinfo *pktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsg); struct in6_pktinfo *pktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsg);
*num = 2; *num = 2;
@ -214,16 +225,21 @@ int xiolog_ancillary_ip6(struct cmsghdr *cmsg, int *num,
'\0', xiogetifname(pktinfo->ipi6_ifindex, scratch2, -1)); '\0', xiogetifname(pktinfo->ipi6_ifindex, scratch2, -1));
} }
return STAT_OK; return STAT_OK;
#endif /* defined(IPV6_PKTINFO) */
#ifdef IPV6_HOPLIMIT
case IPV6_HOPLIMIT: case IPV6_HOPLIMIT:
strncpy(typbuff, "IPV6_HOPLIMIT", typlen); strncpy(typbuff, "IPV6_HOPLIMIT", typlen);
strncpy(nambuff, "hoplimit", namlen); strncpy(nambuff, "hoplimit", namlen);
snprintf(valbuff, vallen, "%d", *(int *)CMSG_DATA(cmsg)); snprintf(valbuff, vallen, "%d", *(int *)CMSG_DATA(cmsg));
return STAT_OK; return STAT_OK;
#endif /* defined(IPV6_HOPLIMIT) */
#ifdef IPV6_RTHDR
case IPV6_RTHDR: case IPV6_RTHDR:
strncpy(typbuff, "IPV6_RTHDR", typlen); strncpy(typbuff, "IPV6_RTHDR", typlen);
strncpy(nambuff, "rthdr", namlen); strncpy(nambuff, "rthdr", namlen);
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0); xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
return STAT_OK; return STAT_OK;
#endif /* defined(IPV6_RTHDR) */
#ifdef IPV6_AUTHHDR #ifdef IPV6_AUTHHDR
case IPV6_AUTHHDR: case IPV6_AUTHHDR:
strncpy(typbuff, "IPV6_AUTHHDR", typlen); strncpy(typbuff, "IPV6_AUTHHDR", typlen);
@ -231,16 +247,20 @@ int xiolog_ancillary_ip6(struct cmsghdr *cmsg, int *num,
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0); xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
return STAT_OK; return STAT_OK;
#endif #endif
#ifdef IPV6_DSTOPTS
case IPV6_DSTOPTS: case IPV6_DSTOPTS:
strncpy(typbuff, "IPV6_DSTOPTS", typlen); strncpy(typbuff, "IPV6_DSTOPTS", typlen);
strncpy(nambuff, "dstopts", namlen); strncpy(nambuff, "dstopts", namlen);
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0); xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
return STAT_OK; return STAT_OK;
#endif /* defined(IPV6_DSTOPTS) */
#ifdef IPV6_HOPOPTS
case IPV6_HOPOPTS: case IPV6_HOPOPTS:
strncpy(typbuff, "IPV6_HOPOPTS", typlen); strncpy(typbuff, "IPV6_HOPOPTS", typlen);
strncpy(nambuff, "hopopts", namlen); strncpy(nambuff, "hopopts", namlen);
xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0); xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0);
return STAT_OK; return STAT_OK;
#endif /* defined(IPV6_HOPOPTS) */
#ifdef IPV6_FLOWINFO #ifdef IPV6_FLOWINFO
case IPV6_FLOWINFO: case IPV6_FLOWINFO:
strncpy(typbuff, "IPV6_FLOWINFO", typlen); strncpy(typbuff, "IPV6_FLOWINFO", typlen);

View file

@ -395,7 +395,9 @@ const struct optname optionnames[] = {
IF_SOCKET ("dontlinger", &opt_so_dontlinger) IF_SOCKET ("dontlinger", &opt_so_dontlinger)
#endif #endif
IF_SOCKET ("dontroute", &opt_so_dontroute) IF_SOCKET ("dontroute", &opt_so_dontroute)
#ifdef IPV6_DSTOPTS
IF_IP6 ("dstopts", &opt_ipv6_dstopts) IF_IP6 ("dstopts", &opt_ipv6_dstopts)
#endif
#ifdef VDSUSP /* HP-UX */ #ifdef VDSUSP /* HP-UX */
IF_TERMIOS("dsusp", &opt_vdsusp) IF_TERMIOS("dsusp", &opt_vdsusp)
#endif #endif
@ -552,8 +554,12 @@ const struct optname optionnames[] = {
#endif #endif
IF_READLINE("history", &opt_history_file) IF_READLINE("history", &opt_history_file)
IF_READLINE("history-file", &opt_history_file) IF_READLINE("history-file", &opt_history_file)
#ifdef IPV6_HOPLIMIT
IF_IP6 ("hoplimit", &opt_ipv6_hoplimit) IF_IP6 ("hoplimit", &opt_ipv6_hoplimit)
#endif
#ifdef IPV6_HOPOPTS
IF_IP6 ("hopopts", &opt_ipv6_hopopts) IF_IP6 ("hopopts", &opt_ipv6_hopopts)
#endif
#if WITH_LIBWRAP && defined(HAVE_HOSTS_ALLOW_TABLE) #if WITH_LIBWRAP && defined(HAVE_HOSTS_ALLOW_TABLE)
IF_IPAPP ("hosts-allow", &opt_tcpwrap_hosts_allow_table) IF_IPAPP ("hosts-allow", &opt_tcpwrap_hosts_allow_table)
#endif #endif
@ -728,14 +734,22 @@ const struct optname optionnames[] = {
#ifdef IPV6_AUTHHDR #ifdef IPV6_AUTHHDR
IF_IP6 ("ipv6-authhdr", &opt_ipv6_authhdr) IF_IP6 ("ipv6-authhdr", &opt_ipv6_authhdr)
#endif #endif
#ifdef IPV6_DSTOPTS
IF_IP6 ("ipv6-dstopts", &opt_ipv6_dstopts) IF_IP6 ("ipv6-dstopts", &opt_ipv6_dstopts)
#endif
#ifdef IPV4_FLOWINFO #ifdef IPV4_FLOWINFO
IF_IP6 ("ipv6-flowinfo", &opt_ipv6_flowinfo) IF_IP6 ("ipv6-flowinfo", &opt_ipv6_flowinfo)
#endif #endif
#ifdef IPV6_HOPLIMIT
IF_IP6 ("ipv6-hoplimit", &opt_ipv6_hoplimit) IF_IP6 ("ipv6-hoplimit", &opt_ipv6_hoplimit)
#endif
#ifdef IPV6_HOPOPTS
IF_IP6 ("ipv6-hopopts", &opt_ipv6_hopopts) IF_IP6 ("ipv6-hopopts", &opt_ipv6_hopopts)
#endif
IF_IP6 ("ipv6-join-group", &opt_ipv6_join_group) IF_IP6 ("ipv6-join-group", &opt_ipv6_join_group)
#ifdef IPV6_PKTINFO
IF_IP6 ("ipv6-pktinfo", &opt_ipv6_pktinfo) IF_IP6 ("ipv6-pktinfo", &opt_ipv6_pktinfo)
#endif
#ifdef IPV6_RECVDSTOPTS #ifdef IPV6_RECVDSTOPTS
IF_IP6 ("ipv6-recvdstopts", &opt_ipv6_recvdstopts) IF_IP6 ("ipv6-recvdstopts", &opt_ipv6_recvdstopts)
#endif #endif
@ -760,7 +774,9 @@ const struct optname optionnames[] = {
#ifdef IPV6_RECVTCLASS #ifdef IPV6_RECVTCLASS
IF_IP6 ("ipv6-recvtclass", &opt_ipv6_recvtclass) IF_IP6 ("ipv6-recvtclass", &opt_ipv6_recvtclass)
#endif #endif
#ifdef IPV6_RTHDR
IF_IP6 ("ipv6-rthdr", &opt_ipv6_rthdr) IF_IP6 ("ipv6-rthdr", &opt_ipv6_rthdr)
#endif
#ifdef IPV6_TCLASS #ifdef IPV6_TCLASS
IF_IP6 ("ipv6-tclass", &opt_ipv6_tclass) IF_IP6 ("ipv6-tclass", &opt_ipv6_tclass)
#endif #endif
@ -1220,7 +1236,9 @@ const struct optname optionnames[] = {
#ifdef O_RSYNC #ifdef O_RSYNC
IF_OPEN ("rsync", &opt_o_rsync) IF_OPEN ("rsync", &opt_o_rsync)
#endif #endif
#ifdef IPV6_RTHDR
IF_IP6 ("rthdr", &opt_ipv6_rthdr) IF_IP6 ("rthdr", &opt_ipv6_rthdr)
#endif
IF_TUN ("running", &opt_iff_running) IF_TUN ("running", &opt_iff_running)
#ifdef TCP_SACK_DISABLE #ifdef TCP_SACK_DISABLE
IF_TCP ("sack-disable", &opt_tcp_sack_disable) IF_TCP ("sack-disable", &opt_tcp_sack_disable)