2004-06-24 14:18:37 +00:00
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* Dan Williams <dcbw@redhat.com>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*
|
|
|
|
|
* (C) Copyright 2004 Red Hat, Inc.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <glib.h>
|
2004-08-02 21:12:40 +00:00
|
|
|
#include <dbus/dbus.h>
|
|
|
|
|
#include <dbus/dbus-glib-lowlevel.h>
|
2004-06-24 14:18:37 +00:00
|
|
|
#include <dbus/dbus-glib.h>
|
|
|
|
|
#include <stdarg.h>
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
#include <iwlib.h>
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
#include <netinet/ether.h>
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
#include "NetworkManager.h"
|
|
|
|
|
#include "NetworkManagerUtils.h"
|
|
|
|
|
#include "NetworkManagerDevice.h"
|
|
|
|
|
#include "NetworkManagerDbus.h"
|
|
|
|
|
#include "NetworkManagerAP.h"
|
2004-07-27 16:15:36 +00:00
|
|
|
#include "NetworkManagerAPList.h"
|
2005-01-21 19:32:08 +00:00
|
|
|
#include "NetworkManagerPolicy.h"
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
|
2004-08-31 Dan Williams <dcbw@redhat.com>
* Remove 'debug' extern global from all files since we now
use syslog()
* src/NetworkManager.[ch]
- Break out routine that get the net.interface property from HAL,
removing that logic from nm_create_device_and_add_to_list()
- (nm_create_device_and_add_to_list): make this a bit more general so
it doesn't do the talking to HAL. Also add arguments to facilitate
the create of test devices.
- (nm_data_mark_state_changed): rename from nm_data_set_state_modified()
- (nm_data_new, main, nm_print_usage): add new argument "--enable-test-devices"
which makes NetworkManager listen for dbus commands to create test
devices, which have no backing hardware. Use when you're on a plane
for example, and/or forgot your wireless card at home. Test devices
_cannot_ be created unless NM is started with --enable-test-devices.
* src/NetworkManagerDbus.[ch]
- New "getLinkActive" method for devices
- New "setLinkActive" method for devices (only works on test devices)
- New "createTestDevice" method on NetworkManager object to create a test
device of a specified type (ie wired, wireless). UDI is created from
scratch, as is the interface name. Only works when NM is started with
--enable-test-devices switch.
- New "removeTestDevice" method on NetworkManager object which removes a
test device. Only works when NM is started with --enable-test-devices
* src/NetworkManagerDevice.[ch]
- Logic to facilitate test devices. Add variables to NMDevice struct to indicate
whether a device is a test device or not, and what its link status is.
- Deal with test devices in most functions. For those that work directly on hardware
special-case test devices.
- (nm_device_new): don't create a test device if test devices weren't enabled on the
command-line.
- (nm_device_update_link_active): split out logic for wired and wireless device link
checking to separate functions to facilitate test device link checking.
- (nm_device_set_enc_key): Since some drivers for wireless cards are daft and
don't make a distinction between System Authentication and Encryption
(namely Cisco aironet), we use Open System auth when setting a WEP key
on the card. We don't deal with Shared Key auth yet.
- (nm_device_activation_worker): split the activation cancel check logic out into
a separate routine nm_device_activation_cancel_if_needed()
- (nm_device_activation_signal_cancel): rename from nm_device_activation_cancel()
- (nm_device_fake_ap_list): Test wireless devices obviously cannot scan, so create
a list of fake access points that they can "see"
- (nm_device_is_test_device): return whether or not a device is a test device
* src/NetworkManagerPolicy.c
- (nm_policy_get_best_device): attempt to deal with wireless network selection,
previously if you "locked"/forced NM to use a wireless device but then
selected a wireless network for NM to use, it would switch to a wired device.
So, if the active device is wireless and it has a "forced" best AP, use it
if the "forced" best AP is still valid
- (nm_state_modification_monitor): deal with NULL best devices, for example
there were no usable network devices, or the last one was removed
* src/backends/NetworkManager*.c
- Deal with test devices, mostly just return success for operations like getting
a DHCP address
* test/nmtestdevices.c
- Test tool to create/remove/link-switch test devices
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@112 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-31 16:09:15 +00:00
|
|
|
static int test_dev_num = 0;
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_create_error_message
|
|
|
|
|
*
|
|
|
|
|
* Make a DBus error message
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static DBusMessage *nm_dbus_create_error_message (DBusMessage *message, const char *exception_namespace,
|
|
|
|
|
const char *exception, const char *format, ...)
|
|
|
|
|
{
|
2004-12-01 22:45:10 +00:00
|
|
|
char *exception_text;
|
2004-06-24 14:18:37 +00:00
|
|
|
DBusMessage *reply_message;
|
|
|
|
|
va_list args;
|
|
|
|
|
char error_text[512];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
va_start (args, format);
|
|
|
|
|
vsnprintf (error_text, 512, format, args);
|
|
|
|
|
va_end (args);
|
|
|
|
|
|
2004-12-01 22:45:10 +00:00
|
|
|
exception_text = g_strdup_printf ("%s.%s", exception_namespace, exception);
|
2004-06-24 14:18:37 +00:00
|
|
|
reply_message = dbus_message_new_error (message, exception_text, error_text);
|
|
|
|
|
g_free (exception_text);
|
|
|
|
|
|
|
|
|
|
return (reply_message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dbus_get_object_path_from_device
|
|
|
|
|
*
|
2004-08-05 18:54:29 +00:00
|
|
|
* Copies the object path for a device object. Caller must free returned string.
|
2004-06-24 14:18:37 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2004-08-05 18:54:29 +00:00
|
|
|
static unsigned char * nm_dbus_get_object_path_from_device (NMDevice *dev)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-05 18:54:29 +00:00
|
|
|
g_return_val_if_fail (dev != NULL, NULL);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-08-06 18:19:06 +00:00
|
|
|
return (g_strdup_printf ("%s/%s", NM_DBUS_PATH_DEVICES, nm_device_get_iface (dev)));
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dbus_get_device_from_object_path
|
|
|
|
|
*
|
|
|
|
|
* Returns the device associated with a dbus object path
|
|
|
|
|
*
|
|
|
|
|
*/
|
2004-08-02 21:12:40 +00:00
|
|
|
static NMDevice *nm_dbus_get_device_from_object_path (NMData *data, const char *path)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
|
|
|
|
NMDevice *dev = NULL;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (data != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
/* FIXME
|
|
|
|
|
* This function could be much more efficient, for example we could
|
|
|
|
|
* actually _parse_ the object path, but that's a lot more code and
|
|
|
|
|
* stupid stuff. The approach below is slower, less efficient, but
|
|
|
|
|
* less code and less error-prone.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* Iterate over device list */
|
|
|
|
|
if (nm_try_acquire_mutex (data->dev_list_mutex, __FUNCTION__))
|
|
|
|
|
{
|
|
|
|
|
GSList *element = data->dev_list;
|
|
|
|
|
char compare_path[100];
|
|
|
|
|
|
|
|
|
|
while (element)
|
|
|
|
|
{
|
2004-07-19 06:52:25 +00:00
|
|
|
if ((dev = (NMDevice *)(element->data)))
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-06 18:19:06 +00:00
|
|
|
snprintf (compare_path, 100, "%s/%s", NM_DBUS_PATH_DEVICES, nm_device_get_iface (dev));
|
2004-07-19 06:52:25 +00:00
|
|
|
/* Compare against our constructed path, but ignore any trailing elements */
|
|
|
|
|
if (strncmp (path, compare_path, strlen (compare_path)) == 0)
|
|
|
|
|
break;
|
2004-06-24 14:18:37 +00:00
|
|
|
dev = NULL;
|
2004-07-19 06:52:25 +00:00
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
element = g_slist_next (element);
|
|
|
|
|
}
|
|
|
|
|
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (dev);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-08-02 21:12:40 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_get_ap_from_object_path
|
2004-06-24 14:18:37 +00:00
|
|
|
*
|
|
|
|
|
* Returns the network (ap) associated with a dbus object path
|
|
|
|
|
*
|
|
|
|
|
*/
|
2004-08-02 21:12:40 +00:00
|
|
|
static NMAccessPoint *nm_dbus_get_ap_from_object_path (const char *path, NMDevice *dev)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-05 18:54:29 +00:00
|
|
|
NMAccessPoint *ap = NULL;
|
|
|
|
|
NMAccessPointList *ap_list;
|
|
|
|
|
NMAPListIter *iter;
|
|
|
|
|
char compare_path[100];
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
2004-07-25 02:40:19 +00:00
|
|
|
g_return_val_if_fail (dev != NULL, NULL);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
ap_list = nm_device_ap_list_get (dev);
|
|
|
|
|
if (!ap_list)
|
|
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
|
|
if (!(iter = nm_ap_list_iter_new (ap_list)))
|
|
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
|
|
while ((ap = nm_ap_list_iter_next (iter)))
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-06 18:19:06 +00:00
|
|
|
snprintf (compare_path, 100, "%s/%s/Networks/%s", NM_DBUS_PATH_DEVICES,
|
2004-07-22 05:17:36 +00:00
|
|
|
nm_device_get_iface (dev), nm_ap_get_essid (ap));
|
2004-06-24 14:18:37 +00:00
|
|
|
if (strncmp (path, compare_path, strlen (compare_path)) == 0)
|
|
|
|
|
break;
|
|
|
|
|
}
|
2004-08-05 18:54:29 +00:00
|
|
|
|
|
|
|
|
nm_ap_list_iter_free (iter);
|
2004-06-24 14:18:37 +00:00
|
|
|
return (ap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dbus_nm_get_active_device
|
|
|
|
|
*
|
|
|
|
|
* Returns the object path of the currently active device
|
|
|
|
|
*
|
|
|
|
|
*/
|
2004-07-25 02:40:19 +00:00
|
|
|
static DBusMessage *nm_dbus_nm_get_active_device (DBusConnection *connection, DBusMessage *message, NMData *data)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-06 18:19:06 +00:00
|
|
|
DBusMessage *reply_message = NULL;
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
g_return_val_if_fail (data != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (connection != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (message != NULL, NULL);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-07-19 06:52:25 +00:00
|
|
|
/* Construct object path of "active" device and return it */
|
2004-08-11 Dan Williams <dcbw@redhat.com>
* info-daemon/NetworkManagerInfo.c:
- (main): clean up Seth's code style
* info-daemon/NetworkManagerInfoDbus.c:
- Use the more aptly-named path/service/interface constants from NetworkManager
- Don't return empty strings ("") as object paths ever, instead return errors
* panel-applet/NMWirelessApplet.c:
- Clean up Seth's code style
* src/NetworkManager.[ch]
- (nm_remove_device_from_list): remove anything having to do with pending_device
- (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon
* src/NetworkManagerAPList.[ch]
- Move Iter struct right above the iter functions to preserve opacity
- (nm_ap_list_remove_ap): implement
- (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(),
remove AP if NetworkManagerInfo doesn't know anything about it
- (nm_ap_list_diff): user NMAPList iterators
- (nm_ap_list_print_members): implement debugging function
* src/NetworkManagerDbus.[ch]
- (nm_dbus_nm_get_active_device): remove anything to do with pending_device
- (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused),
and move the actual key setting stuff into NetworkManagerDevice.c
- (nm_dbus_get_network_priority): return -1 now on errors
- (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to
get lost, and force the active device to update its "best" ap when AP lists change
- (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status"
method call due to pending_device member removal
* src/NetworkManagerDevice.[ch]
- Move NMDevice structure to the top
- Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure
- Remove Pending Action stuff from everywhere
- (nm_device_activation_*): We now "begin" activation and start a thread to do the
activation for us. This thread blocks until all conditions for activation have
been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and
then setup up the interface and runs dhclient. We have to do this because there
is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot
run our main loop and respond to dbus method calls or HAL device removals/inserts
- (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we
can tell nm_device_activation_worker() that we've got a key
- (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure
- (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when
diffing (AP appear/disappear signal functions make sure the AP is actually in the device's
list)
- (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here
* src/NetworkManagerPolicy.c
- Remove anything to do with pending_device
- Adjust device activation to deal with activation-in-worker-thread
* src/NetworkManagerUtils.c
- Clean up locking debugging a bit
* src/NetworkManagerWireless.[ch]
- (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function
was badly named and is better as a device function
* panel-applet/.cvsignore: add
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
|
|
|
if (data->active_device)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-09 15:10:46 +00:00
|
|
|
char *object_path;
|
|
|
|
|
|
|
|
|
|
reply_message = dbus_message_new_method_return (message);
|
|
|
|
|
if (!reply_message)
|
|
|
|
|
return (NULL);
|
|
|
|
|
|
2004-08-11 Dan Williams <dcbw@redhat.com>
* info-daemon/NetworkManagerInfo.c:
- (main): clean up Seth's code style
* info-daemon/NetworkManagerInfoDbus.c:
- Use the more aptly-named path/service/interface constants from NetworkManager
- Don't return empty strings ("") as object paths ever, instead return errors
* panel-applet/NMWirelessApplet.c:
- Clean up Seth's code style
* src/NetworkManager.[ch]
- (nm_remove_device_from_list): remove anything having to do with pending_device
- (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon
* src/NetworkManagerAPList.[ch]
- Move Iter struct right above the iter functions to preserve opacity
- (nm_ap_list_remove_ap): implement
- (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(),
remove AP if NetworkManagerInfo doesn't know anything about it
- (nm_ap_list_diff): user NMAPList iterators
- (nm_ap_list_print_members): implement debugging function
* src/NetworkManagerDbus.[ch]
- (nm_dbus_nm_get_active_device): remove anything to do with pending_device
- (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused),
and move the actual key setting stuff into NetworkManagerDevice.c
- (nm_dbus_get_network_priority): return -1 now on errors
- (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to
get lost, and force the active device to update its "best" ap when AP lists change
- (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status"
method call due to pending_device member removal
* src/NetworkManagerDevice.[ch]
- Move NMDevice structure to the top
- Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure
- Remove Pending Action stuff from everywhere
- (nm_device_activation_*): We now "begin" activation and start a thread to do the
activation for us. This thread blocks until all conditions for activation have
been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and
then setup up the interface and runs dhclient. We have to do this because there
is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot
run our main loop and respond to dbus method calls or HAL device removals/inserts
- (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we
can tell nm_device_activation_worker() that we've got a key
- (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure
- (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when
diffing (AP appear/disappear signal functions make sure the AP is actually in the device's
list)
- (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here
* src/NetworkManagerPolicy.c
- Remove anything to do with pending_device
- Adjust device activation to deal with activation-in-worker-thread
* src/NetworkManagerUtils.c
- Clean up locking debugging a bit
* src/NetworkManagerWireless.[ch]
- (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function
was badly named and is better as a device function
* panel-applet/.cvsignore: add
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
|
|
|
object_path = g_strdup_printf ("%s/%s", NM_DBUS_PATH_DEVICES, nm_device_get_iface (data->active_device));
|
2004-07-27 16:15:36 +00:00
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, object_path, DBUS_TYPE_INVALID);
|
2004-07-19 06:52:25 +00:00
|
|
|
g_free (object_path);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
else
|
2004-08-06 18:19:06 +00:00
|
|
|
{
|
2004-08-09 15:10:46 +00:00
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "NoActiveDevice",
|
|
|
|
|
"There is no currently active device.");
|
2004-08-06 18:19:06 +00:00
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-07-19 06:52:25 +00:00
|
|
|
return (reply_message);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-21 19:32:08 +00:00
|
|
|
typedef struct NMNetNotFoundData
|
|
|
|
|
{
|
|
|
|
|
NMData *app_data;
|
|
|
|
|
char *net;
|
|
|
|
|
} NMNetNotFoundData;
|
|
|
|
|
|
2004-10-16 02:25:02 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_send_network_not_found
|
|
|
|
|
*
|
|
|
|
|
* Tell the info-daemon to alert the user that a requested network was
|
|
|
|
|
* not found.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2005-01-21 19:32:08 +00:00
|
|
|
static gboolean nm_dbus_send_network_not_found (gpointer user_data)
|
2004-10-16 02:25:02 +00:00
|
|
|
{
|
2005-01-21 19:32:08 +00:00
|
|
|
NMNetNotFoundData *cb_data = (NMNetNotFoundData *)user_data;
|
2004-10-16 02:25:02 +00:00
|
|
|
DBusMessage *message;
|
|
|
|
|
|
2005-01-21 19:32:08 +00:00
|
|
|
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;
|
2004-10-16 02:25:02 +00:00
|
|
|
|
|
|
|
|
message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH,
|
|
|
|
|
NMI_DBUS_INTERFACE, "networkNotFound");
|
|
|
|
|
if (message == NULL)
|
|
|
|
|
{
|
|
|
|
|
syslog (LOG_ERR, "nm_dbus_send_network_not_found(): Couldn't allocate the dbus message");
|
2005-01-21 19:32:08 +00:00
|
|
|
goto out;
|
2004-10-16 02:25:02 +00:00
|
|
|
}
|
|
|
|
|
|
2005-01-21 19:32:08 +00:00
|
|
|
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))
|
2004-10-16 02:25:02 +00:00
|
|
|
syslog (LOG_WARNING, "nm_dbus_send_network_not_found(): could not send dbus message");
|
|
|
|
|
|
|
|
|
|
dbus_message_unref (message);
|
2005-01-21 19:32:08 +00:00
|
|
|
|
|
|
|
|
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);
|
2004-10-16 02:25:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-08-26 20:05:24 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_nm_set_active_device
|
|
|
|
|
*
|
|
|
|
|
* Notify the state modification handler that we want to lock to a specific
|
|
|
|
|
* device.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static DBusMessage *nm_dbus_nm_set_active_device (DBusConnection *connection, DBusMessage *message, NMData *data)
|
|
|
|
|
{
|
2004-09-12 03:06:44 +00:00
|
|
|
NMDevice *dev = NULL;
|
|
|
|
|
DBusMessage *reply_message = NULL;
|
|
|
|
|
char *dev_path = NULL;
|
|
|
|
|
char *network = NULL;
|
2004-10-29 16:37:43 +00:00
|
|
|
char *key = NULL;
|
|
|
|
|
int key_type = -1;
|
2004-09-12 03:06:44 +00:00
|
|
|
DBusError error;
|
2004-08-26 20:05:24 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (connection != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (message != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (data != NULL, NULL);
|
|
|
|
|
|
2004-09-12 03:06:44 +00:00
|
|
|
/* Try to grab both device _and_ network first, and if that fails then just the device. */
|
2004-08-26 20:05:24 +00:00
|
|
|
dbus_error_init (&error);
|
2004-09-12 03:06:44 +00:00
|
|
|
if (!dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &dev_path,
|
2004-10-29 16:37:43 +00:00
|
|
|
DBUS_TYPE_STRING, &network, DBUS_TYPE_STRING, &key,
|
|
|
|
|
DBUS_TYPE_INT32, &key_type, DBUS_TYPE_INVALID))
|
2004-08-26 20:05:24 +00:00
|
|
|
{
|
2004-09-12 03:06:44 +00:00
|
|
|
network = NULL;
|
2004-10-29 16:37:43 +00:00
|
|
|
key = NULL;
|
|
|
|
|
key_type = -1;
|
2004-09-12 03:06:44 +00:00
|
|
|
|
|
|
|
|
if (dbus_error_is_set (&error))
|
|
|
|
|
dbus_error_free (&error);
|
|
|
|
|
|
|
|
|
|
/* So if that failed, try getting just the device */
|
|
|
|
|
dbus_error_init (&error);
|
|
|
|
|
if (!dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &dev_path, DBUS_TYPE_INVALID))
|
|
|
|
|
{
|
|
|
|
|
if (dbus_error_is_set (&error))
|
|
|
|
|
dbus_error_free (&error);
|
|
|
|
|
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "InvalidArguments",
|
2004-08-26 20:05:24 +00:00
|
|
|
"NetworkManager::setActiveDevice called with invalid arguments.");
|
2005-01-21 19:32:08 +00:00
|
|
|
goto out;
|
2004-10-14 20:31:35 +00:00
|
|
|
} else syslog (LOG_INFO, "FORCE: device '%s'", dev_path);
|
|
|
|
|
} else syslog (LOG_INFO, "FORCE: device '%s', network '%s'", dev_path, network);
|
2004-08-26 20:05:24 +00:00
|
|
|
|
2004-09-12 03:06:44 +00:00
|
|
|
/* So by now we have a valid device and possibly a network as well */
|
|
|
|
|
|
2004-08-26 20:05:24 +00:00
|
|
|
dev = nm_dbus_get_device_from_object_path (data, dev_path);
|
2004-10-21 17:42:14 +00:00
|
|
|
if (!dev || (nm_device_get_driver_support_level (dev) == NM_DRIVER_UNSUPPORTED))
|
2004-08-26 20:05:24 +00:00
|
|
|
{
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "DeviceNotFound",
|
|
|
|
|
"The requested network device does not exist.");
|
2005-01-21 19:32:08 +00:00
|
|
|
goto out;
|
2004-08-26 20:05:24 +00:00
|
|
|
}
|
2004-10-14 20:31:35 +00:00
|
|
|
nm_device_ref (dev);
|
|
|
|
|
|
|
|
|
|
/* Make sure network is valid and device is wireless */
|
|
|
|
|
if (nm_device_is_wireless (dev) && !network)
|
|
|
|
|
{
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "InvalidArguments",
|
|
|
|
|
"NetworkManager::setActiveDevice called with invalid arguments.");
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
2004-08-26 20:05:24 +00:00
|
|
|
|
2005-01-21 19:32:08 +00:00
|
|
|
data->forcing_device = TRUE;
|
|
|
|
|
nm_device_deactivate (dev, FALSE);
|
|
|
|
|
nm_device_schedule_force_use (dev, network, key, key_type);
|
2004-10-15 20:05:56 +00:00
|
|
|
|
2004-10-14 20:31:35 +00:00
|
|
|
out:
|
2005-01-21 19:32:08 +00:00
|
|
|
dbus_free (dev_path);
|
2004-10-14 20:31:35 +00:00
|
|
|
dbus_free (network);
|
2004-10-29 19:52:35 +00:00
|
|
|
dbus_free (key);
|
2004-08-26 20:05:24 +00:00
|
|
|
return (reply_message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-12-17 17:16:22 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_nm_create_wireless_network
|
|
|
|
|
*
|
|
|
|
|
* Create a new wireless network and
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static DBusMessage *nm_dbus_nm_create_wireless_network (DBusConnection *connection, DBusMessage *message, NMData *data)
|
|
|
|
|
{
|
|
|
|
|
NMDevice *dev = NULL;
|
|
|
|
|
DBusMessage *reply_message = NULL;
|
|
|
|
|
char *dev_path = NULL;
|
2005-01-21 19:32:08 +00:00
|
|
|
NMAccessPoint *new_ap = NULL;
|
2004-12-17 17:16:22 +00:00
|
|
|
char *network = NULL;
|
|
|
|
|
char *key = NULL;
|
|
|
|
|
int key_type = -1;
|
|
|
|
|
DBusError error;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (connection != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (message != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (data != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
/* Try to grab both device _and_ network first, and if that fails then just the device. */
|
|
|
|
|
dbus_error_init (&error);
|
|
|
|
|
if (!dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &dev_path,
|
|
|
|
|
DBUS_TYPE_STRING, &network, DBUS_TYPE_STRING, &key,
|
|
|
|
|
DBUS_TYPE_INT32, &key_type, DBUS_TYPE_INVALID))
|
|
|
|
|
{
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "InvalidArguments",
|
|
|
|
|
"NetworkManager::createWirelessNetwork called with invalid arguments.");
|
|
|
|
|
return (reply_message);
|
|
|
|
|
} else syslog (LOG_INFO, "Creating network '%s' on device '%s'.", network, dev_path);
|
|
|
|
|
|
|
|
|
|
dev = nm_dbus_get_device_from_object_path (data, dev_path);
|
|
|
|
|
dbus_free (dev_path);
|
|
|
|
|
if (!dev || (nm_device_get_driver_support_level (dev) == NM_DRIVER_UNSUPPORTED))
|
|
|
|
|
{
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "DeviceNotFound",
|
|
|
|
|
"The requested network device does not exist.");
|
|
|
|
|
return (reply_message);
|
|
|
|
|
}
|
|
|
|
|
nm_device_ref (dev);
|
|
|
|
|
|
|
|
|
|
/* Make sure network is valid and device is wireless */
|
|
|
|
|
if (!nm_device_is_wireless (dev) || !network)
|
|
|
|
|
{
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "InvalidArguments",
|
|
|
|
|
"NetworkManager::createWirelessNetwork called with invalid arguments.");
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(reply_message = dbus_message_new_method_return (message)))
|
|
|
|
|
goto out;
|
|
|
|
|
|
2005-01-21 19:32:08 +00:00
|
|
|
data->forcing_device = TRUE;
|
2004-12-17 17:16:22 +00:00
|
|
|
|
2005-01-21 19:32:08 +00:00
|
|
|
new_ap = nm_ap_new ();
|
2004-12-17 17:16:22 +00:00
|
|
|
|
2005-01-21 19:32:08 +00:00
|
|
|
/* Fill in the description of the network to create */
|
|
|
|
|
nm_ap_set_essid (new_ap, network);
|
|
|
|
|
if (nm_is_enc_key_valid (key, key_type))
|
|
|
|
|
{
|
|
|
|
|
nm_ap_set_encrypted (new_ap, TRUE);
|
|
|
|
|
nm_ap_set_enc_key_source (new_ap, key, key_type);
|
|
|
|
|
nm_ap_set_auth_method (new_ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
2004-12-17 17:16:22 +00:00
|
|
|
}
|
2005-01-21 19:32:08 +00:00
|
|
|
nm_ap_set_mode (new_ap, NETWORK_MODE_ADHOC);
|
|
|
|
|
nm_ap_set_user_created (new_ap, TRUE);
|
2004-12-17 17:16:22 +00:00
|
|
|
|
2005-01-21 19:32:08 +00:00
|
|
|
nm_device_set_best_ap (dev, new_ap);
|
|
|
|
|
nm_device_freeze_best_ap (dev);
|
|
|
|
|
nm_device_activation_cancel (dev);
|
|
|
|
|
|
|
|
|
|
/* Schedule this device to be used next. */
|
|
|
|
|
nm_policy_schedule_device_switch (dev, data);
|
2004-12-17 17:16:22 +00:00
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
dbus_free (network);
|
|
|
|
|
dbus_free (key);
|
|
|
|
|
nm_device_unref (dev);
|
|
|
|
|
return (reply_message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_nm_get_devices
|
|
|
|
|
*
|
|
|
|
|
* Returns a string array of object paths corresponding to the
|
|
|
|
|
* devices in the device list.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2004-07-25 02:40:19 +00:00
|
|
|
static DBusMessage *nm_dbus_nm_get_devices (DBusConnection *connection, DBusMessage *message, NMData *data)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
|
|
|
|
DBusMessage *reply_message = NULL;
|
|
|
|
|
DBusMessageIter iter;
|
|
|
|
|
DBusMessageIter iter_array;
|
|
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
g_return_val_if_fail (data != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (connection != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (message != NULL, NULL);
|
|
|
|
|
|
2004-08-09 15:10:46 +00:00
|
|
|
/* Check for no devices */
|
|
|
|
|
if (!data->dev_list)
|
|
|
|
|
return (nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "NoDevices",
|
|
|
|
|
"There are no available network devices."));
|
|
|
|
|
|
|
|
|
|
if (!(reply_message = dbus_message_new_method_return (message)))
|
2004-07-25 02:40:19 +00:00
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
|
|
dbus_message_iter_init (reply_message, &iter);
|
|
|
|
|
dbus_message_iter_append_array (&iter, &iter_array, DBUS_TYPE_STRING);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
/* Iterate over device list and grab index of "active device" */
|
|
|
|
|
if (nm_try_acquire_mutex (data->dev_list_mutex, __FUNCTION__))
|
|
|
|
|
{
|
|
|
|
|
GSList *element = data->dev_list;
|
|
|
|
|
gboolean appended = FALSE;
|
|
|
|
|
|
|
|
|
|
while (element)
|
|
|
|
|
{
|
|
|
|
|
NMDevice *dev = (NMDevice *)(element->data);
|
|
|
|
|
|
2004-10-21 17:42:14 +00:00
|
|
|
if (dev && (nm_device_get_driver_support_level (dev) != NM_DRIVER_UNSUPPORTED))
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-06 18:19:06 +00:00
|
|
|
char *object_path = g_strdup_printf ("%s/%s", NM_DBUS_PATH_DEVICES, nm_device_get_iface (dev));
|
2004-06-24 14:18:37 +00:00
|
|
|
dbus_message_iter_append_string (&iter_array, object_path);
|
|
|
|
|
g_free (object_path);
|
|
|
|
|
appended = TRUE;
|
|
|
|
|
}
|
|
|
|
|
element = g_slist_next (element);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If by some chance there is a device list, but it has no devices in it
|
2004-08-09 15:10:46 +00:00
|
|
|
* (something which should never happen), die.
|
2004-06-24 14:18:37 +00:00
|
|
|
*/
|
|
|
|
|
if (!appended)
|
2004-08-09 15:10:46 +00:00
|
|
|
g_assert ("Device list existed, but no devices were in it.");
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2004-08-06 18:19:06 +00:00
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "Retry",
|
2004-06-24 14:18:37 +00:00
|
|
|
"NetworkManager could not lock device list, try again.");
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-27 16:15:36 +00:00
|
|
|
return (reply_message);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------*/
|
|
|
|
|
/* Handler code */
|
|
|
|
|
/*-------------------------------------------------------------*/
|
|
|
|
|
|
2005-01-21 19:32:08 +00:00
|
|
|
typedef struct NMStatusChangeData
|
|
|
|
|
{
|
|
|
|
|
NMDevice *dev;
|
|
|
|
|
DeviceStatus status;
|
|
|
|
|
} NMStatusChangeData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean nm_dbus_device_status_change_helper (gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMStatusChangeData *data = (NMStatusChangeData *)user_data;
|
|
|
|
|
NMData *app_data;
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
/*
|
2004-08-26 20:05:24 +00:00
|
|
|
* nm_dbus_signal_device_status_change
|
2004-06-24 14:18:37 +00:00
|
|
|
*
|
2004-08-26 20:05:24 +00:00
|
|
|
* Notifies the bus that a particular device has had a status change, either
|
|
|
|
|
* active or no longer active
|
2004-06-24 14:18:37 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2004-08-26 20:05:24 +00:00
|
|
|
void nm_dbus_signal_device_status_change (DBusConnection *connection, NMDevice *dev, DeviceStatus status)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
|
|
|
|
DBusMessage *message;
|
2004-08-05 18:54:29 +00:00
|
|
|
unsigned char *dev_path;
|
2004-08-26 20:05:24 +00:00
|
|
|
unsigned char *signal = NULL;
|
2004-10-23 06:43:01 +00:00
|
|
|
NMAccessPoint *ap = NULL;
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
g_return_if_fail (connection != NULL);
|
|
|
|
|
g_return_if_fail (dev != NULL);
|
2004-08-05 18:54:29 +00:00
|
|
|
|
|
|
|
|
if (!(dev_path = nm_dbus_get_object_path_from_device (dev)))
|
|
|
|
|
return;
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-08-26 20:05:24 +00:00
|
|
|
switch (status)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-26 20:05:24 +00:00
|
|
|
case (DEVICE_NO_LONGER_ACTIVE):
|
|
|
|
|
signal = "DeviceNoLongerActive";
|
|
|
|
|
break;
|
|
|
|
|
case (DEVICE_NOW_ACTIVE):
|
|
|
|
|
signal = "DeviceNowActive";
|
|
|
|
|
break;
|
|
|
|
|
case (DEVICE_ACTIVATING):
|
|
|
|
|
signal = "DeviceActivating";
|
|
|
|
|
break;
|
|
|
|
|
case (DEVICE_LIST_CHANGE):
|
|
|
|
|
signal = "DevicesChanged";
|
|
|
|
|
break;
|
2005-01-21 19:32:08 +00:00
|
|
|
case (DEVICE_STATUS_CHANGE):
|
|
|
|
|
signal = "DeviceStatusChanged";
|
|
|
|
|
break;
|
2004-10-23 06:43:01 +00:00
|
|
|
case (DEVICE_ACTIVATION_FAILED):
|
|
|
|
|
signal = "DeviceActivationFailed";
|
|
|
|
|
break;
|
2004-08-26 20:05:24 +00:00
|
|
|
default:
|
|
|
|
|
syslog (LOG_ERR, "nm_dbus_signal_device_status_change(): got a bad signal name");
|
|
|
|
|
return;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-08-26 20:05:24 +00:00
|
|
|
if (!(message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, signal)))
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-26 20:05:24 +00:00
|
|
|
syslog (LOG_ERR, "nm_dbus_signal_device_status_change(): Not enough memory for new dbus message!");
|
2004-08-05 18:54:29 +00:00
|
|
|
g_free (dev_path);
|
2004-06-24 18:20:48 +00:00
|
|
|
return;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-10-23 06:43:01 +00:00
|
|
|
if ((status == DEVICE_ACTIVATION_FAILED) && nm_device_is_wireless (dev))
|
|
|
|
|
ap = nm_device_get_best_ap (dev);
|
|
|
|
|
/* If the device was wireless, attach the name of the wireless network that failed to activate */
|
|
|
|
|
if (ap && nm_ap_get_essid (ap))
|
|
|
|
|
dbus_message_append_args (message, DBUS_TYPE_STRING, dev_path, DBUS_TYPE_STRING, nm_ap_get_essid (ap), DBUS_TYPE_INVALID);
|
|
|
|
|
else
|
|
|
|
|
dbus_message_append_args (message, DBUS_TYPE_STRING, dev_path, DBUS_TYPE_INVALID);
|
2004-10-29 16:37:43 +00:00
|
|
|
|
|
|
|
|
if (ap)
|
|
|
|
|
nm_ap_unref (ap);
|
2004-08-05 18:54:29 +00:00
|
|
|
g_free (dev_path);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
if (!dbus_connection_send (connection, message, NULL))
|
2004-08-26 20:05:24 +00:00
|
|
|
syslog (LOG_WARNING, "nm_dbus_signal_device_status_change(): Could not raise the signal!");
|
2004-08-24 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerAP.[ch]
- Add a "enc_method_good" member and accessors to an Access Point
to signal when we've found the correct encryption method
for an access point
- Add a "timestamp" member and accessors, remove "priority" member
and accessors (use timestamps instead)
- Rename "wep_key"->"enc_key"
- (nm_ap_get_enc_key_hashed): new, return the correct mangled key
for a specified encryption method using the access points
source encryption key/passphrase
* src/NetworkManagerAPList.c
- When updating a network with dbus, grab timestamp now instead of
priority
* src/NetworkManagerDBus.[ch]
- Add signal for "DeviceActivating"
- Switch priority->timestamp
* src/NetworkManagerDevice.c
- Change references of "wep_key" -> "enc_key" or "key"
- Signal DeviceActivating when starting activation
- When activating a wireless device, if the access point we are connecting
to is encrypted, and we have a source key, try to generate a mangled
key and use that (ie, generate real WEP key from a passphrase)
- Rework device activation to fallback to other encryption methods if
a previous one didn't work (ie, try mangling a key as a 104-bit passphrase
first, then if that doesn't work fall back to direct hex key).
- (nm_device_update_best_ap): fix a deadlock, and use timestamps instead of
priority. We now prefer the latest access point used, rather than using
a priority scheme
- (nm_device_do_normal_scan): make the encryption method "unknown" on access
points we've just discovered, and merge in correct info from the global
access point lists
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@68 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-25 22:41:12 +00:00
|
|
|
|
|
|
|
|
dbus_message_unref (message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-10-14 20:31:35 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_network_status_from_data
|
|
|
|
|
*
|
|
|
|
|
* Return a network status string based on our network data
|
|
|
|
|
*
|
|
|
|
|
* Caller MUST free returned value
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static char *nm_dbus_network_status_from_data (NMData *data)
|
|
|
|
|
{
|
|
|
|
|
char *status = NULL;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (data != NULL, NULL);
|
|
|
|
|
|
2005-01-21 19:32:08 +00:00
|
|
|
if (data->forcing_device)
|
|
|
|
|
status = g_strdup ("scanning");
|
|
|
|
|
else if (data->active_device && nm_device_is_activating (data->active_device))
|
2004-10-14 20:31:35 +00:00
|
|
|
{
|
2005-01-21 19:32:08 +00:00
|
|
|
if (nm_device_is_wireless (data->active_device) && nm_device_get_now_scanning (data->active_device))
|
2004-10-14 20:31:35 +00:00
|
|
|
status = g_strdup ("scanning");
|
|
|
|
|
else
|
|
|
|
|
status = g_strdup ("connecting");
|
|
|
|
|
}
|
|
|
|
|
else if (data->active_device)
|
|
|
|
|
status = g_strdup ("connected");
|
|
|
|
|
else
|
|
|
|
|
status = g_strdup ("disconnected");
|
|
|
|
|
|
|
|
|
|
return (status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dbus_signal_network_status_change
|
|
|
|
|
*
|
|
|
|
|
* Signal a change in general network status.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void nm_dbus_signal_network_status_change (DBusConnection *connection, NMData *data)
|
|
|
|
|
{
|
|
|
|
|
DBusMessage *message;
|
|
|
|
|
char *status = NULL;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (connection != NULL);
|
|
|
|
|
g_return_if_fail (data != NULL);
|
|
|
|
|
|
|
|
|
|
if (!(message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "NetworkStatusChange")))
|
|
|
|
|
{
|
|
|
|
|
syslog (LOG_ERR, "nm_dbus_signal_device_status_change(): Not enough memory for new dbus message!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((status = nm_dbus_network_status_from_data (data)))
|
|
|
|
|
{
|
|
|
|
|
dbus_message_append_args (message, DBUS_TYPE_STRING, status, DBUS_TYPE_INVALID);
|
|
|
|
|
|
|
|
|
|
if (!dbus_connection_send (connection, message, NULL))
|
|
|
|
|
syslog (LOG_WARNING, "nm_dbus_signal_device_status_change(): Could not raise the signal!");
|
|
|
|
|
g_free (status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dbus_message_unref (message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
/*
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
* nm_dbus_signal_device_ip4_address_change
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
*
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
* Notifies the bus that a particular device's IPv4 address changed.
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
void nm_dbus_signal_device_ip4_address_change (DBusConnection *connection, NMDevice *dev)
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
{
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
DBusMessage *message;
|
2004-08-05 18:54:29 +00:00
|
|
|
unsigned char *dev_path;
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
g_return_if_fail (connection != NULL);
|
|
|
|
|
g_return_if_fail (dev != NULL);
|
|
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
if (!(dev_path = nm_dbus_get_object_path_from_device (dev)))
|
|
|
|
|
return;
|
|
|
|
|
|
2004-08-06 18:19:06 +00:00
|
|
|
message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "DeviceIP4AddressChange");
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
if (!message)
|
|
|
|
|
{
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_ERR, "nm_dbus_signal_device_ip4_address_change(): Not enough memory for new dbus message!");
|
2004-08-05 18:54:29 +00:00
|
|
|
g_free (dev_path);
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
return;
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
}
|
|
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
dbus_message_append_args (message, DBUS_TYPE_STRING, dev_path, DBUS_TYPE_INVALID);
|
|
|
|
|
g_free (dev_path);
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
|
|
|
|
|
if (!dbus_connection_send (connection, message, NULL))
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_WARNING, "nm_dbus_signal_device_ip4_address_change(): Could not raise the IP4AddressChange signal!");
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
|
|
|
|
|
dbus_message_unref (message);
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-02 21:12:40 +00:00
|
|
|
|
|
|
|
|
/*
|
2004-08-26 20:05:24 +00:00
|
|
|
* nm_dbus_signal_wireless_network_change
|
2004-08-02 21:12:40 +00:00
|
|
|
*
|
|
|
|
|
* Notifies the bus that a new wireless network has come into range
|
|
|
|
|
*
|
|
|
|
|
*/
|
2004-08-26 20:05:24 +00:00
|
|
|
void nm_dbus_signal_wireless_network_change (DBusConnection *connection, NMDevice *dev, NMAccessPoint *ap, gboolean gone)
|
2004-08-02 21:12:40 +00:00
|
|
|
{
|
2004-08-05 18:54:29 +00:00
|
|
|
DBusMessage *message;
|
|
|
|
|
char *dev_path;
|
|
|
|
|
char *ap_path;
|
2004-08-02 21:12:40 +00:00
|
|
|
|
|
|
|
|
g_return_if_fail (connection != NULL);
|
|
|
|
|
g_return_if_fail (dev != NULL);
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
if (!(dev_path = nm_dbus_get_object_path_from_device (dev)))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!(ap_path = nm_device_get_path_for_ap (dev, ap)))
|
|
|
|
|
{
|
|
|
|
|
g_free (dev_path);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-26 20:05:24 +00:00
|
|
|
message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE,
|
|
|
|
|
(gone ? "WirelessNetworkDisappeared" : "WirelessNetworkAppeared"));
|
2004-08-02 21:12:40 +00:00
|
|
|
if (!message)
|
|
|
|
|
{
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_ERR, "nm_dbus_signal_wireless_network_appeared(): Not enough memory for new dbus message!");
|
2004-08-05 18:54:29 +00:00
|
|
|
g_free (dev_path);
|
|
|
|
|
g_free (ap_path);
|
2004-08-02 21:12:40 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
dbus_message_append_args (message,
|
|
|
|
|
DBUS_TYPE_STRING, dev_path,
|
|
|
|
|
DBUS_TYPE_STRING, ap_path,
|
|
|
|
|
DBUS_TYPE_INVALID);
|
|
|
|
|
g_free (ap_path);
|
|
|
|
|
g_free (dev_path);
|
2004-08-02 21:12:40 +00:00
|
|
|
|
|
|
|
|
if (!dbus_connection_send (connection, message, NULL))
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_WARNING, "nnm_dbus_signal_wireless_network_appeared(): Could not raise the WirelessNetworkAppeared signal!");
|
2004-08-02 21:12:40 +00:00
|
|
|
|
|
|
|
|
dbus_message_unref (message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_get_user_key_for_network
|
|
|
|
|
*
|
|
|
|
|
* Asks NetworkManagerInfo for a user-entered WEP key.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2004-11-06 03:23:36 +00:00
|
|
|
void nm_dbus_get_user_key_for_network (DBusConnection *connection, NMDevice *dev, NMAccessPoint *ap, int attempt)
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
{
|
|
|
|
|
DBusMessage *message;
|
|
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
g_return_if_fail (connection != NULL);
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
g_return_if_fail (dev != NULL);
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
g_return_if_fail (nm_ap_get_essid (ap) != NULL);
|
2004-11-06 03:23:36 +00:00
|
|
|
g_return_if_fail (attempt > 0);
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
|
2004-08-06 18:19:06 +00:00
|
|
|
message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH,
|
|
|
|
|
NMI_DBUS_INTERFACE, "getKeyForNetwork");
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
if (message == NULL)
|
|
|
|
|
{
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_ERR, "nm_dbus_get_user_key_for_network(): Couldn't allocate the dbus message");
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-27 16:15:36 +00:00
|
|
|
dbus_message_append_args (message, DBUS_TYPE_STRING, nm_device_get_iface (dev),
|
|
|
|
|
DBUS_TYPE_STRING, nm_ap_get_essid (ap),
|
2004-11-06 03:23:36 +00:00
|
|
|
DBUS_TYPE_INT32, attempt,
|
2004-07-27 16:15:36 +00:00
|
|
|
DBUS_TYPE_INVALID);
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
|
|
|
|
|
if (!dbus_connection_send (connection, message, NULL))
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_WARNING, "nm_dbus_get_user_key_for_network(): could not send dbus message");
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
dbus_message_unref (message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-07-06 04:45:00 +00:00
|
|
|
/*
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
* nm_dbus_set_user_key_for_network
|
2004-07-06 04:45:00 +00:00
|
|
|
*
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
* In response to a NetworkManagerInfo message, sets the WEP key
|
|
|
|
|
* for a particular wireless AP/network
|
2004-07-06 04:45:00 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2004-07-25 02:40:19 +00:00
|
|
|
static void nm_dbus_set_user_key_for_network (DBusConnection *connection, DBusMessage *message, NMData *data)
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
{
|
2004-10-21 17:42:14 +00:00
|
|
|
DBusError error;
|
|
|
|
|
char *device;
|
|
|
|
|
char *network;
|
|
|
|
|
char *passphrase;
|
|
|
|
|
NMEncKeyType key_type;
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
g_return_if_fail (data != NULL);
|
|
|
|
|
g_return_if_fail (connection != NULL);
|
|
|
|
|
g_return_if_fail (message != NULL);
|
|
|
|
|
|
2004-07-27 16:15:36 +00:00
|
|
|
dbus_error_init (&error);
|
|
|
|
|
if (dbus_message_get_args (message, &error,
|
|
|
|
|
DBUS_TYPE_STRING, &device,
|
|
|
|
|
DBUS_TYPE_STRING, &network,
|
|
|
|
|
DBUS_TYPE_STRING, &passphrase,
|
2004-10-21 17:42:14 +00:00
|
|
|
DBUS_TYPE_INT32, &key_type,
|
2004-07-27 16:15:36 +00:00
|
|
|
DBUS_TYPE_INVALID))
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
{
|
2004-07-25 02:40:19 +00:00
|
|
|
NMDevice *dev;
|
2004-08-02 21:12:40 +00:00
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
if ((dev = nm_get_device_by_iface (data, device)))
|
2004-10-21 17:42:14 +00:00
|
|
|
nm_device_set_user_key_for_network (dev, data->invalid_ap_list, network, passphrase, key_type);
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
|
2004-07-27 16:15:36 +00:00
|
|
|
dbus_free (device);
|
|
|
|
|
dbus_free (network);
|
|
|
|
|
dbus_free (passphrase);
|
|
|
|
|
}
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dbus_cancel_get_user_key_for_network
|
|
|
|
|
*
|
|
|
|
|
* Sends a user-key cancellation message to NetworkManagerInfo
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void nm_dbus_cancel_get_user_key_for_network (DBusConnection *connection)
|
2004-07-06 04:45:00 +00:00
|
|
|
{
|
|
|
|
|
DBusMessage *message;
|
|
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
g_return_if_fail (connection != NULL);
|
|
|
|
|
|
2004-08-06 18:19:06 +00:00
|
|
|
message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH,
|
|
|
|
|
NMI_DBUS_INTERFACE, "cancelGetKeyForNetwork");
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
if (message == NULL)
|
2004-07-06 04:45:00 +00:00
|
|
|
{
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_ERR, "nm_dbus_cancel_get_user_key_for_network(): Couldn't allocate the dbus message");
|
2004-07-06 04:45:00 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!dbus_connection_send (connection, message, NULL))
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_WARNING, "nm_dbus_cancel_get_user_key_for_network(): could not send dbus message");
|
2004-07-06 04:45:00 +00:00
|
|
|
|
|
|
|
|
dbus_message_unref (message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-07-27 16:15:36 +00:00
|
|
|
/*
|
2005-01-09 23:15:36 +00:00
|
|
|
* nm_dbus_get_network_properties
|
2004-07-27 16:15:36 +00:00
|
|
|
*
|
2005-01-09 23:15:36 +00:00
|
|
|
* Get a wireless network from NetworkManagerInfo
|
2004-07-27 16:15:36 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2005-01-09 23:15:36 +00:00
|
|
|
NMAccessPoint *nm_dbus_get_network_object (DBusConnection *connection, NMNetworkType type, const char *network)
|
2004-07-27 16:15:36 +00:00
|
|
|
{
|
|
|
|
|
DBusMessage *message;
|
|
|
|
|
DBusError error;
|
|
|
|
|
DBusMessage *reply;
|
2005-01-09 23:15:36 +00:00
|
|
|
gboolean success = FALSE;
|
|
|
|
|
NMAccessPoint *ap = NULL;
|
2004-07-27 16:15:36 +00:00
|
|
|
|
2005-01-09 23:15:36 +00:00
|
|
|
char *essid = NULL;
|
|
|
|
|
gint timestamp_secs = -1;
|
2004-07-27 16:15:36 +00:00
|
|
|
char *key = NULL;
|
2005-01-09 23:15:36 +00:00
|
|
|
NMEncKeyType key_type = -1;
|
|
|
|
|
gboolean trusted = FALSE;
|
2005-01-21 19:32:08 +00:00
|
|
|
NMDeviceAuthMethod auth_method = NM_DEVICE_AUTH_METHOD_UNKNOWN;
|
2005-01-09 23:15:36 +00:00
|
|
|
char **addrs = NULL;
|
|
|
|
|
gint num_addr = -1;
|
|
|
|
|
|
2004-07-27 16:15:36 +00:00
|
|
|
g_return_val_if_fail (connection != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (network != NULL, NULL);
|
2004-08-05 18:54:29 +00:00
|
|
|
g_return_val_if_fail (type != NETWORK_TYPE_UNKNOWN, NULL);
|
2004-07-27 16:15:36 +00:00
|
|
|
|
2005-01-09 23:15:36 +00:00
|
|
|
if (!(message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH, NMI_DBUS_INTERFACE, "getNetworkProperties")))
|
2004-07-27 16:15:36 +00:00
|
|
|
{
|
2005-01-09 23:15:36 +00:00
|
|
|
syslog (LOG_ERR, "nm_dbus_get_network_object(): Couldn't allocate the dbus message");
|
2004-07-27 16:15:36 +00:00
|
|
|
return (NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
dbus_message_append_args (message, DBUS_TYPE_STRING, network,
|
|
|
|
|
DBUS_TYPE_INT32, (int)type,
|
|
|
|
|
DBUS_TYPE_INVALID);
|
2004-07-27 16:15:36 +00:00
|
|
|
|
2005-01-09 23:15:36 +00:00
|
|
|
/* Send message and get properties back from NetworkManagerInfo */
|
2004-07-27 16:15:36 +00:00
|
|
|
dbus_error_init (&error);
|
|
|
|
|
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
|
2004-10-08 05:22:17 +00:00
|
|
|
dbus_message_unref (message);
|
2004-07-27 16:15:36 +00:00
|
|
|
|
|
|
|
|
if (dbus_error_is_set (&error))
|
|
|
|
|
{
|
2005-01-09 23:15:36 +00:00
|
|
|
syslog (LOG_ERR, "nm_dbus_get_network_object(): %s raised '%s'", error.name, error.message);
|
|
|
|
|
goto out;
|
2004-07-27 16:15:36 +00:00
|
|
|
}
|
|
|
|
|
|
2005-01-09 23:15:36 +00:00
|
|
|
if (!reply)
|
2004-09-08 18:14:42 +00:00
|
|
|
{
|
2005-01-09 23:15:36 +00:00
|
|
|
syslog (LOG_NOTICE, "nm_dbus_get_network_object(): reply was NULL.");
|
|
|
|
|
goto out;
|
2004-09-08 18:14:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dbus_error_init (&error);
|
2005-01-09 23:15:36 +00:00
|
|
|
success = dbus_message_get_args (reply, &error,
|
|
|
|
|
DBUS_TYPE_STRING, &essid,
|
|
|
|
|
DBUS_TYPE_INT32, ×tamp_secs,
|
|
|
|
|
DBUS_TYPE_STRING, &key,
|
|
|
|
|
DBUS_TYPE_INT32, &key_type,
|
2005-01-21 19:32:08 +00:00
|
|
|
DBUS_TYPE_INT32, &auth_method,
|
2005-01-09 23:15:36 +00:00
|
|
|
DBUS_TYPE_BOOLEAN, &trusted,
|
|
|
|
|
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &addrs, &num_addr,
|
|
|
|
|
DBUS_TYPE_INVALID);
|
|
|
|
|
if (success)
|
2004-09-08 18:14:42 +00:00
|
|
|
{
|
2005-01-09 23:15:36 +00:00
|
|
|
if (timestamp_secs > 0)
|
|
|
|
|
{
|
|
|
|
|
GTimeVal *timestamp = g_new0 (GTimeVal, 1);
|
2004-09-08 18:14:42 +00:00
|
|
|
|
2005-01-09 23:15:36 +00:00
|
|
|
ap = nm_ap_new ();
|
|
|
|
|
nm_ap_set_essid (ap, essid);
|
2004-09-08 18:14:42 +00:00
|
|
|
|
2005-01-09 23:15:36 +00:00
|
|
|
timestamp->tv_sec = timestamp_secs;
|
|
|
|
|
timestamp->tv_usec = 0;
|
|
|
|
|
nm_ap_set_timestamp (ap, timestamp);
|
|
|
|
|
g_free (timestamp);
|
2004-09-08 18:14:42 +00:00
|
|
|
|
2005-01-09 23:15:36 +00:00
|
|
|
nm_ap_set_trusted (ap, trusted);
|
2004-09-08 18:14:42 +00:00
|
|
|
|
2005-01-09 23:15:36 +00:00
|
|
|
if (key && strlen (key))
|
|
|
|
|
nm_ap_set_enc_key_source (ap, key, key_type);
|
|
|
|
|
else
|
|
|
|
|
nm_ap_set_enc_key_source (ap, NULL, NM_ENC_TYPE_UNKNOWN);
|
2005-01-21 19:32:08 +00:00
|
|
|
nm_ap_set_auth_method (ap, auth_method);
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
|
2005-01-09 23:15:36 +00:00
|
|
|
/* Get user addresses, form into a GSList, and stuff into the AP */
|
|
|
|
|
{
|
|
|
|
|
GSList *addr_list = NULL;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (!addrs)
|
|
|
|
|
num_addr = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < num_addr; i++)
|
|
|
|
|
{
|
|
|
|
|
if (addrs[i] && (strlen (addrs[i]) >= 11))
|
|
|
|
|
addr_list = g_slist_append (addr_list, g_strdup (addrs[i]));
|
|
|
|
|
}
|
|
|
|
|
nm_ap_set_user_addresses (ap, addr_list);
|
|
|
|
|
g_slist_foreach (addr_list, (GFunc)g_free, NULL);
|
|
|
|
|
g_slist_free (addr_list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dbus_free_string_array (addrs);
|
|
|
|
|
g_free (essid);
|
|
|
|
|
g_free (key);
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
}
|
|
|
|
|
else
|
2005-01-09 23:15:36 +00:00
|
|
|
syslog (LOG_ERR, "nm_dbus_get_network_object(): bad data, %s raised %s", error.name, error.message);
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
|
2005-01-09 23:15:36 +00:00
|
|
|
out:
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
if (reply)
|
|
|
|
|
dbus_message_unref (reply);
|
|
|
|
|
|
2005-01-09 23:15:36 +00:00
|
|
|
return (ap);
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-21 19:32:08 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_update_network_auth_method
|
|
|
|
|
*
|
|
|
|
|
* Tell NetworkManagerInfo the updated auth_method of the AP
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
gboolean nm_dbus_update_network_auth_method (DBusConnection *connection, const char *network, const NMDeviceAuthMethod auth_method)
|
|
|
|
|
{
|
|
|
|
|
DBusMessage *message;
|
|
|
|
|
DBusError error;
|
|
|
|
|
gboolean success = FALSE;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (connection != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (network != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (auth_method != NM_DEVICE_AUTH_METHOD_UNKNOWN, FALSE);
|
|
|
|
|
|
|
|
|
|
message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH, NMI_DBUS_INTERFACE, "updateNetworkAuthMethod");
|
|
|
|
|
if (!message)
|
|
|
|
|
{
|
|
|
|
|
syslog (LOG_ERR, "nm_dbus_update_network_auth_method (): Couldn't allocate the dbus message");
|
|
|
|
|
return (FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dbus_message_append_args (message, DBUS_TYPE_STRING, network,
|
|
|
|
|
DBUS_TYPE_INT32, (int)auth_method,
|
|
|
|
|
DBUS_TYPE_INVALID);
|
|
|
|
|
|
|
|
|
|
/* Send message and get trusted status back from NetworkManagerInfo */
|
|
|
|
|
dbus_error_init (&error);
|
|
|
|
|
if (!dbus_connection_send (connection, message, NULL))
|
|
|
|
|
{
|
|
|
|
|
syslog (LOG_ERR, "nm_dbus_update_network_auth_method (): failed to send dbus message.");
|
|
|
|
|
dbus_error_free (&error);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
success = TRUE;
|
|
|
|
|
|
|
|
|
|
dbus_message_unref (message);
|
|
|
|
|
return (success);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-11-17 Dan Williams <dcbw@redhat.com>
* Cache access point MAC addresses in NetworkManagerInfo after you've explicitly
connected to them. Then, after a scan, match up non-ESSID-broadcasting access
points with any cached MAC addresses from NetworkManagerInfo. Allows us to
show known access points that don't broadcast their ESSID in the menus without
any user intervention whatsoever.
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions
for dbus method calls "getNetworkAddresses" and "addNetworkAddress"
* src/NetworkManagerAP.[ch]
- Add a "user_addresses" data member to the NMAccessPoint structure
- (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing
the user_addresses data member
* src/NetworkManagerAPList.c
- (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just
the AP's reported address
- (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo
* src/NetworkManagerDHCP.c
- Increase DHCP timeout from 25s -> 30s
* src/NetworkManagerDbus.[ch]
- (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set
user addresses
* src/NetworkManagerDevice.c
- (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up,
wait 2s, then configure it. Sometimes Prism54 cards will freeze up with
"mgnt tx queue full", seemingly in response to NM controlling the card too much.
So, we take the card down to clear it out.
- (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list
too, since that's where the user_addresses are
* src/NetworkManagerPolicy.c
- (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to
that wireless networks' user_addresses list upon successful activation
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_add_network_address
|
|
|
|
|
*
|
|
|
|
|
* Tell NetworkManagerInfo the MAC address of an AP
|
|
|
|
|
*
|
|
|
|
|
* Returns: FALSE on error
|
|
|
|
|
* TRUE on success
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
gboolean nm_dbus_add_network_address (DBusConnection *connection, NMNetworkType type, const char *network, struct ether_addr *addr)
|
|
|
|
|
{
|
|
|
|
|
DBusMessage *message;
|
|
|
|
|
DBusError error;
|
|
|
|
|
gboolean success = FALSE;
|
|
|
|
|
char char_addr[20];
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (connection != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (network != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (type != NETWORK_TYPE_UNKNOWN, FALSE);
|
|
|
|
|
g_return_val_if_fail (addr != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH,
|
|
|
|
|
NMI_DBUS_INTERFACE, "addNetworkAddress");
|
|
|
|
|
if (!message)
|
|
|
|
|
{
|
|
|
|
|
syslog (LOG_ERR, "nm_dbus_add_network_ap_mac_address(): Couldn't allocate the dbus message");
|
|
|
|
|
return (FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memset (char_addr, 0, 20);
|
|
|
|
|
ether_ntoa_r (addr, &char_addr[0]);
|
|
|
|
|
|
|
|
|
|
dbus_message_append_args (message, DBUS_TYPE_STRING, network,
|
|
|
|
|
DBUS_TYPE_INT32, (int)type,
|
|
|
|
|
DBUS_TYPE_STRING, &char_addr,
|
|
|
|
|
DBUS_TYPE_INVALID);
|
|
|
|
|
|
|
|
|
|
/* Send message and get trusted status back from NetworkManagerInfo */
|
|
|
|
|
dbus_error_init (&error);
|
|
|
|
|
if (!dbus_connection_send (connection, message, NULL))
|
|
|
|
|
{
|
|
|
|
|
syslog (LOG_ERR, "nm_dbus_add_network_ap_mac_address(): failed to send dbus message.");
|
|
|
|
|
dbus_error_free (&error);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
success = TRUE;
|
|
|
|
|
|
|
|
|
|
dbus_message_unref (message);
|
|
|
|
|
return (success);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-07-27 16:15:36 +00:00
|
|
|
/*
|
2004-08-05 18:54:29 +00:00
|
|
|
* nm_dbus_get_networks
|
2004-07-27 16:15:36 +00:00
|
|
|
*
|
2004-08-05 18:54:29 +00:00
|
|
|
* Get all networks of a specific type from NetworkManagerInfo
|
2004-07-27 16:15:36 +00:00
|
|
|
*
|
|
|
|
|
* NOTE: caller MUST free returned value using dbus_free_string_array()
|
|
|
|
|
*
|
|
|
|
|
*/
|
2004-08-05 18:54:29 +00:00
|
|
|
char ** nm_dbus_get_networks (DBusConnection *connection, NMNetworkType type, int *num_networks)
|
2004-07-27 16:15:36 +00:00
|
|
|
{
|
|
|
|
|
DBusMessage *message;
|
|
|
|
|
DBusError error;
|
|
|
|
|
DBusMessage *reply;
|
|
|
|
|
char **networks = NULL;
|
|
|
|
|
|
|
|
|
|
*num_networks = 0;
|
|
|
|
|
g_return_val_if_fail (connection != NULL, NULL);
|
2004-08-05 18:54:29 +00:00
|
|
|
g_return_val_if_fail (type != NETWORK_TYPE_UNKNOWN, NULL);
|
2004-07-27 16:15:36 +00:00
|
|
|
|
2004-08-06 18:19:06 +00:00
|
|
|
message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH,
|
|
|
|
|
NMI_DBUS_INTERFACE, "getNetworks");
|
2004-07-27 16:15:36 +00:00
|
|
|
if (!message)
|
|
|
|
|
{
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_ERR, "nm_dbus_get_networks(): Couldn't allocate the dbus message");
|
2004-07-27 16:15:36 +00:00
|
|
|
return (NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
dbus_message_append_args (message, DBUS_TYPE_INT32, (int)type, DBUS_TYPE_INVALID);
|
|
|
|
|
|
2004-07-27 16:15:36 +00:00
|
|
|
/* Send message and get essid back from NetworkManagerInfo */
|
|
|
|
|
dbus_error_init (&error);
|
|
|
|
|
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
|
|
|
|
|
if (dbus_error_is_set (&error))
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_ERR, "nm_dbus_get_networks(): %s raised %s", error.name, error.message);
|
2004-07-27 16:15:36 +00:00
|
|
|
else if (!reply)
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_NOTICE, "nm_dbus_get_networks(): reply was NULL.");
|
2004-07-27 16:15:36 +00:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DBusMessageIter iter;
|
|
|
|
|
|
|
|
|
|
dbus_message_iter_init (reply, &iter);
|
|
|
|
|
dbus_message_iter_get_string_array (&iter, &networks, num_networks);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dbus_message_unref (message);
|
|
|
|
|
if (reply)
|
2004-08-05 18:54:29 +00:00
|
|
|
dbus_message_unref (reply);
|
2004-07-27 16:15:36 +00:00
|
|
|
|
|
|
|
|
return (networks);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_nmi_filter
|
|
|
|
|
*
|
|
|
|
|
* Respond to NetworkManagerInfo signals about changing Allowed Networks
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static DBusHandlerResult nm_dbus_nmi_filter (DBusConnection *connection, DBusMessage *message, void *user_data)
|
|
|
|
|
{
|
2005-01-25 18:21:38 +00:00
|
|
|
NMData *data = (NMData *)user_data;
|
|
|
|
|
const char *object_path;
|
|
|
|
|
const char *method;
|
|
|
|
|
gboolean handled = FALSE;
|
|
|
|
|
DBusError error;
|
2004-07-25 02:40:19 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (data != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
|
|
|
g_return_val_if_fail (connection != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
|
|
|
g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
|
|
|
|
2004-08-11 Dan Williams <dcbw@redhat.com>
* info-daemon/NetworkManagerInfo.c:
- (main): clean up Seth's code style
* info-daemon/NetworkManagerInfoDbus.c:
- Use the more aptly-named path/service/interface constants from NetworkManager
- Don't return empty strings ("") as object paths ever, instead return errors
* panel-applet/NMWirelessApplet.c:
- Clean up Seth's code style
* src/NetworkManager.[ch]
- (nm_remove_device_from_list): remove anything having to do with pending_device
- (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon
* src/NetworkManagerAPList.[ch]
- Move Iter struct right above the iter functions to preserve opacity
- (nm_ap_list_remove_ap): implement
- (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(),
remove AP if NetworkManagerInfo doesn't know anything about it
- (nm_ap_list_diff): user NMAPList iterators
- (nm_ap_list_print_members): implement debugging function
* src/NetworkManagerDbus.[ch]
- (nm_dbus_nm_get_active_device): remove anything to do with pending_device
- (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused),
and move the actual key setting stuff into NetworkManagerDevice.c
- (nm_dbus_get_network_priority): return -1 now on errors
- (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to
get lost, and force the active device to update its "best" ap when AP lists change
- (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status"
method call due to pending_device member removal
* src/NetworkManagerDevice.[ch]
- Move NMDevice structure to the top
- Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure
- Remove Pending Action stuff from everywhere
- (nm_device_activation_*): We now "begin" activation and start a thread to do the
activation for us. This thread blocks until all conditions for activation have
been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and
then setup up the interface and runs dhclient. We have to do this because there
is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot
run our main loop and respond to dbus method calls or HAL device removals/inserts
- (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we
can tell nm_device_activation_worker() that we've got a key
- (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure
- (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when
diffing (AP appear/disappear signal functions make sure the AP is actually in the device's
list)
- (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here
* src/NetworkManagerPolicy.c
- Remove anything to do with pending_device
- Adjust device activation to deal with activation-in-worker-thread
* src/NetworkManagerUtils.c
- Clean up locking debugging a bit
* src/NetworkManagerWireless.[ch]
- (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function
was badly named and is better as a device function
* panel-applet/.cvsignore: add
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
|
|
|
method = dbus_message_get_member (message);
|
2004-08-06 18:19:06 +00:00
|
|
|
if (!(object_path = dbus_message_get_path (message)))
|
2004-07-27 16:15:36 +00:00
|
|
|
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
|
|
|
|
2004-08-29 Colin Walters <walters@verbum.org>
* test/nminfotest.c: Include string.h and stdlib.h.
(get_network_string_property, get_networks_of_type): Return NULL.
* test/nmclienttest.c (get_device_name, get_active_device): Return
NULL.
* src/backends/NetworkManagerRedHat.c (nm_system_device_stop_dhcp): Just
use strlen, fgets always NULL-terminates the string.
* src/NetworkManagerDbus.c (nm_dbus_nmi_filter,
dbus_message_get_member): Remove /* in comment.
* src/NetworkManagerUtils.c (LOCKING_DEBUG): Ditto.
* src/NetworkManager.c (quit): Unused, delete.
(nm_data_free): Cast arg to GFunc.
* panel-applet/NMWirelessAppletDbus.c: Need to include
string.h, and dbus-glib-lowlevel.h (the latter is needed
for dbus_connection_setup_with_g_main at present).
(nmwa_dbus_update_wireless_network_list): Parenthesize
assignment in conditional.
(nmwa_dbus_worker): Return NULL.
* panel-applet/NMWirelessApplet.c (nmwa_redraw)
(nmwa_get_menu_pos, nmwa_toplevel_menu_activate)
(nmwa_menu_add_text_item, nmwa_setup_widgets): Kill unused variables.
(nmwa_populate_menu): Return NULL on failure, instead of just
return;
* initscript/NMLaunchHelper.c (g_timeout_add): Cast arg to GSourceFunc.
* info-daemon/NetworkManagerInfoNetworksDialog.c (nmi_networks_dialog_init): Kill unused
variables.
* info-daemon/NetworkManagerInfo.c (nmi_print_usage): Unused,
delete.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@105 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-29 06:06:51 +00:00
|
|
|
/* syslog (LOG_DEBUG, "nm_dbus_nmi_filter() got method %s for path %s", method, object_path); */
|
2004-08-11 Dan Williams <dcbw@redhat.com>
* info-daemon/NetworkManagerInfo.c:
- (main): clean up Seth's code style
* info-daemon/NetworkManagerInfoDbus.c:
- Use the more aptly-named path/service/interface constants from NetworkManager
- Don't return empty strings ("") as object paths ever, instead return errors
* panel-applet/NMWirelessApplet.c:
- Clean up Seth's code style
* src/NetworkManager.[ch]
- (nm_remove_device_from_list): remove anything having to do with pending_device
- (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon
* src/NetworkManagerAPList.[ch]
- Move Iter struct right above the iter functions to preserve opacity
- (nm_ap_list_remove_ap): implement
- (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(),
remove AP if NetworkManagerInfo doesn't know anything about it
- (nm_ap_list_diff): user NMAPList iterators
- (nm_ap_list_print_members): implement debugging function
* src/NetworkManagerDbus.[ch]
- (nm_dbus_nm_get_active_device): remove anything to do with pending_device
- (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused),
and move the actual key setting stuff into NetworkManagerDevice.c
- (nm_dbus_get_network_priority): return -1 now on errors
- (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to
get lost, and force the active device to update its "best" ap when AP lists change
- (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status"
method call due to pending_device member removal
* src/NetworkManagerDevice.[ch]
- Move NMDevice structure to the top
- Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure
- Remove Pending Action stuff from everywhere
- (nm_device_activation_*): We now "begin" activation and start a thread to do the
activation for us. This thread blocks until all conditions for activation have
been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and
then setup up the interface and runs dhclient. We have to do this because there
is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot
run our main loop and respond to dbus method calls or HAL device removals/inserts
- (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we
can tell nm_device_activation_worker() that we've got a key
- (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure
- (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when
diffing (AP appear/disappear signal functions make sure the AP is actually in the device's
list)
- (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here
* src/NetworkManagerPolicy.c
- Remove anything to do with pending_device
- Adjust device activation to deal with activation-in-worker-thread
* src/NetworkManagerUtils.c
- Clean up locking debugging a bit
* src/NetworkManagerWireless.[ch]
- (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function
was badly named and is better as a device function
* panel-applet/.cvsignore: add
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
|
|
|
|
2005-01-25 18:21:38 +00:00
|
|
|
dbus_error_init (&error);
|
|
|
|
|
|
2004-08-11 Dan Williams <dcbw@redhat.com>
* info-daemon/NetworkManagerInfo.c:
- (main): clean up Seth's code style
* info-daemon/NetworkManagerInfoDbus.c:
- Use the more aptly-named path/service/interface constants from NetworkManager
- Don't return empty strings ("") as object paths ever, instead return errors
* panel-applet/NMWirelessApplet.c:
- Clean up Seth's code style
* src/NetworkManager.[ch]
- (nm_remove_device_from_list): remove anything having to do with pending_device
- (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon
* src/NetworkManagerAPList.[ch]
- Move Iter struct right above the iter functions to preserve opacity
- (nm_ap_list_remove_ap): implement
- (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(),
remove AP if NetworkManagerInfo doesn't know anything about it
- (nm_ap_list_diff): user NMAPList iterators
- (nm_ap_list_print_members): implement debugging function
* src/NetworkManagerDbus.[ch]
- (nm_dbus_nm_get_active_device): remove anything to do with pending_device
- (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused),
and move the actual key setting stuff into NetworkManagerDevice.c
- (nm_dbus_get_network_priority): return -1 now on errors
- (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to
get lost, and force the active device to update its "best" ap when AP lists change
- (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status"
method call due to pending_device member removal
* src/NetworkManagerDevice.[ch]
- Move NMDevice structure to the top
- Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure
- Remove Pending Action stuff from everywhere
- (nm_device_activation_*): We now "begin" activation and start a thread to do the
activation for us. This thread blocks until all conditions for activation have
been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and
then setup up the interface and runs dhclient. We have to do this because there
is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot
run our main loop and respond to dbus method calls or HAL device removals/inserts
- (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we
can tell nm_device_activation_worker() that we've got a key
- (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure
- (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when
diffing (AP appear/disappear signal functions make sure the AP is actually in the device's
list)
- (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here
* src/NetworkManagerPolicy.c
- Remove anything to do with pending_device
- Adjust device activation to deal with activation-in-worker-thread
* src/NetworkManagerUtils.c
- Clean up locking debugging a bit
* src/NetworkManagerWireless.[ch]
- (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function
was badly named and is better as a device function
* panel-applet/.cvsignore: add
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
|
|
|
if ( (strcmp (object_path, NMI_DBUS_PATH) == 0)
|
2004-09-08 18:14:42 +00:00
|
|
|
&& dbus_message_is_signal (message, NMI_DBUS_INTERFACE, "WirelessNetworkUpdate"))
|
2004-09-09 20:02:59 +00:00
|
|
|
{
|
|
|
|
|
char *network = NULL;
|
|
|
|
|
|
2005-01-25 18:21:38 +00:00
|
|
|
if (dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID))
|
|
|
|
|
{
|
|
|
|
|
/* Update a single wireless network's data */
|
|
|
|
|
syslog (LOG_DEBUG, "NetworkManagerInfo triggered update of wireless network '%s'", network);
|
|
|
|
|
nm_ap_list_update_network_from_nmi (data->allowed_ap_list, network, data);
|
|
|
|
|
dbus_free (network);
|
|
|
|
|
handled = TRUE;
|
|
|
|
|
}
|
2004-09-09 20:02:59 +00:00
|
|
|
}
|
2005-01-25 18:21:38 +00:00
|
|
|
#if (DBUS_VERSION_MAJOR == 0 && DBUS_VERSION_MINOR == 22)
|
2004-08-06 18:19:06 +00:00
|
|
|
else if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, "ServiceCreated"))
|
|
|
|
|
{
|
2005-01-25 18:21:38 +00:00
|
|
|
/* Only for dbus <= 0.22 */
|
2004-08-06 18:19:06 +00:00
|
|
|
char *service;
|
|
|
|
|
|
|
|
|
|
if ( dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &service, DBUS_TYPE_INVALID)
|
|
|
|
|
&& (strcmp (service, NMI_DBUS_SERVICE) == 0))
|
|
|
|
|
{
|
2005-01-25 18:21:38 +00:00
|
|
|
nm_policy_schedule_allowed_ap_list_update (data);
|
2004-08-06 18:19:06 +00:00
|
|
|
}
|
|
|
|
|
}
|
2005-01-25 18:21:38 +00:00
|
|
|
#elif (DBUS_VERSION_MAJOR == 0 && DBUS_VERSION_MINOR == 23)
|
|
|
|
|
else if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, "ServiceOwnerChanged"))
|
2004-08-06 18:19:06 +00:00
|
|
|
{
|
2005-01-25 18:21:38 +00:00
|
|
|
/* New signal for dbus 0.23... */
|
2004-08-06 18:19:06 +00:00
|
|
|
char *service;
|
2005-01-25 18:21:38 +00:00
|
|
|
char *old_owner;
|
|
|
|
|
char *new_owner;
|
|
|
|
|
|
|
|
|
|
if ( dbus_message_get_args (message, &error,
|
|
|
|
|
DBUS_TYPE_STRING, &service,
|
|
|
|
|
DBUS_TYPE_STRING, &old_owner,
|
|
|
|
|
DBUS_TYPE_STRING, &new_owner,
|
|
|
|
|
DBUS_TYPE_INVALID)
|
2004-08-06 18:19:06 +00:00
|
|
|
&& (strcmp (service, NMI_DBUS_SERVICE) == 0))
|
|
|
|
|
{
|
2005-01-25 18:21:38 +00:00
|
|
|
gboolean old_owner_good = (old_owner && (strlen (old_owner) > 0));
|
|
|
|
|
gboolean new_owner_good = (new_owner && (strlen (new_owner) > 0));
|
|
|
|
|
|
|
|
|
|
/* Service didn't used to have an owner, now it does. Equivalent to
|
|
|
|
|
* "ServiceCreated" signal in dbus <= 0.22
|
|
|
|
|
*/
|
|
|
|
|
if (!old_owner_good && new_owner_good)
|
|
|
|
|
nm_policy_schedule_allowed_ap_list_update (data);
|
2004-08-06 18:19:06 +00:00
|
|
|
}
|
|
|
|
|
}
|
2005-01-25 18:21:38 +00:00
|
|
|
#else
|
|
|
|
|
#error "Unrecognized version of DBUS."
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (dbus_error_is_set (&error))
|
|
|
|
|
dbus_error_free (&error);
|
2004-08-05 18:54:29 +00:00
|
|
|
|
2004-08-11 Dan Williams <dcbw@redhat.com>
* info-daemon/NetworkManagerInfo.c:
- (main): clean up Seth's code style
* info-daemon/NetworkManagerInfoDbus.c:
- Use the more aptly-named path/service/interface constants from NetworkManager
- Don't return empty strings ("") as object paths ever, instead return errors
* panel-applet/NMWirelessApplet.c:
- Clean up Seth's code style
* src/NetworkManager.[ch]
- (nm_remove_device_from_list): remove anything having to do with pending_device
- (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon
* src/NetworkManagerAPList.[ch]
- Move Iter struct right above the iter functions to preserve opacity
- (nm_ap_list_remove_ap): implement
- (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(),
remove AP if NetworkManagerInfo doesn't know anything about it
- (nm_ap_list_diff): user NMAPList iterators
- (nm_ap_list_print_members): implement debugging function
* src/NetworkManagerDbus.[ch]
- (nm_dbus_nm_get_active_device): remove anything to do with pending_device
- (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused),
and move the actual key setting stuff into NetworkManagerDevice.c
- (nm_dbus_get_network_priority): return -1 now on errors
- (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to
get lost, and force the active device to update its "best" ap when AP lists change
- (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status"
method call due to pending_device member removal
* src/NetworkManagerDevice.[ch]
- Move NMDevice structure to the top
- Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure
- Remove Pending Action stuff from everywhere
- (nm_device_activation_*): We now "begin" activation and start a thread to do the
activation for us. This thread blocks until all conditions for activation have
been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and
then setup up the interface and runs dhclient. We have to do this because there
is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot
run our main loop and respond to dbus method calls or HAL device removals/inserts
- (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we
can tell nm_device_activation_worker() that we've got a key
- (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure
- (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when
diffing (AP appear/disappear signal functions make sure the AP is actually in the device's
list)
- (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here
* src/NetworkManagerPolicy.c
- Remove anything to do with pending_device
- Adjust device activation to deal with activation-in-worker-thread
* src/NetworkManagerUtils.c
- Clean up locking debugging a bit
* src/NetworkManagerWireless.[ch]
- (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function
was badly named and is better as a device function
* panel-applet/.cvsignore: add
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
|
|
|
return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
2004-07-25 02:40:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_devices_handle_networks_request
|
|
|
|
|
*
|
|
|
|
|
* Converts a property request on a _network_ into a dbus message.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static DBusMessage *nm_dbus_devices_handle_networks_request (DBusConnection *connection, DBusMessage *message,
|
2004-07-25 02:40:19 +00:00
|
|
|
NMData *data, const char *path, const char *request, NMDevice *dev)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
|
|
|
|
NMAccessPoint *ap;
|
|
|
|
|
DBusMessage *reply_message = NULL;
|
|
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
g_return_val_if_fail (data != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (connection != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (message != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (request != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (dev != NULL, NULL);
|
|
|
|
|
|
2004-08-02 21:12:40 +00:00
|
|
|
if (!(ap = nm_dbus_get_ap_from_object_path (path, dev)))
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-06 18:19:06 +00:00
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "NetworkNotFound",
|
2004-06-24 14:18:37 +00:00
|
|
|
"The requested network does not exist for this device.");
|
|
|
|
|
return (reply_message);
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
if (!(reply_message = dbus_message_new_method_return (message)))
|
2004-07-25 02:40:19 +00:00
|
|
|
return (NULL);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
if (strcmp ("getName", request) == 0)
|
2004-07-27 16:15:36 +00:00
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, nm_ap_get_essid (ap), DBUS_TYPE_INVALID);
|
2004-06-24 14:18:37 +00:00
|
|
|
else if (strcmp ("getAddress", request) == 0)
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
{
|
|
|
|
|
char buf[20];
|
|
|
|
|
|
|
|
|
|
memset (&buf[0], 0, 20);
|
|
|
|
|
iw_ether_ntop((const struct ether_addr *) (nm_ap_get_address (ap)), &buf[0]);
|
2004-07-27 16:15:36 +00:00
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, &buf[0], DBUS_TYPE_INVALID);
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
}
|
2004-09-13 17:43:16 +00:00
|
|
|
else if (strcmp ("getStrength", request) == 0)
|
|
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_INT32, nm_ap_get_strength (ap), DBUS_TYPE_INVALID);
|
2004-06-24 14:18:37 +00:00
|
|
|
else if (strcmp ("getFrequency", request) == 0)
|
2004-07-27 16:15:36 +00:00
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_DOUBLE, nm_ap_get_freq (ap), DBUS_TYPE_INVALID);
|
2004-06-24 14:18:37 +00:00
|
|
|
else if (strcmp ("getRate", request) == 0)
|
2004-07-27 16:15:36 +00:00
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_INT32, nm_ap_get_rate (ap), DBUS_TYPE_INVALID);
|
2004-08-05 18:54:29 +00:00
|
|
|
else if (strcmp ("getEncrypted", request) == 0)
|
|
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_BOOLEAN, nm_ap_get_encrypted (ap), DBUS_TYPE_INVALID);
|
2004-12-17 22:08:09 +00:00
|
|
|
else if (strcmp ("getMode", request) == 0)
|
2005-01-12 18:40:04 +00:00
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_UINT32, nm_ap_get_mode (ap), DBUS_TYPE_INVALID);
|
2004-06-24 14:18:37 +00:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Must destroy the allocated message */
|
|
|
|
|
dbus_message_unref (reply_message);
|
|
|
|
|
|
2004-08-06 18:19:06 +00:00
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "UnknownMethod",
|
2004-06-24 14:18:37 +00:00
|
|
|
"NetworkManager knows nothing about the method %s for object %s", request, path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (reply_message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dbus_devices_handle_request
|
|
|
|
|
*
|
|
|
|
|
* Converts a property request into a dbus message.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2004-07-25 02:40:19 +00:00
|
|
|
static DBusMessage *nm_dbus_devices_handle_request (DBusConnection *connection, NMData *data, DBusMessage *message,
|
|
|
|
|
const char *path, const char *request)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
|
|
|
|
NMDevice *dev;
|
|
|
|
|
DBusMessage *reply_message = NULL;
|
|
|
|
|
char *object_path;
|
|
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
g_return_val_if_fail (data != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (connection != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (message != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (request != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
if (!(dev = nm_dbus_get_device_from_object_path (data, path)))
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-06 18:19:06 +00:00
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "DeviceNotFound",
|
2004-06-24 14:18:37 +00:00
|
|
|
"The requested network device does not exist.");
|
|
|
|
|
return (reply_message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Test whether or not the _networks_ of a device were queried instead of the device itself */
|
2004-08-06 18:19:06 +00:00
|
|
|
object_path = g_strdup_printf ("%s/%s/Networks/", NM_DBUS_PATH_DEVICES, nm_device_get_iface (dev));
|
2004-06-24 14:18:37 +00:00
|
|
|
if (strncmp (path, object_path, strlen (object_path)) == 0)
|
|
|
|
|
{
|
|
|
|
|
free (object_path);
|
2004-07-25 02:40:19 +00:00
|
|
|
reply_message = nm_dbus_devices_handle_networks_request (connection, message, data, path, request, dev);
|
2004-06-24 14:18:37 +00:00
|
|
|
return (reply_message);
|
|
|
|
|
}
|
|
|
|
|
free (object_path);
|
|
|
|
|
|
2004-07-27 16:15:36 +00:00
|
|
|
if (!(reply_message = dbus_message_new_method_return (message)))
|
2004-07-25 02:40:19 +00:00
|
|
|
return (NULL);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
if (strcmp ("getName", request) == 0)
|
2004-07-27 16:15:36 +00:00
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, nm_device_get_iface (dev), DBUS_TYPE_INVALID);
|
2004-06-24 14:18:37 +00:00
|
|
|
else if (strcmp ("getType", request) == 0)
|
2004-08-05 18:54:29 +00:00
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_INT32, nm_device_get_type (dev), DBUS_TYPE_INVALID);
|
2004-08-26 20:05:24 +00:00
|
|
|
else if (strcmp ("getHalUdi", request) == 0)
|
|
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, nm_device_get_udi (dev), DBUS_TYPE_INVALID);
|
2004-07-06 04:45:00 +00:00
|
|
|
else if (strcmp ("getIP4Address", request) == 0)
|
2004-07-27 16:15:36 +00:00
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_UINT32, nm_device_get_ip4_address (dev), DBUS_TYPE_INVALID);
|
2004-12-17 22:08:09 +00:00
|
|
|
else if (strcmp ("getMode", request) == 0)
|
|
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_UINT32, nm_device_get_mode (dev), DBUS_TYPE_INVALID);
|
2004-09-13 17:43:16 +00:00
|
|
|
else if (strcmp ("getStrength", request) == 0)
|
2004-09-09 21:34:40 +00:00
|
|
|
{
|
2004-09-13 17:43:16 +00:00
|
|
|
/* Only wireless devices have signal strength */
|
2004-09-09 21:34:40 +00:00
|
|
|
if (!nm_device_is_wireless (dev))
|
|
|
|
|
{
|
|
|
|
|
dbus_message_unref (reply_message);
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "DeviceNotWireless",
|
2004-09-13 17:43:16 +00:00
|
|
|
"Wired devices cannot have signal strength.");
|
2004-09-09 21:34:40 +00:00
|
|
|
return (reply_message);
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-13 17:43:16 +00:00
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_INT32, nm_device_get_signal_strength (dev), DBUS_TYPE_INVALID);
|
2004-09-09 21:34:40 +00:00
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
else if (strcmp ("getActiveNetwork", request) == 0)
|
|
|
|
|
{
|
2004-07-25 02:40:19 +00:00
|
|
|
NMAccessPoint *ap;
|
2004-08-05 18:54:29 +00:00
|
|
|
gboolean success = FALSE;
|
|
|
|
|
|
2004-08-09 15:10:46 +00:00
|
|
|
/* Only wireless devices have an active network */
|
|
|
|
|
if (!nm_device_is_wireless (dev))
|
|
|
|
|
{
|
|
|
|
|
dbus_message_unref (reply_message);
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "DeviceNotWireless",
|
|
|
|
|
"Wired devices cannot have active networks.");
|
|
|
|
|
return (reply_message);
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-09 20:02:59 +00:00
|
|
|
/* Return the network associated with the ESSID the card is currently associated with,
|
|
|
|
|
* if any, and only if that network is the "best" network.
|
|
|
|
|
*/
|
|
|
|
|
if ( (ap = nm_device_ap_list_get_ap_by_essid (dev, nm_device_get_essid (dev)))
|
|
|
|
|
&& (!nm_device_need_ap_switch (dev))
|
|
|
|
|
&& (object_path = nm_device_get_path_for_ap (dev, ap)))
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-09-09 20:02:59 +00:00
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, object_path, DBUS_TYPE_INVALID);
|
|
|
|
|
g_free (object_path);
|
|
|
|
|
success = TRUE;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
2004-08-05 18:54:29 +00:00
|
|
|
|
|
|
|
|
if (!success)
|
2004-08-09 15:10:46 +00:00
|
|
|
{
|
|
|
|
|
dbus_message_unref (reply_message);
|
|
|
|
|
return (nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "NoActiveNetwork",
|
|
|
|
|
"The device is not associated with any networks at this time."));
|
|
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
else if (strcmp ("getNetworks", request) == 0)
|
|
|
|
|
{
|
2004-07-27 16:15:36 +00:00
|
|
|
DBusMessageIter iter;
|
2004-06-24 14:18:37 +00:00
|
|
|
DBusMessageIter iter_array;
|
|
|
|
|
NMAccessPoint *ap = NULL;
|
2004-08-05 18:54:29 +00:00
|
|
|
gboolean success = FALSE;
|
|
|
|
|
NMAccessPointList *ap_list;
|
|
|
|
|
NMAPListIter *list_iter;
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-08-09 15:10:46 +00:00
|
|
|
/* Only wireless devices have networks */
|
|
|
|
|
if (!nm_device_is_wireless (dev))
|
|
|
|
|
{
|
|
|
|
|
dbus_message_unref (reply_message);
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "DeviceNotWireless",
|
|
|
|
|
"Wired devices cannot see wireless networks.");
|
|
|
|
|
return (reply_message);
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-27 16:15:36 +00:00
|
|
|
dbus_message_iter_init (reply_message, &iter);
|
2004-06-24 14:18:37 +00:00
|
|
|
dbus_message_iter_append_array (&iter, &iter_array, DBUS_TYPE_STRING);
|
2004-08-05 18:54:29 +00:00
|
|
|
|
|
|
|
|
if ((ap_list = nm_device_ap_list_get (dev)))
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-05 18:54:29 +00:00
|
|
|
if ((list_iter = nm_ap_list_iter_new (ap_list)))
|
|
|
|
|
{
|
|
|
|
|
while ((ap = nm_ap_list_iter_next (list_iter)))
|
|
|
|
|
{
|
2004-10-13 20:57:23 +00:00
|
|
|
if (nm_ap_get_essid (ap))
|
|
|
|
|
{
|
|
|
|
|
object_path = g_strdup_printf ("%s/%s/Networks/%s", NM_DBUS_PATH_DEVICES,
|
|
|
|
|
nm_device_get_iface (dev), nm_ap_get_essid (ap));
|
|
|
|
|
dbus_message_iter_append_string (&iter_array, object_path);
|
|
|
|
|
g_free (object_path);
|
|
|
|
|
success = TRUE;
|
|
|
|
|
}
|
2004-08-05 18:54:29 +00:00
|
|
|
}
|
|
|
|
|
nm_ap_list_iter_free (list_iter);
|
|
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
2004-08-05 18:54:29 +00:00
|
|
|
|
|
|
|
|
if (!success)
|
2004-08-09 15:10:46 +00:00
|
|
|
{
|
|
|
|
|
dbus_message_unref (reply_message);
|
2004-08-24 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerAP.[ch]
- Add a "enc_method_good" member and accessors to an Access Point
to signal when we've found the correct encryption method
for an access point
- Add a "timestamp" member and accessors, remove "priority" member
and accessors (use timestamps instead)
- Rename "wep_key"->"enc_key"
- (nm_ap_get_enc_key_hashed): new, return the correct mangled key
for a specified encryption method using the access points
source encryption key/passphrase
* src/NetworkManagerAPList.c
- When updating a network with dbus, grab timestamp now instead of
priority
* src/NetworkManagerDBus.[ch]
- Add signal for "DeviceActivating"
- Switch priority->timestamp
* src/NetworkManagerDevice.c
- Change references of "wep_key" -> "enc_key" or "key"
- Signal DeviceActivating when starting activation
- When activating a wireless device, if the access point we are connecting
to is encrypted, and we have a source key, try to generate a mangled
key and use that (ie, generate real WEP key from a passphrase)
- Rework device activation to fallback to other encryption methods if
a previous one didn't work (ie, try mangling a key as a 104-bit passphrase
first, then if that doesn't work fall back to direct hex key).
- (nm_device_update_best_ap): fix a deadlock, and use timestamps instead of
priority. We now prefer the latest access point used, rather than using
a priority scheme
- (nm_device_do_normal_scan): make the encryption method "unknown" on access
points we've just discovered, and merge in correct info from the global
access point lists
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@68 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-25 22:41:12 +00:00
|
|
|
return (nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "NoNetworks",
|
|
|
|
|
"The device cannot see any wireless networks."));
|
2004-08-09 15:10:46 +00:00
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
2004-08-31 Dan Williams <dcbw@redhat.com>
* Remove 'debug' extern global from all files since we now
use syslog()
* src/NetworkManager.[ch]
- Break out routine that get the net.interface property from HAL,
removing that logic from nm_create_device_and_add_to_list()
- (nm_create_device_and_add_to_list): make this a bit more general so
it doesn't do the talking to HAL. Also add arguments to facilitate
the create of test devices.
- (nm_data_mark_state_changed): rename from nm_data_set_state_modified()
- (nm_data_new, main, nm_print_usage): add new argument "--enable-test-devices"
which makes NetworkManager listen for dbus commands to create test
devices, which have no backing hardware. Use when you're on a plane
for example, and/or forgot your wireless card at home. Test devices
_cannot_ be created unless NM is started with --enable-test-devices.
* src/NetworkManagerDbus.[ch]
- New "getLinkActive" method for devices
- New "setLinkActive" method for devices (only works on test devices)
- New "createTestDevice" method on NetworkManager object to create a test
device of a specified type (ie wired, wireless). UDI is created from
scratch, as is the interface name. Only works when NM is started with
--enable-test-devices switch.
- New "removeTestDevice" method on NetworkManager object which removes a
test device. Only works when NM is started with --enable-test-devices
* src/NetworkManagerDevice.[ch]
- Logic to facilitate test devices. Add variables to NMDevice struct to indicate
whether a device is a test device or not, and what its link status is.
- Deal with test devices in most functions. For those that work directly on hardware
special-case test devices.
- (nm_device_new): don't create a test device if test devices weren't enabled on the
command-line.
- (nm_device_update_link_active): split out logic for wired and wireless device link
checking to separate functions to facilitate test device link checking.
- (nm_device_set_enc_key): Since some drivers for wireless cards are daft and
don't make a distinction between System Authentication and Encryption
(namely Cisco aironet), we use Open System auth when setting a WEP key
on the card. We don't deal with Shared Key auth yet.
- (nm_device_activation_worker): split the activation cancel check logic out into
a separate routine nm_device_activation_cancel_if_needed()
- (nm_device_activation_signal_cancel): rename from nm_device_activation_cancel()
- (nm_device_fake_ap_list): Test wireless devices obviously cannot scan, so create
a list of fake access points that they can "see"
- (nm_device_is_test_device): return whether or not a device is a test device
* src/NetworkManagerPolicy.c
- (nm_policy_get_best_device): attempt to deal with wireless network selection,
previously if you "locked"/forced NM to use a wireless device but then
selected a wireless network for NM to use, it would switch to a wired device.
So, if the active device is wireless and it has a "forced" best AP, use it
if the "forced" best AP is still valid
- (nm_state_modification_monitor): deal with NULL best devices, for example
there were no usable network devices, or the last one was removed
* src/backends/NetworkManager*.c
- Deal with test devices, mostly just return success for operations like getting
a DHCP address
* test/nmtestdevices.c
- Test tool to create/remove/link-switch test devices
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@112 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-31 16:09:15 +00:00
|
|
|
else if (strcmp ("getLinkActive", request) == 0)
|
|
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_BOOLEAN, nm_device_get_link_active (dev), DBUS_TYPE_INVALID);
|
|
|
|
|
else if (strcmp ("setLinkActive", request) == 0)
|
|
|
|
|
{
|
|
|
|
|
/* Can only set link status for active devices */
|
|
|
|
|
if (nm_device_is_test_device (dev))
|
|
|
|
|
{
|
|
|
|
|
DBusError error;
|
|
|
|
|
gboolean link;
|
|
|
|
|
|
|
|
|
|
dbus_error_init (&error);
|
|
|
|
|
if (dbus_message_get_args (message, &error, DBUS_TYPE_BOOLEAN, &link, DBUS_TYPE_INVALID))
|
|
|
|
|
{
|
|
|
|
|
nm_device_set_link_active (dev, link);
|
2005-01-21 19:32:08 +00:00
|
|
|
nm_policy_schedule_state_update (data);
|
2004-08-31 Dan Williams <dcbw@redhat.com>
* Remove 'debug' extern global from all files since we now
use syslog()
* src/NetworkManager.[ch]
- Break out routine that get the net.interface property from HAL,
removing that logic from nm_create_device_and_add_to_list()
- (nm_create_device_and_add_to_list): make this a bit more general so
it doesn't do the talking to HAL. Also add arguments to facilitate
the create of test devices.
- (nm_data_mark_state_changed): rename from nm_data_set_state_modified()
- (nm_data_new, main, nm_print_usage): add new argument "--enable-test-devices"
which makes NetworkManager listen for dbus commands to create test
devices, which have no backing hardware. Use when you're on a plane
for example, and/or forgot your wireless card at home. Test devices
_cannot_ be created unless NM is started with --enable-test-devices.
* src/NetworkManagerDbus.[ch]
- New "getLinkActive" method for devices
- New "setLinkActive" method for devices (only works on test devices)
- New "createTestDevice" method on NetworkManager object to create a test
device of a specified type (ie wired, wireless). UDI is created from
scratch, as is the interface name. Only works when NM is started with
--enable-test-devices switch.
- New "removeTestDevice" method on NetworkManager object which removes a
test device. Only works when NM is started with --enable-test-devices
* src/NetworkManagerDevice.[ch]
- Logic to facilitate test devices. Add variables to NMDevice struct to indicate
whether a device is a test device or not, and what its link status is.
- Deal with test devices in most functions. For those that work directly on hardware
special-case test devices.
- (nm_device_new): don't create a test device if test devices weren't enabled on the
command-line.
- (nm_device_update_link_active): split out logic for wired and wireless device link
checking to separate functions to facilitate test device link checking.
- (nm_device_set_enc_key): Since some drivers for wireless cards are daft and
don't make a distinction between System Authentication and Encryption
(namely Cisco aironet), we use Open System auth when setting a WEP key
on the card. We don't deal with Shared Key auth yet.
- (nm_device_activation_worker): split the activation cancel check logic out into
a separate routine nm_device_activation_cancel_if_needed()
- (nm_device_activation_signal_cancel): rename from nm_device_activation_cancel()
- (nm_device_fake_ap_list): Test wireless devices obviously cannot scan, so create
a list of fake access points that they can "see"
- (nm_device_is_test_device): return whether or not a device is a test device
* src/NetworkManagerPolicy.c
- (nm_policy_get_best_device): attempt to deal with wireless network selection,
previously if you "locked"/forced NM to use a wireless device but then
selected a wireless network for NM to use, it would switch to a wired device.
So, if the active device is wireless and it has a "forced" best AP, use it
if the "forced" best AP is still valid
- (nm_state_modification_monitor): deal with NULL best devices, for example
there were no usable network devices, or the last one was removed
* src/backends/NetworkManager*.c
- Deal with test devices, mostly just return success for operations like getting
a DHCP address
* test/nmtestdevices.c
- Test tool to create/remove/link-switch test devices
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@112 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-31 16:09:15 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "NotTestDevice",
|
|
|
|
|
"Only test devices can have their link status set manually.");
|
|
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Must destroy the allocated message */
|
|
|
|
|
dbus_message_unref (reply_message);
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
reply_message = NULL;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (reply_message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dbus_nm_message_handler
|
|
|
|
|
*
|
|
|
|
|
* Dispatch messages against our NetworkManager object
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static DBusHandlerResult nm_dbus_nm_message_handler (DBusConnection *connection, DBusMessage *message, void *user_data)
|
|
|
|
|
{
|
2004-07-25 02:40:19 +00:00
|
|
|
NMData *data = (NMData *)user_data;
|
2004-06-24 14:18:37 +00:00
|
|
|
const char *method;
|
|
|
|
|
const char *path;
|
|
|
|
|
DBusMessage *reply_message = NULL;
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
gboolean handled = TRUE;
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
g_return_val_if_fail (data != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
|
|
|
g_return_val_if_fail (connection != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
|
|
|
g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
method = dbus_message_get_member (message);
|
|
|
|
|
path = dbus_message_get_path (message);
|
|
|
|
|
|
2004-08-29 Colin Walters <walters@verbum.org>
* test/nminfotest.c: Include string.h and stdlib.h.
(get_network_string_property, get_networks_of_type): Return NULL.
* test/nmclienttest.c (get_device_name, get_active_device): Return
NULL.
* src/backends/NetworkManagerRedHat.c (nm_system_device_stop_dhcp): Just
use strlen, fgets always NULL-terminates the string.
* src/NetworkManagerDbus.c (nm_dbus_nmi_filter,
dbus_message_get_member): Remove /* in comment.
* src/NetworkManagerUtils.c (LOCKING_DEBUG): Ditto.
* src/NetworkManager.c (quit): Unused, delete.
(nm_data_free): Cast arg to GFunc.
* panel-applet/NMWirelessAppletDbus.c: Need to include
string.h, and dbus-glib-lowlevel.h (the latter is needed
for dbus_connection_setup_with_g_main at present).
(nmwa_dbus_update_wireless_network_list): Parenthesize
assignment in conditional.
(nmwa_dbus_worker): Return NULL.
* panel-applet/NMWirelessApplet.c (nmwa_redraw)
(nmwa_get_menu_pos, nmwa_toplevel_menu_activate)
(nmwa_menu_add_text_item, nmwa_setup_widgets): Kill unused variables.
(nmwa_populate_menu): Return NULL on failure, instead of just
return;
* initscript/NMLaunchHelper.c (g_timeout_add): Cast arg to GSourceFunc.
* info-daemon/NetworkManagerInfoNetworksDialog.c (nmi_networks_dialog_init): Kill unused
variables.
* info-daemon/NetworkManagerInfo.c (nmi_print_usage): Unused,
delete.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@105 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-29 06:06:51 +00:00
|
|
|
/* syslog (LOG_DEBUG, "nm_dbus_nm_message_handler() got method %s for path %s", method, path); */
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
if (strcmp ("getActiveDevice", method) == 0)
|
2004-07-25 02:40:19 +00:00
|
|
|
reply_message = nm_dbus_nm_get_active_device (connection, message, data);
|
2004-06-24 14:18:37 +00:00
|
|
|
else if (strcmp ("getDevices", method) == 0)
|
2004-07-25 02:40:19 +00:00
|
|
|
reply_message = nm_dbus_nm_get_devices (connection, message, data);
|
2004-08-26 20:05:24 +00:00
|
|
|
else if (strcmp ("setActiveDevice", method) == 0)
|
|
|
|
|
nm_dbus_nm_set_active_device (connection, message, data);
|
2004-12-17 17:16:22 +00:00
|
|
|
else if (strcmp ("createWirelessNetwork", method) == 0)
|
|
|
|
|
nm_dbus_nm_create_wireless_network (connection, message, data);
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
else if (strcmp ("setKeyForNetwork", method) == 0)
|
2004-07-25 02:40:19 +00:00
|
|
|
nm_dbus_set_user_key_for_network (connection, message, data);
|
2004-08-06 18:19:06 +00:00
|
|
|
else if (strcmp ("status", method) == 0)
|
|
|
|
|
{
|
2004-10-14 20:31:35 +00:00
|
|
|
char *status = nm_dbus_network_status_from_data (data);
|
|
|
|
|
if (status && (reply_message = dbus_message_new_method_return (message)))
|
|
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, status, DBUS_TYPE_INVALID);
|
|
|
|
|
g_free (status);
|
2004-08-06 18:19:06 +00:00
|
|
|
}
|
2004-08-31 Dan Williams <dcbw@redhat.com>
* Remove 'debug' extern global from all files since we now
use syslog()
* src/NetworkManager.[ch]
- Break out routine that get the net.interface property from HAL,
removing that logic from nm_create_device_and_add_to_list()
- (nm_create_device_and_add_to_list): make this a bit more general so
it doesn't do the talking to HAL. Also add arguments to facilitate
the create of test devices.
- (nm_data_mark_state_changed): rename from nm_data_set_state_modified()
- (nm_data_new, main, nm_print_usage): add new argument "--enable-test-devices"
which makes NetworkManager listen for dbus commands to create test
devices, which have no backing hardware. Use when you're on a plane
for example, and/or forgot your wireless card at home. Test devices
_cannot_ be created unless NM is started with --enable-test-devices.
* src/NetworkManagerDbus.[ch]
- New "getLinkActive" method for devices
- New "setLinkActive" method for devices (only works on test devices)
- New "createTestDevice" method on NetworkManager object to create a test
device of a specified type (ie wired, wireless). UDI is created from
scratch, as is the interface name. Only works when NM is started with
--enable-test-devices switch.
- New "removeTestDevice" method on NetworkManager object which removes a
test device. Only works when NM is started with --enable-test-devices
* src/NetworkManagerDevice.[ch]
- Logic to facilitate test devices. Add variables to NMDevice struct to indicate
whether a device is a test device or not, and what its link status is.
- Deal with test devices in most functions. For those that work directly on hardware
special-case test devices.
- (nm_device_new): don't create a test device if test devices weren't enabled on the
command-line.
- (nm_device_update_link_active): split out logic for wired and wireless device link
checking to separate functions to facilitate test device link checking.
- (nm_device_set_enc_key): Since some drivers for wireless cards are daft and
don't make a distinction between System Authentication and Encryption
(namely Cisco aironet), we use Open System auth when setting a WEP key
on the card. We don't deal with Shared Key auth yet.
- (nm_device_activation_worker): split the activation cancel check logic out into
a separate routine nm_device_activation_cancel_if_needed()
- (nm_device_activation_signal_cancel): rename from nm_device_activation_cancel()
- (nm_device_fake_ap_list): Test wireless devices obviously cannot scan, so create
a list of fake access points that they can "see"
- (nm_device_is_test_device): return whether or not a device is a test device
* src/NetworkManagerPolicy.c
- (nm_policy_get_best_device): attempt to deal with wireless network selection,
previously if you "locked"/forced NM to use a wireless device but then
selected a wireless network for NM to use, it would switch to a wired device.
So, if the active device is wireless and it has a "forced" best AP, use it
if the "forced" best AP is still valid
- (nm_state_modification_monitor): deal with NULL best devices, for example
there were no usable network devices, or the last one was removed
* src/backends/NetworkManager*.c
- Deal with test devices, mostly just return success for operations like getting
a DHCP address
* test/nmtestdevices.c
- Test tool to create/remove/link-switch test devices
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@112 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-31 16:09:15 +00:00
|
|
|
else if (strcmp ("createTestDevice", method) == 0)
|
|
|
|
|
{
|
|
|
|
|
DBusError error;
|
|
|
|
|
NMDeviceType type;
|
|
|
|
|
|
|
|
|
|
dbus_error_init (&error);
|
|
|
|
|
if ( dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &type, DBUS_TYPE_INVALID)
|
|
|
|
|
&& ((type == DEVICE_TYPE_WIRED_ETHERNET) || (type == DEVICE_TYPE_WIRELESS_ETHERNET)))
|
|
|
|
|
{
|
|
|
|
|
char *interface = g_strdup_printf ("test%d", test_dev_num);
|
|
|
|
|
char *udi = g_strdup_printf ("/test-devices/%s", interface);
|
|
|
|
|
NMDevice *dev = NULL;
|
|
|
|
|
|
|
|
|
|
dev = nm_create_device_and_add_to_list (data, udi, interface, TRUE, type);
|
|
|
|
|
test_dev_num++;
|
|
|
|
|
if ((reply_message = dbus_message_new_method_return (message)))
|
|
|
|
|
{
|
|
|
|
|
char *dev_path = g_strdup_printf ("%s/%s", NM_DBUS_PATH_DEVICES, nm_device_get_iface (dev));
|
|
|
|
|
dbus_message_append_args (reply_message, DBUS_TYPE_STRING, dev_path, DBUS_TYPE_INVALID);
|
|
|
|
|
g_free (dev_path);
|
|
|
|
|
}
|
|
|
|
|
g_free (interface);
|
|
|
|
|
g_free (udi);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "BadType",
|
|
|
|
|
"The test device type was invalid.");
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp ("removeTestDevice", method) == 0)
|
|
|
|
|
{
|
|
|
|
|
DBusError error;
|
|
|
|
|
char *dev_path;
|
|
|
|
|
|
|
|
|
|
dbus_error_init (&error);
|
|
|
|
|
if (dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &dev_path, DBUS_TYPE_INVALID))
|
|
|
|
|
{
|
|
|
|
|
NMDevice *dev;
|
|
|
|
|
|
|
|
|
|
if ((dev = nm_dbus_get_device_from_object_path (data, dev_path)))
|
|
|
|
|
{
|
|
|
|
|
if (nm_device_is_test_device (dev))
|
|
|
|
|
nm_remove_device_from_list (data, nm_device_get_udi (dev));
|
|
|
|
|
else
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "NotTestDevice",
|
|
|
|
|
"Only test devices can be removed via dbus calls.");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "DeviceNotFound",
|
|
|
|
|
"The requested network device does not exist.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "DeviceBad",
|
|
|
|
|
"The device ID was bad.");
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
else
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
handled = FALSE;
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
if (reply_message)
|
|
|
|
|
{
|
|
|
|
|
dbus_connection_send (connection, reply_message, NULL);
|
|
|
|
|
dbus_message_unref (reply_message);
|
|
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dbus_nm_unregister_handler
|
|
|
|
|
*
|
|
|
|
|
* Nothing happens here.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void nm_dbus_nm_unregister_handler (DBusConnection *connection, void *user_data)
|
|
|
|
|
{
|
|
|
|
|
/* do nothing */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dbus_devices_message_handler
|
|
|
|
|
*
|
|
|
|
|
* Dispatch messages against individual network devices
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static DBusHandlerResult nm_dbus_devices_message_handler (DBusConnection *connection, DBusMessage *message, void *user_data)
|
|
|
|
|
{
|
2004-07-25 02:40:19 +00:00
|
|
|
NMData *data = (NMData *)user_data;
|
|
|
|
|
gboolean handled = FALSE;
|
2004-06-24 14:18:37 +00:00
|
|
|
const char *method;
|
|
|
|
|
const char *path;
|
|
|
|
|
DBusMessage *reply_message = NULL;
|
|
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
g_return_val_if_fail (data != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
|
|
|
g_return_val_if_fail (connection != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
|
|
|
g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
method = dbus_message_get_member (message);
|
|
|
|
|
path = dbus_message_get_path (message);
|
|
|
|
|
|
2004-08-23 19:20:49 +00:00
|
|
|
/*syslog (LOG_DEBUG, "nm_dbus_devices_message_handler() got method %s for path %s", method, path);*/
|
2004-08-05 18:54:29 +00:00
|
|
|
|
2004-10-14 20:31:35 +00:00
|
|
|
if (method && path && (reply_message = nm_dbus_devices_handle_request (connection, data, message, path, method)))
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
{
|
|
|
|
|
dbus_connection_send (connection, reply_message, NULL);
|
|
|
|
|
dbus_message_unref (reply_message);
|
2004-07-25 02:40:19 +00:00
|
|
|
handled = TRUE;
|
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-19 06:08:52 +00:00
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dbus_devices_unregister_handler
|
|
|
|
|
*
|
|
|
|
|
* Nothing happens here.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void nm_dbus_devices_unregister_handler (DBusConnection *connection, void *user_data)
|
|
|
|
|
{
|
|
|
|
|
/* do nothing */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-08-06 18:19:06 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_is_info_daemon_running
|
|
|
|
|
*
|
|
|
|
|
* Ask dbus whether or not the info daemon is providing its dbus service
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
gboolean nm_dbus_is_info_daemon_running (DBusConnection *connection)
|
|
|
|
|
{
|
|
|
|
|
DBusError error;
|
2004-09-12 04:48:22 +00:00
|
|
|
gboolean running = FALSE;
|
2004-08-06 18:19:06 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (connection != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
dbus_error_init (&error);
|
2004-09-12 04:48:22 +00:00
|
|
|
running = dbus_bus_service_exists (connection, NMI_DBUS_SERVICE, &error);
|
|
|
|
|
if (dbus_error_is_set (&error))
|
|
|
|
|
dbus_error_free (&error);
|
|
|
|
|
return (running);
|
2004-08-06 18:19:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dbus_init
|
|
|
|
|
*
|
|
|
|
|
* Connect to the system messagebus and register ourselves as a service.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2004-07-25 02:40:19 +00:00
|
|
|
DBusConnection *nm_dbus_init (NMData *data)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
|
|
|
|
DBusError dbus_error;
|
|
|
|
|
dbus_bool_t success;
|
2004-07-25 02:40:19 +00:00
|
|
|
DBusConnection *connection;
|
2004-06-24 14:18:37 +00:00
|
|
|
DBusObjectPathVTable nm_vtable = { &nm_dbus_nm_unregister_handler, &nm_dbus_nm_message_handler, NULL, NULL, NULL, NULL };
|
|
|
|
|
DBusObjectPathVTable devices_vtable = { &nm_dbus_devices_unregister_handler, &nm_dbus_devices_message_handler, NULL, NULL, NULL, NULL };
|
|
|
|
|
|
|
|
|
|
dbus_connection_set_change_sigpipe (TRUE);
|
|
|
|
|
|
|
|
|
|
dbus_error_init (&dbus_error);
|
2004-07-25 02:40:19 +00:00
|
|
|
connection = dbus_bus_get (DBUS_BUS_SYSTEM, &dbus_error);
|
2004-09-12 15:39:05 +00:00
|
|
|
if ((connection == NULL) || dbus_error_is_set (&dbus_error))
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_ERR, "nm_dbus_init() could not get the system bus. Make sure the message bus daemon is running?");
|
2004-09-12 15:39:05 +00:00
|
|
|
if (dbus_error_is_set (&dbus_error))
|
|
|
|
|
dbus_error_free (&dbus_error);
|
2004-06-24 14:18:37 +00:00
|
|
|
return (NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
dbus_connection_set_exit_on_disconnect (connection, FALSE);
|
2004-12-05 21:28:42 +00:00
|
|
|
dbus_connection_setup_with_g_main (connection, data->main_context);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-08-06 18:19:06 +00:00
|
|
|
success = dbus_connection_register_object_path (connection, NM_DBUS_PATH, &nm_vtable, data);
|
2004-06-24 14:18:37 +00:00
|
|
|
if (!success)
|
|
|
|
|
{
|
2004-10-13 20:57:23 +00:00
|
|
|
syslog (LOG_CRIT, "nm_dbus_init() could not register a handler for NetworkManager. Not enough memory?");
|
2004-06-24 14:18:37 +00:00
|
|
|
return (NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-06 18:19:06 +00:00
|
|
|
success = dbus_connection_register_fallback (connection, NM_DBUS_PATH_DEVICES, &devices_vtable, data);
|
2004-06-24 14:18:37 +00:00
|
|
|
if (!success)
|
|
|
|
|
{
|
2004-10-13 20:57:23 +00:00
|
|
|
syslog (LOG_CRIT, "nm_dbus_init() could not register a handler for NetworkManager devices. Not enough memory?");
|
2004-06-24 14:18:37 +00:00
|
|
|
return (NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
if (!dbus_connection_add_filter (connection, nm_dbus_nmi_filter, data, NULL))
|
2004-10-13 20:57:23 +00:00
|
|
|
{
|
|
|
|
|
syslog (LOG_CRIT, "nm_dbus_init() could not attach a dbus message filter. The NetworkManager dbus security policy may not be loaded. Restart dbus?");
|
2004-07-25 02:40:19 +00:00
|
|
|
return (NULL);
|
2004-10-13 20:57:23 +00:00
|
|
|
}
|
2004-07-25 02:40:19 +00:00
|
|
|
|
|
|
|
|
dbus_bus_add_match (connection,
|
|
|
|
|
"type='signal',"
|
2004-08-06 18:19:06 +00:00
|
|
|
"interface='" NMI_DBUS_INTERFACE "',"
|
|
|
|
|
"sender='" NMI_DBUS_SERVICE "',"
|
|
|
|
|
"path='" NMI_DBUS_PATH "'",
|
|
|
|
|
&dbus_error);
|
2004-09-12 15:39:05 +00:00
|
|
|
dbus_error_free (&dbus_error);
|
2004-08-06 18:19:06 +00:00
|
|
|
|
|
|
|
|
dbus_bus_add_match(connection,
|
|
|
|
|
"type='signal',"
|
|
|
|
|
"interface='" DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS "',"
|
|
|
|
|
"sender='" DBUS_SERVICE_ORG_FREEDESKTOP_DBUS "'",
|
|
|
|
|
&dbus_error);
|
2004-09-12 15:39:05 +00:00
|
|
|
dbus_error_free (&dbus_error);
|
2004-07-25 02:40:19 +00:00
|
|
|
|
2004-08-06 20:24:53 +00:00
|
|
|
dbus_bus_acquire_service (connection, NM_DBUS_SERVICE, 0, &dbus_error);
|
|
|
|
|
if (dbus_error_is_set (&dbus_error))
|
|
|
|
|
{
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog (LOG_ERR, "nm_dbus_init() could not acquire its service. dbus_bus_acquire_service() says: '%s'", dbus_error.message);
|
2004-09-12 15:39:05 +00:00
|
|
|
dbus_error_free (&dbus_error);
|
2004-08-06 20:24:53 +00:00
|
|
|
return (NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-25 02:40:19 +00:00
|
|
|
return (connection);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|