Skip to content

Commit

Permalink
teamd: Add support for TIPC link watcher
Browse files Browse the repository at this point in the history
From: Erik Hugne <erik.hugne@ericsson.com>

The first 4 patches moves the arp/ethtool/icmp/icmpv6 link watchers to
separate files, leaving the generic link watcher code in teamd_link_watch.c.
The last patch adds support for the TIPC link watcher. There is a build-time
check that checks if AF_TIPC/SIOCGETLINKNAME are available (kernel 3.15+),
and only builds in TIPC support in that case.
  • Loading branch information
jpirko committed Jun 13, 2014
2 parents 8bbc7bb + 847046a commit 9d439d5
Show file tree
Hide file tree
Showing 11 changed files with 1,704 additions and 1,240 deletions.
34 changes: 34 additions & 0 deletions configure.ac
Expand Up @@ -101,6 +101,40 @@ AC_ARG_ENABLE([zmq],
fi
fi

AC_MSG_CHECKING([if TIPC is available and supports link state supervision])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <linux/tipc.h>
]],[[
#ifndef TIPC_LINK_STATE
#error TIPC link state monitoring is not available for your kernel
#endif
int sd = 0;
struct tipc_sioc_ln_req lnr = { 0 };
if ((sd = socket(AF_TIPC, SOCK_SEQPACKET, 0)) == -1) {
return errno;
}
lnr.peer = 0;
lnr.bearer_id = 0;
if ((ioctl(sd, SIOCGETLINKNAME, &lnr) < 0) < 0) {
return errno;
}
]])],
[teamd_tipc_support=yes],
[teamd_tipc_support=no])
AC_MSG_RESULT([$teamd_tipc_support])
if test "x$teamd_tipc_support" = "xyes"; then
AC_DEFINE(TEAMD_ENABLE_TIPC, 1, [TIPC support enabled])
fi
AM_CONDITIONAL(TEAMD_ENABLE_TIPC, test "x$teamd_tipc_support" = "xyes")

AC_CONFIG_FILES([Makefile
include/Makefile \
libteam/Makefile \
Expand Down
13 changes: 9 additions & 4 deletions teamd/Makefile.am
Expand Up @@ -13,13 +13,18 @@ teamd_LDADD = $(top_builddir)/libteam/libteam.la $(LIBDAEMON_LIBS) $(JANSSON_LIB
bin_PROGRAMS=teamd
teamd_SOURCES=teamd.c teamd_common.c teamd_json.c teamd_config.c teamd_state.c \
teamd_workq.c teamd_events.c teamd_per_port.c \
teamd_option_watch.c teamd_ifinfo_watch.c teamd_link_watch.c \
teamd_ctl.c teamd_dbus.c teamd_zmq.c teamd_usock.c \
teamd_phys_port_check.c teamd_bpf_chef.c teamd_hash_func.c \
teamd_balancer.c teamd_runner_basic_ones.c \
teamd_option_watch.c teamd_ifinfo_watch.c teamd_lw_ethtool.c \
teamd_lw_psr.c teamd_lw_arp_ping.c teamd_lw_nsna_ping.c \
teamd_link_watch.c teamd_ctl.c teamd_dbus.c teamd_zmq.c \
teamd_usock.c teamd_phys_port_check.c teamd_bpf_chef.c \
teamd_hash_func.c teamd_balancer.c teamd_runner_basic_ones.c \
teamd_runner_activebackup.c teamd_runner_loadbalance.c \
teamd_runner_lacp.c

if TEAMD_ENABLE_TIPC
teamd_SOURCES+=teamd_lw_tipc.c
endif

EXTRA_DIST = example_configs dbus redhat

noinst_HEADERS = teamd.h teamd_workq.h teamd_bpf_chef.h teamd_ctl.h \
Expand Down
22 changes: 22 additions & 0 deletions teamd/example_configs/activebackup_tipc.conf
@@ -0,0 +1,22 @@
{
"device": "team0",
"runner": {"name": "activebackup"},
"ports": {
"eth0": {
"link_watch": {
"name": "tipc",
"tipc_bearer": "vlan0"
},
"sticky": true,
"prio": 10
},
"eth1": {
"link_watch": {
"name": "tipc",
"tipc_bearer": "vlan1"
},
"sticky": true,
"prio": 10
}
}
}

0 comments on commit 9d439d5

Please sign in to comment.