From: Susant Sahani Date: Tue, 26 Sep 2017 10:54:26 +0000 (+0530) Subject: networkd: Do not treat IPv6 addresses IFA_F_DEPRECATED as not ready. X-Git-Tag: v236~167^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b7ed5384ab55cd4d7b8d7d1ec7f5d5e145f0a2b1;p=thirdparty%2Fsystemd.git networkd: Do not treat IPv6 addresses IFA_F_DEPRECATED as not ready. 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 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 --- diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index 7f536b4ba9a..889ff1ec160 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -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,