* are closed, but nc doesn't exit - continues to listen/accept.
*/
-/* done in nc.c: #include "busybox.h" */
+/* done in nc.c: #include "libbb.h" */
enum {
SLEAZE_PORT = 31337, /* for UDP-scan RTT trick, change if ya want */
close(rr);
goto again;
}
-
+
} else
bb_error_msg_and_die("timeout");
unarm();
}
proggie = NULL;
e_found:
-
+
// -g -G -t -r deleted, unimplemented -a deleted too
opt_complementary = "?2:vv"; /* max 2 params, -v is a counter */
getopt32(argc, argv, "hnp:s:uvw:" USE_NC_SERVER("l")
/* We manage our fd's so that they are never 0,1,2 */
/*bb_sanitize_stdio(); - not needed */
+ if (argv[0]) {
+ themaddr = xhost2sockaddr(argv[0],
+ argv[1]
+ ? bb_lookup_port(argv[1], o_udpmode ? "udp" : "tcp", 0)
+ : 0);
+ }
+
/* create & bind network socket */
x = (o_udpmode ? SOCK_DGRAM : SOCK_STREAM);
if (option_mask32 & OPT_s) { /* local address */
ouraddr = xhost2sockaddr(str_s, o_lport);
x = xsocket(ouraddr->sa.sa_family, x, 0);
} else {
- x = xsocket_type(&ouraddr, x);
+ /* We try IPv6, then IPv4, unless addr family is
+ * implicitly set by way of remote addr/port spec */
+ x = xsocket_type(&ouraddr,
+ USE_FEATURE_IPV6((themaddr ? themaddr->sa.sa_family : AF_UNSPEC),)
+ x);
if (o_lport)
set_nport(ouraddr, htons(o_lport));
}
xmove_fd(xopen(str_o, O_WRONLY|O_CREAT|O_TRUNC), ofd);
#endif
- if (argv[0]) {
- themaddr = xhost2sockaddr(argv[0],
- argv[1]
- ? bb_lookup_port(argv[1], o_udpmode ? "udp" : "tcp", 0)
- : 0);
-///what if sa_family won't match??
- }
-
if (o_listen) {
dolisten();
/* dolisten does its own connect reporting */