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: <20190530223832.kwoh4yvbbftl4vwc@sesse.net>
Date:   Fri, 31 May 2019 00:38:32 +0200
From:   "Steinar H. Gunderson" <steinar+kernel@...derson.no>
To:     Alexey Kuznetsov <kuznet@....inr.ac.ru>
Cc:     netdev@...r.kernel.org
Subject: Re: EoGRE sends undersized frames without padding

On Thu, May 30, 2019 at 10:35:08AM +0200, Steinar H. Gunderson wrote:
> After looking at the GRE packets in Wireshark, it turns out the Ethernet
> packets within the EoGRE packet is undersized (under 60 bytes), and Linux
> doesn't pad them. I haven't found anything in RFC 7637 that says anything
> about padding, so I would assume it should conform to the usual Ethernet
> padding rules, ie., pad to at least ETH_ZLEN. However, nothing in Linux' IP
> stack seems to actually do this, which means that when the packet is
> decapsulated in the other end and put on the (potentially virtual) wire,
> it gets dropped. The other system properly pads its small frames when sending
> them.

As a proof of concept (no error handling, probably poor performance, not
implemented for IPv6, other issues?), this patch works and fixes my problem:

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 4b0526441476..00be99d23e5c 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -441,6 +441,11 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev,
 	if (tunnel->parms.o_flags & TUNNEL_SEQ)
 		tunnel->o_seqno++;
 
+	if (proto == htons(ETH_P_TEB) && skb->len < ETH_ZLEN) {
+		skb_cow(skb, dev->needed_headroom + ETH_ZLEN - skb->len);
+		skb_put_zero(skb, ETH_ZLEN - skb->len);
+	}
+
 	/* Push GRE header. */
 	gre_build_header(skb, tunnel->tun_hlen,
 			 tunnel->parms.o_flags, proto, tunnel->parms.o_key,

If I apply the patch on the side with the gretap tunnel, the ARP packets are
properly padded, and seen by the host in the other end.

/* Steinar */
-- 
Homepage: https://www.sesse.net/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ