@@ -5,12 +5,13 @@ Subject: [PATCH] [libteam]: Reimplement Warm-Reboot procedure'
5
5
6
6
---
7
7
libteam/ifinfo.c | 6 +-
8
+ libteam/ports.c | 19 +-
8
9
teamd/teamd.c | 51 +++-
9
10
teamd/teamd.h | 6 +
10
11
teamd/teamd_events.c | 13 ++
11
12
teamd/teamd_per_port.c | 6 +
12
13
teamd/teamd_runner_lacp.c | 475 +++++++++++++++++++++++++++++++++++---
13
- 6 files changed, 513 insertions(+), 44 deletions(-)
14
+ 7 files changed, 530 insertions(+), 46 deletions(-)
14
15
15
16
diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c
16
17
index 46d56a2..b86d34c 100644
@@ -34,6 +35,58 @@ index 46d56a2..b86d34c 100644
34
35
set_changed(ifinfo, CHANGED_HWADDR);
35
36
}
36
37
}
38
+ diff --git a/libteam/ports.c b/libteam/ports.c
39
+ index 9ebf30f..0bd7cc0 100644
40
+ --- a/libteam/ports.c
41
+ +++ b/libteam/ports.c
42
+ @@ -128,6 +128,12 @@ int get_port_list_handler(struct nl_msg *msg, void *arg)
43
+ struct nlattr *port_attrs[TEAM_ATTR_PORT_MAX + 1];
44
+ int i;
45
+ uint32_t team_ifindex = 0;
46
+ + /*
47
+ + * In case get_port_list is being called from check_call_change_handlers recursively,
48
+ + * there can be some attributes which have not been consumed by callbacks.
49
+ + * In this case, we should only merge the new attributes into the existing ones without clearing them
50
+ + */
51
+ + bool recursive = (th->change_handler.pending_type_mask & TEAM_PORT_CHANGE) ? true : false;
52
+
53
+ genlmsg_parse(nlh, 0, attrs, TEAM_ATTR_MAX, NULL);
54
+ if (attrs[TEAM_ATTR_TEAM_IFINDEX])
55
+ @@ -140,7 +146,8 @@ int get_port_list_handler(struct nl_msg *msg, void *arg)
56
+ return NL_SKIP;
57
+
58
+ if (!th->msg_recv_started) {
59
+ - port_list_cleanup_last_state(th);
60
+ + if (!recursive)
61
+ + port_list_cleanup_last_state(th);
62
+ th->msg_recv_started = true;
63
+ }
64
+ nla_for_each_nested(nl_port, attrs[TEAM_ATTR_LIST_PORT], i) {
65
+ @@ -165,7 +172,9 @@ int get_port_list_handler(struct nl_msg *msg, void *arg)
66
+ if (!port)
67
+ return NL_SKIP;
68
+ }
69
+ - port->changed = port_attrs[TEAM_ATTR_PORT_CHANGED] ? true : false;
70
+ +
71
+ + if (!port->changed || !recursive)
72
+ + port->changed = port_attrs[TEAM_ATTR_PORT_CHANGED] ? true : false;
73
+ port->linkup = port_attrs[TEAM_ATTR_PORT_LINKUP] ? true : false;
74
+ port->removed = port_attrs[TEAM_ATTR_PORT_REMOVED] ? true : false;
75
+ if (port_attrs[TEAM_ATTR_PORT_SPEED])
76
+ @@ -196,6 +204,13 @@ static int get_port_list(struct team_handle *th)
77
+ if (err)
78
+ return err;
79
+
80
+ + /*
81
+ + * Do not call check_call_change_handlers if this is called recursively to avoid racing conditions
82
+ + * It will be called by the outer call
83
+ + */
84
+ + if (th->change_handler.pending_type_mask & TEAM_PORT_CHANGE)
85
+ + return 0;
86
+ +
87
+ return check_call_change_handlers(th, TEAM_PORT_CHANGE);
88
+
89
+ nla_put_failure:
37
90
diff --git a/teamd/teamd.c b/teamd/teamd.c
38
91
index 421e34d..33512a6 100644
39
92
--- a/teamd/teamd.c
@@ -881,5 +934,5 @@ index 955ef0c..782fc05 100644
881
934
882
935
const struct teamd_runner teamd_runner_lacp = {
883
936
- -
884
- 2.17.1
937
+ 2.30.2
885
938
0 commit comments