kms-elements
kms-elements copied to clipboard
Make networkInterfaces work with dual stack environments, add ipIgnoreList config
What is the current behavior you want to change?
Currently, the networkInterfaces
option does not work with IPv6 addresses, making it useless in dual stack environments.
This PR makes it dual stack compatible.
Fixes https://github.com/Kurento/bugtracker/issues/500.
What is the new behavior provided by this change?
This makes networkInterfaces dual stack compatible by removing the usage of nice_interfaces_get_ip_for_interface
, which used ioctl
and SIOCGIFADDR
. The latter does not support (I think*) AF_INET6
addresses, as explained by:
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.
The new appro was done via glibc's getifaddrs
(fully available from 2.3.3 onwards).
The pitfall with this approach is that, differently from ioctl+SIOCGIFADDR, this fetches link local and private IPs from interfaces, which brought in the need of manually filtering link local addresses and the introduction of the new ipIgnoreList
configuration.
From WebRtcEndpoint.conf.ini:
;; List of IPs to be ignored during the gathering phase when networkInterfaces
;; is enabled.
;;
;; If you set up the networkInterfaces option and the desired interfaces have
;; IPs that you don't wish to be used by libnice's NiceAgent, you
;; you can define them here.
;;
;; The general use case is filtering out IP addresses which are in the private
;; address ranges in environments where they aren't needed. This allows a fine
;; tuning to the number of server-side candidates generated by Kurento, reducing
;; signalling overhead and potentially speeding up connectivity checks.
;;
;; <ipIgnoreList> is a comma-separated list of IP (IPv4 and IPV6) addresses
;;
;; Examples:
;; ipIgnoreList=10.10.0.254
;; ipIgnoreList=fd12:3456:789a:1::1
ipIgnoreList
is only effective when networkInterfaces
is set.
How has this been tested?
- Compiled on 16.04
- Dual stack (IPv4+IPv6) and single stack (IPv4) environments
- Basically did manual configuration combinations and verified behaviour on remote ends (Firefox, Chrome)
- No
networkInterfaces
, withnetworkInterfaces
, all environments: verified that it's working for single and dual stack envs; -
ipIgnoreList
: tested by adding private range IPv4 and IPv6 addresses to my network interface. Verified that including them in the ignore list prevented them to be used in gathering (via webrtc-internals/about:webrtc). Also tested single IPs and a list of IPs (both are supported);
- No
Pending
- Unit tests
- Improve API docs (kmd.json)
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature / enhancement (non-breaking change which improves the project)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] My change requires a change to the documentation
- [ ] My change requires a change in other repository
Checklist
- [x] I have read the Contribution Guidelines
- [x] I have added an explanation of what the changes do and why they should be included
- [ ] I have written new tests for the changes, as applicable, and have successfully run them locally
Hi there, thanks for your Pull Request!
A Kurento member needs to verify that this patch is reasonable to test. In case it is, they should write a comment with the phrase test this please
. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by Kurento members will still work. Regular contributors can be whitelisted to skip this step.
I'm up for a discussion about this approach, mainly regarding the addition of ipIgnoreList
.
If we find out this is proper, then we can focus on the unit testing/API docs.
I believe (but have not tested) that dual stack support + nice_interfaces_get_ip_for_interface
has been addressed in upstream libnice with https://gitlab.freedesktop.org/libnice/libnice/-/merge_requests/186.
If that's correct, then this PR should be closed/deprecated once Kurento picks up the libnice version that includes that MR.