mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
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.
This commit is contained in:
parent
e4f66b7773
commit
24c083dfcb
2
TODO
2
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
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user