$NetBSD: patch-cm,v 1.1 2006/07/07 12:30:56 spz Exp $ --- src/rpsl/rpsl/prefix.cc.orig 2004-07-30 12:58:14.000000000 +0200 +++ src/rpsl/rpsl/prefix.cc @@ -1216,10 +1216,13 @@ void MPPrefixRanges::except(MPPrefixRang assign(result.begin(), result.end()); } +// contains methods rewritten by spz according to hint from Hagen Boehm bool MPPrefixRanges::contains(IPAddr ip) const { MPPrefixRanges::const_iterator p; for (p = begin(); p != end(); ++p) { - if (p->ipv4 && (p->ipv4->get_ipaddr() == ip.get_ipaddr())) + if (p->ipv4 + && p->ipv4->get_ipaddr() == ip.get_ipaddr() + && p->ipv4->get_length() == ip.get_length() ) return true; } return false; @@ -1228,7 +1231,9 @@ bool MPPrefixRanges::contains(IPAddr ip) bool MPPrefixRanges::contains(IPv6Addr ip) const { MPPrefixRanges::const_iterator p; for (p = begin(); p != end(); ++p) { - if (p->ipv6 && (*(p->ipv6->get_ipaddr()) == *(ip.get_ipaddr())) ) + if (p->ipv6 + && p->ipv6->get_ipaddr() == ip.get_ipaddr() + && p->ipv6->get_length() == ip.get_length() ) return true; } return false; @@ -1237,9 +1242,17 @@ bool MPPrefixRanges::contains(IPv6Addr i bool MPPrefixRanges::contains(MPPrefix ip) const { MPPrefixRanges::const_iterator p; for (p = begin(); p != end(); ++p) { - if (p->ipv6 && ip.ipv6 && (*(p->ipv6->get_ipaddr()) == ip.get_ipaddr()) ) + if (p->ipv6 && ip.ipv6 + && p->ipv6->get_ipaddr() == ip.ipv6->get_ipaddr() + && p->ipv6->get_length() == ip.ipv6->get_length() + && p->ipv6->get_m() == ip.ipv6->get_m() + && p->ipv6->get_n() == ip.ipv6->get_n() ) return true; - if (p->ipv4 && ip.ipv4 && (p->ipv4->get_ipaddr() == ip.ipv4->get_ipaddr())) + if (p->ipv4 && ip.ipv4 + && p->ipv4->get_ipaddr() == ip.ipv4->get_ipaddr() + && p->ipv4->get_length() == ip.ipv4->get_length() + && p->ipv4->get_m() == ip.ipv4->get_m() + && p->ipv4->get_n() == ip.ipv4->get_n() ) return true; } return false;