1
0
mirror of https://github.com/gluster/glusterfs.git synced 2026-02-06 09:48:44 +01:00
Files
glusterfs/tests/utils
Sanju Rakonde 0359293023 auth.allow: fix gf_is_ip_in_net (#4109)
* auth.allow: fix gf_is_ip_in_net

Problem:
When auth.allow is set to a subnet address, the hosts which
belong to the same subnet are not able to mount glusterfs volume.
The hosts outside the subnet are able to mount glusterfs volume.

Cause:
1. When the host ip and subnet ip are converted from string to
long using inet_pton, the output is in host byte order, where the subnet
mask is in network byte order.
2. The subnet mask for ipv4 should contain 1's (x times, for /x) followed
by 0's (32 - x times). The currene implementation gives a different submask.

Fix:
1. Convert the ip addresses to network byte order from host byte order
2. Get correct subnet mask

fixes:#4108
Signed-off-by: Sanju Rakonde <sanju.rakonde@phonepe.com>

* Fix clange issueswq

Signed-off-by: Sanju Rakonde <sanju.rakonde@phonepe.com>

* addressing review comments

* apply clang format changes

* apply clang format changes

* address review comments

* link -lresolv to libglusterfs

* add changes

* -s

* add lresolv to compile test .c file

* do not link lresolv for freebsd

Signed-off-by: Sanju Rakonde <sanju.rakonde@phonepe.com>

* add the lresolv lib changes outside debug section

Signed-off-by: Sanju Rakonde <sanju.rakonde@phonepe.com>

* change variable name

---------

Signed-off-by: Sanju Rakonde <sanju.rakonde@phonepe.com>
2023-05-29 19:29:29 +05:30
..
2019-05-22 12:23:07 +05:30