* [patch net] ethtool: set addr_assign_type to NET_ADDR_SET when addr is passed on create
@ 2013-01-06 22:38 Jiri Pirko
2013-01-07 16:36 ` Ben Hutchings
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2013-01-06 22:38 UTC (permalink / raw)
To: netdev; +Cc: davem, bhutchings, shemminger, sassmann
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(-)
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]));
--
1.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch net] ethtool: set addr_assign_type to NET_ADDR_SET when addr is passed on create
2013-01-06 22:38 [patch net] ethtool: set addr_assign_type to NET_ADDR_SET when addr is passed on create Jiri Pirko
@ 2013-01-07 16:36 ` Ben Hutchings
2013-01-07 17:52 ` Jiri Pirko
0 siblings, 1 reply; 3+ messages in thread
From: Ben Hutchings @ 2013-01-07 16:36 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, davem, shemminger, sassmann
On Sun, 2013-01-06 at 23:38 +0100, Jiri Pirko wrote:
> 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>
Not sure what this has to do with ethtool...
> ---
> net/core/rtnetlink.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> 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]));
But if the address is not specified for this new device,
addr_assign_type remains NET_ADD_PERM, right? That sort of makes sense
in that the 'permanent address' of a software device is all-zeroes. I
would prefer to have a way for devices to deny having a permanent
address, but it's a bit late to change that now.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch net] ethtool: set addr_assign_type to NET_ADDR_SET when addr is passed on create
2013-01-07 16:36 ` Ben Hutchings
@ 2013-01-07 17:52 ` Jiri Pirko
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2013-01-07 17:52 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev, davem, shemminger, sassmann
Mon, Jan 07, 2013 at 05:36:05PM CET, bhutchings@solarflare.com wrote:
>On Sun, 2013-01-06 at 23:38 +0100, Jiri Pirko wrote:
>> 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>
>
>Not sure what this has to do with ethtool...
Should have been "netlink" ...
>
>> ---
>> net/core/rtnetlink.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> 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]));
>
>But if the address is not specified for this new device,
>addr_assign_type remains NET_ADD_PERM, right? That sort of makes sense
>in that the 'permanent address' of a software device is all-zeroes. I
>would prefer to have a way for devices to deny having a permanent
>address, but it's a bit late to change that now.
Well if soft-dev uses eth_hw_addr_random() (like team, bridge,
macvlan, etc) it is set to NET_ADDR_RANDOM
And that is exactly the right way to deny having perm address.
>
>Ben.
>
>--
>Ben Hutchings, Staff Engineer, Solarflare
>Not speaking for my employer; that's the marketing department's job.
>They asked us to note that Solarflare product names are trademarked.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-07 17:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-06 22:38 [patch net] ethtool: set addr_assign_type to NET_ADDR_SET when addr is passed on create Jiri Pirko
2013-01-07 16:36 ` Ben Hutchings
2013-01-07 17:52 ` Jiri Pirko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.