network: ndisc - Also fill router preference
This commit is contained in:
@@ -448,10 +448,10 @@ static int ndisc_router_process_autonomous_prefix(Link *link, sd_ndisc_router *r
|
||||
|
||||
static int ndisc_router_process_onlink_prefix(Link *link, sd_ndisc_router *rt) {
|
||||
_cleanup_(route_freep) Route *route = NULL;
|
||||
unsigned prefixlen, preference;
|
||||
usec_t timestamp_usec;
|
||||
uint32_t lifetime_sec;
|
||||
struct in6_addr prefix;
|
||||
unsigned prefixlen;
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
@@ -477,6 +477,11 @@ static int ndisc_router_process_onlink_prefix(Link *link, sd_ndisc_router *rt) {
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Failed to get prefix length: %m");
|
||||
|
||||
/* Prefix Information option does not have preference, hence we use the 'main' preference here */
|
||||
r = sd_ndisc_router_get_preference(rt, &preference);
|
||||
if (r < 0)
|
||||
log_link_warning_errno(link, r, "Failed to get default router preference from RA: %m");
|
||||
|
||||
r = route_new(&route);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
@@ -484,6 +489,7 @@ static int ndisc_router_process_onlink_prefix(Link *link, sd_ndisc_router *rt) {
|
||||
route->family = AF_INET6;
|
||||
route->dst.in6 = prefix;
|
||||
route->dst_prefixlen = prefixlen;
|
||||
route->pref = preference;
|
||||
route->lifetime_usec = sec_to_usec(lifetime_sec, timestamp_usec);
|
||||
|
||||
r = ndisc_request_route(TAKE_PTR(route), link, rt);
|
||||
|
||||
Reference in New Issue
Block a user