summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* cli: use --complete-args for connection add completionlr/connection-addLubomir Rintel2016-06-211-234/+2
| | | | And make it incredibly slow at the same time.
* man: update the nmcli manual for new connection add syntaxLubomir Rintel2016-06-213-1279/+435
| | | | | | | | | | It allows us to clean up the nmcli "c add" section considerably. We list the old-fashioned aliases in a separate section that applies to both "nmcli c add" and "nmcli c modify". The section is now nicely cross-linked with nm-settings in HTML rendering.
* nmcli: streamline connection additionLubomir Rintel2016-06-212-3621/+1274
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a huge refactoring in attempt to 1.) reduce the horrible redundancy in the connection addition path and 2.) reduce confusion between various sources of property value (command line, properties, interactive mode). * The conversions from the strings was done all over the place: settings.c already does for all sensible properties. The rest is removed. * The validations are done randomly and redundantly: server does some validation, and per-property client validations useful for interactive mode are done in settings.c The rest is removed. * The information about defaults and required options was redundantly scattered in per-type completion functions and interactive mode questionnaries. This is now driven by the option_info[] table. In general, we do our best to just map the command line options to properties and allow mixing them. For the rest there's the check_and_set() callbacks (basically to keep compatibility with previous nmcli versions). This this is now all possible: $ nmcli c add type ethernet ifname '*' This always worked $ nmcli c add type bond-slave save no -- connection.autoconnect no The "save" and "--" still work $ nmcli c add connection.type ethernet ifname eth0 Properties can now be used $ nmcli c add type ethernet ip4 1.2.3.4 mac 80:86:66:77:88:99 con-name whatever There's no implementation mandated order of the properties (the type still must be known to determine which properties make sense) $ nmcli --ask c add type ethernet ip4 1.2.3.4 mac 80:86:66:77:88:99 con-name whatever The interactive mode asks only for properties that weren't specified on command line
* man: turn the manual page cross-references into linksLubomir Rintel2016-06-219-54/+54
| | | | | | | | This improves the HTML rendering. But it also causes a lot of non-resolvable linkends warning when rendering a separate manual pages into roff/mman. The messages are harmless, but still a bit ugly.
* libnm/libnm-glib: use Bluetooth device name as description (bgo #592819)Dan Williams2016-06-212-0/+20
| | | | | | | Abuse the 'name' property for this, for now, so we don't have to grab a free slot from NMDeviceClass. https://bugzilla.gnome.org/show_bug.cgi?id=592819
* nmlci merge branch 'fg/autocomplete_fix_rh1301226_with_LR_patches'Francesco Giudici2016-06-214-141/+331
|\ | | | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=724860 https://bugzilla.redhat.com/show_bug.cgi?id=1301226
| * nmcli: add support to shortnames for connection properties autocompletionfg/autocomplete_fix_rh1301226_with_LR_patchesFrancesco Giudici2016-06-211-26/+73
| |
| * nmcli: improve connection autocompletion (2/2)Lubomir Rintel2016-06-213-91/+158
| | | | | | | | | | | | | | | | Complete the property as we parse the list of properties. This makes it possible to actually complete an unfinished property. E.g: $ nmcli --complete c modify enp0s25 +ipv6.addr +ipv6.addresses +ipv6.addr-gen-mode
| * nmcli: improve connection autocompletion (1/2)Lubomir Rintel2016-06-211-5/+22
| | | | | | | | | | | | | | Make property autocompletion take a prefix and modifier flags. This will make it easier to complete an unfinished property name (possibly accompanied by a modifier) without shell trickery.
| * cli: streamline complete_connection_by_type() argumentsLubomir Rintel2016-06-211-74/+70
| | | | | | | | Will be useful to pass around the complete flag.
| * nmcli: enable connection autocompletion for 802.1x propertiesFrancesco Giudici2016-06-214-3/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nmcli bash autocompletion leveraged on "nmcli connection edit", "print" to retrieve the specific properties of a connection. Anyway, the interactive editor is smart and just prints the used components, so in a connection where 802.1x is not enabled we had no autocompletion. Solved adding an "hidden" command "nmcli --complete connection modify" as suggested in bgo #724860 in order to retrieve ALL the available properties for use in autocompletion. Here patch from L.Rintel has been merged to make che --complete option global to nmcli (first version was local to "connection modify"). https://bugzilla.gnome.org/show_bug.cgi?id=724860 https://bugzilla.redhat.com/show_bug.cgi?id=1301226
| * nmcli autocompletion cleanupsFrancesco Giudici2016-06-211-15/+11
|/ | | | | | | | | | | * no need to check HELP_ONLY_AS_FIRST var as when --help option is passed _nmcli_compl_OPTIONS will return 0, falling in the general case that will trigger end of autocompletion * clanup local var declaration in _nmcli func: - remove dupliated OPTIONS_MANDATORY declaration - init HELP_ONLY_AS_FIRST on declaration - order vars for common prefix
* team: check return value of g_dbus_connection_call_sync()Beniamino Galvani2016-06-211-3/+11
| | | | | | | The call can fail; in such case assume that an existing teamd died and our instance will be able to continue. https://bugzilla.redhat.com/show_bug.cgi?id=1347015
* clients,vpn/trivial: rename argument of nm_vpn_get_secret_names()Thomas Haller2016-06-202-6/+6
|
* clients,vpn: only accept full service-types in nm_vpn_get_secret_names()Thomas Haller2016-06-201-4/+6
| | | | | | | | | | nm_vpn_get_secret_names() has only one caller, which passes nm_setting_vpn_get_service_type() as @vpn_type argument. That argument is not a short-name or abbreviation, it must be the full service-type. For our well-known, hard-coded list of service-types, all must start with the same prefix.
* clients: fix wrong assertion _assert_format_int()Thomas Haller2016-06-181-1/+1
| | | | Fixes: 2822f92434e19ebd25b69672bc996fc8311ae929
* all: merge branch 'th/g_strv_contrains'Thomas Haller2016-06-1720-92/+98
|\
| * all: replace _nm_utils_string_in_list() with g_strv_contains()Thomas Haller2016-06-1718-77/+60
| |
| * nm-glib: implement compatibility macro for g_strv_contains() differentlyThomas Haller2016-06-171-14/+7
| | | | | | | | | | | | Otherwise, deprecation warnings are not properly suppressed for g_return_if_fail (g_strv_contains (strv, str));
| * nm-glib: remove G_GNUC_EXTENSIONThomas Haller2016-06-172-17/+17
| | | | | | | | | | | | | | We use statement expressions all over the place without explicitly marking them. If that would be a problem, we'd have to change a *lot* of code. We simply require that as a mandatory feature from our compiler.
| * shared: backport g_strv_contains()Lubomir Rintel2016-06-171-0/+30
|/
* wwan: check at runtime whether to start ModemManagerDidier Raboud2016-06-173-10/+16
| | | | | | | | | | | | | This makes NetworkManager use runtime detection to manage the ModemManager lifecycle when not run by systemd. Under systemd, we expect the ModemManager service to be started by systemd, under non-systemd, we use the dbus activation feature to start ModemManager. [thaller@redhat.com: original patch heavily modified to check for available libsystemd library] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770871 https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00086.html
* platform: recognize rmnet and ccmni interfaces as WWAN network devicesDan Williams2016-06-171-0/+9
| | | | https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00087.html
* platform/trivial: rename NM_LINK_TYPE_WWAN_ETHERNET to NM_LINK_TYPE_WWAN_NETDan Williams2016-06-174-5/+5
| | | | | Some newer WWAN netdev types are "rawip" which don't bother with ethernet framing.
* logging: enable logging domain VPN_PLUGIN up to level <info>Thomas Haller2016-06-173-11/+25
| | | | | | | | | | | | | | | | | | | | | | | | The logging domain VPN_PLUGIN controlls logging of the VPN plugins. Especially at verbose levels <debug> and <trace>, the plugins might reveal sensitive information in the logging. Thus, this level should not be enabled by a $ nmcli logging general level DEBUG domains ALL It should only be enabled when requested explicitly. $ nmcli logging general level DEBUG domains ALL,VPN_PLUGIN:DEBUG Previously, the special level VPN_PLUGIN was entirely excluded from ALL and DEFAULT domains and it was entirely disabled by default. That is however to strict, as it completely silences the VPN plugins by defult. Now, enable them by default up to level INFO. VPN plugins should take care that they don't reveal sensitive information at levels <info> (LOG_NOTICE) and higher (less verbose). For more verbose levels they may print passwords, but that should still be avoided as far as possible.
* shared: add also "shared/nm-utils/nm-vpn-plugin-macros.h"Thomas Haller2016-06-162-0/+44
| | | | | It has the very similar purpose as "nm-utils/nm-vpn-plugin-utils.[ch]", except that is is header-only.
* tests: fix checking NM_ASSERT_NO_MSG define in "nm-test-utils.h"Thomas Haller2016-06-161-1/+1
| | | | | "nm-test-utils.h" may also be used by the VPN plugins, there we have no NM_ASSERT_NO_MSG define.
* shared: merge branch 'th/shared-bgo767697'Thomas Haller2016-06-1635-37/+238
|\ | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=767697
| * shared/tests: build "nm-utils/nm-vpn-plugin-utils.c"th/shared-bgo767697Thomas Haller2016-06-161-0/+24
| | | | | | | | For testing, add a build target to build those files too.
| * shared: include "nm-glib.h" from "nm-macros-internal.h"Thomas Haller2016-06-162-2/+3
| | | | | | | | | | "nm-glib.h" is our most basic header. "nm-macros-internal.h" extends on that. Thus, let "nm-macros-internal.h" include "nm-glib.h".
| * shared: include "gsystem-local-alloc.h" from "nm-glib.h"Thomas Haller2016-06-163-2/+2
| | | | | | | | | | | | | | | | | | "nm-glib.h" is the most basic header, the one we cannot do without. ("nm-default.h", is already more generic, the one which every common source file in NetworkManager repository should include). Let "gsystem-local-alloc.h" be included by "nm-glib.h" and nowhere else.
| * shared: add "nm-utils/nm-vpn-plugin-utils.h"Thomas Haller2016-06-164-0/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This file is only used by plugins and copied between them. It's purpose is to contain general utility functions that are only relevant for implementing NetworkManager's VPN plugins. In principle the utility functions could be part of libnm, however, there are a few problems with that: - if they are part of libnm, adding and using a new utility function requires the plugin to bump the required libnm version. Since you usally can work around/reimplement utility functions, this results in not using the API from libnm, not adding the API to libnm, and reimplementing it over and over in the plugin. - plugins compile both against libnm and libnm-glib. Thus, either the utility function would also be needed in libnm-glib, or again, it is not usable by the plugin. We must avoid that the utility functions diverge and no local modifications to these files should be made in the plugin. Instead, one special location of the utility functions shall be extended and re-imported (copied) to the plugin as needed. Add the files to NetworkManager's repository. Although they are not needed for NetworkManager itself, they are a different API provided by NetworkManager. An API that is reused and shared by copying the files around.
| * shared: move shared files to subdirectory "shared/nm-utils/"Thomas Haller2016-06-1632-36/+37
|/ | | | | | | | | | | | | The "shared" directory contains files that are possibly used by all components of NetworkManager repository. Some of these files are even copied as-is to other projects (VPN plugins, nm-applet) and used there without modification. Move those files to a separate directory. By moving them to a common directory, it is clearer that they belong together. Also, you can easier compare the copied versions to their original via $ diff -r ./shared/nm-utils/ /path/to/nm-vpn-plugin/shared/nm-utils/
* libnm/vpn,cli: merge branch 'th/vpn-service-info-bgo767197'Thomas Haller2016-06-1516-147/+668
|\ | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=767197
| * libnm/vpn: add nm_vpn_editor_plugin_load_vt()Thomas Haller2016-06-157-1/+260
| | | | | | | | | | | | | | | | | | | | Let VPN plugins return a virtual function table to extend the API while bypassing libnm. This allows to add and use new functionality to VPN plugins without updating libnm. The actual definitions are in a header-only file "nm-vpn-editor-plugin-call.h", which can be copied to the caller/plugin.
| * libnm/vpn: pass NMVpnPluginInfo to the NMVpnEditorPlugin instanceThomas Haller2016-06-155-1/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The NMVpnPluginInfo is essentially the .name file, that is, a configuration file about the plugin itself. Via NMVpnPluginInfo instance, the NMVpnEditorPlugin can be created. Usually, one would create a NMVpnPluginInfo (that is, reading the .name file) and then create a NMVpnEditorPlugin instance from there. In this case, usually the editor-plugin is owned by the plugin-info instance (although the API allows for creating the editor-plugin independently). Now, pass the NMVpnPluginInfo to the editor-plugin too. This is useful, because then the editor-plugin can look at the .name file. The .name file is not user configuration. Instead it is configuration about the plugin itself. Although the .name file is part of the plugin build artefacts, it is useful to allow the plugin to access the .name file. The reason is, that this can allow the user to easily change a configuration knob of the plugin without requiring to patch or the plugin.
| * cli: fix handling of VPN names in nmcli by using libnm functionsThomas Haller2016-06-153-106/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At various places, nmcli requires to specify a VPN type by name, for example $ nmcli connection add type vpn ifname '*' vpn-type $VPN_TYPE This $VPN_TYPE used to be a hard-coded list of known VPN plugin names. But actually, it should be a VPN service-type. A service-type used to be the D-Bus name of the VPN plugin. Now, with multiple VPN support that is no longer the case, but it still has the form of a D-Bus bus name. Alternativley, it could be an alias, which is just a way for plugins to support multiple service-types. Fix that, to support fully qualified service-types in the form of D-Bus bus names. Also, support lookup by name, in which case the present plugin-info instances are searched. Finally, support a list of hard-code short-names. All the logic how to translate a short-name to a fully qualified service-type is now inside libnm, so that various user agree on those names and don't have to hard-code them each.
| * libnm/vpn: add nm_vpn_plugin_info_list_find_service_name() functionThomas Haller2016-06-153-1/+180
| |
| * libnm/vpn: refactor nm_vpn_plugin_info_list_find_by_service() and prefer ↵Thomas Haller2016-06-151-18/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | aliases first Refactor code to add function _list_find_by_service(), which will be used in the next commit. A notable change is that we now search also through the aliases together with the service-name. That makes a difference, if one plugin privdes an "alias" which another plugin provides as "service". Due to that change, we would also find the aliased plugin first. In practice it shouldn't matter, because different plugins are not supposed to provide identical services.
| * clients/trivial: rename nm_vpn_get_plugins() to nm_vpn_get_plugin_infos()Thomas Haller2016-06-153-6/+6
| |
| * nmcli: fix VPN export to find plugin by service-typeThomas Haller2016-06-151-1/+1
| |
| * libnm/vpn: add nm_vpn_plugin_info_get_aliasesThomas Haller2016-06-153-2/+31
| |
| * all: use nm_strcmp_p() for sorting stringsThomas Haller2016-06-152-17/+2
| |
| * clients: fix potential crash due to wrong sort functionThomas Haller2016-06-151-7/+1
| | | | | | | | | | | | | | g_qsort_with_data() passes the pointers to the compared items to the compare function, that is not the "const char *" pointers itself. Fixes: 41976e30690d36cc3998c5025ac70c8cbaa8f897
| * shared: add nm_strcmp_p() utils macroThomas Haller2016-06-151-0/+30
|/
* libnm: backport symbols nm_setting_ip_config_get_dns_priority to libnm_1_2_4Thomas Haller2016-06-102-0/+5
| | | | | | | | | Commit bdd0e7fec0a2af12331b815bfaf3de182ed6eebb which added symbol nm_setting_ip_config_get_dns_priority to libnm_1_4_0 was backported to nm-1-2 in commit ad1cdcf6571da23e3197b09f1b4b14d23b8899d1. Add the backported symbol to master to allow seemless upgrading from 1.2.4 to 1.4.0.
* all: merge branch 'th/assert-expr-strings-bgo767296'Thomas Haller2016-06-096-103/+157
|\ | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=767296
| * build: remove assertion messages in non-debug buildThomas Haller2016-06-092-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assertions like g_assert*() and g_return_*() contain the stringified test expression. This string ends up in the binary and increases its size. We usually don't have failing assertions. These string are a waste, instead the file and line number shall suffice. It reduces the striped size of the NetworkManager binary from 2500k to 2392k, that is -108k, -4.3%. This changes - "g_assert (1 == 2);" from: NetworkManager:ERROR:source.c:347:some_function: assertion failed: (1 == 2) to: NetworkManager:ERROR:source.c:347:<unknown-fcn>: assertion failed: (<dropped>) - "g_return_if_fail (1 == 2);" from: (process:21024): NetworkManager-CRITICAL **: some_function: assertion '1 == 2' failed to: (process:21024): NetworkManager-CRITICAL **: ((source.c:347)): assertion '<dropped>' failed When doing a non-debug build, those string are now removed. Debug-builds can be enabled by setting --with-more-assert=$LEVEL to larger then zero. https://bugzilla.gnome.org/show_bug.cgi?id=767296
| * tests: add macro NMTST_G_RETURN_MSG for expecting g_return*() failuresThomas Haller2016-06-095-103/+108
|/ | | | | | A failure to g_return*() by default prints a g_critical() with stringifing the condition. Add a macro NMTST_G_RETURN_MSG() that reproduces that line to more accurately match the failure message.
* platform: tests: skip already used macvtap ifindexesBeniamino Galvani2016-06-071-0/+21
| | | | | | | | | | | In old kernel versions the creation of a macvtap can fail if its ifindex is already used by a macvtap in another namespace, because of a conflict in sysfs entries generation [1]. Try to detect this situation in platform tests and skip an ifindex if already in use. [1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=17af2bce88d31e65ed73d638bb752d2e13c66ced