Skip to content

Commit 0c35e61

Browse files
Fix IP filter (#318)
The logic was wrong and would actually remove many IPs.
1 parent 956ae26 commit 0c35e61

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

ice/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# webrtc-ice changelog
22

33
## Unreleased
4-
* Add IP filter to ICE `AgentConfig` [#306](https://github.com/webrtc-rs/webrtc/pull/306)
4+
5+
* Add IP filter to ICE `AgentConfig` [#306](https://github.com/webrtc-rs/webrtc/pull/306) and [#318](https://github.com/webrtc-rs/webrtc/pull/318).
56

67
## v0.8.1
78

ice/src/util/mod.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,13 @@ pub async fn local_interfaces(
118118

119119
if !ipaddr.is_loopback()
120120
&& ((ipv4requested && ipaddr.is_ipv4()) || (ipv6requested && ipaddr.is_ipv6()))
121+
&& ip_filter
122+
.as_ref()
123+
.map(|filter| filter(ipaddr))
124+
.unwrap_or(true)
121125
{
122-
continue;
123-
}
124-
125-
if let Some(filter) = ip_filter {
126-
if !filter(ipaddr) {
127-
continue;
128-
}
126+
ips.insert(ipaddr);
129127
}
130-
131-
ips.insert(ipaddr);
132128
}
133129
}
134130

0 commit comments

Comments
 (0)