]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: drop unused nexthop_remove() and nexthop_equal()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 29 Sep 2020 08:29:19 +0000 (17:29 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 6 Oct 2020 17:39:51 +0000 (02:39 +0900)
src/network/networkd-nexthop.c
src/network/networkd-nexthop.h

index 4436aa2a36cda793bdf2cb25bebf75c7f4dff119..6ff616d906c51ac7a61011245f854f559e94896e 100644 (file)
@@ -161,16 +161,6 @@ DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(
                 nexthop_compare_func,
                 nexthop_free);
 
-bool nexthop_equal(NextHop *r1, NextHop *r2) {
-        if (r1 == r2)
-                return true;
-
-        if (!r1 || !r2)
-                return false;
-
-        return nexthop_compare_func(r1, r2) == 0;
-}
-
 static int nexthop_get(Link *link, NextHop *in, NextHop **ret) {
         NextHop *existing;
 
@@ -260,67 +250,6 @@ static int nexthop_add(Link *link, NextHop *in, NextHop **ret) {
         return 0;
 }
 
-static int nexthop_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
-        int r;
-
-        assert(m);
-        assert(link);
-        assert(link->ifname);
-
-        if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
-                return 1;
-
-        r = sd_netlink_message_get_errno(m);
-        if (r < 0 && r != -ESRCH)
-                log_link_message_warning_errno(link, m, r, "Could not drop nexthop, ignoring");
-
-        return 1;
-}
-
-int nexthop_remove(NextHop *nexthop, Link *link,
-                   link_netlink_message_handler_t callback) {
-
-        _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
-        int r;
-
-        assert(link);
-        assert(link->manager);
-        assert(link->manager->rtnl);
-        assert(link->ifindex > 0);
-        assert(IN_SET(nexthop->family, AF_INET, AF_INET6));
-
-        r = sd_rtnl_message_new_nexthop(link->manager->rtnl, &req,
-                                      RTM_DELNEXTHOP, nexthop->family,
-                                      nexthop->protocol);
-        if (r < 0)
-                return log_link_error_errno(link, r, "Could not create RTM_DELNEXTHOP message: %m");
-
-        if (DEBUG_LOGGING) {
-                _cleanup_free_ char *gw = NULL;
-
-                if (!in_addr_is_null(nexthop->family, &nexthop->gw))
-                        (void) in_addr_to_string(nexthop->family, &nexthop->gw, &gw);
-
-                log_link_debug(link, "Removing nexthop: gw: %s", strna(gw));
-        }
-
-        if (in_addr_is_null(nexthop->family, &nexthop->gw) == 0) {
-                r = netlink_message_append_in_addr_union(req, RTA_GATEWAY, nexthop->family, &nexthop->gw);
-                if (r < 0)
-                        return log_link_error_errno(link, r, "Could not append RTA_GATEWAY attribute: %m");
-        }
-
-        r = netlink_call_async(link->manager->rtnl, NULL, req,
-                               callback ?: nexthop_remove_handler,
-                               link_netlink_destroy_callback, link);
-        if (r < 0)
-                return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
-
-        link_ref(link);
-
-        return 0;
-}
-
 static int nexthop_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
         int r;
 
index 9d5736b3f9cda24d150f18834f22fb86d42f78ea..af6bf7b0c2df189bb92df01aa06efe23d989981c 100644 (file)
@@ -31,14 +31,11 @@ struct NextHop {
 };
 
 void nexthop_free(NextHop *nexthop);
-int nexthop_remove(NextHop *nexthop, Link *link, link_netlink_message_handler_t callback);
 
 int link_set_nexthop(Link *link);
 
 int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message, Manager *m);
 
-bool nexthop_equal(NextHop *r1, NextHop *r2);
-
 int nexthop_section_verify(NextHop *nexthop);
 
 CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_id);