mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
netfilter: nft_meta_bridge: Add NFT_META_BRI_IIFVPROTO support
This patch allows you to match on bridge vlan protocol, eg. nft add rule bridge firewall zones counter meta ibrvproto 0x8100 Signed-off-by: wenxu <wenxu@ucloud.cn> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
31aed46fed
commit
2a3a93ef0b
@ -796,6 +796,7 @@ enum nft_exthdr_attributes {
|
|||||||
* @NFT_META_IIFKIND: packet input interface kind name (dev->rtnl_link_ops->kind)
|
* @NFT_META_IIFKIND: packet input interface kind name (dev->rtnl_link_ops->kind)
|
||||||
* @NFT_META_OIFKIND: packet output interface kind name (dev->rtnl_link_ops->kind)
|
* @NFT_META_OIFKIND: packet output interface kind name (dev->rtnl_link_ops->kind)
|
||||||
* @NFT_META_BRI_IIFPVID: packet input bridge port pvid
|
* @NFT_META_BRI_IIFPVID: packet input bridge port pvid
|
||||||
|
* @NFT_META_BRI_IIFVPROTO: packet input bridge vlan proto
|
||||||
*/
|
*/
|
||||||
enum nft_meta_keys {
|
enum nft_meta_keys {
|
||||||
NFT_META_LEN,
|
NFT_META_LEN,
|
||||||
@ -827,6 +828,7 @@ enum nft_meta_keys {
|
|||||||
NFT_META_IIFKIND,
|
NFT_META_IIFKIND,
|
||||||
NFT_META_OIFKIND,
|
NFT_META_OIFKIND,
|
||||||
NFT_META_BRI_IIFPVID,
|
NFT_META_BRI_IIFPVID,
|
||||||
|
NFT_META_BRI_IIFVPROTO,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,6 +49,17 @@ static void nft_meta_bridge_get_eval(const struct nft_expr *expr,
|
|||||||
nft_reg_store16(dest, p_pvid);
|
nft_reg_store16(dest, p_pvid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
case NFT_META_BRI_IIFVPROTO: {
|
||||||
|
u16 p_proto;
|
||||||
|
|
||||||
|
br_dev = nft_meta_get_bridge(in);
|
||||||
|
if (!br_dev || !br_vlan_enabled(br_dev))
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
br_vlan_get_proto(br_dev, &p_proto);
|
||||||
|
nft_reg_store16(dest, p_proto);
|
||||||
|
return;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -75,6 +86,7 @@ static int nft_meta_bridge_get_init(const struct nft_ctx *ctx,
|
|||||||
len = IFNAMSIZ;
|
len = IFNAMSIZ;
|
||||||
break;
|
break;
|
||||||
case NFT_META_BRI_IIFPVID:
|
case NFT_META_BRI_IIFPVID:
|
||||||
|
case NFT_META_BRI_IIFVPROTO:
|
||||||
len = sizeof(u16);
|
len = sizeof(u16);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user