libbb: make set_nport accept pointer to sockaddr, not to len_and_sockaddr.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/networking/ftpd.c b/networking/ftpd.c
index b591356..fae634e 100644
--- a/networking/ftpd.c
+++ b/networking/ftpd.c
@@ -433,7 +433,7 @@
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 @@
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 c68d0ac..09c5ff3 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -151,7 +151,7 @@
*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 fb00c6c..6018665 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -501,7 +501,7 @@
/* 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 @@
}
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 e98a5dd..29f99e7 100644
--- a/networking/nc_bloaty.c
+++ b/networking/nc_bloaty.c
@@ -386,10 +386,10 @@
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 @@
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 @@
(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 a8194d1..a9e5d5c 100644
--- a/networking/pscan.c
+++ b/networking/pscan.c
@@ -76,7 +76,7 @@
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 b532e43..3ff2acb 100644
--- a/networking/tcpudp.c
+++ b/networking/tcpudp.c
@@ -387,7 +387,7 @@
* 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 82bb011..55dc15b 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -482,7 +482,7 @@
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 @@
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 @@
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 2f89c8f..3a4be98 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -407,7 +407,7 @@
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);