[systemd-commits] man/systemd.link.xml src/udev

Tom Gundersen tomegun at kemper.freedesktop.org
Thu Feb 5 23:37:19 PST 2015


 man/systemd.link.xml       |    5 ++++-
 src/udev/net/link-config.c |   10 ++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 1c25683e0f40c6169676cc44fa1897082597feec
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Feb 6 08:36:17 2015 +0100

    udev: net_setup - clarify reason for failure of persistent mac address policy

diff --git a/man/systemd.link.xml b/man/systemd.link.xml
index 2cfe710..d5c8b99 100644
--- a/man/systemd.link.xml
+++ b/man/systemd.link.xml
@@ -216,7 +216,10 @@
                 nothing is done. Otherwise, a new MAC address is
                 generated which is guaranteed to be the same on every
                 boot for the given machine and the given device, but
-                which is otherwise random.</para>
+                which is otherwise random. This feature depends on ID_NET_NAME_*
+                properties existing for the link, on hardware where these
+                properties are not set the generation of a persistent mac address
+                will fail.</para>
               </listitem>
             </varlistentry>
             <varlistentry>
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index ad5b956..8b3dc45 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -438,9 +438,10 @@ int link_config_apply(link_config_ctx *ctx, link_config *config,
                 case MACPOLICY_PERSISTENT:
                         if (mac_is_random(device)) {
                                 r = get_mac(device, false, &generated_mac);
-                                if (r == -ENOENT)
+                                if (r == -ENOENT) {
+                                        log_warning_errno(r, "Could not generate persistent MAC address for %s: %m", old_name);
                                         break;
-                                else if (r < 0)
+                                } else if (r < 0)
                                         return r;
                                 mac = &generated_mac;
                         }
@@ -448,9 +449,10 @@ int link_config_apply(link_config_ctx *ctx, link_config *config,
                 case MACPOLICY_RANDOM:
                         if (!mac_is_random(device)) {
                                 r = get_mac(device, true, &generated_mac);
-                                if (r == -ENOENT)
+                                if (r == -ENOENT) {
+                                        log_warning_errno(r, "Could not generate random MAC address for %s: %m", old_name);
                                         break;
-                                else if (r < 0)
+                                } else if (r < 0)
                                         return r;
                                 mac = &generated_mac;
                         }



More information about the systemd-commits mailing list