aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/net
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2022-10-17 13:03:35 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2022-10-25 13:48:42 +0200
commit91619eb60aeccd3181d9b88975add706a9b763c1 (patch)
tree558d95ce5e656ddb6233ab5c189d8e354bdeb843 /net
parentnetfilter: nft_inner: add geneve support (diff)
downloadwireguard-linux-91619eb60aeccd3181d9b88975add706a9b763c1.tar.xz
wireguard-linux-91619eb60aeccd3181d9b88975add706a9b763c1.zip
netfilter: nft_inner: set tunnel offset to GRE header offset
Set inner tunnel offset to the GRE header, this is redundant to existing transport header offset, but this normalizes the handling of the tunnel header regardless its location in the layering. GRE version 0 is overloaded with RFCs, the type decorator in the inner expression might also be useful to interpret matching fields from the netlink delinearize path in userspace. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nft_inner.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/netfilter/nft_inner.c b/net/netfilter/nft_inner.c
index 19fdc8c70cd1..eae7caeff316 100644
--- a/net/netfilter/nft_inner.c
+++ b/net/netfilter/nft_inner.c
@@ -174,8 +174,13 @@ static int nft_inner_parse_tunhdr(const struct nft_inner *priv,
const struct nft_pktinfo *pkt,
struct nft_inner_tun_ctx *ctx, u32 *off)
{
- if (pkt->tprot != IPPROTO_UDP ||
- pkt->tprot != IPPROTO_GRE)
+ if (pkt->tprot == IPPROTO_GRE) {
+ ctx->inner_tunoff = pkt->thoff;
+ ctx->flags |= NFT_PAYLOAD_CTX_INNER_TUN;
+ return 0;
+ }
+
+ if (pkt->tprot != IPPROTO_UDP)
return -1;
ctx->inner_tunoff = *off;