]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #11382 from keszybz/udev-predictable-macs
authorLennart Poettering <lennart@poettering.net>
Fri, 15 Feb 2019 10:31:25 +0000 (11:31 +0100)
committerGitHub <noreply@github.com>
Fri, 15 Feb 2019 10:31:25 +0000 (11:31 +0100)
Allow MACAddressPolicy=persistent for all virtual devices

1  2 
src/libsystemd-network/network-internal.c

index 0348e7fa9dabe93ce39f2bddc8c5f1c5300afa8b,9e7838527c59fcb85ca0622e2fb06ac6121648f0..a0209caf3a8163417e3eb2f04bf930a77cd09863
@@@ -46,15 -47,21 +47,21 @@@ int net_get_unique_predictable_data(sd_
  
          assert(device);
  
+         /* net_get_name() will return one of the device names based on stable information about the
+          * device. If this is not available, we fall back to using the device name. */
          name = net_get_name(device);
          if (!name)
-                 return -ENOENT;
+                 (void) sd_device_get_sysname(device, &name);
+         if (!name)
+                 return log_device_debug_errno(device, SYNTHETIC_ERRNO(ENODATA),
+                                               "No stable identifying information found");
  
+         log_device_debug(device, "Using \"%s\" as stable identifying information", name);
          l = strlen(name);
          sz = sizeof(sd_id128_t) + l;
 -        v = alloca(sz);
 +        v = newa(uint8_t, sz);
  
-         /* fetch some persistent data unique to this machine */
+         /* Fetch some persistent data unique to this machine */
          r = sd_id128_get_machine((sd_id128_t*) v);
          if (r < 0)
                   return r;