Commit Graph

17169 Commits

Author SHA1 Message Date
Thomas Haller
92e9822e1b core: forward-declare NMConfigDeviceStateData in nm-types.h 2016-10-03 12:04:49 +02:00
Thomas Haller
1f91c83a30 core: rename "nm-activation-request.[hc]" for NMActRequest
"nm-activation-request.[hc]" contains NMActRequest. It should
thus be called "nm-act-request.[hc]".
2016-10-03 12:04:49 +02:00
Thomas Haller
70c2292b45 dhcp: use NM_GOBJECT_PROPERTIES_DEFINE() for properties of NMDhcpClient 2016-10-03 12:04:49 +02:00
Thomas Haller
b2c0573f08 core/trivial: move code around
- get_property() should be imidiately before set_property().
- type_init() should be before constructing(), constructed()
  and type_new().
- dispose() and finalize() should be after object creation.
- at last follows class_init().
2016-10-03 12:04:49 +02:00
Thomas Haller
37268914f7 dhcp: make dispose() of NMDhcpDhclient/NMDhcpDhcpcd reentrant 2016-10-03 12:04:14 +02:00
Thomas Haller
0aa3a6dbfb core: refactor private data for NMExportedObject and others 2016-10-03 12:04:14 +02:00
Thomas Haller
b4e66c4818 shared: add nm_clear_g_free() 2016-10-03 12:02:34 +02:00
Thomas Haller
a83eb773ce all: modify line separator comments to be 80 chars wide
sed 's#^/\*\{5\}\*\+/$#/*****************************************************************************/#' $(git grep -l '\*\{5\}' | grep '\.[hc]$') -i
2016-10-03 12:01:15 +02:00
Aidan Delaney
05e66d5202 core: search in /usr/local before system paths for the dnsmasq binary
When looking for the dnsmasq (or any) binary, NetworkManager should
check /usr/local before it checks any system installed version. This
allows the user to replace the binary with a newer version should they
desire and is more consistent with the search behaviour commonly found
in $PATH.

https://github.com/NetworkManager/NetworkManager/pull/10
2016-10-01 13:52:04 +02:00
Lubomir Rintel
f605262792 build: enable JSON validation unless explicitly disabled
This makes it easier for packagers to make sure they're not building
without a feature unintentionally.
2016-09-27 18:37:22 +02:00
Lubomir Rintel
67999ef2d3 libnm-core/tests: disable the JSON validation check without jansson 2016-09-27 18:37:22 +02:00
Pellaeon Lin
4d7cf9a16d libnm: fix typo g_size to gsize
Fixes: 32f78ae6c3

https://bugzilla.gnome.org/show_bug.cgi?id=772062
2016-09-27 18:08:13 +02:00
Thomas Haller
e3a072f3c0 build: don't add systemd path the include search path
Our internal copy of systemd should not be in the search path.
Instead, let users only
  #include "systemd/nm-sd.h"
which then includes everything from systemd that we need.

We want to avoid to accidentally include anything from our
systemd-copy. Any user of that should only include "nm-sd.h",
which then includes everything that is needed further.

For example, "src/devices/wwan/nm-modem-manager.c" has
  #include <systemd/nm-daemon.h>
which in turn includes
  #include "_sd-common.h"
This works all correctly before, because #include "" will first
look in the directory where sd-daemon.h is. However, our mixing of
external systemd library and internal copy is rather dangerous.
Try to avoid it further by keeping the include paths clean.
2016-09-27 14:13:21 +02:00
Thomas Haller
3f4aa48d6b systemd: merge branch systemd into master 2016-09-27 13:29:38 +02:00
Thomas Haller
20ac1e8655 systemd: update code from upstream
This is a direct dump from systemd git on 2016-09-26, git commit
b4c6f71b827d41a4af8007b735edf21ef7609f99.

======

SYSTEMD_DIR=../systemd
COMMIT=b4c6f71b827d41a4af8007b735edf21ef7609f99

(
  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"
2016-09-27 13:28:23 +02:00
Thomas Haller
1a54ac0a1f po: fix adding libnm-core/nm-setting-team.c to po/POTFILES.in
Fixes: 146e0d23bc
2016-09-27 12:02:14 +02:00
Thomas Haller
1b8c201cce cli: reject team.config from files with '\0'
The team-config must be valid utf-8. First of all, JSON
is also defined for other unicode encodings, but libjansson
can only handle utf-8. So, just require that.

A file with a '\0' truncates part of the file and is thus
invalid.
2016-09-27 11:24:47 +02:00
Thomas Haller
c2ef5da42a nmcli: merge branch 'th/nmcli-team-config-args-bgo771870'
https://bugzilla.gnome.org/show_bug.cgi?id=771870
2016-09-27 11:01:24 +02:00
Thomas Haller
c1a4c084b0 cli: support explicitly selecting team-config as file or json data
nmcli has a heuristic when setting the team-config to accepting both
a filename or the plain json text.

Add support for two schemes "file://" and "json://" to explicitly
determine whether to read from file or from json.

Also, no longer silently ignore an all-whitespace word. That is an
error (unless you have a file named " ").

Also, no longer replace newlines with space. Don't mangle the input
text at all.
2016-09-27 10:59:47 +02:00
Thomas Haller
146e0d23bc libnm: reject too large team-config JSON 2016-09-27 10:56:57 +02:00
Thomas Haller
32f78ae6c3 libnm: expose nm_utils_is_json_object() utility function
Since we possibly already link against libjansson, we can also expose some
helper utils which allows nmcli to do basic validation of JSON without
requiring to duplicate the effort of using libjansson.

Also, tighten up the cecks to ensure that we have a JSON object at hand.
We are really interested in that and not of arrays or literals.
2016-09-27 10:56:42 +02:00
Lubomir Rintel
c3586ce01a device: consider a device with slaves configured
Do assume connections for it.

https://bugzilla.redhat.com/show_bug.cgi?id=1333983
2016-09-26 17:49:26 +02:00
Thomas Haller
eb3dd9b679 policy: refactor auto_activate_device() to get rid of "out" cleanup label 2016-09-26 17:10:32 +02:00
Thomas Haller
7a5537ee86 policy: fix owner-ship of specific_object in can_auto_connect()
NMPolicy:auto_activate_device() would wrongly not free the
specific_object, although it is documented as transfer-full.

The only implementation of can_auto_connect() that returned
a specific-object is NMDeviceWifi:can_auto_connect(). So, there
wasn't any actual bug or memory leak.

Fixes: 4c028c7cef
2016-09-26 17:10:07 +02:00
Thomas Haller
ee86069601 shared: add test for NM_SET_OUT() 2016-09-26 17:00:38 +02:00
Beniamino Galvani
d27ae4a8fe checkpoint: merge branch 'bg/checkpoint-improvements-bgo770315'
https://bugzilla.gnome.org/show_bug.cgi?id=770315
2016-09-26 15:10:44 +02:00
Beniamino Galvani
45f72c8cc1 checkpoint: restore both applied and settings connections 2016-09-26 15:10:39 +02:00
Beniamino Galvani
1ab616b59c checkpoint: make python example accept multiple devices and timeout
Add a timeout parameter and allow passing multiple interfaces to make
the script more useful for testing purposes.
2016-09-26 15:10:39 +02:00
Beniamino Galvani
8b9ea0b7c6 checkpoint: consider all devices when an empty list is passed
First, consider all devices and not only realized and managed ones
when an empty list is passed. Also, move the list evaluation to the
checkpoint manager, since the check for device conflicts is done
there.

Fixes: 3e09aed2a0
2016-09-26 15:10:39 +02:00
Beniamino Galvani
c76e218877 checkpoint: use UUID instead of path to match connections
The path can change, while the UUID should univocally identify the
connection.
2016-09-26 15:10:39 +02:00
Beniamino Galvani
637e31bc1f checkpoint: better handle unmanaged and unrealized devices
In order to better restore the previous system state, allow the
inclusion of unmanaged devices in a checkpoint and try to revert to
the old state taking also the realized/managed state into account.
2016-09-26 15:10:39 +02:00
Beniamino Galvani
5754a05605 core: allow passing an applied connection to nm_act_request_new()
This is useful for the checkpoint/restore functionality to revert both
the applied and the settings connections.
2016-09-26 15:10:39 +02:00
Beniamino Galvani
1a6e3e0a57 manager: add nm_manager_get_device_paths() 2016-09-26 15:10:39 +02:00
Thomas Haller
5b8c092d6b device: initialize nm_plugin_missing via constructor property
No need for the setter/getter of this property.

Immutable properties are so much nicer. Remove the setter and
ensure that the nm_plugin_missing property is only set during
object construction.
2016-09-26 13:27:00 +02:00
Thomas Haller
5db62eb51d core: merge branch 'th/device-state-bgo771890'
https://bugzilla.gnome.org/show_bug.cgi?id=771890
2016-09-26 13:16:16 +02:00
Thomas Haller
93396b8d52 config: store and load device runtime state to file
The data is still unused, the actual fields might change.

Note that the actual state we store is subject to change,
according to which data we need. The file format is non stable,
as the files don't survive reboot. So there is no backward
compatibility to maintain and the format can be changed later.
2016-09-26 13:12:02 +02:00
Thomas Haller
1eca446c8c main: create /run/NetworkManager/devices runtime directory 2016-09-26 10:52:12 +02:00
Thomas Haller
1a257a6752 config: use logging macros
For some logging lines we used the wrong logging domain
LOGD_SETTINGS instead of LOGD_CORE.
2016-09-26 10:52:12 +02:00
Thomas Haller
e152eea218 build: fix breakage of enums-to-docbook.pl script for NMCapability enum
GEN      nm-dbus-types.xml
    Documentation for value '*' missing at ../tools/enums-to-docbook.pl line 134, <> line 95.
    Makefile:1579: recipe for target 'nm-dbus-types.xml' failed

Fixes: 93a753e311
2016-09-23 19:11:45 +02:00
Beniamino Galvani
0e96d23733 crypto: don't try to decrypt PKCS#8 key if no password is supplied
crypto_verify_private_key_data() must try to decrypt the key only when
a password is supplied.

Previously the decrypt test always passed because we detected an
unsupported cipher and faked success. Now since version 3.5.4 gnutls
supports PBES1-DES-CBC-MD5 and the key is actually decrypted when a
password is supplied.

Also, don't assert that a wrong password works because we're now able
to actually verify it (only with recent gnutls).

https://bugzilla.gnome.org/show_bug.cgi?id=771623
2016-09-23 18:05:54 +02:00
Thomas Haller
93a753e311 capabilities: add comment about capability range 2016-09-23 16:09:06 +02:00
Thomas Haller
0b48ad4e48 capabilities: merge branch 'th/caps-rh1375967'
https://github.com/NetworkManager/NetworkManager/pull/9
https://bugzilla.redhat.com/show_bug.cgi?id=1375967
2016-09-23 15:50:43 +02:00
Thomas Haller
e80b0a98c0 core: use binary-search for nm_manager_set_capability()
And drop the unused function nm_manager_check_capability().
I don't think we need such a function server-side, as the
server usually has better ways to check whether a capability
is supported.
2016-09-23 15:49:52 +02:00
Thomas Haller
9d00736527 capabilities: fix destroying capabilities in dispose()
dispose() must be re-entrant. Thus, at the very least it must clear the
priv->capabilities after freeing the array.

While at it, move it to finalize (which is only called once) and
move initialization of the array from "constructed" to nm_manager_init()
which is called first.
2016-09-23 15:49:52 +02:00
Thomas Haller
ab26248080 capabilities: fix number for NM_CAPABILITY_TEAM
The enum defines should name their numerical value explicitly,
so that it can be easily seen by looking at the code. Also,
they are public, stable API. They must not change.

Anyway, the capability 0 shall be reserved. Change NM_CAPABILITY_TEAM
to value 1.
2016-09-23 15:49:52 +02:00
Thomas Haller
ede4b1c5e5 libnm: fix symbol versioning
Already released versions must not be extended or modified.
The new symbol is part of upcomming 1.6.0 release.
2016-09-23 15:49:52 +02:00
Thomas Haller
4a6c07d4e5 capabilities: fix data type to "u" / uint32
The property NM_MANAGER_CAPABILITIES was already "au".
The types must be used consistently.
2016-09-23 15:49:52 +02:00
Marius Vollmer
2ca1ce5d88 team: Add NM_CAPABILITY_TEAM 2016-09-23 15:49:52 +02:00
Marius Vollmer
1bb00ae66a manager: Add "Capabilities" property 2016-09-23 15:49:52 +02:00
Thomas Haller
c3ecca225c core: add _nm_utils_array_find_binary_search()
Also add nm_cmp_uint32_p_with_data(). Will be used later.
2016-09-23 15:49:29 +02:00