summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Bellet <fabrice@bellet.info>2016-04-21 18:18:59 +0200
committerOlivier CrĂȘte <olivier.crete@collabora.com>2017-06-08 16:22:24 -0400
commitb4abda09c79e4ce372a3771300abf568c85c7ff5 (patch)
tree93fd80d176a8e2e9e31572236fd97a77e8e3b299
parentd5446a72233eab8501be0b3fb9060c8be3ba034b (diff)
downloadlibnice-b4abda09c79e4ce372a3771300abf568c85c7ff5.tar.gz
interfaces: ignore predefined network interfaces
Some interfaces, like the one managed by libvirtd to provide a network bridge to locally hosted virtual machines, can be completely ignored when gathering ICE candidates. The motivation for adding this possibility is that, ignoring them doesn't remove capabilities, and improves the overall speed of the connection check method, by reducing the number of pairs to be tested. This patch adds the possibility to define such interfaces in the configuration script. Differential Revision: https://phabricator.freedesktop.org/D948
-rw-r--r--agent/interfaces.c6
-rw-r--r--configure.ac14
2 files changed, 20 insertions, 0 deletions
diff --git a/agent/interfaces.c b/agent/interfaces.c
index 0fa2fd7..a81888e 100644
--- a/agent/interfaces.c
+++ b/agent/interfaces.c
@@ -276,6 +276,12 @@ nice_interfaces_get_local_ips (gboolean include_loopback)
nice_debug ("Ignoring loopback interface");
g_free (addr_string);
}
+#ifdef IGNORED_IFACE_PREFIX
+ } else if (g_str_has_prefix (ifa->ifa_name, IGNORED_IFACE_PREFIX)) {
+ nice_debug ("Ignoring interface %s as it matches prefix %s",
+ ifa->ifa_name, IGNORED_IFACE_PREFIX);
+ g_free (addr_string);
+#endif
} else {
if (nice_interfaces_is_private_ip (ifa->ifa_addr))
ips = add_ip_to_list (ips, addr_string, TRUE);
diff --git a/configure.ac b/configure.ac
index b39bfe3..98bbc08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -354,6 +354,20 @@ AM_CONDITIONAL([ENABLE_GTK_DOC], false)
# GObject introspection
GOBJECT_INTROSPECTION_CHECK([1.30.0])
+dnl Ignore a specific network interface name prefix from the connection check
+AC_MSG_CHECKING([whether to ignore a specific network interface name prefix])
+AC_ARG_WITH([ignored-network-interface-prefix],
+ [AS_HELP_STRING([--with-ignored-network-interface-prefix=string],
+ [Ignore network interfaces whose name starts with "string" from the ICE connection
+ check algorithm. For example, interfaces "virbr" in the case of the virtual bridge
+ handled by libvirtd, do not help in finding connectivity.])],
+ [interface_prefix="$withval"])
+AS_IF([test -n "$interface_prefix"],
+ [AC_DEFINE_UNQUOTED([IGNORED_IFACE_PREFIX],["$interface_prefix"],
+ [Ignore this network interface prefix from the connection check])
+ AC_MSG_RESULT([yes, $interface_prefix])],
+ [AC_MSG_RESULT([no])])
+
AC_CONFIG_MACRO_DIR(m4)
AC_OUTPUT