Completely rework IP configuration in the daemon. Use NML3Cfg as layer 3 manager for the IP configuration of an interface. Use NML3ConfigData as pieces of configuration that the various components collect and configure. NMDevice is managing most of the IP configuration at a higher level, that is, it starts DHCP and other IP methods. Rework the state handling there. This is a huge rework of how NetworkManager daemon handles IP configuration. Some fallout is to be expected. It appears the patch deletes many lines of code. That is not accurate, because you also have to count the files `src/core/nm-l3*`, which were unused previously. Co-authored-by: Beniamino Galvani <bgalvani@redhat.com>
3.5 KiB
Rework NMIP[46]Config for next branch
The next branch is a large rework of internals, how IP configuration is done by NMDevice.
Previously, there are two GObjects named NMIP4Config and NMIP6Config. These
serve different purposes:
-
They are data containers that can track IP configuration. As such,
NMDeviceand various parts (likeNMDhcpClient) create them, pass them around and mutate/merge them to track the IP configuration. -
They are also subclasses of
NMDBusObjectand exported on D-Bus as/org/freedesktop/NetworkManager/IP4Config/1, etc. As such, see their D-Bus API (and for IPv6).
next branch will replace use 1) with NML3ConfigData. NML3ConfigData are immutable
(sealable) data containers with little logic. This leaves NMIP4Config to only
implement 2).
This needs to be reworked.
-
Now
NMIP4ConfigandNMIP6Configare subclasses ofNMIPConfig. The goal is to treat IPv4/IPv6 similar and generically. Probably there should be very little code in the subclasses left and most should move to the parent classes. We still need separate GObject types though, because that is howNMDBusObject's glue code can handle different D-Bus paths. -
Now
NML3Cfgis a handle for the IP configuration parameters of a device (ifindex). AsNMIPConfigmostly is about exporting the current IP configuration, it probably can get most of it from there (and by listening to signals to that). -
Note that
NMDevice,NMActiveConnectionreferNMIP[46]Configs, and most importantly, the respective D-Bus objects refer to them. AsNMVpnConnection(and "org.freedesktop.NetworkManager.VPN.Connection" interface) are modeled as "subclasses" ofNMActiveConnection, they also have one. That means, it's not entirely clear what these properties even are. For example, currently,NMDevicedoes a (terrible) dance of tracking externalNMIP[46]Configobjects, merging, intersecting and subtracting them with otherNMIP4Configobjects to get the merged one, which is then exported on D-Bus. That merged object does therefore not directly expose the IP addresses that are actually configured on the interface (ip addr), but more what NetworkManager wanted to configure and the (terrible) feedback loop where the platform addresses get synced. Withnextbranch andNML3Cfgthere is a clear distinction between what NetworkManager wants to configure vs. what is actually configured. I think forNMDeviceandNMActiveConnection, the IP addresses on "org.freedesktop.NetworkManager.IP4Config" should expose the IP addresses that are actually in platform (ip addr). If there is a need to expose additional information (like things that NetworkManager wanted to configure), then this should be different/new API. On the other hand, currentlyNMVpnConnection'sNMIP4Configonly tracks the IP addresses that come from the VPN plugin. So it's much more what it wants to configure (from the VPN plugin), and not at all about what is configured on the interface. I think that needs to change. ANMIPConfigobject on D-Bus exposes IP configuration information about an netdev interface. Period. That also means that aNMVpnConnection(which currently is like a active connection associated with the device) links to the sameNMIPConfigobject as the underlying device.