[Click] todevice and madwifi-ng in monitor mode

David Claffey dclaffey at jjplus.com
Thu Apr 27 14:26:17 EDT 2006


Hi Torquato,

Good to hear it helped.  I actually fixed another problem in skbmgr.cc as well. 
  Recycled skbs need to have the  skb->dst pointer set to NULL.  I had some 
packets coming from linux with this pointer non-NULL. The next use of the 
recycled skb will call dst_release with the refcnt 0, then -1 ,then -2, etc, 
causing a hugh stream of printks.
The patch is below.

- David

--- click/linuxmodule/skbmgr.cc
+++ tmp/linuxmodule/skbmgr.cc
@@ -248,6 +248,7 @@
    // datarefp (expensive to set).
    if (!(skb->pkt_type & PACKET_CLEAN)) {
      dst_release(skb->dst);
+    skb->dst = NULL; // stale pointer will cause problems for recycled skbs; 
dst_run_gc will cleanup mem
      if (skb->destructor) {
        skb->destructor(skb);
        skb->destructor = NULL;


Torquato Bertani wrote:
> Hi David,
> thanks for your patch. Now my kernel doesn't crash anymore!
> Bye
> 
> On 4/12/06, David Claffey <dclaffey at jjplus.com> wrote:
>> I have the click linuxmodule and the madwifi-ng driver running on linux-2.6.12.
>>   I'm using todevice() to send packets out the ath device in monitor mode.  But
>> this only works after adding the following patch:
>> --- click/elements/linuxmodule/todevice.cc
>> +++ tmp/elements/linuxmodule/todevice.cc
>> @@ -383,6 +383,12 @@
>>         skb_put(skb1, 60 - skb1->len);
>>       }
>>
>> +    skb1->dev = _dev;
>> +
>>       int ret;
>>   #if HAVE_LINUX_POLLING
>>       if (_dev->polling > 0)
>>         ret = _dev->tx_queue(_dev, skb1);
>>      else
>> #endif
>>         {
>>             ret = _dev->hard_start_xmit(skb1, _dev);
>>             _hard_start++;
>>         }
>>
>> Todevice() passes the skb to ieee80211_hardstart(struct sk_buff *skb, struct
>> net_device *dev) which then calls ieee80211_monitor_encap(struct ieee80211vap
>> *vap, struct sk_buff *skb).  The problem arises when ieee80211_monitor_encap()
>> references skb->dev->type with skb->dev NULL. Can anyone suggest which function
>> should set skb->dev, todevice or ieee80211_hardstart?
>>
>> - David
>> _______________________________________________
>> click mailing list
>> click at amsterdam.lcs.mit.edu
>> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>>
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> 


More information about the click mailing list