]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: assume Scope=host when Address= is loopback address
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 27 Feb 2020 17:10:15 +0000 (02:10 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 28 Feb 2020 08:53:36 +0000 (09:53 +0100)
Fixes #14903.

src/network/networkd-address.c
src/network/networkd-address.h

index 59775869b604a759e1e2bd7d6cb7be1bcd2b511e..6244f75201d7ea754034aa3d4aa827eb287671c7 100644 (file)
@@ -1053,6 +1053,7 @@ int config_parse_address_scope(const char *unit,
                 }
         }
 
+        n->scope_set = true;
         n = NULL;
         return 0;
 }
@@ -1125,5 +1126,8 @@ int address_section_verify(Address *address) {
                                          address->section->filename, address->section->line);
         }
 
+        if (!address->scope_set && in_addr_is_localhost(address->family, &address->in_addr) > 0)
+                address->scope = RT_SCOPE_HOST;
+
         return 0;
 }
index 6995c5c06e01e2a4f86cefa025fe5c93b26df4c8..ad2412c75aac673365f2bcdeea012bc142ed374b 100644 (file)
@@ -39,6 +39,7 @@ struct Address {
         union in_addr_union in_addr;
         union in_addr_union in_addr_peer;
 
+        bool scope_set:1;
         bool ip_masquerade_done:1;
         bool manage_temporary_address:1;
         bool home_address:1;