core: fix up checks for s390 CTC device type (bgo #649025)

The original check had incorrect logic; correct it.
This commit is contained in:
Dan Williams 2011-05-03 10:38:32 -05:00
parent f898dbf1a9
commit 2e740fe308

View file

@ -490,6 +490,7 @@ net_add (NMUdevManager *self, GUdevDevice *device)
gint etype;
const char *iface;
const char *tmp;
gboolean is_ctc;
g_return_if_fail (device != NULL);
@ -499,12 +500,14 @@ net_add (NMUdevManager *self, GUdevDevice *device)
return;
}
etype = g_udev_device_get_sysfs_attr_as_int (device, "type");
is_ctc = (strncmp (iface, "ctc", 3) == 0) && (etype == 256);
/* Ignore devices that don't report Ethernet encapsulation, except for
* s390 CTC-type devices that report 256 for some reason.
* FIXME: use something other than interface name to detect CTC here.
*/
etype = g_udev_device_get_sysfs_attr_as_int (device, "type");
if ((etype != 1) && (!strncmp (iface, "ctc", 3) && (etype != 256))) {
if ((etype != 1) && (is_ctc == FALSE)) {
nm_log_dbg (LOGD_HW, "ignoring interface with type %d", etype);
return;
}