Nc does not accept connections when listening for a specified remote host. The command: nc -n -l -p <local port> <remote host> always reports "nc: connect from wrong ip/port ... ignored" Nc accepts a connection only when a remote source port is specified (and the connection comes from it): nc -n -l -p <local port> <remote host> <remote source port> This is because of 'memcmp' method of checking out the incoming connection address and port in 'dolisten()' function (line #343 in networking/nc_bloaty.c): ---------------------------------------- 340 rr = accept(netfd, &remend.u.sa, &remend.len); 341 if (rr < 0) 342 bb_perror_msg_and_die("accept"); 343 if (themaddr && memcmp(&remend.u.sa, &themaddr->u.sa, remend.len) != 0) { 344 /* nc 1.10 bails out instead, and its error message 345 * is not suppressed by o_verbose */ 346 if (o_verbose) { 347 char *remaddr = xmalloc_sockaddr2dotted(&remend.u.sa); 348 bb_error_msg("connect from wrong ip/port %s ignored", remaddr); 349 free(remaddr); 350 } 351 close(rr); 352 goto again; 353 } ---------------------------------------- Here 'themaddr->u.sa' has port=0 if it is not specified on the command line while 'remend.u.sa' always has nonzero source port
Created attachment 881 [details] Fix Please try attached patch
Fixed in 1.16.0