Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac65cb8e authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan
Browse files

net: ipv6: Generate all random IID for addresses on RAWIP devices



This reverts commit 557a3b4d ("net: ipv6: Generate random IID
for addresses on RAWIP devices") and commit 8601ea92 ("ipv6: Do
not generate random IID only for RAWIP devices").

This scheme allows for generation of a new IID each time the
interface state is toggled rather than it persisting for the
lifetime of the device.

CRs-Fixed: 2379253
Change-Id: I5c524ae18c374e3afcc26b4ba93a292d51839ed1
Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
parent 5cfddbc8
Loading
Loading
Loading
Loading
+1 −5
Original line number Original line Diff line number Diff line
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -298,10 +298,6 @@ void rmnet_vnd_setup(struct net_device *rmnet_dev)


	rmnet_dev->needs_free_netdev = true;
	rmnet_dev->needs_free_netdev = true;
	rmnet_dev->ethtool_ops = &rmnet_ethtool_ops;
	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 */
/* Exposed API */
+10 −1
Original line number Original line Diff line number Diff line
@@ -2216,8 +2216,17 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
		return addrconf_ifid_ieee1394(eui, dev);
		return addrconf_ifid_ieee1394(eui, dev);
	case ARPHRD_TUNNEL6:
	case ARPHRD_TUNNEL6:
	case ARPHRD_IP6GRE:
	case ARPHRD_IP6GRE:
	case ARPHRD_RAWIP:
		return addrconf_ifid_ip6tnl(eui, dev);
		return addrconf_ifid_ip6tnl(eui, dev);
	case ARPHRD_RAWIP: {
		struct in6_addr lladdr;

		if (ipv6_get_lladdr(dev, &lladdr, IFA_F_TENTATIVE))
			get_random_bytes(eui, 8);
		else
			memcpy(eui, lladdr.s6_addr + 8, 8);

		return 0;
	}
	}
	}
	return -1;
	return -1;
}
}