Commit graph

16243 commits

Author SHA1 Message Date
Thomas Haller aa3e44984a build: don't change directory in tools/create-exports-NetworkManager.sh
We shall call it from the makefile, thus the current directory is
$(top_builddir), which is just what we need.
2016-11-10 18:30:38 +01:00
Thomas Haller f71d1dfffb build: improve tools/create-exports-NetworkManager.sh script
- include symbols from the "B" section.
- improve the script, to use libNetworkManager.a instead
  of the NetworkManager binary. The former is before stripping
  symbols.
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 5f00a20f38 contrib/rpm: fix wrong configure options in spec file 2016-11-10 18:30:38 +01:00
Lubomir Rintel 7700efad18 build: don't build the wimax nsp bindings
Added accidentally by the object-manager branch.
2016-11-10 18:11:24 +01:00
Lubomir Rintel d441271109 libnm/client: drop some unneeded includes 2016-11-10 18:11:15 +01:00
Lubomir Rintel b9f9864bc4 merge: branch 'lr/object-manager'
https://bugzilla.gnome.org/show_bug.cgi?id=771191
2016-11-10 16:54:46 +01:00
Lubomir Rintel 1f5b48a59e libnm: use the o.fd.DBus.ObjectManager API for object management
This speeds up the initial object tree load significantly. Also, it
reduces the object management complexity by shifting the duties to
GDBusObjectManager.

The lifetime of all NMObjects is now managed by the NMClient via the
object manager. The NMClient creates the NMObjects for GDBus objects,
triggers the initialization and serves as an object registry (replaces
the nm-cache).

The ObjectManager uses the o.fd.DBus.ObjectManager API to learn of the
object creation, removal and property changes. It takes care of the
property changes so that we don't have to and lets us always see a
consistent object state.  Thus at the time we learn of a new object we
already know its properties.

The NMObject unfortunately can't be made synchronously initializable as
the NMRemoteConnection's settings are not managed with standard
o.fd.DBus Properties and ObjectManager APIs and thus are not known to
the ObjectManager.  Thus most of the asynchronous object property
changing code in nm-object.c is preserved. The objects notify the
properties that reference them of their initialization in from their
init_finish() methods, thus the asynchronously created objects are not
allowed to fail creation (or the dependees would wait forever). Not a
problem -- if a connection can't get its Settings, it's either invisible
or being removed (presumably we'd learn of the removal from the object
manager soon).

The NMObjects can't be created by the object manager itself, since we
can't determine the resulting object type in proxy_type() yet (we can't
tell from the name and can't access the interface list). Therefore the
GDBusObject is coupled with a NMObject later on.

Lastly, now that all the objects are managed by the object manager, the
NMRemoteSettings and NMManager go away when the daemon is stopped. The
complexity of dealing with calls to NMClient that would require any of
the resources that these objects manage (connection or device lists,
etc.) had to be moved to NMClient. The bright side is that his allows
for removal all of the daemon presence tracking from NMObject.
2016-11-10 16:48:48 +01:00
Lubomir Rintel ff3eb24c15 libnm: change the secret agent to use the generated GDBus bindings
It allows us to drop _nm_dbus_register_proxy_type() and _nm_dbus_new_proxy_*()
once they're not used by the rest of libnm anymore.
2016-11-10 16:48:48 +01:00
Lubomir Rintel bbed63213a libnm/tests: work around ObjectManager bogus warning
We should eventually fix this in Gio, but I guess we need to keep the
workaround for the time being anyway.
2016-11-10 16:48:48 +01:00
Lubomir Rintel 7803f6b7fa libnm/tests: add restart method to the manager mock test support interface 2016-11-10 16:48:48 +01:00
Lubomir Rintel 70548dabe6 libnm/tests: add object manager mock 2016-11-10 16:48:48 +01:00
Lubomir Rintel ab0e0ed117 libnm/tests: turn all mock objects into ExportedObjs
This way they will all be able to register with the ObjectManager mock.
2016-11-10 16:48:48 +01:00
Lubomir Rintel 3f451a2394 libnm/tests: only init the exported obj when the interfaces are in place
When we have the ObjectManager mock, this allows it to emit correct
InterfacesAdded signal when the ExportedObj is initialized.
2016-11-10 16:48:48 +01:00
Lubomir Rintel 24afcb502e libnm/tests: correct vlan id type in vlan device mock 2016-11-10 16:48:47 +01:00
Lubomir Rintel 402ba09269 libnm/tests: notify of changing active-connections in manager mock 2016-11-10 16:48:47 +01:00
Lubomir Rintel f234279c94 libnm/tests: emit standard properties changed signals from mock objects 2016-11-10 16:48:47 +01:00
Lubomir Rintel ed21a820a7 libnm/tests: connection might not be gone at the time manager signals removal
The assumption is not too useful to the library user anyway -- it could easily
be that there's some other link to the object in the object tree.

More importantly, when the objects are managed by the object manager,
we don't destroy the object until we see it actually removed on the
D-Bus. That makes more sense anyway.
2016-11-10 16:48:47 +01:00
Lubomir Rintel 7007c9853c libnm: order the property updates
Don't let a later property update finish than the sooner one.

This wouldn't happen most of time, apart from a special case when the
latter update of a object array property is to an empty list.
In that case the latter update would complete sooner and when the
earlier update finishes the list would contain objects which are
supposed to be gone already.
2016-11-10 16:48:47 +01:00
Lubomir Rintel df46c59775 nm-object: initialize the object buffer to zero 2016-11-10 16:48:47 +01:00
Thomas Haller 2481eaac15 man: clarify HWADDR for nm-setting-ifcfg-rh manual 2016-11-10 14:08:41 +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 b058c45d28 tests: fix run-nm-test.sh to use valgrind when --called-from-make
Fixes: dbafd2ce50
2016-11-10 10:06:40 +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 ba2b2de3ad build: allow using GCC C99 dialect instead of C89
We already use several GCC extenions, like typeof() and
__attribute__((cleanup)). They are too convinient to miss
and every supported compiler must support these.
Currently, gcc and clang does. Maybe other compilers would
support that too, but who knows, nobody seems to test that.

We also already use stdbool.h (C99) and the imported systemd
code is mostly gnu99 too (it's not clear to me, because I don't
find it precisely documented. Certainly it makes use of C99 features
too).

C99/gnu99 has some nice improvements that we no longer should miss
out. For example "flexible array members" or "variable declaration
in init-part of for loop".

It doesn't mean we have to use every obscure (badly supported?)
feature, it means we don't have to forgo features that are well
supported. C99 is 17 years old, I mean, really...

If somebody comes along and ports NM to non-gcc/clang, we can address
bugs about unsupported language features as they surface.
But let's not restrict us to some hypothetical compiler (or language
specification).

Also, NetworkManager is not ported on environment beside Linux.
We don't have to be so considerate about the required build environment.
Gcc is probably the most portable compiler out there. I doubt porting
NetworkManager to *BSD fails due to missing gnu99 features. And if that
causes issues, we should fix them after they happen in practice.
2016-11-10 09:34:39 +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
Beniamino Galvani d9b529b47b merge: branch 'bg/tui-ip-tunnel-rh1391424'
https://bugzilla.redhat.com/show_bug.cgi?id=1391424
2016-11-09 17:51:49 +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 cd73f281cc tui: add support for IP tunnel connections 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
Beniamino Galvani 5aea82d383 libnm-core: ensure a IP tunnel connection specifies a remote IP
The IP of the remote endpoint is always required.
2016-11-09 17:45:34 +01:00
Beniamino Galvani 75127b1348 libnm: add missing device includes in NetworkManager.h
And also sort the setting includes alphabetically.
2016-11-09 17:45:34 +01:00
Lubomir Rintel ecc6040cd8 merge: branch 'lr/ipv6-sharing'
https://bugzilla.gnome.org/show_bug.cgi?id=773777
2016-11-09 17:26:21 +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 0e6d194060 settings: allow method=shared with manual IPv6 configuration
IPv4 already allows setting an address, reusing its prefix for the network
it shares connection with. Additionally, for IPv6, the NDP can also share
the DNS configuration.
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