Commit graph

15750 commits

Author SHA1 Message Date
Beniamino Galvani
2ea42eee5a ip6-config: sort addresses only when reading the property value
Don't change the address order from configuration, but instead sort
addresses just before returning them to clients.

(cherry picked from commit 0a0bca9c7f)
2016-12-09 14:30:57 +01:00
Beniamino Galvani
450572cff4 ip6-config: add nm_ip6_config_set_privacy()
(cherry picked from commit 803a79f778)
2016-12-09 14:30:46 +01:00
Beniamino Galvani
6633eaf75c ip6-config: cache addresses variants
(cherry picked from commit ed4d5889c7)
2016-12-09 14:18:58 +01:00
Beniamino Galvani
6fdea664a4 ip4-config: sort addresses only when reading the property value
Don't change the address order from configuration, but instead sort
addresses just before returning them to clients.

(cherry picked from commit 9609d4da1d)
2016-12-09 14:18:56 +01:00
Beniamino Galvani
996f325f67 ip4-config: cache addresses variants
(cherry picked from commit 5ce81e23b7)
2016-12-09 14:18:54 +01:00
Beniamino Galvani
56cebecd41 ip4-config: don't change order of addresses in the same subnet
When multiple address are assigned to an interface and the kernel must
decide which one should be used to communicate with a given IP, it
chooses the most specific one in the same subnet as the
destination. In case there are multiple addresses in the same subnet,
the primary address is choosen, which is basically the first one that
was added.

With commit 7197425137 ("device: expose NMIP4Config:addresses in
stable/defined sort order") we sorted all the addresses before
committing the configuration, with the side effect that the order no
longer respected the one in the user configuration.

Instead, change the sort function to keep the subnet order unchanged.

(cherry picked from commit e02752c2ed)
2016-12-09 14:18:53 +01:00
Thomas Haller
8bcf1a6e3d ip-config: cleanup integer types for nm_ip4_config_get_num_*()
(cherry picked from commit 510626bf74)
2016-12-09 14:18:47 +01:00
Thomas Haller
baac746abb device: fix activation_source_schedule() for rescheduling the same function
Fixes: 78ca961c0f
(cherry picked from commit 994f1ca96e)
2016-12-08 13:56:21 +01:00
Lubomir Rintel
9cef2f5e83 libnm: order the property updates
Don't let a later property update finish than the sooner one.

This wouldn't happen most of time, apart from a special case when the
latter update of a object array property is to an empty list.
In that case the latter update would complete sooner and when the
earlier update finishes the list would contain objects which are
supposed to be gone already.

(cherry picked from commit 7007c9853c)
2016-12-02 17:31:09 +01:00
Thomas Haller
5f2b0abdd2 platform: increase initial buffer size of libnl's nl_recvmsg() to 32K
Since commit 9fafb382db, we would
explicitly set libnl's socket buffer size to 4*getpagesize().
That is also the default of libnl itself. Additionally, we would
workaround too small buffers by increasing the buffer size up to 512K.

A too small buffer causes messages to be lost. Usually, that only
results in a cache-resync, which isn't too bad. Lost messages are however
a problem if the lost message was an ACK that we were waiting for.
However, it is rather unlikely to happen, because it's expected that
the buffer size gets adjusted already when the cache is filled initially,
before any other requests are pending.

Still, let's increase the default buffer size to 32K, hoping that this
initial value is already large enough to avoid the problem altogether.

Note that iproute2 also uses a buffer size of 32K [1] [2].

Alternatively, we could use MSG_PEEK like systemd does [3]. However,
that requires two syscalls per message.

[1] https://patchwork.ozlabs.org/patch/592178/
[2] https://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/lib/libnetlink.c?id=f5f760b81250630da23a4021c30e802695be79d2#n274
[3] cd66af2274/src/libsystemd/sd-netlink/netlink-socket.c (L323)

(cherry picked from commit ed82b6bcb3)
2016-12-02 15:32:45 +01:00
Thomas Haller
74ff792956 device: allow device reapply of a connection with differing connection.autoconnect
Autoconnect property doesn't really matter for the applied
connection. Whitelist it from the properties and allow changing
it during reapply.

(cherry picked from commit d29839c430)
2016-12-02 11:43:28 +01:00
Thomas Haller
5dbd54552d platform: workaround NLE_MSG_TRUNC failure of nl_recv() with too small buffer size
We don't want to enable MSG_PEEK due to the overhead. But when we detect
that we just lost a message due to MSG_TRUNC, increase the buffer size and
retry.

See-also: 55ea6e6b6c
(cherry picked from commit 9fafb382db)
2016-11-30 17:23:00 +01:00
Piotr Drąg
c7a873e1a9 po: update Polish (pl) translation (bgo #775181)
https://bugzilla.gnome.org/show_bug.cgi?id=775181
(cherry picked from commit b08dd30b09)
2016-11-28 18:53:38 +01:00
Jiří Klimeš
eb9b2de778 agent: don't clear "error", g_simple_async_result_take_error() overtakes it
From valgrind:
==21921== Invalid free() / delete / delete[] / realloc()
==21921==    at 0x4C2CD5A: free (vg_replace_malloc.c:530)
==21921==    by 0x81C4F2D: g_free (gmem.c:189)
==21921==    by 0x81AB021: g_error_free (gerror.c:491)
==21921==    by 0x81AB325: g_clear_error (gerror.c:674)
==21921==    by 0x767B555: reg_request_cb (nm-secret-agent-old.c:616)
==21921==    by 0x7A211F2: g_task_return_now (gtask.c:1107)
==21921==    by 0x7A21228: complete_in_idle_cb (gtask.c:1121)
==21921==    by 0x81BF6B9: g_main_dispatch (gmain.c:3154)
==21921==    by 0x81BF6B9: g_main_context_dispatch (gmain.c:3769)
==21921==    by 0x81BFA6F: g_main_context_iterate.isra.29 (gmain.c:3840)
==21921==    by 0x81BFB1B: g_main_context_iteration (gmain.c:3901)
==21921==    by 0x7A4748C: g_application_run (gapplication.c:2381)
==21921==    by 0x118AEF: main (main.c:81)

It caused memory corruption and may result in strange nm-applet crashes.

(cherry picked from commit 544f7d3683)
2016-11-25 14:34:21 +01:00
Lubomir Rintel
8f8b43880f libnm/vpn-service-plugin: transition to STOPPED state from INIT too
We may want to stop the plugin before we started connecting e.g. when the
plugin NeedsSecrets but we can't supply them.

(cherry picked from commit 743d372d72)
2016-11-24 14:18:47 +01:00
Lubomir Rintel
8ab9634fdb vpn-manager: ignore ip configs from disconnected plugins
Plugins could be already failed or disconnected when the helper fires.
E.g. they could send in an invalid IP4Config that would cause them to
fail and then follow with an IP6Config before they realize it's of no
use. We'd hit an assertion failure in that case, because the
NMVpnConnection would already be cleaned up.

(cherry picked from commit bf70ed2e86)
2016-11-24 14:18:47 +01:00
Lubomir Rintel
fa68e17abe libnm/tests: increase timeout in nm-client test
Otherwise the test may fail in valgrind.

(cherry picked from commit dfa90861e8)
2016-11-24 14:18:47 +01:00
Lubomir Rintel
2fab21ad49 valgrind: adjust one gdbus suppression
In Fedora 25 the actual frame was called "fun:g_main_context_iterate.isra.24".

(cherry picked from commit afd48fbdbe)
2016-11-24 14:18:47 +01:00
Lubomir Rintel
3dbf86f197 man: use <filename> to mark file names
This gives the templates a chance to do something extra clever with the
formatting. The templates, of course, choose not to :(

(cherry picked from commit 7b589e2b72)
2016-11-24 14:18:47 +01:00
Lubomir Rintel
af1e6decde man: link to some online resources
(cherry picked from commit 42e1e669bc)
2016-11-24 14:18:47 +01:00
Lubomir Rintel
af6d220921 man: get rid of the extra capitalization in docbook source
The temaplates capitalize the names if they wish.

(cherry picked from commit 063d714a3c)
2016-11-24 14:18:47 +01:00
Lubomir Rintel
f7a0b36f03 client: don't do g_criticals
Also, be a bit more careful about the layers of errors. Just don't do this:

   (process:236): nmcli-CRITICAL **: Error: Could not create NMClient object:
     Permissions request failed: Authorization check failed:
     The name org.freedesktop.PolicyKit1 was not provided by any .service files.

(cherry picked from commit 7279ea1317)
2016-11-24 14:18:47 +01:00
Lubomir Rintel
676d16293f wifi: notify the AccessPoint change after an AP is removed
Otherwise its path remains visible on D-Bus despite the object is gone,
making libnm sad and grumpy:

  libnm-WARNING **: no object known for /org/freedesktop/NetworkManager/AccessPoint/666

(cherry picked from commit d0c01cc79d)
2016-11-24 14:12:40 +01:00
Beniamino Galvani
ad4d3ba008 manager: fix state transition on resuming from sleep
When going to sleep, we unmanage devices setting the unmanaged flags
immediately but delaying the state transition (because we do it from
another state transition). The signal handler can be executed after
the wake and, especially, after we have already re-managed the device,
making the device unmanaged again.

Detect such situation and force the state to UNMANAGED (which will
also clear any pending state change), so that later we manage the
device again and it will try to activate any available connection.

Fixes: 81ea812362
(cherry picked from commit 3cc06c3db679c1ff2f61a301396393300d36adbb)
2016-11-24 14:12:33 +01:00
Beniamino Galvani
561a0a428d manager: force connectivity check when there is a default active connection
The interaction between the manager state and connectivity check code
is tricky. When there is an active connection with a default route and
NMConnectivity reports full connectivity, we set the CONNECTED_GLOBAL
state. However, if the connectivity check hasn't run yet, we stay in
CONNECTED_SITE state. If there are also other connections that are
activating, the state is set to CONNECTING.

This is a problem, because in CONNECTING we never run the connectivity
check and thus we fail to recognize that there is full connectivity
until a periodic check is run.

To solve this, schedule the connectivity check every time there is an
active connection with default route, even if other connection are
still activating, so that the check result can make the state progress
to CONNECTED_GLOBAL.

(cherry picked from commit 084da69a30)
2016-11-07 14:25:46 +01:00
Thomas Haller
221851436b device: merge branch 'th/preserve-fake-perm-hwaddr-bgo772880'
https://bugzilla.gnome.org/show_bug.cgi?id=772880
https://bugzilla.redhat.com/show_bug.cgi?id=1388286

(cherry picked from commit e2b7da7b82)
2016-11-03 12:33:11 +01:00
Thomas Haller
37266b483b device: suppress log message in nm_device_update_hw_address() when no MAC address
For example for tun devices we get a lot of

  (tun7): hw-addr: failed reading current MAC address

warnings. Just be silent about it. We log when something
changes, we don't need to log when we fail to obtain
a MAC address.

Thereby, refactor nm_device_update_hw_address() to return early.

(cherry picked from commit 0e0018c801)

Conflicts:
    src/devices/nm-device.c
2016-11-03 12:24:02 +01:00
Thomas Haller
cc0a590d57 device: don't evaluate IP config changes until device is initialized
The unmanaged flags PLATFORM_INIT indicates whether UDEV is done
initializing the device. We should not handle IP config changes
before that pointer.

This avoids codepaths that require the permanent MAC address of the
device. We should not freeze the permanent MAC address before
UDEV initialized the device, for two reasons:

- getting the permanent MAC address using ethtool is racy as
  UDEV might still rename the interface.
- freezing a fake permanent MAC address should only happen after
  UDEV is done configuring the MAC address of software devices.

    #0  0x000055555568bc7a in nm_device_update_permanent_hw_address (self=self@entry=0x555555f0fb70 [NMDeviceVeth], force_freeze=force_freeze@entry=1) at src/devices/nm-device.c:11817
    #1  0x000055555568c443 in nm_device_get_permanent_hw_address_full (self=self@entry=0x555555f0fb70 [NMDeviceVeth], force_freeze=force_freeze@entry=1, out_is_fake=out_is_fake@entry=0x0)
        at src/devices/nm-device.c:12227
    #2  0x000055555568cb06 in nm_device_get_permanent_hw_address (self=self@entry=0x555555f0fb70 [NMDeviceVeth]) at src/devices/nm-device.c:12237
    #3  0x000055555568cb50 in spec_match_list (self=0x555555f0fb70 [NMDeviceVeth], specs=0x555555a5c000 = {...}) at src/devices/nm-device.c:12294
    #4  0x00005555556a4ee6 in spec_match_list (device=0x555555f0fb70 [NMDeviceVeth], specs=0x555555a5c000 = {...}) at src/devices/nm-device-ethernet.c:1461
    #5  0x00005555556978db in nm_device_spec_match_list (self=self@entry=0x555555f0fb70 [NMDeviceVeth], specs=0x555555a5c000 = {...}) at src/devices/nm-device.c:12277
    #6  0x000055555558e187 in _match_section_infos_lookup (match_section_infos=0x555555a5d500, keyfile=0x555555a46f80, property=property@entry=0x555555793123 "ipv4.route-metric", device=device@entry=0x555555f0fb70 [NMDeviceVeth], out_value=out_value@entry=0x7fffffffe018) at src/nm-config-data.c:1169
    #7  0x00005555555922ca in nm_config_data_get_connection_default (self=0x555555a548c0 [NMConfigData], property=property@entry=0x555555793123 "ipv4.route-metric", device=device@entry=0x555555f0fb70 [NMDeviceVeth]) at src/nm-config-data.c:1234
    #8  0x00005555556790cd in _get_ipx_route_metric (self=self@entry=0x555555f0fb70 [NMDeviceVeth], is_v4=is_v4@entry=1) at src/devices/nm-device.c:1142
    #9  0x000055555567912e in nm_device_get_ip4_route_metric (self=self@entry=0x555555f0fb70 [NMDeviceVeth]) at src/devices/nm-device.c:1161
    #10 0x000055555567da6c in ip4_config_merge_and_apply (self=self@entry=0x555555f0fb70 [NMDeviceVeth], config=config@entry=0x0, commit=commit@entry=0, out_reason=out_reason@entry=0x0)
        at src/devices/nm-device.c:4787
    #11 0x000055555567e0fb in update_ip4_config (self=self@entry=0x555555f0fb70 [NMDeviceVeth], initial=initial@entry=0) at src/devices/nm-device.c:9532
    #12 0x0000555555693acd in queued_ip4_config_change (user_data=0x555555f0fb70) at src/devices/nm-device.c:9651
    #13 0x00007ffff4c966ba in g_main_context_dispatch (context=0x555555a46af0) at gmain.c:3154
    #14 0x00007ffff4c966ba in g_main_context_dispatch (context=context@entry=0x555555a46af0) at gmain.c:3769
    #15 0x00007ffff4c96a70 in g_main_context_iterate (context=0x555555a46af0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3840
    #16 0x00007ffff4c96d92 in g_main_loop_run (loop=0x555555a47400) at gmain.c:4034
    #17 0x000055555558372a in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:411

(cherry picked from commit 31ca7962f8)
2016-11-03 12:24:02 +01:00
Thomas Haller
9f51a93d97 device: delay evaluating unmanaged-by-user-settings flags until link initialized
Before the link is initialized, that is before UDEV completed
initializing the device, we should not evaluate the user-settings
unmanaged flags.

The reason is, that evaluating it likely involves looking at the
permanent MAC address, which might use the wrong fake MAC address
(before UDEV set the right one). Also, it might use the wrong ifname
to lookup the permanent MAC address via ethtool.

(cherry picked from commit c0d249b733)
2016-11-03 12:24:02 +01:00
Thomas Haller
38b6f36edc device: delay capturing permanent MAC address until UDEV is settled
The permanent MAC address of an NMDevice shall not change as
long as the device is realized. That is, we read it only once
and don't change it afterwards.

There are two issues that this commit tries to mitigate:

(1) users are advised to use UDEV to rename interfaces. As we lookup
  the permenent MAC address using ethtool (which uses the interface
  name), there is a race where we could read the permanent MAC
  address using the wrong interface name. We should wait until
  UDEV finished initializing the device and until the interface
  name is stable (see rh#1388286).
  This commit still cannot avoid the race of ethtool entirely. It only
  tries to avoid ethtool until UDEV has done its work. That is, until we
  expect the interface name no longer to change.

(2) some device types, don't have a permanent MAC address so we fall
  back to use the currently set address (fake). Again, users are advised
  to use UDEV to configure the MAC addresses on such software devices.
  Thus, we should not get the fake MAC address until UDEV initialized
  the device.

This patch actually doesn't solve the problem at all yet.
The reason is that a regular caller of nm_device_get_permanent_hw_address() can
not afford to wait until UDEV settled. Thus, any user who requests the
permanent MAC address before the link is initialized, runs into the
problems above.

In a next step, we shall revisit such calls to nm_device_get_permanent_hw_address()
and delay them until the link is initialized.

(cherry picked from commit 7b7c653c4f)

Conflicts:
        src/devices/nm-device.c
        src/nm-manager.c
2016-11-03 12:24:01 +01:00
Thomas Haller
e41284b3fc device: don't allow mutating the device's hardware address length
We repeatedly call nm_device_update_hw_address() to reset the cached
MAC address of the device. However, we don't allow changing the address
length once it is set.

Multiple entities (initial, current and permanent MAC address) are all
checked to have the same address length. Changing the length would be a
very strange thing (and probably indicate a bug somewhere else).

Just don't allow that.

(cherry picked from commit cbea1f9f23)
2016-11-03 12:24:01 +01:00
Thomas Haller
7bb7b17408 device: treat fake permanent MAC address mostly like a real one
Now that we persist the fake permanent address across
restart of NetworkManager, we want to consider fake
addresses as good enough in most cases.

(cherry picked from commit 416164aa29)
2016-11-03 12:24:01 +01:00
Lubomir Rintel
bb5ee41dc4 config: allow fallback to fake permanent address for default wired connections
The default wired connection is already generated allowing the use of a fake
address, but for the state file and the device matching specs only non-fake
addresses are used. Let's allow fake addresses consistently, so that default
wired connections work properly in containers (where the veth address is
considered fake) as well.

Also, it would really be a better idea to use ifnames everywhere instead, but
that would change the format of the state file.

(cherry picked from commit bcb685c4cb)
2016-11-03 12:24:01 +01:00
Thomas Haller
b071c91eef core: add nm_device_get_permanent_hw_address_full() function
This is a partial cherry-pick from commit 5912b2f9a1.
2016-11-03 12:24:01 +01:00
Thomas Haller
977fbf7089 libnm-core/utils: update hwaddr utilities
_nm_utils_hwaddr_length() did a validation of the string
and returned the length of the address. In all cases where
we were interested in that, we also either want to validate
the address, get the address in binary form, or canonicalize
the address.

We can avoid these duplicate checks, by using _nm_utils_hwaddr_aton()
which both does the parsing and returning the length.

(cherry picked from commit e5fe5a4c03)
2016-11-03 12:24:00 +01:00
Thomas Haller
d242fdc319 shared: add nm_assert_se() macro
We usually don't build NM with g_assert() disabled (G_DISABLE_ASSERT).
But even if we would, there is no assertion macro that always evaluates
the condition for possible side effects.

I think that is a useful thing to have.

(cherry picked from commit ba950cedee)
2016-11-03 12:24:00 +01:00
Thomas Haller
beeb676735 shared: add nm_clear_g_free()
(cherry picked from commit b4e66c4818)
2016-11-03 12:24:00 +01:00
Thomas Haller
7927d451fc tools: fix starting tests with D-Bus session with NMTST_NO_VALGRIND=1
When running

  NMTST_NO_VALGRIND=1 make check -j

we would not start separate D-Bus sessions, thus running tests with
valgrind enabled failed.

(cherry picked from commit c94dac0b5d)
2016-11-03 12:24:00 +01:00
Thomas Haller
a67eb9d8d0 logging: remove LOGD_HW alias for LOGD_PLATFORM
Since commit 1495853e01, LOGD_HW is renamed to
LOGD_PLATFORM. Remove the internal usage of the deprecated name.

Backport this patch to nm-1-4 because it avoids follow-up conflicts with
future backports. Also, it is a really trivial change, meaning, we only
replace the obsolte LOGD_HW name.

(cherry picked from commit 64951f07fb)

Conflicts:
    src/devices/nm-device.c
    src/devices/wwan/nm-modem.c
2016-11-03 12:23:07 +01:00
Thomas Haller
4d89a986ad libnm-core: fix memleak in nm-setting-vlan.c (priority_strv_to_maplist())
(cherry picked from commit f23320478d)
2016-11-02 15:29:16 +01:00
Beniamino Galvani
dbacb9ae09 ppp: add counter to D-Bus object path for PPP manager instances
There can be multiple PPP connections active, each with its own PPP
manager.

Fixes: c1dd3b6eed
(cherry picked from commit bc26f94d1e)
2016-11-02 13:24:27 +01:00
Thomas Haller
b14fe3ce08 core: don't unmanage devices on shutdown
... except Wi-Fi and devices that cannot assume connections at all.

https://bugzilla.redhat.com/show_bug.cgi?id=1371126
https://bugzilla.redhat.com/show_bug.cgi?id=1378418
(cherry picked from commit d298b7c96d)
2016-10-27 11:12:22 +02:00
Beniamino Galvani
c53496fe4a cli: completion: escape shell special characters "()&!"
https://bugzilla.gnome.org/show_bug.cgi?id=772629
(cherry picked from commit 108f04e71e)
2016-10-26 13:42:24 +02:00
Beniamino Galvani
940cb6eb87 wwan: fix wrong connection cast on device state change
nm_settings_connection_set_autoconnect_blocked_reason() must be called
on the settings-connection. Fixes the following:

GLib-GObject-WARNING **: invalid cast from 'NMSimpleConnection' to 'NMSettingsConnection'

Fixes: 06da353242
(cherry picked from commit 7034ea7aa3)
2016-10-26 13:28:07 +02:00
Thomas Haller
d831c2653d libnm: avoid possibly NULL address for NMDeviceVlan calling nm_utils_hwaddr_matches()
(cherry picked from commit c4198d45e3)
2016-10-24 10:33:21 +02:00
Thomas Haller
07d1842fe7 libnm: fix memleak in NMDeviceVxlan
(cherry picked from commit 7eb054d099)
2016-10-24 10:33:13 +02:00
Thomas Haller
7a8ed3fefd shared: make nm_str_not_empty() inline function instead of macro
It was a macro to pass on the non-const-ness of the argument, but
that just doesn't make sense.

That is a signature

  char *nm_str_not_empty (char *)

does not make sense, because you cannot transfer ownership
conditionally without additional checks to avoid a leak. Which makes
this form is pointless. For example:

    char *
    foo (void)
    {
        char *s;

        s = _create_value ();
        return nm_str_not_empty (s); /* leaks "" */
    }

(cherry picked from commit 34970e4141)
2016-10-24 10:33:07 +02:00
Thomas Haller
cbfdb72db2 ifcfg-rh: fix signature of link_changed() callback
Depending on how arguments are passed to the called function,
this could lead to a crash.

Maybe not on 32 bit machines where the size of the pointer is
the size of an int.

Maybe not on x86_64, where the arguments are passed in registers.

Fixes: b88c309167
(cherry picked from commit 548a5440e9)
2016-10-22 17:14:24 +02:00
Beniamino Galvani
b81cd79750 merge: branch 'bg/platform-unaligned-stats64-bgo772605'
https://bugzilla.gnome.org/show_bug.cgi?id=772605
(cherry picked from commit d7b32008b7)
2016-10-14 11:24:11 +02:00
Beniamino Galvani
84d213f7c5 platform: avoid unaligned access to link stats on 64bit architectures
The undefined behavior sanitizer complains with:

platform/nm-linux-platform.c:1482:31: runtime error: member access within misaligned address 0x61a000016fac for type 'struct rtnl_link_stats64', which requires 8 byte alignment
0x61a000016fac: note: pointer points here
  bc 00 17 00 bf 05 00 00  00 00 00 00 bf 05 00 00  00 00 00 00 b5 68 02 00  00 00 00 00 b5 68 02 00
              ^
platform/nm-linux-platform.c:1483:29: runtime error: member access within misaligned address 0x61a000016fac for type 'struct rtnl_link_stats64', which requires 8 byte alignment
0x61a000016fac: note: pointer points here
  bc 00 17 00 bf 05 00 00  00 00 00 00 bf 05 00 00  00 00 00 00 b5 68 02 00  00 00 00 00 b5 68 02 00
              ^
platform/nm-linux-platform.c:1484:31: runtime error: member access within misaligned address 0x61a000016fac for type 'struct rtnl_link_stats64', which requires 8 byte alignment
0x61a000016fac: note: pointer points here
  bc 00 17 00 bf 05 00 00  00 00 00 00 bf 05 00 00  00 00 00 00 b5 68 02 00  00 00 00 00 b5 68 02 00
              ^
platform/nm-linux-platform.c:1485:29: runtime error: member access within misaligned address 0x61a000016fac for type 'struct rtnl_link_stats64', which requires 8 byte alignment
0x61a000016fac: note: pointer points here
  bc 00 17 00 bf 05 00 00  00 00 00 00 bf 05 00 00  00 00 00 00 b5 68 02 00  00 00 00 00 b5 68 02 00
              ^

That's because the pointer returned by nla_data() is only
32bit-aligned and using it to access structure members can cause
issues on some 64bit architectures.

Use the unaligned_read_ne64() macro to access the structure members.

https://bugzilla.gnome.org/show_bug.cgi?id=772605
(cherry picked from commit 89bcf50f61)
2016-10-14 11:23:51 +02:00