Module Name: src Committed By: degroote Date: Tue Jan 7 20:25:24 UTC 2014
Modified Files: src/sbin/ifconfig: ieee80211.c ifconfig.8 Log Message: Before scanning, check if the card is up. If it is not the case, exit with some useful error message. Add some note about this fact in the man page too. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sbin/ifconfig/ieee80211.c cvs rdiff -u -r1.105 -r1.106 src/sbin/ifconfig/ifconfig.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/ifconfig/ieee80211.c diff -u src/sbin/ifconfig/ieee80211.c:1.25 src/sbin/ifconfig/ieee80211.c:1.26 --- src/sbin/ifconfig/ieee80211.c:1.25 Mon Dec 13 17:35:08 2010 +++ src/sbin/ifconfig/ieee80211.c Tue Jan 7 20:25:24 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211.c,v 1.25 2010/12/13 17:35:08 pooka Exp $ */ +/* $NetBSD: ieee80211.c,v 1.26 2014/01/07 20:25:24 degroote Exp $ */ /* * Copyright (c) 1983, 1993 @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: ieee80211.c,v 1.25 2010/12/13 17:35:08 pooka Exp $"); +__RCSID("$NetBSD: ieee80211.c,v 1.26 2014/01/07 20:25:24 degroote Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -463,8 +463,19 @@ setifpowersavesleep(prop_dictionary_t en static int scan_exec(prop_dictionary_t env, prop_dictionary_t oenv) { + struct ifreq ifr; + + if (direct_ioctl(env, SIOCGIFFLAGS, &ifr) == -1) { + perror("ioctl(SIOCGIFFLAGS"); + return -1; + } + + if ((ifr.ifr_flags & IFF_UP) == 0) + errx(EXIT_FAILURE, "The interface must be up before scanning."); + scan_and_wait(env); list_scan(env); + return 0; } Index: src/sbin/ifconfig/ifconfig.8 diff -u src/sbin/ifconfig/ifconfig.8:1.105 src/sbin/ifconfig/ifconfig.8:1.106 --- src/sbin/ifconfig/ifconfig.8:1.105 Sat Nov 9 13:10:35 2013 +++ src/sbin/ifconfig/ifconfig.8 Tue Jan 7 20:25:24 2014 @@ -1,4 +1,4 @@ -.\" $NetBSD: ifconfig.8,v 1.105 2013/11/09 13:10:35 kefren Exp $ +.\" $NetBSD: ifconfig.8,v 1.106 2014/01/07 20:25:24 degroote Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -503,6 +503,7 @@ The flag may be used to display long SSIDs. .Fl v also causes received information elements to be displayed symbolically. +The interface must be up before any scanning operation. Only the super-user can use this command. .It Cm tunnel Ar src_addr Ns Oo Ar ,src_port Oc Ar dest_addr Ns Oo Ar ,dest_port .Oc