Commit graph

6641 commits

Author SHA1 Message Date
Thomas Haller
bf6187e030 core/test: extend timeout for kill-process utils test
On slow virtual machine, these tests could fail because the
timeout was too low. As in a successful run the timeouts should
not be reached anyway, just extend them.
2015-09-04 20:53:03 +02:00
Thomas Haller
39de56844e config: fix wrong signature of class-method config_changed() for signal
Actually, just drop it. It's unused anyway.
2015-09-04 16:34:10 +02:00
Thomas Haller
18d2825ceb dns: unify some logging statements for dns-manager
In update_dns(), prefix the logging lines with "update-dns:".
In init_resolv_conf_mode(), explicitly log the selected mode.
2015-09-04 14:25:23 +02:00
Thomas Haller
ed7198ad99 dns: fix logging in nm_dns_manager_end_updates() 2015-09-04 13:45:13 +02:00
Thomas Haller
de4357d9f4 dns: use _LOG*() macros in "nm-dns-manager.c" 2015-09-04 13:45:13 +02:00
Thomas Haller
9dbc63ac71 dns: add _LOG*() macros to "nm-dns-manager.c" 2015-09-04 13:45:13 +02:00
Thomas Haller
1d06000696 dns/trivial: rename @mgr variable to @self 2015-09-04 13:45:13 +02:00
Lubomir Rintel
f71f9d5fcf tests: fix 32-bit build
Fixes: 874f455d6d
2015-09-04 12:49:54 +02:00
Lubomir Rintel
874f455d6d test: fix duplicate test names
New glib complains.
2015-09-04 12:08:40 +02:00
Thomas Haller
7b70a8405e platform/trivial: add code-comment dividers between different sections of the source file 2015-09-04 11:50:49 +02:00
Thomas Haller
b10210a744 rdisc: refactor logging and use common _LOGD() macro 2015-09-04 11:06:26 +02:00
Thomas Haller
edadef563f platform/test: introduce _LOGD() macros to fake platform and platform tests 2015-09-04 11:06:26 +02:00
Thomas Haller
6bb26f8680 platform: get rid of old logging macros
The naming of these logging macros is unexpected, as we use such
macros only here in platform.

For these messages we cannot use the default _LOGD() set of macros,
because there is no @platform instance around. So let's introduce an
alternative set of logging macros (_LOG2D(), etc) and use it.
2015-09-04 11:06:26 +02:00
Thomas Haller
ed5ebf7e74 logging: introduce an alternative set of logging macros
We already have the macros _LOGD(), _LOGI(), etc. to provide context sensitive
logging (such as printing the object pointer as prefix).

In some implementations, we would like to have a second set of logging
macros, that shall be used differently. For example, use the default
_LOGD() for messages that are explicitly issued by one objects, and use
_LOG2D() in a static context when no object is around.

The "_LOG2" prefix is not great from a naming point of view. However, it is
meant to be a second (alternative) set of logging macros with the same
usage pattern as the _LOGD() macros.
2015-09-04 11:06:26 +02:00
Thomas Haller
d47daeb4d9 platform: use _LOG*() macros instead of duplicated macros
Use the common logging macros _LOGD(), etc. instead of calling
nm_log_*() directly or the non-standard macros debug(), info(), etc.
2015-09-04 11:06:26 +02:00
Thomas Haller
084aec79df platform: refactor setup_socket() to accept explicit platform argument
Also, use _LOGW() in verify_source()
2015-09-04 11:06:26 +02:00
Thomas Haller
ffb931ca5c platform: refactor logging for sysctl functions
Use the standard _LOG*() macros and make the static cache
@sysctl_get_prev_values per instance.
2015-09-04 11:06:26 +02:00
Thomas Haller
4e461dab48 build: exclude private headers for mkenums and nm-enum-types.c 2015-09-04 11:06:26 +02:00
Jiří Klimeš
54019a403a device: give the default wired profiles the lowest autoconnect-priority
Later when other connections are created, they will be preferred over the
default one.

https://bugzilla.redhat.com/show_bug.cgi?id=1075148#c15
2015-09-04 09:53:59 +02:00
Beniamino Galvani
b3b0b46250 device: retry creation of default connection after link is initialized
When a new link is detected, NM tries to generate a default "Wired
connection" in nm_settings_device_added(), but if the link has not
been initialized by udev yet the function returns early because
priv->unmanaged_flags = UNMANAGED_PLATFORM_INIT.

To be sure that a default connection is created is such situation, we
need to call again nm_settings_device_added() after link
initialization.

https://bugzilla.redhat.com/show_bug.cgi?id=1254089
2015-09-03 17:59:51 +02:00
Thomas Haller
158b32b7e0 settings: fix memleak in agent_secrets_done_cb()
Fixes: df6706813a
2015-09-02 17:20:11 +02:00
Dan Williams
f67b5deba3 ppp: remove unused vestige of dbus-glib 2015-08-31 09:38:18 -05:00
Thomas Haller
a922d5e587 platform: assert to successfully dlopen libnl3 2015-08-27 19:28:52 +02:00
Lubomir Rintel
2f4ba5f2bc platform: remove bogus asserts
You can't really compare a symbol resolved by ld.so to dlsym()'d one. The
former one is likely just an address of trampoline in PLT.
2015-08-27 19:28:44 +02:00
Lubomir Rintel
82031add33 dbus: allow talking to more plugins in DBus policy
These two has been seen in the wild.
Libreswan is the RHEL's openswan fork.
2015-08-27 15:11:52 +02:00
Jiří Klimeš
feb5b5538a ifcfg-rh: save wired properties also for bond/team (rh #1255927)
Without that MTU is not saved to ifcfg file for bond and team and thus it is
lost over NetworkManager restart.

https://bugzilla.redhat.com/show_bug.cgi?id=1255927
2015-08-27 10:22:00 +02:00
Jiří Klimeš
7d3a4178a5 team: allow overriding the MTU for team device (rh #1255927)
Set the MTU if 802-3-ethernet.mtu is present and non-zero. The ifcfg-rh writer
sets it if there's a MTU key.

The same change as for bond in commit a169a79a7d.

https://bugzilla.redhat.com/show_bug.cgi?id=1255927
2015-08-27 10:22:00 +02:00
Beniamino Galvani
905220b337 device: fix clearing of dhcp6_restart_id in dhcp6_cleanup()
Fixes: abc96ecdfd
2015-08-26 11:46:26 +02:00
Beniamino Galvani
abc96ecdfd device: don't disconnect after DHCP failure when there are static IPs
Don't disconnect the device when the DHCP renewal fails and there are
already configured static IP addresses on the device. Instead, keep
the device up and try DHCP again after some time.

https://bugzilla.redhat.com/show_bug.cgi?id=1168388
2015-08-26 10:48:49 +02:00
Jiří Klimeš
7edb53f660 core: don't set "startup complete" until devices have been added (rh #1256772)
check_if_startup_complete() could be invoked from nm_settings_start() before
devices had chance to be added, which results in premature "startup complete"
and NM would quit when configure-and-quit=yes is set up.
Postpone actual check_if_startup_complete() resolution until we add all devices
and they are processed.

 (gdb) bt
 #0  0x00005555556401f3 in check_if_startup_complete (self=0x5555559f91d0)
     at nm-manager.c:719
 #1  0x00007ffff4d69de8 in g_closure_invoke () at /lib64/libgobject-2.0.so.0
 #2  0x00007ffff4d7b70d in signal_emit_unlocked_R ()
     at /lib64/libgobject-2.0.so.0
 #3  0x00007ffff4d83471 in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
 #4  0x00007ffff4d8372f in g_signal_emit () at /lib64/libgobject-2.0.so.0
 #5  0x00007ffff4d6e4b5 in g_object_dispatch_properties_changed ()
     at /lib64/libgobject-2.0.so.0
 #6  0x00007ffff4d709d9 in g_object_notify () at /lib64/libgobject-2.0.so.0
 #7  0x00005555556e232c in check_startup_complete (self=self@entry=0x555555a0e130) at settings/nm-settings.c:204
 #8  0x00005555556e5203 in nm_settings_start (self=0x555555a0e130, error=error@entry=0x7fffffffe658) at settings/nm-settings.c:2122
 #9  0x0000555555646d06 in nm_manager_start (self=0x5555559f91d0, error=0x7fffffffe658) at nm-manager.c:4153
 #10 0x00005555555add43 in main (argc=1, argv=0x7fffffffe7c8) at main.c:428
 (gdb)

Fixes:Beaker:NetworkManager_Test37_run_once_new_connection

https://bugzilla.redhat.com/show_bug.cgi?id=1256772
2015-08-26 09:47:47 +02:00
Thomas Haller
790a0713d2 platform: handle parent interfaces in other netns
The parent of a link (IFLA_LINK) can be in another network namespace and
thus invisible to NM.

This requires the netlink attribute IFLA_LINK_NETNSID which is supported
by recent versions of kernel and libnl.

In this case, set the parent field to NM_PLATFORM_LINK_OTHER_NETNS
and properly handle this special case.
2015-08-25 22:33:14 +02:00
Thomas Haller
31902f8f6b platform: minor refactoring in _nl_get_vtable() 2015-08-25 22:25:23 +02:00
Thomas Haller
677d802be6 platform: minor fix in nm_platform_link_to_string()
This had not real consequences, because @master and @parent are of
the same size.
2015-08-25 22:25:23 +02:00
Thomas Haller
2189c7c75b platform: return const argument from _nl_get_vtable() 2015-08-25 22:25:23 +02:00
Thomas Haller
19ebe51e2e platform: assert we loaded the right libnl library 2015-08-25 22:25:23 +02:00
Thomas Haller
3afa894bfb agent-manager: fix wrong unref in request_remove_agent()
Fixes: 13386f760a
2015-08-25 18:53:39 +02:00
Thomas Haller
13386f760a agent-manager: fix leak of secret-agent 2015-08-25 16:37:44 +02:00
Thomas Haller
9b35d29d06 secret-agent: fix detection of disapearing secret-agent
The signal "notify:g-name-owner" is only emitted for well-known
names, but not for unique connection names (":1.x") such as the secret
agent's connection. Also, it will not be emited for private connections.

That meant that when the client disconnected without explicitly
unregistering, the NMSecretAgent was not cleaned up and leaked
indefinitely.
As only one instance of secret agent with a certain 'identifier/uid'
pair can register, this bug also prevented the client from registering
until restart of NetworkManager.

Fixes: df6706813a
2015-08-25 16:37:44 +02:00
Thomas Haller
214faf4695 agent-manager: refactor logging in agent-manager 2015-08-25 16:37:44 +02:00
Thomas Haller
0b3e021538 secret-agent: add trace logging to secret agent 2015-08-25 16:37:44 +02:00
Thomas Haller
ea14cd45f1 agent-manager: remove @asked field from request
This code was unused, because we never enqueued any hashes
to the @asked list. Note that hashing also might give wrong
hash collisions, so this was buggy anyway.

Also, note that impl_agent_manager_register_with_capabilities()
already ensures that duplicate agents are not registered
in the first place (find_agent_by_identifier_and_uid()).
2015-08-25 16:37:44 +02:00
Thomas Haller
e5c59d1f38 secret-agent: don't assert against existing getpwuid() entry
There is a race and there is no guarantee that getpwuid() can lookup a
uid that (previously) existed. Just accept %NULL as @owner_username.
2015-08-25 16:37:43 +02:00
Thomas Haller
92dda6472c secret-agent: rework handling of asynchronous request and cancelling
Refactor the handling of the asynchronous requests so that now
NMSecretAgent has the following properties:

- The callback will *always* be invoked exactly once (sans crashes).
  Even if you cancel the call or if you dispose NMSecretAgent with
  pending calls. That allows the caller to rely on being called back
  and possibly cleanup the user-data.

- Callbacks are always invoked asynchronously with respect to their
  start-call.

- You can cancel all 3 types of operations, not only the 'GetSecrets'
  call. Note that this will still not cancel the calls 'DeleteSecrets'
  and 'SaveSecrets' on a D-Bus level.
  When cancelling, the callback will be invoked synchronously with
  respect to the cancel call, with an GError indicating the cancellation
  (G_IO_ERROR_CANCELLED).

- During dispose, the callback is also invoked synchronously, with
  some other error reason.

This also fixes a crash where handling of the asynchronous data was
messed up and the priv->requests hash would end up to containing dangling
pointers.

https://bugzilla.redhat.com/show_bug.cgi?id=1253407
2015-08-25 16:37:43 +02:00
Thomas Haller
cf16010fb6 agent-manager: fix checking for D-Bus error after gdbus switch
With gdbus, errors are now properly translated. We must check for
the error domain/code, intead of the dbus-error.

Fixes: df6706813a
2015-08-25 16:37:43 +02:00
Thomas Haller
88e485bc1d secret-agent: refactor call-id to be of an opaque pointer type instead of a void pointer
This gives some type safety.
2015-08-25 16:37:43 +02:00
Thomas Haller
8ed98a381b secret-agent: fix leak of @dbus_owner
The @dbus_owner field was only cleaned up when the
proxy disconnected and leaked otherwise.

Also, don't clear @dbus_owner together with the proxy.
Otherwise, get_description() might yield different results
after the proxy got cleared. That can lead to problems because
NMAgentManager tracks the secrets agents by their "dbus-owner" --
IOW, NMAgentManager uses the "dbus-owner" as identifer for the
secret agent. Thus it must not change.

Fixes: 2a2fd1216b
2015-08-25 16:37:43 +02:00
Beniamino Galvani
913f5d9898 settings: fix memory leak in for_each_secret()
Fixes: df6706813a
2015-08-24 16:15:50 +02:00
Thomas Haller
751c674643 manager: fix race subscribing prop_filter()
prop_filter() gets invoked on another thread and we don't take
a strong reference to the manager when subscribing the filter.

Fix the race, by passing on a weak reference.
2015-08-21 17:26:18 +02:00
Thomas Haller
52ed6a8e5c manager: check for object type in do_set_property_check() 2015-08-21 17:20:46 +02:00
Thomas Haller
c79d6dfc1b manager: don't invoke non-thread-safe operations during prop_filter()
prop_filter() is run on another thread. It cannot make use of
the non-thread-safe object NMBusManager.
2015-08-21 17:20:46 +02:00