ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
da2bf9
From f0b11f5042489c85d5016eceff06647bb49d486a Mon Sep 17 00:00:00 2001
da2bf9
From: Yu Watanabe <watanabe.yu+github@gmail.com>
da2bf9
Date: Tue, 17 Dec 2019 15:32:22 +0900
da2bf9
Subject: [PATCH] udev: do not fail if kernel does not support alternative
da2bf9
 names
da2bf9
da2bf9
(cherry picked from commit bb181dd4a664ca8e82a8f7194261fd6531e861d8)
da2bf9
da2bf9
Related: #2005008
da2bf9
---
da2bf9
 man/systemd.link.xml       | 3 ++-
da2bf9
 src/udev/net/link-config.c | 4 +++-
da2bf9
 2 files changed, 5 insertions(+), 2 deletions(-)
da2bf9
da2bf9
diff --git a/man/systemd.link.xml b/man/systemd.link.xml
da2bf9
index 0b0d83349d..c8ebb751ee 100644
da2bf9
--- a/man/systemd.link.xml
da2bf9
+++ b/man/systemd.link.xml
da2bf9
@@ -348,7 +348,8 @@
da2bf9
         <listitem>
da2bf9
           <para>The alternative interface name to use. This option can be specified multiple times.
da2bf9
           If the empty string is assigned to this option, the list is reset, and all prior assignments
da2bf9
-          have no effect.</para>
da2bf9
+          have no effect. If the kernel does not support the alternative names, then this setting will
da2bf9
+          be ignored.</para>
da2bf9
         </listitem>
da2bf9
       </varlistentry>
da2bf9
       <varlistentry>
da2bf9
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
da2bf9
index 4de8ee7d7e..8e88c8e5c4 100644
da2bf9
--- a/src/udev/net/link-config.c
da2bf9
+++ b/src/udev/net/link-config.c
da2bf9
@@ -474,7 +474,9 @@ int link_config_apply(link_config_ctx *ctx, link_config *config,
da2bf9
                 return log_warning_errno(r, "Could not set Alias=, MACAddress= or MTU= on %s: %m", old_name);
da2bf9
 
da2bf9
         r = rtnl_set_link_alternative_names(&ctx->rtnl, ifindex, config->alternative_names);
da2bf9
-        if (r < 0)
da2bf9
+        if (r == -EOPNOTSUPP)
da2bf9
+                log_debug_errno(r, "Could not set AlternativeName= on %s, ignoring: %m", old_name);
da2bf9
+        else if (r < 0)
da2bf9
                 return log_warning_errno(r, "Could not set AlternativeName= on %s: %m", old_name);
da2bf9
 
da2bf9
         *name = new_name;