summaryrefslogtreecommitdiff
path: root/src/network/networkd-dhcp6.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-02-28 09:20:42 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-03-11 14:20:31 +0900
commit80d62d4f1aa62c03828e4cbe2c2dfb2a19765af8 (patch)
tree33e0ee22b8f8e36836a585cf09e89523a4d01266 /src/network/networkd-dhcp6.c
parente26d3d407cbdf9138139ca9526573c494ed55e81 (diff)
downloadsystemd-80d62d4f1aa62c03828e4cbe2c2dfb2a19765af8.tar.gz
network: introduce request_call_netlink_async()
In most netlink handlers, we do the following, 1. decrease the message counter, 2. check the link state, 3. error handling, 4. update link state via e.g. link_check_ready(). The first two steps are mostly common, hence let's extract it. Moreover, this is not only extracting the common logic, but provide a strong advantage; `request_call_netlink_async()` assigns the relevant Request object to the userdata of the netlink slot, and the request object has full information about the message we sent. Hence, in the future, netlink handler can print more detailed error message. E.g. when an address is failed to configure, then currently we only show an address is failed to configure, but with this commit, potentially we can show which address is failed explicitly. This does not change such error handling yet. But let's do that later.
Diffstat (limited to 'src/network/networkd-dhcp6.c')
-rw-r--r--src/network/networkd-dhcp6.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index 3bb013ebaf..bceae735b0 100644
--- a/src/network/networkd-dhcp6.c
+++ b/src/network/networkd-dhcp6.c
@@ -136,13 +136,10 @@ int dhcp6_check_ready(Link *link) {
return 0;
}
-static int dhcp6_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
+static int dhcp6_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Request *req, Link *link, Address *address) {
int r;
assert(link);
- assert(link->dhcp6_messages > 0);
-
- link->dhcp6_messages--;
r = address_configure_handler_internal(rtnl, m, link, "Could not set DHCPv6 address");
if (r <= 0)