interface_add() could get called from two places: by the wifi/eth
device class when activating (which if the supplicant isn't yet
running will D-Bus activate it) and from the NameOwnerChanged
handler for the wpa_supplicant dbus service smgr_running_cb().
So if the supplicant wasn't running, nm_supplicant_interface_new()
would call interface_add() to bring the supplicant to life via
activation, then go on and create priv->iface_proxy. When the
supplicant appeared and D-Bus sent the NameOwnerChanged,
smgr_running_cb() would also call interface_add(), creating a
second priv->iface_proxy. The first one got lost and lived after
its parent NMSupplicantInterface was killed, and could still
respond to signals over the bus.
Prevent that by adding another state, STARTING, that indicates
that we've already started talking to the supplicant. Also be
extra paranoid about disconnecting signal handlers on the proxy.
We only really need one state for the supplicant interface which
simplifies handling in the Wifi and Wired device classes quite a
bit. It also simplifies the supplicant interface class too.
One behavioral change in the device classes is not running the
supplicant interface state changes from an idle; we'll have to
see if that causes problems. ISTR long ago that processing the
state change signals directly caused some issues, but we've
significantly reworked somethings since then so we may be able
to get away with this now.
Move GObject stuff to the bottom to reduce prototype abuse and
remove unneeded prefixes from stuff that's private to the class
itself. We also don't need the 'supplicant-manager' or 'device'
properties since they weren't used anywhere.
Move GObject stuff to the bottom to reduce prototype abuse and
remove unneeded prefixes from stuff that's private to the class
itself. We also don't need the 'supplicant-manager' or 'device'
properties since they weren't used anywhere.
This has been around a long time, but is very hard to trigger. It appears
to happen mostly if the supplicant segfaults on resume but has been seen
in other cases as well.
For whatever reason, the DBusGProxy's refcount reaches 0 and the proxy gets
disposed of. That in turn disposes of all the pending calls that are
in-progress on the proxy. Since we give the pending calls a closure, that
closure (nm_supplicant_info_destroy) gets called when the pending calls
are destroyed. That closure unrefs the proxy again.
Since DBusGProxy doesn't have any protection in its dispose() handler
against re-entrant disposes (which is arguably a bug of the client)
we end up infinite looping in nm_supplicant_info_destroy().
Fix that by ensuring we return early if we detect that we are already
freeing the NMSupplicantInfo object, and thus don't try to dispose
of the proxy yet again.
With supplicant patches, this allows NM to figure out when the supplicant
is performing an unsolicited scan, and thus to not run periodic_update()
when the supplicant is scanning.
This fixes some of the causes of "roaming to none", especially in hidden
SSID networks. In those cases, after NM had requested a broadcast scan,
the hidden SSID AP would likely not show up in the scan results, leading
to the supplicant performing a specific SSID scan that NetworkManager
was unaware of. While that specific SSID scan was going on, NM could
run periodic_update() and pull the wrong frequency off the card,
leading to the "roaming to none" message when the associated AP with
the wrong frequency could not be found in the scan list.
* src/supplicant-manager/nm-supplicant-interface.c
(nm_supplicant_interface_disconnect): Don't increment the reference
count when disconnecting. The problem is on shutdown, when the replies
to these commands do not arrive before NM exits, resulting on never
calling supplicant interface's dispose(), which removes the interface
from supplicant.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4093 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* src/supplicant-manager/nm-supplicant-interface.c
- (request_scan_results, nm_supplicant_interface_dispose,
wpas_iface_query_scan_results): cleanup; scan_results_timeout is now
the id of the timeout, not a GSource
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3784 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Fix memory leaks.
* system-settings/src/nm-system-config-hal-manager.c (get_type_for_udi):
Free data returned from dbus method call.
* system-settings/src/nm-polkit-helpers.c (check_polkit_privileges):
dbus_g_method_get_sender() returns a duplicated string, free it
when done.
(check_polkit_privileges): Looks like policykit sometimes returns
error and non-null return value, don't leak errors in that case.
* system-settings/src/main.c (find_plugin): Don't leak existing
plugin names.
(load_stuff): Don't leak device list and list items.
(have_connection_for_device): Don't leak connection list.
* system-settings/plugins/keyfile/reader.c (read_one_setting_value):
Free the data received from g_keyfile_get_*.
* system-settings/plugins/ifcfg-suse/parser.c (READ_WEP_KEY): Free
the key when the security object is updated.
* src/supplicant-manager/nm-supplicant-interface.c (scan_results_cb):
Free data returned from dbus method call.
(iface_state_cb): Ditto.
(add_network_cb): Ditto.
(nm_supplicant_interface_add_cb): Don't make another copy of already
duplicated object path.
(nm_supplicant_interface_add_to_supplicant): Free the driver GValue
when done.
* src/supplicant-manager/nm-supplicant-config.c
(ADD_STRING_LIST_VAL): Fix a memory leak.
* src/nm-manager.c (free_get_settings_info): Free the allocated
memory slice.
(list_connections_cb): Free data returned from dbus method call.
(system_settings_get_unmanaged_devices_cb): Ditto.
* src/nm-device-802-11-wireless.c (device_cleanup): Free ssid.
* system-settings/plugins/ifcfg-suse/shvar.c (svCloseFile):
* system-settings/plugins/ifcfg-fedora/shvar.c (svCloseFile):
* src/backends/shvar.c (svCloseFile): Free the duplicated content
of the GList.
* libnm-util/nm-setting.c (nm_setting_from_hash): Free the constructor
arguments after the object is created.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3721 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* src/supplicant-manager/nm-supplicant-interface.c
- (blob_free): correctly free blob data after use
- (call_set_blobs): use the right D-Bus interfaace for setBlobs
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3018 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* src/supplicant-manager/nm-supplicant-config.h
src/supplicant-manager/nm-supplicant-config.c
- (nm_supplicant_config_init, nm_supplicant_config_finalize): add a hash
table to store blobs
- (nm_supplicant_config_add_blob): new function; add blob to internal
blob hash table
- (nm_supplicant_config_get_blobs): new function; get stored blobs
- (nm_supplicant_config_add_setting_wireless_security): handle
options that use certificates (ie, blobs)
* src/nm-device-802-11-wireless.c
- (build_supplicant_config): pass a UID (just use the connection path)
to the supplicant config as now required
* src/supplicant-manager/nm-supplicant-interface.c
- (add_network_cb, call_set_blobs, set_blobs_cb, call_set_network): if
there are any blobs to send to wpa_supplicant, send those first
before sending the network configuration
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2990 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Move ppp-manager over to dbus-glib. The big deal is that it was
the last piece of
code that used NM's own version of dbus signal handling and
custom dictionary
marshalling/unmarshalling. With this change, all that obsolete
code can disappear
and we get to maintain over 2000 lines less code.
* libnm-util/dbus-dict-helpers.c:
* libnm-util/dbus-dict-helpers.h: Remove.
* src/ppp-manager/nm-pppd-plugin.c: Convert it to use dbus-glib.
* src/ppp-manager/nm-pppd-plugin.xml: Implement.
* src/ppp-manager/nm-ppp-manager.c: Use dbus-glib instead of
* home-brewed dbus signal
handlers.
* src/nm-dbus-manager.c: Remove all the manual dbus signal
* handling.
* configure.in: Remove test/libnm-util/Makefile creation.
* test/Makefile.am: Remove libnm-util from SUBDIRS.
* test/libnm-util/: Remove the whole directory.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2965 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* src/supplicant-manager/nm-supplicant-interface.c
src/supplicant-manager/nm-supplicant-marshal.list
- (nm_supplicant_interface_class_init): fix stupid mistake, the
"connection-error" signal arguments should be STRING not CHAR
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2795 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* src/supplicant-manager/nm-supplicant-interface.c
- (interface_disconnect_done): don't try to dispose of the net proxy
when it may already have been disposed of
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2719 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* src/supplicant-manager/nm-supplicant-interface.c
- (try_remove_iface): new function, ask wpa_supplicant to remove
an interface
- (nm_supplicant_interface_dispose): call try_remove_iface() when
disposing of the NMSupplicantInterface. Otherwise weird stuff
happens on hotplug if wpa_supplicant doesn't tear down and readd
the interface internally
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2699 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Make NMDevice abstract class, remove almost all references to it's
subclasses (the last place gets removed with new policy manager). Add
NMDeviceInterface (which NMDevice implements) so that when we have
NMDevice exported over DBUS, there's a common NMDevice interface which
all instances have, plus there's a device specific interface for each
specific type.
Remove functions (nm_device_is_802_3_ethernet) and
(nm_device_is_802_11_wireless). There are already standard GObject macros
for type safe checks.
Use the updated supplican manager API.
* src/nm-device-interface.h:
* src/nm-device-interface.c:
* src/nm-call-store.h:
* src/nm-call-store.c: Implement.
* src/supplicant-manager/nm-supplicant-interface.c:
* src/supplicant-manager/nm-supplicant-interface.h:
* src/supplicant-manager/nm-supplicant-manager.c:
* src/supplicant-manager/nm-supplicant-manager.h:
- Remove all private data type references from public header files.
- Remove all references to other NM classes, this class is just a
proxy between wpa_supplicant and NM so it doesn't have to know
any internals.
- Convert to dbus-glib bindings.
- Type safe checks for public methods' arguments.
- Store pending DBUS call ids to NMCallStore.
* src/supplicant-manager/nm-supplicant-config.c:
- Store config values in a GHashTable instead of GSList.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2285 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Threading removal related cleanups:
- Use the glib default main context. Remove the device main context
member from NMDevice, and the main_context member from NMData. Change
all the idle and timeout scheduler functions to use plain
g_idle_add() and g_timeout_add().
- As a side-effect of the first change, nm_dbus_manager_get() no longer
takes an argument; fix that up too.
- Remove all locking, which is useless since we no longer use threads. For
example, nm_get_device_by_iface_locked() has been removed. The global
device list lock, the AP List lock, and all static locks in
NetworkManagerPolicy.c have been removed. The locking utility functions
in NetworkManagerUtils.c have also been removed.
- Other cleanups in spacing and code style
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2205 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Found by Bill Moss:
* src/supplicant-manager/nm-supplicant-interface.c
- (nm_supplicant_interface_disconnect): fix cleanup logic when
the supplicant interface wasn't already disconnected. Always
call removeNetwork and disconnect unless the supplicant interface
is in the DISCONNECTED or INACTIVE state.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2202 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Big wpa_supplicant + dbus update; need latest wpa_supplicant from CVS
plus a few other patches from wpa_supplicant bugzilla.
* src/Makefile.am
src/NetworkManagerPolicy.c
src/NetworkManagerUtils.c
src/NetworkManagerUtils.h
src/nm-ap-security-leap.c
src/nm-ap-security-wep.c
src/nm-ap-security-wpa-eap.c
src/nm-ap-security-wpa-psk.c
src/nm-ap-security.c
src/nm-ap-security.h
src/nm-device-802-11-wireless.c
src/nm-device-802-11-wireless.h
src/supplicant-manager/nm-supplicant-config.c
src/supplicant-manager/nm-supplicant-config.h
src/supplicant-manager/nm-supplicant-interface.c
src/supplicant-manager/nm-supplicant-interface.h
src/supplicant-manager/nm-supplicant-marshal.list
src/supplicant-manager/nm-supplicant-settings-verify.c
src/supplicant-manager/nm-supplicant-settings-verify.h
- Move all connection management and association handling to
wpa_supplicant over dbus, rather than spawning a private copy
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2192 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* src/supplicant-manager/nm-supplicant-interface.c
- (iface_state_cb, wpas_iface_get_state): new functions; query initial
wpa_supplicant interface state
- (nm_supplicant_interface_add_cb): query initial wpa_supplicant interface
state before transitioning to READY state
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2181 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* src/supplicant-manager/nm-supplicant-interface.c
- (nm_supplicant_interface_set_property): track signal handler ID
- (nm_supplicant_interface_dispose): remove signal handler on dispose
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2162 4912f4e0-d625-0410-9fb7-b9a5a253dbdc