diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2018-05-30 16:31:59 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2018-06-09 15:12:31 +0200 |
commit | bd5038f8b76e2fc1b30e09b5a48d8f96e778f8b1 (patch) | |
tree | 267819255bb5987912ed943cdb5c43d83abab795 /src/network | |
parent | networkd-link: link_configure(); factor out link_configure_can() into separat... (diff) | |
download | systemd-bd5038f8b76e2fc1b30e09b5a48d8f96e778f8b1.tar.xz systemd-bd5038f8b76e2fc1b30e09b5a48d8f96e778f8b1.zip |
networkd-link: link_up_can(): move function upwards
This patch is a preparation patch, to avoid forward declarations in the
next patch.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-link.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index ed87ab8d62..b36c383d37 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1847,6 +1847,31 @@ int link_up(Link *link) { return 0; } +static int link_up_can(Link *link) { + _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL; + int r; + + assert(link); + + log_link_debug(link, "Bringing CAN link up"); + + r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex); + if (r < 0) + return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m"); + + r = sd_rtnl_message_link_set_flags(req, IFF_UP, IFF_UP); + if (r < 0) + return log_link_error_errno(link, r, "Could not set link flags: %m"); + + r = sd_netlink_call_async(link->manager->rtnl, req, link_up_handler, link, 0, NULL); + if (r < 0) + return log_link_error_errno(link, r, "Could not send rtnetlink message: %m"); + + link_ref(link); + + return 0; +} + static int link_down_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) { _cleanup_(link_unrefp) Link *link = userdata; int r; @@ -1891,31 +1916,6 @@ int link_down(Link *link) { return 0; } -static int link_up_can(Link *link) { - _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL; - int r; - - assert(link); - - log_link_debug(link, "Bringing CAN link up"); - - r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex); - if (r < 0) - return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m"); - - r = sd_rtnl_message_link_set_flags(req, IFF_UP, IFF_UP); - if (r < 0) - return log_link_error_errno(link, r, "Could not set link flags: %m"); - - r = sd_netlink_call_async(link->manager->rtnl, req, link_up_handler, link, 0, NULL); - if (r < 0) - return log_link_error_errno(link, r, "Could not send rtnetlink message: %m"); - - link_ref(link); - - return 0; -} - static int link_handle_bound_to_list(Link *link) { Link *l; Iterator i; |