diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-04 11:02:55 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-04 11:02:55 +0000 |
commit | 794687947fe9eb15b2512a0d9645d827348c5f6f (patch) | |
tree | 0fb7585537a86b0e02cb7c96caa5c04b70eacb74 /ipsvd | |
parent | 64a15124e71b89dca7b00ba76a2ca821e69b5daa (diff) | |
download | busybox-w32-794687947fe9eb15b2512a0d9645d827348c5f6f.tar.gz busybox-w32-794687947fe9eb15b2512a0d9645d827348c5f6f.tar.bz2 busybox-w32-794687947fe9eb15b2512a0d9645d827348c5f6f.zip |
Add/improve comment, shorten some usage texts. No code changes.
Diffstat (limited to 'ipsvd')
-rw-r--r-- | ipsvd/tcpudp.c | 21 | ||||
-rw-r--r-- | ipsvd/udp_io.c | 2 |
2 files changed, 21 insertions, 2 deletions
diff --git a/ipsvd/tcpudp.c b/ipsvd/tcpudp.c index 9f098c32e..66f44e9a6 100644 --- a/ipsvd/tcpudp.c +++ b/ipsvd/tcpudp.c | |||
@@ -331,12 +331,31 @@ int tcpudpsvd_main(int argc, char **argv) | |||
331 | * to ones coming from this remote IP. */ | 331 | * to ones coming from this remote IP. */ |
332 | xconnect(0, &remote.sa, sa_len); | 332 | xconnect(0, &remote.sa, sa_len); |
333 | /* hole? at this point we have no wildcard udp socket... | 333 | /* hole? at this point we have no wildcard udp socket... |
334 | * can this cause clients to get "port unreachable" icmp? */ | 334 | * can this cause clients to get "port unreachable" icmp? |
335 | * Yup, time window is very small, but it exists (is it?) */ | ||
335 | /* Open new non-connected UDP socket for further clients */ | 336 | /* Open new non-connected UDP socket for further clients */ |
336 | sock = xsocket(lsa->sa.sa_family, tcp ? SOCK_STREAM : SOCK_DGRAM, 0); | 337 | sock = xsocket(lsa->sa.sa_family, tcp ? SOCK_STREAM : SOCK_DGRAM, 0); |
337 | setsockopt_reuseaddr(sock); | 338 | setsockopt_reuseaddr(sock); |
338 | xbind(sock, &lsa->sa, sa_len); | 339 | xbind(sock, &lsa->sa, sa_len); |
339 | socket_want_pktinfo(sock); | 340 | socket_want_pktinfo(sock); |
341 | |||
342 | /* Doesn't work: | ||
343 | * we cannot replace fd #0 - we will lose pending packet | ||
344 | * which is already buffered for us! And we cannot use fd #1 | ||
345 | * instead - it will "intercept" all following packets, but child | ||
346 | * do not expect data coming *from fd #1*! */ | ||
347 | #if 0 | ||
348 | /* Make it so that local addr is fixed to localp->sa | ||
349 | * and we don't accidentally accept packets to other local IPs. */ | ||
350 | /* NB: we possibly bind to the _very_ same_ address & port as the one | ||
351 | * already bound in parent! This seems to work in Linux. | ||
352 | * (otherwise we can move socket to fd #0 only if bind succeeds) */ | ||
353 | close(0); | ||
354 | set_nport(localp, htons(local_port)); | ||
355 | xmove_fd(xsocket(localp->sa.sa_family, SOCK_DGRAM, 0), 0); | ||
356 | setsockopt_reuseaddr(0); /* crucial */ | ||
357 | xbind(0, &localp->sa, localp->len); | ||
358 | #endif | ||
340 | } | 359 | } |
341 | 360 | ||
342 | pid = fork(); | 361 | pid = fork(); |
diff --git a/ipsvd/udp_io.c b/ipsvd/udp_io.c index 2efc15913..592d98b58 100644 --- a/ipsvd/udp_io.c +++ b/ipsvd/udp_io.c | |||
@@ -95,7 +95,7 @@ send_to_from(int fd, void *buf, size_t len, int flags, | |||
95 | 95 | ||
96 | /* NB: this will never set port# in 'to'! | 96 | /* NB: this will never set port# in 'to'! |
97 | * _Only_ IP/IPv6 address part of 'to' is _maybe_ modified. | 97 | * _Only_ IP/IPv6 address part of 'to' is _maybe_ modified. |
98 | * Typical usage is to preinit it with "default" value | 98 | * Typical usage is to preinit 'to' with "default" value |
99 | * before calling recv_from_to(). */ | 99 | * before calling recv_from_to(). */ |
100 | ssize_t | 100 | ssize_t |
101 | recv_from_to(int fd, void *buf, size_t len, int flags, | 101 | recv_from_to(int fd, void *buf, size_t len, int flags, |