Ticket #1094 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

[patch] monitor mode: packet type to PACKET_OUGOING for all outgoing packets.

Reported by: brianbraunstein Assigned to:
Priority: minor Milestone: version 0.9.3
Component: madwifi: 802.11 stack Version: trunk
Keywords: packet type pkt_type PACKET_OUTGOING Cc:
Patch is attached: 1 Pending:

Description

Currently, in ieee80211_monitor.c:ieee80211_monitor_input(), the skb->pkt_type field for "tx" (outgoing) packets is not always set to PACKET_OUTGOING. If the outgoing packet is addressed to a broadcast or multicast address then the packet type will be PACKET_BROADCAST or PACKET_MULTICAST, respectively.

According to manpage "packet(7)", PACKET_OUTGOING should be used "for a packet originated from the local host that is looped back to a packet socket". I believe this should apply to all outgoing packets regardless of their destination address. Without doing so, applications using packet sockets will not be able to discern between broadcast/multicast packets actually received and those that are looped back outgoing packets. However, if changed so that all outgoing packets have PACKET_OUTGOING, applications can always check the destination address field to determine whether it was broadcast/multicast/otherhost/host/etc.

The following patch is extremely simple, which changes the logic to first do "if outgoing packet, then set packet type to outgoing, else if multicast...". This way all outgoing packets will have packet type PACKET_OUTGOING.

Patch:

Index: net80211/ieee80211_monitor.c
===================================================================
--- net80211/ieee80211_monitor.c    (revision 1970)
+++ net80211/ieee80211_monitor.c    (working copy)
@@ -346,13 +346,15 @@
             * The frame passed it's CRC, so we can rely
             * on the contents of the frame to set pkttype.
             */
-           if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+           if (tx)
+               pkttype = PACKET_OUTGOING;
+           else if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
                if (IEEE80211_ADDR_EQ(wh->i_addr1, dev->broadcast))
                    pkttype = PACKET_BROADCAST;
                else
                    pkttype = PACKET_MULTICAST;
            } else
-               pkttype = (tx) ? PACKET_OUTGOING : PACKET_HOST;
+               pkttype = PACKET_HOST;
        }

        if (vap->iv_opmode != IEEE80211_M_MONITOR ||

As requested by the patch submission guidelines, here is the svn info output:

URL: http://svn.madwifi.org/trunk
Repository Root: http://svn.madwifi.org
Repository UUID: 0192ed92-7a03-0410-a25b-9323aeb14dbd
Revision: 1970
Node Kind: directory
Schedule: normal
Last Changed Author: scottr
Last Changed Rev: 1970
Last Changed Date: 2007-01-15 19:34:22 -0800 (Mon, 15 Jan 2007)
Properties Last Updated: 2007-01-16 08:29:34 -0800 (Tue, 16 Jan 2007)

Attachments

madwifi-packet_type.patch (0.7 kB) - added by brianbraunstein on 01/16/07 18:04:35.
patch for monitor mode outgoing packet type (skb->pkt_type)

Change History

01/16/07 18:04:35 changed by brianbraunstein

  • attachment madwifi-packet_type.patch added.

patch for monitor mode outgoing packet type (skb->pkt_type)

01/16/07 18:17:14 changed by brianbraunstein

Sorry, I forgot to sign off the patch the first time: Signed-off-by: Brian Braunstein <madwifi.ticket.1094@bristyle.com>

01/16/07 21:46:28 changed by scottr

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone set to version 0.9.3.

Thanks for the patch! Committed in r1971.


Add/Change #1094 ([patch] monitor mode: packet type to PACKET_OUGOING for all outgoing packets.)