Hello community, here is the log from the commit of package libteam for openSUSE:Factory checked in at 2020-09-03 01:07:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libteam (Old) and /work/SRC/openSUSE:Factory/.libteam.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libteam" Thu Sep 3 01:07:33 2020 rev:20 rq:829586 version:1.31 Changes: -------- --- /work/SRC/openSUSE:Factory/libteam/libteam.changes 2019-08-27 15:54:01.307681740 +0200 +++ /work/SRC/openSUSE:Factory/.libteam.new.3399/libteam.changes 2020-09-03 01:07:39.088336935 +0200 @@ -1,0 +2,11 @@ +Tue Aug 25 15:45:19 UTC 2020 - Dirk Mueller <[email protected]> + +- update to 1.31: + * teamd: fix build error in expansion of macro teamd_log_dbgx + * teamd/lacp: fix segfault due to NULL pointer dereference + * teamd: fix possible race in master ifname callback + * Fix ifinfo_link_with_port race condition with newlink + * Skip setting the same hwaddr to a lag port if not needed + * teamd/lacp: silence ignore none LACP frames + +------------------------------------------------------------------- Old: ---- libteam-1.29.tar.gz New: ---- libteam-1.31.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libteam.spec ++++++ --- /var/tmp/diff_new_pack.sw12RX/_old 2020-09-03 01:07:41.256337658 +0200 +++ /var/tmp/diff_new_pack.sw12RX/_new 2020-09-03 01:07:41.256337658 +0200 @@ -18,7 +18,7 @@ %bcond_without python2 Name: libteam -Version: 1.29 +Version: 1.31 Release: 0 Summary: Utilities for controlling 802.1AX team network device License: LGPL-2.1+ ++++++ libteam-1.29.tar.gz -> libteam-1.31.tar.gz ++++++ ++++ 4387 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/configure.ac new/libteam-1.31/configure.ac --- old/libteam-1.29/configure.ac 2019-07-02 15:41:37.000000000 +0200 +++ new/libteam-1.31/configure.ac 2020-07-26 11:56:44.000000000 +0200 @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([libteam], [1.29], [[email protected]]) +AC_INIT([libteam], [1.31], [[email protected]]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) @@ -24,7 +24,7 @@ # release, then set age to 0. AC_SUBST(LIBTEAM_CURRENT, 11) -AC_SUBST(LIBTEAM_REVISION, 0) +AC_SUBST(LIBTEAM_REVISION, 1) AC_SUBST(LIBTEAM_AGE, 6) AC_SUBST(LIBTEAMDCTL_CURRENT, 1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/libteam/ifinfo.c new/libteam-1.31/libteam/ifinfo.c --- old/libteam-1.29/libteam/ifinfo.c 2018-12-09 09:57:18.000000000 +0100 +++ new/libteam-1.31/libteam/ifinfo.c 2020-04-03 09:40:45.000000000 +0200 @@ -453,7 +453,10 @@ { struct team_ifinfo *ifinfo; - ifinfo = ifinfo_find(th, ifindex); + if (port) + ifinfo = ifinfo_find_create(th, ifindex); + else + ifinfo = ifinfo_find(th, ifindex); if (!ifinfo) return -ENOENT; if (ifinfo->linked) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/libteam/libteam.c new/libteam-1.31/libteam/libteam.c --- old/libteam-1.29/libteam/libteam.c 2019-05-28 14:36:18.000000000 +0200 +++ new/libteam-1.31/libteam/libteam.c 2020-04-25 08:05:38.000000000 +0200 @@ -600,12 +600,24 @@ return -errno; } - err = nl_socket_set_buffer_size(th->nl_sock, NETLINK_RCVBUF, 0); + env = getenv("TEAM_EVENT_BUFSIZE"); + if (env) { + eventbufsize = strtol(env, NULL, 10); + /* ignore other errors, libnl forces minimum 32k and + * too large values are truncated to system rmem_max + */ + if (eventbufsize < 0) + eventbufsize = 0; + } else { + eventbufsize = NETLINK_RCVBUF; + } + + err = nl_socket_set_buffer_size(th->nl_sock, eventbufsize, 0); if (err) { err(th, "Failed to set buffer size of netlink sock."); return -nl2syserr(err); } - err = nl_socket_set_buffer_size(th->nl_sock_event, NETLINK_RCVBUF, 0); + err = nl_socket_set_buffer_size(th->nl_sock_event, eventbufsize, 0); if (err) { err(th, "Failed to set buffer size of netlink event sock."); return -nl2syserr(err); @@ -640,18 +652,6 @@ nl_cli_connect(th->nl_cli.sock_event, NETLINK_ROUTE); nl_socket_set_nonblocking(th->nl_cli.sock_event); - env = getenv("TEAM_EVENT_BUFSIZE"); - if (env) { - eventbufsize = strtol(env, NULL, 10); - /* ignore other errors, libnl forces minimum 32k and - * too large values are truncated to system rmem_max - */ - if (eventbufsize < 0) - eventbufsize = 0; - } else { - eventbufsize = NETLINK_RCVBUF; - } - err = nl_socket_set_buffer_size(th->nl_cli.sock_event, eventbufsize, 0); if (err) { err(th, "Failed to set cli event socket buffer size."); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/man/teamd.conf.5 new/libteam-1.31/man/teamd.conf.5 --- old/libteam-1.29/man/teamd.conf.5 2019-05-02 08:42:05.000000000 +0200 +++ new/libteam-1.31/man/teamd.conf.5 2020-01-09 15:42:51.000000000 +0100 @@ -42,6 +42,9 @@ .PP .BR "lacp "\(em Implements 802.3ad LACP protocol. Can use same Tx port selection possibilities as loadbalance runner. +.PP +Default: +.BR "roundrobin" .RE .TP .BR "notify_peers.count " (int) @@ -182,6 +185,10 @@ .PP .BR "l4 "\(em Uses source and destination TCP and UDP and SCTP ports. +.PP +Default: +.B +["eth", "ipv4", "ipv6"] .RE .TP .BR "runner.tx_balancer.name " (string) @@ -217,6 +224,11 @@ Option specifies the rate at which our link partner is asked to transmit LACPDU packets. If this is .BR "true" then packets will be sent once per second. Otherwise they will be sent every 30 seconds. +.RS 7 +.PP +Default: +.BR "false" +.RE .TP .BR "runner.tx_hash " (array) Same as for load balance runner. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd.c new/libteam-1.31/teamd/teamd.c --- old/libteam-1.29/teamd/teamd.c 2018-12-09 09:57:18.000000000 +0100 +++ new/libteam-1.31/teamd/teamd.c 2020-05-22 17:01:28.000000000 +0200 @@ -265,6 +265,10 @@ teamd_log_err("read() failed."); return -errno; } + if (ret == 0) { + teamd_log_warn("read() for timer_fd returned 0."); + return 0; + } if (ret != sizeof(uint64_t)) { teamd_log_err("read() returned unexpected number of bytes."); return -EINVAL; @@ -332,7 +336,7 @@ if (err) { teamd_log_warn("Loop callback failed with: %s", strerror(-err)); - teamd_log_dbg("Failed loop callback: %s, %p", + teamd_log_dbg(ctx, "Failed loop callback: %s, %p", lcb->name, lcb->priv); } } @@ -519,7 +523,7 @@ list_add_tail(&ctx->run_loop.callback_list, &lcb->list); else list_add(&ctx->run_loop.callback_list, &lcb->list); - teamd_log_dbg("Added loop callback: %s, %p", lcb->name, lcb->priv); + teamd_log_dbg(ctx, "Added loop callback: %s, %p", lcb->name, lcb->priv); return 0; lcb_free: @@ -636,7 +640,7 @@ list_del(&lcb->list); if (lcb->is_period) close(lcb->fd); - teamd_log_dbg("Removed loop callback: %s, %p", + teamd_log_dbg(ctx, "Removed loop callback: %s, %p", lcb->name, lcb->priv); free(lcb->name); free(lcb); @@ -645,7 +649,7 @@ if (found) teamd_run_loop_restart(ctx); else - teamd_log_dbg("Callback named \"%s\" not found.", cb_name); + teamd_log_dbg(ctx, "Callback named \"%s\" not found.", cb_name); } int teamd_loop_callback_enable(struct teamd_context *ctx, const char *cb_name, @@ -820,7 +824,7 @@ if (err) return 0; /* addr is not defined in config, no change needed */ - teamd_log_dbg("Hwaddr string: \"%s\".", hwaddr_str); + teamd_log_dbg(ctx, "Hwaddr string: \"%s\".", hwaddr_str); err = parse_hwaddr(hwaddr_str, &hwaddr, &hwaddr_len); if (err) { teamd_log_err("Failed to parse hardware address."); @@ -833,7 +837,14 @@ err = -EINVAL; goto free_hwaddr; } - err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); + + if (memcmp(hwaddr, ctx->hwaddr, hwaddr_len)) + err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); + else { + err = 0; + teamd_log_dbg(ctx, "Skip setting same hwaddr string: \"%s\".", hwaddr_str); + } + if (!err) ctx->hwaddr_explicit = true; free_hwaddr: @@ -867,7 +878,7 @@ static int teamd_hwaddr_check_change(struct teamd_context *ctx, struct teamd_port *tdport) { - const char *hwaddr; + char *hwaddr; unsigned char hwaddr_len; int err; @@ -885,6 +896,8 @@ teamd_log_err("Failed to set team device hardware address."); return err; } + memcpy(ctx->hwaddr, hwaddr, hwaddr_len); + ctx->hwaddr_len = hwaddr_len; return 0; } @@ -953,16 +966,16 @@ err = teamd_config_string_get(ctx, &runner_name, "$.runner.name"); if (err) { - teamd_log_dbg("Failed to get team runner name from config."); + teamd_log_dbg(ctx, "Failed to get team runner name from config."); runner_name = TEAMD_DEFAULT_RUNNER_NAME; err = teamd_config_string_set(ctx, runner_name, "$.runner.name"); if (err) { teamd_log_err("Failed to set default team runner name in config."); return err; } - teamd_log_dbg("Using default team runner \"%s\".", runner_name); + teamd_log_dbg(ctx, "Using default team runner \"%s\".", runner_name); } else { - teamd_log_dbg("Using team runner \"%s\".", runner_name); + teamd_log_dbg(ctx, "Using team runner \"%s\".", runner_name); } ctx->runner = teamd_find_runner(runner_name); if (!ctx->runner) { @@ -1108,12 +1121,12 @@ char buf[120]; bool trunc; - teamd_log_dbg("<port_list>"); + teamd_log_dbg(ctx, "<port_list>"); team_for_each_port(port, ctx->th) { trunc = team_port_str(port, buf, sizeof(buf)); - teamd_log_dbg("%s %s", buf, trunc ? "<trunc>" : ""); + teamd_log_dbg(ctx, "%s %s", buf, trunc ? "<trunc>" : ""); } - teamd_log_dbg("</port_list>"); + teamd_log_dbg(ctx, "</port_list>"); } static void debug_log_option_list(struct teamd_context *ctx) @@ -1139,12 +1152,12 @@ char buf[120]; bool trunc; - teamd_log_dbg("<ifinfo_list>"); + teamd_log_dbg(ctx, "<ifinfo_list>"); team_for_each_ifinfo(ifinfo, ctx->th) { trunc = team_ifinfo_str(ifinfo, buf, sizeof(buf)); - teamd_log_dbg("%s %s", buf, trunc ? "<trunc>" : ""); + teamd_log_dbg(ctx, "%s %s", buf, trunc ? "<trunc>" : ""); } - teamd_log_dbg("</ifinfo_list>"); + teamd_log_dbg(ctx, "</ifinfo_list>"); } static int debug_change_handler_func(struct team_handle *th, void *priv, @@ -1573,7 +1586,7 @@ if (err) return err; } while (ifindex); - teamd_log_dbg("Generated team device name \"%s\".", buf); + teamd_log_dbg(ctx, "Generated team device name \"%s\".", buf); ctx->team_devname = strdup(buf); if (!ctx->team_devname) @@ -1597,7 +1610,7 @@ } goto skip_set; } else { - teamd_log_dbg("Failed to get team device name from config."); + teamd_log_dbg(ctx, "Failed to get team device name from config."); if (generate_enabled) { err = teamd_generate_devname(ctx); if (err) { @@ -1617,7 +1630,7 @@ } skip_set: - teamd_log_dbg("Using team device \"%s\".", ctx->team_devname); + teamd_log_dbg(ctx, "Using team device \"%s\".", ctx->team_devname); err = asprintf(&ctx->ident, "%s_%s", ctx->argv0, ctx->team_devname); if (err == -1) { @@ -1835,9 +1848,9 @@ daemon_log_ident = ctx->ident; daemon_pid_file_proc = teamd_pid_file_proc; - teamd_log_dbg("Using PID file \"%s\"", daemon_pid_file_proc()); + teamd_log_dbg(ctx, "Using PID file \"%s\"", daemon_pid_file_proc()); if (ctx->config_file) - teamd_log_dbg("Using config file \"%s\"", ctx->config_file); + teamd_log_dbg(ctx, "Using config file \"%s\"", ctx->config_file); switch (ctx->cmd) { case DAEMON_CMD_HELP: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd.h new/libteam-1.31/teamd/teamd.h --- old/libteam-1.29/teamd/teamd.h 2018-12-09 09:57:18.000000000 +0100 +++ new/libteam-1.31/teamd/teamd.h 2020-02-04 18:16:36.000000000 +0100 @@ -49,15 +49,15 @@ #define teamd_log_err(args...) daemon_log(LOG_ERR, ##args) #define teamd_log_warn(args...) daemon_log(LOG_WARNING, ##args) #define teamd_log_info(args...) daemon_log(LOG_INFO, ##args) -#define teamd_log_dbg(args...) daemon_log(LOG_DEBUG, ##args) #define teamd_log_dbgx(ctx, val, args...) \ - if (val <= ctx->debug) \ - daemon_log(LOG_DEBUG, ##args) + ({ if (val <= ctx->debug) daemon_log(LOG_DEBUG, ##args); }) + +#define teamd_log_dbg(ctx, args...) teamd_log_dbgx(ctx, 1, ##args) static inline void TEAMD_BUG(void) { - teamd_log_dbg("BUG: %s:%d\n", __FILE__, __LINE__); + daemon_log(LOG_DEBUG, "BUG: %s:%d\n", __FILE__, __LINE__); assert(0); } @@ -325,6 +325,8 @@ void teamd_port_obj_remove_all(struct teamd_context *ctx); int teamd_port_enabled(struct teamd_context *ctx, struct teamd_port *tdport, bool *enabled); +int teamd_port_enabled_check(struct teamd_context *ctx, + struct teamd_port *tdport, bool *enabled); int teamd_port_prio(struct teamd_context *ctx, struct teamd_port *tdport); int teamd_port_check_enable(struct teamd_context *ctx, struct teamd_port *tdport, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_balancer.c new/libteam-1.31/teamd/teamd_balancer.c --- old/libteam-1.29/teamd/teamd_balancer.c 2018-12-09 09:57:18.000000000 +0100 +++ new/libteam-1.31/teamd/teamd_balancer.c 2020-01-09 15:42:51.000000000 +0100 @@ -174,12 +174,14 @@ } } -static int tb_hash_to_port_remap(struct team_handle *th, +static int tb_hash_to_port_remap(struct teamd_balancer *tb, + struct team_handle *th, struct tb_hash_info *tbhi, struct tb_port_info *tbpi) { struct team_option *option; struct teamd_port *new_tdport = tbpi->tdport; + struct teamd_context *ctx = tb->ctx; uint8_t hash = tbhi->hash; int err; @@ -192,7 +194,7 @@ err = team_set_option_value_u32(th, option, new_tdport->ifindex); if (err) return err; - teamd_log_dbg("Remapped hash \"%u\" (delta %" PRIu64 ") to port %s.", + teamd_log_dbg(ctx, "Remapped hash \"%u\" (delta %" PRIu64 ") to port %s.", hash, tb_stats_get_delta(&tbhi->stats), new_tdport->ifname); return 0; @@ -203,6 +205,7 @@ int err; struct tb_hash_info *tbhi; struct tb_port_info *tbpi; + struct teamd_context *ctx = tb->ctx; if (!tb->tx_balancing_enabled) return 0; @@ -216,7 +219,7 @@ tbhi->rebalance.processed = true; continue; } - err = tb_hash_to_port_remap(th, tbhi, tbpi); + err = tb_hash_to_port_remap(tb, th, tbhi, tbpi); if (err) { tbpi->rebalance.unusable = true; continue; @@ -228,7 +231,7 @@ list_for_each_node_entry(tbpi, &tb->port_info_list, list) { if (tbpi->rebalance.unusable) continue; - teamd_log_dbg("Port %s rebalanced, delta: %" PRIu64, + teamd_log_dbg(ctx, "Port %s rebalanced, delta: %" PRIu64, tbpi->tdport->ifname, tbpi->rebalance.bytes); } return 0; @@ -303,7 +306,7 @@ array_index); return -EINVAL; } - teamd_log_dbg("stats update for hash \"%u\": \"%" PRIu64 "\".", + teamd_log_dbg(ctx, "stats update for hash \"%u\": \"%" PRIu64 "\".", array_index, lb_stats->tx_bytes); tb_stats_update_hash(tb, array_index, lb_stats->tx_bytes); @@ -319,7 +322,7 @@ port_ifindex); return -EINVAL; } - teamd_log_dbg("stats update for port %s: \"%" PRIu64 "\".", + teamd_log_dbg(ctx, "stats update for port %s: \"%" PRIu64 "\".", tdport->ifname, lb_stats->tx_bytes); tb_stats_update_port(tb, tdport, lb_stats->tx_bytes); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_dbus.c new/libteam-1.31/teamd/teamd_dbus.c --- old/libteam-1.29/teamd/teamd_dbus.c 2018-12-09 09:57:18.000000000 +0100 +++ new/libteam-1.31/teamd/teamd_dbus.c 2020-01-09 15:42:51.000000000 +0100 @@ -178,7 +178,7 @@ msg_interface = dbus_message_get_interface(message); if (!method || !path || !msg_interface) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - teamd_log_dbg("dbus: %s.%s (%s)", msg_interface, method, path); + teamd_log_dbg(ctx, "dbus: %s.%s (%s)", msg_interface, method, path); if (!strcmp(method, "Introspect") && !strcmp(msg_interface, "org.freedesktop.DBus.Introspectable")) { @@ -504,7 +504,7 @@ if (err) goto iface_fini; id = dbus_connection_get_server_id(ctx->dbus.con), - teamd_log_dbg("dbus: connected to %s with name %s", id, + teamd_log_dbg(ctx, "dbus: connected to %s with name %s", id, dbus_bus_get_unique_name(ctx->dbus.con)); dbus_free(id); return 0; @@ -541,7 +541,7 @@ err = dbus_bus_request_name(ctx->dbus.con, service_name, 0, &error); if (err == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - teamd_log_dbg("dbus: have name %s", service_name); + teamd_log_dbg(ctx, "dbus: have name %s", service_name); err = 0; } else if (dbus_error_is_set(&error)) { teamd_log_err("dbus: Failed to acquire %s: %s: %s", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_hash_func.c new/libteam-1.31/teamd/teamd_hash_func.c --- old/libteam-1.29/teamd/teamd_hash_func.c 2018-12-09 09:57:18.000000000 +0100 +++ new/libteam-1.31/teamd/teamd_hash_func.c 2020-01-09 15:42:51.000000000 +0100 @@ -170,7 +170,7 @@ int err; if (!teamd_config_path_exists(ctx, "$.runner.tx_hash")) { - teamd_log_dbg("No Tx hash recipe found in config."); + teamd_log_dbg(ctx, "No Tx hash recipe found in config."); err = teamd_hash_func_add_default_frags(ctx); if (err) return err; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_link_watch.c new/libteam-1.31/teamd/teamd_link_watch.c --- old/libteam-1.29/teamd/teamd_link_watch.c 2019-07-02 12:09:40.000000000 +0200 +++ new/libteam-1.31/teamd/teamd_link_watch.c 2020-02-04 18:16:36.000000000 +0100 @@ -281,7 +281,7 @@ err = team_get_port_user_linkup(ctx->th, tdport->ifindex, &linkup); if (!err) { - teamd_log_dbg("%s: Current user link state is \"%s\".", + teamd_log_dbg(ctx, "%s: Current user link state is \"%s\".", tdport->ifname, linkup ? "up" : "down"); } @@ -351,7 +351,7 @@ cpcookie = teamd_config_path_cookie_get(ctx, "$.ports.%s.link_watch", tdport->ifname); if (cpcookie) { - teamd_log_dbg("%s: Got link watch from port config.", + teamd_log_dbg(ctx, "%s: Got link watch from port config.", tdport->ifname); err = link_watch_load_config(ctx, tdport, cpcookie); if (err) @@ -360,7 +360,7 @@ cpcookie = teamd_config_path_cookie_get(ctx, "$.link_watch"); if (cpcookie) { - teamd_log_dbg("%s: Got link watch from global config.", + teamd_log_dbg(ctx, "%s: Got link watch from global config.", tdport->ifname); err = link_watch_load_config(ctx, tdport, cpcookie); if (err) @@ -380,7 +380,7 @@ tdport->ifname); return err; } - teamd_log_dbg("%s: Using implicit link watch.", tdport->ifname); + teamd_log_dbg(ctx, "%s: Using implicit link watch.", tdport->ifname); return link_watch_event_watch_port_added(ctx, tdport, priv); } return 0; @@ -423,9 +423,16 @@ int err; teamd_for_each_tdport(tdport, ctx) { - err = teamd_port_enabled(ctx, tdport, &port_enabled); - if (err) - return err; + err = teamd_port_enabled_check(ctx, tdport, &port_enabled); + if (err) { + /* Looks like the options are not ready for this port. + * This can happen when called from + * link_watch_port_master_ifindex_changed(). Skip this + * for now, let it be handled by future call of + * link_watch_enabled_option_changed(). + */ + continue; + } __set_forced_send_for_port(tdport, port_enabled); if (port_enabled) enabled_port_count++; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_lw_arp_ping.c new/libteam-1.31/teamd/teamd_lw_arp_ping.c --- old/libteam-1.29/teamd/teamd_lw_arp_ping.c 2019-01-14 19:07:41.000000000 +0100 +++ new/libteam-1.31/teamd/teamd_lw_arp_ping.c 2020-01-09 15:42:51.000000000 +0100 @@ -178,7 +178,7 @@ * If source_host is not provided, just use address 0.0.0.0 according * to RFC 5227 (IPv4 Address Conflict Detection). */ - teamd_log_dbg("source address \"%s\".", + teamd_log_dbg(ctx, "source address \"%s\".", str_in_addr(&ap_ppriv->src)); err = teamd_config_string_get(ctx, &host, "@.target_host", cpcookie); @@ -189,25 +189,25 @@ err = set_in_addr(&ap_ppriv->dst, host); if (err) return err; - teamd_log_dbg("target address \"%s\".", str_in_addr(&ap_ppriv->dst)); + teamd_log_dbg(ctx, "target address \"%s\".", str_in_addr(&ap_ppriv->dst)); err = teamd_config_bool_get(ctx, &ap_ppriv->validate_active, "@.validate_active", cpcookie); if (err) ap_ppriv->validate_active = false; - teamd_log_dbg("validate_active \"%d\".", ap_ppriv->validate_active); + teamd_log_dbg(ctx, "validate_active \"%d\".", ap_ppriv->validate_active); err = teamd_config_bool_get(ctx, &ap_ppriv->validate_inactive, "@.validate_inactive", cpcookie); if (err) ap_ppriv->validate_inactive = false; - teamd_log_dbg("validate_inactive \"%d\".", ap_ppriv->validate_inactive); + teamd_log_dbg(ctx, "validate_inactive \"%d\".", ap_ppriv->validate_inactive); err = teamd_config_bool_get(ctx, &ap_ppriv->send_always, "@.send_always", cpcookie); if (err) ap_ppriv->send_always = false; - teamd_log_dbg("send_always \"%d\".", ap_ppriv->send_always); + teamd_log_dbg(ctx, "send_always \"%d\".", ap_ppriv->send_always); err = teamd_config_int_get(ctx, &tmp, "@.vlanid", cpcookie); if (!err) { @@ -217,7 +217,7 @@ } ap_ppriv->vlanid_in_use = true; ap_ppriv->vlanid = tmp; - teamd_log_dbg("vlan id \"%u\".", ap_ppriv->vlanid); + teamd_log_dbg(ctx, "vlan id \"%u\".", ap_ppriv->vlanid); } return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_lw_ethtool.c new/libteam-1.31/teamd/teamd_lw_ethtool.c --- old/libteam-1.29/teamd/teamd_lw_ethtool.c 2018-12-09 09:57:18.000000000 +0100 +++ new/libteam-1.31/teamd/teamd_lw_ethtool.c 2020-01-09 15:42:51.000000000 +0100 @@ -115,7 +115,7 @@ teamd_log_err("\"delay_up\" must not be negative number."); return -EINVAL; } - teamd_log_dbg("delay_up \"%d\".", tmp); + teamd_log_dbg(ctx, "delay_up \"%d\".", tmp); ms_to_timespec(ðtool_ppriv->delay_up, tmp); } err = teamd_config_int_get(ctx, &tmp, "@.delay_down", cpcookie); @@ -124,7 +124,7 @@ teamd_log_err("\"delay_down\" must not be negative number."); return -EINVAL; } - teamd_log_dbg("delay_down \"%d\".", tmp); + teamd_log_dbg(ctx, "delay_down \"%d\".", tmp); ms_to_timespec(ðtool_ppriv->delay_down, tmp); } return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_lw_nsna_ping.c new/libteam-1.31/teamd/teamd_lw_nsna_ping.c --- old/libteam-1.29/teamd/teamd_lw_nsna_ping.c 2019-03-08 12:58:42.000000000 +0100 +++ new/libteam-1.31/teamd/teamd_lw_nsna_ping.c 2020-01-09 15:42:51.000000000 +0100 @@ -175,7 +175,7 @@ err = set_sockaddr_in6(&nsnap_ppriv->dst, host); if (err) return err; - teamd_log_dbg("target address \"%s\".", + teamd_log_dbg(ctx, "target address \"%s\".", str_sockaddr_in6(&nsnap_ppriv->dst)); return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_lw_psr.c new/libteam-1.31/teamd/teamd_lw_psr.c --- old/libteam-1.29/teamd/teamd_lw_psr.c 2019-05-02 08:42:05.000000000 +0200 +++ new/libteam-1.31/teamd/teamd_lw_psr.c 2020-01-09 15:42:51.000000000 +0100 @@ -46,7 +46,7 @@ } else { psr_ppriv->missed++; if (psr_ppriv->missed > psr_ppriv->missed_max && link_up) { - teamd_log_dbg("%s: Missed %u replies (max %u).", + teamd_log_dbg(ctx, "%s: Missed %u replies (max %u).", tdport->ifname, psr_ppriv->missed, psr_ppriv->missed_max); link_up = false; @@ -86,7 +86,7 @@ } else { tmp = LW_PSR_DEFAULT_INTERVAL; } - teamd_log_dbg("interval \"%d\".", tmp); + teamd_log_dbg(ctx, "interval \"%d\".", tmp); ms_to_timespec(&psr_ppriv->interval, tmp); err = teamd_config_int_get(ctx, &tmp, "@.init_wait", cpcookie); @@ -95,7 +95,7 @@ /* if init_wait is set to 0, use default_init_wait */ if (err || !tmp) psr_ppriv->init_wait = lw_psr_default_init_wait; - teamd_log_dbg("init_wait \"%d\".", timespec_to_ms(&psr_ppriv->init_wait)); + teamd_log_dbg(ctx, "init_wait \"%d\".", timespec_to_ms(&psr_ppriv->init_wait)); err = teamd_config_int_get(ctx, &tmp, "@.missed_max", cpcookie); if (!err) { @@ -106,7 +106,7 @@ } else { tmp = LW_PSR_DEFAULT_MISSED_MAX; } - teamd_log_dbg("missed_max \"%d\".", tmp); + teamd_log_dbg(ctx, "missed_max \"%d\".", tmp); psr_ppriv->missed_max = tmp; return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_lw_tipc.c new/libteam-1.31/teamd/teamd_lw_tipc.c --- old/libteam-1.29/teamd/teamd_lw_tipc.c 2018-12-09 09:57:18.000000000 +0100 +++ new/libteam-1.31/teamd/teamd_lw_tipc.c 2020-01-09 15:42:51.000000000 +0100 @@ -88,8 +88,8 @@ if (strcmp(link->name, lnr->linkname)) continue; link->up = link_up; - teamd_log_dbg("tipc: link <%s> went %s.", - lnr->linkname, link_up ? "up" : "down"); + teamd_log_dbg(ctx, "tipc: link <%s> went %s.", + lnr->linkname, link_up ? "up" : "down"); check: path_ok = lw_tipc_topology_check(priv, link->peer); return teamd_link_watch_check_link_up(ctx, ppriv->tdport, ppriv, @@ -100,7 +100,7 @@ lnr->linkname); return -EINVAL; } - teamd_log_dbg("tipc: established new link <%s>", lnr->linkname); + teamd_log_dbg(ctx, "tipc: established new link <%s>", lnr->linkname); link = malloc(sizeof(struct tipc_link)); if (!link) return -ENOMEM; @@ -153,7 +153,7 @@ else if (event.event == htonl(TIPC_WITHDRAWN)) return lw_tipc_link_state_change(ctx, &lnr, tipc_ppriv, false); tipc_cb_err: - teamd_log_dbg("tipc: link state event error"); + teamd_log_dbg(ctx, "tipc: link state event error"); return -EINVAL; } @@ -234,7 +234,7 @@ struct lw_tipc_port_priv *tipc_ppriv = priv; struct tipc_link *link; - teamd_log_dbg("tipc port removed\n"); + teamd_log_dbg(ctx, "tipc port removed\n"); teamd_loop_callback_del(ctx, LW_TIPC_TOPSRV_SOCKET, priv); close(tipc_ppriv->topsrv_sock); while (!LIST_EMPTY(&tipc_ppriv->links)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_per_port.c new/libteam-1.31/teamd/teamd_per_port.c --- old/libteam-1.29/teamd/teamd_per_port.c 2019-04-17 09:33:18.000000000 +0200 +++ new/libteam-1.31/teamd/teamd_per_port.c 2020-02-04 18:16:36.000000000 +0100 @@ -340,7 +340,7 @@ uint32_t ifindex; ifindex = team_ifname2ifindex(ctx->th, port_name); - teamd_log_dbg("%s: Adding port (found ifindex \"%d\").", + teamd_log_dbg(ctx, "%s: Adding port (found ifindex \"%d\").", port_name, ifindex); return team_port_add(ctx->th, ifindex); } @@ -350,7 +350,7 @@ { int err; - teamd_log_dbg("%s: Removing port (found ifindex \"%d\").", + teamd_log_dbg(ctx, "%s: Removing port (found ifindex \"%d\").", tdport->ifname, tdport->ifindex); err = team_port_remove(ctx->th, tdport->ifindex); if (err) @@ -389,19 +389,21 @@ return teamd_port_remove(ctx, tdport); } -int teamd_port_enabled(struct teamd_context *ctx, struct teamd_port *tdport, - bool *enabled) +int __teamd_port_enabled(struct teamd_context *ctx, struct teamd_port *tdport, + bool *enabled, bool may_fail) { struct team_option *option; option = team_get_option(ctx->th, "np", "enabled", tdport->ifindex); if (!option) { - teamd_log_err("%s: Failed to find \"enabled\" option.", - tdport->ifname); + if (!may_fail) + teamd_log_err("%s: Failed to find \"enabled\" option.", + tdport->ifname); return -ENOENT; } if (team_get_option_type(option) != TEAM_OPTION_TYPE_BOOL) { - teamd_log_err("Unexpected type of \"enabled\" option."); + if (!may_fail) + teamd_log_err("Unexpected type of \"enabled\" option."); return -EINVAL; } @@ -409,6 +411,18 @@ return 0; } +int teamd_port_enabled(struct teamd_context *ctx, struct teamd_port *tdport, + bool *enabled) +{ + return __teamd_port_enabled(ctx, tdport, enabled, false); +} + +int teamd_port_enabled_check(struct teamd_context *ctx, + struct teamd_port *tdport, bool *enabled) +{ + return __teamd_port_enabled(ctx, tdport, enabled, true); +} + int teamd_port_prio(struct teamd_context *ctx, struct teamd_port *tdport) { int prio; @@ -428,23 +442,19 @@ bool should_enable, bool should_disable) { bool new_enabled_state; - bool curr_enabled_state; int err; if (!teamd_port_present(ctx, tdport)) return 0; - err = teamd_port_enabled(ctx, tdport, &curr_enabled_state); - if (err) - return err; - if (!curr_enabled_state && should_enable) + if (should_enable) new_enabled_state = true; - else if (curr_enabled_state && should_disable) + else if (should_disable) new_enabled_state = false; else return 0; - teamd_log_dbg("%s: %s port", tdport->ifname, + teamd_log_dbg(ctx, "%s: %s port", tdport->ifname, new_enabled_state ? "Enabling": "Disabling"); err = team_set_port_enabled(ctx->th, tdport->ifindex, new_enabled_state); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_runner_activebackup.c new/libteam-1.31/teamd/teamd_runner_activebackup.c --- old/libteam-1.29/teamd/teamd_runner_activebackup.c 2018-12-09 09:57:18.000000000 +0100 +++ new/libteam-1.31/teamd/teamd_runner_activebackup.c 2020-01-09 15:42:51.000000000 +0100 @@ -255,7 +255,7 @@ ab->active_ifindex = 0; if (!tdport || !teamd_port_present(ctx, tdport)) return 0; - teamd_log_dbg("Clearing active port \"%s\".", tdport->ifname); + teamd_log_dbg(ctx, "Clearing active port \"%s\".", tdport->ifname); err = team_set_port_enabled(ctx->th, tdport->ifindex, false); if (err) { @@ -368,7 +368,7 @@ active_tdport = teamd_get_port(ctx, ab->active_ifindex); if (active_tdport) { - teamd_log_dbg("Current active port: \"%s\" (ifindex \"%d\", prio \"%d\").", + teamd_log_dbg(ctx, "Current active port: \"%s\" (ifindex \"%d\", prio \"%d\").", active_tdport->ifname, active_tdport->ifindex, teamd_port_prio(ctx, active_tdport)); @@ -404,7 +404,7 @@ if (!best.tdport || best.tdport == active_tdport) return 0; - teamd_log_dbg("Found best port: \"%s\" (ifindex \"%d\", prio \"%d\").", + teamd_log_dbg(ctx, "Found best port: \"%s\" (ifindex \"%d\", prio \"%d\").", best.tdport->ifname, best.tdport->ifindex, best.prio); if (!active_tdport || !ab_is_port_sticky(ab, active_tdport)) { @@ -459,7 +459,7 @@ "$.ports.%s.sticky", port_name); if (err) ab_port->cfg.sticky = AB_DFLT_PORT_STICKY; - teamd_log_dbg("%s: Using sticky \"%d\".", port_name, + teamd_log_dbg(ctx, "%s: Using sticky \"%d\".", port_name, ab_port->cfg.sticky); return 0; } @@ -558,7 +558,7 @@ hwaddr_policy_name); return err; } - teamd_log_dbg("Using hwaddr_policy \"%s\".", ab->hwaddr_policy->name); + teamd_log_dbg(ctx, "Using hwaddr_policy \"%s\".", ab->hwaddr_policy->name); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_runner_lacp.c new/libteam-1.31/teamd/teamd_runner_lacp.c --- old/libteam-1.29/teamd/teamd_runner_lacp.c 2019-03-08 13:00:19.000000000 +0100 +++ new/libteam-1.31/teamd/teamd_runner_lacp.c 2020-06-11 14:23:52.000000000 +0200 @@ -97,16 +97,26 @@ static bool lacpdu_check(struct lacpdu *lacpdu) { /* + * According to Annex 43B, section 4, aside from LACP, the Slow + * Protocol linktype is also to be used by other protocols, like + * 0x02 for LAMP, 0x03 for OAM. So for none LACP protocols, just + * silence ignore. + */ + if (lacpdu->subtype != 0x01) + return false; + + /* * According to 43.4.12 version_number, tlv_type and reserved fields * should not be checked. */ - if (lacpdu->subtype != 0x01 || - lacpdu->actor_info_len != 0x14 || + if (lacpdu->actor_info_len != 0x14 || lacpdu->partner_info_len != 0x14 || lacpdu->collector_info_len != 0x10 || - lacpdu->terminator_info_len != 0x00) + lacpdu->terminator_info_len != 0x00) { + teamd_log_warn("malformed LACP PDU came."); return false; + } return true; } @@ -254,7 +264,7 @@ err = teamd_config_bool_get(ctx, &lacp->cfg.active, "$.runner.active"); if (err) lacp->cfg.active = LACP_CFG_DFLT_ACTIVE; - teamd_log_dbg("Using active \"%d\".", lacp->cfg.active); + teamd_log_dbg(ctx, "Using active \"%d\".", lacp->cfg.active); err = teamd_config_int_get(ctx, &tmp, "$.runner.sys_prio"); if (err) { @@ -265,12 +275,12 @@ } else { lacp->cfg.sys_prio = tmp; } - teamd_log_dbg("Using sys_prio \"%d\".", lacp->cfg.sys_prio); + teamd_log_dbg(ctx, "Using sys_prio \"%d\".", lacp->cfg.sys_prio); err = teamd_config_bool_get(ctx, &lacp->cfg.fast_rate, "$.runner.fast_rate"); if (err) lacp->cfg.fast_rate = LACP_CFG_DFLT_FAST_RATE; - teamd_log_dbg("Using fast_rate \"%d\".", lacp->cfg.fast_rate); + teamd_log_dbg(ctx, "Using fast_rate \"%d\".", lacp->cfg.fast_rate); err = teamd_config_int_get(ctx, &tmp, "$.runner.min_ports"); if (err) { @@ -281,7 +291,7 @@ } else { lacp->cfg.min_ports = tmp; } - teamd_log_dbg("Using min_ports \"%d\".", lacp->cfg.min_ports); + teamd_log_dbg(ctx, "Using min_ports \"%d\".", lacp->cfg.min_ports); err = teamd_config_string_get(ctx, &agg_select_policy_name, "$.runner.agg_select_policy"); if (err) @@ -292,7 +302,7 @@ agg_select_policy_name); return err; } - teamd_log_dbg("Using agg_select_policy \"%s\".", + teamd_log_dbg(ctx, "Using agg_select_policy \"%s\".", lacp_get_agg_select_policy_name(lacp)); return 0; } @@ -634,7 +644,7 @@ struct teamd_port *tdport; struct lacp_port *lacp_port; - teamd_log_dbg("Renaming aggregator %u to %u", + teamd_log_dbg(agg_lead->ctx, "Renaming aggregator %u to %u", lacp_agg_id(agg_lead), lacp_agg_id(new_agg_lead)); if (lacp->selected_agg_lead == agg_lead) lacp->selected_agg_lead = new_agg_lead; @@ -649,12 +659,12 @@ { struct lacp_port *agg_lead; - teamd_log_dbg("%s: Selecting LACP port", lacp_port->tdport->ifname); + teamd_log_dbg(lacp_port->ctx, "%s: Selecting LACP port", lacp_port->tdport->ifname); agg_lead = lacp_get_agg_lead(lacp_port); lacp_port->agg_lead = agg_lead; if (lacp_port_better(lacp_port, agg_lead)) lacp_switch_agg_lead(agg_lead, lacp_port); - teamd_log_dbg("%s: LACP port selected into aggregator %u", + teamd_log_dbg(lacp_port->ctx, "%s: LACP port selected into aggregator %u", lacp_port->tdport->ifname, lacp_port_agg_id(lacp_port)); } @@ -677,8 +687,8 @@ { struct lacp_port *agg_lead = lacp_port->agg_lead; - teamd_log_dbg("%s: Unselecting LACP port", lacp_port->tdport->ifname); - teamd_log_dbg("%s: LACP port unselected from aggregator %u", + teamd_log_dbg(lacp_port->ctx, "%s: Unselecting LACP port", lacp_port->tdport->ifname); + teamd_log_dbg(lacp_port->ctx, "%s: LACP port unselected from aggregator %u", lacp_port->tdport->ifname, lacp_port_agg_id(lacp_port)); lacp_port->agg_lead = NULL; if (lacp_port == agg_lead) { @@ -715,7 +725,7 @@ if (!next_agg_lead) next_agg_lead = lacp_get_next_agg(lacp); if (lacp->selected_agg_lead != next_agg_lead) - teamd_log_dbg("Selecting aggregator %u", + teamd_log_dbg(lacp->ctx, "Selecting aggregator %u", lacp_agg_id(next_agg_lead)); lacp->selected_agg_lead = next_agg_lead; @@ -827,7 +837,7 @@ int fast_on; fast_on = lacp_port->partner.state & INFO_STATE_LACP_TIMEOUT; - teamd_log_dbg("%s: Setting periodic timer to \"%s\".", + teamd_log_dbg(lacp_port->ctx, "%s: Setting periodic timer to \"%s\".", lacp_port->tdport->ifname, fast_on ? "fast": "slow"); ms = fast_on ? LACP_PERIODIC_SHORT: LACP_PERIODIC_LONG; ms_to_timespec(&ts, ms); @@ -929,8 +939,8 @@ state |= INFO_STATE_DEFAULTED; if (teamd_port_count(lacp_port->ctx) > 0) state |= INFO_STATE_AGGREGATION; - teamd_log_dbg("%s: lacp info state: 0x%02X.", lacp_port->tdport->ifname, - state); + teamd_log_dbg(lacp_port->ctx, "%s: lacp info state: 0x%02X.", + lacp_port->tdport->ifname, state); lacp_port->actor.state = state; } @@ -996,8 +1006,7 @@ return err; lacp_port_actor_update(lacp_port); - if (lacp_port->periodic_on) - return 0; + return lacpdu_send(lacp_port); } @@ -1089,10 +1098,8 @@ if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) return 0; - if (!lacpdu_check(&lacpdu)) { - teamd_log_warn("malformed LACP PDU came."); + if (!lacpdu_check(&lacpdu)) return 0; - } /* Check if we have correct info about the other side */ if (memcmp(&lacpdu.actor, &lacp_port->partner, @@ -1110,9 +1117,10 @@ if (err) return err; + lacp_port_actor_update(lacp_port); + /* Check if the other side has correct info about us */ - if (!lacp_port->periodic_on && - memcmp(&lacpdu.partner, &lacp_port->actor, + if (memcmp(&lacpdu.partner, &lacp_port->actor, sizeof(struct lacpdu_info))) { err = lacpdu_send(lacp_port); if (err) @@ -1198,7 +1206,7 @@ } else { lacp_port->cfg.lacp_prio = tmp; } - teamd_log_dbg("%s: Using lacp_prio \"%d\".", port_name, + teamd_log_dbg(ctx, "%s: Using lacp_prio \"%d\".", port_name, lacp_port->cfg.lacp_prio); err = teamd_config_int_get(ctx, &tmp, @@ -1212,14 +1220,14 @@ } else { lacp_port->cfg.lacp_key = tmp; } - teamd_log_dbg("%s: Using lacp_key \"%d\".", port_name, + teamd_log_dbg(ctx, "%s: Using lacp_key \"%d\".", port_name, lacp_port->cfg.lacp_key); err = teamd_config_bool_get(ctx, &lacp_port->cfg.sticky, "$.ports.%s.sticky", port_name); if (err) lacp_port->cfg.sticky = LACP_PORT_CFG_DFLT_STICKY; - teamd_log_dbg("%s: Using sticky \"%d\".", port_name, + teamd_log_dbg(ctx, "%s: Using sticky \"%d\".", port_name, lacp_port->cfg.sticky); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_usock.c new/libteam-1.31/teamd/teamd_usock.c --- old/libteam-1.29/teamd/teamd_usock.c 2018-12-09 09:57:18.000000000 +0100 +++ new/libteam-1.31/teamd/teamd_usock.c 2020-01-09 15:42:51.000000000 +0100 @@ -171,28 +171,28 @@ str = teamd_usock_msg_getline(&rest); if (!str) { - teamd_log_dbg("usock: Incomplete message."); + teamd_log_dbg(ctx, "usock: Incomplete message."); return 0; } if (strcmp(TEAMD_USOCK_REQUEST_PREFIX, str)) { - teamd_log_dbg("usock: Unsupported message type."); + teamd_log_dbg(ctx, "usock: Unsupported message type."); return 0; } str = teamd_usock_msg_getline(&rest); if (!str) { - teamd_log_dbg("usock: Incomplete message."); + teamd_log_dbg(ctx, "usock: Incomplete message."); return 0; } if (!teamd_ctl_method_exists(str)) { - teamd_log_dbg("usock: Unknown method \"%s\".", str); + teamd_log_dbg(ctx, "usock: Unknown method \"%s\".", str); return 0; } usock_ops_priv.sock = sock; usock_ops_priv.rcv_msg_args = rest; - teamd_log_dbg("usock: calling method \"%s\"", str); + teamd_log_dbg(ctx, "usock: calling method \"%s\"", str); return teamd_ctl_method_call(ctx, str, &teamd_usock_ctl_method_ops, &usock_ops_priv); @@ -315,7 +315,7 @@ teamd_usock_get_sockpath(addr.sun_path, sizeof(addr.sun_path), ctx->team_devname); - teamd_log_dbg("usock: Using sockpath \"%s\"", addr.sun_path); + teamd_log_dbg(ctx, "usock: Using sockpath \"%s\"", addr.sun_path); err = unlink(addr.sun_path); if (err == -1 && errno != ENOENT) { teamd_log_err("usock: Failed to remove socket file."); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/teamd/teamd_zmq.c new/libteam-1.31/teamd/teamd_zmq.c --- old/libteam-1.29/teamd/teamd_zmq.c 2018-12-09 09:57:18.000000000 +0100 +++ new/libteam-1.31/teamd/teamd_zmq.c 2020-01-09 15:42:51.000000000 +0100 @@ -138,28 +138,28 @@ str = teamd_zmq_msg_getline(&rest); if (!str) { - teamd_log_dbg("zmq: Incomplete message."); + teamd_log_dbg(ctx, "zmq: Incomplete message."); return 0; } if (strcmp(TEAMD_ZMQ_REQUEST_PREFIX, str)) { - teamd_log_dbg("zmq: Unsupported message type."); + teamd_log_dbg(ctx, "zmq: Unsupported message type."); return 0; } str = teamd_zmq_msg_getline(&rest); if (!str) { - teamd_log_dbg("zmq: Incomplete message."); + teamd_log_dbg(ctx, "zmq: Incomplete message."); return 0; } if (!teamd_ctl_method_exists(str)) { - teamd_log_dbg("zmq: Unknown method \"%s\".", str); + teamd_log_dbg(ctx, "zmq: Unknown method \"%s\".", str); return 0; } zmq_ops_priv.sock = ctx->zmq.sock; zmq_ops_priv.rcv_msg_args = rest; - teamd_log_dbg("zmq: calling method \"%s\"", str); + teamd_log_dbg(ctx, "zmq: calling method \"%s\"", str); return teamd_ctl_method_call(ctx, str, &teamd_zmq_ctl_method_ops, &zmq_ops_priv); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libteam-1.29/utils/bond2team new/libteam-1.31/utils/bond2team --- old/libteam-1.29/utils/bond2team 2018-12-09 09:57:18.000000000 +0100 +++ new/libteam-1.31/utils/bond2team 2020-07-20 12:00:11.000000000 +0200 @@ -331,7 +331,7 @@ oIFS="$IFS" IFS=$'\n' VFILE=( $(LANG=C \ - grep -iv 'BONDING_OPTS\|SLAVE\|MASTER\|DEVICETYPE\|TEAM' \ + grep -iv 'BONDING_OPTS\|SLAVE\|MASTER\|TYPE\|DEVICETYPE\|TEAM' \ $ifcfg )) IFS="$oIFS" } @@ -623,7 +623,7 @@ team_ifcfg_deliver() { pr_dbg "${FUNCNAME} $*" - if ! to_stdout; then + if to_stdout; then return 0 fi
