linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net/net-next] bonding:Don't received packets if bonding is not up
@ 2014-08-04  3:15 lichunhe
  2014-08-04  6:13 ` Veaceslav Falico
  0 siblings, 1 reply; 2+ messages in thread
From: lichunhe @ 2014-08-04  3:15 UTC (permalink / raw)
  To: j.vosburgh, vfalico, andy, linux-kernel
  Cc: dingtianhong, qianhuibin, Chunhe Li

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net/net-next] bonding:Don't received packets if bonding is not up
  2014-08-04  3:15 [PATCH net/net-next] bonding:Don't received packets if bonding is not up lichunhe
@ 2014-08-04  6:13 ` Veaceslav Falico
  0 siblings, 0 replies; 2+ messages in thread
From: Veaceslav Falico @ 2014-08-04  6:13 UTC (permalink / raw)
  To: lichunhe; +Cc: j.vosburgh, andy, linux-kernel, dingtianhong, qianhuibin

On Mon, Aug 04, 2014 at 11:15:13AM +0800, lichunhe@huawei.com wrote:
>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.

This breaks arp monitoring and 802.3ad modes, as they won't ever come up.

Also, please cc netdev next times.

>
>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
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-04  6:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-04  3:15 [PATCH net/net-next] bonding:Don't received packets if bonding is not up lichunhe
2014-08-04  6:13 ` Veaceslav Falico

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).