core: implement update_connection() for bridging
This commit is contained in:

committed by
Dan Williams

parent
12fb2519af
commit
a3af5cfe9d
@@ -24,6 +24,7 @@
|
|||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
#include <netinet/ether.h>
|
#include <netinet/ether.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "gsystem-local-alloc.h"
|
#include "gsystem-local-alloc.h"
|
||||||
#include "nm-device-bridge.h"
|
#include "nm-device-bridge.h"
|
||||||
@@ -180,13 +181,6 @@ complete_connection (NMDevice *device,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
match_l2_config (NMDevice *self, NMConnection *connection)
|
|
||||||
{
|
|
||||||
/* FIXME */
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -290,6 +284,32 @@ commit_slave_options (NMDevice *device, NMSettingBridgePort *setting)
|
|||||||
g_clear_object (&s_clear);
|
g_clear_object (&s_clear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_connection (NMDevice *device, NMConnection *connection)
|
||||||
|
{
|
||||||
|
NMSettingBridge *s_bridge = nm_connection_get_setting_bridge (connection);
|
||||||
|
const char *ifname = nm_device_get_iface (device);
|
||||||
|
int ifindex = nm_device_get_ifindex (device);
|
||||||
|
const Option *option;
|
||||||
|
|
||||||
|
if (!s_bridge) {
|
||||||
|
s_bridge = (NMSettingBridge *) nm_setting_bridge_new ();
|
||||||
|
nm_connection_add_setting (connection, (NMSetting *) s_bridge);
|
||||||
|
g_object_set (s_bridge, NM_SETTING_BRIDGE_INTERFACE_NAME, ifname, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (option = master_options; option->name; option++) {
|
||||||
|
gs_free char *str = nm_platform_master_get_option (ifindex, option->sysname);
|
||||||
|
int value = strtol (str, NULL, 10);
|
||||||
|
|
||||||
|
/* See comments in set_sysfs_uint() about centiseconds. */
|
||||||
|
if (option->user_hz_compensate)
|
||||||
|
value /= 100;
|
||||||
|
|
||||||
|
g_object_set (s_bridge, option->name, value, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||||
{
|
{
|
||||||
@@ -439,6 +459,8 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *klass)
|
|||||||
|
|
||||||
g_type_class_add_private (object_class, sizeof (NMDeviceBridgePrivate));
|
g_type_class_add_private (object_class, sizeof (NMDeviceBridgePrivate));
|
||||||
|
|
||||||
|
parent_class->connection_type = NM_SETTING_BRIDGE_SETTING_NAME;
|
||||||
|
|
||||||
/* virtual methods */
|
/* virtual methods */
|
||||||
object_class->constructed = constructed;
|
object_class->constructed = constructed;
|
||||||
object_class->get_property = get_property;
|
object_class->get_property = get_property;
|
||||||
@@ -450,7 +472,7 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *klass)
|
|||||||
parent_class->check_connection_available = check_connection_available;
|
parent_class->check_connection_available = check_connection_available;
|
||||||
parent_class->complete_connection = complete_connection;
|
parent_class->complete_connection = complete_connection;
|
||||||
|
|
||||||
parent_class->match_l2_config = match_l2_config;
|
parent_class->update_connection = update_connection;
|
||||||
|
|
||||||
parent_class->act_stage1_prepare = act_stage1_prepare;
|
parent_class->act_stage1_prepare = act_stage1_prepare;
|
||||||
parent_class->enslave_slave = enslave_slave;
|
parent_class->enslave_slave = enslave_slave;
|
||||||
|
Reference in New Issue
Block a user