summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2013-01-01 04:30:16 +0100
committerDavid S. Miller <davem@davemloft.net>2013-01-04 07:37:36 +0100
commitfbdeca2d7753aa1ab929aeb77ccc46489eed02b9 (patch)
tree156a4b2bada01c59549988352d203191288803e4
parentnet: set dev->addr_assign_type correctly (diff)
downloadlinux-fbdeca2d7753aa1ab929aeb77ccc46489eed02b9.tar.xz
linux-fbdeca2d7753aa1ab929aeb77ccc46489eed02b9.zip
net: add address assign type "SET"
This is the way to indicate that mac address of a device has been set by dev_set_mac_address() Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--net/core/dev.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 6835b5837f93..c5031a45e185 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -64,6 +64,8 @@ struct wireless_dev;
#define NET_ADDR_PERM 0 /* address is permanent (default) */
#define NET_ADDR_RANDOM 1 /* address is generated randomly */
#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
+#define NET_ADDR_SET 3 /* address is set using
+ * dev_set_mac_address() */
/* Backlog congestion levels */
#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
diff --git a/net/core/dev.c b/net/core/dev.c
index c85e32b30f04..bddb2f2ccaa9 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5022,6 +5022,7 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa)
err = ops->ndo_set_mac_address(dev, sa);
if (err)
return err;
+ dev->addr_assign_type = NET_ADDR_SET;
call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
add_device_randomness(dev->dev_addr, dev->addr_len);
return 0;