summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2022-11-14 16:50:21 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2022-12-05 17:14:49 +0100
commit738e41cd3e7f3bcdb2c026475b0caae5f1c6ab76 (patch)
treec9ec7265c0f710fadbee2505945ac06b6b39f47e
parentfb6e1ec54912b9d5025fbbdf419710bb1a236905 (diff)
device: add nm_device_bring_up_full()
In the next commit nm_device_bring_up() will be extended with a new argument. Most callers just want to bring up the device synchronously and don't care about the "no_firmware" argument. Introduce a nm_device_bring_up_full() for callers that need special behavior. (cherry picked from commit 861934a5101163ddb45af18ba0604df8796684f5)
-rw-r--r--src/core/devices/nm-device-bond.c6
-rw-r--r--src/core/devices/nm-device-infiniband.c2
-rw-r--r--src/core/devices/nm-device-macsec.c2
-rw-r--r--src/core/devices/nm-device-private.h3
-rw-r--r--src/core/devices/nm-device-vrf.c2
-rw-r--r--src/core/devices/nm-device-wpan.c4
-rw-r--r--src/core/devices/nm-device.c16
-rw-r--r--src/core/devices/ovs/nm-device-ovs-interface.c2
-rw-r--r--src/core/devices/team/nm-device-team.c4
-rw-r--r--src/core/devices/wifi/nm-device-olpc-mesh.c2
-rw-r--r--src/core/devices/wifi/nm-device-wifi.c4
11 files changed, 27 insertions, 20 deletions
diff --git a/src/core/devices/nm-device-bond.c b/src/core/devices/nm-device-bond.c
index 3e083de461..10765b609c 100644
--- a/src/core/devices/nm-device-bond.c
+++ b/src/core/devices/nm-device-bond.c
@@ -492,7 +492,7 @@ act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason)
/* This is a workaround because netlink do not support ifname as primary */
set_bond_attr_or_default(device, s_bond, NM_SETTING_BOND_OPTION_PRIMARY);
- nm_device_bring_up(device, TRUE, NULL);
+ nm_device_bring_up(device);
return ret;
}
@@ -540,7 +540,7 @@ attach_port(NMDevice *device,
success = nm_platform_link_enslave(nm_device_get_platform(device),
nm_device_get_ip_ifindex(device),
nm_device_get_ip_ifindex(port));
- nm_device_bring_up(port, TRUE, NULL);
+ nm_device_bring_up(port);
if (!success) {
_LOGI(LOGD_BOND, "attaching bond port %s: failed", nm_device_get_ip_iface(port));
@@ -613,7 +613,7 @@ detach_port(NMDevice *device, NMDevice *port, gboolean configure)
* other state is noticed by the now-released slave.
*/
if (ifindex_slave > 0) {
- if (!nm_device_bring_up(port, TRUE, NULL))
+ if (!nm_device_bring_up(port))
_LOGW(LOGD_BOND, "detached bond port could not be brought up.");
}
} else {
diff --git a/src/core/devices/nm-device-infiniband.c b/src/core/devices/nm-device-infiniband.c
index aef6122297..6b6aef8635 100644
--- a/src/core/devices/nm-device-infiniband.c
+++ b/src/core/devices/nm-device-infiniband.c
@@ -89,7 +89,7 @@ act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason)
ok = nm_platform_sysctl_set(nm_device_get_platform(device),
NMP_SYSCTL_PATHID_NETDIR(dirfd, ifname_verified, "mode"),
transport_mode);
- nm_device_bring_up(device, TRUE, NULL);
+ nm_device_bring_up(device);
if (!ok) {
NM_SET_OUT(out_failure_reason, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
diff --git a/src/core/devices/nm-device-macsec.c b/src/core/devices/nm-device-macsec.c
index 5cc0b8da89..f6d76c0aa5 100644
--- a/src/core/devices/nm-device-macsec.c
+++ b/src/core/devices/nm-device-macsec.c
@@ -402,7 +402,7 @@ supplicant_iface_state_is_completed(NMDeviceMacsec *self, NMSupplicantInterfaceS
nm_clear_g_source(&priv->supplicant.lnk_timeout_id);
nm_clear_g_source(&priv->supplicant.con_timeout_id);
- nm_device_bring_up(NM_DEVICE(self), TRUE, NULL);
+ nm_device_bring_up(NM_DEVICE(self));
/* If this is the initial association during device activation,
* schedule the next activation stage.
diff --git a/src/core/devices/nm-device-private.h b/src/core/devices/nm-device-private.h
index 31424d5c2b..eaf03392c9 100644
--- a/src/core/devices/nm-device-private.h
+++ b/src/core/devices/nm-device-private.h
@@ -37,7 +37,8 @@ gboolean nm_device_set_ip_ifindex(NMDevice *self, int ifindex);
gboolean nm_device_set_ip_iface(NMDevice *self, const char *iface);
-gboolean nm_device_bring_up(NMDevice *self, gboolean wait, gboolean *no_firmware);
+gboolean nm_device_bring_up(NMDevice *self);
+gboolean nm_device_bring_up_full(NMDevice *self, gboolean block, gboolean *no_firmware);
void nm_device_take_down(NMDevice *self, gboolean block);
diff --git a/src/core/devices/nm-device-vrf.c b/src/core/devices/nm-device-vrf.c
index 2aef0e3d1e..91eb195ad2 100644
--- a/src/core/devices/nm-device-vrf.c
+++ b/src/core/devices/nm-device-vrf.c
@@ -226,7 +226,7 @@ attach_port(NMDevice *device,
success = nm_platform_link_enslave(nm_device_get_platform(device),
nm_device_get_ip_ifindex(device),
nm_device_get_ip_ifindex(port));
- nm_device_bring_up(port, TRUE, NULL);
+ nm_device_bring_up(port);
if (!success)
return FALSE;
diff --git a/src/core/devices/nm-device-wpan.c b/src/core/devices/nm-device-wpan.c
index f7b712ea85..ecb5ee2306 100644
--- a/src/core/devices/nm-device-wpan.c
+++ b/src/core/devices/nm-device-wpan.c
@@ -176,10 +176,10 @@ act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason)
ret = NM_ACT_STAGE_RETURN_SUCCESS;
out:
- nm_device_bring_up(device, TRUE, NULL);
+ nm_device_bring_up(device);
if (lowpan_device)
- nm_device_bring_up(lowpan_device, TRUE, NULL);
+ nm_device_bring_up(lowpan_device);
return ret;
}
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c
index 2cda9b0de8..01409c783b 100644
--- a/src/core/devices/nm-device.c
+++ b/src/core/devices/nm-device.c
@@ -6828,7 +6828,7 @@ device_link_changed(gpointer user_data)
* bring it up probably has failed because of the
* invalid hardware address; try again.
*/
- nm_device_bring_up(self, TRUE, NULL);
+ nm_device_bring_up(self);
nm_device_queue_recheck_available(self,
NM_DEVICE_STATE_REASON_NONE,
NM_DEVICE_STATE_REASON_NONE);
@@ -9719,7 +9719,7 @@ activate_stage2_device_config(NMDevice *self)
_routing_rules_sync(self, NM_TERNARY_TRUE);
if (!nm_device_sys_iface_state_is_external_or_assume(self)) {
- if (!nm_device_bring_up(self, FALSE, &no_firmware)) {
+ if (!nm_device_bring_up_full(self, FALSE, &no_firmware)) {
nm_device_state_changed(self,
NM_DEVICE_STATE_FAILED,
no_firmware ? NM_DEVICE_STATE_REASON_FIRMWARE_MISSING
@@ -13994,7 +13994,7 @@ carrier_detect_wait(NMDevice *self)
}
gboolean
-nm_device_bring_up(NMDevice *self, gboolean block, gboolean *no_firmware)
+nm_device_bring_up_full(NMDevice *self, gboolean block, gboolean *no_firmware)
{
gboolean device_is_up = FALSE;
NMDeviceCapabilities capabilities;
@@ -14061,6 +14061,12 @@ nm_device_bring_up(NMDevice *self, gboolean block, gboolean *no_firmware)
return TRUE;
}
+gboolean
+nm_device_bring_up(NMDevice *self)
+{
+ return nm_device_bring_up_full(self, TRUE, NULL);
+}
+
void
nm_device_take_down(NMDevice *self, gboolean block)
{
@@ -15814,7 +15820,7 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason,
if (priv->sys_iface_state == NM_DEVICE_SYS_IFACE_STATE_MANAGED) {
if (old_state == NM_DEVICE_STATE_UNMANAGED || priv->firmware_missing) {
- if (!nm_device_bring_up(self, TRUE, &no_firmware) && no_firmware)
+ if (!nm_device_bring_up_full(self, TRUE, &no_firmware) && no_firmware)
_LOGW(LOGD_PLATFORM, "firmware may be missing.");
nm_device_set_firmware_missing(self, no_firmware ? TRUE : FALSE);
}
@@ -16574,7 +16580,7 @@ handle_fail:
}
if (was_taken_down) {
- if (!nm_device_bring_up(self, TRUE, NULL))
+ if (!nm_device_bring_up(self))
return FALSE;
}
diff --git a/src/core/devices/ovs/nm-device-ovs-interface.c b/src/core/devices/ovs/nm-device-ovs-interface.c
index 1f531a6f84..711f65cb5b 100644
--- a/src/core/devices/ovs/nm-device-ovs-interface.c
+++ b/src/core/devices/ovs/nm-device-ovs-interface.c
@@ -132,7 +132,7 @@ link_changed(NMDevice *device, const NMPlatformLink *pllink)
nm_device_devip_set_failed(device, AF_INET6, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
return;
}
- nm_device_bring_up(device, TRUE, NULL);
+ nm_device_bring_up(device);
nm_device_devip_set_state(device, AF_INET, NM_DEVICE_IP_STATE_PENDING, NULL);
nm_device_devip_set_state(device, AF_INET6, NM_DEVICE_IP_STATE_PENDING, NULL);
diff --git a/src/core/devices/team/nm-device-team.c b/src/core/devices/team/nm-device-team.c
index 4e073ddf13..9eca008a10 100644
--- a/src/core/devices/team/nm-device-team.c
+++ b/src/core/devices/team/nm-device-team.c
@@ -884,7 +884,7 @@ attach_port(NMDevice *device,
success = nm_platform_link_enslave(nm_device_get_platform(device),
nm_device_get_ip_ifindex(device),
nm_device_get_ip_ifindex(port));
- nm_device_bring_up(port, TRUE, NULL);
+ nm_device_bring_up(port);
if (!success)
return FALSE;
@@ -934,7 +934,7 @@ detach_port(NMDevice *device, NMDevice *port, gboolean configure)
* IFF_UP), so we must bring it back up here to ensure carrier changes and
* other state is noticed by the now-released port.
*/
- if (!nm_device_bring_up(port, TRUE, NULL)) {
+ if (!nm_device_bring_up(port)) {
_LOGW(LOGD_TEAM, "detached team port %s could not be brought up", port_iface);
}
diff --git a/src/core/devices/wifi/nm-device-olpc-mesh.c b/src/core/devices/wifi/nm-device-olpc-mesh.c
index fd851ebc6a..4705f75ce3 100644
--- a/src/core/devices/wifi/nm-device-olpc-mesh.c
+++ b/src/core/devices/wifi/nm-device-olpc-mesh.c
@@ -198,7 +198,7 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason)
nm_device_get_ifindex(device),
g_bytes_get_data(ssid, NULL),
g_bytes_get_size(ssid));
- nm_device_bring_up(NM_DEVICE(self), TRUE, NULL);
+ nm_device_bring_up(NM_DEVICE(self));
if (!success) {
_LOGW(LOGD_WIFI, "Unable to set the mesh ID");
return NM_ACT_STAGE_RETURN_FAILURE;
diff --git a/src/core/devices/wifi/nm-device-wifi.c b/src/core/devices/wifi/nm-device-wifi.c
index 43798b85ad..fb13c421fa 100644
--- a/src/core/devices/wifi/nm-device-wifi.c
+++ b/src/core/devices/wifi/nm-device-wifi.c
@@ -960,7 +960,7 @@ deactivate(NMDevice *device)
!= _NM_802_11_MODE_INFRA) {
nm_device_take_down(NM_DEVICE(self), TRUE);
nm_platform_wifi_set_mode(nm_device_get_platform(device), ifindex, _NM_802_11_MODE_INFRA);
- nm_device_bring_up(NM_DEVICE(self), TRUE, NULL);
+ nm_device_bring_up(NM_DEVICE(self));
}
if (priv->mode != _NM_802_11_MODE_INFRA) {
@@ -3586,7 +3586,7 @@ set_enabled(NMDevice *device, gboolean enabled)
if (state != NM_DEVICE_STATE_UNAVAILABLE)
_LOGW(LOGD_CORE, "not in expected unavailable state!");
- if (!nm_device_bring_up(NM_DEVICE(self), TRUE, &no_firmware)) {
+ if (!nm_device_bring_up_full(NM_DEVICE(self), TRUE, &no_firmware)) {
_LOGD(LOGD_WIFI, "enable blocked by failure to bring device up");
if (no_firmware)