diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2020-01-13 16:10:30 +0100 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2020-01-13 16:31:40 +0100 |
| commit | 5a09f7759860f4f2a9bb01471ca8099cd705bc10 (patch) | |
| tree | 3a9cffc9622d53c9196771a1c7924bceb754f118 /src/devices/nm-device-infiniband.c | |
| parent | 25691220fd27093630cf244e219b2f4f1f4e749e (diff) | |
| parent | ca847639aab94434daed120c874e1100c3d75dcf (diff) | |
Merge remote-tracking branch 'salsa/debian/master'
Diffstat (limited to 'src/devices/nm-device-infiniband.c')
| -rw-r--r-- | src/devices/nm-device-infiniband.c | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c index 89db2af2..9f79d9bb 100644 --- a/src/devices/nm-device-infiniband.c +++ b/src/devices/nm-device-infiniband.c @@ -1,20 +1,6 @@ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright 2011 - 2018 Red Hat, Inc. +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2011 - 2018 Red Hat, Inc. */ #include "nm-default.h" @@ -76,16 +62,11 @@ static NMActStageReturn act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason) { nm_auto_close int dirfd = -1; - NMActStageReturn ret; NMSettingInfiniband *s_infiniband; char ifname_verified[IFNAMSIZ]; const char *transport_mode; gboolean ok; - ret = NM_DEVICE_CLASS (nm_device_infiniband_parent_class)->act_stage1_prepare (device, out_failure_reason); - if (ret != NM_ACT_STAGE_RETURN_SUCCESS) - return ret; - s_infiniband = nm_device_get_applied_setting (device, NM_TYPE_SETTING_INFINIBAND); g_return_val_if_fail (s_infiniband, NM_ACT_STAGE_RETURN_FAILURE); @@ -94,7 +75,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason) dirfd = nm_platform_sysctl_open_netdir (nm_device_get_platform (device), nm_device_get_ifindex (device), ifname_verified); if (dirfd < 0) { - if (!strcmp (transport_mode, "datagram")) + if (nm_streq (transport_mode, "datagram")) return NM_ACT_STAGE_RETURN_SUCCESS; else { NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_INFINIBAND_MODE); @@ -116,7 +97,9 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason) } static guint32 -get_configured_mtu (NMDevice *device, NMDeviceMtuSource *out_source) +get_configured_mtu (NMDevice *device, + NMDeviceMtuSource *out_source, + gboolean *out_force) { return nm_device_get_configured_mtu_from_connection (device, NM_TYPE_SETTING_INFINIBAND, @@ -208,6 +191,32 @@ update_connection (NMDevice *device, NMConnection *connection) } static gboolean +can_reapply_change (NMDevice *device, + const char *setting_name, + NMSetting *s_old, + NMSetting *s_new, + GHashTable *diffs, + GError **error) +{ + NMDeviceClass *device_class; + + if (nm_streq (setting_name, NM_SETTING_INFINIBAND_SETTING_NAME)) { + return nm_device_hash_check_invalid_keys (diffs, + NM_SETTING_INFINIBAND_SETTING_NAME, + error, + NM_SETTING_INFINIBAND_MTU); /* reapplied with IP config */ + } + + device_class = NM_DEVICE_CLASS (nm_device_infiniband_parent_class); + return device_class->can_reapply_change (device, + setting_name, + s_old, + s_new, + diffs, + error); +} + +static gboolean create_and_realize (NMDevice *device, NMConnection *connection, NMDevice *parent, @@ -359,6 +368,7 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass) device_class->connection_type_check_compatible = NM_SETTING_INFINIBAND_SETTING_NAME; device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_INFINIBAND); + device_class->can_reapply_change = can_reapply_change; device_class->create_and_realize = create_and_realize; device_class->unrealize = unrealize; device_class->get_generic_capabilities = get_generic_capabilities; |