netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bonding/vlan: Avoid mangled NAs on slaves without VLAN tag insertion
@ 2011-02-07 19:20 Ben Hutchings
  2011-02-07 21:17 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Hutchings @ 2011-02-07 19:20 UTC (permalink / raw)
  To: stable; +Cc: Jay Vosburgh, David Miller, netdev, bonding-devel

This is related to commit f88a4a9b65a6f3422b81be995535d0e69df11bb8
upstream, but the bug cannot be properly fixed without the other
changes to VLAN tagging in 2.6.37.

bond_na_send() attempts to insert a VLAN tag in between building and
sending packets of the respective formats.  If the slave does not
implement hardware VLAN tag insertion then vlan_put_tag() will mangle
the network-layer header because the Ethernet header is not present at
this point (unlike in bond_arp_send()).

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
This fix is applicable to versions [2.6.29, 2.6.36].  The context for
the second hunk needs to be reduced to 1 line for versions < 2.6.33
(git am -C1) as the logging call was changed.

Ben.

 drivers/net/bonding/bond_ipv6.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/net/bonding/bond_ipv6.c b/drivers/net/bonding/bond_ipv6.c
index 121b073..78eb5fa 100644
--- a/drivers/net/bonding/bond_ipv6.c
+++ b/drivers/net/bonding/bond_ipv6.c
@@ -70,6 +70,13 @@ static void bond_na_send(struct net_device *slave_dev,
 	};
 	struct sk_buff *skb;
 
+	/* The Ethernet header is built in ndisc_send_skb(), not
+	 * ndisc_build_skb(), so we cannot insert a VLAN tag.  Only an
+	 * out-of-line tag inserted by the hardware will work.
+	 */
+	if (vlan_id && !(slave_dev->features & NETIF_F_HW_VLAN_TX))
+		return;
+
 	icmp6h.icmp6_router = router;
 	icmp6h.icmp6_solicited = 0;
 	icmp6h.icmp6_override = 1;
@@ -88,7 +95,7 @@ static void bond_na_send(struct net_device *slave_dev,
 	}
 
 	if (vlan_id) {
-		skb = vlan_put_tag(skb, vlan_id);
+		skb = __vlan_hwaccel_put_tag(skb, vlan_id);
 		if (!skb) {
 			pr_err("failed to insert VLAN tag\n");
 			return;
-- 
1.7.2.3


-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


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

* Re: [PATCH] bonding/vlan: Avoid mangled NAs on slaves without VLAN tag insertion
  2011-02-07 19:20 [PATCH] bonding/vlan: Avoid mangled NAs on slaves without VLAN tag insertion Ben Hutchings
@ 2011-02-07 21:17 ` David Miller
  2011-02-16 21:58   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2011-02-07 21:17 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, fubar, stable, bonding-devel

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Mon, 07 Feb 2011 19:20:55 +0000

> This is related to commit f88a4a9b65a6f3422b81be995535d0e69df11bb8
> upstream, but the bug cannot be properly fixed without the other
> changes to VLAN tagging in 2.6.37.
> 
> bond_na_send() attempts to insert a VLAN tag in between building and
> sending packets of the respective formats.  If the slave does not
> implement hardware VLAN tag insertion then vlan_put_tag() will mangle
> the network-layer header because the Ethernet header is not present at
> this point (unlike in bond_arp_send()).
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>

Acked-by: David S. Miller <davem@davemloft.net>

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

* Re: [PATCH] bonding/vlan: Avoid mangled NAs on slaves without VLAN tag insertion
  2011-02-07 21:17 ` David Miller
@ 2011-02-16 21:58   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2011-02-16 21:58 UTC (permalink / raw)
  To: David Miller; +Cc: bhutchings, netdev, fubar, stable, bonding-devel

On Mon, Feb 07, 2011 at 01:17:54PM -0800, David Miller wrote:
> From: Ben Hutchings <bhutchings@solarflare.com>
> Date: Mon, 07 Feb 2011 19:20:55 +0000
> 
> > This is related to commit f88a4a9b65a6f3422b81be995535d0e69df11bb8
> > upstream, but the bug cannot be properly fixed without the other
> > changes to VLAN tagging in 2.6.37.
> > 
> > bond_na_send() attempts to insert a VLAN tag in between building and
> > sending packets of the respective formats.  If the slave does not
> > implement hardware VLAN tag insertion then vlan_put_tag() will mangle
> > the network-layer header because the Ethernet header is not present at
> > this point (unlike in bond_arp_send()).
> > 
> > Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> 
> Acked-by: David S. Miller <davem@davemloft.net>

Great, thanks for the patch, now queued up for the next .32-stable
release.

greg k-h

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

end of thread, other threads:[~2011-02-16 21:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-07 19:20 [PATCH] bonding/vlan: Avoid mangled NAs on slaves without VLAN tag insertion Ben Hutchings
2011-02-07 21:17 ` David Miller
2011-02-16 21:58   ` Greg KH

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