summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* nmcli/connections: fix setting ifname with "--ask c add"lr/ask-modeLubomir Rintel2022-06-241-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We almost always do the wrong thing in interactive add: The software devices generally require an interactive name, but we don't insist of asking for them; treating them as optional: $ nmcli -a c add type dummy There is 1 optional setting for General settings. Do you want to provide it? (yes/no) [yes] For some interface types (bridges, bonds, ...) we make up a name, presumably for historical reasons. But we don't give the user an option to modify them: $ nmcli -a c add type bridge <not asking for interface name at all> There are 9 optional settings for Bridge device. Do you want to provide them? (yes/no) [yes] This fixes the above use cases -- still set the default, but be sure to ask: $ nmcli -a c add type dummy Interface name: $ nmcli -a c add type bridge Interface name [nm-bridge1]: Beautiful.
* nmcli/connections: make sure the connection has a base settingLubomir Rintel2022-06-241-0/+6
| | | | | | | | | | | | Do the same bookkeeping as would happen upon setting the "type" option when the connection has a connection.type set upon its addition. Otherwise the --ask mode is sad: $ nmcli --ask c add connection.type team ** nm:ERROR:src/nmcli/connections.c:5648:connection_get_base_meta_setting_type: assertion failed: (base_setting) Bail out! nm:ERROR:src/nmcli/connections.c:5648:connection_get_base_meta_setting_type: assertion failed: (base_setting) Aborted (core dumped)
* nmcli/connections: factor out code run after new connection's type is setLubomir Rintel2022-06-241-21/+33
| | | | | | | | | | | | | | | | | | | | | | | | After the connection's type is set, some bookkeeping is necessary for the interactive (--ask) mode: appropriate setting need to be added and options enabled. Currently it happens in an option setter; which runs when the "type" options is present on the command line, or the value is set in a response to interactive mode: $ nmcli --ask c add type team $ nmcli --ask c add Connection type: team But not when the property is set directly: $ nmcli --ask c add connection.type team ** nm:ERROR:src/nmcli/connections.c:5648:connection_get_base_meta_setting_type: assertion failed: (base_setting) Bail out! nm:ERROR:src/nmcli/connections.c:5648:connection_get_base_meta_setting_type: assertion failed: (base_setting) Aborted (core dumped) This doesn't fix the issue -- a followup commit (hopefully) will.
* nmcli/connections: use the current value in default in ask_option()Lubomir Rintel2022-06-243-37/+57
| | | | | | | | | | | For new connections, this ensures the value in square brackets on interactive add are always correct. Apart from that, this allows us to initialize some non-default values before asking (such as making up an interface name for some software devices), and inform the user about what we picked: Interface name [nm-bridge]:
* nmcli/connections: don't ask to ask with --askLubomir Rintel2022-06-241-9/+7
| | | | | | | | | | | | This is slightly annoying: $ nmcli -a c add type ethernet There is 1 optional setting for General settings. No point in asking if there's just one option. Just ask right away: $ nmcli -a c add type ethernet Interface name:
* nmcli/connections: make sure the connection has a typeLubomir Rintel2022-06-241-3/+10
| | | | | We use it before we validate the connection, thus need to check if it's actually there.
* nmcli/connections: make enable_options() always enable an optionLubomir Rintel2022-06-241-10/+6
|
* nmcli/connections: make opts argument to enable_options() optionalLubomir Rintel2022-06-241-6/+15
| | | | | This makes things slightly less annoying when dealing with options that map nicely to properties (unlike bridge options).
* nmcli/connections: allow empty lists with "--ask c add"Lubomir Rintel2022-06-241-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The interactive add is not too enthusiastic about not providing a value in a list. That is before on getting an empty line in ask_option() we take a shortcut instead of dispatching to set_option(). That way we skip setting the PROPERTY_INF_FLAG_DISABLED flag, causing the option to be included in questionnaire_one_optional()'s info list. There's no reason to avoid calling set_option() if we don't get a value; set_option() handles NULL value just fine. $ nmcli -a c add Connection type: dummy There is 1 optional setting for General settings. Do you want to provide it? (yes/no) [yes] Interface name [*]: lala There are 2 optional settings for IPv4 protocol. Do you want to provide them? (yes/no) [yes] You can specify this option more than once. Press <Enter> when you're done. IPv4 address (IP[/plen]) [none]: You can specify this option more than once. Press <Enter> when you're done. IPv4 address (IP[/plen]) [none]: You can specify this option more than once. Press <Enter> when you're done. IPv4 address (IP[/plen]) [none]: ...
* nmcli/connections: do not remove a bond option unless reset is allowedLubomir Rintel2022-06-241-17/+15
| | | | | If we're setting an option with no value given and no reset allowed, let's just set the default value.
* nmcli/connections: pass allow_reset to check_and_set() callbackLubomir Rintel2022-06-241-1/+16
| | | | | Like the regular set_option() handler, the special ones also need to know whether to reset an option or keep the value.
* libnmc-setting: fix default suggestions for some optionsLubomir Rintel2022-06-241-2/+2
| | | | These are just plain wrong.
* connectivity: skip unexpected address families in system_resolver_resolve_cb()Thomas Haller2022-06-231-2/+2
| | | | | This actually cannot happen, because GInetAddress is either IPv4 or IPv6. Still.
* nmcli/devices: fix a crashLubomir Rintel2022-06-231-2/+2
| | | | | | | | | This is not good: $ nmcli device delete nm-bond Segmentation fault (core dumped) Fixes: 5f9d2927ed02 ("nmcli/devices: use GPtrArray from get_device_list() directly")
* merge: branch 'lr/nmcli-checkpoint'Lubomir Rintel2022-06-235-92/+404
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1207
| * nmcli/devices: add "checkpoint" commandlr/nmcli-checkpointLubomir Rintel2022-06-153-3/+279
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an interface to the Checkpoint/Restore functionality that's available for quite some time. It runs a command with a checkpoint taken and rolls back unless success is confirmed before the checkpoint times out: $ nmcli dev checkpoint eth0 -- nmcli dev dis eth0 Device 'eth0' successfully disconnected. Type "Yes" to commit the changes: No Checkpoint was removed. The details about how it's used are documented in nmcli(1) and nmcli-examples(7).
| * nmcli: be less insistant on exiting when readline() gets no inputLubomir Rintel2022-06-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | When the input ends, we indeed eventually want to shut down. Nevertheless, it might be that we terminated the input *because* we're already shutting down and want do do our cleanup. Let's not take the shortcut to nmc_exit() in case the main loop is no longer running. This doesn't affect existing uses of nmc_readline(), but will be useful in a future patch.
| * nmcli/devices: use GPtrArray from get_device_list() directlyLubomir Rintel2022-06-151-32/+23
| | | | | | | | | | | | | | | | | | This makes get_device_list() return an array of NMDevices with a reference taken and a destroy notifier that unhooks disconnect_state_cb, so that it could replace the GSList of the same utility used by disconnect/delete commands. Suggested-by: Thomas Haller <thaller@redhat.com>
| * nmcli/devices: return GPtrArray instead of GSList from get_device_list()Lubomir Rintel2022-06-151-43/+35
| | | | | | | | | | | | | | | | | | | | | | A pointer array is slightly more efficient here, since we don't really need the ability to insert elements in the middle. In fact, we'd prefer if we could just add to the end, so that we'd spare some callers from a need to do a g_slist_reverse(). Even though that alone being a good reason to use a GPtrArray instead of GSList, I'm doing this for so that I could actually use the returned value as-is in a call to nm_client_checkpoint_create() in a future patch.
| * nmcli/devices: make get_device_list() terminate on "--"Lubomir Rintel2022-06-151-0/+22
| | | | | | | | | | | | | | | | Don't consider "--" a device name. Instead, treat it as a signal to stop reading the device list. If a caller expects nothing beyond the device names, it now has to check.
| * nmcli/devices: make get_device_list() shift argc/argvLubomir Rintel2022-06-151-25/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this patch, get_device_list() would give the caller no clue about how many options did it consume. That is okay -- it would always process all argument until the end, so the no callers would really care. In a further patch, I'd like to allow termination of the device name list (with a "--" arguments), so it will be possible to specify further arguments. Let's change the protype of this routine to use pointers to argc/argv, that it will be possible to adjust them.
| * glib-aux: add g_ptr_array_find() compat routineLubomir Rintel2022-06-151-0/+27
| | | | | | | | I want it but GLib is no good. Sad.
* | initrd: add comment on top of connections and conf snippetsBeniamino Galvani2022-06-231-1/+18
| | | | | | | | | | | | | | | | | | | | | | Example: $ cat /run/NetworkManager/conf.d/15-carrier-timeout.conf # Created by nm-initrd-generator (from "rd.net.timeout.carrier") [device-15-carrier-timeout] match-device=* carrier-wait-timeout=12000
* | initrd: print generated configuration snippetsBeniamino Galvani2022-06-231-22/+41
| | | | | | | | | | Instead of just printing something like "*** Carrier timeout 10sec", print the actual configuration snippet that was generated.
* | device: stop ac6 grace time when ip6ll is ready in shared modeBeniamino Galvani2022-06-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The IPv6 shared mode starts IPv6 autoconf to send router advertisements. IPv6 autoconf schedules a 30-second timeout waiting for a link-local address to appear. When the link-local address appears, we need to cancel the timeout. Fixes: 58287cbcc0c8 ('core: rework IP configuration in NetworkManager using layer 3 configuration') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1030 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1266
* | libnm/docs: add comment about background scanning to wifi.bssid propertyThomas Haller2022-06-213-2/+6
| |
* | po: Update Ukrainian translationYuri Chornoivan2022-06-201-640/+680
| | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1265
* | wifi: merge branch 'owe-fixes'Thomas Haller2022-06-174-2/+16
|\ \ | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1259
| * | nmcli: distinguish OWE-TM from OWE BSSDavid Bauer2022-06-171-2/+3
| | | | | | | | | | | | | | | | | | | | | Distinguish a OWE-TM enabled BSS (which itself is unencrypted) from the OWE BSS actually employing encryption. Signed-off-by: David Bauer <mail@david-bauer.net>
| * | libnm: fix compatibility of OWE-TM with unsecure profilesDavid Bauer2022-06-171-0/+4
| | | | | | | | | | | | | | | | | | | | | A unsecure profile can be used with a OWE-TM network, in which case it uses the non-OWE BSS. Signed-off-by: David Bauer <mail@david-bauer.net>
| * | supplicant/config: supplicant: prevent OWE downgradeDavid Bauer2022-06-172-0/+9
|/ / | | | | | | | | | | | | Prevent downgrade of Enhanced Open / OWE connection profiles to unencrypted connections by forcing wpa_supplicant to use OWE. Signed-off-by: David Bauer <mail@david-bauer.net>
* | platform: merge branch 'th/platform-genl-1'Thomas Haller2022-06-174-355/+379
|\ \ | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1262
| * | platform: extend netlink processing of messages for different protocolsThomas Haller2022-06-171-90/+104
| | | | | | | | | | | | Later, the same loop should also handle genl.
| * | platform: move credential check in event_handler_recvmsgs()Thomas Haller2022-06-171-11/+10
| | |
| * | platform/netlink: add netlink_protocol argument to nl_nlmsghdr_to_str()Thomas Haller2022-06-173-98/+105
| | | | | | | | | | | | | | | The meaning of the header depends on the netlink protocol. Add that parameter, so we can also handle genl.
| * | platform: move nl_recv() to separate functionThomas Haller2022-06-171-28/+48
| | | | | | | | | | | | Will be reused later.
| * | platform: log information about (sync) genetlink socketThomas Haller2022-06-171-3/+11
| | |
| * | platform/trivial: rename netlink sockets in NMLinuxPlatformThomas Haller2022-06-171-31/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - "priv->nlh" to "priv->sk_rtnl": as we also have an genl socket, "nlh" is not a good name. The point is that this is rtnetlink. Also, "h" sounds like a handle, that is, a file descriptor. Make this clearer with a "sk_" prefix. - "priv->genl" to "priv->sk_genl_sync": This socket is only used for synchronous operations, that is, it is passed to various independent components, that use it to send a request and wait for the response (while consuming all messages). We will have a use for a second socket, hence the "_sync" part. The "sk_" prefix is for consistency with "sk_rtnl". - "priv->event_source" to "priv->rtnl_event_source". Just make it clearer, that this is for the rtnetlink socket. In any case, this field is hardly used at all, it can have a sturdy name.
| * | platform: require generic netlink socketThomas Haller2022-06-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sockets are really a fundamental thing we require to operate. We cannot meaningfully operate, if we fail to create them. That is also why a too low file descriptor limit is fatal and unsupported. This is similar with out of memory situations. Just require that we always are able to create the generic netlink socket.
| * | platform: drop _genl_sock() function and directly access dataThomas Haller2022-06-171-12/+3
| | |
| * | platform/netlink: also set NETLINK_EXT_ACK for genl socketThomas Haller2022-06-172-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are only two callers of nl_socket_new(). One for NETLINK_GENERIC and one for NETLINK_ROUTE. We already were enabling ext-ack for the rtnetlink socket. Also enable it for the genl socket. Do that, but just moving this inside nl_socket_new(). I cannot imagine a case where we don't want this.
| * | platform/netlink: combine nl_socket_alloc() and nl_connect()Thomas Haller2022-06-174-83/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create and use new nl_socket_new(). nl_socket_alloc() really does nothing but allocating the struct and initializing the fd to -1. In all cases, we want to call nl_connect() right after. Combine the two. Then we also cannot have a "struct nl_sock" without a valid fd. This means several error checks can be dropped. Note that former nl_connect() did several things at once. Maybe, for more flexibility one would need to tweak what should be done there. For now that is not necessary. In any case, if we need more flexibility, then we would control what nl_connect() (now nl_socket_new()) does, and not the split between nl_socket_alloc() and nl_connect().
| * | platform/netlink: add nm_auto_nlsock cleanup macroThomas Haller2022-06-171-5/+4
|/ /
* | libnm/docs: elaborate how ipv4.dns-search/ipv6.dns-search worksThomas Haller2022-06-173-5/+11
| |
* | dhcp: nettools: save the lease after it gets acceptedBeniamino Galvani2022-06-171-0/+2
| | | | | | | | | | | | | | | | | | Currently the lease gets saved only on the extended (renewal) event. Also save it after it gets accepted. Fixes: 52a0fe584c3b ('dhcp/nettools: better track currently granted lease') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1261
* | dhcp: wait DAD completion for DHCPv6 addressesBeniamino Galvani2022-06-161-8/+99
| | | | | | | | | | | | | | | | | | | | Wait that addresses received through DHCPv6 complete duplicate address detection before reporting that the lease can be used. Fixes: 58287cbcc0c8 ('core: rework IP configuration in NetworkManager using layer 3 configuration') https://bugzilla.redhat.com/show_bug.cgi?id=2096386 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1258
* | cli: reformat file to look betterThomas Haller2022-06-161-49/+105
| | | | | | | | | | | | Comments on the same line as field names are not rendered well by clang-format. Even if manually edited, it seems not a preferable way to comment on a field. Move the comment in the line before.
* | build: add missing example files to "Makefile.examples" for distThomas Haller2022-06-161-0/+9
| |
* | build: sort files in Makefile.examplesThomas Haller2022-06-161-16/+16
| |
* | feat: add example for wifi sae connectionliaohanqin2022-06-161-0/+36
| | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1247