net: ipv6: Generate random IID for addresses on RAWIP devices
authorSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Tue, 5 Jun 2018 01:26:07 +0000 (19:26 -0600)
committerDavid S. Miller <davem@davemloft.net>
Tue, 5 Jun 2018 14:16:25 +0000 (10:16 -0400)
RAWIP devices such as rmnet do not have a hardware address and
instead require the kernel to generate a random IID for the
IPv6 addresses.

Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
net/ipv6/addrconf.c

index cb02e1a015c1a207db2dda91518562844d343a1f..b9a7548ec6a0a7ed2cc7939b4adac70188b37cd8 100644 (file)
@@ -221,6 +221,10 @@ void rmnet_vnd_setup(struct net_device *rmnet_dev)
 
        rmnet_dev->needs_free_netdev = true;
        rmnet_dev->ethtool_ops = &rmnet_ethtool_ops;
+
+       /* This perm addr will be used as interface identifier by IPv6 */
+       rmnet_dev->addr_assign_type = NET_ADDR_RANDOM;
+       eth_random_addr(rmnet_dev->perm_addr);
 }
 
 /* Exposed API */
index f09afc232da441a3627546f3db3431b46eab9d42..5596d87952d4ac93d24cfee4538f5ea795a111ce 100644 (file)
@@ -2251,6 +2251,7 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
                return addrconf_ifid_ieee1394(eui, dev);
        case ARPHRD_TUNNEL6:
        case ARPHRD_IP6GRE:
+       case ARPHRD_RAWIP:
                return addrconf_ifid_ip6tnl(eui, dev);
        }
        return -1;
@@ -3286,7 +3287,8 @@ static void addrconf_dev_config(struct net_device *dev)
            (dev->type != ARPHRD_IP6GRE) &&
            (dev->type != ARPHRD_IPGRE) &&
            (dev->type != ARPHRD_TUNNEL) &&
-           (dev->type != ARPHRD_NONE)) {
+           (dev->type != ARPHRD_NONE) &&
+           (dev->type != ARPHRD_RAWIP)) {
                /* Alas, we support only Ethernet autoconfiguration. */
                return;
        }