From: guy Date: Wed, 30 Jul 2003 00:20:28 +0000 (+0000) Subject: As per a comment by Alex Medvedev , start the search X-Git-Tag: tcpdump-3.8-bp~77 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/66b89d8fb86a633944c17c380fbd324253f360ba As per a comment by Alex Medvedev , start the search for prefixes at bitmasks[32] (the last element of a 33-element array), not bitmasks[33] (one past the last element of that array). Clean up white space. --- diff --git a/util.c b/util.c index ad7e3fde..36b8611c 100644 --- a/util.c +++ b/util.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.85 2003-04-21 16:59:52 fenner Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.86 2003-07-30 00:20:28 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -328,15 +328,15 @@ mask2plen (u_int32_t mask) 0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0, 0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff }; - int prefix_len = 33; + int prefix_len = 32; - /* lets see if we can transform the mask into a prefixlen */ - while (prefix_len >= 0) { - if (bitmasks[prefix_len] == mask) - break; - prefix_len--; - } - return (prefix_len); + /* let's see if we can transform the mask into a prefixlen */ + while (prefix_len >= 0) { + if (bitmasks[prefix_len] == mask) + break; + prefix_len--; + } + return (prefix_len); } /* VARARGS */