uint8_t tos,
uint32_t fwmark,
uint32_t table,
- char *iif,
- char *oif,
+ const char *iif,
+ const char *oif,
RoutingPolicyRule **ret) {
RoutingPolicyRule rule, *existing;
.tos = tos,
.fwmark = fwmark,
.table = table,
- .iif = iif,
- .oif = oif
+ .iif = (char*) iif,
+ .oif = (char*) oif
};
if (m->rules) {
uint8_t tos,
uint32_t fwmark,
uint32_t table,
- char *iif,
- char *oif,
+ const char *_iif,
+ const char *_oif,
RoutingPolicyRule **ret) {
_cleanup_(routing_policy_rule_freep) RoutingPolicyRule *rule = NULL;
+ _cleanup_free_ char *iif = NULL, *oif = NULL;
int r;
assert_return(rules, -EINVAL);
+ if (_iif) {
+ iif = strdup(_iif);
+ if (!iif)
+ return -ENOMEM;
+ }
+
+ if (_oif) {
+ oif = strdup(_oif);
+ if (!oif)
+ return -ENOMEM;
+ }
+
r = routing_policy_rule_new(&rule);
if (r < 0)
return r;
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);
r = set_ensure_allocated(rules, &routing_policy_rule_hash_ops);
if (r < 0)
uint8_t tos,
uint32_t fwmark,
uint32_t table,
- char *iif,
- char *oif,
+ const char *iif,
+ const char *oif,
RoutingPolicyRule **ret) {
return routing_policy_rule_add_internal(m, &m->rules, family, from, from_prefixlen, to, to_prefixlen, tos, fwmark, table, iif, oif, ret);
uint8_t tos,
uint32_t fwmark,
uint32_t table,
- char *iif,
- char *oif,
+ const char *iif,
+ const char *oif,
RoutingPolicyRule **ret) {
return routing_policy_rule_add_internal(m, &m->rules_foreign, family, from, from_prefixlen, to, to_prefixlen, tos, fwmark, table, iif, oif, ret);
}