From 7d08263a13946b66007de825dac9dc7023867ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Thu, 24 Jan 2019 03:07:02 -0800 Subject: [PATCH] BACKPORT: net: dev_is_mac_header_xmit() true for ARPHRD_RAWIP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit __bpf_redirect() and act_mirred checks this boolean to determine whether to prefix an ethernet header. Signed-off-by: Maciej Żenczykowski Acked-by: Daniel Borkmann Signed-off-by: David S. Miller Note: this is commit 3b707c3008cad04604c1f50e39f456621821c414 upstream, but it does not trivially cherrypick to 4.9, because the function does not yet exist, and because ARPHRD_RAWIP is not yet defined. However, ARPHRD_RAWIP does exist in many device kernels, so by hiding it in #ifdef/#endif clause, we fix any device kernels which merge common. Bug: 65674744 Change-Id: I79a14d064738805f4c82612b020406cd75eb872c --- net/core/filter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index c385c55af653..768688bfc7df 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -1711,6 +1711,9 @@ static int __bpf_redirect(struct sk_buff *skb, struct net_device *dev, case ARPHRD_IPGRE: case ARPHRD_VOID: case ARPHRD_NONE: +#ifdef ARPHRD_RAWIP + case ARPHRD_RAWIP: +#endif return __bpf_redirect_no_mac(skb, dev, flags); default: return __bpf_redirect_common(skb, dev, flags);