mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 02:35:25 +00:00
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:
parent
079f2bd560
commit
a12c9d6667
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
|||
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
|
||||
|
||||
2008-04-29 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
|
||||
|
|
|
@ -436,6 +436,41 @@ out:
|
|||
return success;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_system_device_is_up (NMDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (device != NULL, FALSE);
|
||||
|
||||
return nm_system_device_is_up_with_iface (nm_device_get_iface (device));
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_system_device_is_up_with_iface (const char *iface)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
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 */
|
||||
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;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_system_device_set_mtu (const char *iface, guint32 mtu)
|
||||
|
|
|
@ -70,6 +70,9 @@ gboolean nm_system_vpn_device_unset_from_ip4_config (NMDevice *active_device,
|
|||
gboolean nm_system_device_set_up_down (NMDevice *dev, gboolean up);
|
||||
gboolean nm_system_device_set_up_down_with_iface (const char *iface, gboolean up);
|
||||
|
||||
gboolean nm_system_device_is_up (NMDevice *device);
|
||||
gboolean nm_system_device_is_up_with_iface (const char *iface);
|
||||
|
||||
gboolean nm_system_device_update_resolv_conf (void *data, int len, const char *domain_name);
|
||||
|
||||
void nm_system_set_hostname (NMIP4Config *config);
|
||||
|
|
|
@ -733,7 +733,7 @@ out:
|
|||
static gboolean
|
||||
real_hw_is_up (NMDevice *device)
|
||||
{
|
||||
return NM_DEVICE_CLASS (nm_device_802_11_wireless_parent_class)->hw_is_up (device);
|
||||
return nm_system_device_is_up (device);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -342,7 +342,7 @@ real_take_down (NMDevice *dev)
|
|||
static gboolean
|
||||
real_hw_is_up (NMDevice *device)
|
||||
{
|
||||
return NM_DEVICE_CLASS (nm_device_802_3_ethernet_parent_class)->hw_is_up (device);
|
||||
return nm_system_device_is_up (device);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1010,13 +1010,6 @@ real_deactivate_quickly (NMDevice *device)
|
|||
nm_serial_device_close (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
real_is_up (NMDevice *device)
|
||||
{
|
||||
/* Serial devices are always "up" */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static guint32
|
||||
real_get_generic_capabilities (NMDevice *dev)
|
||||
{
|
||||
|
@ -1052,7 +1045,6 @@ nm_serial_device_class_init (NMSerialDeviceClass *klass)
|
|||
object_class->finalize = finalize;
|
||||
|
||||
parent_class->get_generic_capabilities = real_get_generic_capabilities;
|
||||
parent_class->is_up = real_is_up;
|
||||
parent_class->act_stage2_config = real_act_stage2_config;
|
||||
parent_class->act_stage4_get_ip4_config = real_act_stage4_get_ip4_config;
|
||||
parent_class->deactivate_quickly = real_deactivate_quickly;
|
||||
|
|
Loading…
Reference in a new issue