bugtracker
bugtracker copied to clipboard
While using `networkInterfaces` Kurento considers only a single IP per interface
Prerequisites
-
[x] I have read the SUPPORT document
-
[x] I have checked the Troubleshooting Guide
-
[x] I have tested with the latest version of Kurento
Issue description
If networkInterfaces
in WebRtcEndpoint.conf.ini
is set, kurento picks only a signle IP of this interface.
Context
I try to accomplish IPv6 Support with the networkInterfaces
setting as a filter.
How to reproduce?
(replace eth0
with your interface name)
- verify you have multiple IP addresses assigned to this interface with
$ ip addr show eth0
- set
networkInterfaces=eth0
inWebRtcEndpoint.conf.ini
- start kurento
- establish a WebRTC Connection
- check, which IP's are included in the candidates list
Expected & current behavior
I would expect that with the setting 'networkInterfaces' a connection should be possible over any IP of the mentioned interfaces, not just a single (random? first?) one.
Possible solution
kms_webrtc_base_connection_agent_add_net_addr
currently uses nice_interfaces_get_ip_for_interface (gchar *interface_name)
which responds with a single IP. It could use a different method for getting all IPs assigned to this interface and adding all of them to the nice_agent.
https://github.com/Kurento/kms-elements/blob/cbe7516a0e6f20ab380f4d530ad9162d5464547b/src/gst-plugins/webrtcendpoint/kmswebrtcbaseconnection.c#L220
/**
* Add new local IP address to NiceAgent instance.
*/
static void
kms_webrtc_base_connection_agent_add_net_addr (const gchar * net_name,
NiceAgent * agent)
{
NiceAddress *nice_address = nice_address_new ();
gchar *ip_address = nice_interfaces_get_ip_for_interface ((gchar *)net_name);
nice_address_set_from_string (nice_address, ip_address);
nice_agent_add_local_address (agent, nice_address);
GST_INFO_OBJECT (agent, "Added local address: %s", ip_address);
nice_address_free (nice_address);
g_free (ip_address);
}
INFO about Kurento Media Server
- Kurento version: 6.14.0
nice_interfaces_get_ip_for_interface
code is here, where the important bit is the call to ioctl (sockfd, SIOCGIFADDR, &ifr)
.
SIOCGIFADDR docs say:
SIOCGIFADDR, SIOCSIFADDR Get or set the address of the device using ifr_addr. Setting the interface address is a privileged operation. For compati‐ bility, only AF_INET addresses are accepted or returned.
It doesn't even specify if this will be returning the first available IP address, or which one. I would assume it's the first one.
This issue doesn't look like a bug to me, more like a limitation of the current implementation / a feature request. I cannot spend time on this right now, so as always, PRs are welcome.
@j1elo I'm going to try and take a look at this to make it dual stack compatible.