summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* device: disable IPv6 on links when they're not ready for autoconfigurationlr/ipv6-with-carrierLubomir Rintel2018-07-271-11/+16
| | | | | | | | Otherwise kernel logs a line every time we up a device that is not ready for IPv6 autoconfiguration (that is every 5 minutes when a random MAC address is genreated for Wi-Fi scanning), flooding its message buffer: IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
* build: add a some missing dependenciesLubomir Rintel2018-07-261-0/+2
| | | | | | | | | | | | | | | | | | | | | CC src/devices/ovs/src_devices_ovs_libnm_device_plugin_ovs_la-nm-device-ovs-bridge.lo In file included from src/devices/ovs/nm-device-ovs-bridge.c:20: In file included from ./shared/nm-default.h:307: In file included from ./src/nm-logging.h:25: ./libnm-core/nm-core-types.h:28:10: fatal error: 'nm-core-enum-types.h' file not found #include "nm-core-enum-types.h" ^~~~~~~~~~~~~~~~~~~~~~ 1 error generated. CC src/settings/plugins/ifupdown/src_settings_plugins_ifupdown_libnms_ifupdown_core_la-nms-ifupdown-interface-parser.lo In file included from src/settings/plugins/ifupdown/nms-ifupdown-interface-parser.c:23: In file included from ./shared/nm-default.h:307: In file included from ./src/nm-logging.h:25: ./libnm-core/nm-core-types.h:28:10: fatal error: 'nm-core-enum-types.h' file not found #include "nm-core-enum-types.h" ^~~~~~~~~~~~~~~~~~~~~~ 1 error generated. make: *** [Makefile:13904: src/settings/plugins/ifupdown/src_settings_plugins_ifupdown_libnms_ifupdown_core_la-nms-ifupdown-interface-parser.lo] Error 1
* nm-setting: add missing initializersLubomir Rintel2018-07-261-4/+4
| | | | Fixes: f957ea2b343828ad1fa2014bc7a4dedaf854f3bc
* core/setting: rework nm_connection_dump()Lubomir Rintel2018-07-262-39/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Utilize _nm_setting_to_dbus() to serialize the setting. The main reason is that this way we can also print the more complicated values g_strdup_value_contents() can't grok, e.g. the GArrays and GHashTables. Some effort was spent on tidying up the results in a manner it was done previously, instead of reducing this to a plain g_variant_print(). It looks good that way: Before: vpn service-type : "org.freedesktop.NetworkManager.VPN.Novpn" (s) user-name : NULL (sd) persistent : FALSE (sd) data : ((GHashTable*) 0xc61060) (s) secrets : ((GHashTable*) 0xdda640) (s) timeout : 0 (sd) After: vpn service-type : 'org.freedesktop.NetworkManager.VPN.Novpn' data : {'gateway': 'novpn.example.com', 'username': 'hello'} secrets : {'password': 'world'} Note that no effort was spent on printing the defaults. There are multiple ways that could be achieved, but I'm not sure it would be all that necessary given this is really just a quick'n'dirty debugging facilty.
* libnm: add g_autoptr function for more typesLubomir Rintel2018-07-261-0/+3
| | | | Not sure why there missing, perhaps an oversight.
* build: avoid AC_CHECK_FILE() due to problems with cross-compilationThomas Haller2018-07-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | AC_CHECK_FILE() does not work for cross compilation. Autoconf documentation says: Be aware that, like most Autoconf macros, they test a feature of the host machine, and therefore, they die when cross-compiling. [1] Test for the existance of the file directly. Of course, when cross compiling, it's not at all clear that the host machine will run the same distribution. And thus detecting --enable-ifcfg-rh based on the build machine is likely wrong. Note, that we already did AS_IF([test -z "$hostname_persist" -a -f /etc/SuSE-release], hostname_persist=suse) which has the same problem. At least, build no longer fails, and the user can inspect the ./configure summary and see which features were misdetected. [1] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Files.html
* cli: merge branch 'th/cli-connection-handling-4'Thomas Haller2018-07-25864-36537/+67335
|\ | | | | | | https://github.com/NetworkManager/NetworkManager/pull/168
| * cli: remove unused argument from nm_meta_selection_create_parse_list()Thomas Haller2018-07-254-6/+3
| |
| * cli: reuse existing nm_meta_abstract_infos_get_names_str()Thomas Haller2018-07-251-17/+11
| | | | | | | | ... in nm_meta_abstract_info_get_nested_names_str().
| * cli: don't explicitly unset out_to_free argument in NMMetaType.get_nested()Thomas Haller2018-07-253-4/+2
| | | | | | | | | | | | | | The virtual function NMMetaType.get_nested() has only one caller: nm_meta_abstract_info_get_nested(). That caller makes sure to always pass in an @out_to_free argument, and that it is initialized to NULL.
| * cli: drop local variable multiline in _print_do()Thomas Haller2018-07-251-8/+7
| | | | | | | | | | | | | | | | | | | | The local variable was just a copy of the (unchanging) configuration nmc_config->multiline_output. It is complicated enough to understand how nmc_config->print_output and nmc_config->multiline_output affects nmc_print(). Don't use an alias when referencing to nmc_config->multiline_output because it hides where the value is used and where it causes a difference.
| * cli: simplify tracking of parent column in PrintDataCol structureThomas Haller2018-07-251-9/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PrintDataCol contains a reference to the parent structure, for which it was created. Previously, that was expressed via the "parent_idx" field, which is an index into the list of all PrintDataCol entries. That is inconvenient. Resolve the index to the actual pointer. Note that during _output_selection_append() we still need to use the index instead of resolving the pointer right away. That is because _output_selection_append() grows the GArray into which the parent_idx pointers to. So, obtaining the real pointer at that point would result in using a dangling pointer later on. Introduce a new step _output_selection_complete() which converts the index into the actual pointer.
| * cli: minor cleanup explicitly checking print_outputThomas Haller2018-07-254-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | The print-output knows three modes: NORMAL, PRETTY, TERSE. Never compare whether a mode is != a particular mode. Instead, always explicitly check for the modes for which we enable a particular behavior. The effect is, that we always do something when the mode is set to a particular value. We don't ever do something, if the mode is not set to a particular value. Consistently opt-in is easier to understand.
| * cli: minor cleanup evaluating print_outputThomas Haller2018-07-251-21/+39
| | | | | | | | | | | | | | | | | | | | | | | | The print-output knows three modes: NORMAL, PRETTY, TERSE. Instead of using local variables "pretty" and "terse", check for the output mode directly. Note how we have tree modes, so mapping them to two boolean variables is confusing. Especially at one place where we did: pretty = (nmc_config->print_output != NMC_PRINT_TERSE); while at other places: pretty = (nmc_config->print_output == NMC_PRINT_PRETTY);
| * cli: minor cleanup in _print_data_cell_clear_text()Thomas Haller2018-07-251-10/+13
| | | | | | | | | | | | | | It wasn't entirely clear what this was doing. Like before, free and clear the text pointers. However, also always reset the text_format back to PLAIN.
| * cli: fix skipping columns with all default-valuesThomas Haller2018-07-252-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The header-cell is the header for a column with possibly many rows. We must not set: header_cell->skip = nmc_config->overview && is_default; for a particular cell, because it does not take into accound the neighbouring rows. It is only correct, if there is only one row. Invert the logical meaning and rename "strip" to "to_print". Each cell then can opt-in, whether it needs to be printed. Only if no cell opts-in, it will be skipped. Fixes: 9a19bbcb2f6b78be2541334a0d650e765a11fa2b
| * cli: don't translate device state in --terse modeThomas Haller2018-07-252-85/+86
| |
| * cli/tests: cache UUID for test replacement in stdoutThomas Haller2018-07-255-1342/+1351
| | | | | | | | | | | | | | | | | | | | | | | | Instead of re-fetching the UUID each time with a D-Bus call, cache/memoize it. On my system, this improves $ make check-local-clients-tests-test-client from 20.9 to 20.4 seconds (- 2.6%). That is not stellar, but noticible enough to warrant this simple change.
| * cli/tests: avoid duplicate --terse option in testsThomas Haller2018-07-252-1354/+3758
| | | | | | | | | | | | | | | | | | These nmcli calls are inside a Util.iter_nmcli_output_modes() loop, hence, --terse will passed to them already. Specifying --terse more than once, causes nmcli to fail. We didn't actually want to test how nmcli rejects such duplicate arguments. Adjust the test.
| * cli/tests: add more tests for nmcli outputThomas Haller2018-07-252-424/+32097
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add more tests for various output modes of nmcli. This most interestingly includes a terse output for $ nmcli device status Which was not tested previously (but a later commit will change behavior here). This blows up the number of tests even further. Previously, the test invoked nmcli 850 times (taking ~15 seconds ony my machine), afterwards, it is 1334 times (taking ~20 seconds). No doubt, this seems excessive and questionable. However, I maintain that the computer doesn't mind running a lot of redundant tests. The important thing is, that we cover as many cases as possible. Trying at the same time to minimize the number of tests by avoiding duplicates and redundant tests, is just a lot of manual labor. Manual labor that must be repeated whenever new tests are added, to ensure that this test case is not yet covered. So, I am fine with the large number of tests. Let the computer do the work.
| * cli/tests: rework clients-tests.py to combine .expected outputThomas Haller2018-07-25857-36406/+33063
|/ | | | | | | | | | | | | | | | Instead of letting each nmcli run write an individual .expected file, combine the output of multiple runs in one file (per test). Advantages: - since there is a very large number of tests, having a file for each tests is cumbersome. For example, since they are all added to $(EXTRA_DIST) (and since we use non-recursive make), autoconf can easily hit a length limit when processing all the file names. - previously, whenever we added tests, all .expected files shifted and the diff was large. Now, there is a chance that the diff is smaller and more accurate.
* release: bump version to 1.13.2 (development)1.13.2-devLubomir Rintel2018-07-252-2/+2
|
* libnm: add nm_device_ovs_*_get_slaves()Lubomir Rintel2018-07-241-0/+2
| | | | | | | They were missing. Add them to the 1.12.2 node, because they've been backported. See-also: https://github.com/NetworkManager/NetworkManager/pull/172
* build: do not randomize tests by defaultLubomir Rintel2018-07-241-10/+17
| | | | | We don't want the users to default to running the code paths in tests that we didn't check before. They may end up failing randomly.
* rpm: own /etc/sysconfig/network-scriptsLubomir Rintel2018-07-242-0/+6
| | | | | We don't rely on initscripts. If they're gone, we still use the directory.
* connectivity: merge branch 'th/connectivity-busy-loop-fix'Thomas Haller2018-07-241-24/+65
|\
| * connectivity: avoid busy looping with connectivity-check failedThomas Haller2018-07-241-11/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems, curl_multi_socket_action() can fail with connectivity check failed: 4 where "4" means CURLM_INTERNAL_ERROR. When that happens, it also seems that the file descriptor may still have data to read, so the glib IO callback _con_curl_socketevent_cb() will be called in an endless loop. Thereby, keeping the CPU busy with doing nothing (useful). Workaround by disabling polling on the file descriptor when something goes wrong. Note that optimally we would cancel the affected connectivity-check right away. However, due to the design of libcurl's API, from within _con_curl_socketevent_cb() we don't know which connectivity-checks are affected by a failure on this file descriptor. So, all we can do is avoid polling on the (possibly) broken file descriptor. Note that we anyway always schedule a timeout of last resort for each check. Even if something goes very wrong, we will fail the check within 15 seconds. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=903996
| * connectivity: add compile time check that "curl_socket_t" is a typedef to ↵Thomas Haller2018-07-241-0/+2
| | | | | | | | | | | | | | | | | | plain "int" On non-Windows, libcurl's "curl_socket_t" type is just a typedef for int. We rely on that, because we use it as file descriptor. Add a compile time check to ensure that.
| * connectivity/trivial: rename socket argument in multi_socket_cb() callbackThomas Haller2018-07-241-4/+4
| | | | | | | | | | | | "s" might be a good name for a temporary string. But here it's really a file descriptor. Call it "fd".
| * connectivity/trivial: rename local functions to avoid "curl" prefixThomas Haller2018-07-241-12/+12
|/ | | | | | | | | Since this is "C" there are not namespaces and libraries commonly choose a particular name prefix for their symbols. In case of libcurl, that is "curl_". We should avoid using the same name prefix, and choose something distinct.
* device: merge branch 'th/not-available-reason'Thomas Haller2018-07-2441-771/+1144
|\ | | | | | | https://github.com/NetworkManager/NetworkManager/pull/163
| * core: improve error message when activating profileThomas Haller2018-07-241-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: $ nmcli connection up my-wired Error: Connection activation failed: No suitable device found for this connection. After: $ nmcli connection up my-wired Error: Connection activation failed: No suitable device found for this connection (device eth0 not available because device has no carrier). This relies on nm_manager_get_best_device_for_connection() giving a suitable error. That is however a bit complicated, because if no suitable device is found, it's not immediately clear what is the exact reason. E.g. if you try to activate a Wi-Fi profile, the failure reason "SSID is not visible" is better than "Wi-Fi profile cannot activate on ethernet device". This is controlled by carefully setting the failure codes NM_UTILS_ERROR_CONNECTION_AVAILABLE_* to indicate an absolute relevance of the failure. And subsequently, by selecting the failure with the highest relevance. This might still need some improvements, for example by reordering checks (so that more relevant failures are handled first) and tweaking the error relevance.
| * core: improve error message when activating profile on deviceThomas Haller2018-07-241-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | Before: $ nmcli connection up my-wired ifname eth0 Error: Connection activation failed: Connection 'my-wired' is not available on the device eth0 at this time. After: $ nmcli connection up my-wired ifname eth0 Error: Connection activation failed: Connection 'my-wired' is not available on device eth0 because device has no carrier
| * core: return error reason from nm_manager_get_best_device_for_connection()Thomas Haller2018-07-241-6/+47
| | | | | | | | | | | | | | | | | | | | Still unused, but will be used to give a better failure reason when no device is found. The difficulty here is to select the failure message from the most appropriate device. This might still need some tweaking by setting the error codes accordingly and re-ordering checks so that failure cares that are more accurate are handled first.
| * core: give better error reason why device is incompatible with profileThomas Haller2018-07-2436-451/+523
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note the special error codes NM_UTILS_ERROR_CONNECTION_AVAILABLE_*. This will be used to determine, whether the profile is fundamentally incompatible with the device, or whether just some other properties mismatch. That information will be importand during a plain `nmcli connection up`, where NetworkManager searches all devices for a device to activate. If no device is found (and multiple errors happened), we want to show the error that is most likely relevant for the user. Also note, how NMDevice's check_connection_compatible() uses the new class field "device_class->connection_type_check_compatible" to simplify checks for compatible profiles. The error reason is still unused.
| * core: give better error reason why device is unavailableThomas Haller2018-07-249-60/+195
| | | | | | | | The error reason is still unused.
| * shared: add special error codes to NM_UTILS_ERRORThomas Haller2018-07-241-0/+28
| | | | | | | | Will be used next.
| * device: replace NM_DEVICE_CLASS_DECLARE_TYPES() macro by explicit initializationThomas Haller2018-07-2424-69/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems to me the NM_DEVICE_CLASS_DECLARE_TYPES() macro confuses more than helping. Let's explicitly initialize the two fields, albeit with another helper macro NM_DEVICE_DEFINE_LINK_TYPES() to get the list of link-types right. For consistency, also leave nop-lines like device_class->connection_type_supported = NULL; device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (); because all NMDevice class init methods should have this same boiler plate code and to make it explicit that this is intended. And there are only 3 occurences where this actually comes into play.
| * device: also use NM_DEVICE_CLASS_DECLARE_TYPES() for types without link-typesThomas Haller2018-07-243-5/+13
| | | | | | | | | | | | | | | | NMDeviceOvsPort and NMDeviceOvsInterface don't have an underlying link-type from platform. Still use NM_DEVICE_CLASS_DECLARE_TYPES() macro, for consistancy reasons. This requires to extend NM_DEVICE_CLASS_DECLARE_TYPES() macro, to support a variadic argument list with zero link-types.
| * device: use NM_DEVICE_CLASS_DECLARE_TYPES() to set connection_type_supported ↵Thomas Haller2018-07-249-17/+9
| | | | | | | | | | | | of device class the macro already does it just fine. Use it.
| * device: wrap NM_DEVICE_CLASS_DECLARE_TYPES() macro with do-while blockThomas Haller2018-07-2420-24/+27
| |
| * device/trivial: rename NMDeviceClass.connection_type to ↵Thomas Haller2018-07-2413-15/+16
| | | | | | | | | | | | connection_type_supported The term "connection_type" is overused. Give it a more distinct name.
| * core/trival: rename nm_device_match_hwaddr() function to ↵Thomas Haller2018-07-245-11/+11
| | | | | | | | | | | | | | nm_device_match_parent_hwaddr() This name is better, because it compares the MAC address of the device's parent.
| * device/trivial: rename parent-class variable in device class constructorThomas Haller2018-07-2413-176/+176
| | | | | | | | | | | | | | | | The majority of device implementations name their parent-class variable "device_class". That also makes more sense as it is more consistant. E.g. "parent" sounds like it's the direct parent, but that is not the crucial point here. The crucial point at this place, is that we access the NMDeviceClass typed pointer. Rename.
| * wwan/trivial: rename NMModemClass.check_connection_compatible() to use ↵Thomas Haller2018-07-244-9/+9
| | | | | | | | | | | | | | | | | | | | unique name We also have NMDeviceClass.check_connection_compatible(). It is preferable to use unique names, especially for the virtual function table. A reasonable thing to do is grep for the function name to find all places that implement this function. But if different classes use the same name, grep just turns up annoying false positives.
| * shared: add nm_utils_error_set*() helper macrosThomas Haller2018-07-241-0/+9
| | | | | | | | Add helper macros to type less.
| * shared: support zero arguments for NM_NARG() macroThomas Haller2018-07-242-2/+58
|/ | | | | | | It relies on the GCC extension ##__VA_ARGS__, but we do that on various places already. Also add a test.
* dhcp/dhclient-utils: skip over dhclient.conf blocksLubomir Rintel2018-07-232-9/+110
| | | | | | | | | | | | | | Extend the lame-ass dhclient.conf parser to ignore the blocks we can't do anything useful about: alias{}, pseudo{} and even lease{}. Note that there's still a lot of cases we can't handle without a full-fledged dhclient.conf parser -- notably the files that don't use line breaks to separate the statements. That is probably okay -- the whole thing is probably mostly useless and we shall ever bother only about cases that actually cause trouble. https://github.com/NetworkManager/NetworkManager/pull/153
* contrib/rpm: add RHEL connectivity checking packageLubomir Rintel2018-07-233-0/+40
| | | | https://github.com/NetworkManager/NetworkManager/pull/166
* contrib/rpm: use whitespace consistentlyLubomir Rintel2018-07-231-0/+24
| | | | Double newline is used to visually separate sections.