From e5ba407f8f08c812d9bf5088e51c54644839c85b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 11 Dec 2016 02:44:40 +0100 Subject: device: disable ipv6 auto address generation Signed-off-by: Jason A. Donenfeld --- src/device.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/device.c') 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 #include #include +#include #if IS_ENABLED(CONFIG_NF_CONNTRACK) #include #include @@ -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; -- cgit v1.2.3