diff options
| author | Jeremie Koenig <jk@jk.fr.eu.org> | 2010-05-27 15:46:25 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-07-19 00:46:57 +0200 |
| commit | 2ea12d8b6d2a36c5d49df1ae97b86ba287835249 (patch) | |
| tree | f9c72b0802ca6d6aefa4c78d258645fe2c2adbbc | |
| parent | 29885114a5e3d22ee7aa3ab0e373e00e7cff443c (diff) | |
| download | busybox-w32-2ea12d8b6d2a36c5d49df1ae97b86ba287835249.tar.gz busybox-w32-2ea12d8b6d2a36c5d49df1ae97b86ba287835249.tar.bz2 busybox-w32-2ea12d8b6d2a36c5d49df1ae97b86ba287835249.zip | |
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>
| -rw-r--r-- | networking/Config.src | 2 | ||||
| -rw-r--r-- | networking/tcpudp.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/networking/Config.src b/networking/Config.src index fc613e8d3..2d29c423a 100644 --- a/networking/Config.src +++ b/networking/Config.src | |||
| @@ -733,7 +733,6 @@ config SLATTACH | |||
| 733 | config TCPSVD | 733 | config TCPSVD |
| 734 | bool "tcpsvd" | 734 | bool "tcpsvd" |
| 735 | default y | 735 | default y |
| 736 | depends on PLATFORM_LINUX | ||
| 737 | help | 736 | help |
| 738 | tcpsvd listens on a TCP port and runs a program for each new | 737 | tcpsvd listens on a TCP port and runs a program for each new |
| 739 | connection. | 738 | connection. |
| @@ -966,7 +965,6 @@ config IFUPDOWN_UDHCPC_CMD_OPTIONS | |||
| 966 | config UDPSVD | 965 | config UDPSVD |
| 967 | bool "udpsvd" | 966 | bool "udpsvd" |
| 968 | default y | 967 | default y |
| 969 | depends on PLATFORM_LINUX | ||
| 970 | help | 968 | help |
| 971 | udpsvd listens on an UDP port and runs a program for each new | 969 | udpsvd listens on an UDP port and runs a program for each new |
| 972 | connection. | 970 | connection. |
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 @@ | |||
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | #include "libbb.h" | 32 | #include "libbb.h" |
| 33 | |||
| 33 | /* Wants <limits.h> etc, thus included after libbb.h: */ | 34 | /* Wants <limits.h> etc, thus included after libbb.h: */ |
| 35 | #ifdef __linux__ | ||
| 34 | #include <linux/types.h> /* for __be32 etc */ | 36 | #include <linux/types.h> /* for __be32 etc */ |
| 35 | #include <linux/netfilter_ipv4.h> | 37 | #include <linux/netfilter_ipv4.h> |
| 38 | #endif | ||
| 36 | 39 | ||
| 37 | // TODO: move into this file: | 40 | // TODO: move into this file: |
| 38 | #include "tcpudp_perhost.h" | 41 | #include "tcpudp_perhost.h" |
| @@ -464,6 +467,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv) | |||
| 464 | /* setup ucspi env */ | 467 | /* setup ucspi env */ |
| 465 | const char *proto = tcp ? "TCP" : "UDP"; | 468 | const char *proto = tcp ? "TCP" : "UDP"; |
| 466 | 469 | ||
| 470 | #ifdef SO_ORIGINAL_DST | ||
| 467 | /* Extract "original" destination addr:port | 471 | /* Extract "original" destination addr:port |
| 468 | * from Linux firewall. Useful when you redirect | 472 | * from Linux firewall. Useful when you redirect |
| 469 | * an outbond connection to local handler, and it needs | 473 | * an outbond connection to local handler, and it needs |
| @@ -473,6 +477,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv) | |||
| 473 | xsetenv_plain("TCPORIGDSTADDR", addr); | 477 | xsetenv_plain("TCPORIGDSTADDR", addr); |
| 474 | free(addr); | 478 | free(addr); |
| 475 | } | 479 | } |
| 480 | #endif | ||
| 476 | xsetenv_plain("PROTO", proto); | 481 | xsetenv_plain("PROTO", proto); |
| 477 | xsetenv_proto(proto, "LOCALADDR", local_addr); | 482 | xsetenv_proto(proto, "LOCALADDR", local_addr); |
| 478 | xsetenv_proto(proto, "REMOTEADDR", remote_addr); | 483 | xsetenv_proto(proto, "REMOTEADDR", remote_addr); |
