aboutsummaryrefslogtreecommitdiff
path: root/networking/tcpudp.c
diff options
context:
space:
mode:
authorJeremie Koenig <jk@jk.fr.eu.org>2010-05-27 15:46:25 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-07-19 00:46:57 +0200
commit2ea12d8b6d2a36c5d49df1ae97b86ba287835249 (patch)
treef9c72b0802ca6d6aefa4c78d258645fe2c2adbbc /networking/tcpudp.c
parent29885114a5e3d22ee7aa3ab0e373e00e7cff443c (diff)
downloadbusybox-2ea12d8b6d2a36c5d49df1ae97b86ba287835249.tar.gz
tcpsvd,udpsvd: conditionalize usage of SO_ORIGINAL_DST
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>
Diffstat (limited to 'networking/tcpudp.c')
-rw-r--r--networking/tcpudp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/networking/tcpudp.c b/networking/tcpudp.c
index 53e622b56..40f68258e 100644
--- a/networking/tcpudp.c
+++ b/networking/tcpudp.c
@@ -30,9 +30,12 @@
*/
#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);