tools: ynl: wrap recv() + mnl_cb_run2() into a single helper
authorJakub Kicinski <kuba@kernel.org>
Tue, 27 Feb 2024 22:30:25 +0000 (14:30 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 28 Feb 2024 23:25:43 +0000 (15:25 -0800)
commit2f22f0b313f4c11e524c68e34165e62d8276e442
tree748c6d2da88556c72f5fd40c0c266199cd8f80e9
parent9c29a113165fc473e6f91f40e59ece94d287f95d
tools: ynl: wrap recv() + mnl_cb_run2() into a single helper

All callers to mnl_cb_run2() call mnl_socket_recvfrom() right before.
Wrap the two in a helper, take typed arguments (struct ynl_parse_arg),
instead of hoping that all callers remember that parser error handling
requires yarg.

In case of ynl_sock_read_family() we will no longer check for kernel
returning no data, but that would be a kernel bug, not worth complicating
the code to catch this. Calling mnl_cb_run2() on an empty buffer
is legal and results in STOP (1).

Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Link: https://lore.kernel.org/r/20240227223032.1835527-9-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/lib/ynl.c