From ca18311d0ae16a96e988df15a9009095f93df85e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 7 Apr 2011 17:52:20 +0200 Subject: libbb: make set_nport accept pointer to sockaddr, not to len_and_sockaddr. Signed-off-by: Denys Vlasenko --- networking/ftpd.c | 4 ++-- networking/ftpgetput.c | 2 +- networking/inetd.c | 4 ++-- networking/nc_bloaty.c | 8 ++++---- networking/pscan.c | 2 +- networking/tcpudp.c | 2 +- networking/traceroute.c | 8 ++++---- networking/wget.c | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) (limited to 'networking') diff --git a/networking/ftpd.c b/networking/ftpd.c index b59135667..fae634ec4 100644 --- a/networking/ftpd.c +++ b/networking/ftpd.c @@ -433,7 +433,7 @@ bind_for_passive_mode(void) G.pasv_listen_fd = fd = xsocket(G.local_addr->u.sa.sa_family, SOCK_STREAM, 0); setsockopt_reuseaddr(fd); - set_nport(G.local_addr, 0); + set_nport(&G.local_addr->u.sa, 0); xbind(fd, &G.local_addr->u.sa, G.local_addr->len); xlisten(fd, 1); getsockname(fd, &G.local_addr->u.sa, &G.local_addr->len); @@ -542,7 +542,7 @@ handle_port(void) G.port_addr = xdotted2sockaddr(raw, port); #else G.port_addr = get_peer_lsa(STDIN_FILENO); - set_nport(G.port_addr, htons(port)); + set_nport(&G.port_addr->u.sa, htons(port)); #endif WRITE_OK(FTP_PORTOK); } diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index c68d0ace2..09c5ff30f 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c @@ -151,7 +151,7 @@ TODO2: need to stop ignoring IP address in PASV response. *buf_ptr = '\0'; port_num += xatoul_range(buf_ptr + 1, 0, 255) * 256; - set_nport(lsa, htons(port_num)); + set_nport(&lsa->u.sa, htons(port_num)); return xconnect_stream(lsa); } diff --git a/networking/inetd.c b/networking/inetd.c index fb00c6cd7..6018665ef 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -501,7 +501,7 @@ static void prepare_socket_fd(servtab_t *sep) /* zero out the port for all RPC services; let bind() * find one. */ - set_nport(sep->se_lsa, 0); + set_nport(&sep->se_lsa->u.sa, 0); /* for RPC services, attempt to use a reserved port * if they are going to be running as root. */ @@ -959,7 +959,7 @@ static void reread_config_file(int sig UNUSED_PARAM) } if (LONE_CHAR(sep->se_local_hostname, '*')) { lsa = xzalloc_lsa(sep->se_family); - set_nport(lsa, port); + set_nport(&lsa->u.sa, port); } else { lsa = host_and_af2sockaddr(sep->se_local_hostname, ntohs(port), sep->se_family); diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c index e98a5dd5b..29f99e76b 100644 --- a/networking/nc_bloaty.c +++ b/networking/nc_bloaty.c @@ -386,10 +386,10 @@ create new one, and bind() it. TODO */ if (port == 0) { /* "nc -nl -p LPORT RHOST" (w/o RPORT!): * we should accept any remote port */ - set_nport(&remend, 0); /* blot out remote port# */ + set_nport(&remend.u.sa, 0); /* blot out remote port# */ } r = memcmp(&remend.u.sa, &themaddr->u.sa, remend.len); - set_nport(&remend, sv_port); /* restore */ + set_nport(&remend.u.sa, sv_port); /* restore */ if (r != 0) { /* nc 1.10 bails out instead, and its error message * is not suppressed by o_verbose */ @@ -486,7 +486,7 @@ static int udptest(void) us to hang forever, and hit it */ o_wait = 5; /* enough that we'll notice?? */ rr = xsocket(ouraddr->u.sa.sa_family, SOCK_STREAM, 0); - set_nport(themaddr, htons(SLEAZE_PORT)); + set_nport(&themaddr->u.sa, htons(SLEAZE_PORT)); connect_w_timeout(rr); /* don't need to restore themaddr's port, it's not used anymore */ close(rr); @@ -813,7 +813,7 @@ int nc_main(int argc UNUSED_PARAM, char **argv) (themaddr ? themaddr->u.sa.sa_family : AF_UNSPEC), x); if (o_lport) - set_nport(ouraddr, htons(o_lport)); + set_nport(&ouraddr->u.sa, htons(o_lport)); } xmove_fd(x, netfd); setsockopt_reuseaddr(netfd); diff --git a/networking/pscan.c b/networking/pscan.c index a8194d1a8..a9e5d5c29 100644 --- a/networking/pscan.c +++ b/networking/pscan.c @@ -76,7 +76,7 @@ int pscan_main(int argc UNUSED_PARAM, char **argv) DMSG("rtt %u", rtt_4); /* The SOCK_STREAM socket type is implemented on the TCP/IP protocol. */ - set_nport(lsap, htons(port)); + set_nport(&lsap->u.sa, htons(port)); s = xsocket(lsap->u.sa.sa_family, SOCK_STREAM, 0); /* We need unblocking socket so we don't need to wait for ETIMEOUT. */ /* Nonblocking connect typically "fails" with errno == EINPROGRESS */ diff --git a/networking/tcpudp.c b/networking/tcpudp.c index b532e43cd..3ff2acbf8 100644 --- a/networking/tcpudp.c +++ b/networking/tcpudp.c @@ -387,7 +387,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv) * already bound in parent! This seems to work in Linux. * (otherwise we can move socket to fd #0 only if bind succeeds) */ close(0); - set_nport(localp, htons(local_port)); + set_nport(&localp->u.sa, htons(local_port)); xmove_fd(xsocket(localp->u.sa.sa_family, SOCK_DGRAM, 0), 0); setsockopt_reuseaddr(0); /* crucial */ xbind(0, &localp->u.sa, localp->len); diff --git a/networking/traceroute.c b/networking/traceroute.c index 82bb0118c..55dc15b66 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -482,7 +482,7 @@ send_probe(int seq, int ttl) if (!(option_mask32 & OPT_USE_ICMP)) { out = outdata; len -= sizeof(*outudp); - set_nport(dest_lsa, htons(port + seq)); + set_nport(&dest_lsa->u.sa, htons(port + seq)); } } @@ -1018,10 +1018,10 @@ common_traceroute_main(int op, char **argv) int probe_fd = xsocket(af, SOCK_DGRAM, 0); if (op & OPT_DEVICE) setsockopt_bindtodevice(probe_fd, device); - set_nport(dest_lsa, htons(1025)); + set_nport(&dest_lsa->u.sa, htons(1025)); /* dummy connect. makes kernel pick source IP (and port) */ xconnect(probe_fd, &dest_lsa->u.sa, dest_lsa->len); - set_nport(dest_lsa, htons(port)); + set_nport(&dest_lsa->u.sa, htons(port)); /* read IP and port */ source_lsa = get_sock_lsa(probe_fd); @@ -1031,7 +1031,7 @@ common_traceroute_main(int op, char **argv) close(probe_fd); /* bind our sockets to this IP (but not port) */ - set_nport(source_lsa, 0); + set_nport(&source_lsa->u.sa, 0); xbind(sndsock, &source_lsa->u.sa, source_lsa->len); xbind(rcvsock, &source_lsa->u.sa, source_lsa->len); diff --git a/networking/wget.c b/networking/wget.c index 2f89c8f7f..3a4be9878 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -407,7 +407,7 @@ static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_ str = strrchr(G.wget_buf, ','); if (!str) goto pasv_error; port += xatou_range(str+1, 0, 255) * 256; - set_nport(lsa, htons(port)); + set_nport(&lsa->u.sa, htons(port)); *dfpp = open_socket(lsa); -- cgit v1.2.3