]> git.ipfire.org Git - thirdparty/systemd.git/commit
network: replace detailed netlink append messages with a single generic message
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 4 Jan 2022 18:16:01 +0000 (19:16 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 5 Jan 2022 10:36:04 +0000 (11:36 +0100)
commit5b80ecea55c4bce3534ed75abf9cef437850aefb
tree14e9b87a651c2dc29eece8b508ed839816446a61
parent5df66d7d68006615abb4c4d3b1ebad545af4dd72
network: replace detailed netlink append messages with a single generic message

This commit is the first in the series, and they generally follow the same
idea: we had very detailed logging for message append operations which would
only fail either with some type error or intrinsic limit (and then they would
fail everywhere, so this would be noticed during development or in CI), or they
would fail with ENOMEM, in which case the exact location is not very interesting
since this is not repeatable.

I am in general in favour of detailed logging messages, because it helps with
diagnosis of errors, but I think case is an exception. Despite not being very
useful, those messages required a lot of effort, because they were customized
for each and every append operation. In fact some of the messages contained copy
errors. The text of the messages (since they are generally unique) also added up
to a considerable size.

This removes the log messages after each sd_netlink_message_append_*() in
fill_message_create() with a single line in netdev_create(). As described
above, we are just appending fields to a message, so those calls would almost
never fail.

A forgotten 'return' was added in one place.

$ size build/systemd-networkd{.0,}
   text    data     bss     dec     hex filename
1878634  394016      36 2272686  22adae build/systemd-networkd.0
1842450  394080      36 2236566  222096 build/systemd-networkd

… so we save 30k too.
16 files changed:
src/network/netdev/bareudp.c
src/network/netdev/batadv.c
src/network/netdev/bond.c
src/network/netdev/geneve.c
src/network/netdev/ipoib.c
src/network/netdev/ipvlan.c
src/network/netdev/macsec.c
src/network/netdev/macvlan.c
src/network/netdev/netdev.c
src/network/netdev/tunnel.c
src/network/netdev/veth.c
src/network/netdev/vlan.c
src/network/netdev/vrf.c
src/network/netdev/vxcan.c
src/network/netdev/vxlan.c
src/network/netdev/xfrm.c