|
@@ -89,7 +89,8 @@ Dhcp4SrvD2Test::reset() {
|
|
void
|
|
void
|
|
Dhcp4SrvD2Test::configureD2(bool enable_d2, const bool exp_result,
|
|
Dhcp4SrvD2Test::configureD2(bool enable_d2, const bool exp_result,
|
|
const std::string& ip_address,
|
|
const std::string& ip_address,
|
|
- const uint32_t port) {
|
|
|
|
|
|
+ const uint32_t port,
|
|
|
|
+ const uint32_t sender_port) {
|
|
std::ostringstream config;
|
|
std::ostringstream config;
|
|
config <<
|
|
config <<
|
|
"{ \"interfaces\": [ \"*\" ],"
|
|
"{ \"interfaces\": [ \"*\" ],"
|
|
@@ -102,6 +103,7 @@ Dhcp4SrvD2Test::configureD2(bool enable_d2, const bool exp_result,
|
|
" \"enable-updates\" : " << (enable_d2 ? "true" : "false") << ", "
|
|
" \"enable-updates\" : " << (enable_d2 ? "true" : "false") << ", "
|
|
" \"server-ip\" : \"" << ip_address << "\", "
|
|
" \"server-ip\" : \"" << ip_address << "\", "
|
|
" \"server-port\" : " << port << ", "
|
|
" \"server-port\" : " << port << ", "
|
|
|
|
+ " \"sender-port\" : " << sender_port << ", "
|
|
" \"ncr-protocol\" : \"UDP\", "
|
|
" \"ncr-protocol\" : \"UDP\", "
|
|
" \"ncr-format\" : \"JSON\", "
|
|
" \"ncr-format\" : \"JSON\", "
|
|
" \"always-include-fqdn\" : true, "
|
|
" \"always-include-fqdn\" : true, "
|
|
@@ -293,7 +295,9 @@ TEST_F(Dhcp4SrvD2Test, forceUDPSendFailure) {
|
|
|
|
|
|
// Configure it enabled and start it.
|
|
// Configure it enabled and start it.
|
|
// Using server address of 0.0.0.0/0 should induce failure on send.
|
|
// Using server address of 0.0.0.0/0 should induce failure on send.
|
|
- ASSERT_NO_FATAL_FAILURE(configureD2(true, SHOULD_PASS, "0.0.0.0", 0));
|
|
|
|
|
|
+ // Pass in a non-zero sender port to avoid validation error when
|
|
|
|
+ // server-ip/port are same as sender-ip/port
|
|
|
|
+ ASSERT_NO_FATAL_FAILURE(configureD2(true, SHOULD_PASS, "0.0.0.0", 0, 53001));
|
|
ASSERT_TRUE(mgr.ddnsEnabled());
|
|
ASSERT_TRUE(mgr.ddnsEnabled());
|
|
ASSERT_NO_THROW(srv_.startD2());
|
|
ASSERT_NO_THROW(srv_.startD2());
|
|
ASSERT_TRUE(mgr.amSending());
|
|
ASSERT_TRUE(mgr.amSending());
|