You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Alexey Serbin (Code Review)" <ge...@cloudera.org> on 2022/11/10 20:13:03 UTC
[kudu-CR] [util] method for IP address matching against patterns
Alexey Serbin has uploaded this change for review. ( http://gerrit.cloudera.org:8080/19230
Change subject: [util] method for IP address matching against patterns
......................................................................
[util] method for IP address matching against patterns
This patch introduces a new utility function IsAddressMatching()
to check if an IPv4 address represented by Sockaddr object matches
against a set of other addresses. The elements of the pattern set might
be wildcard addresses.
A unit test for the new functionality is added as well.
This patch will be used in a follow-up patch.
Change-Id: I3f6bac9a5fa038d27ba5924f0fd7d5a50b72a7aa
---
M src/kudu/util/net/net_util-test.cc
M src/kudu/util/net/net_util.cc
M src/kudu/util/net/net_util.h
3 files changed, 113 insertions(+), 1 deletion(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/30/19230/1
--
To view, visit http://gerrit.cloudera.org:8080/19230
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f6bac9a5fa038d27ba5924f0fd7d5a50b72a7aa
Gerrit-Change-Number: 19230
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <al...@apache.org>
[kudu-CR] [util] method for IP address matching against patterns
Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Attila Bukor has posted comments on this change. ( http://gerrit.cloudera.org:8080/19230 )
Change subject: [util] method for IP address matching against patterns
......................................................................
Patch Set 1:
(3 comments)
http://gerrit.cloudera.org:8080/#/c/19230/1/src/kudu/util/net/net_util-test.cc
File src/kudu/util/net/net_util-test.cc:
http://gerrit.cloudera.org:8080/#/c/19230/1/src/kudu/util/net/net_util-test.cc@342
PS1, Line 342: ASSERT_TRUE(IsAddressMatching(a, { b }));
How about one more test case where we have a second, non-matching IP address to the vector?
http://gerrit.cloudera.org:8080/#/c/19230/1/src/kudu/util/net/net_util-test.cc@379
PS1, Line 379: ASSERT_TRUE(IsAddressMatching(a0, { wp }));
Here too, we could have a test case with a matching and a non-matching port.
http://gerrit.cloudera.org:8080/#/c/19230/1/src/kudu/util/net/net_util.h
File src/kudu/util/net/net_util.h:
http://gerrit.cloudera.org:8080/#/c/19230/1/src/kudu/util/net/net_util.h@199
PS1, Line 199: patterns
Calling this 'patterns' is a bit confusing. It led me to believe this supports CIDR, netmask, or some partial wildcard (i.e. 192.168.1.*). Maybe that's just me though.
--
To view, visit http://gerrit.cloudera.org:8080/19230
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6bac9a5fa038d27ba5924f0fd7d5a50b72a7aa
Gerrit-Change-Number: 19230
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Thu, 10 Nov 2022 21:34:02 +0000
Gerrit-HasComments: Yes
[kudu-CR] [util] a function to check if IP address is among specified
Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has removed a vote on this change.
Change subject: [util] a function to check if IP address is among specified
......................................................................
Removed Verified-1 by Kudu Jenkins (120)
--
To view, visit http://gerrit.cloudera.org:8080/19230
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: deleteVote
Gerrit-Change-Id: I3f6bac9a5fa038d27ba5924f0fd7d5a50b72a7aa
Gerrit-Change-Number: 19230
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
[kudu-CR] [util] a function to check if IP address is among specified
Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Attila Bukor has posted comments on this change. ( http://gerrit.cloudera.org:8080/19230 )
Change subject: [util] a function to check if IP address is among specified
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit http://gerrit.cloudera.org:8080/19230
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6bac9a5fa038d27ba5924f0fd7d5a50b72a7aa
Gerrit-Change-Number: 19230
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Fri, 11 Nov 2022 06:13:32 +0000
Gerrit-HasComments: No
[kudu-CR] [util] a function to check if IP address is among specified
Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Zoltan Chovan, Attila Bukor, Kudu Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/19230
to look at the new patch set (#2).
Change subject: [util] a function to check if IP address is among specified
......................................................................
[util] a function to check if IP address is among specified
This patch introduces a new utility function IsAddrOneOf()
to check if an IPv4 address represented by Sockaddr object matches
against a set of other addresses. Any element of the reference set
may be a wildcard. This is just a wrapper for std::any() with proper
custom comparison operator for Sockaddr.
A unit test for the new functionality is added as well.
This patch will be used in a follow-up patch.
Change-Id: I3f6bac9a5fa038d27ba5924f0fd7d5a50b72a7aa
---
M src/kudu/util/net/net_util-test.cc
M src/kudu/util/net/net_util.cc
M src/kudu/util/net/net_util.h
3 files changed, 160 insertions(+), 1 deletion(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/30/19230/2
--
To view, visit http://gerrit.cloudera.org:8080/19230
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3f6bac9a5fa038d27ba5924f0fd7d5a50b72a7aa
Gerrit-Change-Number: 19230
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
[kudu-CR] [util] a function to check if IP address is among specified
Posted by "Zoltan Chovan (Code Review)" <ge...@cloudera.org>.
Zoltan Chovan has posted comments on this change. ( http://gerrit.cloudera.org:8080/19230 )
Change subject: [util] a function to check if IP address is among specified
......................................................................
Patch Set 3: Code-Review+1
(2 comments)
small nits only
http://gerrit.cloudera.org:8080/#/c/19230/3/src/kudu/util/net/net_util-test.cc
File src/kudu/util/net/net_util-test.cc:
http://gerrit.cloudera.org:8080/#/c/19230/3/src/kudu/util/net/net_util-test.cc@321
PS3, Line 321: The address should match itself
I'm not sure if any matching is done here, could you clarify?
http://gerrit.cloudera.org:8080/#/c/19230/3/src/kudu/util/net/net_util-test.cc@341
PS3, Line 341: Sockaddr n;
nit: maybe add a small blurb for this scenario
--
To view, visit http://gerrit.cloudera.org:8080/19230
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6bac9a5fa038d27ba5924f0fd7d5a50b72a7aa
Gerrit-Change-Number: 19230
Gerrit-PatchSet: 3
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Fri, 11 Nov 2022 08:39:56 +0000
Gerrit-HasComments: Yes
[kudu-CR] [util] a function to check if IP address is among specified
Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/19230 )
Change subject: [util] a function to check if IP address is among specified
......................................................................
Patch Set 2: Verified+1
unrelated test failure (RELEASE): MasterReplicationAndRpcSizeLimitTest.TabletReports
--
To view, visit http://gerrit.cloudera.org:8080/19230
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6bac9a5fa038d27ba5924f0fd7d5a50b72a7aa
Gerrit-Change-Number: 19230
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Fri, 11 Nov 2022 03:03:23 +0000
Gerrit-HasComments: No
[kudu-CR] [util] a function to check if IP address is among specified
Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/19230 )
Change subject: [util] a function to check if IP address is among specified
......................................................................
[util] a function to check if IP address is among specified
This patch introduces a new utility function IsAddrOneOf()
to check if an IPv4 address represented by Sockaddr object matches
against a set of other addresses. Any element of the reference set
may be a wildcard. This is just a wrapper for std::any() with proper
custom comparison operator for Sockaddr.
A unit test for the new functionality is added as well.
This patch will be used in a follow-up patch.
Change-Id: I3f6bac9a5fa038d27ba5924f0fd7d5a50b72a7aa
Reviewed-on: http://gerrit.cloudera.org:8080/19230
Tested-by: Alexey Serbin <al...@apache.org>
Reviewed-by: Attila Bukor <ab...@apache.org>
---
M src/kudu/util/net/net_util-test.cc
M src/kudu/util/net/net_util.cc
M src/kudu/util/net/net_util.h
3 files changed, 160 insertions(+), 1 deletion(-)
Approvals:
Alexey Serbin: Verified
Attila Bukor: Looks good to me, approved
--
To view, visit http://gerrit.cloudera.org:8080/19230
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I3f6bac9a5fa038d27ba5924f0fd7d5a50b72a7aa
Gerrit-Change-Number: 19230
Gerrit-PatchSet: 3
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
[kudu-CR] [util] a function to check if IP address is among specified
Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/19230 )
Change subject: [util] a function to check if IP address is among specified
......................................................................
Patch Set 1:
(3 comments)
http://gerrit.cloudera.org:8080/#/c/19230/1/src/kudu/util/net/net_util-test.cc
File src/kudu/util/net/net_util-test.cc:
http://gerrit.cloudera.org:8080/#/c/19230/1/src/kudu/util/net/net_util-test.cc@342
PS1, Line 342: ASSERT_TRUE(IsAddressMatching(a, { b }));
> How about one more test case where we have a second, non-matching IP addres
Done
http://gerrit.cloudera.org:8080/#/c/19230/1/src/kudu/util/net/net_util-test.cc@379
PS1, Line 379: ASSERT_TRUE(IsAddressMatching(a0, { wp }));
> Here too, we could have a test case with a matching and a non-matching port
Done
http://gerrit.cloudera.org:8080/#/c/19230/1/src/kudu/util/net/net_util.h
File src/kudu/util/net/net_util.h:
http://gerrit.cloudera.org:8080/#/c/19230/1/src/kudu/util/net/net_util.h@199
PS1, Line 199: patterns
> Calling this 'patterns' is a bit confusing. It led me to believe this suppo
That's a good point. Renamed patterns --> ref_addresses, and also renamed the function iteself: IsAddressMatching() --> IsAddrOneOf()
--
To view, visit http://gerrit.cloudera.org:8080/19230
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6bac9a5fa038d27ba5924f0fd7d5a50b72a7aa
Gerrit-Change-Number: 19230
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Fri, 11 Nov 2022 02:11:37 +0000
Gerrit-HasComments: Yes