Blame TODO

Packit Service b23acc
So you're interested in hacking on NetworkManager?  Here's some cool
Packit Service b23acc
stuff you could do...
Packit Service b23acc
Packit Service b23acc
* Use netlink API instead of ioctl based ethtool.
Packit Service b23acc
Packit Service b23acc
NetworkManager uses ethtool API to set/obtain certain settings of network
Packit Service b23acc
devices. This is an ioctl based API and implmented in "src/platform/nm-platform-utils.c".
Packit Service b23acc
Recently, kernel got a netlink API for the same functionality
Packit Service b23acc
(https://www.kernel.org/doc/html/latest/networking/ethtool-netlink.html).
Packit Service b23acc
NetworkManager should use this API if present, and fallback to the old API
Packit Service b23acc
when running on older kernels. The benefit if this is that netlink provides
Packit Service b23acc
notifications when settings change. The ethtool command line tool
Packit Service b23acc
also implements this API, however it is under an incompatible license,
Packit Service b23acc
so better don't look and make sure not to use the code.
Packit Service b23acc
Packit Service b23acc
Packit Service b23acc
* Add 802-1x capability to nmtui.
Packit Service b23acc
Packit Service b23acc
Add dialogs to nmtui for 802-1x. This will be useful for ethernet (with 802-1x
Packit Service b23acc
port authentication), enterprise Wi-Fi and MACSec. From the GUI and dialog design,
Packit Service b23acc
possibly get inspired by nm-connection-editor.
Packit Service b23acc
Packit Service b23acc
Packit Service b23acc
* Add Azure support to nm-cloud-setup.
Packit Service b23acc
Packit Service b23acc
nm-cloud-setup currently only works for EC2 (and only for IPv4). Add support for Azure
Packit Service b23acc
cloud. See for example SUSE's cloud-netconfig which supports Azure
Packit Service b23acc
(https://github.com/SUSE-Enceladus/cloud-netconfig,
Packit Service b23acc
https://www.suse.com/c/multi-nic-cloud-netconfig-ec2-azure/). Note that cloud-netconfig
Packit Service b23acc
is under an incompatible license, so be careful not to reuse any code. But that would
Packit Service b23acc
anyway be almost impossible, because one is written in bash and the other in C.
Packit Service b23acc
Packit Service b23acc
Packit Service b23acc
* Improve our gitlab-ci integration.
Packit Service b23acc
Packit Service b23acc
Currently our .gitlab-ci starts various base containers and first installs
Packit Service b23acc
the necessary dependencies. That takes time and consumes bandwidth, we should
Packit Service b23acc
instead use more suitable containers. We should instead use ci-templates from
Packit Service b23acc
https://gitlab.freedesktop.org/freedesktop/ci-templates.
Packit Service b23acc
Packit Service b23acc
Packit Service b23acc
* Ethernet Network Auto-detection
Packit Service b23acc
Packit Service b23acc
There are various methods we can use to autodetect which wired network connection
Packit Service b23acc
to use if the user connects to more than one wired network on a frequent basis.
Packit Service b23acc
First, 802.1x enterprise switches broadcast frames which can be used to indicate
Packit Service b23acc
that the switch supports 802.1x and thus allow NetworkManager to select an
Packit Service b23acc
802.1x connection instead of blindly trying DHCP.  Second, NetworkManager could
Packit Service b23acc
listen for traffic from a list of MAC addresses.  Third, NetworkManager could
Packit Service b23acc
integrate 'arping' functionality to determine if a given IP address matches a
Packit Service b23acc
given MAC address, and thus automatically select that connection.  All these
Packit Service b23acc
methods can co-exist and be used in parallel.
Packit Service b23acc
Packit Service b23acc
One small caveat is that MAC addresses are trivial to spoof, so just because
Packit Service b23acc
NetworkManager has discovered a certain MAC address does not mean the network
Packit Service b23acc
is authenticated; only 802.1x security can assure that a network is the network
Packit Service b23acc
the user expects it to be.
Packit Service b23acc
Packit Service b23acc
In any case, a new 'anchor-addresses' property of type string-array should be
Packit Service b23acc
added to the NMSettingWired setting.  Each string element of this property
Packit Service b23acc
should be of the format "<ip>/<mac>" or simply "<mac>".  The first format with
Packit Service b23acc
an IP address would indicate that "arping"-type behavior should be used to
Packit Service b23acc
actively detect the given MAC address; obviously if the given MAC address is
Packit Service b23acc
used for passive discovery as well.  The second format simply lists a MAC
Packit Service b23acc
address to passively listen for.
Packit Service b23acc
Packit Service b23acc
One drawback of listening or probing for known MAC addresses is an increase in
Packit Service b23acc
latency during connections to ethernet networks.  The probing/listening delay
Packit Service b23acc
should be a reasonable amount of time, like 4 - 5 seconds or so, and should
Packit Service b23acc
only be used when a visible connection has anchor addresses.
Packit Service b23acc
Packit Service b23acc
Next a gboolean 'anchor-probing' variable should be added to the
Packit Service b23acc
NMDeviceEthernetPrivate structure in src/nm-device-ethernet.c.  This variable
Packit Service b23acc
should be set to TRUE whenever the device's carrier turns on *and* there are
Packit Service b23acc
visible NMConnections with anchor addresses (ie, connections which are system-
Packit Service b23acc
wide or where one of the allowed users of that connection is logged in).  Then
Packit Service b23acc
probing and listening are started, which involves opening a low-level socket
Packit Service b23acc
on the interface and starting the arping run or listening for MAC addresses.
Packit Service b23acc
A timer is also started (don't forget to cache the timer's source ID in the
Packit Service b23acc
NMDeviceEthernetPrivate data, and to cancel the timer whenever the device
Packit Service b23acc
transitions to any state other than DISCONNECTED).
Packit Service b23acc
Packit Service b23acc
If a known MAC address is discovered as a result of probing or listening, the
Packit Service b23acc
probe/listen socket, timeout, and data are cleaned up, and NetworkManager
Packit Service b23acc
would begin activation of the NMConnection that specified the found MAC address
Packit Service b23acc
in the 'anchor-addresses' property.  If two or more connections specify the
Packit Service b23acc
same MAC address, the connection with the most recent timestamp should be
Packit Service b23acc
preferred.
Packit Service b23acc
Packit Service b23acc
Similarly, if the probing/listening process detects 802.1x frames the device
Packit Service b23acc
should be marked as requiring 802.1x authentication until the carrier drops.
Packit Service b23acc
This would be accomplished by adding a new property to the NMDeviceEthernet
Packit Service b23acc
object and exporting that property through the
Packit Service b23acc
introspection/nm-device-ethernet.xml file.  This would allow clients like
Packit Service b23acc
applets to ensure that users are aware that the device will not allow
Packit Service b23acc
un-authenticated connections and that additional credentials are required to
Packit Service b23acc
successfully connect to this network.
Packit Service b23acc
Packit Service b23acc
Packit Service b23acc
* VPN re-connect (bgo #349151)
Packit Service b23acc
Packit Service b23acc
NM should remember whether a VPN was connected if a connection disconnects
Packit Service b23acc
(like Wi-Fi drops out or short carrier drop) or if the laptop goes to sleep.
Packit Service b23acc
Upon reconnect, if the same Connection is again active, the previously
Packit Service b23acc
connected VPN should be activated again as well.  Basically, don't just drop
Packit Service b23acc
the VPN because Wi-Fi choked for 10 seconds, but reconnect the VPN if it was
Packit Service b23acc
connected before the drop.
Packit Service b23acc
Packit Service b23acc
Packit Service b23acc
* VPN IP Methods
Packit Service b23acc
Packit Service b23acc
Some VPNs (openvpn with TAP for example) require that DHCP is run on a
Packit Service b23acc
pseudo-ethernet device to obtain addressing information.  This is not currently
Packit Service b23acc
possible, but NM already has all the code for DHCP.  Thus, a new "method"
Packit Service b23acc
key should be defined in include/NetworkManagerVPN.h to allow for DHCP to
Packit Service b23acc
be performed if the VPN service daemon requests it in the IP4Config or IP6Config
Packit Service b23acc
signals. In nm-vpn-connection.c, upon receipt of the D-Bus Ip4Config signal
Packit Service b23acc
from the VPN plugin, NetworkManager would inspect the "method" property of the
Packit Service b23acc
ip4 config dictionary.  If that property was present and set to "auto" then
Packit Service b23acc
DHCP would be started using the network interface returned in the dict.  The
Packit Service b23acc
nm_vpn_connection_ip4_config_get() function should be split up into two
Packit Service b23acc
functions, one containing the existing code for static configuration, and a
Packit Service b23acc
second for handling DHCP kickoff.  Minimal parsing of the response should be
Packit Service b23acc
handled in the newly reduced nm_vpn_connection_ip4_config_get() function.
Packit Service b23acc
Packit Service b23acc
To handle DHCP, the NMVPNConnectionPrivate structure should have two members
Packit Service b23acc
added:
Packit Service b23acc
Packit Service b23acc
    NMDHCPManager *dhcp_manager;
Packit Service b23acc
    NMDHCPClient  *dhcp4_client;
Packit Service b23acc
Packit Service b23acc
which would be initialized in the new DHCP handler code split off from
Packit Service b23acc
nm_vpn_connection_ip4_config_get().  These new members would be disposed of in
Packit Service b23acc
both vpn_cleanup() and dispose(), though remember to stop any ongoing DHCP
Packit Service b23acc
transaction when doing so (see dhcp4_cleanup() in nm-device.c for example code).
Packit Service b23acc
For basic code to start the DHCP transaction, see dhcp4_start() in nm-device.c
Packit Service b23acc
as well.  After calling nm_dhcp_manager_start_ip4() and connecting the signals
Packit Service b23acc
to monitor success and failure, the VPN IP4 config handler would simply return
Packit Service b23acc
without changing VPN state, unless a failure occurred.
Packit Service b23acc
Packit Service b23acc
Then, when the DHCP transaction succeeds, which we'd know by checking the
Packit Service b23acc
DHCP client state changes in the "state-changed" signal handler we attached to
Packit Service b23acc
the DHCP client object returned from nm_dhcp_manager_start_ip4(), the code
Packit Service b23acc
would retrieve the completed NMIP4Config object from the DHCP client using the
Packit Service b23acc
nm_dhcp_client_get_ip4_config() function, and then proceed to execute
Packit Service b23acc
essentially the bottom-half of the existing nm_vpn_connection_ip4_config_get()
Packit Service b23acc
function to merge that config with user overrides and apply it to the VPN
Packit Service b23acc
tunnel interface.  Other state changes from the DHCP client might trigger a
Packit Service b23acc
failure of the VPN connection, just like DHCP timeouts and lease-renewal
Packit Service b23acc
failures do for other devices (see dhcp_state_changed() in nm-device.c).
Packit Service b23acc
Packit Service b23acc
Packit Service b23acc
* VPN Service Daemon Secret Requests
Packit Service b23acc
Packit Service b23acc
In addition to NM asking the service daemons whether more secrets are required,
Packit Service b23acc
VPN service daemons (like nm-vpnc-service, nm-openvpn-service, etc) should be
Packit Service b23acc
able to ask NetworkManager to provide secrets during the connection attempt. To
Packit Service b23acc
do this, the plugin should advertise its ability to handle out-of-band secrets
Packit Service b23acc
in its .service file via the key 'async-secrets=true'.  NetworkManager would
Packit Service b23acc
check that key and if present activate the VPN as normal, but skip the explicit
Packit Service b23acc
NeedSecrets calls.
Packit Service b23acc
Packit Service b23acc
Instead, a new "SecretsRequired" signal would be added to
Packit Service b23acc
introspection/nm-vpn-plugin.xml (and corresponding helper code added to
Packit Service b23acc
libnm-glib/nm-vpn-plugin.c) that would be emitted when the plugin determined
Packit Service b23acc
that secrets were required.  This signal would have D-Bus signature of "sas"
Packit Service b23acc
for the arguments [ <s:uuid>, <as:secrets> ] with the <uuid> obviously being
Packit Service b23acc
the connection UUID, and <secrets> being an array of strings of plugin-specific
Packit Service b23acc
strings the plugin requires secrets for.  This array of strings would then be
Packit Service b23acc
passed as the "hints" parameter in nm-vpn-connection.c when secrets are
Packit Service b23acc
requested from agents in a subsequent nm_settings_connection_get_secrets() call.
Packit Service b23acc
At this time the agent code only allows one hint per request, so we may need to
Packit Service b23acc
extend that to allow more than one hint.
Packit Service b23acc
Packit Service b23acc
Thus when connecting if the plugin supported async secrets NetworkManager would
Packit Service b23acc
still request existing secrets (without interactivity) and send them to the
Packit Service b23acc
VPN service daemon in the Connect D-Bus method, then wait for the service daemon
Packit Service b23acc
to either request secrets asynchronously via the SecretsRequired signal or to
Packit Service b23acc
signal successful connection via the Ip4Config signal.
Packit Service b23acc
Packit Service b23acc
The vpnc plugin would need to be reworked to open a pipe to vpnc's stdout and
Packit Service b23acc
stdin file descriptors to capture any authentication messages, and to match
Packit Service b23acc
these messages to known secrets request strings.  When receiving one of these
Packit Service b23acc
strings the plugin would determine which secret was being requested and then
Packit Service b23acc
emit the SecretsRequired signal to NetworkManager.  This would also imply that
Packit Service b23acc
nm-vpnc-service exectutes vpnc with the "--xauth-inter" argument to enable
Packit Service b23acc
challenge-response and does not use the "--non-inter" flag which suppresses that
Packit Service b23acc
behavior.
Packit Service b23acc
Packit Service b23acc
Packit Service b23acc
* WPS
Packit Service b23acc
Packit Service b23acc
wpa_supplicant has support for WPS (Wifi Protected Setup, basically Bluetooth-
Packit Service b23acc
like PIN codes for setting up a wifi connection) and we should add support for
Packit Service b23acc
this to NetworkManager too.  APs that support WPS will say so in their beacon
Packit Service b23acc
IEs which are contained in the "WPA" and "RSN" properties of the BSS object
Packit Service b23acc
exported by the supplicant, and can be processed in src/nm-wifi-ap.c's
Packit Service b23acc
foreach_property_cb() function.  We should add some private fields to the
Packit Service b23acc
NMAccessPoint object (defined in nm-wifi-ap.c) to remember whether a specific
Packit Service b23acc
AP supports WPS and what WPS methods it supports, and expose that over D-Bus to
Packit Service b23acc
GUI clients as well.
Packit Service b23acc
Packit Service b23acc
There are two common WPS setup methods: PIN and button.  For PIN, the router
Packit Service b23acc
either displays a random PIN on an LCD or the router's web UI, or a static PIN
Packit Service b23acc
is printed on the router itself.  The user enters that PIN instead of a PSK
Packit Service b23acc
when connecting.  For the "button" method, the router has a physical button that
Packit Service b23acc
when pushed, allows any client to connect for a short period of time.
Packit Service b23acc
Packit Service b23acc
We'll then need to add some properties to the NMSettingWirelessSecurity setting
Packit Service b23acc
for the WPS PIN code so that when the user enters it through the GUI, it can
Packit Service b23acc
be passed back to NM.  And we'll need to figure out some mechanism for passing
Packit Service b23acc
back an indication that the user pushed the button on the router for the
Packit Service b23acc
pushbutton method.
Packit Service b23acc
Packit Service b23acc
When connecting to a new access point that supports WPS, the GUI client would
Packit Service b23acc
call the AddAndActivateConnection method and wait for NM to request secrets.
Packit Service b23acc
NM would determine that the AP supports WPS, and request WPS secrets from the
Packit Service b23acc
applet.  The applet would ask the user for a PIN, or to push the button on the
Packit Service b23acc
AP, instead of asking for a passphrase or PSK.  When the user has entered the
Packit Service b23acc
PIN or pushed the button, the applet returns this information to NM, which
Packit Service b23acc
proceeds with the connection.
Packit Service b23acc
Packit Service b23acc
NM sends the correct wpa_supplicant config for WPS to the supplicant, and waits
Packit Service b23acc
for the connection to occur.  WPS can only be used the *first* time, so after a
Packit Service b23acc
first successful connection, NM must request the actual hexadecimal PSK from
Packit Service b23acc
wpa_supplicant via D-Bus, and store that PSK in the connection, clear any WPS
Packit Service b23acc
PIN code from the connection, and save the connection to backing storage.
Packit Service b23acc
Packit Service b23acc
Any applet GUI should also allow the user to enter the PSK instead of completing
Packit Service b23acc
association using WPS, since quite a few routers out there are broken, or
Packit Service b23acc
because the user has no physical access to the router itself, but has been given
Packit Service b23acc
as passphrase/PSK instead.
Packit Service b23acc
Packit Service b23acc
Packit Service b23acc
* Better Tablet/Mobile Behavior
Packit Service b23acc
Packit Service b23acc
There are a few components to this:
Packit Service b23acc
Packit Service b23acc
1) kernel driver and hardware capabilities: most mobile devices use periodic
Packit Service b23acc
background scanning to quickly determine whether a known SSID is available and
Packit Service b23acc
notify the connection manager to connect to it.  This typically requires special
Packit Service b23acc
capabilities and good powersave/sleep support from the Wi-Fi kernel driver.
Packit Service b23acc
There is a background scanning API in nl80211, but we need to determine how many
Packit Service b23acc
SSIDs each driver allows for background scanning, and based on that number, give
Packit Service b23acc
the driver the most recent N SSIDs.  We still need to periodically wake the
Packit Service b23acc
device up and do a full scan just in case the user is near a known SSID that was
Packit Service b23acc
not in the N top recently used networks.  This is also beneficial to normal
Packit Service b23acc
desktop use-cases.
Packit Service b23acc
Packit Service b23acc
wpa_supplicant doesn't currently provide an explicit interface for sending SSIDs
Packit Service b23acc
to the driver for background scanning, but could simply send a list using
Packit Service b23acc
configured networks.  However, NM currently does not send *all* configured
Packit Service b23acc
connections' SSIDs to the supplicant, so that's something we should do first
Packit Service b23acc
to optimize connection times.  To do this, NM would need to order all networks
Packit Service b23acc
using the NM timestamp and convert that into a supplicant priority number, which
Packit Service b23acc
would need to be adjusted periodically when the timestamp was updated.  This
Packit Service b23acc
would involve tracking each network (exposed by the supplicant as a D-Bus
Packit Service b23acc
object) and making sure they were added, deleted, and updated when the backing
Packit Service b23acc
NMConnection objects changed.  One complication is that the supplicant
Packit Service b23acc
requires secrets for various network types when the network is added via D-Bus,
Packit Service b23acc
and NetworkManager might not have those secrets yet.  We may need to modify
Packit Service b23acc
the supplicant allow for *all* secrets (PSKs, WEP keys, etc) to be requested
Packit Service b23acc
on-demand, not just EAP secrets like 802.1x passwords.  We then need to fix
Packit Service b23acc
up the supplicant's D-Bus interface to actually send requests for secrets out
Packit Service b23acc
over D-Bus (like wpa_supplicant_eap_param_needed() does for the socket-based
Packit Service b23acc
control interface) and to handle the resulting reply from a D-Bus client like
Packit Service b23acc
wpa_supplicant_ctrl_iface_ctrl_rsp() does.
Packit Service b23acc
Packit Service b23acc
With the secrets request stuff and priority handling in place, wpa_supplicant
Packit Service b23acc
would control network selection and roaming (based on the priorities NM gave it
Packit Service b23acc
of course) instead of NetworkManager itself, and hopefully lead to a faster WiFi
Packit Service b23acc
connection process.
Packit Service b23acc
Packit Service b23acc
2) single-device-at-a-time with overlapping connections: this is also probably
Packit Service b23acc
the best route to go for desktop use-cases as well.  Instead of bringing all
Packit Service b23acc
available connections up, only bring up the "best" connection at any given
Packit Service b23acc
time based on the current priority list (which is roughly Ethernet > Wi-Fi >
Packit Service b23acc
3G/Bluetooth).  However, to ensure seamless connectivity, when one connection
Packit Service b23acc
begins to degrade, the next-best connection should be started before the
Packit Service b23acc
current one is terminated, such that there is a small amount of overlap.
Packit Service b23acc
Consequently the same behavior should be used when a better connection becomes
Packit Service b23acc
available.  This behavior should be suspended when special connections like
Packit Service b23acc
Internet Connection Sharing ones are started, where clearly the priorities
Packit Service b23acc
are different (ie, for Mobile Hotspot 3G > WiFi).