aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/macvlan.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-11-20 01:00:42 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:54:23 -0500
commitad5d20a63940fcfb40af76ba06148f36d5d0b433 (patch)
treeaa45929a8fe974db343ee62c24ba8cc32f8b06d2 /drivers/net/macvlan.c
parent59891d53f4a31402f8bd1f8c89e0e2c07d51b2cd (diff)
[MACVLAN]: Allow setting mac address while device is up
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macvlan.c')
-rw-r--r--drivers/net/macvlan.c24
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
216static 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
234out:
235 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
236 return 0;
237}
238
216static void macvlan_change_rx_flags(struct net_device *dev, int change) 239static 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;