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