diff options
author | Thomas Haller <thaller@redhat.com> | 2021-08-06 15:17:05 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-09-30 09:56:19 +0200 |
commit | d64b4a30d21fa98f6a7d11c28ac21a8f9d8ee299 (patch) | |
tree | ddb782113363dea1fa8e0a38e2570c269b98ff24 /src/core/nm-ip-config.h | |
parent | f20431bf89fd00c88659275f69419601cf98cb6b (diff) | |
download | NetworkManager-next.tar.gz |
core: rework IP configuration in NetworkManager using layer 3 configurationnext
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>
Diffstat (limited to 'src/core/nm-ip-config.h')
-rw-r--r-- | src/core/nm-ip-config.h | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/src/core/nm-ip-config.h b/src/core/nm-ip-config.h index 8e1a593412..224f180e55 100644 --- a/src/core/nm-ip-config.h +++ b/src/core/nm-ip-config.h @@ -7,6 +7,7 @@ #define __NM_IP_CONFIG_H__ #include "nm-dbus-object.h" +#include "nm-l3cfg.h" /*****************************************************************************/ @@ -22,23 +23,65 @@ #define NM_IP_CONFIG_L3CFG "l3cfg" #define NM_IP_CONFIG_IS_VPN "is-vpn" -struct _NMIPConfigPrivate; +struct _NMIPConfigPrivate { + NML3Cfg * l3cfg; + const NML3ConfigData *l3cd; + GVariant * v_address_data; + GVariant * v_addresses; + GVariant * v_route_data; + GVariant * v_routes; + struct { + const NMPObject *best_default_route; + NMIPAddr addr; + } v_gateway; + gulong l3cfg_notify_id; + bool is_vpn : 1; +}; struct _NMIPConfig { - NMDBusObject parent; - struct _NMIPConfigPrivate *_priv; + NMDBusObject parent; + struct _NMIPConfigPrivate _priv; }; typedef struct { NMDBusObjectClass parent; - gboolean is_ipv4; int addr_family; } NMIPConfigClass; GType nm_ip_config_get_type(void); -GType nm_ip4_config_get_type(void); -GType nm_ip6_config_get_type(void); NMIPConfig *nm_ip_config_new(int addr_family, NML3Cfg *l3cfg, gboolean is_vpn); +void nm_ip_config_take_and_unexport_on_idle(NMIPConfig *self_take); + +/*****************************************************************************/ + +static inline NML3Cfg * +nm_ip_config_get_l3cfg(NMIPConfig *self) +{ + g_return_val_if_fail(NM_IS_IP_CONFIG(self), NULL); + + return self->_priv.l3cfg; +} + +static inline struct _NMDedupMultiIndex * +nm_ip_config_get_multi_index(NMIPConfig *self) +{ + return nm_l3cfg_get_multi_idx(nm_ip_config_get_l3cfg(self)); +} + +static inline int +nm_ip_config_get_ifindex(NMIPConfig *self) +{ + return nm_l3cfg_get_ifindex(nm_ip_config_get_l3cfg(self)); +} + +static inline int +nm_ip_config_get_addr_family(NMIPConfig *self) +{ + g_return_val_if_fail(NM_IS_IP_CONFIG(self), AF_UNSPEC); + + return NM_IP_CONFIG_GET_CLASS(self)->addr_family; +} + #endif /* __NM_IP_CONFIG_H__ */ |