Commit Graph

17169 Commits

Author SHA1 Message Date
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
Mickaël Thomas
5216754b1e nm-online: fix countdown to not show 0 seconds until finished
When using nm-online -t N, the countdown shows "0s" during the last second.

The countdown value should be rounded up so that "0s" is only shown when the
timeout is actually elapsed.

https://bugzilla.gnome.org/show_bug.cgi?id=778093
2017-02-03 00:10:44 +01:00
Beniamino Galvani
660bb1a48f libnm-core: return NULL from _nm_utils_slist_to_strv for empty lists
The function is used, among others, in the get_property() of many
objects to return a boxed strv from a list. The default value for a
boxed strv property is NULL, but _nm_utils_slist_to_strv() returns a
pointer to an array with zero elements when the list is empty.

Change the function to return NULL if the input list is empty.
2017-02-02 13:45:27 +01:00
Thomas Haller
f7875a42b0 nm-online: refactor and fix nm-online
Moving nm-online to async init introduced various issues:
- with a timeout of zero, nm-online would terminate with failure
  before initializing the NMClient instance.
- add a timeout for safeguarding the async creation of NMClient
- fix adding trailing newline for the progress bar.

While at it, refactor:
- use defines for the exit codes
- don't use exit(), but instead always properly quit the mainloop
  and cleanup all resources.
- in non-quiet mode, print the result [online] or [offline] at
  the end.

Fixes: c5f17a97ea

https://bugzilla.gnome.org/show_bug.cgi?id=777914
2017-02-02 11:23:14 +01:00
Thomas Haller
34acecf544 nm-online: fix division-by-zero with zero timeout
$ nm-online -t 0
  Floating point exception (core dumped)

Fixes: c5f17a97ea

https://bugzilla.gnome.org/show_bug.cgi?id=777914
2017-01-31 00:12:48 +01:00
Lubomir Rintel
7399cf3b16 cli: add missing NULL-check
Only the connection down operation is cancellable, the other actions are not.

Fixes: 73b560c215
2017-01-29 12:56:31 +01:00
Lubomir Rintel
cc1491401f contrib/rpm: don't recreate files that make install installs 2017-01-29 12:28:55 +01:00
Lubomir Rintel
a1464f0cfa contrib/rpm: don't own the legacy VPN directory
The plugins should own it instead.
2017-01-29 12:28:55 +01:00
Lubomir Rintel
d9ebd31d40 build: install all necessary directories 2017-01-29 12:28:55 +01:00
Lubomir Rintel
b4e1d4794e build: don't install /run files
They're volatile and created during runtime.
2017-01-29 12:28:55 +01:00
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