aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2024-09-22 11:28:07 +0100
committerfiaxh <git@lightrise.org>2024-09-22 11:39:13 +0100
commita7f7b1ceeb78533d1c5856ed2f2adaf0bf386340 (patch)
tree2ca80dda3744965a8bac59f1a03026102dde6149 /plugins
parentf8c004630f56914438fa1b114530f639748e41c1 (diff)
downloaddino-a7f7b1ceeb78533d1c5856ed2f2adaf0bf386340.tar.gz
dino-a7f7b1ceeb78533d1c5856ed2f2adaf0bf386340.zip
Ignore bad stun/turn IP addresses
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ice/src/plugin.vala7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/ice/src/plugin.vala b/plugins/ice/src/plugin.vala
index 4abf042c..ec4fe9cb 100644
--- a/plugins/ice/src/plugin.vala
+++ b/plugins/ice/src/plugin.vala
@@ -31,9 +31,14 @@ public class Dino.Plugins.Ice.Plugin : RootInterface, Object {
Gee.List<Xep.ExternalServiceDiscovery.Service> services = yield ExternalServiceDiscovery.request_services(stream);
foreach (Xep.ExternalServiceDiscovery.Service service in services) {
if (service.transport == "udp" && (service.ty == "stun" || service.ty == "turn")) {
- InetAddress ip = yield lookup_ipv4_addess(service.host);
+ InetAddress? ip = yield lookup_ipv4_addess(service.host);
if (ip == null) continue;
+ if (ip.is_any || ip.is_link_local || ip.is_loopback || ip.is_multicast || ip.is_site_local) {
+ warning("Ignoring STUN/TURN server at %s", service.host);
+ continue;
+ }
+
if (service.ty == "stun") {
debug("Server offers STUN server: %s:%u, resolved to %s", service.host, service.port, ip.to_string());
ice_udp_module.stun_ip = ip.to_string();