Commit Graph

7320 Commits

Author SHA1 Message Date
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
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
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
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
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
Thomas Haller
0ce83890bf utils: fix out-of-bound access for negative indexes in _NM_UTILS_STRING_LOOKUP_TABLE_DEFINE() 2016-01-24 11:31:15 +01:00
Beniamino Galvani
e3a6ba6756 manager: cleanup active connections upon exit
When connection sharing is enabled, the removal of iptables rules is
delegated to the NMActRequest destructor; but for this to work it is
required that the object is properly dereferenced upon NM termination.

Clean up the active connections which are in DEACTIVATED state when
quitting, so that they are unexported and destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=692673
2016-01-23 10:01:21 +01:00
Beniamino Galvani
8cba3e046e core: list iptables sharing rules in the right order
The rules were added to the list using g_slist_append() and then
applied one at time using "iptables --insert" which puts them at the
beginning of the chain, reversing the initial order.

Instead, list them in the desired order and use g_slist_prepend() to
achieve the same result. This has no functional changes.
2016-01-23 10:01:21 +01:00
Dan Williams
08bc51095c ifcfg-rh: convert more testcases to g_assert() 2016-01-22 09:47:16 -06:00
Thomas Haller
8715d61437 libnm-core: fail verify() for NMSettingVlan for invalid vlan id
Point in case:

    # ip link add link dummy0 name dummy0.vlan type vlan id 4095
    RTNETLINK answers: Numerical result out of range

This potentially causes existing (invalid) connections to disappear
as they now fail verification.

Instead of adjusting the range of the GObject property
NM_SETTING_VLAN_ID, reject it during vlan. This is a bit more
forgiving to an older client that isn't aware of this new restriction,
so he can first set the value without raising a critical warning.
2016-01-22 12:02:39 +01:00
Beniamino Galvani
9a56fa0b3f core: allow VLAN ids between 1 and 4095
nm_utils_new_vlan_name() should reject the reserved VLAN id 4095, and
the test case should not test reserved values 0 and 4095.

Fixes: 778207f23e
2016-01-22 11:17:44 +01:00
Dan Williams
356b4ce29c platform: fix leak when netlink dump is too large 2016-01-21 12:28:13 -06:00
Thomas Haller
778207f23e core: truncate parent ifname when constructing virtual ifname for VLAN
https://bugzilla.redhat.com/show_bug.cgi?id=1300755
2016-01-21 18:49:02 +01:00
Thomas Haller
944065c115 core: check generated virtual interfaceplatform name
https://bugzilla.redhat.com/show_bug.cgi?id=1300755
2016-01-21 18:38:52 +01:00
Beniamino Galvani
a4492f4145 manager: fix a couple of memory leaks
Fixes: 4dbaac4ba2
Fixes: d8e1590c50
2016-01-21 18:23:53 +01:00
Thomas Haller
e1f395834a wifi/supplicant: refactor logging to use _LOG() macros 2016-01-21 17:41:32 +01:00
Thomas Haller
e59c4117c4 wifi/supplicant: implement _LOG() macros 2016-01-21 17:41:32 +01:00
Lubomir Rintel
e80346fff7 utils: fix error open() handling
CID 59376 (#2-1 of 2): Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: urandom is passed to a parameter that cannot be negative.
2016-01-21 16:56:19 +01:00
Lubomir Rintel
88da21caa1 linux-platform: fix accidental Python
Coverity: CID 59378 (#1 of 1): Nesting level does not match indentation
(NESTING_INDENT_MISMATCH) This statement is indented to column 41, as if
it were nested within the preceding parent statement, but it is not.
2016-01-21 16:53:56 +01:00
Lubomir Rintel
d03322b2a5 linux-platform: fix a file descriptor leak
Coverity: CID 59384 (#3-1 of 3): Resource leak (RESOURCE_LEAK)26.
leaked_handle: Handle variable fd going out of scope leaks the handle
2016-01-21 16:32:23 +01:00
Thomas Haller
1264fc2108 supplicant: cleanup GObject property implementation in NMSupplicantInterface
nm_supplicant_interface_new() should be merely a convenient interface
for creating the object directly.
2016-01-21 14:58:55 +01:00
Thomas Haller
f1fba3eb02 wifi: fix crash due to wrong ownership handling in nm_supplicant_manager_iface_release()
nm_supplicant_manager_iface_get() would cache and reuse the supplicant
interface. But no ref-counting was in place so that the first user returning
the interface via nm_supplicant_manager_iface_release() would destroy the
instance for others.

This is broken for a very long time. Which shows that we hardly ever
have a cache-hit and usually create a new instance. So, instead of
letting nm_supplicant_manager_create_interface() check for existing
supplicant interface, always create a new instance. This also makes
sense, because we would expect that per ifname only one instance is
requested at a time. Also add an assertion that we don't return
multiple supplicant interface instances for the same ifname.

Drop nm_supplicant_manager_iface_release() in favor of requiring users
to unref the returned instance.

Also, use a GSList instead of a GHashTable for the cache.

Also, previously callers would pass @is_wireless to nm_supplicant_manager_iface_get(),
but the cache lookup did not consider that value. That doesn't matter
now as we always create a new instance.

https://bugzilla.redhat.com/show_bug.cgi?id=1298007
2016-01-21 14:58:55 +01:00
Thomas Haller
063f9185b9 supplicant: don't pass start_now argument to nm_supplicant_interface_new()
Also, don't only consider the @die_count whether to start the supplicant,
but check for is_available() -- which already considers @die_count and
@running.
2016-01-21 14:58:55 +01:00
Thomas Haller
5d64da1da2 supplicant: drop is_wireless argument from NMSupplicantInterface's interface_add() 2016-01-21 14:58:55 +01:00
Thomas Haller
a8165611a8 supplicant: remove check for iface instance after nm_supplicant_interface_new()
A plain constructor for a GObject cannot fail.
2016-01-21 14:58:55 +01:00
Thomas Haller
004edecc81 wifi/supplicant: take object reference during availability_changed()
If the list is expected to be modified, it also means that possibly
instances will be unrefed. Probably, not yet visited instances will
not be unrefed so there is no real problem.

Just be extra cautious and take a reference to all instances first.
2016-01-21 14:58:54 +01:00
Thomas Haller
8dcf4d32e9 device/wifi: remove unnecessary call to remove_supplicant_interface_error_handler()
remove_supplicant_interface_error_handler() is not needed as we later disconnect
all handlers for @self.
2016-01-21 14:58:54 +01:00
Thomas Haller
84828960ff device/wifi: replace cancel_pending_scan() with nm_clear_g_source() 2016-01-21 14:58:54 +01:00
Thomas Haller
0a2ff1d16d device/ethernet: cleanup clearing handlers registered to supplicant interface 2016-01-21 14:58:54 +01:00
Thomas Haller
30f72c2753 device/ethernet: use nm_clear_g*() function in remove_supplicant_interface_error_handler() 2016-01-21 14:58:54 +01:00
Thomas Haller
2505911ad5 supplicant: remove unused function nm_supplicant_interface_get_device() 2016-01-21 14:58:54 +01:00