-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Use new enum variants of `Counter`: `Named` and `Anonymous`.
- Loading branch information
Showing
4 changed files
with
180 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
{ | ||
"nftables": [ | ||
{ | ||
"metainfo": { | ||
"version": "1.0.9", | ||
"release_name": "Old Doc Yak #3", | ||
"json_schema_version": 1 | ||
} | ||
}, | ||
{ | ||
"table": { | ||
"family": "inet", | ||
"name": "named_counter_demo", | ||
"handle": 1 | ||
} | ||
}, | ||
{ | ||
"counter": { | ||
"family": "inet", | ||
"name": "cnt_http", | ||
"table": "named_counter_demo", | ||
"handle": 2, | ||
"comment": "count both http and https packets", | ||
"packets": 0, | ||
"bytes": 0 | ||
} | ||
}, | ||
{ | ||
"counter": { | ||
"family": "inet", | ||
"name": "cnt_smtp", | ||
"table": "named_counter_demo", | ||
"handle": 3, | ||
"packets": 0, | ||
"bytes": 0 | ||
} | ||
}, | ||
{ | ||
"chain": { | ||
"family": "inet", | ||
"table": "named_counter_demo", | ||
"name": "IN", | ||
"handle": 1 | ||
} | ||
}, | ||
{ | ||
"rule": { | ||
"family": "inet", | ||
"table": "named_counter_demo", | ||
"chain": "IN", | ||
"handle": 4, | ||
"expr": [ | ||
{ | ||
"match": { | ||
"op": "==", | ||
"left": { | ||
"payload": { | ||
"protocol": "tcp", | ||
"field": "dport" | ||
} | ||
}, | ||
"right": 21 | ||
} | ||
}, | ||
{ | ||
"counter": { | ||
"packets": 0, | ||
"bytes": 0 | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"rule": { | ||
"family": "inet", | ||
"table": "named_counter_demo", | ||
"chain": "IN", | ||
"handle": 5, | ||
"expr": [ | ||
{ | ||
"match": { | ||
"op": "==", | ||
"left": { | ||
"payload": { | ||
"protocol": "tcp", | ||
"field": "dport" | ||
} | ||
}, | ||
"right": 25 | ||
} | ||
}, | ||
{ | ||
"counter": "cnt_smtp" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"rule": { | ||
"family": "inet", | ||
"table": "named_counter_demo", | ||
"chain": "IN", | ||
"handle": 6, | ||
"expr": [ | ||
{ | ||
"match": { | ||
"op": "==", | ||
"left": { | ||
"payload": { | ||
"protocol": "tcp", | ||
"field": "dport" | ||
} | ||
}, | ||
"right": 80 | ||
} | ||
}, | ||
{ | ||
"counter": "cnt_http" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"rule": { | ||
"family": "inet", | ||
"table": "named_counter_demo", | ||
"chain": "IN", | ||
"handle": 7, | ||
"expr": [ | ||
{ | ||
"match": { | ||
"op": "==", | ||
"left": { | ||
"payload": { | ||
"protocol": "tcp", | ||
"field": "dport" | ||
} | ||
}, | ||
"right": 443 | ||
} | ||
}, | ||
{ | ||
"counter": "cnt_http" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
table inet named_counter_demo { | ||
counter cnt_http { | ||
comment "count both http and https packets" | ||
packets 0 bytes 0 | ||
} | ||
|
||
counter cnt_smtp { | ||
packets 0 bytes 0 | ||
} | ||
|
||
chain IN { | ||
tcp dport 21 counter | ||
tcp dport 25 counter name "cnt_smtp" | ||
tcp dport 80 counter name "cnt_http" | ||
tcp dport 443 counter name "cnt_http" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters