2024-11-06 09:07:18 +00:00
|
|
|
# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
|
2025-06-10 13:59:38 +01:00
|
|
|
---
|
2024-11-06 09:07:18 +00:00
|
|
|
name: rt-rule
|
|
|
|
protocol: netlink-raw
|
2025-04-17 19:17:06 -07:00
|
|
|
uapi-header: linux/fib_rules.h
|
2024-11-06 09:07:18 +00:00
|
|
|
protonum: 0
|
|
|
|
|
|
|
|
doc:
|
|
|
|
FIB rule management over rtnetlink.
|
|
|
|
|
|
|
|
definitions:
|
|
|
|
-
|
|
|
|
name: rtgenmsg
|
|
|
|
type: struct
|
|
|
|
members:
|
|
|
|
-
|
|
|
|
name: family
|
|
|
|
type: u8
|
|
|
|
-
|
|
|
|
name: pad
|
|
|
|
type: pad
|
|
|
|
len: 3
|
|
|
|
-
|
|
|
|
name: fib-rule-hdr
|
|
|
|
type: struct
|
|
|
|
members:
|
|
|
|
-
|
|
|
|
name: family
|
|
|
|
type: u8
|
|
|
|
-
|
|
|
|
name: dst-len
|
|
|
|
type: u8
|
|
|
|
-
|
|
|
|
name: src-len
|
|
|
|
type: u8
|
|
|
|
-
|
|
|
|
name: tos
|
|
|
|
type: u8
|
|
|
|
-
|
|
|
|
name: table
|
|
|
|
type: u8
|
|
|
|
-
|
|
|
|
name: res1
|
|
|
|
type: pad
|
|
|
|
len: 1
|
|
|
|
-
|
|
|
|
name: res2
|
|
|
|
type: pad
|
|
|
|
len: 1
|
|
|
|
-
|
|
|
|
name: action
|
|
|
|
type: u8
|
|
|
|
enum: fr-act
|
|
|
|
-
|
|
|
|
name: flags
|
|
|
|
type: u32
|
|
|
|
-
|
|
|
|
name: fr-act
|
|
|
|
type: enum
|
2025-04-17 19:17:06 -07:00
|
|
|
enum-name:
|
2024-11-06 09:07:18 +00:00
|
|
|
entries:
|
|
|
|
- unspec
|
|
|
|
- to-tbl
|
|
|
|
- goto
|
|
|
|
- nop
|
|
|
|
- res3
|
|
|
|
- res4
|
|
|
|
- blackhole
|
|
|
|
- unreachable
|
|
|
|
- prohibit
|
|
|
|
-
|
|
|
|
name: fib-rule-port-range
|
|
|
|
type: struct
|
|
|
|
members:
|
|
|
|
-
|
|
|
|
name: start
|
|
|
|
type: u16
|
|
|
|
-
|
|
|
|
name: end
|
|
|
|
type: u16
|
|
|
|
-
|
|
|
|
name: fib-rule-uid-range
|
|
|
|
type: struct
|
|
|
|
members:
|
|
|
|
-
|
|
|
|
name: start
|
|
|
|
type: u32
|
|
|
|
-
|
|
|
|
name: end
|
|
|
|
type: u32
|
|
|
|
|
|
|
|
attribute-sets:
|
|
|
|
-
|
|
|
|
name: fib-rule-attrs
|
2025-04-17 19:17:06 -07:00
|
|
|
name-prefix: fra-
|
2024-11-06 09:07:18 +00:00
|
|
|
attributes:
|
|
|
|
-
|
|
|
|
name: dst
|
|
|
|
type: u32
|
|
|
|
-
|
|
|
|
name: src
|
|
|
|
type: u32
|
|
|
|
-
|
|
|
|
name: iifname
|
|
|
|
type: string
|
|
|
|
-
|
|
|
|
name: goto
|
|
|
|
type: u32
|
|
|
|
-
|
|
|
|
name: unused2
|
|
|
|
type: pad
|
|
|
|
-
|
|
|
|
name: priority
|
|
|
|
type: u32
|
|
|
|
-
|
|
|
|
name: unused3
|
|
|
|
type: pad
|
|
|
|
-
|
|
|
|
name: unused4
|
|
|
|
type: pad
|
|
|
|
-
|
|
|
|
name: unused5
|
|
|
|
type: pad
|
|
|
|
-
|
|
|
|
name: fwmark
|
|
|
|
type: u32
|
|
|
|
display-hint: hex
|
|
|
|
-
|
|
|
|
name: flow
|
|
|
|
type: u32
|
|
|
|
-
|
|
|
|
name: tun-id
|
|
|
|
type: u64
|
|
|
|
-
|
|
|
|
name: suppress-ifgroup
|
|
|
|
type: u32
|
|
|
|
-
|
|
|
|
name: suppress-prefixlen
|
|
|
|
type: u32
|
|
|
|
display-hint: hex
|
|
|
|
-
|
|
|
|
name: table
|
|
|
|
type: u32
|
|
|
|
-
|
|
|
|
name: fwmask
|
|
|
|
type: u32
|
|
|
|
display-hint: hex
|
|
|
|
-
|
|
|
|
name: oifname
|
|
|
|
type: string
|
|
|
|
-
|
|
|
|
name: pad
|
|
|
|
type: pad
|
|
|
|
-
|
|
|
|
name: l3mdev
|
|
|
|
type: u8
|
|
|
|
-
|
|
|
|
name: uid-range
|
|
|
|
type: binary
|
|
|
|
struct: fib-rule-uid-range
|
|
|
|
-
|
|
|
|
name: protocol
|
|
|
|
type: u8
|
|
|
|
-
|
|
|
|
name: ip-proto
|
|
|
|
type: u8
|
|
|
|
-
|
|
|
|
name: sport-range
|
|
|
|
type: binary
|
|
|
|
struct: fib-rule-port-range
|
|
|
|
-
|
|
|
|
name: dport-range
|
|
|
|
type: binary
|
|
|
|
struct: fib-rule-port-range
|
|
|
|
-
|
|
|
|
name: dscp
|
|
|
|
type: u8
|
netlink: specs: Add FIB rule flow label attributes
Add the new flow label attributes to the spec. Example:
# ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_rule.yaml \
--do newrule \
--json '{"family": 10, "flowlabel": 1, "flowlabel-mask": 1, "action": 1, "table": 1}'
None
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_rule.yaml \
--dump getrule --json '{"family": 10}' --output-json \
| jq '.[] | select(.flowlabel == "0x1")'
{
"table": 1,
"suppress-prefixlen": "0xffffffff",
"protocol": 0,
"priority": 32765,
"flowlabel": "0x1",
"flowlabel-mask": "0x1",
"family": 10,
"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>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-12-16 19:11:57 +02:00
|
|
|
-
|
|
|
|
name: flowlabel
|
|
|
|
type: u32
|
|
|
|
byte-order: big-endian
|
|
|
|
display-hint: hex
|
|
|
|
-
|
|
|
|
name: flowlabel-mask
|
|
|
|
type: u32
|
|
|
|
byte-order: big-endian
|
|
|
|
display-hint: hex
|
netlink: specs: Add FIB rule port mask attributes
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>
2025-02-17 15:41:07 +02:00
|
|
|
-
|
|
|
|
name: sport-mask
|
|
|
|
type: u16
|
|
|
|
display-hint: hex
|
|
|
|
-
|
|
|
|
name: dport-mask
|
|
|
|
type: u16
|
|
|
|
display-hint: hex
|
netlink: specs: Add FIB rule DSCP mask attribute
Add new DSCP mask attribute to the spec. Example:
# ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_rule.yaml \
--do newrule \
--json '{"family": 2, "dscp": 10, "dscp-mask": 63, "action": 1, "table": 1}'
None
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_rule.yaml \
--dump getrule --json '{"family": 2}' --output-json | jq '.[]'
[...]
{
"table": 1,
"suppress-prefixlen": "0xffffffff",
"protocol": 0,
"priority": 32765,
"dscp": 10,
"dscp-mask": "0x3f",
"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>
Link: https://patch.msgid.link/20250220080525.831924-6-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-02-20 10:05:24 +02:00
|
|
|
-
|
|
|
|
name: dscp-mask
|
|
|
|
type: u8
|
|
|
|
display-hint: hex
|
2024-11-06 09:07:18 +00:00
|
|
|
|
|
|
|
operations:
|
|
|
|
enum-model: directional
|
|
|
|
fixed-header: fib-rule-hdr
|
2025-04-17 19:17:06 -07:00
|
|
|
name-prefix: rtm-
|
2024-11-06 09:07:18 +00:00
|
|
|
list:
|
|
|
|
-
|
|
|
|
name: newrule
|
|
|
|
doc: Add new FIB rule
|
|
|
|
attribute-set: fib-rule-attrs
|
|
|
|
do:
|
|
|
|
request:
|
|
|
|
value: 32
|
|
|
|
attributes: &fib-rule-all
|
|
|
|
- iifname
|
|
|
|
- oifname
|
|
|
|
- priority
|
|
|
|
- fwmark
|
|
|
|
- flow
|
|
|
|
- tun-id
|
|
|
|
- fwmask
|
|
|
|
- table
|
|
|
|
- suppress-prefixlen
|
|
|
|
- suppress-ifgroup
|
|
|
|
- goto
|
|
|
|
- l3mdev
|
|
|
|
- uid-range
|
|
|
|
- protocol
|
|
|
|
- ip-proto
|
|
|
|
- sport-range
|
|
|
|
- dport-range
|
|
|
|
- dscp
|
netlink: specs: Add FIB rule flow label attributes
Add the new flow label attributes to the spec. Example:
# ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_rule.yaml \
--do newrule \
--json '{"family": 10, "flowlabel": 1, "flowlabel-mask": 1, "action": 1, "table": 1}'
None
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_rule.yaml \
--dump getrule --json '{"family": 10}' --output-json \
| jq '.[] | select(.flowlabel == "0x1")'
{
"table": 1,
"suppress-prefixlen": "0xffffffff",
"protocol": 0,
"priority": 32765,
"flowlabel": "0x1",
"flowlabel-mask": "0x1",
"family": 10,
"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>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-12-16 19:11:57 +02:00
|
|
|
- flowlabel
|
|
|
|
- flowlabel-mask
|
netlink: specs: Add FIB rule port mask attributes
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>
2025-02-17 15:41:07 +02:00
|
|
|
- sport-mask
|
|
|
|
- dport-mask
|
netlink: specs: Add FIB rule DSCP mask attribute
Add new DSCP mask attribute to the spec. Example:
# ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_rule.yaml \
--do newrule \
--json '{"family": 2, "dscp": 10, "dscp-mask": 63, "action": 1, "table": 1}'
None
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_rule.yaml \
--dump getrule --json '{"family": 2}' --output-json | jq '.[]'
[...]
{
"table": 1,
"suppress-prefixlen": "0xffffffff",
"protocol": 0,
"priority": 32765,
"dscp": 10,
"dscp-mask": "0x3f",
"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>
Link: https://patch.msgid.link/20250220080525.831924-6-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-02-20 10:05:24 +02:00
|
|
|
- dscp-mask
|
2024-11-06 09:07:18 +00:00
|
|
|
-
|
|
|
|
name: newrule-ntf
|
|
|
|
doc: Notify a rule creation
|
|
|
|
value: 32
|
2025-04-17 19:17:05 -07:00
|
|
|
notify: getrule
|
2024-11-06 09:07:18 +00:00
|
|
|
-
|
|
|
|
name: delrule
|
|
|
|
doc: Remove an existing FIB rule
|
|
|
|
attribute-set: fib-rule-attrs
|
|
|
|
do:
|
|
|
|
request:
|
|
|
|
value: 33
|
|
|
|
attributes: *fib-rule-all
|
|
|
|
-
|
|
|
|
name: delrule-ntf
|
|
|
|
doc: Notify a rule deletion
|
|
|
|
value: 33
|
2025-04-17 19:17:05 -07:00
|
|
|
notify: getrule
|
2024-11-06 09:07:18 +00:00
|
|
|
-
|
|
|
|
name: getrule
|
|
|
|
doc: Dump all FIB rules
|
|
|
|
attribute-set: fib-rule-attrs
|
|
|
|
dump:
|
|
|
|
request:
|
|
|
|
value: 34
|
|
|
|
reply:
|
|
|
|
value: 32
|
|
|
|
attributes: *fib-rule-all
|
|
|
|
|
|
|
|
mcast-groups:
|
|
|
|
list:
|
|
|
|
-
|
|
|
|
name: rtnlgrp-ipv4-rule
|
|
|
|
value: 8
|
|
|
|
-
|
|
|
|
name: rtnlgrp-ipv6-rule
|
|
|
|
value: 19
|