]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #19898 from yuwata/network-multipath-route-without-interface-name
authorLuca Boccassi <luca.boccassi@microsoft.com>
Mon, 14 Jun 2021 13:27:50 +0000 (14:27 +0100)
committerGitHub <noreply@github.com>
Mon, 14 Jun 2021 13:27:50 +0000 (14:27 +0100)
network: set link ifindex when multi-path routes specified without interface name

30 files changed:
docs/DISCOVERABLE_PARTITIONS.md
man/journal-upload.conf.xml
src/journal-remote/journal-upload.c
src/libsystemd-network/dhcp-identifier.c
src/libsystemd-network/dhcp-identifier.h
src/libsystemd-network/dhcp-internal.h
src/libsystemd-network/dhcp6-internal.h
src/libsystemd-network/fuzz-dhcp6-client.c
src/libsystemd-network/sd-dhcp-client.c
src/libsystemd-network/sd-dhcp6-client.c
src/libsystemd-network/test-dhcp-client.c
src/libsystemd-network/test-dhcp6-client.c
src/libsystemd/libsystemd.sym
src/libsystemd/sd-device/sd-device.c
src/libsystemd/sd-netlink/netlink-util.c
src/libsystemd/sd-netlink/netlink-util.h
src/network/networkctl.c
src/network/networkd-link.c
src/network/networkd-manager-bus.c
src/network/networkd-route.c
src/nspawn/nspawn-network.c
src/resolve/resolvectl.c
src/shared/socket-netlink.c
src/shared/socket-netlink.h
src/systemd/sd-device.h
test/TEST-17-UDEV/test.sh
test/test-functions
test/test-network/conf/25-bridge-configure-without-carrier.network
test/test-network/conf/25-test1.network
test/test-network/systemd-networkd-tests.py

index 656a516f971f402b6f627692c1526e80484bae57..f015578a2d0c37661940739bd10332b501f01892 100644 (file)
@@ -221,11 +221,11 @@ We are not. `/etc/fstab` always overrides automatic discovery and is indeed
 mentioned in the specifications.  We are simply trying to make the boot and
 installation processes of Linux a bit more robust and self-descriptive.
 
-### Why did you only define the root partition for x86, x86-64, ARM, ARM64, ia64?
+### Why did you only define the root partition for x86, x86-64, ARM, ARM64, ia64, riscv32, riscv64?
 
 The automatic discovery of the root partition is defined to operate on the disk
 containing the current EFI System Partition (ESP). Since EFI only exists on
-x86, x86-64, ia64, and ARM so far, we only defined root partition UUIDs for
+x86, x86-64, ia64, ARM and RISC-V so far, we only defined root partition UUIDs for
 these architectures.  Should EFI become more common on other architectures, we
 can define additional UUIDs for them.
 
index 403eb57c69bed7b21e8c9fa38f3afa759071fd2e..a1caae198272b0bebe4d82511bae8be08e4c0b5f 100644 (file)
         <listitem><para>SSL CA certificate.</para></listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term><varname>NetworkTimeoutSec=</varname></term>
+
+        <listitem><para>When network connectivity to the server is lost, this option
+        configures the time to wait for the connectivity to get restored. If the server is
+        not reachable over the network for the configured time, <command>systemd-journal-upload</command>
+        exits. Takes a value in seconds (or in other time units if suffixed with "ms", "min", "h", etc).
+        For details, see <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
+        </para></listitem>
+      </varlistentry>
+
     </variablelist>
 
   </refsect1>
index c3d580e49e4ba2febfb818227423c4718bc1fd0f..2a38d206ea16aa3c01ebb4e9a86befa71c1a05c2 100644 (file)
@@ -53,6 +53,7 @@ static const char *arg_machine = NULL;
 static bool arg_merge = false;
 static int arg_follow = -1;
 static const char *arg_save_state = NULL;
+static usec_t arg_network_timeout_usec = USEC_INFINITY;
 
 static void close_fd_input(Uploader *u);
 
@@ -211,6 +212,12 @@ int start_upload(Uploader *u,
                         return log_error_errno(SYNTHETIC_ERRNO(ENOSR),
                                                "Call to curl_easy_init failed.");
 
+                /* If configured, set a timeout for the curl operation. */
+                if (arg_network_timeout_usec != USEC_INFINITY)
+                        easy_setopt(curl, CURLOPT_TIMEOUT,
+                                    (long) DIV_ROUND_UP(arg_network_timeout_usec, USEC_PER_SEC),
+                                    LOG_ERR, return -EXFULL);
+
                 /* tell it to POST to the URL */
                 easy_setopt(curl, CURLOPT_POST, 1L,
                             LOG_ERR, return -EXFULL);
@@ -561,10 +568,11 @@ finalize:
 
 static int parse_config(void) {
         const ConfigTableItem items[] = {
-                { "Upload",  "URL",                    config_parse_string,         0, &arg_url    },
-                { "Upload",  "ServerKeyFile",          config_parse_path_or_ignore, 0, &arg_key    },
-                { "Upload",  "ServerCertificateFile",  config_parse_path_or_ignore, 0, &arg_cert   },
-                { "Upload",  "TrustedCertificateFile", config_parse_path_or_ignore, 0, &arg_trust  },
+                { "Upload",  "URL",                    config_parse_string,         0, &arg_url                  },
+                { "Upload",  "ServerKeyFile",          config_parse_path_or_ignore, 0, &arg_key                  },
+                { "Upload",  "ServerCertificateFile",  config_parse_path_or_ignore, 0, &arg_cert                 },
+                { "Upload",  "TrustedCertificateFile", config_parse_path_or_ignore, 0, &arg_trust                },
+                { "Upload",  "NetworkTimeoutSec",      config_parse_sec,            0, &arg_network_timeout_usec },
                 {}
         };
 
index 953fef19fa407582c3b8ab037a06561aed3fe14b..3313e53f74ce47838dc1fd68508f9dac1b28d93f 100644 (file)
@@ -12,6 +12,7 @@
 #include "network-util.h"
 #include "siphash24.h"
 #include "sparse-endian.h"
+#include "stat-util.h"
 #include "stdio-util.h"
 #include "udev-util.h"
 #include "virt.h"
@@ -160,37 +161,39 @@ int dhcp_identifier_set_iaid(
                 const uint8_t *mac,
                 size_t mac_len,
                 bool legacy_unstable_byteorder,
+                bool use_mac,
                 void *_id) {
+
         /* name is a pointer to memory in the sd_device struct, so must
          * have the same scope */
         _cleanup_(sd_device_unrefp) sd_device *device = NULL;
         const char *name = NULL;
-        uint64_t id;
         uint32_t id32;
+        uint64_t id;
+        int r;
+
+        if (path_is_read_only_fs("/sys") <= 0 && !use_mac) {
+                /* udev should be around */
+
+                r = sd_device_new_from_ifindex(&device, ifindex);
+                if (r < 0)
+                        return r;
+
+                r = sd_device_get_is_initialized(device);
+                if (r < 0)
+                        return r;
+                if (r == 0)
+                        /* not yet ready */
+                        return -EBUSY;
+
+                r = device_is_renaming(device);
+                if (r < 0)
+                        return r;
+                if (r > 0)
+                        /* device is under renaming */
+                        return -EBUSY;
 
-        if (detect_container() <= 0) {
-                /* not in a container, udev will be around */
-                char ifindex_str[1 + DECIMAL_STR_MAX(int)];
-                int r;
-
-                xsprintf(ifindex_str, "n%d", ifindex);
-                if (sd_device_new_from_device_id(&device, ifindex_str) >= 0) {
-                        r = sd_device_get_is_initialized(device);
-                        if (r < 0)
-                                return r;
-                        if (r == 0)
-                                /* not yet ready */
-                                return -EBUSY;
-
-                        r = device_is_renaming(device);
-                        if (r < 0)
-                                return r;
-                        if (r > 0)
-                                /* device is under renaming */
-                                return -EBUSY;
-
-                        name = net_get_name_persistent(device);
-                }
+                name = net_get_name_persistent(device);
         }
 
         if (name)
index 1d9a9c55ba907124a76f903b94e1acf160b00ca9..6c24af0326a6d4766f697cc99b58d0cf5f3e463e 100644 (file)
@@ -59,4 +59,4 @@ int dhcp_identifier_set_duid_llt(struct duid *duid, usec_t t, const uint8_t *add
 int dhcp_identifier_set_duid_ll(struct duid *duid, const uint8_t *addr, size_t addr_len, uint16_t arp_type, size_t *len);
 int dhcp_identifier_set_duid_en(struct duid *duid, size_t *len);
 int dhcp_identifier_set_duid_uuid(struct duid *duid, size_t *len);
-int dhcp_identifier_set_iaid(int ifindex, const uint8_t *mac, size_t mac_len, bool legacy_unstable_byteorder, void *_id);
+int dhcp_identifier_set_iaid(int ifindex, const uint8_t *mac, size_t mac_len, bool legacy_unstable_byteorder, bool use_mac, void *_id);
index d8c42757aa62f45581fa753dd1141d6f18a1e232..16999971d2a8bb35783be2760ffc0891fd089bb0 100644 (file)
@@ -30,6 +30,8 @@ typedef struct DHCPServerData {
 
 extern const struct hash_ops dhcp_option_hash_ops;
 
+typedef struct sd_dhcp_client sd_dhcp_client;
+
 int dhcp_network_bind_raw_socket(int ifindex, union sockaddr_union *link, uint32_t xid,
                                  const uint8_t *mac_addr, size_t mac_addr_len,
                                  const uint8_t *bcast_addr, size_t bcast_addr_len,
@@ -62,6 +64,8 @@ void dhcp_packet_append_ip_headers(DHCPPacket *packet, be32_t source_addr,
 
 int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum, uint16_t port);
 
+void dhcp_client_set_test_mode(sd_dhcp_client *client, bool test_mode);
+
 /* If we are invoking callbacks of a dhcp-client, ensure unreffing the
  * client from the callback doesn't destroy the object we are working
  * on */
index 34e1f61cb08c1e52e1f6726f22fec0a01fadb6c1..f0f814957f2b661b88ccb08c4e6379ff481b92e2 100644 (file)
@@ -91,6 +91,8 @@ typedef struct DHCP6IA {
         LIST_HEAD(DHCP6Address, addresses);
 } DHCP6IA;
 
+typedef struct sd_dhcp6_client sd_dhcp6_client;
+
 int dhcp6_option_append(uint8_t **buf, size_t *buflen, uint16_t code,
                         size_t optlen, const void *optval);
 int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, const DHCP6IA *ia);
@@ -118,6 +120,8 @@ int dhcp6_message_type_from_string(const char *s) _pure_;
 const char *dhcp6_message_status_to_string(int s) _const_;
 int dhcp6_message_status_from_string(const char *s) _pure_;
 
+void dhcp6_client_set_test_mode(sd_dhcp6_client *client, bool test_mode);
+
 #define log_dhcp6_client_errno(client, error, fmt, ...)         \
         log_interface_prefix_full_errno(                        \
                 "DHCPv6 client: ",                              \
index 7ebe01286da57a97e189e1225805c0ee4bfbbe33..f62ab468df342fd511133f404068a8662cf66f76 100644 (file)
@@ -33,6 +33,7 @@ static void fuzz_client(const uint8_t *data, size_t size, bool is_information_re
         assert_se(sd_dhcp6_client_set_ifindex(client, 42) == 0);
         assert_se(sd_dhcp6_client_set_local_address(client, &address) >= 0);
         assert_se(sd_dhcp6_client_set_information_request(client, is_information_request_enabled) == 0);
+        dhcp6_client_set_test_mode(client, true);
 
         assert_se(sd_dhcp6_client_start(client) >= 0);
 
index a15ff8af33a1e6bfa602e12fb84478f2f55dcddc..ff021f4eae12df82a119b6bd38f0a44e98f78a4c 100644 (file)
@@ -117,6 +117,9 @@ struct sd_dhcp_client {
         sd_dhcp_lease *lease;
         usec_t start_delay;
         int ip_service_type;
+
+        /* Ignore ifindex when generating iaid. See dhcp_identifier_set_iaid(). */
+        bool test_mode;
 };
 
 static const uint8_t default_req_opts[] = {
@@ -466,7 +469,8 @@ static int dhcp_client_set_iaid_duid_internal(
                 else {
                         r = dhcp_identifier_set_iaid(client->ifindex, client->mac_addr,
                                                      client->mac_addr_len,
-                                                     true,
+                                                     /* legacy_unstable_byteorder = */ true,
+                                                     /* use_mac = */ client->test_mode,
                                                      &client->client_id.ns.iaid);
                         if (r < 0)
                                 return log_dhcp_client_errno(client, r, "Failed to set IAID: %m");
@@ -555,6 +559,12 @@ int sd_dhcp_client_set_duid_llt(
         return dhcp_client_set_iaid_duid_internal(client, false, false, 0, DUID_TYPE_LLT, NULL, 0, llt_time);
 }
 
+void dhcp_client_set_test_mode(sd_dhcp_client *client, bool test_mode) {
+        assert(client);
+
+        client->test_mode = test_mode;
+}
+
 int sd_dhcp_client_set_hostname(
                 sd_dhcp_client *client,
                 const char *hostname) {
@@ -860,7 +870,9 @@ static int client_message_init(
                 client->client_id.type = 255;
 
                 r = dhcp_identifier_set_iaid(client->ifindex, client->mac_addr, client->mac_addr_len,
-                                             true, &client->client_id.ns.iaid);
+                                             /* legacy_unstable_byteorder = */ true,
+                                             /* use_mac = */ client->test_mode,
+                                             &client->client_id.ns.iaid);
                 if (r < 0)
                         return r;
 
index 855a61bb216c0a5e7cfa2681c87fc9df366272d1..e8c47f429a57d9919a35d49ede69854d7452a9a0 100644 (file)
@@ -84,6 +84,9 @@ struct sd_dhcp6_client {
         usec_t information_refresh_time_usec;
         OrderedHashmap *extra_options;
         OrderedHashmap *vendor_options;
+
+        /* Ignore ifindex when generating iaid. See dhcp_identifier_set_iaid(). */
+        bool test_mode;
 };
 
 static const uint16_t default_req_opts[] = {
@@ -398,6 +401,12 @@ int sd_dhcp6_client_set_iaid(sd_dhcp6_client *client, uint32_t iaid) {
         return 0;
 }
 
+void dhcp6_client_set_test_mode(sd_dhcp6_client *client, bool test_mode) {
+        assert(client);
+
+        client->test_mode = test_mode;
+}
+
 int sd_dhcp6_client_get_iaid(sd_dhcp6_client *client, uint32_t *iaid) {
         assert_return(client, -EINVAL);
         assert_return(iaid, -EINVAL);
@@ -1073,7 +1082,10 @@ static int client_ensure_iaid(sd_dhcp6_client *client) {
         if (client->iaid_set)
                 return 0;
 
-        r = dhcp_identifier_set_iaid(client->ifindex, client->mac_addr, client->mac_addr_len, true, &iaid);
+        r = dhcp_identifier_set_iaid(client->ifindex, client->mac_addr, client->mac_addr_len,
+                                     /* legacy_unstable_byteorder = */ true,
+                                     /* use_mac = */ client->test_mode,
+                                     &iaid);
         if (r < 0)
                 return r;
 
index b464d3d700a3e6eeab07fb4c3c76995b7ac5a9b0..6e0fdcd769ae5e483e9b0bfe78ce3e4df3c0144f 100644 (file)
@@ -145,20 +145,11 @@ static void test_checksum(void) {
 static void test_dhcp_identifier_set_iaid(void) {
         uint32_t iaid_legacy;
         be32_t iaid;
-        int ifindex;
 
-        for (;;) {
-                char ifname[IFNAMSIZ];
-
-                /* try to find an ifindex which does not exist. I causes dhcp_identifier_set_iaid()
-                 * to hash the MAC address. */
-                pseudo_random_bytes(&ifindex, sizeof(ifindex));
-                if (ifindex > 0 && !if_indextoname(ifindex, ifname))
-                        break;
-        }
-
-        assert_se(dhcp_identifier_set_iaid(ifindex, mac_addr, sizeof(mac_addr), true, &iaid_legacy) >= 0);
-        assert_se(dhcp_identifier_set_iaid(ifindex, mac_addr, sizeof(mac_addr), false, &iaid) >= 0);
+        assert_se(dhcp_identifier_set_iaid(42, mac_addr, sizeof(mac_addr), /* legacy = */ true,
+                                           /* use_mac = */ true, &iaid_legacy) >= 0);
+        assert_se(dhcp_identifier_set_iaid(42, mac_addr, sizeof(mac_addr), /* legacy = */ false,
+                                           /* use_mac = */ true, &iaid) >= 0);
 
         /* we expect, that the MAC address was hashed. The legacy value is in native
          * endianness. */
@@ -180,7 +171,7 @@ static int check_options(uint8_t code, uint8_t len, const void *option, void *us
                 size_t duid_len;
 
                 assert_se(dhcp_identifier_set_duid_en(&duid, &duid_len) >= 0);
-                assert_se(dhcp_identifier_set_iaid(42, mac_addr, ETH_ALEN, true, &iaid) >= 0);
+                assert_se(dhcp_identifier_set_iaid(42, mac_addr, ETH_ALEN, true, /* use_mac = */ true, &iaid) >= 0);
 
                 assert_se(len == sizeof(uint8_t) + sizeof(uint32_t) + duid_len);
                 assert_se(len == 19);
@@ -299,6 +290,7 @@ static void test_discover_message(sd_event *e) {
 
         assert_se(sd_dhcp_client_set_ifindex(client, 42) >= 0);
         assert_se(sd_dhcp_client_set_mac(client, mac_addr, bcast_addr, ETH_ALEN, ARPHRD_ETHER) >= 0);
+        dhcp_client_set_test_mode(client, true);
 
         assert_se(sd_dhcp_client_set_request_option(client, 248) >= 0);
 
@@ -516,6 +508,7 @@ static void test_addr_acq(sd_event *e) {
 
         assert_se(sd_dhcp_client_set_ifindex(client, 42) >= 0);
         assert_se(sd_dhcp_client_set_mac(client, mac_addr, bcast_addr, ETH_ALEN, ARPHRD_ETHER) >= 0);
+        dhcp_client_set_test_mode(client, true);
 
         assert_se(sd_dhcp_client_set_callback(client, test_addr_acq_acquired, e) >= 0);
 
index 5d0c5ed2a21624a4602520e80e7c2bc733585885..a72c13684dea6512061fe81efbb5863502f9644f 100644 (file)
@@ -13,6 +13,7 @@
 #include "sd-dhcp6-client.h"
 #include "sd-event.h"
 
+#include "dhcp-identifier.h"
 #include "dhcp6-internal.h"
 #include "dhcp6-lease-internal.h"
 #include "dhcp6-protocol.h"
@@ -24,7 +25,6 @@
 #include "strv.h"
 #include "tests.h"
 #include "time-util.h"
-#include "virt.h"
 
 static struct ether_addr mac_addr = {
         .ether_addr_octet = {'A', 'B', 'C', '1', '2', '3'}
@@ -952,6 +952,7 @@ static int test_client_solicit(sd_event *e) {
                                           sizeof (mac_addr),
                                           ARPHRD_ETHER) >= 0);
         assert_se(sd_dhcp6_client_set_fqdn(client, "host.lab.intra") == 1);
+        dhcp6_client_set_test_mode(client, true);
 
         assert_se(sd_dhcp6_client_get_information_request(client, &val) >= 0);
         assert_se(val == 0);
index 1606981e1e16de63215f4dff9509e404ebce3ca8..3730db6eef9d7405e001870ceb9c86f670b4e423 100644 (file)
@@ -759,4 +759,6 @@ global:
         sd_device_get_usec_initialized;
         sd_device_trigger_with_uuid;
         sd_device_get_trigger_uuid;
+        sd_device_new_from_ifname;
+        sd_device_new_from_ifindex;
 } LIBSYSTEMD_248;
index f31416da530247bf5cfc92db4652a3460267bf86..b5e7a1a44d1014d05a86fb4330d0add0c751547c 100644 (file)
 #include "dirent-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "hashmap.h"
 #include "id128-util.h"
 #include "macro.h"
+#include "netlink-util.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "set.h"
@@ -245,6 +247,52 @@ _public_ int sd_device_new_from_devnum(sd_device **ret, char type, dev_t devnum)
         return sd_device_new_from_syspath(ret, syspath);
 }
 
+static int device_new_from_main_ifname(sd_device **ret, const char *ifname) {
+        const char *syspath;
+
+        assert(ret);
+        assert(ifname);
+
+        syspath = strjoina("/sys/class/net/", ifname);
+        return sd_device_new_from_syspath(ret, syspath);
+}
+
+_public_ int sd_device_new_from_ifname(sd_device **ret, const char *ifname) {
+        _cleanup_free_ char *main_name = NULL;
+        int r;
+
+        assert_return(ret, -EINVAL);
+        assert_return(ifname, -EINVAL);
+
+        r = parse_ifindex(ifname);
+        if (r > 0)
+                return sd_device_new_from_ifindex(ret, r);
+
+        if (ifname_valid(ifname)) {
+                r = device_new_from_main_ifname(ret, ifname);
+                if (r >= 0)
+                        return r;
+        }
+
+        r = rtnl_resolve_link_alternative_name(NULL, ifname, &main_name);
+        if (r < 0)
+                return r;
+
+        return device_new_from_main_ifname(ret, main_name);
+}
+
+_public_ int sd_device_new_from_ifindex(sd_device **ret, int ifindex) {
+        char ifname[IF_NAMESIZE + 1];
+
+        assert_return(ret, -EINVAL);
+        assert_return(ifindex > 0, -EINVAL);
+
+        if (!format_ifname(ifindex, ifname))
+                return -ENODEV;
+
+        return device_new_from_main_ifname(ret, ifname);
+}
+
 static int device_strjoin_new(
                 const char *a,
                 const char *b,
@@ -643,37 +691,13 @@ _public_ int sd_device_new_from_device_id(sd_device **ret, const char *id) {
         }
 
         case 'n': {
-                _cleanup_(sd_device_unrefp) sd_device *device = NULL;
-                _cleanup_close_ int sk = -1;
-                struct ifreq ifr = {};
                 int ifindex;
 
-                r = ifr.ifr_ifindex = parse_ifindex(id + 1);
-                if (r < 0)
-                        return r;
+                ifindex = parse_ifindex(id + 1);
+                if (ifindex < 0)
+                        return ifindex;
 
-                sk = socket_ioctl_fd();
-                if (sk < 0)
-                        return sk;
-
-                r = ioctl(sk, SIOCGIFNAME, &ifr);
-                if (r < 0)
-                        return -errno;
-
-                r = sd_device_new_from_subsystem_sysname(&device, "net", ifr.ifr_name);
-                if (r < 0)
-                        return r;
-
-                r = sd_device_get_ifindex(device, &ifindex);
-                if (r < 0)
-                        return r;
-
-                /* this is racey, so we might end up with the wrong device */
-                if (ifr.ifr_ifindex != ifindex)
-                        return -ENODEV;
-
-                *ret = TAKE_PTR(device);
-                return 0;
+                return sd_device_new_from_ifindex(ret, ifindex);
         }
 
         case '+': {
index 868763bb9c0c7b318fd3640f231458e7a2608976..1211145fbf84a7c8820a92399b7a699d2a2fd603 100644 (file)
@@ -6,6 +6,7 @@
 #include "memory-util.h"
 #include "netlink-internal.h"
 #include "netlink-util.h"
+#include "parse-util.h"
 #include "strv.h"
 
 int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) {
@@ -266,13 +267,18 @@ int rtnl_set_link_alternative_names_by_ifname(sd_netlink **rtnl, const char *ifn
         return 0;
 }
 
-int rtnl_resolve_link_alternative_name(sd_netlink **rtnl, const char *name) {
+int rtnl_resolve_link_alternative_name(sd_netlink **rtnl, const char *name, char **ret) {
         _cleanup_(sd_netlink_unrefp) sd_netlink *our_rtnl = NULL;
         _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL, *reply = NULL;
-        int r, ret;
+        int r, ifindex;
 
         assert(name);
 
+        /* This returns ifindex and the main interface name. */
+
+        if (!ifname_valid_full(name, IFNAME_VALID_ALTERNATIVE))
+                return -EINVAL;
+
         if (!rtnl)
                 rtnl = &our_rtnl;
         if (!*rtnl) {
@@ -295,11 +301,56 @@ int rtnl_resolve_link_alternative_name(sd_netlink **rtnl, const char *name) {
         if (r < 0)
                 return r;
 
-        r = sd_rtnl_message_link_get_ifindex(reply, &ret);
+        r = sd_rtnl_message_link_get_ifindex(reply, &ifindex);
         if (r < 0)
                 return r;
-        assert(ret > 0);
-        return ret;
+        assert(ifindex > 0);
+
+        if (ret) {
+                r = sd_netlink_message_read_string_strdup(message, IFLA_IFNAME, ret);
+                if (r < 0)
+                        return r;
+        }
+
+        return ifindex;
+}
+
+int rtnl_resolve_ifname(sd_netlink **rtnl, const char *name) {
+        int r;
+
+        /* Like if_nametoindex, but resolves "alternative names" too. */
+
+        assert(name);
+
+        r = if_nametoindex(name);
+        if (r > 0)
+                return r;
+
+        return rtnl_resolve_link_alternative_name(rtnl, name, NULL);
+}
+
+int rtnl_resolve_interface(sd_netlink **rtnl, const char *name) {
+        int r;
+
+        /* Like rtnl_resolve_ifname, but resolves interface numbers too. */
+
+        assert(name);
+
+        r = parse_ifindex(name);
+        if (r > 0)
+                return r;
+        assert(r < 0);
+
+        return rtnl_resolve_ifname(rtnl, name);
+}
+
+int rtnl_resolve_interface_or_warn(sd_netlink **rtnl, const char *name) {
+        int r;
+
+        r = rtnl_resolve_interface(rtnl, name);
+        if (r < 0)
+                return log_error_errno(r, "Failed to resolve interface \"%s\": %m", name);
+        return r;
 }
 
 int rtnl_get_link_info(sd_netlink **rtnl, int ifindex, unsigned short *ret_iftype, unsigned *ret_flags) {
index c676c07135e7ddc8cb01917f987bdb4c69abf0fe..a5d725655dd4cce280bb7b175b854be7b0ab3062 100644 (file)
@@ -91,7 +91,10 @@ int rtnl_get_link_alternative_names(sd_netlink **rtnl, int ifindex, char ***ret)
 int rtnl_set_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const *alternative_names);
 int rtnl_set_link_alternative_names_by_ifname(sd_netlink **rtnl, const char *ifname, char * const *alternative_names);
 int rtnl_delete_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const *alternative_names);
-int rtnl_resolve_link_alternative_name(sd_netlink **rtnl, const char *name);
+int rtnl_resolve_link_alternative_name(sd_netlink **rtnl, const char *name, char **ret);
+int rtnl_resolve_ifname(sd_netlink **rtnl, const char *name);
+int rtnl_resolve_interface(sd_netlink **rtnl, const char *name);
+int rtnl_resolve_interface_or_warn(sd_netlink **rtnl, const char *name);
 int rtnl_get_link_info(sd_netlink **rtnl, int ifindex, unsigned short *ret_iftype, unsigned *ret_flags);
 
 int rtnl_log_parse_error(int r);
index a3ba15672b498368891987a051ba651ae33ce0a4..1c2cb7691a42a965b0bd47ce1aa66529bf44f5d1 100644 (file)
@@ -753,9 +753,7 @@ static int acquire_link_info(sd_bus *bus, sd_netlink *rtnl, char **patterns, Lin
 
                 links[c].needs_freeing = true;
 
-                char devid[2 + DECIMAL_STR_MAX(int)];
-                xsprintf(devid, "n%i", links[c].ifindex);
-                (void) sd_device_new_from_device_id(&links[c].sd_device, devid);
+                (void) sd_device_new_from_ifindex(&links[c].sd_device, links[c].ifindex);
 
                 acquire_ether_link_info(&fd, &links[c]);
                 acquire_wlan_link_info(&links[c]);
@@ -2665,7 +2663,7 @@ static int link_up_down(int argc, char *argv[], void *userdata) {
                 return log_oom();
 
         for (int i = 1; i < argc; i++) {
-                index = resolve_interface_or_warn(&rtnl, argv[i]);
+                index = rtnl_resolve_interface_or_warn(&rtnl, argv[i]);
                 if (index < 0)
                         return index;
 
@@ -2703,7 +2701,7 @@ static int link_delete(int argc, char *argv[], void *userdata) {
                 return log_oom();
 
         for (int i = 1; i < argc; i++) {
-                index = resolve_interface_or_warn(&rtnl, argv[i]);
+                index = rtnl_resolve_interface_or_warn(&rtnl, argv[i]);
                 if (index < 0)
                         return index;
 
@@ -2748,7 +2746,7 @@ static int link_renew(int argc, char *argv[], void *userdata) {
                 return log_error_errno(r, "Failed to connect system bus: %m");
 
         for (int i = 1; i < argc; i++) {
-                index = resolve_interface_or_warn(&rtnl, argv[i]);
+                index = rtnl_resolve_interface_or_warn(&rtnl, argv[i]);
                 if (index < 0)
                         return index;
 
@@ -2782,7 +2780,7 @@ static int link_force_renew(int argc, char *argv[], void *userdata) {
                 return log_error_errno(r, "Failed to connect system bus: %m");
 
         for (int i = 1; i < argc; i++) {
-                int index = resolve_interface_or_warn(&rtnl, argv[i]);
+                int index = rtnl_resolve_interface_or_warn(&rtnl, argv[i]);
                 if (index < 0)
                         return index;
 
@@ -2827,7 +2825,7 @@ static int verb_reconfigure(int argc, char *argv[], void *userdata) {
                 return log_oom();
 
         for (int i = 1; i < argc; i++) {
-                index = resolve_interface_or_warn(&rtnl, argv[i]);
+                index = rtnl_resolve_interface_or_warn(&rtnl, argv[i]);
                 if (index < 0)
                         return index;
 
index 911fb9b302c2581d1b99f3df261aa5a101ddc1d1..f603058ea03e20c9ed9908ec5d5936c23675ec72 100644 (file)
@@ -469,46 +469,49 @@ void link_check_ready(Link *link) {
         if (!link->sr_iov_configured)
                 return (void) log_link_debug(link, "%s(): SR-IOV is not configured.", __func__);
 
-        if (link_has_carrier(link) || !link->network->configure_without_carrier) {
-                bool has_ndisc_address = false;
-                NDiscAddress *n;
-
-                if (link_ipv6ll_enabled(link) && !in6_addr_is_set(&link->ipv6ll_address))
-                        return (void) log_link_debug(link, "%s(): IPv6LL is not configured yet.", __func__);
-
-                SET_FOREACH(n, link->ndisc_addresses)
-                        if (!n->marked) {
-                                has_ndisc_address = true;
-                                break;
-                        }
+        /* IPv6LL is assigned after the link gains its carrier. */
+        if (!link->network->configure_without_carrier &&
+            link_ipv6ll_enabled(link) &&
+            !in6_addr_is_set(&link->ipv6ll_address))
+                return (void) log_link_debug(link, "%s(): IPv6LL is not configured yet.", __func__);
+
+        bool has_ndisc_address = false;
+        NDiscAddress *n;
+        SET_FOREACH(n, link->ndisc_addresses)
+                if (!n->marked) {
+                        has_ndisc_address = true;
+                        break;
+                }
 
-                if ((link_dhcp4_enabled(link) || link_dhcp6_with_address_enabled(link) || link_ipv4ll_enabled(link)) &&
-                    !link->dhcp_address && set_isempty(link->dhcp6_addresses) && !has_ndisc_address &&
+        if ((link_dhcp4_enabled(link) || link_dhcp6_with_address_enabled(link) || link_ipv4ll_enabled(link)) &&
+            !link->dhcp_address && set_isempty(link->dhcp6_addresses) && !has_ndisc_address &&
+            !link->ipv4ll_address_configured)
+                /* When DHCP[46] or IPv4LL is enabled, at least one address is acquired by them. */
+                return (void) log_link_debug(link, "%s(): DHCP4, DHCP6 or IPv4LL is enabled but no dynamic address is assigned yet.", __func__);
+
+        /* Ignore NDisc when ConfigureWithoutCarrier= is enabled, as IPv6AcceptRA= is enabled by default. */
+        if (link_dhcp4_enabled(link) || link_dhcp6_enabled(link) || link_dhcp6_pd_is_enabled(link) ||
+            (!link->network->configure_without_carrier && link_ipv6_accept_ra_enabled(link)) ||
+            link_ipv4ll_enabled(link)) {
+
+                if (!link->dhcp4_configured &&
+                    !(link->dhcp6_address_configured && link->dhcp6_route_configured) &&
+                    !(link->dhcp6_pd_address_configured && link->dhcp6_pd_route_configured) &&
+                    !(link->ndisc_addresses_configured && link->ndisc_routes_configured) &&
                     !link->ipv4ll_address_configured)
-                        /* When DHCP[46] or IPv4LL is enabled, at least one address is acquired by them. */
-                        return (void) log_link_debug(link, "%s(): DHCP4, DHCP6 or IPv4LL is enabled but no dynamic address is assigned yet.", __func__);
-
-                if (link_dhcp4_enabled(link) || link_dhcp6_enabled(link) || link_dhcp6_pd_is_enabled(link) ||
-                    link_ipv6_accept_ra_enabled(link) || link_ipv4ll_enabled(link)) {
-                        if (!link->dhcp4_configured &&
-                            !(link->dhcp6_address_configured && link->dhcp6_route_configured) &&
-                            !(link->dhcp6_pd_address_configured && link->dhcp6_pd_route_configured) &&
-                            !(link->ndisc_addresses_configured && link->ndisc_routes_configured) &&
-                            !link->ipv4ll_address_configured)
-                                /* When DHCP[46], NDisc, or IPv4LL is enabled, at least one protocol must be finished. */
-                                return (void) log_link_debug(link, "%s(): dynamic addresses or routes are not configured.", __func__);
-
-                        log_link_debug(link, "%s(): dhcp4:%s ipv4ll:%s dhcp6_addresses:%s dhcp_routes:%s dhcp_pd_addresses:%s dhcp_pd_routes:%s ndisc_addresses:%s ndisc_routes:%s",
-                                       __func__,
-                                       yes_no(link->dhcp4_configured),
-                                       yes_no(link->ipv4ll_address_configured),
-                                       yes_no(link->dhcp6_address_configured),
-                                       yes_no(link->dhcp6_route_configured),
-                                       yes_no(link->dhcp6_pd_address_configured),
-                                       yes_no(link->dhcp6_pd_route_configured),
-                                       yes_no(link->ndisc_addresses_configured),
-                                       yes_no(link->ndisc_routes_configured));
-                }
+                        /* When DHCP[46], NDisc, or IPv4LL is enabled, at least one protocol must be finished. */
+                        return (void) log_link_debug(link, "%s(): dynamic addresses or routes are not configured.", __func__);
+
+                log_link_debug(link, "%s(): dhcp4:%s ipv4ll:%s dhcp6_addresses:%s dhcp_routes:%s dhcp_pd_addresses:%s dhcp_pd_routes:%s ndisc_addresses:%s ndisc_routes:%s",
+                               __func__,
+                               yes_no(link->dhcp4_configured),
+                               yes_no(link->ipv4ll_address_configured),
+                               yes_no(link->dhcp6_address_configured),
+                               yes_no(link->dhcp6_route_configured),
+                               yes_no(link->dhcp6_pd_address_configured),
+                               yes_no(link->dhcp6_pd_route_configured),
+                               yes_no(link->ndisc_addresses_configured),
+                               yes_no(link->ndisc_routes_configured));
         }
 
         link_set_state(link, LINK_STATE_CONFIGURED);
@@ -1394,7 +1397,6 @@ static int link_initialized(Link *link, sd_device *device) {
 
 static int link_check_initialized(Link *link) {
         _cleanup_(sd_device_unrefp) sd_device *device = NULL;
-        char ifindex_str[2 + DECIMAL_STR_MAX(int)];
         int r;
 
         assert(link);
@@ -1404,8 +1406,7 @@ static int link_check_initialized(Link *link) {
                 return link_initialized_and_synced(link);
 
         /* udev should be around */
-        xsprintf(ifindex_str, "n%d", link->ifindex);
-        r = sd_device_new_from_device_id(&device, ifindex_str);
+        r = sd_device_new_from_ifindex(&device, link->ifindex);
         if (r < 0) {
                 log_link_debug_errno(link, r, "Could not find device, waiting for device initialization: %m");
                 return 0;
@@ -2038,6 +2039,8 @@ static int link_update_mtu(Link *link, sd_netlink_message *message) {
                 return 0;
         if (r < 0)
                 return log_link_debug_errno(link, r, "rtnl: failed to read MTU in RTM_NEWLINK message: %m");
+        if (mtu == 0)
+                return 0;
 
         r = sd_netlink_message_read_u32(message, IFLA_MIN_MTU, &min_mtu);
         if (r < 0 && r != -ENODATA)
@@ -2047,9 +2050,6 @@ static int link_update_mtu(Link *link, sd_netlink_message *message) {
         if (r < 0 && r != -ENODATA)
                 return log_link_debug_errno(link, r, "rtnl: failed to read maximum MTU in RTM_NEWLINK message: %m");
 
-        if (mtu == 0)
-                return 0;
-
         if (max_mtu == 0)
                 max_mtu = UINT32_MAX;
 
@@ -2065,8 +2065,9 @@ static int link_update_mtu(Link *link, sd_netlink_message *message) {
         if (link->mtu == mtu)
                 return 0;
 
-        log_link_debug(link, "MTU is changed: %"PRIu32" → %"PRIu32" (min: %"PRIu32", max: %"PRIu32")",
-                       link->mtu, mtu, link->min_mtu, link->max_mtu);
+        if (link->mtu != 0)
+                log_link_debug(link, "MTU is changed: %"PRIu32" → %"PRIu32" (min: %"PRIu32", max: %"PRIu32")",
+                               link->mtu, mtu, link->min_mtu, link->max_mtu);
 
         link->mtu = mtu;
 
index 1c6230b393235870253397717ca37b7e878bc906..4be09d98d84fbe162ef70b499fdbbf64683d3ea0 100644 (file)
@@ -14,7 +14,6 @@
 #include "networkd-manager-bus.h"
 #include "networkd-manager.h"
 #include "path-util.h"
-#include "socket-netlink.h"
 #include "strv.h"
 #include "user-util.h"
 
@@ -60,19 +59,14 @@ static int method_get_link_by_name(sd_bus_message *message, void *userdata, sd_b
         _cleanup_free_ char *path = NULL;
         Manager *manager = userdata;
         const char *name;
-        int index, r;
         Link *link;
+        int r;
 
         r = sd_bus_message_read(message, "s", &name);
         if (r < 0)
                 return r;
 
-        index = resolve_ifname(&manager->rtnl, name);
-        if (index < 0)
-                return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_LINK, "Link %s cannot be resolved", name);
-
-        link = hashmap_get(manager->links, INT_TO_PTR(index));
-        if (!link)
+        if (link_get_by_name(manager, name, &link) < 0)
                 return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_LINK, "Link %s not known", name);
 
         r = sd_bus_message_new_method_return(message, &reply);
index 427856ac26233da1ca65361a3ec3123f01e17cf4..2893c0949d57c4240ab9539459171f9496af34d4 100644 (file)
@@ -13,7 +13,6 @@
 #include "networkd-queue.h"
 #include "networkd-route.h"
 #include "parse-util.h"
-#include "socket-netlink.h"
 #include "string-table.h"
 #include "string-util.h"
 #include "strv.h"
@@ -708,13 +707,10 @@ int link_has_route(Link *link, const Route *route) {
                 Link *l;
 
                 if (m->ifname) {
-                        r = resolve_interface(&link->manager->rtnl, m->ifname);
-                        if (r < 0)
+                        if (link_get_by_name(link->manager, m->ifname, &l) < 0)
                                 return false;
-                        m->ifindex = r;
 
-                        if (link_get(link->manager, m->ifindex, &l) < 0)
-                                return false;
+                        m->ifindex = l->ifindex;
                 } else
                         l = link;
 
index 95e4b0213b5615331b2364650c35d57358c66f25..023b1e7e1a81b96c476e71f8f543f3ba5a19200b 100644 (file)
@@ -272,7 +272,7 @@ int setup_veth(const char *machine_name,
         if (r < 0)
                 return r;
 
-        u = if_nametoindex(n); /* We don't need to use resolve_ifname() here because the
+        u = if_nametoindex(n); /* We don't need to use rtnl_resolve_ifname() here because the
                                 * name we assigned is always the main name. */
         if (u == 0)
                 return log_error_errno(errno, "Failed to resolve interface %s: %m", n);
@@ -330,7 +330,7 @@ static int join_bridge(sd_netlink *rtnl, const char *veth_name, const char *brid
         assert(veth_name);
         assert(bridge_name);
 
-        bridge_ifi = resolve_interface(&rtnl, bridge_name);
+        bridge_ifi = rtnl_resolve_interface(&rtnl, bridge_name);
         if (bridge_ifi < 0)
                 return bridge_ifi;
 
@@ -467,20 +467,14 @@ int remove_bridge(const char *bridge_name) {
 
 int test_network_interface_initialized(const char *name) {
         _cleanup_(sd_device_unrefp) sd_device *d = NULL;
-        int ifi, r;
-        char ifi_str[2 + DECIMAL_STR_MAX(int)];
+        int r;
 
-        if (path_is_read_only_fs("/sys"))
+        if (path_is_read_only_fs("/sys") > 0)
                 return 0;
 
         /* udev should be around. */
 
-        ifi = resolve_interface_or_warn(NULL, name);
-        if (ifi < 0)
-                return ifi;
-
-        sprintf(ifi_str, "n%i", ifi);
-        r = sd_device_new_from_device_id(&d, ifi_str);
+        r = sd_device_new_from_ifname(&d, name);
         if (r < 0)
                 return log_error_errno(r, "Failed to get device %s: %m", name);
 
@@ -515,7 +509,7 @@ int move_network_interfaces(int netns_fd, char **ifaces) {
                 _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
                 int ifi;
 
-                ifi = resolve_interface_or_warn(&rtnl, *i);
+                ifi = rtnl_resolve_interface_or_warn(&rtnl, *i);
                 if (ifi < 0)
                         return ifi;
 
@@ -554,7 +548,7 @@ int setup_macvlan(const char *machine_name, pid_t pid, char **ifaces) {
                 struct ether_addr mac;
                 int ifi;
 
-                ifi = resolve_interface_or_warn(&rtnl, *i);
+                ifi = rtnl_resolve_interface_or_warn(&rtnl, *i);
                 if (ifi < 0)
                         return ifi;
 
@@ -640,7 +634,7 @@ int setup_ipvlan(const char *machine_name, pid_t pid, char **ifaces) {
                 _cleanup_free_ char *n = NULL, *a = NULL;
                 int ifi;
 
-                ifi = resolve_interface_or_warn(&rtnl, *i);
+                ifi = rtnl_resolve_interface_or_warn(&rtnl, *i);
                 if (ifi < 0)
                         return ifi;
 
index e652c82ffcb19d3d2253c19eb7f9e45b3c8e07f2..23f4ff1077b83629639a7d4503bb0f1a4966b31e 100644 (file)
@@ -119,7 +119,7 @@ int ifname_mangle(const char *s) {
         if (!iface)
                 return log_oom();
 
-        ifi = resolve_interface(NULL, iface);
+        ifi = rtnl_resolve_interface(NULL, iface);
         if (ifi < 0) {
                 if (ifi == -ENODEV && arg_ifindex_permissive) {
                         log_debug("Interface '%s' not found, but -f specified, ignoring.", iface);
@@ -2018,7 +2018,7 @@ static int verb_status(int argc, char **argv, void *userdata) {
                 STRV_FOREACH(ifname, argv + 1) {
                         int ifindex, q;
 
-                        ifindex = resolve_interface(&rtnl, *ifname);
+                        ifindex = rtnl_resolve_interface(&rtnl, *ifname);
                         if (ifindex < 0) {
                                 log_warning_errno(ifindex, "Failed to resolve interface \"%s\", ignoring: %m", *ifname);
                                 continue;
index 4a7007d06e509d3c7f6a0957b082c133d13e4f8e..0c044378265f06c45dcfd5a584d0a2984766f731 100644 (file)
 #include "socket-util.h"
 #include "string-util.h"
 
-int resolve_ifname(sd_netlink **rtnl, const char *name) {
-        int r;
-
-        /* Like if_nametoindex, but resolves "alternative names" too. */
-
-        assert(name);
-
-        r = if_nametoindex(name);
-        if (r > 0)
-                return r;
-
-        return rtnl_resolve_link_alternative_name(rtnl, name);
-}
-
-int resolve_interface(sd_netlink **rtnl, const char *name) {
-        int r;
-
-        /* Like resolve_ifname, but resolves interface numbers too. */
-
-        assert(name);
-
-        r = parse_ifindex(name);
-        if (r > 0)
-                return r;
-        assert(r < 0);
-
-        return resolve_ifname(rtnl, name);
-}
-
-int resolve_interface_or_warn(sd_netlink **rtnl, const char *name) {
-        int r;
-
-        r = resolve_interface(rtnl, name);
-        if (r < 0)
-                return log_error_errno(r, "Failed to resolve interface \"%s\": %m", name);
-        return r;
-}
-
 int socket_address_parse(SocketAddress *a, const char *s) {
         _cleanup_free_ char *n = NULL;
         char *e;
@@ -338,7 +300,7 @@ int in_addr_port_ifindex_name_from_string_auto(
                         return -EINVAL; /* We want to return -EINVAL for syntactically invalid names,
                                          * and -ENODEV for valid but nonexistent interfaces. */
 
-                ifindex = resolve_interface(NULL, m + 1);
+                ifindex = rtnl_resolve_interface(NULL, m + 1);
                 if (ifindex < 0)
                         return ifindex;
 
index eac599159db82e49df9411c7cf154a3220980214..6256a831bac3fefb09cd00e440ca16776b971549 100644 (file)
@@ -1,16 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-netlink.h"
-
 #include "in-addr-util.h"
 #include "macro.h"
 #include "socket-util.h"
 
-int resolve_ifname(sd_netlink **rtnl, const char *name);
-int resolve_interface(sd_netlink **rtnl, const char *name);
-int resolve_interface_or_warn(sd_netlink **rtnl, const char *name);
-
 int make_socket_fd(int log_level, const char* address, int type, int flags);
 
 int socket_address_parse(SocketAddress *a, const char *s);
index 04599ea3821a6561dff360b45a73e47c774dd33b..7ab0a8334eb91d55907b6b4d0ec68dd322e7ced9 100644 (file)
@@ -62,6 +62,8 @@ int sd_device_new_from_devnum(sd_device **ret, char type, dev_t devnum);
 int sd_device_new_from_subsystem_sysname(sd_device **ret, const char *subsystem, const char *sysname);
 int sd_device_new_from_device_id(sd_device **ret, const char *id);
 int sd_device_new_from_stat_rdev(sd_device **ret, const struct stat *st);
+int sd_device_new_from_ifname(sd_device **ret, const char *ifname);
+int sd_device_new_from_ifindex(sd_device **ret, int ifindex);
 
 int sd_device_get_parent(sd_device *child, sd_device **ret);
 int sd_device_get_parent_with_subsystem_devtype(sd_device *child, const char *subsystem, const char *devtype, sd_device **ret);
index 446f4a83db5defac6ea1f6a857ee53aaa5c96955..f2c5f3c98312c3210d01be7f24060ebc9af2a129 100755 (executable)
@@ -2,7 +2,7 @@
 set -e
 
 TEST_DESCRIPTION="UDEV"
-IMAGE_NAME="udev"
+IMAGE_NAME="default"
 TEST_NO_NSPAWN=1
 
 # shellcheck source=test/test-functions
@@ -10,11 +10,4 @@ TEST_NO_NSPAWN=1
 
 QEMU_TIMEOUT=800
 
-test_append_files() {
-    (
-        instmods dummy
-        generate_module_dependencies
-    )
-}
-
 do_test "$@"
index 3a33eacfedebc36d6598cf247c1ca6f227de8952..aada33611c50166875e43d0d9ad87661070adb6a 100644 (file)
@@ -863,6 +863,7 @@ install_modules() {
 
     instmods loop
     instmods vfat
+    instmods dummy
 
     if [[ "$LOOKS_LIKE_SUSE" ]]; then
         instmods ext4
index c7d25832526a716aa945cd597a0a013f3e4cc538..64c986d493ebe18c0cfa4d07808151e237591636 100644 (file)
@@ -2,6 +2,5 @@
 Name=bridge99
 
 [Network]
-LinkLocalAddressing=yes
 IPv6AcceptRA=no
 ConfigureWithoutCarrier=yes
index 965013f558798a7a04c7da7e070386e160c0556d..0af564b6208a43ab000f16ae0e07df5aeb0de38e 100644 (file)
@@ -4,3 +4,4 @@ Name=test1
 [Network]
 Address=192.168.0.15/24
 Gateway=192.168.0.1
+IPv6AcceptRA=no
index 33090b565d83e673951ac4e9681357b5b153ff51..2f1b11980908f40e1067f37af57002758dfae0d4 100755 (executable)
@@ -2044,7 +2044,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
             with self.subTest(carrier=carrier):
                 if carrier_map[carrier] != read_link_attr('test1', 'carrier'):
                     check_output(f'ip link set dev test1 carrier {carrier}')
-                self.wait_online([f'test1:{routable_map[carrier]}'])
+                self.wait_online([f'test1:{routable_map[carrier]}:{routable_map[carrier]}'])
 
                 output = check_output(*networkctl_cmd, '-n', '0', 'status', 'test1', env=env)
                 print(output)
@@ -2068,7 +2068,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
             with self.subTest(carrier=carrier, have_config=have_config):
                 if carrier_map[carrier] != read_link_attr('test1', 'carrier'):
                     check_output(f'ip link set dev test1 carrier {carrier}')
-                self.wait_online([f'test1:{routable_map[carrier]}'])
+                self.wait_online([f'test1:{routable_map[carrier]}:{routable_map[carrier]}'])
 
                 output = check_output(*networkctl_cmd, '-n', '0', 'status', 'test1', env=env)
                 print(output)