summaryrefslogtreecommitdiff
path: root/tools/net/ynl/samples/rt-route.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2025-05-05 19:52:06 +0300
committerJakub Kicinski <kuba@kernel.org>2025-05-08 04:21:25 +0300
commitb8ae9f70aaf134dc57f227fd1730b64ce89e109d (patch)
treef7c3b66c647c04c4657e7ccc7f7411249de8dee2 /tools/net/ynl/samples/rt-route.c
parenta512be0ecb147e25ec0492335953ae8ad8e28fcb (diff)
downloadlinux-b8ae9f70aaf134dc57f227fd1730b64ce89e109d.tar.xz
tools: ynl-gen: split presence metadata
Each YNL struct contains the data and a sub-struct indicating which fields are valid. Something like: struct family_op_req { struct { u32 a:1; u32 b:1; u32 bin_len; } _present; u32 a; u64 b; const unsigned char *bin; }; Note that the bin object 'bin' has a length stored, and that length has a _len suffix added to the field name. This breaks if there is a explicit field called bin_len, which is the case for some TC actions. Move the length fields out of the _present struct, create a new struct called _len: struct family_op_req { struct { u32 a:1; u32 b:1; } _present; struct { u32 bin; } _len; u32 a; u64 b; const unsigned char *bin; }; This should prevent name collisions and help with the packing of the struct. Unfortunately this is a breaking change, but hopefully the migration isn't too painful. Link: https://patch.msgid.link/20250505165208.248049-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/net/ynl/samples/rt-route.c')
-rw-r--r--tools/net/ynl/samples/rt-route.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/net/ynl/samples/rt-route.c b/tools/net/ynl/samples/rt-route.c
index 9d9c868f8873..7427104a96df 100644
--- a/tools/net/ynl/samples/rt-route.c
+++ b/tools/net/ynl/samples/rt-route.c
@@ -26,13 +26,13 @@ static void rt_route_print(struct rt_route_getroute_rsp *r)
printf("oif: %-16s ", name);
}
- if (r->_present.dst_len) {
+ if (r->_len.dst) {
route = inet_ntop(r->_hdr.rtm_family, r->dst,
route_str, sizeof(route_str));
printf("dst: %s/%d", route, r->_hdr.rtm_dst_len);
}
- if (r->_present.gateway_len) {
+ if (r->_len.gateway) {
route = inet_ntop(r->_hdr.rtm_family, r->gateway,
route_str, sizeof(route_str));
printf("gateway: %s ", route);