Patchwork [net-next] ethtool: set addr_assign_type to NET_ADDR_SET when addr is passed on create

login
register
mail settings
Submitter Jiri Pirko
Date Jan. 6, 2013, 10:41 p.m.
Message ID <1357512117-5581-1-git-send-email-jiri@resnulli.us>
Download mbox | patch
Permalink /patch/209841/
State Accepted
Delegated to: David Miller
Headers show

Comments

Jiri Pirko - Jan. 6, 2013, 10:41 p.m.
In case user passed address via netlink during create, NET_ADDR_PERM was set.
That is not correct so fix this by setting NET_ADDR_SET.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 net/core/rtnetlink.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
David Miller - Jan. 7, 2013, 5:05 a.m.
From: Jiri Pirko <jiri@resnulli.us>
Date: Sun,  6 Jan 2013 23:41:57 +0100

> In case user passed address via netlink during create, NET_ADDR_PERM was set.
> That is not correct so fix this by setting NET_ADDR_SET.
> 
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 9969afb..9a419b0 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1667,9 +1667,11 @@  struct net_device *rtnl_create_link(struct net *net,
 
 	if (tb[IFLA_MTU])
 		dev->mtu = nla_get_u32(tb[IFLA_MTU]);
-	if (tb[IFLA_ADDRESS])
+	if (tb[IFLA_ADDRESS]) {
 		memcpy(dev->dev_addr, nla_data(tb[IFLA_ADDRESS]),
 				nla_len(tb[IFLA_ADDRESS]));
+		dev->addr_assign_type = NET_ADDR_SET;
+	}
 	if (tb[IFLA_BROADCAST])
 		memcpy(dev->broadcast, nla_data(tb[IFLA_BROADCAST]),
 				nla_len(tb[IFLA_BROADCAST]));