linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mira Ressel <aranea@aixah.de>
To: David Miller <davem@davemloft.net>
Cc: kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] veth: Initialize dev->perm_addr
Date: Wed, 26 Aug 2020 15:20:00 +0000	[thread overview]
Message-ID: <20200826152000.ckxrcfyetdvuvqum@vega> (raw)
In-Reply-To: <20200824.102545.1450838041398463071.davem@davemloft.net>

On Mon, Aug 24, 2020 at 10:25:45AM -0700, David Miller wrote:
> From: Mira Ressel <aranea@aixah.de>
> Date: Mon, 24 Aug 2020 14:38:26 +0000
> 
> > Set the perm_addr of veth devices to whatever MAC has been assigned to
> > the 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 veth
> > interface on a host the same link-local address.
> > 
> > The new behaviour matches that of several other virtual interface types
> > (such as gre), and as far as I can tell, perm_addr isn't used by any
> > other code sites that are relevant to veth.
> > 
> > Signed-off-by: Mira Ressel <aranea@aixah.de>
>  ...
> > @@ -1342,6 +1342,8 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
> >  	if (!ifmp || !tbp[IFLA_ADDRESS])
> >  		eth_hw_addr_random(peer);
> >  
> > +	memcpy(peer->perm_addr, peer->dev_addr, peer->addr_len);
> 
> Semantically don't you want to copy over the peer->perm_addr?
> 
> Otherwise this loses the entire point of the permanent address, and
> what the ipv6 address generation facility expects.

I'm confused. Am I misinterpreting what you're saying here, or did you
make a typo?

I'm setting the peer->perm_addr, which would otherwise be zero, to its
dev_addr, which has been either generated randomly by the kernel or
provided by userland in a netlink attribute.

-- 
Regards,
Mira

  reply	other threads:[~2020-08-26 15:20 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 ` [PATCH 2/2] vlan: " Mira Ressel
2020-08-24 17:25 ` [PATCH 1/2] veth: " David Miller
2020-08-26 15:20   ` Mira Ressel [this message]
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=20200826152000.ckxrcfyetdvuvqum@vega \
    --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;
as well as URLs for NNTP newsgroup(s).