summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* initrd: disable ipv4 and ipv6 by default for vlan parent connectionbg/initrd-vlanBeniamino Galvani2020-11-202-4/+232
| | | | | | | | | | | | | | Change the generator to disable by default IP configuration for the parent connection of a VLAN, because that is what a user would expect and what the legacy module does. Of course if the user explicitly configures DHCP or an address for the parent interface, that overrides the default. Note that now the generator always creates a connection for the parent interface. Before this commit, it did only when there was an explicit ip= argument for the parent interface. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/509
* initrd: fix parsing of ip= argument with dotted interface nameBeniamino Galvani2020-11-204-34/+82
| | | | | | | | | | | | The command line parser looks for a dot or a colon to determine whether the first token in a ip= argument is a IPv4 address (dot), an IPv6 address (colon) or an interface name (none). This strategy doesn't work for interface names containing a dot (typically VLANs). Instead, try to parse the IPv4/IPv6 address in the token; if this fails then consider the token as an interface name. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/581
* initrd: add test for prefixed address in ip= argumentBeniamino Galvani2020-11-201-2/+4
|
* wifi: merge branch 'th/wifi-bssid-cleanup'Thomas Haller2020-11-2020-157/+150
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/686
| * core: refactor nm_ethernet_address_is_valid()th/wifi-bssid-cleanupThomas Haller2020-11-195-49/+40
| | | | | | | | | | | | | | | | | | | | The caller *always* needs to know whether the argument is an address in binary or text from. At that point, it's only inconvenient to require the user to either pass "-1" or ETH_ALEN as size (nothing else was supported anyway). Split the function and rename.
| * wifi: use NMEtherAddr struct for bssidThomas Haller2020-11-1914-81/+83
| |
| * wifi: drop Wext handlers get_rate()/get_bssid()/get_qual() from NMWifiUtilsClassThomas Haller2020-11-193-39/+31
| | | | | | | | | | | | | | | | | | Wext is anyway deprected. Our NMWifiUtilsClass should not have API to accomodate it. That means, we don't need dedicated get_rate(), get_bssid(), get_qual() hooks, when they all are only called by get_station(). Instead, push the Wext specific code down.
| * wifi: use nm_wifi_ap_set_address_bin() in activation_success_handler()Thomas Haller2020-11-192-8/+3
| |
| * wifi: expose nm_wifi_ap_set_address_bin() helperThomas Haller2020-11-192-17/+18
| |
| * shared: add static asserts for size/alignment of NMEtherAddrThomas Haller2020-11-191-0/+3
| |
| * shared: improve NM_ETHER_ADDR_INIT() helper macroThomas Haller2020-11-192-4/+13
|/ | | | | | | | | | | | | | | The macro should require exactly 6 parameters (for the 6 bytes of the address). On the other hand, we also should be able to use a macro like NM_ETHER_ADDR_INIT(NM_BRIDGE_GROUP_ADDRESS_DEF_BIN) To get that work properly, we need to expand the variadic macro once. Also, cast the result to the struct type. With this, it can not only be used for initialization, but also for assignment and temporary variables.
* trivial: improve code commentsin "nm-std-aux/c-list-util.c"Thomas Haller2020-11-191-2/+3
|
* wifi: merge branch 'balrog-kun:platform-wifi-common-call'Thomas Haller2020-11-199-162/+143
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/683
| * platform: Drop nm_platform_wifi_get_{bssid,rate,quality}Andrew Zaborowski2020-11-196-154/+9
| | | | | | | | | | | | | | | | | | | | | | These are unused now so remove them and revert most of e0394689b3463a1c0c7b0f162bb08327fca8e6f4 which attempted to fix the same issue of the platform wifi API not mapping well the nl80211 commands resulting in redundant netlink commands being used. In the wext driver there are still three individual getters for the three values and nm_wifi_utils_get_station() uses either these or the collective get_station method depending on the driver.
| * wifi: Switch to using nm_platform_wifi_get_stationAndrew Zaborowski2020-11-192-38/+43
| | | | | | | | | | | | | | | | | | | | | | Switch NMDeviceIwd and NMDeviceWifi from nm_platform_wifi_get_bssid, nm_platform_wifi_get_quality and nm_platform_wifi_get_rate to nm_platform_wifi_get_station. I also dropped the checks for the signal quality percentage range as they're no longer necessary and in NMDeviceWifi dropped zero-initialization of the bssid buffer before the nm_platform_wifi_get_bssid call which not necessary either.
| * platform: Add a wifi_get_station utilityAndrew Zaborowski2020-11-197-0/+121
|/ | | | | | | | | | Merge nm_platform_wifi_get_bssid, nm_platform_wifi_get_quality, nm_platform_wifi_get_rate into one utility, nm_platform_wifi_get_station that uses the single NL80211_CMD_GET_STATION command dump when the nl80211 driver is used. With wext each function mapped to one ioctl while with nl80211 all three can be obtained with one netlink command. The new function should use the minimum number of calls with either driver.
* wifi/iwd: merge branch 'balrog-kun:iwd-autoconnect'Thomas Haller2020-11-1910-359/+1414
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/670
| * iwd: Update KnownNetwork.AutoConnect on NM connection changesAndrew Zaborowski2020-11-191-5/+68
| | | | | | | | | | | | | | | | | | | | | | Watch NMSettingConnection's changes using the NM_SETTINGS_CONNECTION_UPDATED_INTERNAL signal and update IWD KnownNetwork's AutoConnect property when NMSettingConnection's autoconnect property changes. We will not receive "notify::" NM_SETTING_CONNECTION_AUTOCONNECT signals normally because the NMConnection seems to be replaced with a new one in Update2() rather than its settings changing.
| * iwd: Roughly respect the NMDevice::autoconnect propertyAndrew Zaborowski2020-11-191-30/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Watch the NMDevice::autoconnect property to disable IWD autoconnect if requested by user. We have no way to re-enable it when the device is idle though. Make sure to not disable IWD's autoconnect in .deactivate() if not necessary. There's not much we can do if we have to call Station.Disconnect() but we can avoid calling it if unnecessary -- a slight optimization regardless of the autoconnect block flags. Fortunately NM and IWD block autoconnect on a manual deactivation in the same way (in MANAGED mode) and unblock it on an activation in the same way too (in MANAGED mode). Also if wifi.iwd.autoconnect is in use, unset NM_DEVICE_AUTOCONNECT_BLOCKED_MANUAL_DISCONNECT under the same conditions as IWD normally would. This could be made optional but with wifi.iwd.autoconnect by default we should follow IWD's autoconnect logic.
| * iwd: Add the wifi.iwd.autoconnect settingAndrew Zaborowski2020-11-194-83/+677
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If this setting it true (or missing) we skip most of the D-Bus Disconnect() calls whoe purpose was to keep IWD's internal autoconnect mechanism always disabled. We use the IWD's Station.State property updates, and secrets requets through our IWD agent, to find out when IWD is trying to connect and create "assumed" activations on the NM side to mirror the IWD state. This is quite complicated due to the many possible combinations of NMDevice's state and IWD's state. A lot of them are "impossible" but we try to be careful to consider all the different possibilities. NM has a nice API for "assuming connections" but it's designed for slightly different use cases than what we have here and for now we created normal "managed"-type activations when assuming an IWD automatic connection.
| * iwd: Order objects from g_dbus_object_manager_get_objectsAndrew Zaborowski2020-11-192-2/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before we call interface_added for all interfaces and objects returned from g_dbus_object_manager_get_objects(), order the objects based on the interfaces present on them. This is to avoid processing Network.KnownNetwork properties referring to KnownNetwork objects that we haven't processed yet, and new Station.ConnectedNetwork properties referring to Network objects we haven't processed yet. In NMDeviceIwd make sure we don't emit unnecessary re-checks if device is not yet enabled because now we're always going to be adding the APs (representing IWD Network objects) before the device is enabled, i.e. before the nm_device_iwd_set_dbus_object() call, when NM first connects to IWD.
| * iwd: Create mirror connections for non-802.1X IWD known networksAndrew Zaborowski2020-11-193-94/+255
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now we'd only create mirror NMSettingsConnection objects for IWD KnownNetwork objects of the "8021x" type in the NMIwdManager class. Now create mirror connections, or track existing matching NMSettingsConnections, for every Known Network, for three reasons: * to allow NMDeviceIwd to easily look up the NMSettingsConnection matching an externally-triggered connection, specifically when we let IWD autoconnect, * to allow users to "forget" those Known Networks, * to allow us to synchronize the autoconnectable property between NM and IWD to later allow users toggling it (not done yet).
| * wifi: Add NMWifiAp getters for wpa_flags/rsn_flagsAndrew Zaborowski2020-11-192-16/+30
| |
| * iwd: Stop using _nm_utils_ssid_to_utf8()Andrew Zaborowski2020-11-194-111/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _nm_utils_ssid_to_utf8() can be quite heavy and also has this comment: * Again, this function should be used for debugging and display purposes * _only_. In most places that we used it, we have already validated the connection's SSID to be valid UTF-8 so we can simply g_strndup() it now, even in the two places where we actually only needed it for display purposes. And we definitely don't need or want the locale-specific conversions done in _nm_utils_ssid_to_utf8 when the SSID is *not* utf8. In mirror_8021x_connection we also optimize the lookup loop to avoid validating and strdup'ing all the SSID.
| * iwd: Validate UTF-8 SSID early in ↵Andrew Zaborowski2020-11-191-30/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | check_connection_compatible/complete_connection IWD only supports UTF-8 SSIDs internally, any BSS who's SSID doesn't validate as UTF-8 is ignored. There's also no way to ask IWD to connect to such network/start AP/Adhoc etc. because SSIDs are passed as D-Bus strings. So validate that connection SSIDs are UTF-8 early in check_connection_compatible/complete_connection and refactor check_connection slightly to avoid duplication. Since NMWifiAPs are created by us, we already know those have valid SSIDs so once we've also checked new NMConnections in check_connection_compatible there should be no possibility that an SSID anywhere else in the code is not UTF8. We should be able to treat the GBytes values as UTF8 without redundant validation or the complex locale-dependent conversions in _nm_utils_ssid_to_utf8.
| * iwd: Never lock to BSSID in complete_connectionAndrew Zaborowski2020-11-191-4/+1
| | | | | | | | | | | | | | The AP BSSIDs created by the iwd backend are made up so never lock the connections to them. It probably wouldn't matter as long as the iwd backend is used but the fake BSSID could stay in the connection properties even if the user switches to wpa_supplicant.
| * iwd: Move scheduling periodic scan out of set_current_ap()Andrew Zaborowski2020-11-191-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | set_current_ap() would always call schedule_periodic_scan() but: first it would do nothing when current_ap was non-NULL because we schedule_periodic_scan makes sure not to auto-scan when connected. Secondly state_changed() already calls schedule_periodic_scan indirectly through set_can_scan() so normally when we disconnect and current_ap becomes NULL we already do trigger a scan. The only situation where we didn't is when a connection is cancelled during NEED_AUTH because IWD's state doesn't change, so we add a schedule_periodic_scan() call in network_connect_cb() on error.
| * iwd: Rename can_connect and iwd_connectionAndrew Zaborowski2020-11-191-15/+15
| | | | | | | | | | | | | | | | Rename NMDeviceIwdPrivate.can_connect to .nm_autoconnect in preparation to also add .iwd_autoconnect. Rename misnamed local variable iwd_connection to nm_connection, we'll need a new iwd_connection variable later.
| * iwd: Allow scanning in NM_DEVICE_STATE_NEED_AUTHAndrew Zaborowski2020-11-191-1/+1
| | | | | | | | | | | | In this state, same as in DISCONNECTED or ACTIVATED, allow scanning if IWD is in the "connected" or "disconnected" states as there's no reason not to scan.
| * iwd: Handle the net.connman.iwd.Agent.Cancel() methodAndrew Zaborowski2020-11-192-4/+61
|/ | | | | | | | | | Implement a Cancel method on our IWD secrets agent DBus object. This results in a call to nm_device_iwd_agent_query() for the device currently handling the request and the @invocation parameter is NULL to signal that the current query is being cancelled. nm_device_iwd_agent_query doesn't do much with this call just yet but the handling will be necessary when IWD autoconnect is used by NM.
* dns: fix _dns_manager_set_ip_config() for missing deviceThomas Haller2020-11-191-1/+1
| | | | Fixes: 395665902b01 ('dns: don't apply DNS configuration for external connections')
* release: bump version to 1.29.2 (development)1.29.2-devBeniamino Galvani2020-11-182-2/+2
|
* libnm/tests: add unit test for more consistency check of NMObject type ↵Thomas Haller2020-11-181-14/+77
| | | | | | | | | | | information The type information of NMObject is entirely static. And there are certain conditions how this information should be. Add some more checks. We need priv_ptr_offset set if (and only if) we also have property_ao_info or property_o_info registered.
* utils: introduce new NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_20Fernando Fernandez Mancera2020-11-182-1/+3
| | | | | | | | | | | | | | | | This patch is replacing NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_LOW with NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_10 and NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_HIGH with NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30. In addition it is introducing NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_20 which is a middle point between the existing priorities. This new priority is needed due to Veth support incoming. It will be used to prevent the creation a NMDeviceWired instance. Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net> [thaller@redhat.com: split original patch]
* libnm/trivial: rename enums NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_*Fernando Fernandez Mancera2020-11-1838-83/+83
| | | | | | | | | | | | | We will need more levels of priority. Change the naming to make room for that. sed 's/NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_LOW/NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_10/g' `git grep -l NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_ ` -i sed 's/NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_LOW/NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_10/g' `git grep -l NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_ ` -i ./contrib/scripts/nm-code-format-container.sh Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net> [thaller@redhat.com: split original patch]
* cli: replace if-else-if construct in nmc_process_connection_properties() by ↵Thomas Haller2020-11-181-77/+86
| | | | | | | | | | | continue The if-else-if constuct spans many lines and it is not easy to see that there is no common action after the if-else-if construct. Instead, at the end of each if-block, just "continue" the loop. This is similar to a "return-early" apprach and it mean you don't need to think what happens at the end of the if-block.
* cli: don't fail `nmcli con modify $PROFILE remove $SETTING` for non-existing ↵Thomas Haller2020-11-181-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | setting Removing a setting that is not present should not be an error. The user asked that the profile doesn't have the requested setting, and that should succeed (even if that results in no actual change). Consider when you want to make a hotspot profile "open". That implies to remove the "wifi-sec" and "802-1x" settings. But you may not check before whether the profile is already open, and whether it already has those settings. We should just allow $ nmcli connection modify "$PROFILE" remove wifi-sec remove 802-1x to succeed, regardless whether this changes anything or not. Likewise, if you do $ nmcli connection modify "$PROFILE" con-name foo $ nmcli connection modify "$PROFILE" con-name foo then the second command doesn't fail with "the name is already \"foo\"". It just succeeds.
* gitlab CI: remove leftover comments referring to libinputPeter Hutterer2020-11-182-8/+6
| | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/684
* man,libnm,cli: merge branch 'th/man-cli-connection-types'Thomas Haller2020-11-177-49/+117
|\ | | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/444 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/680
| * man: update supported connection types in `man nmcli`Thomas Haller2020-11-171-5/+45
| | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/444
| * man: sort supported connection types in `man nmcli`Thomas Haller2020-11-171-17/+17
| |
| * cli: assert that valid_parts are set for base typesThomas Haller2020-11-172-3/+25
| |
| * cli: fix shell completion for connection.type to show "ovs-{dpkg,patch}"Thomas Haller2020-11-171-1/+2
| | | | | | | | | | | | | | | | | | | | nmcli --complete-args connection add type '' would not show "ovs-{dpdk,patch}", because the conditions about what makes a base type are not consistent with what NMSettingConnection's verify() does. Fix that.
| * shared/libnm: move NMSettingPriority helpers to "shared/nm-meta-setting.h"Thomas Haller2020-11-174-29/+34
|/
* ovs: merge branch 'th/ovs-external-ids-2'Thomas Haller2020-11-1712-271/+808
|\ | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1866227 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/679
| * core/ovs: for now drop cancellable from ovsdbmethod call againThomas Haller2020-11-171-74/+5
| | | | | | | | | | | | | | Currently the cancellable is not yet used. Drop it again. However, I think the code might be useful, so I hope to revert this commit afterwards to use it.
| * core/ovs: support setting OVS external-idsThomas Haller2020-11-178-44/+294
| | | | | | | | | | | | | | | | Also support reapply. During reapply we try to preserve keys that are added externally. However, the current implementation does not properly use transactions to ensure there is no race here.
| * core/ovs: log external-ids of Interfaces/Ports/BridgesThomas Haller2020-11-171-12/+54
| |
| * core/ovs: cleanup logging of OvsdbMethodCallThomas Haller2020-11-171-56/+42
| | | | | | | | | | | | | | We don't need every log line repeat all the parameters of the call. Each call should have a unique identifier (which is NM_HASH_OBFUSCATE_PTR(call)) and only the first message from a call contains all the details.
| * core/ovs: allow ovsdb calls to be cancelledThomas Haller2020-11-171-6/+74
| | | | | | | | | | | | In general, providing an async API also requires the ability to cancel requests. It's not yet used, but add a way to handle a GCancellable.