Commit Graph

17106 Commits

Author SHA1 Message Date
Thomas Haller
cd267cceed build: add missing GLIB_CFLAGS for compiling adsl device plugin 2017-01-29 12:25:05 +01:00
Thomas Haller
7f63c875f9 libnm-core: clear wifi.mac-address-randomization when unsetting wifi.cloned-mac-address
When a client clears wifi.cloned-mac-address, he clearly also want
to clear the deprected wifi.mac-address-randomization property.

Do that automatically in libnm.

https://mail.gnome.org/archives/networkmanager-list/2017-January/msg00060.html
2017-01-28 17:17:14 +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
James McCoy
dbd365c3f9 nm-online: return from quit_if_connected after setting retval
c5f17a97ea changed nm-online to determine
the status asynchronously, however this introduced a regression with
"nm-online -x -q" when there is connectivity.

        if (   state == NM_STATE_CONNECTED_LOCAL
            || state == NM_STATE_CONNECTED_SITE
            || state == NM_STATE_CONNECTED_GLOBAL) {
            data->retval = 0;
            g_main_loop_quit (data->loop);
        }
    }
    if (data->exit_no_nm && (state != NM_STATE_CONNECTING)) {
        data->retval = 1;
        g_main_loop_quit (data->loop);
    }

After setting data->retval = 0 in the "state is connected" branch, the
function falls through to the "exit_no_nm and !connecting" branch,
overwriting data->retval.  This causes "nm-online -x -q" to incorrectly
report an offline state.

Adding an explicit "return;" after any state where data->retval is set
ensures that the value isn't overwritten before main() uses it.

Fixes: c5f17a97ea

https://mail.gnome.org/archives/networkmanager-list/2017-January/msg00058.html
2017-01-28 10:54:04 +01:00
Lubomir Rintel
73b560c215 cli: avoid use-after free on connection deletion
If the connection spontaneously disappears (perhaps along with the whole
daemon on crash) while we're deleting it, then the removal callback
would free up the context structure the delete operation is using.

Let's cancel the in-flight delete operations so that they won't touch
the structure after it's gone.
2017-01-27 13:33:28 +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
93b632a7fa release: bump version to 1.7.1-dev after 1.6.0 release
After 1.6.0 is released, merge it back into master so that
1.6.0 is part of the history of master. That means,
  $ git log --first-parent master
will also traverse 1.6.0 and 1.6-rc*.

Also bump the micro version to 1.7.1-dev to indicate that this is
after 1.6.0 is out.
2017-01-25 18:30:55 +01:00
Lubomir Rintel
2554a8736d release: bump version to 1.6.0 2017-01-25 18:18:09 +01:00
Piotr Drąg
034d75fb79 po: update Polish (pl) translation (bgo #777402)
https://bugzilla.gnome.org/show_bug.cgi?id=777402
(cherry picked from commit 2131e98511)
2017-01-25 18:18:09 +01:00
Piotr Drąg
2131e98511 po: update Polish (pl) translation (bgo #777402)
https://bugzilla.gnome.org/show_bug.cgi?id=777402
2017-01-25 17:49:47 +01:00
Thomas Haller
a101e0dc6a release: update NEWS 2017-01-25 17:38:43 +01:00
Thomas Haller
146f2c0bd1 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.

(cherry picked from commit 9ae5e6a54d)
2017-01-25 17:27:42 +01:00
Beniamino Galvani
91d0c036de build: libnm-wwan.so depends on linker script
(cherry picked from commit 8134d72f49)
2017-01-25 17:21:29 +01:00
Thomas Haller
1b38632d5d exported-object: fix adding get_property() function for "path" property
Fixes: e4e0daeed4
(cherry picked from commit aba850609b)
2017-01-25 17:19:16 +01:00
Thomas Haller
183d49f759 exported-object: add "path" GObject property to have notify signal
(cherry picked from commit e4e0daeed4)
2017-01-25 17:19:11 +01:00
Lubomir Rintel
cd8e8ab1ca 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.

(cherry picked from commit b605fb2712)
2017-01-25 17:18:24 +01:00
Lubomir Rintel
8b9f3055bf active-connection: unhook the settings connection removed signal on dispose
Fixes: f0e3dfdace
(cherry picked from commit f541cef958)
2017-01-25 17:17:45 +01:00
Thomas Haller
63d4764acf 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.

(cherry picked from commit 419151a19e)
2017-01-25 17:15:37 +01:00
Thomas Haller
78272be2ff core/tests: add test matching s390-subchannels device spec
(cherry picked from commit 0f7098b71b)
2017-01-25 17:15:37 +01:00
Lubomir Rintel
aa9e908c6a 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
(cherry picked from commit 20328eaddf)
2017-01-25 17:15:36 +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
105d8a2447 device: fix setting minimal MTU to 1280 for IPv6
Fixes: 665e398022
(cherry picked from commit ec66135a40)
2017-01-24 16:38:21 +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
e56d308ba5 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
(cherry picked from commit c8a649b3de)
2017-01-24 16:19:41 +01:00
Lubomir Rintel
db6e8b21e4 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.

(cherry picked from commit f0e3dfdace)
2017-01-24 16:19:40 +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
Lubomir Rintel
701f79280f release: bump version to 1.5.91 (1.6-rc2) 2017-01-23 18:43:19 +01:00
Lubomir Rintel
57c084a611 NEWS: move the more important entries upwards 2017-01-23 18:42:55 +01:00
Thomas Haller
383d81e813 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.

(cherry picked from commit 9fff9f501a)
2017-01-23 09:44:14 +01:00
Thomas Haller
05d35647ec 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.

(cherry picked from commit b0aaff86b6)
2017-01-23 09:44:14 +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
Jiří Klimeš
283758dab3 cli: fix some TAB completions for nmcli -a con add
(cherry picked from commit 1cee85f556)
2017-01-21 21:32:31 +01:00
Jiří Klimeš
1cee85f556 cli: fix some TAB completions for nmcli -a con add 2017-01-21 21:15:26 +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
Jiří Klimeš
e29add5f81 cli: move code around to group related functions - no functional change
* all getter/setter/describe, ... functions grouped according to properties
* sort the settings groups alphabetically

(cherry picked from commit 418733f2c1)
2017-01-21 19:56:40 +01:00
Jiří Klimeš
1298a998a1 cli: simplify property functions for allowed values with a macro
DEFINE_ALLOWED_FOR_ENUMS

(cherry picked from commit 5f90f48467)
2017-01-21 19:56:35 +01:00
Jiří Klimeš
49702826b7 cli: TAB-completion for macsec.mode in interactive editor
(cherry picked from commit 6573c2d860)
2017-01-21 19:56:29 +01:00
Jiří Klimeš
344e48da75 cli: TAB-completion for ipv6.addr-gen-mode in interactive editor
(cherry picked from commit 4d8800c876)
2017-01-21 19:56:23 +01:00
Jiří Klimeš
418733f2c1 cli: move code around to group related functions - no functional change
* all getter/setter/describe, ... functions grouped according to properties
* sort the settings groups alphabetically
2017-01-21 19:50:52 +01:00