mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 00:40:08 +01:00
all: merge branch 'cathay4t:ensure_setting'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/964
This commit is contained in:
commit
f9c096ba84
40 changed files with 144 additions and 298 deletions
|
|
@ -17,6 +17,7 @@
|
|||
#include "libnm-glib-aux/nm-uuid.h"
|
||||
#include "libnm-glib-aux/nm-str-buf.h"
|
||||
#include "libnm-base/nm-net-aux.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-aux-intern/nm-common-macros.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-setting-connection.h"
|
||||
|
|
@ -248,11 +249,7 @@ _nm_utils_complete_generic_with_params(NMPlatform * platform,
|
|||
g_assert(fallback_id_prefix);
|
||||
g_return_if_fail(ifname_prefix == NULL || ifname == NULL);
|
||||
|
||||
s_con = nm_connection_get_setting_connection(connection);
|
||||
if (!s_con) {
|
||||
s_con = (NMSettingConnection *) nm_setting_connection_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_con));
|
||||
}
|
||||
s_con = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_CONNECTION);
|
||||
g_object_set(G_OBJECT(s_con), NM_SETTING_CONNECTION_TYPE, ctype, NULL);
|
||||
|
||||
if (!nm_setting_connection_get_uuid(s_con)) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <stdio.h>
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
#include "nm-bluez-common.h"
|
||||
#include "nm-bluez-manager.h"
|
||||
|
|
@ -273,11 +274,7 @@ complete_connection(NMDevice * device,
|
|||
s_serial = nm_connection_get_setting_serial(connection);
|
||||
s_ppp = nm_connection_get_setting_ppp(connection);
|
||||
|
||||
s_bt = nm_connection_get_setting_bluetooth(connection);
|
||||
if (!s_bt) {
|
||||
s_bt = (NMSettingBluetooth *) nm_setting_bluetooth_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_bt));
|
||||
}
|
||||
s_bt = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_BLUETOOTH);
|
||||
|
||||
ctype = nm_setting_bluetooth_get_connection_type(s_bt);
|
||||
if (ctype) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "nm-device-private.h"
|
||||
#include "settings/nm-settings.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-platform/nm-platform.h"
|
||||
#include "nm-device-factory.h"
|
||||
#include "nm-setting-6lowpan.h"
|
||||
|
|
@ -221,12 +222,7 @@ static void
|
|||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMSetting6Lowpan *s_6lowpan =
|
||||
NM_SETTING_6LOWPAN(nm_connection_get_setting(connection, NM_TYPE_SETTING_6LOWPAN));
|
||||
|
||||
if (!s_6lowpan) {
|
||||
s_6lowpan = (NMSetting6Lowpan *) nm_setting_6lowpan_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_6lowpan);
|
||||
}
|
||||
_nm_connection_ensure_setting(connection, NM_TYPE_SETTING_6LOWPAN);
|
||||
|
||||
g_object_set(
|
||||
s_6lowpan,
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "nm-device-private.h"
|
||||
#include "libnm-platform/nm-platform.h"
|
||||
#include "nm-device-factory.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
#include "nm-ip4-config.h"
|
||||
|
||||
|
|
@ -79,8 +80,6 @@ complete_connection(NMDevice * device,
|
|||
NMConnection *const *existing_connections,
|
||||
GError ** error)
|
||||
{
|
||||
NMSettingBond *s_bond;
|
||||
|
||||
nm_utils_complete_generic(nm_device_get_platform(device),
|
||||
connection,
|
||||
NM_SETTING_BOND_SETTING_NAME,
|
||||
|
|
@ -91,11 +90,7 @@ complete_connection(NMDevice * device,
|
|||
NULL,
|
||||
TRUE);
|
||||
|
||||
s_bond = nm_connection_get_setting_bond(connection);
|
||||
if (!s_bond) {
|
||||
s_bond = (NMSettingBond *) nm_setting_bond_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_bond));
|
||||
}
|
||||
_nm_connection_ensure_setting(connection, NM_TYPE_SETTING_BOND);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -168,16 +163,11 @@ static void
|
|||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMDeviceBond * self = NM_DEVICE_BOND(device);
|
||||
NMSettingBond *s_bond = nm_connection_get_setting_bond(connection);
|
||||
NMSettingBond *s_bond = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_BOND);
|
||||
int ifindex = nm_device_get_ifindex(device);
|
||||
NMBondMode mode = NM_BOND_MODE_UNKNOWN;
|
||||
const char ** options;
|
||||
|
||||
if (!s_bond) {
|
||||
s_bond = (NMSettingBond *) nm_setting_bond_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_bond);
|
||||
}
|
||||
|
||||
/* Read bond options from sysfs and update the Bond setting to match */
|
||||
options = nm_setting_bond_get_valid_options(NULL);
|
||||
for (; options[0]; options++) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "nm-device-private.h"
|
||||
#include "libnm-platform/nm-platform.h"
|
||||
#include "nm-device-factory.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
|
||||
#define _NMLOG_DEVICE_TYPE NMDeviceBridge
|
||||
|
|
@ -145,8 +146,6 @@ complete_connection(NMDevice * device,
|
|||
NMConnection *const *existing_connections,
|
||||
GError ** error)
|
||||
{
|
||||
NMSettingBridge *s_bridge;
|
||||
|
||||
nm_utils_complete_generic(nm_device_get_platform(device),
|
||||
connection,
|
||||
NM_SETTING_BRIDGE_SETTING_NAME,
|
||||
|
|
@ -157,11 +156,7 @@ complete_connection(NMDevice * device,
|
|||
NULL,
|
||||
TRUE);
|
||||
|
||||
s_bridge = nm_connection_get_setting_bridge(connection);
|
||||
if (!s_bridge) {
|
||||
s_bridge = (NMSettingBridge *) nm_setting_bridge_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_bridge));
|
||||
}
|
||||
_nm_connection_ensure_setting(connection, NM_TYPE_SETTING_BRIDGE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -576,17 +571,12 @@ static void
|
|||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMDeviceBridge * self = NM_DEVICE_BRIDGE(device);
|
||||
NMSettingBridge *s_bridge = nm_connection_get_setting_bridge(connection);
|
||||
NMSettingBridge *s_bridge = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_BRIDGE);
|
||||
int ifindex = nm_device_get_ifindex(device);
|
||||
const Option * option;
|
||||
gs_free char * stp = NULL;
|
||||
int stp_value;
|
||||
|
||||
if (!s_bridge) {
|
||||
s_bridge = (NMSettingBridge *) nm_setting_bridge_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_bridge);
|
||||
}
|
||||
|
||||
option = master_options;
|
||||
nm_assert(nm_streq(option->sysname, "stp_state"));
|
||||
|
||||
|
|
@ -690,11 +680,7 @@ master_update_slave_connection(NMDevice * device,
|
|||
g_return_val_if_fail(ifindex_slave > 0, FALSE);
|
||||
|
||||
s_con = nm_connection_get_setting_connection(connection);
|
||||
s_port = nm_connection_get_setting_bridge_port(connection);
|
||||
if (!s_port) {
|
||||
s_port = (NMSettingBridgePort *) nm_setting_bridge_port_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_port));
|
||||
}
|
||||
s_port = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_BRIDGE_PORT);
|
||||
|
||||
for (option = slave_options; option->name; option++) {
|
||||
gs_free char *str = nm_platform_sysctl_slave_get_option(nm_device_get_platform(device),
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include "libnm-platform/nm-platform.h"
|
||||
#include "nm-device-factory.h"
|
||||
#include "nm-setting-dummy.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
|
||||
#define _NMLOG_DEVICE_TYPE NMDeviceDummy
|
||||
|
|
@ -48,8 +49,6 @@ complete_connection(NMDevice * device,
|
|||
NMConnection *const *existing_connections,
|
||||
GError ** error)
|
||||
{
|
||||
NMSettingDummy *s_dummy;
|
||||
|
||||
nm_utils_complete_generic_with_params(nm_device_get_platform(device),
|
||||
connection,
|
||||
NM_SETTING_DUMMY_SETTING_NAME,
|
||||
|
|
@ -59,11 +58,7 @@ complete_connection(NMDevice * device,
|
|||
NULL,
|
||||
nm_device_get_ip_iface(device));
|
||||
|
||||
s_dummy = nm_connection_get_setting_dummy(connection);
|
||||
if (!s_dummy) {
|
||||
s_dummy = NM_SETTING_DUMMY(nm_setting_dummy_new());
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_dummy));
|
||||
}
|
||||
_nm_connection_ensure_setting(connection, NM_TYPE_SETTING_DUMMY);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -71,12 +66,7 @@ complete_connection(NMDevice * device,
|
|||
static void
|
||||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMSettingDummy *s_dummy = nm_connection_get_setting_dummy(connection);
|
||||
|
||||
if (!s_dummy) {
|
||||
s_dummy = (NMSettingDummy *) nm_setting_dummy_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_dummy);
|
||||
}
|
||||
_nm_connection_ensure_setting(connection, NM_TYPE_SETTING_DUMMY);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "nm-device-ethernet-utils.h"
|
||||
#include "settings/nm-settings.h"
|
||||
#include "nm-device-factory.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "libnm-udev-aux/nm-udev-utils.h"
|
||||
|
|
@ -1616,11 +1617,7 @@ complete_connection(NMDevice * device,
|
|||
NULL,
|
||||
TRUE);
|
||||
|
||||
s_veth = _nm_connection_get_setting(connection, NM_TYPE_SETTING_VETH);
|
||||
if (!s_veth) {
|
||||
s_veth = (NMSettingVeth *) nm_setting_veth_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_veth));
|
||||
}
|
||||
s_veth = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_VETH);
|
||||
|
||||
ifindex = nm_device_get_ip_ifindex(device);
|
||||
if (ifindex > 0) {
|
||||
|
|
@ -1662,11 +1659,7 @@ complete_connection(NMDevice * device,
|
|||
if (s_pppoe && !nm_setting_verify(NM_SETTING(s_pppoe), NULL, error))
|
||||
return FALSE;
|
||||
|
||||
s_wired = nm_connection_get_setting_wired(connection);
|
||||
if (!s_wired) {
|
||||
s_wired = (NMSettingWired *) nm_setting_wired_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_wired));
|
||||
}
|
||||
s_wired = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_WIRED);
|
||||
|
||||
/* Default to an ethernet-only connection, but if a PPPoE setting was given
|
||||
* then PPPoE should be our connection type.
|
||||
|
|
@ -1780,20 +1773,15 @@ get_s390_subchannels(NMDevice *device)
|
|||
static void
|
||||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE(device);
|
||||
NMSettingWired * s_wired = nm_connection_get_setting_wired(connection);
|
||||
gboolean perm_hw_addr_is_fake;
|
||||
const char * perm_hw_addr;
|
||||
const char * mac = nm_device_get_hw_address(device);
|
||||
const char * mac_prop = NM_SETTING_WIRED_MAC_ADDRESS;
|
||||
GHashTableIter iter;
|
||||
const char * key;
|
||||
const char * value;
|
||||
|
||||
if (!s_wired) {
|
||||
s_wired = (NMSettingWired *) nm_setting_wired_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_wired);
|
||||
}
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE(device);
|
||||
NMSettingWired *s_wired = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_WIRED);
|
||||
gboolean perm_hw_addr_is_fake;
|
||||
const char * perm_hw_addr;
|
||||
const char * mac = nm_device_get_hw_address(device);
|
||||
const char * mac_prop = NM_SETTING_WIRED_MAC_ADDRESS;
|
||||
GHashTableIter iter;
|
||||
const char * key;
|
||||
const char * value;
|
||||
|
||||
g_object_set(nm_connection_get_setting_connection(connection),
|
||||
NM_SETTING_CONNECTION_TYPE,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include "nm-ip4-config.h"
|
||||
#include "libnm-platform/nm-platform.h"
|
||||
#include "nm-device-factory.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
|
||||
#define NM_DEVICE_INFINIBAND_IS_PARTITION "is-partition"
|
||||
|
|
@ -146,11 +147,7 @@ complete_connection(NMDevice * device,
|
|||
{
|
||||
NMSettingInfiniband *s_infiniband;
|
||||
|
||||
s_infiniband = nm_connection_get_setting_infiniband(connection);
|
||||
if (!s_infiniband) {
|
||||
s_infiniband = (NMSettingInfiniband *) nm_setting_infiniband_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_infiniband));
|
||||
}
|
||||
s_infiniband = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_INFINIBAND);
|
||||
|
||||
nm_utils_complete_generic(
|
||||
nm_device_get_platform(device),
|
||||
|
|
@ -175,15 +172,11 @@ complete_connection(NMDevice * device,
|
|||
static void
|
||||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMSettingInfiniband *s_infiniband = nm_connection_get_setting_infiniband(connection);
|
||||
const char * mac = nm_device_get_permanent_hw_address(device);
|
||||
const char * transport_mode = "datagram";
|
||||
int ifindex;
|
||||
|
||||
if (!s_infiniband) {
|
||||
s_infiniband = (NMSettingInfiniband *) nm_setting_infiniband_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_infiniband);
|
||||
}
|
||||
NMSettingInfiniband *s_infiniband =
|
||||
_nm_connection_ensure_setting(connection, NM_TYPE_SETTING_INFINIBAND);
|
||||
const char *mac = nm_device_get_permanent_hw_address(device);
|
||||
const char *transport_mode = "datagram";
|
||||
int ifindex;
|
||||
|
||||
if (mac && !nm_utils_hwaddr_matches(mac, -1, NULL, INFINIBAND_ALEN))
|
||||
g_object_set(s_infiniband, NM_SETTING_INFINIBAND_MAC_ADDRESS, mac, NULL);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "nm-manager.h"
|
||||
#include "libnm-platform/nm-platform.h"
|
||||
#include "nm-device-factory.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
#include "settings/nm-settings.h"
|
||||
#include "nm-act-request.h"
|
||||
|
|
@ -416,14 +417,10 @@ complete_connection(NMDevice * device,
|
|||
static void
|
||||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMDeviceIPTunnel * self = NM_DEVICE_IP_TUNNEL(device);
|
||||
NMDeviceIPTunnelPrivate *priv = NM_DEVICE_IP_TUNNEL_GET_PRIVATE(self);
|
||||
NMSettingIPTunnel * s_ip_tunnel = nm_connection_get_setting_ip_tunnel(connection);
|
||||
|
||||
if (!s_ip_tunnel) {
|
||||
s_ip_tunnel = (NMSettingIPTunnel *) nm_setting_ip_tunnel_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_ip_tunnel);
|
||||
}
|
||||
NMDeviceIPTunnel * self = NM_DEVICE_IP_TUNNEL(device);
|
||||
NMDeviceIPTunnelPrivate *priv = NM_DEVICE_IP_TUNNEL_GET_PRIVATE(self);
|
||||
NMSettingIPTunnel * s_ip_tunnel =
|
||||
_nm_connection_ensure_setting(connection, NM_TYPE_SETTING_IP_TUNNEL);
|
||||
|
||||
if (nm_setting_ip_tunnel_get_mode(s_ip_tunnel) != priv->mode)
|
||||
g_object_set(G_OBJECT(s_ip_tunnel), NM_SETTING_IP_TUNNEL_MODE, priv->mode, NULL);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "settings/nm-settings.h"
|
||||
#include "nm-act-request.h"
|
||||
#include "nm-manager.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-platform/nm-platform.h"
|
||||
#include "nm-device-factory.h"
|
||||
#include "nm-setting-macvlan.h"
|
||||
|
|
@ -419,14 +420,10 @@ complete_connection(NMDevice * device,
|
|||
static void
|
||||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE(device);
|
||||
NMSettingMacvlan * s_macvlan = nm_connection_get_setting_macvlan(connection);
|
||||
int new_mode;
|
||||
|
||||
if (!s_macvlan) {
|
||||
s_macvlan = (NMSettingMacvlan *) nm_setting_macvlan_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_macvlan);
|
||||
}
|
||||
NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE(device);
|
||||
NMSettingMacvlan * s_macvlan =
|
||||
_nm_connection_ensure_setting(connection, NM_TYPE_SETTING_MACVLAN);
|
||||
int new_mode;
|
||||
|
||||
new_mode = platform_mode_to_setting(priv->props.mode);
|
||||
if (new_mode != nm_setting_macvlan_get_mode(s_macvlan))
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "libnm-platform/nm-platform.h"
|
||||
#include "nm-device-factory.h"
|
||||
#include "nm-setting-tun.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
|
||||
#define _NMLOG_DEVICE_TYPE NMDeviceTun
|
||||
|
|
@ -186,11 +187,7 @@ update_connection(NMDevice *device, NMConnection *connection)
|
|||
return;
|
||||
}
|
||||
|
||||
s_tun = nm_connection_get_setting_tun(connection);
|
||||
if (!s_tun) {
|
||||
s_tun = (NMSettingTun *) nm_setting_tun_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_tun);
|
||||
}
|
||||
s_tun = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_TUN);
|
||||
|
||||
if (mode != nm_setting_tun_get_mode(s_tun))
|
||||
g_object_set(G_OBJECT(s_tun), NM_SETTING_TUN_MODE, (guint) mode, NULL);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "libnm-platform/nm-platform.h"
|
||||
#include "nm-device-factory.h"
|
||||
#include "nm-manager.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
#include "libnm-platform/nmp-object.h"
|
||||
#include "libnm-platform/nm-platform-utils.h"
|
||||
|
|
@ -432,18 +433,13 @@ static void
|
|||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMDeviceVlanPrivate * priv = NM_DEVICE_VLAN_GET_PRIVATE(device);
|
||||
NMSettingVlan * s_vlan = nm_connection_get_setting_vlan(connection);
|
||||
NMSettingVlan * s_vlan = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_VLAN);
|
||||
int ifindex = nm_device_get_ifindex(device);
|
||||
const NMPlatformLink *plink;
|
||||
const NMPObject * polnk;
|
||||
guint vlan_id;
|
||||
_NMVlanFlags vlan_flags;
|
||||
|
||||
if (!s_vlan) {
|
||||
s_vlan = (NMSettingVlan *) nm_setting_vlan_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_vlan);
|
||||
}
|
||||
|
||||
polnk = nm_platform_link_get_lnk(nm_device_get_platform(device),
|
||||
ifindex,
|
||||
NM_LINK_TYPE_VLAN,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "nm-device-private.h"
|
||||
#include "nm-manager.h"
|
||||
#include "nm-setting-vrf.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-platform/nm-platform.h"
|
||||
#include "settings/nm-settings.h"
|
||||
|
||||
|
|
@ -199,12 +200,7 @@ static void
|
|||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMDeviceVrfPrivate *priv = NM_DEVICE_VRF_GET_PRIVATE(device);
|
||||
NMSettingVrf * s_vrf = _nm_connection_get_setting(connection, NM_TYPE_SETTING_VRF);
|
||||
|
||||
if (!s_vrf) {
|
||||
s_vrf = (NMSettingVrf *) nm_setting_vrf_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_vrf);
|
||||
}
|
||||
NMSettingVrf * s_vrf = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_VRF);
|
||||
|
||||
if (priv->props.table != nm_setting_vrf_get_table(s_vrf))
|
||||
g_object_set(G_OBJECT(s_vrf), NM_SETTING_VRF_TABLE, priv->props.table, NULL);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "settings/nm-settings.h"
|
||||
#include "nm-act-request.h"
|
||||
#include "nm-ip4-config.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
|
||||
#define _NMLOG_DEVICE_TYPE NMDeviceVxlan
|
||||
|
|
@ -399,14 +400,9 @@ complete_connection(NMDevice * device,
|
|||
static void
|
||||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMDeviceVxlanPrivate *priv = NM_DEVICE_VXLAN_GET_PRIVATE(device);
|
||||
NMSettingVxlan * s_vxlan = nm_connection_get_setting_vxlan(connection);
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
if (!s_vxlan) {
|
||||
s_vxlan = (NMSettingVxlan *) nm_setting_vxlan_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_vxlan);
|
||||
}
|
||||
NMDeviceVxlanPrivate *priv = NM_DEVICE_VXLAN_GET_PRIVATE(device);
|
||||
NMSettingVxlan *s_vxlan = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_VXLAN);
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
if (priv->props.id != nm_setting_vxlan_get_id(s_vxlan))
|
||||
g_object_set(G_OBJECT(s_vxlan), NM_SETTING_VXLAN_ID, priv->props.id, NULL);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <linux/fib_rules.h>
|
||||
|
||||
#include "nm-setting-wireguard.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
#include "libnm-glib-aux/nm-secret-utils.h"
|
||||
#include "nm-device-private.h"
|
||||
|
|
@ -1891,17 +1892,11 @@ static void
|
|||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMDeviceWireGuardPrivate *priv = NM_DEVICE_WIREGUARD_GET_PRIVATE(device);
|
||||
NMSettingWireGuard * s_wg =
|
||||
NM_SETTING_WIREGUARD(nm_connection_get_setting(connection, NM_TYPE_SETTING_WIREGUARD));
|
||||
const NMPObject * obj_wg;
|
||||
NMSettingWireGuard *s_wg = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_WIREGUARD);
|
||||
const NMPObject * obj_wg;
|
||||
const NMPObjectLnkWireGuard *olnk_wg;
|
||||
guint i;
|
||||
|
||||
if (!s_wg) {
|
||||
s_wg = NM_SETTING_WIREGUARD(nm_setting_wireguard_new());
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_wg));
|
||||
}
|
||||
|
||||
g_object_set(s_wg,
|
||||
NM_SETTING_WIREGUARD_FWMARK,
|
||||
(guint) priv->lnk_curr.fwmark,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "libnm-platform/nm-platform.h"
|
||||
#include "nm-device-factory.h"
|
||||
#include "nm-setting-wpan.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
|
||||
#define _NMLOG_DEVICE_TYPE NMDeviceWpan
|
||||
|
|
@ -71,13 +72,7 @@ complete_connection(NMDevice * device,
|
|||
static void
|
||||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMSettingWpan *s_wpan =
|
||||
NM_SETTING_WPAN(nm_connection_get_setting(connection, NM_TYPE_SETTING_WPAN));
|
||||
|
||||
if (!s_wpan) {
|
||||
s_wpan = (NMSettingWpan *) nm_setting_wpan_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_wpan);
|
||||
}
|
||||
_nm_connection_ensure_setting(connection, NM_TYPE_SETTING_WPAN);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include "devices/nm-device-private.h"
|
||||
#include "libnm-platform/nm-platform.h"
|
||||
#include "nm-config.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-ip4-config.h"
|
||||
|
|
@ -78,8 +79,6 @@ complete_connection(NMDevice * device,
|
|||
NMConnection *const *existing_connections,
|
||||
GError ** error)
|
||||
{
|
||||
NMSettingTeam *s_team;
|
||||
|
||||
nm_utils_complete_generic(nm_device_get_platform(device),
|
||||
connection,
|
||||
NM_SETTING_TEAM_SETTING_NAME,
|
||||
|
|
@ -90,11 +89,7 @@ complete_connection(NMDevice * device,
|
|||
NULL,
|
||||
TRUE);
|
||||
|
||||
s_team = nm_connection_get_setting_team(connection);
|
||||
if (!s_team) {
|
||||
s_team = (NMSettingTeam *) nm_setting_team_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_team));
|
||||
}
|
||||
_nm_connection_ensure_setting(connection, NM_TYPE_SETTING_TEAM);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -168,15 +163,10 @@ static void
|
|||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMDeviceTeam * self = NM_DEVICE_TEAM(device);
|
||||
NMSettingTeam * s_team = nm_connection_get_setting_team(connection);
|
||||
NMSettingTeam * s_team = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_TEAM);
|
||||
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE(self);
|
||||
struct teamdctl * tdc = priv->tdc;
|
||||
|
||||
if (!s_team) {
|
||||
s_team = (NMSettingTeam *) nm_setting_team_new();
|
||||
nm_connection_add_setting(connection, (NMSetting *) s_team);
|
||||
}
|
||||
|
||||
/* Read the configuration only if not already set */
|
||||
if (!priv->config && ensure_teamd_connection(device))
|
||||
teamd_read_config(self);
|
||||
|
|
@ -250,11 +240,7 @@ master_update_slave_connection(NMDevice * self,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
s_port = nm_connection_get_setting_team_port(connection);
|
||||
if (!s_port) {
|
||||
s_port = (NMSettingTeamPort *) nm_setting_team_port_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_port));
|
||||
}
|
||||
s_port = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_TEAM_PORT);
|
||||
|
||||
g_object_set(G_OBJECT(s_port), NM_SETTING_TEAM_PORT_CONFIG, port_config, NULL);
|
||||
g_free(port_config);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "libnm-glib-aux/nm-ref-string.h"
|
||||
#include "nm-iwd-manager.h"
|
||||
#include "libnm-core-aux-intern/nm-common-macros.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nm-setting-8021x.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-wireless-security.h"
|
||||
|
|
@ -966,7 +967,7 @@ complete_connection(NMDevice * device,
|
|||
gboolean hidden = FALSE;
|
||||
const char * mode;
|
||||
|
||||
s_wifi = nm_connection_get_setting_wireless(connection);
|
||||
s_wifi = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_WIRELESS);
|
||||
|
||||
mode = s_wifi ? nm_setting_wireless_get_mode(s_wifi) : NULL;
|
||||
|
||||
|
|
@ -1031,12 +1032,6 @@ complete_connection(NMDevice * device,
|
|||
}
|
||||
|
||||
ssid = nm_wifi_ap_get_ssid(ap);
|
||||
|
||||
/* Add a wifi setting if one doesn't exist yet */
|
||||
if (!s_wifi) {
|
||||
s_wifi = (NMSettingWireless *) nm_setting_wireless_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_wifi));
|
||||
}
|
||||
}
|
||||
|
||||
if (ap) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-olpc-mesh.h"
|
||||
#include "nm-manager.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-platform/nm-platform.h"
|
||||
|
||||
#define _NMLOG_DEVICE_TYPE NMDeviceOlpcMesh
|
||||
|
|
@ -88,11 +89,7 @@ complete_connection(NMDevice * device,
|
|||
{
|
||||
NMSettingOlpcMesh *s_mesh;
|
||||
|
||||
s_mesh = nm_connection_get_setting_olpc_mesh(connection);
|
||||
if (!s_mesh) {
|
||||
s_mesh = (NMSettingOlpcMesh *) nm_setting_olpc_mesh_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_mesh));
|
||||
}
|
||||
s_mesh = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_OLPC_MESH);
|
||||
|
||||
if (!nm_setting_olpc_mesh_get_ssid(s_mesh)) {
|
||||
gs_unref_bytes GBytes *ssid = NULL;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "NetworkManagerUtils.h"
|
||||
#include "devices/nm-device-private.h"
|
||||
#include "nm-act-request.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
#include "libnm-glib-aux/nm-ref-string.h"
|
||||
#include "nm-ip4-config.h"
|
||||
|
|
@ -302,10 +303,7 @@ complete_connection(NMDevice * device,
|
|||
}
|
||||
|
||||
/* Add a Wi-Fi P2P setting if one doesn't exist yet */
|
||||
if (!s_wifi_p2p) {
|
||||
s_wifi_p2p = NM_SETTING_WIFI_P2P(nm_setting_wifi_p2p_new());
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_wifi_p2p));
|
||||
}
|
||||
s_wifi_p2p = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_WIFI_P2P);
|
||||
|
||||
g_object_set(G_OBJECT(s_wifi_p2p), NM_SETTING_WIFI_P2P_PEER, setting_peer, NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "nm-device-wifi-p2p.h"
|
||||
#include "nm-wifi-ap.h"
|
||||
#include "libnm-core-aux-intern/nm-common-macros.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "devices/nm-device.h"
|
||||
#include "devices/nm-device-private.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
|
|
@ -1205,10 +1206,7 @@ complete_connection(NMDevice * device,
|
|||
}
|
||||
|
||||
/* Add a wifi setting if one doesn't exist yet */
|
||||
if (!s_wifi) {
|
||||
s_wifi = (NMSettingWireless *) nm_setting_wireless_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_wifi));
|
||||
}
|
||||
s_wifi = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_WIRELESS);
|
||||
|
||||
if (ap)
|
||||
ssid = nm_wifi_ap_get_ssid(ap);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "nm-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-aux-intern/nm-common-macros.h"
|
||||
#include "libnm-base/nm-config-base.h"
|
||||
|
||||
|
|
@ -679,10 +680,7 @@ nm_wifi_utils_complete_connection(GBytes * ap_ssid,
|
|||
}
|
||||
|
||||
/* Everything else requires security */
|
||||
if (!s_wsec) {
|
||||
s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_wsec));
|
||||
}
|
||||
s_wsec = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
|
||||
|
||||
key_mgmt = nm_setting_wireless_security_get_key_mgmt(s_wsec);
|
||||
auth_alg = nm_setting_wireless_security_get_auth_alg(s_wsec);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <arpa/inet.h>
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "devices/nm-device-private.h"
|
||||
|
|
@ -829,11 +830,7 @@ complete_connection(NMModem * modem,
|
|||
if (MODEM_CAPS_3GPP2(modem_caps)) {
|
||||
NMSettingCdma *s_cdma;
|
||||
|
||||
s_cdma = nm_connection_get_setting_cdma(connection);
|
||||
if (!s_cdma) {
|
||||
s_cdma = (NMSettingCdma *) nm_setting_cdma_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_cdma));
|
||||
}
|
||||
s_cdma = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_CDMA);
|
||||
|
||||
if (!nm_setting_cdma_get_number(s_cdma))
|
||||
g_object_set(G_OBJECT(s_cdma), NM_SETTING_CDMA_NUMBER, "#777", NULL);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "nm-common-macros.h"
|
||||
#include "nm-errors.h"
|
||||
#include "libnm-core-public/nm-connection.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -358,3 +359,16 @@ nm_settings_connection_validate_permission_user(const char *item, gssize len)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gpointer
|
||||
_nm_connection_ensure_setting(NMConnection *connection, GType gtype)
|
||||
{
|
||||
NMSetting *setting;
|
||||
|
||||
setting = nm_connection_get_setting(connection, gtype);
|
||||
if (!setting) {
|
||||
setting = g_object_new(gtype, NULL);
|
||||
nm_connection_add_setting(connection, setting);
|
||||
}
|
||||
return setting;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,4 +166,6 @@ gboolean nm_utils_validate_dhcp4_vendor_class_id(const char *vci, GError **error
|
|||
|
||||
gboolean nm_settings_connection_validate_permission_user(const char *item, gssize len);
|
||||
|
||||
gpointer _nm_connection_ensure_setting(NMConnection *connection, GType gtype);
|
||||
|
||||
#endif /* __NM_LIBNM_SHARED_UTILS_H__ */
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include "libnm-glib-aux/nm-secret-utils.h"
|
||||
#include "libnm-systemd-shared/nm-sd-utils-shared.h"
|
||||
#include "libnm-core-aux-intern/nm-common-macros.h"
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
#include "nm-keyfile.h"
|
||||
#include "nm-setting-private.h"
|
||||
|
|
@ -3779,11 +3779,7 @@ nm_keyfile_read(GKeyFile * keyfile,
|
|||
goto out_with_info_error;
|
||||
}
|
||||
|
||||
s_con = nm_connection_get_setting_connection(connection);
|
||||
if (!s_con) {
|
||||
s_con = NM_SETTING_CONNECTION(nm_setting_connection_new());
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_con));
|
||||
}
|
||||
s_con = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_CONNECTION);
|
||||
|
||||
/* Make sure that we have 'interface-name' even if it was specified in the
|
||||
* "wrong" (ie, deprecated) group.
|
||||
|
|
|
|||
|
|
@ -334,20 +334,11 @@ nmt_page_bond_constructed(GObject *object)
|
|||
NmtNewtWidget * widget, *label;
|
||||
NMConnection * conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(bond));
|
||||
s_bond = nm_connection_get_setting_bond(conn);
|
||||
if (!s_bond) {
|
||||
nm_connection_add_setting(conn, nm_setting_bond_new());
|
||||
s_bond = nm_connection_get_setting_bond(conn);
|
||||
}
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(bond));
|
||||
s_bond = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_BOND);
|
||||
priv->s_bond = s_bond;
|
||||
|
||||
s_wired = nm_connection_get_setting_wired(conn);
|
||||
if (!s_wired) {
|
||||
nm_connection_add_setting(conn, nm_setting_wired_new());
|
||||
s_wired = nm_connection_get_setting_wired(conn);
|
||||
}
|
||||
|
||||
s_wired = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_WIRED);
|
||||
section = nmt_editor_section_new(_("BOND"), NULL, TRUE);
|
||||
grid = nmt_editor_section_get_body(section);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include "nmt-page-bridge-port.h"
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
|
||||
G_DEFINE_TYPE(NmtPageBridgePort, nmt_page_bridge_port, NMT_TYPE_EDITOR_PAGE)
|
||||
|
||||
NmtEditorPage *
|
||||
|
|
@ -35,11 +37,7 @@ nmt_page_bridge_port_constructed(GObject *object)
|
|||
NMConnection * conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(bridge));
|
||||
s_port = nm_connection_get_setting_bridge_port(conn);
|
||||
if (!s_port) {
|
||||
nm_connection_add_setting(conn, nm_setting_bridge_port_new());
|
||||
s_port = nm_connection_get_setting_bridge_port(conn);
|
||||
}
|
||||
s_port = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_BRIDGE_PORT);
|
||||
|
||||
section = nmt_editor_section_new(_("BRIDGE PORT"), NULL, TRUE);
|
||||
grid = nmt_editor_section_get_body(section);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "nmt-page-bridge.h"
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nmt-address-list.h"
|
||||
#include "nmt-slave-list.h"
|
||||
|
||||
|
|
@ -53,11 +54,7 @@ nmt_page_bridge_constructed(GObject *object)
|
|||
NMConnection * conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(bridge));
|
||||
s_bridge = nm_connection_get_setting_bridge(conn);
|
||||
if (!s_bridge) {
|
||||
nm_connection_add_setting(conn, nm_setting_bridge_new());
|
||||
s_bridge = nm_connection_get_setting_bridge(conn);
|
||||
}
|
||||
s_bridge = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_BRIDGE);
|
||||
|
||||
section = nmt_editor_section_new(_("BRIDGE"), NULL, TRUE);
|
||||
grid = nmt_editor_section_get_body(section);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
#include "libnm-client-aux-extern/nm-default-client.h"
|
||||
|
||||
#include "nmt-page-dsl.h"
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nmt-page-ethernet.h"
|
||||
#include "nmt-page-ppp.h"
|
||||
#include "nmt-password-fields.h"
|
||||
|
|
@ -83,11 +85,7 @@ nmt_page_dsl_constructed(GObject *object)
|
|||
const GSList * sections, *iter;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(dsl));
|
||||
s_pppoe = nm_connection_get_setting_pppoe(conn);
|
||||
if (!s_pppoe) {
|
||||
nm_connection_add_setting(conn, nm_setting_pppoe_new());
|
||||
s_pppoe = nm_connection_get_setting_pppoe(conn);
|
||||
}
|
||||
s_pppoe = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_PPPOE);
|
||||
|
||||
section = build_dsl_section(dsl, s_pppoe);
|
||||
nmt_editor_page_add_section(NMT_EDITOR_PAGE(dsl), section);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include <linux/if_ether.h>
|
||||
#include <linux/if_infiniband.h>
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nmt-mac-entry.h"
|
||||
#include "nmt-mtu-entry.h"
|
||||
|
||||
|
|
@ -42,11 +43,7 @@ nmt_page_ethernet_constructed(GObject *object)
|
|||
NMConnection * conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(ethernet));
|
||||
s_wired = nm_connection_get_setting_wired(conn);
|
||||
if (!s_wired) {
|
||||
nm_connection_add_setting(conn, nm_setting_wired_new());
|
||||
s_wired = nm_connection_get_setting_wired(conn);
|
||||
}
|
||||
s_wired = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_WIRED);
|
||||
|
||||
deventry = nmt_editor_page_device_get_device_entry(NMT_EDITOR_PAGE_DEVICE(object));
|
||||
g_object_bind_property(s_wired,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
#include "libnm-client-aux-extern/nm-default-client.h"
|
||||
|
||||
#include "nmt-page-infiniband.h"
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nmt-mtu-entry.h"
|
||||
|
||||
G_DEFINE_TYPE(NmtPageInfiniband, nmt_page_infiniband, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
||||
|
|
@ -46,11 +48,7 @@ nmt_page_infiniband_constructed(GObject *object)
|
|||
NMConnection * conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(infiniband));
|
||||
s_ib = nm_connection_get_setting_infiniband(conn);
|
||||
if (!s_ib) {
|
||||
nm_connection_add_setting(conn, nm_setting_infiniband_new());
|
||||
s_ib = nm_connection_get_setting_infiniband(conn);
|
||||
}
|
||||
s_ib = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_INFINIBAND);
|
||||
/* initialize 'transport-mode' if it is NULL */
|
||||
if (!nm_setting_infiniband_get_transport_mode(s_ib)) {
|
||||
g_object_set(G_OBJECT(s_ib), NM_SETTING_INFINIBAND_TRANSPORT_MODE, "datagram", NULL);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "nmt-page-ip-tunnel.h"
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nmt-device-entry.h"
|
||||
#include "nmt-mtu-entry.h"
|
||||
|
||||
|
|
@ -102,11 +103,7 @@ nmt_page_ip_tunnel_constructed(GObject *object)
|
|||
GClosure * s2w, *w2s;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(ip_tunnel));
|
||||
s_ip_tunnel = nm_connection_get_setting_ip_tunnel(conn);
|
||||
if (!s_ip_tunnel) {
|
||||
nm_connection_add_setting(conn, nm_setting_ip_tunnel_new());
|
||||
s_ip_tunnel = nm_connection_get_setting_ip_tunnel(conn);
|
||||
}
|
||||
s_ip_tunnel = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_IP_TUNNEL);
|
||||
|
||||
/* Initialize the mode for new connections */
|
||||
if (nm_setting_ip_tunnel_get_mode(s_ip_tunnel) == NM_IP_TUNNEL_MODE_UNKNOWN) {
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@
|
|||
|
||||
#include "libnm-client-aux-extern/nm-default-client.h"
|
||||
|
||||
#include "nmt-page-ip4.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "nmt-page-ip4.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nmt-ip-entry.h"
|
||||
#include "nmt-address-list.h"
|
||||
#include "nmt-route-editor.h"
|
||||
|
|
@ -84,14 +86,13 @@ nmt_page_ip4_constructed(GObject *object)
|
|||
NMConnection * conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(ip4));
|
||||
s_ip4 = nm_connection_get_setting_ip4_config(conn);
|
||||
if (!s_ip4) {
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
s_ip4 = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_IP4_CONFIG);
|
||||
/* initialize 'method' to auto if it is NULL */
|
||||
if (!nm_setting_ip_config_get_method(s_ip4)) {
|
||||
g_object_set(G_OBJECT(s_ip4),
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
nm_connection_add_setting(conn, (NMSetting *) s_ip4);
|
||||
}
|
||||
|
||||
widget = nmt_newt_popup_new(ip4methods);
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@
|
|||
|
||||
#include "libnm-client-aux-extern/nm-default-client.h"
|
||||
|
||||
#include "nmt-page-ip6.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "nmt-page-ip6.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nmt-ip-entry.h"
|
||||
#include "nmt-address-list.h"
|
||||
#include "nmt-route-editor.h"
|
||||
|
|
@ -85,14 +87,13 @@ nmt_page_ip6_constructed(GObject *object)
|
|||
NMConnection * conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(ip6));
|
||||
s_ip6 = nm_connection_get_setting_ip6_config(conn);
|
||||
if (!s_ip6) {
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new();
|
||||
s_ip6 = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_IP6_CONFIG);
|
||||
/* initialize 'method' to auto if it is NULL */
|
||||
if (!nm_setting_ip_config_get_method(s_ip6)) {
|
||||
g_object_set(G_OBJECT(s_ip6),
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
nm_connection_add_setting(conn, (NMSetting *) s_ip6);
|
||||
}
|
||||
|
||||
widget = nmt_newt_popup_new(ip6methods);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include "nmt-page-team-port.h"
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
|
||||
G_DEFINE_TYPE(NmtPageTeamPort, nmt_page_team_port, NMT_TYPE_EDITOR_PAGE)
|
||||
|
||||
#define NMT_PAGE_TEAM_PORT_GET_PRIVATE(o) \
|
||||
|
|
@ -63,12 +65,8 @@ nmt_page_team_port_constructed(GObject *object)
|
|||
NmtNewtWidget * widget;
|
||||
NMConnection * conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(team));
|
||||
s_port = nm_connection_get_setting_team_port(conn);
|
||||
if (!s_port) {
|
||||
nm_connection_add_setting(conn, nm_setting_team_port_new());
|
||||
s_port = nm_connection_get_setting_team_port(conn);
|
||||
}
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(team));
|
||||
s_port = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_TEAM_PORT);
|
||||
priv->s_port = s_port;
|
||||
|
||||
section = nmt_editor_section_new(_("TEAM PORT"), NULL, TRUE);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "nmt-page-team.h"
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nmt-slave-list.h"
|
||||
|
||||
G_DEFINE_TYPE(NmtPageTeam, nmt_page_team, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
||||
|
|
@ -111,12 +112,8 @@ nmt_page_team_constructed(GObject *object)
|
|||
NmtNewtWidget * widget;
|
||||
NMConnection * conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(team));
|
||||
s_team = nm_connection_get_setting_team(conn);
|
||||
if (!s_team) {
|
||||
nm_connection_add_setting(conn, nm_setting_team_new());
|
||||
s_team = nm_connection_get_setting_team(conn);
|
||||
}
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(team));
|
||||
s_team = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_TEAM);
|
||||
priv->s_team = s_team;
|
||||
|
||||
section = nmt_editor_section_new(_("TEAM"), NULL, TRUE);
|
||||
|
|
|
|||
|
|
@ -10,11 +10,12 @@
|
|||
|
||||
#include "libnm-client-aux-extern/nm-default-client.h"
|
||||
|
||||
#include "nm-editor-bindings.h"
|
||||
#include "nmt-page-vlan.h"
|
||||
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
#include "nmt-page-vlan.h"
|
||||
#include "nm-editor-bindings.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nmt-device-entry.h"
|
||||
#include "nmt-mac-entry.h"
|
||||
#include "nmt-mtu-entry.h"
|
||||
|
|
@ -49,17 +50,9 @@ nmt_page_vlan_constructed(GObject *object)
|
|||
NmtNewtWidget * widget, *parent, *id_entry;
|
||||
NMConnection * conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(vlan));
|
||||
s_vlan = nm_connection_get_setting_vlan(conn);
|
||||
if (!s_vlan) {
|
||||
nm_connection_add_setting(conn, nm_setting_vlan_new());
|
||||
s_vlan = nm_connection_get_setting_vlan(conn);
|
||||
}
|
||||
s_wired = nm_connection_get_setting_wired(conn);
|
||||
if (!s_wired) {
|
||||
nm_connection_add_setting(conn, nm_setting_wired_new());
|
||||
s_wired = nm_connection_get_setting_wired(conn);
|
||||
}
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(vlan));
|
||||
s_vlan = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_VLAN);
|
||||
s_wired = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_WIRED);
|
||||
|
||||
section = nmt_editor_section_new(_("VLAN"), NULL, TRUE);
|
||||
grid = nmt_editor_section_get_body(section);
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@
|
|||
|
||||
#include "libnm-client-aux-extern/nm-default-client.h"
|
||||
|
||||
#include "nmt-page-wifi.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
#include "nmt-page-wifi.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nmt-mac-entry.h"
|
||||
#include "nmt-mtu-entry.h"
|
||||
#include "nmt-password-fields.h"
|
||||
|
|
@ -164,13 +166,8 @@ nmt_page_wifi_constructed(GObject *object)
|
|||
NMConnection * conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(wifi));
|
||||
s_wireless = nm_connection_get_setting_wireless(conn);
|
||||
if (!s_wireless) {
|
||||
nm_connection_add_setting(conn, nm_setting_wireless_new());
|
||||
s_wireless = nm_connection_get_setting_wireless(conn);
|
||||
}
|
||||
|
||||
s_wsec = nm_connection_get_setting_wireless_security(conn);
|
||||
s_wireless = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_WIRELESS);
|
||||
s_wsec = nm_connection_get_setting_wireless_security(conn);
|
||||
if (!s_wsec) {
|
||||
/* It makes things simpler if we always have a
|
||||
* NMSettingWirelessSecurity; we'll hold a ref on one, and add
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "nmt-page-wireguard.h"
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nmt-device-entry.h"
|
||||
#include "nmt-mtu-entry.h"
|
||||
#include "nmt-wireguard-peer-list.h"
|
||||
|
|
@ -51,12 +52,7 @@ nmt_page_wireguard_constructed(GObject *object)
|
|||
NMConnection * conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(wireguard));
|
||||
s_wireguard = NM_SETTING_WIREGUARD(nm_connection_get_setting(conn, NM_TYPE_SETTING_WIREGUARD));
|
||||
if (!s_wireguard) {
|
||||
nm_connection_add_setting(conn, nm_setting_wireguard_new());
|
||||
s_wireguard =
|
||||
NM_SETTING_WIREGUARD(nm_connection_get_setting(conn, NM_TYPE_SETTING_WIREGUARD));
|
||||
}
|
||||
s_wireguard = _nm_connection_ensure_setting(conn, NM_TYPE_SETTING_WIREGUARD);
|
||||
|
||||
section = nmt_editor_section_new(_("WireGuard"), NULL, TRUE);
|
||||
grid = nmt_editor_section_get_body(section);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue