netfilter: nft_meta: offload support for interface index
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 28 Oct 2019 15:02:50 +0000 (16:02 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 13 Nov 2019 09:41:34 +0000 (10:41 +0100)
This patch adds support for offloading the NFT_META_IIF selector.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_tables_offload.h
net/netfilter/nft_meta.c

index 03cf585..ea7d1d7 100644 (file)
@@ -45,6 +45,7 @@ struct nft_flow_key {
        struct flow_dissector_key_ip                    ip;
        struct flow_dissector_key_vlan                  vlan;
        struct flow_dissector_key_eth_addrs             eth_addrs;
+       struct flow_dissector_key_meta                  meta;
 } __aligned(BITS_PER_LONG / 8); /* Ensure that we can do comparisons as longs. */
 
 struct nft_flow_match {
index 317e3a9..8fd21f4 100644 (file)
@@ -547,6 +547,10 @@ static int nft_meta_get_offload(struct nft_offload_ctx *ctx,
                                  sizeof(__u8), reg);
                nft_offload_set_dependency(ctx, NFT_OFFLOAD_DEP_TRANSPORT);
                break;
+       case NFT_META_IIF:
+               NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_META, meta,
+                                 ingress_ifindex, sizeof(__u32), reg);
+               break;
        default:
                return -EOPNOTSUPP;
        }