1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
From: Thomas Haller <thaller@redhat.com>
Date: Sun, 28 Aug 2016 13:52:32 +0200
Subject: platform: split processing result from do_change_link()
(cherry picked from commit 3dc09446771a3434ed948bdd5e6ca9f6ef9a9e76)
(cherry picked from commit 471521ca84187cd32afcd20aebe5a369fe7368dc)
---
src/platform/nm-linux-platform.c | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 98c4e46..eeb24ca 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -4060,18 +4060,14 @@ out:
return !!nmp_cache_lookup_obj (priv->cache, obj_id);
}
-static NMPlatformError
-do_change_link (NMPlatform *platform,
- int ifindex,
- struct nl_msg *nlmsg)
+static WaitForNlResponseResult
+do_change_link_request (NMPlatform *platform,
+ int ifindex,
+ struct nl_msg *nlmsg)
{
nm_auto_pop_netns NMPNetns *netns = NULL;
WaitForNlResponseResult seq_result = WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN;
int nle;
- char s_buf[256];
- NMPlatformError result = NM_PLATFORM_ERROR_SUCCESS;
- NMLogLevel log_level = LOGL_DEBUG;
- const char *log_result = "failure", *log_detail = "";
if (!nm_platform_netns_push (platform, &netns))
return NM_PLATFORM_ERROR_UNSPECIFIED;
@@ -4098,6 +4094,18 @@ retry:
nlmsg_hdr (nlmsg)->nlmsg_type = RTM_SETLINK;
goto retry;
}
+ return seq_result;
+}
+
+static NMPlatformError
+do_change_link_result (NMPlatform *platform,
+ int ifindex,
+ WaitForNlResponseResult seq_result)
+{
+ char s_buf[256];
+ NMPlatformError result = NM_PLATFORM_ERROR_SUCCESS;
+ NMLogLevel log_level = LOGL_DEBUG;
+ const char *log_result = "failure", *log_detail = "";
if (seq_result == WAIT_FOR_NL_RESPONSE_RESULT_RESPONSE_OK) {
log_result = "success";
@@ -4123,6 +4131,17 @@ retry:
return result;
}
+static NMPlatformError
+do_change_link (NMPlatform *platform,
+ int ifindex,
+ struct nl_msg *nlmsg)
+{
+ WaitForNlResponseResult seq_result;
+
+ seq_result = do_change_link_request (platform, ifindex, nlmsg);
+ return do_change_link_result (platform, ifindex, seq_result);
+}
+
static gboolean
link_add (NMPlatform *platform,
const char *name,
|