netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, tgraf@suug.ch,
	Stephen Hemminger <shemming@brocade.com>
Subject: Re: [PATCH] net: rtnetlink: be more strict when setting MAC address
Date: Tue, 18 Aug 2015 01:23:16 +0200	[thread overview]
Message-ID: <20150817232316.GA20744@orbit.nwl.cc> (raw)
In-Reply-To: <20150817.140933.1342685440755543932.davem@davemloft.net>

On Mon, Aug 17, 2015 at 02:09:33PM -0700, David Miller wrote:
> From: Phil Sutter <phil@nwl.cc>
> Date: Mon, 17 Aug 2015 23:06:47 +0200
> 
> > Upon evaluation of IFLA_ADDRESS and IFLA_BROADCAST messages, make sure
> > the passed argument length matches dev->addr_len exactly.
> > 
> > This fixes dubious behaviour of 'ip link set eth0 addr <MAC>' where
> > '<MAC>' is too long, e.g. '00:11:22:33:44:55:66:77'. Called like this,
> > 'ip' would return successfully and the kernel sets eth0's MAC address to
> > the leading six octets of the passed argument.
> > 
> > Signed-off-by: Phil Sutter <phil@nwl.cc>
> 
> I don't think this behavior is very "dubious" and making the check more
> strict risks breaking things that have worked for a very long time.
> 
> I'm not applying this, sorry.

No problem. I was already afraid of this breaking something as commit
1840bb1, which introduces validate_linkmsg(), already mentions something
in that direction. Therefore I appreciate your feedback clarifying this
for me, although it is not quite the outcome I had wished for.

Seeing that the kernel checks the minimum length already, shifting the
maximum length check to kernel space felt like a natural choice.

Nevertheless, I think iproute2 should not behave this way. Stephen, do
you think it is reasonable to add a similar logic to iplink_parse() as
done in do_set() (i.e., finding out which is the correct length of LL
address for a given interface and validating input based on this)? If
so, is it appropriate to recycle get_address() function or should the
information come from netlink?

Thanks, Phil

      reply	other threads:[~2015-08-17 23:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 21:06 [PATCH] net: rtnetlink: be more strict when setting MAC address Phil Sutter
2015-08-17 21:09 ` David Miller
2015-08-17 23:23   ` Phil Sutter [this message]

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=20150817232316.GA20744@orbit.nwl.cc \
    --to=phil@nwl.cc \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemming@brocade.com \
    --cc=tgraf@suug.ch \
    /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).