From: <lichunhe@huawei.com>
To: <j.vosburgh@gmail.com>, <vfalico@gmail.com>, <andy@greyhouse.net>,
<linux-kernel@vger.kernel.org>
Cc: <dingtianhong@huawei.com>, <qianhuibin@huawei.com>,
Chunhe Li <lichunhe@huawei.com>
Subject: [PATCH net/net-next] bonding:Don't received packets if bonding is not up
Date: Mon, 4 Aug 2014 11:15:13 +0800 [thread overview]
Message-ID: <1407122113-3184-1-git-send-email-lichunhe@huawei.com> (raw)
From: Chunhe Li <lichunhe@huawei.com>
If the bonding device is down, it should not receive packets
to network stack or other upper flow stack.
Signed-off-by: Chunhe Li <lichunhe@huawei.com>
---
drivers/net/bonding/bond_main.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 701f86c..48a127b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1110,6 +1110,12 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
int (*recv_probe)(const struct sk_buff *, struct bonding *,
struct slave *);
int ret = RX_HANDLER_ANOTHER;
+
+ slave = bond_slave_get_rcu(skb->dev);
+ bond = slave->bond;
+
+ if (unlikely(!(bond->dev->flags & IFF_UP)))
+ return RX_HANDLER_PASS;
skb = skb_share_check(skb, GFP_ATOMIC);
if (unlikely(!skb))
@@ -1117,9 +1123,6 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
*pskb = skb;
- slave = bond_slave_get_rcu(skb->dev);
- bond = slave->bond;
-
recv_probe = ACCESS_ONCE(bond->recv_probe);
if (recv_probe) {
ret = recv_probe(skb, bond, slave);
--
1.9.2.0
next reply other threads:[~2014-08-04 3:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-04 3:15 lichunhe [this message]
2014-08-04 6:13 ` Veaceslav Falico
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=1407122113-3184-1-git-send-email-lichunhe@huawei.com \
--to=lichunhe@huawei.com \
--cc=andy@greyhouse.net \
--cc=dingtianhong@huawei.com \
--cc=j.vosburgh@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=qianhuibin@huawei.com \
--cc=vfalico@gmail.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
all inboxes | Powered by JetHome®