Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Make networkInterfaces work with dual stack environments, add ipIgnoreList config #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

prlanzarin
Copy link
Contributor

@prlanzarin prlanzarin commented Sep 16, 2020

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 Kurento/bugtracker#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, with networkInterfaces, 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);

Pending

  • Unit tests
  • Improve API docs (kmd.json)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • 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

  • I have read the Contribution Guidelines
  • 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

…eList

This makes networkInterfaces dual stack compatible by removing the usage of nice_interfaces_get_ip_for_interface, which used ioctl and SIOCGIFADDR which are not AF_INET6 compatible

This was done via glibc`s getifaddrs. The pitfall here is that, differently from ioctl, 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 ipIgnoreList configuration

The ipIgnoreList config is a list of IP addresses (v4-6) to be ignored during the gathering phase. With that, you can prevent adding IPs from the desired interfaces you know are useless to libnice`s agent
@jenkinskurento
Copy link

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.

@prlanzarin
Copy link
Contributor Author

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.

@prlanzarin
Copy link
Contributor Author

prlanzarin commented Apr 12, 2021

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

While using networkInterfaces Kurento considers only a single IP per interface
3 participants