diff --git a/.gitignore b/.gitignore index 8679daf..a7c181d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/libteam-1.27.tar.gz +SOURCES/libteam-1.28.tar.gz diff --git a/.libteam.metadata b/.libteam.metadata index 9eb55d4..f7afdcc 100644 --- a/.libteam.metadata +++ b/.libteam.metadata @@ -1 +1 @@ -2293a6081223ffa85ef3376bb4e6e1e48ed35129 SOURCES/libteam-1.27.tar.gz +c3429d0b29ae78dd1d4899dab6fe9f13af26ff7d SOURCES/libteam-1.28.tar.gz diff --git a/SOURCES/libteam-binding-python-use-SWIG_FromCharPtrAndSize-for-Pytho.patch b/SOURCES/libteam-binding-python-use-SWIG_FromCharPtrAndSize-for-Pytho.patch deleted file mode 100644 index e00fc8d..0000000 --- a/SOURCES/libteam-binding-python-use-SWIG_FromCharPtrAndSize-for-Pytho.patch +++ /dev/null @@ -1,34 +0,0 @@ -From d9769b270608654aa7f07ce48a36f084843daf01 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Xin Long -Date: Wed, 25 Jul 2018 16:43:22 +0800 -Subject: [PATCHv2 1/2] binding/python: use SWIG_FromCharPtrAndSize for Python3 - support - -PyString_FromStringAndSize is replaced with PyUnicode_FromStringAndSize -in Python3, and SWIG_FromCharPtrAndSize will choose the right one with -the check "#if PY_VERSION_HEX >= 0x0300000". - -Fixes: 4cb7829debd7 ("add support for hw address manipulation") -Signed-off-by: Xin Long -Signed-off-by: Jiri Pirko ---- - binding/python/team/capi.i.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/binding/python/team/capi.i.in b/binding/python/team/capi.i.in -index 5ce4659..c7a5842 100644 ---- a/binding/python/team/capi.i.in -+++ b/binding/python/team/capi.i.in -@@ -40,7 +40,7 @@ int team_hwaddr_set(struct team_handle *th, uint32_t ifindex, const char *addr, - if ($1) free($1); - } - %typemap(argout) (char *addr, unsigned int addr_len) { -- $result = SWIG_Python_AppendOutput($result, PyString_FromStringAndSize($1,$2)); -+ $result = SWIG_Python_AppendOutput($result, SWIG_FromCharPtrAndSize($1,$2)); - } - %apply char *OUTPUT {char *addr}; - int team_hwaddr_get(struct team_handle *th, uint32_t ifindex, char *addr, unsigned int addr_len); --- -2.1.0 - diff --git a/SOURCES/libteam-configure.ac-Empty-LDFLAGS-before-checking-for-libnl.patch b/SOURCES/libteam-configure.ac-Empty-LDFLAGS-before-checking-for-libnl.patch deleted file mode 100644 index 54a5066..0000000 --- a/SOURCES/libteam-configure.ac-Empty-LDFLAGS-before-checking-for-libnl.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 87662455fc6eae38de70fd7b6f758c22ec7a443a Mon Sep 17 00:00:00 2001 -Message-Id: <87662455fc6eae38de70fd7b6f758c22ec7a443a.1526634690.git.lucien.xin@gmail.com> -In-Reply-To: <789591c7318a0423984037b6a8ba3f3925f4eaa7.1526634690.git.lucien.xin@gmail.com> -References: <789591c7318a0423984037b6a8ba3f3925f4eaa7.1526634690.git.lucien.xin@gmail.com> -From: Timothy Redaelli -Date: Tue, 10 Apr 2018 15:54:02 +0200 -Subject: [PATCHv2 2/3] configure.ac: Empty LDFLAGS before checking for libnl3 - -Currently since CFLAGS are dropped if you have LDFLAGS=-pie (default on RHEL) -the rtnl_link_get_phys_port_id, rtnl_link_set_carrier and rtnl_link_get_carrier -tests always fails: - -/usr/bin/ld: /tmp/ccv5GdFD.o: relocation R_X86_64_PC32 against undefined symbol -`rtnl_link_get_carrier@@libnl_3' can not be used when making a shared object; -recompile with -fPIC - -This commits empty LDFLAGS before launching the 3 tests and restores it -after the tests. - -Signed-off-by: Timothy Redaelli -Signed-off-by: Jiri Pirko ---- - configure.ac | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 60657bb..f27c15c 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -39,8 +39,10 @@ LT_INIT - - PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0 libnl-route-3.0 libnl-cli-3.0]) - TMP_CFLAGS="$CFLAGS" -+ TMP_LDFLAGS="$LDFLAGS" - TMP_LIBS="$LIBS" - CFLAGS="$CPPFLAGS $LIBNL_CFLAGS" -+ LDFLAGS="" - LIBS="$LIBS $LIBNL_LIBS" - AC_CHECK_LIB([nl-route-3], [rtnl_link_get_phys_port_id], - AC_DEFINE(HAVE_RTNL_LINK_GET_PHYS_ID, [1], [Define to 1 if you have rtnl_link_get_phys_port_id function.])) -@@ -49,6 +51,7 @@ PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0 libnl-route-3.0 libnl-cli-3 - AC_CHECK_LIB([nl-route-3], [rtnl_link_get_carrier], - AC_DEFINE(HAVE_RTNL_LINK_GET_CARRIER, [1], [Define to 1 if you have rtnl_link_get_carrier.])) - CFLAGS="$TMP_CFLAGS" -+ LDFLAGS="$TMP_LDFLAGS" - LIBS="$TMP_LIBS" - - PKG_CHECK_MODULES([LIBDAEMON], [libdaemon]) --- -2.1.0 - diff --git a/SOURCES/libteam-libteam-don-t-crash-when-trying-to-print-unregistere.patch b/SOURCES/libteam-libteam-don-t-crash-when-trying-to-print-unregistere.patch deleted file mode 100644 index 3bc20ef..0000000 --- a/SOURCES/libteam-libteam-don-t-crash-when-trying-to-print-unregistere.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 05a7a9598fc9e616a1acf19096aeb93f7288bb35 Mon Sep 17 00:00:00 2001 -Message-Id: <05a7a9598fc9e616a1acf19096aeb93f7288bb35.1526634690.git.lucien.xin@gmail.com> -In-Reply-To: <789591c7318a0423984037b6a8ba3f3925f4eaa7.1526634690.git.lucien.xin@gmail.com> -References: <789591c7318a0423984037b6a8ba3f3925f4eaa7.1526634690.git.lucien.xin@gmail.com> -From: Antti Tiainen -Date: Thu, 3 May 2018 20:13:35 +0300 -Subject: [PATCHv2 3/3] libteam: don't crash when trying to print unregistered - device name - -team_port_str() will crash when trying to print port name that was -just unregistered, if dellink event is handled before port removal -event. - -This is regression from Commit 046fb6ba0aec ("libteam: resynchronize -ifinfo after lost RTNLGRP_LINK notifications"), which made it free -all removed interfaces after ifinfo handlers are called. - -Put the ifinfo_destroy_removed() back to dellink/newlink handlers as -it was before that commit. Clean up the ifinfo list after change handlers -only if it refreshed the entire ifinfo list after lost events. - -There's still a rare possibility that dellink event is missed due to -full socket receive buffer, which would cause ifinfo refresh and clearing -removed interfaces. For this, add NULL check to team_port_str() so it -doesn't try to print port device name in this situation. - -Signed-off-by: Antti Tiainen -Signed-off-by: Jiri Pirko ---- - include/team.h | 1 + - libteam/ifinfo.c | 7 ++++++- - libteam/libteam.c | 2 +- - libteam/stringify.c | 3 ++- - 4 files changed, 10 insertions(+), 3 deletions(-) - -diff --git a/include/team.h b/include/team.h -index 9ae517d..b31c8d8 100644 ---- a/include/team.h -+++ b/include/team.h -@@ -223,6 +223,7 @@ enum { - TEAM_PORT_CHANGE = 0x1, - TEAM_OPTION_CHANGE = 0x2, - TEAM_IFINFO_CHANGE = 0x4, -+ TEAM_IFINFO_REFRESH = 0x8, - TEAM_ANY_CHANGE = TEAM_PORT_CHANGE | - TEAM_OPTION_CHANGE | - TEAM_IFINFO_CHANGE, -diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c -index 5c32a9c..46d56a2 100644 ---- a/libteam/ifinfo.c -+++ b/libteam/ifinfo.c -@@ -258,6 +258,8 @@ static void obj_input_newlink(struct nl_object *obj, void *arg, bool event) - uint32_t ifindex; - int err; - -+ ifinfo_destroy_removed(th); -+ - link = (struct rtnl_link *) obj; - - ifindex = rtnl_link_get_ifindex(link); -@@ -294,6 +296,8 @@ static void event_handler_obj_input_dellink(struct nl_object *obj, void *arg) - uint32_t ifindex; - int err; - -+ ifinfo_destroy_removed(th); -+ - link = (struct rtnl_link *) obj; - - ifindex = rtnl_link_get_ifindex(link); -@@ -412,7 +416,8 @@ int get_ifinfo_list(struct team_handle *th) - } - } - -- ret = check_call_change_handlers(th, TEAM_IFINFO_CHANGE); -+ ret = check_call_change_handlers(th, TEAM_IFINFO_CHANGE | -+ TEAM_IFINFO_REFRESH); - if (ret < 0) - err(th, "get_ifinfo_list: check_call_change_handers failed"); - return ret; -diff --git a/libteam/libteam.c b/libteam/libteam.c -index 77a06dd..ce0467e 100644 ---- a/libteam/libteam.c -+++ b/libteam/libteam.c -@@ -236,7 +236,7 @@ int check_call_change_handlers(struct team_handle *th, - break; - } - } -- if (call_type_mask & TEAM_IFINFO_CHANGE) { -+ if (call_type_mask & TEAM_IFINFO_REFRESH) { - ifinfo_destroy_removed(th); - ifinfo_clear_changed(th); - } -diff --git a/libteam/stringify.c b/libteam/stringify.c -index 38f4788..f1faf90 100644 ---- a/libteam/stringify.c -+++ b/libteam/stringify.c -@@ -344,7 +344,8 @@ static bool __team_port_str(struct team_port *port, - team_is_port_removed(port) ? "-" : - team_is_port_changed(port) ? "*" : " ", - ifindex, -- team_get_ifinfo_ifname(ifinfo), -+ ifinfo ? team_get_ifinfo_ifname(ifinfo) : -+ "(removed)", - team_is_port_link_up(port) ? "up": "down", - team_get_port_speed(port), - team_get_port_duplex(port) ? "FD" : "HD"); --- -2.1.0 - diff --git a/SOURCES/libteam-man-fix-runner.min_ports-default-value.patch b/SOURCES/libteam-man-fix-runner.min_ports-default-value.patch new file mode 100644 index 0000000..b8a6ced --- /dev/null +++ b/SOURCES/libteam-man-fix-runner.min_ports-default-value.patch @@ -0,0 +1,30 @@ +From f36c191da3d65a4744582b2eb09fa297dd85f9ae Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Fri, 22 Feb 2019 16:27:46 +0800 +Subject: [PATCH 5/6] man: fix runner.min_ports default value + +It should be 1 instead of 0. + +Reported-by: LiLiang +Signed-off-by: Hangbin Liu +Signed-off-by: Jiri Pirko +--- + man/teamd.conf.5 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/man/teamd.conf.5 b/man/teamd.conf.5 +index 9bdf46a..5b0f3e9 100644 +--- a/man/teamd.conf.5 ++++ b/man/teamd.conf.5 +@@ -240,7 +240,7 @@ Specifies the minimum number of ports that must be active before asserting carri + .RS 7 + .PP + Default: +-.BR "0" ++.BR "1" + .RE + .TP + .BR "runner.agg_select_policy " (string) +-- +2.18.1 + diff --git a/SOURCES/libteam-man-fix-runner.sys_prio-default.patch b/SOURCES/libteam-man-fix-runner.sys_prio-default.patch deleted file mode 100644 index f3497ef..0000000 --- a/SOURCES/libteam-man-fix-runner.sys_prio-default.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 789591c7318a0423984037b6a8ba3f3925f4eaa7 Mon Sep 17 00:00:00 2001 -Message-Id: <789591c7318a0423984037b6a8ba3f3925f4eaa7.1526634690.git.lucien.xin@gmail.com> -From: Francesco Giudici -Date: Thu, 18 Jan 2018 18:21:52 +0100 -Subject: [PATCHv2 1/3] man: fix runner.sys_prio default - -runner.sys_prio default is 65535, not 255. -255 is actually the default value of ports.PORTIFNAME.lacp_prio. - -Signed-off-by: Francesco Giudici -Signed-off-by: Jiri Pirko ---- - man/teamd.conf.5 | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/man/teamd.conf.5 b/man/teamd.conf.5 -index 0545023..dc5000e 100644 ---- a/man/teamd.conf.5 -+++ b/man/teamd.conf.5 -@@ -229,7 +229,7 @@ System priority, value can be 0 \(en 65535. - .RS 7 - .PP - Default: --.BR "255" -+.BR "65535" - .RE - .TP - .BR "runner.min_ports " (int) -@@ -269,6 +269,11 @@ Default: - .TP - .BR "ports.PORTIFNAME.lacp_prio " (int) - Port priority according to LACP standard. The lower number means higher priority. -+.RS 7 -+.PP -+Default: -+.BR "255" -+.RE - .TP - .BR "ports.PORTIFNAME.lacp_key " (int) - Port key according to LACP standard. It is only possible to aggregate ports with the same key. --- -2.1.0 - diff --git a/SOURCES/libteam-teamd-add-port_hwaddr_changed-for-ab-runner.patch b/SOURCES/libteam-teamd-add-port_hwaddr_changed-for-ab-runner.patch deleted file mode 100644 index aff497b..0000000 --- a/SOURCES/libteam-teamd-add-port_hwaddr_changed-for-ab-runner.patch +++ /dev/null @@ -1,159 +0,0 @@ -From efaa6ae709bb4b59efacb0bb7301be2242b058bc Mon Sep 17 00:00:00 2001 -Message-Id: -From: Xin Long -Date: Fri, 20 Oct 2017 12:35:07 +0800 -Subject: [PATCH 1/3] teamd: add port_hwaddr_changed for ab runner - -This patch to fix an events processing race issue when adding two ports -into one team dev with ab mode with same_all hwaddr policy: - -team0 original hwaddr: 00:00:00:00:00:0a -port1 original hwaddr: 00:00:00:00:00:01 -port2 original hwaddr: 00:00:00:00:00:02 - -There are two sockets in teamd: nl_cli.sock_event for ifinfo updates -and nl_sock_event for ports/options changes. During adding two ports, -the events on these two sockets could be: - -nl_sock_event: - [1] -- [2] -- - -[1]: port1 added event (added by enslaving port1) -[2]: port2 added event (added by enslaving port2) - -nl_cli.sock_event: - [a1] -- [b0] -- [c1] -- [d2] -- [e2] -- [f1] -- - -[a1]: port1 ifinfo event (added by setting port1's master) -[b0]: team0 ifinfo event (added by setting team0's hwaddr) -[c1]: port1 ifinfo event (added by set port1's hwaddr) -[d2]: port2 ifinfo event (added by set port2's master) -[e2]: port2 ifinfo event (added by set port2's hwaddr) -[f1]: port1 ifinfo event (added by set port1's hwaddr) - -teamd can make sure the order for their processing is as above on the -same socket, but not between two sockets. So if these events processing -order is (monitoring team/ports' ifinfo, hwaddr, master): - -[ 1]: team0->ifinfo = 00:00:00:00:00:0a - team0->hwaddr = 00:00:00:00:00:01 - port1->hwaddr = 00:00:00:00:00:0a -[a1]: port1->ifinfo = 00:00:00:00:00:01 - port1->master = team0 -[ 2]: port2->ifinfo = 00:00:00:00:00:02 - port2->hwaddr = 00:00:00:00:00:0a - (team0->ifinfo is not updated, it's still 00:00:00:00:00:0a) -[b0]: team0->ifinfo = 00:00:00:00:00:01 - port1->hwaddr = 00:00:00:00:00:01 - (port2->master is not yet set, port2->hwaddr couldn't be updated) -[c1]: no changes -[d2]: port2->ifinfo = 00:00:00:00:00:0a - port2->master = team0 - (too late !!!) -[e2]: no changes -[f1]: no changes - -Then: -team0 final hwaddr: 00:00:00:00:00:01 -port1 final hwaddr: 00:00:00:00:00:01 -port2 final hwaddr: 00:00:00:00:00:0a <----- issue - -This patch is to add port_hwaddr_changed for ab runner, in [e2] where -we set it's hwaddr with team0 (port2->hwaddr = 00:00:00:00:00:01) IF -port2->hwaddr != team0->ifinfo. - -I think the same issue also exists in lacp and lb mode for which I will -fix them in another patches. - -v1 -> v2: - fix some typos in changelog and couple of style problems in codes - -Reported-by: Jon Nikolakakis -Signed-off-by: Xin Long -Signed-off-by: Jiri Pirko -Signed-off-by: Marcelo Ricardo Leitner ---- - teamd/teamd_runner_activebackup.c | 39 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 39 insertions(+) - -diff --git a/teamd/teamd_runner_activebackup.c b/teamd/teamd_runner_activebackup.c -index aec3a73d5ff61534c377b935fe0e5bc1f51af79d..8a3447f1a63d71055eb7a8784cbe96381ee2b451 100644 ---- a/teamd/teamd_runner_activebackup.c -+++ b/teamd/teamd_runner_activebackup.c -@@ -39,6 +39,8 @@ struct ab_hwaddr_policy { - const char *name; - int (*hwaddr_changed)(struct teamd_context *ctx, - struct ab *ab); -+ int (*port_hwaddr_changed)(struct teamd_context *ctx, struct ab *ab, -+ struct teamd_port *tdport); - int (*port_added)(struct teamd_context *ctx, struct ab *ab, - struct teamd_port *tdport); - int (*active_set)(struct teamd_context *ctx, struct ab *ab, -@@ -95,6 +97,26 @@ static int ab_hwaddr_policy_same_all_hwaddr_changed(struct teamd_context *ctx, - return 0; - } - -+static int -+ab_hwaddr_policy_same_all_port_hwaddr_changed(struct teamd_context *ctx, -+ struct ab *ab, -+ struct teamd_port *tdport) -+{ -+ int err; -+ -+ if (!memcmp(team_get_ifinfo_hwaddr(tdport->team_ifinfo), -+ ctx->hwaddr, ctx->hwaddr_len)) -+ return 0; -+ -+ err = team_hwaddr_set(ctx->th, tdport->ifindex, ctx->hwaddr, -+ ctx->hwaddr_len); -+ if (err) -+ teamd_log_err("%s: Failed to set port hardware address.", -+ tdport->ifname); -+ -+ return err; -+} -+ - static int ab_hwaddr_policy_same_all_port_added(struct teamd_context *ctx, - struct ab *ab, - struct teamd_port *tdport) -@@ -114,6 +136,7 @@ static int ab_hwaddr_policy_same_all_port_added(struct teamd_context *ctx, - static const struct ab_hwaddr_policy ab_hwaddr_policy_same_all = { - .name = "same_all", - .hwaddr_changed = ab_hwaddr_policy_same_all_hwaddr_changed, -+ .port_hwaddr_changed = ab_hwaddr_policy_same_all_port_hwaddr_changed, - .port_added = ab_hwaddr_policy_same_all_port_added, - }; - -@@ -411,6 +434,21 @@ static int ab_event_watch_hwaddr_changed(struct teamd_context *ctx, void *priv) - return 0; - } - -+static int ab_event_watch_port_hwaddr_changed(struct teamd_context *ctx, -+ struct teamd_port *tdport, -+ void *priv) -+{ -+ struct ab *ab = priv; -+ -+ if (!teamd_port_present(ctx, tdport)) -+ return 0; -+ -+ if (ab->hwaddr_policy->port_hwaddr_changed) -+ return ab->hwaddr_policy->port_hwaddr_changed(ctx, ab, tdport); -+ -+ return 0; -+} -+ - static int ab_port_load_config(struct teamd_context *ctx, - struct ab_port *ab_port) - { -@@ -491,6 +529,7 @@ static int ab_event_watch_prio_option_changed(struct teamd_context *ctx, - - static const struct teamd_event_watch_ops ab_event_watch_ops = { - .hwaddr_changed = ab_event_watch_hwaddr_changed, -+ .port_hwaddr_changed = ab_event_watch_port_hwaddr_changed, - .port_added = ab_event_watch_port_added, - .port_link_changed = ab_event_watch_port_link_changed, - .option_changed = ab_event_watch_prio_option_changed, --- -2.14.3 - diff --git a/SOURCES/libteam-teamd-add-port_hwaddr_changed-for-lacp-runner.patch b/SOURCES/libteam-teamd-add-port_hwaddr_changed-for-lacp-runner.patch deleted file mode 100644 index 4c77bf3..0000000 --- a/SOURCES/libteam-teamd-add-port_hwaddr_changed-for-lacp-runner.patch +++ /dev/null @@ -1,66 +0,0 @@ -From c42cc9955a93bc4bed65adf9a506f92b8df290d7 Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: -References: -From: Xin Long -Date: Tue, 7 Nov 2017 12:33:36 +0800 -Subject: [PATCH 3/3] teamd: add port_hwaddr_changed for lacp runner - -To fix the same issue fixed in commit efaa6ae709bb ("teamd: add -port_hwaddr_changed for ab runner") for lacp runner, this patch -is to add .port_hwaddr_changed for lacp runner as well. - -Signed-off-by: Xin Long -Signed-off-by: Jiri Pirko -Signed-off-by: Marcelo Ricardo Leitner ---- - teamd/teamd_runner_lacp.c | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - -diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 1310f6737f6cf37b7d6fef0befb8c803178212bd..7b8f0a783cfd71aa3f8a89276f5b95bce2fc517a 100644 ---- a/teamd/teamd_runner_lacp.c -+++ b/teamd/teamd_runner_lacp.c -@@ -1336,6 +1336,31 @@ static int lacp_event_watch_hwaddr_changed(struct teamd_context *ctx, - return 0; - } - -+static int lacp_event_watch_port_hwaddr_changed(struct teamd_context *ctx, -+ struct teamd_port *tdport, -+ void *priv) -+{ -+ struct lacp_port *lacp_port; -+ struct lacp *lacp = priv; -+ int err; -+ -+ if (!teamd_port_present(ctx, tdport)) -+ return 0; -+ -+ if (!memcmp(team_get_ifinfo_hwaddr(tdport->team_ifinfo), -+ ctx->hwaddr, ctx->hwaddr_len)) -+ return 0; -+ -+ err = lacp_port_set_mac(ctx, tdport); -+ if (err) -+ return err; -+ -+ lacp_port = lacp_port_get(lacp, tdport); -+ lacp_port_actor_system_update(lacp_port); -+ -+ return 0; -+} -+ - static int lacp_event_watch_admin_state_changed(struct teamd_context *ctx, - void *priv) - { -@@ -1389,6 +1414,7 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx, - - static const struct teamd_event_watch_ops lacp_event_watch_ops = { - .hwaddr_changed = lacp_event_watch_hwaddr_changed, -+ .port_hwaddr_changed = lacp_event_watch_port_hwaddr_changed, - .port_added = lacp_event_watch_port_added, - .port_removed = lacp_event_watch_port_removed, - .port_changed = lacp_event_watch_port_changed, --- -2.14.3 - diff --git a/SOURCES/libteam-teamd-add-port_hwaddr_changed-for-lb-runner.patch b/SOURCES/libteam-teamd-add-port_hwaddr_changed-for-lb-runner.patch deleted file mode 100644 index 95a1188..0000000 --- a/SOURCES/libteam-teamd-add-port_hwaddr_changed-for-lb-runner.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0164b6a460728b3a1fd3feee9e2901f1b810cf24 Mon Sep 17 00:00:00 2001 -Message-Id: <0164b6a460728b3a1fd3feee9e2901f1b810cf24.1518205291.git.mleitner@redhat.com> -In-Reply-To: -References: -From: Xin Long -Date: Tue, 7 Nov 2017 12:33:11 +0800 -Subject: [PATCH 2/3] teamd: add port_hwaddr_changed for lb runner - -To fix the same issue fixed in commit efaa6ae709bb ("teamd: add -port_hwaddr_changed for ab runner") for lb runner, this patch is -to add .port_hwaddr_changed for lb runner as well. - -Signed-off-by: Xin Long -Signed-off-by: Jiri Pirko -Signed-off-by: Marcelo Ricardo Leitner ---- - teamd/teamd_runner_loadbalance.c | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -diff --git a/teamd/teamd_runner_loadbalance.c b/teamd/teamd_runner_loadbalance.c -index a1e21303455fde55763b57b898ac5aaeb21c4b61..b9bfc13895b1a47d3e5cf552e6c720601c475d97 100644 ---- a/teamd/teamd_runner_loadbalance.c -+++ b/teamd/teamd_runner_loadbalance.c -@@ -87,8 +87,31 @@ static int lb_event_watch_hwaddr_changed(struct teamd_context *ctx, void *priv) - return 0; - } - -+static int lb_event_watch_port_hwaddr_changed(struct teamd_context *ctx, -+ struct teamd_port *tdport, -+ void *priv) -+{ -+ int err; -+ -+ if (!teamd_port_present(ctx, tdport)) -+ return 0; -+ -+ if (!memcmp(team_get_ifinfo_hwaddr(tdport->team_ifinfo), -+ ctx->hwaddr, ctx->hwaddr_len)) -+ return 0; -+ -+ err = team_hwaddr_set(ctx->th, tdport->ifindex, ctx->hwaddr, -+ ctx->hwaddr_len); -+ if (err) -+ teamd_log_err("%s: Failed to set port hardware address.", -+ tdport->ifname); -+ -+ return err; -+} -+ - static const struct teamd_event_watch_ops lb_port_watch_ops = { - .hwaddr_changed = lb_event_watch_hwaddr_changed, -+ .port_hwaddr_changed = lb_event_watch_port_hwaddr_changed, - .port_added = lb_event_watch_port_added, - .port_removed = lb_event_watch_port_removed, - .port_link_changed = lb_event_watch_port_link_changed, --- -2.14.3 - diff --git a/SOURCES/libteam-teamd-add-port_master_ifindex_changed-for-teamd_even.patch b/SOURCES/libteam-teamd-add-port_master_ifindex_changed-for-teamd_even.patch deleted file mode 100644 index a4a0281..0000000 --- a/SOURCES/libteam-teamd-add-port_master_ifindex_changed-for-teamd_even.patch +++ /dev/null @@ -1,191 +0,0 @@ -From b6f63db7f3c8eb3119c9449abe9ac6535965e14d Mon Sep 17 00:00:00 2001 -Message-Id: -From: Hangbin Liu -Date: Wed, 8 Aug 2018 16:56:52 +0800 -Subject: [PATCHv2] teamd: add port_master_ifindex_changed for - teamd_event_watch_ops - -When we add port to new active-backup teams with multi threads. After -the port is set to link up and trigger function obj_input_newlink(), -it's possible that there is no master index in rtnl link info. So the -team slave's master_ifindex is not updated. - -On the other hand, the port is up and trigger functions like -- teamd_link_watch_check_link_up() - - teamd_event_port_link_changed() - - ab_event_watch_port_link_changed() - - ab_link_watch_handler() - - teamd_for_each_tdport() - - teamd_get_next_tdport() - - teamd_port_present() - -Here the teamd_port_present() failed as the port master ifindex is not -update to team ifindex yet. Finally we get nothing and no active port -is set. - -Here is the reproducer: - -\#bin/bash -if [ -z $1 ] || [ -z $2 ]; then - echo "Usage: $0 iface1 iface2" - exit 1 -else - iface1=$1 - iface2=$2 -fi - -WAIT=2 -COUNT=0 - -start_team() -{ - local num=$1 - local iface=$2 - teamd -o -n -U -d -t team$num -c '{"runner": {"name": "activebackup"},"link_watch": {"name": "ethtool"}}' -gg - teamdctl team$num port add $iface -} - -while :; do - echo "-----------------------------------------------------------" - let "COUNT++" - echo "Loop $COUNT" - - teamd -k -t team1 - teamd -k -t team2 - sleep "$WAIT" - start_team 1 $iface1 & - start_team 2 $iface2 & - sleep "$WAIT" - - if teamdctl team1 state | grep -q "active port: $iface1" && \ - teamdctl team2 state | grep -q "active port: $iface2"; then - echo "Pass" - else - echo "FAIL" - exit 1 - fi -done - -Failure as follows: - -]# teamdctl teamX state dump - "runner": { - "active_port": "" - }, - -Currently we only reproduced this with active-backup mode(I could reproduce it -in VM easily, but hard to reproduce it on physical machines). - -Fix it by adding a new teamd_event_watch_ops port_master_ifindex_changed for -active-backup mode. - -V2: update commit description from Jamie Bainbridge's reply. -v3: update description and reproducer. - -Signed-off-by: Hangbin Liu -Signed-off-by: Jiri Pirko ---- - teamd/teamd.h | 5 +++++ - teamd/teamd_events.c | 19 +++++++++++++++++++ - teamd/teamd_ifinfo_watch.c | 5 +++++ - teamd/teamd_runner_activebackup.c | 8 ++++++++ - 4 files changed, 37 insertions(+) - -diff --git a/teamd/teamd.h b/teamd/teamd.h -index 5dbfb9b..3934fc2 100644 ---- a/teamd/teamd.h -+++ b/teamd/teamd.h -@@ -189,6 +189,9 @@ struct teamd_event_watch_ops { - struct teamd_port *tdport, void *priv); - int (*port_ifname_changed)(struct teamd_context *ctx, - struct teamd_port *tdport, void *priv); -+ int (*port_master_ifindex_changed)(struct teamd_context *ctx, -+ struct teamd_port *tdport, -+ void *priv); - int (*option_changed)(struct teamd_context *ctx, - struct team_option *option, void *priv); - char *option_changed_match_name; -@@ -208,6 +211,8 @@ int teamd_event_ifinfo_hwaddr_changed(struct teamd_context *ctx, - struct team_ifinfo *ifinfo); - int teamd_event_ifinfo_ifname_changed(struct teamd_context *ctx, - struct team_ifinfo *ifinfo); -+int teamd_event_ifinfo_master_ifindex_changed(struct teamd_context *ctx, -+ struct team_ifinfo *ifinfo); - int teamd_event_ifinfo_admin_state_changed(struct teamd_context *ctx, - struct team_ifinfo *ifinfo); - int teamd_events_init(struct teamd_context *ctx); -diff --git a/teamd/teamd_events.c b/teamd/teamd_events.c -index 1a95974..65aa46a 100644 ---- a/teamd/teamd_events.c -+++ b/teamd/teamd_events.c -@@ -167,6 +167,25 @@ int teamd_event_ifinfo_ifname_changed(struct teamd_context *ctx, - return 0; - } - -+int teamd_event_ifinfo_master_ifindex_changed(struct teamd_context *ctx, -+ struct team_ifinfo *ifinfo) -+{ -+ struct event_watch_item *watch; -+ uint32_t ifindex = team_get_ifinfo_ifindex(ifinfo); -+ struct teamd_port *tdport = teamd_get_port(ctx, ifindex); -+ int err; -+ -+ list_for_each_node_entry(watch, &ctx->event_watch_list, list) { -+ if (watch->ops->port_master_ifindex_changed && tdport) { -+ err = watch->ops->port_master_ifindex_changed(ctx, tdport, -+ watch->priv); -+ if (err) -+ return err; -+ } -+ } -+ return 0; -+} -+ - int teamd_event_ifinfo_admin_state_changed(struct teamd_context *ctx, - struct team_ifinfo *ifinfo) - { -diff --git a/teamd/teamd_ifinfo_watch.c b/teamd/teamd_ifinfo_watch.c -index f334ff6..6a19532 100644 ---- a/teamd/teamd_ifinfo_watch.c -+++ b/teamd/teamd_ifinfo_watch.c -@@ -59,6 +59,11 @@ static int ifinfo_change_handler_func(struct team_handle *th, void *priv, - if (err) - return err; - } -+ if (team_is_ifinfo_master_ifindex_changed(ifinfo)) { -+ err = teamd_event_ifinfo_master_ifindex_changed(ctx, ifinfo); -+ if (err) -+ return err; -+ } - } - return 0; - } -diff --git a/teamd/teamd_runner_activebackup.c b/teamd/teamd_runner_activebackup.c -index 8a3447f..f92d341 100644 ---- a/teamd/teamd_runner_activebackup.c -+++ b/teamd/teamd_runner_activebackup.c -@@ -520,6 +520,13 @@ static int ab_event_watch_port_link_changed(struct teamd_context *ctx, - return ab_link_watch_handler(ctx, priv); - } - -+static int ab_event_watch_port_master_ifindex_changed(struct teamd_context *ctx, -+ struct teamd_port *tdport, -+ void *priv) -+{ -+ return ab_link_watch_handler(ctx, priv); -+} -+ - static int ab_event_watch_prio_option_changed(struct teamd_context *ctx, - struct team_option *option, - void *priv) -@@ -532,6 +539,7 @@ static const struct teamd_event_watch_ops ab_event_watch_ops = { - .port_hwaddr_changed = ab_event_watch_port_hwaddr_changed, - .port_added = ab_event_watch_port_added, - .port_link_changed = ab_event_watch_port_link_changed, -+ .port_master_ifindex_changed = ab_event_watch_port_master_ifindex_changed, - .option_changed = ab_event_watch_prio_option_changed, - .option_changed_match_name = "priority", - }; --- -2.1.0 - diff --git a/SOURCES/libteam-teamd-config-update-local-prio-to-kernel.patch b/SOURCES/libteam-teamd-config-update-local-prio-to-kernel.patch new file mode 100644 index 0000000..c3de0a7 --- /dev/null +++ b/SOURCES/libteam-teamd-config-update-local-prio-to-kernel.patch @@ -0,0 +1,68 @@ +From c8b356a3cd363af10d71e21a4fb7dc26cf90b5bc Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Mon, 7 Jan 2019 15:58:49 +0800 +Subject: [PATCH 2/6] teamd: config: update local prio to kernel + +Team port's priority will affect the active port selection. Update the +local config is not enough. We also need to update kernel configs. + +Reported-by: Liang Li +Signed-off-by: Hangbin Liu +Signed-off-by: Jiri Pirko +--- + teamd/teamd_config.c | 32 ++++++++++++++++++++++++++++++++ + 1 file changed, 32 insertions(+) + +diff --git a/teamd/teamd_config.c b/teamd/teamd_config.c +index 94158ce..69b25de 100644 +--- a/teamd/teamd_config.c ++++ b/teamd/teamd_config.c +@@ -155,6 +155,31 @@ errout: + return err; + } + ++static int teamd_config_port_set(struct teamd_context *ctx, const char *port_name, ++ json_t *port_obj) ++{ ++ struct teamd_port *tdport; ++ json_t *config; ++ int tmp, err; ++ ++ tdport = teamd_get_port_by_ifname(ctx, port_name); ++ if (!tdport) ++ return -ENODEV; ++ ++ config = json_object_get(port_obj, "prio"); ++ if (json_is_integer(config)) { ++ tmp = json_integer_value(config); ++ err = team_set_port_priority(ctx->th, tdport->ifindex, tmp); ++ if (err) { ++ teamd_log_err("%s: Failed to set \"priority\".", ++ tdport->ifname); ++ return err; ++ } ++ } ++ ++ return 0; ++} ++ + int teamd_config_port_update(struct teamd_context *ctx, const char *port_name, + const char *json_port_cfg_str) + { +@@ -184,6 +209,13 @@ int teamd_config_port_update(struct teamd_context *ctx, const char *port_name, + if (err) + teamd_log_err("%s: Failed to update existing config " + "port object", port_name); ++ else { ++ err = teamd_config_port_set(ctx, port_name, port_new_obj); ++ if (err) ++ teamd_log_err("%s: Failed to update config to kernel", ++ port_name); ++ } ++ + new_port_decref: + json_decref(port_new_obj); + return err; +-- +2.18.1 + diff --git a/SOURCES/libteam-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch b/SOURCES/libteam-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch deleted file mode 100644 index 1c24d0e..0000000 --- a/SOURCES/libteam-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 45912ded9cb5166d8286a6a4fb53bfe9fffcd8a9 Mon Sep 17 00:00:00 2001 -Message-Id: <45912ded9cb5166d8286a6a4fb53bfe9fffcd8a9.1518009078.git.mleitner@redhat.com> -From: Xin Long -Date: Wed, 11 Oct 2017 14:17:38 +0800 -Subject: [PATCH] teamd: do not process lacpdu before the port ifinfo is set - -Now the port ifinfo will be set in obj_input_newlink when a RTM_NEWLINK -event is received. - -But when a port is being added, if a lacpdu gets received on this port -before the RTM_NEWLINK event, lacpdu_recv will process the packet with -incorrect port ifinfo. - -In Patrick's case, as ifinfo->master_ifindex was 0, it would skip this -port in teamd_for_each_tdport, which caused lacp_port->agg_lead not to -be updated in lacp_switch_agg_lead. Later the lacp_port actor would go -to a unexpected state. - -This patch is to avoid it by checking teamd_port_present in lacpdu_recv -so that it would not process lacpdu before the port ifinfo is set. - -Reported-by: Patrick Talbert -Tested-by: Patrick Talbert -Signed-off-by: Xin Long -Reviewed-by: Marcelo Ricardo Leitner -Signed-off-by: Jiri Pirko -Signed-off-by: Marcelo Ricardo Leitner ---- - teamd/teamd_runner_lacp.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 5601278696a9f263f6bfe71642b2db971c9314b9..1310f6737f6cf37b7d6fef0befb8c803178212bd 100644 ---- a/teamd/teamd_runner_lacp.c -+++ b/teamd/teamd_runner_lacp.c -@@ -1075,6 +1075,9 @@ static int lacpdu_recv(struct lacp_port *lacp_port) - if (err <= 0) - return err; - -+ if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) -+ return 0; -+ - if (!lacpdu_check(&lacpdu)) { - teamd_log_warn("malformed LACP PDU came."); - return 0; --- -2.14.3 - diff --git a/SOURCES/libteam-teamd-improve-the-error-output-for-non-integer-port-.patch b/SOURCES/libteam-teamd-improve-the-error-output-for-non-integer-port-.patch new file mode 100644 index 0000000..71ea1b9 --- /dev/null +++ b/SOURCES/libteam-teamd-improve-the-error-output-for-non-integer-port-.patch @@ -0,0 +1,74 @@ +From 8c7614abf5993d92e332a800f244bdebd7c9a2c8 Mon Sep 17 00:00:00 2001 +Message-Id: <8c7614abf5993d92e332a800f244bdebd7c9a2c8.1562149642.git.lucien.xin@gmail.com> +From: Xin Long +Date: Tue, 2 Jul 2019 19:33:56 +0800 +Subject: [PATCH] teamd: improve the error output for non-integer port prio + +This patch is to improve the error log when users pass +a non-integer value to set port's prio. After that, we +can remove the error output for teamd_config_port_set +failure from teamd_config_port_update. + +Signed-off-by: Xin Long +Signed-off-by: Jiri Pirko +--- + teamd/teamd_config.c | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/teamd/teamd_config.c b/teamd/teamd_config.c +index 1bf85ac..610ad5f 100644 +--- a/teamd/teamd_config.c ++++ b/teamd/teamd_config.c +@@ -167,17 +167,19 @@ static int teamd_config_port_set(struct teamd_context *ctx, const char *port_nam + return 0; + + config = json_object_get(port_obj, "prio"); +- if (json_is_integer(config)) { +- tmp = json_integer_value(config); +- err = team_set_port_priority(ctx->th, tdport->ifindex, tmp); +- if (err) { +- teamd_log_err("%s: Failed to set \"priority\".", +- tdport->ifname); +- return err; +- } ++ if (!json_is_integer(config)) { ++ teamd_log_err("%s: Failed to get integer for \"priority\".", ++ tdport->ifname); ++ return -ENOENT; + } + +- return 0; ++ tmp = json_integer_value(config); ++ err = team_set_port_priority(ctx->th, tdport->ifindex, tmp); ++ if (err) ++ teamd_log_err("%s: Failed to update \"priority\" to kernel", ++ tdport->ifname); ++ ++ return err; + } + + int teamd_config_port_update(struct teamd_context *ctx, const char *port_name, +@@ -206,16 +208,14 @@ int teamd_config_port_update(struct teamd_context *ctx, const char *port_name, + /* replace existing object content */ + json_object_clear(port_obj); + err = json_object_update(port_obj, port_new_obj); +- if (err) ++ if (err) { + teamd_log_err("%s: Failed to update existing config " + "port object", port_name); +- else { +- err = teamd_config_port_set(ctx, port_name, port_new_obj); +- if (err) +- teamd_log_err("%s: Failed to update config to kernel", +- port_name); ++ goto new_port_decref; + } + ++ err = teamd_config_port_set(ctx, port_name, port_new_obj); ++ + new_port_decref: + json_decref(port_new_obj); + return err; +-- +2.18.1 + diff --git a/SOURCES/libteam-teamd-lacp-update-port-state-according-to-partner-s-.patch b/SOURCES/libteam-teamd-lacp-update-port-state-according-to-partner-s-.patch new file mode 100644 index 0000000..567e93a --- /dev/null +++ b/SOURCES/libteam-teamd-lacp-update-port-state-according-to-partner-s-.patch @@ -0,0 +1,74 @@ +From 54f137c10579bf97800c61ebb13e732aa1d843e6 Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Fri, 8 Mar 2019 19:28:55 +0800 +Subject: [PATCH 6/6] teamd: lacp: update port state according to partner's + sync bit + +According to 6.4.15 of IEEE 802.1AX-2014, Figure 6-22, the state that the +port is selected moves MUX state from DETACHED to ATTACHED. + +But ATTACHED state does not mean that the port can send and receive user +frames. COLLECTING_DISTRIBUTION state is the state that the port can send +and receive user frames. To move MUX state from ATTACHED to +COLLECTING_DISTRIBUTION, the partner state should be sync as well as the +port selected. + +In function lacp_port_actor_update(), only INFO_STATE_SYNCHRONIZATION +should be set to the actor.state when the port is selected. +INFO_STATE_COLLECTING and INFO_STATE_DISTRIBUTING should be set to false +with ATTACHED mode and set to true when INFO_STATE_SYNCHRONIZATION of +partner.state is set. + +In function lacp_port_should_be_{enabled, disabled}(), we also need to +check the INFO_STATE_SYNCHRONIZATION bit of partner.state. + +Signed-off-by: Hangbin Liu +Signed-off-by: Jiri Pirko +--- + teamd/teamd_runner_lacp.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c +index 555aa06..d292d69 100644 +--- a/teamd/teamd_runner_lacp.c ++++ b/teamd/teamd_runner_lacp.c +@@ -333,7 +333,8 @@ static int lacp_port_should_be_enabled(struct lacp_port *lacp_port) + struct lacp *lacp = lacp_port->lacp; + + if (lacp_port_selected(lacp_port) && +- lacp_port->agg_lead == lacp->selected_agg_lead) ++ lacp_port->agg_lead == lacp->selected_agg_lead && ++ lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION) + return true; + return false; + } +@@ -343,7 +344,8 @@ static int lacp_port_should_be_disabled(struct lacp_port *lacp_port) + struct lacp *lacp = lacp_port->lacp; + + if (!lacp_port_selected(lacp_port) || +- lacp_port->agg_lead != lacp->selected_agg_lead) ++ lacp_port->agg_lead != lacp->selected_agg_lead || ++ !(lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION)) + return true; + return false; + } +@@ -914,9 +916,13 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port) + if (lacp_port->lacp->cfg.fast_rate) + state |= INFO_STATE_LACP_TIMEOUT; + if (lacp_port_selected(lacp_port) && +- lacp_port_agg_selected(lacp_port)) +- state |= INFO_STATE_SYNCHRONIZATION | +- INFO_STATE_COLLECTING | INFO_STATE_DISTRIBUTING; ++ lacp_port_agg_selected(lacp_port)) { ++ state |= INFO_STATE_SYNCHRONIZATION; ++ state &= ~(INFO_STATE_COLLECTING | INFO_STATE_DISTRIBUTING); ++ if (lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION) ++ state |= INFO_STATE_COLLECTING | ++ INFO_STATE_DISTRIBUTING; ++ } + if (lacp_port->state == PORT_STATE_EXPIRED) + state |= INFO_STATE_EXPIRED; + if (lacp_port->state == PORT_STATE_DEFAULTED) +-- +2.18.1 + diff --git a/SOURCES/libteam-teamd-lw-arp_ping-only-check-arp-reply-message.patch b/SOURCES/libteam-teamd-lw-arp_ping-only-check-arp-reply-message.patch new file mode 100644 index 0000000..3b081c6 --- /dev/null +++ b/SOURCES/libteam-teamd-lw-arp_ping-only-check-arp-reply-message.patch @@ -0,0 +1,38 @@ +From 5f355301b7cafbb51b036ad1e5af38e79d4330d6 Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Fri, 11 Jan 2019 09:57:10 +0800 +Subject: [PATCH 3/6] teamd: lw: arp_ping: only check arp reply message + +Currently we check both arp request and reply message for arp_ping link +watch. But if we enabled validate_active and validate_inactive at the +same time, we will receive the other slave's arp request as the switch +broadcasts arp request message. i.e. slave1 receives arp request from +slave2 and vice versa. + +Then the arp check will pass even the target is unreachable. Fix it by +only check arp reply message. + +Reported-by: LiLiang +Signed-off-by: Hangbin Liu +Signed-off-by: Jiri Pirko +--- + teamd/teamd_lw_arp_ping.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/teamd/teamd_lw_arp_ping.c b/teamd/teamd_lw_arp_ping.c +index 01cd6e1..81806f0 100644 +--- a/teamd/teamd_lw_arp_ping.c ++++ b/teamd/teamd_lw_arp_ping.c +@@ -336,7 +336,8 @@ static int lw_ap_receive(struct lw_psr_port_priv *psr_ppriv) + if (ap.ah.ar_hrd != htons(ll_my.sll_hatype) || + ap.ah.ar_pro != htons(ETH_P_IP) || + ap.ah.ar_hln != ll_my.sll_halen || +- ap.ah.ar_pln != 4) { ++ ap.ah.ar_pln != 4 || ++ ap.ah.ar_op != htons(ARPOP_REPLY)) { + return 0; + } + +-- +2.18.1 + diff --git a/SOURCES/libteam-teamd-lw-nsna_ping-only-send-ns-on-enabled-port.patch b/SOURCES/libteam-teamd-lw-nsna_ping-only-send-ns-on-enabled-port.patch new file mode 100644 index 0000000..913b24d --- /dev/null +++ b/SOURCES/libteam-teamd-lw-nsna_ping-only-send-ns-on-enabled-port.patch @@ -0,0 +1,35 @@ +From 6bf0e87387878654186bcf7287e0eda59b1c2f2c Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Thu, 21 Feb 2019 17:37:46 +0800 +Subject: [PATCH 4/6] teamd: lw: nsna_ping: only send ns on enabled port + +We forget to check forced_send when using nsna_ping link_watch. +Ns is sent from all ports, which cause switch mac flapping. Some +reply packets are delivered to disabled port and dropped directly. + +Fix it by checking forced_send and only send ns on enabled port. + +Reported-by: LiLiang +Signed-off-by: Hangbin Liu +Signed-off-by: Jiri Pirko +--- + teamd/teamd_lw_nsna_ping.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/teamd/teamd_lw_nsna_ping.c b/teamd/teamd_lw_nsna_ping.c +index 127d950..82371c4 100644 +--- a/teamd/teamd_lw_nsna_ping.c ++++ b/teamd/teamd_lw_nsna_ping.c +@@ -203,6 +203,9 @@ static int lw_nsnap_send(struct lw_psr_port_priv *psr_ppriv) + struct sockaddr_in6 sendto_addr; + struct ns_packet nsp; + ++ if (!(psr_ppriv->common.forced_send)) ++ return 0; ++ + err = teamd_getsockname_hwaddr(psr_ppriv->sock, &ll_my, + sizeof(nsp.hwaddr)); + if (err) +-- +2.18.1 + diff --git a/SOURCES/libteam-teamd-remove-port-if-adding-fails.patch b/SOURCES/libteam-teamd-remove-port-if-adding-fails.patch new file mode 100644 index 0000000..454366a --- /dev/null +++ b/SOURCES/libteam-teamd-remove-port-if-adding-fails.patch @@ -0,0 +1,62 @@ +From 0f1b2fac03361c5d2bac34e4b19922c60c5c06c6 Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Wed, 13 Mar 2019 15:04:29 +0800 +Subject: [PATCH 1/3] teamd: remove port if adding fails + +When we add a port to team via teamdctl, some drivers do not support +changing mac address after dev opened, which would lead to the failure +of port_obj_create(). The call path looks like below for LACP mode: + +- port_obj_create() + - port_priv_init_all() + - lacp_port_added() + - lacp_port_set_mac() + +Currently, we only destroy the port object if adding port fails. But the +port is still enslaved to team in kernel. IP link command shows the port +is a team_slave, but teamdctl state shows nothing. This may make users +confused. + +Fix it by removing the port if adding fails. + +v2: also calls teamd_port_remove in port_obj_remove() + +Reported-by: Vladimir Benes +Signed-off-by: Hangbin Liu +Signed-off-by: Jiri Pirko +--- + teamd/teamd_per_port.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c +index 09d1dc7..f98a90d 100644 +--- a/teamd/teamd_per_port.c ++++ b/teamd/teamd_per_port.c +@@ -42,6 +42,8 @@ struct port_obj { + }; + + #define _port(port_obj) (&(port_obj)->port) ++static int teamd_port_remove(struct teamd_context *ctx, ++ struct teamd_port *tdport); + + int teamd_port_priv_create_and_get(void **ppriv, struct teamd_port *tdport, + const struct teamd_port_priv *pp, +@@ -203,6 +205,7 @@ static int port_obj_create(struct teamd_context *ctx, + teamd_event_port_removed: + teamd_event_port_removed(ctx, tdport); + list_del: ++ teamd_port_remove(ctx, tdport); + port_obj_destroy(ctx, port_obj); + port_obj_free(port_obj); + return err; +@@ -214,6 +217,7 @@ static void port_obj_remove(struct teamd_context *ctx, + struct teamd_port *tdport = _port(port_obj); + + teamd_event_port_removed(ctx, tdport); ++ teamd_port_remove(ctx, tdport); + port_obj_destroy(ctx, port_obj); + port_obj_free(port_obj); + } +-- +2.18.1 + diff --git a/SOURCES/libteam-teamd-return-0-if-tdport-doesn-t-exist-in-teamd_conf.patch b/SOURCES/libteam-teamd-return-0-if-tdport-doesn-t-exist-in-teamd_conf.patch new file mode 100644 index 0000000..83594ab --- /dev/null +++ b/SOURCES/libteam-teamd-return-0-if-tdport-doesn-t-exist-in-teamd_conf.patch @@ -0,0 +1,52 @@ +From 2bf8652cce4303d3ae79dff8bdef10dfae27439b Mon Sep 17 00:00:00 2001 +Message-Id: <2bf8652cce4303d3ae79dff8bdef10dfae27439b.1562149639.git.lucien.xin@gmail.com> +From: Xin Long +Date: Tue, 2 Jul 2019 19:30:43 +0800 +Subject: [PATCH] teamd: return 0 if tdport doesn't exist in + teamd_config_port_set + +This issue can be reproduced by doing: + + # ip link add dummy1 type dummy + # teamd -t team0 -c '{"runner": {"name": "activebackup"}}' -d + # teamdctl team0 port config update dummy1 '{"prio": -10}' + # ip link set dummy0 master team0 + +and the error shows: + + libteamdctl: usock: Error message received: "ConfigUpdateFail" + libteamdctl: usock: Error message content: "Failed to update config." + command call failed (Invalid argument) + +It's a regression caused by Commit c8b356a3cd36 ("teamd: config: update +local prio to kernel") where it requires the tdport has to exist when +a tdport config is being updated. However teamd supports for the port +config going first before the port being enslaved. + +This issue breaks how NM-team starts a team device. Here to fix it by +returning 0 even if the tdport doesn't exist in teamd_config_port_set. + +Reported-by: Radek Vykydal +Fixes: c8b356a3cd36 ("teamd: config: update local prio to kernel") +Signed-off-by: Xin Long +Signed-off-by: Jiri Pirko +--- + teamd/teamd_config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/teamd/teamd_config.c b/teamd/teamd_config.c +index 34fef1f..1bf85ac 100644 +--- a/teamd/teamd_config.c ++++ b/teamd/teamd_config.c +@@ -164,7 +164,7 @@ static int teamd_config_port_set(struct teamd_context *ctx, const char *port_nam + + tdport = teamd_get_port_by_ifname(ctx, port_name); + if (!tdport) +- return -ENODEV; ++ return 0; + + config = json_object_get(port_obj, "prio"); + if (json_is_integer(config)) { +-- +2.18.1 + diff --git a/SOURCES/libteam-teamd-tdport-has-to-exist-if-item-per_port-is-set-in.patch b/SOURCES/libteam-teamd-tdport-has-to-exist-if-item-per_port-is-set-in.patch new file mode 100644 index 0000000..c3acc57 --- /dev/null +++ b/SOURCES/libteam-teamd-tdport-has-to-exist-if-item-per_port-is-set-in.patch @@ -0,0 +1,42 @@ +From 4dc3a7a042c88193f0371a33f1043919843e6447 Mon Sep 17 00:00:00 2001 +From: Xin Long +Date: Mon, 1 Apr 2019 16:15:24 +0800 +Subject: [PATCH 2/3] teamd: tdport has to exist if item->per_port is set in + __find_by_item_path + +The issue can be reproduced by: + + # teamd -c '{"device":"team0", "runner":{"name":"lacp"}}' & + # teamdctl team0 state item set runner.aggregator.selected true + +teamd process will abort in lacp_port_state_aggregator_selected_set() +as gsc->info.tdport was set to NULL in teamd_state_item_value_set() + +The item 'runner.aggregator.selected' is of per_port = true, and it +shouldn't allow to call its setter/getter(). + +This patch is to add the check for it in __find_by_item_path() called +by teamd_state_item_value_get/set(). + +Fixes: 6c00aaf02553 ("teamd: add support for state item write operation") +Signed-off-by: Xin Long +Signed-off-by: Jiri Pirko +--- + teamd/teamd_state.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/teamd/teamd_state.c b/teamd/teamd_state.c +index ab64db9..0714880 100644 +--- a/teamd/teamd_state.c ++++ b/teamd/teamd_state.c +@@ -333,6 +333,7 @@ static int __find_by_item_path(struct teamd_state_val_item **p_item, + list_for_each_node_entry(item, &ctx->state_val_list, list) { + /* item->subpath[0] == '.' */ + if (!strcmp(item->subpath + 1, subpath) && ++ (!item->per_port || tdport) && + (!item->tdport || item->tdport == tdport)) { + *p_item = item; + *p_tdport = tdport; +-- +2.18.1 + diff --git a/SOURCES/libteam-teamd-use-enabled-option_changed-to-sync-enabled-to-.patch b/SOURCES/libteam-teamd-use-enabled-option_changed-to-sync-enabled-to-.patch new file mode 100644 index 0000000..b112156 --- /dev/null +++ b/SOURCES/libteam-teamd-use-enabled-option_changed-to-sync-enabled-to-.patch @@ -0,0 +1,76 @@ +From 90e5279ce0241838d5687739b3bc795235b7d53b Mon Sep 17 00:00:00 2001 +From: Xin Long +Date: Mon, 15 Apr 2019 16:56:35 +0800 +Subject: [PATCH 3/3] teamd: use enabled option_changed to sync enabled to + link_up for lb runner + +LiLiang found an issue that after adding two ports into a team device with +lb mode their enabled option sometimes is false. + +It was caused by the unexpected events order: + + 0. team_port_add() in kernel. + 1. port_change event A1 sent to userspace. + 2. option_change event B1 sent to userspace. + 3. port_change event A2 sent to userspace IF port is up now. + 4. process port_change event A1 and set port's enabled option 'false'. + 5. option_change event B2 sent to userspace. + 6. process option_change event B1 and sync enabled option (value = 1). + 7. process port_change event A2 and do nothing as enabled option is 1. + 8. process option_change event B2 and sync enabled option (value = 0). + +In kernel, when the port is still down after dev_open(), which happens more +often since it changed to use netif_oper_up() to check the state instead of +netif_carrier_ok(), the event A2 in Step 3 can be sent at any moment. When +it's ahead of Step 4, Step 7 won't set enabled option to 1 as Step 8 comes +late. + +As the port up event can be triggered by dev_watchdog at anytime in kernel, +the port_change and option_change events order can not be controlled. What +can only be done here is to correct it at Step 8, to sync enabled option to +link_up. + +So this patch is to add enabled option_changed for lb mode to do this sync. + +Reported-by: LiLiang +Signed-off-by: Xin Long +Signed-off-by: Jiri Pirko +--- + teamd/teamd_runner_loadbalance.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/teamd/teamd_runner_loadbalance.c b/teamd/teamd_runner_loadbalance.c +index b9bfc13..a581472 100644 +--- a/teamd/teamd_runner_loadbalance.c ++++ b/teamd/teamd_runner_loadbalance.c +@@ -109,12 +109,27 @@ static int lb_event_watch_port_hwaddr_changed(struct teamd_context *ctx, + return err; + } + ++static int lb_event_watch_enabled_option_changed(struct teamd_context *ctx, ++ struct team_option *option, ++ void *priv) ++{ ++ struct teamd_port *tdport; ++ ++ tdport = teamd_get_port(ctx, team_get_option_port_ifindex(option)); ++ if (!tdport) ++ return 0; ++ ++ return lb_event_watch_port_link_changed(ctx, tdport, priv); ++} ++ + static const struct teamd_event_watch_ops lb_port_watch_ops = { + .hwaddr_changed = lb_event_watch_hwaddr_changed, + .port_hwaddr_changed = lb_event_watch_port_hwaddr_changed, + .port_added = lb_event_watch_port_added, + .port_removed = lb_event_watch_port_removed, + .port_link_changed = lb_event_watch_port_link_changed, ++ .option_changed = lb_event_watch_enabled_option_changed, ++ .option_changed_match_name = "enabled", + }; + + static int lb_init(struct teamd_context *ctx, void *priv) +-- +2.18.1 + diff --git a/SOURCES/libteam-teamnl-update-help-message.patch b/SOURCES/libteam-teamnl-update-help-message.patch new file mode 100644 index 0000000..f9c3aa5 --- /dev/null +++ b/SOURCES/libteam-teamnl-update-help-message.patch @@ -0,0 +1,31 @@ +From 6e67aa89a746ff98d4b4f4fa3c778aa31d4d2c7f Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Mon, 17 Dec 2018 16:58:34 +0800 +Subject: [PATCH 1/6] teamnl: update help message + +Update help message so people could know we support port name directly. + +Signed-off-by: Hangbin Liu +Signed-off-by: Jiri Pirko +--- + utils/teamnl.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/utils/teamnl.c b/utils/teamnl.c +index e8de7e2..c53345d 100644 +--- a/utils/teamnl.c ++++ b/utils/teamnl.c +@@ -521,7 +521,9 @@ static void print_help(const char *argv0) { + + printf( + "%s [options] teamdevname command [command args]\n" +- "\t-h --help Show this help\n", ++ "\t-h --help Show this help\n" ++ "\t-p --port_name team slave port name\n" ++ "\t-a --array_index team option array index\n", + argv0); + printf("Commands:\n"); + for (i = 0; i < CMD_TYPE_COUNT; i++) { +-- +2.18.1 + diff --git a/SOURCES/libteam-utils-check-to_stdout-return-correctly-in-bond2team.patch b/SOURCES/libteam-utils-check-to_stdout-return-correctly-in-bond2team.patch deleted file mode 100644 index 0510959..0000000 --- a/SOURCES/libteam-utils-check-to_stdout-return-correctly-in-bond2team.patch +++ /dev/null @@ -1,38 +0,0 @@ -From eb3b18e87be7aab31bdfa51a882210b24596dc9d Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: -References: -From: Xin Long -Date: Fri, 27 Jul 2018 17:07:47 +0800 -Subject: [PATCHv2 2/2] utils: check to_stdout return correctly in bond2team - -to_stdout is a function, not a string, so fix the check on -its return in bond2team. - -v1->v2: - improve the coding style as Flavio suggested. - -Fixes: d5a1c8ee9e36 ("utils: add bond2team conversion tool") -Signed-off-by: Xin Long -Acked-by: Flavio Leitner -Signed-off-by: Jiri Pirko ---- - utils/bond2team | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/utils/bond2team b/utils/bond2team -index f8d46ef..fc81c4b 100755 ---- a/utils/bond2team -+++ b/utils/bond2team -@@ -623,7 +623,7 @@ team_ifcfg_write() - team_ifcfg_deliver() - { - pr_dbg "${FUNCNAME} $*" -- if [ ! to_stdout ]; then -+ if ! to_stdout; then - return 0 - fi - --- -2.1.0 - diff --git a/SPECS/libteam.spec b/SPECS/libteam.spec index e181176..450ee8b 100644 --- a/SPECS/libteam.spec +++ b/SPECS/libteam.spec @@ -1,21 +1,22 @@ Name: libteam -Version: 1.27 -Release: 10%{?dist} +Version: 1.28 +Release: 4%{?dist} Summary: Library for controlling team network device Group: System Environment/Libraries License: LGPLv2+ URL: http://www.libteam.org Source: http://www.libteam.org/files/libteam-%{version}.tar.gz -Patch1: libteam-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch -Patch2: libteam-teamd-add-port_hwaddr_changed-for-ab-runner.patch -Patch3: libteam-teamd-add-port_hwaddr_changed-for-lb-runner.patch -Patch4: libteam-teamd-add-port_hwaddr_changed-for-lacp-runner.patch -Patch5: libteam-man-fix-runner.sys_prio-default.patch -Patch6: libteam-configure.ac-Empty-LDFLAGS-before-checking-for-libnl.patch -Patch7: libteam-libteam-don-t-crash-when-trying-to-print-unregistere.patch -Patch8: libteam-binding-python-use-SWIG_FromCharPtrAndSize-for-Pytho.patch -Patch9: libteam-utils-check-to_stdout-return-correctly-in-bond2team.patch -Patch10: libteam-teamd-add-port_master_ifindex_changed-for-teamd_even.patch +Patch1: libteam-teamnl-update-help-message.patch +Patch2: libteam-teamd-config-update-local-prio-to-kernel.patch +Patch3: libteam-teamd-lw-arp_ping-only-check-arp-reply-message.patch +Patch4: libteam-teamd-lw-nsna_ping-only-send-ns-on-enabled-port.patch +Patch5: libteam-man-fix-runner.min_ports-default-value.patch +Patch6: libteam-teamd-lacp-update-port-state-according-to-partner-s-.patch +Patch7: libteam-teamd-remove-port-if-adding-fails.patch +Patch8: libteam-teamd-tdport-has-to-exist-if-item-per_port-is-set-in.patch +Patch9: libteam-teamd-use-enabled-option_changed-to-sync-enabled-to-.patch +Patch10: libteam-teamd-return-0-if-tdport-doesn-t-exist-in-teamd_conf.patch +Patch11: libteam-teamd-improve-the-error-output-for-non-integer-port-.patch BuildRequires: jansson-devel BuildRequires: libdaemon-devel BuildRequires: libnl3-devel @@ -174,6 +175,32 @@ cd binding/python %{_sysconfdir}/sysconfig/network-scripts/ifdown-TeamPort %changelog +* Mon Jul 15 2019 Xin Long - 1.28-4 +- gating: run VM with more RAM [1722449] +* Wed Jul 03 2019 Xin Long - 1.28-3 +- teamd: return 0 if tdport doesn't exist in teamd_config_port_set [1722449] +- teamd: improve the error output for non-integer port prio +* Mon Apr 29 2019 Xin Long - 1.28-2 +- teamd: use enabled option_changed to sync enabled to link_up for lb runner [1668132] +- teamd: tdport has to exist if item->per_port is set in __find_by_item_path [1687336] +- teamd: remove port if adding fails [1668744] +* Wed Apr 17 2019 Xin Long - 1.28-1 +- teamd: lacp: update port state according to partner's sync bit +- man: fix runner.min_ports default value [1679853] +- teamd: lw: nsna_ping: only send ns on enabled port [1671195] +- teamd: lw: arp_ping: only check arp reply message [1663093] +- teamd: config: update local prio to kernel [1657113] +- teamnl: update help message +- 1.28 release +- teamd: lacp: send LACPDU when port state transitions from DEFAULT to CURRENT +- man teamd.conf: Document ARP Ping link_watch.vlanid option +- man teamd.conf: fix indentation of link_watch.send_always +- libteam/options: fix s32/u32 data storage on big endian +- teamd: add an option to force log output to stdout, stderr or syslog +- teamd: add port_master_ifindex_changed for teamd_event_watch_ops +- man: add 'random' to the list of available runners +- examples: fix duplex comparison against best port + * Thu Jan 10 2019 Xin Long - 1.27-10 - add new package network-scripts-team [1659846]