Commit Graph

15047 Commits

Author SHA1 Message Date
Dan Williams
2b02eea1a4 trivial: add missing break 2014-10-16 20:10:12 -05:00
Dan Williams
8176af1152 keyfile: fix handling of enum/flags properties after fcfb4b40 (bgo #738585)
When some properties got converted to G_TYPE_ENUM and G_TYPE_FLAGS
the keyfile plugin was not updated to handle these types.

https://bugzilla.gnome.org/show_bug.cgi?id=738585
2014-10-16 19:17:18 -05:00
Dan Williams
b69143b508 build: ensure rl_echo_signal_char() exists in the readline library 2014-10-14 14:30:44 -05:00
Thomas Haller
d5ceb0af15 bluez: fix compiler error due to redefinition of typedef
clang warns:
    make[5]: Entering directory `./NetworkManager/src/devices/bluetooth'
      CC       nm-bluez5-dun.lo
    nm-bluez5-dun.c:50:3: error: redefinition of typedef 'NMBluez5DunContext' is a C11 feature [-Werror,-Wtypedef-redefinition]
    } NMBluez5DunContext;
      ^
    ./nm-bluez5-dun.h:27:36: note: previous definition is here
    typedef struct _NMBluez5DunContext NMBluez5DunContext;
                                       ^

Fixes: f1c9595311
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-14 11:28:19 +02:00
Marius Vollmer
4f950ee569 policy: allow non-local admin sessions to control the network (rh #1145646) 2014-10-13 15:58:46 -05:00
Thomas Haller
d00fed839a bluez: merge branch 'lr-bluez5-dun' (rh #1055628)
https://bugzilla.redhat.com/show_bug.cgi?id=1055628

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-13 14:30:27 +02:00
Lubomir Rintel
f1c9595311 bluez: re-add DUN support for Bluez5
This adds service discovery via SDP and RFCOMM tty management to
NetworkManager, as it was dropped from Bluez.

Based on work by Dan Williams <dcbw@redhat.com>.
The SDP discovery is based on code from Bluez project.
2014-10-13 14:27:33 +02:00
Dan Williams
384ec86064 bluez: track adapter address in NMBluezDevice
We'll need it for bluez5 DUN support.

[lkundrak@v3.sk: Turn the addresses to strings from guint8[ETH_ALEN], as that
is what rest of NetworkManager uses for MAC addresses and what Bluez utility
functions expect as well.]
2014-10-13 14:27:33 +02:00
Dan Williams
5254ac456e bluez: split out errors
We'll use them from more places than nm nm-bt-device.c in the future.
2014-10-13 14:27:33 +02:00
Thomas Haller
ec84e4f00a merge branch 'th/bgo737380_log_connection_diff'
https://bugzilla.gnome.org/show_bug.cgi?id=737380

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 22:25:32 +02:00
Thomas Haller
30b1afd73b core: log connection change with nm_utils_log_connection_diff()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 21:17:17 +02:00
Thomas Haller
41e0d5b9ce core: add nm_utils_log_connection_diff
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 21:17:17 +02:00
Thomas Haller
1cc7b8d027 libnm-util: add _nm_setting_get_property() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 21:17:17 +02:00
Thomas Haller
1464c5a11e libnm: add function _nm_setting_get_setting_priority()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 21:17:17 +02:00
Thomas Haller
68bc95c12f libnm-util: let nm_setting_diff() be symetric not to return properties that are set to default
Previously, nm_setting_diff() (and thus nm_connection_diff()), returned
only properties that are different AND not set to the default value.
However, if the opposite setting 'B' was missing, it would always
include all properties from 'A', even the default ones.

This behaviour was asymetric. Add two new compare flags
@NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT and
@NM_SETTING_COMPARE_FLAG_DIFF_RESULT_NO_DEFAULT to control the
behaviour of whether to include default properties.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 21:17:17 +02:00
Thomas Haller
e5194fd346 libnm: hide API for generic handling of secrets
The functions nm_setting_clear_secrets(),
nm_setting_clear_secrets_with_flags(), and nm_setting_need_secrets()
are not used outside of libnm-core. Remove them from public API.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 21:17:17 +02:00
Thomas Haller
978724da96 libnm-util: don't assert in nm_setting_get_secret_flags() and avoid assertion in agent_secrets_done_cb()
When secret providers return the connection hash in GetSecrets(),
this hash should only contain secrets. However, some providers also
return non-secret properties.

for_each_secret() iterated over all entries of the @secrets hash
and triggered the assertion in nm_setting_get_secret_flags() (see
below).

NM should not assert against user provided input. Change
nm_setting_get_secret_flags() to silently return FALSE, if the property
is not a secret.

Indeed, handling of secrets is very different for NMSettingVpn and
others. Hence nm_setting_get_secret_flags() has only an inconsistent
behavior and we have to fix all call sites to do the right thing
(depending on whether we have a VPN setting or not).

Now for_each_secret() checks whether the property is a secret
without hitting the assertion. Adjust all other calls of
nm_setting_get_secret_flags(), to anticipate non-secret flags and
assert/warn where appropriate.

Also, agent_secrets_done_cb() clears now all non-secrets properties
from the hash, using the new argument @remove_non_secrets when calling
for_each_secret().

  #0  0x0000003370c504e9 in g_logv () from /lib64/libglib-2.0.so.0
  #1  0x0000003370c5063f in g_log () from /lib64/libglib-2.0.so.0
  #2  0x00007fa4b0c1c156 in get_secret_flags (setting=0x1e3ac60, secret_name=0x1ea9180 "security", verify_secret=1, out_flags=0x7fff7507857c, error=0x0) at nm-setting.c:1091
  #3  0x00007fa4b0c1c2b2 in nm_setting_get_secret_flags (setting=0x1e3ac60, secret_name=0x1ea9180 "security", out_flags=0x7fff7507857c, error=0x0) at nm-setting.c:1124
  #4  0x0000000000463d03 in for_each_secret (connection=0x1deb2f0, secrets=0x1e9f860, callback=0x464f1b <has_system_owned_secrets>, callback_data=0x7fff7507865c) at settings/nm-settings-connection.c:203
  #5  0x000000000046525f in agent_secrets_done_cb (manager=0x1dddf50, call_id=1, agent_dbus_owner=0x1ddb9e0 ":1.39", agent_username=0x1e51710 "thom", agent_has_modify=1, setting_name=0x1e91f90 "802-11-wireless-security",
      flags=NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION, secrets=0x1e9f860, error=0x0, user_data=0x1deb2f0, other_data2=0x477d61 <get_secrets_cb>, other_data3=0x1ea92a0) at settings/nm-settings-connection.c:757
  #6  0x00000000004dc4fd in get_complete_cb (parent=0x1ea6300, secrets=0x1e9f860, agent_dbus_owner=0x1ddb9e0 ":1.39", agent_username=0x1e51710 "thom", error=0x0, user_data=0x1dddf50) at settings/nm-agent-manager.c:1139
  #7  0x00000000004dab54 in req_complete_success (req=0x1ea6300, secrets=0x1e9f860, agent_dbus_owner=0x1ddb9e0 ":1.39", agent_uname=0x1e51710 "thom") at settings/nm-agent-manager.c:502
  #8  0x00000000004db86e in get_done_cb (agent=0x1e89530, call_id=0x1, secrets=0x1e9f860, error=0x0, user_data=0x1ea6300) at settings/nm-agent-manager.c:856
  #9  0x00000000004de9d0 in get_callback (proxy=0x1e47530, call=0x1, user_data=0x1ea10f0) at settings/nm-secret-agent.c:267
  #10 0x000000337380cad2 in complete_pending_call_and_unlock () from /lib64/libdbus-1.so.3
  #11 0x000000337380fdc1 in dbus_connection_dispatch () from /lib64/libdbus-1.so.3
  #12 0x000000342800ad65 in message_queue_dispatch () from /lib64/libdbus-glib-1.so.2
  #13 0x0000003370c492a6 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
  #14 0x0000003370c49628 in g_main_context_iterate.isra.24 () from /lib64/libglib-2.0.so.0
  #15 0x0000003370c49a3a in g_main_loop_run () from /lib64/libglib-2.0.so.0
  #16 0x000000000042e5c6 in main (argc=1, argv=0x7fff75078e88) at main.c:644

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 21:17:17 +02:00
Thomas Haller
a7c8e5c6e9 merge branch 'th/bgo580018_autoconnect_priority'
Add configuration option NMSettingConnection:autoconnect-priority.
This new option is only relevant for connections that are set to
autoconnect. When having more then one candicate for autoconnect, this
new setting allows to always prefer one connection over the other.

If both connections have the same priority setting, the previous
automatism is used to choose the best candidate. That is, NM will
choose the least recently connected candidate.
See also the still unresolved but related bug bgo#737356 that asks
for providing a different automatism.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:36:48 +02:00
Thomas Haller
f87e876f79 core: prefer connections with higher priority for autoconnect
https://bugzilla.gnome.org/show_bug.cgi?id=580018

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:13:18 +02:00
Thomas Haller
59f2c0fb3e core/policy: refactor auto_activate_device() to use a GPtrArray
Next we want to sort the array, g_slist_sort() is not guaranteed to be
stable, while g_ptr_array_sort() is. Also, sorting a GSList has
worse performance.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:13:18 +02:00
Thomas Haller
91ec7dac90 core: remove nm_device_get_best_auto_connection()
nm_device_get_best_auto_connection() was only used at one place.
It was a very simple function, just iterated over a list finding
the first can_auto_connect() connection. At the very least, the name
was misleading, because it did not return the 'best', but the 'first'
connection.

Get rid of the function altogether.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:13:18 +02:00
Thomas Haller
f68faccd7f core: add nm_device_can_auto_connect() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:13:18 +02:00
Thomas Haller
2e8a2921e5 core: ensure properly comparing boolean values in connection_sort()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:13:18 +02:00
Thomas Haller
cf26bb2dea cli: support connection.autoconnect-priority property
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:13:18 +02:00
Thomas Haller
83e99c2227 cli: add nmc_property_set_int() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:13:17 +02:00
Thomas Haller
c9476a4242 cli: fix type when setting variadic argument in nmc_property_set_uint()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:13:17 +02:00
Thomas Haller
210e0dbc11 ifcfg-rh: add support for NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:13:17 +02:00
Thomas Haller
212f5dcba6 ifcfg-rh: add svGetValueInt64() utility function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:13:17 +02:00
Thomas Haller
24a2f9c6cd libnm: add NMSettingConnection:autoconnect-priority setting
The autoconnect priority has only any relevance, if the connection
is autoconnect too.

The priority defaults to zero, with higher numbers meaning preferred.
The valid range is limited to [-999,999].

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:13:17 +02:00
Thomas Haller
b145700656 libnm: make @copy_func argument in _nm_utils_copy_strdict() optional
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:13:17 +02:00
Thomas Haller
884040fa8f nmtst: improve nmtst_assert_connection_verifies_without_normalization()
If the assertion in verifies_without_normalization() fails due to
@was_modified, the error message is not helpful.
Assert first against the content of the connection. This prints
most likely the settings that were actually modified.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 20:11:31 +02:00
Thomas Haller
71c5e5dea1 contrib/nm-live-vm: install perl dependancy (YAML) in mock build
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-10 20:52:38 +02:00
Dan Winship
60cce40042 libnm: fix crash in nm_client_new_async(), add a test for it
nm_client_new_async() got broken in the NMManager split. Fix it, and
use it from one of the tests in test-nm-client to make sure it's
getting tested in the future.
2014-10-10 13:44:54 -04:00
Dan Winship
af8fb3da47 libnm: fix NMActiveConnection object-path-valued properties (bgo #738103) 2014-10-10 13:10:28 -04:00
Dan Winship
677314c540 libnm: fix NMActiveConnection object-path-valued properties
NMActiveConnection:connection was an object path rather than an
NMRemoteConnection because in the past the NMObject property system
wasn't capable of handling NMRemoteConnection-valued properties.
NMActiveConnection:master was an object path rather than an NMDevice
entirely by accident. Fix both.

NMActiveConnection:specific-object can't currently be converted to an
object, because we don't know ahead of time what object type it is,
and NMObject can't deal with that. Instead, we rename it to
:specific-object-path (and likewise for its get function), both to
emphasize that it doesn't behave like other properties, and to leave
the old name open for an actual object-valued property later on.
2014-10-10 13:10:19 -04:00
Dan Winship
8c3d6f734b libnm: add nm-types.h, to avoid include loops
Add nm-types.h defining all the type structs, to avoid future include
loops. Clean up the includes in all of the installed headers.
2014-10-10 13:10:18 -04:00
Dan Winship
dccaffe143 libnm: merge NMRemoteSettings into NMClient (bgo #738103) 2014-10-10 13:09:43 -04:00
Dan Winship
6f3d1f9526 libnm: merge NMRemoteSettings into NMClient
Make NMRemoteSettings internal and have NMClient wrap all of its APIs,
just like it does with NMManager.
2014-10-10 12:40:19 -04:00
Dan Winship
c1f1e96181 cli: (trivial) rename NmCli.system_connections to connections
Rename NmCli.system_connections to connections, since the "user
connections" have been gone forever.
2014-10-10 12:40:15 -04:00
Dan Winship
90f66ff456 libnm: split "NMManager" out of NMClient
Clone NMClient as NMManager, and make NMClient just be a wrapper
around that new class.
2014-10-10 12:40:14 -04:00
Dan Winship
98bcc51240 libnm: clean up NMClient semantics when NM is not running
Add a single function to check if NM is running and set a GError if
not, then use it as appropriate.

Don't bother to check if NM is running in get_*() functions if
nm_running_changed_cb() would have reset the field anyway (and fix
that up to reset a few more fields).
2014-10-10 12:40:14 -04:00
Dan Winship
66bb00f677 libnm: (trivial) reorder NMClient function declarations/code
Rearrange the NMClient function declarations and the functions
themselves, and group them into "general", "device", and "active
connection" sections.

No code changes, just moving things around.
2014-10-10 12:40:08 -04:00
Thomas Haller
a6b4d54499 core: merge branch 'th/bgo737731-kill-process'
Add utility function to kill non-child processes and fix the wrong
use of nm_utils_kill_child_process_sync() in nm-dhcp-client.c

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-10 12:31:40 +02:00
Thomas Haller
4bfc163b63 dhcp: relax check valid PID for dhcp process
All callers only pass a PID that previously was returned from
spawning a process. AFAIS, there is no officially reserved range
for lower PIDs that would enforce valid PIDs to be larger then 25.
Relax this check.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-10 12:30:22 +02:00
Thomas Haller
5bbd8750c7 core/dhcp: kill external dhcp process using nm_utils_kill_process_sync()
nm_utils_kill_child_sync() is not able to reap the external process.
This causes NM to hang for 500 ms and logs the following error:

  <debug> [1412167360.400201] [NetworkManagerUtils.c:534] nm_utils_kill_child_sync(): kill child process 'dhcp-client' (7109): waiting up to 500 milliseconds for process to terminate normally afte
  <debug> [1412167360.900298] [NetworkManagerUtils.c:549] nm_utils_kill_child_sync(): kill child process 'dhcp-client' (7109): sending SIGKILL...
  <error> [1412167360.900369] [NetworkManagerUtils.c:576] nm_utils_kill_child_sync(): kill child process 'dhcp-client' (7109): after sending SIGTERM (15) and SIGKILL, waitpid failed with No child

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-10 12:28:59 +02:00
Thomas Haller
efd8be04f1 core: add nm_utils_kill_process_sync() function
This utility function is for killing other processes.
Contrary to nm_utils_kill_child_*() which is for killing
and reaping child processes.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-10 12:28:59 +02:00
Thomas Haller
99c5edbacd core: add nm_utils_get_start_time_for_pid() function
Move the code from nm-auth-subject.c over to NetworkManagerUtils.c

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-10 11:51:40 +02:00
Dan Williams
15b2a85ec5 ifcfg-rh: fix build on 32-bit 2014-10-09 13:20:06 -05:00
Thomas Haller
94a6f609f7 platform: fix format string for logging MTU in nm_platform_link_set_mtu()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-09 13:12:51 +02:00
Dan Williams
8c48fcf96c ifcfg-rh: read and write WiFi bands with BAND keyword
BAND alone will be honored, but CHANNEL will override BAND
since CHANNEL almost always implies BAND as well.
2014-10-08 21:55:31 -05:00