Changeset 1360

Show
Ignore:
Timestamp:
12/19/05 02:30:25 (6 years ago)
Author:
jbicket
Message:

add monitor mode sysctls:
monitor_txf_len - truncate packets to this length if they
were sent from this node. A value of '0' means don't truncate,
which is the default.

monitor_nods_only - ignore tods, fromds, and dstods packets
on this montitor device. A value of '0' means accept all packets,
which is the default.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/net80211/ieee80211_linux.c

    r1332 r1360  
    493493        return ret; 
    494494} 
     495static int 
     496IEEE80211_SYSCTL_DECL(ieee80211_sysctl_monitor_nods_only, ctl, write, filp, buffer, 
     497                lenp, ppos) 
     498{ 
     499        struct ieee80211vap *vap = ctl->extra1; 
     500        u_int val; 
     501        int ret; 
     502 
     503        ctl->data = &val; 
     504        ctl->maxlen = sizeof(val); 
     505        if (write) { 
     506                ret = IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, 
     507                                lenp, ppos); 
     508                if (ret == 0) { 
     509                        vap->iv_monitor_nods_only = val; 
     510                } 
     511        } else { 
     512                val = vap->iv_monitor_nods_only; 
     513                ret = IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, 
     514                                                     lenp, ppos); 
     515        } 
     516        return ret; 
     517} 
     518static int 
     519IEEE80211_SYSCTL_DECL(ieee80211_sysctl_monitor_txf_len, ctl, write, filp, buffer, 
     520                lenp, ppos) 
     521{ 
     522        struct ieee80211vap *vap = ctl->extra1; 
     523        u_int val; 
     524        int ret; 
     525 
     526        ctl->data = &val; 
     527        ctl->maxlen = sizeof(val); 
     528        if (write) { 
     529                ret = IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, 
     530                                lenp, ppos); 
     531                if (ret == 0) { 
     532                        vap->iv_monitor_txf_len = val; 
     533                } 
     534        } else { 
     535                val = vap->iv_monitor_txf_len; 
     536                ret = IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, 
     537                                lenp, ppos); 
     538        } 
     539        return ret; 
     540} 
    495541 
    496542#define CTL_AUTO        -2      /* cannot be CTL_ANY or CTL_NONE */ 
     
    508554          .mode         = 0644, 
    509555          .proc_handler = ieee80211_sysctl_dev_type 
     556        }, 
     557        { .ctl_name     = CTL_AUTO, 
     558          .procname     = "monitor_nods_only", 
     559          .mode         = 0644, 
     560          .proc_handler = ieee80211_sysctl_monitor_nods_only 
     561        }, 
     562        { .ctl_name     = CTL_AUTO, 
     563          .procname     = "monitor_txf_len", 
     564          .mode         = 0644, 
     565          .proc_handler = ieee80211_sysctl_monitor_txf_len 
    510566        }, 
    511567        /* NB: must be last entry before NULL */ 
  • trunk/net80211/ieee80211_monitor.c

    r1315 r1360  
    187187                struct sk_buff *skb1; 
    188188                struct net_device *dev = vap->iv_dev; 
     189                struct ieee80211_frame *wh; 
     190                u_int8_t dir; 
    189191                next = TAILQ_NEXT(vap, iv_next); 
    190192                if (vap->iv_opmode != IEEE80211_M_MONITOR || 
     
    196198                        /* XXX stat+msg */ 
    197199                        continue; 
    198                 } 
    199  
     200                }                
     201                if (vap->iv_monitor_txf_len && tx) { 
     202                        /* truncate transmit feedback packets */ 
     203                        skb_trim(skb1, vap->iv_monitor_txf_len); 
     204                } 
     205                wh = (struct ieee80211_frame *)skb->data; 
     206                dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK; 
     207                if (vap->iv_monitor_nods_only && dir != IEEE80211_FC1_DIR_NODS) { 
     208                        /* don't rx fromds, tods, or dstods packets */ 
     209                        continue; 
     210                }                    
    200211                switch (vap->iv_dev->type) { 
    201212                case ARPHRD_IEEE80211: 
  • trunk/net80211/ieee80211_var.h

    r1293 r1360  
    284284        u_int32_t               iv_debug;       /* debug msg flags */ 
    285285        struct ieee80211_stats  iv_stats;       /* statistics */ 
     286 
     287        int                     iv_monitor_nods_only; /* in monitor mode only nods traffic */ 
     288        int                     iv_monitor_txf_len;   /* in monitor mode, truncate tx packets */ 
    286289 
    287290        int                     (*iv_newstate)(struct ieee80211vap *,