diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2000-12-18 07:00:18 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2000-12-18 07:00:18 +0000 |
commit | 040cec622958fd9effc2a1943a9fa0cac999b6b4 (patch) | |
tree | 7dd5d833bf02645447a8bd5e82eda0a7b91353f4 /sbin | |
parent | 9174170e5fa17b4faff14aee7feff04eab624d91 (diff) |
fix nwid get/set
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index f132a576696..fc3fa3ee2b6 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.41 2000/11/10 18:18:05 itojun Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.42 2000/12/18 07:00:17 mickey Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -81,7 +81,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; #else -static char rcsid[] = "$OpenBSD: ifconfig.c,v 1.41 2000/11/10 18:18:05 itojun Exp $"; +static char rcsid[] = "$OpenBSD: ifconfig.c,v 1.42 2000/12/18 07:00:17 mickey Exp $"; #endif #endif /* not lint */ @@ -1085,12 +1085,13 @@ setifnwid(val, d) char *val; int d; { - u_int8_t nwid[IEEE80211_NWID_LEN]; + struct ieee80211_nwid nwid; memset(&nwid, 0, sizeof(nwid)); - (void)strncpy(nwid, val, sizeof(nwid)); + (void)strncpy(nwid.i_nwid, val, sizeof(nwid.i_nwid)); + nwid.i_len = sizeof(nwid.i_nwid); (void)strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - ifr.ifr_data = (caddr_t)nwid; + ifr.ifr_data = (caddr_t)&nwid; if (ioctl(s, SIOCS80211NWID, (caddr_t)&ifr) < 0) warn("SIOCS80211NWID"); } @@ -1098,14 +1099,17 @@ setifnwid(val, d) void ieee80211_status() { - u_int8_t nwid[IEEE80211_NWID_LEN + 1]; + struct ieee80211_nwid nwid; + char buf[IEEE80211_NWID_LEN + 1]; memset(&ifr, 0, sizeof(ifr)); - ifr.ifr_data = (caddr_t)nwid; + ifr.ifr_data = (caddr_t)&nwid; (void)strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - nwid[IEEE80211_NWID_LEN] = 0; - if (ioctl(s, SIOCG80211NWID, (caddr_t)&ifr) == 0) - printf("\tnwid %s\n", nwid); + if (ioctl(s, SIOCG80211NWID, (caddr_t)&ifr) == 0) { + strncpy(buf, nwid.i_nwid, sizeof(buf) - 1); + buf[IEEE80211_NWID_LEN] = '\0'; + printf("\tnwid %s\n", nwid.i_nwid); + } } void |