Skip to content

Commit

Permalink
netlink: specs: Add FIB rule port mask attributes
Browse files Browse the repository at this point in the history
Add new port mask attributes to the spec. Example:

 # ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_rule.yaml \
	--do newrule \
	--json '{"family": 2, "sport-range": { "start": 12345, "end": 12345 }, "sport-mask": 65535, "action": 1, "table": 1}'
 None
 # ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_rule.yaml \
	--do newrule \
	--json '{"family": 2, "dport-range": { "start": 54321, "end": 54321 }, "dport-mask": 65535, "action": 1, "table": 2}'
 None
 $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_rule.yaml \
	--dump getrule --json '{"family": 2}' --output-json | jq '.[]'
 [...]
 {
   "table": 2,
   "suppress-prefixlen": "0xffffffff",
   "protocol": 0,
   "priority": 32764,
   "dport-range": {
     "start": 54321,
     "end": 54321
   },
   "dport-mask": "0xffff",
   "family": 2,
   "dst-len": 0,
   "src-len": 0,
   "tos": 0,
   "action": "to-tbl",
   "flags": 0
 }
 {
   "table": 1,
   "suppress-prefixlen": "0xffffffff",
   "protocol": 0,
   "priority": 32765,
   "sport-range": {
     "start": 12345,
     "end": 12345
   },
   "sport-mask": "0xffff",
   "family": 2,
   "dst-len": 0,
   "src-len": 0,
   "tos": 0,
   "action": "to-tbl",
   "flags": 0
 }
 [...]

Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20250217134109.311176-7-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Ido Schimmel authored and Jakub Kicinski committed Feb 20, 2025
1 parent 34e406a commit ab35ebf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Documentation/netlink/specs/rt_rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ attribute-sets:
type: u32
byte-order: big-endian
display-hint: hex
-
name: sport-mask
type: u16
display-hint: hex
-
name: dport-mask
type: u16
display-hint: hex

operations:
enum-model: directional
Expand Down Expand Up @@ -215,6 +223,8 @@ operations:
- dscp
- flowlabel
- flowlabel-mask
- sport-mask
- dport-mask
-
name: newrule-ntf
doc: Notify a rule creation
Expand Down

0 comments on commit ab35ebf

Please sign in to comment.