]> git.ipfire.org Git - network.git/commitdiff
ports: Log when we created a random Ethernet address
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 4 Jun 2023 17:19:19 +0000 (17:19 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 4 Jun 2023 17:19:19 +0000 (17:19 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/networkd/port.c

index dfce5b6afd18b655818e60e40515ab9aa7543868..d5ffe42c890da7fa221bec29ea2f18420d7f482d 100644 (file)
@@ -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));