Debian Codegraph @

patches/old/madwifi-ng-r2662-dirty_wesside-ng_fix.patch

raw
1 Index: ath/if_ath.c
2 ===================================================================
3 --- ath/if_ath.c (revision 2662)
4 +++ ath/if_ath.c (working copy)
5 @@ -2282,6 +2282,7 @@
6 ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
7 {
8 struct ath_softc *sc = dev->priv;
9 + struct ieee80211com *ic = &sc->sc_ic;
10 struct ath_hal *ah = sc->sc_ah;
11 struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
12 const HAL_RATE_TABLE *rt;
13 @@ -2294,7 +2295,11 @@
14 struct ieee80211_frame *wh;
15
16 wh = (struct ieee80211_frame *) skb->data;
17 - try0 = ph->try0;
18 + try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
19 + /*
20 + * The retry value has to be patched to 1 when injecting,
21 + * otherwise the sequence number will be overwritten
22 + */
23 rt = sc->sc_currates;
24 txrate = dot11_to_ratecode(sc, rt, ph->rate0);
25 power = ph->power > 60 ? 60 : ph->power;
26 @@ -5360,18 +5365,21 @@
27 {
28 struct ath_softc *sc = dev->priv;
29 struct ieee80211com *ic = &sc->sc_ic;
30 - struct ieee80211_frame *wh = (struct ieee80211_frame *) skb->data;
31 - unsigned int headersize = ieee80211_anyhdrsize(wh);
32 - int padbytes = roundup(headersize, 4) - headersize;
33 + struct ieee80211_frame *wh;
34
35 KASSERT(ic->ic_flags & IEEE80211_F_DATAPAD,
36 ("data padding not enabled?"));
37
38 - if (padbytes > 0) {
39 + wh = (struct ieee80211_frame *) skb->data;
40 + if (IEEE80211_QOS_HAS_SEQ(wh)) {
41 + struct sk_buff *skb1 = skb_copy(skb, GFP_ATOMIC);
42 /* Remove hw pad bytes */
43 - struct sk_buff *skb1 = skb_copy(skb, GFP_ATOMIC);
44 - memmove(skb1->data + padbytes, skb1->data, headersize);
45 - skb_pull(skb1, padbytes);
46 + unsigned int headersize = ieee80211_hdrsize(wh);
47 + int padbytes = roundup(headersize, 4) - headersize;
48 + if (padbytes > 0) {
49 + memmove(skb1->data + padbytes, skb1->data, headersize);
50 + skb_pull(skb1, padbytes);
51 + }
52 ieee80211_input_monitor(ic, skb1, bf, 0, rtsf, sc);
53 dev_kfree_skb(skb1);
54 } else {
55 @@ -5392,8 +5400,6 @@
56 A_MAX(sizeof(struct wlan_ng_prism2_header),
57 ATHDESC_HEADER_SIZE));
58 u_int32_t tstamp;
59 - unsigned int headersize;
60 - int padbytes;
61 /*
62 * release the owner of this skb since we're basically
63 * recycling it
64 @@ -5411,13 +5417,15 @@
65 skb_orphan(skb);
66
67 wh = (struct ieee80211_frame *) skb->data;
68 - headersize = ieee80211_anyhdrsize(wh);
69 - padbytes = roundup(headersize, 4) - headersize;
70 - if (padbytes > 0) {
71 + if (IEEE80211_QOS_HAS_SEQ(wh)) {
72 /* Unlike in rx_capture, we're freeing the skb at the end
73 * anyway, so we don't need to worry about using a copy */
74 - memmove(skb->data + padbytes, skb->data, headersize);
75 - skb_pull(skb, padbytes);
76 + unsigned int headersize = ieee80211_hdrsize(wh);
77 + int padbytes = roundup(headersize, 4) - headersize;
78 + if (padbytes > 0) {
79 + memmove(skb->data + padbytes, skb->data, headersize);
80 + skb_pull(skb, padbytes);
81 + }
82 }
83
84 if (skb_headroom(skb) < extra &&