Re: [PATCH] fix up RTM_SETLINK handling

From: Roland Dreier (roland@topspin.com)
Date: Wed Jan 15 2003 - 20:39:40 EST


Added EXPORT_SYMBOL for call_netdevice_notifiers().

Thanks,
  Roland

 include/linux/netdevice.h | 1 +
 net/core/dev.c | 12 ++++++++++++
 net/core/rtnetlink.c | 17 +++++++++++++++--
 net/netsyms.c | 1 +
 4 files changed, 29 insertions(+), 2 deletions(-)

===== include/linux/netdevice.h 1.27 vs edited =====
--- 1.27/include/linux/netdevice.h Tue Jan 7 14:33:37 2003
+++ edited/include/linux/netdevice.h Wed Jan 15 17:07:08 2003
@@ -480,6 +480,7 @@
 extern int unregister_netdevice(struct net_device *dev);
 extern int register_netdevice_notifier(struct notifier_block *nb);
 extern int unregister_netdevice_notifier(struct notifier_block *nb);
+extern int call_netdevice_notifiers(unsigned long val, void *v);
 extern int dev_new_index(void);
 extern struct net_device *dev_get_by_index(int ifindex);
 extern struct net_device *__dev_get_by_index(int ifindex);
===== net/netsyms.c 1.40 vs edited =====
--- 1.40/net/netsyms.c Wed Dec 4 11:42:20 2002
+++ edited/net/netsyms.c Wed Jan 15 17:35:56 2003
@@ -500,6 +500,7 @@
 /* Device callback registration */
 EXPORT_SYMBOL(register_netdevice_notifier);
 EXPORT_SYMBOL(unregister_netdevice_notifier);
+EXPORT_SYMBOL(call_netdevice_notifiers);
 
 /* support for loadable net drivers */
 #ifdef CONFIG_NET
===== net/core/dev.c 1.52 vs edited =====
--- 1.52/net/core/dev.c Tue Jan 7 14:33:37 2003
+++ edited/net/core/dev.c Wed Jan 15 17:19:13 2003
@@ -877,6 +877,18 @@
         return notifier_chain_unregister(&netdev_chain, nb);
 }
 
+/**
+ * call_netdevice_notifiers - call all network notifier blocks
+ *
+ * Call all network notifier blocks. Parameters and return value
+ * are as for notifier_call_chain().
+ */
+
+int call_netdevice_notifiers(unsigned long val, void *v)
+{
+ return notifier_call_chain(&netdev_chain, val, v);
+}
+
 /*
  * Support routine. Sends outgoing frames to any network
  * taps currently in use.
===== net/core/rtnetlink.c 1.6 vs edited =====
--- 1.6/net/core/rtnetlink.c Tue Jan 7 01:05:42 2003
+++ edited/net/core/rtnetlink.c Wed Jan 15 17:10:37 2003
@@ -234,10 +234,20 @@
         err = -EINVAL;
 
         if (ida[IFLA_ADDRESS - 1]) {
+ if (!dev->set_mac_address) {
+ err = -EOPNOTSUPP;
+ goto out;
+ }
+ if (!netif_device_present(dev)) {
+ err = -ENODEV;
+ goto out;
+ }
                 if (ida[IFLA_ADDRESS - 1]->rta_len != RTA_LENGTH(dev->addr_len))
                         goto out;
- memcpy(dev->dev_addr, RTA_DATA(ida[IFLA_ADDRESS - 1]),
- dev->addr_len);
+
+ err = dev->set_mac_address(dev, RTA_DATA(ida[IFLA_ADDRESS - 1]));
+ if (err)
+ goto out;
         }
 
         if (ida[IFLA_BROADCAST - 1]) {
@@ -250,6 +260,9 @@
         err = 0;
 
 out:
+ if (!err)
+ call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
+
         dev_put(dev);
         return err;
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jan 15 2003 - 22:00:56 EST