svn commit: r195848 - in head/tools/tools/net80211: stumbler w00t w00t/ap w00t/assoc w00t/expand w00t/prga w00t/redir wesside/wesside wlaninject

Sam Leffler sam at FreeBSD.org
Fri Jul 24 15:31:23 UTC 2009


Author: sam
Date: Fri Jul 24 15:31:22 2009
New Revision: 195848
URL: http://svn.freebsd.org/changeset/base/195848

Log:
  Update for vaps:
  o do not force monitor mode; the wlanX ifnet must be an ahdemo mode vap
  o move channel change work before marking ifnet up to avoid churning
    the state machine
  o change default ifnet name to "wlan0"
  
  Approved by:	re (kensmith)

Modified:
  head/tools/tools/net80211/stumbler/stumbler.c
  head/tools/tools/net80211/w00t/README
  head/tools/tools/net80211/w00t/ap/ap.c
  head/tools/tools/net80211/w00t/assoc/assoc.c
  head/tools/tools/net80211/w00t/expand/expand.c
  head/tools/tools/net80211/w00t/prga/prga.c
  head/tools/tools/net80211/w00t/redir/redir.c
  head/tools/tools/net80211/wesside/wesside/wesside.c
  head/tools/tools/net80211/wlaninject/wlaninject.c

Modified: head/tools/tools/net80211/stumbler/stumbler.c
==============================================================================
--- head/tools/tools/net80211/stumbler/stumbler.c	Fri Jul 24 15:28:29 2009	(r195847)
+++ head/tools/tools/net80211/stumbler/stumbler.c	Fri Jul 24 15:31:22 2009	(r195848)
@@ -275,9 +275,14 @@ void set_chan(int c) {
 void setup_if(char *dev) {
         struct ifreq ifr;
         unsigned int flags;
-        struct ifmediareq ifmr;
-        int *mwords;
-        
+
+        // set chan
+        memset(&chaninfo.ireq, 0, sizeof(chaninfo.ireq));
+        strcpy(chaninfo.ireq.i_name, dev);
+        chaninfo.ireq.i_type = IEEE80211_IOC_CHANNEL;
+
+        set_chan(1);
+
         // set iface up and promisc
         memset(&ifr, 0, sizeof(ifr));
         strcpy(ifr.ifr_name, dev);
@@ -293,39 +298,6 @@ void setup_if(char *dev) {
         ifr.ifr_flagshigh = flags >> 16;
         if (ioctl(ioctl_s, SIOCSIFFLAGS, &ifr) == -1)
                 die(1, "ioctl(SIOCSIFFLAGS)");
-
-        // set monitor mode
-        memset(&ifmr, 0, sizeof(ifmr));
-        strcpy(ifmr.ifm_name, dev);
-        if (ioctl(ioctl_s, SIOCGIFMEDIA, &ifmr) == -1)
-                die(1, "ioctl(SIOCGIFMEDIA)");
-
-        if (ifmr.ifm_count == 0) 
-                die(0, "0 media thinggies...\n");
-
-        mwords = (int *)malloc(ifmr.ifm_count * sizeof(int));
-        if (!mwords)
-                die(1, "malloc()");
-
-        ifmr.ifm_ulist = mwords;
-
-        if (ioctl(ioctl_s, SIOCGIFMEDIA, &ifmr) == -1)
-                die(1, "ioctl(SIOCGIFMEDIA)");
-        
-	free(mwords);
-
-        memset(&ifr, 0, sizeof(ifr));
-        strcpy(ifr.ifr_name, dev);
-        ifr.ifr_media = ifmr.ifm_current | IFM_IEEE80211_MONITOR;
-        if (ioctl(ioctl_s, SIOCSIFMEDIA, &ifr) == -1)
-                die(1, "ioctl(SIOCSIFMEDIA)");
-
-        // set chan
-        memset(&chaninfo.ireq, 0, sizeof(chaninfo.ireq));
-        strcpy(chaninfo.ireq.i_name, dev);
-        chaninfo.ireq.i_type = IEEE80211_IOC_CHANNEL;
-
-        set_chan(1);
 }
 
 void open_bpf(char *dev, int dlt) {

Modified: head/tools/tools/net80211/w00t/README
==============================================================================
--- head/tools/tools/net80211/w00t/README	Fri Jul 24 15:28:29 2009	(r195847)
+++ head/tools/tools/net80211/w00t/README	Fri Jul 24 15:31:22 2009	(r195848)
@@ -4,7 +4,7 @@ This is a collection of tools that use r
 None of the tools configure the interface, so be sure to run something
 like:
 
-ifconfig ath0 channel 7 mediaopt monitor promisc up
+ifconfig wlan create wlandev ath0 wlanmode ahdemo channel 7 promisc up
 
 beforehand.  The following tools are found here:
 

Modified: head/tools/tools/net80211/w00t/ap/ap.c
==============================================================================
--- head/tools/tools/net80211/w00t/ap/ap.c	Fri Jul 24 15:28:29 2009	(r195847)
+++ head/tools/tools/net80211/w00t/ap/ap.c	Fri Jul 24 15:31:22 2009	(r195848)
@@ -846,7 +846,7 @@ void next_event(struct params *p)
 
 int main(int argc, char *argv[])
 {
-	char *iface = "ath0";
+	char *iface = "wlan0";
 	char *tap = "tap0";
 	struct params p;
 	int ch;

Modified: head/tools/tools/net80211/w00t/assoc/assoc.c
==============================================================================
--- head/tools/tools/net80211/w00t/assoc/assoc.c	Fri Jul 24 15:28:29 2009	(r195847)
+++ head/tools/tools/net80211/w00t/assoc/assoc.c	Fri Jul 24 15:31:22 2009	(r195848)
@@ -710,7 +710,7 @@ int main(int argc, char *argv[])
 	char mac[] = { 0x00, 0x00, 0xde, 0xfa, 0xce, 0xd };
 	int ch;
 	struct params p;
-	char *iface = "ath0";
+	char *iface = "wlan0";
 	char *tap = "tap0";
 	int timeout = 50*1000;
 	struct timeval start;

Modified: head/tools/tools/net80211/w00t/expand/expand.c
==============================================================================
--- head/tools/tools/net80211/w00t/expand/expand.c	Fri Jul 24 15:28:29 2009	(r195847)
+++ head/tools/tools/net80211/w00t/expand/expand.c	Fri Jul 24 15:31:22 2009	(r195848)
@@ -421,7 +421,7 @@ void usage(char *name)
 int main(int argc, char *argv[])
 {
 	struct params p;
-	char *iface = "ath0";
+	char *iface = "wlan0";
 	char *tap = "tap0";
 	int ch;
 

Modified: head/tools/tools/net80211/w00t/prga/prga.c
==============================================================================
--- head/tools/tools/net80211/w00t/prga/prga.c	Fri Jul 24 15:28:29 2009	(r195847)
+++ head/tools/tools/net80211/w00t/prga/prga.c	Fri Jul 24 15:31:22 2009	(r195848)
@@ -602,7 +602,7 @@ void transmit(struct params *p)
 int main(int argc, char *argv[])
 {
 	struct params p;
-	char *iface = "ath0";
+	char *iface = "wlan0";
 	char *tap = "tap0";
 	int ch;
 

Modified: head/tools/tools/net80211/w00t/redir/redir.c
==============================================================================
--- head/tools/tools/net80211/w00t/redir/redir.c	Fri Jul 24 15:28:29 2009	(r195847)
+++ head/tools/tools/net80211/w00t/redir/redir.c	Fri Jul 24 15:31:22 2009	(r195848)
@@ -631,7 +631,7 @@ void usage(char *name)
 int main(int argc, char *argv[])
 {
 	struct params p;
-	char *iface = "ath0";
+	char *iface = "wlan0";
 	char *tap = "tap0";
 	int ch;
 

Modified: head/tools/tools/net80211/wesside/wesside/wesside.c
==============================================================================
--- head/tools/tools/net80211/wesside/wesside/wesside.c	Fri Jul 24 15:28:29 2009	(r195847)
+++ head/tools/tools/net80211/wesside/wesside/wesside.c	Fri Jul 24 15:31:22 2009	(r195848)
@@ -384,6 +384,15 @@ void setup_if(char *dev) {
 		exit(1);
 	}
 
+	// set chan
+	memset(&chaninfo.ireq, 0, sizeof(chaninfo.ireq));
+	strcpy(chaninfo.ireq.i_name, dev);
+	chaninfo.ireq.i_type = IEEE80211_IOC_CHANNEL;
+	
+	chaninfo.chan = 0;
+	chaninfo.s = s;
+	set_chan(1);
+
 	// set iface up and promisc
 	memset(&ifr, 0, sizeof(ifr));
 	strcpy(ifr.ifr_name, dev);
@@ -404,49 +413,6 @@ void setup_if(char *dev) {
 		exit(1);
 	}
 
-	// set monitor mode
-	memset(&ifmr, 0, sizeof(ifmr));
-	strcpy(ifmr.ifm_name, dev);
-	if (ioctl(s, SIOCGIFMEDIA, &ifmr) == -1) {
-		perror("ioctl(SIOCGIFMEDIA)");
-		exit(1);
-	}
-
-	if (ifmr.ifm_count == 0) {
-		time_print("0 media thinggies...\n");
-		exit(1);
-	}
-
-	mwords = (int *)malloc(ifmr.ifm_count * sizeof(int));
-	if (!mwords) {
-		perror("malloc()");
-		exit(1);
-	}
-	ifmr.ifm_ulist = mwords;
-	
-	if (ioctl(s, SIOCGIFMEDIA, &ifmr) == -1) {
-		perror("ioctl(SIOCGIFMEDIA)");
-		exit(1);
-	}
-	free(mwords);
-
-	memset(&ifr, 0, sizeof(ifr));
-	strcpy(ifr.ifr_name, dev);
-	ifr.ifr_media = ifmr.ifm_current | IFM_IEEE80211_MONITOR;
-	if (ioctl(s, SIOCSIFMEDIA, &ifr) == -1) {
-		perror("ioctl(SIOCSIFMEDIA)");
-		exit(1);
-	}
-
-	// set chan
-	memset(&chaninfo.ireq, 0, sizeof(chaninfo.ireq));
-	strcpy(chaninfo.ireq.i_name, dev);
-	chaninfo.ireq.i_type = IEEE80211_IOC_CHANNEL;
-	
-	chaninfo.chan = 0;
-	chaninfo.s = s;
-	set_chan(1);
-
 	printf("done\n");
 }
 

Modified: head/tools/tools/net80211/wlaninject/wlaninject.c
==============================================================================
--- head/tools/tools/net80211/wlaninject/wlaninject.c	Fri Jul 24 15:28:29 2009	(r195847)
+++ head/tools/tools/net80211/wlaninject/wlaninject.c	Fri Jul 24 15:31:22 2009	(r195848)
@@ -58,6 +58,14 @@ void setup_if(char *dev, int chan) {
 	if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1)
 		err(1, "socket()");
 
+	/* chan */
+	memset(&ireq, 0, sizeof(ireq));
+	snprintf(ireq.i_name, sizeof(ireq.i_name), "%s", dev);
+	ireq.i_type = IEEE80211_IOC_CHANNEL;
+	ireq.i_val = chan;
+	if (ioctl(s, SIOCS80211, &ireq) == -1)
+		err(1, "ioctl(SIOCS80211)");
+
 	/* UP & PROMISC */
 	memset(&ifr, 0, sizeof(ifr));
 	snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", dev);
@@ -70,34 +78,6 @@ void setup_if(char *dev, int chan) {
 	if (ioctl(s, SIOCSIFFLAGS, &ifr) == -1)
 		err(1, "ioctl(SIOCSIFFLAGS)");
 
-	/* set monitor mode */
-	memset(&ifmr, 0, sizeof(ifmr));
-	snprintf(ifmr.ifm_name, sizeof(ifmr.ifm_name), "%s", dev);
-	if (ioctl(s, SIOCGIFMEDIA, &ifmr) == -1)
-		err(1, "ioctl(SIOCGIFMEDIA)");
-	if (ifmr.ifm_count == 0) {
-		printf("0 media thinggies...\n");
-		exit(1);
-	}
-	mwords = (int *)malloc(ifmr.ifm_count * sizeof(int));
-	if (!mwords)
-		err(1, "malloc()");
-	ifmr.ifm_ulist = mwords;
-	if (ioctl(s, SIOCGIFMEDIA, &ifmr) == -1)
-		err(1, "ioctl(SIOCGIFMEDIA)");
-	free(mwords);
-	ifr.ifr_media = ifmr.ifm_current | IFM_IEEE80211_MONITOR;
-	if (ioctl(s, SIOCSIFMEDIA, &ifr) == -1)
-		err(1, "ioctl(SIOCSIFMEDIA)");
-
-	/* chan */
-	memset(&ireq, 0, sizeof(ireq));
-	snprintf(ireq.i_name, sizeof(ireq.i_name), "%s", dev);
-	ireq.i_type = IEEE80211_IOC_CHANNEL;
-	ireq.i_val = chan;
-	if (ioctl(s, SIOCS80211, &ireq) == -1)
-		err(1, "ioctl(SIOCS80211)");
-
 	close(s);
 }
 
@@ -546,7 +526,7 @@ int do_verify(struct ieee80211_frame *se
 int main(int argc, char *argv[])
 {
 	int fd, fd2;
-	char *iface = "ath0";
+	char *iface = "wlan0";
 	char *verify = NULL;
 	int chan = 1;
 	struct {


More information about the svn-src-all mailing list