diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-12-11 02:44:40 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-12-11 12:45:34 +0100 |
commit | e5ba407f8f08c812d9bf5088e51c54644839c85b (patch) | |
tree | 1ba831e4a1053bd284df63ff72a32b5d1fb217ba /src/device.c | |
parent | 3ce242a568c5c565e42ee70a32c6fd41cb5fa5a7 (diff) |
device: disable ipv6 auto address generation
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/device.c')
-rw-r--r-- | src/device.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/device.c b/src/device.c index 55adc60..af53393 100644 --- a/src/device.c +++ b/src/device.c @@ -19,6 +19,7 @@ #include <net/icmp.h> #include <net/rtnetlink.h> #include <net/ip_tunnels.h> +#include <net/addrconf.h> #if IS_ENABLED(CONFIG_NF_CONNTRACK) #include <net/netfilter/nf_conntrack.h> #include <net/netfilter/nf_nat_core.h> @@ -48,7 +49,12 @@ static int open_peer(struct wireguard_peer *peer, void *data) static int open(struct net_device *dev) { struct wireguard_device *wg = netdev_priv(dev); - int ret = socket_init(wg); + int ret; + struct inet6_dev *dev_v6 = __in6_dev_get(dev); + if (dev_v6) + dev_v6->addr_gen_mode = IN6_ADDR_GEN_MODE_NONE; + + ret = socket_init(wg); if (ret < 0) return ret; peer_for_each(wg, open_peer, NULL); @@ -261,7 +267,7 @@ static void setup(struct net_device *dev) dev->addr_len = 0; dev->needed_headroom = DATA_PACKET_HEAD_ROOM; dev->needed_tailroom = noise_encrypted_len(MESSAGE_PADDING_MULTIPLE); - dev->type = ARPHRD_NONE; /* Virtually the same as ARPHRD_NONE, except doesn't get IP6 auto config. */ + dev->type = ARPHRD_NONE; dev->flags = IFF_POINTOPOINT | IFF_NOARP; #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) dev->flags |= IFF_NO_QUEUE; |