* [B.A.T.M.A.N.] [PATCH v2 00/10] Part 4: handle addr_assign_type for random addresses
@ 2012-02-17 15:43 Danny Kukawka
2012-02-17 15:43 ` [B.A.T.M.A.N.] [PATCH v2 06/10] batman-adv: use eth_hw_addr_random() instead of random_ether_addr() Danny Kukawka
0 siblings, 1 reply; 5+ messages in thread
From: Danny Kukawka @ 2012-02-17 15:43 UTC (permalink / raw)
To: David S. Miller
Cc: user-mode-linux-devel, Jiri Pirko, e1000-devel, Jiri Kosina,
b.a.t.m.a.n, Danny Kukawka, linux-kernel, Jeff Kirsher, netdev,
Richard Cochran
The fourth part of my patch series to fix the handling of
addr_assign_type for random MAC addresses.
This most of the patches in this series are for slightly
more complex cases to handle addr_assign_type and the
reset to NET_ADDR_PERM as soon as the MAC get changed via
.ndo_set_mac_address where eth_mac_addr wasn't used.
Danny Kukawka (10):
au1000_eth: use eth_hw_addr_random() instead of random_ether_addr()
lantiq_etop: set addr_assign_type if random_ether_addr() used
davinci_emac: use eth_hw_addr_random() instead of random_ether_addr()
xilinx ll_temac: use eth_hw_addr_random() instead of
random_ether_addr()
igbvf: reset netdevice addr_assign_type if changed
batman-adv: use eth_hw_addr_random() instead of random_ether_addr()
cisco/enic: use eth_hw_addr_random() instead of random_ether_addr()
ethoc: set addr_assign_type if random_ether_addr() used
atheros eth: set addr_assign_type if random_ether_addr() used
UML net: set addr_assign_type if random_ether_addr() used
arch/um/drivers/net_kern.c | 11 ++++++++---
drivers/net/ethernet/amd/au1000_eth.c | 9 +++++----
drivers/net/ethernet/atheros/atl1c/atl1c_hw.c | 2 +-
drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 9 ++++-----
drivers/net/ethernet/atheros/atlx/atl1.c | 12 +++++++++---
drivers/net/ethernet/atheros/atlx/atlx.c | 1 +
drivers/net/ethernet/cisco/enic/enic_main.c | 14 ++++++++++++--
drivers/net/ethernet/ethoc.c | 20 ++++++++++++++++++--
drivers/net/ethernet/intel/igbvf/netdev.c | 1 +
drivers/net/ethernet/lantiq_etop.c | 7 +++++++
drivers/net/ethernet/ti/davinci_emac.c | 5 +++--
drivers/net/ethernet/xilinx/ll_temac_main.c | 4 +++-
net/batman-adv/soft-interface.c | 5 ++---
13 files changed, 74 insertions(+), 26 deletions(-)
--
1.7.8.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [B.A.T.M.A.N.] [PATCH v2 06/10] batman-adv: use eth_hw_addr_random() instead of random_ether_addr()
2012-02-17 15:43 [B.A.T.M.A.N.] [PATCH v2 00/10] Part 4: handle addr_assign_type for random addresses Danny Kukawka
@ 2012-02-17 15:43 ` Danny Kukawka
2012-02-17 21:01 ` David Miller
2012-02-17 21:18 ` [B.A.T.M.A.N.] [PATCH] " Sven Eckelmann
0 siblings, 2 replies; 5+ messages in thread
From: Danny Kukawka @ 2012-02-17 15:43 UTC (permalink / raw)
To: Marek Lindner
Cc: netdev, b.a.t.m.a.n, Danny Kukawka, linux-kernel,
Simon Wunderlich, David S. Miller
Use eth_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Remove dev_addr in interface_setup(), it's not needed anymore.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
v2: use bitops, adapt to eth_hw_addr_random()
Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
---
net/batman-adv/soft-interface.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 987c75a..fd1d327 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -541,6 +541,7 @@ static int interface_set_mac_addr(struct net_device *dev, void *p)
}
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+ dev->addr_assign_type &= ~NET_ADDR_RANDOM;
return 0;
}
@@ -783,7 +784,6 @@ static const struct net_device_ops bat_netdev_ops = {
static void interface_setup(struct net_device *dev)
{
struct bat_priv *priv = netdev_priv(dev);
- char dev_addr[ETH_ALEN];
ether_setup(dev);
@@ -800,8 +800,7 @@ static void interface_setup(struct net_device *dev)
dev->hard_header_len = BAT_HEADER_LEN;
/* generate random address */
- random_ether_addr(dev_addr);
- memcpy(dev->dev_addr, dev_addr, ETH_ALEN);
+ eth_hw_addr_random(dev);
SET_ETHTOOL_OPS(dev, &bat_ethtool_ops);
--
1.7.8.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH v2 06/10] batman-adv: use eth_hw_addr_random() instead of random_ether_addr()
2012-02-17 15:43 ` [B.A.T.M.A.N.] [PATCH v2 06/10] batman-adv: use eth_hw_addr_random() instead of random_ether_addr() Danny Kukawka
@ 2012-02-17 21:01 ` David Miller
2012-02-17 21:18 ` [B.A.T.M.A.N.] [PATCH] " Sven Eckelmann
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2012-02-17 21:01 UTC (permalink / raw)
To: danny.kukawka
Cc: netdev, b.a.t.m.a.n, dkukawka, linux-kernel, siwu, lindner_marek
From: Danny Kukawka <danny.kukawka@bisect.de>
Date: Fri, 17 Feb 2012 16:43:27 +0100
> Use eth_hw_addr_random() instead of calling random_ether_addr()
> to set addr_assign_type correctly to NET_ADDR_RANDOM.
>
> Remove dev_addr in interface_setup(), it's not needed anymore.
>
> Reset the state to NET_ADDR_PERM as soon as the MAC get
> changed via .ndo_set_mac_address.
>
> v2: use bitops, adapt to eth_hw_addr_random()
>
> Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [B.A.T.M.A.N.] [PATCH] batman-adv: use eth_hw_addr_random() instead of random_ether_addr()
2012-02-17 15:43 ` [B.A.T.M.A.N.] [PATCH v2 06/10] batman-adv: use eth_hw_addr_random() instead of random_ether_addr() Danny Kukawka
2012-02-17 21:01 ` David Miller
@ 2012-02-17 21:18 ` Sven Eckelmann
2012-02-20 10:31 ` Marek Lindner
1 sibling, 1 reply; 5+ messages in thread
From: Sven Eckelmann @ 2012-02-17 21:18 UTC (permalink / raw)
To: b.a.t.m.a.n
From: Danny Kukawka <danny.kukawka@bisect.de>
Use eth_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Remove dev_addr in interface_setup(), it's not needed anymore.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
v2: use bitops, adapt to eth_hw_addr_random()
Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
[sven@narfation.org: Backported it to linux 2.6.29]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
Important: This patch was already applied by David S. Miller in net-next.git
and will be part of linux 3.3. So we have to apply this one in next. This patch
should also never be sent to David (he already has it).
The merge of next into master will be a little bit messy. Just delete the
definition of dev_hw_addr_random in compat.h and use eth_hw_addr_random in
soft-interface.c
compat.h | 14 ++++++++++++++
soft-interface.c | 5 ++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/compat.h b/compat.h
index 7f86b41..95b8706 100644
--- a/compat.h
+++ b/compat.h
@@ -104,6 +104,10 @@ static inline int __param_set_copystring(const char *val,
}
#define param_set_copystring __param_set_copystring
+/* hack for dev->addr_assign_type &= ~NET_ADDR_RANDOM; */
+#define addr_assign_type ifindex
+#define NET_ADDR_RANDOM 0
+
#endif /* < KERNEL_VERSION(2, 6, 36) */
@@ -126,4 +130,14 @@ void free_rcu_tt_local_entry(struct rcu_head *rcu);
#endif /* < KERNEL_VERSION(3, 0, 0) */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
+
+static inline void eth_hw_addr_random(struct net_device *dev)
+{
+ random_ether_addr(dev->dev_addr);
+}
+
+#endif /* < KERNEL_VERSION(3, 0, 0) */
+
#endif /* _NET_BATMAN_ADV_COMPAT_H_ */
diff --git a/soft-interface.c b/soft-interface.c
index 2ffdc74..37fbcb5 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -541,6 +541,7 @@ static int interface_set_mac_addr(struct net_device *dev, void *p)
}
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+ dev->addr_assign_type &= ~NET_ADDR_RANDOM;
return 0;
}
@@ -783,7 +784,6 @@ static const struct net_device_ops bat_netdev_ops = {
static void interface_setup(struct net_device *dev)
{
struct bat_priv *priv = netdev_priv(dev);
- char dev_addr[ETH_ALEN];
ether_setup(dev);
@@ -800,8 +800,7 @@ static void interface_setup(struct net_device *dev)
dev->hard_header_len = BAT_HEADER_LEN;
/* generate random address */
- random_ether_addr(dev_addr);
- memcpy(dev->dev_addr, dev_addr, ETH_ALEN);
+ eth_hw_addr_random(dev);
SET_ETHTOOL_OPS(dev, &bat_ethtool_ops);
--
1.7.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: use eth_hw_addr_random() instead of random_ether_addr()
2012-02-17 21:18 ` [B.A.T.M.A.N.] [PATCH] " Sven Eckelmann
@ 2012-02-20 10:31 ` Marek Lindner
0 siblings, 0 replies; 5+ messages in thread
From: Marek Lindner @ 2012-02-20 10:31 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Saturday, February 18, 2012 05:18:46 Sven Eckelmann wrote:
> From: Danny Kukawka <danny.kukawka@bisect.de>
>
> Use eth_hw_addr_random() instead of calling random_ether_addr()
> to set addr_assign_type correctly to NET_ADDR_RANDOM.
>
> Remove dev_addr in interface_setup(), it's not needed anymore.
>
> Reset the state to NET_ADDR_PERM as soon as the MAC get
> changed via .ndo_set_mac_address.
Applied in revision 2e52993.
Thanks,
Marek
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-02-20 10:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-17 15:43 [B.A.T.M.A.N.] [PATCH v2 00/10] Part 4: handle addr_assign_type for random addresses Danny Kukawka
2012-02-17 15:43 ` [B.A.T.M.A.N.] [PATCH v2 06/10] batman-adv: use eth_hw_addr_random() instead of random_ether_addr() Danny Kukawka
2012-02-17 21:01 ` David Miller
2012-02-17 21:18 ` [B.A.T.M.A.N.] [PATCH] " Sven Eckelmann
2012-02-20 10:31 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox