summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-09-30 14:01:44 +0200
committerTom Gundersen <teg@jklm.no>2015-10-21 02:35:31 +0200
commitadda1ed94a04742ddacdc76dfa311816e1ed9f68 (patch)
treec29e5b9867a54e80baf83505f9c353f96e453017 /src/network/networkd-link.c
parentfcf50cff129c1b0c6c415428e659da40c3053e6e (diff)
networkd: address - distinguish between addresses added by us and by others
We only keep the addresses that we added ourselves in link->addresses, and introduce a new set link->addresses_foreign to keep addresses of unknown origin. Only functional change is that "foreign" addresses no longer prevent a link from entering "configured" state.
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 1ac76c4255..c0f27aaca8 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -297,6 +297,11 @@ static void link_free(Link *link) {
set_free(link->addresses);
+ while (!set_isempty(link->addresses_foreign))
+ address_free(set_first(link->addresses_foreign));
+
+ set_free(link->addresses_foreign);
+
while ((address = link->pool_addresses)) {
LIST_REMOVE(addresses, link->pool_addresses, address);
address_free(address);
@@ -508,7 +513,9 @@ void link_check_ready(Link *link) {
Iterator i;
assert(link);
- assert(link->network);
+
+ if (!link->network)
+ return;
if (!link->static_configured)
return;
@@ -2324,6 +2331,15 @@ static void link_update_operstate(Link *link) {
scope = address->scope;
}
+ /* for operstate we also take foreign addresses into account */
+ SET_FOREACH(address, link->addresses_foreign, i) {
+ if (!address_is_ready(address))
+ continue;
+
+ if (address->scope < scope)
+ scope = address->scope;
+ }
+
if (scope < RT_SCOPE_SITE)
/* universally accessible addresses found */
operstate = LINK_OPERSTATE_ROUTABLE;