Skip to content

Commit 023289b

Browse files
donaldhkuba-moo
authored andcommitted
doc/netlink: Add spec for rt route messages
Add schema for rt route with support for getroute, newroute and delroute. Routes can be dumped with filter attributes like this: ./tools/net/ynl/cli.py \ --spec Documentation/netlink/specs/rt_route.yaml \ --dump getroute --json '{"rtm-family": 2, "rtm-table": 254}' Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://lore.kernel.org/r/20230825122756.7603-13-donald.hunter@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent b2f63d9 commit 023289b

File tree

1 file changed

+327
-0
lines changed

1 file changed

+327
-0
lines changed
Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2+
3+
name: rt-route
4+
protocol: netlink-raw
5+
protonum: 0
6+
7+
doc:
8+
Route configuration over rtnetlink.
9+
10+
definitions:
11+
-
12+
name: rtm-type
13+
name-prefix: rtn-
14+
type: enum
15+
entries:
16+
- unspec
17+
- unicast
18+
- local
19+
- broadcast
20+
- anycast
21+
- multicast
22+
- blackhole
23+
- unreachable
24+
- prohibit
25+
- throw
26+
- nat
27+
- xresolve
28+
-
29+
name: rtmsg
30+
type: struct
31+
members:
32+
-
33+
name: rtm-family
34+
type: u8
35+
-
36+
name: rtm-dst-len
37+
type: u8
38+
-
39+
name: rtm-src-len
40+
type: u8
41+
-
42+
name: rtm-tos
43+
type: u8
44+
-
45+
name: rtm-table
46+
type: u8
47+
-
48+
name: rtm-protocol
49+
type: u8
50+
-
51+
name: rtm-scope
52+
type: u8
53+
-
54+
name: rtm-type
55+
type: u8
56+
enum: rtm-type
57+
-
58+
name: rtm-flags
59+
type: u32
60+
-
61+
name: rta-cacheinfo
62+
type: struct
63+
members:
64+
-
65+
name: rta-clntref
66+
type: u32
67+
-
68+
name: rta-lastuse
69+
type: u32
70+
-
71+
name: rta-expires
72+
type: u32
73+
-
74+
name: rta-error
75+
type: u32
76+
-
77+
name: rta-used
78+
type: u32
79+
80+
attribute-sets:
81+
-
82+
name: route-attrs
83+
attributes:
84+
-
85+
name: rta-dst
86+
type: binary
87+
display-hint: ipv4
88+
-
89+
name: rta-src
90+
type: binary
91+
display-hint: ipv4
92+
-
93+
name: rta-iif
94+
type: u32
95+
-
96+
name: rta-oif
97+
type: u32
98+
-
99+
name: rta-gateway
100+
type: binary
101+
display-hint: ipv4
102+
-
103+
name: rta-priority
104+
type: u32
105+
-
106+
name: rta-prefsrc
107+
type: binary
108+
display-hint: ipv4
109+
-
110+
name: rta-metrics
111+
type: nest
112+
nested-attributes: rta-metrics
113+
-
114+
name: rta-multipath
115+
type: binary
116+
-
117+
name: rta-protoinfo # not used
118+
type: binary
119+
-
120+
name: rta-flow
121+
type: u32
122+
-
123+
name: rta-cacheinfo
124+
type: binary
125+
struct: rta-cacheinfo
126+
-
127+
name: rta-session # not used
128+
type: binary
129+
-
130+
name: rta-mp-algo # not used
131+
type: binary
132+
-
133+
name: rta-table
134+
type: u32
135+
-
136+
name: rta-mark
137+
type: u32
138+
-
139+
name: rta-mfc-stats
140+
type: binary
141+
-
142+
name: rta-via
143+
type: binary
144+
-
145+
name: rta-newdst
146+
type: binary
147+
-
148+
name: rta-pref
149+
type: u8
150+
-
151+
name: rta-encap-type
152+
type: u16
153+
-
154+
name: rta-encap
155+
type: binary # tunnel specific nest
156+
-
157+
name: rta-expires
158+
type: u32
159+
-
160+
name: rta-pad
161+
type: binary
162+
-
163+
name: rta-uid
164+
type: u32
165+
-
166+
name: rta-ttl-propagate
167+
type: u8
168+
-
169+
name: rta-ip-proto
170+
type: u8
171+
-
172+
name: rta-sport
173+
type: u16
174+
-
175+
name: rta-dport
176+
type: u16
177+
-
178+
name: rta-nh-id
179+
type: u32
180+
-
181+
name: rta-metrics
182+
attributes:
183+
-
184+
name: rtax-unspec
185+
type: unused
186+
value: 0
187+
-
188+
name: rtax-lock
189+
type: u32
190+
-
191+
name: rtax-mtu
192+
type: u32
193+
-
194+
name: rtax-window
195+
type: u32
196+
-
197+
name: rtax-rtt
198+
type: u32
199+
-
200+
name: rtax-rttvar
201+
type: u32
202+
-
203+
name: rtax-ssthresh
204+
type: u32
205+
-
206+
name: rtax-cwnd
207+
type: u32
208+
-
209+
name: rtax-advmss
210+
type: u32
211+
-
212+
name: rtax-reordering
213+
type: u32
214+
-
215+
name: rtax-hoplimit
216+
type: u32
217+
-
218+
name: rtax-initcwnd
219+
type: u32
220+
-
221+
name: rtax-features
222+
type: u32
223+
-
224+
name: rtax-rto-min
225+
type: u32
226+
-
227+
name: rtax-initrwnd
228+
type: u32
229+
-
230+
name: rtax-quickack
231+
type: u32
232+
-
233+
name: rtax-cc-algo
234+
type: string
235+
-
236+
name: rtax-fastopen-no-cookie
237+
type: u32
238+
239+
operations:
240+
enum-model: directional
241+
list:
242+
-
243+
name: getroute
244+
doc: Dump route information.
245+
attribute-set: route-attrs
246+
fixed-header: rtmsg
247+
do:
248+
request:
249+
value: 26
250+
attributes:
251+
- rtm-family
252+
- rta-src
253+
- rtm-src-len
254+
- rta-dst
255+
- rtm-dst-len
256+
- rta-iif
257+
- rta-oif
258+
- rta-ip-proto
259+
- rta-sport
260+
- rta-dport
261+
- rta-mark
262+
- rta-uid
263+
reply:
264+
value: 24
265+
attributes: &all-route-attrs
266+
- rtm-family
267+
- rtm-dst-len
268+
- rtm-src-len
269+
- rtm-tos
270+
- rtm-table
271+
- rtm-protocol
272+
- rtm-scope
273+
- rtm-type
274+
- rtm-flags
275+
- rta-dst
276+
- rta-src
277+
- rta-iif
278+
- rta-oif
279+
- rta-gateway
280+
- rta-priority
281+
- rta-prefsrc
282+
- rta-metrics
283+
- rta-multipath
284+
- rta-flow
285+
- rta-cacheinfo
286+
- rta-table
287+
- rta-mark
288+
- rta-mfc-stats
289+
- rta-via
290+
- rta-newdst
291+
- rta-pref
292+
- rta-encap-type
293+
- rta-encap
294+
- rta-expires
295+
- rta-pad
296+
- rta-uid
297+
- rta-ttl-propagate
298+
- rta-ip-proto
299+
- rta-sport
300+
- rta-dport
301+
- rta-nh-id
302+
dump:
303+
request:
304+
value: 26
305+
attributes:
306+
- rtm-family
307+
reply:
308+
value: 24
309+
attributes: *all-route-attrs
310+
-
311+
name: newroute
312+
doc: Create a new route
313+
attribute-set: route-attrs
314+
fixed-header: rtmsg
315+
do:
316+
request:
317+
value: 24
318+
attributes: *all-route-attrs
319+
-
320+
name: delroute
321+
doc: Delete an existing route
322+
attribute-set: route-attrs
323+
fixed-header: rtmsg
324+
do:
325+
request:
326+
value: 25
327+
attributes: *all-route-attrs

0 commit comments

Comments
 (0)