Commit Graph

7207 Commits

Author SHA1 Message Date
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
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
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
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
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
Thomas Haller
655b85bfea logging: replace using _LOGL_N by G_N_ELEMENTS()
At various places we used _LOGL_N to check the index
before accessing one of our static arrays. Instead use
G_N_ELEMENTS().
2015-08-04 11:21:56 +02:00
Thomas Haller
d3b91eb258 logging/trivial: rename LOGL_MAX to _LOGL_N
The name LOGL_MAX was misleading, because it is not
the "maximum" logging level, but the number of different
levels. Rename it.
2015-08-04 11:21:48 +02:00
Beniamino Galvani
532ed38a3c settings: add audit support 2015-08-04 09:32:12 +02:00
Beniamino Galvani
f834a08d0b manager: add audit support 2015-08-04 09:32:12 +02:00
Beniamino Galvani
0d4dfe5007 settings-connection: add audit support 2015-08-04 09:32:12 +02:00
Beniamino Galvani
9ce005da34 device: add audit support 2015-08-04 09:32:12 +02:00
Beniamino Galvani
e49cc5dfcd auth-utils: add nm_auth_chain_get_subject() 2015-08-04 09:32:12 +02:00
Beniamino Galvani
be49a59fb6 core: add audit support
Introduce some primitives to deliver messages about relevant
configuration changes to the Linux audit subsystem through libaudit
(if enabled at build time) and to the logging system.
2015-08-04 09:32:12 +02:00
Beniamino Galvani
41e7051165 logging: add AUDIT domain 2015-08-04 08:46:11 +02:00
Beniamino Galvani
4fb0d62802 build: remove SELinux AM_CONDITIONAL from configure.ac 2015-08-04 08:46:11 +02:00
Thomas Haller
1c2883c940 platform/tests: fix assertion for test-link for team device
Seems that team changed to now also raise two change signals.
Relax the assertion that broke tests on Fedora 22.
2015-08-01 11:18:26 +02:00
Dan Williams
e8139f56c2 core: split device creation and device setup (bgo #737458)
Future patches will create devices long before they are backed by
kernel resources, so we need to split NMDevice object creation from
actual setup based on the backing resources.

This patch combines the NMDeviceFactory's new_link() and
create_virtual_device_for_connection() class methods into a single
create_device() method that simply creates an unrealized NMDevice
object; this method is not expected to fail unless the device is
supposed to be ignored.  This also means that the NMDevice
'platform-device' property is removed, because a platform link
object may not be available at NMDevice object creation time.

After the device is created, it is then "realized" at some later
time from a platform link (for existing/hardware devices via the
realize() method) or from an NMConnection (for newly created software
devices via the create_and_realize() NMDeviceClass methods).

https://bugzilla.gnome.org/show_bug.cgi?id=737458
2015-07-31 14:06:09 -05:00
Beniamino Galvani
cf455aa0e2 ifcfg-rh: properly write the wake-on-lan property
ETHTOOL_OPTS must be cleared when the wake-on-lan value is 'default'
and a "wol d" string must be appended when the value is 'none'.

Fixes: 2e0d0bc050
2015-07-30 16:56:27 +02:00
Beniamino Galvani
d1b6835ada settings: fix failed assertion 'owner != NULL in nm-agent-manager.c
Let NMSecretAgent emit the 'disconnected' event when dbus_owner is
still valid so that receivers of the signal can query it. This fixes
the following failed assertion:

    remove_agent: assertion 'owner != NULL' failed

Fixes: 2a2fd1216b
2015-07-30 16:42:21 +02:00
Thomas Haller
d2d40cc75b vpn: refactor vpn-manager to use NMVpnPluginInfo
Use NMVpnPluginInfo to load the plugins in NMVpnManager.

This has the advantage of reusing the code from libnm
to use the same approach to read the plugin config files.

Another advantage is that we now check the file permissions
of the config file.
2015-07-29 22:34:35 +02:00
Beniamino Galvani
5f7f38a586 wwan: trivial: fix typos in error strings
Reported-by: m.manico@gmx.at
2015-07-29 15:34:43 +02:00
Dan Winship
02370be7f3 core: rename NMDBusManager to NMBusManager
Our gdbus generated types use the same names as their corresponding
"real" types, but with "NM" changed to "NMDBus".

Unfortunately, that means that introspection/nmdbus-manager.c (the
generated type for src/nm-manager.c) uses the same type name as the
entirely unrelated src/nm-dbus-manager.c.

Fix this by removing the "d" from src/nm-dbus-manager.c. (We could
rename the generated type instead, but then it becomes inconsistent
with all the other generated types, and we're already using it as
"NMDBusManager" in libnm/nm-manager.c.)
2015-07-24 13:25:48 -04:00
Dan Winship
1424f249e3 settings: fix/reorganize NMSettingConnection secrets code
NMSettingConnection's for_each_secret() function works in a
slightly-too-GHashTable-specific way. Reorganize the code now to make
the change to GVariants easier later.

Also, fix a few bugs:
  - In the (unlikely) case of a non-secret being stored in
    vpn.secrets, we were treating it as though it was a secret
    with flags NONE.
  - The code was comparing against NONE when it meant !AGENT_OWNED
    in a few places. (With the current set of NMSettingSecretFlags
    values, this worked, but in the future it might not.)
  - In some cases we never called for_each_secret() with the
    @remove_non_secrets flag, meaning we might have ended up
    passing non-secrets to other code.
2015-07-24 13:25:48 -04:00
Dan Winship
2a2fd1216b settings: rework NMSecretAgent disconnection detection
Have NMSecretAgent emit "disconnected" when it detects that it has
been disconnected, rather than having both the agent and the agent
manager monitor it separately.
2015-07-24 13:25:47 -04:00
Dan Winship
1bcf42f37b bluetooth, vpn-manager: use GDBusProxies to monitor services
Create a GDBusProxy for the service to be monitored and use that to
tell whether it is running, rather than using NMDBusManager and the
global NameOwnerChanged signal.
2015-07-24 13:25:47 -04:00
Dan Winship
94078a139a core: port NMDhcp4Config/NMDhcp6Config to GVariant
In the gdbus port, the :options properties will be GVariant-valued
(and thus immutable), so having APIs that let you repeatedly modify
them would make things complicated. Since we actually only ever set
all the options at once, just change the APIs to do that, rather than
setting the options one-by-one.

Since nm-dispatcher already works in terms of GVariant, it makes
things simpler there if NMDhcp[46]Config can return its options as a
GVariant. And since we'll need it to be a GVariant internally later
anyway, just port everything to GVariant now, and convert it to a
GHashTable for dbus-glib only in get_property().
2015-07-24 13:25:47 -04:00
Dan Winship
c1dd3b6eed core: move D-Bus export/unexport into NMExportedObject
Move D-Bus export/unexport handling into NMExportedObject and remove
type-specific export/get_path methods (export paths are now specified
at the class level, and NMExportedObject handles the counters for all
exported types automatically).

Since all exportable objects now use the same get_path() method, we
can also add some helper methods to simplify get_property()
implementations for object-path and object-path-array properties.
2015-07-24 13:25:47 -04:00
Dan Winship
6fcc1deee0 core: add an NMExportedObject base class
Add NMExportedObject, make it the base class of all D-Bus-exported
types, and move the nm-properties-changed-signal logic into it. (Also,
make NMSettings use the same properties-changed code as everything
else, which it was not previously doing, presumably for historical
reasons).

(This is mostly just shuffling code around at this point, but
NMExportedObject will be more important in the gdbus port, since
gdbus-codegen doesn't do a very good job of supporting objects that
export multiple interfaces [as each NMDevice subclass does, for
example], so we will need more glue/helper code in NMExportedObject
then.)
2015-07-24 13:25:47 -04:00
Dan Winship
f3d10b3ec8 core: add missing g_dbus_error_strip_remote_error() calls 2015-07-24 13:25:47 -04:00
Dan Winship
3452ee2a0e all: rename nm-glib-compat.h to nm-glib.h, use everywhere
Rather than randomly including one or more of <glib.h>,
<glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include
"nm-glib-compat.h" most of the time), rename nm-glib-compat.h to
nm-glib.h, include <gio/gio.h> from there, and then change all .c
files in NM to include "nm-glib.h" rather than including the glib
headers directly.

(Public headers files still have to include the real glib headers,
since nm-glib.h isn't installed...)

Also, remove glib includes from header files that are already
including a base object header file (which must itself already include
the glib headers).
2015-07-24 13:25:47 -04:00
Dan Winship
dd0e198955 include: add nm-dbus-compat.h
Add a file containing the defines like DBUS_INTERFACE_DBUS from
dbus-shared.h, and use it from the gdbus-using files.

Also, convert a bunch of other places that were previously hardcoding
the string values to use the defines instead, and fix the ifcfg-rh
plugin to properly namespace its own D-Bus-related defines.
2015-07-24 13:25:47 -04:00
Dan Winship
f2174b623f ppp-manager: trivial: move class_init function 2015-07-24 13:25:47 -04:00
Thomas Haller
8bca864111 core: move NM_DEFINE_SINGLETON macros to src/NetworkManagerUtils.h
NM_DEFINE_SINGLETON is used only by core and makes use of nm-logging.
It does not belong to "include/nm-macros-internal.h". Move it to "src/".
2015-07-24 18:07:16 +02:00
Thomas Haller
981817e998 Revert "core: move NM_DEFINE_SINGLETON macros to src/NetworkManagerUtils.h"
This reverts commit 1bca459865.

I accidentely pushed that commit. Revert.
2015-07-24 16:24:22 +02:00
Thomas Haller
1bca459865 core: move NM_DEFINE_SINGLETON macros to src/NetworkManagerUtils.h
NM_DEFINE_SINGLETON is used only by core and makes use of nm-logging.
It does not belong to "include/nm-macros-internal.h". Move it to "src/".
2015-07-24 15:45:46 +02:00
Beniamino Galvani
996cbcd25c core: configure Wake-on-LAN parameters for Ethernet devices 2015-07-24 14:02:59 +02:00
Beniamino Galvani
2e0d0bc050 ifcfg-rh: add support for Wake-on-LAN ethtool options
Based on branch danw/wip/ethtool by Dan Winship <danw@redhat.com>
2015-07-24 14:02:59 +02:00
Thomas Haller
6a5657896f keyfile: rename keyfile when user changes connection id
Originally, if you change the ID of a connection,
the existing keyfile will not be renamed. That means
after renaming a connection, it's keyfile name will
mismatch.

Now, when th user modifies a connection via D-Bus and changes
the connection it, rename the file.

https://bugzilla.gnome.org/show_bug.cgi?id=740738
2015-07-24 11:10:18 +02:00
Thomas Haller
238cb02ed6 keyfile: cleanup error messages in _internal_write_connection()
A GError should contain a nice, human readable error message. The
file:line prefix looks ugly. Also, the error messages are already
systemwide unique. So a user can easily grep for them and locate
the origin.
2015-07-24 11:04:01 +02:00
Thomas Haller
d5d34ec107 keyfile: refactor return paths in _internal_write_connection() 2015-07-24 11:04:01 +02:00
Thomas Haller
c0b03debc8 keyfile: add info logging when updating connection 2015-07-24 11:04:01 +02:00
Thomas Haller
c863d2ad0f keyfile: fix memleak of path in commit_changes() 2015-07-24 11:04:01 +02:00