Commit graph

15603 commits

Author SHA1 Message Date
Thomas Haller
a82b7c8d5e ifcfg-rh: accept TEAM connections also without DEVICETYPE setting
Allow omitting DEVICETYPE=Team or DEVICETYPE=TeamPort and accept
team connections based on the presence of TEAM_CONFIG/TEAM_MASTER
alone.

Also, check first for a team slave before checking for bond
slave. That is what initscripts do and matters if somebody wrongly
sets MASTER and TEAM_MASTER.

libteam:     20d45a1e02
initscripts: https://git.fedorahosted.org/cgit/initscripts.git/commit/?id=3235be4a3da91bc91c698b318935240dbdf81aac

https://bugzilla.redhat.com/show_bug.cgi?id=1367180
(cherry picked from commit 114eb5b963)
2016-08-26 12:56:56 +02:00
Thomas Haller
6de181247f ifcfg-rh: make out_unhandled argument non-optional
Depending on the connection we are about to read,
we would assert that the user provided a @out_unhandled
argument.

That means, the user must always provide a valid @out_unhandled
pointer, because he cannot know beforehand how the reading
of the ifcfg file goes.

(cherry picked from commit 50d7ac4af3)
2016-08-26 12:56:55 +02:00
Thomas Haller
1d909f4229 ifcfg-rh: clear IP settings for slave connections
Clear some IP related entries from the ifcfg-rh file if
the connection is a slave connection.

Also, drop utils_ignore_ip_config(). It is guaranteed, that
writer only handles connections that verify(). Such connections
have an IPv4/IPv6 setting if (and only if) they are not slave
types.

https://bugzilla.redhat.com/show_bug.cgi?id=1368761
(cherry picked from commit cf7b8866ce)
2016-08-26 11:40:32 +02:00
Lubomir Rintel
b29683782c release: bump to 1.4.1 (development) 2016-08-24 22:06:51 +02:00
Lubomir Rintel
93b4119a81 release: bump version to 1.4.0 2016-08-24 18:48:19 +02:00
Beniamino Galvani
2a56c07092 dhcp/systemd: honor timeout for DHCPv6
https://bugzilla.gnome.org/show_bug.cgi?id=770329
(cherry picked from commit bdaa3acfc3)
2016-08-24 18:01:18 +02:00
Lubomir Rintel
afab2b8112 cli: only connect handlers for property changes in interactive edit
Fixes: c5324ed285
(cherry picked from commit 79c81bbb8c)
2016-08-24 17:27:55 +02:00
Lubomir Rintel
2f45665559 cli: default to method=manual when adding an address
This restores accidentally changed behavior for
"nmcli c add ... ip[46] <address>"

Fixes: c5324ed285
(cherry picked from commit 195ad4ec97)
2016-08-24 17:27:55 +02:00
Thomas Haller
890c37ebd0 team: merge branch 'th/team-invalid-config-rh1366300'
https://bugzilla.redhat.com/show_bug.cgi?id=1366300

(cherry picked from commit eb982b9d94)
2016-08-24 11:00:02 +02:00
Thomas Haller
5b9f7169ed libnm-core/team: normalize invalid config to NULL
A user may very well have connections on disk with bogus json.
Such connections may have failed to activate before, but rejecting
them now as invalid means that we stop loading them from disk. That is,
they disappear after upgrade.

Instead of doing that, also accept invalid json (beside "") and
normalize/coerce it to NULL.

https://bugzilla.redhat.com/show_bug.cgi?id=1366300
(cherry picked from commit 476810c290)
2016-08-24 10:59:39 +02:00
Lubomir Rintel
5f1662066d libnm-core/team: treat "" team config as no config
https://bugzilla.redhat.com/show_bug.cgi?id=1366300
(cherry picked from commit 0fc8b856c3)
2016-08-24 10:59:39 +02:00
Thomas Haller
9382fb0213 device/team: fix assuming non-NULL team-config in NMDeviceTeam::act_stage1_prepare()
(cherry picked from commit 4f6fd1bf0e)
2016-08-24 10:59:39 +02:00
Thomas Haller
07e8ddbfd8 NEWS: update
(cherry picked from commit 0a04b55491)
2016-08-23 22:52:28 +02:00
Thomas Haller
965df5c571 NEWS: fix spelling
(cherry picked from commit 154c86efc6)
2016-08-23 22:44:24 +02:00
Lubomir Rintel
aa0ebcc324 tests: try to resolve the .so file symbols
At some point, linker on ppc64le would throw away useful symbols along with the
garbage: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1c9177d9a5c3e06d3344347c8068acfb7d8ecc8b

Add a post-build check so that the distributors running broken binutils
would catch this early and fix their toolchain (or disable the garbage
collecting at the expense of larger and slower binaries).

(cherry picked from commit 680b3d1037)
2016-08-23 14:32:43 +02:00
Thomas Haller
633344bf27 core: use #define for "rfkill-changed" signal name
(cherry picked from commit 640fbec855)
2016-08-23 11:46:28 +02:00
Beniamino Galvani
772a9cb05d core: check valid uid for D-Bus load_connection(s)/set_logging calls
Commit 4c7fa8dfdc ("core: drop root requirement for
load_connection(s)/set_logging D-Bus calls") removed the enforcing of
permission in the daemon for such methods since the D-Bus daemon
configuration already does that. That change also allows clients to
send a request and not wait for a response, since we don't have to
check the caller credentials in the daemon.

In the future we might switch to polkit for these methods, breaking
clients that don't wait for a reponse, so it seems better to prevent
from beginning such behavior.

Fixes: 4c7fa8dfdc
(cherry picked from commit dd27b79c4e)
2016-08-23 11:24:19 +02:00
Thomas Haller
847133c66c core: merge branch 'th/vpn-ifindex-fix-rh1368354'
https://bugzilla.redhat.com/show_bug.cgi?id=1368354

(cherry picked from commit 224d383595)
2016-08-23 11:12:53 +02:00
Thomas Haller
0852401b0e vpn: ignore unexpected default-route for nm_vpn_connection_ip6_config_get()
The VPN data comes from an external source, it may be bogus.
Default-routes are not allowed on this point and would trigger
an assertion afterwards. Skip over them.

(cherry picked from commit 071103b172)
2016-08-23 11:12:10 +02:00
Thomas Haller
6757dd3713 vpn: fix nm_vpn_connection_ip6_config_get() for VPNs without own interface
We need an ifindex for the NMIP4Config/NMIP6Config instance.
For interface-less VPN types, we need to lookup the parent
device, as already done for IPv4.

Fix IPv6 case too.

https://bugzilla.redhat.com/show_bug.cgi?id=1368354
(cherry picked from commit 2da35ddfe8)
2016-08-23 11:12:10 +02:00
Thomas Haller
bf1713a701 vpn: refactor property implementation in NMVpnConnection
(cherry picked from commit 9d6f613df4)
2016-08-23 11:12:10 +02:00
Thomas Haller
907b5a597e vpn: embed private data in NMVpnConnection structure
(cherry picked from commit d52195475b)
2016-08-23 11:12:10 +02:00
Thomas Haller
02980bed49 core: downgrade assertion in nm-ip[46]-config.c to g_critical
(cherry picked from commit c5682d601b)
2016-08-23 11:12:10 +02:00
Thomas Haller
417039fbd6 device: silence logging about "link disconnected"
<info> logging is just too verbose for something that happens
frequently.

(cherry picked from commit ed7f832c40)
2016-08-23 10:50:49 +02:00
Thomas Haller
f392da2c78 device: fix queued activation failure due to link disconnected
When activating a connection, it may fail with nmcli reporting:
  $ nmcli connection up id "Wired Connection 1"
  Error: Connection activation failed: Active connection removed before it was initialized

This should be easily reproducible by having a connection "Wired Connection 1" with
cloned-mac-address set to random. When the connection is already active on a device,
re-activating with
  $ nmcli connection up id "Wired Connection 1"
fails.

We first create a queued-activation and tear down the existing
connection:
   device (enp0s25): state change: deactivating -> disconnected (reason 'new-activation')
Shortly after we see:
   device[0x557d02cdb0c0] (enp0s25): set-hw-addr: setting MAC address to 'AA:BB:CC:DD:EE:FF' (reset, deactivate)...
   device[0x557d02cdb0c0] (enp0s25): taking down device
later, we get:
   device (enp0s25): link disconnected
   device[0x557d02cdb0c0] (enp0s25): queued state change to unavailable due to carrier-changed (id 17290)
in the meantime, the queued activation request starts:
   device (enp0s25): Activation: starting connection 'my-wired' (ca058ec5-8a47-4e1e-b38e-962b71c4699e)
but the device already transitions to unavailable
   device[0x557d02cdb0c0] (enp0s25): running queued state change to unavailable (id 17290)
   device (enp0s25): state change: disconnected -> unavailable (reason 'carrier-changed') [30 20 40]
which kills the new activation request:
   active-connection[0x557d02c10e40]: set state deactivated (was unknown)

Just delay a carrier-lost handling if we have any queued activation
requests.

(cherry picked from commit d4e9b30320)
2016-08-23 10:50:48 +02:00
Thomas Haller
6c4447520d platform: disable debug logging for NMPObject ref-couting
These logging lines are already disabled by default as _LOGt()
is a NOP unless configured --with-more-logging.

However, the logging is still very verbose also for debug-builds
and currently there are no known issues there. Disable the logging
statements (but leave them in so they can easily be enabled).

(cherry picked from commit 4cb845558e)
2016-08-22 18:37:04 +02:00
Thomas Haller
f1beb01050 core: use define for signal name in nm_active_connection_set_device()
(cherry picked from commit 598bea3481)
2016-08-22 16:25:33 +02:00
Thomas Haller
0e1c7ede12 device: emit NM_DEVICE_STATE_CHANGED signal by id
This saves a lookup of the ID by name. We already have the signal-id,
use it.

(cherry picked from commit 534b0360c1)
2016-08-22 16:25:32 +02:00
Beniamino Galvani
e9f96024ae cli: return sane error message for D-Bus policy permission errors
The error returned to users when a load_connection(s)/set_logging call
fails due to D-Bus policy denial is a bit obscure:

  $ nmcli general logging level debug
  Error: failed to set logging: Rejected send message, 4 matched rules;
  type="method_call", sender=":1.233" (uid=1001 pid=27225 comm="nmcli
  general logging level debug ")
  interface="org.freedesktop.NetworkManager" member="SetLogging" error
  name="(unset)" requested_reply="0" destination=":1.207" (uid=0
  pid=25793 comm="/usr/sbin/NetworkManager --no-daemon ")

Convert it to a more comprehensible:

  $ nmcli general logging level debug
  Error: failed to set logging: access denied

https://bugzilla.redhat.com/show_bug.cgi?id=1362542
(cherry picked from commit 805925f9ef)
2016-08-20 10:45:55 +02:00
Beniamino Galvani
a77ed0de97 core: drop root requirement for load_connection(s)/set_logging D-Bus calls
The D-Bus configuration already ensures that only root can do that;
enforcing the permission at policy level seems better than doing it in
the daemon itself because it allows users to change the policy and
also because callers can exit immediately after issuing the request.

(cherry picked from commit 4c7fa8dfdc)
2016-08-20 10:45:53 +02:00
Beniamino Galvani
0944a86182 ifcfg-rh: ensure master is cleared when updating a connection
If the connection is not a slave we must clear any existing variable
indicating the connection's master.

https://bugzilla.redhat.com/show_bug.cgi?id=1355656
(cherry picked from commit 2750714802)
2016-08-19 18:56:59 +02:00
Beniamino Galvani
9364585eeb device: don't flush addresses when unmanaging assumed devices
When a assumed software device is brought down externally, it becomes
UNMANAGED_EXTERNAL_DOWN and its state goes from ACTIVATED directly to
UNMANAGED. In such case, we shouldn't flush the IP configuration
(addresses and routes) present on the device.

To fix this, clean up the device with CLEANUP_TYPE_KEEP and modify
nm_device_cleanup() not to flush addresses and devices with such flag.

https://bugzilla.redhat.com/show_bug.cgi?id=1363995
(cherry picked from commit 45cd3302dc)
2016-08-19 18:19:13 +02:00
Thomas Haller
eff2dc63b4 vpn: fix out-of-range access reading route.plen in nm_vpn_connection_ip4_config_get()
Also, skip over routes with plen zero.

Fixes: 44768f0311

https://bugzilla.redhat.com/show_bug.cgi?id=1368355
(cherry picked from commit 87fcbb491d)
2016-08-19 13:42:06 +02:00
Thomas Haller
4023659ee1 logging: remove unused formatting options
Previously, we logged also the location (file:line func). nm-logging.c
supported format flags to control the timestamp, the location, and alignment
of the timestamp.

We want that all our logging backends log the same messages. That is,
both syslog and journal should have our ~default~ logging format, that
is with timestamp but without location.

Drop the unused code.

(cherry picked from commit cc828431b8)
2016-08-19 12:32:30 +02:00
Beniamino Galvani
db14c1b167 policy: always try to update kernel hostname
Even if we know that the new hostname being set is equal to the cached
old one, the user may have manually changed the kernel hostname in the
meanwhile. For example:

 # hostname
 host123

 # hostname localhost
 # nmcli connection up eth1
                    # (now NM receives 'host123' from DHCP, but
                    # believes it's already set and doesn't update it)
 # hostname
 localhost

Let's always try to update the kernel (transient) hostname, unless it
is really already set (as returned by gethostname()).

https://bugzilla.redhat.com/show_bug.cgi?id=1356015
(cherry picked from commit 51b2cef04f)
2016-08-19 10:02:41 +02:00
Thomas Haller
ed20625309 platform/tests: relax condition for test
Got a test failure for /link/software/bond

(cherry picked from commit bdd0f722b8)
2016-08-18 15:26:57 +02:00
Thomas Haller
4cce0b7cf4 contrib/rpm: fix wrong argument to configure script
Fixes: aff491b6f3
(cherry picked from commit 5d09d45b42)
2016-08-18 14:54:04 +02:00
Thomas Haller
959e151722 contrib/rpm: update spec file to make it more similar to RHEL's version
(cherry picked from commit aff491b6f3)
2016-08-18 12:40:08 +02:00
Thomas Haller
cf50806689 core: don't suppress routes inside the subnet of the interface
It's not clear why a route should be suppressed if it is contained
in the subnet of one of the interface's addresses.

I think it is wrong to do this. For example, imagine an ethernet
and a Wi-Fi device both connected to the same subnet 10.0.0.0/8. By
default, ethernet gets higher priority and a better metric of 100.
If the user wants to configure a route "10.0.0.1/32 metric 99"
to reach a certain host explicitly via Wi-Fi, this check will
forbid that.

This condition was added a long time ago (38dbdae266),
but it's unclear what the original intent was.

See also commit 4f7b1cabc0, which
already relaxed this suppression of routes for non-direct routes.

(cherry picked from commit ac5dc1a951)
2016-08-17 22:42:21 +02:00
Piotr Drąg
3d9a0fda33 po: update Polish (pl) translation (bgo #769463)
https://bugzilla.gnome.org/show_bug.cgi?id=769463
(cherry picked from commit 5e41e1634d)
2016-08-17 20:00:14 +02:00
Thomas Haller
0bdcab100c all: cleanup includes in header files
- don't include "nm-default.h" in header files. Every source file must
  include as first header "nm-default.h", thus our headers get the
  default include already implicitly.

- we don't support compiling NetworkManager itself with a C++ compiler. Remove
  G_BEGIN_DECLS/G_END_DECLS from internal headers. We do however support
  users of libnm to use C++, thus they stay in public headers.

(cherry picked from commit f19aff8909)
2016-08-17 19:51:17 +02:00
Lubomir Rintel
40d5749ec1 release: bump version to 1.3.91 (1.4-rc1) 2016-08-17 16:21:52 +02:00
Lubomir Rintel
cb6f1f5751 release: update NEWS with recently merged features 2016-08-17 16:20:42 +02:00
Thomas Haller
844345eddd all: merge branch 'th/device-statistics'
Add support to expose tx/rx statistics per device

https://mail.gnome.org/archives/networkmanager-list/2016-August/msg00045.html
2016-08-17 16:13:16 +02:00
Thomas Haller
fbbebc2123 device: always expose device statistics information
Instead of updating the device-statistic counters only periodically as
we refresh the link, update them on every link-changed event from
platform.

That means, also for devices that have RefreshRateMs at zero, the values
will be updated at random times when the link information changes.
The difference is, that previously the counters would be zero unless
RefreshRateMs was set. Now, they have some (probably stale) values
which however are not guaranteed to be kept up-to-date.

Also, now we refresh more often then promised by RefreshRateMs. But the API
technically doesn't specify that, so if we find there is a problem with
this, we may revert it later.
2016-08-17 16:08:21 +02:00
Thomas Haller
c16e14c71c device: drop nm-device-statistics.c and refactor tracking device statistics
Originally, "nm-device-statistics.c" contained code to fetch the device
counters via netlink. As now the netlink part is handled by NMPlatform,
the code can be simplified by merging it back to NMDevice.
2016-08-17 16:08:21 +02:00
Thomas Haller
3d9d91b2be platform: print rx/tx counters in nm_platform_link_to_string() 2016-08-17 16:08:21 +02:00
Thomas Haller
02a448e49b device: namespace fields related to statistics in NMDevicePrivate
... by grouping them together in a struct.
2016-08-17 16:08:21 +02:00
Thomas Haller
d9509a2db1 device: don't initalize fields in nm_device_init() to NULL
They are already guaranteed to be 0/NULL.
2016-08-17 16:08:21 +02:00
Thomas Haller
14a7b2a4fe manager: add explicit cast for g_object_set()
Technically, this is not needed because glib requires that
int is at least 32 bits. Thus, uint32 will be safely promoted
to uint.

Just do the cast to be explict about the expected type.
2016-08-17 16:08:21 +02:00