Goutham Pacha Ravi has uploaded this change for review.
Allow /0 CIDR prefix in export client blocks
The lexer regex patterns for CIDR suffixes reject prefix
length 0 because they require the first digit to be [1-9].
This prevents valid CIDR notation like 0.0.0.0/0 and ::/0
(RFC 4632, RFC 4291) from being used in export client
blocks to match all addresses in an address family.
Fix the regex to accept /0 while still disallowing leading
zeros. Also fix undefined behavior in cidr_contains_ip()
for IPv4 with mask=0, where a 32-bit shift of an int is
performed (UB in C). Add test cases for /0 parsing and
containment.
Change-Id: Ibd5364266e7a5afe1b2749f9a5fc2c1dc7478ba3
Fixes: https://github.com/nfs-ganesha/nfs-ganesha/issues/1396
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
---
M src/config_parsing/conf_lex.l
M src/support/ip_utils.c
M src/test/test_cidr.c
3 files changed, 11 insertions(+), 2 deletions(-)
git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/48/1237448/1
To view, visit change 1237448. To unsubscribe, or for help writing mail filters, visit settings.