Initialize for libteam
This commit is contained in:
commit
97b8cd88f4
11 changed files with 814 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
libteam-1.27.tar.gz
|
1
.libteam.metadata
Normal file
1
.libteam.metadata
Normal file
|
@ -0,0 +1 @@
|
|||
cac96e66113c3f90d7040d9c87a887d8fce829a2eaedf5557b64806bcf4565c0 libteam-1.27.tar.gz
|
31
0001-allow-send_interface-dbus.patch
Normal file
31
0001-allow-send_interface-dbus.patch
Normal file
|
@ -0,0 +1,31 @@
|
|||
From f0ebd1613f748f5ba4f873935d3e171cdeb8620c Mon Sep 17 00:00:00 2001
|
||||
From: Nirmoy Das <ndas@suse.de>
|
||||
Date: Wed, 22 Nov 2017 16:49:53 +0100
|
||||
Subject: [PATCH] allow send_interface dbus
|
||||
|
||||
---
|
||||
teamd/teamd.conf.in | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/teamd/teamd.conf.in b/teamd/teamd.conf.in
|
||||
index 6ca3282..8fca859 100644
|
||||
--- a/teamd/teamd.conf.in
|
||||
+++ b/teamd/teamd.conf.in
|
||||
@@ -4,11 +4,14 @@
|
||||
<busconfig>
|
||||
<policy user="root">
|
||||
<allow own_prefix="org.libteam.teamd"/>
|
||||
+ <allow send_interface="org.libteam.teamd"/>
|
||||
</policy>
|
||||
<policy user="@teamd_user@">
|
||||
<allow own_prefix="org.libteam.teamd"/>
|
||||
+ <allow send_interface="org.libteam.teamd"/>
|
||||
</policy>
|
||||
<policy context="default">
|
||||
<deny own_prefix="org.libteam.teamd"/>
|
||||
+ <allow send_interface="org.libteam.teamd"/>
|
||||
</policy>
|
||||
</busconfig>
|
||||
--
|
||||
2.15.0
|
||||
|
217
0001-teamd-Add-option-to-change-evaluation-logic-of-multi.patch
Normal file
217
0001-teamd-Add-option-to-change-evaluation-logic-of-multi.patch
Normal file
|
@ -0,0 +1,217 @@
|
|||
From 7cb5de8b01be132bd4150eff460bfd83296414b6 Mon Sep 17 00:00:00 2001
|
||||
From: Otto Hollmann <otto.hollmann@suse.com>
|
||||
Date: Tue, 2 May 2023 17:36:15 +0200
|
||||
Subject: [PATCH] teamd: Add option to change evaluation logic of multiple
|
||||
link-watchers
|
||||
|
||||
Now, if multiple link watchers are used, link is up if any of the
|
||||
link-watchers reports the link up.
|
||||
|
||||
Introduce new option "link_watch_policy" to change this behaviour.
|
||||
Possible values are "any" and "all". If nothing specified, default value
|
||||
"any" will be used and there will be no change in current behaviour. If
|
||||
value "all" will be set, link will be up only if ALL the link-watchers
|
||||
report the link up.
|
||||
|
||||
Signed-off-by: Otto Hollmann <otto.hollmann@suse.com>
|
||||
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
|
||||
---
|
||||
man/teamd.conf.5 | 47 +++++++++++++++++++
|
||||
.../activebackup_multi_lw_2.conf | 25 ++++++++++
|
||||
teamd/teamd.c | 26 ++++++++++
|
||||
teamd/teamd.h | 1 +
|
||||
teamd/teamd_link_watch.c | 27 +++++++++--
|
||||
5 files changed, 121 insertions(+), 5 deletions(-)
|
||||
create mode 100644 teamd/example_configs/activebackup_multi_lw_2.conf
|
||||
|
||||
diff --git a/man/teamd.conf.5 b/man/teamd.conf.5
|
||||
index dc913cd..8c65c33 100644
|
||||
--- a/man/teamd.conf.5
|
||||
+++ b/man/teamd.conf.5
|
||||
@@ -407,6 +407,23 @@ Default:
|
||||
.TP
|
||||
.BR "link_watch.target_host "| " ports.PORTIFNAME.link_watch.target_host " (hostname)
|
||||
Hostname to be converted to IPv6 address which will be filled into NS packet as target address.
|
||||
+.TP
|
||||
+.BR "link_watch_policy " (string)
|
||||
+Name of link-watchers evaluation policy. Available options are following:
|
||||
+.RS 7
|
||||
+.PP
|
||||
+.BR "any "\(em
|
||||
+Link is up if
|
||||
+.BR any
|
||||
+of the link-watchers reports the link up.
|
||||
+.PP
|
||||
+.BR "all "\(em
|
||||
+Link is up if
|
||||
+.BR all
|
||||
+of the link-watchers reports the link up.
|
||||
+.PP
|
||||
+Default:
|
||||
+.BR "any"
|
||||
.SH EXAMPLES
|
||||
.PP
|
||||
.nf
|
||||
@@ -518,6 +535,36 @@ This configuration uses ARP ping link watch.
|
||||
Similar to the previous one, only this time two link watchers are used at the same time.
|
||||
.PP
|
||||
.nf
|
||||
+{
|
||||
+ "device": "team0",
|
||||
+ "runner": {"name": "activebackup"},
|
||||
+ "link_watch_policy": "all",
|
||||
+ "link_watch": [
|
||||
+ {
|
||||
+ "name": "arp_ping",
|
||||
+ "interval": 100,
|
||||
+ "missed_max": 30,
|
||||
+ "target_host": "192.168.23.1"
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "ethtool"
|
||||
+ }
|
||||
+ ],
|
||||
+ "ports": {
|
||||
+ "eth1": {
|
||||
+ "prio": -10,
|
||||
+ "sticky": true
|
||||
+ },
|
||||
+ "eth2": {
|
||||
+ "prio": 100
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+.fi
|
||||
+.PP
|
||||
+Two link-watchers are used at the same time. Link is up only if all configured link-watchers report link is up.
|
||||
+.PP
|
||||
+.nf
|
||||
{
|
||||
"device": "team0",
|
||||
"runner": {
|
||||
diff --git a/teamd/example_configs/activebackup_multi_lw_2.conf b/teamd/example_configs/activebackup_multi_lw_2.conf
|
||||
new file mode 100644
|
||||
index 0000000..a9073d7
|
||||
--- /dev/null
|
||||
+++ b/teamd/example_configs/activebackup_multi_lw_2.conf
|
||||
@@ -0,0 +1,25 @@
|
||||
+{
|
||||
+ "device": "team0",
|
||||
+ "runner": {"name": "activebackup"},
|
||||
+ "link_watch_policy": "all",
|
||||
+ "link_watch": [
|
||||
+ {
|
||||
+ "name": "arp_ping",
|
||||
+ "interval": 100,
|
||||
+ "missed_max": 30,
|
||||
+ "target_host": "192.168.23.1"
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "ethtool"
|
||||
+ }
|
||||
+ ],
|
||||
+ "ports": {
|
||||
+ "eth1": {
|
||||
+ "prio": -10,
|
||||
+ "sticky": true
|
||||
+ },
|
||||
+ "eth2": {
|
||||
+ "prio": 100
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/teamd/teamd.c b/teamd/teamd.c
|
||||
index a89b702..f351599 100644
|
||||
--- a/teamd/teamd.c
|
||||
+++ b/teamd/teamd.c
|
||||
@@ -1805,6 +1805,28 @@ static int teamd_drop_privileges()
|
||||
|
||||
#endif
|
||||
|
||||
+static int teamd_get_link_watch_policy(struct teamd_context *ctx)
|
||||
+{
|
||||
+ int err;
|
||||
+ const char *link_watch_policy;
|
||||
+
|
||||
+ err = teamd_config_string_get(ctx, &link_watch_policy, "$.link_watch_policy");
|
||||
+ if (!err) {
|
||||
+ if (!strcmp(link_watch_policy, "all")) {
|
||||
+ ctx->evaluate_all_watchers = true;
|
||||
+ } else if (!strcmp(link_watch_policy, "any")) {
|
||||
+ ctx->evaluate_all_watchers = false;
|
||||
+ } else {
|
||||
+ teamd_log_err("Unrecognized value for link_watch_policy.");
|
||||
+ teamd_log_err("Only \"any\" or \"all\" are allowed but \"%s\" found in config.", link_watch_policy);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ } else {
|
||||
+ teamd_log_dbg(ctx, "No link_watch_policy specified in config, using default value \"any\".");
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
enum teamd_exit_code ret = TEAMD_EXIT_FAILURE;
|
||||
@@ -1863,6 +1885,10 @@ int main(int argc, char **argv)
|
||||
if (err)
|
||||
goto config_free;
|
||||
|
||||
+ err = teamd_get_link_watch_policy(ctx);
|
||||
+ if (err)
|
||||
+ goto config_free;
|
||||
+
|
||||
err = teamd_set_default_pid_file(ctx);
|
||||
if (err)
|
||||
goto config_free;
|
||||
diff --git a/teamd/teamd.h b/teamd/teamd.h
|
||||
index 541d2a7..bc2ce36 100644
|
||||
--- a/teamd/teamd.h
|
||||
+++ b/teamd/teamd.h
|
||||
@@ -105,6 +105,7 @@ struct teamd_context {
|
||||
bool no_quit_destroy;
|
||||
bool init_no_ports;
|
||||
bool pre_add_ports;
|
||||
+ bool evaluate_all_watchers;
|
||||
char * config_file;
|
||||
char * config_text;
|
||||
json_t * config_json;
|
||||
diff --git a/teamd/teamd_link_watch.c b/teamd/teamd_link_watch.c
|
||||
index cae6549..11f4697 100644
|
||||
--- a/teamd/teamd_link_watch.c
|
||||
+++ b/teamd/teamd_link_watch.c
|
||||
@@ -133,11 +133,28 @@ bool teamd_link_watch_port_up(struct teamd_context *ctx,
|
||||
if (!tdport)
|
||||
return true;
|
||||
link = true;
|
||||
- teamd_for_each_port_priv_by_creator(common_ppriv, tdport,
|
||||
- LW_PORT_PRIV_CREATOR_PRIV) {
|
||||
- link = common_ppriv->link_up;
|
||||
- if (link)
|
||||
- return link;
|
||||
+ if (ctx->evaluate_all_watchers) {
|
||||
+ /*
|
||||
+ * If multiple link-watchers used at the same time,
|
||||
+ * link is up if ALL of the link-watchers reports the link up.
|
||||
+ */
|
||||
+ teamd_for_each_port_priv_by_creator(common_ppriv, tdport,
|
||||
+ LW_PORT_PRIV_CREATOR_PRIV) {
|
||||
+ link = common_ppriv->link_up;
|
||||
+ if (!link)
|
||||
+ return link;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /*
|
||||
+ * If multiple link-watchers used at the same time,
|
||||
+ * link is up if ANY of the link-watchers reports the link up.
|
||||
+ */
|
||||
+ teamd_for_each_port_priv_by_creator(common_ppriv, tdport,
|
||||
+ LW_PORT_PRIV_CREATOR_PRIV) {
|
||||
+ link = common_ppriv->link_up;
|
||||
+ if (link)
|
||||
+ return link;
|
||||
+ }
|
||||
}
|
||||
return link;
|
||||
}
|
75
better_handle_failures_to_chown.patch
Normal file
75
better_handle_failures_to_chown.patch
Normal file
|
@ -0,0 +1,75 @@
|
|||
From 44ed6a1724bac01cd1c1dd25defb62237df5f379 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Haller <thaller@redhat.com>
|
||||
Date: Fri, 21 May 2021 18:32:07 +0200
|
||||
Subject: [PATCH 1/1] teamd: better handle failures to chown(TEAMD_RUN_DIR)
|
||||
during teamd_drop_privileges()
|
||||
|
||||
NetworkManager is exec-ing teamd while running without CAP_CHOWN.
|
||||
|
||||
When teamd is configured to drop privileges, then it will call chown
|
||||
while still running as root user. But the command will fail because of
|
||||
lack of CAP_CHOWN.
|
||||
|
||||
Note that chown() succeeds if the calling process has CAP_CHOWN or if
|
||||
the file already is owned by the calling user/group (whereas, changing
|
||||
the group will still work, if the user is a member of that group).
|
||||
|
||||
The directory might have already been prepared with the right user/group.
|
||||
Let's handle that. If the first chown() as root succeeds, we are good.
|
||||
If it fails, we will retry after changing the user id. If the directory
|
||||
already has the right/compatible user, this command will succeeds too
|
||||
and teamd can proceed.
|
||||
|
||||
See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/722
|
||||
|
||||
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
||||
---
|
||||
teamd/teamd.c | 18 +++++++++++++-----
|
||||
1 file changed, 13 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/teamd/teamd.c b/teamd/teamd.c
|
||||
index b310140570c5..3ef3d6cf09f6 100644
|
||||
--- a/teamd/teamd.c
|
||||
+++ b/teamd/teamd.c
|
||||
@@ -1714,6 +1714,7 @@ static int teamd_drop_privileges()
|
||||
cap_t my_caps;
|
||||
struct passwd *pw = NULL;
|
||||
struct group *grpent = NULL;
|
||||
+ int chown_succeeded;
|
||||
|
||||
if ((pw = getpwnam(TEAMD_USER)) == NULL) {
|
||||
fprintf(stderr, "Error reading user %s entry (%m)\n", TEAMD_USER);
|
||||
@@ -1734,11 +1735,12 @@ static int teamd_drop_privileges()
|
||||
goto error;
|
||||
}
|
||||
|
||||
- if (chown(TEAMD_RUN_DIR, pw->pw_uid, pw->pw_gid) < 0) {
|
||||
- fprintf(stderr, "Unable to change ownership of %s to %s/%s (%m)\n",
|
||||
- TEAMD_RUN_DIR, TEAMD_USER, TEAMD_GROUP);
|
||||
- goto error;
|
||||
- }
|
||||
+ /* Try to change owner while still being root. We might not have
|
||||
+ * capabilities, so this might fail. At this point, we accept that,
|
||||
+ * because the directory might have been prepared with a suitable owner
|
||||
+ * already. But on failure, we will retry as the new user below.
|
||||
+ */
|
||||
+ chown_succeeded = (chown(TEAMD_RUN_DIR, pw->pw_uid, pw->pw_gid) == 0);
|
||||
|
||||
if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0)
|
||||
goto error;
|
||||
@@ -1758,6 +1760,12 @@ static int teamd_drop_privileges()
|
||||
goto error;
|
||||
}
|
||||
|
||||
+ if (!chown_succeeded && chown(TEAMD_RUN_DIR, pw->pw_uid, pw->pw_gid) < 0) {
|
||||
+ fprintf(stderr, "Unable to change ownership of %s to %s/%s (%m)\n",
|
||||
+ TEAMD_RUN_DIR, TEAMD_USER, TEAMD_GROUP);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
if ((my_caps = cap_init()) == NULL)
|
||||
goto error;
|
||||
if (cap_set_flag(my_caps, CAP_EFFECTIVE, ARRAY_SIZE(cv), cv, CAP_SET) < 0)
|
||||
--
|
||||
2.31.1
|
||||
|
44
check_if_psr_ops_were_initialized.patch
Normal file
44
check_if_psr_ops_were_initialized.patch
Normal file
|
@ -0,0 +1,44 @@
|
|||
Index: libteam-1.16/teamd/teamd_lw_psr.c
|
||||
===================================================================
|
||||
--- libteam-1.16.orig/teamd/teamd_lw_psr.c
|
||||
+++ libteam-1.16/teamd/teamd_lw_psr.c
|
||||
@@ -39,6 +39,9 @@ static int lw_psr_callback_periodic(stru
|
||||
bool link_up = common_ppriv->link_up;
|
||||
int err;
|
||||
|
||||
+ if (!psr_ppriv->ops)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
if (psr_ppriv->reply_received) {
|
||||
link_up = true;
|
||||
psr_ppriv->missed = 0;
|
||||
@@ -65,6 +68,9 @@ static int lw_psr_callback_socket(struct
|
||||
{
|
||||
struct lw_psr_port_priv *psr_ppriv = priv;
|
||||
|
||||
+ if (!psr_ppriv->ops)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
return psr_ppriv->ops->receive(psr_ppriv);
|
||||
}
|
||||
|
||||
@@ -120,6 +126,9 @@ int lw_psr_port_added(struct teamd_conte
|
||||
struct lw_psr_port_priv *psr_ppriv = priv;
|
||||
int err;
|
||||
|
||||
+ if (!psr_ppriv->ops)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
err = lw_psr_load_options(ctx, tdport, psr_ppriv);
|
||||
if (err) {
|
||||
teamd_log_err("Failed to load options.");
|
||||
@@ -182,6 +191,9 @@ void lw_psr_port_removed(struct teamd_co
|
||||
{
|
||||
struct lw_psr_port_priv *psr_ppriv = priv;
|
||||
|
||||
+ if (!psr_ppriv->ops)
|
||||
+ return;
|
||||
+
|
||||
teamd_loop_callback_del(ctx, LW_PERIODIC_CB_NAME, psr_ppriv);
|
||||
teamd_loop_callback_del(ctx, LW_SOCKET_CB_NAME, psr_ppriv);
|
||||
psr_ppriv->ops->sock_close(psr_ppriv);
|
14
ignore_ebusy_for_team_hwaddr_set.patch
Normal file
14
ignore_ebusy_for_team_hwaddr_set.patch
Normal file
|
@ -0,0 +1,14 @@
|
|||
Index: libteam-1.18/libteam/libteam.c
|
||||
===================================================================
|
||||
--- libteam-1.18.orig/libteam/libteam.c
|
||||
+++ libteam-1.18/libteam/libteam.c
|
||||
@@ -1633,6 +1633,9 @@ int team_hwaddr_set(struct team_handle *
|
||||
err = rtnl_link_change(th->nl_cli.sock, link, link, 0);
|
||||
err = -nl2syserr(err);
|
||||
|
||||
+ if (err == -EBUSY)
|
||||
+ err = 0;
|
||||
+
|
||||
nl_addr_put(nl_addr);
|
||||
|
||||
errout:
|
108
libteam.changes
Normal file
108
libteam.changes
Normal file
|
@ -0,0 +1,108 @@
|
|||
* Mon Jun 26 2023 otto.hollmann@suse.com
|
||||
- Add option to change evaluation logic of multiple link-watchers (jsc#PED-2209)
|
||||
Add 0001-teamd-Add-option-to-change-evaluation-logic-of-multi.patch
|
||||
* Fri Sep 9 2022 cfamullaconrad@suse.com
|
||||
- Add teamd-config-update-local-prio-to-kernel.patch (bsc#1200505)
|
||||
* Fri Nov 12 2021 otto.hollmann@suse.com
|
||||
- teamd: better handle failures to chown(TEAMD_RUN_DIR) during
|
||||
teamd_drop_privileges() (bsc#1185424)
|
||||
[+ better_handle_failures_to_chown.patch]
|
||||
* Fri Jan 5 2018 jengelh@inai.de
|
||||
- Drop /pkg/ subpart from includedir
|
||||
* Wed Jan 3 2018 tchvatal@suse.com
|
||||
- Remove defattr that is not really needed
|
||||
- Add condition around python bindings, they are really based on
|
||||
swig code that would need to be rewritten to support python3
|
||||
* Wed Nov 22 2017 ndas@suse.de
|
||||
- allow send_interface in dbus conf file for wicked.
|
||||
[+ 0001-allow-send_interface-dbus.patch]
|
||||
* Wed Nov 22 2017 jengelh@inai.de
|
||||
- Update to new upstream release 1.27
|
||||
* teamd: escape some sensitive characters in ifname with
|
||||
double quotation marks
|
||||
* libteam: resynchronize ifinfo after lost RTNLGRP_LINK
|
||||
notifications
|
||||
* teamd: check port link_up when a port is added with
|
||||
loadbalance runner
|
||||
* Wed Nov 22 2017 jengelh@inai.de
|
||||
- Do not suppress errors from useradd
|
||||
* Wed Nov 22 2017 ndas@suse.de
|
||||
- sync with SLES changes(bsc#1055708)
|
||||
* Add check_if_psr_ops_were_initialized.patch:
|
||||
* * Fix teamd segfault when link_watch initialization callbacks fail
|
||||
(e.g. lw_psr_port_added() in case of activebackup runner) due to
|
||||
an attempt to change hwaddr on an enslaved, link up port device.
|
||||
Note: enslavement triggers initialization callbacks.
|
||||
* Add ignore_ebusy_for_team_hwaddr_set.patch:
|
||||
* * Make PortAdd and PortRemove dbus methods work for all runners.
|
||||
Ignore attempts to change hwaddr of an already enslaved devices.
|
||||
(fate#318389,fate#317728,fate#316923)
|
||||
- Add start_teamd_from_usr_sbin.patch:
|
||||
* Modify service file to start teamd instance from /usr/sbin.
|
||||
* Mon Nov 21 2016 jengelh@inai.de
|
||||
- Update to new upstream release 1.26
|
||||
* dbus: don't do <deny send_interface="..." /> in template
|
||||
dbus s. f.
|
||||
* teamd: do correct l3/l4 tx hashing with vlans
|
||||
* teamd: lacp: use original hwaddr as source address in lacpdus
|
||||
* libteam: fix TEAM_OPTION_TYPE_BOOL type for big-endian
|
||||
architectures
|
||||
* teamd: handle vlan 0 packets
|
||||
* misc: fix an out-of-bound write with zero-length
|
||||
hardware address
|
||||
* teamd: fix the issue that network blocks when issuing
|
||||
`systemctl stop teamd`
|
||||
* teamd: lacp: Do not unselect port if it changes state
|
||||
to "expired"
|
||||
* Thu Feb 11 2016 jengelh@inai.de
|
||||
- Update to new upstream release 1.22
|
||||
* teamd: Fix member port state change on master team admin UP.
|
||||
* teamd: add CAP_NET_RAW capability for LACP packet sockets
|
||||
* teamd: lacp: update actor state before sending LACP frames
|
||||
* Wed Sep 9 2015 jengelh@inai.de
|
||||
- Update to new upstream release 1.18
|
||||
* teamd: lacp: change actor system value on team MAC change
|
||||
* Fix sending duplicate LACP frames at the start of establishing
|
||||
a logical channel.
|
||||
* Fix teamd memory corruption issues seen by missing port unlink
|
||||
in ifinfo_destroy()
|
||||
* libteam: Add check to disallow creating device names longer than
|
||||
15 characters.
|
||||
* Fri Jul 31 2015 jengelh@inai.de
|
||||
- Update to new upstream release 1.17
|
||||
* teamd: lw: nsna_ping: fix NA RX and ARP RX handling
|
||||
* libteam: ifinfo: fix rtnl dellink handling
|
||||
* Sun Mar 29 2015 jengelh@inai.de
|
||||
- Update to new upstream release 1.16
|
||||
* teamdctl: show port link down count in state output
|
||||
* teamd: lw: count how many times has been the port down
|
||||
* Thu Jan 8 2015 jengelh@inai.de
|
||||
- Update to new upstream release 1.15
|
||||
* Topology-aware failover with TIPC
|
||||
* Mon Jul 21 2014 jengelh@inai.de
|
||||
- Update to new upstream release 1.11
|
||||
* add support for TIPC link watcher
|
||||
* teamd quits when the device is removed
|
||||
* teamd: add support for checking multiple ports IFLA_PHYS_PORT_ID
|
||||
* Thu Aug 8 2013 jengelh@inai.de
|
||||
- Update to new upstream release 1.5
|
||||
* lacp: introduce multiple aggregator selection policies
|
||||
* lacp: allow to have multiple functions to find out which port
|
||||
is better
|
||||
* lacp: introduce agg select policy based on per-port config
|
||||
options
|
||||
* teamd: introduce simple SR-IOV support
|
||||
* lacp: do not set state disable if driver does not report speed
|
||||
and duplex
|
||||
* teamd: add support for multicast group rejoin sending
|
||||
* utils: add bond2team conversion tool
|
||||
* Thu Feb 28 2013 jengelh@inai.de
|
||||
- Update to new upstream release 1.0 -
|
||||
(no changes summary provided; this is the first tarball release)
|
||||
* Wed Nov 14 2012 jengelh@inai.de
|
||||
- Update to git snapshot 0+git368 [a62cd9309607c6d72d46ef68403a730a6367b827] -
|
||||
no changes summary provided by upstream
|
||||
- Install systemd service file for teamd
|
||||
- Build and install python bindings
|
||||
* Sat May 12 2012 jengelh@inai.de
|
||||
- Initial package for build.opensuse.org
|
243
libteam.spec
Normal file
243
libteam.spec
Normal file
|
@ -0,0 +1,243 @@
|
|||
#
|
||||
# spec file for package libteam
|
||||
#
|
||||
# Copyright (c) 2022-2023 ZhuningOS
|
||||
#
|
||||
|
||||
|
||||
%bcond_without python2
|
||||
# _tmpfilesdir is not defined in systemd macros up to openSUSE 13.2
|
||||
%{!?_tmpfilesdir: %global _tmpfilesdir %{_libexecdir}/tmpfiles.d }
|
||||
Name: libteam
|
||||
Version: 1.27
|
||||
Release: 150000.4.9.1
|
||||
Summary: Utilities for controlling 802.1AX team network device
|
||||
License: LGPL-2.1+
|
||||
Group: System/Kernel
|
||||
Url: http://libteam.org/
|
||||
|
||||
#Git-Web: https://github.com/jpirko/libteam
|
||||
#Git-Clone: git://github.com/jpirko/libteam
|
||||
Source: http://libteam.org/files/%name-%version.tar.gz
|
||||
Patch0: check_if_psr_ops_were_initialized.patch
|
||||
Patch1: start_teamd_from_usr_sbin.patch
|
||||
Patch2: ignore_ebusy_for_team_hwaddr_set.patch
|
||||
Patch3: 0001-allow-send_interface-dbus.patch
|
||||
Patch4: better_handle_failures_to_chown.patch
|
||||
Patch5: teamd-config-update-local-prio-to-kernel.patch
|
||||
# PATCH-FIX-UPSTREAM jsc#PED-2209 Add option to change link-watchers logic
|
||||
Patch6: 0001-teamd-Add-option-to-change-evaluation-logic-of-multi.patch
|
||||
BuildRequires: doxygen
|
||||
BuildRequires: libcap-devel
|
||||
BuildRequires: pkg-config
|
||||
BuildRequires: swig
|
||||
BuildRequires: pkgconfig(dbus-1)
|
||||
BuildRequires: pkgconfig(jansson)
|
||||
BuildRequires: pkgconfig(libdaemon)
|
||||
BuildRequires: pkgconfig(libnl-3.0) >= 3.2.0
|
||||
BuildRequires: pkgconfig(libnl-cli-3.0) >= 3.2.0
|
||||
BuildRequires: pkgconfig(libnl-genl-3.0) >= 3.2.0
|
||||
BuildRequires: pkgconfig(libnl-route-3.0) >= 3.2.0
|
||||
%if %{with python2}
|
||||
BuildRequires: pkgconfig(python2)
|
||||
%endif
|
||||
%if 0%{?suse_version} >= 1220
|
||||
BuildRequires: systemd-rpm-macros
|
||||
%endif
|
||||
%define teamd_user teamd
|
||||
%define teamd_group daemon
|
||||
%define teamd_daemon_directory /run/teamd
|
||||
%define teamd_dbus_policy_directory %_sysconfdir/dbus-1/system.d
|
||||
%define teamd_dbus_policy_name org.libteam.teamd.conf
|
||||
|
||||
%description
|
||||
A library which is the user-space counterpart for the team network
|
||||
driver, and provides an API to control them.
|
||||
|
||||
Linux kernel 3.3 and above offer a so-called "team" network driver -
|
||||
a lightweight mechanism for bonding multiple interfaces together.
|
||||
It is a userspace-driven alternative to the existing bonding driver.
|
||||
|
||||
%package -n libteam5
|
||||
Summary: Library for controlling 802.1AX team network device
|
||||
Group: System/Libraries
|
||||
|
||||
%description -n libteam5
|
||||
A library which is the user-space counterpart for the team network
|
||||
driver, and provides an API to control them.
|
||||
|
||||
Linux kernel 3.3 and above offer a so-called "team" network driver -
|
||||
a lightweight mechanism for bonding multiple interfaces together.
|
||||
It is a userspace-driven alternative to the existing bonding driver.
|
||||
|
||||
%package -n libteamdctl0
|
||||
Summary: Library for controlling the team network device daemon
|
||||
Group: System/Libraries
|
||||
|
||||
%description -n libteamdctl0
|
||||
Linux kernel 3.3 and above offer a so-called "team" network driver -
|
||||
a lightweight mechanism for bonding multiple interfaces together.
|
||||
It is a userspace-driven alternative to the existing bonding driver.
|
||||
|
||||
%package devel
|
||||
Summary: Development files for libteam
|
||||
Group: Development/Libraries/C and C++
|
||||
Requires: libteam5 = %version
|
||||
Requires: libteamdctl0 = %version
|
||||
|
||||
%description devel
|
||||
A library which is the user-space counterpart for the team network
|
||||
driver, and provides an API to control them.
|
||||
|
||||
This package contains the development headers for the libteam and
|
||||
libteamdctl libraries.
|
||||
|
||||
%package tools
|
||||
Summary: Utilities for controlling team network devices
|
||||
Group: System/Daemons
|
||||
|
||||
%description tools
|
||||
This package contains frontends to libteam that allow changing
|
||||
the (team-specific) properties of team devices.
|
||||
(The general configuration of network devices can be done
|
||||
through using iproute.)
|
||||
|
||||
Linux kernel 3.3 and above offer a so-called "team" network driver -
|
||||
a lightweight mechanism for bonding multiple interfaces together.
|
||||
It is a userspace-driven alternative to the existing bonding driver.
|
||||
|
||||
%package -n python-libteam
|
||||
Summary: Python bindings for libteam
|
||||
Group: Development/Languages/Python
|
||||
|
||||
%description -n python-libteam
|
||||
This package should be installed if you want to develop Python
|
||||
programs that will manipulate team network devices.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
|
||||
%build
|
||||
%configure --includedir="%_includedir/%name" --bindir="%_sbindir" \
|
||||
--disable-silent-rules \
|
||||
--disable-static \
|
||||
--with-run-dir=%teamd_daemon_directory \
|
||||
--with-user=%teamd_user \
|
||||
--with-group=%teamd_group
|
||||
# Use CFLAGS= to kill -Werror
|
||||
make %{?_smp_mflags} CFLAGS="%optflags"
|
||||
%if %{with python2}
|
||||
pushd binding/python/
|
||||
python ./setup.py build
|
||||
popd
|
||||
%endif
|
||||
|
||||
%install
|
||||
b="%buildroot"
|
||||
%make_install
|
||||
%if %{with python2}
|
||||
pushd binding/python/
|
||||
python ./setup.py install --root="$b" --prefix="%_prefix"
|
||||
popd
|
||||
%endif
|
||||
|
||||
# Install /usr/lib/tmpfiles.d/libteam.conf
|
||||
mkdir -p %{buildroot}%{_tmpfilesdir}
|
||||
cat > %{buildroot}%{_tmpfilesdir}/libteam.conf <<EOF
|
||||
# See tmpfiles.d(5) for details
|
||||
# Type(d=directory) Path Mode UID GID Age(until delete when cleaning)
|
||||
d %teamd_daemon_directory 0755 %teamd_user %teamd_group -
|
||||
EOF
|
||||
|
||||
rm -f "$b/%_libdir"/*.la
|
||||
%if 0%{?_unitdir:1}
|
||||
mkdir -p "$b/%_unitdir"
|
||||
install -pm0644 teamd/redhat/systemd/*.service "$b/%_unitdir/"
|
||||
%endif
|
||||
|
||||
%if 0%{?_sysconfdir:1}
|
||||
mkdir -p "$b/%teamd_dbus_policy_directory/"
|
||||
install -pm0644 teamd/dbus/teamd.conf "$b/%teamd_dbus_policy_directory/%teamd_dbus_policy_name"
|
||||
%endif
|
||||
|
||||
%check
|
||||
make check
|
||||
|
||||
%pre tools
|
||||
getent group daemon >/dev/null || %_sbindir/groupadd -r %teamd_group
|
||||
getent passwd %teamd_user >/dev/null || \
|
||||
%_sbindir/useradd -r -g %teamd_group -s /bin/false \
|
||||
-c "Teamd daemon user" -d %_localstatedir/lib/empty %teamd_user
|
||||
%_sbindir/usermod -g %teamd_group %teamd_user 2>/dev/null
|
||||
test -L %teamd_daemon_directory || rm -rf %teamd_daemon_directory && :
|
||||
%if 0%{?_unitdir:1}
|
||||
%service_add_pre teamd@.service
|
||||
%endif
|
||||
|
||||
%post tools
|
||||
# Use %%tmpfiles_create when 13.2 is oldest in support scope
|
||||
/usr/bin/systemd-tmpfiles --create %{_tmpfilesdir}/libteam.conf || :
|
||||
# reload dbus to apply new teamd's policy
|
||||
systemctl reload dbus.service 2>/dev/null || :
|
||||
%if 0%{?_unitdir:1}
|
||||
%service_add_post teamd@.service
|
||||
%endif
|
||||
|
||||
%preun tools
|
||||
%if 0%{?_unitdir:1}
|
||||
%service_del_preun teamd@.service
|
||||
%endif
|
||||
|
||||
%postun tools
|
||||
%if 0%{?_unitdir:1}
|
||||
%service_del_postun teamd@.service
|
||||
%endif
|
||||
# reload dbus to forget teamd's policy
|
||||
if [ ${FIRST_ARG:-$1} -eq 0 ]; then
|
||||
systemctl reload dbus.service 2>/dev/null || :
|
||||
fi
|
||||
|
||||
%post -n libteam5 -p /sbin/ldconfig
|
||||
%postun -n libteam5 -p /sbin/ldconfig
|
||||
%post -n libteamdctl0 -p /sbin/ldconfig
|
||||
%postun -n libteamdctl0 -p /sbin/ldconfig
|
||||
|
||||
%files -n libteam5
|
||||
%_libdir/libteam.so.5*
|
||||
|
||||
%files -n libteamdctl0
|
||||
%_libdir/libteamdctl.so.0*
|
||||
|
||||
%files devel
|
||||
%_includedir/*
|
||||
%_libdir/libteam.so
|
||||
%_libdir/libteamdctl.so
|
||||
%_libdir/pkgconfig/libteam*.pc
|
||||
|
||||
%files tools
|
||||
%_sbindir/bond2team
|
||||
%_sbindir/team*
|
||||
%dir %_sysconfdir/dbus-1
|
||||
%dir %teamd_dbus_policy_directory
|
||||
%config %teamd_dbus_policy_directory/%teamd_dbus_policy_name
|
||||
%_mandir/man1/*
|
||||
%_mandir/man5/*
|
||||
%_mandir/man8/*
|
||||
%if 0%{?_unitdir:1}
|
||||
%_unitdir
|
||||
%endif
|
||||
%{_tmpfilesdir}/libteam.conf
|
||||
|
||||
%if %{with python2}
|
||||
%files -n python-libteam
|
||||
%python_sitearch/*
|
||||
%endif
|
||||
|
||||
%changelog
|
12
start_teamd_from_usr_sbin.patch
Normal file
12
start_teamd_from_usr_sbin.patch
Normal file
|
@ -0,0 +1,12 @@
|
|||
Index: libteam-1.16/teamd/redhat/systemd/teamd@.service
|
||||
===================================================================
|
||||
--- libteam-1.16.orig/teamd/redhat/systemd/teamd@.service
|
||||
+++ libteam-1.16/teamd/redhat/systemd/teamd@.service
|
||||
@@ -3,6 +3,6 @@ Description=Team Daemon for device %I
|
||||
|
||||
[Service]
|
||||
BusName=org.libteam.teamd.%i
|
||||
-ExecStart=/usr/bin/teamd -U -D -o -t %i -f /run/teamd/%i.conf
|
||||
+ExecStart=/usr/sbin/teamd -U -D -o -t %i -f /run/teamd/%i.conf
|
||||
Restart=on-failure
|
||||
RestartPreventExitStatus=1
|
68
teamd-config-update-local-prio-to-kernel.patch
Normal file
68
teamd-config-update-local-prio-to-kernel.patch
Normal file
|
@ -0,0 +1,68 @@
|
|||
From 656db4394c33bccc6a5ed31fe1d719cc07d0b6da Mon Sep 17 00:00:00 2001
|
||||
From: Hangbin Liu <liuhangbin@gmail.com>
|
||||
Date: Mon, 7 Jan 2019 15:58:49 +0800
|
||||
Subject: [PATCH] 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 <liali@redhat.com>
|
||||
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
|
||||
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
|
||||
---
|
||||
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.35.3
|
||||
|
Loading…
Add table
Reference in a new issue