summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-02-26 07:56:39 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-03-11 06:16:41 +0100
commitff51134c93a748524b75b4fd492f9c03cb02f65c (patch)
treeaa4dd86f335acceeecb3de90f3ae9fb2f466892d /src
parentnetwork: make address_configure() and friends take Request object (diff)
downloadsystemd-ff51134c93a748524b75b4fd492f9c03cb02f65c.tar.xz
systemd-ff51134c93a748524b75b4fd492f9c03cb02f65c.zip
network: make request_process_address() and friends take Link and corresponding object
This also renames e.g. request_process_address() -> address_process_request(). Also, this drops type checks such as `assert(req->type == REQUEST_TYPE_ADDRESS)`, as in the later commits, the function of processing request, e.g. `address_process_request()`, will be assigned to the Request object when it is created. And the request type will be used to distinguish and to avoid deduplicating requests which do not have any assigned objects, like REQUEST_TYPE_DHCP4_CLIENT. Hence, the type checks in process functions are mostly not necessary and redundant. This is mostly cleanups and preparation for later commits, and should not change any behavior.
Diffstat (limited to 'src')
-rw-r--r--src/network/netdev/netdev.c19
-rw-r--r--src/network/netdev/netdev.h4
-rw-r--r--src/network/networkd-address-label.c11
-rw-r--r--src/network/networkd-address-label.h2
-rw-r--r--src/network/networkd-address.c10
-rw-r--r--src/network/networkd-address.h2
-rw-r--r--src/network/networkd-bridge-fdb.c9
-rw-r--r--src/network/networkd-bridge-fdb.h2
-rw-r--r--src/network/networkd-bridge-mdb.c10
-rw-r--r--src/network/networkd-bridge-mdb.h2
-rw-r--r--src/network/networkd-dhcp-server.c7
-rw-r--r--src/network/networkd-dhcp-server.h2
-rw-r--r--src/network/networkd-dhcp4.c12
-rw-r--r--src/network/networkd-dhcp4.h2
-rw-r--r--src/network/networkd-dhcp6.c10
-rw-r--r--src/network/networkd-dhcp6.h2
-rw-r--r--src/network/networkd-ipv6-proxy-ndp.c10
-rw-r--r--src/network/networkd-ipv6-proxy-ndp.h2
-rw-r--r--src/network/networkd-ndisc.c9
-rw-r--r--src/network/networkd-ndisc.h2
-rw-r--r--src/network/networkd-neighbor.c10
-rw-r--r--src/network/networkd-neighbor.h2
-rw-r--r--src/network/networkd-nexthop.c10
-rw-r--r--src/network/networkd-nexthop.h2
-rw-r--r--src/network/networkd-queue.c40
-rw-r--r--src/network/networkd-radv.c9
-rw-r--r--src/network/networkd-radv.h2
-rw-r--r--src/network/networkd-route.c12
-rw-r--r--src/network/networkd-route.h2
-rw-r--r--src/network/networkd-routing-policy-rule.c10
-rw-r--r--src/network/networkd-routing-policy-rule.h2
-rw-r--r--src/network/networkd-setlink.c22
-rw-r--r--src/network/networkd-setlink.h4
-rw-r--r--src/network/tc/qdisc.c8
-rw-r--r--src/network/tc/qdisc.h2
-rw-r--r--src/network/tc/tclass.c8
-rw-r--r--src/network/tc/tclass.h2
37 files changed, 99 insertions, 177 deletions
diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
index 30b2970712..d296d799c3 100644
--- a/src/network/netdev/netdev.c
+++ b/src/network/netdev/netdev.c
@@ -632,16 +632,12 @@ static int netdev_is_ready_to_create(NetDev *netdev, Link *link) {
return true;
}
-int request_process_stacked_netdev(Request *req) {
- NetDev *netdev;
- Link *link;
+int stacked_netdev_process_request(Request *req, Link *link, void *userdata) {
+ NetDev *netdev = ASSERT_PTR(userdata);
int r;
assert(req);
- assert(req->type == REQUEST_TYPE_NETDEV_STACKED);
-
- netdev = ASSERT_PTR(req->netdev);
- link = ASSERT_PTR(req->link);
+ assert(link);
r = netdev_is_ready_to_create(netdev, link);
if (r <= 0)
@@ -707,14 +703,11 @@ int link_request_stacked_netdev(Link *link, NetDev *netdev) {
return 0;
}
-int request_process_independent_netdev(Request *req) {
- NetDev *netdev;
+int independent_netdev_process_request(Request *req, Link *link, void *userdata) {
+ NetDev *netdev = ASSERT_PTR(userdata);
int r;
- assert(req);
- assert(req->type == REQUEST_TYPE_NETDEV_INDEPENDENT);
-
- netdev = ASSERT_PTR(req->netdev);
+ assert(!link);
r = netdev_is_ready_to_create(netdev, NULL);
if (r <= 0)
diff --git a/src/network/netdev/netdev.h b/src/network/netdev/netdev.h
index ccf58f7ccb..4c2e949fb2 100644
--- a/src/network/netdev/netdev.h
+++ b/src/network/netdev/netdev.h
@@ -209,8 +209,8 @@ int netdev_set_ifindex(NetDev *netdev, sd_netlink_message *newlink);
int netdev_generate_hw_addr(NetDev *netdev, Link *link, const char *name,
const struct hw_addr_data *hw_addr, struct hw_addr_data *ret);
-int request_process_independent_netdev(Request *req);
-int request_process_stacked_netdev(Request *req);
+int independent_netdev_process_request(Request *req, Link *link, void *userdata);
+int stacked_netdev_process_request(Request *req, Link *link, void *userdata);
int link_request_stacked_netdev(Link *link, NetDev *netdev);
const char *netdev_kind_to_string(NetDevKind d) _const_;
diff --git a/src/network/networkd-address-label.c b/src/network/networkd-address-label.c
index 3447d96cf9..c165cde092 100644
--- a/src/network/networkd-address-label.c
+++ b/src/network/networkd-address-label.c
@@ -132,20 +132,17 @@ static int address_label_configure(AddressLabel *label, Link *link, Request *req
return 0;
}
-int request_process_address_label(Request *req) {
- Link *link;
+int address_label_process_request(Request *req, Link *link, void *userdata) {
+ AddressLabel *label = ASSERT_PTR(userdata);
int r;
assert(req);
- assert(req->label);
- assert(req->type == REQUEST_TYPE_ADDRESS_LABEL);
-
- link = ASSERT_PTR(req->link);
+ assert(link);
if (!link_is_ready_to_configure(link, false))
return 0;
- r = address_label_configure(req->label, link, req);
+ r = address_label_configure(label, link, req);
if (r < 0)
return log_link_warning_errno(link, r, "Failed to configure address label: %m");
diff --git a/src/network/networkd-address-label.h b/src/network/networkd-address-label.h
index 582dd05b88..19bb0383e6 100644
--- a/src/network/networkd-address-label.h
+++ b/src/network/networkd-address-label.h
@@ -26,7 +26,7 @@ AddressLabel *address_label_free(AddressLabel *label);
void network_drop_invalid_address_labels(Network *network);
int link_request_static_address_labels(Link *link);
-int request_process_address_label(Request *req);
+int address_label_process_request(Request *req, Link *link, void *userdata);
CONFIG_PARSER_PROTOTYPE(config_parse_address_label);
CONFIG_PARSER_PROTOTYPE(config_parse_address_label_prefix);
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index bf56335e31..3164f82c30 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -1112,16 +1112,12 @@ static bool address_is_ready_to_configure(Link *link, const Address *address) {
return true;
}
-int request_process_address(Request *req) {
- Address *address;
- Link *link;
+int address_process_request(Request *req, Link *link, Address *address) {
int r;
assert(req);
- assert(req->type == REQUEST_TYPE_ADDRESS);
-
- address = ASSERT_PTR(req->address);
- link = ASSERT_PTR(req->link);
+ assert(link);
+ assert(address);
if (!address_is_ready_to_configure(link, address))
return 0;
diff --git a/src/network/networkd-address.h b/src/network/networkd-address.h
index b116237638..a90dbceb64 100644
--- a/src/network/networkd-address.h
+++ b/src/network/networkd-address.h
@@ -101,7 +101,7 @@ int link_request_address(
Request **ret);
int link_request_static_address(Link *link, Address *address, bool consume);
int link_request_static_addresses(Link *link);
-int request_process_address(Request *req);
+int address_process_request(Request *req, Link *link, Address *address);
int manager_rtnl_process_address(sd_netlink *nl, sd_netlink_message *message, Manager *m);
diff --git a/src/network/networkd-bridge-fdb.c b/src/network/networkd-bridge-fdb.c
index a7ba2239c6..e8a05e5e13 100644
--- a/src/network/networkd-bridge-fdb.c
+++ b/src/network/networkd-bridge-fdb.c
@@ -219,15 +219,12 @@ static bool bridge_fdb_is_ready_to_configure(BridgeFDB *fdb, Link *link) {
return true;
}
-int request_process_bridge_fdb(Request *req) {
- BridgeFDB *fdb;
- Link *link;
+int bridge_fdb_process_request(Request *req, Link *link, void *userdata) {
+ BridgeFDB *fdb = ASSERT_PTR(userdata);
int r;
assert(req);
- assert(req->type == REQUEST_TYPE_BRIDGE_FDB);
- assert_se(link = req->link);
- assert_se(fdb = req->fdb);
+ assert(link);
if (!bridge_fdb_is_ready_to_configure(fdb, link))
return 0;
diff --git a/src/network/networkd-bridge-fdb.h b/src/network/networkd-bridge-fdb.h
index b1098760d2..6a6e80384e 100644
--- a/src/network/networkd-bridge-fdb.h
+++ b/src/network/networkd-bridge-fdb.h
@@ -47,7 +47,7 @@ void network_drop_invalid_bridge_fdb_entries(Network *network);
int link_request_static_bridge_fdb(Link *link);
-int request_process_bridge_fdb(Request *req);
+int bridge_fdb_process_request(Request *req, Link *link, void *userdata);
CONFIG_PARSER_PROTOTYPE(config_parse_fdb_hwaddr);
CONFIG_PARSER_PROTOTYPE(config_parse_fdb_vlan_id);
diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c
index 4cd98f3545..b9320f7ea2 100644
--- a/src/network/networkd-bridge-mdb.c
+++ b/src/network/networkd-bridge-mdb.c
@@ -205,19 +205,17 @@ static bool bridge_mdb_is_ready_to_configure(Link *link) {
return true;
}
-int request_process_bridge_mdb(Request *req) {
- Link *link;
+int bridge_mdb_process_request(Request *req, Link *link, void *userdata) {
+ BridgeMDB *mdb = ASSERT_PTR(userdata);
int r;
assert(req);
- assert(req->mdb);
- assert(req->type == REQUEST_TYPE_BRIDGE_MDB);
- assert_se(link = req->link);
+ assert(link);
if (!bridge_mdb_is_ready_to_configure(link))
return 0;
- r = bridge_mdb_configure(req->mdb, link, req);
+ r = bridge_mdb_configure(mdb, link, req);
if (r < 0)
return log_link_warning_errno(link, r, "Failed to configure bridge MDB: %m");
diff --git a/src/network/networkd-bridge-mdb.h b/src/network/networkd-bridge-mdb.h
index ce91e3f572..c9a34af88a 100644
--- a/src/network/networkd-bridge-mdb.h
+++ b/src/network/networkd-bridge-mdb.h
@@ -25,7 +25,7 @@ BridgeMDB *bridge_mdb_free(BridgeMDB *mdb);
void network_drop_invalid_bridge_mdb_entries(Network *network);
int link_request_static_bridge_mdb(Link *link);
-int request_process_bridge_mdb(Request *req);
+int bridge_mdb_process_request(Request *req, Link *link, void *userdata);
CONFIG_PARSER_PROTOTYPE(config_parse_mdb_group_address);
CONFIG_PARSER_PROTOTYPE(config_parse_mdb_vlan_id);
diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
index 795ad686af..b11ff073bc 100644
--- a/src/network/networkd-dhcp-server.c
+++ b/src/network/networkd-dhcp-server.c
@@ -567,13 +567,10 @@ static bool dhcp_server_is_ready_to_configure(Link *link) {
return true;
}
-int request_process_dhcp_server(Request *req) {
- Link *link;
+int dhcp_server_process_request(Request *req, Link *link, void *userdata) {
int r;
- assert(req);
- assert(req->type == REQUEST_TYPE_DHCP_SERVER);
- assert_se(link = req->link);
+ assert(link);
if (!dhcp_server_is_ready_to_configure(link))
return 0;
diff --git a/src/network/networkd-dhcp-server.h b/src/network/networkd-dhcp-server.h
index 1af1c65c66..7a204e7d0a 100644
--- a/src/network/networkd-dhcp-server.h
+++ b/src/network/networkd-dhcp-server.h
@@ -11,7 +11,7 @@ void network_adjust_dhcp_server(Network *network);
int link_request_dhcp_server_address(Link *link);
int link_request_dhcp_server(Link *link);
-int request_process_dhcp_server(Request *req);
+int dhcp_server_process_request(Request *req, Link *link, void *userdata);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_relay_agent_suboption);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_emit);
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 2b985f361a..1aa389bb53 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -1597,15 +1597,10 @@ static int dhcp4_configure_duid(Link *link) {
return dhcp_configure_duid(link, link_get_dhcp4_duid(link));
}
-int request_process_dhcp4_client(Request *req) {
- Link *link;
+int dhcp4_process_request(Request *req, Link *link, void *userdata) {
int r;
- assert(req);
- assert(req->link);
- assert(req->type == REQUEST_TYPE_DHCP4_CLIENT);
-
- link = req->link;
+ assert(link);
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
return 0;
@@ -1619,7 +1614,7 @@ int request_process_dhcp4_client(Request *req) {
if (r <= 0)
return r;
- r = dhcp4_configure(req->link);
+ r = dhcp4_configure(link);
if (r < 0)
return log_link_warning_errno(link, r, "Failed to configure DHCPv4 client: %m");
@@ -1629,7 +1624,6 @@ int request_process_dhcp4_client(Request *req) {
log_link_debug(link, "DHCPv4 client is configured%s.",
r > 0 ? ", acquiring DHCPv4 lease" : "");
-
return 1;
}
diff --git a/src/network/networkd-dhcp4.h b/src/network/networkd-dhcp4.h
index 830e39f66a..4e466ca4f9 100644
--- a/src/network/networkd-dhcp4.h
+++ b/src/network/networkd-dhcp4.h
@@ -25,7 +25,7 @@ int dhcp4_start(Link *link);
int dhcp4_lease_lost(Link *link);
int dhcp4_check_ready(Link *link);
-int request_process_dhcp4_client(Request *req);
+int dhcp4_process_request(Request *req, Link *link, void *userdata);
int link_request_dhcp4_client(Link *link);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_client_identifier);
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index 244c3a2a4d..3bb013ebaf 100644
--- a/src/network/networkd-dhcp6.c
+++ b/src/network/networkd-dhcp6.c
@@ -715,15 +715,10 @@ int dhcp6_update_mac(Link *link) {
return 0;
}
-int request_process_dhcp6_client(Request *req) {
- Link *link;
+int dhcp6_process_request(Request *req, Link *link, void *userdata) {
int r;
- assert(req);
- assert(req->link);
- assert(req->type == REQUEST_TYPE_DHCP6_CLIENT);
-
- link = req->link;
+ assert(link);
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
return 0;
@@ -751,7 +746,6 @@ int request_process_dhcp6_client(Request *req) {
log_link_debug(link, "DHCPv6 client is configured%s.",
r > 0 ? ", acquiring DHCPv6 lease" : "");
-
return 1;
}
diff --git a/src/network/networkd-dhcp6.h b/src/network/networkd-dhcp6.h
index 52347c5e7b..e3bc57cc30 100644
--- a/src/network/networkd-dhcp6.h
+++ b/src/network/networkd-dhcp6.h
@@ -21,7 +21,7 @@ int dhcp6_update_mac(Link *link);
int dhcp6_start(Link *link);
int dhcp6_start_on_ra(Link *link, bool information_request);
-int request_process_dhcp6_client(Request *req);
+int dhcp6_process_request(Request *req, Link *link, void *userdata);
int link_request_dhcp6_client(Link *link);
int link_serialize_dhcp6_client(Link *link, FILE *f);
diff --git a/src/network/networkd-ipv6-proxy-ndp.c b/src/network/networkd-ipv6-proxy-ndp.c
index 5844273be9..def456c9aa 100644
--- a/src/network/networkd-ipv6-proxy-ndp.c
+++ b/src/network/networkd-ipv6-proxy-ndp.c
@@ -80,19 +80,17 @@ static int ipv6_proxy_ndp_address_configure(const struct in6_addr *address, Link
return 0;
}
-int request_process_ipv6_proxy_ndp_address(Request *req) {
- Link *link;
+int ipv6_proxy_ndp_address_process_request(Request *req, Link *link, struct in6_addr *address) {
int r;
assert(req);
- assert(req->ipv6_proxy_ndp);
- assert(req->type == REQUEST_TYPE_IPV6_PROXY_NDP);
- assert_se(link = req->link);
+ assert(link);
+ assert(address);
if (!link_is_ready_to_configure(link, false))
return 0;
- r = ipv6_proxy_ndp_address_configure(req->ipv6_proxy_ndp, link, req);
+ r = ipv6_proxy_ndp_address_configure(address, link, req);
if (r < 0)
return log_link_warning_errno(link, r, "Failed to configure IPv6 proxy NDP address: %m");
diff --git a/src/network/networkd-ipv6-proxy-ndp.h b/src/network/networkd-ipv6-proxy-ndp.h
index b35cd56182..39a7820599 100644
--- a/src/network/networkd-ipv6-proxy-ndp.h
+++ b/src/network/networkd-ipv6-proxy-ndp.h
@@ -10,6 +10,6 @@ typedef struct Request Request;
void network_adjust_ipv6_proxy_ndp(Network *network);
int link_request_static_ipv6_proxy_ndp_addresses(Link *link);
-int request_process_ipv6_proxy_ndp_address(Request *req);
+int ipv6_proxy_ndp_address_process_request(Request *req, Link *link, struct in6_addr *address);
CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_proxy_ndp_address);
diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
index 7f2366ba70..2f86ade325 100644
--- a/src/network/networkd-ndisc.c
+++ b/src/network/networkd-ndisc.c
@@ -1122,14 +1122,10 @@ int ndisc_start(Link *link) {
return 1;
}
-int request_process_ndisc(Request *req) {
- Link *link;
+int ndisc_process_request(Request *req, Link *link, void *userdata) {
int r;
- assert(req);
- assert(req->type == REQUEST_TYPE_NDISC);
-
- link = ASSERT_PTR(req->link);
+ assert(link);
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
return 0;
@@ -1148,7 +1144,6 @@ int request_process_ndisc(Request *req) {
log_link_debug(link, "IPv6 Router Discovery is configured%s.",
r > 0 ? " and started" : "");
-
return 1;
}
diff --git a/src/network/networkd-ndisc.h b/src/network/networkd-ndisc.h
index 1958652778..5a7eb58a56 100644
--- a/src/network/networkd-ndisc.h
+++ b/src/network/networkd-ndisc.h
@@ -48,7 +48,7 @@ int ndisc_start(Link *link);
void ndisc_vacuum(Link *link);
void ndisc_flush(Link *link);
-int request_process_ndisc(Request *req);
+int ndisc_process_request(Request *req, Link *link, void *userdata);
int link_request_ndisc(Link *link);
CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_accept_ra_start_dhcp6_client);
diff --git a/src/network/networkd-neighbor.c b/src/network/networkd-neighbor.c
index 13dcba8286..33fa5e21ec 100644
--- a/src/network/networkd-neighbor.c
+++ b/src/network/networkd-neighbor.c
@@ -225,16 +225,12 @@ static int neighbor_configure(Neighbor *neighbor, Link *link, Request *req) {
return 0;
}
-int request_process_neighbor(Request *req) {
- Neighbor *neighbor;
- Link *link;
+int neighbor_process_request(Request *req, Link *link, Neighbor *neighbor) {
int r;
assert(req);
- assert(req->type == REQUEST_TYPE_NEIGHBOR);
-
- neighbor = ASSERT_PTR(req->neighbor);
- link = ASSERT_PTR(req->link);
+ assert(link);
+ assert(neighbor);
if (!link_is_ready_to_configure(link, false))
return 0;
diff --git a/src/network/networkd-neighbor.h b/src/network/networkd-neighbor.h
index ac1678de18..52a7733a89 100644
--- a/src/network/networkd-neighbor.h
+++ b/src/network/networkd-neighbor.h
@@ -39,7 +39,7 @@ int link_drop_foreign_neighbors(Link *link);
void link_foreignize_neighbors(Link *link);
int link_request_static_neighbors(Link *link);
-int request_process_neighbor(Request *req);
+int neighbor_process_request(Request *req, Link *link, Neighbor *neighbor);
int manager_rtnl_process_neighbor(sd_netlink *rtnl, sd_netlink_message *message, Manager *m);
diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c
index ed9d621587..143ecce6c4 100644
--- a/src/network/networkd-nexthop.c
+++ b/src/network/networkd-nexthop.c
@@ -565,16 +565,12 @@ static bool nexthop_is_ready_to_configure(Link *link, const NextHop *nexthop) {
return gateway_is_ready(link, FLAGS_SET(nexthop->flags, RTNH_F_ONLINK), nexthop->family, &nexthop->gw);
}
-int request_process_nexthop(Request *req) {
- NextHop *nexthop;
- Link *link;
+int nexthop_process_request(Request *req, Link *link, NextHop *nexthop) {
int r;
assert(req);
- assert(req->type == REQUEST_TYPE_NEXTHOP);
-
- nexthop = ASSERT_PTR(req->nexthop);
- link = ASSERT_PTR(req->link);
+ assert(link);
+ assert(nexthop);
if (!nexthop_is_ready_to_configure(link, nexthop))
return 0;
diff --git a/src/network/networkd-nexthop.h b/src/network/networkd-nexthop.h
index 16eb02f7eb..c5b58e5d38 100644
--- a/src/network/networkd-nexthop.h
+++ b/src/network/networkd-nexthop.h
@@ -49,7 +49,7 @@ int link_drop_foreign_nexthops(Link *link);
void link_foreignize_nexthops(Link *link);
int link_request_static_nexthops(Link *link, bool only_ipv4);
-int request_process_nexthop(Request *req);
+int nexthop_process_request(Request *req, Link *link, NextHop *nexthop);
int manager_get_nexthop_by_id(Manager *manager, uint32_t id, NextHop **ret);
int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message, Manager *m);
diff --git a/src/network/networkd-queue.c b/src/network/networkd-queue.c
index b30d0532d1..830802324e 100644
--- a/src/network/networkd-queue.c
+++ b/src/network/networkd-queue.c
@@ -369,67 +369,67 @@ int manager_process_requests(sd_event_source *s, void *userdata) {
ORDERED_SET_FOREACH(req, manager->request_queue) {
switch (req->type) {
case REQUEST_TYPE_ACTIVATE_LINK:
- r = request_process_activation(req);
+ r = link_process_activation(req, req->link, req->userdata);
break;
case REQUEST_TYPE_ADDRESS:
- r = request_process_address(req);
+ r = address_process_request(req, req->link, req->address);
break;
case REQUEST_TYPE_ADDRESS_LABEL:
- r = request_process_address_label(req);
+ r = address_label_process_request(req, req->link, req->label);
break;
case REQUEST_TYPE_BRIDGE_FDB:
- r = request_process_bridge_fdb(req);
+ r = bridge_fdb_process_request(req, req->link, req->fdb);
break;
case REQUEST_TYPE_BRIDGE_MDB:
- r = request_process_bridge_mdb(req);
+ r = bridge_mdb_process_request(req, req->link, req->mdb);
break;
case REQUEST_TYPE_DHCP_SERVER:
- r = request_process_dhcp_server(req);
+ r = dhcp_server_process_request(req, req->link, NULL);
break;
case REQUEST_TYPE_DHCP4_CLIENT:
- r = request_process_dhcp4_client(req);
+ r = dhcp4_process_request(req, req->link, NULL);
break;
case REQUEST_TYPE_DHCP6_CLIENT:
- r = request_process_dhcp6_client(req);
+ r = dhcp6_process_request(req, req->link, NULL);
break;
case REQUEST_TYPE_IPV6_PROXY_NDP:
- r = request_process_ipv6_proxy_ndp_address(req);
+ r = ipv6_proxy_ndp_address_process_request(req, req->link, req->ipv6_proxy_ndp);
break;
case REQUEST_TYPE_NDISC:
- r = request_process_ndisc(req);
+ r = ndisc_process_request(req, req->link, NULL);
break;
case REQUEST_TYPE_NEIGHBOR:
- r = request_process_neighbor(req);
+ r = neighbor_process_request(req, req->link, req->neighbor);
break;
case REQUEST_TYPE_NETDEV_INDEPENDENT:
- r = request_process_independent_netdev(req);
+ r = independent_netdev_process_request(req, req->link, req->netdev);
break;
case REQUEST_TYPE_NETDEV_STACKED:
- r = request_process_stacked_netdev(req);
+ r = stacked_netdev_process_request(req, req->link, req->netdev);
break;
case REQUEST_TYPE_NEXTHOP:
- r = request_process_nexthop(req);
+ r = nexthop_process_request(req, req->link, req->nexthop);
break;
case REQUEST_TYPE_RADV:
- r = request_process_radv(req);
+ r = radv_process_request(req, req->link, NULL);
break;
case REQUEST_TYPE_ROUTE:
- r = request_process_route(req);
+ r = route_process_request(req, req->link, req->route);
break;
case REQUEST_TYPE_ROUTING_POLICY_RULE:
- r = request_process_routing_policy_rule(req);
+ r = routing_policy_rule_process_request(req, req->link, req->rule);
break;
case REQUEST_TYPE_SET_LINK:
r = request_process_set_link(req);
break;
case REQUEST_TYPE_TC_QDISC:
- r = request_process_qdisc(req);
+ r = qdisc_process_request(req, req->link, NULL);
break;
case REQUEST_TYPE_TC_CLASS:
- r = request_process_tclass(req);
+ r = tclass_process_request(req, req->link, NULL);
break;
case REQUEST_TYPE_UP_DOWN:
- r = request_process_link_up_or_down(req);
+ r = link_process_up_or_down(req, req->link, req->userdata);
break;
default:
return -EINVAL;
diff --git a/src/network/networkd-radv.c b/src/network/networkd-radv.c
index 507f0a0ccc..f6e1841c05 100644
--- a/src/network/networkd-radv.c
+++ b/src/network/networkd-radv.c
@@ -582,15 +582,10 @@ static int radv_is_ready_to_configure(Link *link) {
return true;
}
-int request_process_radv(Request *req) {
- Link *link;
+int radv_process_request(Request *req, Link *link, void *userdata) {
int r;
- assert(req);
- assert(req->link);
- assert(req->type == REQUEST_TYPE_RADV);
-
- link = req->link;
+ assert(link);
r = radv_is_ready_to_configure(link);
if (r <= 0)
diff --git a/src/network/networkd-radv.h b/src/network/networkd-radv.h
index 952fa8ae58..0d340c955e 100644
--- a/src/network/networkd-radv.h
+++ b/src/network/networkd-radv.h
@@ -68,7 +68,7 @@ int radv_update_mac(Link *link);
int radv_add_prefix(Link *link, const struct in6_addr *prefix, uint8_t prefix_len,
usec_t lifetime_preferred_usec, usec_t lifetime_valid_usec);
-int request_process_radv(Request *req);
+int radv_process_request(Request *req, Link *link, void *userdata);
int link_request_radv(Link *link);
const char* radv_prefix_delegation_to_string(RADVPrefixDelegation i) _const_;
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index a33ab92f3a..1c5ace643e 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -1319,19 +1319,13 @@ static int route_is_ready_to_configure(const Route *route, Link *link) {
return true;
}
-int request_process_route(Request *req) {
+int route_process_request(Request *req, Link *link, Route *route) {
_cleanup_(converted_routes_freep) ConvertedRoutes *converted = NULL;
- Route *route;
- Link *link;
int r;
assert(req);
- assert(req->link);
- assert(req->route);
- assert(req->type == REQUEST_TYPE_ROUTE);
-
- link = req->link;
- route = req->route;
+ assert(link);
+ assert(route);
r = route_is_ready_to_configure(route, link);
if (r < 0)
diff --git a/src/network/networkd-route.h b/src/network/networkd-route.h
index ee8e36f83d..634ed16176 100644
--- a/src/network/networkd-route.h
+++ b/src/network/networkd-route.h
@@ -95,7 +95,7 @@ int link_request_route(
link_netlink_message_handler_t netlink_handler,
Request **ret);
int link_request_static_routes(Link *link, bool only_ipv4);
-int request_process_route(Request *req);
+int route_process_request(Request *req, Link *link, Route *route);
int manager_rtnl_process_route(sd_netlink *rtnl, sd_netlink_message *message, Manager *m);
diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c
index 8ff6b0980c..a90c176f76 100644
--- a/src/network/networkd-routing-policy-rule.c
+++ b/src/network/networkd-routing-policy-rule.c
@@ -724,16 +724,12 @@ void link_foreignize_routing_policy_rules(Link *link) {
}
}
-int request_process_routing_policy_rule(Request *req) {
- RoutingPolicyRule *rule;
- Link *link;
+int routing_policy_rule_process_request(Request *req, Link *link, RoutingPolicyRule *rule) {
int r;
assert(req);
- assert(req->type == REQUEST_TYPE_ROUTING_POLICY_RULE);
-
- link = ASSERT_PTR(req->link);
- rule = ASSERT_PTR(req->rule);
+ assert(link);
+ assert(rule);
if (!link_is_ready_to_configure(link, false))
return 0;
diff --git a/src/network/networkd-routing-policy-rule.h b/src/network/networkd-routing-policy-rule.h
index 2d1ce19165..2d60e59565 100644
--- a/src/network/networkd-routing-policy-rule.h
+++ b/src/network/networkd-routing-policy-rule.h
@@ -64,7 +64,7 @@ int routing_policy_rule_compare_func(const RoutingPolicyRule *a, const RoutingPo
void network_drop_invalid_routing_policy_rules(Network *network);
int link_request_static_routing_policy_rules(Link *link);
-int request_process_routing_policy_rule(Request *req);
+int routing_policy_rule_process_request(Request *req, Link *link, RoutingPolicyRule *rule);
int manager_rtnl_process_rule(sd_netlink *rtnl, sd_netlink_message *message, Manager *m);
int manager_drop_routing_policy_rules_internal(Manager *m, bool foreign, const Link *except);
diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
index 69bbff061d..f5d879af78 100644
--- a/src/network/networkd-setlink.c
+++ b/src/network/networkd-setlink.c
@@ -1096,17 +1096,12 @@ static bool link_is_ready_to_activate(Link *link) {
return true;
}
-int request_process_activation(Request *req) {
- Link *link;
- bool up;
+int link_process_activation(Request *req, Link *link, void *userdata) {
+ bool up = PTR_TO_INT(userdata);
int r;
assert(req);
- assert(req->link);
- assert(req->type == REQUEST_TYPE_ACTIVATE_LINK);
-
- link = req->link;
- up = PTR_TO_INT(req->userdata);
+ assert(link);
if (!link_is_ready_to_activate(link))
return 0;
@@ -1191,17 +1186,12 @@ static bool link_is_ready_to_bring_up_or_down(Link *link, bool up) {
return true;
}
-int request_process_link_up_or_down(Request *req) {
- Link *link;
- bool up;
+int link_process_up_or_down(Request *req, Link *link, void *userdata) {
+ bool up = PTR_TO_INT(userdata);
int r;
assert(req);
- assert(req->link);
- assert(req->type == REQUEST_TYPE_UP_DOWN);
-
- link = req->link;
- up = PTR_TO_INT(req->userdata);
+ assert(link);
if (!link_is_ready_to_bring_up_or_down(link, up))
return 0;
diff --git a/src/network/networkd-setlink.h b/src/network/networkd-setlink.h
index e943f2012a..3c9853e3ad 100644
--- a/src/network/networkd-setlink.h
+++ b/src/network/networkd-setlink.h
@@ -42,10 +42,10 @@ int link_configure_mtu(Link *link);
int request_process_set_link(Request *req);
-int request_process_activation(Request *req);
+int link_process_activation(Request *req, Link *link, void *userdata);
int link_request_to_activate(Link *link);
-int request_process_link_up_or_down(Request *req);
+int link_process_up_or_down(Request *req, Link *link, void *userdata);
int link_request_to_bring_up_or_down(Link *link, bool up);
int link_down_now(Link *link);
diff --git a/src/network/tc/qdisc.c b/src/network/tc/qdisc.c
index 9220299c95..fa3b0925b9 100644
--- a/src/network/tc/qdisc.c
+++ b/src/network/tc/qdisc.c
@@ -368,14 +368,12 @@ static bool qdisc_is_ready_to_configure(QDisc *qdisc, Link *link) {
return link_find_tclass(link, qdisc->parent, NULL) >= 0;
}
-int request_process_qdisc(Request *req) {
- QDisc *qdisc;
- Link *link;
+int qdisc_process_request(Request *req, Link *link, QDisc *qdisc) {
int r;
assert(req);
- assert_se(link = req->link);
- assert_se(qdisc = req->qdisc);
+ assert(link);
+ assert(qdisc);
if (!qdisc_is_ready_to_configure(qdisc, link))
return 0;
diff --git a/src/network/tc/qdisc.h b/src/network/tc/qdisc.h
index 54afe97ced..37ec61cbc7 100644
--- a/src/network/tc/qdisc.h
+++ b/src/network/tc/qdisc.h
@@ -82,7 +82,7 @@ int qdisc_compare_func(const QDisc *a, const QDisc *b);
int link_find_qdisc(Link *link, uint32_t handle, uint32_t parent, const char *kind, QDisc **qdisc);
-int request_process_qdisc(Request *req);
+int qdisc_process_request(Request *req, Link *link, QDisc *qdisc);
int link_request_qdisc(Link *link, QDisc *qdisc);
void network_drop_invalid_qdisc(Network *network);
diff --git a/src/network/tc/tclass.c b/src/network/tc/tclass.c
index 937727796e..b5b3615d98 100644
--- a/src/network/tc/tclass.c
+++ b/src/network/tc/tclass.c
@@ -327,14 +327,12 @@ static bool tclass_is_ready_to_configure(TClass *tclass, Link *link) {
return link_find_qdisc(link, tclass->classid, tclass->parent, tclass_get_tca_kind(tclass), NULL) >= 0;
}
-int request_process_tclass(Request *req) {
- TClass *tclass;
- Link *link;
+int tclass_process_request(Request *req, Link *link, TClass *tclass) {
int r;
assert(req);
- assert_se(link = req->link);
- assert_se(tclass = req->tclass);
+ assert(link);
+ assert(tclass);
if (!tclass_is_ready_to_configure(tclass, link))
return 0;
diff --git a/src/network/tc/tclass.h b/src/network/tc/tclass.h
index c588b38abe..f7b724b002 100644
--- a/src/network/tc/tclass.h
+++ b/src/network/tc/tclass.h
@@ -64,7 +64,7 @@ int tclass_compare_func(const TClass *a, const TClass *b);
int link_find_tclass(Link *link, uint32_t classid, TClass **ret);
-int request_process_tclass(Request *req);
+int tclass_process_request(Request *req, Link *link, TClass *tclass);
int link_request_tclass(Link *link, TClass *tclass);
void network_drop_invalid_tclass(Network *network);