lkml.org 
[lkml]   [2012]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 49/50] openvswitch: use dev_hw_addr_random() instead of random_ether_addr()
Date
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.

Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.

Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
---
net/openvswitch/vport-internal_dev.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 322b8d2..c71baf0 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -67,6 +67,8 @@ static int internal_dev_mac_addr(struct net_device *dev, void *p)
if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+ if (dev->addr_assign_type & NET_ADDR_RANDOM)
+ dev->addr_assign_type ^= NET_ADDR_RANDOM;
return 0;
}

@@ -145,7 +147,7 @@ static void do_setup(struct net_device *netdev)
netdev->vlan_features = netdev->features;
netdev->features |= NETIF_F_HW_VLAN_TX;
netdev->hw_features = netdev->features & ~NETIF_F_LLTX;
- random_ether_addr(netdev->dev_addr);
+ dev_hw_addr_random(netdev, netdev->dev_addr);
}

static struct vport *internal_dev_create(const struct vport_parms *parms)
--
1.7.7.3


\
 
 \ /
  Last update: 2012-02-08 22:19    [W:2.749 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site