-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/sniff.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc index 66299d1..81eccab 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc +++ b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc | |||
@@ -1,314 +1,320 @@ | |||
1 | /* | 1 | /* |
2 | * rfmon mode sniffer | 2 | * rfmon mode sniffer |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include "sniff.hh" | 7 | #include "sniff.hh" |
8 | #include "ieee802_11.hh" | 8 | #include "ieee802_11.hh" |
9 | #include "extract.hh" | 9 | #include "extract.hh" |
10 | #include "log.hh" | 10 | #include "log.hh" |
11 | #include "proto.hh" | 11 | #include "proto.hh" |
12 | 12 | ||
13 | /* Main function, checks packets */ | 13 | /* Main function, checks packets */ |
14 | void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *packet, char *guihost, int guiport) | 14 | void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *packet, char *guihost, int guiport) |
15 | { | 15 | { |
16 | unsigned int caplen = pkthdr->caplen; | 16 | unsigned int caplen = pkthdr->caplen; |
17 | unsigned int length = pkthdr->len; | 17 | unsigned int length = pkthdr->len; |
18 | u_int16_t fc; | 18 | u_int16_t fc; |
19 | unsigned int HEADER_LENGTH; | 19 | unsigned int HEADER_LENGTH; |
20 | 20 | ||
21 | /* pinfo holds all interresting information for us */ | 21 | /* pinfo holds all interresting information for us */ |
22 | struct packetinfo pinfo; | 22 | struct packetinfo pinfo; |
23 | struct packetinfo *pinfoptr; | 23 | struct packetinfo *pinfoptr; |
24 | 24 | ||
25 | /* wl_network_t will finally be set and send to the ui */ | 25 | /* wl_network_t will finally be set and send to the ui */ |
26 | wl_network_t wl_net; | 26 | wl_network_t wl_net; |
27 | 27 | ||
28 | pinfoptr=&pinfo; | 28 | pinfoptr=&pinfo; |
29 | 29 | ||
30 | pinfoptr->isvalid = 0; | 30 | pinfoptr->isvalid = 0; |
31 | pinfoptr->pktlen = pkthdr->len; | 31 | pinfoptr->pktlen = pkthdr->len; |
32 | 32 | ||
33 | if (caplen < IEEE802_11_FC_LEN) | 33 | if (caplen < IEEE802_11_FC_LEN) |
34 | { | 34 | { |
35 | /* This is a garbage packet, because is does not long enough | 35 | /* This is a garbage packet, because is does not long enough |
36 | to hold a 802.11b header */ | 36 | to hold a 802.11b header */ |
37 | pinfoptr->isvalid = 0; | 37 | pinfoptr->isvalid = 0; |
38 | return; | 38 | return; |
39 | } | 39 | } |
40 | 40 | ||
41 | /* Gets the framecontrol bits (2bytes long) */ | 41 | /* Gets the framecontrol bits (2bytes long) */ |
42 | fc = EXTRACT_LE_16BITS(packet); | 42 | fc = EXTRACT_LE_16BITS(packet); |
43 | 43 | ||
44 | HEADER_LENGTH = GetHeaderLength(fc); | 44 | HEADER_LENGTH = GetHeaderLength(fc); |
45 | 45 | ||
46 | if (caplen < HEADER_LENGTH) | 46 | if (caplen < HEADER_LENGTH) |
47 | { | 47 | { |
48 | /* This is a garbage packet, because it is not long enough | 48 | /* This is a garbage packet, because it is not long enough |
49 | to hold a correct header of its type */ | 49 | to hold a correct header of its type */ |
50 | pinfoptr->isvalid = 0; | 50 | pinfoptr->isvalid = 0; |
51 | return; | 51 | return; |
52 | } | 52 | } |
53 | 53 | ||
54 | /* Decode 802.11b header out of the packet */ | 54 | /* Decode 802.11b header out of the packet */ |
55 | if (decode_80211b_hdr(packet,pinfoptr) == 0) | 55 | if (decode_80211b_hdr(packet,pinfoptr) == 0) |
56 | { | 56 | { |
57 | /* Justification of the ofset to further process the packet */ | 57 | /* Justification of the ofset to further process the packet */ |
58 | length -= HEADER_LENGTH; | 58 | length -= HEADER_LENGTH; |
59 | caplen -= HEADER_LENGTH; | 59 | caplen -= HEADER_LENGTH; |
60 | packet += HEADER_LENGTH; | 60 | packet += HEADER_LENGTH; |
61 | } | 61 | } |
62 | else /* Something is wrong,could not be a correct packet */ | 62 | else /* Something is wrong,could not be a correct packet */ |
63 | return; | 63 | return; |
64 | 64 | ||
65 | switch (FC_TYPE(fc)) | 65 | switch (FC_TYPE(fc)) |
66 | { | 66 | { |
67 | /* Is it a managemnet frame? */ | 67 | /* Is it a managemnet frame? */ |
68 | case T_MGMT: | 68 | case T_MGMT: |
69 | switch (FC_SUBTYPE(fc)) | 69 | switch (FC_SUBTYPE(fc)) |
70 | { | 70 | { |
71 | case ST_BEACON: | 71 | case ST_BEACON: |
72 | if (handle_beacon(fc, packet,pinfoptr) ==0) | 72 | if (handle_beacon(fc, packet,pinfoptr) ==0) |
73 | { | 73 | { |
74 | if (!strcmp(pinfoptr->desthwaddr,"ff:ff:ff:ff:ff:ff") == 0) | 74 | if (!strcmp(pinfoptr->desthwaddr,"ff:ff:ff:ff:ff:ff") == 0) |
75 | { | 75 | { |
76 | /* Every beacon must have the broadcast as destination | 76 | /* Every beacon must have the broadcast as destination |
77 | so it must be a shitti packet */ | 77 | so it must be a shitti packet */ |
78 | pinfoptr->isvalid = 0; | 78 | pinfoptr->isvalid = 0; |
79 | return; | 79 | return; |
80 | } | 80 | } |
81 | 81 | ||
82 | if (pinfoptr->cap_ESS == pinfoptr->cap_IBSS) | 82 | if (pinfoptr->cap_ESS == pinfoptr->cap_IBSS) |
83 | { | 83 | { |
84 | /* Only one of both are possible, so must be | 84 | /* Only one of both are possible, so must be |
85 | a noise packet, if this comes up */ | 85 | a noise packet, if this comes up */ |
86 | pinfoptr->isvalid = 0; | 86 | pinfoptr->isvalid = 0; |
87 | return; | 87 | return; |
88 | } | 88 | } |
89 | if (pinfoptr->channel < 1 || pinfoptr->channel > 14) | 89 | if (pinfoptr->channel < 1 || pinfoptr->channel > 14) |
90 | { | 90 | { |
91 | /* Only channels between 1 and 14 are possible | 91 | /* Only channels between 1 and 14 are possible |
92 | others must be noise packets */ | 92 | others must be noise packets */ |
93 | pinfoptr->isvalid = 0; | 93 | pinfoptr->isvalid = 0; |
94 | return; | 94 | return; |
95 | } | 95 | } |
96 | 96 | ||
97 | 97 | ||
98 | /* Here should be the infos to the gui issued */ | 98 | /* Here should be the infos to the gui issued */ |
99 | if (pinfoptr->cap_ESS == 1 &&pinfoptr->cap_IBSS ==0) | 99 | if (pinfoptr->cap_ESS == 1 &&pinfoptr->cap_IBSS ==0) |
100 | { | 100 | { |
101 | wl_loginfo("Found an access point"); | 101 | wl_loginfo("Found an access point"); |
102 | wl_net.net_type=1; | 102 | wl_net.net_type=1; |
103 | } | 103 | } |
104 | else if(pinfoptr->cap_ESS == 0 && pinfoptr->cap_IBSS == 1) | 104 | else if(pinfoptr->cap_ESS == 0 && pinfoptr->cap_IBSS == 1) |
105 | { | 105 | { |
106 | wl_loginfo("Found an ad-hoc network"); | 106 | wl_loginfo("Found an ad-hoc network"); |
107 | wl_net.net_type=2; | 107 | wl_net.net_type=2; |
108 | } | 108 | } |
109 | if (strcmp (pinfoptr->ssid,NONBROADCASTING) ==0) | 109 | if (strcmp (pinfoptr->ssid,NONBROADCASTING) ==0) |
110 | { | 110 | { |
111 | wl_loginfo("Net is a non-broadcasting network"); | 111 | wl_loginfo("Net is a non-broadcasting network"); |
112 | } | 112 | } |
113 | else | 113 | else |
114 | { | 114 | { |
115 | wl_loginfo("SSID is: %s", pinfoptr->ssid); | 115 | wl_loginfo("SSID is: %s", pinfoptr->ssid); |
116 | // wl_net.bssid=pinfoptr->ssid; | 116 | // wl_net.bssid=pinfoptr->ssid; |
117 | } | 117 | } |
118 | 118 | ||
119 | wl_loginfo("SSID length is: %d", pinfoptr->ssid_len); | ||
119 | wl_net.ssid_len=pinfoptr->ssid_len; | 120 | wl_net.ssid_len=pinfoptr->ssid_len; |
121 | |||
122 | wl_loginfo("Channel is: %d", pinfoptr->channel); | ||
120 | wl_net.channel=pinfoptr->channel; | 123 | wl_net.channel=pinfoptr->channel; |
121 | wl_net.wep=pinfoptr->cap_WEP; | 124 | wl_net.wep=pinfoptr->cap_WEP; |
122 | memcpy(wl_net.mac, pinfoptr->sndhwaddr, sizeof(wl_net.mac));; | 125 | |
123 | memcpy(wl_net.bssid, pinfoptr->ssid, sizeof(wl_net.bssid)); | 126 | wl_loginfo("Mac is: %s", pinfoptr->sndhwaddr); |
127 | memcpy(wl_net.mac, pinfoptr->sndhwaddr, sizeof(wl_net.mac)-1);; | ||
128 | wl_loginfo("SSID is: %s", pinfoptr->ssid); | ||
129 | memcpy(wl_net.bssid, pinfoptr->ssid, sizeof(wl_net.bssid)-1); | ||
124 | 130 | ||
125 | // printf ("\n\tDest : %s\n",pinfoptr->desthwaddr); | 131 | // printf ("\n\tDest : %s\n",pinfoptr->desthwaddr); |
126 | send_network_found((char *)guihost, guiport, &wl_net); | 132 | send_network_found((char *)guihost, guiport, &wl_net); |
127 | wl_loginfo("Sent network to GUI '%s:%d'", guihost, guiport); | 133 | wl_loginfo("Sent network to GUI '%s:%d'", guihost, guiport); |
128 | } | 134 | } |
129 | break; | 135 | break; |
130 | default: | 136 | default: |
131 | wl_logerr("Unknown IEEE802.11 frame subtype (%d)", FC_SUBTYPE(fc)); | 137 | wl_logerr("Unknown IEEE802.11 frame subtype (%d)", FC_SUBTYPE(fc)); |
132 | break; | 138 | break; |
133 | } /* End of switch over different mgt frame types */ | 139 | } /* End of switch over different mgt frame types */ |
134 | 140 | ||
135 | break; | 141 | break; |
136 | 142 | ||
137 | case T_CTRL: | 143 | case T_CTRL: |
138 | wl_loginfo("Received control frame, not implemented yet"); | 144 | wl_loginfo("Received control frame, not implemented yet"); |
139 | break; | 145 | break; |
140 | 146 | ||
141 | case T_DATA: | 147 | case T_DATA: |
142 | wl_loginfo("Received date frame, not implemented yet"); | 148 | wl_loginfo("Received date frame, not implemented yet"); |
143 | break; | 149 | break; |
144 | 150 | ||
145 | default: | 151 | default: |
146 | wl_logerr("Unknown IEEE802.11 frame type (%d)", FC_TYPE(fc)); | 152 | wl_logerr("Unknown IEEE802.11 frame type (%d)", FC_TYPE(fc)); |
147 | break; | 153 | break; |
148 | } | 154 | } |
149 | } | 155 | } |
150 | 156 | ||
151 | /* This decodes the 802.11b frame header out of the 802.11b packet | 157 | /* This decodes the 802.11b frame header out of the 802.11b packet |
152 | all the infos is placed into the packetinfo structure */ | 158 | all the infos is placed into the packetinfo structure */ |
153 | int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo) | 159 | int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo) |
154 | { | 160 | { |
155 | const struct mgmt_header_t *mgthdr = (const struct mgmt_header_t *) p; | 161 | const struct mgmt_header_t *mgthdr = (const struct mgmt_header_t *) p; |
156 | ppinfo->fcsubtype = FC_SUBTYPE(mgthdr->fc); | 162 | ppinfo->fcsubtype = FC_SUBTYPE(mgthdr->fc); |
157 | 163 | ||
158 | /* Get the sender, bssid and dest mac address */ | 164 | /* Get the sender, bssid and dest mac address */ |
159 | etheraddr_string(mgthdr->bssid,ppinfo->bssid); | 165 | etheraddr_string(mgthdr->bssid,ppinfo->bssid); |
160 | etheraddr_string(mgthdr->da,ppinfo->desthwaddr); | 166 | etheraddr_string(mgthdr->da,ppinfo->desthwaddr); |
161 | etheraddr_string(mgthdr->sa,ppinfo->sndhwaddr); | 167 | etheraddr_string(mgthdr->sa,ppinfo->sndhwaddr); |
162 | ppinfo->fc_wep = FC_WEP(mgthdr->fc); | 168 | ppinfo->fc_wep = FC_WEP(mgthdr->fc); |
163 | return 0; | 169 | return 0; |
164 | } | 170 | } |
165 | 171 | ||
166 | 172 | ||
167 | void etheraddr_string(register const u_char *ep, char *text) | 173 | void etheraddr_string(register const u_char *ep, char *text) |
168 | { | 174 | { |
169 | static char hex[] = "0123456789abcdef"; | 175 | static char hex[] = "0123456789abcdef"; |
170 | register unsigned int i, j; | 176 | register unsigned int i, j; |
171 | register char *cp; | 177 | register char *cp; |
172 | char buf[sizeof("00:00:00:00:00:00")]; | 178 | char buf[sizeof("00:00:00:00:00:00")]; |
173 | cp = buf; | 179 | cp = buf; |
174 | if ((j = *ep >> 4) != 0) | 180 | if ((j = *ep >> 4) != 0) |
175 | *cp++ = hex[j]; | 181 | *cp++ = hex[j]; |
176 | *cp++ = hex[*ep++ & 0xf]; | 182 | *cp++ = hex[*ep++ & 0xf]; |
177 | for (i = 5; (int)--i >= 0;) { | 183 | for (i = 5; (int)--i >= 0;) { |
178 | *cp++ = ':'; | 184 | *cp++ = ':'; |
179 | if ((j = *ep >> 4) != 0) | 185 | if ((j = *ep >> 4) != 0) |
180 | *cp++ = hex[j]; | 186 | *cp++ = hex[j]; |
181 | *cp++ = hex[*ep++ & 0xf]; | 187 | *cp++ = hex[*ep++ & 0xf]; |
182 | } | 188 | } |
183 | *cp = '\0'; | 189 | *cp = '\0'; |
184 | strcpy(text,buf); | 190 | strcpy(text,buf); |
185 | } | 191 | } |
186 | 192 | ||
187 | /* beacon handler */ | 193 | /* beacon handler */ |
188 | int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo) | 194 | int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo) |
189 | { | 195 | { |
190 | struct mgmt_body_t pbody; | 196 | struct mgmt_body_t pbody; |
191 | int offset = 0; | 197 | int offset = 0; |
192 | 198 | ||
193 | /* Get the static informations out of the packet */ | 199 | /* Get the static informations out of the packet */ |
194 | memset(&pbody, 0, sizeof(pbody)); | 200 | memset(&pbody, 0, sizeof(pbody)); |
195 | memcpy(&pbody.timestamp, p, 8); | 201 | memcpy(&pbody.timestamp, p, 8); |
196 | offset += 8; | 202 | offset += 8; |
197 | pbody.beacon_interval = EXTRACT_LE_16BITS(p+offset); | 203 | pbody.beacon_interval = EXTRACT_LE_16BITS(p+offset); |
198 | offset += 2; | 204 | offset += 2; |
199 | pbody.capability_info = EXTRACT_LE_16BITS(p+offset); | 205 | pbody.capability_info = EXTRACT_LE_16BITS(p+offset); |
200 | offset += 2; | 206 | offset += 2; |
201 | 207 | ||
202 | /* Gets the different flags out of the capabilities */ | 208 | /* Gets the different flags out of the capabilities */ |
203 | ppinfo->cap_ESS = CAPABILITY_ESS(pbody.capability_info); | 209 | ppinfo->cap_ESS = CAPABILITY_ESS(pbody.capability_info); |
204 | ppinfo->cap_IBSS = CAPABILITY_IBSS(pbody.capability_info); | 210 | ppinfo->cap_IBSS = CAPABILITY_IBSS(pbody.capability_info); |
205 | ppinfo->cap_WEP = CAPABILITY_PRIVACY(pbody.capability_info); | 211 | ppinfo->cap_WEP = CAPABILITY_PRIVACY(pbody.capability_info); |
206 | 212 | ||
207 | /* Gets the tagged elements out of the packets */ | 213 | /* Gets the tagged elements out of the packets */ |
208 | while (offset + 1 < ppinfo->pktlen) | 214 | while (offset + 1 < ppinfo->pktlen) |
209 | { | 215 | { |
210 | switch (*(p + offset)) | 216 | switch (*(p + offset)) |
211 | { | 217 | { |
212 | case E_SSID: | 218 | case E_SSID: |
213 | memcpy(&(pbody.ssid),p+offset,2); offset += 2; | 219 | memcpy(&(pbody.ssid),p+offset,2); offset += 2; |
214 | if (pbody.ssid.length > 0) | 220 | if (pbody.ssid.length > 0) |
215 | { | 221 | { |
216 | memcpy(&(pbody.ssid.ssid),p+offset,pbody.ssid.length); offset += pbody.ssid.length; | 222 | memcpy(&(pbody.ssid.ssid),p+offset,pbody.ssid.length); offset += pbody.ssid.length; |
217 | pbody.ssid.ssid[pbody.ssid.length]='\0'; | 223 | pbody.ssid.ssid[pbody.ssid.length]='\0'; |
218 | if (strcmp((char *)pbody.ssid.ssid,"")==0) | 224 | if (strcmp((char *)pbody.ssid.ssid,"")==0) |
219 | memcpy(ppinfo->ssid, NONBROADCASTING, sizeof(ppinfo->ssid)); | 225 | memcpy(ppinfo->ssid, NONBROADCASTING, sizeof(ppinfo->ssid)); |
220 | else | 226 | else |
221 | memcpy(ppinfo->ssid, pbody.ssid.ssid, sizeof(ppinfo->ssid)); | 227 | memcpy(ppinfo->ssid, pbody.ssid.ssid, sizeof(ppinfo->ssid)); |
222 | ppinfo->ssid_len = pbody.ssid.length; | 228 | ppinfo->ssid_len = pbody.ssid.length; |
223 | } | 229 | } |
224 | break; | 230 | break; |
225 | 231 | ||
226 | case E_CHALLENGE: | 232 | case E_CHALLENGE: |
227 | memcpy(&(pbody.challenge),p+offset,2); offset += 2; | 233 | memcpy(&(pbody.challenge),p+offset,2); offset += 2; |
228 | if (pbody.challenge.length > 0) | 234 | if (pbody.challenge.length > 0) |
229 | { | 235 | { |
230 | memcpy(&(pbody.challenge.text),p+offset,pbody.challenge.length); offset += pbody.challenge.length; | 236 | memcpy(&(pbody.challenge.text),p+offset,pbody.challenge.length); offset += pbody.challenge.length; |
231 | pbody.challenge.text[pbody.challenge.length]='\0'; | 237 | pbody.challenge.text[pbody.challenge.length]='\0'; |
232 | } | 238 | } |
233 | break; | 239 | break; |
234 | case E_RATES: | 240 | case E_RATES: |
235 | memcpy(&(pbody.rates),p+offset,2); offset += 2; | 241 | memcpy(&(pbody.rates),p+offset,2); offset += 2; |
236 | if (pbody.rates.length > 0) | 242 | if (pbody.rates.length > 0) |
237 | { | 243 | { |
238 | memcpy(&(pbody.rates.rate),p+offset,pbody.rates.length); offset += pbody.rates.length; | 244 | memcpy(&(pbody.rates.rate),p+offset,pbody.rates.length); offset += pbody.rates.length; |
239 | } | 245 | } |
240 | break; | 246 | break; |
241 | case E_DS: | 247 | case E_DS: |
242 | memcpy(&(pbody.ds),p+offset,3); offset +=3; | 248 | memcpy(&(pbody.ds),p+offset,3); offset +=3; |
243 | ppinfo->channel = pbody.ds.channel; | 249 | ppinfo->channel = pbody.ds.channel; |
244 | break; | 250 | break; |
245 | case E_CF: | 251 | case E_CF: |
246 | memcpy(&(pbody.cf),p+offset,8); offset +=8; | 252 | memcpy(&(pbody.cf),p+offset,8); offset +=8; |
247 | break; | 253 | break; |
248 | case E_TIM: | 254 | case E_TIM: |
249 | memcpy(&(pbody.tim),p+offset,2); offset +=2; | 255 | memcpy(&(pbody.tim),p+offset,2); offset +=2; |
250 | memcpy(&(pbody.tim.count),p+offset,3); offset +=3; | 256 | memcpy(&(pbody.tim.count),p+offset,3); offset +=3; |
251 | if ((pbody.tim.length -3) > 0) | 257 | if ((pbody.tim.length -3) > 0) |
252 | { | 258 | { |
253 | memcpy((pbody.tim.bitmap),p+(pbody.tim.length -3),(pbody.tim.length -3)); | 259 | memcpy((pbody.tim.bitmap),p+(pbody.tim.length -3),(pbody.tim.length -3)); |
254 | offset += pbody.tim.length -3; | 260 | offset += pbody.tim.length -3; |
255 | } | 261 | } |
256 | break; | 262 | break; |
257 | default: | 263 | default: |
258 | 264 | ||
259 | offset+= *(p+offset+1) + 2; | 265 | offset+= *(p+offset+1) + 2; |
260 | break; | 266 | break; |
261 | } /* end of switch*/ | 267 | } /* end of switch*/ |
262 | } /* end of for loop */ | 268 | } /* end of for loop */ |
263 | return 0; | 269 | return 0; |
264 | 270 | ||
265 | } /* End of handle_beacon */ | 271 | } /* End of handle_beacon */ |
266 | 272 | ||
267 | 273 | ||
268 | int GetHeaderLength(u_int16_t fc) | 274 | int GetHeaderLength(u_int16_t fc) |
269 | { | 275 | { |
270 | int iLength=0; | 276 | int iLength=0; |
271 | 277 | ||
272 | switch (FC_TYPE(fc)) | 278 | switch (FC_TYPE(fc)) |
273 | { | 279 | { |
274 | case T_MGMT: | 280 | case T_MGMT: |
275 | iLength = MGMT_HEADER_LEN; | 281 | iLength = MGMT_HEADER_LEN; |
276 | break; | 282 | break; |
277 | case T_CTRL: | 283 | case T_CTRL: |
278 | switch (FC_SUBTYPE(fc)) | 284 | switch (FC_SUBTYPE(fc)) |
279 | { | 285 | { |
280 | case CTRL_PS_POLL: | 286 | case CTRL_PS_POLL: |
281 | iLength = CTRL_PS_POLL_LEN; | 287 | iLength = CTRL_PS_POLL_LEN; |
282 | break; | 288 | break; |
283 | case CTRL_RTS: | 289 | case CTRL_RTS: |
284 | iLength = CTRL_RTS_LEN; | 290 | iLength = CTRL_RTS_LEN; |
285 | break; | 291 | break; |
286 | case CTRL_CTS: | 292 | case CTRL_CTS: |
287 | iLength = CTRL_CTS_LEN; | 293 | iLength = CTRL_CTS_LEN; |
288 | break; | 294 | break; |
289 | case CTRL_ACK: | 295 | case CTRL_ACK: |
290 | iLength = CTRL_ACK_LEN; | 296 | iLength = CTRL_ACK_LEN; |
291 | break; | 297 | break; |
292 | case CTRL_CF_END: | 298 | case CTRL_CF_END: |
293 | iLength = CTRL_END_LEN; | 299 | iLength = CTRL_END_LEN; |
294 | break; | 300 | break; |
295 | case CTRL_END_ACK: | 301 | case CTRL_END_ACK: |
296 | iLength = CTRL_END_ACK_LEN; | 302 | iLength = CTRL_END_ACK_LEN; |
297 | break; | 303 | break; |
298 | default: | 304 | default: |
299 | iLength = 0; | 305 | iLength = 0; |
300 | break; | 306 | break; |
301 | } | 307 | } |
302 | break; | 308 | break; |
303 | case T_DATA: | 309 | case T_DATA: |
304 | if (FC_TO_DS(fc) && FC_FROM_DS(fc)) | 310 | if (FC_TO_DS(fc) && FC_FROM_DS(fc)) |
305 | iLength = 30; | 311 | iLength = 30; |
306 | else | 312 | else |
307 | iLength = 24; | 313 | iLength = 24; |
308 | break; | 314 | break; |
309 | default: | 315 | default: |
310 | wl_logerr("unknown IEEE802.11 frame type (%d)", FC_TYPE(fc)); | 316 | wl_logerr("unknown IEEE802.11 frame type (%d)", FC_TYPE(fc)); |
311 | break; | 317 | break; |
312 | } | 318 | } |
313 | return iLength; | 319 | return iLength; |
314 | } | 320 | } |