Changeset 3634

Show
Ignore:
Timestamp:
05/16/08 18:09:28 (3 months ago)
Author:
br1
Message:

let ieee80211_recv_mgmt() return 0 if the frame is to be discarded and don't
process discarded frames in ath_recv_mgmt(). this reduces the number of times
we attempt to merge IBSS to invalid beacons.

this patch is based on the work of Derek Smithies

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • madwifi/trunk/ath/if_ath.c

    r3630 r3634  
    182182static struct sk_buff *ath_rxbuf_take_skb(struct ath_softc *, struct ath_buf *); 
    183183static int ath_rxbuf_init(struct ath_softc *, struct ath_buf *); 
    184 static void ath_recv_mgmt(struct ieee80211vap *, struct ieee80211_node *, 
     184static int ath_recv_mgmt(struct ieee80211vap *, struct ieee80211_node *, 
    185185        struct sk_buff *, int, int, u_int64_t); 
    186186static void ath_setdefantenna(struct ath_softc *, u_int); 
     
    64376437 * including those belonging to other BSS. 
    64386438 */ 
    6439 static void 
     6439static int 
    64406440ath_recv_mgmt(struct ieee80211vap * vap, struct ieee80211_node *ni_or_null, 
    64416441        struct sk_buff *skb, int subtype, int rssi, u_int64_t rtsf) 
     
    64566456        /* Call up first so subsequent work can use information 
    64576457         * potentially stored in the node (e.g. for ibss merge). */ 
    6458         sc->sc_recv_mgmt(vap, ni_or_null, skb, subtype, rssi, rtsf); 
     6458        if (sc->sc_recv_mgmt(vap, ni_or_null, skb, subtype, rssi, rtsf) == 0) 
     6459                return 0; 
    64596460 
    64606461        /* Lookup the new node if any (this grabs a reference to it). */ 
     
    64636464        if (ni == NULL) { 
    64646465                DPRINTF(sc, ATH_DEBUG_BEACON, "Dropping; node unknown.\n"); 
    6465                 return
     6466                return 0
    64666467        } 
    64676468 
     
    65396540 
    65406541        ieee80211_unref_node(&ni); 
     6542        return 0; 
    65416543} 
    65426544 
     
    68386840                ath_hal_rxmonitor(ah, &sc->sc_halstats, &sc->sc_curchan); 
    68396841        if (!bf_processed) 
    6840                 DPRINTF(sc, ATH_DEBUG_RX_PROC,  
    6841                         "Warning: %s got scheduled when no recieve " 
    6842                             "buffers were ready. Were they cleared?\n",  
     6842                DPRINTF(sc, ATH_DEBUG_RX_PROC, 
     6843                        "Warning: %s got scheduled when no receive " 
     6844                            "buffers were ready. Were they cleared?\n", 
    68436845                        __func__); 
    6844         DPRINTF(sc, ATH_DEBUG_RX_PROC, "%s: cycle completed.
    6845                 " %d rx buf processed. %d were errors.  %d skb accepted.\n",  
     6846        DPRINTF(sc, ATH_DEBUG_RX_PROC, "%s: cycle completed.
     6847                " %d rx buf processed. %d were errors. %d skb accepted.\n", 
    68466848                __func__, bf_processed, errors, skb_accepted); 
    68476849#undef PA2DESC 
  • madwifi/trunk/ath/if_athvar.h

    r3627 r3634  
    642642        int sc_debug; 
    643643        int sc_default_ieee80211_debug;         /* default debug flags for new VAPs */ 
    644         void (*sc_recv_mgmt)(struct ieee80211vap *, struct ieee80211_node *, 
     644        int (*sc_recv_mgmt)(struct ieee80211vap *, struct ieee80211_node *, 
    645645                struct sk_buff *, int, int, u_int64_t); 
    646646#ifdef IEEE80211_DEBUG_REFCNT 
  • madwifi/trunk/net80211/ieee80211_input.c

    r3621 r3634  
    16791679                        "%s", "no " #__elem);                           \ 
    16801680                vap->iv_stats.is_rx_elem_missing++;                     \ 
    1681                 return;                                                       \ 
     1681                return 0;                                             \ 
    16821682        }                                                               \ 
    16831683        if ((__elem)[1] > (__maxlen)) {                                 \ 
     
    16871687                        "bad " #__elem " len %d", (__elem)[1]);         \ 
    16881688                vap->iv_stats.is_rx_elem_toobig++;                      \ 
    1689                 return;                                                       \ 
     1689                return 0;                                             \ 
    16901690        }                                                               \ 
    16911691} while (0) 
     
    16981698                        "%s", "ie too short");                          \ 
    16991699                vap->iv_stats.is_rx_elem_toosmall++;                    \ 
    1700                 return;                                                       \ 
     1700                return 0;                                             \ 
    17011701        }                                                               \ 
    17021702} while (0) 
     
    17231723                                wh->i_addr2, _ssid);                    \ 
    17241724                vap->iv_stats.is_rx_ssidmismatch++;                     \ 
    1725                 return;                                                       \ 
     1725                return 0;                                             \ 
    17261726        }                                                               \ 
    17271727} while (0) 
     
    17321732            memcmp((_ssid) + 2, (_ni)->ni_essid, (_ssid)[1]) != 0)) {   \ 
    17331733                vap->iv_stats.is_rx_ssidmismatch++;                     \ 
    1734                 return;                                                       \ 
     1734                return 0;                                             \ 
    17351735        }                                                               \ 
    17361736} while (0) 
     
    30413041 * Context: SoftIRQ 
    30423042 */ 
    3043 void 
     3043int 
    30443044ieee80211_recv_mgmt(struct ieee80211vap *vap, 
    30453045        struct ieee80211_node *ni_or_null, struct sk_buff *skb, 
     
    30903090                    vap->iv_opmode == IEEE80211_M_IBSS)) { 
    30913091                        vap->iv_stats.is_rx_mgtdiscard++; 
    3092                         return
     3092                        return 0
    30933093                } 
    30943094                /* 
     
    31983198                } 
    31993199                if (frm > efrm) 
    3200                        return; 
     3200                  return 0;  /* reached past the end */ 
    32013201                IEEE80211_VERIFY_ELEMENT(scan.rates, IEEE80211_RATE_MAXSIZE); 
    32023202                IEEE80211_VERIFY_ELEMENT(scan.ssid, IEEE80211_NWID_LEN); 
     
    32083208                                "invalid channel %u", scan.chan); 
    32093209                        vap->iv_stats.is_rx_badchan++; 
    3210                         return
     3210                        return 0
    32113211                } 
    32123212#endif 
     
    32283228                                "for off-channel %u", scan.chan); 
    32293229                        vap->iv_stats.is_rx_chanmismatch++; 
    3230                         return
     3230                        return 0
    32313231                } 
    32323232 
     
    32403240                                wh, "beacon", "invalid beacon interval (%u)", 
    32413241                                scan.bintval); 
    3242                         return
     3242                        return 0
    32433243                } 
    32443244 
     
    34073407                        else if (contbgscan(vap) || startbgscan(vap)) 
    34083408                                ieee80211_bg_scan(vap); 
    3409                         return
     3409                        return 0
    34103410                } 
    34113411                /* 
     
    34143414                if (ic->ic_flags & IEEE80211_F_SCAN) { 
    34153415                        ieee80211_add_scan(vap, &scan, wh, subtype, rssi, rtsf); 
    3416                         return
     3416                        return 0
    34173417                } 
    34183418                if ((vap->iv_opmode == IEEE80211_M_IBSS) &&  
     
    34213421                                /* Create a new entry in the neighbor table. */ 
    34223422                                ni = ieee80211_add_neighbor(vap, wh, &scan); 
     3423                                if (ni == NULL) 
     3424                                        return 0; 
    34233425                        } else { 
    34243426                                /* 
     
    34683470                    vap->iv_state != IEEE80211_S_RUN) { 
    34693471                        vap->iv_stats.is_rx_mgtdiscard++; 
    3470                         return
     3472                        return 0
    34713473                } 
    34723474                if (IEEE80211_IS_MULTICAST(wh->i_addr2)) { 
    34733475                        /* frame must be directed */ 
    34743476                        vap->iv_stats.is_rx_mgtdiscard++;       /* XXX: stat */ 
    3475                         return
     3477                        return 0
    34763478                } 
    34773479 
     
    34813483#ifdef ATH_SUPERG_XR 
    34823484        if (vap->iv_flags & IEEE80211_F_XR) 
    3483                 return
     3485                return 0
    34843486#endif 
    34853487                /* 
     
    35123514                } 
    35133515                if (frm > efrm) 
    3514                        return; 
     3516                  return 0; /* reached past the end */ 
    35153517                IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_MAXSIZE); 
    35163518                IEEE80211_VERIFY_ELEMENT(ssid, IEEE80211_NWID_LEN); 
     
    35223524                                "%s", "no ssid with ssid suppression enabled"); 
    35233525                        vap->iv_stats.is_rx_ssidmismatch++; /*XXX*/ 
    3524                         return
     3526                        return 0
    35253527                } 
    35263528                if (ni == vap->iv_bss) { 
     
    35383540                        } 
    35393541                        if (ni == NULL) 
    3540                                 return
     3542                                return 0
    35413543                        allocbs = 1; 
    35423544                } 
     
    36033605                                IEEE80211_DISCARD(vap, IEEE80211_MSG_AUTH, 
    36043606                                        wh, "auth", "%s", "not to pier xr bssid"); 
    3605                                 return
     3607                                return 0
    36063608                        } 
    36073609                } 
     
    36153617                                wh, "auth", "%s", "disallowed by ACL"); 
    36163618                        vap->iv_stats.is_rx_acl++; 
    3617                         return
     3619                        return 0
    36183620                } 
    36193621                if (vap->iv_flags & IEEE80211_F_COUNTERM) { 
     
    36273629                                        IEEE80211_REASON_MIC_FAILURE); 
    36283630                        } 
    3629                         return
     3631                        return 0
    36303632                } 
    36313633                if (algo == IEEE80211_AUTH_ALG_SHARED) 
     
    36453647                                        (IEEE80211_STATUS_ALG << 16)); 
    36463648                        } 
    3647                         return
     3649                        return 0
    36483650                } 
    36493651                break; 
     
    36593661                    vap->iv_state != IEEE80211_S_RUN) { 
    36603662                        vap->iv_stats.is_rx_mgtdiscard++; 
    3661                         return
     3663                        return 0
    36623664                } 
    36633665 
     
    36903692                                "%s", "wrong bssid"); 
    36913693                        vap->iv_stats.is_rx_assoc_bss++; 
    3692                         return
     3694                        return 0
    36933695                } 
    36943696                capinfo = le16toh(*(__le16 *)frm); 
     
    37463748                } 
    37473749                if (frm > efrm) 
    3748                         return; 
     3750                        return 0; /* reached past the end */ 
    37493751 
    37503752                IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_MAXSIZE); 
     
    37603762                                IEEE80211_REASON_ASSOC_NOT_AUTHED); 
    37613763                        vap->iv_stats.is_rx_assoc_notauth++; 
    3762                         return
     3764                        return 0
    37633765                } 
    37643766 
     
    37763778                                ieee80211_node_leave(ni); /* XXX */ 
    37773779                                vap->iv_stats.is_rx_assoc_badscie++; /* XXX */ 
    3778                                 return
     3780                                return 0
    37793781                        } 
    37803782                } 
     
    37933795                        /* XXX distinguish WPA/RSN? */ 
    37943796                        vap->iv_stats.is_rx_assoc_badwpaie++; 
    3795                         return
     3797                        return 0
    37963798                } 
    37973799 
     
    38113813                                /* XXX distinguish WPA/RSN? */ 
    38123814                                vap->iv_stats.is_rx_assoc_badwpaie++; 
    3813                                 return
     3815                                return 0
    38143816                        } 
    38153817                        IEEE80211_NOTE_MAC(vap, 
     
    38353837                        ieee80211_node_leave(ni); 
    38363838                        vap->iv_stats.is_rx_assoc_capmismatch++; 
    3837                         return
     3839                        return 0
    38383840                } 
    38393841                rate = ieee80211_setup_rates(ni, rates, xrates, 
     
    38553857                        ieee80211_node_leave(ni); 
    38563858                        vap->iv_stats.is_rx_assoc_norate++; 
    3857                         return
     3859                        return 0
    38583860                } 
    38593861 
     
    38713873                                ieee80211_node_leave(ni); 
    38723874                                vap->iv_stats.is_rx_assoc_capmismatch++; 
    3873                                 return
     3875                                return 0
    38743876                        } 
    38753877                } 
     
    39253927                    vap->iv_state != IEEE80211_S_ASSOC) { 
    39263928                        vap->iv_stats.is_rx_mgtdiscard++; 
    3927                         return
     3929                        return 0
    39283930                } 
    39293931 
     
    39513953                        ieee80211_new_state(vap, IEEE80211_S_SCAN, 
    39523954                                IEEE80211_SCAN_FAIL_STATUS); 
    3953                         return
     3955                        return 0
    39543956                } 
    39553957                associd = le16toh(*(__le16 *)frm); 
     
    39873989                } 
    39883990                if (frm > efrm) 
    3989                         return; 
     3991                        return 0; /* reached past the end */ 
    39903992                IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_MAXSIZE); 
    39913993                rate = ieee80211_setup_rates(ni, rates, xrates, 
     
    40004002                        ieee80211_new_state(vap, IEEE80211_S_SCAN, 
    40014003                                IEEE80211_SCAN_FAIL_STATUS); 
    4002                         return
     4004                        return 0
    40034005                } 
    40044006 
     
    40684070                if (vap->iv_state == IEEE80211_S_SCAN) { 
    40694071                        vap->iv_stats.is_rx_mgtdiscard++; 
    4070                         return
     4072                        return 0
    40714073                } 
    40724074                /* 
     
    41044106                    vap->iv_state != IEEE80211_S_AUTH) { 
    41054107                        vap->iv_stats.is_rx_mgtdiscard++; 
    4106                         return
     4108                        return 0
    41074109                } 
    41084110                /* 
     
    41394141#undef ISREASSOC 
    41404142#undef ISPROBE 
     4143        return 1; 
    41414144} 
    41424145#undef IEEE80211_VERIFY_LENGTH 
  • madwifi/trunk/net80211/ieee80211_node.c

    r3631 r3634  
    947947 
    948948        if (show_counter) { 
    949                 snprintf(node_count,  
    950                          sizeof(node_count),  
    951                          "[#NODES=%05d] ",  
     949                snprintf(node_count, 
     950                         sizeof(node_count), 
     951                         "[#NODES=%05d] ", 
    952952                         atomic_read(&ni->ni_ic->ic_node_counter)); 
    953953        } 
  • madwifi/trunk/net80211/ieee80211_proto.h

    r3621 r3634  
    7171void ieee80211_saveie(u_int8_t **, const u_int8_t *); 
    7272void ieee80211_saveath(struct ieee80211_node *, u_int8_t *); 
    73 void ieee80211_recv_mgmt(struct ieee80211vap *, struct ieee80211_node *, 
     73int ieee80211_recv_mgmt(struct ieee80211vap *, struct ieee80211_node *, 
    7474        struct sk_buff *, int, int, u_int64_t); 
    7575void ieee80211_sta_pwrsave(struct ieee80211vap *, int); 
  • madwifi/trunk/net80211/ieee80211_var.h

    r3594 r3634  
    437437        /* Send/recv 802.11 management frame */ 
    438438        int (*ic_send_mgmt)(struct ieee80211_node *, int, int); 
    439         void (*ic_recv_mgmt)(struct ieee80211vap *, struct ieee80211_node *, 
     439        int (*ic_recv_mgmt)(struct ieee80211vap *, struct ieee80211_node *, 
    440440                struct sk_buff *, int, int, u_int64_t); 
    441441