/* Copyright (c) 2013-2014 Intel Corp. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 and only version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.*/#include <linux/if_arp.h>#include <linux/netdevice.h>#include <linux/etherdevice.h>#include <linux/module.h>#include <linux/debugfs.h>#include <net/ipv6.h>#include <net/ip6_route.h>#include <net/addrconf.h>#include <net/af_ieee802154.h>/* to get the address type */#include <net/bluetooth/bluetooth.h>#include <net/bluetooth/hci_core.h>#include <net/bluetooth/l2cap.h>#include <net/6lowpan.h>/* for the compression support */#define VERSION"0.1"static struct dentry *lowpan_enable_debugfs;static struct dentry *lowpan_control_debugfs;#define IFACE_NAME_TEMPLATE"bt%d"#define EUI64_ADDR_LEN 8struct skb_cb {struct in6_addr addr;struct in6_addr gw;struct l2cap_chan *chan;int status;};#define lowpan_cb(skb) ((struct skb_cb *)((skb)->cb))/* The devices list contains those devices that we are acting * as a proxy. The BT 6LoWPAN device is a virtual device that * connects to the Bluetooth LE device. The real connection to * BT device is done via l2cap layer. There exists one * virtual device / one BT 6LoWPAN network (=hciX device). * The list contains struct lowpan_dev elements. */staticLIST_HEAD(bt_6lowpan_devices);staticDEFINE_SPINLOCK(devices_lock);static bool enable_6lowpan;/* We are listening incoming connections via this channel */static struct l2cap_chan *listen_chan;struct lowpan_peer {struct list_head list;struct rcu_head rcu;struct l2cap_chan *chan;/* peer addresses in various formats */