diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-09-17 21:29:23 +0900 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-09-21 23:06:58 +0200 |
commit | dd83d5879661d46f85457d139f683c920875eb44 (patch) | |
tree | 11413b23f497a546d24484bcad91128f66ccea8a | |
parent | b294305888da171f393bbb4c3dc0be332e8d50c1 (diff) | |
download | systemd-dd83d5879661d46f85457d139f683c920875eb44.tar.gz |
network: add missing link->network checks
When the function is called, no network file may be assigned to the
link.
(cherry picked from commit b1b0b42e48303134731e017a108c6c334ef5f4c8)
-rw-r--r-- | src/network/networkd-link.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index f5bb78890a..77df151cdd 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -2393,9 +2393,9 @@ static int link_drop_foreign_config(Link *link) { continue; if (link_address_is_dynamic(link, address)) { - if (FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_DHCP)) + if (link->network && FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_DHCP)) continue; - } else if (FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_STATIC)) + } else if (link->network && FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_STATIC)) continue; if (link_is_static_address_configured(link, address)) { @@ -2435,11 +2435,11 @@ static int link_drop_foreign_config(Link *link) { in_addr_equal(AF_INET6, &route->dst, &(union in_addr_union) { .in6 = {{{ 0xff,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 }}} })) continue; - if (route->protocol == RTPROT_STATIC && + if (route->protocol == RTPROT_STATIC && link->network && FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_STATIC)) continue; - if (route->protocol == RTPROT_DHCP && + if (route->protocol == RTPROT_DHCP && link->network && FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_DHCP)) continue; |