Commit Graph

21088 Commits

Author SHA1 Message Date
Thomas Haller
9d9dd84a71 ifcfg-rh: merge branch 'th/ifcfg-ignore-other' 2016-03-04 18:32:13 +01:00
Thomas Haller
86ccdcf366 ifcfg-rh: log debug level message when loading of ifcfg file fails for common reasons 2016-03-04 18:31:03 +01:00
Thomas Haller
7e4178b383 ifcfg-rh: skip loading files for unhandled types due to existing ifup script
When an ifcfg file doesn't specify the TYPE, ifup will
look for a script "ifup-${DEVICETYPE}", where DEVICETYPE
is determined as
  [ -z "$DEVICETYPE" ] && DEVICETYPE=$(echo ${DEVICE} | sed "s/[0-9]*$//")

Avoid handling such files by checking that no such ifup script exists.
2016-03-04 18:31:03 +01:00
Thomas Haller
9e4abc99e7 ifcfg-rh: ignore "sit" connections without explicit TYPE based on IPV6TUNNELIPV4
If a ifcfg file has no TYPE=sit, we would detect it as ethernet,
although the presence of IPV6TUNNELIPV4 indicates that it of type
"sit". Ignore such connections.
2016-03-04 18:11:48 +01:00
Thomas Haller
8ccba8d09f ifcfg-rh/tests/trivial: remove self-explanatory comments 2016-03-04 18:11:45 +01:00
Thomas Haller
2ff11525c6 nmtst: convert nmtst_assert_error() to a macro to preserve func:line information
Within the macro, the assertion print the proper location of where
the failure happens, instead of pointing to "nm-test-utils.h".
2016-03-04 17:01:41 +01:00
Beniamino Galvani
0fe8a557f8 merge: branch 'bg/sethostname-hostnamed-rh1308974'
Use hostnamed to set the transient hostname when possible.

https://bugzilla.redhat.com/show_bug.cgi?id=1308974
2016-03-04 14:33:01 +01:00
Beniamino Galvani
14d3103ba9 policy: move code from set_system_hostname() to _set_hostname() 2016-03-04 14:27:09 +01:00
Beniamino Galvani
f87d25f7a1 policy: simplify set_system_hostname()
Move some conditionals to the beginning of the function.
2016-03-04 14:27:09 +01:00
Beniamino Galvani
4090716d96 core: use hostnamed to set the transient hostname
In commit 6dc35e66d4 ("settings: add hostnamed support") we started
to use systemd-hostnamed for setting the system static hostname
(i.e. the one written to /etc/hostname), but nm-policy.c still called
sethostname() to set the transient (dynamic) hostname when this needs
to be changed, for example after a reverse lookup of our dynamic IP
address.

Thus, when using systemd the hostname change failed because process'
capabilities are restricted and sethostname() requires CAP_SYS_ADMIN.

We should set also the transient hostname through hostnamed when this
is available.

https://bugzilla.redhat.com/show_bug.cgi?id=1308974
2016-03-04 14:27:09 +01:00
Thomas Haller
298ab55225 platform: cleanup logging for udev-add event 2016-03-04 13:19:34 +01:00
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