summaryrefslogtreecommitdiff
path: root/clients/tui
Commit message (Collapse)AuthorAgeFilesLines
* libnm,core: use _nm_utils_ascii_str_to_uint64() instead of strtol()Thomas Haller2019-02-121-2/+2
| | | | | | | Using strtol() correctly proves to be hard. Usually, we want to also check that the end pointer is points to the end of the string. Othewise, we silently accept trailing garbage.
* all: drop unnecessary includes of <errno.h> and <string.h>Thomas Haller2019-02-1218-35/+15
| | | | | "nm-macros-interal.h" already includes <errno.h> and <string.h>. No need to include it everywhere else too.
* clients: don't tread secret agent as NMSecretAgentOldThomas Haller2019-02-051-4/+4
| | | | | | | | Most of the times we actually need a NMSecretAgentSimple typed pointer. This way, need need to cast less. But even if we would need to cast more, it's better to have pointers point to the actual type, not merely to avoid shortcomings of C.
* build: meson: Add trailing commasIñigo Martínez2018-12-202-7/+7
| | | | | | | Add missing trailing commas that avoids getting noise when another file/parameter is added and eases reviewing changes[0]. [0] https://gitlab.gnome.org/GNOME/dconf/merge_requests/11#note_291585
* docs: misc. typosluz.paz2018-09-153-3/+3
| | | | | | Found via `codespell -q 3 --skip="*.po"` https://github.com/NetworkManager/NetworkManager/pull/203
* cli: fix reading "vpn.secrets.*" from passwd-fileThomas Haller2018-09-141-3/+3
| | | | | | | | | | | | | | | | Due to a bug, we required VPN secrets to be prefixed with "vpn.secret." instead of "vpn.secrets.". This was a change in behavior with 1.12.0 release. Fix it, to restore the old behavior. For backward compatibility to the broken behavior, adjust parse_passwords() to treat accept that as well. https://bugzilla.redhat.com/show_bug.cgi?id=1628833 https://github.com/NetworkManager/NetworkManager/pull/201 Fixes: 0601b5d725b072bd3ce4ec60be867898a16f85cd (cherry picked from commit 5815ae8c60961f088e4e54b41ddf8254cb83574a)
* build: create "config-extra.h" header instead of passing directory variables ↵Thomas Haller2018-07-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | via CFLAGS 1) the command line gets shorter. I frequently run `make V=1` to see the command line arguments for the compiler, and there is a lot of noise. 2) define each of these variables at one place. This makes it easy to verify that for all compilation units, a particular define has the same value. Previously that was not obvious or even not the case (see commit e5d1a71396e107d1909744d26ad401f206c0c915 and commit d63cf1ef2faba57595112a82e962b9643cce4718). The point is to avoid redundancy. 3) not all compilation units need all defines. In fact, most modules would only need a few of these defines. We aimed to pass the necessary minium of defines to each compilation unit, but that was non-obvious to get right and often we set a define that wasn't used. See for example "src_settings_plugins_ibft_cppflags" which needlessly had "-DSYSCONFDIR". This question is now entirely avoided by just defining all variables in a header. We don't care to find the minimum, because every component gets anyway all defines from the header. 4) this also avoids the situation, where a module that previously did not use a particular define gets modified to require it. Previously, that would have required to identify the missing define, and add it to the CFLAGS of the complation unit. Since every compilation now includes "config-extra.h", all defines are available everywhere. 5) the fact that each define is now available in all compilation units could be perceived as a downside. But it isn't, because these defines should have a unique name and one specific value. Defining the same name with different values, or refer to the same value by different names is a bug, not a desirable feature. Since these defines should be unique accross the entire tree, there is no problem in providing them to every compilation unit. 6) the reason why we generate "config-extra.h" this way, instead of using AC_DEFINE() in configure.ac, is due to the particular handling of autoconf for directory variables. See [1]. With meson, it would be trivial to put them into "config.h.meson". While that is not easy with autoconf, the "config-extra.h" workaround seems still preferable to me. [1] https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Installation-Directory-Variables.html
* all: don't use gchar/gshort/gint/glong but C typesThomas Haller2018-07-114-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We commonly don't use the glib typedefs for char/short/int/long, but their C types directly. $ git grep '\<g\(char\|short\|int\|long\|float\|double\)\>' | wc -l 587 $ git grep '\<\(char\|short\|int\|long\|float\|double\)\>' | wc -l 21114 One could argue that using the glib typedefs is preferable in public API (of our glib based libnm library) or where it clearly is related to glib, like during g_object_set (obj, PROPERTY, (gint) value, NULL); However, that argument does not seem strong, because in practice we don't follow that argument today, and seldomly use the glib typedefs. Also, the style guide for this would be hard to formalize, because "using them where clearly related to a glib" is a very loose suggestion. Also note that glib typedefs will always just be typedefs of the underlying C types. There is no danger of glib changing the meaning of these typedefs (because that would be a major API break of glib). A simple style guide is instead: don't use these typedefs. No manual actions, I only ran the bash script: FILES=($(git ls-files '*.[hc]')) sed -i \ -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>\( [^ ]\)/\1\2/g' \ -e 's/\<g\(char\|short\|int\|long\|float\|double\)\> /\1 /g' \ -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>/\1/g' \ "${FILES[@]}"
* build: unifiy specifying locale directory defineThomas Haller2018-05-312-2/+2
|
* all: use the elvis operator wherever possibleLubomir Rintel2018-05-102-6/+6
| | | | | | | | | | | | | | | | | | | | | Coccinelle: @@ expression a, b; @@ -a ? a : b +a ?: b Applied with: spatch --sp-file ternary.cocci --in-place --smpl-spacing --dir . With some manual adjustments on spots that Cocci didn't catch for reasons unknown. Thanks to the marvelous effort of the GNU compiler developer we can now spare a couple of bits that could be used for more important things, like this commit message. Standards commitees yet have to catch up.
* all: remove consecutive empty linesBeniamino Galvani2018-04-306-6/+0
| | | | | | | Normalize coding style by removing consecutive empty lines from C sources and headers. https://github.com/NetworkManager/NetworkManager/pull/108
* all: unify spelling of translators hint in source codeThomas Haller2018-04-131-1/+1
| | | | | | | | | Use the same form everywhere: "TRANSLATORS" instead of "Translators". The manual also seems to prefer the upper-case form [1]. $ sed 's/\<Translators\>: /TRANSLATORS: /g' $(git grep -l Translators) -i [1] https://www.gnu.org/software/gettext/manual/gettext.html
* all: fix -Wcast-function-type warningsLubomir Rintel2018-02-081-1/+1
| | | | | | | | | | | GCC 8.0's -Wcast-function-type objects casting function pointers to ones with incompatible prototypes. Sometimes we do that on purpose though. Notably, the g_source_set_callback()'s func argument can point to functions of various prototypes. Also, libnm-glib/nm-remote-connection is perhaps just not worth reworking, that would just be a waste of time. A cast to void(*)(void) avoids the GCC warning, let's use it.
* all: drop trailing spacesThomas Haller2018-02-074-4/+4
|
* all: replace non-leading tabs with spacesThomas Haller2018-02-077-21/+21
| | | | | | We commonly only allow tabs at the beginning of a line, not afterwards. The reason for this style is so that the code looks formated right with tabstop=4 and tabstop=8.
* all: require glib 2.40lr/glib-2-40Lubomir Rintel2018-01-181-10/+0
| | | | | | RHEL 7.1 and Ubuntu 14.04 LTS both have this. https://bugzilla.gnome.org/show_bug.cgi?id=792323
* build/meson: use variables for ldflags and linker-scriptThomas Haller2018-01-111-5/+1
|
* build/meson: unconditionally use linker version scriptsThomas Haller2018-01-101-4/+3
| | | | | | | We also unconditionally use them with autotools. Also, the detection for have_version_script does not seem correct to me. At least, it didn't work with clang.
* meson: Use string variables extensivelyIñigo Martínez2018-01-101-2/+4
| | | | | | | The strings holding the names used for libraries have also been moved to different variables. This way they would be less error as these variables can be reused easily and any typing error would be quickly detected.
* meson: Improve dependency systemIñigo Martínez2018-01-102-16/+8
| | | | | | | | | | | | | | | | | | | | Some targets are missing dependencies on some generated sources in the meson port. These makes the build to fail due to missing source files on a highly parallelized build. These dependencies have been resolved by taking advantage of meson's internal dependencies which can be used to pass source files, include directories, libraries and compiler flags. One of such internal dependencies called `core_dep` was already in use. However, in order to avoid any confusion with another new internal dependency called `nm_core_dep`, which is used to include directories and source files from the `libnm-core` directory, the `core_dep` dependency has been renamed to `nm_dep`. These changes have allowed minimizing the build details which are inherited by using those dependencies. The parallelized build has also been improved.
* clients: drop redundant #include "NetworkManager.h"Thomas Haller2018-01-0817-33/+0
| | | | This header is already included by "nm-default.h".
* build: refine the NETWORKMANAGER_COMPILATION defineThomas Haller2018-01-081-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Note that: - we compile some source files multiple times. Most notably those under "shared/". - we include a default header "shared/nm-default.h" in every source file. This header is supposed to setup a common environment by defining and including parts that are commonly used. As we always include the same header, the header must behave differently depending one whether the compilation is for libnm-core, NetworkManager or libnm-glib. E.g. it must include <glib/gi18n.h> or <glib/gi18n-lib.h> depending on whether we compile a library or an application. For that, the source files need the NETWORKMANAGER_COMPILATION #define to behave accordingly. Extend the define to be composed of flags. These flags are all named NM_NETWORKMANAGER_COMPILATION_WITH_*, they indicate which part of the build are available. E.g. when building libnm-core.la itself, then WITH_LIBNM_CORE, WITH_LIBNM_CORE_INTERNAL, and WITH_LIBNM_CORE_PRIVATE are available. When building NetworkManager, WITH_LIBNM_CORE_PRIVATE is not available but the internal parts are still accessible. When building nmcli, only WITH_LIBNM_CORE (the public part) is available. This granularily controls the build.
* build: Remove default install directoriesIñigo Martínez2018-01-021-2/+1
| | | | | | | | | | The install directories of those targets that match the default install directories have been removed because they are redundant. This also allows a simple meson build files and it is unnecessary to create some paths. https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00078.html
* libnm-core: move detection of UTF-8 capable terminals to clients/Lubomir Rintel2017-12-181-2/+3
| | | | | | | | Having it in libnm doesn't make any sense and prevents using it for more internal functionality. Too bad nm_utils_wifi_strength_bars() is already a public API. No problem -- replace it with a compatible yet dumber equivalent.
* all: get rid of a handful of unused-but-set variablesLubomir Rintel2017-12-181-2/+0
|
* build: use template files for enum types' sources generationIñigo Martínez2017-12-182-2/+2
| | | | | | | | | | Source files for enum types are generated by passing segments of the source code of the files to the `glib-mkenums` command. This patch removes those parameters where source code is used from meson build files by moving those segmeents to template files. https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00057.html
* build: add initial support for meson build systemIñigo Martínez2017-12-132-0/+117
| | | | | | | | | | meson is a build system focused on speed an ease of use, which helps speeding up the software development. This patch adds meson support along autotools. [thaller@redhat.com: rebased patch and adjusted for iwd support] https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00022.html
* tui: fix creation of open Wi-Fi connectionsBeniamino Galvani2017-11-302-5/+28
| | | | | | | | | | | | | | | | | | | | Commit 6a4af482f02c ("nmtui: always create ethernet settings for VLAN and wireless security for wifi.") changed nmtui to always add the wireless security setting to the new connection, but without initializing it. This leads to a crash that was fixed in 40fcf67a8415 ("tui: fix crash creating Wi-Fi connection"). There is an additional bug: connections without authentication can't be saved because the wireless security setting has uninitialized fields. To fix this, revert both patches (the first partially) because the previous code did the right thing as it added the setting only when needed. Fixes: 6a4af482f02c4342c69cd38dd46c078aeaf60d0d https://bugzilla.redhat.com/show_bug.cgi?id=1518167
* clients: some cleanup of requesting VPN secretsThomas Haller2017-11-232-25/+22
|
* all: include "nm-utils/nm-hash-utils.h" by defaultThomas Haller2017-11-161-2/+0
| | | | | | | | | Next we will use siphash24() instead of the glib version g_direct_hash() or g_str_hash(). Hence, the "nm-utils/nm-hash-utils.h" header becomes very fundamental and will be needed basically everywhere. Instead of requiring the users to include them, let it be included via "nm-default.h" header.
* all: use nm_close() instead of close()Thomas Haller2017-11-141-1/+1
|
* core,clients: use our own string hashing function nm_str_hash()Thomas Haller2017-10-181-2/+4
| | | | | | | | | | | | | | | | | | | | Replace the usage of g_str_hash() with our own nm_str_hash(). GLib's g_str_hash() uses djb2 hashing function, just like we do at the moment. The only difference is, that we use a diffrent seed value. Note, that we initialize the hash seed with random data (by calling getrandom() or reading /dev/urandom). That is a change compared to before. This change of the hashing function and accessing the random pool might be undesired for libnm/libnm-core. Hence, the change is not done there as it possibly changes behavior for public API. Maybe we should do that later though. At this point, there isn't much of a change. This patch becomes interesting, if we decide to use a different hashing algorithm.
* tui: fix memory leakbg/tui-activation-rh1500651Beniamino Galvani2017-10-161-0/+2
|
* tui: improve tracking of activation stateBeniamino Galvani2017-10-161-21/+53
| | | | | | | | | | nmtui determines the activation result by tracking the active connection state but that is not enough, as the active connection may disappear or because we need to consider also the device state in some particular cases. Use the same logic implemented in nmcli that is now provided by the nmc_activation_get_effective_state() helper.
* tui: add group-forward-mask property to bridge pageBeniamino Galvani2017-10-131-0/+6
| | | | | | | The validation on allowed bits is done when the user saves the connection. https://bugzilla.redhat.com/show_bug.cgi?id=1358615
* tui: fix crash creating Wi-Fi connectionThomas Haller2017-10-112-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When adding a new Wi-Fi connection, nmtui crashes. Usually, a verified Wi-Fi connection always has key_mgnt set. However, the client doesn't have the luxury to assume that all connections verify. Especially, while creating a new connection. #0 0x00007ffff4fe5baa in __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31 #1 0x000055555556654c in get_security_type (binding=0x5555557d1cf0) at clients/tui/nm-editor-bindings.c:591 #2 0x000055555556593b in wireless_security_changed (object=0x0, pspec=0x0, user_data=0x5555557d1cf0) at clients/tui/nm-editor-bindings.c:628 #3 0x000055555556536d in nm_editor_bind_wireless_security_method (connection=0x5555558028e0, s_wsec=0x555555892eb0 [NMSettingWirelessSecurity], target=0x555555935e10, target_property=0x55555559311b "active-id", flags=(G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE)) at clients/tui/nm-editor-bindings.c:796 #4 0x000055555557a3aa in nmt_page_wifi_constructed (object=0x5555559349e0 [NmtPageWifi]) at clients/tui/nmt-page-wifi.c:338 #5 0x00007ffff5e6b670 in g_object_new_internal (class=class@entry=0x5555557c14c0, params=params@entry=0x7fffffffc440, n_params=n_params@entry=2) at gobject.c:1823 #6 0x00007ffff5e6d24d in g_object_new_valist (object_type=object_type@entry=93824994775616, first_property_name=first_property_name@entry=0x5555555920c6 "connection", var_args=var_args@entry=0x7fffffffc590) at gobject.c:2042 #7 0x00007ffff5e6d691 in g_object_new (object_type=93824994775616, first_property_name=0x5555555920c6 "connection") at gobject.c:1626 #8 0x000055555557985a in nmt_page_wifi_new (conn=0x5555558028e0, deventry=0x5555557d15e0 [NmtDeviceEntry]) at clients/tui/nmt-page-wifi.c:45 #9 0x000055555556f7e2 in nmt_editor_constructed (object=0x555555922af0 [NmtEditor]) at clients/tui/nmt-editor.c:374 #10 0x00007ffff5e6b670 in g_object_new_internal (class=class@entry=0x555555932750, params=params@entry=0x7fffffffcac0, n_params=n_params@entry=4) at gobject.c:1823 #11 0x00007ffff5e6d24d in g_object_new_valist (object_type=object_type@entry=93824996288016, first_property_name=first_property_name@entry=0x5555555920c6 "connection", var_args=var_args@entry=0x7fffffffcc10) at gobject.c:2042 #12 0x00007ffff5e6d691 in g_object_new (object_type=93824996288016, first_property_name=0x5555555920c6 "connection") at gobject.c:1626 #13 0x000055555556f261 in nmt_editor_new (connection=0x555555802880) at clients/tui/nmt-editor.c:109 #14 0x0000555555562b35 in nmt_edit_connection (connection=0x555555802880) at clients/tui/nmtui-edit.c:448 #15 0x0000555555563a29 in create_connection (widget=0x55555588b150 [NmtNewtListbox], list=0x555555922a00) at clients/tui/nmtui-edit.c:185 #16 0x0000555555563a5d in create_connection_and_quit (widget=0x55555588b150 [NmtNewtListbox], list=0x555555922a00) at clients/tui/nmtui-edit.c:192 #20 0x00007ffff5e81b0f in <emit signal ??? on instance 0x55555588b150 [NmtNewtListbox]> (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3447 #17 0x00007ffff5e6630d in g_closure_invoke (closure=0x555555929260, return_value=0x0, n_param_values=1, param_values=0x7fffffffcfe0, invocation_hint=0x7fffffffcf60) at gclosure.c:804 #18 0x00007ffff5e7898e in signal_emit_unlocked_R (node=node@entry=0x55555582ac70, detail=detail@entry=0, instance=instance@entry=0x55555588b150, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffcfe0) at gsignal.c:3635 #19 0x00007ffff5e811a5 in g_signal_emit_valist (instance=0x55555588b150, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffd1b0) at gsignal.c:3391 #21 0x000055555558e43f in nmt_newt_widget_activated (widget=0x55555588b150 [NmtNewtListbox]) at clients/tui/newt/nmt-newt-widget.c:329 #22 0x0000555555584fc8 in nmt_newt_form_iterate (form=0x555555922a00 [NmtAddConnection]) at clients/tui/newt/nmt-newt-form.c:309 #23 0x0000555555585d62 in nmt_newt_form_keypress_callback (fd=1435623072, condition=G_IO_IN, user_data=0x0) at clients/tui/newt/nmt-newt-form.c:335 #24 0x00007ffff598a247 in g_main_dispatch (context=0x5555557c3af0) at gmain.c:3234 #25 0x00007ffff598a247 in g_main_context_dispatch (context=context@entry=0x5555557c3af0) at gmain.c:3899 #26 0x00007ffff598a5e8 in g_main_context_iterate (context=0x5555557c3af0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3972 #27 0x00007ffff598a902 in g_main_loop_run (loop=0x55555591b190) at gmain.c:4168 #28 0x00005555555609b5 in main (argc=1, argv=0x7fffffffd5e8) at clients/tui/nmtui.c:298 Fixes: 6a4af482f02c4342c69cd38dd46c078aeaf60d0d
* shared: pass addr_family as first argument to nm_utils_parse_inaddr*()Thomas Haller2017-10-062-32/+32
| | | | | | | The addr_family should be the first argument. It mirrors inet_pton() and is just nicer. Also, rename the argument from "family" to "addr_family".
* tui: extend range of route metric to full uint32Thomas Haller2017-09-052-5/+2
| | | | That is how kernel allows it and the rest of NetworkManager's API.
* tui: extend numeric range of NmtNewtEntryNumeric to gint64Thomas Haller2017-09-052-25/+25
| | | | | It is used for example for the route's metric, which is guint32 and may not fit into int type.
* tui: change default route metric of new routes to -1Thomas Haller2017-09-051-2/+2
| | | | | -1 means "unset" to allow fallback to the per-device metric. That shall be the preferred default.
* tui: guess the prefix length (netmask) of private IPv4 addresses and routes ↵Thomas Haller2017-09-052-73/+35
| | | | | | | | | | | | | | | | | | based on network class For RFC1918 private IPv4addresses, guess a better prefix length for addresses and routes. nmtui is an interactive program. It makes sense to be a bit smarter about what the user probably meant. It would be nice if nmtui would update the entry field immediately when the cursor leaves the field, to show the guessed prefix length. However, that is not easily possible, so lets to that another time. For IPv6 addresses, default to /64 instead of /128. https://bugzilla.redhat.com/show_bug.cgi?id=1474295
* tui: avoid integer overflow checking the range in NmtNewtEntryNumericThomas Haller2017-09-051-8/+2
| | | | | | | | | | | | strtoul() operates on "unsigned long" while NmtNewtEntryNumeric uses "int". strtoul() might indicate that the text is a valid "unsigned long", however, then casting to "int" might lead to truncation of the number and wrong range check. Also, the type supposedly handles negative integers as well. Not with strtoul().
* tui: allow empty route metric to indicate defaultThomas Haller2017-09-051-1/+1
| | | | | | When entering a manual route, the metric defaults internally to "-1". That is indicated in the TUI as empty entry. We must allow that as valid configuration.
* tui: extend NmtNewtEntryNumeric to allow optional empty entryThomas Haller2017-09-052-1/+52
|
* tui: add ignore-auto-dns property to IPv4 and IPv6 pagesBeniamino Galvani2017-09-012-0/+12
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1487084
* tui: use nm_streq0() in nmt_connect_connection_list_get_connection()Thomas Haller2017-05-301-9/+7
|
* nmtui connect: avoid segfault when iface is not foundArnaud Lefebvre2017-05-301-3/+7
| | | | https://github.com/NetworkManager/NetworkManager/pull/21
* nmtui: add support for cloned mac in bond interfacesNikolay Martynov2017-05-281-0/+14
| | | | | | | | | | This is useful because bond gets its mac from first slave and order of slave attachement is not guaranteed. For example if we have bond with wifi and ethernet we want mac from wifi to be use by bond interface because many wifi defices do now allow one to send data with spoofed macs. Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
* nmtui: always create ethernet settings for VLAN and wireless security for wifi.Nikolay Martynov2017-05-282-55/+5
| | | | | | | | | | | | | Ethernet settings for VLAN are always created later in settings normalization. We might as well always created them. This fixes a user visible problem: currently if user specifies cloned mac when connection is created this value doesn't get saved. User has to go, edit saved connection to add it again. Similar problem existed for wireless security and wifi Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
* all: use "unsigned" instead of "unsigned int"Thomas Haller2017-03-141-1/+1
|