summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-10-08 16:59:26 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-11-30 12:37:36 +0900
commit3ca1fab70a0db80dd0460478ead42c6db284ee7b (patch)
tree30c74c17b8c634c4ceb67711d20103ca113483f0 /src/network/networkd-link.c
parente4dc0845bc26b3a3abec58932bdefe346d879d0f (diff)
downloadsystemd-3ca1fab70a0db80dd0460478ead42c6db284ee7b.tar.gz
networkd: merge ll addressing fallback modes into normal "boolean" values
They are not really boolean, because we have both ipv4 and ipv6, but for each protocol we have either unset, no, and yes. From https://github.com/systemd/systemd/issues/13316#issuecomment-582906817: LinkLocalAddressing must be a boolean option, at least for ipv4: - LinkLocalAddressing=no => no LL at all. - LinkLocalAddressing=yes + Static Address => invalid configuration, warn and interpret as LinkLocalAddressing=no, no LL at all. (we check that during parsing and reject) - LinkLocalAddressing=yes + DHCP => LL process should be subordinated to the DHCP one, an LL address must be acquired at start or after a short N unsuccessful DHCP attemps, and must not stop DHCP to keeping trying. When a DHCP address is acquired, drop the LL address. If the DHCP address is lost, re-adquire a new LL address. (next patch will move in this direction) - LinkLocalAddressing=fallback has no reason to exist, because LL address must always be allocated as a fallback option when using DHCP. Having both DHCP and LL address at the same time is an RFC violation, so LinkLocalAdressing=yes correctly implemented is already the "fallback" behavior. The fallback option must be deprecated and if present in older configs must be interpreted as LinkLocalAddressing=yes. (removed) - And for IPv6, the LinkLocalAddress option has any sense at all? IPv6-LL address aren't required to be always set for every IPv6 enabled interface (in this case, coexisting with static or dynamic address if any)? Shouldn't be always =yes? (good question) This effectively reverts 29e81083bd2fcb2dbf83f67ef358c7d25adf7e9d. There is no special "fallback" mode now, so the check doesn't make sense anymore.
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 4feda54c70..baaf0b8812 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -55,9 +55,8 @@
#include "util.h"
#include "vrf.h"
-bool link_ipv4ll_enabled(Link *link, AddressFamily mask) {
+bool link_ipv4ll_enabled(Link *link) {
assert(link);
- assert((mask & ~(ADDRESS_FAMILY_IPV4 | ADDRESS_FAMILY_FALLBACK_IPV4)) == 0);
if (link->flags & IFF_LOOPBACK)
return false;
@@ -80,7 +79,7 @@ bool link_ipv4ll_enabled(Link *link, AddressFamily mask) {
if (link->network->bond)
return false;
- return link->network->link_local & mask;
+ return link->network->link_local & ADDRESS_FAMILY_IPV4;
}
bool link_ipv6ll_enabled(Link *link) {
@@ -795,7 +794,7 @@ void link_check_ready(Link *link) {
bool has_ndisc_address = false;
NDiscAddress *n;
- if (link_ipv4ll_enabled(link, ADDRESS_FAMILY_IPV4) && !link->ipv4ll_address_configured) {
+ if (link_ipv4ll_enabled(link) && !link->ipv4ll_address_configured) {
log_link_debug(link, "%s(): IPv4LL is not configured.", __func__);
return;
}
@@ -814,7 +813,7 @@ void link_check_ready(Link *link) {
if ((link_dhcp4_enabled(link) || link_dhcp6_enabled(link)) &&
!link->dhcp_address && set_isempty(link->dhcp6_addresses) && !has_ndisc_address &&
- !(link_ipv4ll_enabled(link, ADDRESS_FAMILY_FALLBACK_IPV4) && link->ipv4ll_address_configured)) {
+ !(link_ipv4ll_enabled(link) && link->ipv4ll_address_configured)) {
log_link_debug(link, "%s(): DHCP4 or DHCP6 is enabled but no dynamic address is assigned yet.", __func__);
return;
}
@@ -824,7 +823,7 @@ void link_check_ready(Link *link) {
!(link->dhcp6_address_configured && link->dhcp6_route_configured) &&
!(link->dhcp6_pd_address_configured && link->dhcp6_pd_route_configured) &&
!(link->ndisc_addresses_configured && link->ndisc_routes_configured) &&
- !(link_ipv4ll_enabled(link, ADDRESS_FAMILY_FALLBACK_IPV4) && link->ipv4ll_address_configured)) {
+ !(link_ipv4ll_enabled(link) && link->ipv4ll_address_configured)) {
/* When DHCP or RA is enabled, at least one protocol must provide an address, or
* an IPv4ll fallback address must be configured. */
log_link_debug(link, "%s(): dynamic addresses or routes are not configured.", __func__);
@@ -1230,7 +1229,7 @@ static int link_acquire_ipv4_conf(Link *link) {
assert(link->manager);
assert(link->manager->event);
- if (link_ipv4ll_enabled(link, ADDRESS_FAMILY_IPV4)) {
+ if (link_ipv4ll_enabled(link)) {
assert(link->ipv4ll);
log_link_debug(link, "Acquiring IPv4 link-local address");