Commit Graph

13873 Commits

Author SHA1 Message Date
Thomas Haller
c8174f0f9f nmtst: detect whether the test runs as tap test
Same as gtestutils does, look for --tap command line argument.
2015-11-24 09:35:01 +01:00
Thomas Haller
5031fc3c71 nmtst: initialize g_test_init() after parsing NMTST_DEBUG 2015-11-24 09:12:42 +01:00
Beniamino Galvani
9b1d195600 merge: branch 'bg/dhcp-send-fqdn-rh1255507'
https://bugzilla.redhat.com/show_bug.cgi?id=1255507
2015-11-23 22:11:42 +01:00
Beniamino Galvani
c3573ebf2b dhcp4: send FQDN option when ipv4.dhcp-fqdn is set
Modify the 3 DHCP client backends to support the new property.
2015-11-23 22:09:12 +01:00
Beniamino Galvani
cba0f4e3c4 cli: add ipv4.dhcp-fqdn property 2015-11-23 22:09:06 +01:00
Beniamino Galvani
5002342d94 ifcfg-rh: support the DHCP_FQDN variable
Add support for the DHCP_FQDN ifcfg-rh variable which maps to the
ipv4.dhcp-fqdn property.
2015-11-23 22:08:22 +01:00
Beniamino Galvani
cb40194532 libnm-core: add a 'dhcp-fqdn' property to NMSettingIP4Config
The property contains the fully qualified domain name to be sent to
DHCP server using the FQDN option. The property is mutually exclusive
with 'dhcp-hostname'.
2015-11-23 16:31:52 +01:00
Beniamino Galvani
dbbb08eb01 dhcp-manager: strip hostname sent by dhcpcd
The dhclient DHCP backend strips the domain part from the hostname
option sent to server; for consistency among different backends
uniform the dhcpcd client to do the same.
2015-11-23 16:31:08 +01:00
Beniamino Galvani
c09b12240e dhcp-manager: strip hostname sent by internal DHCP client
The dhclient DHCP backend strips the domain part from the hostname
option sent to server; for consistency among different backends
uniform the internal client to do the same.
2015-11-23 16:31:08 +01:00
Beniamino Galvani
aa22b2d87f systemd: merge branch 'systemd' into master 2015-11-23 16:18:10 +01:00
Beniamino Galvani
b8c2fc26c1 dhcp: pass IPv6 link-local address to DHCP client
The DHCP client from new libsystemd-network requires a link-local IPv6
address to be passed to the library; add a new argument to
nm_dhcp_manager_start_ip6() and related functions.
2015-11-23 15:58:17 +01:00
Beniamino Galvani
aa9d0d1467 systemd: update code from upstream
This is a direct dump from systemd git on 2015-11-23, git commit
6098bb0dc31b1c472ab868088d04234352c44b75.

======

SYSTEMD_DIR=../systemd
COMMIT=6098bb0dc31b1c472ab868088d04234352c44b75

(
  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/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/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/siphash24.c"
nm_copy_sd "src/basic/siphash24.h"
nm_copy_sd "src/basic/socket-util.h"
nm_copy_sd "src/basic/sparse-endian.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.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.c"
nm_copy_sd "src/libsystemd-network/lldp-network.h"
nm_copy_sd "src/libsystemd-network/lldp-network.c"
nm_copy_sd "src/libsystemd-network/lldp-port.c"
nm_copy_sd "src/libsystemd-network/lldp-port.h"
nm_copy_sd "src/libsystemd-network/lldp-tlv.c"
nm_copy_sd "src/libsystemd-network/lldp-tlv.h"
nm_copy_sd "src/libsystemd-network/lldp-util.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-id128/sd-id128.c"
nm_copy_sd "src/libsystemd/sd-event/event-util.h"
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"
2015-11-23 11:23:25 +01:00
Thomas Haller
e1ea4b725e main: add argument --print-config to NetworkManager 2015-11-22 13:40:32 +01:00
Thomas Haller
c2831875e3 default-route: fix deleting default-route when disconnecting device (bgo #757587)
When deconfiguring a device, we must also explicitly clear the
default-route -- unless the device was assumed.

This can easily reproduced by disconnecting the cable from the
wired connection that has the default rout. Prevously, the
default-route was not cleared and lingered around.

https://bugzilla.gnome.org/show_bug.cgi?id=757587
2015-11-20 15:08:01 +01:00
Thomas Haller
661ce49973 default-route: introduce _LOG2*() logging macros to log entry-messages 2015-11-20 14:21:53 +01:00
Thomas Haller
28c41c1f8c platform: use explict "bool" type instead of "guint8" in NMPObjects 2015-11-20 12:01:46 +01:00
Thomas Haller
eef83a199a platform: minor code cleanup in _new_from_nl_link()
Add a code comment, rename goto-labels, reorder some
lines of code and have @lnk_data not being nm_auto_nmpobj.
2015-11-20 11:54:47 +01:00
Jiří Klimeš
0f6baeef35 core: verify secrets when adding connection via D-Bus (bgo #757843)
Fixes: dbbedce21f
       libnm: don't check for valid passwords in NMSetting:verify()

https://bugzilla.gnome.org/show_bug.cgi?id=757843
2015-11-20 10:35:10 +01:00
Jiří Klimeš
b41b32cb7b libnm: add nm_setting_verify_secrets() and nm_connection_verify_secrets()
for verifying the secrets, because it is not done in plain nm_setting_verify().

For simple verification of free-form string secrets,
_nm_setting_verify_secret_string() helper is used.
2015-11-20 10:35:10 +01:00
Thomas Haller
fc758cb4ea ifcfg-rh: fix memleak reading mac-address-randomization
Fixes: 4b412218e6
2015-11-19 15:23:39 +01:00
Thomas Haller
ecadff700e libnm-core: fix memleak in NMSettingGsm
Fixes: 4b412218e6
2015-11-19 15:09:41 +01:00
Jiří Klimeš
d4ebffcfb9 wifi: do update BSSID cache in activation_success_handler() (rh #1094298)
Even if update_seen_bssids_cache() is called by set_current_ap() it did not
really update the cache because it was called in NM_DEVICE_STATE_PREPARE state.
So the cache was only updated by periodic_update() when the connection roamed
to another AP.

Fixes: 1283816b41

https://bugzilla.redhat.com/show_bug.cgi?id=1094298
2015-11-19 14:43:27 +01:00
Joel Holdsworth
312c72f761 crypto_gnutls: removed dead code
https://mail.gnome.org/archives/networkmanager-list/2015-November/msg00061.html
2015-11-19 13:58:12 +01:00
Joel Holdsworth
8051038b4d build/nmcli: make nmcli build optional
https://mail.gnome.org/archives/networkmanager-list/2015-November/msg00043.html
https://mail.gnome.org/archives/networkmanager-list/2015-November/msg00063.html
2015-11-19 13:51:59 +01:00
Thomas Haller
5de28d4d16 wifi: propagte errors from supplicant-config to caller
The nm_supplicant_config_add_*() functions used to log failures
themselves. As also the caller was logging the failure this resulted
in duplicate logging lines like:

  <warn>  MAC address randomization is not supported
  <error> [1447867727.909185] [nm-device-wifi.c:2238] build_supplicant_config(): (wlp3s0): Couldn't add 802-11-wireless setting to supplicant config.
  <error> [1447867727.909261] [nm-device-wifi.c:2472] act_stage2_config(): (wlp3s0): Activation: (wifi) couldn't build wireless configuration.

Instead, propagate the error reason back to the caller where there
is more context to log one single concise message.

Now you'd see only:

  <error> [1447935996.859371] [nm-device-wifi.c:2475] act_stage2_config(): (wlp3s0): Activation: (wifi) couldn't build wireless configuration: 802-11-wireless: cannot enable mac-randomization due to missing supplicant support
2015-11-19 13:45:14 +01:00
Thomas Haller
98e4194963 wifi: disable mac-address-randomization by default
Enabling it by default can be bad. For example for captive portals.
Effectively revert commit 4f6c91d696
to again disable it by default.

https://bugzilla.gnome.org/show_bug.cgi?id=734081
2015-11-18 17:54:11 +01:00
Thomas Haller
f4c7a9d426 man: fix documentation of for default value wifi.mac-address-randomization
Fixes: 4f6c91d696
2015-11-18 17:10:41 +01:00
Thomas Haller
dd2f09c8b1 wwan: merge branch 'dcbw/bgo756916-wwan-connection-filters'
https://bugzilla.gnome.org/show_bug.cgi?id=756916
2015-11-18 15:52:07 +01:00
Dan Williams
cb751012a2 wwan: rework connection flow to send PIN earlier and fix autoconnect
Modems often don't expose all the required properties until they have
been unlocked, and that includes the IP types supported by the modem.

With an autoconnect WWAN connection where the SIM requires a PIN, there
were two problems:

1) the PIN is a secret and we don't have it until it's explicitly requested
during the activation process, so we cannot gate GSM connection availability
on whether a PIN is present since this happens long before we request secrets

2) when the modem is locked it may not report the supported IP types, which
caused an auto-activation to fail early becuase IP compatibility is checked
before the PIN is sent to the modem

Rework connection activation flow into a series of concrete steps, where the
PIN is sent to the modem if required, and only after the modem is actually
unlocked does the connection proceed.  This does mean that any connection
marked 'autoconnect' can theoretically enable a PIN-locked modem even if
the connection has no PIN defined, but there's no good way around that.
NetworkManager would activate the connection
2015-11-18 15:50:53 +01:00
Dan Williams
d9c6b9f3dd core: only run availability recheck transition if required
Device subclasses can call nm_device_recheck_available() at any time,
and the function would change the device's state to UNKNOWN in cases
where the device was available already.  For WWAN devices, availability
is rechecked every time the modem state changes, resulting in:

NetworkManager[28919]: <info>  (ttyUSB4): modem state changed, 'disabled' --> 'enabling' (reason: user-requested)
NetworkManager[28919]: <debug> [1445538582.116727] [devices/nm-device.c:2769] recheck_available(): [0x23bd710] (ttyUSB4): device is available, will transition to unknown
NetworkManager[28919]: <info>  (ttyUSB4): modem state changed, 'enabling' --> 'searching' (reason: user-requested)
NetworkManager[28919]: <debug> [1445538582.776317] [devices/nm-device.c:2769] recheck_available(): [0x23bd710] (ttyUSB4): device is available, will transition to unknown
2015-11-18 15:50:52 +01:00
Dan Williams
06442276c9 cli: add support for GSM setting device-id, sim-id, and sim-operator-id properties 2015-11-18 15:50:52 +01:00
Dan Williams
4b412218e6 libnm/wwan: add GSM setting device-id, sim-id, and sim-operator-id properties
These properties limit whether the connection applies to a certain WWAN modem
based on the modem's device ID or SIM ID (as reported by the WWAN management
service), or through the MCC/MNC ID of the operator that issued the SIM card.
2015-11-18 15:50:52 +01:00
Thomas Haller
59d2434383 wifi: merge branch 'dcbw/wifi-random-mac-bgo734081'
https://bugzilla.gnome.org/show_bug.cgi?id=734081
2015-11-18 15:38:26 +01:00
Dan Williams
3ac82f2c75 nmcli: add support for WiFi MAC address randomization property 2015-11-18 15:37:42 +01:00
Thomas Haller
4f6c91d696 wifi: enable mac-address-randomization by default for new connections
But ensure that old keyfiles that did not yet understand
the new key continue to have it disabled.
2015-11-18 15:37:42 +01:00
Thomas Haller
6a46dfca26 ifcfg-rh: add support for NMSettingWireless:mac-address-randomization
Old init-scripts that did not yet understand this key will have
mac-address-randomization explicitly disabled. This is to ensure
that old connections don't change behavior.
Thus, the writer must always write the value explicitly.

Downside is, if somebody creates a quick ifcfg-file, the feature
is disabled by default.
2015-11-18 15:37:42 +01:00
Dan Williams
190e0e31cd wifi: implement MAC address randomization
If the supplicant supports it and the connection requests it, tell
the supplicant to randomize the MAC address for the association.

In addition, like both iOS, Android, and other OSs always randomize
the MAC address when performing a WiFi scan.
2015-11-18 15:37:42 +01:00
Dan Williams
21e84f21af supplicant: check for MAC address randomization support 2015-11-18 15:37:42 +01:00
Dan Williams
63cbff0875 trivial: wifi/supplicant: change ApSupport to NMSupplicantFeature 2015-11-18 15:37:42 +01:00
Dan Williams
0222822134 libnm: add Wi-Fi MAC address randomization property 2015-11-18 15:37:42 +01:00
Thomas Haller
325faa2379 ifcfg-rh: add svSetValueInt64() utility 2015-11-18 15:37:42 +01:00
Thomas Haller
bc5a8e2e18 core/dbus: merge branch 'dcbw/gdbus-object-manager' (bgo #753566)
Merge final part of 'dcbw/gdbus-object-manager' which removes
the private D-Bus socket and introduced ObjectManager.

https://bugzilla.gnome.org/show_bug.cgi?id=753566
2015-11-18 15:16:40 +01:00
Dan Williams
b023d0754b exported-object: add support for DBus ObjectManager interface
NMExportedObject now derives from GDBusObjectSkeleton, which is what
GDBusObjectManagerServer wants.  The main GDBusConnection and each
private server connection now gets a new GDBusObjectManagerServer,
and exported objects are registered with that instead of individually
exporting each GDBusInterfaceSkeleton.

Previously exported objects were not referenced by the BusManager,
but instead removed from the exports hash via weak references.  The
GDBusObjectManagerServer instead references exported objects, which
can make them live much longer than they did before.

Co-Authored-By: Thomas Haller <thaller@redhat.com>
2015-11-18 15:15:05 +01:00
Lubomir Rintel
83b8b9e1f6 bus-manager: drop private socket
With ObjectManager we can not export ObjectSkeletons to multiple connections --
the manager would unexport the InterfaceSkeletons upon its destruction.

It seems easiest to just drop the private socket altogether; It was broken for
broken for some time and noone noticed anyway. Also startup before D-Bus is
still broken: NetworkManager would reconnect to the bus but multiple managers
won't notice the bus is around (we'll never see firewalld or policykit come up).

We should probably just stop pretending we support operation without a real
D-Bus server. With the advent of kdbus this makes even more sense.
2015-11-18 15:15:05 +01:00
Lubomir Rintel
2146c60996 libnm: stop using the private socket 2015-11-18 15:15:04 +01:00
Thomas Haller
16afb3a31a platform/tests: fix fake-platform test running in debug-mode
In debug-mode, test_ip4_address_peer_zero() used to print the
result of `ip address show`. That fails for fake-platform
because the device does not exists.

Just don't do that.
2015-11-18 14:01:15 +01:00
Thomas Haller
37824def11 all: add C99's "bool" define
https://mail.gnome.org/archives/networkmanager-list/2015-November/msg00036.html
2015-11-18 13:25:21 +01:00
Jiří Klimeš
0c65b28960 cli: add 'nmcli connection clone' for cloning connections (bgo #757627)
Synopsis:
nmcli connection clone [--temporary] [id|uuid|path] <ID> <new name>

It copies the <ID> connection as <new name>. The command is very useful
if there is a connection, but another one is needed for a related
configuration. One can copy the existing profile and modify it for the
new situation.

For example:
$ nmcli con clone main-eth second-eth
$ nmcli con modify second-eth connection.interface-name em4

https://bugzilla.gnome.org/show_bug.cgi?id=757627
2015-11-18 09:37:44 +01:00
Jiří Klimeš
f902444325 ifcfg: fix a possible double-free error on invalid WEP key (rh #1281324)
https://bugzilla.redhat.com/show_bug.cgi?id=1281324
2015-11-18 09:15:39 +01:00
Thomas Haller
914d875dc2 wifi: fix handling APs list using string-hashing
Commit d518278011 changed
the hashing for the APs to use direct-hashing.

That was wrong because get_ap_by_path() needs a full
string-comparison.

Fixes: d518278011
2015-11-16 16:51:54 +01:00