From: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
To: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
xen-devel@lists.xenproject.org, mcgrof@suse.com,
Stephen Hemminger <stephen@networkplumber.org>,
bridge@lists.linux-foundation.org
Subject: Re: [PATCH 1/3] bridge: preserve random init MAC address
Date: Wed, 19 Mar 2014 09:42:42 +0900 [thread overview]
Message-ID: <5328E802.3030901@lab.ntt.co.jp> (raw)
In-Reply-To: <1394680527-28970-2-git-send-email-mcgrof@do-not-panic.com>
(2014/03/13 12:15), Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
>
> As it is now if you add create a bridge it gets started
> with a random MAC address and if you then add a net_device
> as a slave but later kick it out you end up with a zero
> MAC address. Instead preserve the original random MAC
> address and use it.
>
> If you manually set the bridge address that will always
> be respected. This change only takes effect if at the time
> of computing the new root port we determine we have found
> no candidates.
>
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Cc: bridge@lists.linux-foundation.org
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: xen-devel@lists.xenproject.org
> Cc: kvm@vger.kernel.org
> Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> ---
> net/bridge/br_device.c | 1 +
> net/bridge/br_private.h | 1 +
> net/bridge/br_stp_if.c | 3 +++
> 3 files changed, 5 insertions(+)
>
> diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
> index b063050..5f13eac 100644
> --- a/net/bridge/br_device.c
> +++ b/net/bridge/br_device.c
> @@ -368,6 +368,7 @@ void br_dev_setup(struct net_device *dev)
> br->bridge_id.prio[1] = 0x00;
>
> ether_addr_copy(br->group_addr, eth_reserved_addr_base);
> + ether_addr_copy(br->random_init_addr, dev->dev_addr);
>
> br->stp_enabled = BR_NO_STP;
> br->group_fwd_mask = BR_GROUPFWD_DEFAULT;
> diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
> index e1ca1dc..32a06da 100644
> --- a/net/bridge/br_private.h
> +++ b/net/bridge/br_private.h
> @@ -240,6 +240,7 @@ struct net_bridge
> unsigned long bridge_hello_time;
> unsigned long bridge_forward_delay;
>
> + u8 random_init_addr[ETH_ALEN];
> u8 group_addr[ETH_ALEN];
> u16 root_port;
>
> diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
> index 189ba1e..4c9ad45 100644
> --- a/net/bridge/br_stp_if.c
> +++ b/net/bridge/br_stp_if.c
> @@ -239,6 +239,9 @@ bool br_stp_recalculate_bridge_id(struct net_bridge *br)
> if (ether_addr_equal(br->bridge_id.addr, addr))
> return false; /* no change */
>
> + if (ether_addr_equal(addr, br_mac_zero))
> + addr = br->random_init_addr;
> +
> br_stp_change_bridge_id(br, addr);
> return true;
> }
nit,
If the last detached port happens to have the same addr as
random_init_addr, this seems to call br_stp_change_bridge_id() even
though bridge_id is not changed.
Shouldn't the assignment of random_init_addr be done before the check of
"no change"?
Toshiaki Makita
next prev parent reply other threads:[~2014-03-19 0:43 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-13 3:15 [PATCH 0/3] bridge: few enhancements and small fixes Luis R. Rodriguez
2014-03-13 3:15 ` [PATCH 1/3] bridge: preserve random init MAC address Luis R. Rodriguez
2014-03-19 0:42 ` Toshiaki Makita [this message]
2014-03-19 0:50 ` Luis R. Rodriguez
2014-03-19 1:04 ` Toshiaki Makita
2014-03-19 1:10 ` Luis R. Rodriguez
2014-03-19 16:09 ` [Bridge] " Toshiaki Makita
2014-03-19 3:10 ` Stephen Hemminger
2014-03-19 3:37 ` Luis R. Rodriguez
2014-03-20 2:05 ` Luis R. Rodriguez
2014-04-22 19:41 ` Luis R. Rodriguez
2014-04-30 18:40 ` Luis R. Rodriguez
2014-04-30 19:11 ` Vlad Yasevich
2014-03-13 3:15 ` [PATCH 2/3] bridge: trigger a bridge calculation upon port changes Luis R. Rodriguez
2014-03-13 18:26 ` Cong Wang
2014-03-15 1:39 ` Luis R. Rodriguez
2014-03-18 20:46 ` Cong Wang
2014-03-18 21:22 ` Luis R. Rodriguez
2014-04-22 19:43 ` Luis R. Rodriguez
2014-04-30 18:38 ` Luis R. Rodriguez
2014-04-30 20:04 ` Vlad Yasevich
2014-04-30 22:59 ` Luis R. Rodriguez
2014-05-01 0:12 ` Vlad Yasevich
2014-03-13 3:15 ` [PATCH 3/3] bridge: fix bridge root block on designated port Luis R. Rodriguez
2014-03-13 22:16 ` Stephen Hemminger
2014-03-15 2:08 ` Luis R. Rodriguez
2014-03-18 20:31 ` [PATCH 0/3] bridge: few enhancements and small fixes Luis R. Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5328E802.3030901@lab.ntt.co.jp \
--to=makita.toshiaki@lab.ntt.co.jp \
--cc=bridge@lists.linux-foundation.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@do-not-panic.com \
--cc=mcgrof@suse.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox