diff --git a/src/addr/get.rs b/src/addr/get.rs index a0e7240..67bdb7c 100644 --- a/src/addr/get.rs +++ b/src/addr/get.rs @@ -114,11 +114,13 @@ impl AddressFilterBuilder { } if let Some(address) = self.address { + let mut is_match: bool = false; + for nla in msg.nlas.iter() { if let Unspec(x) | Address(x) | Local(x) | Multicast(x) | Anycast(x) = nla { - let is_match = match address { + is_match = match address { IpAddr::V4(address) => { x[..] == address.octets()[..] } @@ -127,22 +129,31 @@ impl AddressFilterBuilder { } }; if is_match { - return true; + break; } } } - return false; + + if !is_match { + return false; + } } if let Some(ref label) = self.label { + let mut is_match: bool = false; + for nla in msg.nlas.iter() { if let Label(l) = nla { if label == l { - return true; + is_match = true; + break; } } } - return false; + + if !is_match { + return false; + } } true