diff options
-rw-r--r-- | drivers/net/macvlan.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 9f4d65c3095f..b7c9791009d0 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -213,6 +213,29 @@ static int macvlan_stop(struct net_device *dev) | |||
213 | return 0; | 213 | return 0; |
214 | } | 214 | } |
215 | 215 | ||
216 | static int macvlan_set_mac_address(struct net_device *dev, void *p) | ||
217 | { | ||
218 | struct macvlan_dev *vlan = netdev_priv(dev); | ||
219 | struct net_device *lowerdev = vlan->lowerdev; | ||
220 | struct sockaddr *addr = p; | ||
221 | int err; | ||
222 | |||
223 | if (!is_valid_ether_addr(addr->sa_data)) | ||
224 | return -EADDRNOTAVAIL; | ||
225 | |||
226 | if (!(dev->flags & IFF_UP)) | ||
227 | goto out; | ||
228 | |||
229 | err = dev_unicast_add(lowerdev, addr->sa_data, ETH_ALEN); | ||
230 | if (err < 0) | ||
231 | return err; | ||
232 | dev_unicast_delete(lowerdev, dev->dev_addr, ETH_ALEN); | ||
233 | |||
234 | out: | ||
235 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | ||
236 | return 0; | ||
237 | } | ||
238 | |||
216 | static void macvlan_change_rx_flags(struct net_device *dev, int change) | 239 | static void macvlan_change_rx_flags(struct net_device *dev, int change) |
217 | { | 240 | { |
218 | struct macvlan_dev *vlan = netdev_priv(dev); | 241 | struct macvlan_dev *vlan = netdev_priv(dev); |
@@ -300,6 +323,7 @@ static void macvlan_setup(struct net_device *dev) | |||
300 | dev->stop = macvlan_stop; | 323 | dev->stop = macvlan_stop; |
301 | dev->change_mtu = macvlan_change_mtu; | 324 | dev->change_mtu = macvlan_change_mtu; |
302 | dev->change_rx_flags = macvlan_change_rx_flags; | 325 | dev->change_rx_flags = macvlan_change_rx_flags; |
326 | dev->set_mac_address = macvlan_set_mac_address; | ||
303 | dev->set_multicast_list = macvlan_set_multicast_list; | 327 | dev->set_multicast_list = macvlan_set_multicast_list; |
304 | dev->hard_start_xmit = macvlan_hard_start_xmit; | 328 | dev->hard_start_xmit = macvlan_hard_start_xmit; |
305 | dev->destructor = free_netdev; | 329 | dev->destructor = free_netdev; |