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.
ips = nice_interfaces_get_local_ips (TRUE);
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;
- }
++preference;
}