diff options
author | sam <sam@FreeBSD.org> | 2009-07-24 15:31:22 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2009-07-24 15:31:22 +0000 |
commit | 33f3a67bc1f6ed041c320e4d7ebf363b010178db (patch) | |
tree | b2f21e20bceccddb08f7a57d5d486699523bb239 /tools | |
parent | 671d3b45e2a64b81e6d6445549e7b4396bc5f2f5 (diff) | |
download | FreeBSD-src-33f3a67bc1f6ed041c320e4d7ebf363b010178db.zip FreeBSD-src-33f3a67bc1f6ed041c320e4d7ebf363b010178db.tar.gz |
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)
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/net80211/stumbler/stumbler.c | 44 | ||||
-rw-r--r-- | tools/tools/net80211/w00t/README | 2 | ||||
-rw-r--r-- | tools/tools/net80211/w00t/ap/ap.c | 2 | ||||
-rw-r--r-- | tools/tools/net80211/w00t/assoc/assoc.c | 2 | ||||
-rw-r--r-- | tools/tools/net80211/w00t/expand/expand.c | 2 | ||||
-rw-r--r-- | tools/tools/net80211/w00t/prga/prga.c | 2 | ||||
-rw-r--r-- | tools/tools/net80211/w00t/redir/redir.c | 2 | ||||
-rw-r--r-- | tools/tools/net80211/wesside/wesside/wesside.c | 52 | ||||
-rw-r--r-- | tools/tools/net80211/wlaninject/wlaninject.c | 38 |
9 files changed, 32 insertions, 114 deletions
diff --git a/tools/tools/net80211/stumbler/stumbler.c b/tools/tools/net80211/stumbler/stumbler.c index ebedd71..b649c30 100644 --- a/tools/tools/net80211/stumbler/stumbler.c +++ b/tools/tools/net80211/stumbler/stumbler.c @@ -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) { diff --git a/tools/tools/net80211/w00t/README b/tools/tools/net80211/w00t/README index 7620f8f..58e4fc1 100644 --- a/tools/tools/net80211/w00t/README +++ b/tools/tools/net80211/w00t/README @@ -4,7 +4,7 @@ This is a collection of tools that use raw 802.11 packet injection. 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: diff --git a/tools/tools/net80211/w00t/ap/ap.c b/tools/tools/net80211/w00t/ap/ap.c index 2b334ab..65f7adb 100644 --- a/tools/tools/net80211/w00t/ap/ap.c +++ b/tools/tools/net80211/w00t/ap/ap.c @@ -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; diff --git a/tools/tools/net80211/w00t/assoc/assoc.c b/tools/tools/net80211/w00t/assoc/assoc.c index 65853af..79aaef6 100644 --- a/tools/tools/net80211/w00t/assoc/assoc.c +++ b/tools/tools/net80211/w00t/assoc/assoc.c @@ -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; diff --git a/tools/tools/net80211/w00t/expand/expand.c b/tools/tools/net80211/w00t/expand/expand.c index fe37145..f2827d9 100644 --- a/tools/tools/net80211/w00t/expand/expand.c +++ b/tools/tools/net80211/w00t/expand/expand.c @@ -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; diff --git a/tools/tools/net80211/w00t/prga/prga.c b/tools/tools/net80211/w00t/prga/prga.c index 5672481..173dde7 100644 --- a/tools/tools/net80211/w00t/prga/prga.c +++ b/tools/tools/net80211/w00t/prga/prga.c @@ -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; diff --git a/tools/tools/net80211/w00t/redir/redir.c b/tools/tools/net80211/w00t/redir/redir.c index 77dc16d..9be363e 100644 --- a/tools/tools/net80211/w00t/redir/redir.c +++ b/tools/tools/net80211/w00t/redir/redir.c @@ -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; diff --git a/tools/tools/net80211/wesside/wesside/wesside.c b/tools/tools/net80211/wesside/wesside/wesside.c index 8106b64..6b276db 100644 --- a/tools/tools/net80211/wesside/wesside/wesside.c +++ b/tools/tools/net80211/wesside/wesside/wesside.c @@ -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"); } diff --git a/tools/tools/net80211/wlaninject/wlaninject.c b/tools/tools/net80211/wlaninject/wlaninject.c index b491da8..7527e94 100644 --- a/tools/tools/net80211/wlaninject/wlaninject.c +++ b/tools/tools/net80211/wlaninject/wlaninject.c @@ -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 *sent, int slen, void *got, int glen) int main(int argc, char *argv[]) { int fd, fd2; - char *iface = "ath0"; + char *iface = "wlan0"; char *verify = NULL; int chan = 1; struct { |