From: 邢庆杰 <xqjcool@gmail.com>
To: stephen@networkplumber.org, davem@davemloft.net
Cc: netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 3.2 01/06] "bridge should send gratuitous ARP to notify peer while a bond, which is a port of this bridge, changes."
Date: Sat, 6 Jan 2018 17:25:20 +0800 [thread overview]
Message-ID: <CAOtoAkc_prks5PcRtwqh2Agp0TTT2jY4jpQzOoi_CgiSPjST-w@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1626 bytes --]
We create bond0 and add eth0ð1 as slaves. Eth0 is active. Then we add
bond0
into br0 as a bridge port. Br0 has ip address. When eth0 is down, after
bond0's
failover eth1 become active. At this moment, we need br0 send a gratuitous
ARP
to notify peer to update ARP table.
Signed-off-by: Xing.Qingjie <xqjcool@gmail.com>
---
net/bridge/br_notify.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index a76b621..90cf123 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -34,6 +34,7 @@ static int br_device_event(struct notifier_block *unused,
unsigned long event, v
struct net_device *dev = ptr;
struct net_bridge_port *p;
struct net_bridge *br;
+ struct in_device *in_dev;
bool changed_addr;
int err;
@@ -102,6 +103,17 @@ static int br_device_event(struct notifier_block
*unused, unsigned long event, v
case NETDEV_PRE_TYPE_CHANGE:
/* Forbid underlaying device to change its type. */
return NOTIFY_BAD;
+
+ case NETDEV_NOTIFY_PEERS:
+ /* Send gratuitous arp while bond,a port of bridge, changes
*/
+ if (dev->priv_flags & IFF_BONDING && dev->flags &
IFF_MASTER) {
+ in_dev = __in_dev_get_rtnl(br->dev);
+
+ ASSERT_RTNL();
+ if (in_dev)
+ inetdev_send_gratuitous_arp(br->dev,
in_dev);
+ }
+ break;
}
/* Events that may cause spanning tree to refresh */
--
1.7.1
[-- Attachment #1.2: Type: text/html, Size: 2151 bytes --]
[-- Attachment #2: 0001-bridge-should-send-gratuitous-ARP-to-notify-peer-whi.patch --]
[-- Type: application/octet-stream, Size: 1678 bytes --]
From 3040990542ca5e4276f9d9215d4556c9e22cc581 Mon Sep 17 00:00:00 2001
From: Xing.Qingjie <xqjcool@gmail.com>
Date: Wed, 6 Sep 2017 04:03:25 +0800
Subject: [PATCH] bridge should send gratuitous ARP to notify peer while a bond, which
is a port of this bridge, changes.
We create bond0 and add eth0ð1 as slaves. Eth0 is active. Then we add bond0
into br0 as a bridge port. Br0 has ip address. When eth0 is down, after bond0's
failover eth1 become active. At this moment, we need br0 send a gratuitous ARP
to notify peer to update ARP table.
Signed-off-by: Xing.Qingjie <xqjcool@gmail.com>
---
net/bridge/br_notify.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index a76b621..90cf123 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -34,6 +34,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
struct net_device *dev = ptr;
struct net_bridge_port *p;
struct net_bridge *br;
+ struct in_device *in_dev;
bool changed_addr;
int err;
@@ -102,6 +103,17 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
case NETDEV_PRE_TYPE_CHANGE:
/* Forbid underlaying device to change its type. */
return NOTIFY_BAD;
+
+ case NETDEV_NOTIFY_PEERS:
+ /* Send gratuitous arp while bond,a port of bridge, changes */
+ if (dev->priv_flags & IFF_BONDING && dev->flags & IFF_MASTER) {
+ in_dev = __in_dev_get_rtnl(br->dev);
+
+ ASSERT_RTNL();
+ if (in_dev)
+ inetdev_send_gratuitous_arp(br->dev, in_dev);
+ }
+ break;
}
/* Events that may cause spanning tree to refresh */
--
1.7.1
next reply other threads:[~2018-01-06 9:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-06 9:25 邢庆杰 [this message]
2018-01-06 14:33 ` [PATCH 3.2 01/06] "bridge should send gratuitous ARP to notify peer while a bond, which is a port of this bridge, changes." Stephen Hemminger
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=CAOtoAkc_prks5PcRtwqh2Agp0TTT2jY4jpQzOoi_CgiSPjST-w@mail.gmail.com \
--to=xqjcool@gmail.com \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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).