#if __GNUC__ >= 7
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
#endif
+#include <netinet/icmp6.h>
#include <stddef.h>
+
#include "conf-parser.h"
#include "in-addr-prefix-util.h"
#include "netem.h"
IPv6SendRA.HomeAgentLifetimeSec, config_parse_router_home_agent_lifetime, 0, offsetof(Network, home_agent_lifetime_usec)
IPv6SendRA.HomeAgentPreference, config_parse_uint16, 0, offsetof(Network, router_home_agent_preference)
IPv6Prefix.Prefix, config_parse_prefix, 0, 0
-IPv6Prefix.OnLink, config_parse_prefix_boolean, 0, 0
-IPv6Prefix.AddressAutoconfiguration, config_parse_prefix_boolean, 0, 0
+IPv6Prefix.OnLink, config_parse_prefix_boolean, ND_OPT_PI_FLAG_ONLINK, 0
+IPv6Prefix.AddressAutoconfiguration, config_parse_prefix_boolean, ND_OPT_PI_FLAG_AUTO, 0
IPv6Prefix.ValidLifetimeSec, config_parse_prefix_lifetime, 0, 0
IPv6Prefix.PreferredLifetimeSec, config_parse_prefix_lifetime, 0, 0
IPv6Prefix.Assign, config_parse_prefix_boolean, 0, 0
.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,
- .onlink = true,
- .address_auto_configuration = true,
};
r = hashmap_ensure_put(&network->prefixes_by_section, &config_section_hash_ops, prefix->section, prefix);
if (r < 0)
return r;
- r = sd_radv_prefix_set_onlink(p, prefix->onlink);
+ r = sd_radv_prefix_set_onlink(p, FLAGS_SET(prefix->flags, ND_OPT_PI_FLAG_ONLINK));
if (r < 0)
return r;
- r = sd_radv_prefix_set_address_autoconfiguration(p, prefix->address_auto_configuration);
+ r = sd_radv_prefix_set_address_autoconfiguration(p, FLAGS_SET(prefix->flags, ND_OPT_PI_FLAG_AUTO));
if (r < 0)
return r;
return 0;
}
- if (streq(lvalue, "OnLink"))
- p->onlink = r;
- else if (streq(lvalue, "AddressAutoconfiguration"))
- p->address_auto_configuration = r;
- else if (streq(lvalue, "Assign"))
+ if (ltype != 0)
+ SET_FLAG(p->flags, ltype, r);
+ else {
+ assert(streq(lvalue, "Assign"));
p->assign = r;
- else
- assert_not_reached();
+ }
TAKE_PTR(p);
return 0;
Network *network;
ConfigSection *section;
- struct in6_addr prefix;
+ uint8_t flags;
uint8_t prefixlen;
+ struct in6_addr prefix;
usec_t preferred_lifetime;
usec_t valid_lifetime;
- bool onlink;
- bool address_auto_configuration;
-
bool assign;
uint32_t route_metric;
Set *tokens;