Permit to forward IEEE802.11 Data Packet from kernel space to user space bypass
kernel network stack.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
--- a/include/net/mac80211.h 2014-06-02 11:48:37.000000000 +0200
|
||||
+++ b/include/net/mac80211.h 2014-06-04 21:02:25.000000000 +0200
|
||||
+++ b/include/net/mac80211.h 2014-06-07 17:23:03.000000000 +0200
|
||||
@@ -4699,4 +4699,24 @@ int ieee80211_parse_p2p_noa(const struct
|
||||
*/
|
||||
void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf);
|
||||
@ -10,7 +10,7 @@
|
||||
+struct ieee80211_pcktunnel {
|
||||
+ u16 subtype_mask[3]; /* 0: MGMT, 1: CTLR, 2: DATA */
|
||||
+
|
||||
+ int (*handler)(struct sk_buff *skb, int sig_dbm, unsigned char rate, void *data);
|
||||
+ int (*handler)(u32 ifindex, struct sk_buff *skb, int sig_dbm, unsigned char rate, void *data);
|
||||
+ void *data;
|
||||
+};
|
||||
+
|
||||
@ -26,8 +26,16 @@
|
||||
+
|
||||
#endif /* MAC80211_H */
|
||||
--- a/net/mac80211/ieee80211_i.h 2014-06-02 11:48:37.000000000 +0200
|
||||
+++ b/net/mac80211/ieee80211_i.h 2014-06-02 14:48:23.000000000 +0200
|
||||
@@ -727,6 +727,9 @@ struct ieee80211_sub_if_data {
|
||||
+++ b/net/mac80211/ieee80211_i.h 2014-06-07 17:14:25.000000000 +0200
|
||||
@@ -165,6 +165,7 @@ typedef unsigned __bitwise__ ieee80211_r
|
||||
#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)
|
||||
+#define RX_IGNORE_MONITOR ((__force ieee80211_rx_result) 4u)
|
||||
|
||||
/**
|
||||
* enum ieee80211_packet_rx_flags - packet RX flags
|
||||
@@ -727,6 +728,9 @@ struct ieee80211_sub_if_data {
|
||||
|
||||
char name[IFNAMSIZ];
|
||||
|
||||
@ -38,7 +46,7 @@
|
||||
struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
|
||||
unsigned int fragment_next;
|
||||
--- a/net/mac80211/iface.c 2014-06-02 11:48:37.000000000 +0200
|
||||
+++ b/net/mac80211/iface.c 2014-06-04 22:12:23.000000000 +0200
|
||||
+++ b/net/mac80211/iface.c 2014-06-04 22:52:06.000000000 +0200
|
||||
@@ -1850,3 +1850,80 @@ void ieee80211_iface_exit(void)
|
||||
{
|
||||
unregister_netdevice_notifier(&mac80211_netdev_notifier);
|
||||
@ -121,7 +129,7 @@
|
||||
+EXPORT_SYMBOL(ieee80211_pcktunnel_deregister);
|
||||
+
|
||||
--- a/net/mac80211/rx.c 2014-06-02 11:48:37.000000000 +0200
|
||||
+++ b/net/mac80211/rx.c 2014-06-04 22:47:51.707004555 +0200
|
||||
+++ b/net/mac80211/rx.c 2014-06-07 17:22:05.000000000 +0200
|
||||
@@ -2828,6 +2828,51 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
|
||||
return RX_QUEUED;
|
||||
}
|
||||
@ -160,8 +168,8 @@
|
||||
+
|
||||
+ /* Delegate packet to external handler */
|
||||
+ if (handler->subtype_mask[fc_type] & bitmask) {
|
||||
+ if (handler->handler(rx->skb, sig_dbm, pckrate, handler->data)) {
|
||||
+ return RX_DROP_MONITOR;
|
||||
+ if (handler->handler(rx->sdata->dev->ifindex, rx->skb, sig_dbm, pckrate, handler->data)) {
|
||||
+ return RX_IGNORE_MONITOR;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
@ -174,7 +182,15 @@
|
||||
/* TODO: use IEEE80211_RX_FRAGMENTED */
|
||||
static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
|
||||
struct ieee80211_rate *rate)
|
||||
@@ -2935,7 +2980,8 @@ static void ieee80211_rx_handlers_result
|
||||
@@ -2907,6 +2952,7 @@ static void ieee80211_rx_handlers_result
|
||||
if (rx->sta)
|
||||
rx->sta->rx_dropped++;
|
||||
/* fall through */
|
||||
+ case RX_IGNORE_MONITOR:
|
||||
case RX_CONTINUE: {
|
||||
struct ieee80211_rate *rate = NULL;
|
||||
struct ieee80211_supported_band *sband;
|
||||
@@ -2935,7 +2981,8 @@ static void ieee80211_rx_handlers_result
|
||||
}
|
||||
|
||||
static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
|
||||
@ -184,7 +200,7 @@
|
||||
{
|
||||
ieee80211_rx_result res = RX_DROP_MONITOR;
|
||||
struct sk_buff *skb;
|
||||
@@ -2968,6 +3014,11 @@ static void ieee80211_rx_handlers(struct
|
||||
@@ -2968,6 +3015,11 @@ static void ieee80211_rx_handlers(struct
|
||||
if (ieee80211_vif_is_mesh(&rx->sdata->vif))
|
||||
CALL_RXH(ieee80211_rx_h_mesh_fwding);
|
||||
#endif
|
||||
@ -196,7 +212,7 @@
|
||||
CALL_RXH(ieee80211_rx_h_amsdu)
|
||||
CALL_RXH(ieee80211_rx_h_data)
|
||||
|
||||
@@ -2991,7 +3042,8 @@ static void ieee80211_rx_handlers(struct
|
||||
@@ -2991,7 +3043,8 @@ static void ieee80211_rx_handlers(struct
|
||||
spin_unlock_bh(&rx->local->rx_path_lock);
|
||||
}
|
||||
|
||||
@ -206,7 +222,7 @@
|
||||
{
|
||||
struct sk_buff_head reorder_release;
|
||||
ieee80211_rx_result res = RX_DROP_MONITOR;
|
||||
@@ -3009,7 +3061,7 @@ static void ieee80211_invoke_rx_handlers
|
||||
@@ -3009,7 +3062,7 @@ static void ieee80211_invoke_rx_handlers
|
||||
|
||||
ieee80211_rx_reorder_ampdu(rx, &reorder_release);
|
||||
|
||||
@ -215,7 +231,7 @@
|
||||
return;
|
||||
|
||||
rxh_next:
|
||||
@@ -3046,7 +3098,7 @@ void ieee80211_release_reorder_timeout(s
|
||||
@@ -3046,7 +3099,7 @@ void ieee80211_release_reorder_timeout(s
|
||||
ieee80211_sta_reorder_release(sta->sdata, tid_agg_rx, &frames);
|
||||
spin_unlock(&tid_agg_rx->reorder_lock);
|
||||
|
||||
@ -224,7 +240,7 @@
|
||||
}
|
||||
|
||||
/* main receive path */
|
||||
@@ -3160,7 +3212,9 @@ static bool prepare_for_handlers(struct
|
||||
@@ -3160,7 +3213,9 @@ static bool prepare_for_handlers(struct
|
||||
* or not the skb was consumed.
|
||||
*/
|
||||
static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,
|
||||
@ -235,7 +251,7 @@
|
||||
{
|
||||
struct ieee80211_local *local = rx->local;
|
||||
struct ieee80211_sub_if_data *sdata = rx->sdata;
|
||||
@@ -3186,7 +3240,7 @@ static bool ieee80211_prepare_and_rx_han
|
||||
@@ -3186,7 +3241,7 @@ static bool ieee80211_prepare_and_rx_han
|
||||
rx->skb = skb;
|
||||
}
|
||||
|
||||
@ -244,7 +260,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3195,7 +3249,8 @@ static bool ieee80211_prepare_and_rx_han
|
||||
@@ -3195,7 +3250,8 @@ static bool ieee80211_prepare_and_rx_han
|
||||
* be called with rcu_read_lock protection.
|
||||
*/
|
||||
static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
|
||||
@ -254,7 +270,7 @@
|
||||
{
|
||||
struct ieee80211_local *local = hw_to_local(hw);
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
@@ -3248,7 +3303,7 @@ static void __ieee80211_rx_handle_packet
|
||||
@@ -3248,7 +3304,7 @@ static void __ieee80211_rx_handle_packet
|
||||
|
||||
rx.sta = prev_sta;
|
||||
rx.sdata = prev_sta->sdata;
|
||||
@ -263,7 +279,7 @@
|
||||
|
||||
prev_sta = sta;
|
||||
}
|
||||
@@ -3257,7 +3312,7 @@ static void __ieee80211_rx_handle_packet
|
||||
@@ -3257,7 +3313,7 @@ static void __ieee80211_rx_handle_packet
|
||||
rx.sta = prev_sta;
|
||||
rx.sdata = prev_sta->sdata;
|
||||
|
||||
@ -272,7 +288,7 @@
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
@@ -3286,7 +3341,7 @@ static void __ieee80211_rx_handle_packet
|
||||
@@ -3286,7 +3342,7 @@ static void __ieee80211_rx_handle_packet
|
||||
|
||||
rx.sta = sta_info_get_bss(prev, hdr->addr2);
|
||||
rx.sdata = prev;
|
||||
@ -281,7 +297,7 @@
|
||||
|
||||
prev = sdata;
|
||||
}
|
||||
@@ -3295,7 +3350,7 @@ static void __ieee80211_rx_handle_packet
|
||||
@@ -3295,7 +3351,7 @@ static void __ieee80211_rx_handle_packet
|
||||
rx.sta = sta_info_get_bss(prev, hdr->addr2);
|
||||
rx.sdata = prev;
|
||||
|
||||
@ -290,7 +306,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3406,7 +3461,7 @@ void ieee80211_rx(struct ieee80211_hw *h
|
||||
@@ -3406,7 +3462,7 @@ void ieee80211_rx(struct ieee80211_hw *h
|
||||
ieee80211_tpt_led_trig_rx(local,
|
||||
((struct ieee80211_hdr *)skb->data)->frame_control,
|
||||
skb->len);
|
||||
|
Reference in New Issue
Block a user