Commit graph

8323 commits

Author SHA1 Message Date
Beniamino Galvani
dbf0b343ec device: fix NULL pointer dereference in dhcp6_start()
Don't crash when nm_device_dhcp6_renew() calls dhcp6_start() with NULL
@reason.

Fixes: d1295b12e9
2016-09-22 11:34:23 +02:00
Beniamino Galvani
fb40060ac1 build: add macro to check shared objects symbols 2016-09-20 13:43:20 +02:00
Beniamino Galvani
cdedd2b53e manager: emit device-removed signal when a device unrealizes
The 'device-added' and 'device-removed' signals indicate when the
value of the 'Devices' property changes. The property only returns
realized devices and so if a device unrealizes we should emit the
removed signal for it.

Fixes: 5da37a129c

https://bugzilla.gnome.org/show_bug.cgi?id=771324
2016-09-16 16:27:11 +02:00
Beniamino Galvani
8f92ead6e2 device: fix crash reapplying connection to slave devices
Slave devices don't have IPv4 and IPv6 configuration and so special
care must be taken when comparing their methods.

https://bugzilla.redhat.com/show_bug.cgi?id=1376446
2016-09-16 14:20:38 +02:00
Francesco Giudici
b50fc0d47e tests/ifupdown: add missing source-stanza files reference from makefile
Fixes: ada6b96de9
2016-09-13 16:45:40 +02:00
Thomas Haller
e7a1008b4b device: cleanup _hw_addr_set()
No change in behavior, just reorganize.

Fixes: 32f7c1d4b9
2016-09-13 11:16:31 +02:00
Thomas Haller
32f7c1d4b9 device: wait for MAC address change to complete before setting interface up
Some drivers (brcmfmac) don't change the MAC address right away.
NetworkManager works around that by waiting synchronously until
the address changes (commit 1a85103765).

wpa_supplicant on the other hand, only re-reads the MAC address
when changing state from DISABLED to ENABLED, which happens when
the interface comes up.

That is a bug in wpa_supplicant and the driver, but we can work-around by
waiting until the MAC address actually changed before setting the interface
IFF_UP. Also note, that there is still a race in wpa_supplicant which might
miss a change to DISABLED state altogether.

https://bugzilla.gnome.org/show_bug.cgi?id=770504
https://bugzilla.redhat.com/show_bug.cgi?id=1374023
2016-09-13 10:33:58 +02:00
Thomas Haller
d461eb6894 device: drop virtual methods for bring_up(), take_down() and is_up()
They have no more implementations in derived classes.
2016-09-12 18:09:17 +02:00
Thomas Haller
14ae46021b device: drop NMDeviceMacvlan:bring_up() implementation
This was added by commit 4de8851eca, probably
by copying from NMDeviceVlan. It's not clear why a netlink request to
set the device IFF_UP would fail, or why that warrants a retry.
2016-09-12 18:08:16 +02:00
Thomas Haller
2c8cb145c2 device: drop NMDeviceVlan:bring_up() implementation
This retry loop was added by commit dc6341acec.
But I suspect, that the main-point there was not to retry the netlink
request to set the interface up. Why would that fail, and why would
a failure to set the interface up require a retry?

I think it was added to wait for carrier. But waiting for carrier was
later dropped with commit 5074898591
and it is not clear why we would wait for carrier at all -- we don't
do that for other device types either.
2016-09-12 18:08:16 +02:00
Thomas Haller
9deb6ede73 device: drop NMDeviceWifi:bring_up() implementation
Instead of letting the sub-class check the "enabled" state, let
it be handled by nm_device_bring_up().

Note that nm_device_get_enabled() only has two implementations:
NMDeviceModem:bring_up() and NMDeviceWifi:bring_up().
2016-09-12 18:03:47 +02:00
Thomas Haller
b122337353 device: implement get_enabled() for NMDeviceWifi
The virtual function NMDevice:set_enabled() has two implementations:
NMDeviceModem and NMDeviceWifi. Likewise, the get_enabled() function
should also be implemented by those types.

The only caller of nm_device_get_enabled() is NMPolicy:schedule_activate_check().
It is correct to skip Wi-Fi devices based on their enabled state.
2016-09-12 18:03:47 +02:00
Thomas Haller
042f2b2e7e core: use defines for signal names 2016-09-12 18:03:47 +02:00
Beniamino Galvani
b519b96c4e ifcfg-rh: fill 'auth-alg' with the original value for WPA-PSK
Restore the original value of auth-alg, which can be NULL or 'open'
for WPA-PSK.

https://bugzilla.gnome.org/show_bug.cgi?id=770907
2016-09-12 16:04:38 +02:00
Beniamino Galvani
00c4e7e73a ifcfg-rh: add wifi protocols only if present in connection file
An empty 802-11-wireless-security.proto is equivalent to
'wpa,rsn'. Previously we added the two protocols when reading the
connection and the variables were missing, with the result that an
empty value would be read as 'wpa,rsn' at the next restart. This is
harmless but makes the two connections appear as different, with bad
effects when 'monitor-connection-files' is enabled.

Ensure that the original value persists after a write/read cycle.

https://bugzilla.gnome.org/show_bug.cgi?id=770907
2016-09-12 16:04:27 +02:00
Thomas Haller
fae5ecec5a device: change default value for cloned-mac-address to "preserve" (bgo#770611)
Long ago before commit 1b49f94, NetworkManager did not touch the
MAC address at all. Since 0.8.2 NetworkManager would modify the
MAC address, and eventually it would reset the permanent MAC address
of the device.

This prevents a user from externally setting the MAC address via tools
like macchanger and rely on NetworkManager not to reset it to the
permanent MAC address. This is considered a security regression in
bgo#708820.

This only changed with commit 9a354cd and 1.4.0. Since then it is possible
to configure "cloned-mac-address=preserve", which instead uses the "initial"
MAC address when the device activates.
That also changed that the "initial" MAC address is the address which was
externally configured on the device as last. In other words, the
"initial" MAC address is picked up from external changes, unless it
was NetworkManager itself who configured the address when activating a
connection.

However, in absence of an explicit configuration the default for
"cloned-mac-address" is still "permanent". Meaning, the user has to
explicitly configure that NetworkManager should not touch the MAC address.
It makes sense to change the upstream default to "preserve". Although this
is a change in behavior since 0.8.2, it seems a better default.

This change has the drastic effect that all the existing connections
out there with "cloned-mac-address=$(nil)" change behavior after upgrade.
I think most users won't notice, because their devices have the permanent
address set by default anyway. I would think that there are few users
who intentionally configured "cloned-mac-address=" to have NetworkManager
restore the permanent address.

https://bugzilla.gnome.org/show_bug.cgi?id=770611
2016-09-12 14:01:57 +02:00
Thomas Haller
553717bb1c device: don't set ip4_state=IP_FAIL for ipv4.method=disabled
... and don't set ip6_state=IP_FAIL for ipv6.method=ignore.

The disabled state is like having an empty NMIP4Config object.
It should not result in %IP_FAIL state. Instead, we just want
to proceed and commit an empty NMIP4Config instance.

This was introduced by commit 0652d9c596,
which I think was wrong.

Likewise, for ipv6.method=ignore we also don't want to mark the
IP state as failed. Instead, we want to proceed and set IP_DONE
right away -- without commiting anything, which is a difference
to the IPv4 case.

This is especially important, because an ip4_state/ip6_state of IP_FAIL
causes nm_device_can_assume_active_connection() to return FALSE, which
means we unmanage devices at shutdown. Ony might say that it doesn't
matter so much for a device without IP configuration, but imagine a
bond with VLANs on top that only has Layer 2 configuration. This will
bring down the entire stack.

With this change, devices with IP methods disabled/ignore stay up on
exit of NetworkManager (rh#1371126). Of course, that means on restart
software devices stay unamanged due to external-down (because since
commit e1edcda, devices without IP address are also external-down).
So, this really just fixes one scenario, breaking another one.
This should be fixed with bgo#746440 by not assuming connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1371126
2016-09-09 14:10:27 +02:00
Thomas Haller
067aa50363 device: add new result NM_ACT_STAGE_RETURN_IP_DONE for ip config activation
This is like NM_ACT_STAGE_RETURN_SUCCESS, except it should only set
the IP state without commiting an NMIP[46]Config instance.
2016-09-09 14:10:27 +02:00
Thomas Haller
dd48472909 device: only set use_tempaddr sysctl for non-assumed devices
and only if the activation stage is not about to fail hard.
2016-09-09 14:10:27 +02:00
Thomas Haller
2162a84c5f device/trivial: rename NM_ACT_STAGE_RETURN_STOP to NM_ACT_STAGE_RETURN_IP_FAIL
and rename NM_ACT_STAGE_RETURN_STOP to NM_ACT_STAGE_RETURN_IP_FAIL.
They are only used during IP config stage. Give them a better name.
2016-09-09 14:10:27 +02:00
Thomas Haller
398e1e8b3c device: remove unneeded activation-stage result NM_ACT_STAGE_RETURN_FINISH
We can express FINISH by returning SUCCESS and not set out_config in
act_stage3_ip4_config_start().
2016-09-09 14:10:27 +02:00
Thomas Haller
94f42e9bec device: log changes to ip4_state and ip6_state 2016-09-09 14:10:27 +02:00
Thomas Haller
8bae6e588f ifcfg-rh: remove dead code from write_ip4_setting()
s_ip4 cannot be NULL and fake_ip4 is never TRUE.

Found by Coverity.

Fixes: cf7b8866ce
2016-09-09 01:01:30 +02:00
Thomas Haller
1a85103765 device: workaround driver issue with delayed change of MAC address
brcmfmac and possibly other drivers don't change the MAC address
right away, but instead the result is delayed. That is problematic
because we cannot continue activation before the MAC address is
settled.

Add a hack to workaround the issue by waiting until the MAC address
changed.

The previous attempt to workaround this was less intrusive: we would
just refresh the link once and check the result. But that turns out
not to be sufficent for all cases. Now, wait and poll.

https://bugzilla.gnome.org/show_bug.cgi?id=770456
https://bugzilla.redhat.com/show_bug.cgi?id=1374023
2016-09-08 20:59:33 +02:00
Thomas Haller
7d3bfce1dc dns/resolved: various fixes
- mode in init_resolv_conf_mode() must be initialized in
  case it is NULL.
- drop the NULL sentinal from resolved_paths and make it
  static.
- resolved_proxy_created() must handle the fact that @self
  might be already destroyed.
- call_done() must not access @self before ensuring that
  the call was not cancelled.
  What's more, send_update() can be called by resolved_proxy_created(),
  thus it must ensure that it has an @update_cancellable. Let
  send_update() create and cancel the @update_cancellable().
  Also, send_update() -- which now manages @update_cancellable
  instead of update() -- must actually cancel the previous
  cancellable, otherwise the callback again might access
  a disposed @self.

Co-authored-by: Beniamino Galvani <bgalvani@redhat.com>
2016-09-08 12:49:11 +02:00
Thomas Haller
040bf6c1e8 dns/resolved: adjust coding style 2016-09-08 12:49:03 +02:00
Sjoerd Simons
818023c257 dns/resolved: add systemd-resolved backend
Add initial DNS backend that pushes DNS information into
systemd-resolved. Backend is choosen by default if the systems
resolv.conv is setup to pointing to one of the standard resolved
locations.

This doesn't handle global dns configuration.

Signed-off-by: Sjoerd Simons <sjoerd@luon.net>

https://bugzilla.gnome.org/show_bug.cgi?id=762540
2016-09-08 12:49:03 +02:00
Thomas Haller
2856a658b3 dhcp: call synchronous Notify D-Bus method from nm-dhcp-helper
A D-Bus signal is asynchronous and it can happen that nm-dhcp-helper
emits the "Event" signal before the server is able to register a handler:

   NM_DHCP_HELPER=/usr/libexec/nm-dhcp-helper
   nmcli general logging level TRACE
   for i in `seq 1 500`; do $NM_DHCP_HELPER & done
   journalctl -u NetworkManager --since '1 min ago' | grep "didn't have associated interface" | wc -l
    499

Avoid that, by calling the synchronous D-Bus method "Notify".

Interestingly, this race seem to exist since 2007.

Actually, we called g_dbus_connection_signal_subscribe() from inside
GDBusServer:new-connection signal. So it is not clear how such a race
could exist. I was not able to reproduce it by putting a sleep
before g_dbus_connection_signal_subscribe(). On the other hand, there
is bug rh#1372854 and above reproducer which strongly indicates that
events can be lost under certain circumstances.
Now we instead g_dbus_connection_register_object() from the
new-connection signal. According to my tests there was no more race
as also backed by glib's documentation. Still, keep a simple retry-loop
in nm-dhcp-helper just to be sure.

https://bugzilla.redhat.com/show_bug.cgi?id=1372854
https://bugzilla.redhat.com/show_bug.cgi?id=1373276
2016-09-08 00:22:25 +02:00
Thomas Haller
7684b68c49 dhcp: add new header "nm-dhcp-helper-api.h" 2016-09-08 00:21:21 +02:00
Thomas Haller
cc89996c9e dhcp-helper: refactor logging to use logging macros 2016-09-08 00:21:21 +02:00
Thomas Haller
bb489163db dhcp-helper: refactor error handling
Don't exit(1) from fatal_error() because that skips destroying
local variables in main(). Just return regularly.
2016-09-08 00:21:21 +02:00
Thomas Haller
2dd3a5245f dhcp-listener/trivial: rename field to track connections in NMDhcpListener
It's not "signal-handles", as it currently tracks the registration ID of
type int. Rename it, it is effectively the list of connections that we
track.
2016-09-08 00:21:21 +02:00
Thomas Haller
d37cd04fe0 dhcp-listener: add logging macros to nm-dhcp-listener.c 2016-09-08 00:21:21 +02:00
Thomas Haller
822f01a8fd dhcp-listener: refactor type definition and embed private data in @self 2016-09-08 00:21:21 +02:00
Thomas Haller
cdf6ad4057 core: use _NM_GET_PRIVATE() macros 2016-09-08 00:21:21 +02:00
Thomas Haller
c1b4b99a3c logging: don't round subsecond part in logging timestamp
tv.tv_usec is guaranteed to have less then 6 digits, however rounding it up
we might reach 1000000 and thus the value becomes mis-aligned. To round
correctly, we would have to carry over a potential overflow to the seconds.
But that seems too much effort for little gain. Just truncate the value.
2016-09-08 00:21:21 +02:00
Thomas Haller
ee723b2aee systemd: merge branch systemd into master 2016-09-07 13:38:37 +02:00
Thomas Haller
a1efdc2b0a systemd: update code from upstream
This is a direct dump from systemd git on 2016-09-07, git commit
c5d5fc91eba8541a3a86ff6b839a2b6e824f4149.

======

SYSTEMD_DIR=../systemd
COMMIT=c5d5fc91eba8541a3a86ff6b839a2b6e824f4149

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files :/src/systemd/src/ | xargs -d '\n' rm -f

nm_copy_sd() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd "src/basic/alloc-util.c"
nm_copy_sd "src/basic/alloc-util.h"
nm_copy_sd "src/basic/async.h"
nm_copy_sd "src/basic/escape.c"
nm_copy_sd "src/basic/escape.h"
nm_copy_sd "src/basic/ether-addr-util.c"
nm_copy_sd "src/basic/ether-addr-util.h"
nm_copy_sd "src/basic/extract-word.c"
nm_copy_sd "src/basic/extract-word.h"
nm_copy_sd "src/basic/fileio.c"
nm_copy_sd "src/basic/fileio.h"
nm_copy_sd "src/basic/fd-util.c"
nm_copy_sd "src/basic/fd-util.h"
nm_copy_sd "src/basic/fs-util.c"
nm_copy_sd "src/basic/fs-util.h"
nm_copy_sd "src/basic/hash-funcs.c"
nm_copy_sd "src/basic/hash-funcs.h"
nm_copy_sd "src/basic/hashmap.c"
nm_copy_sd "src/basic/hashmap.h"
nm_copy_sd "src/basic/hexdecoct.c"
nm_copy_sd "src/basic/hexdecoct.h"
nm_copy_sd "src/basic/hostname-util.c"
nm_copy_sd "src/basic/hostname-util.h"
nm_copy_sd "src/basic/in-addr-util.c"
nm_copy_sd "src/basic/in-addr-util.h"
nm_copy_sd "src/basic/io-util.c"
nm_copy_sd "src/basic/io-util.h"
nm_copy_sd "src/basic/list.h"
nm_copy_sd "src/basic/log.h"
nm_copy_sd "src/basic/macro.h"
nm_copy_sd "src/basic/mempool.h"
nm_copy_sd "src/basic/mempool.c"
nm_copy_sd "src/basic/parse-util.c"
nm_copy_sd "src/basic/parse-util.h"
nm_copy_sd "src/basic/path-util.c"
nm_copy_sd "src/basic/path-util.h"
nm_copy_sd "src/basic/prioq.h"
nm_copy_sd "src/basic/prioq.c"
nm_copy_sd "src/basic/random-util.c"
nm_copy_sd "src/basic/random-util.h"
nm_copy_sd "src/basic/refcnt.h"
nm_copy_sd "src/basic/set.h"
nm_copy_sd "src/basic/signal-util.h"
nm_copy_sd "src/basic/siphash24.c"
nm_copy_sd "src/basic/siphash24.h"
nm_copy_sd "src/basic/socket-util.c"
nm_copy_sd "src/basic/socket-util.h"
nm_copy_sd "src/basic/sparse-endian.h"
nm_copy_sd "src/basic/stdio-util.h"
nm_copy_sd "src/basic/string-table.c"
nm_copy_sd "src/basic/string-table.h"
nm_copy_sd "src/basic/string-util.c"
nm_copy_sd "src/basic/string-util.h"
nm_copy_sd "src/basic/strv.c"
nm_copy_sd "src/basic/strv.h"
nm_copy_sd "src/basic/time-util.c"
nm_copy_sd "src/basic/time-util.h"
nm_copy_sd "src/basic/umask-util.h"
nm_copy_sd "src/basic/unaligned.h"
nm_copy_sd "src/basic/utf8.c"
nm_copy_sd "src/basic/utf8.h"
nm_copy_sd "src/basic/util.c"
nm_copy_sd "src/basic/util.h"
nm_copy_sd "src/libsystemd-network/arp-util.c"
nm_copy_sd "src/libsystemd-network/arp-util.h"
nm_copy_sd "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-network.c"
nm_copy_sd "src/libsystemd-network/dhcp-option.c"
nm_copy_sd "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.h"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd "src/libsystemd-network/lldp-network.c"
nm_copy_sd "src/libsystemd-network/lldp-network.h"
nm_copy_sd "src/libsystemd-network/network-internal.c"
nm_copy_sd "src/libsystemd-network/network-internal.h"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd "src/libsystemd-network/sd-lldp.c"
nm_copy_sd "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd "src/shared/dns-domain.c"
nm_copy_sd "src/shared/dns-domain.h"
nm_copy_sd "src/systemd/_sd-common.h"
nm_copy_sd "src/systemd/sd-dhcp6-client.h"
nm_copy_sd "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd "src/systemd/sd-dhcp-client.h"
nm_copy_sd "src/systemd/sd-dhcp-lease.h"
nm_copy_sd "src/systemd/sd-event.h"
nm_copy_sd "src/systemd/sd-ndisc.h"
nm_copy_sd "src/systemd/sd-id128.h"
nm_copy_sd "src/systemd/sd-ipv4acd.h"
nm_copy_sd "src/systemd/sd-ipv4ll.h"
nm_copy_sd "src/systemd/sd-lldp.h"
2016-09-07 13:35:08 +02:00
Thomas Haller
0ef8e98e73 ifupdown: add curly braces to for loop 2016-09-07 13:19:06 +02:00
Scott Sweeny
ada6b96de9 plugins: ifupdown: support source-directory stanza
Enable the ifupdown settings plugin to read interface
definitions from the source directory:

/etc/network/interfaces.d/

https://mail.gnome.org/archives/networkmanager-list/2016-September/msg00014.html
2016-09-07 13:15:42 +02:00
Beniamino Galvani
f618bc3611 vpn: fix memory leak when disconnecting from VPN
Fixes: d568eb0e6c
2016-09-03 11:03:48 +02:00
Thomas Haller
ba713e8381 exported-object: use _NMLOG2() macro for logging property-changed signal 2016-09-02 20:13:36 +02:00
Thomas Haller
b9c1868b45 exported-object: use @self variable instead of @object 2016-09-02 20:13:36 +02:00
Thomas Haller
bef26a2e69 dbus: fix emitting D-Bus NetworkManager's old-style PropertiesChange signal
Before switching to gdbus (before 1.2.0), NetworkManager used dbus-glib.
Most objects in the D-Bus API with properties had a signal
NetworkManager-specific "PropertiesChanged" signal. Nowadays, this way of
handling of property changes is deprecated for the common "PropertiesChanged"
signal on the "org.freedesktop.DBus.Properties" interface.

There were a few pecularities in 1.0.0 and earlier:

  (1) Due to the implementation with dbus-glib, a property-changed
    signal was emitted on *all* interfaces. For example:
      - a change on a NMDeviceVeth of "NMDeviceEthernet.HwAddress" would be
        emitted both for the interfaces "fdo.NM.Device.Ethernet" and
        "fdo.NM.Device.Veth". Note that NMDeviceVeth is derived from
        NMDeviceEthernet and there is no "HwAddress" on veth device.
      - a change of "NMVpnConnection.VpnState" was emitted on both
        interfaces "fdo.NM.VPN.Connection" and "fdo.NM.Connecion.Active".
        Note that NMActiveConnection is the parent type of NMVpnConnection and
        only the latter has a property "VpnState".
  (2) NMDevice's "fdo.NM.Device" interface  doesn't have a "PropertiesChanged"
    signal. From (1) follows that all property-changes for this type were instead
    invoked with an interface like "fdo.NM.Device.Ethernet" (or multiple
    interfaces in case of NMDeviceVeth).

1.2.0 introduced gdbus, which gives us the standard "fdo.DBus.Properties"
signal. However, it made the mistake of not realizing (1), thus instead
of emitting the signal once for each interface, it would pick the first
one in the inheritance tree.

With 1.4.0, a bug from merge commit 844345e caused signals for devices
to be only emitted for the interface "fdo.NM.Device.Statistics", instead
of "fdo.NM.Device.Ethernet" or "fdo.NM.Device.Veth" (or both).

The latter is what bgo#770629 is about and what commit 82e9439 tried to fix.
However, the fix was wrong because it tried to do the theoretically correct
thing of emitting the property-changed signal exactly once for the
interface that actually ontains the property. In addition, it missed that
NMDevice doesn't have a PropertiesChanged signal, which caused signals for
"fdo.NM.Device" to get lost *sigh*.

Now, restore the (broken) behavior of 1.0.0. These old-style property changed
signals are anyway considered deprecated and exist solely to satisfy old clients
and preserve the old API.

Fixes: 63fbfad3705db5901e6a2a6a2fc332da0f0ae4be

https://bugzilla.gnome.org/show_bug.cgi?id=770629
https://bugzilla.redhat.com/show_bug.cgi?id=1371920
2016-09-02 20:13:36 +02:00
Beniamino Galvani
a043b0b4c7 wwan: fix memory leaks 2016-09-02 09:47:41 +02:00
Beniamino Galvani
7203769fd0 device: don't try to start LLDP listener if no link is available
L3-only devices don't have an ifindex during stage2, don't try to
start LLDP on them.

Fixes: 07a9364d9c
2016-09-02 09:47:41 +02:00
Beniamino Galvani
c39e03edbf device: manage firewall zone for assumed persistent connections
After the fix in [1], if the connection is assumed we don't update its
firewall zone. The goal of that change was to prevent NM from
interfering with the configuration done externally on devices not
created by NM.

However if there is an assumed persistent connection active on the
device NM touches the configuration in other ways, for example it
configures DHCP and manages the default route. So it seems correct to
also update the firewall zone.

OTOH, if the connection is assumed-generated there is no persistent
connection specifying a firewall zone and updating it makes no sense.

Bug [1] was about not interfering with devices unknown to NM (for
which there is no persistent connection) and so this change should not
conflict with the previous fix.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1098281

https://bugzilla.redhat.com/show_bug.cgi?id=1366288
2016-08-31 14:44:02 +02:00
Thomas Haller
46f285e3d3 exported-object: cleanup logging about properties-changed 2016-08-31 14:22:28 +02:00
Thomas Haller
82e94390de exported-object: fix source interface for PropertiesChanged D-Bus signal
nm_exported_object_notify() hooks GObject's property-change signal
and searches for the D-Bus interface to which to send the
PropertiesChanged signal.
Then it would enqueue the value encoded as GVariant in pending_notifications.
However, thereby the association between the property that changed and the
interface was lost. So later in idle_emit_properties_changed() it would
just pick the first interface with a properties-changed-id.

That is wrong. pending_notifications must be associated with the D-Bus
interface that we are going to notify. That is, each InterfaceData must
have its own separate list.

This is broken since introducing NMExportedObject and moving to gdbus.
Only now it was discovered as NMDevice itself has two D-Bus interfaces:
"Device" and "Device.Statistics".

Note that the order of the PropertiesChanged in our D-Bus API is not defined
so that later signals can reach the receiver before earlier signals.
Also, multiple change signals for one property may be combined.
That is not changed by this patch and is not considered a bug, but something
that our D-Bus API wrt. PropertiesChanged does not guarantee.

https://bugzilla.gnome.org/show_bug.cgi?id=770629
2016-08-31 14:22:28 +02:00
Lubomir Rintel
3127fb0d17 device: don't let external changes cause a release of the slave
At this point we don't know if the slave has been using an assumed
connection that just vanished -- the best bet is to let the device be.

If it's meant to be unenslaved, it won't be due to an external event.

https://bugzilla.redhat.com/show_bug.cgi?id=1357738
2016-08-31 12:06:22 +02:00