summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-09-29 16:17:43 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-10-06 19:44:42 +0200
commit58f1fe9af9429c994c0a94ea3762d66a596ec261 (patch)
tree765869a4c7ef9945a3290330e402a4c390eabbf1 /src
parentnetwork: move functions (diff)
downloadsystemd-58f1fe9af9429c994c0a94ea3762d66a596ec261.tar.xz
systemd-58f1fe9af9429c994c0a94ea3762d66a596ec261.zip
network: move link_request_set_neighbors() to networkd-neighbor.c
Diffstat (limited to 'src')
-rw-r--r--src/network/networkd-link.c29
-rw-r--r--src/network/networkd-neighbor.c27
-rw-r--r--src/network/networkd-neighbor.h2
3 files changed, 30 insertions, 28 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index e5d51f1572..6df7ce74a0 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1131,33 +1131,6 @@ void link_check_ready(Link *link) {
return;
}
-static int link_request_set_neighbors(Link *link) {
- Neighbor *neighbor;
- int r;
-
- assert(link);
- assert(link->network);
- assert(link->state != _LINK_STATE_INVALID);
-
- link->neighbors_configured = false;
-
- LIST_FOREACH(neighbors, neighbor, link->network->neighbors) {
- r = neighbor_configure(neighbor, link, NULL);
- if (r < 0)
- return log_link_warning_errno(link, r, "Could not set neighbor: %m");
- }
-
- if (link->neighbor_messages == 0) {
- link->neighbors_configured = true;
- link_check_ready(link);
- } else {
- log_link_debug(link, "Setting neighbors");
- link_set_state(link, LINK_STATE_CONFIGURING);
- }
-
- return 0;
-}
-
static int link_set_bridge_fdb(Link *link) {
FdbEntry *fdb_entry;
int r;
@@ -1307,7 +1280,7 @@ static int link_request_set_addresses(Link *link) {
if (r < 0)
return r;
- r = link_request_set_neighbors(link);
+ r = link_set_neighbors(link);
if (r < 0)
return r;
diff --git a/src/network/networkd-neighbor.c b/src/network/networkd-neighbor.c
index 26ef94328f..b9c149121c 100644
--- a/src/network/networkd-neighbor.c
+++ b/src/network/networkd-neighbor.c
@@ -310,6 +310,33 @@ int neighbor_configure(Neighbor *neighbor, Link *link, link_netlink_message_hand
return 0;
}
+int link_set_neighbors(Link *link) {
+ Neighbor *neighbor;
+ int r;
+
+ assert(link);
+ assert(link->network);
+ assert(link->state != _LINK_STATE_INVALID);
+
+ link->neighbors_configured = false;
+
+ LIST_FOREACH(neighbors, neighbor, link->network->neighbors) {
+ r = neighbor_configure(neighbor, link, NULL);
+ if (r < 0)
+ return log_link_warning_errno(link, r, "Could not set neighbor: %m");
+ }
+
+ if (link->neighbor_messages == 0) {
+ link->neighbors_configured = true;
+ link_check_ready(link);
+ } else {
+ log_link_debug(link, "Setting neighbors");
+ link_set_state(link, LINK_STATE_CONFIGURING);
+ }
+
+ return 0;
+}
+
static int neighbor_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
int r;
diff --git a/src/network/networkd-neighbor.h b/src/network/networkd-neighbor.h
index 97ee1f6d73..bba59f0227 100644
--- a/src/network/networkd-neighbor.h
+++ b/src/network/networkd-neighbor.h
@@ -47,6 +47,8 @@ bool neighbor_equal(const Neighbor *n1, const Neighbor *n2);
int neighbor_section_verify(Neighbor *neighbor);
+int link_set_neighbors(Link *link);
+
CONFIG_PARSER_PROTOTYPE(config_parse_neighbor_address);
CONFIG_PARSER_PROTOTYPE(config_parse_neighbor_hwaddr);
CONFIG_PARSER_PROTOTYPE(config_parse_neighbor_lladdr);