summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/test-dhcp6-client.c
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2014-09-01 13:21:34 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2014-09-10 12:56:29 +0300
commitd63be95a306bf1e262c7e1c7ad4b2c12b49d371e (patch)
tree7920aa3c029b4b7bdd3a8b64eb7cfb442b1e5d76 /src/libsystemd-network/test-dhcp6-client.c
parent346e13a25dc6f76d3bc9d8decd40dc4782b02d2a (diff)
test-dhcp6-client: Add checks for Elapsed Time option
Verify that the Elapsed Time option is present.
Diffstat (limited to 'src/libsystemd-network/test-dhcp6-client.c')
-rw-r--r--src/libsystemd-network/test-dhcp6-client.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c
index d102a796b4..37ddfc2cfa 100644
--- a/src/libsystemd-network/test-dhcp6-client.c
+++ b/src/libsystemd-network/test-dhcp6-client.c
@@ -269,6 +269,11 @@ static int test_advertise_option(sd_event *e) {
*optval) >= 0);
break;
+ case DHCP6_OPTION_ELAPSED_TIME:
+ assert_se(optlen == 2);
+
+ break;
+
default:
break;
}
@@ -361,7 +366,8 @@ static int test_client_verify_request(DHCP6Message *request, uint8_t *option,
uint8_t *optval;
uint16_t optcode;
size_t optlen;
- bool found_clientid = false, found_iana = false, found_serverid = false;
+ bool found_clientid = false, found_iana = false, found_serverid = false,
+ found_elapsed_time = false;
int r;
struct in6_addr addr;
be32_t val;
@@ -410,11 +416,20 @@ static int test_client_verify_request(DHCP6Message *request, uint8_t *option,
assert_se(!memcmp(&msg_advertise[179], optval, optlen));
break;
+
+ case DHCP6_OPTION_ELAPSED_TIME:
+ assert_se(!found_elapsed_time);
+ found_elapsed_time = true;
+
+ assert_se(optlen == 2);
+
+ break;
}
}
assert_se(r == -ENOMSG);
- assert_se(found_clientid && found_iana && found_serverid);
+ assert_se(found_clientid && found_iana && found_serverid &&
+ found_elapsed_time);
assert_se(sd_dhcp6_lease_get_first_address(lease, &addr, &lt_pref,
&lt_valid) >= 0);
@@ -452,7 +467,8 @@ static int test_client_verify_solicit(DHCP6Message *solicit, uint8_t *option,
uint8_t *optval;
uint16_t optcode;
size_t optlen;
- bool found_clientid = false, found_iana = false;
+ bool found_clientid = false, found_iana = false,
+ found_elapsed_time = false;
int r;
assert_se(solicit->type == DHCP6_SOLICIT);
@@ -478,11 +494,19 @@ static int test_client_verify_solicit(DHCP6Message *solicit, uint8_t *option,
memcpy(&test_iaid, optval, sizeof(test_iaid));
break;
+
+ case DHCP6_OPTION_ELAPSED_TIME:
+ assert_se(!found_elapsed_time);
+ found_elapsed_time = true;
+
+ assert_se(optlen == 2);
+
+ break;
}
}
assert_se(r == -ENOMSG);
- assert_se(found_clientid && found_iana);
+ assert_se(found_clientid && found_iana && found_elapsed_time);
return 0;
}