diff -up bind-9.5.0b3/lib/isc/netaddr.c.any bind-9.5.0b3/lib/isc/netaddr.c --- bind-9.5.0b3/lib/isc/netaddr.c.any 2008-05-05 22:01:29.000000000 +0200 +++ bind-9.5.0b3/lib/isc/netaddr.c 2008-05-05 22:24:52.000000000 +0200 @@ -69,10 +69,11 @@ isc_boolean_t isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, unsigned int prefixlen) { - const unsigned char *pa, *pb; + const unsigned char *pa, *pb, *pany; unsigned int ipabytes; /* Length of whole IP address in bytes */ unsigned int nbytes; /* Number of significant whole bytes */ unsigned int nbits; /* Number of significant leftover bits */ + isc_netaddr_t any; /* represents 0.0.0.0 or ::0 */ REQUIRE(a != NULL && b != NULL); @@ -86,11 +87,15 @@ isc_netaddr_eqprefix(const isc_netaddr_t case AF_INET: pa = (const unsigned char *) &a->type.in; pb = (const unsigned char *) &b->type.in; + isc_netaddr_any(&any); + pany = (const unsigned char *) &any.type.in; ipabytes = 4; break; case AF_INET6: pa = (const unsigned char *) &a->type.in6; pb = (const unsigned char *) &b->type.in6; + isc_netaddr_any6(&any); + pany = (const unsigned char *) &any.type.in6; ipabytes = 16; break; default: @@ -99,6 +104,10 @@ isc_netaddr_eqprefix(const isc_netaddr_t return (ISC_FALSE); } + if (memcmp(pa, pany, ipabytes) == 0 || + memcmp(pb, pany, ipabytes) == 0) + return (ISC_TRUE); + /* * Don't crash if we get a pattern like 10.0.0.1/9999999. */