diff options
author | 2018-08-12 18:33:55 +0000 | |
---|---|---|
committer | 2018-08-12 18:33:55 +0000 | |
commit | 09c249a1fb692a33d059e63a2db52e46c8caaf1a (patch) | |
tree | a785427a820b2e6ce77bdafbdd8bb4af2e26d892 | |
parent | Really overwrite the major of com(4) instead of the hardcoded 12. (diff) | |
download | wireguard-openbsd-09c249a1fb692a33d059e63a2db52e46c8caaf1a.tar.xz wireguard-openbsd-09c249a1fb692a33d059e63a2db52e46c8caaf1a.zip |
Make ifconfig's -joinlist command work as advertised.
ok deraadt phessler
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 7a89c26dadb..6bc7276ff5e 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.373 2018/08/11 09:18:49 benno Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.374 2018/08/12 18:33:55 stsp Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -1707,23 +1707,16 @@ delifjoin(const char *val, int d) len = 0; join.i_flags |= IEEE80211_JOIN_DEL; - if (val == NULL) { + if (d == -1) { ifr.ifr_data = (caddr_t)&join; if (ioctl(s, SIOCS80211JOIN, (caddr_t)&ifr) < 0) warn("SIOCS80211JOIN"); return; } - if (d != 0) { - /* no network id is especially desired */ - memset(&join, 0, sizeof(join)); - len = 0; - } else { - len = sizeof(join.i_nwid); - if (val != NULL && - get_string(val, NULL, join.i_nwid, &len) == NULL) - return; - } + len = sizeof(join.i_nwid); + if (get_string(val, NULL, join.i_nwid, &len) == NULL) + return; join.i_len = len; (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_data = (caddr_t)&join; |