diff options
| author | Daniil Baturin <daniil@baturin.org> | 2013-06-01 13:34:05 -0700 |
|---|---|---|
| committer | Daniil Baturin <daniil@baturin.org> | 2013-06-01 13:34:05 -0700 |
| commit | e2faec5f111fd733b56f8842cb50998cefccd926 (patch) | |
| tree | eda7e09a268b00a11d189ab3812afdd88ccb9aa0 /src | |
| parent | 00f98b395795533a9a424fa9bd55e52957ad1031 (diff) | |
| download | ipaddrcheck-e2faec5f111fd733b56f8842cb50998cefccd926.tar.gz ipaddrcheck-e2faec5f111fd733b56f8842cb50998cefccd926.zip | |
Fix is_ipv4_broadcast() behaviour, don't return success for addresses
that can't be broadcast by definition (IPv6, IPv4 p-t-p).
Diffstat (limited to 'src')
| -rw-r--r-- | src/ipaddrcheck_functions.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ipaddrcheck_functions.c b/src/ipaddrcheck_functions.c index 061ba8f..2ba8de2 100644 --- a/src/ipaddrcheck_functions.c +++ b/src/ipaddrcheck_functions.c @@ -244,7 +244,11 @@ int is_ipv4_broadcast(CIDR *address) { int result; - if( cidr_equals(address, cidr_addr_broadcast(address)) == 0 ) + /* The very concept of broadcast address doesn't apply to + IPv6 and point-to-point or /32 IPv4 */ + if( (cidr_get_proto(address) == CIDR_IPV4) && + (cidr_equals(address, cidr_addr_broadcast(address)) == 0 ) && + (cidr_get_pflen(address) < 31) ) { result = RESULT_SUCCESS; } |
