mac80211: make bridge_packets a virtual interface option
authorJohannes Berg <johannes@sipsolutions.net>
Wed, 10 Sep 2008 22:01:54 +0000 (00:01 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 15 Sep 2008 20:48:22 +0000 (16:48 -0400)
The bridge_packets configuration really should be per virtual
interface (theoretically per AP/VLAN, but this is much easier);
there currently is no way to set it yet though. Also invert
the option to "NO_BRIDGE_PACKETS" so the default is to bridge.

While at it, also document the flags properly.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/debugfs.c
net/mac80211/ieee80211_i.h
net/mac80211/main.c
net/mac80211/rx.c

index ee509f1109e2112209977f11887602154ef12171..24ce544633109c038ee4af718258ddc942311568 100644 (file)
@@ -51,8 +51,6 @@ DEBUGFS_READONLY_FILE(antenna_sel_tx, 20, "%d",
                      local->hw.conf.antenna_sel_tx);
 DEBUGFS_READONLY_FILE(antenna_sel_rx, 20, "%d",
                      local->hw.conf.antenna_sel_rx);
-DEBUGFS_READONLY_FILE(bridge_packets, 20, "%d",
-                     local->bridge_packets);
 DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d",
                      local->rts_threshold);
 DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d",
@@ -206,7 +204,6 @@ void debugfs_hw_add(struct ieee80211_local *local)
        DEBUGFS_ADD(frequency);
        DEBUGFS_ADD(antenna_sel_tx);
        DEBUGFS_ADD(antenna_sel_rx);
-       DEBUGFS_ADD(bridge_packets);
        DEBUGFS_ADD(rts_threshold);
        DEBUGFS_ADD(fragmentation_threshold);
        DEBUGFS_ADD(short_retry_limit);
@@ -263,7 +260,6 @@ void debugfs_hw_del(struct ieee80211_local *local)
        DEBUGFS_DEL(frequency);
        DEBUGFS_DEL(antenna_sel_tx);
        DEBUGFS_DEL(antenna_sel_rx);
-       DEBUGFS_DEL(bridge_packets);
        DEBUGFS_DEL(rts_threshold);
        DEBUGFS_DEL(fragmentation_threshold);
        DEBUGFS_DEL(short_retry_limit);
index 199d64143b415fd166bd5066d05875ef21e30bc3..52f36ab1ee57b81e645c3510416e680cfd61d38b 100644 (file)
@@ -402,11 +402,25 @@ struct ieee80211_if_mesh {
        do { } while (0)
 #endif
 
-/* flags used in struct ieee80211_sub_if_data.flags */
-#define IEEE80211_SDATA_ALLMULTI       BIT(0)
-#define IEEE80211_SDATA_PROMISC                BIT(1)
-#define IEEE80211_SDATA_USERSPACE_MLME BIT(2)
-#define IEEE80211_SDATA_OPERATING_GMODE        BIT(3)
+/**
+ * enum ieee80211_sub_if_data_flags - virtual interface flags
+ *
+ * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets
+ * @IEEE80211_SDATA_PROMISC: interface is promisc
+ * @IEEE80211_SDATA_USERSPACE_MLME: userspace MLME is active
+ * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode
+ * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between
+ *     associated stations and deliver multicast frames both
+ *     back to wireless media and to the local net stack.
+ */
+enum ieee80211_sub_if_data_flags {
+       IEEE80211_SDATA_ALLMULTI                = BIT(0),
+       IEEE80211_SDATA_PROMISC                 = BIT(1),
+       IEEE80211_SDATA_USERSPACE_MLME          = BIT(2),
+       IEEE80211_SDATA_OPERATING_GMODE         = BIT(3),
+       IEEE80211_SDATA_DONT_BRIDGE_PACKETS     = BIT(4),
+};
+
 struct ieee80211_sub_if_data {
        struct list_head list;
 
@@ -635,10 +649,6 @@ struct ieee80211_local {
        struct crypto_blkcipher *wep_rx_tfm;
        u32 wep_iv;
 
-       int bridge_packets; /* bridge packets between associated stations and
-                            * deliver multicast frames both back to wireless
-                            * media and to the local net stack */
-
        struct list_head interfaces;
 
        /*
@@ -726,7 +736,6 @@ struct ieee80211_local {
                struct dentry *frequency;
                struct dentry *antenna_sel_tx;
                struct dentry *antenna_sel_rx;
-               struct dentry *bridge_packets;
                struct dentry *rts_threshold;
                struct dentry *fragmentation_threshold;
                struct dentry *short_retry_limit;
index 4bfac4b41c51e4de008d33fd7b3bbed8270b1ae0..72e3f5574e9fe553504d75390a3381f41237da24 100644 (file)
@@ -1280,8 +1280,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
 
        local->hw.queues = 1; /* default */
 
-       local->bridge_packets = 1;
-
        local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
        local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
        local->short_retry_limit = 7;
index 208563a27bc43c6e0ae8ab526c0ba55af76102c2..93f2cda9926e007cb7f7078e9d82936b0567cc77 100644 (file)
@@ -1221,8 +1221,9 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
        skb = rx->skb;
        xmit_skb = NULL;
 
-       if (local->bridge_packets && (sdata->vif.type == IEEE80211_IF_TYPE_AP ||
-                                     sdata->vif.type == IEEE80211_IF_TYPE_VLAN) &&
+       if ((sdata->vif.type == IEEE80211_IF_TYPE_AP ||
+            sdata->vif.type == IEEE80211_IF_TYPE_VLAN) &&
+           !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) &&
            (rx->flags & IEEE80211_RX_RA_MATCH)) {
                if (is_multicast_ether_addr(ehdr->h_dest)) {
                        /*