diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-11-01 10:47:36 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2023-11-01 15:02:49 +0100 |
commit | 4314abf6d4e612e33c53909339931f2bd4cc0c29 (patch) | |
tree | 715c0101e457a9acb2ef9b4f72b604eb5ff1497b /src/libsystemd/sd-netlink/netlink-message-nfnl.c | |
parent | Merge pull request #29803 from poettering/coredump-message-tweaks (diff) | |
download | systemd-4314abf6d4e612e33c53909339931f2bd4cc0c29.tar.xz systemd-4314abf6d4e612e33c53909339931f2bd4cc0c29.zip |
sd-netlink: res_id is 16bit but serial is 32bit
The explicit value here is not so important.
Let's chop off the higher bits.
Fixes the issue reported at
https://github.com/systemd/systemd/pull/29802#issuecomment-1788637950.
Diffstat (limited to '')
-rw-r--r-- | src/libsystemd/sd-netlink/netlink-message-nfnl.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsystemd/sd-netlink/netlink-message-nfnl.c b/src/libsystemd/sd-netlink/netlink-message-nfnl.c index ff7f7c3480..fd3055d879 100644 --- a/src/libsystemd/sd-netlink/netlink-message-nfnl.c +++ b/src/libsystemd/sd-netlink/netlink-message-nfnl.c @@ -149,9 +149,9 @@ int sd_nfnl_send_batch( if (serials) serials[i] = message_get_serial(messages[i]); - /* It seems that the kernel accepts an arbitrary number. Let's set the serial of the - * first message. */ - nfnl_message_set_res_id(messages[i], message_get_serial(batch_begin)); + /* It seems that the kernel accepts an arbitrary number. Let's set the lower 16 bits of the + * serial of the first message. */ + nfnl_message_set_res_id(messages[i], (uint16_t) (message_get_serial(batch_begin) & UINT16_MAX)); iovs[c++] = IOVEC_MAKE(messages[i]->hdr, messages[i]->hdr->nlmsg_len); } |