Commit Graph

14477 Commits

Author SHA1 Message Date
Beniamino Galvani
7d00394f40 logging: merge branch 'bg/logging-messages-bgo763040'
Introduce logging helpers where possible, to uniform the format of
messages and prepend a tag specifying the module that generated the
message, along with other useful information (interface name, ...).

https://bugzilla.gnome.org/show_bug.cgi?id=763040
2016-03-04 12:06:51 +01:00
Beniamino Galvani
d6d9f47a32 dhcp: client: use logging helpers 2016-03-04 11:59:37 +01:00
Beniamino Galvani
cc19352e11 dnsmasq-manager: use logging helpers 2016-03-04 11:55:41 +01:00
Beniamino Galvani
627b943d6a ppp-manager: use logging helpers 2016-03-04 11:55:41 +01:00
Beniamino Galvani
24900e26ef bus-manager: use logging helpers 2016-03-04 11:55:41 +01:00
Beniamino Galvani
47a04ad015 audit: use logging helpers 2016-03-04 11:55:41 +01:00
Beniamino Galvani
f48ee45ff0 policy: use logging helpers 2016-03-04 11:55:41 +01:00
Beniamino Galvani
d2cc33a5b9 supplicant: use logging helpers 2016-03-04 11:53:05 +01:00
Beniamino Galvani
505faf0d6d settings: use logging helpers 2016-03-04 11:53:04 +01:00
Beniamino Galvani
1d5ff2160d bluez-manager: use logging helpers 2016-03-04 11:48:04 +01:00
Beniamino Galvani
67473283ca device: improve logging messages
Add a "device" prefix to the messages.
2016-03-04 11:48:04 +01:00
Beniamino Galvani
392c3909d8 dispatcher: use logging helpers 2016-03-04 11:48:04 +01:00
Beniamino Galvani
bb7da812fe device/ethernet: fix crash on 802.1x authentication timeout
Fixes the following:
GLib-GObject-WARNING **: invalid cast from 'NMSimpleConnection' to 'NMSettingsConnection'

Fixes: 06da353242
2016-03-04 11:43:03 +01:00
Thomas Haller
7e091a230a m4: update introspection.m4 with original file from gobject-introspection
Originally m4/introspection.m4 was copied from gobject-introspection
repository. We however modified it in commit f6272144e9.

Reimport the file with latest changes, but still preserving our
workaround.
2016-03-04 09:25:23 +01:00
Thomas Haller
d17aedf91f all: explicitly ignore return values
Coverity warns that usually we check for the return value.
2016-03-04 09:06:21 +01:00
Thomas Haller
9f16498938 route-manager/tests: add assertion for adding route
Not checking the return value is marked by coverity. Just workaround it.
2016-03-04 08:59:36 +01:00
Thomas Haller
f2165ab959 route-manager/tests: add assertion for adding route
Not checking the return value is marked by coverity. Just workaround it.
2016-03-04 08:58:25 +01:00
Thomas Haller
e4af0f6767 libnm: fix clearing real-devices in NMManager's free_devices()
Found by coverity.
2016-03-04 08:56:38 +01:00
Thomas Haller
2d6cf0df19 device: assert for valid device argument in nm_device_remove_pending_action()
Coverity complains in nm-active-connection.c:

   996        if (priv->pending_activation_id) {
      CID 59368 (#1 of 1): Dereference after null check (FORWARD_NULL)4. var_deref_model: Passing null pointer priv->device to nm_device_remove_pending_action, which dereferences it. [show details]
   997                nm_device_remove_pending_action (priv->device, priv->pending_activation_id, TRUE);
   998                g_clear_pointer (&priv->pending_activation_id, g_free);
   999        }
2016-03-04 08:47:44 +01:00
Thomas Haller
1bf76b784f ifcfg-rh/tests: remove call to nm_connection_normalize()
Coverity complains that the return value is not checked.
Normaliziation here is not necessary.
2016-03-04 08:37:54 +01:00
Thomas Haller
21ff042051 all: merge branch 'danw/gerror-bgo762868'
https://bugzilla.gnome.org/show_bug.cgi?id=762868
2016-03-03 19:08:40 +01:00
Thomas Haller
cd4f84b738 all: don't include error->code in log messages
GError codes are only unique per domain, so logging the code without
also indicating the domain is not helpful. And anyway, if the error
messages are not distinctive enough to tell the whole story then we
should fix the error messages.

Based-on-patch-by: Dan Winship <danw@gnome.org>
2016-03-03 18:54:20 +01:00
Dan Winship
6265398b6e all: use g_error_matches()
Use g_error_matches() where we're testing error codes. In particular,
use it rather than looking at only ->code and not also ->domain, which
is just wrong.

[thaller@redhat.com: rebase and modify original patch]
2016-03-03 18:54:20 +01:00
Thomas Haller
01b9b4104c all: clean-up usage of GError
Functions that take a GError** MUST fill it in on error. There is no
need to check whether error is NULL if the function it was passed to
had a failing return value.

Likewise, a proper GError must have a non-NULL message, so there's no
need to double-check that either.

Based-on-patch-by: Dan Winship <danw@gnome.org>
2016-03-03 18:54:20 +01:00
Thomas Haller
7871d850f5 shared: add NM_G_ERROR_MSG() 2016-03-03 18:54:20 +01:00
Beniamino Galvani
c30627f106 settings: set @error on failure of nm_settings_plugin_add_connection() 2016-03-03 18:54:20 +01:00
Lubomir Rintel
99b37d768f iface-helper: fix RA processing with more than one router
We construct new IP6Config on each rdisc_config_changed(). That's not a smart
thing to do, since that makes us throw away the previous configuration.

In case the two routers on the same network, the first RA triggers
rdisc_config_changed() for changed gateway and addresses. On handling the
second RA rdisc_config_changed() doesn't add the address, resulting in the
address being removed on ip6 config sync.

A side effect of this is that the address is still tentative, resulting in DAD
retry and an new address being added. So the networking still works, but at the
expense of a single DAD failure and an address that's perhaps different from what
was expected.
2016-03-03 16:00:56 +01:00
Michael Biebl
0518489b39 tests: fix bashism in run-test-dbus-session.sh
https://bugzilla.gnome.org/show_bug.cgi?id=762940
2016-03-03 13:45:50 +01:00
Beniamino Galvani
89d1e46615 dhcp/systemd: enable DHCPv6 support
Until now the internal DHCP client could start a DHCPv6 transaction
but was not able to parse the lease and pass the information back to
the core. Add the missing glue code to make this work.

https://bugzilla.gnome.org/show_bug.cgi?id=762432
2016-03-03 11:29:27 +01:00
Adrian Likins
6c59443ad5 Fix missing commas in list-devices devtypes dict. 2016-03-02 18:43:28 +01:00
Beniamino Galvani
8f706197fe manager: use logging helpers 2016-03-02 12:16:23 +01:00
Dan Williams
abc700c5c7 libnm-glib/libnm/vpn: fix handling of ConnectInteractive() failure (rh #1298732)
If the plugin supports interactive mode, but the VPN binary (like vpnc
or openvpn) doesn't support it, then the plugin should return
NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED from its connect_interactive()
hook.  This lets NetworkManager know to fall back to plain Connect().

Since this notification is done through an error return, the VPN service
plugin code sees the failure and moves the plugin state back to
STOPPED.  NetworkManager sees that state change, and terminates the
connection attempt while waiting for a reply to the Connect() method.

(VPN service plugins that don't support interactive mode at all don't
have this problem because that error is returned before the plugin's
state is moved to STARTING.)

To fix this, do two things:

1) if the connect_interactive() hook fails and returns the error
NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED, postpone the STOPPED
state change for a few seconds to allow NM time to fall back to
plain Connect().  We still want to move the plugin state back to
STOPPED eventually, because otherwise it could stay in STARTING
forever.

2) change state to STARTING only if the connect/connect_interactive
plugin hooks were successful.  Otherwise the plugin would still be
in STARTING state, and it's not valid to call Connect()/ConnectInteractive()
during the STARTING state.

https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00091.html
https://bugzilla.redhat.com/show_bug.cgi?id=1298732
2016-03-02 11:27:17 +01:00
Thomas Haller
4fb8cf35f4 logging: print timestamp only with msec precision 2016-03-01 15:22:59 +01:00
Thomas Haller
24582b65e1 logging: change logging format to drop "[file:line] func():" part
Choose a new logging format.

- the logging format must not be configurable and it must be the
  same for all backends. It is neat that journal supports additional
  fields, but an average user still posts the output of plain
  journalctl, without "--output verbose" (which would also be hard
  to read).
  Also, we get used to a certain logging format, so having different
  formats is confusing. If one format is better then another, it should
  be used for all backends: syslog, journal and debug.
  The only question is, what is the best format.

- the timestamp: I find it useful to see how much time between two
  events passed. The timestamp printed by syslog doesn't have sufficient
  granularity, and the internal journal fields are not readily available.
  We used to print the timestamps for <error>, <debug> and <trace>,
  but ommited them for <info> and <warn> levels. We now print them for
  all levels, which has a uniform alignment.

- the location: the "[file:line] func():" part is mostly redundant
  and results in wide lines. It also causes a misalignment of the
  logging lines, or -- as I recently added alignment of the location --
  it results in awkward whitespace and truncation.
  But the location is really just necessary because our logging messages
  are bad:
    "<debug> [1456397604.038226] (9) 11-dhclient succeeded"
  The solution to this is not
    "<debug> [1456397604.038226] [nm-dispatcher.c:358] dispatcher_results_process(): (9) 11-dhclient succeeded"
  but a properly worded message:
    "<debug> [1456397604.038226] dispatcher: request #9, script 11-dhclient succeeded"

- logging-message: we need to write better logging messages.
  I like some form of "tags" that are easy to grep:
    "platform: signal: link changed: 4: ..."
  Downside is, that this is not nice to read as a full sentence.
  So, especially for <info> and <warn> logging, more human readable
  messages are better.
  We should find a compromise, where the log message explains what
  happens, but is still concise and contains patterns that are easy
  to grep and identify visually.

https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00077.html
2016-03-01 15:20:57 +01:00
Thomas Haller
684e80b539 platform: add flags argument to nm_platform_ip4_address_add()
The argument is still always unset. We will need it later to set
IFA_F_NOPREFIXROUTE.
2016-03-01 15:09:16 +01:00
Thomas Haller
cc78e06393 platform: track ifa_flags for cached IPv4 addresses
It's useful to track the flags for IPv4 addresses too.

- we might want to sort IPv4 addresses according to whether they
  are permanent or dynamic.

- later we want to set IFA_F_NOPREFIXROUTE also for IPv4 addresses.
  While the ability to "set" a flag doesn't necessarily require that we
  also keep the flags present in NMPlatformIP4Address, it is more consistent.
2016-03-01 15:08:31 +01:00
Thomas Haller
be4472bdcd platform: call ethtool functions via platform
When adding namespace support later, we must call ethtool
from the proper namespace, i.e. via a NMPlatform instance.

Avoid calling ethtool directly.
2016-03-01 15:07:04 +01:00
Thomas Haller
98d14b0c15 systemd/tests: add test_lldp_create() test
This test makes sense because "test-systemd" is not
linked against any other systemd library. So this test
verifies that our libsystemd clone is self contained.
2016-03-01 13:50:16 +01:00
Beniamino Galvani
e0abe36ae7 release: bump version to 1.1.91 (1.2-beta2) 2016-03-01 13:14:46 +01:00
Thomas Haller
67134e7141 core: merge branch 'th/build-core'
Add a test "test-systemd" which links against our copy
of systemd code and a minimal core library. For that,
cleanup and split NetworkManagerUtils.h.
2016-03-01 12:54:22 +01:00
Thomas Haller
51e292885c systemd/tests: add test util for systemd
Most interestingly is also, whether we can link libsystemd.a without
having undefined references (which might be wrongly satisfied by an
externally loaded libsystem shared library.
2016-03-01 12:42:42 +01:00
Thomas Haller
adb56d137e core: split "nm-core-utils.h" out of "NetworkManagerUtils.h"
"NetworkManagerUtils.h" contains a bunch of helper tools for core
daemon ("src/").

Unfortunately, it has dependencies to other parts of core,
such as "nm-device.h" and "nm-platform.h". Split out a part
of tools that are independent so that they can be used without
dragging in other dependencies.

"nm-core-utils.h" should only use libnm-core, "nm-logging.h"
and shared.

"NetworkManagerUtils.h" should provide all "nm-core-utils.h" and
possibly other utilities that have larger dependencies.
2016-03-01 12:42:42 +01:00
Thomas Haller
e4a7502a2c logging: make logging independent of platform
"nm-logging.h" is a basic core module that should have few other
dependencies. Instead of letting nm-logging.c directly call a function
from "nm-linux-platform.c", let platform register a handler as needed.

This way, you can build a core library containing nm-logging but no
nm-platform.
2016-03-01 12:42:42 +01:00
Thomas Haller
60ca6e028f lldp/tests: fix memleaks in test
valgrind complains since commit ae9cc8910d.
2016-03-01 12:41:38 +01:00
Beniamino Galvani
24e3306b87 release: update NEWS 2016-03-01 09:56:14 +01:00
Beniamino Galvani
da01b81ff4 merge: branch 'bg/vlan-reorder-hdr-bgo762626'
https://bugzilla.gnome.org/show_bug.cgi?id=762626
2016-02-29 18:23:15 +01:00
Beniamino Galvani
da70fbd7d5 libnm-core: remove special handling of missing VLAN_FLAGS
On older NM versions the default value for vlan.flags was 0, but then
the actual value set on interfaces was REORDER_HDR. In order to
maintain backwards compatibility in behavior, remove the special
handling of vlan.flags so that a missing key is treated as the default
value REORDER_HDR.

https://bugzilla.gnome.org/show_bug.cgi?id=762626
2016-02-29 18:11:17 +01:00
Beniamino Galvani
2e5e7285a8 ifcfg-rh: change the handling of REORDER_HDR flag
On NM 1.0 connections were created by default without the REORDER_HDR
flag, but then due to a bug in platform code (fixed in [1]), the
kernel interface always had the flag set.

Now that the setting is honored, users upgrading to the new version of
NM will see a change from the previous behavior, since interfaces will
not have REORDER_HDR and this will certainly break functionality.

The only solution here seems to be to ignore the REORDER_HDR variable
in ifcfg files (since it never had any effect) and introduce a new
NO_REORDER_HDR option for the VLAN_FLAGS variable which allows to turn
the flag off. The consequence is that the flag will be set for all old
connections.

This change introduces an incompatibility with initscripts, however is
necessary to avoid breaking user functionality upon upgrade.
Connections created through NetworkManager will still be parsed
correctly by initscripts (since we always write the REORDER_HDR
variable).

[1] db62fc9d72 ("platform: fix adding VLAN flags")

https://bugzilla.gnome.org/show_bug.cgi?id=762626
2016-02-29 18:11:17 +01:00
Thomas Haller
eb80f69098 utils: add nm_utils_strbuf_init() macro 2016-02-29 17:46:41 +01:00
Thomas Haller
7f43e0a7b3 platform/trivial: rename NMPlatformIP6Address's "flags" field to "n_ifa_flags"
There are far too many "flags". Rename the "flags" to "n_ifa_flags"
which reminds to "ifa_flags" in 'struct ifaddrmsg', but with a
distinctive "n_" prefix.
2016-02-29 16:27:08 +01:00