diff --git a/configure.ac b/configure.ac index b75d51f..8867587 100644 --- a/configure.ac +++ b/configure.ac @@ -441,6 +441,7 @@ AC_CHECK_HEADERS([ \ sys/mman.h sys/file.h sys/wait.h \ unistd.h signal.h libgen.h stropts.h \ syslog.h pwd.h grp.h \ + net/if_tap.h \ sys/sockio.h sys/uio.h linux/sockios.h \ linux/types.h sys/poll.h sys/epoll.h err.h \ ]) @@ -455,6 +456,9 @@ SOCKET_INCLUDES=" #ifdef HAVE_SYS_SOCKET_H #include #endif +#ifdef HAVE_NET_IF_H +#include +#endif #ifdef HAVE_NETINET_IN_H #include #endif @@ -518,6 +522,12 @@ AC_CHECK_TYPE( , [[${SOCKET_INCLUDES}]] ) +AC_CHECK_MEMBER( + [struct in_pktinfo.ipi_spec_dst], + [AC_DEFINE([HAVE_IPI_SPEC_DST], [1], [struct in_pktinfo.ipi_spec_dst needed for IP_PKTINFO support])], + , + [[${SOCKET_INCLUDES}]] +) AC_CHECK_TYPE( [sa_family_t], [AC_DEFINE([HAVE_SA_FAMILY_T], [1], [sa_family_t, needed to hold AF_* info])], diff --git a/src/compat/compat-basename.c b/src/compat/compat-basename.c index a057691..0ca0f5f 100644 --- a/src/compat/compat-basename.c +++ b/src/compat/compat-basename.c @@ -28,6 +28,10 @@ #include "config-msvc.h" #endif +#ifdef __sun +int need_at_least_one_symbol = 0; +#endif + #ifndef HAVE_BASENAME #include "compat.h" diff --git a/src/openvpn/init.c b/src/openvpn/init.c index cb73a3d..7f4ff4a 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -1293,7 +1293,7 @@ initialization_sequence_completed (struct context *c, const unsigned int flags) switch (local.addr.sa.sa_family) { case AF_INET: -#ifdef IP_PKTINFO +#if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) local.addr.in4.sin_addr = actual->pi.in4.ipi_spec_dst; #else local.addr.in4.sin_addr = actual->pi.in4; diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 714a847..a165428 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -2457,7 +2457,7 @@ print_link_socket_actual_ex (const struct link_socket_actual *act, struct openvpn_sockaddr sa; CLEAR (sa); sa.addr.in4.sin_family = AF_INET; -#ifdef IP_PKTINFO +#if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) sa.addr.in4.sin_addr = act->pi.in4.ipi_spec_dst; if_indextoname(act->pi.in4.ipi_ifindex, ifname); #elif defined(IP_RECVDSTADDR) @@ -2859,7 +2859,7 @@ link_socket_read_tcp (struct link_socket *sock, struct openvpn_in4_pktinfo { struct cmsghdr cmsghdr; -#ifdef HAVE_IN_PKTINFO +#if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) struct in_pktinfo pi4; #elif defined(IP_RECVDSTADDR) struct in_addr pi4; @@ -2904,7 +2904,7 @@ link_socket_read_udp_posix_recvmsg (struct link_socket *sock, cmsg = CMSG_FIRSTHDR (&mesg); if (cmsg != NULL && CMSG_NXTHDR (&mesg, cmsg) == NULL -#ifdef IP_PKTINFO +#if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) && cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_PKTINFO #elif defined(IP_RECVDSTADDR) @@ -2915,7 +2915,7 @@ link_socket_read_udp_posix_recvmsg (struct link_socket *sock, #endif && cmsg->cmsg_len >= sizeof (struct openvpn_in4_pktinfo)) { -#ifdef IP_PKTINFO +#if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) struct in_pktinfo *pkti = (struct in_pktinfo *) CMSG_DATA (cmsg); from->pi.in4.ipi_ifindex = pkti->ipi_ifindex; from->pi.in4.ipi_spec_dst = pkti->ipi_spec_dst; @@ -3016,7 +3016,7 @@ link_socket_write_udp_posix_sendmsg (struct link_socket *sock, mesg.msg_namelen = sizeof (struct sockaddr_in); mesg.msg_control = &opi; mesg.msg_flags = 0; -#ifdef HAVE_IN_PKTINFO +#if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) mesg.msg_controllen = sizeof (struct openvpn_in4_pktinfo); cmsg = CMSG_FIRSTHDR (&mesg); cmsg->cmsg_len = sizeof (struct openvpn_in4_pktinfo); diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h index b154bc0..312ef55 100644 --- a/src/openvpn/socket.h +++ b/src/openvpn/socket.h @@ -90,7 +90,7 @@ struct link_socket_actual struct openvpn_sockaddr dest; #if ENABLE_IP_PKTINFO union { -#ifdef HAVE_IN_PKTINFO +#if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) struct in_pktinfo in4; #elif defined(IP_RECVDSTADDR) struct in_addr in4; @@ -623,7 +623,7 @@ addr_defined_ipi (const struct link_socket_actual *lsa) #if ENABLE_IP_PKTINFO if (!lsa) return 0; switch (lsa->dest.addr.sa.sa_family) { -#ifdef HAVE_IN_PKTINFO +#if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) case AF_INET: return lsa->pi.in4.ipi_spec_dst.s_addr != 0; #elif defined(IP_RECVDSTADDR) case AF_INET: return lsa->pi.in4.s_addr != 0;