]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dhcp6_client: Add helper for fetching Prefix Delegation information
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 6 Sep 2018 17:31:48 +0000 (11:31 -0600)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Wed, 19 Sep 2018 19:45:17 +0000 (13:45 -0600)
Add helper function for fetching enabled/disabled state of Prefix
Delegation for a DHCPv6 client. Update function setting prefix
delegation to use an int instead of a boolean.

src/libsystemd-network/sd-dhcp6-client.c
src/systemd/sd-dhcp6-client.h

index a99ddaae9dd65c3a3eca5c507c8876a0eb1dd9be..20e19be3bcb50a5edb4d6b180077421b96976261 100644 (file)
@@ -325,7 +325,16 @@ int sd_dhcp6_client_set_request_option(sd_dhcp6_client *client, uint16_t option)
         return 0;
 }
 
-int sd_dhcp6_client_set_prefix_delegation(sd_dhcp6_client *client, bool delegation) {
+int sd_dhcp6_client_get_prefix_delegation(sd_dhcp6_client *client, int *delegation) {
+        assert_return(client, -EINVAL);
+        assert_return(delegation, -EINVAL);
+
+        *delegation = client->prefix_delegation;
+
+        return 0;
+}
+
+int sd_dhcp6_client_set_prefix_delegation(sd_dhcp6_client *client, int delegation) {
         assert_return(client, -EINVAL);
 
         client->prefix_delegation = delegation;
index fa36dca9090dd3beba0be088caa3cc12d8f38e2b..b7e0db1d6caedf92d845e105213e22ff595d98b8 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <inttypes.h>
 #include <net/ethernet.h>
-#include <stdbool.h>
 #include <sys/types.h>
 
 #include "sd-dhcp6-lease.h"
@@ -120,8 +119,10 @@ int sd_dhcp6_client_get_information_request(
 int sd_dhcp6_client_set_request_option(
                 sd_dhcp6_client *client,
                 uint16_t option);
+int sd_dhcp6_client_get_prefix_delegation(sd_dhcp6_client *client,
+                                          int *delegation);
 int sd_dhcp6_client_set_prefix_delegation(sd_dhcp6_client *client,
-                                          bool delegation);
+                                          int delegation);
 
 int sd_dhcp6_client_get_lease(
                 sd_dhcp6_client *client,