From: Vladislav Yasevich <vyasevich@gmail.com>
To: netdev@vger.kernel.org
Cc: Vladislav Yasevich <vyasevic@redhat.com>
Subject: [PATCH net 1/4] macvlan: Do not return error when setting the same mac address
Date: Fri, 16 Jun 2017 09:36:46 -0400 [thread overview]
Message-ID: <20170616133649.24622-2-vyasevic@redhat.com> (raw)
In-Reply-To: <20170616133649.24622-1-vyasevic@redhat.com>
The user currently gets an EBUSY error when attempting to set
the mac address on a macvlan device to the same value.
This should really be a no-op as nothing changes. Catch
the condition and return early.
Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
---
drivers/net/macvlan.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 67bf7eb..de214fb 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -703,6 +703,10 @@ static int macvlan_set_mac_address(struct net_device *dev, void *p)
if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
+ /* If the addresses are the same, this is a no-op */
+ if (ether_addr_equal(dev->dev_addr, addr->sa_data))
+ return 0;
+
if (vlan->mode == MACVLAN_MODE_PASSTHRU) {
dev_set_mac_address(vlan->lowerdev, addr);
return 0;
--
2.9.4
next prev parent reply other threads:[~2017-06-16 13:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-16 13:36 [PATCH net 0/4] macvlan: Fix some issues with changing mac addresses Vladislav Yasevich
2017-06-16 13:36 ` Vladislav Yasevich [this message]
2017-06-16 13:36 ` [PATCH net 2/4] macvlan: Fix passthru macvlan mac address inheritance Vladislav Yasevich
2017-06-16 13:36 ` [PATCH net 3/4] macvlan: convert port passthru to flags Vladislav Yasevich
2017-06-16 13:36 ` [PATCH net 4/4] macvlan: Let passthru macvlan correctly restore lower mac address Vladislav Yasevich
2017-06-17 4:35 ` Girish Moodalbail
2017-06-17 15:21 ` Vlad Yasevich
2017-06-17 5:23 ` [PATCH net 0/4] macvlan: Fix some issues with changing mac addresses Girish Moodalbail
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=20170616133649.24622-2-vyasevic@redhat.com \
--to=vyasevich@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=vyasevic@redhat.com \
/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).