2008-04-30 Dan Williams <dcbw@redhat.com>

* src/NetworkManagerSystem.c
	  src/NetworkManagerSystem.h
		- (nm_system_device_is_up, nm_system_device_is_up_with_iface): new
			functions to check device flags for IFF_UP

	* src/nm-serial-device.c
		- (real_is_up): remove; NMDevice now returns TRUE if the subclass doesn't
			implement is_up

	* src/nm-device-802-3-ethernet.c
	  src/nm-device-802-11-wireless.c
		- (real_hw_is_up): call nm_system_device_is_up()

	* src/nm-device.c
		- (real_hw_is_up): move to nm_system_device_is_up_with_iface()
		- (real_is_up): remove; nm_device_is_up() returns TRUE if subclass
			does not implement



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3620 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2008-04-30 12:54:00 +00:00
parent 079f2bd560
commit a12c9d6667
7 changed files with 60 additions and 49 deletions

View File

@@ -196,37 +196,6 @@ error:
return NULL;
}
static gboolean
real_hw_is_up (NMDevice *self)
{
struct ifreq ifr;
const char *iface;
int err, fd;
fd = socket (PF_INET, SOCK_DGRAM, 0);
if (fd < 0) {
nm_warning ("couldn't open control socket.");
return FALSE;
}
/* Get device's flags */
iface = nm_device_get_iface (self);
strncpy (ifr.ifr_name, iface, IFNAMSIZ);
err = ioctl (fd, SIOCGIFFLAGS, &ifr);
close (fd);
if (!err)
return (!((ifr.ifr_flags^IFF_UP) & IFF_UP));
if (errno != ENODEV) {
nm_warning ("%s: could not get flags for device %s. errno = %d",
__func__, iface, errno);
}
return FALSE;
}
static gboolean
nm_device_hw_is_up (NMDevice *self)
{
@@ -1474,12 +1443,6 @@ nm_device_hw_take_down (NMDevice *self, gboolean wait)
g_usleep (200);
}
static gboolean
real_is_up (NMDevice *self)
{
return TRUE;
}
static gboolean
nm_device_bring_up (NMDevice *self, gboolean wait)
{
@@ -1693,8 +1656,6 @@ nm_device_class_init (NMDeviceClass *klass)
object_class->get_property = get_property;
object_class->constructor = constructor;
klass->hw_is_up = real_hw_is_up;
klass->is_up = real_is_up;
klass->get_type_capabilities = real_get_type_capabilities;
klass->get_generic_capabilities = real_get_generic_capabilities;
klass->act_stage1_prepare = real_act_stage1_prepare;