Commit Graph

10071 Commits

Author SHA1 Message Date
Jiří Klimeš
2eede80108 cli: deny removing values of nmcli-unchangable properties
nmc_setting_reset_property() function checks whether we allow changing the property
(set_func != NULL) and if so, the property value is reset to default.
2013-09-06 15:00:34 +02:00
Jiří Klimeš
70cc30cb73 cli: add missing connection:type to nmc_add_prop_funcs() in editor 2013-09-06 14:12:26 +02:00
Jiří Klimeš
9835da7c74 libnm-util: update description of team:config and team-port:config properties 2013-09-06 13:52:27 +02:00
Jiří Klimeš
242bebfb3d cli: add 'remove' command to the interactive editor
remove <setting>[.property] | <property>

It entirely removes given setting from edited connection. If a property is given,
the command instead resets the property to its default value.

https://bugzilla.gnome.org/show_bug.cgi?id=707576
2013-09-06 10:10:37 +02:00
Jiří Klimeš
c2faf32b88 cli: 'connection add' - questionnaire mode (rh #953291)
Synopsis: nmcli --ask connection add

When '--ask' is used, nmcli will ask not only for mandatory arguments but also
for the optional ones, with a series of questions.
2013-09-06 09:16:46 +02:00
Thomas Haller
2766829a67 libnm-glib: don't warn when dbus object initialization fails with UNKNOWN_METHOD
A common case where this warning was triggered, was the removal of
IP6Config objects. As this can happen as a regular event, do not warn in
this case.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-05 22:08:43 +02:00
Dan Williams
fa0112c0ca core: handle externally added IPv6 adresses and routes on IP change
Cache externally added IP details and represent them via the D-Bus
interface, and also merge them into the final device config to ensure
they aren't lost if DHCP renews or RA changes occur.
2013-09-05 14:24:06 -05:00
Dan Williams
d8c9828a4d core: add nm_ip6_config_subtract()
Removes anything in 'src' from 'dst'.
2013-09-05 14:24:06 -05:00
Scott Shambarger
04f6e09d50 ifcfg-rh: fix handling of legacy IPv4 route files without gateway.
Routes without gateway are legal and should be treated as a device route
(direct route).

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

The original patch was written by Scott Shambarger <scott-gnome@shambarger.net>.
This is a modified version of the patch.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Reported-by: Scott Shambarger <scott-gnome@shambarger.net>
2013-09-05 21:13:15 +02:00
Thomas Haller
f6703f540c nmcli: reword error message for a wrong user input in edit mode
Before, when specifying a setting.property with missing property name,
the following happened:

  nmcli> set connection.
  Error: invalid property: '' not among [...

Reword this special error case of a missing property to make it more
clear.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-05 20:02:12 +02:00
Thomas Haller
1111dbf812 nmcli: fix segfault in edit mode when parsing user prompt
readline_x returns NULL for empty input, so it is wrong
to call g_strstrip without checking for NULL first.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-05 13:59:54 +02:00
Thomas Haller
4e09b87d54 ifupdown: misc code cleanup for "add support for source stanza"
- make use of glib functions
- coding style

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-05 10:58:46 +02:00
Michael Wisheu
48ed1abca7 ifupdown: add support for source stanza
Since Debian 7 (Wheezy) / Ubuntu 11.04 (Natty Narwhal) ifupdown supports
the source stanza to source in other configuration files from
/etc/network/interfaces.

Add support to the ifupdown plugin to include configuration files via
source.

Patch did not apply cleanly and was slightly modified by Thomas Haller.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
Reviewed-by: Sebastian Harl <tokkee@debian.org>
2013-09-05 10:56:28 +02:00
Thomas Haller
fc7468131c nmcli: major rework of bash completion
Bash completion does now parse the command line from left to right and
only suggests options that make sense at the current cursor position.

If the cursor is not at the end of the line, the words right from the
cursor are ignored for completion. The reason is, that it would be much
more difficult to figure out the valid options when also looking at
options right from the cursor. However, it should still work nicely
even in this case.

There is still an unsolved issue when completing words with space or
other special characters. However, this issue was present before.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-05 10:47:41 +02:00
Jiří Klimeš
650cbc6660 trivial: fix build by returning FALSE in gboolean nm_device_set_is_nm_owned()
g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
2013-09-05 09:14:57 +02:00
Thomas Haller
958ec36b96 core: delete virtual devices created by NM when they are deactivated.
Virtual/software devices that were created by NM should be deleted when
the device gets deactivated.

https://bugzilla.gnome.org/show_bug.cgi?id=695705
https://bugzilla.redhat.com/show_bug.cgi?id=953300

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-04 18:21:49 +02:00
Thomas Haller
c6458cab36 core: add flag is_nm_owned to NMDevice
Add a flag to indicate that the device is owned by NM.
This is interesting for software/virtual devices, that were created by
NM and should be deleted when the interface gets deactivated.

This flag is not implemented as a glib property.

Maybe this flag can be consolidated with the managed flag. For now it is
unclear how to do it, so add this flag. It should be easy later to
replace it again.

https://bugzilla.gnome.org/show_bug.cgi?id=695705
https://bugzilla.redhat.com/show_bug.cgi?id=953300

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-04 18:21:49 +02:00
Jiří Klimeš
8e050a3a77 trivial: fix a typo in description of ipv6.method in libnm-util 2013-09-04 12:56:17 +02:00
Jiří Klimeš
50bec85f98 cli: allow editing team and team-port settings in interactive editor 2013-09-04 12:43:11 +02:00
Jiri Pirko
96303bd9da cli: add missed setting name to nmc_team_slave_settings
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-09-04 12:43:11 +02:00
Jiri Pirko
d338b90cfd cli: add config option for team devices
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-09-04 12:43:11 +02:00
Jiri Pirko
97be00f9e0 cli: add team port setting
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-09-04 12:43:11 +02:00
Jiri Pirko
eb05cbeb9c cli: add team and team-slave detail printing
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-09-04 12:43:11 +02:00
Thomas Haller
00e1e20b16 nmcli: special error message for access denied when SetLogging fails
Setting the logging level fails for normal users due to missing dbus
permissions as configured in src/org.freedesktop.NetworkManager.conf.

In that case, nmcli simply fails showing the dbus error. This error
is however not very clear, so this commit shows a different error
text for the particular case of ACCESS_DENIED.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-04 11:56:46 +02:00
Dan Winship
5094d00b1e libnm-util: fix nm_setting_wireless_ap_security_compatible()
It was still looking at priv->security.
2013-09-03 13:47:46 -04:00
Jiří Klimeš
2d9366bcee cli: connect IP addresses/method handlers for existing connections (rh #998137)
The handlers detecting changes of IP addresses/method in nmcli interactive
editor were connected only for newly created connection. That's why the
automagic feature of setting 'method' when 'addresses' are changed and vice
versa worked just for new connections, but not while editing existing
connections.
2013-09-02 13:20:04 +02:00
Jiří Klimeš
0e57603e43 libnm-util: nm_utils_hwaddr_aton_len() allow hyphens in MAC string (rh #1002553)
http://en.wikipedia.org/wiki/MAC_address#Notational_conventions
Both 01:23:45:67:89:ab and 01-23-45-67-89-ab are used and valid.
2013-09-02 10:08:02 +02:00
Jiří Klimeš
ea78744555 settings: set deprecated 'security' for GetSettings() not to break old clients
Old clients might expect 802-11-wireless.security being set for secured Wi-Fi
connections. So to be on a safer side, we set the property in D-Bus GetSettings()
result.
2013-09-02 09:46:32 +02:00
Jiří Klimeš
0185e8371f libnm-util: deprecate 'security' property of '802-11-wireless' setting
'security' property is redundant, because the security restrictions are easily
recognized by the presence of '802-11-wireless-security' in a Wi-Fi connection.
The setting has to be present anyway, but we also had to set and check whether
the value in 'security' matches the security setting.
Following the KISS principle, it is best not to use the 'security' property
altogether.
2013-09-02 09:46:31 +02:00
Jiří Klimeš
284cce0405 test: remove deprecated 'security' property from tests
Adjust tests not to use deprecated 'security' property.
2013-09-02 09:46:31 +02:00
Jiří Klimeš
713755780f core: don't use deprecated 'security' property of wifi setting
That means replacing/removing
- nm_setting_wireless_get_security() function
- NM_SETTING_WIRELESS_SEC property
2013-09-02 09:46:31 +02:00
Jiří Klimeš
36465df124 cli: remove 802-11-wireless.security property from nmcli as it is deprecated
If a Wi-Fi connection is secured, it contains 802-11-wireless-security setting.
That's it. There's no need to have this property.
2013-09-02 09:46:31 +02:00
Jiří Klimeš
5157f9b0ae trivial: remove trailing TABs 2013-09-02 09:26:34 +02:00
Jiří Klimeš
5ce25c5eb4 ppp: fix getting username/password for Bluetooth connections (bgo #701507) 2013-09-02 09:09:38 +02:00
Dan Williams
1a42e764d4 core: fix handling of ActiveConnections on Policy dispose()
The manager has already disposed of the ActiveConnections by the time
the Policy is disposed, but the manager wasn't clearing the
active_connections list, so the Policy got a stale list of freed
objects.  Next, the manager wasn't always emitting ACTIVE_CONNECTION_REMOVED
when disposing of ActiveConnections, which the Policy listens to
for cleanup.  This lead to warnings on shutdown when the Policy
attempted to clean up for already disposed objects

Fix all this by ensuring the Manager signals when removing
ActiveConnections, which the Policy then uses to clean up
it's stuff, and ensuring the manager properly cleans up its
ActiveConnection list.
2013-08-30 18:00:18 -05:00
Pavel Šimerda
c6ba3ca51b core: use nm_platform_master_*_option() for bonds
Acked-by: Dan Winship <danw@gnome.org>
2013-08-31 00:47:11 +02:00
Pavel Šimerda
9e19c3dba5 core: use nm_platform_*_*_option() for bridges
And refactor to prepare for update_connection() implementation.

Acked-by: Dan Winship <danw@gnome.org>
2013-08-31 00:47:11 +02:00
Pavel Šimerda
e96b5d82bd platform: fix and simplify address lifetime compensation
Acked-by: Dan Williams <dcbw@redhat.com>
2013-08-31 00:47:11 +02:00
Pavel Šimerda
c5c8fbea12 trivial: remove unused 'existing' parameter from get_connections() 2013-08-31 00:47:11 +02:00
Thomas Haller
f4118492b6 fix: avoid call to g_file_test with NULL path in nm-dhcp-dhclient.c
Calling g_file_test with a NULL path causes valgrind to complain.

 NetworkManager[24512]: <debug> [1377884547.687536] [dhcp-manager/nm-dhcp-dhclient.c:482] create_dhclient_config(): (em1): no existing dhclient configuration to merge
 ==24512== Syscall param access(pathname) points to unaddressable byte(s)
 ==24512==    at 0x3F976E7627: access (in /usr/lib64/libc-2.17.so)
 ==24512==    by 0x4EDA556: g_file_test (in /usr/lib64/libglib-2.0.so.0.3600.3)
 ==24512==    by 0x49BB69: create_dhclient_config (nm-dhcp-dhclient.c:364)
 ==24512==    by 0x49CC39: ip4_start (nm-dhcp-dhclient.c:671)

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-30 19:53:25 +02:00
Thomas Haller
f218f9195b fix: nm-device-wifi disconnect signal from supplicatant.iface==NULL
This fixes a glib assertion.

Backtrace:
 #0  0x00007f139ab08e0d in g_logv () from /lib64/libglib-2.0.so.0
 #1  0x00007f139ab08ff2 in g_log () from /lib64/libglib-2.0.so.0
 #2  0x0000003f9aa3151a in g_type_check_instance () from /lib64/libgobject-2.0.so.0
 #3  0x0000003f9aa272d4 in g_signal_handlers_disconnect_matched () from /lib64/libgobject-2.0.so.0
 #4  0x0000000000495b7d in supplicant_interface_release (self=0xc58040) at devices/nm-device-wifi.c:423
 #5  0x0000000000498a28 in dispose (object=0xc58040) at devices/nm-device-wifi.c:3525
 #6  0x0000003f9aa14338 in g_object_unref () from /lib64/libgobject-2.0.so.0
 #7  0x000000000047699a in remove_device (manager=manager@entry=0xc09050, device=0xc58040, quitting=quitting@entry=1) at nm-manager.c:748
 #8  0x0000000000478a84 in dispose (object=0xc09050) at nm-manager.c:4558
 #9  0x0000003f9aa14338 in g_object_unref () from /lib64/libgobject-2.0.so.0
 #10 0x0000000000428cc0 in main (argc=1, argv=0x7fffc0948c98) at main.c:626

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-30 19:28:27 +02:00
Dan Williams
0c15e1c2ce fix: glib assertion in nm-agent-manager, cancelling completed dbus call
This fixes a glib assertion:
"dbus_g_proxy_cancel_call: assertion `pending != NULL' failed"

Backtrace:
 #0  0x00007f962dad9e0d in g_logv () from /lib64/libglib-2.0.so.0
 #1  0x00007f962dad9ff2 in g_log () from /lib64/libglib-2.0.so.0
 #2  0x00000000004a84bd in nm_secret_agent_cancel_secrets (self=0x213b300, call=0x1) at settings/nm-secret-agent.c:331
 #3  0x00000000004a4068 in request_free (req=0x216a490) at settings/nm-agent-manager.c:479
 #4  0x00007f962dac25fa in g_hash_table_remove_internal () from /lib64/libglib-2.0.so.0

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-30 18:23:24 +02:00
Dan Winship
8c167c1f8f core: fix NMPolicy/NMManager refcounting
NMManager owns the NMPolicy now, so the policy should not be holding a
ref on the manager.
2013-08-30 09:33:43 -04:00
Pavel Šimerda
2371ee6168 trivial: rename nm_settings_add_connection*() functions
It makes more sense to use basic name for the basic function and
suffixed name for the special one.

Acked-by: Dan Williams <dcbw@redhat.com>
2013-08-30 10:54:29 +02:00
Pavel Šimerda
e0c2b970d6 trivial: add some comments to nm-device's link-changed handlers
Acked-by: Dan Winship <danw@gnome.org>
2013-08-30 10:54:20 +02:00
Colin Walters
ff89e98fac trivial: consistently #include "libgsystem.h" rather than just gsystem-local-alloc.h
libgsystem contains more than just the local allocation macros; in the
future we will likely want to make use of some of this such as the
structured logging support.
2013-08-29 16:16:35 -05:00
Dan Williams
f35c8e3e4a gsystem: update libgsystem for compiler warning fixes 2013-08-29 16:16:26 -05:00
Thomas Haller
38213b0524 platform: add nm_platform_*_to_string functions
Add *_to_string functions for address (ip4 and ip6) and
route (ip4 and ip6). Also refactor the previously existing
nm_platform_ip4_route_to_string function.

The to_string function returns a pointer to an internal
buffer. Also update log_* functions to make use of the new
to_string functions.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-29 22:16:45 +02:00
Colin Walters
5fcf647a28 nm-activation-request: Make use of libgsystem local allocations
Just cleaner code.

Reviewed-by: Pavel Šimerda <psimerda@redhat.com>
2013-08-29 15:16:34 -04:00
Dan Williams
a9b9330bed build: fix builddir != srcdir when building D-Bus API spec HTML 2013-08-29 13:43:03 -05:00