summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRinku Kothiya <rkothiya@redhat.com>2019-01-01 21:06:05 +0530
committerAmar Tumballi <amarts@redhat.com>2019-01-18 17:13:13 +0000
commit0687b0beb5cc58d5aac9e203f0feebcd7e9eea03 (patch)
tree1816ba8a7868956702f4a6f7ecc338c4d66654b7 /xlators
parentebaf09a2a329517936232510e117debc3795e80b (diff)
core: Feature added to accept CidrIp in auth.allow
Added functionality to gluster volume set auth.allow command to accept CIDR IP addresses. Modified few functions to isolate cidr feature so that it prevents other gluster commands such as peer probe to use cidr format ip. The functions are modified in such a way that they have an option to enable accepting of cidr format for other gluster commands if required in furture. updates: bz#1138841 Change-Id: Ie6734002a7078f1820e5df42d404411cce945e8b Credits: Mohit Agrawal Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/quiesce/src/quiesce.c2
-rw-r--r--xlators/protocol/auth/addr/src/addr.c16
2 files changed, 13 insertions, 5 deletions
diff --git a/xlators/features/quiesce/src/quiesce.c b/xlators/features/quiesce/src/quiesce.c
index abdb901f356..bfd1116a568 100644
--- a/xlators/features/quiesce/src/quiesce.c
+++ b/xlators/features/quiesce/src/quiesce.c
@@ -95,7 +95,7 @@ gf_quiesce_populate_failover_hosts(xlator_t *this, quiesce_priv_t *priv,
__gf_quiesce_cleanup_failover_hosts(this, priv);
addr_tok = strtok_r(dup_val, ",", &save_ptr);
while (addr_tok) {
- if (!valid_internet_address(addr_tok, _gf_true)) {
+ if (!valid_internet_address(addr_tok, _gf_true, _gf_false)) {
gf_msg(this->name, GF_LOG_INFO, 0, QUIESCE_MSG_INVAL_HOST,
"Specified "
"invalid internet address:%s",
diff --git a/xlators/protocol/auth/addr/src/addr.c b/xlators/protocol/auth/addr/src/addr.c
index 0d995862de4..bf12c455d7c 100644
--- a/xlators/protocol/auth/addr/src/addr.c
+++ b/xlators/protocol/auth/addr/src/addr.c
@@ -65,10 +65,18 @@ compare_addr_and_update(char *option_str, char *peer_addr, char *subvol,
goto out;
}
} else {
- match = fnmatch(addr_str, peer_addr, 0);
- if (negate ? match : !match) {
- *result = status;
- goto out;
+ if (strstr(addr_str, "/")) {
+ match = gf_is_ip_in_net(addr_str, peer_addr);
+ if (negate ? !match : match) {
+ *result = status;
+ goto out;
+ }
+ } else {
+ match = fnmatch(addr_str, peer_addr, 0);
+ if (negate ? match : !match) {
+ *result = status;
+ goto out;
+ }
}
}