[2/3]
>From 13b5c2f4aabcd070ea46e60f9aff6849bf5ff15a Mon Sep 17 00:00:00 2001
From: Alexander Smirnov <[email protected]>
Date: Sun, 26 Jun 2011 16:46:11 +0400
Subject: [PATCH 2/3] Add simple tunneling hook
This patch provides possibility to route packets to another protocol.
The main work in protocol-over-wpan related to compressing of packets
header (which is a mac layer routine) when pivot of mac layer is common
for all. The next function which will be executed after tunnel is
'netif_rx', so packets will go to the upper layer.
Based on code from Jon Smirl.
Signed-off-by: Alexander Smirnov <[email protected]>
---
net/mac802154/mac802154.h | 6 ++++++
net/mac802154/wpan.c | 6 ++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/net/mac802154/mac802154.h b/net/mac802154/mac802154.h
index a59c070..e21326a 100644
--- a/net/mac802154/mac802154.h
+++ b/net/mac802154/mac802154.h
@@ -69,12 +69,18 @@ struct mac802154_wpan_mib {
u8 dsn;
};
+typedef int
+(*wpan_tunnel)(struct net_device *dev, struct sk_buff *skb, u8 *saddr, u8
*daddr);
+
struct mac802154_sub_if_data {
struct list_head list; /* the ieee802154_priv->slaves list */
struct mac802154_priv *hw;
struct net_device *dev;
+ /* possibility to route traffic to another protocol */
+ wpan_tunnel tunnel;
+
int type;
spinlock_t mib_lock;
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index 6ba52c7..f58ea93 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -376,6 +376,12 @@ static int mac802154_process_ack(struct net_device *dev,
struct sk_buff *skb)
static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb)
{
+ struct mac802154_sub_if_data *priv = netdev_priv(dev);
+
+ /* simple tunneling: route traffic to another protocol */
+ if (priv->tunnel)
+ return priv->tunnel(dev, skb, mac_cb(skb)->sa.hwaddr,
mac_cb(skb)->da.hwaddr);
+
if (in_interrupt())
return netif_rx(skb);
else
--
1.7.2.3
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Linux-zigbee-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel