Commit Graph

15047 Commits

Author SHA1 Message Date
Dan Winship
7f6e39ec6e dhcp-manager: port to gdbus
The existing code was somewhat confusing because it used
string->GValue hash tables in some places, and string->string hash
tables in other places. In the new version, the string->GValue hash
tables become GVariants, but the string->string hash tables stay as
hash tables, so you can tell them apart more easily.
2015-08-10 09:41:26 -04:00
Dan Winship
8f36727ac8 ppp-manager: port to gdbus 2015-08-10 09:41:26 -04:00
Dan Winship
c050fb7cd2 devices, active-connection: port to gdbus 2015-08-10 09:41:26 -04:00
Dan Winship
df6706813a settings: port to gdbus 2015-08-10 09:41:26 -04:00
Dan Winship
9f8de603e3 ifcfg-rh: port to gdbus 2015-08-10 09:41:26 -04:00
Dan Winship
4b823a86c9 core: port NMBusManager to gdbus
Also remove some now-unused NMBusManager API
2015-08-10 09:41:26 -04:00
Dan Winship
073991f5a8 core: port NMExportedObject to gdbus
Port NMExportedObject to gdbus, and make
nm_exported_object_class_add_interface() deal with generating D-Bus
skeleton objects and attaching signal handlers and property bindings
as needed to properly handle methods, signals, and properties.
2015-08-10 09:41:26 -04:00
Dan Winship
284e15a877 core: make NMManager singleton more like others
Rename nm_manager_new() to nm_manager_setup(), and change the local
@singleton variable to @singleton_instance. (Also, add a local @self
variable inside nm_manager_setup().)

Also, make NMManager own NMSettings rather than having them both owned
by main().
2015-08-10 09:41:26 -04:00
Dan Winship
b7911bae51 core: better order the code at startup
NM was calling nm_bus_manager_start_service() to claim its bus name
before it exported any of its objects, but this didn't matter under
dbus-glib, because no client connections would be accepted until the
main loop was started later on, by which point we would have exported
everything.

But with gdbus, method calls are initially received in the gdbus
worker thread, which means that clients would be able to connect right
away and then be told that the expected interfaces don't exist.

So move the nm_bus_manager_start_service() call to occur after
creating NMSettings and NMManager (and, indirectly, NMAgentManager).
This requires splitting out the slow parts of nm_settings_new() into a
new nm_settings_start(), so that we can create and export it first,
and then read the connections, etc afterward. (Likewise, there were
still a few potentially-slow bits in nm_manager_new() which are now
moved into nm_manager_start().)
2015-08-10 09:41:26 -04:00
Dan Winship
1c11c5cff1 core: fix NMManager in private-bus-only case
NMManager was failing to initialize if there was only a private bus,
despite the fact that this is exactly the use case that the private
bus was added for.

The only other potentially-failing code in nm_manager_new() was adding
prop_filter to the D-Bus connection, but this can't really fail, so
just assert that it doesn't. And now, nm_manager_new() always
succeeds, so update the caller for that.
2015-08-10 09:41:25 -04:00
Lubomir Rintel
c44069c10a device: avoid setting MTU to zero if undefined 2015-08-10 14:10:17 +02:00
Thomas Haller
b503b02cac libnm: add NM_AVAILABLE_IN_1_2 for API nm_access_point_get_last_seen()
Fixes: 1e85c35846
2015-08-09 14:37:10 +02:00
Thomas Haller
311b90080f libnm-glib: add NM_AVAILABLE_IN_1_2 for API nm_access_point_get_last_seen()
Fixes: f3b8285be5
2015-08-09 14:36:55 +02:00
Thomas Haller
8bce48d8bf libnm: backport symbol nm_access_point_get_last_seen@libnm_1_0_6
nm_access_point_get_last_seen() was backported for 1.0.6 in
commit fade4ded37e16e44ff75947dd22d054789c5a2a7.
2015-08-09 12:20:01 +02:00
Dan Winship
578e5e53c0 core: fix runtime warning when building without libaudit
If !HAVE_LIBAUDIT then sizeof(NMAuditManagerPrivate) was 0, which
upset g_type_class_add_private(). (It's also not valid C.)

Fix things up so that NMAuditManagerPrivate as a whole only exists if
HAVE_LIBAUDIT.
2015-08-07 16:46:33 -04:00
Eric Koegel
0db81e1014 sleep-monitor: add support for ConsoleKit2 inhibit
ConsoleKit2 has added the same suspend/resume DBUS API that Systemd
uses. This patch adds the code to use ConsoleKit2's inhibit API.
http://consolekit2.github.io/ConsoleKit2/#Manager.Inhibit

[thaller@redhat.com: modified original patch]

https://bugzilla.gnome.org/show_bug.cgi?id=752836
2015-08-07 11:45:57 +02:00
Thomas Haller
558117222f device: merge branch 'th/device-ignore-auto-bgo752546'
https://bugzilla.gnome.org/show_bug.cgi?id=752546
2015-08-06 17:55:22 +02:00
Thomas Haller
43e6f6a178 device: only 'ignore-auto-routes' and 'ignore-auto-dns' for certain settings
During merge_and_apply(), we merge several NMIPxConfig into a new
@composite. For 'ignore-auto-routes' and 'ignore-auto-dns', we want to
prevent certain routes/dns-settings to be merged.

But it is wrong to reject settings from all partial configs.
For example, especially ext_ipx_config and vpn_ipx_config contain
routes that we still must merge and preserve.

This was recently changed by 79630c11e5
and previously by ab6548c62134518ba2871306397e7fb9c84260ca. But it was
wrong for a long time already.

Also note, that nm_ip4_config_merge() now also ignores NIS, WINS, and
dns-options.

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

Fixes: 79630c11e5
2015-08-06 17:52:55 +02:00
Thomas Haller
f7a8962dd4 core: add @merge_flags argument to nm_ip4_config_merge() and nm_ip6_config_merge()
The new flags are not yet used, so there is no change in functionality.

The flags NM_IP_CONFIG_MERGE_NO_ROUTES and NM_IP_CONFIG_MERGE_NO_DNS go
together with the 'ignore-auto-routes' and 'ignore-auto-dns' setting.

Note that for IPv4, NM_IP_CONFIG_MERGE_NO_DNS also ignores NIS, WINS, and dns-options.
This is different from current other places that handle 'ignore-auto-dns'
and only care about nameservers, domains, and searches.
2015-08-06 17:52:55 +02:00
Beniamino Galvani
54d10f0ec1 device: fix memory leak in act_stage3_ip6_config_start()
If linklocal6_start() finds that the device already has an IPv6
link-local address and returns NM_ACT_STAGE_RETURN_FINISH, we don't
need to fill @out_config with an empty configuration. A non-NULL
@out_config is required only for ret = NM_ACT_STAGE_RETURN_SUCCESS.

Fixes: 396dc2b3b4
2015-08-05 18:04:51 +02:00
Thomas Haller
c0138fa7e7 contrib/rpm: compile audit support but disable by default
The default SELinux policy on current RHEL and Fedora distributions
does not allow for NetworkManager to use audit. Hence, unless the user
changes the SELinux policy it will not work.

Disable auditing by default, but have it compiled so that the user can
enable it via "NetworkManager.conf".
2015-08-05 17:05:01 +02:00
Thomas Haller
97ec44f593 libnm: fix gtkdoc for nm_utils_enum_to_str() and nm_utils_enum_from_str()
Fixes: 8be9814793
2015-08-05 16:35:26 +02:00
Thomas Haller
1766ab6e21 libnm: fix gtkdoc for _nm_utils_dns_option_*()
Fixes: 019943bb5d
2015-08-05 16:33:44 +02:00
Thomas Haller
d81e8b96d2 libnm: fix gtkdoc for nm_setting_ip_config_next_valid_dns_option()
Fixes: 019943bb5d
2015-08-05 16:32:00 +02:00
Thomas Haller
eef0342bcc libnm/test: use (void) for empty parentheses in function prototype
Fixes: ec92ecedae
2015-08-05 16:24:12 +02:00
Thomas Haller
b7de900b90 build: fix out-of-tree build for missing "nm-version.h"
Fixes: 19c3ea948a
2015-08-05 16:15:03 +02:00
Colin Walters
50f9c8aa7e utils: use (void) for empty arguments
In C, `()` doesn't do what you want by default.

Fixes: 2cf274c03e
2015-08-05 16:03:06 +02:00
Thomas Haller
796ec5c038 all: merge branch 'th/nm-default-bgo752857'
- order destruction of singletons

- add new header "nm-default.h" to always include a set of standard
  headers.

https://bugzilla.gnome.org/show_bug.cgi?id=752857
2015-08-05 15:37:52 +02:00
Dan Winship
22e1a97e12 all: drop includes to <glib/gi18n.h> for "nm-default.h"
The localization headers are now included via "nm-default.h".

Also fixes several places, where we wrongly included <glib/gi18n-lib.h>
instead of <glib/gi18n.h>. For example under "clients/" directory.
2015-08-05 15:35:51 +02:00
Thomas Haller
7363dc94c6 nm-default: include i18n headers via "nm-default.h" 2015-08-05 15:32:40 +02:00
Thomas Haller
19c3ea948a all: make use of new header file "nm-default.h" 2015-08-05 15:32:40 +02:00
Thomas Haller
9ac57182ca include: add convenience header "nm-default.h"
This internal header file should be included by our internal source
code files and header files. It includes in one place other headers
that constitute to a minimal set of required headers. Most notably
this is <glib.h> and our "nm-glib.h" header.

Note that public header files and example source code cannot include
this file as "nm-default.h" is internal only.
2015-08-05 15:32:39 +02:00
Thomas Haller
780e9a3f43 libnm: include header in public header file with angle brackets 2015-08-05 15:25:30 +02:00
Thomas Haller
37c9f62e5d all: include internal headers with quotes 2015-08-05 15:25:29 +02:00
Thomas Haller
5ebea89252 supplicant/test: fix wrong usage of nmtst_init() inside core tests 2015-08-05 15:25:29 +02:00
Thomas Haller
cc16e94562 core: log setup of singleton instances 2015-08-05 15:25:29 +02:00
Thomas Haller
2cf274c03e core: order destruction of singleton instances
Previously, the order of destructing singleton instances
was undefined. Now, have singleton instances register their
destruction via nm_singleton_instance_register().

Objects that are registered later, will be destructed earlier. IOW,
they will be destroyed in reverse order of construction.

This is only a crude method to get the lifetime of singleton instances
right by default. Having singletons ref other singletons to keep them
alive gives more control over the lifetimes of singletons. This change
of having a defined order of destruction does not conflict with taking
references to singletons (and thus extending their lifetime).

Note that previously, NMPlatform was not registered for destruction.
We don't change that yet and intenionally leak a reference.
2015-08-05 15:23:57 +02:00
Thomas Haller
e0bded93f3 libnm: avoid deprecated warning for NMVpnPluginInfo
When merely including "nm-vpn-plugin-info.h" (or "NetworkManager.h")
gcc raises warnings like:
  "Not available before 1.2 [-Werror=deprecated-declarations]"

The problem is that the NMVpnPluginInfo typedef itself is marked as
deprecated but also used by other functions like nm_vpn_plugin_info_get_name().

    typedef struct {
        int field;
    } Foo G_UNAVAILABLE(1,2);

    G_UNAVAILABLE(1,2)
    void deprecated_function (Foo *foo);

    warning: ‘Foo’ is deprecated: Not available before 1.2 [-Wdeprecated-declarations]

I think that when a function is itself deprecated, gcc should not warn about
the use of a deprecated typedef.
Gcc's documentation states: "Note that the warnings only occur for
uses and then only if the type is being applied to an identifier
that itself is not being declared as deprecated.".
Apparently, this only works for structs, but not for typedef of structs.

Anyway. Remove the deprecation from NMVpnPluginInfo to avoid the compiler
warning.

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

Fixes: d6226bd987
2015-08-04 15:59:32 +02:00
Beniamino Galvani
f8ae5f1671 libnm-core: trivial: fix glib-mkenums parse warning
Avoid a new line in the definition of enum value to fix the following
glib-mkenums warning:

  glib-mkenums: nm-setting-wired.h:71:
  Failed to parse ` - 1 - NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT) '

Fixes: 5622461c04
2015-08-04 14:50:30 +02:00
Lubomir Rintel
a983552308 merge: fix MTU handling
https://bugzilla.gnome.org/show_bug.cgi?id=752508
2015-08-04 14:23:54 +02:00
Thomas Haller
d7ca945a9f build: print configure result for default configuration values in a common format 2015-08-04 14:16:23 +02:00
Thomas Haller
98cd83e578 build: fix configure bug for detecting libaudit support
Fixes: c4c0bbb28c
2015-08-04 14:15:27 +02:00
Thomas Haller
c4c0bbb28c audit-manager: enable logging.audit by default when libaudit support is available
Previously, when compiling NetworkManager with libaudit support, it
was disabled by default and only used after setting logging.audit=true.

Turn that around. If we compile NetworkManager with audit support, we also
enable it by default. The user can then explicitly disable it by
configuring logging.audit in NetworkManager.conf.

But also, add a configure option 'yes-disabled-by-default' to compile
with audit support, but have it disabled by default. This would be the
previous behavior, but it must be enabled explicitly.

Fixes: be49a59fb6
2015-08-04 13:44:55 +02:00
Lubomir Rintel
f7f9e734aa device: lower serverity of MTU adjustment logging
Warn is probably too harsh, but we still need to log the reason for the change.
2015-08-04 13:43:31 +02:00
Lubomir Rintel
a92d8b0c67 device: don't modify the device MTU if it's unset
The MTU of 0 means default, not zero-length packets:

  <warn>  (wlp3s0): Lowering IPv6 MTU (1472) to match device MTU (0)
  <warn>  (wlp3s0): IPv6 MTU (0) smaller than 1280, adjusting
  <warn>  (wlp3s0): Raising device MTU (0) to match IPv6 MTU (1280)
  <error> [1437068831.306733] [platform/nm-linux-platform.c:2440] sysctl_set(): platform-linux: sysctl: failed to set '/proc/sys/net/ipv6/conf/wlp3s0/mtu' to '1472': (22) Invalid argument

Reported-by:  Jan Alexander Steffens <jan.steffens@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=752508
2015-08-04 13:43:31 +02:00
Yuri Chornoivan
1bebb91860 po: updated Ukranian translation (bgo #752817)
https://bugzilla.gnome.org/show_bug.cgi?id=752817
2015-08-04 12:58:12 +02:00
Thomas Haller
63d27397db logging: merge branch 'th/logging-off-bgo753128'
https://bugzilla.gnome.org/show_bug.cgi?id=753128
2015-08-04 11:25:21 +02:00
Thomas Haller
8a4ad96ec1 logging: remove dummy logging domain "NONE"
"NONE" was wrongly part of @domain_descs and thus advertised
via `NetworkManager --help`. But since its @num was set to
LOGD_NONE (zero), it was already rejected by nm_logging_setup().
2015-08-04 11:21:57 +02:00
Thomas Haller
4e26ef55c6 logging: minor refactoring in nm_logging_setup() 2015-08-04 11:21:57 +02:00
Thomas Haller
8c3f1812ea logging: support an "OFF" logging level
The only way to disable logging for a domain entirely is to
omit the domain from the "domains" list. For example:

  "level=INFO, domains=PLATFORM,..."

Now add an explicit level "OFF" to facilitate configuration like:

  "level=INFO, domains=ALL,WIFI_SCAN:OFF"

It also supports
  "level=OFF, domains=PLATFORM:INFO"
but this is for the most part equivalent to
  "level=INFO, domains=PLATFORM"
2015-08-04 11:21:57 +02:00