diff options
author | Jiri Pirko <jiri@resnulli.us> | 2013-01-07 20:38:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-08 21:00:47 -0500 |
commit | 948b337e62ca96b6e7de06fdd5f6fe44769d7e9c (patch) | |
tree | 801e99a0a85a7030dc0c5cde8907d54860ac6716 /net/core/dev.c | |
parent | 7265a6bbdd28c37e567162308a09807cb22cdb75 (diff) |
net: init perm_addr in register_netdevice()
Benefit from the fact that dev->addr_assign_type is set to NET_ADDR_PERM
in case the device has permanent address.
This also fixes the problem that many drivers do not set perm_addr at
all.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 2e2448201a76..594830e83589 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -6004,6 +6004,13 @@ int register_netdevice(struct net_device *dev) | |||
6004 | list_netdevice(dev); | 6004 | list_netdevice(dev); |
6005 | add_device_randomness(dev->dev_addr, dev->addr_len); | 6005 | add_device_randomness(dev->dev_addr, dev->addr_len); |
6006 | 6006 | ||
6007 | /* If the device has permanent device address, driver should | ||
6008 | * set dev_addr and also addr_assign_type should be set to | ||
6009 | * NET_ADDR_PERM (default value). | ||
6010 | */ | ||
6011 | if (dev->addr_assign_type == NET_ADDR_PERM) | ||
6012 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
6013 | |||
6007 | /* Notify protocols, that a new device appeared. */ | 6014 | /* Notify protocols, that a new device appeared. */ |
6008 | ret = call_netdevice_notifiers(NETDEV_REGISTER, dev); | 6015 | ret = call_netdevice_notifiers(NETDEV_REGISTER, dev); |
6009 | ret = notifier_to_errno(ret); | 6016 | ret = notifier_to_errno(ret); |