summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fastd.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/fastd.c b/fastd.c
index 9c3894c..55d2a25 100644
--- a/fastd.c
+++ b/fastd.c
@@ -39,7 +39,8 @@
#define DRV_NAME "fastd"
#define DRV_VERSION "0.1"
#define DRV_DESCRIPTION "fastd tunnel driver"
-#define DRV_COPYRIGHT "(C) 2013 Matthias Schiffer <mschiffer@universe-factory.net>"
+#define DRV_COPYRIGHT \
+ "(C) 2013 Matthias Schiffer <mschiffer@universe-factory.net>"
#include <linux/module.h>
@@ -58,6 +59,10 @@
#include "fastd.h"
+#define FASTD_HEADROOM \
+ (ETH_HLEN + sizeof(struct ipv6hdr) + sizeof(struct udphdr) + 24)
+
+
static LIST_HEAD(fastd_list);
static struct workqueue_struct *fastd_workqueue;
@@ -99,7 +104,6 @@ static int fastd_nl_event(struct notifier_block *nb,
list_for_each_entry_rcu(entry, &fastd_list, list) {
if (entry->owner == n->portid) {
- /* allow registration of a new interface for this portid */
ACCESS_ONCE(entry->owner) = 0;
queue_work(fastd_workqueue, &entry->destroy_work);
@@ -123,7 +127,8 @@ static const struct net_device_ops fastd_netdev_ops_ip = {
};
-static void fastd_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
+static void fastd_ethtool_get_drvinfo(struct net_device *dev,
+ struct ethtool_drvinfo *info)
{
struct fastd_struct *fastd = netdev_priv(dev);
@@ -169,7 +174,7 @@ static void fastd_netdev_init(struct net_device *dev)
eth_hw_addr_random(dev);
ether_setup(dev);
- dev->hard_header_len = ETH_HLEN + sizeof(struct ipv6hdr) + sizeof(struct udphdr) + ETH_HLEN;
+ dev->hard_header_len = FASTD_HEADROOM + ETH_HLEN;
break;
@@ -177,7 +182,7 @@ static void fastd_netdev_init(struct net_device *dev)
dev->netdev_ops = &fastd_netdev_ops_eth;
dev->addr_len = 0;
- dev->hard_header_len = ETH_HLEN + sizeof(struct ipv6hdr) + sizeof(struct udphdr);
+ dev->hard_header_len = FASTD_HEADROOM;
dev->mtu = 1500;
dev->type = ARPHRD_NONE;
@@ -220,7 +225,8 @@ static int fastd_cmd_create(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[FASTD_A_IFNAME])
name = nla_data(info->attrs[FASTD_A_IFNAME]);
- dev = alloc_netdev(sizeof(struct fastd_struct), name, fastd_netdev_setup);
+ dev = alloc_netdev(sizeof(struct fastd_struct), name,
+ fastd_netdev_setup);
if (!dev)
return -ENOMEM;
@@ -254,7 +260,7 @@ err_free_dev:
static struct nla_policy fastd_nl_policy[__FASTD_A_MAX] = {
- [FASTD_A_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },
+ [FASTD_A_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 },
[FASTD_A_MODE] = { .type = NLA_U16 },
};