util: Remove unused isValidPrefix
Change-Id: I0e853148b82af5e0261a7b046e4258f84d37bfdd
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/util.cpp b/src/util.cpp
index 23ab4bf..1feab81 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -169,12 +169,6 @@
return isValidIP(AF_INET, address) || isValidIP(AF_INET6, address);
}
-bool isValidPrefix(int family, uint8_t prefix)
-{
- return familyVisit(
- [=]<int f>() noexcept { return isValidPrefix<f>(prefix); }, family);
-}
-
void deleteInterface(stdplus::const_zstring intf)
{
pid_t pid = fork();
diff --git a/src/util.hpp b/src/util.hpp
index ea9d767..47351a5 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -90,18 +90,6 @@
bool isValidIP(int family, stdplus::const_zstring address) noexcept;
bool isValidIP(stdplus::const_zstring address) noexcept;
-/* @brief checks that the given prefix is valid or not.
- * @param[in] family - IP address family(AF_INET/AF_INET6).
- * @param[in] prefix - prefix length.
- * @returns true if it is valid otherwise false.
- */
-template <int family>
-constexpr bool isValidPrefix(uint8_t prefix) noexcept
-{
- return prefix <= sizeof(typename FamilyTraits<family>::addr) * 8;
-}
-bool isValidPrefix(int family, uint8_t prefixLength);
-
/** @brief Delete the given interface.
* @param[in] intf - interface name.
*/
diff --git a/test/test_util.cpp b/test/test_util.cpp
index b0474ea..84d6f1b 100644
--- a/test/test_util.cpp
+++ b/test/test_util.cpp
@@ -86,25 +86,6 @@
EXPECT_TRUE(isValidIP(AF_INET6, "1::8"));
}
-TEST_F(TestUtil, PrefixValidation)
-{
- EXPECT_TRUE(isValidPrefix(AF_INET, 0));
- EXPECT_TRUE(isValidPrefix(AF_INET, 1));
- EXPECT_TRUE(isValidPrefix(AF_INET, 32));
- EXPECT_FALSE(isValidPrefix(AF_INET, 33));
- EXPECT_FALSE(isValidPrefix(AF_INET, 64));
-
- EXPECT_TRUE(isValidPrefix(AF_INET6, 0));
- EXPECT_TRUE(isValidPrefix(AF_INET6, 1));
- EXPECT_TRUE(isValidPrefix(AF_INET6, 53));
- EXPECT_TRUE(isValidPrefix(AF_INET6, 64));
- EXPECT_TRUE(isValidPrefix(AF_INET6, 128));
- EXPECT_FALSE(isValidPrefix(AF_INET6, 129));
- EXPECT_FALSE(isValidPrefix(AF_INET6, 177));
-
- EXPECT_THROW(isValidPrefix(AF_UNSPEC, 1), std::invalid_argument);
-}
-
TEST_F(TestUtil, InterfaceToUbootEthAddr)
{
EXPECT_EQ(std::nullopt, interfaceToUbootEthAddr("et"));