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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Dec 2017 08:13:11 -0800
From:   Ed Swierk <eswierk@...portsystems.com>
To:     netdev@...r.kernel.org
Cc:     Ed Swierk <eswierk@...portsystems.com>,
        Benjamin Warren <ben@...portsystems.com>,
        Keith Holleman <holleman@...portsystems.com>
Subject: [PATCH] veth: Optionally pad packets to minimum Ethernet length

Most physical Ethernet devices pad short packets to the minimum length
of 64 bytes (including FCS) on transmit. It can be useful to simulate
this behavior when debugging a problem that results from it (such as
incorrect L4 checksum calculation).

Padding is unnecessary for most applications so leave it off by
default. Enable padding only when the otherwise unused IFF_AUTOMEDIA
flag is set (e.g. by writing 0x5003 to flags in sysfs).

Signed-off-by: Ed Swierk <eswierk@...portsystems.com>
---
 drivers/net/veth.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index f5438d0978ca..292029bf4bb2 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -111,6 +111,12 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
 		goto drop;
 	}
 
+	if (unlikely(dev->flags & IFF_AUTOMEDIA)) {
+		/* if eth_skb_pad returns an error the skb was freed */
+		if (eth_skb_pad(skb))
+			goto drop;
+	}
+
 	if (likely(dev_forward_skb(rcv, skb) == NET_RX_SUCCESS)) {
 		struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats);
 
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ