if_ndis.c (288635) | if_ndis.c (293339) |
---|---|
1/*- 2 * Copyright (c) 2003 3 * Bill Paul <wpaul@windriver.com>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 20 unchanged lines hidden (view full) --- 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 * 32 * WPA support originally contributed by Arvind Srinivasan <arvind@celar.us> 33 * then hacked upon mercilessly by my. 34 */ 35 36#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003 3 * Bill Paul <wpaul@windriver.com>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 20 unchanged lines hidden (view full) --- 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 * 32 * WPA support originally contributed by Arvind Srinivasan <arvind@celar.us> 33 * then hacked upon mercilessly by my. 34 */ 35 36#include <sys/cdefs.h> |
37__FBSDID("$FreeBSD: head/sys/dev/if_ndis/if_ndis.c 288635 2015-10-03 21:48:27Z adrian $"); | 37__FBSDID("$FreeBSD: head/sys/dev/if_ndis/if_ndis.c 293339 2016-01-07 18:41:03Z avos $"); |
38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/sockio.h> 42#include <sys/mbuf.h> 43#include <sys/malloc.h> 44#include <sys/endian.h> 45#include <sys/priv.h> --- 673 unchanged lines hidden (view full) --- 719 720static int 721ndis_80211attach(struct ndis_softc *sc) 722{ 723 struct ieee80211com *ic = &sc->ndis_ic; 724 ndis_80211_rates_ex rates; 725 struct ndis_80211_nettype_list *ntl; 726 uint32_t arg; | 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/sockio.h> 42#include <sys/mbuf.h> 43#include <sys/malloc.h> 44#include <sys/endian.h> 45#include <sys/priv.h> --- 673 unchanged lines hidden (view full) --- 719 720static int 721ndis_80211attach(struct ndis_softc *sc) 722{ 723 struct ieee80211com *ic = &sc->ndis_ic; 724 ndis_80211_rates_ex rates; 725 struct ndis_80211_nettype_list *ntl; 726 uint32_t arg; |
727 int mode, i, r, len; 728 uint8_t bands = 0; | 727 int mode, i, r, len, nonettypes = 1; 728 uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)] = { 0 }; |
729 730 callout_init(&sc->ndis_scan_callout, 1); 731 732 ic->ic_softc = sc; 733 ic->ic_ioctl = ndis_80211ioctl; 734 ic->ic_name = device_get_nameunit(sc->ndis_dev); 735 ic->ic_opmode = IEEE80211_M_STA; 736 ic->ic_phytype = IEEE80211_T_DS; --- 9 unchanged lines hidden (view full) --- 746 if (r != 0) { 747 free(ntl, M_DEVBUF); 748 goto nonettypes; 749 } 750 751 for (i = 0; i < ntl->ntl_items; i++) { 752 mode = ndis_nettype_mode(ntl->ntl_type[i]); 753 if (mode) { | 729 730 callout_init(&sc->ndis_scan_callout, 1); 731 732 ic->ic_softc = sc; 733 ic->ic_ioctl = ndis_80211ioctl; 734 ic->ic_name = device_get_nameunit(sc->ndis_dev); 735 ic->ic_opmode = IEEE80211_M_STA; 736 ic->ic_phytype = IEEE80211_T_DS; --- 9 unchanged lines hidden (view full) --- 746 if (r != 0) { 747 free(ntl, M_DEVBUF); 748 goto nonettypes; 749 } 750 751 for (i = 0; i < ntl->ntl_items; i++) { 752 mode = ndis_nettype_mode(ntl->ntl_type[i]); 753 if (mode) { |
754 nonettypes = 0; |
|
754 setbit(ic->ic_modecaps, mode); | 755 setbit(ic->ic_modecaps, mode); |
755 setbit(&bands, mode); | 756 setbit(bands, mode); |
756 } else 757 device_printf(sc->ndis_dev, "Unknown nettype %d\n", 758 ntl->ntl_type[i]); 759 } 760 free(ntl, M_DEVBUF); 761nonettypes: 762 /* Default to 11b channels if the card did not supply any */ | 757 } else 758 device_printf(sc->ndis_dev, "Unknown nettype %d\n", 759 ntl->ntl_type[i]); 760 } 761 free(ntl, M_DEVBUF); 762nonettypes: 763 /* Default to 11b channels if the card did not supply any */ |
763 if (bands == 0) { | 764 if (nonettypes) { |
764 setbit(ic->ic_modecaps, IEEE80211_MODE_11B); | 765 setbit(ic->ic_modecaps, IEEE80211_MODE_11B); |
765 setbit(&bands, IEEE80211_MODE_11B); | 766 setbit(bands, IEEE80211_MODE_11B); |
766 } 767 len = sizeof(rates); 768 bzero((char *)&rates, len); 769 r = ndis_get_info(sc, OID_802_11_SUPPORTED_RATES, (void *)rates, &len); 770 if (r != 0) 771 device_printf(sc->ndis_dev, "get rates failed: 0x%x\n", r); 772 /* 773 * Since the supported rates only up to 8 can be supported, --- 80 unchanged lines hidden (view full) --- 854 TESTSETRATE(IEEE80211_MODE_11A, 96); 855 TESTSETRATE(IEEE80211_MODE_11A, 108); 856 } 857 858#undef SETRATE 859#undef INCRATE 860#undef TESTSETRATE 861 | 767 } 768 len = sizeof(rates); 769 bzero((char *)&rates, len); 770 r = ndis_get_info(sc, OID_802_11_SUPPORTED_RATES, (void *)rates, &len); 771 if (r != 0) 772 device_printf(sc->ndis_dev, "get rates failed: 0x%x\n", r); 773 /* 774 * Since the supported rates only up to 8 can be supported, --- 80 unchanged lines hidden (view full) --- 855 TESTSETRATE(IEEE80211_MODE_11A, 96); 856 TESTSETRATE(IEEE80211_MODE_11A, 108); 857 } 858 859#undef SETRATE 860#undef INCRATE 861#undef TESTSETRATE 862 |
862 ieee80211_init_channels(ic, NULL, &bands); | 863 ieee80211_init_channels(ic, NULL, bands); |
863 864 /* 865 * To test for WPA support, we need to see if we can 866 * set AUTHENTICATION_MODE to WPA and read it back 867 * successfully. 868 */ 869 i = sizeof(arg); 870 arg = NDIS_80211_AUTHMODE_WPA; --- 2544 unchanged lines hidden --- | 864 865 /* 866 * To test for WPA support, we need to see if we can 867 * set AUTHENTICATION_MODE to WPA and read it back 868 * successfully. 869 */ 870 i = sizeof(arg); 871 arg = NDIS_80211_AUTHMODE_WPA; --- 2544 unchanged lines hidden --- |