summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/test-dhcp6-client.c
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2014-06-24 15:20:32 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2014-06-26 15:10:11 +0200
commitda6fe470e17fa02f3adedc779585caf8669252bd (patch)
tree1013abf1c360df17f402ca70ec024636364c671e /src/libsystemd-network/test-dhcp6-client.c
parentnetworkd: Properly stop router solicitation and DHCPv6 client (diff)
downloadsystemd-da6fe470e17fa02f3adedc779585caf8669252bd.tar.xz
systemd-da6fe470e17fa02f3adedc779585caf8669252bd.zip
sd-dhcp6-client: Add Option Request Option support
Provide a function to request more options from the DHCPv6 server. Provide a sensible default set at startup and add test basic test cases for the intended usage. Define DNS and NTP related option codes and add comments for the unassigned codes.
Diffstat (limited to 'src/libsystemd-network/test-dhcp6-client.c')
-rw-r--r--src/libsystemd-network/test-dhcp6-client.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c
index c5729dbc6b..5bb410dab3 100644
--- a/src/libsystemd-network/test-dhcp6-client.c
+++ b/src/libsystemd-network/test-dhcp6-client.c
@@ -68,6 +68,13 @@ static int test_client_basic(sd_event *e) {
assert_se(sd_dhcp6_client_set_mac(client, &mac_addr) >= 0);
+ assert_se(sd_dhcp6_client_set_request_option(client, DHCP6_OPTION_CLIENTID) == -EINVAL);
+ assert_se(sd_dhcp6_client_set_request_option(client, DHCP6_OPTION_DNS_SERVERS) == -EEXIST);
+ assert_se(sd_dhcp6_client_set_request_option(client, DHCP6_OPTION_NTP_SERVER) == -EEXIST);
+ assert_se(sd_dhcp6_client_set_request_option(client, DHCP6_OPTION_SNTP_SERVERS) == 0);
+ assert_se(sd_dhcp6_client_set_request_option(client, DHCP6_OPTION_DOMAIN_LIST) == -EEXIST);
+ assert_se(sd_dhcp6_client_set_request_option(client, 10) == -EINVAL);
+
assert_se(sd_dhcp6_client_set_callback(client, NULL, NULL) >= 0);
assert_se(sd_dhcp6_client_detach_event(client) >= 0);
@@ -520,6 +527,8 @@ static void test_client_solicit_cb(sd_dhcp6_client *client, int event,
assert_se(e);
assert_se(event == DHCP6_EVENT_IP_ACQUIRE);
+ assert_se(sd_dhcp6_client_set_request_option(client, DHCP6_OPTION_DNS_SERVERS) == -EBUSY);
+
if (verbose)
printf(" got DHCPv6 event %d\n", event);