lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101021221015.22906.3516.stgit@jf-dev1-dcblab>
Date:	Thu, 21 Oct 2010 15:10:15 -0700
From:	John Fastabend <john.r.fastabend@...el.com>
To:	netdev@...r.kernel.org
Cc:	jesse@...ira.com
Subject: [RFC][net-next-2.6 PATCH 3/4] ethtool: set hard_header_len using
	ETH_FLAG_{TX|RX}VLAN

Toggling the vlan tx|rx hw offloads needs to set the hard_header_len
as well otherwise we end up using LL_RESERVED_SPACE incorrectly.
This results in pskb_expand_head() being used unnecessarily.

This add a check in ethtool_op_set_flags to catch the ETH_FLAG_TXVLAN
flag and set the header length.

Signed-off-by: John Fastabend <john.r.fastabend@...el.com>
---

 net/core/ethtool.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 956a9f4..4f7fe26 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -21,6 +21,7 @@
 #include <linux/uaccess.h>
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
+#include <linux/if_vlan.h>
 
 /*
  * Some useful ethtool_ops methods that're device independent.
@@ -151,6 +152,14 @@ int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported)
 	if (data & ~supported)
 		return -EINVAL;
 
+	/* is ETH_FLAGS_TXVLAN being toggled */
+	if ((dev->features & ETH_FLAG_TXVLAN) ^ (data & ETH_FLAG_TXVLAN)) {
+		if (data & ETH_FLAG_TXVLAN)
+			dev->hard_header_len -= VLAN_HLEN;
+		else
+			dev->hard_header_len += VLAN_HLEN;
+	}
+
 	dev->features = ((dev->features & ~flags_dup_features) |
 			 (data & flags_dup_features));
 	return 0;

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ