(I'm so sorry!) Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

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>


Author Hangbin Liu Committer Jakub Kicinski Date Commit Parent 499f32f0
+29 -5
1 changed file
+29 -5
1 changed file