aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzheglov <zheglov@yandex-team.com>2022-07-07 19:33:56 +0300
committerzheglov <zheglov@yandex-team.com>2022-07-07 19:33:56 +0300
commit95d4076addb1b5489601ccf87d38119b3a651260 (patch)
treeb10bd9322917c65c960df93364d0024c53d660b2
parent1ebea3a426fe7f05306ac0daeb294623e3f9db6a (diff)
downloadydb-95d4076addb1b5489601ccf87d38119b3a651260.tar.gz
reworked ip_filter to ipmath
-rw-r--r--library/cpp/ipmath/ipmath.cpp2
-rw-r--r--library/cpp/ipmath/ipmath_ut.cpp8
2 files changed, 9 insertions, 1 deletions
diff --git a/library/cpp/ipmath/ipmath.cpp b/library/cpp/ipmath/ipmath.cpp
index b8cca00c805..f9e56c337c2 100644
--- a/library/cpp/ipmath/ipmath.cpp
+++ b/library/cpp/ipmath/ipmath.cpp
@@ -135,7 +135,7 @@ TIpAddressRange::TIpAddressRangeBuilder& TIpAddressRange::TIpAddressRangeBuilder
TIpAddressRange::TIpAddressRangeBuilder& TIpAddressRange::TIpAddressRangeBuilder::To(TIpv6Address to) {
Y_ENSURE_EX(IsValid(to), TInvalidIpRangeException() << "Address " << to.ToString() << " is invalid");
- Start_ = to;
+ End_ = to;
return *this;
}
diff --git a/library/cpp/ipmath/ipmath_ut.cpp b/library/cpp/ipmath/ipmath_ut.cpp
index 5fe459ecc8b..179f2325034 100644
--- a/library/cpp/ipmath/ipmath_ut.cpp
+++ b/library/cpp/ipmath/ipmath_ut.cpp
@@ -188,6 +188,14 @@ public:
ASSERT_THAT(range.Size(), Eq(256));
}
+ void IpRangeFromIpv4BuilderFromTIpv6Address() {
+ const auto s = TIpv6Address::FromString("192.168.0.0");
+ const auto e = TIpv6Address::FromString("192.168.0.255");
+ auto range = TIpAddressRange::From(s).To(e).Build();
+
+ ASSERT_THAT(range.Size(), Eq(256));
+ }
+
void IpRangeFromInvalidIpv4() {
auto build = [] (auto from, auto to) {
return TIpAddressRange::From(from).To(to).Build();