sd-netlink: revamp message serial handling
authorLennart Poettering <lennart@poettering.net>
Wed, 10 Feb 2021 16:59:46 +0000 (17:59 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 12 Mar 2021 15:23:45 +0000 (16:23 +0100)
commitd3635d45d1a4b4b9bae8b9ac967f31ff3f53afab
tree3e089cff495da6b51588439ebe98c915d322b97b
parent18e4b646f48c19843da5cd23c8c032a7c89a1eec
sd-netlink: revamp message serial handling

Let's use uint32_t everywhere to maintain the seqno, since that's what
the kernel does. Prviously in the reply_callback logic we used 64bit,
for no apparent reason.

Using 32bit also provides us with the benefit that we can avoid using
uint64_hash_ops, and can use trivial_hash_ops instead for the reply
hashmap, so that we can store the seqno in the key pointer directly.

While we are at it, let's make sure we never run into serial collisions
internally (32bit is a lot, but not that much), and let's put a limit on
outstanding serials, to catch programming errors.

(cherry picked from commit b522c4b92a1a8999e008002f0a30acbaf58b55e4)
src/libsystemd/sd-netlink/netlink-internal.h
src/libsystemd/sd-netlink/sd-netlink.c