tcpsvd,udpsvd: conditionalize usage of SO_ORIGINAL_DST
authorJeremie Koenig <jk@jk.fr.eu.org>
Thu, 27 May 2010 13:46:25 +0000 (15:46 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 18 Jul 2010 22:46:57 +0000 (00:46 +0200)
On systems without this call, $TCPORIGDSTADDR is not set.

Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/Config.src
networking/tcpudp.c

index fc613e8d3885a88dd76ab1f27edab361e9bf8a96..2d29c423a2d1d6825a21b086e177f1b9d6c4544f 100644 (file)
@@ -733,7 +733,6 @@ config SLATTACH
 config TCPSVD
        bool "tcpsvd"
        default y
-       depends on PLATFORM_LINUX
        help
          tcpsvd listens on a TCP port and runs a program for each new
          connection.
@@ -966,7 +965,6 @@ config IFUPDOWN_UDHCPC_CMD_OPTIONS
 config UDPSVD
        bool "udpsvd"
        default y
-       depends on PLATFORM_LINUX
        help
          udpsvd listens on an UDP port and runs a program for each new
          connection.
index 53e622b56b186ecf46cf8d5dddc06735d01ad488..40f68258ec0c3a47c8576dac3aae6ba4b9612bd6 100644 (file)
  */
 
 #include "libbb.h"
+
 /* Wants <limits.h> etc, thus included after libbb.h: */
+#ifdef __linux__
 #include <linux/types.h> /* for __be32 etc */
 #include <linux/netfilter_ipv4.h>
+#endif
 
 // TODO: move into this file:
 #include "tcpudp_perhost.h"
@@ -464,6 +467,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv)
                        /* setup ucspi env */
                        const char *proto = tcp ? "TCP" : "UDP";
 
+#ifdef SO_ORIGINAL_DST
                        /* Extract "original" destination addr:port
                         * from Linux firewall. Useful when you redirect
                         * an outbond connection to local handler, and it needs
@@ -473,6 +477,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv)
                                xsetenv_plain("TCPORIGDSTADDR", addr);
                                free(addr);
                        }
+#endif
                        xsetenv_plain("PROTO", proto);
                        xsetenv_proto(proto, "LOCALADDR", local_addr);
                        xsetenv_proto(proto, "REMOTEADDR", remote_addr);