sd-dhcp6: constify output arguments in get_{ntp,nds}_addr

This matches what we do for ipv4 and is in general better.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-05-24 21:51:39 +02:00
parent dddc8d1e1e
commit 00813316b0
4 changed files with 9 additions and 10 deletions

View File

@ -213,7 +213,7 @@ int dhcp6_lease_set_dns(sd_dhcp6_lease *lease, uint8_t *optval, size_t optlen) {
return 0; return 0;
} }
int sd_dhcp6_lease_get_dns(sd_dhcp6_lease *lease, struct in6_addr **addrs) { int sd_dhcp6_lease_get_dns(sd_dhcp6_lease *lease, const struct in6_addr **addrs) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(addrs, -EINVAL); assert_return(addrs, -EINVAL);
@ -341,7 +341,7 @@ int dhcp6_lease_set_sntp(sd_dhcp6_lease *lease, uint8_t *optval, size_t optlen)
} }
int sd_dhcp6_lease_get_ntp_addrs(sd_dhcp6_lease *lease, int sd_dhcp6_lease_get_ntp_addrs(sd_dhcp6_lease *lease,
struct in6_addr **addrs) { const struct in6_addr **addrs) {
assert_return(lease, -EINVAL); assert_return(lease, -EINVAL);
assert_return(addrs, -EINVAL); assert_return(addrs, -EINVAL);

View File

@ -371,7 +371,7 @@ static int test_advertise_option(sd_event *e) {
int r; int r;
uint8_t *opt; uint8_t *opt;
bool opt_clientid = false; bool opt_clientid = false;
struct in6_addr *addrs; const struct in6_addr *addrs;
char **domains; char **domains;
log_debug("/* %s */", __func__); log_debug("/* %s */", __func__);
@ -518,7 +518,7 @@ static void test_client_solicit_cb(sd_dhcp6_client *client, int event,
void *userdata) { void *userdata) {
sd_event *e = userdata; sd_event *e = userdata;
sd_dhcp6_lease *lease; sd_dhcp6_lease *lease;
struct in6_addr *addrs; const struct in6_addr *addrs;
char **domains; char **domains;
log_debug("/* %s */", __func__); log_debug("/* %s */", __func__);
@ -744,7 +744,7 @@ static void test_client_information_cb(sd_dhcp6_client *client, int event,
void *userdata) { void *userdata) {
sd_event *e = userdata; sd_event *e = userdata;
sd_dhcp6_lease *lease; sd_dhcp6_lease *lease;
struct in6_addr *addrs; const struct in6_addr *addrs;
struct in6_addr address = { { { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; struct in6_addr address = { { { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 } } };
char **domains; char **domains;

View File

@ -4091,7 +4091,7 @@ int link_save(Link *link) {
} }
if (link->network->dhcp6_use_dns && dhcp6_lease) { if (link->network->dhcp6_use_dns && dhcp6_lease) {
struct in6_addr *in6_addrs; const struct in6_addr *in6_addrs;
r = sd_dhcp6_lease_get_dns(dhcp6_lease, &in6_addrs); r = sd_dhcp6_lease_get_dns(dhcp6_lease, &in6_addrs);
if (r > 0) { if (r > 0) {
@ -4195,7 +4195,7 @@ int link_save(Link *link) {
} }
if (link->network->dhcp6_use_ntp && dhcp6_lease) { if (link->network->dhcp6_use_ntp && dhcp6_lease) {
struct in6_addr *in6_addrs; const struct in6_addr *in6_addrs;
char **hosts; char **hosts;
r = sd_dhcp6_lease_get_ntp_addrs(dhcp6_lease, r = sd_dhcp6_lease_get_ntp_addrs(dhcp6_lease,

View File

@ -39,10 +39,9 @@ int sd_dhcp6_lease_get_pd(sd_dhcp6_lease *lease, struct in6_addr *prefix,
uint32_t *lifetime_preferred, uint32_t *lifetime_preferred,
uint32_t *lifetime_valid); uint32_t *lifetime_valid);
int sd_dhcp6_lease_get_dns(sd_dhcp6_lease *lease, struct in6_addr **addrs); int sd_dhcp6_lease_get_dns(sd_dhcp6_lease *lease, const struct in6_addr **addrs);
int sd_dhcp6_lease_get_domains(sd_dhcp6_lease *lease, char ***domains); int sd_dhcp6_lease_get_domains(sd_dhcp6_lease *lease, char ***domains);
int sd_dhcp6_lease_get_ntp_addrs(sd_dhcp6_lease *lease, int sd_dhcp6_lease_get_ntp_addrs(sd_dhcp6_lease *lease, const struct in6_addr **addrs);
struct in6_addr **addrs);
int sd_dhcp6_lease_get_ntp_fqdn(sd_dhcp6_lease *lease, char ***ntp_fqdn); int sd_dhcp6_lease_get_ntp_fqdn(sd_dhcp6_lease *lease, char ***ntp_fqdn);
sd_dhcp6_lease *sd_dhcp6_lease_ref(sd_dhcp6_lease *lease); sd_dhcp6_lease *sd_dhcp6_lease_ref(sd_dhcp6_lease *lease);