Message ID | 20090413083848.GB23734@psychotron.englab.brq.redhat.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Mon, 13 Apr 2009 10:38:48 +0200 Jiri Pirko <jpirko@redhat.com> wrote: > Introducing function dev_mac_address_changed which can be called from driver > which changed his mac address to force notifiers to be called. > > Signed-off-by: Jiri Pirko <jpirko@redhat.com> > --- > include/linux/netdevice.h | 1 + > net/core/dev.c | 12 ++++++++++++ > 2 files changed, 13 insertions(+), 0 deletions(-) > > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h > index 2e7783f..ff8db51 100644 > --- a/include/linux/netdevice.h > +++ b/include/linux/netdevice.h > @@ -1461,6 +1461,7 @@ extern int dev_change_net_namespace(struct net_device *, > extern int dev_set_mtu(struct net_device *, int); > extern int dev_set_mac_address(struct net_device *, > struct sockaddr *); > +extern void dev_mac_address_changed(struct net_device *); > extern int dev_hard_start_xmit(struct sk_buff *skb, > struct net_device *dev, > struct netdev_queue *txq); > diff --git a/net/core/dev.c b/net/core/dev.c > index 91d792d..1adc89b 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -3833,6 +3833,18 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa) > return err; > } > > +/** > + * dev_mac_address_changed - Notify Media Access Control Address changed > + * @dev: device > + * > + * Notifies the change of the hardware (MAC) address of the device > + */ > +void dev_mac_address_changed(struct net_device *dev) > +{ > + call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); > +} > +EXPORT_SYMBOL(dev_mac_address_changed); > + > /* > * Perform the SIOCxIFxxx calls, inside read_lock(dev_base_lock) > */ The original version of this that I send, allowed notifiers to return an error to block changing address (error would go back to application). This is how other notifier hooks work (mtu, etc). Why is dev_set_mac_address_changed called out separately, it should be inside dev_set_mac_address. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 2e7783f..ff8db51 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1461,6 +1461,7 @@ extern int dev_change_net_namespace(struct net_device *, extern int dev_set_mtu(struct net_device *, int); extern int dev_set_mac_address(struct net_device *, struct sockaddr *); +extern void dev_mac_address_changed(struct net_device *); extern int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, struct netdev_queue *txq); diff --git a/net/core/dev.c b/net/core/dev.c index 91d792d..1adc89b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3833,6 +3833,18 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa) return err; } +/** + * dev_mac_address_changed - Notify Media Access Control Address changed + * @dev: device + * + * Notifies the change of the hardware (MAC) address of the device + */ +void dev_mac_address_changed(struct net_device *dev) +{ + call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); +} +EXPORT_SYMBOL(dev_mac_address_changed); + /* * Perform the SIOCxIFxxx calls, inside read_lock(dev_base_lock) */
Introducing function dev_mac_address_changed which can be called from driver which changed his mac address to force notifiers to be called. Signed-off-by: Jiri Pirko <jpirko@redhat.com> --- include/linux/netdevice.h | 1 + net/core/dev.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-)