Merge pull request #12738 from yuwata/network-routing-policy-cleanup

network: several cleanups for routing policy rule
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-06-06 18:53:20 +02:00
committed by GitHub
3 changed files with 10 additions and 10 deletions

View File

@@ -830,7 +830,7 @@ static int link_request_set_routing_policy_rule(Link *link) {
continue;
}
r = routing_policy_rule_configure(rule, link, NULL, false);
r = routing_policy_rule_configure(rule, link, NULL);
if (r < 0) {
log_link_warning_errno(link, r, "Could not set routing policy rules: %m");
link_enter_failed(link);

View File

@@ -46,8 +46,10 @@ void routing_policy_rule_free(RoutingPolicyRule *rule) {
}
if (rule->manager) {
set_remove(rule->manager->rules, rule);
set_remove(rule->manager->rules_foreign, rule);
if (set_get(rule->manager->rules, rule) == rule)
set_remove(rule->manager->rules, rule);
if (set_get(rule->manager->rules_foreign, rule) == rule)
set_remove(rule->manager->rules_foreign, rule);
}
network_config_section_free(rule->section);
@@ -275,8 +277,8 @@ static int routing_policy_rule_add_internal(Manager *m,
rule->tos = tos;
rule->fwmark = fwmark;
rule->table = table;
rule->iif = iif;
rule->oif = oif;
rule->iif = TAKE_PTR(iif);
rule->oif = TAKE_PTR(oif);
rule->protocol = protocol;
rule->sport = *sport;
rule->dport = *dport;
@@ -292,9 +294,7 @@ static int routing_policy_rule_add_internal(Manager *m,
if (ret)
*ret = rule;
rule = NULL;
iif = oif = NULL;
TAKE_PTR(rule);
return 0;
}
@@ -474,7 +474,7 @@ static int routing_policy_rule_handler(sd_netlink *rtnl, sd_netlink_message *m,
return 1;
}
int routing_policy_rule_configure(RoutingPolicyRule *rule, Link *link, link_netlink_message_handler_t callback, bool update) {
int routing_policy_rule_configure(RoutingPolicyRule *rule, Link *link, link_netlink_message_handler_t callback) {
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
int r;

View File

@@ -57,7 +57,7 @@ void routing_policy_rule_free(RoutingPolicyRule *rule);
DEFINE_NETWORK_SECTION_FUNCTIONS(RoutingPolicyRule, routing_policy_rule_free);
int routing_policy_rule_configure(RoutingPolicyRule *address, Link *link, link_netlink_message_handler_t callback, bool update);
int routing_policy_rule_configure(RoutingPolicyRule *address, Link *link, link_netlink_message_handler_t callback);
int routing_policy_rule_remove(RoutingPolicyRule *routing_policy_rule, Link *link, link_netlink_message_handler_t callback);
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,