mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Add to_subnet bif (fixes #782).
Also fix IPAddr::Mask/ReverseMask not allowing argument of 0. And clarified return value of to_addr bif when the input string does not parse into a valid IP address.
This commit is contained in:
parent
c84394d07f
commit
32aabe8432
9 changed files with 59 additions and 14 deletions
|
@ -11,7 +11,7 @@ const uint8_t IPAddr::v4_mapped_prefix[12] = { 0, 0, 0, 0,
|
|||
|
||||
void IPAddr::Mask(int top_bits_to_keep)
|
||||
{
|
||||
if ( top_bits_to_keep <= 0 || top_bits_to_keep > 128 )
|
||||
if ( top_bits_to_keep < 0 || top_bits_to_keep > 128 )
|
||||
{
|
||||
reporter->Error("Bad IPAddr::Mask value %d", top_bits_to_keep);
|
||||
return;
|
||||
|
@ -40,7 +40,7 @@ void IPAddr::Mask(int top_bits_to_keep)
|
|||
|
||||
void IPAddr::ReverseMask(int top_bits_to_chop)
|
||||
{
|
||||
if ( top_bits_to_chop <= 0 || top_bits_to_chop > 128 )
|
||||
if ( top_bits_to_chop < 0 || top_bits_to_chop > 128 )
|
||||
{
|
||||
reporter->Error("Bad IPAddr::ReverseMask value %d", top_bits_to_chop);
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue