diff options
| author | Jeff Garzik <jeff@garzik.org> | 2006-06-08 15:48:25 -0400 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-06-08 15:48:25 -0400 |
| commit | ba9b28d19a3251bb1dfe6a6f8cc89b96fb85f683 (patch) | |
| tree | d770bd8c536771cb3804abb51ed029d7dd9d30d2 | |
| parent | 862fc81b62c2d41a7e0b97b90844c80e59c7b0f1 (diff) | |
| parent | 5c601d0c942f5aaf7f3cff7e08f61047d70a964e (diff) | |
Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6 into upstream
| -rw-r--r-- | drivers/net/wireless/Kconfig | 17 | ||||
| -rw-r--r-- | drivers/net/wireless/Makefile | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_main.c | 13 | ||||
| -rw-r--r-- | drivers/net/wireless/zd1201.c (renamed from drivers/usb/net/zd1201.c) | 67 | ||||
| -rw-r--r-- | drivers/net/wireless/zd1201.h (renamed from drivers/usb/net/zd1201.h) | 0 | ||||
| -rw-r--r-- | drivers/usb/net/Kconfig | 17 | ||||
| -rw-r--r-- | drivers/usb/net/Makefile | 1 | ||||
| -rw-r--r-- | include/net/ieee80211.h | 3 | ||||
| -rw-r--r-- | include/net/ieee80211softmac.h | 2 | ||||
| -rw-r--r-- | net/ieee80211/ieee80211_tx.c | 25 | ||||
| -rw-r--r-- | net/ieee80211/softmac/Kconfig | 1 | ||||
| -rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_assoc.c | 22 | ||||
| -rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_auth.c | 12 | ||||
| -rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_event.c | 5 | ||||
| -rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_io.c | 169 |
15 files changed, 180 insertions, 176 deletions
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index d7691c482835..30ec235e6935 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
| @@ -531,6 +531,23 @@ config PRISM54 | |||
| 531 | say M here and read <file:Documentation/modules.txt>. The module | 531 | say M here and read <file:Documentation/modules.txt>. The module |
| 532 | will be called prism54.ko. | 532 | will be called prism54.ko. |
| 533 | 533 | ||
| 534 | config USB_ZD1201 | ||
| 535 | tristate "USB ZD1201 based Wireless device support" | ||
| 536 | depends on USB && NET_RADIO | ||
| 537 | select FW_LOADER | ||
| 538 | ---help--- | ||
| 539 | Say Y if you want to use wireless LAN adapters based on the ZyDAS | ||
| 540 | ZD1201 chip. | ||
| 541 | |||
| 542 | This driver makes the adapter appear as a normal Ethernet interface, | ||
| 543 | typically on wlan0. | ||
| 544 | |||
| 545 | The zd1201 device requires external firmware to be loaded. | ||
| 546 | This can be found at http://linux-lc100020.sourceforge.net/ | ||
| 547 | |||
| 548 | To compile this driver as a module, choose M here: the | ||
| 549 | module will be called zd1201. | ||
| 550 | |||
| 534 | source "drivers/net/wireless/hostap/Kconfig" | 551 | source "drivers/net/wireless/hostap/Kconfig" |
| 535 | source "drivers/net/wireless/bcm43xx/Kconfig" | 552 | source "drivers/net/wireless/bcm43xx/Kconfig" |
| 536 | 553 | ||
diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile index c86779879361..512603de309a 100644 --- a/drivers/net/wireless/Makefile +++ b/drivers/net/wireless/Makefile | |||
| @@ -40,3 +40,5 @@ obj-$(CONFIG_BCM43XX) += bcm43xx/ | |||
| 40 | # 16-bit wireless PCMCIA client drivers | 40 | # 16-bit wireless PCMCIA client drivers |
| 41 | obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o | 41 | obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o |
| 42 | obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o | 42 | obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o |
| 43 | |||
| 44 | obj-$(CONFIG_USB_ZD1201) += zd1201.o | ||
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index c0502905a956..736dde96c4a3 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
| @@ -3555,7 +3555,7 @@ static void bcm43xx_ieee80211_set_security(struct net_device *net_dev, | |||
| 3555 | unsigned long flags; | 3555 | unsigned long flags; |
| 3556 | int keyidx; | 3556 | int keyidx; |
| 3557 | 3557 | ||
| 3558 | dprintk(KERN_INFO PFX "set security called\n"); | 3558 | dprintk(KERN_INFO PFX "set security called"); |
| 3559 | 3559 | ||
| 3560 | bcm43xx_lock_mmio(bcm, flags); | 3560 | bcm43xx_lock_mmio(bcm, flags); |
| 3561 | 3561 | ||
| @@ -3568,24 +3568,25 @@ static void bcm43xx_ieee80211_set_security(struct net_device *net_dev, | |||
| 3568 | 3568 | ||
| 3569 | if (sec->flags & SEC_ACTIVE_KEY) { | 3569 | if (sec->flags & SEC_ACTIVE_KEY) { |
| 3570 | secinfo->active_key = sec->active_key; | 3570 | secinfo->active_key = sec->active_key; |
| 3571 | dprintk(KERN_INFO PFX " .active_key = %d\n", sec->active_key); | 3571 | dprintk(", .active_key = %d", sec->active_key); |
| 3572 | } | 3572 | } |
| 3573 | if (sec->flags & SEC_UNICAST_GROUP) { | 3573 | if (sec->flags & SEC_UNICAST_GROUP) { |
| 3574 | secinfo->unicast_uses_group = sec->unicast_uses_group; | 3574 | secinfo->unicast_uses_group = sec->unicast_uses_group; |
| 3575 | dprintk(KERN_INFO PFX " .unicast_uses_group = %d\n", sec->unicast_uses_group); | 3575 | dprintk(", .unicast_uses_group = %d", sec->unicast_uses_group); |
| 3576 | } | 3576 | } |
| 3577 | if (sec->flags & SEC_LEVEL) { | 3577 | if (sec->flags & SEC_LEVEL) { |
| 3578 | secinfo->level = sec->level; | 3578 | secinfo->level = sec->level; |
| 3579 | dprintk(KERN_INFO PFX " .level = %d\n", sec->level); | 3579 | dprintk(", .level = %d", sec->level); |
| 3580 | } | 3580 | } |
| 3581 | if (sec->flags & SEC_ENABLED) { | 3581 | if (sec->flags & SEC_ENABLED) { |
| 3582 | secinfo->enabled = sec->enabled; | 3582 | secinfo->enabled = sec->enabled; |
| 3583 | dprintk(KERN_INFO PFX " .enabled = %d\n", sec->enabled); | 3583 | dprintk(", .enabled = %d", sec->enabled); |
| 3584 | } | 3584 | } |
| 3585 | if (sec->flags & SEC_ENCRYPT) { | 3585 | if (sec->flags & SEC_ENCRYPT) { |
| 3586 | secinfo->encrypt = sec->encrypt; | 3586 | secinfo->encrypt = sec->encrypt; |
| 3587 | dprintk(KERN_INFO PFX " .encrypt = %d\n", sec->encrypt); | 3587 | dprintk(", .encrypt = %d", sec->encrypt); |
| 3588 | } | 3588 | } |
| 3589 | dprintk("\n"); | ||
| 3589 | if (bcm->initialized && !bcm->ieee->host_encrypt) { | 3590 | if (bcm->initialized && !bcm->ieee->host_encrypt) { |
| 3590 | if (secinfo->enabled) { | 3591 | if (secinfo->enabled) { |
| 3591 | /* upload WEP keys to hardware */ | 3592 | /* upload WEP keys to hardware */ |
diff --git a/drivers/usb/net/zd1201.c b/drivers/net/wireless/zd1201.c index 9b1e4ed1d07e..662ecc8a33ff 100644 --- a/drivers/usb/net/zd1201.c +++ b/drivers/net/wireless/zd1201.c | |||
| @@ -33,7 +33,7 @@ static struct usb_device_id zd1201_table[] = { | |||
| 33 | {} | 33 | {} |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | static int ap = 0; /* Are we an AP or a normal station? */ | 36 | static int ap; /* Are we an AP or a normal station? */ |
| 37 | 37 | ||
| 38 | #define ZD1201_VERSION "0.15" | 38 | #define ZD1201_VERSION "0.15" |
| 39 | 39 | ||
| @@ -49,7 +49,7 @@ MODULE_DEVICE_TABLE(usb, zd1201_table); | |||
| 49 | static int zd1201_fw_upload(struct usb_device *dev, int apfw) | 49 | static int zd1201_fw_upload(struct usb_device *dev, int apfw) |
| 50 | { | 50 | { |
| 51 | const struct firmware *fw_entry; | 51 | const struct firmware *fw_entry; |
| 52 | char* data; | 52 | char *data; |
| 53 | unsigned long len; | 53 | unsigned long len; |
| 54 | int err; | 54 | int err; |
| 55 | unsigned char ret; | 55 | unsigned char ret; |
| @@ -65,7 +65,7 @@ static int zd1201_fw_upload(struct usb_device *dev, int apfw) | |||
| 65 | if (err) { | 65 | if (err) { |
| 66 | dev_err(&dev->dev, "Failed to load %s firmware file!\n", fwfile); | 66 | dev_err(&dev->dev, "Failed to load %s firmware file!\n", fwfile); |
| 67 | dev_err(&dev->dev, "Make sure the hotplug firmware loader is installed.\n"); | 67 | dev_err(&dev->dev, "Make sure the hotplug firmware loader is installed.\n"); |
| 68 | dev_err(&dev->dev, "Goto http://linux-lc100020.sourceforge.net for more info\n"); | 68 | dev_err(&dev->dev, "Goto http://linux-lc100020.sourceforge.net for more info.\n"); |
| 69 | return err; | 69 | return err; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| @@ -94,12 +94,12 @@ static int zd1201_fw_upload(struct usb_device *dev, int apfw) | |||
| 94 | USB_DIR_OUT | 0x40, 0, 0, NULL, 0, ZD1201_FW_TIMEOUT); | 94 | USB_DIR_OUT | 0x40, 0, 0, NULL, 0, ZD1201_FW_TIMEOUT); |
| 95 | if (err < 0) | 95 | if (err < 0) |
| 96 | goto exit; | 96 | goto exit; |
| 97 | 97 | ||
| 98 | err = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 0x4, | 98 | err = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 0x4, |
| 99 | USB_DIR_IN | 0x40, 0,0, &ret, sizeof(ret), ZD1201_FW_TIMEOUT); | 99 | USB_DIR_IN | 0x40, 0,0, &ret, sizeof(ret), ZD1201_FW_TIMEOUT); |
| 100 | if (err < 0) | 100 | if (err < 0) |
| 101 | goto exit; | 101 | goto exit; |
| 102 | 102 | ||
| 103 | if (ret & 0x80) { | 103 | if (ret & 0x80) { |
| 104 | err = -EIO; | 104 | err = -EIO; |
| 105 | goto exit; | 105 | goto exit; |
| @@ -166,13 +166,13 @@ static int zd1201_docmd(struct zd1201 *zd, int cmd, int parm0, | |||
| 166 | return -ENOMEM; | 166 | return -ENOMEM; |
| 167 | } | 167 | } |
| 168 | usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb, zd->endp_out2), | 168 | usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb, zd->endp_out2), |
| 169 | command, 16, zd1201_usbfree, zd); | 169 | command, 16, zd1201_usbfree, zd); |
| 170 | ret = usb_submit_urb(urb, GFP_ATOMIC); | 170 | ret = usb_submit_urb(urb, GFP_ATOMIC); |
| 171 | if (ret) { | 171 | if (ret) { |
| 172 | kfree(command); | 172 | kfree(command); |
| 173 | usb_free_urb(urb); | 173 | usb_free_urb(urb); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | return ret; | 176 | return ret; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| @@ -316,7 +316,7 @@ static void zd1201_usbrx(struct urb *urb, struct pt_regs *regs) | |||
| 316 | fc = le16_to_cpu(*(__le16 *)&data[datalen-16]); | 316 | fc = le16_to_cpu(*(__le16 *)&data[datalen-16]); |
| 317 | seq = le16_to_cpu(*(__le16 *)&data[datalen-24]); | 317 | seq = le16_to_cpu(*(__le16 *)&data[datalen-24]); |
| 318 | 318 | ||
| 319 | if(zd->monitor) { | 319 | if (zd->monitor) { |
| 320 | if (datalen < 24) | 320 | if (datalen < 24) |
| 321 | goto resubmit; | 321 | goto resubmit; |
| 322 | if (!(skb = dev_alloc_skb(datalen+24))) | 322 | if (!(skb = dev_alloc_skb(datalen+24))) |
| @@ -364,7 +364,7 @@ static void zd1201_usbrx(struct urb *urb, struct pt_regs *regs) | |||
| 364 | goto resubmit; | 364 | goto resubmit; |
| 365 | } | 365 | } |
| 366 | hlist_for_each_entry(frag, node, &zd->fraglist, fnode) | 366 | hlist_for_each_entry(frag, node, &zd->fraglist, fnode) |
| 367 | if(frag->seq == (seq&IEEE80211_SCTL_SEQ)) | 367 | if (frag->seq == (seq&IEEE80211_SCTL_SEQ)) |
| 368 | break; | 368 | break; |
| 369 | if (!frag) | 369 | if (!frag) |
| 370 | goto resubmit; | 370 | goto resubmit; |
| @@ -376,7 +376,6 @@ static void zd1201_usbrx(struct urb *urb, struct pt_regs *regs) | |||
| 376 | goto resubmit; | 376 | goto resubmit; |
| 377 | hlist_del_init(&frag->fnode); | 377 | hlist_del_init(&frag->fnode); |
| 378 | kfree(frag); | 378 | kfree(frag); |
| 379 | /* Fallthrough */ | ||
| 380 | } else { | 379 | } else { |
| 381 | if (datalen<14) | 380 | if (datalen<14) |
| 382 | goto resubmit; | 381 | goto resubmit; |
| @@ -422,7 +421,7 @@ static int zd1201_getconfig(struct zd1201 *zd, int rid, void *riddata, | |||
| 422 | int rid_fid; | 421 | int rid_fid; |
| 423 | int length; | 422 | int length; |
| 424 | unsigned char *pdata; | 423 | unsigned char *pdata; |
| 425 | 424 | ||
| 426 | zd->rxdatas = 0; | 425 | zd->rxdatas = 0; |
| 427 | err = zd1201_docmd(zd, ZD1201_CMDCODE_ACCESS, rid, 0, 0); | 426 | err = zd1201_docmd(zd, ZD1201_CMDCODE_ACCESS, rid, 0, 0); |
| 428 | if (err) | 427 | if (err) |
| @@ -471,11 +470,11 @@ static int zd1201_getconfig(struct zd1201 *zd, int rid, void *riddata, | |||
| 471 | length = zd->rxlen; | 470 | length = zd->rxlen; |
| 472 | 471 | ||
| 473 | do { | 472 | do { |
| 474 | int actual_length; | 473 | int actual_length; |
| 475 | 474 | ||
| 476 | actual_length = (length > 64) ? 64 : length; | 475 | actual_length = (length > 64) ? 64 : length; |
| 477 | 476 | ||
| 478 | if(pdata[0] != 0x3) { | 477 | if (pdata[0] != 0x3) { |
| 479 | dev_dbg(&zd->usb->dev, "Rx Resource packet type error: %02X\n", | 478 | dev_dbg(&zd->usb->dev, "Rx Resource packet type error: %02X\n", |
| 480 | pdata[0]); | 479 | pdata[0]); |
| 481 | return -EINVAL; | 480 | return -EINVAL; |
| @@ -487,11 +486,10 @@ static int zd1201_getconfig(struct zd1201 *zd, int rid, void *riddata, | |||
| 487 | } | 486 | } |
| 488 | 487 | ||
| 489 | /* Skip the 4 bytes header (RID length and RID) */ | 488 | /* Skip the 4 bytes header (RID length and RID) */ |
| 490 | if(i == 0) { | 489 | if (i == 0) { |
| 491 | pdata += 8; | 490 | pdata += 8; |
| 492 | actual_length -= 8; | 491 | actual_length -= 8; |
| 493 | } | 492 | } else { |
| 494 | else { | ||
| 495 | pdata += 4; | 493 | pdata += 4; |
| 496 | actual_length -= 4; | 494 | actual_length -= 4; |
| 497 | } | 495 | } |
| @@ -620,7 +618,7 @@ static int zd1201_drvr_start(struct zd1201 *zd) | |||
| 620 | short max; | 618 | short max; |
| 621 | __le16 zdmax; | 619 | __le16 zdmax; |
| 622 | unsigned char *buffer; | 620 | unsigned char *buffer; |
| 623 | 621 | ||
| 624 | buffer = kzalloc(ZD1201_RXSIZE, GFP_KERNEL); | 622 | buffer = kzalloc(ZD1201_RXSIZE, GFP_KERNEL); |
| 625 | if (!buffer) | 623 | if (!buffer) |
| 626 | return -ENOMEM; | 624 | return -ENOMEM; |
| @@ -632,7 +630,7 @@ static int zd1201_drvr_start(struct zd1201 *zd) | |||
| 632 | err = usb_submit_urb(zd->rx_urb, GFP_KERNEL); | 630 | err = usb_submit_urb(zd->rx_urb, GFP_KERNEL); |
| 633 | if (err) | 631 | if (err) |
| 634 | goto err_buffer; | 632 | goto err_buffer; |
| 635 | 633 | ||
| 636 | err = zd1201_docmd(zd, ZD1201_CMDCODE_INIT, 0, 0, 0); | 634 | err = zd1201_docmd(zd, ZD1201_CMDCODE_INIT, 0, 0, 0); |
| 637 | if (err) | 635 | if (err) |
| 638 | goto err_urb; | 636 | goto err_urb; |
| @@ -684,7 +682,7 @@ static int zd1201_enable(struct zd1201 *zd) | |||
| 684 | static int zd1201_disable(struct zd1201 *zd) | 682 | static int zd1201_disable(struct zd1201 *zd) |
| 685 | { | 683 | { |
| 686 | int err; | 684 | int err; |
| 687 | 685 | ||
| 688 | if (!zd->mac_enabled) | 686 | if (!zd->mac_enabled) |
| 689 | return 0; | 687 | return 0; |
| 690 | if (zd->monitor) { | 688 | if (zd->monitor) { |
| @@ -764,7 +762,6 @@ static int zd1201_net_open(struct net_device *dev) | |||
| 764 | static int zd1201_net_stop(struct net_device *dev) | 762 | static int zd1201_net_stop(struct net_device *dev) |
| 765 | { | 763 | { |
| 766 | netif_stop_queue(dev); | 764 | netif_stop_queue(dev); |
| 767 | |||
| 768 | return 0; | 765 | return 0; |
| 769 | } | 766 | } |
| 770 | 767 | ||
| @@ -915,7 +912,6 @@ static int zd1201_get_name(struct net_device *dev, | |||
| 915 | struct iw_request_info *info, char *name, char *extra) | 912 | struct iw_request_info *info, char *name, char *extra) |
| 916 | { | 913 | { |
| 917 | strcpy(name, "IEEE 802.11b"); | 914 | strcpy(name, "IEEE 802.11b"); |
| 918 | |||
| 919 | return 0; | 915 | return 0; |
| 920 | } | 916 | } |
| 921 | 917 | ||
| @@ -1013,11 +1009,10 @@ static int zd1201_set_mode(struct net_device *dev, | |||
| 1013 | if (err) | 1009 | if (err) |
| 1014 | return err; | 1010 | return err; |
| 1015 | } | 1011 | } |
| 1016 | zd->monitor=monitor; | 1012 | zd->monitor = monitor; |
| 1017 | /* If monitor mode is set we don't actually turn it on here since it | 1013 | /* If monitor mode is set we don't actually turn it on here since it |
| 1018 | * is done during mac reset anyway (see zd1201_mac_enable). | 1014 | * is done during mac reset anyway (see zd1201_mac_enable). |
| 1019 | */ | 1015 | */ |
| 1020 | |||
| 1021 | zd1201_mac_reset(zd); | 1016 | zd1201_mac_reset(zd); |
| 1022 | 1017 | ||
| 1023 | return 0; | 1018 | return 0; |
| @@ -1117,7 +1112,7 @@ static int zd1201_get_wap(struct net_device *dev, | |||
| 1117 | zd->iwstats.qual.updated = 2; | 1112 | zd->iwstats.qual.updated = 2; |
| 1118 | } | 1113 | } |
| 1119 | 1114 | ||
| 1120 | return zd1201_getconfig(zd,ZD1201_RID_CURRENTBSSID,ap_addr->sa_data,6); | 1115 | return zd1201_getconfig(zd, ZD1201_RID_CURRENTBSSID, ap_addr->sa_data, 6); |
| 1121 | } | 1116 | } |
| 1122 | 1117 | ||
| 1123 | static int zd1201_set_scan(struct net_device *dev, | 1118 | static int zd1201_set_scan(struct net_device *dev, |
| @@ -1275,7 +1270,7 @@ static int zd1201_set_rate(struct net_device *dev, | |||
| 1275 | if (!rrq->fixed) { /* Also enable all lower bitrates */ | 1270 | if (!rrq->fixed) { /* Also enable all lower bitrates */ |
| 1276 | rate |= rate-1; | 1271 | rate |= rate-1; |
| 1277 | } | 1272 | } |
| 1278 | 1273 | ||
| 1279 | err = zd1201_setconfig16(zd, ZD1201_RID_TXRATECNTL, rate); | 1274 | err = zd1201_setconfig16(zd, ZD1201_RID_TXRATECNTL, rate); |
| 1280 | if (err) | 1275 | if (err) |
| 1281 | return err; | 1276 | return err; |
| @@ -1486,7 +1481,7 @@ static int zd1201_get_encode(struct net_device *dev, | |||
| 1486 | return -EINVAL; | 1481 | return -EINVAL; |
| 1487 | 1482 | ||
| 1488 | erq->flags |= i+1; | 1483 | erq->flags |= i+1; |
| 1489 | 1484 | ||
| 1490 | erq->length = zd->encode_keylen[i]; | 1485 | erq->length = zd->encode_keylen[i]; |
| 1491 | memcpy(key, zd->encode_keys[i], erq->length); | 1486 | memcpy(key, zd->encode_keys[i], erq->length); |
| 1492 | 1487 | ||
| @@ -1529,11 +1524,7 @@ static int zd1201_set_power(struct net_device *dev, | |||
| 1529 | return -EINVAL; | 1524 | return -EINVAL; |
| 1530 | } | 1525 | } |
| 1531 | out: | 1526 | out: |
| 1532 | err = zd1201_setconfig16(zd, ZD1201_RID_CNFPMENABLED, enabled); | 1527 | return zd1201_setconfig16(zd, ZD1201_RID_CNFPMENABLED, enabled); |
| 1533 | if (err) | ||
| 1534 | return err; | ||
| 1535 | |||
| 1536 | return 0; | ||
| 1537 | } | 1528 | } |
| 1538 | 1529 | ||
| 1539 | static int zd1201_get_power(struct net_device *dev, | 1530 | static int zd1201_get_power(struct net_device *dev, |
| @@ -1627,15 +1618,11 @@ static int zd1201_set_hostauth(struct net_device *dev, | |||
| 1627 | struct iw_request_info *info, struct iw_param *rrq, char *extra) | 1618 | struct iw_request_info *info, struct iw_param *rrq, char *extra) |
| 1628 | { | 1619 | { |
| 1629 | struct zd1201 *zd = (struct zd1201 *)dev->priv; | 1620 | struct zd1201 *zd = (struct zd1201 *)dev->priv; |
| 1630 | int err; | ||
| 1631 | 1621 | ||
| 1632 | if (!zd->ap) | 1622 | if (!zd->ap) |
| 1633 | return -EOPNOTSUPP; | 1623 | return -EOPNOTSUPP; |
| 1634 | 1624 | ||
| 1635 | err = zd1201_setconfig16(zd, ZD1201_RID_CNFHOSTAUTH, rrq->value); | 1625 | return zd1201_setconfig16(zd, ZD1201_RID_CNFHOSTAUTH, rrq->value); |
| 1636 | if (err) | ||
| 1637 | return err; | ||
| 1638 | return 0; | ||
| 1639 | } | 1626 | } |
| 1640 | 1627 | ||
| 1641 | static int zd1201_get_hostauth(struct net_device *dev, | 1628 | static int zd1201_get_hostauth(struct net_device *dev, |
| @@ -1744,7 +1731,7 @@ static int zd1201_probe(struct usb_interface *interface, | |||
| 1744 | { | 1731 | { |
| 1745 | struct zd1201 *zd; | 1732 | struct zd1201 *zd; |
| 1746 | struct usb_device *usb; | 1733 | struct usb_device *usb; |
| 1747 | int i, err; | 1734 | int err; |
| 1748 | short porttype; | 1735 | short porttype; |
| 1749 | char buf[IW_ESSID_MAX_SIZE+2]; | 1736 | char buf[IW_ESSID_MAX_SIZE+2]; |
| 1750 | 1737 | ||
| @@ -1773,9 +1760,7 @@ static int zd1201_probe(struct usb_interface *interface, | |||
| 1773 | if (!zd->rx_urb || !zd->tx_urb) | 1760 | if (!zd->rx_urb || !zd->tx_urb) |
| 1774 | goto err_zd; | 1761 | goto err_zd; |
| 1775 | 1762 | ||
| 1776 | for(i = 0; i<100; i++) | 1763 | mdelay(100); |
| 1777 | udelay(1000); | ||
| 1778 | |||
| 1779 | err = zd1201_drvr_start(zd); | 1764 | err = zd1201_drvr_start(zd); |
| 1780 | if (err) | 1765 | if (err) |
| 1781 | goto err_zd; | 1766 | goto err_zd; |
| @@ -1833,7 +1818,7 @@ static int zd1201_probe(struct usb_interface *interface, | |||
| 1833 | goto err_net; | 1818 | goto err_net; |
| 1834 | dev_info(&usb->dev, "%s: ZD1201 USB Wireless interface\n", | 1819 | dev_info(&usb->dev, "%s: ZD1201 USB Wireless interface\n", |
| 1835 | zd->dev->name); | 1820 | zd->dev->name); |
| 1836 | 1821 | ||
| 1837 | usb_set_intfdata(interface, zd); | 1822 | usb_set_intfdata(interface, zd); |
| 1838 | return 0; | 1823 | return 0; |
| 1839 | 1824 | ||
diff --git a/drivers/usb/net/zd1201.h b/drivers/net/wireless/zd1201.h index 235f0ee34b24..235f0ee34b24 100644 --- a/drivers/usb/net/zd1201.h +++ b/drivers/net/wireless/zd1201.h | |||
diff --git a/drivers/usb/net/Kconfig b/drivers/usb/net/Kconfig index efd6ca7e4ac5..054059632a21 100644 --- a/drivers/usb/net/Kconfig +++ b/drivers/usb/net/Kconfig | |||
| @@ -301,21 +301,4 @@ config USB_NET_ZAURUS | |||
| 301 | some cases CDC MDLM) protocol, not "g_ether". | 301 | some cases CDC MDLM) protocol, not "g_ether". |
| 302 | 302 | ||
| 303 | 303 | ||
| 304 | config USB_ZD1201 | ||
| 305 | tristate "USB ZD1201 based Wireless device support" | ||
| 306 | depends on NET_RADIO | ||
| 307 | select FW_LOADER | ||
| 308 | ---help--- | ||
| 309 | Say Y if you want to use wireless LAN adapters based on the ZyDAS | ||
| 310 | ZD1201 chip. | ||
| 311 | |||
| 312 | This driver makes the adapter appear as a normal Ethernet interface, | ||
| 313 | typically on wlan0. | ||
| 314 | |||
| 315 | The zd1201 device requires external firmware to be loaded. | ||
| 316 | This can be found at http://linux-lc100020.sourceforge.net/ | ||
| 317 | |||
| 318 | To compile this driver as a module, choose M here: the | ||
| 319 | module will be called zd1201. | ||
| 320 | |||
| 321 | endmenu | 304 | endmenu |
diff --git a/drivers/usb/net/Makefile b/drivers/usb/net/Makefile index a21e6eaabaf6..160f19dbdf12 100644 --- a/drivers/usb/net/Makefile +++ b/drivers/usb/net/Makefile | |||
| @@ -15,7 +15,6 @@ obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o | |||
| 15 | obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o | 15 | obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o |
| 16 | obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o | 16 | obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o |
| 17 | obj-$(CONFIG_USB_USBNET) += usbnet.o | 17 | obj-$(CONFIG_USB_USBNET) += usbnet.o |
| 18 | obj-$(CONFIG_USB_ZD1201) += zd1201.o | ||
| 19 | 18 | ||
| 20 | ifeq ($(CONFIG_USB_DEBUG),y) | 19 | ifeq ($(CONFIG_USB_DEBUG),y) |
| 21 | EXTRA_CFLAGS += -DDEBUG | 20 | EXTRA_CFLAGS += -DDEBUG |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index 293e920ca59d..d5147770ad47 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
| @@ -1247,7 +1247,8 @@ extern int ieee80211_set_encryption(struct ieee80211_device *ieee); | |||
| 1247 | extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev); | 1247 | extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev); |
| 1248 | extern void ieee80211_txb_free(struct ieee80211_txb *); | 1248 | extern void ieee80211_txb_free(struct ieee80211_txb *); |
| 1249 | extern int ieee80211_tx_frame(struct ieee80211_device *ieee, | 1249 | extern int ieee80211_tx_frame(struct ieee80211_device *ieee, |
| 1250 | struct ieee80211_hdr *frame, int len); | 1250 | struct ieee80211_hdr *frame, int hdr_len, |
| 1251 | int total_len, int encrypt_mpdu); | ||
| 1251 | 1252 | ||
| 1252 | /* ieee80211_rx.c */ | 1253 | /* ieee80211_rx.c */ |
| 1253 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | 1254 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, |
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h index 703463a8828b..7a483ab4022f 100644 --- a/include/net/ieee80211softmac.h +++ b/include/net/ieee80211softmac.h | |||
| @@ -310,7 +310,7 @@ extern void ieee80211softmac_stop(struct net_device *dev); | |||
| 310 | * - context set to the context data you want passed | 310 | * - context set to the context data you want passed |
| 311 | * The return value is 0, or an error. | 311 | * The return value is 0, or an error. |
| 312 | */ | 312 | */ |
| 313 | typedef void (*notify_function_ptr)(struct net_device *dev, void *context); | 313 | typedef void (*notify_function_ptr)(struct net_device *dev, int event_type, void *context); |
| 314 | 314 | ||
| 315 | #define ieee80211softmac_notify(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_KERNEL); | 315 | #define ieee80211softmac_notify(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_KERNEL); |
| 316 | #define ieee80211softmac_notify_atomic(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_ATOMIC); | 316 | #define ieee80211softmac_notify_atomic(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_ATOMIC); |
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index 233d527c6953..6a5de1b84459 100644 --- a/net/ieee80211/ieee80211_tx.c +++ b/net/ieee80211/ieee80211_tx.c | |||
| @@ -555,7 +555,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 555 | /* Incoming 802.11 strucure is converted to a TXB | 555 | /* Incoming 802.11 strucure is converted to a TXB |
| 556 | * a block of 802.11 fragment packets (stored as skbs) */ | 556 | * a block of 802.11 fragment packets (stored as skbs) */ |
| 557 | int ieee80211_tx_frame(struct ieee80211_device *ieee, | 557 | int ieee80211_tx_frame(struct ieee80211_device *ieee, |
| 558 | struct ieee80211_hdr *frame, int len) | 558 | struct ieee80211_hdr *frame, int hdr_len, int total_len, |
| 559 | int encrypt_mpdu) | ||
| 559 | { | 560 | { |
| 560 | struct ieee80211_txb *txb = NULL; | 561 | struct ieee80211_txb *txb = NULL; |
| 561 | unsigned long flags; | 562 | unsigned long flags; |
| @@ -565,6 +566,9 @@ int ieee80211_tx_frame(struct ieee80211_device *ieee, | |||
| 565 | 566 | ||
| 566 | spin_lock_irqsave(&ieee->lock, flags); | 567 | spin_lock_irqsave(&ieee->lock, flags); |
| 567 | 568 | ||
| 569 | if (encrypt_mpdu && !ieee->sec.encrypt) | ||
| 570 | encrypt_mpdu = 0; | ||
| 571 | |||
| 568 | /* If there is no driver handler to take the TXB, dont' bother | 572 | /* If there is no driver handler to take the TXB, dont' bother |
| 569 | * creating it... */ | 573 | * creating it... */ |
| 570 | if (!ieee->hard_start_xmit) { | 574 | if (!ieee->hard_start_xmit) { |
| @@ -572,32 +576,41 @@ int ieee80211_tx_frame(struct ieee80211_device *ieee, | |||
| 572 | goto success; | 576 | goto success; |
| 573 | } | 577 | } |
| 574 | 578 | ||
| 575 | if (unlikely(len < 24)) { | 579 | if (unlikely(total_len < 24)) { |
| 576 | printk(KERN_WARNING "%s: skb too small (%d).\n", | 580 | printk(KERN_WARNING "%s: skb too small (%d).\n", |
| 577 | ieee->dev->name, len); | 581 | ieee->dev->name, total_len); |
| 578 | goto success; | 582 | goto success; |
| 579 | } | 583 | } |
| 580 | 584 | ||
| 585 | if (encrypt_mpdu) | ||
| 586 | frame->frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | ||
| 587 | |||
| 581 | /* When we allocate the TXB we allocate enough space for the reserve | 588 | /* When we allocate the TXB we allocate enough space for the reserve |
| 582 | * and full fragment bytes (bytes_per_frag doesn't include prefix, | 589 | * and full fragment bytes (bytes_per_frag doesn't include prefix, |
| 583 | * postfix, header, FCS, etc.) */ | 590 | * postfix, header, FCS, etc.) */ |
| 584 | txb = ieee80211_alloc_txb(1, len, ieee->tx_headroom, GFP_ATOMIC); | 591 | txb = ieee80211_alloc_txb(1, total_len, ieee->tx_headroom, GFP_ATOMIC); |
| 585 | if (unlikely(!txb)) { | 592 | if (unlikely(!txb)) { |
| 586 | printk(KERN_WARNING "%s: Could not allocate TXB\n", | 593 | printk(KERN_WARNING "%s: Could not allocate TXB\n", |
| 587 | ieee->dev->name); | 594 | ieee->dev->name); |
| 588 | goto failed; | 595 | goto failed; |
| 589 | } | 596 | } |
| 590 | txb->encrypted = 0; | 597 | txb->encrypted = 0; |
| 591 | txb->payload_size = len; | 598 | txb->payload_size = total_len; |
| 592 | 599 | ||
| 593 | skb_frag = txb->fragments[0]; | 600 | skb_frag = txb->fragments[0]; |
| 594 | 601 | ||
| 595 | memcpy(skb_put(skb_frag, len), frame, len); | 602 | memcpy(skb_put(skb_frag, total_len), frame, total_len); |
| 596 | 603 | ||
| 597 | if (ieee->config & | 604 | if (ieee->config & |
| 598 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) | 605 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) |
| 599 | skb_put(skb_frag, 4); | 606 | skb_put(skb_frag, 4); |
| 600 | 607 | ||
| 608 | /* To avoid overcomplicating things, we do the corner-case frame | ||
| 609 | * encryption in software. The only real situation where encryption is | ||
| 610 | * needed here is during software-based shared key authentication. */ | ||
| 611 | if (encrypt_mpdu) | ||
| 612 | ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); | ||
| 613 | |||
| 601 | success: | 614 | success: |
| 602 | spin_unlock_irqrestore(&ieee->lock, flags); | 615 | spin_unlock_irqrestore(&ieee->lock, flags); |
| 603 | 616 | ||
diff --git a/net/ieee80211/softmac/Kconfig b/net/ieee80211/softmac/Kconfig index f2a27cc6ecb1..2811651cb134 100644 --- a/net/ieee80211/softmac/Kconfig +++ b/net/ieee80211/softmac/Kconfig | |||
| @@ -2,6 +2,7 @@ config IEEE80211_SOFTMAC | |||
| 2 | tristate "Software MAC add-on to the IEEE 802.11 networking stack" | 2 | tristate "Software MAC add-on to the IEEE 802.11 networking stack" |
| 3 | depends on IEEE80211 && EXPERIMENTAL | 3 | depends on IEEE80211 && EXPERIMENTAL |
| 4 | select WIRELESS_EXT | 4 | select WIRELESS_EXT |
| 5 | select IEEE80211_CRYPT_WEP | ||
| 5 | ---help--- | 6 | ---help--- |
| 6 | This option enables the hardware independent software MAC addon | 7 | This option enables the hardware independent software MAC addon |
| 7 | for the IEEE 802.11 networking stack. | 8 | for the IEEE 802.11 networking stack. |
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c index 5d90b9a6ee50..5e9a90651d04 100644 --- a/net/ieee80211/softmac/ieee80211softmac_assoc.c +++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c | |||
| @@ -164,12 +164,28 @@ network_matches_request(struct ieee80211softmac_device *mac, struct ieee80211_ne | |||
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | static void | 166 | static void |
| 167 | ieee80211softmac_assoc_notify(struct net_device *dev, void *context) | 167 | ieee80211softmac_assoc_notify_scan(struct net_device *dev, int event_type, void *context) |
| 168 | { | 168 | { |
| 169 | struct ieee80211softmac_device *mac = ieee80211_priv(dev); | 169 | struct ieee80211softmac_device *mac = ieee80211_priv(dev); |
| 170 | ieee80211softmac_assoc_work((void*)mac); | 170 | ieee80211softmac_assoc_work((void*)mac); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | static void | ||
| 174 | ieee80211softmac_assoc_notify_auth(struct net_device *dev, int event_type, void *context) | ||
| 175 | { | ||
| 176 | struct ieee80211softmac_device *mac = ieee80211_priv(dev); | ||
| 177 | |||
| 178 | switch (event_type) { | ||
| 179 | case IEEE80211SOFTMAC_EVENT_AUTHENTICATED: | ||
| 180 | ieee80211softmac_assoc_work((void*)mac); | ||
| 181 | break; | ||
| 182 | case IEEE80211SOFTMAC_EVENT_AUTH_FAILED: | ||
| 183 | case IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT: | ||
| 184 | ieee80211softmac_disassoc(mac); | ||
| 185 | break; | ||
| 186 | } | ||
| 187 | } | ||
| 188 | |||
| 173 | /* This function is called to handle userspace requests (asynchronously) */ | 189 | /* This function is called to handle userspace requests (asynchronously) */ |
| 174 | void | 190 | void |
| 175 | ieee80211softmac_assoc_work(void *d) | 191 | ieee80211softmac_assoc_work(void *d) |
| @@ -249,7 +265,7 @@ ieee80211softmac_assoc_work(void *d) | |||
| 249 | * Maybe we can hope to have more memory after scanning finishes ;) | 265 | * Maybe we can hope to have more memory after scanning finishes ;) |
| 250 | */ | 266 | */ |
| 251 | dprintk(KERN_INFO PFX "Associate: Scanning for networks first.\n"); | 267 | dprintk(KERN_INFO PFX "Associate: Scanning for networks first.\n"); |
| 252 | ieee80211softmac_notify(mac->dev, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, ieee80211softmac_assoc_notify, NULL); | 268 | ieee80211softmac_notify(mac->dev, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, ieee80211softmac_assoc_notify_scan, NULL); |
| 253 | if (ieee80211softmac_start_scan(mac)) | 269 | if (ieee80211softmac_start_scan(mac)) |
| 254 | dprintk(KERN_INFO PFX "Associate: failed to initiate scan. Is device up?\n"); | 270 | dprintk(KERN_INFO PFX "Associate: failed to initiate scan. Is device up?\n"); |
| 255 | return; | 271 | return; |
| @@ -284,7 +300,7 @@ ieee80211softmac_assoc_work(void *d) | |||
| 284 | * otherwise adding the notification would be racy. */ | 300 | * otherwise adding the notification would be racy. */ |
| 285 | if (!ieee80211softmac_auth_req(mac, found)) { | 301 | if (!ieee80211softmac_auth_req(mac, found)) { |
| 286 | dprintk(KERN_INFO PFX "cannot associate without being authenticated, requested authentication\n"); | 302 | dprintk(KERN_INFO PFX "cannot associate without being authenticated, requested authentication\n"); |
| 287 | ieee80211softmac_notify_internal(mac, IEEE80211SOFTMAC_EVENT_ANY, found, ieee80211softmac_assoc_notify, NULL, GFP_KERNEL); | 303 | ieee80211softmac_notify_internal(mac, IEEE80211SOFTMAC_EVENT_ANY, found, ieee80211softmac_assoc_notify_auth, NULL, GFP_KERNEL); |
| 288 | } else { | 304 | } else { |
| 289 | printkl(KERN_WARNING PFX "Not authenticated, but requesting authentication failed. Giving up to associate\n"); | 305 | printkl(KERN_WARNING PFX "Not authenticated, but requesting authentication failed. Giving up to associate\n"); |
| 290 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED, found); | 306 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED, found); |
diff --git a/net/ieee80211/softmac/ieee80211softmac_auth.c b/net/ieee80211/softmac/ieee80211softmac_auth.c index 084b6211f293..90b8484e509b 100644 --- a/net/ieee80211/softmac/ieee80211softmac_auth.c +++ b/net/ieee80211/softmac/ieee80211softmac_auth.c | |||
| @@ -107,6 +107,7 @@ ieee80211softmac_auth_queue(void *data) | |||
| 107 | printkl(KERN_WARNING PFX "Authentication timed out with "MAC_FMT"\n", MAC_ARG(net->bssid)); | 107 | printkl(KERN_WARNING PFX "Authentication timed out with "MAC_FMT"\n", MAC_ARG(net->bssid)); |
| 108 | /* Remove this item from the queue */ | 108 | /* Remove this item from the queue */ |
| 109 | spin_lock_irqsave(&mac->lock, flags); | 109 | spin_lock_irqsave(&mac->lock, flags); |
| 110 | net->authenticating = 0; | ||
| 110 | ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT, net); | 111 | ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT, net); |
| 111 | cancel_delayed_work(&auth->work); /* just to make sure... */ | 112 | cancel_delayed_work(&auth->work); /* just to make sure... */ |
| 112 | list_del(&auth->list); | 113 | list_del(&auth->list); |
| @@ -212,13 +213,13 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) | |||
| 212 | aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE; | 213 | aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE; |
| 213 | spin_unlock_irqrestore(&mac->lock, flags); | 214 | spin_unlock_irqrestore(&mac->lock, flags); |
| 214 | 215 | ||
| 215 | /* Switch to correct channel for this network */ | 216 | /* Send our response */ |
| 216 | mac->set_channel(mac->dev, net->channel); | ||
| 217 | |||
| 218 | /* Send our response (How to encrypt?) */ | ||
| 219 | ieee80211softmac_send_mgt_frame(mac, aq->net, IEEE80211_STYPE_AUTH, aq->state); | 217 | ieee80211softmac_send_mgt_frame(mac, aq->net, IEEE80211_STYPE_AUTH, aq->state); |
| 220 | break; | 218 | return 0; |
| 221 | case IEEE80211SOFTMAC_AUTH_SHARED_PASS: | 219 | case IEEE80211SOFTMAC_AUTH_SHARED_PASS: |
| 220 | kfree(net->challenge); | ||
| 221 | net->challenge = NULL; | ||
| 222 | net->challenge_len = 0; | ||
| 222 | /* Check the status code of the response */ | 223 | /* Check the status code of the response */ |
| 223 | switch(auth->status) { | 224 | switch(auth->status) { |
| 224 | case WLAN_STATUS_SUCCESS: | 225 | case WLAN_STATUS_SUCCESS: |
| @@ -229,6 +230,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) | |||
| 229 | spin_unlock_irqrestore(&mac->lock, flags); | 230 | spin_unlock_irqrestore(&mac->lock, flags); |
| 230 | printkl(KERN_NOTICE PFX "Shared Key Authentication completed with "MAC_FMT"\n", | 231 | printkl(KERN_NOTICE PFX "Shared Key Authentication completed with "MAC_FMT"\n", |
| 231 | MAC_ARG(net->bssid)); | 232 | MAC_ARG(net->bssid)); |
| 233 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_AUTHENTICATED, net); | ||
| 232 | break; | 234 | break; |
| 233 | default: | 235 | default: |
| 234 | printkl(KERN_NOTICE PFX "Shared Key Authentication with "MAC_FMT" failed, error code: %i\n", | 236 | printkl(KERN_NOTICE PFX "Shared Key Authentication with "MAC_FMT" failed, error code: %i\n", |
diff --git a/net/ieee80211/softmac/ieee80211softmac_event.c b/net/ieee80211/softmac/ieee80211softmac_event.c index 4b153f7cc96c..f34fa2ef666b 100644 --- a/net/ieee80211/softmac/ieee80211softmac_event.c +++ b/net/ieee80211/softmac/ieee80211softmac_event.c | |||
| @@ -78,7 +78,7 @@ ieee80211softmac_notify_callback(void *d) | |||
| 78 | struct ieee80211softmac_event event = *(struct ieee80211softmac_event*) d; | 78 | struct ieee80211softmac_event event = *(struct ieee80211softmac_event*) d; |
| 79 | kfree(d); | 79 | kfree(d); |
| 80 | 80 | ||
| 81 | event.fun(event.mac->dev, event.context); | 81 | event.fun(event.mac->dev, event.event_type, event.context); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | int | 84 | int |
| @@ -167,6 +167,9 @@ ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int eve | |||
| 167 | if ((eventptr->event_type == event || eventptr->event_type == -1) | 167 | if ((eventptr->event_type == event || eventptr->event_type == -1) |
| 168 | && (eventptr->event_context == NULL || eventptr->event_context == event_ctx)) { | 168 | && (eventptr->event_context == NULL || eventptr->event_context == event_ctx)) { |
| 169 | list_del(&eventptr->list); | 169 | list_del(&eventptr->list); |
| 170 | /* User may have subscribed to ANY event, so | ||
| 171 | * we tell them which event triggered it. */ | ||
| 172 | eventptr->event_type = event; | ||
| 170 | schedule_work(&eventptr->work); | 173 | schedule_work(&eventptr->work); |
| 171 | } | 174 | } |
| 172 | } | 175 | } |
diff --git a/net/ieee80211/softmac/ieee80211softmac_io.c b/net/ieee80211/softmac/ieee80211softmac_io.c index cc6cd56c85b1..09541611e48c 100644 --- a/net/ieee80211/softmac/ieee80211softmac_io.c +++ b/net/ieee80211/softmac/ieee80211softmac_io.c | |||
| @@ -149,6 +149,56 @@ ieee80211softmac_hdr_3addr(struct ieee80211softmac_device *mac, | |||
| 149 | * shouldn't the sequence number be in ieee80211? */ | 149 | * shouldn't the sequence number be in ieee80211? */ |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | static u16 | ||
| 153 | ieee80211softmac_capabilities(struct ieee80211softmac_device *mac, | ||
| 154 | struct ieee80211softmac_network *net) | ||
| 155 | { | ||
| 156 | u16 capability = 0; | ||
| 157 | |||
| 158 | /* ESS and IBSS bits are set according to the current mode */ | ||
| 159 | switch (mac->ieee->iw_mode) { | ||
| 160 | case IW_MODE_INFRA: | ||
| 161 | capability = cpu_to_le16(WLAN_CAPABILITY_ESS); | ||
| 162 | break; | ||
| 163 | case IW_MODE_ADHOC: | ||
| 164 | capability = cpu_to_le16(WLAN_CAPABILITY_IBSS); | ||
| 165 | break; | ||
| 166 | case IW_MODE_AUTO: | ||
| 167 | capability = net->capabilities & | ||
| 168 | (WLAN_CAPABILITY_ESS|WLAN_CAPABILITY_IBSS); | ||
| 169 | break; | ||
| 170 | default: | ||
| 171 | /* bleh. we don't ever go to these modes */ | ||
| 172 | printk(KERN_ERR PFX "invalid iw_mode!\n"); | ||
| 173 | break; | ||
| 174 | } | ||
| 175 | |||
| 176 | /* CF Pollable / CF Poll Request */ | ||
| 177 | /* Needs to be implemented, for now, the 0's == not supported */ | ||
| 178 | |||
| 179 | /* Privacy Bit */ | ||
| 180 | capability |= mac->ieee->sec.level ? | ||
| 181 | cpu_to_le16(WLAN_CAPABILITY_PRIVACY) : 0; | ||
| 182 | |||
| 183 | /* Short Preamble */ | ||
| 184 | /* Always supported: we probably won't ever be powering devices which | ||
| 185 | * dont support this... */ | ||
| 186 | capability |= WLAN_CAPABILITY_SHORT_PREAMBLE; | ||
| 187 | |||
| 188 | /* PBCC */ | ||
| 189 | /* Not widely used */ | ||
| 190 | |||
| 191 | /* Channel Agility */ | ||
| 192 | /* Not widely used */ | ||
| 193 | |||
| 194 | /* Short Slot */ | ||
| 195 | /* Will be implemented later */ | ||
| 196 | |||
| 197 | /* DSSS-OFDM */ | ||
| 198 | /* Not widely used */ | ||
| 199 | |||
| 200 | return capability; | ||
| 201 | } | ||
| 152 | 202 | ||
| 153 | /***************************************************************************** | 203 | /***************************************************************************** |
| 154 | * Create Management packets | 204 | * Create Management packets |
| @@ -179,27 +229,6 @@ ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt, | |||
| 179 | return 0; | 229 | return 0; |
| 180 | ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_ASSOC_REQ, net->bssid, net->bssid); | 230 | ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_ASSOC_REQ, net->bssid, net->bssid); |
| 181 | 231 | ||
| 182 | /* Fill in capability Info */ | ||
| 183 | switch (mac->ieee->iw_mode) { | ||
| 184 | case IW_MODE_INFRA: | ||
| 185 | (*pkt)->capability = cpu_to_le16(WLAN_CAPABILITY_ESS); | ||
| 186 | break; | ||
| 187 | case IW_MODE_ADHOC: | ||
| 188 | (*pkt)->capability = cpu_to_le16(WLAN_CAPABILITY_IBSS); | ||
| 189 | break; | ||
| 190 | case IW_MODE_AUTO: | ||
| 191 | (*pkt)->capability = net->capabilities & (WLAN_CAPABILITY_ESS|WLAN_CAPABILITY_IBSS); | ||
| 192 | break; | ||
| 193 | default: | ||
| 194 | /* bleh. we don't ever go to these modes */ | ||
| 195 | printk(KERN_ERR PFX "invalid iw_mode!\n"); | ||
| 196 | break; | ||
| 197 | } | ||
| 198 | /* Need to add this | ||
| 199 | (*pkt)->capability |= mac->ieee->short_slot ? | ||
| 200 | cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME) : 0; | ||
| 201 | */ | ||
| 202 | (*pkt)->capability |= mac->ieee->sec.level ? cpu_to_le16(WLAN_CAPABILITY_PRIVACY) : 0; | ||
| 203 | /* Fill in Listen Interval (?) */ | 232 | /* Fill in Listen Interval (?) */ |
| 204 | (*pkt)->listen_interval = cpu_to_le16(10); | 233 | (*pkt)->listen_interval = cpu_to_le16(10); |
| 205 | 234 | ||
| @@ -239,17 +268,9 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt, | |||
| 239 | return 0; | 268 | return 0; |
| 240 | ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_REASSOC_REQ, net->bssid, net->bssid); | 269 | ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_REASSOC_REQ, net->bssid, net->bssid); |
| 241 | 270 | ||
| 242 | /* Fill in capability Info */ | 271 | /* Fill in the capabilities */ |
| 243 | (*pkt)->capability = mac->ieee->iw_mode == IW_MODE_MASTER ? | 272 | (*pkt)->capability = ieee80211softmac_capabilities(mac, net); |
| 244 | cpu_to_le16(WLAN_CAPABILITY_ESS) : | 273 | |
| 245 | cpu_to_le16(WLAN_CAPABILITY_IBSS); | ||
| 246 | /* | ||
| 247 | (*pkt)->capability |= mac->ieee->short_slot ? | ||
| 248 | cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME) : 0; | ||
| 249 | */ | ||
| 250 | (*pkt)->capability |= mac->ieee->sec.level ? | ||
| 251 | cpu_to_le16(WLAN_CAPABILITY_PRIVACY) : 0; | ||
| 252 | |||
| 253 | /* Fill in Listen Interval (?) */ | 274 | /* Fill in Listen Interval (?) */ |
| 254 | (*pkt)->listen_interval = cpu_to_le16(10); | 275 | (*pkt)->listen_interval = cpu_to_le16(10); |
| 255 | /* Fill in the current AP MAC */ | 276 | /* Fill in the current AP MAC */ |
| @@ -268,26 +289,27 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt, | |||
| 268 | static u32 | 289 | static u32 |
| 269 | ieee80211softmac_auth(struct ieee80211_auth **pkt, | 290 | ieee80211softmac_auth(struct ieee80211_auth **pkt, |
| 270 | struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net, | 291 | struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net, |
| 271 | u16 transaction, u16 status) | 292 | u16 transaction, u16 status, int *encrypt_mpdu) |
| 272 | { | 293 | { |
| 273 | u8 *data; | 294 | u8 *data; |
| 295 | int auth_mode = mac->ieee->sec.auth_mode; | ||
| 296 | int is_shared_response = (auth_mode == WLAN_AUTH_SHARED_KEY | ||
| 297 | && transaction == IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE); | ||
| 298 | |||
| 274 | /* Allocate Packet */ | 299 | /* Allocate Packet */ |
| 275 | (*pkt) = (struct ieee80211_auth *)ieee80211softmac_alloc_mgt( | 300 | (*pkt) = (struct ieee80211_auth *)ieee80211softmac_alloc_mgt( |
| 276 | 2 + /* Auth Algorithm */ | 301 | 2 + /* Auth Algorithm */ |
| 277 | 2 + /* Auth Transaction Seq */ | 302 | 2 + /* Auth Transaction Seq */ |
| 278 | 2 + /* Status Code */ | 303 | 2 + /* Status Code */ |
| 279 | /* Challenge Text IE */ | 304 | /* Challenge Text IE */ |
| 280 | mac->ieee->open_wep ? 0 : | 305 | is_shared_response ? 0 : 1 + 1 + net->challenge_len |
| 281 | 1 + 1 + WLAN_AUTH_CHALLENGE_LEN | 306 | ); |
| 282 | ); | ||
| 283 | if (unlikely((*pkt) == NULL)) | 307 | if (unlikely((*pkt) == NULL)) |
| 284 | return 0; | 308 | return 0; |
| 285 | ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_AUTH, net->bssid, net->bssid); | 309 | ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_AUTH, net->bssid, net->bssid); |
| 286 | 310 | ||
| 287 | /* Algorithm */ | 311 | /* Algorithm */ |
| 288 | (*pkt)->algorithm = mac->ieee->open_wep ? | 312 | (*pkt)->algorithm = cpu_to_le16(auth_mode); |
| 289 | cpu_to_le16(WLAN_AUTH_OPEN) : | ||
| 290 | cpu_to_le16(WLAN_AUTH_SHARED_KEY); | ||
| 291 | /* Transaction */ | 313 | /* Transaction */ |
| 292 | (*pkt)->transaction = cpu_to_le16(transaction); | 314 | (*pkt)->transaction = cpu_to_le16(transaction); |
| 293 | /* Status */ | 315 | /* Status */ |
| @@ -295,18 +317,20 @@ ieee80211softmac_auth(struct ieee80211_auth **pkt, | |||
| 295 | 317 | ||
| 296 | data = (u8 *)(*pkt)->info_element; | 318 | data = (u8 *)(*pkt)->info_element; |
| 297 | /* Challenge Text */ | 319 | /* Challenge Text */ |
| 298 | if(!mac->ieee->open_wep){ | 320 | if (is_shared_response) { |
| 299 | *data = MFIE_TYPE_CHALLENGE; | 321 | *data = MFIE_TYPE_CHALLENGE; |
| 300 | data++; | 322 | data++; |
| 301 | 323 | ||
| 302 | /* Copy the challenge in */ | 324 | /* Copy the challenge in */ |
| 303 | // *data = challenge length | 325 | *data = net->challenge_len; |
| 304 | // data += sizeof(u16); | 326 | data++; |
| 305 | // memcpy(data, challenge, challenge length); | 327 | memcpy(data, net->challenge, net->challenge_len); |
| 306 | // data += challenge length; | 328 | data += net->challenge_len; |
| 307 | 329 | ||
| 308 | /* Add the full size to the packet length */ | 330 | /* Make sure this frame gets encrypted with the shared key */ |
| 309 | } | 331 | *encrypt_mpdu = 1; |
| 332 | } else | ||
| 333 | *encrypt_mpdu = 0; | ||
| 310 | 334 | ||
| 311 | /* Return the packet size */ | 335 | /* Return the packet size */ |
| 312 | return (data - (u8 *)(*pkt)); | 336 | return (data - (u8 *)(*pkt)); |
| @@ -396,6 +420,7 @@ ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, | |||
| 396 | { | 420 | { |
| 397 | void *pkt = NULL; | 421 | void *pkt = NULL; |
| 398 | u32 pkt_size = 0; | 422 | u32 pkt_size = 0; |
| 423 | int encrypt_mpdu = 0; | ||
| 399 | 424 | ||
| 400 | switch(type) { | 425 | switch(type) { |
| 401 | case IEEE80211_STYPE_ASSOC_REQ: | 426 | case IEEE80211_STYPE_ASSOC_REQ: |
| @@ -405,7 +430,7 @@ ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, | |||
| 405 | pkt_size = ieee80211softmac_reassoc_req((struct ieee80211_reassoc_request **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg); | 430 | pkt_size = ieee80211softmac_reassoc_req((struct ieee80211_reassoc_request **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg); |
| 406 | break; | 431 | break; |
| 407 | case IEEE80211_STYPE_AUTH: | 432 | case IEEE80211_STYPE_AUTH: |
| 408 | pkt_size = ieee80211softmac_auth((struct ieee80211_auth **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg, (u16)(arg & 0xFFFF), (u16) (arg >> 16)); | 433 | pkt_size = ieee80211softmac_auth((struct ieee80211_auth **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg, (u16)(arg & 0xFFFF), (u16) (arg >> 16), &encrypt_mpdu); |
| 409 | break; | 434 | break; |
| 410 | case IEEE80211_STYPE_DISASSOC: | 435 | case IEEE80211_STYPE_DISASSOC: |
| 411 | case IEEE80211_STYPE_DEAUTH: | 436 | case IEEE80211_STYPE_DEAUTH: |
| @@ -434,52 +459,8 @@ ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, | |||
| 434 | * or get rid of it alltogether? | 459 | * or get rid of it alltogether? |
| 435 | * Does this work for you now? | 460 | * Does this work for you now? |
| 436 | */ | 461 | */ |
| 437 | ieee80211_tx_frame(mac->ieee, (struct ieee80211_hdr *)pkt, pkt_size); | 462 | ieee80211_tx_frame(mac->ieee, (struct ieee80211_hdr *)pkt, |
| 438 | 463 | IEEE80211_3ADDR_LEN, pkt_size, encrypt_mpdu); | |
| 439 | kfree(pkt); | ||
| 440 | return 0; | ||
| 441 | } | ||
| 442 | |||
| 443 | |||
| 444 | /* Create an rts/cts frame */ | ||
| 445 | static u32 | ||
| 446 | ieee80211softmac_rts_cts(struct ieee80211_hdr_2addr **pkt, | ||
| 447 | struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net, | ||
| 448 | u32 type) | ||
| 449 | { | ||
| 450 | /* Allocate Packet */ | ||
| 451 | (*pkt) = kmalloc(IEEE80211_2ADDR_LEN, GFP_ATOMIC); | ||
| 452 | memset(*pkt, 0, IEEE80211_2ADDR_LEN); | ||
| 453 | if((*pkt) == NULL) | ||
| 454 | return 0; | ||
| 455 | ieee80211softmac_hdr_2addr(mac, (*pkt), type, net->bssid); | ||
| 456 | return IEEE80211_2ADDR_LEN; | ||
| 457 | } | ||
| 458 | |||
| 459 | |||
| 460 | /* Sends a control packet */ | ||
| 461 | static int | ||
| 462 | ieee80211softmac_send_ctl_frame(struct ieee80211softmac_device *mac, | ||
| 463 | struct ieee80211softmac_network *net, u32 type, u32 arg) | ||
| 464 | { | ||
| 465 | void *pkt = NULL; | ||
| 466 | u32 pkt_size = 0; | ||
| 467 | |||
| 468 | switch(type) { | ||
| 469 | case IEEE80211_STYPE_RTS: | ||
| 470 | case IEEE80211_STYPE_CTS: | ||
| 471 | pkt_size = ieee80211softmac_rts_cts((struct ieee80211_hdr_2addr **)(&pkt), mac, net, type); | ||
| 472 | break; | ||
| 473 | default: | ||
| 474 | printkl(KERN_DEBUG PFX "Unsupported Control Frame type: %i\n", type); | ||
| 475 | return -EINVAL; | ||
| 476 | } | ||
| 477 | |||
| 478 | if(pkt_size == 0) | ||
| 479 | return -ENOMEM; | ||
| 480 | |||
| 481 | /* Send the packet to the ieee80211 layer for tx */ | ||
| 482 | ieee80211_tx_frame(mac->ieee, (struct ieee80211_hdr *) pkt, pkt_size); | ||
| 483 | 464 | ||
| 484 | kfree(pkt); | 465 | kfree(pkt); |
| 485 | return 0; | 466 | return 0; |
