Commit graph

19756 commits

Author SHA1 Message Date
Thomas Haller
fa09e7eb53 device/ndisc: skip link-local addresses from NDisc 2018-03-20 15:24:38 +01:00
Thomas Haller
c96c374d14 core: merge branch 'th/complete-generic-cleanup'
https://github.com/NetworkManager/NetworkManager/pull/78
2018-03-20 15:19:21 +01:00
Thomas Haller
c5457fcadb settings: invalidate pointers for debugging use of outdated connections_cached_list
connections_cached_list stays only valid until we remove/add connections
to NMSettings. Using the list without cloning requires to be aware of that.

When clearing the list, invalidate all pointers, in the hope that a following
use-after-free will blow up with an assertion.

We only do this in elevated assertion mode. It's not to prevent any bugs,
it's to better notice it.
2018-03-20 15:08:18 +01:00
Thomas Haller
e17cd1d742 core: avoid clone of all-connections list for nm_utils_complete_generic()
NMSettings exposes a cached list of all connection. We don't need
to clone it. Note that this is not save against concurrent modification,
meaning, add/remove of connections in NMSettings will invalidate the
list.

However, it wasn't save against that previously either, because
altough we cloned the container (GSList), we didn't take an additional
reference to the elements.

This is purely a performance optimization, we don't need to clone the
list. Also, since the original list is of type "NMConnection *const*",
use that type insistently, instead of dependent API requiring GSList.

IMO, GSList is anyway not a very nice API for many use cases because
it requires an additional slice allocation for each element. It's
slower, and often less convenient to use.
2018-03-20 15:08:18 +01:00
Thomas Haller
f063ab41e9 core: don't sort connection list for nm_utils_complete_generic()
We create the all_connections list in impl_manager_add_and_activate_connection().
With this list we either call nm_utils_complete_generic() directly,
or pass it to nm_device_complete_connection(). The latter also ends
up only calling nm_utils_complete_generic() with this argument.

nm_utils_complete_generic() doesn't care about the order in which
the connections are returned. Which also becomes apparent, because
we first sorted the list, and then reverted the order with
g_slist_prepend().

Do not sort the list, hence we also don't need to clone it.
2018-03-20 15:08:18 +01:00
Thomas Haller
1d5a76140d core: cleanup of nm_utils_complete_generic()
Also, endlessly try searching for a unused name. Why limit it
arbitrarily to 10000 or 500? Just try, eventually we will find
a match.
2018-03-20 15:08:18 +01:00
Thomas Haller
14adbc692a ofono: fix crash during complete-connection for Ofono modem
nm_modem_complete_connection() cannot just return FALSE in case
the modem doesn't overwrite complete_connection(). It must set
the error variable.

This leads to a crash when calling AddAndActivate for Ofono type
modem. It does not affect the ModemManager implementation
NMModemBroadband, because that one implements the method.
2018-03-20 15:08:18 +01:00
Thomas Haller
af97b9a41e device: minor cleanup of nm_device_complete_connection() and add code comment
Regarding the cleanup: remove the success variable and instead error
out early.
2018-03-20 15:08:18 +01:00
Thomas Haller
f7b2ebc87a shared: fix typecheck in NM_PTRARRAY_LEN()
Previously, NM_PTRARRAY_LEN() would not work if the pointer type is
an opaque type, which is common. For example:

  NMConnection *const*connections = ...;
2018-03-20 15:08:18 +01:00
Thomas Haller
39ab38a04d core/platform: add support for TUN/TAP netlink support and various cleanup
Kernel recently got support for exposing TUN/TAP information on netlink
[1], [2], [3]. Add support for it to the platform cache.

The advantage of using netlink is that querying sysctl bypasses the
order of events of the netlink socket. It is out of sync and racy. For
example, platform cache might still think that a tun device exists, but
a subsequent lookup at sysfs might fail because the device was deleted
in the meantime. Another point is, that we don't get change
notifications via sysctl and that it requires various extra syscalls
to read the device information. If the tun information is present on
netlink, put it into the cache. This bypasses checking sysctl while
we keep looking at sysctl for backward compatibility until we require
support from kernel.

Notes:

- we had two link types NM_LINK_TYPE_TAP and NM_LINK_TYPE_TUN. This
  deviates from the model of how kernel treats TUN/TAP devices, which
  makes it more complicated. The link type of a NMPlatformLink instance
  should match what kernel thinks about the device. Point in case,
  when parsing RTM_NETLINK messages, we very early need to determine
  the link type (_linktype_get_type()). However, to determine the
  type of a TUN/TAP at that point, we need to look into nested
  netlink attributes which in turn depend on the type (IFLA_INFO_KIND
  and IFLA_INFO_DATA), or even worse, we would need to look into
  sysctl for older kernel vesions. Now, the TUN/TAP type is a property
  of the link type NM_LINK_TYPE_TUN, instead of determining two
  different link types.

- various parts of the API (both kernel's sysctl vs. netlink) and
  NMDeviceTun vs. NMSettingTun disagree whether the PI is positive
  (NM_SETTING_TUN_PI, IFLA_TUN_PI, NMPlatformLnkTun.pi) or inverted
  (NM_DEVICE_TUN_NO_PI, IFF_NO_PI). There is no consistent way,
  but prefer the positive form for internal API at NMPlatformLnkTun.pi.

- previously NMDeviceTun.mode could not change after initializing
  the object. Allow for that to happen, because forcing some properties
  that are reported by kernel to not change is wrong, in case they
  might change. Of course, in practice kernel doesn't allow the device
  to ever change its type, but the type property of the NMDeviceTun
  should not make that assumption, because, if it actually changes, what
  would it mean?

- note that as of now, new netlink API is not yet merged to mainline Linus
  tree. Shortcut _parse_lnk_tun() to not accidentally use unstable API
  for now.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1277457
[2] https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=1ec010e705934c8acbe7dbf31afc81e60e3d828b
[3] https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=118eda77d6602616bc523a17ee45171e879d1818

https://bugzilla.redhat.com/show_bug.cgi?id=1547213
https://github.com/NetworkManager/NetworkManager/pull/77
2018-03-20 11:59:52 +01:00
Beniamino Galvani
e09ffb0c81 ifcfg-rh: preserve NULL wifi mode when persisting a connection
The wireless mode property can be unset (NULL), in which case it
assumed to be equivalent to "infrastructure". If we convert an unset
mode to infrastructure, the connection will change on write,
triggering errors like:

 settings-connection[...]: write: successfully updated (ifcfg-rh: persist (null)), connection was modified in the process
 device (wlp4s0): Activation: (wifi) access point 'test1' has security, but secrets are required.
 device (wlp4s0): state change: config -> need-auth (reason 'none', sys-iface-state: 'managed')
 device (wlp4s0): The connection was modified since activation
 device (wlp4s0): state change: need-auth -> failed (reason 'no-secrets', sys-iface-state: 'managed')

To fix this, remove the MODE key when the mode is unset so that the
property is read back exactly as it was. Note that initscripts need
the MODE set, but in most cases there are other issues that make Wi-Fi
connection written by NM not compatible with initscripts.

https://bugzilla.redhat.com/show_bug.cgi?id=1549972
2018-03-20 09:32:20 +01:00
Bastien Nocera
497a18aee9 build: Remove GLIB_GENMARSHAL check
It's unused.

https://bugzilla.gnome.org/show_bug.cgi?id=794294
2018-03-19 16:23:11 +01:00
Yuri Chornoivan
64cb0f5cfb po: update Ukrainian (uk) translation (bgo#794443)
https://bugzilla.gnome.org/show_bug.cgi?id=794443
2018-03-19 16:17:51 +01:00
Thomas Haller
63ca07f492 shared: add nm_clear_pointer() and implement existing nm_clear_*() based on it
Add an alternative to g_clear_pointer(). The differences are:

  - nm_clear_pointer() is more type safe as it does not cast neither the
    pointer nor the destroy function. Commonly, the types should be compatible
    and not requiring a cast. Casting in the macro eliminates some of the
    compilers type checking. For example, while
       g_clear_pointer (&priv->hash_table, g_ptr_array_unref);
    compiles, nm_clear_pointer() would prevent such an invalid use.

  - also, clear the destination pointer *before* invoking the destroy
    function. Destroy might emit signals (like weak-pointer callbacks
    of GArray clear functions). Clear the destination first, so that
    we don't leave a dangling pointer there.

  - return TRUE/FALSE depending on whether there was a pointer to clear.

I tested that redefining g_clear_pointer()/g_clear_object() with our
more typesafe nm_* variants still compiles and indicates no bugs. So
that is good. It's not really expected that turning on more static checks
would yield a large number of bugs, because generally our code is in a good
shape already. We have few such bugs, because we already turn all all warnings
and extra checks that make sense. That however is not an argument for
not introducing (and using) a more resticted implementation.
2018-03-19 15:51:17 +01:00
Thomas Haller
4cbe3eaaca shared: clear destination pointer in nm_clear_*() functions first
It's slightly more correct to first clear the pointer location
before invoking the destroy function. The destroy function might
emit other callbacks, and at a certain point the pointer becomes
dangling. Avoid this danling pointer, by first clearing the
memory, and then destroing the instance.
2018-03-19 15:50:15 +01:00
Thomas Haller
f0442a47ed all: avoid calling g_free on a const pointer with g_clear_pointer()
With g_clear_pointer(pptr, g_free), pptr is cast to a non-const pointer,
and hence there is no compiler warning about calling g_free() in a const
pointer. However, it still feels ugly to pass a const pointer to
g_clear_pointer(). We should either add an explicity cast, or just
make the pointer non-const.

I guess part of the problem is that C's "const char *" means that the
string itself is immutable, but also that it cannot be freed. We most
often want a different semantic: the string itself is immutable after
being initialized once, but the memory itself can and will be freed.
Such a notion of immutable C strings cannot be expressed.

For that, just remove the "const" from the declarations. Although we
don't want to modify the (content of the) string, it's still more a
mutable string.

Only in _vt_cmd_obj_copy_lnk_vlan(), add an explicity cast but keep the
type as const. The reason is, that we really want that NMPObject
instances are immutable (in the sense that they don't modify while
existing), but that doesn't mean the memory cannot be freed.
2018-03-19 15:45:46 +01:00
Thomas Haller
9545a8bc34 all: don't explicitly cast destroy function for g_clear_pointer()
The g_clear_pointer() macro already contains a cast to GDestroyNotify. No
need to do it ourself. In fact, with the cast, this only works with the
particular g_clear_pointer() implementation, that first assigns the
destroy function to a local variable.

See-also: https://bugzilla.gnome.org/show_bug.cgi?id=674634#c52
2018-03-19 15:27:08 +01:00
Thomas Haller
9c4919be76 connectivity: merge branch 'th/connectivity-rework' (part 1)
https://github.com/NetworkManager/NetworkManager/pull/70
2018-03-19 14:47:30 +01:00
Thomas Haller
c1054ec8ff connectivity: always build nm-connectivity.c source
We already do conditional build with "#if WITH_CONCHECK".
Get rid of the conditional in the makefile and instead do
conditional compilating inside the source file "nm-connectivity.c".

The advantage is, now if you want to know which parts are build,
you only need to grep for the WITH_CONCHECK preprocessor define
instead of also caring about the conditional in Makefile.am and
meson.build.

It doesn't change the fact of conditional compilation. But it
consistently uses one mechanism to achieve it.
2018-03-19 14:46:55 +01:00
Thomas Haller
2012b49219 connectivity/trivial: move code
nm_connectivity_state_to_string() is entirely independent of the GObject implementation
of NMConnectivity. Move it to the beginning of the source file. It will be useful next
because we will *always* build "nm-connectivity.c" source file, but disable various
parts with #if. Hence, move the part that should always be build to the top.
2018-03-19 14:46:55 +01:00
Thomas Haller
89ccfa8dde connectivity: fix evaluating @what argument of CURLMOPT_SOCKETFUNCTION
It's not a bitfields, it's documented to be an enum with 4
possible values.
2018-03-19 14:46:55 +01:00
Thomas Haller
bfe60cb7b9 connectivity: fix timeout handling for curl
g_timeout_add() expects the timeout in milliseconds, not seconds.

Reported-by: Serban Iorga <serban300@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=794464

Fixes: 7307dea9c4
2018-03-19 14:46:23 +01:00
Thomas Haller
b680d118ee connectivity: fix integer type for signal-id NMDevicePrivate.concheck_periodic_id 2018-03-19 14:39:09 +01:00
Thomas Haller
265ae98fef core/trivial: rename internal structure 2018-03-19 14:39:09 +01:00
Thomas Haller
1bba43432a core/trivial: move code 2018-03-19 14:39:09 +01:00
Lubomir Rintel
b686dd8488 session-monitor: fix a -Wcast-function-type warning
See-Also: ee916a1e9e
2018-03-19 13:05:31 +01:00
Thomas Haller
5cd9340f83 dbus: disable all but EXTERNAL D-Bus authentication for private sockets
We use a private D-Bus socket for example for DHCP clients to report back
at unix:path=/var/run/NetworkManager/private-dhcp.

By default, gdbus will enable the authentication mechanisms EXTERNAL
and DBUS_COOKIE_SHA1. However, DBUS_COOKIE_SHA1 requires a /root/.dbus-keyrings
directory, which is not available to NetworkManager as it is started with
ProtectHome=read-only. And writing to /root would be a bad idea anyway.

This leads to a warning

  NetworkManager[10962]: Error adding entry to keyring: Error creating directory “/root/.dbus-keyrings”: Read-only file system

Disable all but the EXTERNAL mechanism.

See-also: https://dbus.freedesktop.org/doc/dbus-specification.html#auth-mechanisms

https://bugzilla.gnome.org/show_bug.cgi?id=793116
https://github.com/NetworkManager/NetworkManager/pull/79
2018-03-19 11:26:15 +01:00
Dan Williams
4b24f42e5e docs: fix VPN chapter ID 2018-03-16 12:56:22 -05:00
Beniamino Galvani
32a279ea5f dhcp: merge branch 'bg/dhcp-client-id-bgo793957'
https://bugzilla.gnome.org/show_bug.cgi?id=793957
2018-03-15 17:27:07 +01:00
Beniamino Galvani
0e4b33ee75 dhclient: write client-id with backslash and quotes as hex 2018-03-15 17:25:27 +01:00
Beniamino Galvani
8ffa22d10d dhcp: dhclient: set type 0 for printable client IDs
The documentation for the ipv4.dhcp-client-id property says:

 If the property is not a hex string it is considered as a
 non-hardware-address client ID and the 'type' field is set to 0.

However, currently we set the client-id without the leading zero byte
in the dhclient configuration and thus dhclient sends the first string
character as type and the remainder as client-id content. Looking
through git history, the dhclient plugin has always behaved this way
even if the intent was clearly that string client-id had to be zero
padded (this is evident by looking at
nm_dhcp_utils_client_id_string_to_bytes()). The internal plugin
instead sends the correct client-id with zero type.

Change the dhclient plugin to honor the documented behavior and add
the leading zero byte when the client-id is a string.

This commit introduces a change in behavior for users that have
dhcp=dhclient and have a plain string (not hexadecimal) set in
ipv4.dhcp-client-id, as NM will send a different client-id possibly
changing the IP address returned by the server.

https://bugzilla.gnome.org/show_bug.cgi?id=793957
2018-03-15 17:25:27 +01:00
Thomas Haller
b6059158b5 release: bump version to 1.11.2 (development) 2018-03-15 17:14:20 +01:00
Thomas Haller
059d34a27f arping/tests: better handle wait timeout for test IPv4 DAD
The test tries to do IPv4 DAD. That necessarily involves waiting
for a timeout. Since the NMArpingManager spawns arping processes,
the precise timings depend on the load of the machine and may be
large in some cases.

Usually, our test would run fast to successful completion.
However, sometimes, it can take several hundered milliseconds.

Instead of increasing the timeout to a large value (which would
needlessly extend the run time of our tests in the common cases),
try first with a reasonably short timeout. A timeout which commonly
results in success. If the test with the short timeout fails, just
try again with an excessively large timeout.

This saves about 400 msec for the common case, but extends the
races that we saw where not even 250 msec of wait time were
sufficient.
2018-03-15 11:24:08 +01:00
Stas Solovey
371af1f8b9 po: updated Russian (ru) translation (bgo #794338)
https://bugzilla.gnome.org/show_bug.cgi?id=794338
2018-03-15 08:28:17 +01:00
Alan Jenkins
167e42a87e systemd: make enablement of n-m-wait-online.service follow n-m.service
This is the approach used by systemd-networkd.

I don't understand the logic that caused systemd-networkd to make the change -
9e49656037

Instead, I am suggesting it for consistency, and because it seems to me this is the
exact correct behaviour. Because if you enable NetworkManager, and rely on it to
configure your network devices, then network mounts will not start correctly at boot
time unless you also enable NetworkManager-wait-online.service.

Enabling NetworkManager-wait-online.service does not cause unnecessary serialization
of the boot process; it is only pulled in if something else (like a network mount)
pulls in network-online.target.

I am suggesting this in response to reading this user support request [1].

[1] https://unix.stackexchange.com/questions/429604/fstab-not-automatically-mounting-smb-storage

[thaller@redhat.com: reworded commit message]

https://github.com/NetworkManager/NetworkManager/pull/76
2018-03-14 10:24:45 +01:00
Beniamino Galvani
17009ed91d dhcp: handle expiry by letting the client continue for some time
Previously we would kill the client when the lease expired and we
restarted it 3 times at 2 minutes intervals before failing the
connection. If the client is killed after it received a NACK from the
server, it doesn't have the chance to delete the lease file and the
next time it is started it will request the same lease again.

Also, the previous restart logic is a bit convoluted.

Since clients already know how to deal with NACKs, let them continue
for a grace period after the expiry. When the grace period ends, we
fail the method and this can either fail the whole connection or keep
it active depending on the may-fail configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=783391
2018-03-13 15:11:08 +01:00
Thomas Haller
57ab9fd60f core/dbus: rework creating numbered D-Bus export path by putting counter into class
I dislike the static hash table to cache the integer counter for
numbered paths. Let's instead cache the counter at the class instance
itself -- since the class contains the information how the export
path should be exported.

However, we cannot use a plain integer field inside the class structure,
because the class is copied between derived classes. For example,
NMDeviceEthernet and NMDeviceBridge both get a copy of the NMDeviceClass
instance. Hence, the class doesn't contain the counter directly, but
a pointer to one counter that can be shared between sibling classes.
2018-03-13 11:29:18 +01:00
Thomas Haller
1e535789cf core/dbus: merge branch 'th/dbus'
https://github.com/NetworkManager/NetworkManager/pull/74
2018-03-12 18:37:24 +01:00
Thomas Haller
297d4985ab core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API
Previously, we used the generated GDBusInterfaceSkeleton types and glued
them via the NMExportedObject base class to our NM types. We also used
GDBusObjectManagerServer.

Don't do that anymore. The resulting code was more complicated despite (or
because?) using generated classes. It was hard to understand, complex, had
ordering-issues, and had a runtime and memory overhead.

This patch refactors this entirely and uses the lower layer API GDBusConnection
directly. It replaces the generated code, GDBusInterfaceSkeleton, and
GDBusObjectManagerServer. All this is now done by NMDbusObject and NMDBusManager
and static descriptor instances of type GDBusInterfaceInfo.

This adds a net plus of more then 1300 lines of hand written code. I claim
that this implementation is easier to understand. Note that previously we
also required extensive and complex glue code to bind our objects to the
generated skeleton objects. Instead, now glue our objects directly to
GDBusConnection. The result is more immediate and gets rid of layers of
code in between.
Now that the D-Bus glue us more under our control, we can address issus and
bottlenecks better, instead of adding code to bend the generated skeletons
to our needs.

Note that the current implementation now only supports one D-Bus connection.
That was effectively the case already, although there were places (and still are)
where the code pretends it could also support connections from a private socket.
We dropped private socket support mainly because it was unused, untested and
buggy, but also because GDBusObjectManagerServer could not export the same
objects on multiple connections. Now, it would be rather straight forward to
fix that and re-introduce ObjectManager on each private connection. But this
commit doesn't do that yet, and the new code intentionally supports only one
D-Bus connection.
Also, the D-Bus startup was simplified. There is no retry, either nm_dbus_manager_start()
succeeds, or it detects the initrd case. In the initrd case, bus manager never tries to
connect to D-Bus. Since the initrd scenario is not yet used/tested, this is good enough
for the moment. It could be easily extended later, for example with polling whether the
system bus appears (like was done previously). Also, restart of D-Bus daemon isn't
supported either -- just like before.

Note how NMDBusManager now implements the ObjectManager D-Bus interface
directly.

Also, this fixes race issues in the server, by no longer delaying
PropertiesChanged signals. NMExportedObject would collect changed
properties and send the signal out in idle_emit_properties_changed()
on idle. This messes up the ordering of change events w.r.t. other
signals and events on the bus. Note that not only NMExportedObject
messed up the ordering. Also the generated code would hook into
notify() and process change events in and idle handle, exhibiting the
same ordering issue too.
No longer do that. PropertiesChanged signals will be sent right away
by hooking into dispatch_properties_changed(). This means, changing
a property in quick succession will no longer be combined and is
guaranteed to emit signals for each individual state. Quite possibly
we emit now more PropertiesChanged signals then before.
However, we are now able to group a set of changes by using standard
g_object_freeze_notify()/g_object_thaw_notify(). We probably should
make more use of that.

Also, now that our signals are all handled in the right order, we
might find places where we still emit them in the wrong order. But that
is then due to the order in which our GObjects emit signals, not due
to an ill behavior of the D-Bus glue. Possibly we need to identify
such ordering issues and fix them.

Numbers (for contrib/rpm --without debug on x86_64):

- the patch changes the code size of NetworkManager by
  - 2809360 bytes
  + 2537528 bytes (-9.7%)

- Runtime measurements are harder because there is a large variance
  during testing. In other words, the numbers are not reproducible.
  Currently, the implementation performs no caching of GVariants at all,
  but it would be rather simple to add it, if that turns out to be
  useful.
  Anyway, without strong claim, it seems that the new form tends to
  perform slightly better. That would be no surprise.

  $ time (for i in {1..1000}; do nmcli >/dev/null || break; echo -n .;  done)
  - real    1m39.355s
  + real    1m37.432s

  $ time (for i in {1..2000}; do busctl call org.freedesktop.NetworkManager /org/freedesktop org.freedesktop.DBus.ObjectManager GetManagedObjects > /dev/null || break; echo -n .; done)
  - real    0m26.843s
  + real    0m25.281s

- Regarding RSS size, just looking at the processes in similar
  conditions, doesn't give a large difference. On my system they
  consume about 19MB RSS. It seems that the new version has a
  slightly smaller RSS size.
  - 19356 RSS
  + 18660 RSS
2018-03-12 18:37:08 +01:00
Thomas Haller
a1f37964f0 core: rename "nm-bus-manager.h" to "nm-dbus-manager.h"
The next commit will completely rework NMBusManager and replace
NMExportedObject by a new type NMDBusObject.

Originally, NMDBusObject was added along NMExportedObject to ease
the rework and have compilable, intermediate stages of refactoring. Now,
I think the new name is better, because NMDBusObject is very strongly related
to the bus manager and the old name NMExportedObject didn't make that
clear.

I also slighly prefer the name NMDBusObject over NMBusObject, hence
for consistancy, also rename NMBusManager to NMDBusManager.

This commit only renames the file for a nicer diff in the next commit.
It does not actually update the type name in sources. That will be done
later.
2018-03-12 18:03:07 +01:00
Thomas Haller
8b75f10ebe device: set properties before emitting the change notification
The change doesn't really make a difference. I thought it would, so I
did it. But turns out (as the code correctly assumes), while the
notifications are frozen, it's OK to leave the property still in an
inconsistent state while emitting the notify signal.

Still, it feels slightly more correct this way, so keep the change.
2018-03-12 18:03:07 +01:00
Thomas Haller
34493c5134 device/veth: don't use notify() signal to bind changes for "peer" property
The notify() signal is not emitted while the object properties are
blocked via g_object_freeze_notify(). That makes is unsuitable to
emit a notification for "peer" property whenver the device's "parent"
property changes. Because especially with freeze/thaw, we want to emit
both signals in the same batch, not first emit change signals for "parent",
and then in a second run the signals for "peer".

Use the existing parent_changed_notify() virtual function instead.
2018-03-12 18:03:07 +01:00
Thomas Haller
062f86d88e secret-agent: don't use generated NMDBusSecretAgent proxy
The generated code is really just a thin wrapper around direct
GDBusProxy calls. GDBusProxy is reasonably convenient to use directly,
drop this wrapper.

We also don't use a generated wrapper for other cases where
NetworkManager acts as a D-Bus client. There is no reason to
do it in this case.

While the nmdbus_*() functions that we were using are small wrappers,
we also created a NMDBusSecretAgent instance, and hence several other
functions and symbols are used as well. It's unnecessary.

This saves 8552 bytes for NetworkManager binary (2817944 vs. 2809392
bytes for contrib/rpm on x86_64).
2018-03-12 18:02:20 +01:00
Thomas Haller
39db757e44 shared: don't validate type-string in G_VARIANT_TYPE() cast macro in production code 2018-03-12 17:44:35 +01:00
Thomas Haller
b0b5cfb7f2 shared: add nm_g_variant_unref_floating() helper 2018-03-10 16:49:30 +01:00
Thomas Haller
14ffe6bc55 dbus: extend NM_DEFINE_GDBUS*() helper macros 2018-03-10 16:49:30 +01:00
Thomas Haller
70b24819a0 dns: don't leak cached config_variant on exit
Not really serious as it's only on shutdown, but shows up as leak in valgrind.
2018-03-10 16:49:30 +01:00
Thomas Haller
0b756184eb manager: fix leaking volatile-connection-list on exit
On exit during NMManager's dispose(), we must fist remove active connections
via active_connection_remove(), before clearing the volatile-connection-list.
Otheriwise, while deleting the active connection, we schedule a idle action
to delete the volatile connection on idle, but at that point the dispose()
already cleaned up the idle list.

  ==3150== 72 (24 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 3,411 of 6,079
  ==3150==    at 0x4C2FB6B: malloc (vg_replace_malloc.c:299)
  ==3150==    by 0x6AB7358: g_malloc (gmem.c:94)
  ==3150==    by 0x6ACEF35: g_slice_alloc (gslice.c:1025)
  ==3150==    by 0x1686B1: connection_flags_changed (nm-manager.c:1823)
  ==3150==    by 0x661F73C: g_closure_invoke (gclosure.c:804)
  ==3150==    by 0x66324DD: signal_emit_unlocked_R (gsignal.c:3635)
  ==3150==    by 0x663AD04: g_signal_emit_valist (gsignal.c:3391)
  ==3150==    by 0x663B66E: g_signal_emit (gsignal.c:3447)
  ==3150==    by 0x2EC753: connection_flags_changed (nm-settings.c:824)
  ==3150==    by 0x661F73C: g_closure_invoke (gclosure.c:804)
  ==3150==    by 0x66324DD: signal_emit_unlocked_R (gsignal.c:3635)
  ==3150==    by 0x663AD04: g_signal_emit_valist (gsignal.c:3391)
  ==3150==    by 0x663B66E: g_signal_emit (gsignal.c:3447)
  ==3150==    by 0x6623C03: g_object_dispatch_properties_changed (gobject.c:1080)
  ==3150==    by 0x1DFD47: dispatch_properties_changed (nm-dbus-object.c:237)
  ==3150==    by 0x6626178: g_object_notify_by_spec_internal (gobject.c:1173)
  ==3150==    by 0x6626178: g_object_notify_by_pspec (gobject.c:1283)
  ==3150==    by 0x2E7377: _notify (nm-settings-connection.c:53)
  ==3150==    by 0x2E7377: nm_settings_connection_set_flags_full (nm-settings-connection.c:2346)
  ==3150==    by 0x2E744D: nm_settings_connection_set_flags (nm-settings-connection.c:2316)
  ==3150==    by 0x2E7466: set_visible (nm-settings-connection.c:316)
  ==3150==    by 0x2E7774: nm_settings_connection_delete (nm-settings-connection.c:795)
  ==3150==    by 0x1665A8: _delete_volatile_connection_do (nm-manager.c:598)
  ==3150==    by 0x1668F4: active_connection_remove (nm-manager.c:625)
  ==3150==    by 0x16ABA7: dispose (nm-manager.c:6726)
  ==3150==    by 0x6624607: g_object_unref (gobject.c:3293)
  ==3150==    by 0x1D779B: _nm_singleton_instance_destroy (nm-core-utils.c:138)
  ==3150==    by 0x4011332: _dl_fini (in /usr/lib64/ld-2.26.so)
  ==3150==    by 0x815FB57: __run_exit_handlers (in /usr/lib64/libc-2.26.so)
  ==3150==    by 0x815FBA9: exit (in /usr/lib64/libc-2.26.so)
  ==3150==    by 0x1383C7: main (main.c:467)
2018-03-10 16:18:29 +01:00
Beniamino Galvani
6a54f4279f platform: merge branch 'bg/extack-bgo793261'
https://bugzilla.gnome.org/show_bug.cgi?id=793261
2018-03-09 17:52:54 +01:00
Thomas Haller
e81224824a platform: pre-increment netlink sequence number and add comment
Pre-increment. That allows to not explicitly initialize nlh_seq_next
in nm_linux_platform_init().
2018-03-09 17:52:43 +01:00