device: expose nm_device_ip_config_new() as internal API

(cherry picked from commit 096247e60b)
This commit is contained in:
Thomas Haller 2019-03-02 20:21:50 +01:00
parent 97da3149f7
commit 8068310125
2 changed files with 25 additions and 19 deletions

View file

@ -159,6 +159,12 @@ gboolean nm_device_sysctl_ip_conf_set (NMDevice *self,
const char *property,
const char *value);
NMIP4Config *nm_device_ip4_config_new (NMDevice *self);
NMIP6Config *nm_device_ip6_config_new (NMDevice *self);
NMIPConfig *nm_device_ip_config_new (NMDevice *self, int addr_family);
/*****************************************************************************/
gint64 nm_device_get_configured_mtu_from_connection_default (NMDevice *self,

View file

@ -884,28 +884,28 @@ concheck_get_mgr (NMDevice *self)
return priv->concheck_mgr;
}
static NMIP4Config *
_ip4_config_new (NMDevice *self)
NMIP4Config *
nm_device_ip4_config_new (NMDevice *self)
{
return nm_ip4_config_new (nm_device_get_multi_index (self),
nm_device_get_ip_ifindex (self));
}
static NMIP6Config *
_ip6_config_new (NMDevice *self)
NMIP6Config *
nm_device_ip6_config_new (NMDevice *self)
{
return nm_ip6_config_new (nm_device_get_multi_index (self),
nm_device_get_ip_ifindex (self));
}
static NMIPConfig *
_ip_config_new (NMDevice *self, int addr_family)
NMIPConfig *
nm_device_ip_config_new (NMDevice *self, int addr_family)
{
nm_assert_addr_family (addr_family);
return addr_family == AF_INET
? (gpointer) _ip4_config_new (self)
: (gpointer) _ip6_config_new (self);
? (gpointer) nm_device_ip4_config_new (self)
: (gpointer) nm_device_ip6_config_new (self);
}
static void
@ -932,7 +932,7 @@ applied_config_init (AppliedConfig *config, gpointer ip_config)
static void
applied_config_init_new (AppliedConfig *config, NMDevice *self, int addr_family)
{
gs_unref_object NMIPConfig *c = _ip_config_new (self, addr_family);
gs_unref_object NMIPConfig *c = nm_device_ip_config_new (self, addr_family);
applied_config_init (config, c);
}
@ -6835,7 +6835,7 @@ ipv4ll_get_ip4_config (NMDevice *self, guint32 lla)
NMPlatformIP4Address address;
NMPlatformIP4Route route;
config = _ip4_config_new (self);
config = nm_device_ip4_config_new (self);
g_assert (config);
memset (&address, 0, sizeof (address));
@ -7010,7 +7010,7 @@ ensure_con_ip_config (NMDevice *self, int addr_family)
if (!connection)
return;
con_ip_config = _ip_config_new (self, addr_family);
con_ip_config = nm_device_ip_config_new (self, addr_family);
if (IS_IPv4) {
nm_ip4_config_merge_setting (NM_IP4_CONFIG (con_ip_config),
@ -7113,7 +7113,7 @@ ip_config_merge_and_apply (NMDevice *self,
}
}
composite = _ip_config_new (self, addr_family);
composite = nm_device_ip_config_new (self, addr_family);
if (!IS_IPv4) {
nm_ip6_config_set_privacy (NM_IP6_CONFIG (composite),
@ -7433,7 +7433,7 @@ dhcp4_state_changed (NMDhcpClient *client,
connection = nm_device_get_applied_connection (self);
g_assert (connection);
manual = _ip4_config_new (self);
manual = nm_device_ip4_config_new (self);
nm_ip4_config_merge_setting (manual,
nm_connection_get_setting_ip4_config (connection),
NM_SETTING_CONNECTION_MDNS_DEFAULT,
@ -7771,7 +7771,7 @@ shared4_new_config (NMDevice *self, NMConnection *connection)
is_generated = TRUE;
}
config = _ip4_config_new (self);
config = nm_device_ip4_config_new (self);
nm_ip4_config_add_address (config, &address);
if (is_generated) {
/* Remove the address lock when the object gets disposed */
@ -9664,7 +9664,7 @@ act_stage3_ip_config_start (NMDevice *self,
}
if (num_addresses) {
config = _ip4_config_new (self);
config = nm_device_ip4_config_new (self);
nm_ip4_config_merge_setting (config,
nm_connection_get_setting_ip4_config (connection),
NM_SETTING_CONNECTION_MDNS_DEFAULT,
@ -9861,7 +9861,7 @@ nm_device_activate_stage3_ip6_start (NMDevice *self)
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip_config_start (self, AF_INET6, (gpointer *) &ip6_config, &failure_reason);
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
if (!ip6_config)
ip6_config = _ip6_config_new (self);
ip6_config = nm_device_ip6_config_new (self);
/* Here we get a static IPv6 config, like for Shared where it's
* autogenerated or from modems where it comes from ModemManager.
*/
@ -10449,7 +10449,7 @@ dad6_add_pending_address (NMDevice *self,
nm_platform_ip6_address_to_string (pl_addr, NULL, 0));
if (!*dad6_config)
*dad6_config = _ip6_config_new (self);
*dad6_config = nm_device_ip6_config_new (self);
nm_ip6_config_add_address (*dad6_config, pl_addr);
}
@ -10849,7 +10849,7 @@ nm_device_reactivate_ip4_config (NMDevice *self,
g_clear_object (&priv->ext_ip_config_4);
g_clear_object (&priv->dev_ip_config_4.current);
g_clear_object (&priv->dev2_ip_config_4.current);
priv->con_ip_config_4 = _ip4_config_new (self);
priv->con_ip_config_4 = nm_device_ip4_config_new (self);
nm_ip4_config_merge_setting (priv->con_ip_config_4,
s_ip4_new,
_get_mdns (self),
@ -10925,7 +10925,7 @@ nm_device_reactivate_ip6_config (NMDevice *self,
if ( priv->ipv6ll_handle
&& !IN6_IS_ADDR_UNSPECIFIED (&priv->ipv6ll_addr))
priv->ipv6ll_has = TRUE;
priv->con_ip_config_6 = _ip6_config_new (self);
priv->con_ip_config_6 = nm_device_ip6_config_new (self);
nm_ip6_config_merge_setting (priv->con_ip_config_6,
s_ip6_new,
nm_device_get_route_table (self, AF_INET6, TRUE),