summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-08-28 15:23:01 +0900
committerGitHub <noreply@github.com>2019-08-28 15:23:01 +0900
commitb9773474988fb243b033a255afb91217095aaa67 (patch)
tree8f0da02b1326ba71497a9791c381de9791917f9c
parent88e1306af6380794842fb31108ba67895799fab4 (diff)
parent44013aa4f57c1a5ac7766a3a7cd719d912deb245 (diff)
downloadsystemd-b9773474988fb243b033a255afb91217095aaa67.tar.gz
Merge pull request #13412 from yuwata/network-check-and-warn-more
network: check more static IPv6 configurations and add more warnings
-rw-r--r--src/network/networkd-link.c8
-rw-r--r--src/network/networkd-network.c46
-rw-r--r--src/network/networkd-network.h2
3 files changed, 51 insertions, 5 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index f9e74e0f5b..f5bb78890a 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -191,7 +191,13 @@ static bool link_ipv6_enabled(Link *link) {
return false;
/* DHCPv6 client will not be started if no IPv6 link-local address is configured. */
- return link_ipv6ll_enabled(link) || network_has_static_ipv6_addresses(link->network);
+ if (link_ipv6ll_enabled(link))
+ return true;
+
+ if (network_has_static_ipv6_configurations(link->network))
+ return true;
+
+ return false;
}
static bool link_radv_enabled(Link *link) {
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 6a8766ce68..2b8d0eb2fb 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -220,6 +220,26 @@ int network_verify(Network *network) {
if (network->link_local < 0)
network->link_local = network->bridge ? ADDRESS_FAMILY_NO : ADDRESS_FAMILY_IPV6;
+ if (!FLAGS_SET(network->link_local, ADDRESS_FAMILY_IPV6)) {
+ if (network->ipv6_accept_ra > 0) {
+ log_warning("%s: IPv6AcceptRA= is enabled by the .network file but IPv6 link local addressing is disabled. "
+ "Disabling IPv6AcceptRA=.", network->filename);
+ network->ipv6_accept_ra = false;
+ }
+
+ if (FLAGS_SET(network->dhcp, ADDRESS_FAMILY_IPV6)) {
+ log_warning("%s: DHCPv6 client is enabled by the .network file but IPv6 link local addressing is disabled. "
+ "Disabling DHCPv6 client.", network->filename);
+ SET_FLAG(network->dhcp, ADDRESS_FAMILY_IPV6, false);
+ }
+
+ if (network->router_prefix_delegation != RADV_PREFIX_DELEGATION_NONE) {
+ log_warning("%s: IPv6PrefixDelegation= is enabled but IPv6 link local addressing is disabled. "
+ "Disabling IPv6PrefixDelegation=.", network->filename);
+ network->router_prefix_delegation = RADV_PREFIX_DELEGATION_NONE;
+ }
+ }
+
if (FLAGS_SET(network->link_local, ADDRESS_FAMILY_FALLBACK_IPV4) &&
!FLAGS_SET(network->dhcp, ADDRESS_FAMILY_IPV4)) {
log_warning("%s: fallback assignment of IPv4 link local address is enabled but DHCPv4 is disabled. "
@@ -662,15 +682,35 @@ int network_apply(Network *network, Link *link) {
return 0;
}
-bool network_has_static_ipv6_addresses(Network *network) {
+bool network_has_static_ipv6_configurations(Network *network) {
Address *address;
+ Route *route;
+ FdbEntry *fdb;
+ Neighbor *neighbor;
assert(network);
- LIST_FOREACH(addresses, address, network->static_addresses) {
+ LIST_FOREACH(addresses, address, network->static_addresses)
if (address->family == AF_INET6)
return true;
- }
+
+ LIST_FOREACH(routes, route, network->static_routes)
+ if (route->family == AF_INET6)
+ return true;
+
+ LIST_FOREACH(static_fdb_entries, fdb, network->static_fdb_entries)
+ if (fdb->family == AF_INET6)
+ return true;
+
+ LIST_FOREACH(neighbors, neighbor, network->neighbors)
+ if (neighbor->family == AF_INET6)
+ return true;
+
+ if (!LIST_IS_EMPTY(network->address_labels))
+ return true;
+
+ if (!LIST_IS_EMPTY(network->static_prefixes))
+ return true;
return false;
}
diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
index f8894f86dd..bc760744e5 100644
--- a/src/network/networkd-network.h
+++ b/src/network/networkd-network.h
@@ -269,7 +269,7 @@ int network_get(Manager *manager, sd_device *device, const char *ifname, const s
int network_apply(Network *network, Link *link);
void network_apply_anonymize_if_set(Network *network);
-bool network_has_static_ipv6_addresses(Network *network);
+bool network_has_static_ipv6_configurations(Network *network);
CONFIG_PARSER_PROTOTYPE(config_parse_stacked_netdev);
CONFIG_PARSER_PROTOTYPE(config_parse_tunnel);