Commit Graph

17169 Commits

Author SHA1 Message Date
Thomas Haller
08f5681b0e core: const arguments for _nm_utils_ptrarray_find_*() functions 2016-09-23 15:34:17 +02:00
Lubomir Rintel
e59ed6451f contrib/rpm: require at least the version of glib we built against
glib neither versions its symbols nor bumps SONAME on API changes, so rpm can't
figure out the correct dependencies itself.

https://bugzilla.redhat.com/show_bug.cgi?id=1378809
2016-09-23 12:20:23 +02:00
Beniamino Galvani
36f561ead0 cli: merge branch 'bg/cli-readline-async-rh1368353'
https://bugzilla.gnome.org/show_bug.cgi?id=732097
https://bugzilla.redhat.com/show_bug.cgi?id=1368353
2016-09-23 09:48:32 +02:00
Beniamino Galvani
995229181c cli: remove editor thread
Currently the editor runs in a dedicated thread so that the blocking
call to readline() doesn't stop the processing of D-Bus events in the
main loop. The editor thread can access objects concurrently with the
main thread and this can cause races and crashes.

Remove the editor thread and use the non-blocking readline API.

https://bugzilla.gnome.org/show_bug.cgi?id=732097
https://bugzilla.redhat.com/show_bug.cgi?id=1368353
2016-09-23 09:46:28 +02:00
Beniamino Galvani
a2dac38174 cli: clear source when progress callback terminates 2016-09-23 09:46:28 +02:00
Beniamino Galvani
3ea5efd008 cli: fix wrong memory allocation size
Fixes: 8d9718bd0f
2016-09-23 09:46:28 +02:00
Thomas Haller
c6ac2310dc dhcp: add FIXME comment to nm-dhcp-helper.c 2016-09-23 09:37:21 +02:00
Thomas Haller
0fb723e720 libnm: relax comparison of bond-option for INFERRABLE match
When comparing the bond-settings of an activated device against
the settings from the connection, some properties might easily
differ. Hack them around in NMSettingBond:compare_property().

For example:

the setting in the connection has:
    [bond]
    mode=active-backup

later, the device gets:
    [bond]
    active_slave=inf_ib0
    fail_over_mac=active
    mode=active-backup

Note that the fail_over_mac changes due to:
  kernel: nm-bond: enslaved VLAN challenged slave inf_ib0. Adding VLANs will be blocked as long as inf_ib0 is part of bond nm-bond
  kernel: nm-bond: The slave device specified does not support setting the MAC address
  kernel: nm-bond: Setting fail_over_mac to active for active-backup mode

https://bugzilla.redhat.com/show_bug.cgi?id=1375558
2016-09-22 18:32:54 +02:00
Thomas Haller
78957c0d39 device: fix nm_utils_match_connection() for NMSettingInfiniband:mac-address
<debug> [1474469475.3318] Connection 'inf_ib0' differs from candidate 't-inf' in infiniband.mac-address
    <debug> [1474469475.3318] manager: (inf_ib0): generated connection 'inf_ib0'

https://bugzilla.redhat.com/show_bug.cgi?id=1375558
2016-09-22 16:48:27 +02:00
Thomas Haller
b1fd5a06c4 macros: simplify NM_IN_SET() and NM_IN_STRSET() macros
and support up to 16 arguments.
2016-09-22 16:34:22 +02:00
Beniamino Galvani
f1165cc290 device: rework state transition after IP configuration
Unify the two check_ip_done() and check_ip_failed() functions into a
single one to have all the state transition logic in the same place.

This also fixes a regression introduced by commit 553717bb1c
("device: don't set ip4_state=IP_FAIL for ipv4.method=disabled").
After that commit the device immediately proceeded to IP_CHECK when
there was a disabled/ignore method. Now we wait for the termination of
the other method, like it used to be.

Fixes: 553717bb1c

https://bugzilla.gnome.org/show_bug.cgi?id=771579
2016-09-22 14:12:06 +02:00
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
Christian Kirbach
899d5e5c82 po: update German (de) translation (bgo#771732)
https://bugzilla.gnome.org/show_bug.cgi?id=771732
2016-09-21 11:24:27 +02:00
Beniamino Galvani
58349c3885 man: NetworkManager.conf: better document dns=dnsmasq
It's potentially unexpected by user that dnsmasq works differently
from the libc resolver and doesn't try the servers in order. Add a
paragraph to explain that and how to tweak the resolution order.
2016-09-20 15:32:37 +02:00
Beniamino Galvani
b1bf2671b2 build: fix build with address sanitizer
Every program run during the build which loads a NM library must
preload libasan.so if the address sanitizer is enabled.

Add a macro to set the needed environment variables and use it when
performing the shared object link tests.
2016-09-20 13:44:04 +02:00
Beniamino Galvani
fb40060ac1 build: add macro to check shared objects symbols 2016-09-20 13:43:20 +02:00
Beniamino Galvani
a875603355 cli: merge branch 'jk/nmcli-complete-regression-rh1375933'
https://bugzilla.redhat.com/show_bug.cgi?id=1375933
2016-09-19 16:58:40 +02:00
Jiří Klimeš
52723bd743 cli: fix yes/no completion in questionnaire mode 2016-09-19 16:58:18 +02:00
Jiří Klimeš
08a74c272b cli: tab-complete "Interface name [*]" in questionnaire mode 2016-09-19 16:58:18 +02:00
Jiří Klimeš
c2ef397867 cli: enable bash completion for some more properties of add/modify
connection.interface-name
mavclan.tap
mavclan.parent
ip-tunnel.parent
vxlan.parent
2016-09-19 16:58:18 +02:00
Jiří Klimeš
61a56aa3db cli: fix completion/add missing functions for '--complete-args' (rh #1375933)
This makes bash completion work again for 'nmcli connection add'.

Fixes: 8b39090597

https://bugzilla.redhat.com/show_bug.cgi?id=1375933
2016-09-19 16:55:40 +02:00
Jiří Klimeš
1f0ba2e487 cli: (trivial) move gen_func_ifnames() from devices.c to common.c
and rename it to nmc_rl_gen_func()
2016-09-19 16:55:39 +02:00
Jiří Klimeš
4b90b7b774 cli: (trivial): remove stray %s 2016-09-19 16:55:37 +02:00
Thomas Haller
1206fd066b shared: add nm_utils_syslog_coerce_from_nm() util
When a VPN plugin logs to syslog(), it should not use the syslog
levels that were passed in by NetworkManager directly. Instead,
it must map LOG_NOTICE to LOG_INFO and LOG_INFO to LOG_DEBUG.

Add a utility function does gets that right.
2016-09-19 15:35:33 +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
Beniamino Galvani
2a391348b6 clients: fix check on secret request path
priv->path is NULL when the agent handles all requests (for example
when executing "nmcli agent").

Fixes: f3099db28e
2016-09-15 09:40:03 +02:00
Beniamino Galvani
73c649f365 clients: merge branch 'bg/clients-agent-message-rh1351272'
https://bugzilla.redhat.com/show_bug.cgi?id=1351272
2016-09-14 23:35:04 +02:00
Beniamino Galvani
f666efed0d clients: fix matching of connection path
Since we use g_str_has_prefix() to match a request_id with the
connection path, there can be wrong matches. For example:

 request_id: /org/freedesktop/NetworkManager/Settings/10/802-1x
 connection: /org/freedesktop/NetworkManager/Settings/1

would match. Add a trailing slash to the connection path stored in the
agent to prevent this.
2016-09-14 23:34:25 +02:00
Beniamino Galvani
f3099db28e clients: handle secret requests only for current connection
The path was checked only when serving the enqueued requests but not
for new ones. Fix this by moving the check to
request_secrets_from_ui().

Fixes: 991df80408

https://bugzilla.redhat.com/show_bug.cgi?id=1351272
2016-09-14 23:34:25 +02:00
Beniamino Galvani
2c1adaae5e clients: add secrets request message for wired and DSL connections 2016-09-14 23:32:52 +02:00
Beniamino Galvani
a80af27fc9 clients: don't show "(null)" prompt for secrets
If the caller doesn't provide a message, simply don't show it.
2016-09-14 23:32:52 +02:00
Beniamino Galvani
b28b2ba8a9 clients: add define for NMSecretAgentSimple signal name 2016-09-14 23:32:52 +02:00
Beniamino Galvani
eaad7ae431 libnm-core: drop extra IPs from shared connections during normalization
The core only consider the first address for shared connections, don't
pretend we accept multiple addresses.  This change doesn't prevent
supporting multiple addresses in the future.

https://bugzilla.gnome.org/show_bug.cgi?id=763937
2016-09-14 23:30:41 +02:00
Thomas Haller
b33aacbc91 build: move detection of NM_GIT_SHA to separate "m4/git-sha-record.m4"
We want to embed the current commit-id in the ./configure script.
That way the generated ./configure file in the source tarball
references the commit-id from which the tarball was created.

Then, in a second step, a script can check ./configure to find
the parent commit. This is for example done by the 'makerepo.sh'
script.

This is generally useful, and also done by network-manager-applet
and libnl3 projects. Move the function to a separate m4 macro
to reuse it. It should also be re-used in NetworkManager's VPN plugins.
2016-09-14 14:11:07 +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
c3b18ec6ee device: merge branch 'th/device-bring-up-bgo771284'
https://bugzilla.gnome.org/show_bug.cgi?id=771284
2016-09-12 18:11:42 +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
eb8da4c282 build: disable type checks in G_TYPE_CHECK_INSTANCE_CAST() macros (bgo#771120)
Avoid the pointless overhead. Even glib disables them unless you build
with --enable-debug.

https://bugzilla.gnome.org/show_bug.cgi?id=771120
2016-09-12 13:53:34 +02:00
Beniamino Galvani
aae26ebed3 libnm: merge branch 'bg/libnm-activation-stuck-rh1367752'
https://bugzilla.redhat.com/show_bug.cgi?id=1367752
2016-09-09 16:50:19 +02:00