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

Commit 7360fe16 authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan
Browse files

core: Update IID every time netdevice is brought down



This is done to randomize the IPv6 address generation.
This also assigns a different IID to every rmnet interface.

CRs-Fixed: 2771389
Change-Id: I427481f1eeda098a2ebbd0c8ce88030eb0cd6cfd
Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
parent 8a3c6765
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -331,7 +331,9 @@ static int rmnet_config_notify_cb(struct notifier_block *nb,
		netdev_dbg(dev, "Kernel unregister\n");
		rmnet_force_unassociate_device(dev);
		break;

	case NETDEV_DOWN:
		rmnet_vnd_reset_mac_addr(dev);
		break;
	default:
		break;
	}
+9 −1
Original line number Diff line number Diff line
@@ -357,7 +357,7 @@ void rmnet_vnd_setup(struct net_device *rmnet_dev)
	rmnet_dev->netdev_ops = &rmnet_vnd_ops;
	rmnet_dev->mtu = RMNET_DFLT_PACKET_SIZE;
	rmnet_dev->needed_headroom = RMNET_NEEDED_HEADROOM;
	random_ether_addr(rmnet_dev->dev_addr);
	random_ether_addr(rmnet_dev->perm_addr);
	rmnet_dev->tx_queue_len = RMNET_TX_QUEUE_LEN;

	/* Raw IP mode */
@@ -444,3 +444,11 @@ int rmnet_vnd_do_flow_control(struct net_device *rmnet_dev, int enable)

	return 0;
}

void rmnet_vnd_reset_mac_addr(struct net_device *dev)
{
	if (dev->netdev_ops != &rmnet_vnd_ops)
		return;

	random_ether_addr(dev->perm_addr);
}
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2018, 2020 The Linux Foundation. All rights reserved.
 *
 * 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
@@ -27,4 +27,5 @@ void rmnet_vnd_rx_fixup(struct net_device *dev, u32 skb_len);
void rmnet_vnd_tx_fixup(struct net_device *dev, u32 skb_len);
u8 rmnet_vnd_get_mux(struct net_device *rmnet_dev);
void rmnet_vnd_setup(struct net_device *dev);
void rmnet_vnd_reset_mac_addr(struct net_device *dev);
#endif /* _RMNET_VND_H_ */