From: Mira Ressel <aranea@aixah.de>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Mira Ressel <aranea@aixah.de>
Subject: [PATCH 2/2] vlan: Initialize dev->perm_addr
Date: Mon, 24 Aug 2020 14:47:47 +0000 [thread overview]
Message-ID: <20200824144747.7037-1-aranea@aixah.de> (raw)
In-Reply-To: <20200824143828.5964-1-aranea@aixah.de>
Set the perm_addr of vlan devices to that of their parent device.
Otherwise, it remains all zero, with the consequence that
ipv6_generate_stable_address() (which is used if the sysctl
net.ipv6.conf.DEV.addr_gen_mode is set to 2 or 3) assigns every vlan
interface on a host the same link-local address.
This has the added benefit of giving vlan devices the same link-local
address as their parent device, which is common practice, and indeed
precisely what happens automatically if the default eui64-based address
generation is used.
Signed-off-by: Mira Ressel <aranea@aixah.de>
---
net/8021q/vlan_netlink.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index 0db85aeb119b..8c60d92b7717 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -182,6 +182,8 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev,
else if (dev->mtu > max_mtu)
return -EINVAL;
+ memcpy(dev->perm_addr, real_dev->perm_addr, real_dev->addr_len);
+
err = vlan_changelink(dev, tb, data, extack);
if (!err)
err = register_vlan_dev(dev, extack);
--
2.25.4
next prev parent reply other threads:[~2020-08-24 14:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-24 14:38 [PATCH 1/2] veth: Initialize dev->perm_addr Mira Ressel
2020-08-24 14:47 ` Mira Ressel [this message]
2020-08-24 17:25 ` David Miller
2020-08-26 15:20 ` Mira Ressel
2020-08-26 15:28 ` David Miller
2020-08-26 16:29 ` Mira Ressel
2020-08-26 16:33 ` David Miller
2020-08-27 1:04 ` Mira Ressel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200824144747.7037-1-aranea@aixah.de \
--to=aranea@aixah.de \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox