netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: nikolay@redhat.com
To: netdev@vger.kernel.org
Cc: andy@greyhouse.net, fubar@us.ibm.com, davem@davemloft.net
Subject: [PATCH 1/2] bonding: reset master mac on first enslave failure
Date: Thu,  6 Jun 2013 13:55:01 +0200	[thread overview]
Message-ID: <1370519702-18581-2-git-send-email-nikolay@redhat.com> (raw)
In-Reply-To: <1370519702-18581-1-git-send-email-nikolay@redhat.com>

From: Nikolay Aleksandrov <nikolay@redhat.com>

If the bond device is supposed to get the first slave's MAC address and
the first enslavement fails then we need to reset the master's MAC
otherwise it will stay the same as the failed slave device. We do it
after err_undo_flags since that is the first place where the MAC can be
changed and we check if it should've been the first slave and if the
bond's MAC was set to it because that err place is used by multiple
locations prior to changing the master's MAC address.

Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
---
 drivers/net/bonding/bond_main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 29b846c..473633a 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1957,6 +1957,10 @@ err_free:
 
 err_undo_flags:
 	bond_compute_features(bond);
+	/* Enslave of first slave has failed and we need to fix master's mac */
+	if (bond->slave_cnt == 0 &&
+	    ether_addr_equal(bond_dev->dev_addr, slave_dev->dev_addr))
+		eth_hw_addr_random(bond_dev);
 
 	return res;
 }
-- 
1.8.1.4

  reply	other threads:[~2013-06-06 11:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-06 11:55 [PATCH 0/2] bonding: couple of bug fixes nikolay
2013-06-06 11:55 ` nikolay [this message]
2013-06-06 11:55 ` [PATCH 2/2] bonding: fix igmp_retrans type and two related races nikolay
2013-06-07  1:00   ` Jay Vosburgh
2013-06-07  9:37     ` Nikolay Aleksandrov
2013-06-11  9:45 ` [PATCH 0/2] bonding: couple of bug fixes David Miller
2013-06-11 16:42   ` Jay Vosburgh
2013-06-11 16:50     ` Nikolay Aleksandrov

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=1370519702-18581-2-git-send-email-nikolay@redhat.com \
    --to=nikolay@redhat.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.com \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).