Commit 93b7db46 authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

[NET]: Fix notification on address change via rtnetlink.

Only send NETDEV_CHANGEADDR notifies for address and broadcast changes.
Notify is also sent out if only one of the 2 changes is successful.
Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarJamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 97b085e2
...@@ -265,7 +265,7 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ...@@ -265,7 +265,7 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
struct ifinfomsg *ifm = NLMSG_DATA(nlh); struct ifinfomsg *ifm = NLMSG_DATA(nlh);
struct rtattr **ida = arg; struct rtattr **ida = arg;
struct net_device *dev; struct net_device *dev;
int err; int err, send_addr_notify = 0;
dev = dev_get_by_index(ifm->ifi_index); dev = dev_get_by_index(ifm->ifi_index);
if (!dev) if (!dev)
...@@ -312,6 +312,7 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ...@@ -312,6 +312,7 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
err = dev->set_mac_address(dev, RTA_DATA(ida[IFLA_ADDRESS - 1])); err = dev->set_mac_address(dev, RTA_DATA(ida[IFLA_ADDRESS - 1]));
if (err) if (err)
goto out; goto out;
send_addr_notify = 1;
} }
if (ida[IFLA_BROADCAST - 1]) { if (ida[IFLA_BROADCAST - 1]) {
...@@ -319,6 +320,7 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ...@@ -319,6 +320,7 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
goto out; goto out;
memcpy(dev->broadcast, RTA_DATA(ida[IFLA_BROADCAST - 1]), memcpy(dev->broadcast, RTA_DATA(ida[IFLA_BROADCAST - 1]),
dev->addr_len); dev->addr_len);
send_addr_notify = 1;
} }
if (ida[IFLA_MTU - 1]) { if (ida[IFLA_MTU - 1]) {
...@@ -365,7 +367,7 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ...@@ -365,7 +367,7 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
err = 0; err = 0;
out: out:
if (!err) if (send_addr_notify)
call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
dev_put(dev); dev_put(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment