From 221be0e80a2f128211d22302fd139fd310526e8e Mon Sep 17 00:00:00 2001 From: Benji Rewis Date: Wed, 24 Jan 2024 14:00:45 -0800 Subject: [PATCH] RSDK-239 Disallow IPV6 connections --- src/rpc/webrtc.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rpc/webrtc.rs b/src/rpc/webrtc.rs index 8ebbc76..a57982c 100644 --- a/src/rpc/webrtc.rs +++ b/src/rpc/webrtc.rs @@ -7,6 +7,7 @@ use futures::Future; use http::{header::HeaderName, HeaderMap, HeaderValue, Uri}; use std::{ hint, + net::IpAddr, pin::Pin, str::FromStr, sync::{atomic::AtomicBool, Arc}, @@ -183,6 +184,12 @@ fn new_webrtc_api() -> Result { let mut setting_engine = SettingEngine::default(); setting_engine.set_ice_multicast_dns_mode(MulticastDnsMode::QueryAndGather); + // Disallow ipv6 addresses since grpc-go does not currently support IPv6 scoped literals. + // See related grpc-go issue: https://github.com/grpc/grpc-go/issues/3272. + // In communicating with WebRTC agents using go (such as an RDK), we do not want to elect + // an IPV6 address. + setting_engine.set_ip_filter(Box::new(|ip: IpAddr| -> bool { ip.is_ipv4() })); + Ok(APIBuilder::new() .with_media_engine(media_engine) .with_interceptor_registry(interceptor)