]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-netlink: allow configuration of flags parameter when creating message object
authorLennart Poettering <lennart@poettering.net>
Tue, 8 Apr 2025 10:13:12 +0000 (12:13 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 13 May 2025 12:42:33 +0000 (14:42 +0200)
commit6e196011ca8a1eba5be16f57e05ff6f152672f7a
tree066897986ab76a64606c692e14327430cd74a65a
parenta2ab433a60e43f451682061b214c6bb71ea27e4d
sd-netlink: allow configuration of flags parameter when creating message object

We soon want to add for sock_diag(7) netlink sockets. Those reuse the
same message type codes for request and response but with different
message formats. Hence we need to look at NLM_F_REQUEST to determine
which message policy to apply. Hence it is essential to know the flags
parameters right away when creating a message, since we cannot do early
validation otherwise.

This only adds support for setting the flags value right at the moment
of creation of the message object, it does not otherwise add
sock_diag(7) support, that is added in a later message.

This also corrects the flag for synthetic NLMSG_ERROR messages which
should not have the NLM_F_REQUEST flag set (since they are responses,
not requests).
src/libsystemd/sd-netlink/netlink-genl.c
src/libsystemd/sd-netlink/netlink-internal.h
src/libsystemd/sd-netlink/netlink-message-nfnl.c
src/libsystemd/sd-netlink/netlink-message-rtnl.c
src/libsystemd/sd-netlink/netlink-message.c
src/libsystemd/sd-netlink/netlink-socket.c
src/libsystemd/sd-netlink/netlink-types.c
src/libsystemd/sd-netlink/netlink-types.h