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 "NetworkManagerAP.h"
|
|
|
|
|
#include "NetworkManagerUtils.h"
|
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
|
|
|
#include "NetworkManagerWireless.h"
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
extern gboolean debug;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Encapsulates Access Point information
|
|
|
|
|
*/
|
|
|
|
|
struct NMAccessPoint
|
|
|
|
|
{
|
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
|
|
|
guint refcount;
|
|
|
|
|
gchar *essid;
|
|
|
|
|
struct ether_addr *address;
|
|
|
|
|
guint8 quality;
|
|
|
|
|
double freq;
|
|
|
|
|
guint16 rate;
|
|
|
|
|
gboolean encrypted;
|
2004-07-28 02:49:33 +00:00
|
|
|
gboolean invalid;
|
2004-08-02 21:12:40 +00:00
|
|
|
NMAPEncMethod enc_method;
|
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
|
|
|
gboolean enc_method_good;
|
2004-08-02 21:12:40 +00:00
|
|
|
gboolean matched; // used in ap list diffing
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
/* Things from user prefs */
|
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
|
|
|
gchar *enc_key;
|
2004-08-29 05:40:32 +00:00
|
|
|
GTimeVal timestamp;
|
2004-06-24 14:18:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_ap_new
|
|
|
|
|
*
|
|
|
|
|
* Create a new, blank user access point info structure
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
NMAccessPoint * nm_ap_new (void)
|
|
|
|
|
{
|
|
|
|
|
NMAccessPoint *ap;
|
|
|
|
|
|
|
|
|
|
ap = g_new0 (NMAccessPoint, 1);
|
|
|
|
|
if (!ap)
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog( LOG_ERR, "nm_ap_new() could not allocate a new user access point info structure. Not enough memory?" );
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
ap->refcount = 1;
|
|
|
|
|
|
|
|
|
|
return (ap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_ap_new_from_ap
|
|
|
|
|
*
|
|
|
|
|
* Create a new user access point info structure, duplicating an existing one
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
NMAccessPoint * nm_ap_new_from_ap (NMAccessPoint *src_ap)
|
|
|
|
|
{
|
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
|
|
|
NMAccessPoint *new_ap;
|
|
|
|
|
struct ether_addr *new_addr;
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (src_ap != NULL, NULL);
|
|
|
|
|
|
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
|
|
|
new_addr = g_new0 (struct ether_addr, 1);
|
|
|
|
|
g_return_val_if_fail (new_addr != NULL, NULL);
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
new_ap = nm_ap_new();
|
|
|
|
|
if (!new_ap)
|
2004-08-23 19:20:49 +00:00
|
|
|
syslog( LOG_ERR, "nm_ap_new_from_uap() could not allocate a new user access point info structure. Not enough memory?" );
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
new_ap->refcount = 1;
|
|
|
|
|
|
|
|
|
|
if (src_ap->essid && (strlen (src_ap->essid) > 0))
|
|
|
|
|
new_ap->essid = g_strdup (src_ap->essid);
|
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 (src_ap->address)
|
|
|
|
|
{
|
|
|
|
|
memcpy (new_addr, src_ap->address, sizeof (struct ether_addr));
|
|
|
|
|
new_ap->address = new_addr;
|
|
|
|
|
}
|
2004-06-24 14:18:37 +00:00
|
|
|
new_ap->quality = src_ap->quality;
|
|
|
|
|
new_ap->freq = src_ap->freq;
|
|
|
|
|
new_ap->rate = src_ap->rate;
|
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
|
|
|
new_ap->encrypted = src_ap->encrypted;
|
2004-06-24 14:18:37 +00:00
|
|
|
|
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
|
|
|
if (src_ap->enc_key && (strlen (src_ap->enc_key) > 0))
|
|
|
|
|
new_ap->enc_key = g_strdup (src_ap->enc_key);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
return (new_ap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* AP refcounting functions
|
|
|
|
|
*/
|
|
|
|
|
void nm_ap_ref (NMAccessPoint *ap)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
|
|
|
|
ap->refcount++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_unref (NMAccessPoint *ap)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
|
|
|
|
ap->refcount--;
|
|
|
|
|
if (ap->refcount == 0)
|
|
|
|
|
{
|
|
|
|
|
g_free (ap->essid);
|
|
|
|
|
g_free (ap->address);
|
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
|
|
|
g_free (ap->enc_key);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
ap->essid = NULL;
|
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
|
|
|
ap->enc_key = NULL;
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
g_free (ap);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
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
|
|
|
* Get/set functions for timestamp
|
2004-06-24 14:18:37 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2004-08-29 05:40:32 +00:00
|
|
|
const GTimeVal *nm_ap_get_timestamp (NMAccessPoint *ap)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (ap != NULL, 0);
|
|
|
|
|
|
2004-08-29 05:40:32 +00:00
|
|
|
return (&ap->timestamp);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-08-29 05:40:32 +00:00
|
|
|
void nm_ap_set_timestamp (NMAccessPoint *ap, const GTimeVal *timestamp)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
2004-08-29 05:40:32 +00:00
|
|
|
ap->timestamp = *timestamp;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Get/set functions for essid
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
gchar * nm_ap_get_essid (NMAccessPoint *ap)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (ap != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
return (ap->essid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_essid (NMAccessPoint *ap, gchar * essid)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
|
|
|
|
if (ap->essid)
|
|
|
|
|
g_free (ap->essid);
|
|
|
|
|
|
|
|
|
|
ap->essid = g_strdup (essid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
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
|
|
|
* Get/set functions for encryption key
|
2004-06-24 14:18:37 +00:00
|
|
|
*
|
|
|
|
|
*/
|
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
|
|
|
gchar * nm_ap_get_enc_key_source (NMAccessPoint *ap)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (ap != NULL, NULL);
|
|
|
|
|
|
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 (ap->enc_key);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
void nm_ap_set_enc_key_source (NMAccessPoint *ap, gchar * key)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
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
|
|
|
if (ap->enc_key)
|
|
|
|
|
g_free (ap->enc_key);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
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
|
|
|
ap->enc_key = g_strdup (key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gchar *nm_ap_get_enc_key_hashed (NMAccessPoint *ap, NMAPEncMethod method)
|
|
|
|
|
{
|
|
|
|
|
gchar *hashed = NULL;
|
|
|
|
|
char *source_key;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (ap != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
source_key = nm_ap_get_enc_key_source (ap);
|
|
|
|
|
switch (method)
|
|
|
|
|
{
|
|
|
|
|
case (NM_AP_ENC_METHOD_104_BIT_PASSPHRASE):
|
|
|
|
|
if (source_key)
|
|
|
|
|
hashed = nm_wireless_128bit_key_from_passphrase (source_key);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case (NM_AP_ENC_METHOD_40_BIT_PASSPHRASE):
|
|
|
|
|
case (NM_AP_ENC_METHOD_HEX_KEY):
|
|
|
|
|
case (NM_AP_ENC_METHOD_UNKNOWN):
|
|
|
|
|
if (source_key)
|
|
|
|
|
hashed = g_strdup (source_key);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
hashed = NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (hashed);
|
2004-06-24 14:18:37 +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
|
|
|
/*
|
|
|
|
|
* Get/set functions for encrypted flag
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
gboolean nm_ap_get_encrypted (NMAccessPoint *ap)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (ap != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
return (ap->encrypted);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_encrypted (NMAccessPoint *ap, gboolean encrypted)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
|
|
|
|
ap->encrypted = encrypted;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
/*
|
|
|
|
|
* Get/set functions for address
|
|
|
|
|
*
|
|
|
|
|
*/
|
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
|
|
|
struct ether_addr * nm_ap_get_address (NMAccessPoint *ap)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (ap != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
return (ap->address);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
void nm_ap_set_address (NMAccessPoint *ap, const struct ether_addr * addr)
|
2004-06-24 14:18:37 +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
|
|
|
struct ether_addr *new_addr;
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
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
|
|
|
new_addr = g_new0 (struct ether_addr, 1);
|
|
|
|
|
g_return_if_fail (new_addr != NULL);
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
if (ap->address)
|
|
|
|
|
g_free (ap->address);
|
|
|
|
|
|
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
|
|
|
memcpy (new_addr, addr, sizeof (struct ether_addr));
|
|
|
|
|
ap->address = new_addr;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Get/set functions for quality
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
guint8 nm_ap_get_quality (NMAccessPoint *ap)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (ap != NULL, 0);
|
|
|
|
|
|
|
|
|
|
return (ap->quality);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_quality (NMAccessPoint *ap, guint8 quality)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
|
|
|
|
ap->quality = quality;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Get/set functions for frequency
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
double nm_ap_get_freq (NMAccessPoint *ap)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (ap != NULL, 0);
|
|
|
|
|
|
|
|
|
|
return (ap->freq);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_freq (NMAccessPoint *ap, double freq)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
|
|
|
|
ap->freq = freq;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Get/set functions for rate
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
guint16 nm_ap_get_rate (NMAccessPoint *ap)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (ap != NULL, 0);
|
|
|
|
|
|
|
|
|
|
return (ap->rate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_rate (NMAccessPoint *ap, guint16 rate)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
|
|
|
|
ap->rate = rate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2004-07-28 02:49:33 +00:00
|
|
|
* Get/set functions for "invalid" access points, ie ones
|
|
|
|
|
* for which a user explicitly does not wish to connect to
|
|
|
|
|
* (by cancelling requests for WEP key, for example)
|
2004-06-24 14:18:37 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2004-07-28 02:49:33 +00:00
|
|
|
gboolean nm_ap_get_invalid (NMAccessPoint *ap)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-07-28 02:49:33 +00:00
|
|
|
g_return_val_if_fail (ap != NULL, TRUE);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2004-07-28 02:49:33 +00:00
|
|
|
return (ap->invalid);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-07-28 02:49:33 +00:00
|
|
|
void nm_ap_set_invalid (NMAccessPoint *ap, gboolean invalid)
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
2004-07-28 02:49:33 +00:00
|
|
|
ap->invalid = invalid;
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
2004-08-02 21:12:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Get/set functions for "matched", which is used by
|
|
|
|
|
* the ap list diffing functions to speed up the diff
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
gboolean nm_ap_get_matched (NMAccessPoint *ap)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (ap != NULL, TRUE);
|
|
|
|
|
|
|
|
|
|
return (ap->matched);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_matched (NMAccessPoint *ap, gboolean matched)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
|
|
|
|
ap->matched = matched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Get/set functions for encryption method
|
|
|
|
|
* Given some sort of passphrase/wep key from the user, we try it first
|
|
|
|
|
* as a 104-bit passphrase->key conversion, and fall back from there. These
|
|
|
|
|
* functions are meant to cache which fallback succeeds so we don't have to
|
|
|
|
|
* do it every time.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
NMAPEncMethod nm_ap_get_enc_method (NMAccessPoint *ap)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (ap != NULL, TRUE);
|
|
|
|
|
|
|
|
|
|
return (ap->enc_method);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_enc_method (NMAccessPoint *ap, NMAPEncMethod enc_method)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
|
|
|
|
ap->enc_method = enc_method;
|
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
|
|
|
|
|
|
|
|
/* By definition, if the encryption method is "unknown", it cannot be
|
|
|
|
|
* "firm" (that is, we know what method we need to use to talk to an ap)
|
|
|
|
|
*/
|
|
|
|
|
if (enc_method == NM_AP_ENC_METHOD_UNKNOWN)
|
|
|
|
|
ap->enc_method_good = FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean nm_ap_get_enc_method_good (NMAccessPoint *ap)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (ap != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
return (ap->enc_method_good);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_ap_set_enc_method_good (NMAccessPoint *ap, gboolean good)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
|
|
|
|
ap->enc_method_good = good;
|
2004-08-02 21:12:40 +00:00
|
|
|
}
|