Commit Graph

7207 Commits

Author SHA1 Message Date
Thomas Haller
28a6f11b2c bluez: use GDBus instead of dbus-glib in nm-bluez-device.c
Refactor nm-bluez-device.c to use GDBus both to connect to
BlueZ 4 and BlueZ 4.

Also remove the unused property RSSI.

Also prefix every logline with the dbus path of the device.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Thomas Haller
bf5a6ad443 bluez: enable both BlueZ4 and 5 and select it dynamically at runtime
NMBluezManager is now a proxy and only delegates to either
NMBluez4Manager or NMBluez5Manager. It detects the running BlueZ
version at runtime, and once it decides for one version, it cannot be
changed anymore as long NetworkManager is running.

This means, when switching from BlueZ4 to BlueZ5 or vice versa you have
to restart NetworkManager. This should be acceptable, because it is
not a common use case (most systems won't have both versions installed
anyway) and it greatly simplifies implementation.

Also note that NMBluez4Manager and NMBluez5Manager do not implement a
common interface. NMBluezManager delegates to the correct manager.
Having them share an common interface or base class would not simplify
the code, because NMBluezManager not only delegates, but it also acts as
a proxy until it is decided which BlueZ version is running. So, this
proxy-like behaviour would still be needed. The alternative would be to
merge the functionality of all three NMBluez*Manager classes into one.

This also removes the --enable-bluez4 configure switch, because both
versions are now always enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=709412

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Thomas Haller
3344ce9ff6 bluez: copy bluez-manager file for version 4 and 5
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Thomas Haller
ef8501096f bluez: rename BlueZ 4 adapter to make the BlueZ version explicit
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Thomas Haller
e8e8031676 bluez: support BlueZ 4 and 5 together in nm-bluez-device.c
Do no longer separate nm-bluez-device at compile time with the
WITH_BLUEZ4 preprocessor flag.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Thomas Haller
b3ec1587d3 bluez: rename variables in nm-bluez-common.h for BlueZ 4 vs. 5
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Thomas Haller
e46722b72b core: make callback argument in nm_settings_connection_commit_changes/_delete optional
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Dan Williams
6b8bf26b79 platform: don't treat unrecognized WiMAX devices as Ethernet
If the WiMAX plugin isn't installed, or the WiMAX device isn't
recognized, NetworkManager shouldn't treat the interface as
regular ethernet since the device requires specific setup to
be ready for IP configuration, which of course NetworkManager
can't do because the WiMAX plugin isn't loaded.  Ignore them
instead.
2013-10-18 11:28:01 -05:00
Jiří Klimeš
33f8218023 trivial: fix indentation in nm_manager_activate_connection() 2013-10-18 09:02:26 +02:00
Dan Williams
de45e49eb8 settings: document nm_settings_add_connection() 2013-10-17 13:04:37 -05:00
Dan Williams
1fe5c197d2 settings: clarify ownership of objects returned from plugin's add_connection() hook
Plugin owns the object and callers must reference it if they wish to use it outside
of the function they called "add" from.  Likewise, callers of the ConnectionProvider's
add_connection method must also reference the returned object if they wish to
continue using it.
2013-10-17 13:03:39 -05:00
Jiří Klimeš
fbf2ca9ec3 dhcp: don't crash when no DHCP client is available (rh #1015809)
Print a warning instead.

https://bugzilla.redhat.com/show_bug.cgi?id=1015809
2013-10-17 15:10:09 +02:00
Thomas Haller
bc092bcf44 core: announce device removal even for udev events with no ifindex property
Actually, this case should no longer happen, but just to be sure:
when a udev remove event without ifindex comes, get the ifindex from
the cache and announce the device removal.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-17 10:56:57 +02:00
Dan Winship
d59311b095 platform: fix srcdir != builddir build after last change 2013-10-16 13:44:54 -04:00
Dan Williams
473018d8b2 platform: detect non-mac80211 WiFi devices as WiFi (rh #1015598)
Before NMPlatform landed, the old NMManager code looked at either
DEVTYPE=wlan or asked the internal wifi utilities whether the
device was WiFi or not.  This got lost when moving to NMPlatform.

It turns out that only mac80211-based drivers set the DEVTYPE=wlan
flag in sysfs, while older WEXT, out-of-tree, and staging drivers
often do not (though they should).

To avoid breaking recognition of these crappy drivers that used
to work, re-add the wifi utils checks.
2013-10-16 12:35:37 -05:00
Dan Winship
79407f0c37 settings: normalize and verify connections on update
When a connection is updated (either by its plugin or via D-Bus), we
need to normalize and verify it before accepting the changes.
2013-10-16 13:27:23 -04:00
Jiří Klimeš
a6944e157b platform: fix getting "ifindex" for devices on 'remove' udev action
We have to get IFINDEX using g_udev_device_get_property() instead of
g_udev_device_get_sysfs_attr().

On removal the IFINDEX in sysfs may not be available - this didn't caused
problems because such an event was ignored. But sometimes the sysfs IFINDEX
in 'remove' action was present, but *wrong*. It contained IFINDEX of a newly
created device of the same name, and thus it triggered removal of the new
device instead of the old one.

Logs (grepped):
...
NetworkManager[30628]: <info> Auto-activating connection 'b1'.
NetworkManager[30628]: <debug> [1381930187.149545] [platform/nm-platform.c:1777] log_link(): signal: link added: bb (328)
NetworkManager[30628]: <debug> [1381930187.937222] [platform/nm-linux-platform.c:2568] handle_udev_event(): UDEV event: action 'add' subsys 'net' device 'bb' (328)
NetworkManager[30628]: <debug> [1381930187.937662] [platform/nm-platform.c:1777] log_link(): signal: link added: bb (328)
NetworkManager[30628]: <info> (bb): deactivating device (reason 'user-requested') [39]
NetworkManager[30628]: <debug> [1381930193.266097] [platform/nm-platform.c:397] nm_platform_link_delete(): link: deleting 'bb' (328)
NetworkManager[30628]: <debug> [1381930193.279324] [platform/nm-platform.c:1777] log_link(): signal: link removed: bb (328)
NetworkManager[30628]: <debug> [1381930193.348167] [platform/nm-linux-platform.c:2568] handle_udev_event(): UDEV event: action 'remove' subsys 'net' device 'bb' (unknown)
NetworkManager[30628]: <info> Auto-activating connection 'b1'.
NetworkManager[30628]: <debug> [1381930193.561106] [platform/nm-platform.c:1777] log_link(): signal: link added: bb (330)
NetworkManager[30628]: <debug> [1381930194.217300] [platform/nm-linux-platform.c:2568] handle_udev_event(): UDEV event: action 'add' subsys 'net' device 'bb' (330)
NetworkManager[30628]: <debug> [1381930194.217548] [platform/nm-platform.c:1777] log_link(): signal: link added: bb (330)
NetworkManager[30628]: <info> (bb): deactivating device (reason 'user-requested') [39]
NetworkManager[30628]: <debug> [1381930216.329118] [platform/nm-platform.c:397] nm_platform_link_delete(): link: deleting 'bb' (330)
NetworkManager[30628]: <debug> [1381930216.344442] [platform/nm-platform.c:1777] log_link(): signal: link removed: bb (330)
NetworkManager[30628]: <info> Auto-activating connection 'b1'.
NetworkManager[30628]: <debug> [1381930216.598636] [platform/nm-platform.c:1777] log_link(): signal: link added: bb (332)

This line is bad:
NetworkManager[30628]: <debug> [1381930217.79182] [platform/nm-linux-platform.c:2568] handle_udev_event(): UDEV event: action 'remove' subsys 'net' device 'bb' (332)

NetworkManager[30628]: <debug> [1381930217.81009] [platform/nm-platform.c:1777] log_link(): signal: link removed: bb (332)
NetworkManager[30628]: <info> (bb): deactivating device (reason 'removed') [36]
NetworkManager[30628]: <debug> [1381930217.95192] [platform/nm-linux-platform.c:2568] handle_udev_event(): UDEV event: action 'add' subsys 'net' device 'bb' (332)
NetworkManager[30628]: <debug> [1381930217.95492] [platform/nm-platform.c:1777] log_link(): signal: link added: bb (332)
NetworkManager[30628]: <info> Auto-activating connection 'b1'.
...
2013-10-16 19:00:45 +02:00
Jiří Klimeš
8ecbe53f37 platform: log links in event_notification() in debug mode 2013-10-16 17:28:04 +02:00
Thomas Haller
1d0a26e19d core: print ifindex when logging UDEV event
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-15 19:45:42 +02:00
Dan Winship
f03635e5ac core: don't have IP4 and IP6 configs on slaves
Although it's convenient in some places to have IP configs on all
connections, it makes more sense in other places to not have IP
configs on slaves. (eg, it's confusing for nmcli, etc, to report a
full NMSettingIP4Config on a slave device). So revert parts of the
earlier patch. However, it's still safe to assume that s_ip4 != NULL
if method != DISABLED, so some of the earlier simplifications can
stay.

Also, add nm_utils_get_ip_config_method(), which returns the correct
IP config method for a connection, whether the connection has IP4 and
IP6 settings objects or not, and use that to keep some more of the
simplifications from the earlier patch.
2013-10-14 12:07:37 -04:00
Thomas Haller
8a046bedbb core: fix crash for bridge-slave with missing NMSettingBridgePort setting
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-11 19:53:33 +02:00
Dan Winship
0a77cf6320 ifcfg-rh: fix handling of minimal ifcfg files
ifcfg-rh had the rule that if an ifcfg file had no BOOTPROTO and no
IPv4 addresses, then it should be treated as method=auto for
compatibility. But in fact, current ifup treats it as method=disabled,
so we should too.

https://bugzilla.gnome.org/show_bug.cgi?id=708875
2013-10-11 12:24:34 -04:00
Dan Winship
68f12b4e9c settings: make connections always have s_ip4 and s_ip6
Make sure that all connections returned from NMSettings or created via
AddAndActivateConnection have an NMSettingIP4Config and an
NMSettingIP6Config, with non-NULL methods, and get rid of
now-unnecessary checks for those.

Also move the slaves-can't-have-IP-config checks into the
platform-independent code as well. This also gets rid of spurious
"ignoring IP4/IP6 configuration" warnings in ifcfg-rh when reading a
slave ifcfg file.

Partly based on a patch from Pavel.

https://bugzilla.gnome.org/show_bug.cgi?id=708875
2013-10-11 12:24:34 -04:00
Dan Williams
09bde40f02 core: fix PropertiesChanged signals for IP-related properties
To present a consistent API to clients, the IP-related properties
are only valid when the device has finished IP configuration.  But
they are set before that happens, and their change notifications
were emitted before the IP configuration was considered valid.
Re-emit the change notifications when the device enters the IP_CHECK
state (and thus has IP configuration) and also when the device
deactivates to enusre clients have up-to-date IP-related property
information.

For the changes to has_ip_config(), the priv->ipX_state checks are
not necessary since the device will have valid IP configuration
when it enters the IP_CHECK state.  The other checks can be
consolidated into a single statement.

Acked-by: Dan Winship
2013-10-09 13:59:42 -05:00
Dan Williams
b5fa0fec1c trivial: remove unnecessary warning 2013-10-09 09:39:57 -05:00
Dan Williams
9543e45afe core: allow IPv4 to proceed if IPv6 is globally disabled but set to "auto" (rh #1012151)
If the user disabled IPv6 support in the kernel with "ipv6.disable=1" on the
kernel boot line, then any attempts to open IPv6 sockets (which libndp does)
will fail.  This failed the entire connection, even if IPv6's "may-fail"
property was TRUE.  Instead, just fail IPv6 and allow IPv4 to proceed.  If
IPv4 fails or is disabled, then other logic will fail the entire connection.
2013-10-07 11:53:18 -05:00
Jiří Klimeš
2af8c08f65 ifcfg-rh: ignore default routes in route6 file (rh #991807)
Base on patch from Francesco Prelz <Francesco Prelz mi infn it>:
https://mail.gnome.org/archives/networkmanager-list/2013-January/msg00095.html

https://bugzilla.redhat.com/show_bug.cgi?id=991807
2013-10-07 18:10:27 +02:00
Dan Williams
87041545b4 ifcfg-rh: fix ignoring updates that don't change anything
connection_from_file() requires the 'error' parameter.  Not passing a
valid 'error' parameter causes the function to fail and return NULL,
which mean that commit_changes() would always re-write the connection
instead of ignoring commits where nothing has actually changed.

connection_from_file() no longer requires the unmanaged, keyfile,
or routefile parameters, so remove them.
2013-10-04 23:43:25 -05:00
Thomas Haller
08670c9163 bluez: fix leak of NMBluezDevice in bluez_connect_cb
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-03 14:00:51 -05:00
Dan Williams
c4035ead5f core: fix nm_ip6_config_replace() nameserver address comparison 2013-10-03 13:59:18 -05:00
Dan Williams
da2f1d5870 trivial: print route prefix when printing RA discovered routes 2013-10-03 13:59:18 -05:00
Dan Williams
72ac1e38f9 rdisc: mask host bits off RA prefix (rh #1008104) (bgo #709230)
Some RA implementations (like radvd) dump whatever the user configures
onto the wire, accepting a prefix of "2001:db8:1:0::1/64" without
masking the host bits off.

This causes NetworkManager to send that route down to the kernel, which
*does* mask the host bits off.  This causes a mismatch between the
route NetworkManager expects the kernel to create, and what the kernel
actually created, when searching for the kernel object in the platform's
refresh_object() function:

	cache = choose_cache (platform, object);
	cached_object = nl_cache_search (choose_cache (platform, object), object);
	kernel_object = get_kernel_object (priv->nlh, object);

kernel_object is NULL since 'object' (a route which came from the RA
prefix) is not the same as the object the kernel actually did create.

Ensure we match kernel behavior by fixing up prefixes for dumb router
advertisement services.
2013-10-03 13:59:18 -05:00
Thomas Haller
f4557256ea bluez: fix creation of NAP connection for bluez device
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 20:21:44 +02:00
Thomas Haller
e08687e1e2 team: do not g_source_remove after g_child_watch_add signal was emitted
g_child_watch_add only emits one signal and gets automatically
removed from the source. No need for double removal, so unset
teamd_process_watch before calling teamd_cleanup.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 20:07:22 +02:00
Thomas Haller
67789cd476 team: fix missing teamd_cleanup in certain cases
Also ensure that teamd_timeout_cb does a state transition of the device.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 20:07:05 +02:00
Thomas Haller
154dcd948a team: fix startup of team by ignoring teamd_dbus_vanished at first
g_bus_watch_name immediatly emits a vanished signal, if the name does not exist
at the begining. So the first signal, does not indicate an actual change of
state and must be ignored.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 20:07:05 +02:00
Jiří Klimeš
23e90ee76d team: fix a crash on team devices (rh #1013593)
teamd was being watched using g_bus_watch_name(). But when the NM team device
was destroyed NM tried to remove the watcher with g_source_remove() instead of
g_bus_unwatch_name(). Thus the watcher was not removed and
teamd_dbus_appeared() was called on disposed device.

https://bugzilla.redhat.com/show_bug.cgi?id=1013593#c28

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 20:05:05 +02:00
Thomas Haller
e4fc7440cc team: ensure that teamd_start does not get called when already starting
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 19:39:17 +02:00
Dan Williams
d3aae79e5c dhcp: fix IPv6 address prefixes (rh #1013583)
53e55aab36 mistakenly moved the address
prefix without moving the memset() to initialize the address.  Make
sure the address is initialized before trying to do anything with it.
2013-10-01 15:48:25 -05:00
Thomas Haller
0f88cb13f1 team: remove variable teamd_on_dbus that was always FALSE
The variable teamd_on_dbus in nm-device-team was never set to TRUE.
Remove it. Also, before teamd_dbus_vanished did never cleanup anything.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-01 11:45:46 +02:00
Thomas Haller
d11f41a8a0 team: fix wrong assertion in device-team
The assertion that priv->teamd_pid is set does not hold.

For example, if no teamd binary can be found, "Stage 1 of 5 (Device
Prepare)" fails with "Activation (nm-team) to start teamd: not found".
This causes the device state to become "failed" and later
"disconnected", which in turn calls teamd_stop without a valid teamd_pid
set.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-01 11:18:13 +02:00
Jiří Klimeš
f767e05f4a team: chain up parent dispose() in NMDeviceTeam dispose() (rh #1013593)
NMDeviceTeam dispose() did not chain up to parent dispose(). This prevented
parent dispose() to be called (only finalize()) and thus link_changed_cb()
and device_ip_changed() handlers were not disconnected. Later these handlers
were called on invalid device resulting in a crash.

https://bugzilla.redhat.com/show_bug.cgi?id=1013593
2013-10-01 10:23:12 +02:00
Jiří Klimeš
469febc0d9 rdisc: do not crash on NDP init failures (rh #1012151)
ndp_open() can fail, do not assume it cannot.
When 'ipv6.disable=1' kernel parameter is used, the whole IPv6 stack is
disabled and the attempt to create PF_INET6 socket fails.

https://bugzilla.redhat.com/show_bug.cgi?id=1012151
2013-09-30 12:08:35 +02:00
Jiří Klimeš
6b9b3adbd1 trivial: remove trailing spaces 2013-09-27 13:26:29 +02:00
Jiří Klimeš
282b9df60d vpn: fix VPN plugin D-Bus errors
The errors were documented as org.freedesktop.NetworkManager.VPN.Error.*,
but the actual values were org.freedesktop.NetworkManager.VPN.Plugin.*

Also update the errors documentation.
2013-09-27 13:26:29 +02:00
Jiří Klimeš
9dff830692 vpn: fix connecting to VPN (bgo #708255)
The ConnectInteractive() -> Connect() fallback code doesn't work, because
_connect_internal() changes the state to NM_VPN_SERVICE_STATE_STARTING before
checking if it can implement ConnectInteractive(), and then when the Connect()
call comes in, the VPN is not in STOPPED or INIT, so it returns an error.

The commit moves setting state to STARTING after the ConnectInteractive() check
availability, in the plugin. We introduce new plugin error and set it when the
the plugin does not implement ConnectInteractive(). NetworkManager uses this
error for ConnectInteractive() -> Connect() fallback.

https://bugzilla.gnome.org/show_bug.cgi?id=708255
2013-09-27 13:26:09 +02:00
Dan Williams
57c99c11fe core: don't run Bluetooth disconnect unless the device was connected
Don't unconditionally call disconnect during device deactivation, since
the device also gets deactivated in the UNAVAILABLE -> DISCONNECTED
state change, long before any Bluetooth connection has been made.
2013-09-26 15:50:00 -05:00
Thomas Haller
1f4608e06e bluez: fix compile error in nm-bluez-device for BlueZ 4 (unused variable)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-26 13:41:12 +02:00
Dan Williams
1735fadc10 trivial: print a more informative warning if built for Bluez5 but Bluez4 is installed 2013-09-25 19:45:15 -05:00
Thomas Haller
4fe20ed4d8 core: add const qualifier to functions in nm-ip[46]-config
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-25 23:12:37 +02:00