summaryrefslogtreecommitdiff
path: root/src/network/networkd-bridge-mdb.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-06-03 11:24:02 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-06-06 09:52:52 +0200
commit84dbb3fd83ef7d7e5b2ea02be1f492974384256c (patch)
tree8b709e5d9f164c9b8297a08dc328bd9c92e01d83 /src/network/networkd-bridge-mdb.c
parentb547241728487c0dca22780241b04964f2eb37af (diff)
downloadsystemd-84dbb3fd83ef7d7e5b2ea02be1f492974384256c.tar.gz
basic/in-addr-util: add IN_ADDR_TO_STRING
Since we don't need the error value, and the buffer is allocated with a fixed size, the whole logic provided by in_addr_to_string() becomes unnecessary, so it's enough to wrap inet_ntop() directly. inet_ntop() can only fail with ENOSPC. But we specify a buffer that is supposed to be large enough, so this should never fail. A bunch of tests of this are added. This allows all the wrappers like strna(), strnull(), strempty() to be dropped. The guard of 'if (DEBUG_LOGGING)' can be dropped from around log_debug(), because log_debug() implements the check outside of the function call. But log_link_debug() does not, so it we need it to avoid unnecessary evaluation of the formatting.
Diffstat (limited to 'src/network/networkd-bridge-mdb.c')
-rw-r--r--src/network/networkd-bridge-mdb.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c
index 3af4afe4a1..bd1a9745dc 100644
--- a/src/network/networkd-bridge-mdb.c
+++ b/src/network/networkd-bridge-mdb.c
@@ -119,13 +119,9 @@ static int bridge_mdb_configure(BridgeMDB *mdb, Link *link, Request *req) {
assert(link->manager);
assert(req);
- if (DEBUG_LOGGING) {
- _cleanup_free_ char *a = NULL;
-
- (void) in_addr_to_string(mdb->family, &mdb->group_addr, &a);
+ if (DEBUG_LOGGING)
log_link_debug(link, "Configuring bridge MDB entry: MulticastGroupAddress=%s, VLANId=%u",
- strna(a), mdb->vlan_id);
- }
+ IN_ADDR_TO_STRING(mdb->family, &mdb->group_addr), mdb->vlan_id);
entry = (struct br_mdb_entry) {
/* If MDB entry is added on bridge master, then the state must be MDB_TEMPORARY.