summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-05-12 00:22:29 +0200
committerTom Gundersen <teg@jklm.no>2015-05-12 00:43:45 +0200
commit24c083dfcbff3d1dd86a22cba7555a9ae6d8a53d (patch)
treef4e30951822d9ae9d9c6e00a02ed152ebb98ed90
parente4f66b7773ae21278bf6b9c02a3282eec5996266 (diff)
downloadsystemd-24c083dfcbff3d1dd86a22cba7555a9ae6d8a53d.tar.gz
networkd: network_get - allow udev_device to be NULL
In containers we never have udev devices, so drop the assert. This fixes an assertion introduced in af3aa302741b6edb0729925febb5f8bc26721fe3.
-rw-r--r--TODO2
-rw-r--r--src/network/networkd-network.c21
2 files changed, 10 insertions, 13 deletions
diff --git a/TODO b/TODO
index 3edb7fdfca..932fef6431 100644
--- a/TODO
+++ b/TODO
@@ -49,8 +49,6 @@ Before 220:
* introduce argv0array=
-* Assertion 'device' failed at src/network/networkd-network.c:280, function network_get(). Aborting.
-
Features:
* invent a better systemd-run scheme for naming scopes, that works with remoting
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;