netfilter: nf_tables: add nfproto support to meta expression
[firefly-linux-kernel-4.4.55.git] / net / netfilter / nft_meta.c
index 1ceaaa6dfe722406d9cac8a73a3a46566e11a8ea..999d04688433540541e22b6706c2ce39effb1a1c 100644 (file)
@@ -43,6 +43,9 @@ static void nft_meta_get_eval(const struct nft_expr *expr,
        case NFT_META_PROTOCOL:
                *(__be16 *)dest->data = skb->protocol;
                break;
+       case NFT_META_NFPROTO:
+               dest->data[0] = pkt->ops->pf;
+               break;
        case NFT_META_PRIORITY:
                dest->data[0] = skb->priority;
                break;
@@ -181,6 +184,7 @@ static int nft_meta_init_validate_get(uint32_t key)
        switch (key) {
        case NFT_META_LEN:
        case NFT_META_PROTOCOL:
+       case NFT_META_NFPROTO:
        case NFT_META_PRIORITY:
        case NFT_META_MARK:
        case NFT_META_IIF: