From a7f7b1ceeb78533d1c5856ed2f2adaf0bf386340 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 22 Sep 2024 11:28:07 +0100 Subject: Ignore bad stun/turn IP addresses --- plugins/ice/src/plugin.vala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'plugins/ice/src/plugin.vala') 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 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(); -- cgit v1.2.3-70-g09d2