diff options
Diffstat (limited to 'networking/libiproute/iplink.c')
-rw-r--r-- | networking/libiproute/iplink.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index 7db4d7e..3d3ea2a 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c @@ -49,14 +49,11 @@ static void do_chflags(char *dev, uint32_t flags, uint32_t mask) strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); fd = get_ctl_fd(); - if (ioctl(fd, SIOCGIFFLAGS, &ifr)) { - bb_perror_msg_and_die("SIOCGIFFLAGS"); - } + xioctl(fd, SIOCGIFFLAGS, &ifr); if ((ifr.ifr_flags ^ flags) & mask) { ifr.ifr_flags &= ~mask; ifr.ifr_flags |= mask & flags; - if (ioctl(fd, SIOCSIFFLAGS, &ifr)) - bb_perror_msg_and_die("SIOCSIFFLAGS"); + xioctl(fd, SIOCSIFFLAGS, &ifr); } close(fd); } @@ -66,15 +63,11 @@ static void do_changename(char *dev, char *newdev) { struct ifreq ifr; int fd; - int err; strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); strncpy(ifr.ifr_newname, newdev, sizeof(ifr.ifr_newname)); fd = get_ctl_fd(); - err = ioctl(fd, SIOCSIFNAME, &ifr); - if (err) { - bb_perror_msg_and_die("SIOCSIFNAME"); - } + xioctl(fd, SIOCSIFNAME, &ifr); close(fd); } @@ -88,9 +81,7 @@ static void set_qlen(char *dev, int qlen) memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); ifr.ifr_qlen = qlen; - if (ioctl(s, SIOCSIFTXQLEN, &ifr) < 0) { - bb_perror_msg_and_die("SIOCSIFXQLEN"); - } + xioctl(s, SIOCSIFTXQLEN, &ifr); close(s); } @@ -104,9 +95,7 @@ static void set_mtu(char *dev, int mtu) memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); ifr.ifr_mtu = mtu; - if (ioctl(s, SIOCSIFMTU, &ifr) < 0) { - bb_perror_msg_and_die("SIOCSIFMTU"); - } + xioctl(s, SIOCSIFMTU, &ifr); close(s); } @@ -122,9 +111,7 @@ static int get_address(char *dev, int *htype) memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); - if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) { - bb_perror_msg_and_die("SIOCGIFINDEX"); - } + xioctl(s, SIOCGIFINDEX, &ifr); memset(&me, 0, sizeof(me)); me.sll_family = AF_PACKET; @@ -163,9 +150,10 @@ static void set_address(struct ifreq *ifr, int brd) int s; s = get_ctl_fd(); - if (ioctl(s, brd ? SIOCSIFHWBROADCAST :SIOCSIFHWADDR, ifr) < 0) { - bb_perror_msg_and_die(brd ? "SIOCSIFHWBROADCAST" : "SIOCSIFHWADDR"); - } + if (brd) + xioctl(s, SIOCSIFHWBROADCAST, ifr); + else + xioctl(s, SIOCSIFHWADDR, ifr); close(s); } |