netplan writes Keyfiles for NetworkManager with GString instead of GKeyFile API
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Netplan |
New
|
Undecided
|
Unassigned |
Bug Description
netplan uses C and glib. However, it constructs the keyfiles for NetworkManager (in /etc/NetworkMan
It should use GKeyFile API instead. This takes care of handling string and escape them accordingly. At the end, the keyfile can be converted to string (or written to file).
A possible alternative would be that libnm would finally start exposing its API for Keyfiles. Then, netplan could use libnm, it would create an `NMConnection`, and that could then be converted to a GKeyfile (if that API was added to libnm: https:/
- it requires libnm API that does not exist yet (but this is something that really should be added. So, investing work here would not be for naught).
- it makes netplan dependent at libnm.so. That might be acceptable, because if you use NetworkManager, libnm.so will also be around. And you can install libnm.so without NetworkManager (and of course, NetworkManager does not need to be running to use libnm). Albeit cumbersome, the part of netplan that requires libnm could be packaged separately and loaded as a plugin (dlopen).
+ the NMConnection API of libnm may be more convenient to use.
+ NMConnection provides nm_connection_
+ NMConnection's can also be converted to GVariant and sent over on D-Bus. That means, the code that creates the NMConnection would be independent from whether to store it as keyfiles or use on the D-Bus API. That would netplan allow not only to write profiles to file (before starting NetworkManager) but also to make changes at runtime. Yes, the alternative is `nmcli connection load "/etc/NetworkMa