madwifi: add sanity checks for monitor mode injection
[openwrt-10.03/.git] / package / madwifi / patches / 436-injection_checks.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -3199,7 +3199,13 @@ ath_tx_startraw(struct net_device *dev, 
4         struct ieee80211_frame *wh;
5  
6         wh = (struct ieee80211_frame *)skb->data;
7 +
8         try0 = ph->try0;
9 +       if (!try0)
10 +               try0 = 1;
11 +       else if (try0 > 11)
12 +               try0 = 11;
13 +
14         rt = sc->sc_currates;
15         txrate = dot11_to_ratecode(sc, rt, ph->rate0);
16         power = ph->power > 63 ? 63 : ph->power;
17 @@ -3224,7 +3230,8 @@ ath_tx_startraw(struct net_device *dev, 
18         rt = sc->sc_currates;
19         KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
20  
21 -       if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
22 +       if (((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_DATA) ||
23 +               IEEE80211_IS_MULTICAST(wh->i_addr1)) {
24                 flags |= HAL_TXDESC_NOACK;      /* no ack on broad/multicast */
25                 sc->sc_stats.ast_tx_noack++;
26                 try0 = 1;