Commit Graph

14110 Commits

Author SHA1 Message Date
Thomas Haller
301c747938 settings: coding style and use gs_free in write_hostname() 2016-01-29 17:36:27 +01:00
Joel Holdsworth
55a07b4ca4 settings: resolve path if hostname is a sym-link
If the hostname file is a symbolic link, follow it to find where the
real file is located, otherwise g_file_set_contents will attempt to
replace the link with a plain file.

https://mail.gnome.org/archives/networkmanager-list/2016-January/msg00061.html
https://mail.gnome.org/archives/networkmanager-list/2016-January/msg00073.html
2016-01-29 17:33:48 +01:00
Thomas Haller
17c5e4ec65 device: don't iterate over a va_list more then once
Calling va_start() (with va_end()) in between seems to work and
is done by systemd and other code occasionally.

However, it's not clear that this really works on every architecture.
So just replace thise one instance with a different implementation
by passing the arguments as an array.
2016-01-29 14:29:28 +01:00
Thomas Haller
bb86877031 libnm-core: cleanup handling IP address in NMIPRoute
The change to canonicalize_ip() has actually no effect
because all callers that pass null_any==TRUE, ensure
already that they don't pass NULL.
2016-01-29 13:49:27 +01:00
Thomas Haller
862be319a8 libnm-core: use utility function in NMIPRoute for getting size of addresses per family 2016-01-28 21:15:59 +01:00
Thomas Haller
0ba4322eec libnm-core: ensure any next_hop in NMIPRoute is NULL
NMIPRoute has the convention that a next-hop 0.0.0.0/:: is stored
as NULL. However, the binary setters could violate that.
2016-01-28 21:15:59 +01:00
Dan Williams
91f06323c7 examples: avoid compile errors around NM versioning 2016-01-28 12:27:14 -06:00
Dan Williams
1cf4727766 wwan: retry connect on some errors and save them for log messages
First, cb751012a2 mistakenly converted the
act_stage_context_step() in connect_ready() to connect_context_clear()
instead of connect_context_step().  This would cause the IP Type retry
logic to fail and no further types to be tried.  It also throws
away the ctx->first_error and causes all errors that MM returns on the
connect attempt to be dropped on the floor.

Second, not all errors should cause an advance to the next IP Type,
since some errors aren't related to it.  Specifically, MM_CORE_ERROR_RETRY
when using Simple.Connect() means that a timeout was reached
in the internal connect logic, not a modem or network error.  In
that case, try the connect again with the same IP Type before advancing
to the next type.

Fixes: cb751012a2

Tested-by: Ladislav Michl <ladis@linux-mips.org>
Tested-by: Tore Anderson <tore@fud.no>
2016-01-28 12:25:47 -06:00
Lubomir Rintel
061edeaea6 vpn-service-plugin: allow VPNs with no IP configuration
Perfectly fine for ethernet-bridged networks (openvpn with tap devices).
2016-01-28 11:50:15 +01:00
Lubomir Rintel
8e3a5f6d3a vpn-connection: try completing the connection when plugin sends config
In case there's no IP configuration we wan the connection to succeed,
not time out.
2016-01-28 11:50:15 +01:00
Michael Biebl
06dbbb899c tests: fix tests for nm_utils_kill_child() by using "bash"
Seems that "dash" has issues with trap EXIT. This causes
test failures on systems where the default shell is not "bash".

[thaller@redhat.com: patch extracted from BZ and modified to
 use bash everywhere]
https://bugzilla.gnome.org/show_bug.cgi?id=761146
2016-01-28 10:07:44 +01:00
Thomas Haller
fc7c333d84 libnm: include "nm-vpn-service-plugin.h" in "NetworkManager.h"
"nm-vpn-service-plugin.h" includes "nm-connection.h", so there is already no
way to use "nm-vpn-service-plugin.h" without also pulling in all "NetworkManager.h".

On the other hand, we might not include "nm-vpn-service-plugin.h" in
"NetworkManager.h" to keep the overall headers small (by default).
But let's just include it too. We already opted for convenience
over small-include by having one top-level header file.
2016-01-27 17:20:09 +01:00
Thomas Haller
1a3597529e bluez: merge branch 'th/bluez-crash-shutdown-rh1301389'
The crash from rh1301389 is probably not fixed by these changes.
The cause there is still unclear, however these changes seem
anyway correct. Merge them.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1301389
2016-01-27 14:20:45 +01:00
Thomas Haller
53233bb04c bluez: own reference to connection provider in NMBluezDevice 2016-01-27 14:18:38 +01:00
Thomas Haller
94dcffc475 bluez: own reference to connection provider in NMBluezManager 2016-01-27 14:18:38 +01:00
Thomas Haller
7cc54d5bb9 bluez: fix invoking parent dispose() function in NMBluezManager
Fixes: bf5a6ad443
2016-01-27 14:18:38 +01:00
Thomas Haller
858e4bca45 manager: downgrade assertions to g_critical() in manager's singleton getters 2016-01-27 14:18:38 +01:00
Thomas Haller
bb78d14467 contrib/rpm: add comment to NetworkManager.conf about debug logfiles 2016-01-27 14:11:24 +01:00
Thomas Haller
0cccb7b723 man: reorder and rework CONNECTION SECTION in NetworkManager.conf's manual 2016-01-27 13:48:09 +01:00
Thomas Haller
de97003641 man: fix indention of program listings in NetworkManager.conf 2016-01-27 13:14:53 +01:00
Thomas Haller
b51da9b030 man: replace tabs by eight spaces in xml manual pages 2016-01-27 13:12:49 +01:00
Thomas Haller
4eda14451b man: fix typo in NetworkManager.conf 2016-01-27 12:32:07 +01:00
Thomas Haller
0bedc637ed build: add "shared" files to EXTRA_DIST 2016-01-27 11:51:17 +01:00
Dan Williams
0a3a345b71 dns: remove newlines from errors 2016-01-26 11:26:41 -06:00
Dan Williams
af189b3295 dns: clean up error paths in dns-manager
Specifically for resolvconf, if the write succeeded, but the pclose()
failed error would be left NULL and SR_ERROR would be returned, which
caused a crash in nm_dns_manager_end_updates().
2016-01-26 11:25:50 -06:00
Thomas Haller
acc0d79224 systemd: merge branch 'systemd' into master 2016-01-26 17:45:23 +01:00
Thomas Haller
14912429cc systemd: update code from upstream
This is a direct dump from systemd git on 2016-01-26, git commit
3820ed90335211dc208b048f1ff48ae66940ce3b.

======

SYSTEMD_DIR=../systemd
COMMIT=3820ed90335211dc208b048f1ff48ae66940ce3b

(
  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/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/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/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.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/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/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-01-26 16:48:18 +01:00
Thomas Haller
ea112ed821 dispatcher: adjust logging output for dispatcher events
Previously, we would log messages like:
  #3 'pre-up' [tun0]: new request (1 scripts)

Journald interprets the "#" prefix as a severity level and
highlights them.
2016-01-26 14:10:56 +01:00
Thomas Haller
8029f59e4f libnm-glib: fix another memory leak around update_permissions()
This time in init_async_got_permissions().

Thereby, just use gs_unref_hash and gs_free_error for cleanup.
2016-01-26 12:20:15 +01:00
Thomas Haller
e0601d501a libnm-glib: fix crash due to uninitalized pointer in get_permissions_reply()
If the D-Bus call failed with error, @permissions would stay uninitialized.
2016-01-26 12:04:08 +01:00
Beniamino Galvani
96b11af92d dns: fix generation of global configuration for dnsmasq
Fixes: ae9e82354a
2016-01-25 21:46:11 +01:00
Beniamino Galvani
3eb5037e1f dhcp/systemd: disable callback before stopping the client
Otherwise the call to stop() would generate a new unwanted state
transition.
2016-01-25 17:46:01 +01:00
Beniamino Galvani
37d0833a15 dhcp/systemd: honor timeout 2016-01-25 17:46:01 +01:00
Beniamino Galvani
2ef70653fb dhcp/systemd: gracefully fail when the interface has unknown ARP type 2016-01-25 17:46:01 +01:00
Thomas Haller
583c759dd7 platform: merge branch 'th/platform-recvmsg-enobufs' 2016-01-25 15:49:31 +01:00
Thomas Haller
f00c472ee8 platform: increase netlink socket receive buffer size
When the receive buffer is too small, we easily can hit ENOBUFS during recvmsg()
and need to resync the platform cache. But even worse, we possibly also loose
ACKs for pending netlink requests so that requests seem to fail (although they
might have succeeded).

Avoid that harder by increasing the buffer size to 8MB. This is also
done by networkd:

  be660c371b
2016-01-25 15:48:09 +01:00
Thomas Haller
45df49ebdd platform: improve detecting ENOBUFS for recvmsg() on netlink socket
libnl3 maps different error codes to NLE_NOMEM. Only resync platform cache
when we really experienced a ENOBUFS from recvmsg().
2016-01-25 15:08:32 +01:00
Thomas Haller
4ba999e41e platform: refactor check for error in event_handler_recvmsgs() to switch statement 2016-01-25 15:07:10 +01:00
Thomas Haller
8ab968d4ef platform: fix draining netlink socket on cache resync
Fixes: 809c547b6c
2016-01-25 14:38:35 +01:00
Thomas Haller
66438de577 core: reject existing links when trying to add a link via platform
When we decide to add a new link, we alredy checked that no such link exists
(ignoring race conditions).

It is wrong to accept a EXITS failure when adding the link. There is no guarantee
that the existing link has all the same properties as the one we intend to add.
More importantly, this link was added externally outside of NetworkManager and it
should not be taken over.

Just treat EXISTS as a failure as any other.
2016-01-25 13:35:10 +01:00
Thomas Haller
809c547b6c platform: handle netlink ACKs in event_handler_recvmsgs() during cache-resync
When reading from netlink-socket fails with NLE_NOMEM, messages were
lost. In this case the cache must be resynced and all pending messages
from the socket are rejected via "event_handler_recvmsgs (platform, FALSE)".

In this case, we don't want to handle the received messages as the
cache anyway needs to resync. However, we are still interested in
all queued ACKs that are there.

We are also interested in RTM_NEWADDR messages which we use to detect
kernel support via _support_kernel_extended_ifa_flags_detect().
2016-01-25 13:33:10 +01:00
Thomas Haller
a47b2abeb1 device: merge branch 'lr/default-unmanaged-bgo746566' (part 5)
Merge another early part of 'lr/default-unmanaged-bgo746566'

https://bugzilla.gnome.org/show_bug.cgi?id=746566
2016-01-24 16:12:08 +01:00
Thomas Haller
4ab3fd37f9 device: add _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST enum
NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST is a multi-flag value combining all
the hooks that compose a user-request. Add a special value that has no esplicit
meaning except that it ~is~ a user-request.
2016-01-24 16:07:01 +01:00
Thomas Haller
02ec76df5a device: cleanup handling available-connections
For update, don't delete first and add it again. Just do it
in one step.

For recheck, don't delete all connections first to add them
all anew. Instead, check what changes and only emit the changed
signal if there are any actual changes.
2016-01-24 16:07:01 +01:00
Thomas Haller
9b3b94858b device/trivial: rename functions for available-connections 2016-01-24 16:07:01 +01:00
Thomas Haller
ba187e054d core: refactor functions to use NM_UTILS_LOOKUP*()
Also use NM_UTILS_LOOKUP_STR() macro, which can transform
unknown values to their numerical representation using
alloca().
2016-01-24 15:04:36 +01:00
Thomas Haller
6c6ab10dea core/trivial: rename NM_UTILS_STRING_LOOKUP_TABLE* to NM_UTILS_LOOKUP*
Due to using a switch stetement, it is no longer only useful for looking
up strings, and it certainly doesn't use a table anymore.
2016-01-24 14:29:37 +01:00
Thomas Haller
b9df6009ff utils: implement NM_UTILS_STRING_LOOKUP_TABLE_DEFINE() as switch() statement
The compiler will likely optimize a  switch() statement also to a table
lookup, but it also works for negative values and values with large
gaps.
2016-01-24 14:21:14 +01:00
Thomas Haller
3ed2488d74 utils: use NM_UTILS_STRING_LOOKUP_TABLE_ITEM() macro 2016-01-24 14:20:58 +01:00
Thomas Haller
8956ea661c utils: add NM_UTILS_STRING_LOOKUP_TABLE_ITEM() macro 2016-01-24 14:20:57 +01:00