settings: fix unmanaging of InfiniBand devices

ifcfg-rh didn't let you unmanage an InfiniBand device by hardware
address because it was recording the hardware address with uppercase
letters, while nm_match_spec_hwaddr() required lowercase. Fix this by
making nm_match_spec_hwaddr() match case-insensitively (and remove the
manual lowercasing that several other places were doing to work around
this.)

keyfile didn't let you unmanage an InfiniBand device by hardware
address because it only accepted ARPHRD_ETHER hardware addresses. Fix
that by using nm_utils_hwaddr_valid() instead.
This commit is contained in:
Dan Winship
2013-06-11 11:21:17 -03:00
parent 9a73db17d5
commit d575381c28
4 changed files with 16 additions and 32 deletions

View File

@@ -369,7 +369,7 @@ nm_match_spec_string (const GSList *specs, const char *match)
const GSList *iter;
for (iter = specs; iter; iter = g_slist_next (iter)) {
if (!strcmp ((const char *) iter->data, match))
if (!g_ascii_strcasecmp ((const char *) iter->data, match))
return TRUE;
}
@@ -379,18 +379,12 @@ nm_match_spec_string (const GSList *specs, const char *match)
gboolean
nm_match_spec_hwaddr (const GSList *specs, const char *hwaddr)
{
char *hwaddr_match, *p;
char *hwaddr_match;
gboolean matched;
g_return_val_if_fail (hwaddr != NULL, FALSE);
p = hwaddr_match = g_strdup_printf ("mac:%s", hwaddr);
while (*p) {
*p = g_ascii_tolower (*p);
p++;
}
hwaddr_match = g_strdup_printf ("mac:%s", hwaddr);
matched = nm_match_spec_string (specs, hwaddr_match);
g_free (hwaddr_match);
return matched;