diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-07-10 03:06:08 +0200 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2023-07-30 14:55:18 +0200 |
commit | 754252f9231adad1993ca010d5b79f8fe54f8e3b (patch) | |
tree | b8ff9553be1d42ebb2e17c40458a52983f03d81e /src/network | |
parent | Merge pull request #28564 from YHNdnzj/gpt-auto-kill-more-duplicate (diff) | |
download | systemd-754252f9231adad1993ca010d5b79f8fe54f8e3b.tar.xz systemd-754252f9231adad1993ca010d5b79f8fe54f8e3b.zip |
network: rename sd_netlink_message* req -> m
This also merges neighbor_configure_message() with neighbor_configure().
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-neighbor.c | 36 | ||||
-rw-r--r-- | src/network/networkd-nexthop.c | 8 |
2 files changed, 17 insertions, 27 deletions
diff --git a/src/network/networkd-neighbor.c b/src/network/networkd-neighbor.c index e3c332eadb..01d17dd3af 100644 --- a/src/network/networkd-neighbor.c +++ b/src/network/networkd-neighbor.c @@ -175,24 +175,6 @@ static void log_neighbor_debug(const Neighbor *neighbor, const char *str, const IN_ADDR_TO_STRING(neighbor->family, &neighbor->in_addr)); } -static int neighbor_configure_message(Neighbor *neighbor, Link *link, sd_netlink_message *req) { - int r; - - r = sd_rtnl_message_neigh_set_state(req, NUD_PERMANENT); - if (r < 0) - return r; - - r = netlink_message_append_hw_addr(req, NDA_LLADDR, &neighbor->ll_addr); - if (r < 0) - return r; - - r = netlink_message_append_in_addr_union(req, NDA_DST, neighbor->family, &neighbor->in_addr); - if (r < 0) - return r; - - return 0; -} - static int neighbor_configure(Neighbor *neighbor, Link *link, Request *req) { _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL; int r; @@ -211,7 +193,15 @@ static int neighbor_configure(Neighbor *neighbor, Link *link, Request *req) { if (r < 0) return r; - r = neighbor_configure_message(neighbor, link, m); + r = sd_rtnl_message_neigh_set_state(m, NUD_PERMANENT); + if (r < 0) + return r; + + r = netlink_message_append_hw_addr(m, NDA_LLADDR, &neighbor->ll_addr); + if (r < 0) + return r; + + r = netlink_message_append_in_addr_union(m, NDA_DST, neighbor->family, &neighbor->in_addr); if (r < 0) return r; @@ -342,7 +332,7 @@ static int neighbor_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, Link } static int neighbor_remove(Neighbor *neighbor) { - _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL; + _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL; Link *link; int r; @@ -355,16 +345,16 @@ static int neighbor_remove(Neighbor *neighbor) { log_neighbor_debug(neighbor, "Removing", link); - r = sd_rtnl_message_new_neigh(link->manager->rtnl, &req, RTM_DELNEIGH, + r = sd_rtnl_message_new_neigh(link->manager->rtnl, &m, RTM_DELNEIGH, link->ifindex, neighbor->family); if (r < 0) return log_link_error_errno(link, r, "Could not allocate RTM_DELNEIGH message: %m"); - r = netlink_message_append_in_addr_union(req, NDA_DST, neighbor->family, &neighbor->in_addr); + r = netlink_message_append_in_addr_union(m, NDA_DST, neighbor->family, &neighbor->in_addr); if (r < 0) return log_link_error_errno(link, r, "Could not append NDA_DST attribute: %m"); - r = netlink_call_async(link->manager->rtnl, NULL, req, neighbor_remove_handler, + r = netlink_call_async(link->manager->rtnl, NULL, m, neighbor_remove_handler, link_netlink_destroy_callback, link); if (r < 0) return log_link_error_errno(link, r, "Could not send rtnetlink message: %m"); diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index eed28440c2..42b48198af 100644 --- a/src/network/networkd-nexthop.c +++ b/src/network/networkd-nexthop.c @@ -388,7 +388,7 @@ static int nexthop_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, Link } static int nexthop_remove(NextHop *nexthop) { - _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL; + _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL; Manager *manager; Link *link; int r; @@ -407,15 +407,15 @@ static int nexthop_remove(NextHop *nexthop) { log_nexthop_debug(nexthop, "Removing", link); - r = sd_rtnl_message_new_nexthop(manager->rtnl, &req, RTM_DELNEXTHOP, AF_UNSPEC, RTPROT_UNSPEC); + r = sd_rtnl_message_new_nexthop(manager->rtnl, &m, RTM_DELNEXTHOP, AF_UNSPEC, RTPROT_UNSPEC); if (r < 0) return log_link_error_errno(link, r, "Could not create RTM_DELNEXTHOP message: %m"); - r = sd_netlink_message_append_u32(req, NHA_ID, nexthop->id); + r = sd_netlink_message_append_u32(m, NHA_ID, nexthop->id); if (r < 0) return log_link_error_errno(link, r, "Could not append NHA_ID attribute: %m"); - r = netlink_call_async(manager->rtnl, NULL, req, nexthop_remove_handler, + r = netlink_call_async(manager->rtnl, NULL, m, nexthop_remove_handler, link ? link_netlink_destroy_callback : NULL, link); if (r < 0) return log_link_error_errno(link, r, "Could not send rtnetlink message: %m"); |