Ticket #921: madwifi_monitor_invalid_frames.patch

File madwifi_monitor_invalid_frames.patch, 3.6 kB (added by scottraynel@gmail.com, 6 years ago)

Use "monitor_invalid_frames" instead of "monitor_error_frames". Signed-off-by: Scott Raynel <scottraynel@gmail.com>

  • net80211/ieee80211_monitor.c

    old new  
    247247                        /* don't rx fromds, tods, or dstods packets */ 
    248248                        continue; 
    249249                }                    
     250 
     251                /* If we have rx'd an error frame... */ 
     252                if (!tx && ds->ds_rxstat.rs_status != 0) { 
     253                        /* If the vap does not want error frames and 
     254                         * the error was not a crypto error (which we  
     255                         * let through regardless), drop the frame */ 
     256                        if (vap->iv_monitor_invalid_frames == 0 && 
     257                                        (ds->ds_rxstat.rs_status &~ 
     258                                         (HAL_RXERR_DECRYPT|HAL_RXERR_MIC))) { 
     259                                continue; 
     260                        } 
     261                } 
     262                 
    250263                skb1 = skb_copy(skb, GFP_ATOMIC); 
    251264                if (skb1 == NULL) { 
    252265                        /* XXX stat+msg */ 
  • net80211/ieee80211_var.h

    old new  
    313313 
    314314        int iv_monitor_nods_only;               /* in monitor mode only nods traffic */ 
    315315        int iv_monitor_txf_len;                 /* in monitor mode, truncate tx packets */ 
     316        int iv_monitor_invalid_frames;          /* in monitor mode, accept error frames */ 
    316317 
    317318        int (*iv_newstate)(struct ieee80211vap *, enum ieee80211_state, int); 
    318319        u_int8_t iv_myaddr[IEEE80211_ADDR_LEN]; 
  • net80211/ieee80211_linux.c

    old new  
    546546        } 
    547547        return ret; 
    548548} 
     549static int 
     550IEEE80211_SYSCTL_DECL(ieee80211_sysctl_monitor_invalid_frames, ctl, write, filp, buffer, 
     551        lenp, ppos) 
     552{ 
     553        struct ieee80211vap *vap = ctl->extra1; 
     554        u_int val; 
     555        int ret; 
    549556 
     557        ctl->data = &val; 
     558        ctl->maxlen = sizeof(val); 
     559        if (write) { 
     560                ret = IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, 
     561                        lenp, ppos); 
     562                if (ret == 0) 
     563                        vap->iv_monitor_invalid_frames = val; 
     564        } else { 
     565                val = vap->iv_monitor_invalid_frames; 
     566                ret = IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, 
     567                        lenp, ppos); 
     568        } 
     569        return ret; 
     570} 
     571 
     572 
    550573#define CTL_AUTO        -2      /* cannot be CTL_ANY or CTL_NONE */ 
    551574 
    552575static const ctl_table ieee80211_sysctl_template[] = { 
     
    572595          .mode         = 0644, 
    573596          .proc_handler = ieee80211_sysctl_monitor_txf_len 
    574597        }, 
     598        { .ctl_name     = CTL_AUTO, 
     599          .procname     = "monitor_invalid_frames", 
     600          .mode         = 0644, 
     601          .proc_handler = ieee80211_sysctl_monitor_invalid_frames 
     602        }, 
    575603        /* NB: must be last entry before NULL */ 
    576604        { .ctl_name     = CTL_AUTO, 
    577605          .procname     = "%parent", 
  • ath/if_ath.c

    old new  
    55025502#endif 
    55035503                                } 
    55045504                        } 
    5505                         /* 
    5506                          * Reject error frames, we normally don't want 
    5507                          * to see them in monitor mode (in monitor mode 
    5508                          * allow through packets that have crypto problems). 
     5505                        /*  
     5506                         * Error frame rejection is now done after frames 
     5507                         * are passed to the monitor mode vaps as some 
     5508                         * monitor mode vaps may want to process error frames. 
     5509                         * Filtering of frames with crypto problems is now 
     5510                         * done in ieee80211_input_monitor 
    55095511                         */ 
    5510                         if ((ds->ds_rxstat.rs_status &~ 
    5511                                 (HAL_RXERR_DECRYPT|HAL_RXERR_MIC)) || 
    5512                             sc->sc_ic.ic_opmode != IEEE80211_M_MONITOR) 
     5512                        if (sc->sc_nmonvaps == 0) 
    55135513                                goto rx_next; 
    55145514                } 
    55155515rx_accept: 
     
    55585558                        } 
    55595559                } 
    55605560 
     5561                /* Reject error frames */ 
     5562                if (ds->ds_rxstat.rs_status != 0) { 
     5563                        dev_kfree_skb(skb); 
     5564                        skb = NULL; 
     5565                        goto rx_next; 
     5566                } 
     5567 
    55615568                /* remove the crc */ 
    55625569                skb_trim(skb, skb->len - IEEE80211_CRC_LEN); 
    55635570