]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: set default callbacks for routing_policy_rule_configure() and routing_policy...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 28 Nov 2018 20:18:16 +0000 (21:18 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 2 Dec 2018 05:23:45 +0000 (06:23 +0100)
src/network/networkd-link.c
src/network/networkd-routing-policy-rule.c
src/network/networkd-routing-policy-rule.h

index 604d9d0a5d4f46989b4ba2a8fb9eac08544b256c..891f72b6ab9d3b0e2f3e2bb4e86899e3b43c0494 100644 (file)
@@ -801,7 +801,7 @@ static int link_set_routing_policy_rule(Link *link) {
                         continue;
                 }
 
-                r = routing_policy_rule_configure(rule, link, link_routing_policy_rule_handler, false);
+                r = routing_policy_rule_configure(rule, link, NULL, false);
                 if (r < 0) {
                         log_link_warning_errno(link, r, "Could not set routing policy rules: %m");
                         link_enter_failed(link);
index e84612d41df3c9f3c394e1b3582b528c8055382a..f883dc0e0602fd2cb41a1aeef73d435b4a37f09d 100644 (file)
@@ -404,7 +404,8 @@ int routing_policy_rule_remove(RoutingPolicyRule *routing_policy_rule, Link *lin
                         return log_error_errno(r, "Could not set destination prefix length: %m");
         }
 
-        r = sd_netlink_call_async(link->manager->rtnl, NULL, m, callback,
+        r = sd_netlink_call_async(link->manager->rtnl, NULL, m,
+                                  callback ?: routing_policy_rule_remove_handler,
                                   link_netlink_destroy_callback, link, 0, __func__);
         if (r < 0)
                 return log_error_errno(r, "Could not send rtnetlink message: %m");
@@ -461,7 +462,7 @@ static int routing_policy_rule_new_static(Network *network, const char *filename
         return 0;
 }
 
-int link_routing_policy_rule_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
+static int routing_policy_rule_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
         Link *link = userdata;
         int r;
 
@@ -597,7 +598,8 @@ int routing_policy_rule_configure(RoutingPolicyRule *rule, Link *link, sd_netlin
 
         rule->link = link;
 
-        r = sd_netlink_call_async(link->manager->rtnl, NULL, m, callback,
+        r = sd_netlink_call_async(link->manager->rtnl, NULL, m,
+                                  callback ?: routing_policy_rule_handler,
                                   link_netlink_destroy_callback, link, 0, __func__);
         if (r < 0)
                 return log_error_errno(r, "Could not send rtnetlink message: %m");
@@ -1239,7 +1241,7 @@ void routing_policy_rule_purge(Manager *m, Link *link) {
                 existing = set_get(m->rules_foreign, rule);
                 if (existing) {
 
-                        r = routing_policy_rule_remove(rule, link, routing_policy_rule_remove_handler);
+                        r = routing_policy_rule_remove(rule, link, NULL);
                         if (r < 0) {
                                 log_warning_errno(r, "Could not remove routing policy rules: %m");
                                 continue;
index 3bb3b4cd8110447e77dc4506541935c8ced98691..c31ed566ecb7721cc8ac477bc47617a6a5abdd31 100644 (file)
@@ -55,8 +55,6 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(RoutingPolicyRule*, routing_policy_rule_free);
 
 int routing_policy_rule_configure(RoutingPolicyRule *address, Link *link, sd_netlink_message_handler_t callback, bool update);
 int routing_policy_rule_remove(RoutingPolicyRule *routing_policy_rule, Link *link, sd_netlink_message_handler_t callback);
-int link_routing_policy_rule_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata);
-int link_routing_policy_rule_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata);
 
 int routing_policy_rule_add(Manager *m, int family, const union in_addr_union *from, uint8_t from_prefixlen, const union in_addr_union *to, uint8_t to_prefixlen,
                             uint8_t tos, uint32_t fwmark, uint32_t table, const char *iif, const char *oif, uint8_t protocol, const struct fib_rule_port_range *sport,