Skip to content

Commit fdab695

Browse files
committed
libteam: add new package
libteam is a userspace tool to configure Linux network teaming. This consists of 5 packages: - libteam.so is a wrapper library to interface the Team Netlink API. - teamd is a service/daemon to control a team netdev using the libteam library. - teamdctl is a utility to alter teamd configuration at runtime. - libteamdctl.so is a library used by teamdctl. - teamnl is a utility mainly for debugging. Signed-off-by: Qingfang Deng <dqfext@gmail.com>
1 parent 5291500 commit fdab695

File tree

2 files changed

+167
-0
lines changed

2 files changed

+167
-0
lines changed

net/libteam/Makefile

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
include $(TOPDIR)/rules.mk
2+
3+
PKG_NAME:=libteam
4+
PKG_VERSION:=1.32
5+
PKG_RELEASE:=1
6+
7+
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
8+
PKG_SOURCE_URL:=https://codeload.github.com/jpirko/libteam/tar.gz/refs/tags/v$(PKG_VERSION)?
9+
PKG_HASH:=7ad90555db8aecdcaf002f543d330408501600edf7065e0ca398fce9b1e64820
10+
11+
PKG_FIXUP:=autoreconf
12+
PKG_INSTALL:=1
13+
PKG_BUILD_PARALLEL:=1
14+
PKG_BUILD_FLAGS:=lto
15+
16+
PKG_MAINTAINER:=Qingfang Deng <dqfext@gmail.com>
17+
PKG_LICENSE:=LGPL-2.1-only
18+
PKG_LICENSE_FILES:=COPYING
19+
20+
include $(INCLUDE_DIR)/package.mk
21+
22+
CONFIGURE_ARGS+=--disable-static
23+
24+
define Package/libteam/default
25+
SECTION:=libs
26+
CATEGORY:=Libraries
27+
URL:=https://github.com/jpirko/libteam
28+
endef
29+
30+
define Package/libteam
31+
$(Package/libteam/default)
32+
TITLE:=Team common library
33+
DEPENDS:=+kmod-team +libnl-cli \
34+
+kmod-team-mode-activebackup \
35+
+kmod-team-mode-broadcast \
36+
+kmod-team-mode-loadbalance \
37+
+kmod-team-mode-random \
38+
+kmod-team-mode-roundrobin
39+
ABI_VERSION:=5
40+
endef
41+
42+
define Package/libteam/description
43+
Libteam lib is a userspace wrapper of Team Netlink communication.
44+
endef
45+
46+
define Package/libteamdctl
47+
$(Package/libteam/default)
48+
TITLE:=Team daemon control library
49+
ABI_VERSION:=0
50+
endef
51+
52+
define Package/libteamdctl/description
53+
Common library for teamdctl.
54+
endef
55+
56+
define Package/teamd/default
57+
SECTION:=net
58+
CATEGORY:=Network
59+
URL:=https://github.com/jpirko/libteam
60+
endef
61+
62+
define Package/teamd
63+
$(Package/teamd/default)
64+
TITLE:=Team daemon
65+
DEPENDS:=+libteam +libdaemon +jansson
66+
endef
67+
68+
define Package/teamd/description
69+
teamd is a daemon to control a given team network device, during runtime,
70+
as a puppeteer controls a puppet. It uses libteam to communicate with the
71+
kernel team device instance via Netlink sockets. The behaviour depends on
72+
the selected runner and its configuration.
73+
endef
74+
75+
define Package/teamdctl
76+
$(Package/teamd/default)
77+
TITLE:=Team daemon control tool
78+
DEPENDS:=+teamd +libteamdctl
79+
endef
80+
81+
define Package/teamdctl/description
82+
teamdctl is a tool that allows a user to interact with a running teamd instance.
83+
endef
84+
85+
define Package/teamnl
86+
$(Package/teamd/default)
87+
TITLE:=Team Netlink interface tool
88+
DEPENDS:=+libteam
89+
endef
90+
91+
define Package/teamnl/description
92+
teamnl is a tool enabling interaction with a team device via the team driver
93+
Netlink interface. This tools serves mainly for debugging purposes. Note that
94+
it makes no sense to use this tool to change options on team device controlled
95+
by a teamd instance.
96+
endef
97+
98+
define Build/InstallDev
99+
$(INSTALL_DIR) $(1)/usr
100+
$(CP) $(PKG_INSTALL_DIR)/usr/include $(1)/usr
101+
$(CP) $(PKG_INSTALL_DIR)/usr/lib $(1)/usr
102+
endef
103+
104+
define Package/libteam/install
105+
$(INSTALL_DIR) $(1)/usr/lib
106+
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libteam.so.$(ABI_VERSION)* $(1)/usr/lib/
107+
endef
108+
109+
define Package/libteamdctl/install
110+
$(INSTALL_DIR) $(1)/usr/lib
111+
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libteamdctl.so.$(ABI_VERSION)* $(1)/usr/lib/
112+
endef
113+
114+
define Package/teamd/install
115+
$(INSTALL_DIR) $(1)/usr/bin
116+
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/teamd $(1)/usr/bin/
117+
endef
118+
119+
define Package/teamdctl/install
120+
$(INSTALL_DIR) $(1)/usr/bin
121+
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/teamdctl $(1)/usr/bin/
122+
endef
123+
124+
define Package/teamnl/install
125+
$(INSTALL_DIR) $(1)/usr/bin
126+
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/teamnl $(1)/usr/bin/
127+
endef
128+
129+
$(eval $(call BuildPackage,libteam))
130+
$(eval $(call BuildPackage,libteamdctl))
131+
$(eval $(call BuildPackage,teamd))
132+
$(eval $(call BuildPackage,teamdctl))
133+
$(eval $(call BuildPackage,teamnl))
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From 4eb54a811bef43da2be9cc84009567e5d6ca9741 Mon Sep 17 00:00:00 2001
2+
From: Khem Raj <raj.khem@gmail.com>
3+
Date: Sat, 11 May 2024 23:15:59 -0700
4+
Subject: [PATCH] teamd: Pass correct parameter type to accept API
5+
6+
accept() expects sockaddr as second parameter
7+
8+
int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
9+
10+
Fixes build with gcc-16 on musl systems
11+
| ../../git/teamd/teamd_usock.c: In function 'callback_usock':
12+
| ../../git/teamd/teamd_usock.c:280:40: error: passing argument 2 of 'accept' from incompatible pointer type [-Wincompatible-pointer-types]
13+
| 280 | sock = accept(ctx->usock.sock, &addr, &alen);
14+
| | ^~~~~
15+
| | |
16+
| | struct sockaddr_un *
17+
18+
Signed-off-by: Khem Raj <raj.khem@gmail.com>
19+
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
20+
---
21+
teamd/teamd_usock.c | 2 +-
22+
1 file changed, 1 insertion(+), 1 deletion(-)
23+
24+
--- a/teamd/teamd_usock.c
25+
+++ b/teamd/teamd_usock.c
26+
@@ -277,7 +277,7 @@ static int callback_usock(struct teamd_c
27+
int err;
28+
29+
alen = sizeof(addr);
30+
- sock = accept(ctx->usock.sock, &addr, &alen);
31+
+ sock = accept(ctx->usock.sock, (struct sockaddr *)&addr, &alen);
32+
if (sock == -1) {
33+
teamd_log_err("usock: Failed to accept connection.");
34+
return -errno;

0 commit comments

Comments
 (0)