Commit 76f6df3c authored by Fabrice Bellet's avatar Fabrice Bellet

candidate: strip link-local ipv6 scope in local preference

This patch makes IPv6 link-local addresses obtain a unique ice
local preference when computing their priority, by stripping the
"%<interfacename>" added to them by getnameinfo(). Previously, all
these addresses obtained the same preference value, since the whole
local ips list was checked without finding a match.
parent a8e2475a
...@@ -171,9 +171,12 @@ nice_candidate_ip_local_preference (const NiceCandidate *candidate) ...@@ -171,9 +171,12 @@ nice_candidate_ip_local_preference (const NiceCandidate *candidate)
ips = nice_interfaces_get_local_ips (TRUE); ips = nice_interfaces_get_local_ips (TRUE);
for (iter = ips; iter; iter = g_list_next (iter)) { for (iter = ips; iter; iter = g_list_next (iter)) {
if (g_strcmp0 (ip_string, iter->data) == 0) { /* Strip the IPv6 link-local scope string */
gchar **tokens = g_strsplit (iter->data, "%", 2);
gboolean match = (g_strcmp0 (ip_string, tokens[0]) == 0);
g_strfreev (tokens);
if (match)
break; break;
}
++preference; ++preference;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment