ieee80211_input.c (116904) | ieee80211_input.c (117811) |
---|---|
1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 17 unchanged lines hidden (view full) --- 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 17 unchanged lines hidden (view full) --- 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_input.c 116904 2003-06-27 05:13:52Z sam $"); | 34__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_input.c 117811 2003-07-20 21:36:08Z sam $"); |
35 36#include "opt_inet.h" 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/mbuf.h> 41#include <sys/malloc.h> 42#include <sys/kernel.h> --- 544 unchanged lines hidden (view full) --- 587 IEEE80211_DPRINTF(("%s: element id %u/len %u " 588 "ignored\n", __func__, *frm, frm[1])); 589 break; 590 } 591 frm += frm[1] + 2; 592 } 593 IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_SIZE); 594 IEEE80211_VERIFY_ELEMENT(ssid, IEEE80211_NWID_LEN); | 35 36#include "opt_inet.h" 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/mbuf.h> 41#include <sys/malloc.h> 42#include <sys/kernel.h> --- 544 unchanged lines hidden (view full) --- 587 IEEE80211_DPRINTF(("%s: element id %u/len %u " 588 "ignored\n", __func__, *frm, frm[1])); 589 break; 590 } 591 frm += frm[1] + 2; 592 } 593 IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_SIZE); 594 IEEE80211_VERIFY_ELEMENT(ssid, IEEE80211_NWID_LEN); |
595 if (chan > IEEE80211_CHAN_MAX || isclr(ic->ic_chan_active, chan)) { | 595 if ( 596#if IEEE80211_CHAN_MAX < 255 597 chan > IEEE80211_CHAN_MAX || 598#endif 599 isclr(ic->ic_chan_active, chan)) { |
596 IEEE80211_DPRINTF(("%s: ignore %s with invalid channel " 597 "%u\n", __func__, 598 ISPROBE(subtype) ? "probe response" : "beacon", 599 chan)); 600 return; 601 } 602 if (chan != bchan) { 603 /* --- 166 unchanged lines hidden (view full) --- 770 IEEE80211_DPRINTF(("%s: unsupported auth %d from %s\n", 771 __func__, algo, ether_sprintf(wh->i_addr2))); 772 return; 773 } 774 switch (ic->ic_opmode) { 775 case IEEE80211_M_IBSS: 776 if (ic->ic_state != IEEE80211_S_RUN || seq != 1) 777 return; | 600 IEEE80211_DPRINTF(("%s: ignore %s with invalid channel " 601 "%u\n", __func__, 602 ISPROBE(subtype) ? "probe response" : "beacon", 603 chan)); 604 return; 605 } 606 if (chan != bchan) { 607 /* --- 166 unchanged lines hidden (view full) --- 774 IEEE80211_DPRINTF(("%s: unsupported auth %d from %s\n", 775 __func__, algo, ether_sprintf(wh->i_addr2))); 776 return; 777 } 778 switch (ic->ic_opmode) { 779 case IEEE80211_M_IBSS: 780 if (ic->ic_state != IEEE80211_S_RUN || seq != 1) 781 return; |
778 ieee80211_new_state(&ic->ic_if, IEEE80211_S_AUTH, | 782 ieee80211_new_state(ic, IEEE80211_S_AUTH, |
779 wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); 780 break; 781 782 case IEEE80211_M_AHDEMO: 783 /* should not come here */ 784 break; 785 786 case IEEE80211_M_HOSTAP: --- 30 unchanged lines hidden (view full) --- 817 ether_sprintf(wh->i_addr3)); 818 ni = ieee80211_find_node(ic, wh->i_addr2); 819 if (ni != NULL) { 820 ni->ni_fails++; 821 ieee80211_unref_node(&ni); 822 } 823 return; 824 } | 783 wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); 784 break; 785 786 case IEEE80211_M_AHDEMO: 787 /* should not come here */ 788 break; 789 790 case IEEE80211_M_HOSTAP: --- 30 unchanged lines hidden (view full) --- 821 ether_sprintf(wh->i_addr3)); 822 ni = ieee80211_find_node(ic, wh->i_addr2); 823 if (ni != NULL) { 824 ni->ni_fails++; 825 ieee80211_unref_node(&ni); 826 } 827 return; 828 } |
825 ieee80211_new_state(&ic->ic_if, IEEE80211_S_ASSOC, | 829 ieee80211_new_state(ic, IEEE80211_S_ASSOC, |
826 wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); 827 break; 828 } 829 break; 830 } 831 832 case IEEE80211_FC0_SUBTYPE_ASSOC_REQ: 833 case IEEE80211_FC0_SUBTYPE_REASSOC_REQ: { --- 172 unchanged lines hidden (view full) --- 1006 frm += frm[1] + 2; 1007 } 1008 1009 IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_SIZE); 1010 ieee80211_setup_rates(ic, ni, rates, xrates, 1011 IEEE80211_F_DOSORT | IEEE80211_F_DOFRATE | 1012 IEEE80211_F_DONEGO | IEEE80211_F_DODEL); 1013 if (ni->ni_rates.rs_nrates != 0) | 830 wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); 831 break; 832 } 833 break; 834 } 835 836 case IEEE80211_FC0_SUBTYPE_ASSOC_REQ: 837 case IEEE80211_FC0_SUBTYPE_REASSOC_REQ: { --- 172 unchanged lines hidden (view full) --- 1010 frm += frm[1] + 2; 1011 } 1012 1013 IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_SIZE); 1014 ieee80211_setup_rates(ic, ni, rates, xrates, 1015 IEEE80211_F_DOSORT | IEEE80211_F_DOFRATE | 1016 IEEE80211_F_DONEGO | IEEE80211_F_DODEL); 1017 if (ni->ni_rates.rs_nrates != 0) |
1014 ieee80211_new_state(ifp, IEEE80211_S_RUN, | 1018 ieee80211_new_state(ic, IEEE80211_S_RUN, |
1015 wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); 1016 break; 1017 } 1018 1019 case IEEE80211_FC0_SUBTYPE_DEAUTH: { 1020 u_int16_t reason; 1021 /* 1022 * deauth frame format 1023 * [2] reason 1024 */ 1025 IEEE80211_VERIFY_LENGTH(efrm - frm, 2); 1026 reason = le16toh(*(u_int16_t *)frm); 1027 switch (ic->ic_opmode) { 1028 case IEEE80211_M_STA: | 1019 wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); 1020 break; 1021 } 1022 1023 case IEEE80211_FC0_SUBTYPE_DEAUTH: { 1024 u_int16_t reason; 1025 /* 1026 * deauth frame format 1027 * [2] reason 1028 */ 1029 IEEE80211_VERIFY_LENGTH(efrm - frm, 2); 1030 reason = le16toh(*(u_int16_t *)frm); 1031 switch (ic->ic_opmode) { 1032 case IEEE80211_M_STA: |
1029 ieee80211_new_state(&ic->ic_if, IEEE80211_S_AUTH, | 1033 ieee80211_new_state(ic, IEEE80211_S_AUTH, |
1030 wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); 1031 break; 1032 case IEEE80211_M_HOSTAP: 1033 ni = ieee80211_find_node(ic, wh->i_addr2); 1034 if (ni != NULL) { 1035 if (ifp->if_flags & IFF_DEBUG) 1036 if_printf(ifp, "station %s deauthenticated" 1037 " by peer (reason %d)\n", --- 12 unchanged lines hidden (view full) --- 1050 /* 1051 * disassoc frame format 1052 * [2] reason 1053 */ 1054 IEEE80211_VERIFY_LENGTH(efrm - frm, 2); 1055 reason = le16toh(*(u_int16_t *)frm); 1056 switch (ic->ic_opmode) { 1057 case IEEE80211_M_STA: | 1034 wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); 1035 break; 1036 case IEEE80211_M_HOSTAP: 1037 ni = ieee80211_find_node(ic, wh->i_addr2); 1038 if (ni != NULL) { 1039 if (ifp->if_flags & IFF_DEBUG) 1040 if_printf(ifp, "station %s deauthenticated" 1041 " by peer (reason %d)\n", --- 12 unchanged lines hidden (view full) --- 1054 /* 1055 * disassoc frame format 1056 * [2] reason 1057 */ 1058 IEEE80211_VERIFY_LENGTH(efrm - frm, 2); 1059 reason = le16toh(*(u_int16_t *)frm); 1060 switch (ic->ic_opmode) { 1061 case IEEE80211_M_STA: |
1058 ieee80211_new_state(&ic->ic_if, IEEE80211_S_ASSOC, | 1062 ieee80211_new_state(ic, IEEE80211_S_ASSOC, |
1059 wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); 1060 break; 1061 case IEEE80211_M_HOSTAP: 1062 ni = ieee80211_find_node(ic, wh->i_addr2); 1063 if (ni != NULL) { 1064 if (ifp->if_flags & IFF_DEBUG) 1065 if_printf(ifp, "station %s disassociated" 1066 " by peer (reason %d)\n", --- 19 unchanged lines hidden --- | 1063 wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); 1064 break; 1065 case IEEE80211_M_HOSTAP: 1066 ni = ieee80211_find_node(ic, wh->i_addr2); 1067 if (ni != NULL) { 1068 if (ifp->if_flags & IFF_DEBUG) 1069 if_printf(ifp, "station %s disassociated" 1070 " by peer (reason %d)\n", --- 19 unchanged lines hidden --- |