From: Michael Tremer Date: Sun, 4 Jun 2023 17:19:19 +0000 (+0000) Subject: ports: Log when we created a random Ethernet address X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d667fff47beb1fbdf570006b112e64500528a139;p=network.git ports: Log when we created a random Ethernet address Signed-off-by: Michael Tremer --- diff --git a/src/networkd/port.c b/src/networkd/port.c index dfce5b6a..d5ffe42c 100644 --- a/src/networkd/port.c +++ b/src/networkd/port.c @@ -67,6 +67,7 @@ static void nw_port_free(nw_port* port) { } static int nw_port_setup_address(nw_port* port) { + char* __address = NULL; int r; // Read ADDRESS from configuration @@ -100,6 +101,15 @@ ERROR: return r; } + // Format the generated address + __address = nw_address_to_string(&port->address); + if (__address) { + ERROR("Generated a random Ethernet address for %s: %s\n", port->name, __address); + + // Free the address + free(__address); + } + return 0; } @@ -490,7 +500,7 @@ static int nw_port_create_link(nw_port* port) { // XXX Set common things like MTU, etc. - // Set MAC address + // Set Ethernet address r = sd_netlink_message_append_ether_addr(m, IFLA_ADDRESS, &port->address); if (r < 0) { ERROR("Could not set MAC address: %s\n", strerror(-r));