summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-network.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 4d4972e5d6..8aa4eb2ed1 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -273,23 +273,22 @@ int network_get(Manager *manager, struct udev_device *device,
Network **ret) {
Network *network;
struct udev_device *parent;
- const char *path, *parent_driver, *driver, *devtype;
+ const char *path = NULL, *parent_driver = NULL, *driver = NULL, *devtype = NULL;
assert(manager);
assert(ret);
- assert(device);
- path = udev_device_get_property_value(device, "ID_PATH");
+ if (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;
+ parent = udev_device_get_parent(device);
+ if (parent)
+ parent_driver = udev_device_get_driver(parent);
- driver = udev_device_get_property_value(device, "ID_NET_DRIVER");
+ driver = udev_device_get_property_value(device, "ID_NET_DRIVER");
- devtype = udev_device_get_devtype(device);
+ devtype = udev_device_get_devtype(device);
+ }
LIST_FOREACH(networks, network, manager->networks) {
if (net_match_config(network->match_mac, network->match_path,
@@ -299,7 +298,7 @@ int network_get(Manager *manager, struct udev_device *device,
network->match_arch,
address, path, parent_driver, driver,
devtype, ifname)) {
- if (network->match_name) {
+ if (network->match_name && device) {
const char *attr;
uint8_t name_assign_type = NET_NAME_UNKNOWN;