summaryrefslogtreecommitdiff
path: root/src/network/networkd-neighbor.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-02-04 00:40:08 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-02-12 22:43:10 +0900
commitd9eee312a7232c83d7494139d4d1bc8831d57455 (patch)
tree074b2bcc997a6349075db97cc3a327c00cf9748a /src/network/networkd-neighbor.c
parente81fd9dd232830c79d4fa9b3303afc40da6c6ff0 (diff)
downloadsystemd-d9eee312a7232c83d7494139d4d1bc8831d57455.tar.gz
network: make address_configure() or friends return 1 when the address is new
Diffstat (limited to 'src/network/networkd-neighbor.c')
-rw-r--r--src/network/networkd-neighbor.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/network/networkd-neighbor.c b/src/network/networkd-neighbor.c
index 22b716b14a..f54a2f9c99 100644
--- a/src/network/networkd-neighbor.c
+++ b/src/network/networkd-neighbor.c
@@ -170,6 +170,7 @@ static int neighbor_add_internal(Link *link, Set **neighbors, const Neighbor *in
}
static int neighbor_add(Link *link, const Neighbor *in, Neighbor **ret) {
+ bool is_new = false;
Neighbor *neighbor;
int r;
@@ -179,6 +180,7 @@ static int neighbor_add(Link *link, const Neighbor *in, Neighbor **ret) {
r = neighbor_add_internal(link, &link->neighbors, in, &neighbor);
if (r < 0)
return r;
+ is_new = true;
} else if (r == 0) {
/* Neighbor is foreign, claim it as recognized */
r = set_ensure_put(&link->neighbors, &neighbor_hash_ops, neighbor);
@@ -188,12 +190,13 @@ static int neighbor_add(Link *link, const Neighbor *in, Neighbor **ret) {
set_remove(link->neighbors_foreign, neighbor);
} else if (r == 1) {
/* Neighbor already exists */
+ ;
} else
return r;
if (ret)
*ret = neighbor;
- return 0;
+ return is_new;
}
static int neighbor_add_foreign(Link *link, const Neighbor *in, Neighbor **ret) {
@@ -279,7 +282,7 @@ static int neighbor_configure(Neighbor *neighbor, Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "Could not add neighbor: %m");
- return 0;
+ return r;
}
int link_set_neighbors(Link *link) {