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

Commit 9bac3b90 authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan
Browse files

ipv6: generate random IID only for temporary addresses on RAWIP devices



RAWIP devices require the device IID to be used for permanent
addresses only, and random IIDs to be generated for temporary
addresses. Legacy user-space applications rely on this behavior

CRs-Fixed: 2086060
Change-Id: I007bdf8bcfdce687ad31612fed9d9c769321edb9
Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
parent a3e068e8
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -2216,6 +2216,16 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
	case ARPHRD_TUNNEL6:
	case ARPHRD_IP6GRE:
		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;
}
@@ -3246,7 +3256,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;
	}