NetworkManager r4226 - in trunk: . src



Author: tambeti
Date: Mon Oct 27 10:50:21 2008
New Revision: 4226
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4226&view=rev

Log:
2008-10-27  Tambet Ingo  <tambet gmail com>

	* src/nm-device-ethernet.c (nm_device_ethernet_get_speed): Implement
	correct speed reporting for fast devices (kernel >= 2.6.27).

Modified:
   trunk/ChangeLog
   trunk/src/nm-device-ethernet.c

Modified: trunk/src/nm-device-ethernet.c
==============================================================================
--- trunk/src/nm-device-ethernet.c	(original)
+++ trunk/src/nm-device-ethernet.c	Mon Oct 27 10:50:21 2008
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <linux/types.h>
 #include <linux/sockios.h>
+#include <linux/version.h>
 #include <linux/ethtool.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
@@ -453,7 +454,14 @@
 	if (ioctl (fd, SIOCETHTOOL, &ifr) == -1)
 		goto out;
 
-	speed = edata.speed != G_MAXUINT16 ? edata.speed : 0;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
+	speed = edata.speed;
+#else
+	speed = ethtool_cmd_speed (&edata);
+#endif
+
+	if (speed == G_MAXUINT16 || speed == G_MAXUINT32)
+		speed = 0;
 
 out:
 	close (fd);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]