From a60e5ec56a60071deaa4d7dcd92d93e22336bf10 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 20 Jan 2017 22:30:29 -0800 Subject: [PATCH] [libteam]: Add patch 0001-libteam-Add-team_get_port_enabled-function.patch --- ...m-Add-team_get_port_enabled-function.patch | 59 +++++++++++++++++++ src/libteam/Makefile | 4 ++ 2 files changed, 63 insertions(+) create mode 100644 src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch diff --git a/src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch b/src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch new file mode 100644 index 000000000000..9bf08ce61308 --- /dev/null +++ b/src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch @@ -0,0 +1,59 @@ +From 2f9248dd07d51361bc0a93ef70d0f8ac2631af35 Mon Sep 17 00:00:00 2001 +From: Shuotian Cheng +Date: Fri, 20 Jan 2017 12:10:13 -0800 +Subject: [PATCH] libteam: Add team_get_port_enabled function + +--- + include/team.h | 2 ++ + libteam/libteam.c | 22 ++++++++++++++++++++++ + 2 files changed, 24 insertions(+) + +diff --git a/include/team.h b/include/team.h +index 20ebcf6..9ae517d 100644 +--- a/include/team.h ++++ b/include/team.h +@@ -68,6 +68,8 @@ int team_get_bpf_hash_func(struct team_handle *th, struct sock_fprog *fp); + int team_set_bpf_hash_func(struct team_handle *th, const struct sock_fprog *fp); + int team_set_port_enabled(struct team_handle *th, + uint32_t port_ifindex, bool val); ++int team_get_port_enabled(struct team_handle *th, ++ uint32_t port_ifindex, bool *enabled); + int team_set_port_user_linkup_enabled(struct team_handle *th, + uint32_t port_ifindex, bool val); + int team_get_port_user_linkup(struct team_handle *th, +diff --git a/libteam/libteam.c b/libteam/libteam.c +index ac187aa..106e5cf 100644 +--- a/libteam/libteam.c ++++ b/libteam/libteam.c +@@ -1295,6 +1295,28 @@ int team_set_port_enabled(struct team_handle *th, + /** + * @param th libteam library context + * @param port_ifindex port interface index ++ * @param enabled where the enabled state will be stored ++ * ++ * @details Gets enabled state for port identified by port_ifindex ++ * ++ * @return Zero on success or negative number in case of an error. ++ **/ ++TEAM_EXPORT ++int team_get_port_enabled(struct team_handle *th, ++ uint32_t port_ifindex, bool *enabled) ++{ ++ struct team_option *option; ++ ++ option = team_get_option(th, "np", "enabled", port_ifindex); ++ if (!option) ++ return -ENOENT; ++ *enabled = team_get_option_value_bool(option); ++ return 0; ++} ++ ++/** ++ * @param th libteam library context ++ * @param port_ifindex port interface index + * @param val boolean value + * + * @details Enables or disable user linkup for port identified by port_ifindex +-- +2.1.4 + diff --git a/src/libteam/Makefile b/src/libteam/Makefile index b41487241b83..e6864596c98d 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -13,8 +13,12 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : git clone https://github.com/jpirko/libteam.git pushd ./libteam git checkout -f v1.26 + + # Apply patch + git apply ../0001-libteam-Add-team_get_port_enabled-function.patch popd + # Obtain debian packaging git clone https://anonscm.debian.org/git/collab-maint/libteam.git tmp pushd ./tmp git checkout -f da006f2 # v1.26