naccyde / rpms / systemd

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