network: dhcp6pd: set server address for unreachable route
This is just for json output.
This commit is contained in:
@@ -665,13 +665,20 @@ static int dhcp6_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *li
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int dhcp6_request_unreachable_route(Link *link, const struct in6_addr *addr, uint8_t prefixlen, usec_t lifetime_usec) {
|
||||
static int dhcp6_request_unreachable_route(
|
||||
Link *link,
|
||||
const struct in6_addr *addr,
|
||||
uint8_t prefixlen,
|
||||
usec_t lifetime_usec,
|
||||
const union in_addr_union *server_address) {
|
||||
|
||||
_cleanup_(route_freep) Route *route = NULL;
|
||||
Route *existing;
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
assert(addr);
|
||||
assert(server_address);
|
||||
|
||||
if (prefixlen >= 64) {
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
@@ -687,6 +694,7 @@ static int dhcp6_request_unreachable_route(Link *link, const struct in6_addr *ad
|
||||
return log_oom();
|
||||
|
||||
route->source = NETWORK_CONFIG_SOURCE_DHCP6;
|
||||
route->provider = *server_address;
|
||||
route->family = AF_INET6;
|
||||
route->dst.in6 = *addr;
|
||||
route->dst_prefixlen = prefixlen;
|
||||
@@ -797,6 +805,7 @@ static int dhcp6_pd_assign_prefixes(Link *link, Link *uplink) {
|
||||
}
|
||||
|
||||
int dhcp6_pd_prefix_acquired(Link *dhcp6_link) {
|
||||
union in_addr_union server_address;
|
||||
usec_t timestamp_usec;
|
||||
Link *link;
|
||||
int r;
|
||||
@@ -804,6 +813,10 @@ int dhcp6_pd_prefix_acquired(Link *dhcp6_link) {
|
||||
assert(dhcp6_link);
|
||||
assert(dhcp6_link->dhcp6_lease);
|
||||
|
||||
r = sd_dhcp6_lease_get_server_address(dhcp6_link->dhcp6_lease, &server_address.in6);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(dhcp6_link, r, "Failed to get server address of DHCPv6 lease: %m");
|
||||
|
||||
r = sd_dhcp6_lease_get_timestamp(dhcp6_link->dhcp6_lease, clock_boottime_or_monotonic(), ×tamp_usec);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(dhcp6_link, r, "Failed to get timestamp of DHCPv6 lease: %m");
|
||||
@@ -831,7 +844,7 @@ int dhcp6_pd_prefix_acquired(Link *dhcp6_link) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = dhcp6_request_unreachable_route(dhcp6_link, &pd_prefix, pd_prefix_len, lifetime_valid_usec);
|
||||
r = dhcp6_request_unreachable_route(dhcp6_link, &pd_prefix, pd_prefix_len, lifetime_valid_usec, &server_address);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user