]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: Do not treat IPv6 addresses IFA_F_DEPRECATED as not ready.
authorSusant Sahani <susant@redhat.com>
Tue, 26 Sep 2017 10:54:26 +0000 (16:24 +0530)
committerSusant Sahani <susant@redhat.com>
Tue, 26 Sep 2017 10:54:26 +0000 (16:24 +0530)
When we are receiving address lifetime valid and lifetime preferred
'0' we set them via ndisc. That makes is shows as depricated and we
treat this as not ready.

In link_check_ready we look for whether address is depricated and
since this is depricated we never configure this link.

Thanks to Marc Haber <mh+github@zugschlus.de>

lifetime 0 a valid, and common, use case. It enables an installation to
autoconfigure systems in a way that they become immediately reachable
without needing local configuration after they have been turned on (for
example, for remote configuration).  The local admin can then configure
additional, static IP addresses to be used for the server's service (and
the IP adress _only_, while the rest of network configuration still comes
from autoconfiguration), while _KEEPING_ the possibiltiy to reach the
system over the autoconfigured address in the case that static
configuration fails.

The correct way is to handle the announcement exactly as it is correctly
handled in the released software: It configures the address as
"deprecated", causing the kernel to accept packets addresses to it, and
not to use it for outgoing packets/connections _UNLESS_ there is no other
way to send the packet out.

The only change that is needed is that systemd-networkd should not wedge
itself in that case, it should just continue working (with two IP
addresses configured on the interface).

An IPv6 address with a remamining lifetime of zero is _NOT_ like an
expired IPv4 DHCP lease, it's still a valid and useable IP address. It
is just that the network advises the host not to use the address any
more for outgoing traffic _UNLESS_ there is no other way to send the
traffic.

Fixes #6359

src/network/networkd-address.c

index 7f536b4ba9a5574bd1b61c73e4c7276473a434b4..889ff1ec16046787255d5f2c583d91f22d530f5f 100644 (file)
@@ -973,7 +973,10 @@ int config_parse_address_scope(const char *unit,
 bool address_is_ready(const Address *a) {
         assert(a);
 
-        return !(a->flags & (IFA_F_TENTATIVE | IFA_F_DEPRECATED));
+        if (a->family == AF_INET6)
+                return !(a->flags & IFA_F_TENTATIVE);
+        else
+                return !(a->flags & (IFA_F_TENTATIVE | IFA_F_DEPRECATED));
 }
 
 int config_parse_router_preference(const char *unit,