diff --git a/openwrt/mac80211_patches/922-mac80211_packet_tunnel-linux-4.4.patch b/openwrt/mac80211_patches/922-mac80211_packet_tunnel-linux-4.4.patch index 6780623..97f00a4 100644 --- a/openwrt/mac80211_patches/922-mac80211_packet_tunnel-linux-4.4.patch +++ b/openwrt/mac80211_patches/922-mac80211_packet_tunnel-linux-4.4.patch @@ -1,4 +1,4 @@ -From abc84789bd6d42fdbfe598d72177ed41d54c7bcf Mon Sep 17 00:00:00 2001 +From 681af1c29f8276c2105ff4ce8d31ec56bd9e5b7a Mon Sep 17 00:00:00 2001 From: Andreas Schultz Date: Thu, 4 Feb 2016 15:57:11 +0100 Subject: [PATCH] support patch for FreeWTP @@ -14,7 +14,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. 6 files changed, 479 insertions(+), 12 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h -index 760bc4d..bf60d9d 100644 +index 760bc4d..e80b1af 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -2199,6 +2199,37 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, @@ -23,7 +23,7 @@ index 760bc4d..bf60d9d 100644 +#ifdef CONFIG_MAC80211_CAPWAP_WTP + -+extern struct static_key mac80211_capwap_wtp; ++extern struct static_key_false mac80211_capwap_wtp; + +/** + * @@ -108,7 +108,7 @@ index 6837a46..e96cbff 100644 struct sk_buff_head *skbs); struct sk_buff * diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c -index bcb0a1b..8e2069f 100644 +index bcb0a1b..cb08ec2 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1955,3 +1955,66 @@ void ieee80211_iface_exit(void) @@ -118,7 +118,7 @@ index bcb0a1b..8e2069f 100644 + +#ifdef CONFIG_MAC80211_CAPWAP_WTP + -+struct static_key mac80211_capwap_wtp __read_mostly; ++DEFINE_STATIC_KEY_FALSE(mac80211_capwap_wtp); + +static const struct net_device_ops ieee80211_capwapif_ops = { + .ndo_open = ieee80211_open, @@ -145,7 +145,7 @@ index bcb0a1b..8e2069f 100644 + ret = -EBUSY; + } else { + rcu_assign_pointer(sdata->pcktunnel_handlers, handler); -+ static_key_slow_inc(&mac80211_capwap_wtp); ++ static_branch_enable(&mac80211_capwap_wtp); + } + + mutex_unlock(&sdata->local->iflist_mtx); @@ -166,7 +166,7 @@ index bcb0a1b..8e2069f 100644 + h = rcu_dereference_protected(sdata->pcktunnel_handlers, lockdep_is_held(&sdata->local->iflist_mtx)); + if (h == handler) { + ret = 0; -+ static_key_slow_dec(&mac80211_capwap_wtp); ++ static_branch_disable(&mac80211_capwap_wtp); + rcu_assign_pointer(sdata->pcktunnel_handlers, NULL); + } + @@ -179,7 +179,7 @@ index bcb0a1b..8e2069f 100644 + +#endif diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c -index a3bb8f7..cbe0642 100644 +index a3bb8f7..07b2ff6 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -3058,6 +3058,56 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) @@ -265,7 +265,7 @@ index a3bb8f7..cbe0642 100644 CALL_RXH(ieee80211_rx_h_mesh_fwding); #endif +#ifdef CONFIG_MAC80211_CAPWAP_WTP -+ if (static_key_false(&mac80211_capwap_wtp)) { ++ if (static_branch_unlikely(&mac80211_capwap_wtp)) { + /* special treatment */ + res = ieee80211_rx_h_pcktunnel(rx, rate); + if (res != RX_CONTINUE) @@ -380,7 +380,7 @@ index a3bb8f7..cbe0642 100644 rcu_read_unlock(); diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c -index bdc224d..5f1f424 100644 +index bdc224d..ee4e7c7 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2939,6 +2939,115 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, diff --git a/openwrt/mac80211_patches/922-mac80211_packet_tunnel-linux-4.8.patch b/openwrt/mac80211_patches/922-mac80211_packet_tunnel-linux-4.8.patch index dc71a11..e854ba4 100644 --- a/openwrt/mac80211_patches/922-mac80211_packet_tunnel-linux-4.8.patch +++ b/openwrt/mac80211_patches/922-mac80211_packet_tunnel-linux-4.8.patch @@ -1,4 +1,4 @@ -From 0829e230256d8f18c2d482923d16d3582311221f Mon Sep 17 00:00:00 2001 +From c77fede6bca4d81c4db720a0ebcfa3ea6b933161 Mon Sep 17 00:00:00 2001 From: Andreas Schultz Date: Thu, 4 Feb 2016 15:57:11 +0100 Subject: [PATCH] support patch for FreeWTP @@ -13,15 +13,17 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. net/mac80211/tx.c | 286 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 481 insertions(+), 14 deletions(-) +diff --git a/include/net/mac80211.h b/include/net/mac80211.h +index be30b05..cc1f0e8 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -2323,6 +2323,37 @@ ieee80211_get_alt_retry_rate(const struc +@@ -2309,6 +2309,37 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, */ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); +#ifdef CPTCFG_MAC80211_CAPWAP_WTP + -+extern struct static_key mac80211_capwap_wtp; ++extern struct static_key_false mac80211_capwap_wtp; + +/** + * @@ -53,9 +55,11 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. /** * DOC: Hardware crypto acceleration * +diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig +index 3891cbd..4ff4461 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig -@@ -317,3 +317,10 @@ config MAC80211_STA_HASH_MAX_SIZE +@@ -318,3 +318,10 @@ config MAC80211_STA_HASH_MAX_SIZE connect more stations than the number selected here.) If unsure, leave the default of 0. @@ -66,9 +70,11 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. + ---help--- + Select this to build support hooks for out-of-tree CAPWAP FreeWTP + module. +diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h +index 9438c94..3ec4613 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -182,6 +182,9 @@ typedef unsigned __bitwise__ ieee80211_r +@@ -180,6 +180,9 @@ typedef unsigned __bitwise__ ieee80211_rx_result; #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u) #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u) #define RX_QUEUED ((__force ieee80211_rx_result) 3u) @@ -78,7 +84,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. /** * enum ieee80211_packet_rx_flags - packet RX flags -@@ -847,6 +850,11 @@ struct ieee80211_sub_if_data { +@@ -836,6 +839,11 @@ struct ieee80211_sub_if_data { char name[IFNAMSIZ]; @@ -90,7 +96,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. /* Fragment table for host-based reassembly */ struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; unsigned int fragment_next; -@@ -1696,6 +1704,10 @@ netdev_tx_t ieee80211_subif_start_xmit(s +@@ -1655,6 +1663,10 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, void __ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev, u32 info_flags); @@ -101,16 +107,18 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. void ieee80211_purge_tx_queue(struct ieee80211_hw *hw, struct sk_buff_head *skbs); struct sk_buff * +diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c +index c59af3e..c05f4c6 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -2001,3 +2001,66 @@ void ieee80211_iface_exit(void) +@@ -1966,3 +1966,66 @@ void ieee80211_iface_exit(void) { unregister_netdevice_notifier(&mac80211_netdev_notifier); } + +#ifdef CPTCFG_MAC80211_CAPWAP_WTP + -+struct static_key mac80211_capwap_wtp __read_mostly; ++DEFINE_STATIC_KEY_FALSE(mac80211_capwap_wtp); + +static const struct net_device_ops ieee80211_capwapif_ops = { + .ndo_open = ieee80211_open, @@ -137,7 +145,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. + ret = -EBUSY; + } else { + rcu_assign_pointer(sdata->pcktunnel_handlers, handler); -+ static_key_slow_inc(&mac80211_capwap_wtp); ++ static_branch_enable(&mac80211_capwap_wtp); + } + + mutex_unlock(&sdata->local->iflist_mtx); @@ -158,7 +166,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. + h = rcu_dereference_protected(sdata->pcktunnel_handlers, lockdep_is_held(&sdata->local->iflist_mtx)); + if (h == handler) { + ret = 0; -+ static_key_slow_dec(&mac80211_capwap_wtp); ++ static_branch_disable(&mac80211_capwap_wtp); + rcu_assign_pointer(sdata->pcktunnel_handlers, NULL); + } + @@ -170,9 +178,11 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. +EXPORT_SYMBOL(ieee80211_pcktunnel_deregister); + +#endif +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c +index 5e65e83..4a6d2cd 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -3097,6 +3097,56 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_ +@@ -3097,6 +3097,56 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) return RX_QUEUED; } @@ -229,7 +239,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx, struct ieee80211_rate *rate) { -@@ -3176,6 +3226,9 @@ static void ieee80211_rx_handlers_result +@@ -3176,6 +3226,9 @@ static void ieee80211_rx_handlers_result(struct ieee80211_rx_data *rx, if (rx->sta) rx->sta->rx_stats.dropped++; /* fall through */ @@ -239,7 +249,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. case RX_CONTINUE: { struct ieee80211_rate *rate = NULL; struct ieee80211_supported_band *sband; -@@ -3204,7 +3257,9 @@ static void ieee80211_rx_handlers_result +@@ -3204,7 +3257,9 @@ static void ieee80211_rx_handlers_result(struct ieee80211_rx_data *rx, } static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx, @@ -250,12 +260,12 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. { ieee80211_rx_result res = RX_DROP_MONITOR; struct sk_buff *skb; -@@ -3243,6 +3298,15 @@ static void ieee80211_rx_handlers(struct +@@ -3243,6 +3298,15 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx, if (ieee80211_vif_is_mesh(&rx->sdata->vif)) CALL_RXH(ieee80211_rx_h_mesh_fwding); #endif +#ifdef CPTCFG_MAC80211_CAPWAP_WTP -+ if (static_key_false(&mac80211_capwap_wtp)) { ++ if (static_branch_unlikely(&mac80211_capwap_wtp)) { + /* special treatment */ + res = ieee80211_rx_h_pcktunnel(rx, rate); + if (res != RX_CONTINUE) @@ -266,7 +276,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. CALL_RXH(ieee80211_rx_h_amsdu); CALL_RXH(ieee80211_rx_h_data); -@@ -3266,7 +3330,8 @@ static void ieee80211_rx_handlers(struct +@@ -3266,7 +3330,8 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx, spin_unlock_bh(&rx->local->rx_path_lock); } @@ -276,7 +286,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. { struct sk_buff_head reorder_release; ieee80211_rx_result res = RX_DROP_MONITOR; -@@ -3285,7 +3350,7 @@ static void ieee80211_invoke_rx_handlers +@@ -3285,7 +3350,7 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx) ieee80211_rx_reorder_ampdu(rx, &reorder_release); @@ -285,7 +295,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. return; rxh_next: -@@ -3331,7 +3396,7 @@ void ieee80211_release_reorder_timeout(s +@@ -3331,7 +3396,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) drv_event_callback(rx.local, rx.sdata, &event); } @@ -294,7 +304,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. } void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid, -@@ -3406,7 +3471,7 @@ void ieee80211_mark_rx_ba_filtered_frame +@@ -3406,7 +3471,7 @@ void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid, release: spin_unlock_bh(&tid_agg_rx->reorder_lock); @@ -303,7 +313,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. out: rcu_read_unlock(); -@@ -3878,7 +3943,9 @@ static bool ieee80211_invoke_fast_rx(str +@@ -3878,7 +3943,9 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, * or not the skb was consumed. */ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, @@ -314,7 +324,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. { struct ieee80211_local *local = rx->local; struct ieee80211_sub_if_data *sdata = rx->sdata; -@@ -3916,7 +3983,7 @@ static bool ieee80211_prepare_and_rx_han +@@ -3916,7 +3983,7 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, rx->skb = skb; } @@ -323,7 +333,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. return true; } -@@ -3927,7 +3994,8 @@ static bool ieee80211_prepare_and_rx_han +@@ -3927,7 +3994,8 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta, struct sk_buff *skb, @@ -333,7 +343,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. { struct ieee80211_local *local = hw_to_local(hw); struct ieee80211_sub_if_data *sdata; -@@ -3973,7 +4041,7 @@ static void __ieee80211_rx_handle_packet +@@ -3973,7 +4041,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, if (pubsta) { rx.sta = container_of(pubsta, struct sta_info, sta); rx.sdata = rx.sta->sdata; @@ -342,7 +352,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. return; goto out; } else if (ieee80211_is_data(fc)) { -@@ -3992,7 +4060,7 @@ static void __ieee80211_rx_handle_packet +@@ -3992,7 +4060,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, rx.sta = prev_sta; rx.sdata = prev_sta->sdata; @@ -351,7 +361,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. prev_sta = sta; } -@@ -4001,7 +4069,7 @@ static void __ieee80211_rx_handle_packet +@@ -4001,7 +4069,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, rx.sta = prev_sta; rx.sdata = prev_sta->sdata; @@ -360,7 +370,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. return; goto out; } -@@ -4030,7 +4098,7 @@ static void __ieee80211_rx_handle_packet +@@ -4030,7 +4098,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, rx.sta = sta_info_get_bss(prev, hdr->addr2); rx.sdata = prev; @@ -369,7 +379,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. prev = sdata; } -@@ -4039,7 +4107,7 @@ static void __ieee80211_rx_handle_packet +@@ -4039,7 +4107,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, rx.sta = sta_info_get_bss(prev, hdr->addr2); rx.sdata = prev; @@ -378,7 +388,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. return; } -@@ -4152,7 +4220,7 @@ void ieee80211_rx_napi(struct ieee80211_ +@@ -4152,7 +4220,7 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta, ((struct ieee80211_hdr *)skb->data)->frame_control, skb->len); @@ -387,9 +397,11 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. rcu_read_unlock(); +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index 2030443..bca96a4 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3434,6 +3434,115 @@ netdev_tx_t ieee80211_subif_start_xmit(s +@@ -3213,6 +3213,115 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, return NETDEV_TX_OK; } @@ -505,7 +517,7 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. struct sk_buff * ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, u32 info_flags) -@@ -4409,3 +4518,180 @@ void __ieee80211_tx_skb_tid_band(struct +@@ -4188,3 +4297,180 @@ void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, ieee80211_xmit(sdata, NULL, skb); local_bh_enable(); } @@ -686,13 +698,6 @@ Allows for kernel side interception and injection of IEEE 802.11 frames. +EXPORT_SYMBOL(ieee80211_inject_xmit); + +#endif ---- a/.local-symbols -+++ b/.local-symbols -@@ -42,6 +42,7 @@ LIB80211_CRYPT_CCMP= - LIB80211_CRYPT_TKIP= - LIB80211_DEBUG= - MAC80211= -+MAC80211_CAPWAP_WTP= - MAC80211_HAS_RC= - MAC80211_RC_MINSTREL= - MAC80211_RC_MINSTREL_HT= +-- +2.9.3 +