chiark / gitweb /
mount: don't run quotaon only for network filesystems
[elogind.git] / src / network / networkd-network.c
index 0ba0c75714c9eb0cb49475af307f7a70ff298695..78bbf74bff03e3c351d942d5a4878bc318bec1c9 100644 (file)
@@ -103,6 +103,7 @@ static int network_load_one(Manager *manager, const char *filename) {
         network->dhcp_routes = true;
         network->dhcp_sendhost = true;
         network->dhcp_route_metric = DHCP_ROUTE_METRIC;
+        network->dhcp_client_identifier = DHCP_CLIENT_ID_DUID;
 
         network->llmnr = LLMNR_SUPPORT_YES;
 
@@ -271,9 +272,24 @@ int network_get(Manager *manager, struct udev_device *device,
                 const char *ifname, const struct ether_addr *address,
                 Network **ret) {
         Network *network;
+        struct udev_device *parent;
+        const char *path, *parent_driver, *driver, *devtype;
 
         assert(manager);
         assert(ret);
+        assert(device);
+
+        path = udev_device_get_property_value(device, "ID_PATH");
+
+        parent = udev_device_get_parent(device);
+        if (parent)
+                parent_driver = udev_device_get_driver(parent);
+        else
+                parent_driver = NULL;
+
+        driver = udev_device_get_property_value(device, "ID_NET_DRIVER");
+
+        devtype = udev_device_get_devtype(device);
 
         LIST_FOREACH(networks, network, manager->networks) {
                 if (net_match_config(network->match_mac, network->match_path,
@@ -281,19 +297,15 @@ int network_get(Manager *manager, struct udev_device *device,
                                      network->match_name, network->match_host,
                                      network->match_virt, network->match_kernel,
                                      network->match_arch,
-                                     address,
-                                     udev_device_get_property_value(device, "ID_PATH"),
-                                     udev_device_get_driver(udev_device_get_parent(device)),
-                                     udev_device_get_property_value(device, "ID_NET_DRIVER"),
-                                     udev_device_get_devtype(device),
-                                     ifname)) {
+                                     address, path, parent_driver, driver,
+                                     devtype, ifname)) {
                         if (network->match_name) {
                                 const char *attr;
                                 uint8_t name_assign_type = NET_NAME_UNKNOWN;
 
                                 attr = udev_device_get_sysattr_value(device, "name_assign_type");
                                 if (attr)
-                                        (void)safe_atou8(attr, &name_assign_type);
+                                        (void) safe_atou8(attr, &name_assign_type);
 
                                 if (name_assign_type == NET_NAME_ENUM)
                                         log_warning("%-*s: found matching network '%s', based on potentially unpredictable ifname",
@@ -600,6 +612,14 @@ int config_parse_dhcp(
         return 0;
 }
 
+static const char* const dhcp_client_identifier_table[_DHCP_CLIENT_ID_MAX] = {
+        [DHCP_CLIENT_ID_MAC] = "mac",
+        [DHCP_CLIENT_ID_DUID] = "duid"
+};
+
+DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(dhcp_client_identifier, DCHPClientIdentifier);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp_client_identifier, dhcp_client_identifier, DCHPClientIdentifier, "Failed to parse client identifier type");
+
 static const char* const llmnr_support_table[_LLMNR_SUPPORT_MAX] = {
         [LLMNR_SUPPORT_NO] = "no",
         [LLMNR_SUPPORT_YES] = "yes",