aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-04-02 09:24:14 +0100
committerRon Yorston <rmy@pobox.com>2018-04-02 09:24:14 +0100
commit34a68d327b42c3c700e84cd475496985782290b1 (patch)
tree99bfe59cca420d26f01e81a7f41763f71b44d22c /networking
parentaff3c5bd7b6bdcfb97f63153ab839c5f55f16a12 (diff)
parente84212f8346741a2d4a04b40639c44fe519cf5a7 (diff)
downloadbusybox-w32-34a68d327b42c3c700e84cd475496985782290b1.tar.gz
busybox-w32-34a68d327b42c3c700e84cd475496985782290b1.tar.bz2
busybox-w32-34a68d327b42c3c700e84cd475496985782290b1.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'networking')
-rw-r--r--networking/ifplugd.c2
-rw-r--r--networking/ifupdown.c6
-rw-r--r--networking/libiproute/iplink.c2
-rw-r--r--networking/netstat.c7
-rw-r--r--networking/route.c2
-rw-r--r--networking/ssl_client.c1
-rw-r--r--networking/udhcp/d6_socket.c2
-rw-r--r--networking/wget.c4
8 files changed, 17 insertions, 9 deletions
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index 9bc1a075f..5059eaf73 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -367,7 +367,7 @@ static void up_iface(void)
367 /* Let user know we mess up with interface */ 367 /* Let user know we mess up with interface */
368 bb_error_msg("upping interface"); 368 bb_error_msg("upping interface");
369 if (network_ioctl(SIOCSIFFLAGS, &ifrequest, "setting interface flags") < 0) { 369 if (network_ioctl(SIOCSIFFLAGS, &ifrequest, "setting interface flags") < 0) {
370 if (errno != ENODEV) 370 if (errno != ENODEV && errno != EADDRNOTAVAIL)
371 xfunc_die(); 371 xfunc_die();
372 G.iface_exists = 0; 372 G.iface_exists = 0;
373 return; 373 return;
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 534c9f0c7..5481134e5 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -138,6 +138,7 @@
138//usage: "\n -v Print out what would happen before doing it" 138//usage: "\n -v Print out what would happen before doing it"
139//usage: "\n -f Force deconfiguration" 139//usage: "\n -f Force deconfiguration"
140 140
141#include <net/if.h>
141#include "libbb.h" 142#include "libbb.h"
142#include "common_bufsiz.h" 143#include "common_bufsiz.h"
143/* After libbb.h, since it needs sys/types.h on some systems */ 144/* After libbb.h, since it needs sys/types.h on some systems */
@@ -503,6 +504,8 @@ static int FAST_FUNC static_up6(struct interface_defn_t *ifd, execfn *exec)
503 504
504static int FAST_FUNC static_down6(struct interface_defn_t *ifd, execfn *exec) 505static int FAST_FUNC static_down6(struct interface_defn_t *ifd, execfn *exec)
505{ 506{
507 if (!if_nametoindex(ifd->iface))
508 return 1; /* already gone */
506# if ENABLE_FEATURE_IFUPDOWN_IP 509# if ENABLE_FEATURE_IFUPDOWN_IP
507 return execute("ip link set %iface% down", ifd, exec); 510 return execute("ip link set %iface% down", ifd, exec);
508# else 511# else
@@ -598,6 +601,9 @@ static int FAST_FUNC static_up(struct interface_defn_t *ifd, execfn *exec)
598static int FAST_FUNC static_down(struct interface_defn_t *ifd, execfn *exec) 601static int FAST_FUNC static_down(struct interface_defn_t *ifd, execfn *exec)
599{ 602{
600 int result; 603 int result;
604
605 if (!if_nametoindex(ifd->iface))
606 return 2; /* already gone */
601# if ENABLE_FEATURE_IFUPDOWN_IP 607# if ENABLE_FEATURE_IFUPDOWN_IP
602 /* Optional "label LBL" is necessary if interface is an alias (eth0:0), 608 /* Optional "label LBL" is necessary if interface is an alias (eth0:0),
603 * otherwise "ip addr flush dev eth0:0" flushes all addresses on eth0. 609 * otherwise "ip addr flush dev eth0:0" flushes all addresses on eth0.
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index 2aa8b683b..9c164a71d 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -161,7 +161,7 @@ static int get_address(char *dev, int *htype)
161 161
162 s = xsocket(PF_PACKET, SOCK_DGRAM, 0); 162 s = xsocket(PF_PACKET, SOCK_DGRAM, 0);
163 163
164 memset(&ifr, 0, sizeof(ifr)); 164 /*memset(&ifr, 0, sizeof(ifr)); - SIOCGIFINDEX does not need to clear all */
165 strncpy_IFNAMSIZ(ifr.ifr_name, dev); 165 strncpy_IFNAMSIZ(ifr.ifr_name, dev);
166 xioctl(s, SIOCGIFINDEX, &ifr); 166 xioctl(s, SIOCGIFINDEX, &ifr);
167 167
diff --git a/networking/netstat.c b/networking/netstat.c
index 33281e333..f6bcd44ba 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -397,8 +397,11 @@ static char *ip_port_str(struct sockaddr *addr, int port, const char *proto, int
397 /* Code which used "*" for INADDR_ANY is removed: it's ambiguous 397 /* Code which used "*" for INADDR_ANY is removed: it's ambiguous
398 * in IPv6, while "0.0.0.0" is not. */ 398 * in IPv6, while "0.0.0.0" is not. */
399 399
400 host = numeric ? xmalloc_sockaddr2dotted_noport(addr) 400 host = NULL;
401 : xmalloc_sockaddr2host_noport(addr); 401 if (!numeric)
402 host = xmalloc_sockaddr2host_noport(addr);
403 if (!host)
404 host = xmalloc_sockaddr2dotted_noport(addr);
402 405
403 host_port = xasprintf("%s:%s", host, get_sname(htons(port), proto, numeric)); 406 host_port = xasprintf("%s:%s", host, get_sname(htons(port), proto, numeric));
404 free(host); 407 free(host);
diff --git a/networking/route.c b/networking/route.c
index 6edc0f6d7..8387ce1bb 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -444,7 +444,7 @@ static NOINLINE void INET6_setroute(int action, char **args)
444 444
445 if (devname) { 445 if (devname) {
446 struct ifreq ifr; 446 struct ifreq ifr;
447 memset(&ifr, 0, sizeof(ifr)); 447 /*memset(&ifr, 0, sizeof(ifr)); - SIOCGIFINDEX does not need to clear all */
448 strncpy_IFNAMSIZ(ifr.ifr_name, devname); 448 strncpy_IFNAMSIZ(ifr.ifr_name, devname);
449 xioctl(skfd, SIOCGIFINDEX, &ifr); 449 xioctl(skfd, SIOCGIFINDEX, &ifr);
450 rt.rtmsg_ifindex = ifr.ifr_ifindex; 450 rt.rtmsg_ifindex = ifr.ifr_ifindex;
diff --git a/networking/ssl_client.c b/networking/ssl_client.c
index e56d82fc1..49aec6b99 100644
--- a/networking/ssl_client.c
+++ b/networking/ssl_client.c
@@ -41,7 +41,6 @@ int ssl_client_main(int argc UNUSED_PARAM, char **argv)
41 tls = new_tls_state(); 41 tls = new_tls_state();
42#if !ENABLE_PLATFORM_MINGW32 42#if !ENABLE_PLATFORM_MINGW32
43 opt = getopt32(argv, "es:+r:+n:", &tls->ofd, &tls->ifd, &sni); 43 opt = getopt32(argv, "es:+r:+n:", &tls->ofd, &tls->ifd, &sni);
44
45 if (!(opt & (1<<2))) { 44 if (!(opt & (1<<2))) {
46 /* -r N defaults to -s N */ 45 /* -r N defaults to -s N */
47 tls->ifd = tls->ofd; 46 tls->ifd = tls->ofd;
diff --git a/networking/udhcp/d6_socket.c b/networking/udhcp/d6_socket.c
index 315c8d98a..6ad53a9c2 100644
--- a/networking/udhcp/d6_socket.c
+++ b/networking/udhcp/d6_socket.c
@@ -63,7 +63,7 @@ int FAST_FUNC d6_read_interface(const char *interface, int *ifindex, struct in6_
63 struct ifreq ifr; 63 struct ifreq ifr;
64 int fd; 64 int fd;
65 65
66 memset(&ifr, 0, sizeof(ifr)); 66 /*memset(&ifr, 0, sizeof(ifr)); - SIOCGIFINDEX does not need to clear all */
67 strncpy_IFNAMSIZ(ifr.ifr_name, interface); 67 strncpy_IFNAMSIZ(ifr.ifr_name, interface);
68 fd = xsocket(AF_INET6, SOCK_RAW, IPPROTO_RAW); 68 fd = xsocket(AF_INET6, SOCK_RAW, IPPROTO_RAW);
69 if (ioctl(fd, SIOCGIFINDEX, &ifr) == 0) { 69 if (ioctl(fd, SIOCGIFINDEX, &ifr) == 0) {
diff --git a/networking/wget.c b/networking/wget.c
index 194bf457a..aaa068ba9 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -409,7 +409,7 @@ static FILE *open_socket(len_and_sockaddr *lsa)
409 /* hopefully it understands what ESPIPE means... */ 409 /* hopefully it understands what ESPIPE means... */
410 fp = fdopen(fd, "r+"); 410 fp = fdopen(fd, "r+");
411 if (!fp) 411 if (!fp)
412 bb_perror_msg_and_die(bb_msg_memory_exhausted); 412 bb_die_memory_exhausted();
413 413
414 return fp; 414 return fp;
415} 415}
@@ -1146,7 +1146,7 @@ static void download_one_url(const char *url)
1146# endif 1146# endif
1147 sfp = fdopen(fd, "r+"); 1147 sfp = fdopen(fd, "r+");
1148 if (!sfp) 1148 if (!sfp)
1149 bb_perror_msg_and_die(bb_msg_memory_exhausted); 1149 bb_die_memory_exhausted();
1150 goto socket_opened; 1150 goto socket_opened;
1151 } 1151 }
1152 sfp = open_socket(lsa); 1152 sfp = open_socket(lsa);