Commit Graph

11613 Commits

Author SHA1 Message Date
Thomas Haller
3af40acf31 core: declare nm_agent_manager_get() using NM_DEFINE_SINGLETON_GETTER()
Also move the initilization of the instance into the constructed()
method.

NMAgentManager now owns a reference to the DBUS manager and Auth
manager and the dispose() function properly unregisters itself from
both.
2015-01-12 12:10:03 +01:00
Thomas Haller
d45c1b84f4 core: declare nm_supplicant_manager_get() using NM_DEFINE_SINGLETON_GETTER() 2015-01-12 12:10:03 +01:00
Thomas Haller
d8887019ce core: declare nm_session_monitor_get() using NM_DEFINE_SINGLETON_GETTER() 2015-01-12 12:10:03 +01:00
Thomas Haller
22409e0481 core: declare nm_firewall_manager_get() using NM_DEFINE_SINGLETON_GETTER() 2015-01-12 12:10:03 +01:00
Thomas Haller
f4bf50bf4a core: declare nm_inotify_helper_get() using NM_DEFINE_SINGLETON_GETTER()
Refactor NMInotifyHelper to implement the singleton getter using
NM_DEFINE_SINGLETON_GETTER().

For one this means that the getter no longer increments the reference
count. This was anyway wrong, because no caller of nm_inotify_helper_get()
unrefered the returned reference, hence leaking the singleton.

Also, the getter can no longer fail to create the singleton instance.
Note that none of the callers actually coped with a failure to get
the singleton.
Instead return an instance that does nothing.
One downside (upside?) of this is that we only try once to initialize
the inotify handle.
2015-01-12 12:10:03 +01:00
Thomas Haller
e2739cfc1b core: declare nm_vpn_manager_get() using NM_DEFINE_SINGLETON_GETTER() 2015-01-12 12:10:03 +01:00
Thomas Haller
fc575d6783 core: declare nm_dhcp_manager_get() using NM_DEFINE_SINGLETON_GETTER() 2015-01-12 12:10:03 +01:00
Thomas Haller
e439637ada core: declare nm_dns_manager_get() using NM_DEFINE_SINGLETON_GETTER() 2015-01-12 12:10:02 +01:00
Thomas Haller
a8ebd1aa1a core: declare nm_sleep_monitor_get() using NM_DEFINE_SINGLETON_GETTER()
Also no longer increment the reference count in the getter and
properly disconnect the signals in NMManager:dispose().

Also use the defines for the signal names instead of plain strings.
2015-01-12 12:10:02 +01:00
Thomas Haller
822cb293ef core/trivial: rename singleton variables according to default name 2015-01-12 12:10:02 +01:00
Thomas Haller
e725887c3a all: add macro NM_DEFINE_SINGLETON_GETTER() 2015-01-12 12:10:02 +01:00
Thomas Haller
2a3d65f8b2 trivial: whitespace fix 2015-01-11 22:52:50 +01:00
Thomas Haller
1bb1bfe6e7 core: merge branch 'th/route-fixes-bgo741871'
https://bugzilla.gnome.org/show_bug.cgi?id=741871
2015-01-11 13:35:15 +01:00
Thomas Haller
41e6c4fac1 platform: workaround deletion of IPv4 route with metric 0
Deleting routes with metric 0 might end up deleting other
routes with a different metric.

Workaround this in platform to only delete a route with
metric 0 if such a route can be found prior to deletion.

Don't only look into the cache (which might be out of date).
Instead refetch the route we are about to delete to be sure.

There is still a race that we might end up deleting the wrong
route.

https://bugzilla.gnome.org/show_bug.cgi?id=741871
https://bugzilla.redhat.com/show_bug.cgi?id=1172780
2015-01-11 13:08:34 +01:00
Thomas Haller
2cb3c7e8a0 platform: route_search_cache() should not treat a metric 0 as "any" route
This match-any behavior ignoring metric is nowhere used. And even if we
would need such a behavior, using 0 is wrong because IPv4 routes can
have a metric of zero.
2015-01-11 13:08:34 +01:00
Thomas Haller
06e4eee0ce platform: fix IPv6 route methods for metric 0
Handling a route with metric 0 effectively means
a metric of 1024 (user default). Adjust the add(),
delete() and exist() functions to consider routes
with metric 0 as 1024.
2015-01-11 13:08:34 +01:00
Thomas Haller
4ba8df425f platform: fix data type for metric argument of refresh_route() 2015-01-11 13:08:34 +01:00
Thomas Haller
3e33a5a6c5 ifcfg-rh: support ipvx.route-metric property as IPVX_ROUTE_METRIC
Write ipv4.route-metric and ipv6.route-metric property of
NMSettingConnection as IPV4_ROUTE_METRIC and IPV6_ROUTE_METRIC,
respectively.
2015-01-10 21:10:52 +01:00
Thomas Haller
207ab013a1 ifcfg-rh: fix invalid g_return_val_if_fail() argument in devtimeout_from_file()
Fixes: 62d870e1a6
2015-01-10 14:21:25 +01:00
Dan Williams
5e892819fc contrib: remove dbus/dbus-glib requires from libnm sub-package
libnm doesn't use dbus-glib or dbus at all.
2015-01-09 17:12:01 -06:00
Dan Williams
3bcd1c7495 dbus: fix NMRUNDIR permissions on create
This is really a no-op because the directory will be created by
nm_main_utils_check_pidfile() anyway, but make sure the permissions
are synchronized.  Now that resolv.conf is symlink into NMRUNDIR,
if normal users don't have permissions to read NMRUNDIR then
DNS won't work.
2015-01-09 13:56:40 -06:00
Dan Williams
984b0763d9 core: force disable_ipv6=0 when turning on userspace IPv6LL (bgo #741773)
If a device assumes a connection without activating a user-requested or
NM-requested connection, then disable_ipv6 is not touched.  When the device
is deactivated, it still isn't touched even though userspace IPv6LL
is enabled.  This could lead to an user-requested activation with
IPv6 configuration, but disable_ipv6=1.

Whenever userspace IPv6LL is turned on, we should also set disable_ipv6=0
to ensure IPv6 can function.  Userspace IPv6LL will ensure that the
interface does not have an address until the user/connection requests
it, which was the only reason that NM touched disable_ipv6 anyway.

fixes:NetworkManager_Test203_testcase_286589
fixes:NetworkManager_Test204_testcase_286590

https://bugzilla.gnome.org/show_bug.cgi?id=741773
2015-01-09 13:56:40 -06:00
Dan Winship
d746103d75 keyfile: fix an uninitialized variable
read_field() was supposed to set *error to NULL if there was no error,
but it missed one case. (If **current was '\0'.)
2015-01-09 11:56:39 -05:00
Dan Winship
20a56fa9a2 contrib: sync fedora/rpm/NetworkManager.spec
We're building the plugins on s390 these days
2015-01-09 11:30:50 -05:00
Dan Winship
07194fb6a9 ifcfg-rh: merge branch danw/devtimeout-rh1171917
https://bugzilla.redhat.com/show_bug.cgi?id=1171917
2015-01-09 09:46:19 -05:00
Dan Winship
62d870e1a6 ifcfg-rh: handle DEVTIMEOUT property (rh #1171917)
If an ifcfg file has a DEVTIMEOUT property (and a DEVICE, and is
ONBOOT=yes), and the device is not present at startup, then wait up to
DEVTIMEOUT seconds for it to appear before declaring the connection
ready.

This allows for a hacky workaround to devices that take a bizarrely
long time to be probed.
2015-01-09 09:45:25 -05:00
Dan Winship
b067ca7034 core: allow connections to participate in NMManager:startup-complete
Add an NMSettingsConnection:ready property, which indicates if the
connection is ready to use. Add NMSettings:startup-complete, which is
TRUE when all connections are ready. Make NMManager:startup-complete
take NMSettings:startup-complete into account.
2015-01-09 09:45:25 -05:00
Lubomir Rintel
c27074bf43 keyfile: another cur at fixing the bridge test
Fixes: 2f82bf537b
2015-01-09 15:14:18 +01:00
Lubomir Rintel
7d58177590 keyfile: fix bridge test
Fixes: 2f82bf537b
2015-01-09 14:37:36 +01:00
Lubomir Rintel
2f82bf537b bridge: Properly check range of STP properties (rh #1160815)
If zero is out of range, only allow it when STP is disabled.

https://bugzilla.redhat.com/show_bug.cgi?id=1160815
2015-01-09 12:13:53 +01:00
Rui Matos
8c32ea916b libnm-glib/nm-client: zero the CheckConnectivityData structure
Otherwise, if the caller doesn't provide a cancellable we'll try to
access a bogus ccd->cancellable in check_connectivity_data_free() and
crash.

https://bugzilla.gnome.org/show_bug.cgi?id=740841
2015-01-08 16:15:23 +01:00
Lubomir Rintel
15acfac455 team: improve handling of externally managed devices (rh #1172734)
https://bugzilla.redhat.com/show_bug.cgi?id=1172734
2015-01-08 15:16:57 +01:00
Lubomir Rintel
03a5a85d6c team: get configuration only when teamd appears on bus for externally added interfaces
teamd first adds the link and only then listens on the bus therefore we race
with it. Let's watch for the bus presence even for the teamd devices we didn't
add for all their lifetime and recheck for assumed connections as we see them.
2015-01-08 15:16:44 +01:00
Lubomir Rintel
744e35e1d2 Revert "team: start teamd when ensuring team connection else teamdctl_connect() fails"
We don't want to start a teamd instance when there's an externally added team
interface. We just don't want to try to the daemon if it's not there (addressed
by a later commit).

This reverts commit a78386b6d1.

Conflicts:
	src/devices/team/nm-device-team.c
2015-01-08 15:16:44 +01:00
Thomas Haller
fc5a66b14b libnm: fix documentation for nm_utils_file_search_in_paths() 2015-01-08 13:08:56 +01:00
Thomas Haller
abbca50ca9 core: add /bin to the default search path
https://bugzilla.gnome.org/show_bug.cgi?id=742576
2015-01-08 12:58:08 +01:00
Thomas Haller
6eccfda0fa build: fix --enable-lto configure option to allow disabling option explicitly
When specifying '--enable-lto=anything' or '--disable-lto',
the configure script would always set enable_lto=yes.

The only way to disable lto, was *not* specifying the
configure option.

https://bugzilla.gnome.org/show_bug.cgi?id=742575
2015-01-08 12:03:50 +01:00
Thomas Haller
bb90127c2a tests: check for no pending expected_messages on exit of tests
On the end of the test there should be no unchecked expected
messages. Register a destructor function in nmtst to assert
against that.

Also call nmtst_free() in the destructor. That way, we always release
the allocated data without requiring the test to do it explicitly.
2015-01-07 22:47:27 +01:00
Jiří Klimeš
cf0a87c5e4 tui: fix crash when editing DSL connection
Program received signal SIGSEGV, Segmentation fault.
 0x000000000041b3e5 in nmt_page_dsl_constructed (object=0x7fffec0228c0 [NmtPageDsl]) at nmt-page-dsl.c:109
 109		priv->ethernet_page = nmt_page_ethernet_new (conn, nmt_editor_page_device_get_device_entry (NMT_EDITOR_PAGE_DEVICE (dsl)));
 Missing separate debuginfos, use: debuginfo-install libffi-3.0.10-3.fc18.x86_64 newt-0.52.15-1.fc19.x86_64
 (gdb) bt
 #0  0x000000000041b3e5 in nmt_page_dsl_constructed (object=0x7fffec0228c0 [NmtPageDsl]) at nmt-page-dsl.c:109
 #1  0x0000003e9ac161e3 in g_object_newv (object_type=1, object_type@entry=16203872, n_parameters=n_parameters@entry=2, parameters=parameters@entry=0xf74350)
    at gobject.c:1741
 #2  0x0000003e9ac16560 in g_object_new_valist (object_type=object_type@entry=16203872, first_property_name=first_property_name@entry=0x42e524 "connection",
    var_args=var_args@entry=0x7fffffffcef8) at gobject.c:1830
 #3  0x0000003e9ac16894 in g_object_new (object_type=16203872, first_property_name=first_property_name@entry=0x42e524 "connection") at gobject.c:1545
 #4  0x000000000041b504 in nmt_page_dsl_new (conn=<optimized out>, deventry=deventry@entry=0x974690 [NmtDeviceEntry]) at nmt-page-dsl.c:47
 #5  0x000000000041808e in nmt_editor_constructed (object=<optimized out>) at nmt-editor.c:355
 #6  0x0000003e9ac161e3 in g_object_newv (object_type=1, object_type@entry=16174256, n_parameters=n_parameters@entry=4, parameters=parameters@entry=0xf6cec0)
     at gobject.c:1741
 ...
 (gdb) p priv
 $1 = (NmtPageDslPrivate *) 0x0
2015-01-07 19:29:53 +01:00
Thomas Haller
2ef8f6edfe ifcfg: refactor utils_get_ifcfg_name()
No need to allocate a temporary "base" variable. Just
search for the last '/' ourselves.
All the special handling that g_path_get_basename() does,
for example handling empty filenames and removing trailing
slashes, is not needed.

Thereby fix not to return empty names such as from "ifcfg-".
2015-01-07 12:31:49 -05:00
Jiří Klimeš
675d545bcc tui: fix saving "Available to all users" (rh #1176042) 2015-01-07 17:54:13 +01:00
Thomas Haller
e4f32abfec Revert "ifcfg-rh: avoid passing NULL error to connection_from_file_full()"
This reverts commit 35988ec633.

Since commit ffe0fde235,
wireless_connection_from_ifcfg() accepts a missing @error argument.
Revert this commit because the caller then can control whether to
log the error by providing @error.
2015-01-06 15:54:54 +01:00
Pavel Šimerda
4c629b0310 session: prefer new configure options
The main motivation for this change is to be able to build configure
command lines that will work for both old and new versions of
NetworkManager.

Acked-By: Thomas Haller <thaller@redhat.com>
2015-01-06 15:20:30 +01:00
Jiří Klimeš
f7880cf114 build: fix compilation with GLib 2.32
for g_clear_pointer()
2015-01-06 13:12:08 +01:00
Dan Winship
b454267761 libnm-glib: crash when NMRemoteSettings is quickly destroyed (bgo #742138)
NMRemoteSettings queues a bunch of async NMRemoteConnection creations,
but wasn't doing anything to ensure that it was still alive when they
completed. Pointed out by Cosimo Cecchi.

https://bugzilla.gnome.org/show_bug.cgi?id=742138
2015-01-05 15:35:57 -05:00
Pavel Šimerda
0de60b300e session: merge nm-session-monitor-* modules
Merged all session tracking modules into one source file and simplified
it substantially. Now systemd-logind and ConsoleKit support can be built
in at the same time and both are detected at runtime. This is useful on
source based as well as binary distributions.

Original patch written by Fabio Erculiani <lxnay@sabayon.org>, modified
by Pavel Šimerda <psimerda@redhat.com> and Thomas Haller <thaller@redhat.com>.

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

Acked-By: Thomas Haller <thaller@redhat.com>
2015-01-05 18:39:46 +01:00
Pavel Šimerda
eb2eda4408 main: don't initialize the session monitor
The session monitor will be initialized as soon as it's needed.

Acked-By: Thomas Haller <thaller@redhat.com>
2015-01-05 18:39:41 +01:00
Pavel Šimerda
4a9eaa190f session: switch code to nm_session_monitor_{,dis}connect()
Acked-By: Thomas Haller <thaller@redhat.com>
2015-01-05 18:39:17 +01:00
Pavel Šimerda
d42f2c11b7 auth: remove session monitor argument
There's no need to call `nm_session_monitor_get()` individually for each
call to `nm_auth_is_subject_in_acl()`.

Acked-By: Thomas Haller <thaller@redhat.com>
2015-01-05 18:38:44 +01:00
Pavel Šimerda
5fb31ba5d1 session: switch code to nm_session_monitor_session_exists()
Acked-By: Thomas Haller <thaller@redhat.com>
2015-01-05 18:38:22 +01:00