From: Hauke Mehrtens Date: Sat, 26 Dec 2009 21:44:35 +0000 (+0100) Subject: compat: Backport eth_mac_addr X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=5dc40f3a780ef81b818cd55871c556eb6f24b0ad;p=openwrt%2Fstaging%2Fblogic.git compat: Backport eth_mac_addr eth_mac_addr is needed by net/mac80211/iface.c Signed-off-by: Hauke Mehrtens --- diff --git a/compat/compat-2.6.29.c b/compat/compat-2.6.29.c index 669ad3505b7b..ea2a99194130 100644 --- a/compat/compat-2.6.29.c +++ b/compat/compat-2.6.29.c @@ -13,6 +13,7 @@ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) #include +#include /** * usb_unpoison_anchored_urbs - let an anchor be used successfully again @@ -35,6 +36,29 @@ void usb_unpoison_anchored_urbs(struct usb_anchor *anchor) } EXPORT_SYMBOL_GPL(usb_unpoison_anchored_urbs); +/** + * eth_mac_addr - set new Ethernet hardware address + * @dev: network device + * @p: socket address + * Change hardware address of device. + * + * This doesn't change hardware matching, so needs to be overridden + * for most real devices. + */ +int eth_mac_addr(struct net_device *dev, void *p) +{ + struct sockaddr *addr = p; + + if (netif_running(dev)) + return -EBUSY; + if (!is_valid_ether_addr(addr->sa_data)) + return -EADDRNOTAVAIL; + memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); + return 0; +} +EXPORT_SYMBOL(eth_mac_addr); +/* Source: net/ethernet/eth.c */ + #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) */ diff --git a/include/linux/compat-2.6.29.h b/include/linux/compat-2.6.29.h index cad5e6b4888b..b31a58c95484 100644 --- a/include/linux/compat-2.6.29.h +++ b/include/linux/compat-2.6.29.h @@ -56,6 +56,8 @@ extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor); } \ ) +extern int eth_mac_addr(struct net_device *dev, void *p); + #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) */ #endif /* LINUX_26_29_COMPAT_H */