|
|
|
@@ -35,7 +35,7 @@ bool link_radv_enabled(Link *link) {
|
|
|
|
|
return link->network->router_prefix_delegation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Prefix *prefix_free(Prefix *prefix) {
|
|
|
|
|
Prefix* prefix_free(Prefix *prefix) {
|
|
|
|
|
if (!prefix)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
@@ -80,9 +80,11 @@ static int prefix_new_static(Network *network, const char *filename, unsigned se
|
|
|
|
|
.network = network,
|
|
|
|
|
.section = TAKE_PTR(n),
|
|
|
|
|
|
|
|
|
|
.flags = ND_OPT_PI_FLAG_ONLINK | ND_OPT_PI_FLAG_AUTO,
|
|
|
|
|
.preferred_lifetime = RADV_DEFAULT_PREFERRED_LIFETIME_USEC,
|
|
|
|
|
.valid_lifetime = RADV_DEFAULT_VALID_LIFETIME_USEC,
|
|
|
|
|
.prefix.flags = ND_OPT_PI_FLAG_ONLINK | ND_OPT_PI_FLAG_AUTO,
|
|
|
|
|
.prefix.valid_lifetime = RADV_DEFAULT_VALID_LIFETIME_USEC,
|
|
|
|
|
.prefix.preferred_lifetime = RADV_DEFAULT_PREFERRED_LIFETIME_USEC,
|
|
|
|
|
.prefix.valid_until = USEC_INFINITY,
|
|
|
|
|
.prefix.preferred_until = USEC_INFINITY,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
r = hashmap_ensure_put(&network->prefixes_by_section, &config_section_hash_ops, prefix->section, prefix);
|
|
|
|
@@ -93,7 +95,7 @@ static int prefix_new_static(Network *network, const char *filename, unsigned se
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RoutePrefix *route_prefix_free(RoutePrefix *prefix) {
|
|
|
|
|
RoutePrefix* route_prefix_free(RoutePrefix *prefix) {
|
|
|
|
|
if (!prefix)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
@@ -137,7 +139,8 @@ static int route_prefix_new_static(Network *network, const char *filename, unsig
|
|
|
|
|
.network = network,
|
|
|
|
|
.section = TAKE_PTR(n),
|
|
|
|
|
|
|
|
|
|
.lifetime = RADV_DEFAULT_VALID_LIFETIME_USEC,
|
|
|
|
|
.route.lifetime = RADV_DEFAULT_VALID_LIFETIME_USEC,
|
|
|
|
|
.route.valid_until = USEC_INFINITY,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
r = hashmap_ensure_put(&network->route_prefixes_by_section, &config_section_hash_ops, prefix->section, prefix);
|
|
|
|
@@ -148,7 +151,7 @@ static int route_prefix_new_static(Network *network, const char *filename, unsig
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pref64Prefix *pref64_prefix_free(pref64Prefix *prefix) {
|
|
|
|
|
Prefix64* prefix64_free(Prefix64 *prefix) {
|
|
|
|
|
if (!prefix)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
@@ -162,11 +165,11 @@ pref64Prefix *pref64_prefix_free(pref64Prefix *prefix) {
|
|
|
|
|
return mfree(prefix);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFINE_SECTION_CLEANUP_FUNCTIONS(pref64Prefix, pref64_prefix_free);
|
|
|
|
|
DEFINE_SECTION_CLEANUP_FUNCTIONS(Prefix64, prefix64_free);
|
|
|
|
|
|
|
|
|
|
static int pref64_prefix_new_static(Network *network, const char *filename, unsigned section_line, pref64Prefix **ret) {
|
|
|
|
|
static int prefix64_new_static(Network *network, const char *filename, unsigned section_line, Prefix64 **ret) {
|
|
|
|
|
_cleanup_(config_section_freep) ConfigSection *n = NULL;
|
|
|
|
|
_cleanup_(pref64_prefix_freep) pref64Prefix *prefix = NULL;
|
|
|
|
|
_cleanup_(prefix64_freep) Prefix64 *prefix = NULL;
|
|
|
|
|
int r;
|
|
|
|
|
|
|
|
|
|
assert(network);
|
|
|
|
@@ -184,15 +187,16 @@ static int pref64_prefix_new_static(Network *network, const char *filename, unsi
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prefix = new(pref64Prefix, 1);
|
|
|
|
|
prefix = new(Prefix64, 1);
|
|
|
|
|
if (!prefix)
|
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
|
|
*prefix = (pref64Prefix) {
|
|
|
|
|
*prefix = (Prefix64) {
|
|
|
|
|
.network = network,
|
|
|
|
|
.section = TAKE_PTR(n),
|
|
|
|
|
|
|
|
|
|
.lifetime = RADV_PREF64_DEFAULT_LIFETIME_USEC,
|
|
|
|
|
.prefix64.lifetime = RADV_PREF64_DEFAULT_LIFETIME_USEC,
|
|
|
|
|
.prefix64.valid_until = USEC_INFINITY,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
r = hashmap_ensure_put(&network->pref64_prefixes_by_section, &config_section_hash_ops, prefix->section, prefix);
|
|
|
|
@@ -217,11 +221,11 @@ int link_request_radv_addresses(Link *link) {
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* radv_generate_addresses() below requires the prefix length <= 64. */
|
|
|
|
|
if (p->prefixlen > 64)
|
|
|
|
|
if (p->prefix.prefixlen > 64)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
_cleanup_hashmap_free_ Hashmap *tokens_by_address = NULL;
|
|
|
|
|
r = radv_generate_addresses(link, p->tokens, &p->prefix, p->prefixlen, &tokens_by_address);
|
|
|
|
|
r = radv_generate_addresses(link, p->tokens, &p->prefix.address, p->prefix.prefixlen, &tokens_by_address);
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
@@ -237,7 +241,7 @@ int link_request_radv_addresses(Link *link) {
|
|
|
|
|
address->source = NETWORK_CONFIG_SOURCE_STATIC;
|
|
|
|
|
address->family = AF_INET6;
|
|
|
|
|
address->in_addr.in6 = *a;
|
|
|
|
|
address->prefixlen = p->prefixlen;
|
|
|
|
|
address->prefixlen = p->prefix.prefixlen;
|
|
|
|
|
address->route_metric = p->route_metric;
|
|
|
|
|
address->token = ipv6_token_ref(token);
|
|
|
|
|
|
|
|
|
@@ -285,23 +289,23 @@ static int radv_set_prefix(Link *link, Prefix *prefix) {
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
r = sd_radv_prefix_set_prefix(p, &prefix->prefix, prefix->prefixlen);
|
|
|
|
|
r = sd_radv_prefix_set_prefix(p, &prefix->prefix.address, prefix->prefix.prefixlen);
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
r = sd_radv_prefix_set_preferred_lifetime(p, prefix->preferred_lifetime, USEC_INFINITY);
|
|
|
|
|
r = sd_radv_prefix_set_preferred_lifetime(p, prefix->prefix.preferred_lifetime, prefix->prefix.preferred_until);
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
r = sd_radv_prefix_set_valid_lifetime(p, prefix->valid_lifetime, USEC_INFINITY);
|
|
|
|
|
r = sd_radv_prefix_set_valid_lifetime(p, prefix->prefix.valid_lifetime, prefix->prefix.valid_until);
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
r = sd_radv_prefix_set_onlink(p, FLAGS_SET(prefix->flags, ND_OPT_PI_FLAG_ONLINK));
|
|
|
|
|
r = sd_radv_prefix_set_onlink(p, FLAGS_SET(prefix->prefix.flags, ND_OPT_PI_FLAG_ONLINK));
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
r = sd_radv_prefix_set_address_autoconfiguration(p, FLAGS_SET(prefix->flags, ND_OPT_PI_FLAG_AUTO));
|
|
|
|
|
r = sd_radv_prefix_set_address_autoconfiguration(p, FLAGS_SET(prefix->prefix.flags, ND_OPT_PI_FLAG_AUTO));
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
@@ -320,18 +324,18 @@ static int radv_set_route_prefix(Link *link, RoutePrefix *prefix) {
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
r = sd_radv_route_prefix_set_prefix(p, &prefix->prefix, prefix->prefixlen);
|
|
|
|
|
r = sd_radv_route_prefix_set_prefix(p, &prefix->route.address, prefix->route.prefixlen);
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
r = sd_radv_route_prefix_set_lifetime(p, prefix->lifetime, USEC_INFINITY);
|
|
|
|
|
r = sd_radv_route_prefix_set_lifetime(p, prefix->route.lifetime, prefix->route.valid_until);
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
return sd_radv_add_route_prefix(link->radv, p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int radv_set_pref64_prefix(Link *link, pref64Prefix *prefix) {
|
|
|
|
|
static int radv_set_pref64_prefix(Link *link, Prefix64 *prefix) {
|
|
|
|
|
_cleanup_(sd_radv_pref64_prefix_unrefp) sd_radv_pref64_prefix *p = NULL;
|
|
|
|
|
int r;
|
|
|
|
|
|
|
|
|
@@ -343,7 +347,7 @@ static int radv_set_pref64_prefix(Link *link, pref64Prefix *prefix) {
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
r = sd_radv_pref64_prefix_set_prefix(p, &prefix->prefix, prefix->prefixlen, prefix->lifetime);
|
|
|
|
|
r = sd_radv_pref64_prefix_set_prefix(p, &prefix->prefix64.prefix, prefix->prefix64.prefixlen, prefix->prefix64.lifetime);
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
@@ -496,9 +500,6 @@ static int radv_find_uplink(Link *link, Link **ret) {
|
|
|
|
|
|
|
|
|
|
static int radv_configure(Link *link) {
|
|
|
|
|
Link *uplink = NULL;
|
|
|
|
|
RoutePrefix *q;
|
|
|
|
|
pref64Prefix *n;
|
|
|
|
|
Prefix *p;
|
|
|
|
|
int r;
|
|
|
|
|
|
|
|
|
|
assert(link);
|
|
|
|
@@ -553,18 +554,21 @@ static int radv_configure(Link *link) {
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
Prefix *p;
|
|
|
|
|
HASHMAP_FOREACH(p, link->network->prefixes_by_section) {
|
|
|
|
|
r = radv_set_prefix(link, p);
|
|
|
|
|
if (r < 0 && r != -EEXIST)
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RoutePrefix *q;
|
|
|
|
|
HASHMAP_FOREACH(q, link->network->route_prefixes_by_section) {
|
|
|
|
|
r = radv_set_route_prefix(link, q);
|
|
|
|
|
if (r < 0 && r != -EEXIST)
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Prefix64 *n;
|
|
|
|
|
HASHMAP_FOREACH(n, link->network->pref64_prefixes_by_section) {
|
|
|
|
|
r = radv_set_pref64_prefix(link, n);
|
|
|
|
|
if (r < 0 && r != -EEXIST)
|
|
|
|
@@ -781,36 +785,36 @@ static int prefix_section_verify(Prefix *p) {
|
|
|
|
|
if (section_is_invalid(p->section))
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
|
|
if (in6_addr_is_null(&p->prefix))
|
|
|
|
|
if (in6_addr_is_null(&p->prefix.address))
|
|
|
|
|
return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
|
|
|
|
|
"%s: [IPv6Prefix] section without Prefix= field configured, "
|
|
|
|
|
"or specified prefix is the null address. "
|
|
|
|
|
"Ignoring [IPv6Prefix] section from line %u.",
|
|
|
|
|
p->section->filename, p->section->line);
|
|
|
|
|
|
|
|
|
|
if (p->prefixlen < 3 || p->prefixlen > 128)
|
|
|
|
|
if (p->prefix.prefixlen < 3 || p->prefix.prefixlen > 128)
|
|
|
|
|
return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
|
|
|
|
|
"%s: Invalid prefix length %u is specified in [IPv6Prefix] section. "
|
|
|
|
|
"Valid range is 3…128. Ignoring [IPv6Prefix] section from line %u.",
|
|
|
|
|
p->section->filename, p->prefixlen, p->section->line);
|
|
|
|
|
p->section->filename, p->prefix.prefixlen, p->section->line);
|
|
|
|
|
|
|
|
|
|
if (p->prefixlen > 64) {
|
|
|
|
|
if (p->prefix.prefixlen > 64) {
|
|
|
|
|
log_info("%s:%u: Unusual prefix length %u (> 64) is specified in [IPv6Prefix] section from line %s%s.",
|
|
|
|
|
p->section->filename, p->section->line,
|
|
|
|
|
p->prefixlen,
|
|
|
|
|
p->prefix.prefixlen,
|
|
|
|
|
p->assign ? ", refusing to assign an address in " : "",
|
|
|
|
|
p->assign ? IN6_ADDR_PREFIX_TO_STRING(&p->prefix, p->prefixlen) : "");
|
|
|
|
|
p->assign ? IN6_ADDR_PREFIX_TO_STRING(&p->prefix.address, p->prefix.prefixlen) : "");
|
|
|
|
|
|
|
|
|
|
p->assign = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (p->preferred_lifetime > p->valid_lifetime)
|
|
|
|
|
if (p->prefix.preferred_lifetime > p->prefix.valid_lifetime)
|
|
|
|
|
return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
|
|
|
|
|
"%s: The preferred lifetime %s is longer than the valid lifetime %s. "
|
|
|
|
|
"Ignoring [IPv6Prefix] section from line %u.",
|
|
|
|
|
p->section->filename,
|
|
|
|
|
FORMAT_TIMESPAN(p->preferred_lifetime, USEC_PER_SEC),
|
|
|
|
|
FORMAT_TIMESPAN(p->valid_lifetime, USEC_PER_SEC),
|
|
|
|
|
FORMAT_TIMESPAN(p->prefix.preferred_lifetime, USEC_PER_SEC),
|
|
|
|
|
FORMAT_TIMESPAN(p->prefix.valid_lifetime, USEC_PER_SEC),
|
|
|
|
|
p->section->line);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
@@ -820,11 +824,11 @@ static int route_prefix_section_verify(RoutePrefix *p) {
|
|
|
|
|
if (section_is_invalid(p->section))
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
|
|
if (p->prefixlen > 128)
|
|
|
|
|
if (p->route.prefixlen > 128)
|
|
|
|
|
return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
|
|
|
|
|
"%s: Invalid prefix length %u is specified in [IPv6RoutePrefix] section. "
|
|
|
|
|
"Valid range is 0…128. Ignoring [IPv6RoutePrefix] section from line %u.",
|
|
|
|
|
p->section->filename, p->prefixlen, p->section->line);
|
|
|
|
|
p->section->filename, p->route.prefixlen, p->section->line);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@@ -855,7 +859,7 @@ void network_adjust_radv(Network *network) {
|
|
|
|
|
if (!FLAGS_SET(network->router_prefix_delegation, RADV_PREFIX_DELEGATION_STATIC)) {
|
|
|
|
|
network->prefixes_by_section = hashmap_free_with_destructor(network->prefixes_by_section, prefix_free);
|
|
|
|
|
network->route_prefixes_by_section = hashmap_free_with_destructor(network->route_prefixes_by_section, route_prefix_free);
|
|
|
|
|
network->pref64_prefixes_by_section = hashmap_free_with_destructor(network->pref64_prefixes_by_section, pref64_prefix_free);
|
|
|
|
|
network->pref64_prefixes_by_section = hashmap_free_with_destructor(network->pref64_prefixes_by_section, prefix64_free);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!network->router_prefix_delegation)
|
|
|
|
@@ -883,10 +887,10 @@ void network_adjust_radv(Network *network) {
|
|
|
|
|
if (route_prefix_section_verify(route) < 0)
|
|
|
|
|
route_prefix_free(route);
|
|
|
|
|
|
|
|
|
|
pref64Prefix *pref64;
|
|
|
|
|
Prefix64 *pref64;
|
|
|
|
|
HASHMAP_FOREACH(pref64, network->pref64_prefixes_by_section)
|
|
|
|
|
if (section_is_invalid(pref64->section))
|
|
|
|
|
pref64_prefix_free(pref64);
|
|
|
|
|
prefix64_free(pref64);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int config_parse_prefix(
|
|
|
|
@@ -915,15 +919,15 @@ int config_parse_prefix(
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return log_oom();
|
|
|
|
|
|
|
|
|
|
r = in_addr_prefix_from_string(rvalue, AF_INET6, &a, &p->prefixlen);
|
|
|
|
|
r = in_addr_prefix_from_string(rvalue, AF_INET6, &a, &p->prefix.prefixlen);
|
|
|
|
|
if (r < 0) {
|
|
|
|
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
|
|
|
|
"Prefix is invalid, ignoring assignment: %s", rvalue);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(void) in6_addr_mask(&a.in6, p->prefixlen);
|
|
|
|
|
p->prefix = a.in6;
|
|
|
|
|
(void) in6_addr_mask(&a.in6, p->prefix.prefixlen);
|
|
|
|
|
p->prefix.address = a.in6;
|
|
|
|
|
|
|
|
|
|
TAKE_PTR(p);
|
|
|
|
|
return 0;
|
|
|
|
@@ -962,7 +966,7 @@ int config_parse_prefix_boolean(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ltype != 0)
|
|
|
|
|
SET_FLAG(p->flags, ltype, r);
|
|
|
|
|
SET_FLAG(p->prefix.flags, ltype, r);
|
|
|
|
|
else {
|
|
|
|
|
assert(streq(lvalue, "Assign"));
|
|
|
|
|
p->assign = r;
|
|
|
|
@@ -1012,9 +1016,9 @@ int config_parse_prefix_lifetime(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (streq(lvalue, "PreferredLifetimeSec"))
|
|
|
|
|
p->preferred_lifetime = usec;
|
|
|
|
|
p->prefix.preferred_lifetime = usec;
|
|
|
|
|
else if (streq(lvalue, "ValidLifetimeSec"))
|
|
|
|
|
p->valid_lifetime = usec;
|
|
|
|
|
p->prefix.valid_lifetime = usec;
|
|
|
|
|
else
|
|
|
|
|
assert_not_reached();
|
|
|
|
|
|
|
|
|
@@ -1119,15 +1123,15 @@ int config_parse_route_prefix(
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return log_oom();
|
|
|
|
|
|
|
|
|
|
r = in_addr_prefix_from_string(rvalue, AF_INET6, &a, &p->prefixlen);
|
|
|
|
|
r = in_addr_prefix_from_string(rvalue, AF_INET6, &a, &p->route.prefixlen);
|
|
|
|
|
if (r < 0) {
|
|
|
|
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
|
|
|
|
"Route prefix is invalid, ignoring assignment: %s", rvalue);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(void) in6_addr_mask(&a.in6, p->prefixlen);
|
|
|
|
|
p->prefix = a.in6;
|
|
|
|
|
(void) in6_addr_mask(&a.in6, p->route.prefixlen);
|
|
|
|
|
p->route.address = a.in6;
|
|
|
|
|
|
|
|
|
|
TAKE_PTR(p);
|
|
|
|
|
return 0;
|
|
|
|
@@ -1172,7 +1176,7 @@ int config_parse_route_prefix_lifetime(
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p->lifetime = usec;
|
|
|
|
|
p->route.lifetime = usec;
|
|
|
|
|
|
|
|
|
|
TAKE_PTR(p);
|
|
|
|
|
return 0;
|
|
|
|
@@ -1190,7 +1194,7 @@ int config_parse_pref64_prefix(
|
|
|
|
|
void *data,
|
|
|
|
|
void *userdata) {
|
|
|
|
|
|
|
|
|
|
_cleanup_(pref64_prefix_free_or_set_invalidp) pref64Prefix *p = NULL;
|
|
|
|
|
_cleanup_(prefix64_free_or_set_invalidp) Prefix64 *p = NULL;
|
|
|
|
|
Network *network = ASSERT_PTR(userdata);
|
|
|
|
|
union in_addr_union a;
|
|
|
|
|
uint8_t prefixlen;
|
|
|
|
@@ -1201,7 +1205,7 @@ int config_parse_pref64_prefix(
|
|
|
|
|
assert(lvalue);
|
|
|
|
|
assert(rvalue);
|
|
|
|
|
|
|
|
|
|
r = pref64_prefix_new_static(network, filename, section_line, &p);
|
|
|
|
|
r = prefix64_new_static(network, filename, section_line, &p);
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return log_oom();
|
|
|
|
|
|
|
|
|
@@ -1219,8 +1223,8 @@ int config_parse_pref64_prefix(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(void) in6_addr_mask(&a.in6, prefixlen);
|
|
|
|
|
p->prefix = a.in6;
|
|
|
|
|
p->prefixlen = prefixlen;
|
|
|
|
|
p->prefix64.prefix = a.in6;
|
|
|
|
|
p->prefix64.prefixlen = prefixlen;
|
|
|
|
|
|
|
|
|
|
TAKE_PTR(p);
|
|
|
|
|
return 0;
|
|
|
|
@@ -1238,7 +1242,7 @@ int config_parse_pref64_prefix_lifetime(
|
|
|
|
|
void *data,
|
|
|
|
|
void *userdata) {
|
|
|
|
|
|
|
|
|
|
_cleanup_(pref64_prefix_free_or_set_invalidp) pref64Prefix *p = NULL;
|
|
|
|
|
_cleanup_(prefix64_free_or_set_invalidp) Prefix64 *p = NULL;
|
|
|
|
|
Network *network = ASSERT_PTR(userdata);
|
|
|
|
|
usec_t usec;
|
|
|
|
|
int r;
|
|
|
|
@@ -1248,7 +1252,7 @@ int config_parse_pref64_prefix_lifetime(
|
|
|
|
|
assert(lvalue);
|
|
|
|
|
assert(rvalue);
|
|
|
|
|
|
|
|
|
|
r = pref64_prefix_new_static(network, filename, section_line, &p);
|
|
|
|
|
r = prefix64_new_static(network, filename, section_line, &p);
|
|
|
|
|
if (r < 0)
|
|
|
|
|
return log_oom();
|
|
|
|
|
|
|
|
|
@@ -1265,7 +1269,7 @@ int config_parse_pref64_prefix_lifetime(
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p->lifetime = usec;
|
|
|
|
|
p->prefix64.lifetime = usec;
|
|
|
|
|
|
|
|
|
|
TAKE_PTR(p);
|
|
|
|
|
return 0;
|
|
|
|
|