Commit Graph

15047 Commits

Author SHA1 Message Date
Lubomir Rintel
26aeb12749 linux-platforms: don't enumerate devices via udev if udevd is not running
We'd be able to do so for already existing devices, but not for devices that
are added afterwards, since gudev is hardwired not to listen for events from
kernel.
2015-05-11 19:28:13 +02:00
Lubomir Rintel
d6aef9c188 platform/test: unshare the netns namespace so that root tests don't mess with the system
Mount a private sysfs instance. Otherwise gudev sees the devices from the
parent netns as opposed to our netns.

We do, however need a writable /sys/devices subtree for testing the bridge
code. There doesn't seem to be any other way to get a writable subtree of a
read-only filesystem than remounting it with no parameters after the initial
mount. We use this to get a writable sysfs instance and then bindmount it so
that it fits properly in the sysfs hierarchy.

Co-Authored-By: Thomas Haller <thaller@redhat.com>
2015-05-11 19:28:13 +02:00
Dan Williams
21fef6a357 build: correct help message about missing readline + termcap libraries 2015-05-11 10:33:21 -05:00
Lubomir Rintel
c8236ea694 build: re-add a line accidentally removed by the last merge 2015-05-11 11:35:52 +02:00
Beniamino Galvani
b341431f87 ipv4ll: merge branch 'bg/ipv4ll-bgo747463'
https://bugzilla.gnome.org/show_bug.cgi?id=747463
2015-05-11 10:49:53 +02:00
Beniamino Galvani
db923366b2 contrib/rpm: remove avahi-autoipd dependency and files 2015-05-11 10:48:48 +02:00
Beniamino Galvani
3376952ef9 callouts: avahi-autoipd-action is no more 2015-05-11 10:48:48 +02:00
Beniamino Galvani
c029502912 ipv4ll: use internal implementation 2015-05-11 10:48:48 +02:00
Beniamino Galvani
c6302f3227 device: fix device state transition after IPv4LL failure
Don't terminate the entire connection if IPv4LL configuration fails
but instead call nm_device_check_ip_failed() to check the result of
IPv6 as well.
2015-05-11 10:48:48 +02:00
Beniamino Galvani
33d4232c3d device/trivial: move nm_device_check_ip_failed()
Move nm_device_check_ip_failed() upwards as it will be used by IPv4LL
code.
2015-05-11 10:48:48 +02:00
Beniamino Galvani
7a7f280ef3 device/trivial: rename 'aipd' and 'autoip4' to 'ipv4ll' 2015-05-11 10:48:48 +02:00
Beniamino Galvani
9d6a2e6f0f systemd: ensure every file includes 'nm-sd-adapt.h' first 2015-05-11 10:48:48 +02:00
Lubomir Rintel
6fba9fd2e5 device: make sure NMDevice doesn't vanish halfway through applying configuration
It could be that the device was removed and the default route manager holds the
last reference:

  Breakpoint 1, dispose (object=0x90e710 [NMDeviceTun]) at devices/nm-device.c:8588
  8588            NMDevice *self = NM_DEVICE (object);
  (gdb) bt
  #0  0x000000000045d24e in dispose (object=0x90e710 [NMDeviceTun]) at devices/nm-device.c:8588
  #1  0x00007ffff4d29b7c in g_object_unref (_object=0x90e710) at gobject.c:3133
  #2  0x00000000004b0a61 in _entry_at_idx_remove (entry=<optimized out>) at nm-default-route-manager.c:192
  #3  0x00000000004b0a61 in _entry_at_idx_remove (vtable=<optimized out>, self=<optimized out>, entry_idx=<optimized out>) at nm-default-route-manager.c:638
  #4  0x00000000004adb51 in _ipx_update_default_route (vtable=0x7b1850 <vtable_ip6>, self=0x7da610 [NMDefaultRouteManager], source=<optimized out>) at nm-default-route-manager.c:814
  #5  0x0000000000459ccb in nm_device_set_ip6_config (self=0x90e710 [NMDeviceTun], new_config=<optimized out>, commit=<optimized out>, reason=<optimized out>) at devices/nm-device.c:6213
  #6  0x0000000000450c92 in ip6_config_merge_and_apply (self=0x90e710 [NMDeviceTun], commit=0, out_reason=0x0) at devices/nm-device.c:3670
  #7  0x0000000000452d06 in update_ip_config (self=0x90e710 [NMDeviceTun], initial=<optimized out>) at devices/nm-device.c:6915
  #8  0x000000000046253e in queued_ip_config_change (user_data=<optimized out>) at devices/nm-device.c:6945
  #9  0x00007ffff4a257fb in g_main_context_dispatch (context=0x7ca3e0) at gmain.c:3111
  #10 0x00007ffff4a257fb in g_main_context_dispatch (context=context@entry=0x7ca3e0) at gmain.c:3710
  #11 0x00007ffff4a25b98 in g_main_context_iterate (context=0x7ca3e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3781
  #12 0x00007ffff4a25ec2 in g_main_loop_run (loop=0x7ca4a0) at gmain.c:3975
  #13 0x0000000000444bbe in main (argc=<optimized out>, argv=<optimized out>) at main.c:486
  (gdb)

  Program received signal SIGTRAP, Trace/breakpoint trap.
  g_logv (log_domain=0x7ffff4d4f164 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffd5b0) at gmessages.c:1046
  1046              g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
  (gdb) bt
  #0  0x00007ffff4a2c970 in g_logv (log_domain=0x7ffff4d4f164 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffd5b0) at gmessages.c:1046
  #1  0x00007ffff4a2cbaf in g_log (log_domain=log_domain@entry=0x7ffff4d4f164 "GLib-GObject", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x7ffff4d563b0 "invalid unclassed pointer in cast to '%s'") at gmessages.c:1079
  #2  0x00007ffff4d481f9 in g_type_check_instance_cast (type_instance=0x90e710, iface_type=<optimized out>) at gtype.c:4030
  #3  0x0000000000459ceb in nm_device_set_ip6_config (self=0x90e710, new_config=<optimized out>, commit=<optimized out>, reason=0x0) at devices/nm-device.c:6217
  #4  0x0000000000450c92 in ip6_config_merge_and_apply (self=0x90e710, commit=0, out_reason=0x0) at devices/nm-device.c:3670
  #5  0x0000000000452d06 in update_ip_config (self=0x90e710, initial=<optimized out>) at devices/nm-device.c:6915
  #6  0x000000000046253e in queued_ip_config_change (user_data=<optimized out>) at devices/nm-device.c:6945
  #7  0x00007ffff4a257fb in g_main_context_dispatch (context=0x7ca3e0) at gmain.c:3111
  #8  0x00007ffff4a257fb in g_main_context_dispatch (context=context@entry=0x7ca3e0) at gmain.c:3710
  #9  0x00007ffff4a25b98 in g_main_context_iterate (context=0x7ca3e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3781
  #10 0x00007ffff4a25ec2 in g_main_loop_run (loop=0x7ca4a0) at gmain.c:3975
  #11 0x0000000000444bbe in main (argc=<optimized out>, argv=<optimized out>) at main.c:486
  (gdb)

https://bugzilla.gnome.org/show_bug.cgi?id=748193
2015-05-11 10:44:02 +02:00
Beniamino Galvani
caac8785da systemd: merge branch 'systemd'
Conflicts:
	src/systemd/src/shared/strv.c
	src/systemd/src/shared/util.c
2015-05-11 09:20:33 +02:00
Beniamino Galvani
8ff2c2e936 systemd: merge branch 'systemd'
In addition, update src/Makefile.am with new paths and move

  src/{dhcp-manager/systemd-dhcp => systemd}/nm-sd-adapt.[ch]

as well.
2015-05-11 09:19:02 +02:00
Beniamino Galvani
6edc737173 dns: don't override DHCP-supplied search order with domain
NM always prepends the list of DNS domains received through DHCP to
the search list in /etc/resolv.conf, overriding the DHCP-supplied DNS
domain search order. This behavior is not entirely correct since it
changes the search order provided by system administrators.

We cannot simply avoid adding the DNS domain list to the search list
because this would break some configurations that rely on the 'domain'
option to deliver the search list.

This patch modifies the behavior of DNS manager to:
 - insert the DHCP-provided 'domain' at the end of 'searches' option
   so that 'searches' is always preferred
 - ignore 'domain' if 'searches' option exists and 'domain' is a
   single domain

https://bugzilla.gnome.org/show_bug.cgi?id=748900
2015-05-08 10:21:28 +02:00
Jiří Klimeš
33527341b1 wifi: fix a crash in on_bss_proxy_acquired()
g_dbus_proxy_get_cached_property_names() function can return NULL.

 Program received signal SIGSEGV, Segmentation fault.
 on_bss_proxy_acquired (proxy=0x7fffe4003880 [GDBusProxy], result=0x895490, user_data=<optimized out>) at supplicant-manager/nm-supplicant-interface.c:159
 159		while (*iter) {
 (gdb) bt
 #0  0x000000000048fac7 in on_bss_proxy_acquired (proxy=0x7fffe4003880 [GDBusProxy], result=0x895490, user_data=<optimized out>)
     at supplicant-manager/nm-supplicant-interface.c:159
 #1  0x0000003bf84728b7 in g_simple_async_result_complete (simple=0x895490 [GSimpleAsyncResult]) at gsimpleasyncresult.c:763
 #2  0x0000003bf8472919 in complete_in_idle_cb (data=<optimized out>) at gsimpleasyncresult.c:775
 #3  0x0000003bf5c497fb in g_main_context_dispatch (context=0x7d6420) at gmain.c:3111
 #4  0x0000003bf5c497fb in g_main_context_dispatch (context=context@entry=0x7d6420) at gmain.c:3710
 #5  0x0000003bf5c49b98 in g_main_context_iterate (context=0x7d6420, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3781
 #6  0x0000003bf5c49ec2 in g_main_loop_run (loop=0x7d64e0) at gmain.c:3975
 #7  0x00000000004349d6 in main (argc=1, argv=0x7fffffffe598) at main.c:486
2015-05-07 13:08:16 +02:00
Thomas Haller
f55a272ade platform: fix compiler warning about non-initialized pointer
When compiling with -fexceptions (as we build our RPM), we must
initialize all variables with a cleanup attribute.

Fixes: 29ccb8851c
2015-05-07 11:10:36 +02:00
Dan Williams
6270db5f0b merge: device factory cleanups and first parts of devices-for-all (bgo #747429) 2015-05-06 16:17:01 -05:00
Dan Williams
8fa0f4690f core: let plugins indicate links which should be ignored
Instead of hacky stuff in the Manager, let plugins themselves indicate
which links should be ignored (because they are really child links that
are controlled by a different device that the plugin handles).
2015-05-06 16:14:25 -05:00
Dan Williams
aba250a7d4 core: move permanent and initial MAC address reading to NMDevice and NMPlatform
Ethernet, WiFi, and VLAN used the same implementation for initial address.

Ethernet and WiFi used the same implementation (and duplicated code) for
permanent MAC address, plus they both used ethtool in what should be
generic code, which is better done in the platform.
2015-05-06 16:14:25 -05:00
Dan Williams
ddaea22332 platform: move driver & firmware version reading into the platform 2015-05-06 16:14:25 -05:00
Dan Williams
fa74ed7ca1 platform: add nm_platform_link_get_by_address() 2015-05-06 16:14:25 -05:00
Dan Williams
29ccb8851c platform: ensure created interface matches requested type
If the caller requested that a bond be created, don't return success
if there was an existing bridge with the same name.
2015-05-06 16:14:25 -05:00
Dan Williams
2abda4bfa5 platform: return link objects from add functions 2015-05-06 16:14:25 -05:00
Dan Williams
179d56c73c core: move virtual interface name handling into device plugins
Instead of having a bunch of logic in the Manager for determining the
VLAN and Infiniband virtual interface names, move the type-specific
logic into the plugins themselves.
2015-05-06 16:14:25 -05:00
Dan Williams
42b272b604 trivial: move code 2015-05-06 16:14:24 -05:00
Dan Williams
71bde20c30 core: let device plugins advertise supported link and setting types
Instead of looping over all plugins and asking each plugin whether it
can handle a link or a connection, have them advertise the link and
connection types they support, and use that when creating new devices.
2015-05-06 16:14:24 -05:00
Dan Williams
cd3df12c8f vlan: don't fail if parent isn't found at construct time for existing devices
For existing devices, depending on the order that netlink sends interfaces to
us, the parent may be found after the VLAN interface and not be available when
the VLAN interface is constructed.  Instead of failing construction, when a
NMDeviceVlan has no parent keep it unavailable for activation.  Then have
the Manager notify existing devices when a new device is found, and let
NMDeviceVlan find the parent later and become available via that mechanism.

This doesn't apply to VLANs created by NM itself, because the kernel requires
a parent ifindex when creating a VLAN device.  Thus this fix only applies to
VLANs created outside NetworkManager, or existing when NM starts up.
2015-05-06 16:14:24 -05:00
Dan Williams
477cbc848a trivial: move code 2015-05-06 16:14:24 -05:00
Dan Williams
baee9080b7 platform: recognize Bluetooth BNEP devices via DEVTYPE
Instead of strcmp()-ing the device name, recognize these devices from their
driver's DEVTYPE.
2015-05-06 16:14:24 -05:00
Dan Williams
77d01c9094 settings: ignore incompatible connections when looking for existing ones
beb18050 made this code run for all devices instead of just ethernet
devices, which means any kind of connection gets compared to any
device.  But only compatible connections should be considered.
2015-05-06 16:14:24 -05:00
Dan Williams
fb1d04099f core: don't activate failed queued activation requests
If the queued activation request failed before the device is
finished deactiving the old request, don't start activating
the failed queued request.
2015-05-06 16:14:24 -05:00
Dan Williams
8203ae8093 merge: follow supplicant's AP list instead of managing lifetime internally (bgo #748593) 2015-05-06 15:25:03 -05:00
Dan Williams
1fcc9690d1 platform: remove unused wifi_utils_get_ssid() 2015-05-06 15:23:47 -05:00
Dan Williams
2028ef2c82 wifi: remove anachronistic NMAccessPoint getter pattern
Just use priv.
2015-05-06 15:23:47 -05:00
Dan Williams
a646514fb6 wifi: remove unused NMAccessPoint set_property() code
Properties are never set at construct time through GValues, but
later through helpers.
2015-05-06 15:23:47 -05:00
Dan Williams
7202449b47 wifi: beautify spacing in nm-wifi-ap.h 2015-05-06 15:21:32 -05:00
Dan Williams
8cd2353cd9 wifi: make internal functions static or remove them
Convert internal-only getters to priv-> at their point of usage,
and make internal-only setters static.
2015-05-06 15:21:32 -05:00
Dan Williams
13c77b09eb wifi: move NMAccessPoint getters/setters to top
Allows us to remove some no longer used prototypes from the headers.
Remove some pointless comments at the same time.
2015-05-06 15:21:31 -05:00
Dan Williams
ea9ae4cd76 wifi: move NMAccessPoint GObject stuff to the bottom 2015-05-06 15:20:31 -05:00
Dan Williams
e482f853f6 wifi: remove supplicant-forgotten current AP from list on disconnect
NM never removes the current AP from the AP list, to prevent NM from
indicating that it's connected, but to nothing.  But the supplicant
can remove that AP from its list at any time (out of range, turned off,
etc), leading to a priv->current_ap that is no longer known to the
supplicant but still exists in the NM AP list.  Since the supplicant
has forgotten it, NM will never receive a removal signal for it.

To ensure that a supplicant-forgotten priv->current_ap is removed
from the NM AP list when priv->current_ap is cleared or changed, mark
any AP removed by the supplicant as 'fake'.  It will then always be
removed in set_current_ap() and not linger in the AP list forever like
a zombie.
2015-05-06 15:14:06 -05:00
Dan Williams
910c62d8c7 wifi: follow supplicant's scan list instead of managing AP lifetime internally
Instead of tricky logic to merge APs and age them, just tell the
supplicant what our aging parameters are, and rely on it to handle
removal from the list.  Notable behavioral changes are:

* APs will now be removed when they haven't been seen for two
consecutive scans in which they would have been included.  This
means that when the scan interval is short, out-of-range APs will
be removed much more quickly than the previous 360 seconds.

* APs now live at most 250 seconds (twice our longest scan interval)
instead of the previous 360 seconds.

* The problem with wpa_supplicant < 2.3 not notifying that a BSS has
been seen in the scan if none of its properties actually changed is
now avoided, because an AP is only removed when the supplicant removes it

In general these changes should make the scan list more responsive, at
the cost of slightly more instability in the list due to the unreliability
of WiFi scanning.  But it also removes a layer of complexity and
abstraction from NetworkManager, pushing the scan results list closer
to that which the hardware reports.
2015-05-06 15:14:06 -05:00
Dan Williams
be370859ef wifi: condense AP list dump log message
Remove the trailing message, and indicate when the last scan
took place and when the next one will happen.
2015-05-06 15:14:06 -05:00
Dan Williams
6ee7e22acb wifi: make nm_ap_dump() print on one line 2015-05-06 15:14:04 -05:00
Dan Williams
f575c6a5cb dns: clear error before updating resolv.conf
If the resolv.conf method failed, don't trigger a warning by overwriting
an already-set error.
2015-05-06 14:55:46 -05:00
Thomas Haller
113a4bcb21 test: move some old tests to nm-test-utils.h 2015-05-06 17:23:33 +02:00
Dan Williams
5b1cde1bfc vpn: don't fail if no system secrets exist
The VPN connection requests secrets a few times; first it retrieves
only system-owned secrets to see if they are sufficient (and thus
doesn't need to bother the user), then it retrieves existing agent
owned secrets (so the user doesn't get a popup), then finally if
those aren't sufficient it asks the user interactively.

But if there was some error retrieving system secrets, or if there
weren't any system secrets at all, don't fail the VPN connection.
Just go on and ask the user for the secrets.
2015-05-05 15:51:25 -05:00
Thomas Haller
9847ab7147 core: merge branch 'th/reload-ignore-carrier-bgo748050'
Make the main.ignore-carrier configuration option reloadable
via our usual SIGHUP mechanism.

https://bugzilla.gnome.org/show_bug.cgi?id=748050
2015-05-05 16:57:25 +02:00
Thomas Haller
8ebb8d0d0f device: allow reloading of the ignore-carrier flag
Now on SIGHUP, when reloading NetworkManager configuration, also reload
the ignore-carrier flag.

While a device is activated, the reload is ignored until the device
deactivates.

Maybe it would be simpler just not to cache ignore_carrer and let it
take effect immediately. But not caching ignore_carrer has the
additional downside that every call to is_available must check the
specs -- which in sum is potentially expensive for something that
almost never changes.

https://bugzilla.gnome.org/show_bug.cgi?id=748050
2015-05-05 16:53:51 +02:00