Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec
[linux-2.6-block.git] / net / ipv6 / ip6_vti.c
index 9156d6b9eb24ba9c263909668ef5bca2d036950a..3d8a3b63b4fdbec7d488194e21e0c9013f0ff6da 100644 (file)
@@ -49,6 +49,7 @@
 #include <net/xfrm.h>
 #include <net/net_namespace.h>
 #include <net/netns/generic.h>
+#include <linux/etherdevice.h>
 
 #define IP6_VTI_HASH_SIZE_SHIFT  5
 #define IP6_VTI_HASH_SIZE (1 << IP6_VTI_HASH_SIZE_SHIFT)
@@ -696,6 +697,10 @@ vti6_parm_to_user(struct ip6_tnl_parm2 *u, const struct __ip6_tnl_parm *p)
        u->link = p->link;
        u->i_key = p->i_key;
        u->o_key = p->o_key;
+       if (u->i_key)
+               u->i_flags |= GRE_KEY;
+       if (u->o_key)
+               u->o_flags |= GRE_KEY;
        u->proto = p->proto;
 
        memcpy(u->name, p->name, sizeof(u->name));
@@ -846,6 +851,9 @@ static void vti6_dev_setup(struct net_device *dev)
        dev->flags |= IFF_NOARP;
        dev->addr_len = sizeof(struct in6_addr);
        netif_keep_dst(dev);
+       /* This perm addr will be used as interface identifier by IPv6 */
+       dev->addr_assign_type = NET_ADDR_RANDOM;
+       eth_random_addr(dev->perm_addr);
 }
 
 /**