diff options
| author | Hangbin Liu <liuhangbin@kylinos.cn> | 2026-10-08 16:24:02 +0800 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-10-15 16:59:58 -0700 |
| commit | 05d3030eff5b73f6fe7f86dafa3eeae004e2ede1 (patch) | |
| tree | 9d70453c7ef40be598294fa86ba271144b7b88ba /scripts/basic | |
| parent | 499f32f0eb56603af2930ba67b4eb82fc1437264 (diff) | |
tools: ynl: convert enum selector to string for sub-message parsing
YNL sub-message parsing expects a string selector for strcmp(). So for
non-external enum selectors, convert the integer value to its string form
via the family's {enum}_str() helper. This enables correct decoding of
sub-messages keyed by enum values.
After the change, if there is no encap_type (e.g. previous ordering on
older kernels), or a new encap_type is missing from the spec file in
future kernel, the code will report "Sub-message key not set", the same
with string lookup fails. With the subsequent rt-route encap spec update,
the newly generated code will look like:
if (!dst->_present.encap_type)
return ynl_submsg_failed(yarg, "encap", "encap-type");
encap_type_str = rt_route_encap_type_str(dst->encap_type);
if (!encap_type_str)
return ynl_submsg_failed(yarg, "encap", "enum-lookup-failed");
if (rt_route_encap_data_parse(&parg, encap_type_str, attr))
return YNL_PARSE_CB_ERROR;
Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20261008-ynl_rt_encap-v4-2-4ed2ccf7f949@kylinos.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions
