#include "sd-ndisc.h"
+#include "missing_network.h"
#include "networkd-ndisc.h"
#include "networkd-route.h"
#include "strv.h"
return log_link_error_errno(link, r, "Could not allocate route: %m");
route->family = AF_INET6;
- route->table = link->network->ipv6_accept_ra_route_table;
+ route->table = link_get_ipv6_accept_ra_route_table(link);
route->priority = link->network->dhcp_route_metric;
route->protocol = RTPROT_RA;
route->pref = preference;
return log_link_error_errno(link, r, "Could not allocate route: %m");
route->family = AF_INET6;
- route->table = link->network->ipv6_accept_ra_route_table;
+ route->table = link_get_ipv6_accept_ra_route_table(link);
route->priority = link->network->dhcp_route_metric;
route->protocol = RTPROT_RA;
route->flags = RTM_F_PREFIX;
return log_link_error_errno(link, r, "Could not allocate route: %m");
route->family = AF_INET6;
- route->table = link->network->ipv6_accept_ra_route_table;
+ route->table = link_get_ipv6_accept_ra_route_table(link);
route->protocol = RTPROT_RA;
route->pref = preference;
route->gw.in6 = gateway;
return 0;
}
-static void ndisc_rdnss_hash_func(const void *p, struct siphash *state) {
- const NDiscRDNSS *x = p;
-
+static void ndisc_rdnss_hash_func(const NDiscRDNSS *x, struct siphash *state) {
siphash24_compress(&x->address, sizeof(x->address), state);
}
-static int ndisc_rdnss_compare_func(const void *_a, const void *_b) {
- const NDiscRDNSS *a = _a, *b = _b;
-
+static int ndisc_rdnss_compare_func(const NDiscRDNSS *a, const NDiscRDNSS *b) {
return memcmp(&a->address, &b->address, sizeof(a->address));
}
-static const struct hash_ops ndisc_rdnss_hash_ops = {
- .hash = ndisc_rdnss_hash_func,
- .compare = ndisc_rdnss_compare_func
-};
+DEFINE_PRIVATE_HASH_OPS(ndisc_rdnss_hash_ops, NDiscRDNSS, ndisc_rdnss_hash_func, ndisc_rdnss_compare_func);
static int ndisc_router_process_rdnss(Link *link, sd_ndisc_router *rt) {
uint32_t lifetime;
return 0;
}
-static void ndisc_dnssl_hash_func(const void *p, struct siphash *state) {
- const NDiscDNSSL *x = p;
-
+static void ndisc_dnssl_hash_func(const NDiscDNSSL *x, struct siphash *state) {
siphash24_compress(NDISC_DNSSL_DOMAIN(x), strlen(NDISC_DNSSL_DOMAIN(x)), state);
}
-static int ndisc_dnssl_compare_func(const void *_a, const void *_b) {
- const NDiscDNSSL *a = _a, *b = _b;
-
+static int ndisc_dnssl_compare_func(const NDiscDNSSL *a, const NDiscDNSSL *b) {
return strcmp(NDISC_DNSSL_DOMAIN(a), NDISC_DNSSL_DOMAIN(b));
}
-static const struct hash_ops ndisc_dnssl_hash_ops = {
- .hash = ndisc_dnssl_hash_func,
- .compare = ndisc_dnssl_compare_func
-};
+DEFINE_PRIVATE_HASH_OPS(ndisc_dnssl_hash_ops, NDiscDNSSL, ndisc_dnssl_hash_func, ndisc_dnssl_compare_func);
static void ndisc_router_process_dnssl(Link *link, sd_ndisc_router *rt) {
_cleanup_strv_free_ char **l = NULL;
return;
}
- if (flags & ND_OPT_PI_FLAG_ONLINK)
- (void) ndisc_router_process_onlink_prefix(link, rt);
- if (flags & ND_OPT_PI_FLAG_AUTO)
- (void) ndisc_router_process_autonomous_prefix(link, rt);
+ if (link->network->ipv6_accept_ra_use_onlink_prefix)
+ if (flags & ND_OPT_PI_FLAG_ONLINK)
+ (void) ndisc_router_process_onlink_prefix(link, rt);
+
+ if (link->network->ipv6_accept_ra_use_autonomous_prefix)
+ if (flags & ND_OPT_PI_FLAG_AUTO)
+ (void) ndisc_router_process_autonomous_prefix(link, rt);
break;
}