2005-05-06 Dan Williams <dcbw@redhat.com>
* gnome/applet/applet-dbus-device.c gnome/applet/applet-dbus-info.c gnome/applet/applet-dbus.c gnome/applet/applet.c gnome/applet/applet.h - (nmwa_get_device_for_nm_device) -> (nmwa_get_device_for_nm_path) * gnome/applet/applet-dbus.c - (nmwa_dbus_filter): trap DeviceCarrierOn/DeviceCarrierOff signals so we notice when wired device's carriers come back on. Should fix issue with wired devices being grayed out even if the cable is in, for devices that support carrier detection. * gnome/applet/applet.c - (nmwa_driver_notify): bash focus-stealing prevention in the face - (nmwa_act_stage_to_pixbuf): Clarify wireless ACT_STAGE_DEVICE_CONFIG tooltip message - (nmwa_menu_item_activate, nmwa_menu_add_device_item, nmwa_menu_item_data_free): Fix situation where applet wouldn't respond to menu selections * src/NetworkManager.c src/NetworkManagerDevice.c src/NetworkManagerDbus.c src/NetworkManagerDbus.h - (nm_dbus_signal_device_status_change) -> (nm_dbus_schedule_device_status_change_signal) * src/NetworkManagerDbus.c - (nm_dbus_send_network_not_found, nm_dbus_schedule_network_not_found_signal): Remove, no longer used or relevant - (nm_dbus_signal_device_status_change): Better signal enum->string matching - (nm_dbus_schedule_device_status_change_signal): add * src/NetworkManagerDevice.c - (nm_device_worker_thread_stop): don't try to join a NULL worker thread - (nm_device_set_link_active): Fix up switching for non-carrier-detect devices, ie don't deactivate them unless explicitly told to by the user. Also send CARRIER_OFF / CARRIER_ON signals when link changes - (nm_device_set_essid, nm_device_set_enc_key, nm_device_is_up, nm_device_set_mode): Don't print error message when device is no longer around - (nm_device_deactivate): kill any current DHCP process attached to this device, not just during activation * src/NetworkManagerPolicy.c - (nm_policy_auto_get_best_device): Ignore semi-supported devices completely from auto-device-selection. - (nm_policy_device_change_check): Don't interrupt semi-supported devices * src/NetworkManagerSystem.c - (nm_system_device_set_up_down_with_iface): Quiet first warning message when device is no longer present (Bill Moss) * src/backends/shvar.c - (svOpenFile): Open read-only to make SELinux happy * src/backends/NetworkManagerRedHat.c - (nm_system_device_get_system_config): Use SYSCONFDIR rather than hardcoding the path to the ifcfg-* files git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@613 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
60
ChangeLog
60
ChangeLog
@@ -1,3 +1,63 @@
|
||||
2005-05-06 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* gnome/applet/applet-dbus-device.c
|
||||
gnome/applet/applet-dbus-info.c
|
||||
gnome/applet/applet-dbus.c
|
||||
gnome/applet/applet.c
|
||||
gnome/applet/applet.h
|
||||
- (nmwa_get_device_for_nm_device) -> (nmwa_get_device_for_nm_path)
|
||||
|
||||
* gnome/applet/applet-dbus.c
|
||||
- (nmwa_dbus_filter): trap DeviceCarrierOn/DeviceCarrierOff signals
|
||||
so we notice when wired device's carriers come back on. Should
|
||||
fix issue with wired devices being grayed out even if the cable
|
||||
is in, for devices that support carrier detection.
|
||||
|
||||
* gnome/applet/applet.c
|
||||
- (nmwa_driver_notify): bash focus-stealing prevention in the face
|
||||
- (nmwa_act_stage_to_pixbuf): Clarify wireless ACT_STAGE_DEVICE_CONFIG
|
||||
tooltip message
|
||||
- (nmwa_menu_item_activate, nmwa_menu_add_device_item, nmwa_menu_item_data_free):
|
||||
Fix situation where applet wouldn't respond to menu selections
|
||||
|
||||
* src/NetworkManager.c
|
||||
src/NetworkManagerDevice.c
|
||||
src/NetworkManagerDbus.c
|
||||
src/NetworkManagerDbus.h
|
||||
- (nm_dbus_signal_device_status_change) -> (nm_dbus_schedule_device_status_change_signal)
|
||||
|
||||
* src/NetworkManagerDbus.c
|
||||
- (nm_dbus_send_network_not_found, nm_dbus_schedule_network_not_found_signal):
|
||||
Remove, no longer used or relevant
|
||||
- (nm_dbus_signal_device_status_change): Better signal enum->string matching
|
||||
- (nm_dbus_schedule_device_status_change_signal): add
|
||||
|
||||
* src/NetworkManagerDevice.c
|
||||
- (nm_device_worker_thread_stop): don't try to join a NULL worker thread
|
||||
- (nm_device_set_link_active): Fix up switching for non-carrier-detect devices,
|
||||
ie don't deactivate them unless explicitly told to by the user. Also send
|
||||
CARRIER_OFF / CARRIER_ON signals when link changes
|
||||
- (nm_device_set_essid, nm_device_set_enc_key, nm_device_is_up, nm_device_set_mode):
|
||||
Don't print error message when device is no longer around
|
||||
- (nm_device_deactivate): kill any current DHCP process attached to this device,
|
||||
not just during activation
|
||||
|
||||
* src/NetworkManagerPolicy.c
|
||||
- (nm_policy_auto_get_best_device): Ignore semi-supported devices completely from
|
||||
auto-device-selection.
|
||||
- (nm_policy_device_change_check): Don't interrupt semi-supported devices
|
||||
|
||||
* src/NetworkManagerSystem.c
|
||||
- (nm_system_device_set_up_down_with_iface): Quiet first warning message when device
|
||||
is no longer present (Bill Moss)
|
||||
|
||||
* src/backends/shvar.c
|
||||
- (svOpenFile): Open read-only to make SELinux happy
|
||||
|
||||
* src/backends/NetworkManagerRedHat.c
|
||||
- (nm_system_device_get_system_config): Use SYSCONFDIR rather than hardcoding
|
||||
the path to the ifcfg-* files
|
||||
|
||||
2005-05-05 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* Expose activation stages to NetworkManager clients, like the applet
|
||||
|
@@ -718,7 +718,7 @@ void nmwa_dbus_net_properties_cb (DBusPendingCall *pcall, void *user_data)
|
||||
{
|
||||
NetworkDevice * dev;
|
||||
|
||||
if ((dev = nmwa_get_device_for_nm_device (applet->dbus_device_list, cb_data->dev_op)))
|
||||
if ((dev = nmwa_get_device_for_nm_path (applet->dbus_device_list, cb_data->dev_op)))
|
||||
{
|
||||
WirelessNetwork * net = wireless_network_new (essid, op);
|
||||
WirelessNetwork * tmp_net;
|
||||
@@ -798,7 +798,7 @@ void nmwa_dbus_device_remove_one_network (NMWirelessApplet *applet, const char *
|
||||
g_return_if_fail (dev_path != NULL);
|
||||
g_return_if_fail (net_path != NULL);
|
||||
|
||||
if ((dev = nmwa_get_device_for_nm_device (applet->dbus_device_list, dev_path)))
|
||||
if ((dev = nmwa_get_device_for_nm_path (applet->dbus_device_list, dev_path)))
|
||||
{
|
||||
WirelessNetwork * net;
|
||||
|
||||
@@ -871,7 +871,7 @@ void nmwa_dbus_device_properties_cb (DBusPendingCall *pcall, void *user_data)
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
NetworkDevice *dev = network_device_new (iface, type, op);
|
||||
NetworkDevice *tmp_dev = nmwa_get_device_for_nm_device (applet->dbus_device_list, op);
|
||||
NetworkDevice *tmp_dev = nmwa_get_device_for_nm_path (applet->dbus_device_list, op);
|
||||
|
||||
network_device_set_hal_udi (dev, udi);
|
||||
network_device_set_address (dev, hw_addr);
|
||||
@@ -1033,7 +1033,7 @@ void nmwa_dbus_device_remove_one_device (NMWirelessApplet *applet, const char *d
|
||||
|
||||
g_return_if_fail (applet != NULL);
|
||||
|
||||
if ((dev = nmwa_get_device_for_nm_device (applet->dbus_device_list, dev_path)))
|
||||
if ((dev = nmwa_get_device_for_nm_path (applet->dbus_device_list, dev_path)))
|
||||
{
|
||||
applet->dbus_device_list = g_slist_remove (applet->dbus_device_list, dev);
|
||||
network_device_unref (dev);
|
||||
@@ -1057,7 +1057,7 @@ void nmwa_dbus_set_device (DBusConnection *connection, NetworkDevice *dev, const
|
||||
g_return_if_fail (connection != NULL);
|
||||
g_return_if_fail (dev != NULL);
|
||||
|
||||
if (network_device_is_wired (dev) && !passphrase && (key_type != -1))
|
||||
if (network_device_is_wireless (dev) && !passphrase && (key_type != -1))
|
||||
return;
|
||||
|
||||
if ((message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "setActiveDevice")))
|
||||
@@ -1224,11 +1224,11 @@ void nmwa_dbus_update_device_strength_cb (DBusPendingCall *pcall, void *user_dat
|
||||
NetworkDevice *dev;
|
||||
|
||||
/* Update strength on dbus active device */
|
||||
if ((dev = nmwa_get_device_for_nm_device (applet->dbus_device_list, cb_data->dev_path)))
|
||||
if ((dev = nmwa_get_device_for_nm_path (applet->dbus_device_list, cb_data->dev_path)))
|
||||
network_device_set_strength (dev, strength);
|
||||
|
||||
/* Update strength on gui active device too */
|
||||
if ((dev = nmwa_get_device_for_nm_device (applet->gui_device_list, cb_data->dev_path)))
|
||||
if ((dev = nmwa_get_device_for_nm_path (applet->gui_device_list, cb_data->dev_path)))
|
||||
network_device_set_strength (dev, strength);
|
||||
}
|
||||
dbus_message_unref (reply);
|
||||
|
@@ -72,7 +72,7 @@ static DBusMessage * nmi_dbus_get_key_for_network (NMWirelessApplet *applet, DBu
|
||||
WirelessNetwork *net = NULL;
|
||||
|
||||
g_mutex_lock (applet->data_mutex);
|
||||
if ((dev = nmwa_get_device_for_nm_device (applet->gui_device_list, dev_path)))
|
||||
if ((dev = nmwa_get_device_for_nm_path (applet->gui_device_list, dev_path)))
|
||||
{
|
||||
if ((net = network_device_get_wireless_network_by_nm_path (dev, net_path)))
|
||||
success = nmi_passphrase_dialog_schedule_show (dev, net, message, applet);
|
||||
|
@@ -420,7 +420,7 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa
|
||||
if (!(interface = dbus_message_get_interface (message)))
|
||||
return FALSE;
|
||||
|
||||
/* nm_info ("signal(): got signal op='%s' member='%s' interface='%s'", object_path, member, interface); */
|
||||
/* nm_info ("signal(): got signal op='%s' member='%s' interface='%s'", object_path, member, interface); */
|
||||
|
||||
if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
|
||||
{
|
||||
@@ -481,7 +481,9 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa
|
||||
else if ( dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceAdded")
|
||||
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive")
|
||||
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive")
|
||||
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivating"))
|
||||
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivating")
|
||||
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceCarrierOn")
|
||||
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceCarrierOff"))
|
||||
{
|
||||
char *path = NULL;
|
||||
|
||||
@@ -584,10 +586,10 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa
|
||||
{
|
||||
NetworkDevice *dev;
|
||||
|
||||
if ((dev = nmwa_get_device_for_nm_device (applet->dbus_device_list, dev_path)))
|
||||
if ((dev = nmwa_get_device_for_nm_path (applet->dbus_device_list, dev_path)))
|
||||
network_device_set_act_stage (dev, stage);
|
||||
|
||||
if ((dev = nmwa_get_device_for_nm_device (applet->gui_device_list, dev_path)))
|
||||
if ((dev = nmwa_get_device_for_nm_path (applet->gui_device_list, dev_path)))
|
||||
network_device_set_act_stage (dev, stage);
|
||||
}
|
||||
}
|
||||
|
@@ -532,12 +532,13 @@ gboolean nmwa_driver_notify (gpointer user_data)
|
||||
DriverNotifyCBData * cb_data = (DriverNotifyCBData *)(user_data);
|
||||
NetworkDevice * dev;
|
||||
NMWirelessApplet * applet;
|
||||
GtkDialog * dialog;
|
||||
GtkWidget * dialog;
|
||||
GtkLabel * label;
|
||||
char * label_text = NULL;
|
||||
char * temp = NULL;
|
||||
GtkButton * button;
|
||||
NMDriverSupportLevel support_level;
|
||||
guint32 timestamp;
|
||||
|
||||
g_return_val_if_fail (cb_data != NULL, FALSE);
|
||||
|
||||
@@ -559,7 +560,7 @@ gboolean nmwa_driver_notify (gpointer user_data)
|
||||
goto out;
|
||||
}
|
||||
|
||||
dialog = GTK_DIALOG (glade_xml_get_widget (cb_data->xml, "driver_sucks_dialog"));
|
||||
dialog = glade_xml_get_widget (cb_data->xml, "driver_sucks_dialog");
|
||||
g_signal_connect (G_OBJECT (dialog), "destroy-event", GTK_SIGNAL_FUNC (nmwa_driver_notify_dialog_destroy_cb), cb_data);
|
||||
g_signal_connect (G_OBJECT (dialog), "delete-event", GTK_SIGNAL_FUNC (nmwa_driver_notify_dialog_delete_cb), cb_data);
|
||||
|
||||
@@ -593,6 +594,10 @@ gboolean nmwa_driver_notify (gpointer user_data)
|
||||
|
||||
gtk_widget_show_all (GTK_WIDGET (dialog));
|
||||
|
||||
/* Bash focus-stealing prevention in the face */
|
||||
timestamp = gdk_x11_get_server_time (dialog->window);
|
||||
gdk_x11_window_set_user_time (dialog->window, timestamp);
|
||||
|
||||
out:
|
||||
network_device_unref (cb_data->dev);
|
||||
return (FALSE);
|
||||
@@ -703,7 +708,7 @@ static GdkPixbuf * nmwa_act_stage_to_pixbuf (NMWirelessApplet *applet, NetworkDe
|
||||
if (network_device_is_wired (dev))
|
||||
*tip = g_strdup_printf (_("Configuring device %s for the wired network..."), iface);
|
||||
else if (network_device_is_wireless (dev))
|
||||
*tip = g_strdup_printf (_("Configuring device %s for the wireless network '%s'..."), iface, essid);
|
||||
*tip = g_strdup_printf (_("Attempting to join the wireless network '%s'..."), essid);
|
||||
return applet->progress_icons[3];
|
||||
}
|
||||
|
||||
@@ -964,18 +969,18 @@ static void nmwa_update_network_timestamp (NMWirelessApplet *applet, WirelessNet
|
||||
* NetworkManager ID given.
|
||||
*
|
||||
*/
|
||||
NetworkDevice *nmwa_get_device_for_nm_device (GSList *dev_list, const char *nm_dev)
|
||||
NetworkDevice *nmwa_get_device_for_nm_path (GSList *dev_list, const char *nm_path)
|
||||
{
|
||||
NetworkDevice *found_dev = NULL;
|
||||
GSList *elt;
|
||||
|
||||
g_return_val_if_fail (nm_dev != NULL, NULL);
|
||||
g_return_val_if_fail (strlen (nm_dev), NULL);
|
||||
g_return_val_if_fail (nm_path != NULL, NULL);
|
||||
g_return_val_if_fail (strlen (nm_path), NULL);
|
||||
|
||||
for (elt = dev_list; elt; elt = g_slist_next (elt))
|
||||
{
|
||||
NetworkDevice *dev = (NetworkDevice *)(elt->data);
|
||||
if (dev && (strcmp (network_device_get_nm_path (dev), nm_dev) == 0))
|
||||
if (dev && (strcmp (network_device_get_nm_path (dev), nm_path) == 0))
|
||||
{
|
||||
found_dev = dev;
|
||||
break;
|
||||
@@ -1002,34 +1007,25 @@ static void nmwa_menu_item_activate (GtkMenuItem *item, gpointer user_data)
|
||||
g_return_if_fail (item != NULL);
|
||||
g_return_if_fail (applet != NULL);
|
||||
|
||||
if (!(tag = g_object_get_data (G_OBJECT (item), "device")))
|
||||
return;
|
||||
|
||||
g_mutex_lock (applet->data_mutex);
|
||||
if ((dev = nmwa_get_device_for_nm_path (applet->gui_device_list, tag)))
|
||||
network_device_ref (dev);
|
||||
g_mutex_unlock (applet->data_mutex);
|
||||
|
||||
if (!dev)
|
||||
return;
|
||||
|
||||
if ((tag = g_object_get_data (G_OBJECT (item), "network")))
|
||||
{
|
||||
char *item_dev = g_object_get_data (G_OBJECT (item), "nm_device");
|
||||
|
||||
g_mutex_lock (applet->data_mutex);
|
||||
if (item_dev && (dev = nmwa_get_device_for_nm_device (applet->gui_device_list, item_dev)))
|
||||
{
|
||||
network_device_ref (dev);
|
||||
g_mutex_unlock (applet->data_mutex);
|
||||
if ((net = network_device_get_wireless_network_by_essid (dev, tag)))
|
||||
nmwa_update_network_timestamp (applet, net);
|
||||
}
|
||||
else
|
||||
g_mutex_unlock (applet->data_mutex);
|
||||
}
|
||||
else if ((tag = g_object_get_data (G_OBJECT (item), "device")))
|
||||
{
|
||||
g_mutex_lock (applet->data_mutex);
|
||||
dev = nmwa_get_device_for_nm_device (applet->gui_device_list, tag);
|
||||
network_device_ref (dev);
|
||||
g_mutex_unlock (applet->data_mutex);
|
||||
if ((net = network_device_get_wireless_network_by_essid (dev, tag)))
|
||||
nmwa_update_network_timestamp (applet, net);
|
||||
}
|
||||
|
||||
if (dev)
|
||||
{
|
||||
nmwa_dbus_set_device (applet->connection, dev, wireless_network_get_essid (net), -1, NULL);
|
||||
network_device_unref (dev);
|
||||
}
|
||||
nmwa_dbus_set_device (applet->connection, dev, net ? wireless_network_get_essid (net) : NULL, -1, NULL);
|
||||
network_device_unref (dev);
|
||||
}
|
||||
|
||||
|
||||
@@ -1140,7 +1136,7 @@ static void nmwa_menu_add_device_item (GtkWidget *menu, NetworkDevice *device, g
|
||||
if (network_device_get_active (device))
|
||||
gtk_check_menu_item_set_active (gtk_item, TRUE);
|
||||
|
||||
g_object_set_data (G_OBJECT (gtk_item), "device", g_strdup (network_device_get_iface (device)));
|
||||
g_object_set_data (G_OBJECT (gtk_item), "device", g_strdup (network_device_get_nm_path (device)));
|
||||
g_object_set_data (G_OBJECT (gtk_item), "nm-item-data", item);
|
||||
g_signal_connect(G_OBJECT (gtk_item), "activate", G_CALLBACK (nmwa_menu_item_activate), applet);
|
||||
|
||||
@@ -1155,7 +1151,7 @@ static void nmwa_menu_add_device_item (GtkWidget *menu, NetworkDevice *device, g
|
||||
GtkMenuItem *gtk_item = wireless_menu_item_get_item (item);
|
||||
wireless_menu_item_update (item, device, n_devices);
|
||||
|
||||
g_object_set_data (G_OBJECT (gtk_item), "device", g_strdup (network_device_get_iface (device)));
|
||||
g_object_set_data (G_OBJECT (gtk_item), "device", g_strdup (network_device_get_nm_path (device)));
|
||||
g_object_set_data (G_OBJECT (gtk_item), "nm-item-data", item);
|
||||
g_signal_connect(G_OBJECT (gtk_item), "activate", G_CALLBACK (nmwa_menu_item_activate), applet);
|
||||
|
||||
@@ -1245,7 +1241,7 @@ void nmwa_add_networks_helper (NetworkDevice *dev, WirelessNetwork *net, gpointe
|
||||
network_menu_item_update (item, net, cb_data->has_encrypted);
|
||||
|
||||
g_object_set_data (G_OBJECT (gtk_item), "network", g_strdup (wireless_network_get_essid (net)));
|
||||
g_object_set_data (G_OBJECT (gtk_item), "nm_device", g_strdup (network_device_get_nm_path (dev)));
|
||||
g_object_set_data (G_OBJECT (gtk_item), "device", g_strdup (network_device_get_nm_path (dev)));
|
||||
g_object_set_data (G_OBJECT (gtk_item), "nm-item-data", item);
|
||||
g_signal_connect (G_OBJECT (gtk_item), "activate", G_CALLBACK (nmwa_menu_item_activate), cb_data->applet);
|
||||
|
||||
@@ -1472,12 +1468,6 @@ static void nmwa_menu_item_data_free (GtkWidget *menu_item, gpointer data)
|
||||
g_free (tag);
|
||||
}
|
||||
|
||||
if ((tag = g_object_get_data (G_OBJECT (menu_item), "nm_device")))
|
||||
{
|
||||
g_object_set_data (G_OBJECT (menu_item), "nm_device", NULL);
|
||||
g_free (tag);
|
||||
}
|
||||
|
||||
if ((tag = g_object_get_data (G_OBJECT (menu_item), "nm-item-data")))
|
||||
{
|
||||
g_object_set_data (G_OBJECT (menu_item), "nm-item-data", NULL);
|
||||
|
@@ -143,7 +143,7 @@ typedef struct
|
||||
GladeXML * xml;
|
||||
} DriverNotifyCBData;
|
||||
|
||||
NetworkDevice * nmwa_get_device_for_nm_device (GSList *dev_list, const char *nm_dev);
|
||||
NetworkDevice * nmwa_get_device_for_nm_path (GSList *dev_list, const char *nm_dev);
|
||||
NMWirelessApplet * nmwa_new (void);
|
||||
void nmwa_schedule_warning_dialog (NMWirelessApplet *applet, const char *msg);
|
||||
gboolean nmwa_driver_notify (gpointer user_data);
|
||||
|
@@ -136,7 +136,7 @@ NMDevice * nm_create_device_and_add_to_list (NMData *data, const char *udi, cons
|
||||
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
||||
|
||||
nm_policy_schedule_device_change_check (data);
|
||||
nm_dbus_signal_device_status_change (data->dbus_connection, dev, DEVICE_ADDED);
|
||||
nm_dbus_schedule_device_status_change_signal (data, dev, NULL, DEVICE_ADDED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -178,7 +178,7 @@ void nm_remove_device_from_list (NMData *data, const char *udi)
|
||||
nm_device_set_removed (dev, TRUE);
|
||||
nm_device_deactivate (dev, FALSE);
|
||||
nm_device_worker_thread_stop (dev);
|
||||
nm_dbus_signal_device_status_change (data->dbus_connection, dev, DEVICE_REMOVED);
|
||||
nm_dbus_schedule_device_status_change_signal (data, dev, NULL, DEVICE_REMOVED);
|
||||
|
||||
nm_device_unref (dev);
|
||||
|
||||
|
@@ -165,190 +165,121 @@ NMDevice *nm_dbus_get_device_from_object_path (NMData *data, const char *path)
|
||||
}
|
||||
|
||||
|
||||
typedef struct NMNetNotFoundData
|
||||
{
|
||||
NMData *app_data;
|
||||
char *net;
|
||||
} NMNetNotFoundData;
|
||||
|
||||
/*
|
||||
* nm_dbus_send_network_not_found
|
||||
*
|
||||
* Tell the info-daemon to alert the user that a requested network was
|
||||
* not found.
|
||||
*
|
||||
*/
|
||||
static gboolean nm_dbus_send_network_not_found (gpointer user_data)
|
||||
{
|
||||
NMNetNotFoundData *cb_data = (NMNetNotFoundData *)user_data;
|
||||
DBusMessage *message;
|
||||
|
||||
g_return_val_if_fail (cb_data != NULL, FALSE);
|
||||
|
||||
if (!cb_data->app_data || !cb_data->app_data->dbus_connection || !cb_data->net)
|
||||
goto out;
|
||||
|
||||
message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH,
|
||||
NMI_DBUS_INTERFACE, "networkNotFound");
|
||||
if (message == NULL)
|
||||
{
|
||||
nm_warning ("nm_dbus_send_network_not_found(): Couldn't allocate the dbus message");
|
||||
goto out;
|
||||
}
|
||||
|
||||
dbus_message_append_args (message, DBUS_TYPE_STRING, &cb_data->net, DBUS_TYPE_INVALID);
|
||||
if (!dbus_connection_send (cb_data->app_data->dbus_connection, message, NULL))
|
||||
nm_warning ("nm_dbus_send_network_not_found(): could not send dbus message");
|
||||
|
||||
dbus_message_unref (message);
|
||||
|
||||
out:
|
||||
g_free (cb_data);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
void nm_dbus_schedule_network_not_found_signal (NMData *data, const char *network)
|
||||
{
|
||||
NMNetNotFoundData *cb_data;
|
||||
GSource *source;
|
||||
|
||||
g_return_if_fail (data != NULL);
|
||||
g_return_if_fail (network != NULL);
|
||||
|
||||
cb_data = g_malloc0 (sizeof (NMNetNotFoundData));
|
||||
cb_data->app_data = data;
|
||||
cb_data->net = g_strdup (network);
|
||||
|
||||
source = g_idle_source_new ();
|
||||
g_source_set_callback (source, nm_dbus_send_network_not_found, cb_data, NULL);
|
||||
g_source_attach (source, data->main_context);
|
||||
g_source_unref (source);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* Handler code */
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
typedef struct NMStatusChangeData
|
||||
{
|
||||
NMDevice *dev;
|
||||
DeviceStatus status;
|
||||
NMData * data;
|
||||
NMDevice * dev;
|
||||
NMAccessPoint * ap;
|
||||
DeviceStatus status;
|
||||
} NMStatusChangeData;
|
||||
|
||||
|
||||
static gboolean nm_dbus_device_status_change_helper (gpointer user_data)
|
||||
typedef struct
|
||||
{
|
||||
NMStatusChangeData *data = (NMStatusChangeData *)user_data;
|
||||
NMData *app_data;
|
||||
DeviceStatus status;
|
||||
const char * signal;
|
||||
} DeviceStatusSignals;
|
||||
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
|
||||
if (!data->dev || !nm_device_get_app_data (data->dev))
|
||||
goto out;
|
||||
|
||||
app_data = nm_device_get_app_data (data->dev);
|
||||
nm_dbus_signal_device_status_change (app_data->dbus_connection, data->dev, data->status);
|
||||
|
||||
out:
|
||||
g_free (data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void nm_dbus_schedule_device_status_change (NMDevice *dev, DeviceStatus status)
|
||||
static DeviceStatusSignals dev_status_signals[] =
|
||||
{
|
||||
NMStatusChangeData *data = NULL;
|
||||
GSource *source;
|
||||
guint source_id = 0;
|
||||
NMData *app_data;
|
||||
|
||||
g_return_if_fail (dev != NULL);
|
||||
|
||||
app_data = nm_device_get_app_data (dev);
|
||||
g_return_if_fail (app_data != NULL);
|
||||
|
||||
data = g_malloc0 (sizeof (NMStatusChangeData));
|
||||
data->dev = dev;
|
||||
data->status = status;
|
||||
|
||||
source = g_idle_source_new ();
|
||||
g_source_set_callback (source, nm_dbus_device_status_change_helper, data, NULL);
|
||||
source_id = g_source_attach (source, app_data->main_context);
|
||||
g_source_unref (source);
|
||||
}
|
||||
|
||||
{ DEVICE_NO_LONGER_ACTIVE, "DeviceNoLongerActive" },
|
||||
{ DEVICE_NOW_ACTIVE, "DeviceNowActive" },
|
||||
{ DEVICE_ACTIVATING, "DeviceActivating" },
|
||||
{ DEVICE_ACTIVATION_FAILED, "DeviceActivationFailed" },
|
||||
{ DEVICE_ADDED, "DeviceAdded" },
|
||||
{ DEVICE_REMOVED, "DeviceRemoved" },
|
||||
{ DEVICE_CARRIER_ON, "DeviceCarrierOn" },
|
||||
{ DEVICE_CARRIER_OFF, "DeviceCarrierOff" },
|
||||
{ DEVICE_STATUS_INVALID, NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* nm_dbus_signal_device_status_change
|
||||
*
|
||||
* Notifies the bus that a particular device has had a status change, either
|
||||
* active or no longer active
|
||||
* Notifies the bus that a particular device has had a status change
|
||||
*
|
||||
*/
|
||||
void nm_dbus_signal_device_status_change (DBusConnection *connection, NMDevice *dev, DeviceStatus status)
|
||||
static gboolean nm_dbus_signal_device_status_change (gpointer user_data)
|
||||
{
|
||||
NMStatusChangeData *cb_data = (NMStatusChangeData *)user_data;
|
||||
DBusMessage * message;
|
||||
char * dev_path;
|
||||
const char * signal = NULL;
|
||||
NMAccessPoint * ap = NULL;
|
||||
int i = 0;
|
||||
|
||||
g_return_if_fail (connection != NULL);
|
||||
g_return_if_fail (dev != NULL);
|
||||
g_return_val_if_fail (cb_data->data, FALSE);
|
||||
g_return_val_if_fail (cb_data->data->dbus_connection, FALSE);
|
||||
g_return_val_if_fail (cb_data->dev, FALSE);
|
||||
|
||||
if (!(dev_path = nm_dbus_get_object_path_for_device (dev)))
|
||||
return;
|
||||
while ((dev_status_signals[i].status != DEVICE_STATUS_INVALID) && (dev_status_signals[i].status != cb_data->status))
|
||||
i++;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case DEVICE_NO_LONGER_ACTIVE:
|
||||
signal = "DeviceNoLongerActive";
|
||||
break;
|
||||
case DEVICE_NOW_ACTIVE:
|
||||
signal = "DeviceNowActive";
|
||||
break;
|
||||
case DEVICE_ACTIVATING:
|
||||
signal = "DeviceActivating";
|
||||
break;
|
||||
case DEVICE_ACTIVATION_FAILED:
|
||||
signal = "DeviceActivationFailed";
|
||||
break;
|
||||
case DEVICE_ADDED:
|
||||
signal = "DeviceAdded";
|
||||
break;
|
||||
case DEVICE_REMOVED:
|
||||
signal = "DeviceRemoved";
|
||||
break;
|
||||
default:
|
||||
nm_warning ("nm_dbus_signal_device_status_change(): got a bad signal name");
|
||||
return;
|
||||
}
|
||||
if (!(signal = dev_status_signals[i].signal))
|
||||
return FALSE;
|
||||
|
||||
if (!(dev_path = nm_dbus_get_object_path_for_device (cb_data->dev)))
|
||||
return FALSE;
|
||||
|
||||
if (!(message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, signal)))
|
||||
{
|
||||
nm_warning ("nm_dbus_signal_device_status_change(): Not enough memory for new dbus message!");
|
||||
g_free (dev_path);
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* If the device was wireless, attach the name of the wireless network that failed to activate */
|
||||
if (ap && nm_ap_get_essid (ap))
|
||||
if (cb_data->ap)
|
||||
{
|
||||
const char *essid = nm_ap_get_essid (ap);
|
||||
dbus_message_append_args (message, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_STRING, &essid, DBUS_TYPE_INVALID);
|
||||
const char *essid = nm_ap_get_essid (cb_data->ap);
|
||||
if (essid)
|
||||
dbus_message_append_args (message, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_STRING, &essid, DBUS_TYPE_INVALID);
|
||||
nm_ap_unref (cb_data->ap);
|
||||
}
|
||||
else
|
||||
dbus_message_append_args (message, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_INVALID);
|
||||
|
||||
if (ap)
|
||||
nm_ap_unref (ap);
|
||||
|
||||
g_free (dev_path);
|
||||
|
||||
if (!dbus_connection_send (connection, message, NULL))
|
||||
if (!dbus_connection_send (cb_data->data->dbus_connection, message, NULL))
|
||||
nm_warning ("nm_dbus_signal_device_status_change(): Could not raise the signal!");
|
||||
|
||||
dbus_message_unref (message);
|
||||
|
||||
nm_device_unref (cb_data->dev);
|
||||
g_free (cb_data);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void nm_dbus_schedule_device_status_change_signal (NMData *data, NMDevice *dev, NMAccessPoint *ap, DeviceStatus status)
|
||||
{
|
||||
NMStatusChangeData *cb_data = NULL;
|
||||
GSource *source;
|
||||
|
||||
g_return_if_fail (data != NULL);
|
||||
g_return_if_fail (dev != NULL);
|
||||
|
||||
cb_data = g_malloc0 (sizeof (NMStatusChangeData));
|
||||
nm_device_ref (dev);
|
||||
cb_data->data = data;
|
||||
cb_data->dev = dev;
|
||||
if (ap)
|
||||
{
|
||||
nm_ap_ref (ap);
|
||||
cb_data->ap = ap;
|
||||
}
|
||||
cb_data->status = status;
|
||||
|
||||
source = g_idle_source_new ();
|
||||
g_source_set_priority (source, G_PRIORITY_HIGH_IDLE);
|
||||
g_source_set_callback (source, nm_dbus_signal_device_status_change, cb_data, NULL);
|
||||
g_source_attach (source, data->main_context);
|
||||
g_source_unref (source);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -31,13 +31,16 @@
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DEVICE_STATUS_INVALID,
|
||||
DEVICE_NOW_ACTIVE,
|
||||
DEVICE_NO_LONGER_ACTIVE,
|
||||
DEVICE_ACTIVATING,
|
||||
DEVICE_ACTIVATION_FAILED,
|
||||
DEVICE_ACTIVATION_CANCELED,
|
||||
DEVICE_ADDED,
|
||||
DEVICE_REMOVED
|
||||
DEVICE_REMOVED,
|
||||
DEVICE_CARRIER_ON,
|
||||
DEVICE_CARRIER_OFF
|
||||
} DeviceStatus;
|
||||
|
||||
|
||||
@@ -57,10 +60,7 @@ char * get_name_owner (DBusConnection *con, const char *name);
|
||||
char * nm_dbus_get_object_path_for_device (NMDevice *dev);
|
||||
char * nm_dbus_get_object_path_for_network (NMDevice *dev, NMAccessPoint *ap);
|
||||
|
||||
void nm_dbus_schedule_device_status_change (NMDevice *dev, DeviceStatus status);
|
||||
void nm_dbus_signal_device_status_change (DBusConnection *connection, NMDevice *dev, DeviceStatus status);
|
||||
|
||||
void nm_dbus_schedule_network_not_found_signal (NMData *data, const char *network);
|
||||
void nm_dbus_schedule_device_status_change_signal (NMData *data, NMDevice *dev, NMAccessPoint *ap, DeviceStatus status);
|
||||
|
||||
void nm_dbus_signal_state_change (DBusConnection *connection, NMData *data);
|
||||
|
||||
|
@@ -525,8 +525,11 @@ void nm_device_worker_thread_stop (NMDevice *dev)
|
||||
|
||||
if (dev->loop)
|
||||
g_main_loop_quit (dev->loop);
|
||||
g_thread_join(dev->worker);
|
||||
dev->worker = NULL;
|
||||
if (dev->worker)
|
||||
{
|
||||
g_thread_join (dev->worker);
|
||||
dev->worker = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -678,24 +681,35 @@ void nm_device_set_link_active (NMDevice *dev, const gboolean link_active)
|
||||
}
|
||||
else if (link_active && !nm_device_get_act_request (dev))
|
||||
{
|
||||
NMDevice *act_dev = nm_get_active_device (dev->app_data);
|
||||
NMDevice * act_dev = nm_get_active_device (dev->app_data);
|
||||
NMActRequest * act_dev_req = act_dev ? nm_device_get_act_request (act_dev) : NULL;
|
||||
|
||||
/* If there is no currently active device, or the currently active device
|
||||
* is wireless, and the device that's had the link change->active is wired,
|
||||
* activate the wired device.
|
||||
/* Should we switch to this device now that it has a link?
|
||||
*
|
||||
* Only auto-switch for wired devices, AND...
|
||||
*
|
||||
* only switch to fully-supported devices, since ones that don't have carrier detection
|
||||
* capability usually report the carrier as "always on" even if its not really on. User
|
||||
* must manually choose semi-supported devices.
|
||||
*
|
||||
*/
|
||||
if ( nm_device_is_wired (dev)
|
||||
&& ((act_dev && nm_device_is_wireless (act_dev)) || !act_dev))
|
||||
if (nm_device_is_wired (dev) && (nm_device_get_driver_support_level (dev) == NM_DRIVER_FULLY_SUPPORTED))
|
||||
{
|
||||
NMActRequest *act_req = nm_act_request_new (dev->app_data, dev, NULL, TRUE); /* TRUE = user requested */
|
||||
gboolean do_switch = act_dev ? FALSE : TRUE; /* If no currently active device, switch to this one */
|
||||
NMActRequest * act_req;
|
||||
|
||||
if (act_req)
|
||||
/* If active device is wireless, switch to this one */
|
||||
if (act_dev && nm_device_is_wireless (act_dev) && act_dev_req && !nm_act_request_get_user_requested (act_dev_req))
|
||||
do_switch = TRUE;
|
||||
|
||||
if (do_switch && (act_req = nm_act_request_new (dev->app_data, dev, NULL, TRUE)))
|
||||
{
|
||||
nm_info ("Will activate wired connection '%s' because it now has a link.", nm_device_get_iface (dev));
|
||||
nm_policy_schedule_device_activation (act_req);
|
||||
}
|
||||
}
|
||||
}
|
||||
nm_dbus_schedule_device_status_change_signal (dev->app_data, dev, NULL, link_active ? DEVICE_CARRIER_ON : DEVICE_CARRIER_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -984,7 +998,10 @@ void nm_device_set_essid (NMDevice *dev, const char *essid)
|
||||
nm_info ("%s: About to SET IWESSID.", nm_device_get_iface (dev));
|
||||
#endif
|
||||
if ((err = iw_set_ext (nm_dev_sock_get_fd (sk), nm_device_get_iface (dev), SIOCSIWESSID, &wreq)) == -1)
|
||||
nm_warning ("nm_device_set_essid(): error setting ESSID '%s' for device %s. errno = %d", safe_essid, nm_device_get_iface (dev), errno);
|
||||
{
|
||||
if (errno != ENODEV)
|
||||
nm_warning ("nm_device_set_essid(): error setting ESSID '%s' for device %s. errno = %d", safe_essid, nm_device_get_iface (dev), errno);
|
||||
}
|
||||
|
||||
nm_dev_sock_close (sk);
|
||||
|
||||
@@ -1318,7 +1335,10 @@ void nm_device_set_enc_key (NMDevice *dev, const char *key, NMDeviceAuthMethod a
|
||||
nm_info ("%s: About to SET IWENCODE.", nm_device_get_iface (dev));
|
||||
#endif
|
||||
if (iw_set_ext (nm_dev_sock_get_fd (sk), nm_device_get_iface (dev), SIOCSIWENCODE, &wreq) == -1)
|
||||
nm_warning ("nm_device_set_enc_key(): error setting key for device %s. errno = %d", nm_device_get_iface (dev), errno);
|
||||
{
|
||||
if (errno != ENODEV)
|
||||
nm_warning ("nm_device_set_enc_key(): error setting key for device %s. errno = %d", nm_device_get_iface (dev), errno);
|
||||
}
|
||||
}
|
||||
|
||||
nm_dev_sock_close (sk);
|
||||
@@ -1569,7 +1589,7 @@ static void nm_device_set_up_down (NMDevice *dev, gboolean up)
|
||||
*/
|
||||
gboolean nm_device_is_up (NMDevice *dev)
|
||||
{
|
||||
NMSock *sk;
|
||||
NMSock * sk;
|
||||
struct ifreq ifr;
|
||||
int err;
|
||||
|
||||
@@ -1591,8 +1611,10 @@ gboolean nm_device_is_up (NMDevice *dev)
|
||||
if (!err)
|
||||
return (!((ifr.ifr_flags^IFF_UP) & IFF_UP));
|
||||
|
||||
nm_warning ("nm_device_is_up() could not get flags for device %s. errno = %d", nm_device_get_iface (dev), errno );
|
||||
return (FALSE);
|
||||
if (errno != ENODEV)
|
||||
nm_warning ("nm_device_is_up() could not get flags for device %s. errno = %d", nm_device_get_iface (dev), errno );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* I really wish nm_v_wait_for_completion_or_timeout could translate these
|
||||
@@ -1782,10 +1804,13 @@ gboolean nm_device_set_mode (NMDevice *dev, const NMNetworkMode mode)
|
||||
if (iw_set_ext (nm_dev_sock_get_fd (sk), nm_device_get_iface (dev), SIOCSIWMODE, &wreq) == 0)
|
||||
success = TRUE;
|
||||
else
|
||||
nm_warning ("nm_device_set_mode (%s): error setting card to %s mode. errno = %d",
|
||||
nm_device_get_iface (dev),
|
||||
mode == NETWORK_MODE_INFRA ? "Infrastructure" : (mode == NETWORK_MODE_ADHOC ? "adhoc" : "unknown"),
|
||||
errno);
|
||||
{
|
||||
if (errno != ENODEV)
|
||||
nm_warning ("nm_device_set_mode (%s): error setting card to %s mode. errno = %d",
|
||||
nm_device_get_iface (dev),
|
||||
mode == NETWORK_MODE_INFRA ? "Infrastructure" : (mode == NETWORK_MODE_ADHOC ? "adhoc" : "unknown"),
|
||||
errno);
|
||||
}
|
||||
}
|
||||
nm_dev_sock_close (sk);
|
||||
}
|
||||
@@ -1831,7 +1856,7 @@ gboolean nm_device_activation_start (NMActRequest *req)
|
||||
nm_device_activate_schedule_stage1_device_prepare (req);
|
||||
|
||||
nm_schedule_state_change_signal_broadcast (data);
|
||||
nm_dbus_signal_device_status_change (data->dbus_connection, dev, DEVICE_ACTIVATING);
|
||||
nm_dbus_schedule_device_status_change_signal (data, dev, NULL, DEVICE_ACTIVATING);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -3108,6 +3133,7 @@ gboolean nm_device_deactivate (NMDevice *dev, gboolean just_added)
|
||||
|
||||
if (dev->act_request)
|
||||
{
|
||||
nm_dhcp_manager_cancel_transaction (dev->app_data->dhcp_manager, dev->act_request);
|
||||
nm_act_request_unref (dev->act_request);
|
||||
dev->act_request = NULL;
|
||||
}
|
||||
@@ -3131,7 +3157,7 @@ gboolean nm_device_deactivate (NMDevice *dev, gboolean just_added)
|
||||
nm_device_update_ip4_address (dev);
|
||||
|
||||
if (!just_added)
|
||||
nm_dbus_signal_device_status_change (dev->app_data->dbus_connection, dev, DEVICE_NO_LONGER_ACTIVE);
|
||||
nm_dbus_schedule_device_status_change_signal (dev->app_data, dev, NULL, DEVICE_NO_LONGER_ACTIVE);
|
||||
|
||||
/* Clean up stuff, don't leave the card associated */
|
||||
if (nm_device_is_wireless (dev))
|
||||
|
@@ -138,7 +138,7 @@ static gboolean nm_policy_activation_failed (NMActRequest *req)
|
||||
* that failed, not one that we've automatically found and connected to.
|
||||
*/
|
||||
if (nm_act_request_get_user_requested (req))
|
||||
nm_dbus_schedule_network_not_found_signal (data, nm_ap_get_essid (ap));
|
||||
nm_dbus_schedule_device_status_change_signal (data, dev, ap, DEVICE_ACTIVATION_FAILED);
|
||||
|
||||
/* Add the AP to the invalid list and force a best ap update */
|
||||
nm_ap_set_invalid (ap, TRUE);
|
||||
@@ -149,7 +149,10 @@ static gboolean nm_policy_activation_failed (NMActRequest *req)
|
||||
ap ? nm_ap_get_essid (ap) : "(none)");
|
||||
}
|
||||
else
|
||||
{
|
||||
nm_info ("Activation (%s) failed.", nm_device_get_iface (dev));
|
||||
nm_dbus_schedule_device_status_change_signal (data, dev, NULL, DEVICE_ACTIVATION_FAILED);
|
||||
}
|
||||
|
||||
nm_device_deactivate (dev, FALSE);
|
||||
nm_schedule_state_change_signal_broadcast (data);
|
||||
@@ -218,8 +221,8 @@ static NMDevice * nm_policy_auto_get_best_device (NMData *data, NMAccessPoint **
|
||||
guint prio = 0;
|
||||
NMDevice *dev = (NMDevice *)(elt->data);
|
||||
|
||||
/* Skip unsupported devices */
|
||||
if (nm_device_get_driver_support_level (dev) == NM_DRIVER_UNSUPPORTED)
|
||||
/* Skip devices that can't do carrier detect or can't do wireless scanning */
|
||||
if (nm_device_get_driver_support_level (dev) != NM_DRIVER_FULLY_SUPPORTED)
|
||||
continue;
|
||||
|
||||
dev_type = nm_device_get_type (dev);
|
||||
@@ -315,11 +318,24 @@ static gboolean nm_policy_device_change_check (NMData *data)
|
||||
if (!nm_try_acquire_mutex (data->dev_list_mutex, __FUNCTION__))
|
||||
return FALSE;
|
||||
|
||||
/* Don't interrupt a currently activating device. */
|
||||
if (old_dev && nm_device_is_activating (old_dev))
|
||||
if (old_dev)
|
||||
{
|
||||
nm_info ("Old device '%s' activating, won't change.", nm_device_get_iface (old_dev));
|
||||
goto out;
|
||||
/* Don't interrupt a currently activating device. */
|
||||
if (nm_device_is_activating (old_dev))
|
||||
{
|
||||
nm_info ("Old device '%s' activating, won't change.", nm_device_get_iface (old_dev));
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Don't interrupt semi-supported devices either. If the user chose one, they must
|
||||
* explicitly choose to move to another device, we're not going to move for them.
|
||||
*/
|
||||
if (nm_device_get_driver_support_level (old_dev) != NM_DRIVER_FULLY_SUPPORTED)
|
||||
{
|
||||
nm_info ("Old device '%s' was semi-supported and user chosen, won't change unless told to.",
|
||||
nm_device_get_iface (old_dev));
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
new_dev = nm_policy_auto_get_best_device (data, &ap);
|
||||
|
@@ -282,7 +282,10 @@ gboolean nm_system_device_set_up_down_with_iface (NMDevice *dev, const char *ifa
|
||||
memset (&ifr, 0, sizeof (struct ifreq));
|
||||
memcpy (ifr.ifr_name, iface, strlen (iface));
|
||||
if (ioctl (nm_dev_sock_get_fd (sk), SIOCGIFFLAGS, &ifr) == -1)
|
||||
nm_warning ("nm_system_device_set_up_down_with_iface() could not get flags for device %s. errno = %d", iface, errno );
|
||||
{
|
||||
if (errno != ENODEV)
|
||||
nm_warning ("nm_system_device_set_up_down_with_iface() could not get flags for device %s. errno = %d", iface, errno );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the interface doesn't have those flags already, set them on it. */
|
||||
|
@@ -432,9 +432,10 @@ static driver_support wired_driver_blacklist[] =
|
||||
/*
|
||||
* nm_get_device_driver_name
|
||||
*
|
||||
* Get the device's driver name from HAL.
|
||||
*
|
||||
*/
|
||||
char *nm_get_device_driver_name (LibHalContext *ctx, NMDevice *dev)
|
||||
static char *nm_get_device_driver_name (LibHalContext *ctx, NMDevice *dev)
|
||||
{
|
||||
char *udi = NULL;
|
||||
char *driver_name = NULL;
|
||||
|
@@ -360,7 +360,7 @@ void *nm_system_device_get_system_config (NMDevice *dev)
|
||||
sys_data = g_malloc0 (sizeof (RHSystemConfigData));
|
||||
sys_data->use_dhcp = TRUE;
|
||||
|
||||
cfg_file_path = g_strdup_printf ("/etc/sysconfig/network-scripts/ifcfg-%s", nm_device_get_iface (dev));
|
||||
cfg_file_path = g_strdup_printf (SYSCONFDIR"/sysconfig/network-scripts/ifcfg-%s", nm_device_get_iface (dev));
|
||||
if (!cfg_file_path)
|
||||
return sys_data;
|
||||
|
||||
|
@@ -49,12 +49,17 @@ svOpenFile(const char *name, gboolean create)
|
||||
|
||||
s = g_malloc0(sizeof(shvarFile));
|
||||
|
||||
#if 1 /* NetworkManager local change */
|
||||
s->fd = open(name, O_RDONLY); /* NOT O_CREAT */
|
||||
if (s->fd != -1) closefd = 1;
|
||||
#else
|
||||
s->fd = open(name, O_RDWR); /* NOT O_CREAT */
|
||||
if (s->fd == -1) {
|
||||
/* try read-only */
|
||||
s->fd = open(name, O_RDONLY); /* NOT O_CREAT */
|
||||
if (s->fd != -1) closefd = 1;
|
||||
}
|
||||
#endif
|
||||
s->fileName = g_strdup(name);
|
||||
|
||||
if (s->fd != -1) {
|
||||
|
Reference in New Issue
Block a user