diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 21:14:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 21:14:48 +0000 |
commit | e10ff189aca57bba91933088195d4edda199cb20 (patch) | |
tree | 056237559582eba27e68fa864434436ac5b7f535 /test-iputils_hh.cc | |
parent | Adding upstream version 1.8.3. (diff) | |
download | dnsdist-e10ff189aca57bba91933088195d4edda199cb20.tar.xz dnsdist-e10ff189aca57bba91933088195d4edda199cb20.zip |
Adding upstream version 1.9.3.upstream/1.9.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | test-iputils_hh.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test-iputils_hh.cc b/test-iputils_hh.cc index a299fed..b30df73 100644 --- a/test-iputils_hh.cc +++ b/test-iputils_hh.cc @@ -1,5 +1,9 @@ +#ifndef BOOST_TEST_DYN_LINK #define BOOST_TEST_DYN_LINK +#endif + #define BOOST_TEST_NO_MAIN + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -264,6 +268,24 @@ BOOST_AUTO_TEST_CASE(test_Netmask) { BOOST_CHECK(all < empty); BOOST_CHECK(empty > full); BOOST_CHECK(full < empty); + + /* invalid (too large) mask */ + { + Netmask invalidMaskV4("192.0.2.1/33"); + BOOST_CHECK_EQUAL(invalidMaskV4.getBits(), 32U); + BOOST_CHECK(invalidMaskV4.getNetwork() == ComboAddress("192.0.2.1")); + Netmask invalidMaskV6("fe80::92fb:a6ff:fe4a:51da/129"); + BOOST_CHECK_EQUAL(invalidMaskV6.getBits(), 128U); + BOOST_CHECK(invalidMaskV6.getNetwork() == ComboAddress("fe80::92fb:a6ff:fe4a:51da")); + } + { + Netmask invalidMaskV4(ComboAddress("192.0.2.1"), 33); + BOOST_CHECK_EQUAL(invalidMaskV4.getBits(), 32U); + BOOST_CHECK(invalidMaskV4.getNetwork() == ComboAddress("192.0.2.1")); + Netmask invalidMaskV6(ComboAddress("fe80::92fb:a6ff:fe4a:51da"), 129); + BOOST_CHECK_EQUAL(invalidMaskV6.getBits(), 128U); + BOOST_CHECK(invalidMaskV6.getNetwork() == ComboAddress("fe80::92fb:a6ff:fe4a:51da")); + } } static std::string NMGOutputToSorted(const std::string& str) |