ethtool: set addr_assign_type to NET_ADDR_SET when addr is passed on create
authorJiri Pirko <jiri@resnulli.us>
Sun, 6 Jan 2013 12:41:57 +0000 (12:41 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Jan 2013 05:05:02 +0000 (21:05 -0800)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c

index 9969afb82271ed41b8bdc7ffdbc0dd5d17b245aa..9a419b0994822986c90abacf1ebe49307618ed1b 100644 (file)
@@ -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]));