Commit graph

8195 commits

Author SHA1 Message Date
Mario Sanchez Prada
dfd9d85beb nm-dispatcher: Added new 'connectivity-state' parameter to private D-Bus API
In order to pass the connectivity state to the relevant hooks along with
the event itself, we need to add this parameter for the 'Action' method
of then internal 'org.freedesktop.nm_dispatcher' interface, which will
be sent by the network manager main process to the dispatcher.

https://bugzilla.gnome.org/show_bug.cgi?id=768969
2016-07-28 22:22:14 +02:00
Mario Sanchez Prada
283562ef18 nm-dispatcher: Added new action for 'connectivity-change' events
The purpose of this action is to provide a hook for the OS to act
on global changes regarding to connectivity, which can currently
be one of 'none', 'portal', 'limited', 'full' or 'unknown'.

Check the documentation for a more information on each of those states:
https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMConnectivityState

https://bugzilla.gnome.org/show_bug.cgi?id=768969
2016-07-28 22:22:14 +02:00
Beniamino Galvani
9446481f4c policy: update system hostname when DHCP configuration changes
If both IPv4 and IPv6 are enabled and IPv6 terminates first (and
ipv4.may-fail=yes), the device becomes ACTIVATED and we try to update
the system hostname from the DHCP lease, if necessary. But later, the
termination of DHCPv4 doesn't trigger a new update and so it's
possible that the system hostname remains unset even if the DHCPv4
lease specifies a hostname.

To have a deterministic behavior we should always try to update the
system hostname when a DHCP transaction terminates.

https://bugzilla.redhat.com/show_bug.cgi?id=1356015
2016-07-27 15:13:49 +02:00
Beniamino Galvani
300b8ce842 team: update configuration when adding or removing slaves
Unfortunately teamd doesn't have an asynchronous way to notify a
change in the actual configuration, so when a port is enslaved or
released we wait some time for the changes to take effect and read the
configuration again.

https://bugzilla.redhat.com/show_bug.cgi?id=1310435
2016-07-23 08:58:58 +02:00
Beniamino Galvani
791bca1dcc team: request actual configuration to teamd
Request the actual configuration when reading it from teamd. The
actual configuration, differently from the normal one, doesn't contain
non-active team ports.
2016-07-23 08:58:58 +02:00
Francesco Giudici
ddc35f27eb device: enable checks against the MAC address of virtual devices
enables (back) matching against 802-3-ethernet.mac-address and
802-3-ethenet.mac-address-blacklist connection parameters
for MAC addresses belonging to virtual devices too.
2016-07-22 19:36:23 +02:00
Francesco Giudici
55b9fd46ee device: allow creation of default wired connection for virtual interfaces 2016-07-22 19:36:23 +02:00
Lubomir Rintel
f9821a1669 dhcp: drop an unused fariable
Fixes: 1c58ce0d74
2016-07-13 12:26:15 +02:00
Thomas Haller
36856ba610 all: reuse _nm_utils_hwaddr_ntoa() for converting binary to string 2016-07-10 13:44:58 +02:00
Thomas Haller
1c58ce0d74 dhcp: prefix logging messages with "dhcp" 2016-07-10 13:22:12 +02:00
Thomas Haller
bfe4a69c25 wwan: downgrade warning logging about 'No SIM object available'
On every start of NetworkManager I'd see a warning message:

  modem-broadband[cdc-wdm0]: failed to retrieve SIM object: No SIM object available

Apparently, to warn about this is too alarming.
2016-07-10 11:53:11 +02:00
Beniamino Galvani
75406d1760 device: allow ipv6ll address to be set for disconnected devices
Commit f85941ee91 ("device: don't try to generate ipv6ll address for
disconnected devices") disabled the generation of IPv6 link-local
addresses for disconnected devices to fix a crash. However that broke
the following:

 $ ip a f dev eth0
 $ systemctl start NetworkManager
 $ nmcli d
 DEVICE  TYPE      STATE         CONNECTION
 eth0    ethernet  disconnected  eth0
 $ ip a a dev eth0 2001::42/64
 $ ip a show eth0
 4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
     link/ether 52:52:00:61:32:81 brd ff:ff:ff:ff:ff:ff
     inet6 2001::42/64 scope global
        valid_lft forever preferred_lft forever
     (no link-local address)

Instead, enable the generation of a link-local address even if the
device is disconnected and fix nm_device_get_ip_iface_identifier() to
not require a connection if @ignore_token is set.

Fixes: f85941ee91
2016-07-09 11:38:58 +02:00
Thomas Haller
e988ed96f9 device: downgrade debug logging about not setting hardware address
No change is not particularly interesting, and for Wi-Fi devices
it happens everytime we scan. Downgrade the debug message to trace
level.
2016-07-09 10:23:39 +02:00
Beniamino Galvani
45484af2af platform: wifi: drop old wifi data when an interface is renamed
Drop the old wifi data when the interface is renamed, otherwise WEXT
methods would use the old name.

https://bugzilla.gnome.org/show_bug.cgi?id=768433
2016-07-08 13:40:10 +02:00
Thomas Haller
a9524509e8 rdisc: preserve most-managed dhcp-level from multiple router advertisements 2016-07-08 12:35:14 +02:00
Thomas Haller
0e07bbf968 rdisc: tighten up type and range of NMRDiscRoute.plen 2016-07-08 12:35:14 +02:00
Thomas Haller
15b486700f rdisc: hide internal fields from NMRDisc API
Hide the mutable fields that were exposed to the user of the NMRDisc API.
Instead, only expose a constant NMRDiscData structure.
2016-07-08 12:25:07 +02:00
Thomas Haller
c81eff0669 rdisc: move sysctl configuration values to NMRDiscPrivate
While at it, tighten up the integer values, types and ranges
and ensure no interger overflow can happen when calculating
timeouts and retry.
2016-07-08 12:25:07 +02:00
Thomas Haller
1bc3df0bd4 rdisc: move @iid field to NMRDiscPrivate 2016-07-08 12:08:55 +02:00
Thomas Haller
629332172b rdisc: refactor logging config-changes not as signal handler
Just log _config_changed_log() right away and not go through
the GObject signal.
2016-07-08 12:08:55 +02:00
Thomas Haller
db59f5fa11 rdisc: emit config-changed signal by ID and not by name
Also, properly cast the NMRDiscConfigMap argument to int.
2016-07-08 12:08:55 +02:00
Thomas Haller
d42b3aca60 rdisc: remove unused signal slots ra_timeout and ra_process 2016-07-08 12:08:55 +02:00
Thomas Haller
c9c00ec5c6 rdisc: move public fields from NMRDisc to NMRDiscPrivate
As they are initialized from the constructor of the subclass, the have
to be construct-only GObject properties, which brings some overhead.
2016-07-08 12:08:53 +02:00
Thomas Haller
322299617f rdisc: move @platform and @netns field to private structure NMRDiscPrivate 2016-07-08 12:08:02 +02:00
Thomas Haller
7ab03097fc rdisc: embed pointer to private data in NMRDisc
NMRDisc is one of the more heavily used classes. Let's clean it up
a bit.
2016-07-08 12:08:02 +02:00
Thomas Haller
5fa835baee rdisc/tests: don't link nm-fake-rdisc with non-testing NetworkManager binary 2016-07-08 12:08:02 +02:00
Thomas Haller
c5a72405b6 rdisc: hide NMLndpRDisc struct and embed private data 2016-07-08 12:08:02 +02:00
Thomas Haller
bb3f73655a rdisc/trivial: rename NMLNDPRDisc to NMLndpRDisc
For abbreviations that have more then 2 characters, we prefer to use lower-case.
For example, NMVpnManager.
2016-07-08 12:08:02 +02:00
Beniamino Galvani
10c5352855 secret-agent: increase timeout for GetSecrets D-Bus call
The default value of 25 seconds is too short, bump it to 120.

https://bugzilla.gnome.org/show_bug.cgi?id=767321
https://bugzilla.redhat.com/show_bug.cgi?id=1349740
2016-07-08 11:55:55 +02:00
Beniamino Galvani
5d4fc4c9ac team: fail the connection if the teamd configuration can't be read
If the read of teamd configuration failed (possibly due to a timeout),
fail the connection immediately where possible instead of letting it
continue and risk to block again at the next read.

https://bugzilla.redhat.com/show_bug.cgi?id=1257237
2016-07-07 17:31:23 +02:00
Beniamino Galvani
06ded430e8 team: fix handling of D-Bus name watch events
When a device is activated any existing teamd instance is killed. But
since commit 28274495d6 ("device/team: always try to connect to
teamd in update_connection()") the disappearing of the D-Bus name
owner always triggers an automatic restart of the instance in
teamd_dbus_vanished() if the name was previously owned. This new
instance conflicts with the instance we're about to start.

Instead, restore the previous behavior of restarting teamd only if
there is an activation in progress and use @tdc as a flag. This also
means that update_connection() should not modify the value of @tdc.

Fixes: 28274495d6
2016-07-07 17:31:23 +02:00
Beniamino Galvani
3d8839927e policy: reset slaves' retry counter only for explicit activations
A infinite activation loop can arise when the master repeatedly fails
activating: slave's _internal_activate_device() calls
ensure_master_active_connection() to activate the master connection
and during master activation activate_slave_connections() resets the
retry counter of slaves.

The autoconnect retry counter of a slave should only be reset for
explicit master activations, not for auto-activations.

https://bugzilla.redhat.com/show_bug.cgi?id=1270814
2016-07-07 17:14:38 +02:00
Beniamino Galvani
adba47cb61 active-connection: don't weak-unref parent inside notify function 2016-07-07 17:14:38 +02:00
Beniamino Galvani
7f191eb15b device: fail slave activation if master is deactivating
When the master connection deactivates, we also fail slave
connections; but if the master deactivation happens just before a
slave reaches the PREPARE state, we failed to notice it and keep
the slave stuck without chance of progressing. Fix this.
2016-07-07 17:14:38 +02:00
Beniamino Galvani
f9feddbcf0 device: cancel pending activation when slave is released
Since nm_device_slave_notify_release() is called from outside the
activation chain of the slave device (it gets called from the master
device) there might be pending activation sources scheduled, clear
them before queueing a state change.
2016-07-07 17:14:38 +02:00
Beniamino Galvani
c5fa3738b1 bond: use defines for sysfs attribute names
Previously we used defines for bond option names and used string
literals for their attribute names in sysfs. But they are the same by
definition so let's use defines also for attributes.
2016-07-06 15:20:53 +02:00
Beniamino Galvani
f33a620b97 bond: fix default value for 'ad_actor_system' option
Even if the 'ad_actor_system' option is only valid for the 802.3ad
mode, the sysfs file is always present and has a default value of
''. But in 802.3ad mode the default value is
'00:00:00:00:00:00'. Return the correct value in
nm_setting_bond_get_option_default().

Furthermore, writing a empty string to the file will generate an
error, don't do it.
2016-07-06 15:20:53 +02:00
Beniamino Galvani
dd1c453ff7 bond: improve compatibility check of options and modes
We print an error when the write of a bond options fails as this is
considered an effect of a wrong configuration (or a bug in the checks
done by NM) that the user should notice. But not all options are
supported in all bonding modes and so we ignore some unsupported
options for the current mode to avoid populating logs with useless
errors.

Improve the code there by using a more generic approach and
synchronize the mode/option compatibility table with kernel (file
drivers/net/bonding/bond_options.c).

https://bugzilla.gnome.org/show_bug.cgi?id=767776
https://bugzilla.redhat.com/show_bug.cgi?id=1352131
2016-07-06 15:20:53 +02:00
Beniamino Galvani
f85941ee91 device: don't try to generate ipv6ll address for disconnected devices
If the device is disconnected because it can't be assumed due to lack
of IP configuration, don't try to generate an ipv6 link-local address,
as this requires a connection.

 #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
 #1  __GI_abort () at abort.c:89
 #2  g_assertion_message (domain=domain@entry=0x5f41b4 "NetworkManager", file=file@entry=0x5ef9b5 "devices/nm-device.c", line=line@entry=831,
     func=func@entry=0x5f3220 <__FUNCTION__.37383> "nm_device_get_ip_iface_identifier", message=message@entry=0x1e86100 "assertion failed: (connection)") at gtestutils.c:2429
 #3  g_assertion_message_expr (domain=domain@entry=0x5f41b4 "NetworkManager", file=file@entry=0x5ef9b5 "devices/nm-device.c", line=line@entry=831,
     func=func@entry=0x5f3220 <__FUNCTION__.37383> "nm_device_get_ip_iface_identifier", expr=expr@entry=0x5e65c6 "connection") at gtestutils.c:2452
 #4  nm_device_get_ip_iface_identifier (self=self@entry=0x1e612a0, iid=iid@entry=0x7fffce40e3d0, ignore_token=ignore_token@entry=1) at devices/nm-device.c:831
 #5  check_and_add_ipv6ll_addr (self=self@entry=0x1e612a0) at devices/nm-device.c:5983
 #6  queued_ip6_config_change (user_data=0x1e612a0) at devices/nm-device.c:9489
 #7  g_main_dispatch (context=0x1d3e060) at gmain.c:3154
 #8  g_main_context_dispatch (context=context@entry=0x1d3e060) at gmain.c:3769
 #9  g_main_context_iterate (context=0x1d3e060, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3840
 #10 g_main_loop_run (loop=0x1d3ab00) at gmain.c:4034
 #11 main (argc=1, argv=0x7fffce40e6a8) at main.c:411

https://bugzilla.redhat.com/show_bug.cgi?id=1351633
2016-07-06 12:17:13 +02:00
Thomas Haller
1bbc26a5c7 device: downgrade logging warning in nm_device_steal_connection()
<info>  [1467793329.6313] device (veth-guest): Activation: starting connection 'my-wired' (ca058ec5-8a47-4e1e-b38e-962b71c4699e)
    <debug> [1467793329.6313] device[0x55af2884bf90] (veth-guest): activation-stage: schedule activate_stage1_device_prepare,2 (id 510)
    <warn>  [1467793329.6314] device (veth-guest): disconnecting connection 'my-wired' for new activation request.
    <info>  [1467793329.6315] device (veth-guest): state change: disconnected -> deactivating (reason 'new-activation') [30 110 60

A warning is too verbose. This is not an unusual condition, it's just that
a new activation supersedes an other one.
2016-07-06 10:28:45 +02:00
Thomas Haller
a1743ab59e core/trivial: cleanup indention for property definitions in nm-ip[46]-config.c 2016-07-06 10:20:06 +02:00
Thomas Haller
652dc4b379 wifi: cleanup type implementation of NMDeviceWifi
- make NMDeviceWifi and NMDeviceWifiClass internal, opaque
  structures
- embed private data in NMDeviceWifi
- implement GObject properties via NM_GOBJECT_PROPERTIES_DEFINE()
2016-07-06 10:06:09 +02:00
Thomas Haller
788583d9fd wifi: fix missing pending-action-remove for "scan"
<warn>  [1467730406.7343] device (wlp3s0): add_pending_action (2): scan already pending
    file devices/nm-device.c: line 10443 (nm_device_add_pending_action): should not be reached

Fixes: eed8fd2e43
2016-07-06 10:06:09 +02:00
Thomas Haller
399c26f55f wifi: minor cleanups for boolean variables 2016-07-06 10:06:09 +02:00
Thomas Haller
8fcd4798f4 platform/tests: fix link tests
Fixes: 6f31f87871
2016-07-05 23:21:03 +02:00
Thomas Haller
e8518b2a37 device: tune down warning about failure to set userspace IPv6LL on non-existing device
When a device gets removed externally, we still try to clear userspace IPv6LL address handling.
That fails, due to non-existing device. Such a failure should not be logged as warning.

    <debug> [1467723214.2078] device[0x558c59335ca0] (enp0s25): disposing
    <debug> [1467723214.2079] device[0x558c59335ca0] (enp0s25): remove_pending_action (0): 'dhcp6' not pending (expected)
    <debug> [1467723214.2079] device[0x558c59335ca0] (enp0s25): remove_pending_action (0): 'autoconf6' not pending (expected)
    <debug> [1467723214.2079] device[0x558c59335ca0] (enp0s25): will disable userland IPv6LL
    <debug> [1467723214.2079] platform-linux: link: change 20: user-ipv6ll: set IPv6 address generation mode to eui64
    <trace> [1467723214.2080] platform-linux: delayed-action: schedule wait-for-nl-response (seq 92, timeout in 0.199998611)
    <trace> [1467723214.2080] platform-linux: delayed-action: schedule refresh-link (ifindex 20)
    <trace> [1467723214.2080] platform-linux: delayed-action: handle refresh-link (ifindex 20)
    <debug> [1467723214.2080] platform-linux: do-request-link: 20
    <trace> [1467723214.2080] platform-linux: netlink: recvmsg: new message type 2, seq 92
    <debug> [1467723214.2080] platform-linux: netlink: recvmsg: error message from kernel: No such device (19) for request 92
    <trace> [1467723214.2081] platform-linux: delayed-action: complete wait-for-nl-response (seq 92, timeout in 0.199895684, failure 19 (No such device))
    <trace> [1467723214.2081] platform-linux: delayed-action: schedule wait-for-nl-response (seq 93, timeout in 0.199999306)
    <trace> [1467723214.2081] platform-linux: delayed-action: handle wait-for-nl-response (any)
    <trace> [1467723214.2081] platform-linux: netlink: recvmsg: new message type 2, seq 93
    <debug> [1467723214.2081] platform-linux: netlink: recvmsg: error message from kernel: No such device (19) for request 93
    <trace> [1467723214.2082] platform-linux: delayed-action: complete wait-for-nl-response (seq 93, timeout in 0.199921142, failure 19 (No such device))
    <debug> [1467723214.2082] platform-linux: do-change-link[20]: failure changing link: failure 19 (No such device)
    <warn>  [1467723214.2082] device (enp0s25): failed to disable userspace IPv6LL address handling

https://bugzilla.redhat.com/show_bug.cgi?id=1323571
2016-07-05 23:11:57 +02:00
Thomas Haller
e81d4f2b64 ifcfg: downgrade warning about NM_CONTROLLED=no
NM_CONTROLLED=no is an explicit user configuration. There is no point in
issuing a warning that the user doesn't want to manage a device.

   <warn>  [1467722628.7388] ifcfg-rh: Ignoring connection /etc/sysconfig/network-scripts/ifcfg-eth0 (5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03,"System eth0") / device 'eth0' due to NM_CONTROLLED=no.

Also, don't truncate the device spec, instead show the full
device spec, it may contains a MAC address or a s390 subchannel.
2016-07-05 23:08:23 +02:00
Thomas Haller
87169e681a veth: refactor type definition of NMDeviceVeth
Embed the private data inside NMDeviceVeth structure and use NM_GOBJECT_PROPERTIES_DEFINE().
2016-07-05 23:08:23 +02:00
Thomas Haller
a040e447d0 ethernet: notify when setting s390 subchannels 2016-07-05 23:08:23 +02:00
Thomas Haller
6036ef5d74 ethernet: implement NMDeviceEthernet's properties via NM_GOBJECT_PROPERTIES_DEFINE() 2016-07-05 23:08:23 +02:00