diff options
author | Patrik Flykt <patrik.flykt@linux.intel.com> | 2014-06-24 16:20:32 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2014-06-26 16:10:11 +0300 |
commit | da6fe470e17fa02f3adedc779585caf8669252bd (patch) | |
tree | 1013abf1c360df17f402ca70ec024636364c671e /src/libsystemd-network/test-dhcp6-client.c | |
parent | 1873a3d344042e818d2a5762c0ebfc3823c8f84d (diff) |
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.c | 9 |
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); |