From 52a259cd1e94d42a2e5edaca8634bbb3383ae92d Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Sat, 11 Apr 2020 22:13:00 +0200 Subject: [PATCH] [#1043] Added eth1961 fake interface --- src/lib/dhcp/tests/iface_mgr_test_config.cc | 8 ++++++-- src/lib/dhcp/tests/iface_mgr_test_config.h | 3 +++ src/lib/dhcp/tests/iface_mgr_unittest.cc | 3 +++ .../dhcpsrv/tests/shared_networks_list_parser_unittest.cc | 4 ++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/lib/dhcp/tests/iface_mgr_test_config.cc b/src/lib/dhcp/tests/iface_mgr_test_config.cc index 20035f2933..39618b7f0a 100644 --- a/src/lib/dhcp/tests/iface_mgr_test_config.cc +++ b/src/lib/dhcp/tests/iface_mgr_test_config.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -32,7 +32,7 @@ IfaceMgrTestConfig::IfaceMgrTestConfig(const bool default_config) { IfaceMgr::instance().setPacketFilter(packet_filter4_); IfaceMgr::instance().setPacketFilter(packet_filter6_); - // Create default set of fake interfaces: lo, eth0 and eth1. + // Create default set of fake interfaces: lo, eth0, eth1 and eth1961. if (default_config) { createIfaces(); } @@ -117,6 +117,10 @@ IfaceMgrTestConfig::createIfaces() { addAddress("eth1", IOAddress("192.0.2.3")); addAddress("eth1", IOAddress("192.0.2.5")); addAddress("eth1", IOAddress("fe80::3a60:77ff:fed5:abcd")); + // eth1961 + addIface("eth1961", 3); + addAddress("eth1961", IOAddress("198.51.100.1")); + addAddress("eth1961", IOAddress("fe80::3a60:77ff:fed5:9876")); } diff --git a/src/lib/dhcp/tests/iface_mgr_test_config.h b/src/lib/dhcp/tests/iface_mgr_test_config.h index c12c6e3e3b..fa55ad3051 100644 --- a/src/lib/dhcp/tests/iface_mgr_test_config.h +++ b/src/lib/dhcp/tests/iface_mgr_test_config.h @@ -130,6 +130,9 @@ struct FlagInactive6 { /// - eth1 #2 /// - 192.0.2.3 /// - fe80::3a60:77ff:fed5:abcd +/// - eth1961 +/// - 198.51.100.1 +/// - fe80::3a60:77ff:fed5:9876 /// /// For all interfaces the following flags are set: /// - multicast diff --git a/src/lib/dhcp/tests/iface_mgr_unittest.cc b/src/lib/dhcp/tests/iface_mgr_unittest.cc index 769f2517fb..22fa697e1c 100644 --- a/src/lib/dhcp/tests/iface_mgr_unittest.cc +++ b/src/lib/dhcp/tests/iface_mgr_unittest.cc @@ -1869,6 +1869,9 @@ TEST_F(IfaceMgrTest, openSockets4IfaceDown) { // and active. EXPECT_EQ(2, IfaceMgr::instance().getIface("eth1")->getSockets().size()); EXPECT_EQ(2, IfaceMgr::instance().getIface(ETH1_INDEX)->getSockets().size()); + // Same for eth1961. + EXPECT_EQ(1, IfaceMgr::instance().getIface("eth1961")->getSockets().size()); + EXPECT_EQ(1, IfaceMgr::instance().getIface(ETH1961_INDEX)->getSockets().size()); // Never open socket on loopback interface. EXPECT_TRUE(IfaceMgr::instance().getIface("lo")->getSockets().empty()); EXPECT_TRUE(IfaceMgr::instance().getIface(LO_INDEX)->getSockets().empty()); diff --git a/src/lib/dhcpsrv/tests/shared_networks_list_parser_unittest.cc b/src/lib/dhcpsrv/tests/shared_networks_list_parser_unittest.cc index 9bf82dd069..cf7516f4f1 100644 --- a/src/lib/dhcpsrv/tests/shared_networks_list_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/shared_networks_list_parser_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -89,7 +89,7 @@ TEST(SharedNetworkListParserTest, iface) { std::string config = "[" " {" " \"name\": \"bird\"," - " \"interface\": \"eth0\"" + " \"interface\": \"eth1961\"" " }" "]"; -- GitLab