aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2012-06-27 05:27:46 +0000
committerDavid S. Miller <davem@davemloft.net>2012-06-27 21:25:58 -0700
commitd4fc6918f4b3cc844185f59fc518351525950449 (patch)
treef317d3dd0328483053857a7de5e7b06f91db6f47 /drivers/net/virtio_net.c
parente9976d7c96423ac1991396aa82335206ded55bcf (diff)
downloadkernel_goldelico_gta04-d4fc6918f4b3cc844185f59fc518351525950449.zip
kernel_goldelico_gta04-d4fc6918f4b3cc844185f59fc518351525950449.tar.gz
kernel_goldelico_gta04-d4fc6918f4b3cc844185f59fc518351525950449.tar.bz2
virtio_net: allow to change mac when iface is running
Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index f18149a..36a16d5 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -679,11 +679,12 @@ static int virtnet_set_mac_address(struct net_device *dev, void *p)
{
struct virtnet_info *vi = netdev_priv(dev);
struct virtio_device *vdev = vi->vdev;
- int ret;
+ struct sockaddr *addr = p;
- ret = eth_mac_addr(dev, p);
- if (ret)
- return ret;
+ if (!is_valid_ether_addr(addr->sa_data))
+ return -EADDRNOTAVAIL;
+ memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+ dev->addr_assign_type &= ~NET_ADDR_RANDOM;
if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC))
vdev->config->set(vdev, offsetof(struct virtio_net_config, mac),