Commit graph

8858 commits

Author SHA1 Message Date
Thomas Haller
cac0738723 device: change hw_addr_type field to bitfield type
We don't want to waste a full "int" size to store the @hw_addr_type
in NMDevicePrivate. Previously, that was hacked around by using guint8.

Now, instead use a bitfield which has the right type.
2017-02-10 14:40:23 +01:00
Thomas Haller
5151a6071f device: inline device helper structs QueuedState and PingInfo
These two structs are only used at exactly one place: as the type
for a field in NMDevicePrivate.

Having additional structs (that are only used at one place) only
add noise. Also, there are already prior-acts of using unnamed
structs in NMDevicePrivate in case of structs that only serve
to group/namespace a set of fields.
2017-02-10 14:40:23 +01:00
Thomas Haller
e347d96596 device: prepend pending actions list
The order doesn't matter, so prepend instead of append new items
to the pending-actions list.
2017-02-10 14:40:23 +01:00
Thomas Haller
3bc1e02adf device: don't clone pending-action string
All callers either use a static @action argument or keep a clone
of the string that lives as long as the action is pending. So,
save cloning the string.
2017-02-10 14:40:23 +01:00
Thomas Haller
8ac14b5400 device: implement queued_state_to_string() via NM_UTILS_LOOKUP_STR_DEFINE_STATIC() 2017-02-10 14:40:23 +01:00
Thomas Haller
e234673a4a device: refactor pending-action strings as named defines 2017-02-10 14:40:23 +01:00
Thomas Haller
252e95c113 device: queue recheck-available before removing "wait for supplicant" pending action
While we still recheck-available, we want to queue a pending action to block
startup-complete. However, we have to queue that before removing the pending
action for "wait for supplicant".

  <debug> [...] device[0x563abbcca400] (wlp2s0): remove_pending_action (0): 'waiting for supplicant'
  <info>  [...] manager: startup complete
  <debug> [...] device[0x563abbcca400] (wlp2s0): add_pending_action (1): 'queued state change to disconnected'
2017-02-10 14:40:23 +01:00
Thomas Haller
11744b090e device: add pending-action "recheck-available"
Startup-complete means that all devices have settled in a state
and no further activation is pending. When we have a recheck-available
scheduled, we clearly should not yet declare startup-complete.

Add a new pending-action "recheck-available" to avoid:

  <info>  [1485520408.3920] device (wlp2s0): supplicant interface state: starting -> ready
  <debug> [1485520408.3920] device[0x563abbcca400] (wlp2s0): remove_pending_action (0): 'waiting for supplicant'
  <info>  [1485520408.3920] manager: startup complete
  <debug> [1485520408.3924] device[0x563abbcca400] (wlp2s0): add_pending_action (1): 'queued state change to disconnected'
2017-02-10 14:40:23 +01:00
Thomas Haller
95a95b3e48 core: use define for GObject property name NM_SUPPLICANT_INTERFACE_SCANNING
grep-ing for '\<scanning\>' yields 42 hits under src. But only 2 are actual
references to the "scanning" GObject property of NMDeviceWifi.

Use a #define with a unique name where we mean NMDeviceWifi's property.
2017-02-10 14:40:23 +01:00
Thomas Haller
dc40288849 all: use NM_CACHED_QUARK_FCN() to define cached quarks 2017-02-10 14:33:52 +01:00
Thomas Haller
7d6b8bab70 all: use NM_CACHED_QUARK_FCN() instead of G_DEFINE_QUARK()
I think NM_CACHED_QUARK_FCN() is better because:

- the implementation is in our hand, meaning it is clear that
  putting a "static" before NM_CACHED_QUARK_FCN() is guaranteed to
  work -- without relying on G_DEFINE_QUARK() to be defined in a way
  that this works (in fact, we currently never do that and instead
  make all functions non-static).
- it does not construct function names by appending "_quark".
  Thus you can grep for the entire function name and finding
  the place where it is implemented.
- same with the stings, where the new macro doesn't stringify the
  argument, which is less surpising. Again, now you can grep
  for the string including the double quoting.

(yes, I really use grep to understand the source-code)
2017-02-10 14:33:52 +01:00
Thomas Haller
8538b61eb6 core: use cached GQuark and g_object_[gs]et_qdata()
Use g_object_[gs]et_qdata() instead of g_object_[gs]et_data() with a cached
quark. This saves an additional lookup to intern the string.
2017-02-10 14:33:52 +01:00
Beniamino Galvani
a347962831 platform: fix detection of primary/secondary addresses
ip4_addr_subnets_is_secondary() should fill the list of addresses in
the same subnet also when returning FALSE, because
nm_platform_ip4_address_sync() uses it.

Fixes: 2f68a50041
2017-02-08 14:47:14 +01:00
Beniamino Galvani
0a0893280b core: fix nm_utils_file_set_contents() handling of -1 length
nm_utils_file_set_contents() must compute the content size when
@length is -1.

Fixes: 21358edc54
2017-02-08 12:40:47 +01:00
Thomas Haller
ca5f915ac2 platform: cleanup _log_dbg_sysctl_set_impl() and _log_dbg_sysctl_get_impl()
- use gs_free attribute
- move printing the logging cache warning inside the place
  where we actuall add a new item to the cache.

It's really a minor cleanup of stuff that come to my mind reviewing the
function.
2017-02-07 15:28:14 +01:00
Thomas Haller
0cb85f161e device/wifi: drop messing with wpa-supplicant's support for MAC address randomization
We no longer use wpa_supplicant for MAC address randomization. Instead, NetworkManager
handles it on it's own. It is actually important that supplicant does not interfere
when setting the MAC address of the device.

The code was only in effect when supplicant has a PreassocMacAddr property.
As this is a recent feature, the left-over code wasn't noticed until now.

https://mail.gnome.org/archives/networkmanager-list/2017-February/msg00003.html

Fixes: 767abfa690
2017-02-07 14:38:34 +01:00
Beniamino Galvani
0683ad5db2 bond: fix crash in update_connection()
The value read from sysfs can be NULL.

Fixes: 2324410a75
2017-02-07 11:05:01 +01:00
Thomas Haller
e68cc17f43 build: fix -Wignored-qualifiers warnings
./src/nm-config-data.h:163:1: error: 'const' type qualifier on return type has no effect [-Werror,-Wignored-qualifiers]
    const guint nm_config_data_get_connectivity_interval (const NMConfigData *config_data);
    ^~~~~~
2017-02-06 19:27:21 +01:00
Thomas Haller
7c6c8f0d8b all: cleanup switch fall-through comments for -Wimplicit-fallthrough warning
The -Wimplicit-fallthrough=3 warning is quite flexible of accepting
a fall-through warning.

Some comments were missing or not detected correctly.

Thereby, also change all other comments to follow the exact
same pattern.
2017-02-06 16:45:20 +01:00
Thomas Haller
1859b90c48 systemd: merge branch systemd into master 2017-02-06 13:45:51 +01:00
Thomas Haller
c2d0b9eec0 systemd: fix memleak in dhcp6_option_parse_domainname
https://github.com/systemd/systemd/pull/5114
419eaa8f8d
2017-02-06 13:44:45 +01:00
Thomas Haller
7cd2dfabec systemd: fix memleak in dhcp6_lease_set_domains
https://github.com/systemd/systemd/pull/5113
0b75a95ace
2017-02-06 13:42:14 +01:00
Thomas Haller
e52235a781 systemd: update code from upstream
This is a direct dump from systemd git on 2017-02-05, git commit
52e634271fe96ec23a22705ffb87df59a09d1618.

======

SYSTEMD_DIR=../systemd
COMMIT=52e634271fe96ec23a22705ffb87df59a09d1618

(
  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"
2017-02-06 13:12:07 +01:00
Thomas Haller
11bc3f191e all: use nm_utils_strv_find_first() from shared/nm-utils 2017-02-04 17:55:30 +01:00
Lubomir Rintel
6404c79e4d core: kill nm_spawn_process()
It's not used anymore. Which is a good thing, because if it was used
we'd have to get rid of the uses.

It did accept a whitespace separated string for an argument, which is
never useful for us; it indicated error either on g_spawn_sync()
failure or an error status code of the program spawned, but only set the
error in the former case which had let to errors.

The would would be a bit nicer place without it.
(But not much)
2017-02-03 18:53:40 +01:00
Lubomir Rintel
55a5bf580d dns-unbound: avoid using nm_spawn_process()
It doesn't improve anything and is the last user of said function.
2017-02-03 18:53:40 +01:00
Lubomir Rintel
46c534d7e9 dns-manager: get rid of the nm_spawn_process() use
There's no point in making our lives more complicated by concatenating
the argument into a string and then splitting it up again.
2017-02-03 18:53:39 +01:00
Lubomir Rintel
4e8eddd100 dns-manager: fix a NULL dereference in error handling
nm_spawn_process() only sets error if the g_spawn_sync() itself fails,
not when the program ran returns a non-zero code.

  <debug> [148  059915.1567] dns-mgr: update-dns: updating resolv.conf
  <info>  [148  059915.1568] dns-mgr: Removing DNS information from /usr/bin/resolvconf
  No resolv.conf for interface NetworkManager
  Thread 1 "NetworkManager" received signal SIGSEGV, Segmentation fault.
  0x0000555555  7c325 in nm_dns_manager_end_updates
  1532  _LOGW ("could not commit DNS changes: %s", error->message);
  (gdb) bt full
  #0  0x0000555555  7c325 in nm_dns_manager_end_updates
          error = 0x0
2017-02-03 18:53:24 +01:00
Thomas Haller
27cba47957 ifcfg-rh: fix interpreting missing MAC_ADDRESS_RANDOMIZATION as permanent address
With commit 4f6c91d696, we aimed to
enable mac-address-randomization by default for Wi-Fi. That however
is not possible by default because it breaks various scenarios.
Also, later wifi.mac-address-randomization was deprecated in favor
of wifi.cloned-mac-address setting.

Both wifi.mac-address-randomization and wifi.cloned-mac-address support
global default values, so it is wrong to read a missing
MAC_ADDRESS_RANDOMIZATION setting as "NEVER" -- which due to
normalization also results in cloned-mac-address=permanent.

See also commit 46d53e1101 which does
something similar for keyfile.

This bug also prevents a user from clearing the cloned-mac-address:

  $ nmcli connection show "$CONN"
  ...
  802-11-wireless.cloned-mac-address:        permanent
  802-11-wireless.mac-address-randomization: never
  ...
  $ nmcli connection modify "$CONN: wifi.cloned-mac-address ''
  # ^ takes no effect

As workaround, you also need to clear mac-address-randomization:

  $ nmcli connection modify "$CONN: wifi.cloned-mac-address '' \
          wifi.mac-address-randomization default

https://mail.gnome.org/archives/networkmanager-list/2017-January/msg00060.html
2017-01-28 16:04:32 +01:00
Lubomir Rintel
1db6b01b2f manager: avoid an extra path to ac translation
The ac might already be unexported which would lead to a crash.
In any case, it's just unnecessary.
2017-01-27 13:33:28 +01:00
Lubomir Rintel
59b497f0f0 manager: guard the flag setting by the actual device presence
The parent might be an active connection w/o the device being determined.
2017-01-27 13:33:28 +01:00
Thomas Haller
419151a19e core: refactor parsing in match_device_s390_subchannels_parse()
Changes:

  - match_device_s390_subchannels_parse() should accept un-initialized
    arguments a,b,c, as they are striclty output arguments (without
    transfering ownership).
  - the output arguments should be set if (and only if) the function
    succeeds. That is, move assigning the output arguments to the end.
  - increase the BUFSIZE. It's unclear why choosing 10. Probably that
    was already sufficient as a subchannel looks like
    "0.0.f5f0,0.0.f5f1,0.0.f5f2". Still, increase it to be ample.
    If we want to restrict the parsing based on the lenght of the input,
    that should be done explicitly (but that seems not desirable).
  - use _nm_utils_ascii_str_to_int64() which checks that the range
    of the values fits in guint32.

It seems wrong that match_device_s390_subchannels_eval() only compares
the first of up to three subchannels. But leave it as is for now.
2017-01-25 17:15:23 +01:00
Thomas Haller
0f7098b71b core/tests: add test matching s390-subchannels device spec 2017-01-25 17:15:23 +01:00
Lubomir Rintel
20328eaddf core: add missing initializers to match_data_s390_subchannels_eval()
match_device_s390_subchannels_parse() asserts that arguments point to
zeroes.

  1299     static gboolean
  1300     match_data_s390_subchannels_eval (const char *spec_str,
  1301                                       MatchDeviceData *match_data)
  1302     {
  >>>     CID 160923:  Uninitialized variables  (UNINIT)
  >>>     Declaring variable "c" without initializer.
  1303            guint32 a, b, c;

Fixes: b0aaff86b6
2017-01-25 17:15:23 +01:00
Lubomir Rintel
f541cef958 active-connection: unhook the settings connection removed signal on dispose
Fixes: f0e3dfdace
2017-01-25 16:32:03 +01:00
Thomas Haller
aba850609b exported-object: fix adding get_property() function for "path" property
Fixes: e4e0daeed4
2017-01-25 13:46:54 +01:00
Lubomir Rintel
b605fb2712 manager: don't let a master device go unmanaged on a slave activation
If a slave device activates, we should keep the master up even though it
was taken over before.

This fixes an issue, where a single slave to a master would be
reactivated after a daemon restart. The daemon restart would cause the
master to be treated externally created (would go unmanaged when all the
slaves are gone) while the reactivation would leave the master without
slaves for a while.
2017-01-25 13:36:30 +01:00
Thomas Haller
9ae5e6a54d device: track exported-object path for NMActRequest from device
The public property NM_DEVICE_ACTIVATION_REQUEST exposes the exported
D-Bus path. So, it's not sufficient to emit property changed signals
when changing the priv->act_request pointer, we must also react on
exporting/unexporting.

It's not clear whether this fixes an actual bug. Maybe, we never
export/unexport priv->act_request while the device tracks it.
But the code is pretty hard to follow and it's hard to verify
whether this is the case.
By hooking up to "notify::path", we can easily verify that such
a situtation cannot arise.
2017-01-25 13:32:18 +01:00
Thomas Haller
e4e0daeed4 exported-object: add "path" GObject property to have notify signal 2017-01-25 13:12:08 +01:00
Thomas Haller
ec66135a40 device: fix setting minimal MTU to 1280 for IPv6
Fixes: 665e398022
2017-01-24 16:36:56 +01:00
Thomas Haller
c8a649b3de core: avoid unexporting active-connection that is not exported
For better or worse, nm_exported_object_unexport() asserts that the
object is currently exported.

It's not clear that an active connection at this place is always
exported.

Fixes: f0e3dfdace
2017-01-24 15:41:34 +01:00
Lubomir Rintel
f0e3dfdace active-connection: drop off the bus when the settings connection disappears
The active connection has an immutable connection property, but is
cleaned asynchronously by the manager after its settings connection is
done. Fine, let's remove it from the bus first though, so that we don't
hang there with a dangling object path.
2017-01-24 14:00:59 +01:00
Thomas Haller
9fff9f501a core: drop duplicate code searching for match in nm_match_spec_device()
When searching for "*", we still need to check for higher priority
"except:" matches. But don't duplicate the search loop and just
proceed with the regular searched.

It already has the "if (!except && match == NM_MATCH_SPEC_MATCH)" which
short-cuts the search.
2017-01-23 09:43:24 +01:00
Thomas Haller
0d6885cfa3 systemd: merge branch systemd into master 2017-01-22 15:07:32 +01:00
Thomas Haller
c655355752 systemd: update code from upstream
This is a direct dump from systemd git on 2017-01-21, git commit
2feb1c9659f8f9d873615b0c28217a659bdbc86a.

======

SYSTEMD_DIR=../systemd
COMMIT=2feb1c9659f8f9d873615b0c28217a659bdbc86a

(
  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"
2017-01-21 20:13:46 +01:00
Thomas Haller
b0aaff86b6 core: refactor nm_match_spec_device() to use match-data structure
Instead of passing on invdividual arguments for the match, create
a MatchDeviceData structure and pass it on.

This reduces the number of arguments and extending it later should
be easier. Also, lazily parse the hardware address as needed.
2017-01-21 20:01:29 +01:00
Thomas Haller
b0e58a9823 src/tests: randomize device spec list for test 2017-01-20 21:05:58 +01:00
Thomas Haller
b957403efd core: refactor evaluation of device's match-spec
Previously, we would have different functions like
  - nm_match_spec_device_type()
  - nm_match_spec_hwaddr()
  - nm_match_spec_s390_subchannels()
  - nm_match_spec_interface_name()
which all would handle one type of match-spec.

So, to get the overall result whether the arguments
match or not, nm_device_spec_match_list() had to stich
them together and iterate the list multiple times.

Refactor the code to have one nm_match_spec_device()
function that gets all relevant paramters.

The upside is:

  - the logic how to evaluate the match-spec is all at one place
    (match_device_eval()) instead of spread over multiple
    functions.

  - It requires iterating the list at most twice. Twice, because
    we do a fast pre-search for "*".

One downside could be, that we have to pass all 4 arguments
for the evaluation, even if the might no be needed. That is,
because "nm-core-utils.c" shall be independend from NMDevice, it
cannot receive a device instance to get the parameters as needed.
As we would add new match-types, the argument list would grow.
However, all arguments are cached and fetching them from the
device's private data is very cheap.
2017-01-20 20:59:14 +01:00
Beniamino Galvani
7dde8d8106 vlan: use parent interface mtu as default
After commit 22e8af6242 ("device: set a per-device default MTU on
activation") we explicitly set the VLAN MTU to 1500 if not overridden
by user settings. This has the advantage that the MTU is set to a
predictable value, while before it could have different values
depending on when the interface was created (for example, the
interface would get a 1500 MTU if created during boot, or would
inherit the parent's MTU if activated manually).

However, a better default value is the MTU of the parent interface
which is in most cases what the user wants. This value was the default
before commit 22e8af6242 for manually activated connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1414186
2017-01-20 18:35:01 +01:00
Beniamino Galvani
714b18dcf7 device: don't call _commit_mtu() when ipv4.method=disabled
After commit 553717bb1c ("device: don't set ip4_state=IP_FAIL for
ipv4.method=disabled"), we commit an empty IPv4 configuration when
IPv4 is disabled. This means that it's not necessary anymore to call
_commit_mtu() because the MTU will be set in
ip4_config_merge_and_apply().
2017-01-20 17:41:48 +01:00