src: Add support for pkttype in meta expresion
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 src: Add support for pkttype in meta expresion
If It wants to declare a pktype attribute, It has used a syntax like this:
nft add rule ip filter input meta pkttype broadcast
Joint work with Alvaro Neira Ayuso <[email protected]>
Signed-off-by Alvaro Neira Ayuso <[email protected]>
Signed-off-by Ana Rey <[email protected]>
---
[Changes in v2:]
* Fix the description of @TYPE_PKTTYPE datatype and @NFT_META_PKTTYPE attribute.
* Delete "loopback" symbol of pkttype_type_tbl table of symbol.
* Add SYMBOL_LIST_END in pkttype_type_tbl table of symbol to avoid incorrect option of pkttype.
include/datatype.h | 2 ++ include/linux/netfilter/nf_tables.h | 2 ++ src/meta.c | 55 +++++++++++++++++++++++++++++++++++ src/parser.y | 2 ++ src/scanner.l | 1 + 5 files changed, 62 insertions(+)
include/datatype.h +2 -0
@@ -35,6 +35,7 @@* @TYPE_CT_STATUS: conntrack status (bitmask subtype) * @TYPE_ICMP6_TYPE: ICMPv6 type codes (integer subtype) * @TYPE_CT_LABEL: Conntrack Label (bitmask subtype) +* @TYPE_PKTTYPE: packet type (integer subtype) */ enum datatypes {TYPE_INVALID ,
@@ -68,6 +69,7 @@ enum datatypes {TYPE_CT_STATUS ,TYPE_ICMP6_TYPE ,TYPE_CT_LABEL , +TYPE_PKTTYPE , __TYPE_MAX };#define TYPE_MAX (__TYPE_MAX - 1)
include/linux/netfilter/nf_tables.h +2 -0
@@ -535,6 +535,7 @@ enum nft_exthdr_attributes {* @NFT_META_L4PROTO: layer 4 protocol number * @NFT_META_BRI_IIFNAME: packet input bridge interface name * @NFT_META_BRI_OIFNAME: packet output bridge interface name +* @NFT_META_PKTTYPE: packet type */ enum nft_meta_keys {NFT_META_LEN ,
@@ -556,6 +557,7 @@ enum nft_meta_keys {NFT_META_L4PROTO ,NFT_META_BRI_IIFNAME ,NFT_META_BRI_OIFNAME , + NFT_META_PKTTYPE, };/**
src/meta.c +55 -0
73 lines not on this page · raw message
src/parser.y +2 -0
@@ -324,6 +324,7 @@ static int monitor_lookup_event(const char *event) %token RTCLASSID "rtclassid" %token IBRIPORT "ibriport" %token OBRIPORT "obriport" +%token PKTTYPE "pkttype" %token CT "ct" %token DIRECTION "direction"
@@ -1784,6 +1785,7 @@ meta_key_unqualified : MARK { $$ = NFT_META_MARK; } | RTCLASSID { $$ = NFT_META_RTCLASSID; } | IBRIPORT { $$ = NFT_META_BRI_IIFNAME; } | OBRIPORT { $$ = NFT_META_BRI_OIFNAME; } + | PKTTYPE { $$ = NFT_META_PKTTYPE; } ; meta_stmt : META meta_key SET expr
src/scanner.l +1 -0
@@ -406,6 +406,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "rtclassid" { return RTCLASSID; } "ibriport" { return IBRIPORT; } "obriport" { return OBRIPORT; } +"pkttype" { return PKTTYPE; } "ct" { return CT; } "direction" { return DIRECTION; }
Signature · 1 line
1.7.10.4