[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4131504.bFpDbrJZp3@sven-laptop.home.narfation.org>
Date: Thu, 09 Feb 2012 09:44:12 +0100
From: Sven Eckelmann <sven@...fation.org>
To: b.a.t.m.a.n@...ts.open-mesh.org
Cc: Danny Kukawka <danny.kukawka@...ect.de>,
Marek Lindner <lindner_marek@...oo.de>, netdev@...r.kernel.org,
Danny Kukawka <dkukawka@...e.de>, linux-kernel@...r.kernel.org,
Simon Wunderlich <siwu@....tu-chemnitz.de>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [B.A.T.M.A.N.] [PATCH 40/50] batman-adv: use dev_hw_addr_random() instead of random_ether_addr()
On Wednesday 08 February 2012 22:10:47 Danny Kukawka wrote:
> 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@...ect.de>
> ---
> net/batman-adv/soft-interface.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/net/batman-adv/soft-interface.c
> b/net/batman-adv/soft-interface.c index 987c75a..865a485 100644
> --- a/net/batman-adv/soft-interface.c
> +++ b/net/batman-adv/soft-interface.c
> @@ -541,6 +541,9 @@ static int interface_set_mac_addr(struct net_device
> *dev, void *p) }
>
> memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
> + if (dev->addr_assign_type & NET_ADDR_RANDOM)
> + dev->addr_assign_type ^= NET_ADDR_RANDOM;
> +
> return 0;
> }
Why not something like
dev->addr_assign_type &= ~NET_ADDR_RANDOM;
? It is a relative common way inside the kernel to do this kind of stuff.
Thanks,
Sven
PS: For the batman-adv people. This functionality was introduced with 2.6.36.
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists