Packet resending + IP filtering issues

ahuguet at cttc.es ahuguet
Mon May 7 04:32:56 PDT 2007


I workarounded the issue.
Monitoring the net I saw that there was an LLC+SNAP encapsulation, thus I
needed an extra 8 Byte offset.
I'm not entirely satisfied having that 8 value number hardcoded there, and
I'd say in the hostap_80211_rx code there should be something that could
be of use as to determine that extra offset. I'd welcome any hint in that
direction.

So far, the filter that seems to be working in my set environment is the
one that follows:

if (type == IEEE80211_FTYPE_DATA && stype == IEEE80211_STYPE_DATA && dst
!= dev->dev_addr){
		 printk(KERN_DEBUG "Data of %d bytes \n", skb->len);
		 printk(KERN_DEBUG "Sequence number %d \n", WLAN_GET_SEQ_SEQ(sc)>>4);
		/* The secuence number must be shifted 4 bits to the right, to proper
see its 			 * value*/
		if (skb->len > 44){
			memcpy (&protocol, skb->data+hdrlen+8+9,1);
			/* Skip MAC header(hdrlen) + LLC header(8) + IP header offset(9) */
			printk(KERN_DEBUG "Protocol %d \n",protocol);

			if (protocol==17){ /* Test with UDP */
				if (local->last_data_rx == NULL) /* We've nothing buffered */
					local->last_data_rx = pskb_copy (skb,GFP_KERNEL);
				else { /* We've old data, first free the old, then copy the new */
					dev_kfree_skb(local->last_data_rx);
					local->last_data_rx = pskb_copy (skb,GFP_KERNEL);
				}
				printk(KERN_DEBUG "Copy done \n");
			}
		}
	}
Sorry for the e-mail flooding and multiple self-replying, but I preferred
to do this, in order to safe answers to questions that are now
"workarounded".



>> 4)
>>
>> I then tried to access the IP header field directly, but seems I'm
>> missing
>> something, since the printed numbers do not correspond to the expected
>> protocol types.
>>
>> if (skb->len > 40){
>>  memcpy (&protocol,skb->data+20+9,1);
>>  printk(KERN_DEBUG "Protocol %d \n",protocol);
>> }
>>
>> I add the 20, for the MAC header is 20 Bytes lenght, plus the 9 Bytes of
>> offset corresponding to the IP header that follows. Protocol is a field
>> a
>> Byte lenght.
>>
>
> My mistake when typing this, I was thinking on IP header which is 20 Bytes
> lenght.
> The code used at attempt 4) is:
>
> if (skb->len > 44){
>  memcpy (&protocol, skb->data+hdrlen+9,1);
>  printk(KERN_DEBUG "Protocol %d \n",protocol);
> }
>
> UDP datagrams, that should have a protocol number of 17, show 0 when using
> the aforementioned code.
>






More information about the Hostap mailing list