PERFORCE change 136856 for review

Sam Leffler sam at FreeBSD.org
Tue Mar 4 22:02:59 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=136856

Change 136856 by sam at sam_ebb on 2008/03/04 22:02:46

	don't blindly mark the interface UP before scanning; 
	check first as this might have uninteded side-effects

Affected files ...

.. //depot/projects/vap/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c#5 edit

Differences ...

==== //depot/projects/vap/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c#5 (text+ko) ====

@@ -293,9 +293,9 @@
 
 	memcpy(&ea, addr, IEEE80211_ADDR_LEN);
 	wpa_printf(MSG_DEBUG,
-		"%s: alg=%s addr=%s key_idx=%d set_tx=%d seq_len=%zu key_len=%zu",
-		__func__, alg_name, ether_ntoa(&ea), key_idx, set_tx,
-		seq_len, key_len);
+	    "%s: alg=%s addr=%s key_idx=%d set_tx=%d seq_len=%zu key_len=%zu",
+	    __func__, alg_name, ether_ntoa(&ea), key_idx, set_tx,
+	    seq_len, key_len);
 
 	if (seq_len > sizeof(u_int64_t)) {
 		wpa_printf(MSG_DEBUG, "%s: seq_len %zu too big",
@@ -458,8 +458,15 @@
 
 	/* XXX not true but easiest to perpetuate the myth */
 	/* NB: interface must be marked UP to do a scan */
-	if (getifflags(drv, &flags) != 0 || setifflags(drv, flags | IFF_UP) != 0)
+	if (getifflags(drv, &flags) != 0) {
+		wpa_printf(MSG_DEBUG, "%s did not mark interface UP", __func__);
+		return -1;
+	}
+	if ((flags & IFF_UP) == 0 && setifflags(drv, flags | IFF_UP) != 0) {
+		wpa_printf(MSG_DEBUG, "%s unable to mark interface UP",
+		    __func__);
 		return -1;
+	}
 
 	memset(&sr, 0, sizeof(sr));
 	sr.sr_flags = IEEE80211_IOC_SCAN_ACTIVE


More information about the p4-projects mailing list