Commit Graph

17904 Commits

Author SHA1 Message Date
Thomas Haller
af5b86aa1e policy: log policy's orig_hostname 2017-05-12 17:29:33 +02:00
Thomas Haller
25c5a96da7 policy: drop out argument from _get_hostname()
It serves no purpose, because the function always allocates a new
result and returns it. It would make sense, if the output string
would only be cloned when we need to allocate a new string. But
since that optimization is not done, the argument serves no purpose.
2017-05-12 17:29:33 +02:00
Thomas Haller
f0a229c1e2 policy: namespace fields related to DNS reverse lookup for hostname 2017-05-12 17:29:33 +02:00
Thomas Haller
5819b0de8e policy: add lookup_by_address() function for g_resolver_lookup_by_address_async() 2017-05-12 17:29:33 +02:00
Thomas Haller
9f4a5b85b6 hostname: change logging of hostname-mode
Don't log with level <info>. It's not important enough and only
noise. Also, move the logging line outside of nm_policy_init(). At that
point, the policy instance is not yet initialized (much), so we shouldn't
use the logging macro _LOGD().
2017-05-12 17:29:33 +02:00
Thomas Haller
54f5407abf hostname: cache hostname-manager's hostname property
A property preferably only emits a notify-changed signal when
the value actually changes and it caches the value (so that
between property-changed signals the value is guaranteed not to change).

NMSettings and NMManager both already cache the hostname, because
NMHostnameManager didn't guarantee this basic concept.

Implement it and rely on it from NMSettings and NMPolicy.
And remove the copy of the property from NMManager.

Move the call for nm_dispatcher_call_hostname() from NMHostnameManager
to NMManager. Note that NMPolicy also has a call to the dispatcher
when set-transient-hostname returns. This should be cleaned up later.
2017-05-12 17:29:33 +02:00
Thomas Haller
5bfb7c3c89 hostname: split out hostname management from NMSettings
Hostname management is complicated. At least, how it is implemented currently.
For example, NMPolicy also sets the hostname (NMPolicy calls
nm_settings_set_transient_hostname() to have hostnamed set the hostname,
but then falls back to sethostname() in settings_set_hostname_cb()).
Also, NMManager tracks the hostname in NM_MANAGER_HOSTNAME too, and
NMPolicy listens to changes from there -- instead of changes from
NMSettings.

Eventually, NMHostnameManager should contain the hostname parts from NMSettings
and NMPolicy.
2017-05-12 17:29:33 +02:00
Thomas Haller
f3dfe0f745 ofono: clenaup NMModemOfono's disconnect()
- anticipate missing callback/ctx->result

- always invoke the result callback when given

- fix leaking GVariant in disconnect_done()

- fix crash due to non-initialized ctx->result

- pass cancellable to g_dbus_proxy_call()
2017-05-12 17:29:33 +02:00
Thomas Haller
663dfd7d51 ofono: make asynchrounous operations for context_proxy cancellable
Also,

  - disconnect signal handlers in dispose()

  - fix memleak in stage1_prepare_down()()
2017-05-12 17:29:33 +02:00
Thomas Haller
1e5be78eb9 ofono: make asynchrounous operations for modem_proxy cancellable
Also,

  - chain up the constructed() function

  - fix memleak in modem_get_properties_done()
2017-05-12 17:29:33 +02:00
Thomas Haller
58712c9546 ofono: take D-Bus proxy for ConnectionManager asynchronously
Also,

  - disconnect signals from connman_proxy in dispose()

  - don't take reference to self for GetProperties call
2017-05-12 17:29:33 +02:00
Thomas Haller
b7329fccce ofono: take D-Bus proxy for SimManager asynchronously
Also,

  - fix memleaks in sim_get_properties_done()

  - don't take reference to self for GetProperties call
2017-05-12 17:29:33 +02:00
Thomas Haller
615aa3f077 modem: prettify logging output about available ModemManager/oFono
These lines are logged with <info> level. They should look pleasant.
2017-05-12 17:29:33 +02:00
Thomas Haller
f61b1dadae bt: use logging macros in nm-bluez4-manager.c 2017-05-12 17:29:33 +02:00
Thomas Haller
7d11fe5581 bt: use logging macros in nm-bluez4-adapter.c 2017-05-12 17:29:33 +02:00
Thomas Haller
e68a33d114 bt: create D-Bus proxy for NMBluez4Manager asynchronously
And some fixes:

  - proxy creation may fail. Don't handle it by retrying,
    but at least don't access the invalid proxy instance.

  - quering "DefaultAdapter" did not take a reference to @self
    nor was the operation cancellable. This leads to crash
    if the instance gets destroyed early.
2017-05-12 17:29:33 +02:00
Thomas Haller
44f5e372ce bt: create D-Bus proxy for NMBluez4Adapter asynchronously
And some fixes:

  - proxy creation may fail. Don't handle it by retrying,
    but at least don't access the invalid proxy instance.

  - get_properties_cb() did not take a reference to @self
    nor was the operation cancellable. This leads to crash
    if the instance gets destroyed early.
2017-05-12 17:29:33 +02:00
Thomas Haller
e84a52ea42 bt: track name-owner changes via NMModemManager and create D-Bus proxy asynchronously
Fix two issues of the previous code:

  - the D-Bus proxy for the modem manager should not get created
    synchronously.
  - NMModemManager is a singleton, let it track the name-owner
    change and the D-Bus proxy, instead of having one per NMDeviceBt.
2017-05-12 17:29:33 +02:00
Thomas Haller
7840dde47b bt: minor refactoring of mm_name_owner_changed() function 2017-05-12 17:29:33 +02:00
Thomas Haller
d1ef7f7aac bt: move initialization of NMDeviceBt to constructed()
Don't do non-trivial initialization in nm_device_bt_init(). At
this point, the object is not yet fully created. As we already have
a constructed() implemented, move the initialization there.
2017-05-12 17:29:33 +02:00
Thomas Haller
a087278e8e modem: make NMModemManager a singleton
Singletons are not entirely bad, if used carefully. We will need
the singleton from bluetooth plugin.
2017-05-12 17:29:33 +02:00
Thomas Haller
ce1ae5f458 modem: add define for ModemManager D-Bus path
Also, bluetooth plugin uses NMModem from the wwan plugin. Don't
include such a foreign header in a "nm-device-bt.h". Instead, forward
declare what we need.
2017-05-12 17:29:33 +02:00
Thomas Haller
c257e22cb5 modem: cleanup construction of NMModem
It is invalid that a constructor() returns NULL. These anyway were
only assertions, checking conditions that should never fail.
2017-05-12 17:29:33 +02:00
Thomas Haller
2dbb4d8d2b modem/trivial: move code around 2017-05-12 17:29:33 +02:00
Thomas Haller
4c070639d3 modem/trivial: rename functions in nm-modem-manager.c
Most of the functions are strictly related to ModemManager. Their
name should hint to that, so that they are clearly separated from
the ofono functions and general purpose functions.

Same for data fields.
2017-05-12 17:29:33 +02:00
Thomas Haller
3128a8a4c1 manager: make asynchrounous operations cancellable
It is often wrong to take a reference to keep the instance alive during
the asynchronous request, because it means the instance cannot be
destroyed as long as the (non cancellable) request is bending.

Fix that for NMModemManager and pass a cancallable along.
2017-05-12 17:29:33 +02:00
Thomas Haller
0adc517407 modem: use logging macros in nm-modem-manager.c 2017-05-12 17:29:33 +02:00
Thomas Haller
6334121d6b modem: make use of cleanup attribute to free data in callbacks 2017-05-12 17:29:33 +02:00
Thomas Haller
44f68600e1 modem: use our standard pattern for accessing private data of NMModeManager
Although our type structures have their _priv data embedded,
we don't use it directly. Adjust NMModemManager to follow
that pattern.
2017-05-12 17:29:33 +02:00
Thomas Haller
4efab710e4 travis: enable gcc+clang compiler for travis builds 2017-05-12 14:29:10 +02:00
Thomas Haller
a6c84e2ea0 cli: fix redundant "const const" declaration in nmcli.h
Fixes: bfb9fd0d2f
2017-05-12 14:06:49 +02:00
Thomas Haller
7f8815a9c3 connectivity: avoid compiler warning for argument of curl_easy_getinfo()
libcurl employs some typechecking via "curl/typecheck-gcc.h". When
compling with --enable-lto, compilation fails otherwise with:

    make[2]: Entering directory '/data/src/NetworkManager'
      CC       src/src_libNetworkManager_la-nm-connectivity.lo
      CCLD     src/libNetworkManager.la
      CCLD     src/libNetworkManagerTest.la
      CCLD     src/dhcp/tests/test-dhcp-dhclient
    src/nm-connectivity.c: In function 'curl_check_connectivity':
    src/nm-connectivity.c:147:10: error: call to '_curl_easy_getinfo_err_string' declared with attribute warning: curl_easy_getinfo expects a pointer to char * for this info [-Werror]
       eret = curl_easy_getinfo (msg->easy_handle, CURLINFO_PRIVATE, &cb_data);
              ^
    lto1: all warnings being treated as errors
    lto-wrapper: fatal error: /usr/bin/gcc returned 1 exit status
    compilation terminated.
    /usr/bin/ld: error: lto-wrapper failed
2017-05-12 09:55:46 +02:00
Thomas Haller
348ffdec18 core: fix reading device state file
For manged=unknown, we don't write the value to the
device state keyfile. The results in an empty file,
or at least, a keyfile that doesn't have device.managed
set.

On read, we must treat a missing device.managed flag as
unknown, and not as unmanaged. Otherwise, on restart
a device becomes marked as explicitly unmanaged.

This was broken by commit 142ebb1 "core: only persist explicit managed
state in device's state file", where we started conditionally
to no longer write the managed state.

Reported-by: Michael Biebl <mbiebl@debian.org>
Fixes: 142ebb1037
2017-05-11 19:58:25 +02:00
Thomas Haller
81008c90ac core: cleanup logging reading device-state
- print string value instead of numerical "managed"
- for missing state, print the same format. After all,
  some defaults apply and it is interesting to know what
  they are.
2017-05-11 19:58:10 +02:00
Thomas Haller
3063a5eda3 all: merge branch 'th/c-list'
https://bugzilla.gnome.org/show_bug.cgi?id=782286
2017-05-11 18:52:31 +02:00
Thomas Haller
8894e8c61b proxy: use CList to track configs in NMPacrunnnerManager
- config->removed can be replaced by c_list_is_empty(&config->lst)

- downgrade some assertions to nm_assert(). Even without the
  assert we crash a few lines later with a NULL pointer access.
  That gives almost the same debuggability and discoverability
  of the bug.

- use exact type signature for GAsyncReadyCallback and avoid
  casting.

- when the name owner disappears, cancel all asynchronous
  operations. Note how the new pacrunner instance will anyway
  start without configuration, so for all intended purpose, all
  pending operations are at that moment obsolete.
2017-05-11 18:42:49 +02:00
Thomas Haller
e827925646 agent-manager: use CList to track requests 2017-05-11 18:26:10 +02:00
Thomas Haller
a844b98259 agent-manager/trivial: move code 2017-05-11 18:26:10 +02:00
Thomas Haller
04dfff7db8 secret-agent: use CList to track requests 2017-05-11 18:26:10 +02:00
Thomas Haller
8296de1823 firewall: use CList to track pending_calls 2017-05-11 18:26:10 +02:00
Thomas Haller
e6744bcb65 libnm: fix type for "notify_id" source id in "nm-object.c" 2017-05-11 18:26:10 +02:00
Thomas Haller
d6c1e565ff libnm: remove unused code reload_results and reload_error from "nm-object.c"
Fixes: 1f5b48a59e
2017-05-11 18:26:10 +02:00
Thomas Haller
65b440c9fa libnm: use CList instead of GSList for pending in "nm-object.c" 2017-05-11 18:26:10 +02:00
Thomas Haller
35f37151df libnm: use CList instead of GSList for notify_items in "nm-object.c" 2017-05-11 18:26:10 +02:00
Thomas Haller
c63a6772a4 libnm: use CList instead of GSList for pending_activations in "nm-manager.c" 2017-05-11 18:26:10 +02:00
Thomas Haller
c12dd0d970 ifcfg-rh: refactor shvar.c to use CList instead of GList 2017-05-11 18:26:10 +02:00
Thomas Haller
d079846330 shared: add "nm-utils/c-list.h" header
Include the circular, doubly-linked list implementation from
c-util/c-list [1], commit 864051de6e7e1c93c782064fbe3a86b4c17ac466.

[1] https://github.com/c-util/c-list
2017-05-11 18:26:07 +02:00
Thomas Haller
a08540d967 proxy: fix passing cancellable to async D-Bus operations
We must not cancel pacrunner_cancellable when the D-Bus proxy is
created. Instead, keep it around and use it later for the asynchronous
D-Bus operations.

This doesn't really matter at the moment, because the pacrunner manager
is only destroyed when NetworkManager is about to terminated. That is
the only time when we actually cancel the asynchronous request. Also,
at that time we no longer iterate the mainloop, so the pending requests
are never completed anyway.
2017-05-11 18:24:41 +02:00
Thomas Haller
df137fdf9a proxy: fix refcount handing for DestroyProxyConfiguration operation
Fixes: e895beb0da
2017-05-11 18:24:41 +02:00
Nikolay Martynov
58f7813283 platform: ignore RTM_GETLINK messages sent by wireless extentions
We listen to all RTM_GETLINK messages to get updates on interfaces statuses.
Unfortunately wireless code in the kernel sends those messages with wireless information included
and all other information excluded. When we receive such message we wipe out our valid cached entry
with new object that is almost empty because netlink message didn't contain any information.

Solution to this is to check that incoming message contains MTU field: this field is always
set for complete messages about interfaces and is not set by wireless code.

Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>

https://github.com/NetworkManager/NetworkManager/pull/17
2017-05-11 17:41:10 +02:00