Commit graph

8618 commits

Author SHA1 Message Date
Thomas Haller
e053996881 build: rename "src/dhcp-manager" to "src/dhcp"
The dhcp directory does not only contain the manager
instance, but various files related to DHCP.

Rename.
2016-11-21 14:07:47 +01:00
Thomas Haller
1706366351 build: rename "src/supplicant-manager" to "src/supplicant"
The supplicant directory does not only contain the manager
instance, but various files related to wpa-supplicant.

Rename.
2016-11-21 14:07:47 +01:00
Lubomir Rintel
bf70ed2e86 vpn-manager: ignore ip configs from disconnected plugins
Plugins could be already failed or disconnected when the helper fires.
E.g. they could send in an invalid IP4Config that would cause them to
fail and then follow with an IP6Config before they realize it's of no
use. We'd hit an assertion failure in that case, because the
NMVpnConnection would already be cleaned up.
2016-11-21 13:53:03 +01:00
Thomas Haller
3cd56809ed core: drop unused "nm-bt-enum-types.h"
In core, we should not use any generated enum-types. Especially
nm-bt-enum-types.h was unused already.
2016-11-18 16:40:25 +01:00
Thomas Haller
d66d7fb707 core: drop unused "nm-modem-enum-types.h"
In core, we should not use any generated enum-types.
They are just bloat.
2016-11-18 16:40:25 +01:00
Thomas Haller
2afc1d7c43 wwan: don't use generated enum-type NM_TYPE_MODEM_STATE 2016-11-18 16:40:25 +01:00
Beniamino Galvani
a6d34f9ae3 team: ignore SIGPIPE when spawning teamd
With systemd < 219, restarting the journald service closes the stdout
and stderr streams associated with services.

The NM process has SIGPIPE ignored, but g_spawn_sync()/g_spawn_async()
re-enable it and so any child executed with those functions will
terminate by default if it tries to log anything to stdout/stderr.

The teamd instance launched by NM is affected by this problem since it
writes debug messages before actually ignoring SIGPIPE.

To fix this, use the @child_setup callback of g_spawn() to ignore
again SIGPIPE in the child process.

https://bugzilla.redhat.com/show_bug.cgi?id=1393853
2016-11-18 14:45:33 +01:00
Lubomir Rintel
d0c01cc79d wifi: notify the AccessPoint change after an AP is removed
Otherwise its path remains visible on D-Bus despite the object is gone,
making libnm sad and grumpy:

  libnm-WARNING **: no object known for /org/freedesktop/NetworkManager/AccessPoint/666
2016-11-16 16:30:12 +01:00
Thomas Haller
13a95c363c device: drop factory-no-default global arrays
On some architectures, it seems we don't properly expose
the symbol of these static variables from NetworkManager
binary.

Just avoid that and don't instead use a static array
inside the device plugin itself.

While at it, make the arrays all const, which possibly allows
the linker to put those symbols in the read-only section.
2016-11-13 15:06:57 +01:00
Thomas Haller
a791a9aa4b systemd: merge branch systemd into master 2016-11-13 14:16:42 +01:00
Thomas Haller
e68056a229 systemd: update code from upstream
This is a direct dump from systemd git on 2016-11-12, git commit
1f8c78a1bab2e06a462894fa89d842ffc313832d.

======

SYSTEMD_DIR=../systemd
COMMIT=1f8c78a1bab2e06a462894fa89d842ffc313832d

(
  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-11-13 14:11:33 +01:00
Beniamino Galvani
35b32e5825 ndisc/lndp: fix unregistration of receive handler
Fixes: 6387856602
2016-11-12 19:25:40 +01:00
Lubomir Rintel
00dbf6e90a auth-utils: don't fail the auth chain if we can't get a single permissions
It could be that the client is just newer and it's just too harsh to
fail the whole request. Leave the unknown permission in unknown and
possibly proceed filling in the rest.
2016-11-11 17:41:43 +01:00
Beniamino Galvani
00ce005e51 device: properly handle MTU for devices with @iface != @ip_iface
When the device has an IP interface different from the main one, we
previously took the MTU saved in priv->mtu (which is the MTU initially
set on the underlying interface) and applied it to the IP interface.

This is wrong as it forces the two MTUs to be equal and breaks
connectivity for devices with encapsulation (as PPP). Instead, track
the two MTUs in different variables.

https://bugzilla.redhat.com/show_bug.cgi?id=1385198
2016-11-11 15:52:25 +01:00
Thomas Haller
88e18c9de8 ifcfg-rh: improve handling of empty strings in svUnescape()
- a key
    FOO=''
  would still allocate a temporary GString and return the allocated
  empty string. Don't do that. This saves the g_free() in
  svGetValueString() for this common case. We should return
  an allocated string only if it is necessary. It is not necessary
  for the "" case, and it is inconsistent.

- when returning an empty string, always return the static string "".
  No need to seek to the end of value, and return a pointer to that
  string.
  This happens for example in the case
    FOO= # empty value, but trailing stuff
    FOO=""
    FOO=$'\Uxhallo'
2016-11-11 12:55:01 +01:00
Beniamino Galvani
9430cf3e6b ifcfg-rh: accept 802.1x connection with empty EAP-TLS identity
An identity is not needed for EAP-TLS.

https://bugzilla.redhat.com/show_bug.cgi?id=1391477
2016-11-11 11:03:57 +01:00
Thomas Haller
7b78a931df build: generate src/NetworkManager.ver during build
This adds 0.4 seconds to the build time.

You can disable it by setting $NM_BUILD_NO_CREATE_EXPORTS environment
variable. This is useful in the unexpected case that the script
is broken.
Or, if you just want to use a different, non-generated version-script.
Or, if you want to save 0.4 seconds build-time.
2016-11-10 18:30:38 +01:00
Thomas Haller
dc8ed66a19 build: fix symbol version file for _nm_device_factory_no_default_settings
Strange, didn't get this failure before...

    ./src/NetworkManager: symbol lookup error: ./src/devices/wifi/.libs/libnm-device-plugin-wifi.so: undefined symbol: _nm_device_factory_no_default_settings
2016-11-10 18:30:38 +01:00
Thomas Haller
81d058b5e8 team: log PID of died teamd instance 2016-11-10 10:56:35 +01:00
Thomas Haller
60be9cbc9e device: fix memleak for ndisc_search->domain in ndisc_set_router_config()
It is a bit fragile not to clone the string because we depend on
nm_ip6_config_get_search(priv->ip6_config) to be stable.

In practice, it's no problem. Saves an additional strdup and the
effort to cleanup the memory afterwards.
2016-11-10 10:19:57 +01:00
Thomas Haller
aeeee116c7 device: fix array indexing in ndisc_set_router_config()
Fixes: de52c25cfd
2016-11-10 10:04:03 +01:00
Thomas Haller
de52c25cfd device: refactor ndisc_set_router_config()
- only record @now timestamp if we actually need it.
- use gint32 for @now. It seems wrong that NMNDiscDNSServer
  uses guint32 for the timestamp. We keep
  nm_utils_get_monotonic_timestamp_s() as gint32 for a reason.
- ensure the arrays are initialized to zero. E.g.
  ndisc_addr->dad_counter was uninitalized.
- set the size for arrays outside the loop
- use g_array_unref(). I think that is usually better. It makes
  only a difference when somebody else holds a reference to the
  array. And in that case, it usually seems better not to clear
  the array, just release your refrence.
2016-11-10 09:30:05 +01:00
Lubomir Rintel
2b304d82d7 device: properly size the arrays 2016-11-10 08:10:28 +01:00
Lubomir Rintel
3d7931bbf6 ifcfg-rh: fix a memory leak 2016-11-09 20:34:13 +01:00
Thomas Haller
0759f7fbdb policy: fix memleak in clear_ip6_prefix_delegation() 2016-11-09 18:16:48 +01:00
Thomas Haller
6c59784a59 policy: make dispose() reentrant and indention 2016-11-09 18:16:48 +01:00
Thomas Haller
602247e8e3 ip-tunnel: avoid crash on missing NMPlatformLnkIp6Tnl lnk part
You cannot assume that we are always able to lookup a corresponding
lnk object. In fact, there is no guarantee that link->ifindex still
exists in the platform cache at all.
2016-11-09 17:45:39 +01:00
Thomas Haller
a6416cbd13 ip-tunnel: tigthen up checks for valid IP tunnel modes
The compiler warns us when we don't specify all enum values
in a switch(), provided that default: is missing.

Make use of that to get a warning when we add a new tunnel mode.
2016-11-09 17:45:39 +01:00
Beniamino Galvani
2805555bd2 ip-tunnel: fail the activation for unknown tunnel modes
When an IP-tunnel connection with mode different from the implemented
ones was activated, an assertion failed in tunnel_mode_to_link_type().

Instead we should return NM_LINK_TYPE_UNKNOWN there and fail the
activation.
2016-11-09 17:45:34 +01:00
Lubomir Rintel
ec12fcf6bf policy: delegate IPv6 configuration to ipv6.method=shared connections
The policy listens to signals from shared devices that need subnets and
requesting devices that provide prefixes. Whenever a subnet is needed,
policy tries to obtain a subnets from all of default6 device's prefixes.
When it fails to get any, it asks for more prefixes.

This way we make it possible for the delegating router to either
provide us with a /64 for each of our shared interfaces, or provide a
larger prefix that we could subnet.

The policy also updates the shared device's DNS information to keep it in sync
with the best requesting device changes.
2016-11-09 17:23:32 +01:00
Lubomir Rintel
479ad5065e device: add IPv6 configuration delegation machinery
There's two parts of the configuration involved: the subnet addresses
and the DNS information.

For the addressing, the shared (downlink) device signals the policy needs for a
/64 subnet. When it gets one, it merges it into the autoconf configuration and
forwards to the NDisc. When more prefixes are needed, the (uplink) device asks
the DHCP manager and eventually signals delegation (reception) of a prefix.
The NMDevice only provides the mechanism, the actual subnetting needs to
be done by the NMPolicy.

For the DNS configuration, the shared device just copies it from
whichever device the policy deems suitable.
2016-11-09 17:23:32 +01:00
Lubomir Rintel
4ec37b0364 dhcp-manager: add ability to specify the number of IPv6 prefixes to request
Utilizes RFC 3633 prefix option in role of requesting router to ask the
delegating router for prefixes. In future we'll be able to use the
addresses from those prefixes on ipv6.method=shared connections.
2016-11-09 17:23:32 +01:00
Lubomir Rintel
7d195856cc dhcp-manager: move the options logging one level up
It will make sense to log the options even if we're not creating an
ip6_config (e.g. we got a prefix option, not an address).

Also, guard it with a logging enable conditional. That way we save
precious microseconds so that we'll feel less guilty about the demise of
mankind and universe.
2016-11-09 17:23:32 +01:00
Lubomir Rintel
d74e5e45e5 manager: allow ipv6.medhod=shared connections 2016-11-09 17:23:32 +01:00
Lubomir Rintel
bda1e880de device: enable the IPv6 forwarding for shared connections
Useful when they have  internet-routable prefixes, consistent with IPv4.
2016-11-09 17:23:32 +01:00
Lubomir Rintel
46e63e03af device: announce the managed IPv6 configuration with ipv6.method=shared
This esentially causes us to announce the prefixes of the addresses we
own and the DNS configuration.

Currently the only way to get the IPv6 configuration on such device is
manual setting in the connection. This will change with IPv6 prefix
delegation.
2016-11-09 17:23:32 +01:00
Lubomir Rintel
611870347a ifcfg: add ability to save/restore ipv6.method=shared
We use IPV6_AUTOCONF=shared for this.
2016-11-09 17:23:32 +01:00
Lubomir Rintel
6387856602 ndisc/lndp: add ability to announce the managed IPv6 configuration
Announce the prefixes and DNS configuration.
2016-11-09 17:23:32 +01:00
Lubomir Rintel
425ce65ed0 ndisc: rename the config-changed signal
The ndisc config can now be changed by NMDevice as well when the NDisc
is in ROUTER mode. But what we're really interested in is when we
receive a new one from the outside.
2016-11-09 17:23:32 +01:00
Lubomir Rintel
87624a6c50 ndisc: add logic for acting as a router 2016-11-09 17:23:32 +01:00
Lubomir Rintel
be6a0c7ce5 ndisc: move the logging deduplication into a macro
We'll want to use it elsewhere.
2016-11-09 17:23:32 +01:00
Lubomir Rintel
aed2106d3e ndisc: avoid calling start() multiple times
It hooks on ndp event callbacks and we'll end up in them being done
redundantly, leaking them on dispose and potentially even calling them.
2016-11-09 17:23:31 +01:00
Lubomir Rintel
679f8dfc7d ndisc/trivial: move nm_ndisc_set_iid upwards 2016-11-09 17:23:31 +01:00
Lubomir Rintel
c84313a2b7 ndisc/lndp: drop an unused variable 2016-11-09 17:16:48 +01:00
Lubomir Rintel
d09aea62ee ndisc/trivial: add a couple of comments of where do the constants come from 2016-11-09 17:16:48 +01:00
Lubomir Rintel
f69b6c038e device: the domain list from DNSSL is in fact a search list 2016-11-09 17:16:48 +01:00
Lubomir Rintel
44fca246a7 rdisc: rename to ndisc
We'll soon not only do the router discovery, but announce ourselves as a
reouter. "Neighbor discovery" sounds to be a more appropriate name for
the class than "Router discovery".
2016-11-09 17:16:47 +01:00
Lubomir Rintel
aa71dbc6c4 device: avoid a crash when L3 configuration fails
Don't call the IP check until at either IPv4 or IPv6 is actually
configured.
2016-11-09 15:06:21 +01:00
Lubomir Rintel
2e8f40f2c9 ifcfg-rh: avoid parsing the IPV6_PRIVACY string twice
This saves a couple of CPU cycles that would be better used for
something more useful, such as looking for transmissions from aliens.
2016-11-09 15:06:20 +01:00
Lubomir Rintel
577ba42e18 ifcfg-rh: get rid of an extra unused variable
This saves a couple of bits we could instead use to save memories of the
better days.
2016-11-09 15:06:20 +01:00