* [PATCH net-next v2] net: ipv6: Generate random IID for addresses on RAWIP devices
@ 2018-06-05 1:26 Subash Abhinov Kasiviswanathan
2018-06-05 14:17 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Subash Abhinov Kasiviswanathan @ 2018-06-05 1:26 UTC (permalink / raw)
To: davem, netdev, yoshfuji; +Cc: Subash Abhinov Kasiviswanathan, Sean Tranchetti
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>
---
v1->v2: Yoshfuji suggested to update the I/G and G/L bit.
Similar functionality is already implemented by addrconf_ifid_ip6tnl()
so use it.
---
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 4 ++++
net/ipv6/addrconf.c | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
index cb02e1a..b9a7548 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
@@ -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 */
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f09afc2..5596d87 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -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;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next v2] net: ipv6: Generate random IID for addresses on RAWIP devices
2018-06-05 1:26 [PATCH net-next v2] net: ipv6: Generate random IID for addresses on RAWIP devices Subash Abhinov Kasiviswanathan
@ 2018-06-05 14:17 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-06-05 14:17 UTC (permalink / raw)
To: subashab; +Cc: netdev, yoshfuji, stranche
From: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Date: Mon, 4 Jun 2018 19:26:07 -0600
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-05 14:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 1:26 [PATCH net-next v2] net: ipv6: Generate random IID for addresses on RAWIP devices Subash Abhinov Kasiviswanathan
2018-06-05 14:17 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.