Adds sequence numbers to IEEE 802.11 headers. Signed-off-by: Jiri Benc Signed-off-by: Jirka Bohac Index: netdev/include/net/ieee80211.h =================================================================== --- netdev.orig/include/net/ieee80211.h 2005-09-17 14:52:22.000000000 +0200 +++ netdev/include/net/ieee80211.h 2005-09-17 14:52:41.000000000 +0200 @@ -729,6 +729,8 @@ struct ieee80211_device { unsigned int frag_next_idx; u16 fts; /* Fragmentation Threshold */ + u16 seq_number; /* sequence number in transmitted frames */ + /* Association info */ u8 bssid[ETH_ALEN]; Index: netdev/net/ieee80211/ieee80211_module.c =================================================================== --- netdev.orig/net/ieee80211/ieee80211_module.c 2005-09-17 14:51:12.000000000 +0200 +++ netdev/net/ieee80211/ieee80211_module.c 2005-09-17 14:52:41.000000000 +0200 @@ -138,6 +138,7 @@ struct ieee80211_device *alloc_ieee80211 /* Default fragmentation threshold is maximum payload size */ ieee->fts = DEFAULT_FTS; + ieee->seq_number = 0; ieee->scan_age = DEFAULT_MAX_SCAN_AGE; ieee->open_wep = 1; Index: netdev/net/ieee80211/ieee80211_tx.c =================================================================== --- netdev.orig/net/ieee80211/ieee80211_tx.c 2005-09-17 14:51:12.000000000 +0200 +++ netdev/net/ieee80211/ieee80211_tx.c 2005-09-17 14:52:41.000000000 +0200 @@ -368,6 +368,13 @@ int ieee80211_xmit(struct sk_buff *skb, else bytes_last_frag = bytes_per_frag; + if (nr_frags > 16) { + /* Should never happen */ + printk(KERN_WARNING "%s: Fragmentation threshold too low\n", + dev->name); + goto failed; + } + /* When we allocate the TXB we allocate enough space for the reserve * and full fragment bytes (bytes_per_frag doesn't include prefix, * postfix, header, FCS, etc.) */ @@ -389,6 +396,8 @@ int ieee80211_xmit(struct sk_buff *skb, frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len); memcpy(frag_hdr, &header, hdr_len); + frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_number | i); + /* If this is not the last fragment, then add the MOREFRAGS * bit to the frame control */ if (i != nr_frags - 1) { @@ -421,6 +430,11 @@ int ieee80211_xmit(struct sk_buff *skb, /* FCS */ skb_put(skb_frag, 4); } + /* Sequence number is stored in bits 4 to 15 of the Sequence Control + * field in 802.11 header. The seq_number field is organized the + * same way so we don't need to shift while copying it to 802.11 + * header. */ + ieee->seq_number += 0x10; success: spin_unlock_irqrestore(&ieee->lock, flags);