]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-dhcp6: constify output arguments in get_{ntp,nds}_addr
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 24 May 2020 19:51:39 +0000 (21:51 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 26 May 2020 07:47:45 +0000 (09:47 +0200)
This matches what we do for ipv4 and is in general better.

src/libsystemd-network/sd-dhcp6-lease.c
src/libsystemd-network/test-dhcp6-client.c
src/network/networkd-link.c
src/systemd/sd-dhcp6-lease.h

index 8aebb53c873da63c6d0e0d889070c4188718cf51..4eee10ea896b7264236181e0f0e2e185001b276f 100644 (file)
@@ -213,7 +213,7 @@ int dhcp6_lease_set_dns(sd_dhcp6_lease *lease, uint8_t *optval, size_t optlen) {
         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(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,
-                                 struct in6_addr **addrs) {
+                                 const struct in6_addr **addrs) {
         assert_return(lease, -EINVAL);
         assert_return(addrs, -EINVAL);
 
index 3a68f1fe718619e7011c5e8a79df41b3e0a36599..4b40e31c1249ac4dff65d3f5ec7df91a229ca1f5 100644 (file)
@@ -371,7 +371,7 @@ static int test_advertise_option(sd_event *e) {
         int r;
         uint8_t *opt;
         bool opt_clientid = false;
-        struct in6_addr *addrs;
+        const struct in6_addr *addrs;
         char **domains;
 
         log_debug("/* %s */", __func__);
@@ -518,7 +518,7 @@ static void test_client_solicit_cb(sd_dhcp6_client *client, int event,
                                    void *userdata) {
         sd_event *e = userdata;
         sd_dhcp6_lease *lease;
-        struct in6_addr *addrs;
+        const struct in6_addr *addrs;
         char **domains;
 
         log_debug("/* %s */", __func__);
@@ -744,7 +744,7 @@ static void test_client_information_cb(sd_dhcp6_client *client, int event,
                                        void *userdata) {
         sd_event *e = userdata;
         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 } } };
         char **domains;
 
index 43b5d8e3c95c54d4ccc113f08a856557a5f9458b..daa9683a780f01237432adaeb5339c7e0ad4c66e 100644 (file)
@@ -4091,7 +4091,7 @@ int link_save(Link *link) {
                 }
 
                 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);
                         if (r > 0) {
@@ -4195,7 +4195,7 @@ int link_save(Link *link) {
                 }
 
                 if (link->network->dhcp6_use_ntp && dhcp6_lease) {
-                        struct in6_addr *in6_addrs;
+                        const struct in6_addr *in6_addrs;
                         char **hosts;
 
                         r = sd_dhcp6_lease_get_ntp_addrs(dhcp6_lease,
index 33a32a6dc54b6df22adc28e19c0533000b8d6c00..4301c6db878b4e5e556507a05f5d76124145e371 100644 (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_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_ntp_addrs(sd_dhcp6_lease *lease,
-                                 struct in6_addr **addrs);
+int sd_dhcp6_lease_get_ntp_addrs(sd_dhcp6_lease *lease, const struct in6_addr **addrs);
 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);