Hello community, here is the log from the commit of package libteam for openSUSE:Factory checked in at 2016-02-18 11:06:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libteam (Old) and /work/SRC/openSUSE:Factory/.libteam.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libteam" Changes: -------- --- /work/SRC/openSUSE:Factory/libteam/libteam.changes 2015-09-19 06:55:13.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libteam.new/libteam.changes 2016-02-18 12:35:45.000000000 +0100 @@ -1,0 +2,8 @@ +Thu Feb 11 11:51:38 UTC 2016 - jeng...@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 + +------------------------------------------------------------------- Old: ---- libteam-1.18.tar.gz New: ---- libteam-1.22.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libteam.spec ++++++ --- /var/tmp/diff_new_pack.mcPPMV/_old 2016-02-18 12:35:46.000000000 +0100 +++ /var/tmp/diff_new_pack.mcPPMV/_new 2016-02-18 12:35:46.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package libteam # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: libteam -Version: 1.18 +Version: 1.22 Release: 0 Summary: Utilities for controlling 802.1AX team network device License: LGPL-2.1+ ++++++ libteam-1.18.tar.gz -> libteam-1.22.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/config.h.in new/libteam-1.22/config.h.in --- old/libteam-1.18/config.h.in 2015-08-21 07:51:18.000000000 +0200 +++ new/libteam-1.22/config.h.in 2015-11-03 13:36:13.000000000 +0100 @@ -18,6 +18,9 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `cap' library (-lcap). */ +#undef HAVE_LIBCAP + /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC @@ -83,6 +86,15 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* TEAMD GROUP. */ +#undef TEAMD_GROUP + +/* TEAMD RUN DIR. */ +#undef TEAMD_RUN_DIR + +/* TEAMD USER. */ +#undef TEAMD_USER + /* Version number of package */ #undef VERSION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/configure new/libteam-1.22/configure --- old/libteam-1.18/configure 2015-08-21 07:51:18.000000000 +0200 +++ new/libteam-1.22/configure 2015-11-03 13:36:13.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libteam 1.18. +# Generated by GNU Autoconf 2.69 for libteam 1.22. # # Report bugs to <j...@resnulli.us>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libteam' PACKAGE_TARNAME='libteam' -PACKAGE_VERSION='1.18' -PACKAGE_STRING='libteam 1.18' +PACKAGE_VERSION='1.22' +PACKAGE_STRING='libteam 1.22' PACKAGE_BUGREPORT='j...@resnulli.us' PACKAGE_URL='' @@ -641,6 +641,8 @@ ZMQ_CFLAGS DBUS_LIBS DBUS_CFLAGS +LIBCAP_FALSE +LIBCAP_TRUE LIBOBJS JANSSON_LIBS JANSSON_CFLAGS @@ -783,8 +785,11 @@ enable_libtool_lock enable_logging enable_debug +with_user +with_group enable_dbus enable_zmq +with_run_dir ' ac_precious_vars='build_alias host_alias @@ -1348,7 +1353,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libteam 1.18 to adapt to many kinds of systems. +\`configure' configures libteam 1.22 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1418,7 +1423,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libteam 1.18:";; + short | recursive ) echo "Configuration of libteam 1.22:";; esac cat <<\_ACEOF @@ -1450,6 +1455,10 @@ --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). + --with-user[=username] Set default daemon user [default=root] + --with-group[=groupname] + Specify the system group [default=root] + --with-run-dir[=DIR] Teamd run time directory [default=${localstatedir}] Some influential environment variables: CC C compiler command @@ -1547,7 +1556,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libteam configure 1.18 +libteam configure 1.22 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1916,7 +1925,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libteam $as_me 1.18, which was +It was created by libteam $as_me 1.22, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2782,7 +2791,7 @@ # Define the identity of the package. PACKAGE='libteam' - VERSION='1.18' + VERSION='1.22' cat >>confdefs.h <<_ACEOF @@ -4140,16 +4149,16 @@ # 6. If any interfaces have been removed or changed since the last public # release, then set age to 0. -LIBTEAM_CURRENT=7 +LIBTEAM_CURRENT=8 -LIBTEAM_REVISION=3 +LIBTEAM_REVISION=2 -LIBTEAM_AGE=2 +LIBTEAM_AGE=3 LIBTEAMDCTL_CURRENT=1 -LIBTEAMDCTL_REVISION=4 +LIBTEAMDCTL_REVISION=5 LIBTEAMDCTL_AGE=1 @@ -13160,6 +13169,102 @@ fi +user=root +dbus_policy_template="teamd/teamd.conf.in" +dbus_policy_file="teamd/dbus/teamd.conf" + +# Check whether --with-user was given. +if test "${with_user+set}" = set; then : + withval=$with_user; case "$withval" in + root|yes|no|"") ;; + *) user="$withval" + sed -e "s|@teamd_user@|$user|g" \ + < $dbus_policy_template > $dbus_policy_file ;; + esac + +fi + + +cat >>confdefs.h <<_ACEOF +#define TEAMD_USER "${user}" +_ACEOF + + +group=root + +# Check whether --with-group was given. +if test "${with_group+set}" = set; then : + withval=$with_group; case "$withval" in + yes|no|"") ;; + *) group="$withval" ;; + esac + +fi + + +cat >>confdefs.h <<_ACEOF +#define TEAMD_GROUP "${group}" +_ACEOF + + + if test "x$user" != "xroot" -o "x$group" != "xroot"; then + LIBCAP_TRUE= + LIBCAP_FALSE='#' +else + LIBCAP_TRUE='#' + LIBCAP_FALSE= +fi + +if test -z "$LIBCAP_TRUE"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cap_init in -lcap" >&5 +$as_echo_n "checking for cap_init in -lcap... " >&6; } +if ${ac_cv_lib_cap_cap_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcap $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char cap_init (); +int +main () +{ +return cap_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_cap_cap_init=yes +else + ac_cv_lib_cap_cap_init=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cap_cap_init" >&5 +$as_echo "$ac_cv_lib_cap_cap_init" >&6; } +if test "x$ac_cv_lib_cap_cap_init" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBCAP 1 +_ACEOF + + LIBS="-lcap $LIBS" + +else + as_fn_error $? "*** Non-root daemon support requested but libcap-devel library not found" "$LINENO" 5 +fi + +fi + have_dbus=no # Check whether --enable-dbus was given. if test "${enable_dbus+set}" = set; then : @@ -13330,6 +13435,21 @@ fi fi + +# Check whether --with-run-dir was given. +if test "${with_run_dir+set}" = set; then : + withval=$with_run_dir; case "$withval" in + yes|no|"") ;; + *) +cat >>confdefs.h <<_ACEOF +#define TEAMD_RUN_DIR "${withval}/" +_ACEOF + ;; + esac + +fi + + for ac_prog in doxygen do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -13528,6 +13648,10 @@ as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${LIBCAP_TRUE}" && test -z "${LIBCAP_FALSE}"; then + as_fn_error $? "conditional \"LIBCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_DOXYGEN_TRUE}" && test -z "${HAVE_DOXYGEN_FALSE}"; then as_fn_error $? "conditional \"HAVE_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -13929,7 +14053,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libteam $as_me 1.18, which was +This file was extended by libteam $as_me 1.22, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13995,7 +14119,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libteam config.status 1.18 +libteam config.status 1.22 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/configure.ac new/libteam-1.22/configure.ac --- old/libteam-1.18/configure.ac 2015-08-21 07:49:30.000000000 +0200 +++ new/libteam-1.22/configure.ac 2015-11-03 13:35:00.000000000 +0100 @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([libteam], [1.18], [j...@resnulli.us]) +AC_INIT([libteam], [1.22], [j...@resnulli.us]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) @@ -23,12 +23,12 @@ # 6. If any interfaces have been removed or changed since the last public # release, then set age to 0. -AC_SUBST(LIBTEAM_CURRENT, 7) -AC_SUBST(LIBTEAM_REVISION, 3) -AC_SUBST(LIBTEAM_AGE, 2) +AC_SUBST(LIBTEAM_CURRENT, 8) +AC_SUBST(LIBTEAM_REVISION, 2) +AC_SUBST(LIBTEAM_AGE, 3) AC_SUBST(LIBTEAMDCTL_CURRENT, 1) -AC_SUBST(LIBTEAMDCTL_REVISION, 4) +AC_SUBST(LIBTEAMDCTL_REVISION, 5) AC_SUBST(LIBTEAMDCTL_AGE, 1) CFLAGS="$CFLAGS -Wall" @@ -77,6 +77,35 @@ AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) ]) +user=root +dbus_policy_template="teamd/teamd.conf.in" +dbus_policy_file="teamd/dbus/teamd.conf" +AC_ARG_WITH([user], + [AS_HELP_STRING([--with-user@<:@=username@:>@], [Set default daemon user @<:@default=root@:>@])], + [case "$withval" in + root|yes|no|"") ;; + *) user="$withval" + sed -e "s|[@]teamd_user[@]|$user|g" \ + < $dbus_policy_template > $dbus_policy_file ;; + esac] +) +AC_DEFINE_UNQUOTED(TEAMD_USER, "${user}", [TEAMD USER.]) + +group=root +AC_ARG_WITH([group], + [AS_HELP_STRING([--with-group@<:@=groupname@:>@], [Specify the system group @<:@default=root@:>@])], + [case "$withval" in + yes|no|"") ;; + *) group="$withval" ;; + esac] +) +AC_DEFINE_UNQUOTED(TEAMD_GROUP, "${group}", [TEAMD GROUP.]) + +AM_CONDITIONAL([LIBCAP], [test "x$user" != "xroot" -o "x$group" != "xroot"]) +AM_COND_IF([LIBCAP], + [AC_CHECK_LIB([cap], [cap_init],, + AC_MSG_ERROR([*** Non-root daemon support requested but libcap-devel library not found]))]) + have_dbus=no AC_ARG_ENABLE([dbus], AS_HELP_STRING([--disable-dbus], [disable D-Bus API @<:@default=enabled@:>@])) @@ -101,6 +130,14 @@ fi fi +AC_ARG_WITH([run-dir], + [AS_HELP_STRING([--with-run-dir@<:@=DIR@:>@], [Teamd run time directory @<:@default=${localstatedir}@:>@])], + [case "$withval" in + yes|no|"") ;; + *) AC_DEFINE_UNQUOTED(TEAMD_RUN_DIR, "${withval}/", [TEAMD RUN DIR.]) ;; + esac] +) + AC_CHECK_PROGS([DOXYGEN], [doxygen]) if test -z "$DOXYGEN"; then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/include/team.h new/libteam-1.22/include/team.h --- old/libteam-1.18/include/team.h 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/include/team.h 2015-10-05 15:37:26.000000000 +0200 @@ -138,6 +138,7 @@ /* ifinfo getters */ bool team_is_ifinfo_removed(struct team_ifinfo *ifinfo); uint32_t team_get_ifinfo_ifindex(struct team_ifinfo *ifinfo); +bool team_get_ifinfo_admin_state(struct team_ifinfo *ifinfo); struct team_port *team_get_ifinfo_port(struct team_ifinfo *ifinfo); char *team_get_ifinfo_hwaddr(struct team_ifinfo *ifinfo); bool team_is_ifinfo_hwaddr_changed(struct team_ifinfo *ifinfo); @@ -149,6 +150,7 @@ bool team_is_ifinfo_ifname_changed(struct team_ifinfo *ifinfo); uint32_t team_get_ifinfo_master_ifindex(struct team_ifinfo *ifinfo); bool team_is_ifinfo_master_ifindex_changed(struct team_ifinfo *ifinfo); +bool team_is_ifinfo_admin_state_changed(struct team_ifinfo *ifinfo); char *team_get_ifinfo_phys_port_id(struct team_ifinfo *ifinfo); bool team_is_ifinfo_phys_port_id_changed(struct team_ifinfo *ifinfo); size_t team_get_ifinfo_phys_port_id_len(struct team_ifinfo *ifinfo); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/libteam/ifinfo.c new/libteam-1.22/libteam/ifinfo.c --- old/libteam-1.18/libteam/ifinfo.c 2015-07-19 08:27:02.000000000 +0200 +++ new/libteam-1.22/libteam/ifinfo.c 2015-10-05 15:37:26.000000000 +0200 @@ -57,6 +57,7 @@ size_t orig_hwaddr_len; char ifname[IFNAMSIZ]; uint32_t master_ifindex; + bool admin_state; #define MAX_PHYS_PORT_ID_LEN 32 char phys_port_id[MAX_PHYS_PORT_ID_LEN]; size_t phys_port_id_len; @@ -70,10 +71,11 @@ #define CHANGED_MASTER_IFINDEX (1 << 4) #define CHANGED_PHYS_PORT_ID (1 << 5) #define CHANGED_PHYS_PORT_ID_LEN (1 << 6) +#define CHANGED_ADMIN_STATE (1 << 7) #define CHANGED_ANY (CHANGED_REMOVED | CHANGED_HWADDR | \ CHANGED_HWADDR_LEN | CHANGED_IFNAME | \ CHANGED_MASTER_IFINDEX | CHANGED_PHYS_PORT_ID | \ - CHANGED_PHYS_PORT_ID_LEN) + CHANGED_PHYS_PORT_ID_LEN | CHANGED_ADMIN_STATE) static void set_changed(struct team_ifinfo *ifinfo, int bit) { @@ -127,6 +129,20 @@ } } +static void update_admin_state(struct team_ifinfo *ifinfo, struct rtnl_link *link) +{ + unsigned int flags; + bool admin_state; + + flags = rtnl_link_get_flags(link); + admin_state = ((flags & IFF_UP) == IFF_UP); + + if (admin_state != ifinfo->admin_state) { + ifinfo->admin_state = admin_state; + set_changed(ifinfo, CHANGED_ADMIN_STATE); + } +} + static void update_master(struct team_ifinfo *ifinfo, struct rtnl_link *link) { uint32_t master_ifindex; @@ -172,6 +188,7 @@ update_master(ifinfo, link); update_hwaddr(ifinfo, link); update_phys_port_id(ifinfo, link); + update_admin_state(ifinfo, link); } static struct team_ifinfo *ifinfo_find(struct team_handle *th, uint32_t ifindex) @@ -475,6 +492,19 @@ /** * @param ifinfo ifinfo structure * + * @details Get ifinfo admin state. + * + * @return Ifinfo interface index as idenfified by in kernel. + **/ +TEAM_EXPORT +bool team_get_ifinfo_admin_state(struct team_ifinfo *ifinfo) +{ + return ifinfo->admin_state; +} + +/** + * @param ifinfo ifinfo structure + * * @details Get port associated to rtnetlink interface info. * * @return Pointer to appropriate team_port structure @@ -617,6 +647,19 @@ } /** + * @param ifinfo ifinfo structure + * + * @details See if admin state of interface got changed. + * + * @return True if admin state of interface got changed. + **/ +TEAM_EXPORT +bool team_is_ifinfo_admin_state_changed(struct team_ifinfo *ifinfo) +{ + return is_changed(ifinfo, CHANGED_ADMIN_STATE); +} + +/** * @param ifinfo ifinfo structure * * @details Get ifinfo physical port ID. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/libteam/nl_updates.h new/libteam-1.22/libteam/nl_updates.h --- old/libteam-1.18/libteam/nl_updates.h 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/libteam/nl_updates.h 2015-10-05 15:37:26.000000000 +0200 @@ -27,14 +27,10 @@ #endif #ifndef NLA_S8 -/* - * Presume that libnl will add all types and relevant puts/gets at once - * so check only for NLA_S8. - */ #define NLA_S8 12 -#define NLA_S16 13 -#define NLA_S32 14 -#define NLA_S64 15 +#endif + +#ifndef NLA_PUT_S8 /** * Add 8 bit signed integer attribute to netlink message. @@ -51,16 +47,33 @@ } /** + * Add 8 bit signed integer attribute to netlink message. + * @arg msg Netlink message. + * @arg attrtype Attribute type. + * @arg value Numeric value. + */ +#define NLA_PUT_S8(msg, attrtype, value) \ + NLA_PUT_TYPE(msg, int8_t, attrtype, value) + +/** * Return value of 8 bit signed integer attribute. * @arg nla 8 bit signed integer attribute * * @return Payload as 8 bit signed integer. */ -int8_t nla_get_s8(struct nlattr *nla) +static inline int8_t nla_get_s8(struct nlattr *nla) { return *(int8_t *) nla_data(nla); } +#endif /* NLA_S8 */ + +#ifndef NLA_S16 +#define NLA_S16 13 +#endif + +#ifndef NLA_PUT_S16 + /** * Add 16 bit signed integer attribute to netlink message. * @arg msg Netlink message. @@ -70,22 +83,39 @@ * @see nla_put * @return 0 on success or a negative error code. */ -int nla_put_s16(struct nl_msg *msg, int attrtype, int16_t value) +static inline int nla_put_s16(struct nl_msg *msg, int attrtype, int16_t value) { return nla_put(msg, attrtype, sizeof(int16_t), &value); } /** + * Add 16 bit signed integer attribute to netlink message. + * @arg msg Netlink message. + * @arg attrtype Attribute type. + * @arg value Numeric value. + */ +#define NLA_PUT_S16(msg, attrtype, value) \ + NLA_PUT_TYPE(msg, int16_t, attrtype, value) + +/** * Return payload of 16 bit signed integer attribute. * @arg nla 16 bit signed integer attribute * * @return Payload as 16 bit signed integer. */ -int16_t nla_get_s16(struct nlattr *nla) +static inline int16_t nla_get_s16(struct nlattr *nla) { return *(int16_t *) nla_data(nla); } +#endif /* NLA_S16 */ + +#ifndef NLA_S32 +#define NLA_S32 14 +#endif + +#ifndef NLA_PUT_S32 + /** * Add 32 bit signed integer attribute to netlink message. * @arg msg Netlink message. @@ -95,22 +125,39 @@ * @see nla_put * @return 0 on success or a negative error code. */ -int nla_put_s32(struct nl_msg *msg, int attrtype, int32_t value) +static inline int nla_put_s32(struct nl_msg *msg, int attrtype, int32_t value) { return nla_put(msg, attrtype, sizeof(int32_t), &value); } /** + * Add 32 bit signed integer attribute to netlink message. + * @arg msg Netlink message. + * @arg attrtype Attribute type. + * @arg value Numeric value. + */ +#define NLA_PUT_S32(msg, attrtype, value) \ + NLA_PUT_TYPE(msg, int32_t, attrtype, value) + +/** * Return payload of 32 bit signed integer attribute. * @arg nla 32 bit signed integer attribute. * * @return Payload as 32 bit signed integer. */ -int32_t nla_get_s32(struct nlattr *nla) +static inline int32_t nla_get_s32(struct nlattr *nla) { return *(int32_t *) nla_data(nla); } +#endif /* NLA_S32 */ + +#ifndef NLA_S64 +#define NLA_S64 15 +#endif + +#ifndef NLA_PUT_S64 + /** * Add 64 bit signed integer attribute to netlink message. * @arg msg Netlink message. @@ -120,39 +167,12 @@ * @see nla_put * @return 0 on success or a negative error code. */ -int nla_put_s64(struct nl_msg *msg, int attrtype, int64_t value) +static inline int nla_put_s64(struct nl_msg *msg, int attrtype, int64_t value) { return nla_put(msg, attrtype, sizeof(int64_t), &value); } /** - * Add 8 bit signed integer attribute to netlink message. - * @arg msg Netlink message. - * @arg attrtype Attribute type. - * @arg value Numeric value. - */ -#define NLA_PUT_S8(msg, attrtype, value) \ - NLA_PUT_TYPE(msg, int8_t, attrtype, value) - -/** - * Add 16 bit signed integer attribute to netlink message. - * @arg msg Netlink message. - * @arg attrtype Attribute type. - * @arg value Numeric value. - */ -#define NLA_PUT_S16(msg, attrtype, value) \ - NLA_PUT_TYPE(msg, int16_t, attrtype, value) - -/** - * Add 32 bit signed integer attribute to netlink message. - * @arg msg Netlink message. - * @arg attrtype Attribute type. - * @arg value Numeric value. - */ -#define NLA_PUT_S32(msg, attrtype, value) \ - NLA_PUT_TYPE(msg, int32_t, attrtype, value) - -/** * Add 64 bit signed integer attribute to netlink message. * @arg msg Netlink message. * @arg attrtype Attribute type. @@ -167,7 +187,7 @@ * * @return Payload as 64 bit signed integer. */ -int64_t nla_get_s64(struct nlattr *nla) +static inline int64_t nla_get_s64(struct nlattr *nla) { int64_t tmp; @@ -176,6 +196,6 @@ return tmp; } -#endif +#endif /* NLA_S64 */ #endif /* _NL_UPDATES_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/libteamdctl/cli_usock.c new/libteam-1.22/libteamdctl/cli_usock.c --- old/libteam-1.18/libteamdctl/cli_usock.c 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/libteamdctl/cli_usock.c 2015-10-05 15:37:26.000000000 +0200 @@ -79,7 +79,8 @@ return 0; } -#define WAIT_USEC (TEAMDCTL_REPLY_TIMEOUT * 1000) +#define WAIT_SEC (TEAMDCTL_REPLY_TIMEOUT / 1000) +#define WAIT_USEC (TEAMDCTL_REPLY_TIMEOUT % 1000 * 1000) static int cli_usock_wait_recv(int sock) { @@ -88,7 +89,7 @@ int ret; struct timeval tv; - tv.tv_sec = 0; + tv.tv_sec = WAIT_SEC; tv.tv_usec = WAIT_USEC; FD_ZERO(&rfds); FD_SET(sock, &rfds); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/Makefile.am new/libteam-1.22/teamd/Makefile.am --- old/libteam-1.18/teamd/Makefile.am 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/teamd/Makefile.am 2015-10-05 16:15:46.000000000 +0200 @@ -21,7 +21,7 @@ teamd_runner_basic_ones.c teamd_runner_activebackup.c \ teamd_runner_loadbalance.c teamd_runner_lacp.c -EXTRA_DIST = example_configs dbus redhat +EXTRA_DIST = example_configs dbus redhat teamd.conf.in noinst_HEADERS = teamd.h teamd_workq.h teamd_bpf_chef.h teamd_ctl.h \ teamd_json.h teamd_dbus.h teamd_zmq.h teamd_usock.h \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/Makefile.in new/libteam-1.22/teamd/Makefile.in --- old/libteam-1.18/teamd/Makefile.in 2015-08-21 07:51:19.000000000 +0200 +++ new/libteam-1.22/teamd/Makefile.in 2015-11-03 13:36:15.000000000 +0100 @@ -351,7 +351,7 @@ teamd_runner_basic_ones.c teamd_runner_activebackup.c \ teamd_runner_loadbalance.c teamd_runner_lacp.c -EXTRA_DIST = example_configs dbus redhat +EXTRA_DIST = example_configs dbus redhat teamd.conf.in noinst_HEADERS = teamd.h teamd_workq.h teamd_bpf_chef.h teamd_ctl.h \ teamd_json.h teamd_dbus.h teamd_zmq.h teamd_usock.h \ teamd_dbus_common.h teamd_usock_common.h teamd_config.h \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/dbus/teamd.conf new/libteam-1.22/teamd/dbus/teamd.conf --- old/libteam-1.18/teamd/dbus/teamd.conf 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/teamd/dbus/teamd.conf 2015-10-26 14:44:06.000000000 +0100 @@ -8,6 +8,5 @@ </policy> <policy context="default"> <deny own_prefix="org.libteam.teamd"/> - <deny send_interface="org.libteam.teamd"/> </policy> </busconfig> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/redhat/systemd/teamd@.service new/libteam-1.22/teamd/redhat/systemd/teamd@.service --- old/libteam-1.18/teamd/redhat/systemd/teamd@.service 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/teamd/redhat/systemd/teamd@.service 2015-10-05 15:37:26.000000000 +0200 @@ -1,5 +1,6 @@ [Unit] Description=Team Daemon for device %I +Before=network.target [Service] BusName=org.libteam.teamd.%i diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/teamd.c new/libteam-1.22/teamd/teamd.c --- old/libteam-1.18/teamd/teamd.c 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/teamd/teamd.c 2015-10-06 16:03:50.000000000 +0200 @@ -846,8 +846,14 @@ teamd_config_for_each_key(key, ctx, "$.ports") { err = teamd_port_add_ifname(ctx, key); - if (err) + if (err == -ENODEV) { + teamd_log_warn("%s: Skipped adding a missing port.", key); + continue; + } else if (err) { + teamd_log_err("%s: Failed to add port (%s).", key, + strerror(-err)); return err; + } } return 0; } @@ -1441,10 +1447,8 @@ pid_t pid; int err = 0; - if (getuid() != 0) { - teamd_log_err("This program is intended to be run as root."); - return -EPERM; - } + if (getuid() == 0) + teamd_log_warn("This program is not intended to be run as root."); if (daemon_reset_sigs(-1) < 0) { teamd_log_err("Failed to reset all signal handlers."); @@ -1615,10 +1619,6 @@ if (ctx->pid_file) return 0; - err = teamd_make_rundir(); - if (err) - return err; - err = asprintf(&ctx->pid_file, TEAMD_RUN_DIR"%s.pid", ctx->team_devname); if (err == -1) { teamd_log_err("Failed allocate memory for PID file string."); @@ -1664,12 +1664,110 @@ free(ctx); } + +#ifdef HAVE_LIBCAP +#include <sys/prctl.h> +#include <sys/capability.h> +#include <sys/types.h> +#include <pwd.h> +#include <grp.h> + +#ifndef TEAMD_USER +#define TEAMD_USER "root" +#endif +#ifndef TEAMD_GROUP +#define TEAMD_GROUP "root" +#endif + +static int teamd_drop_privileges() +{ + cap_value_t cv[] = {CAP_NET_ADMIN, CAP_NET_BIND_SERVICE, CAP_NET_RAW}; + cap_t my_caps; + struct passwd *pw = NULL; + struct group *grpent = NULL; + + if ((pw = getpwnam(TEAMD_USER)) == NULL) { + fprintf(stderr, "Error reading user %s entry (%m)\n", TEAMD_USER); + goto error; + } + + if (pw->pw_uid == 0) + return 0; + + if ((grpent = getgrnam(TEAMD_GROUP)) == NULL) { + fprintf(stderr, "Error reading group %s entry (%m)\n", TEAMD_GROUP); + goto error; + } + + if (pw->pw_gid != grpent->gr_gid) { + fprintf(stderr, "%s GID (%u) does not match %s GID (%u)\n", + TEAMD_USER, pw->pw_gid, TEAMD_GROUP, grpent->gr_gid); + 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; + } + + if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0) + goto error; + + if (setgid(pw->pw_gid) < 0) { + fprintf(stderr, "Unable to set process GID to %u (%m)\n", pw->pw_gid); + goto error; + } + + if (initgroups(TEAMD_USER, pw->pw_gid) < 0) { + fprintf(stderr, "Unable to initialize the group access list for %s user with GID %u (%m)\n", + TEAMD_USER, pw->pw_gid); + goto error; + } + if (setuid(pw->pw_uid) < 0) { + fprintf(stderr, "Unable to set UID to %u (%m)\n", pw->pw_uid); + 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) + goto error; + if (cap_set_flag(my_caps, CAP_PERMITTED, ARRAY_SIZE(cv), cv, CAP_SET) < 0) + goto error; + if (cap_set_proc(my_caps) < 0) + goto error; + cap_free(my_caps); + + return 0; +error: + fprintf(stderr, "Failed to drop privileges\n"); + return -EINVAL; +} + +#else + +static int teamd_drop_privileges() +{ + return 0; +} + +#endif + int main(int argc, char **argv) { enum teamd_exit_code ret = TEAMD_EXIT_FAILURE; int err; struct teamd_context *ctx; + err = teamd_make_rundir(); + if (err) + return ret; + + err = teamd_drop_privileges(); + if (err) + return ret; + err = teamd_context_init(&ctx); if (err) { fprintf(stderr, "Failed to init daemon context\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/teamd.conf.in new/libteam-1.22/teamd/teamd.conf.in --- old/libteam-1.18/teamd/teamd.conf.in 1970-01-01 01:00:00.000000000 +0100 +++ new/libteam-1.22/teamd/teamd.conf.in 2015-10-26 14:44:06.000000000 +0100 @@ -0,0 +1,16 @@ +<?xml version="1.0"?> <!--*-nxml-*--> +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<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"/> + </policy> +</busconfig> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/teamd.h new/libteam-1.22/teamd/teamd.h --- old/libteam-1.18/teamd/teamd.h 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/teamd/teamd.h 2015-10-05 15:37:26.000000000 +0200 @@ -67,7 +67,9 @@ TEAMD_BUG(); } +#ifndef TEAMD_RUN_DIR #define TEAMD_RUN_DIR "/var/run/teamd/" +#endif static inline int teamd_make_rundir(void) { @@ -174,6 +176,7 @@ struct teamd_event_watch_ops { int (*hwaddr_changed)(struct teamd_context *ctx, void *priv); int (*ifname_changed)(struct teamd_context *ctx, void *priv); + int (*admin_state_changed)(struct teamd_context *ctx, void *priv); int (*port_added)(struct teamd_context *ctx, struct teamd_port *tdport, void *priv); void (*port_removed)(struct teamd_context *ctx, @@ -205,6 +208,8 @@ struct team_ifinfo *ifinfo); int teamd_event_ifinfo_ifname_changed(struct teamd_context *ctx, struct team_ifinfo *ifinfo); +int teamd_event_ifinfo_admin_state_changed(struct teamd_context *ctx, + struct team_ifinfo *ifinfo); int teamd_events_init(struct teamd_context *ctx); void teamd_events_fini(struct teamd_context *ctx); int teamd_event_watch_register(struct teamd_context *ctx, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/teamd_ctl.c new/libteam-1.22/teamd/teamd_ctl.c --- old/libteam-1.18/teamd/teamd_ctl.c 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/teamd/teamd_ctl.c 2015-10-05 15:37:26.000000000 +0200 @@ -102,6 +102,11 @@ teamd_log_dbgx(ctx, 2, "port_devname \"%s\"", port_devname); err = teamd_port_add_ifname(ctx, port_devname); + if (err) { + teamd_log_err("%s: Failed to add port (%s).", port_devname, + strerror(-err)); + } + switch (err) { case -ENODEV: return ops->reply_err(ops_priv, "NoSuchDev", "No such device."); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/teamd_events.c new/libteam-1.22/teamd/teamd_events.c --- old/libteam-1.18/teamd/teamd_events.c 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/teamd/teamd_events.c 2015-10-05 15:37:26.000000000 +0200 @@ -167,6 +167,23 @@ return 0; } +int teamd_event_ifinfo_admin_state_changed(struct teamd_context *ctx, + struct team_ifinfo *ifinfo) +{ + struct event_watch_item *watch; + uint32_t ifindex = team_get_ifinfo_ifindex(ifinfo); + int err; + + list_for_each_node_entry(watch, &ctx->event_watch_list, list) { + if (watch->ops->admin_state_changed && ctx->ifindex == ifindex) { + err = watch->ops->admin_state_changed(ctx, watch->priv); + if (err) + return err; + } + } + return 0; +} + int teamd_events_init(struct teamd_context *ctx) { list_init(&ctx->event_watch_list); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/teamd_ifinfo_watch.c new/libteam-1.22/teamd/teamd_ifinfo_watch.c --- old/libteam-1.18/teamd/teamd_ifinfo_watch.c 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/teamd/teamd_ifinfo_watch.c 2015-10-05 15:37:26.000000000 +0200 @@ -36,10 +36,16 @@ int err; team_for_each_ifinfo(ifinfo, th) { - if (ctx->ifinfo == ifinfo && - team_is_ifinfo_removed(ifinfo)) { - teamd_log_warn("Team device removal detected."); - teamd_run_loop_quit(ctx, 0); + if (ctx->ifinfo == ifinfo) { + if (team_is_ifinfo_removed(ifinfo)) { + teamd_log_warn("Team device removal detected."); + teamd_run_loop_quit(ctx, 0); + } + if (team_is_ifinfo_admin_state_changed(ifinfo)) { + err = teamd_event_ifinfo_admin_state_changed(ctx, ifinfo); + if (err) + return err; + } } if (team_is_ifinfo_hwaddr_changed(ifinfo) || diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/teamd_lw_ethtool.c new/libteam-1.22/teamd/teamd_lw_ethtool.c --- old/libteam-1.18/teamd/teamd_lw_ethtool.c 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/teamd/teamd_lw_ethtool.c 2015-10-05 15:37:26.000000000 +0200 @@ -109,7 +109,7 @@ int err; int tmp; - err = teamd_config_int_get(ctx, &tmp, "@.queue_id", cpcookie); + err = teamd_config_int_get(ctx, &tmp, "@.delay_up", cpcookie); if (!err) { if (tmp < 0) { teamd_log_err("\"delay_up\" must not be negative number."); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/teamd_per_port.c new/libteam-1.22/teamd/teamd_per_port.c --- old/libteam-1.18/teamd/teamd_per_port.c 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/teamd/teamd_per_port.c 2015-10-05 15:37:26.000000000 +0200 @@ -333,16 +333,12 @@ int teamd_port_add_ifname(struct teamd_context *ctx, const char *port_name) { - int err; uint32_t ifindex; ifindex = team_ifname2ifindex(ctx->th, port_name); teamd_log_dbg("%s: Adding port (found ifindex \"%d\").", port_name, ifindex); - err = team_port_add(ctx->th, ifindex); - if (err) - teamd_log_err("%s: Failed to add port.", port_name); - return err; + return team_port_add(ctx->th, ifindex); } static int teamd_port_remove(struct teamd_context *ctx, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/teamd_runner_lacp.c new/libteam-1.22/teamd/teamd_runner_lacp.c --- old/libteam-1.18/teamd/teamd_runner_lacp.c 2015-08-21 07:44:29.000000000 +0200 +++ new/libteam-1.22/teamd/teamd_runner_lacp.c 2015-10-12 21:25:10.000000000 +0200 @@ -888,9 +888,7 @@ lacp_port_actor_system_update(lacp_port); } -static int lacpdu_send(struct lacp_port *lacp_port); - -static int lacp_port_actor_update(struct lacp_port *lacp_port) +static void lacp_port_actor_update(struct lacp_port *lacp_port) { uint8_t state = 0; @@ -910,13 +908,10 @@ teamd_log_dbg("%s: lacp info state: 0x%02X.", lacp_port->tdport->ifname, state); lacp_port->actor.state = state; - - if (lacp_port->periodic_on) - return 0; - - return lacpdu_send(lacp_port); } +static int lacpdu_send(struct lacp_port *lacp_port); + static int lacp_port_set_state(struct lacp_port *lacp_port, enum lacp_port_state new_state) { @@ -971,7 +966,10 @@ if (err) return err; - return lacp_port_actor_update(lacp_port); + lacp_port_actor_update(lacp_port); + if (lacp_port->periodic_on) + return 0; + return lacpdu_send(lacp_port); } static enum lacp_port_state lacp_port_get_state(struct lacp_port *lacp_port) @@ -1016,6 +1014,11 @@ struct sockaddr_ll ll_my; struct sockaddr_ll ll_slow; int err; + bool admin_state; + + admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); + if (!admin_state) + return 0; err = teamd_getsockname_hwaddr(lacp_port->sock, &ll_my, 0); if (err) @@ -1109,6 +1112,7 @@ { struct lacp_port *lacp_port = priv; + lacp_port_actor_update(lacp_port); return lacpdu_send(lacp_port); } @@ -1302,6 +1306,28 @@ return 0; } +static int lacp_event_watch_admin_state_changed(struct teamd_context *ctx, + void *priv) +{ + struct lacp *lacp = priv; + struct teamd_port *tdport; + bool admin_state; + int err; + + admin_state = team_get_ifinfo_admin_state(ctx->ifinfo); + + teamd_for_each_tdport(tdport, ctx) { + struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); + + err = lacp_port_set_state(lacp_port, + admin_state?PORT_STATE_EXPIRED:PORT_STATE_DISABLED); + if (err) + return err; + } + return 0; +} + + static int lacp_event_watch_port_added(struct teamd_context *ctx, struct teamd_port *tdport, void *priv) { @@ -1331,11 +1357,12 @@ return lacp_port_link_update(lacp_port); } -static const struct teamd_event_watch_ops lacp_port_watch_ops = { +static const struct teamd_event_watch_ops lacp_event_watch_ops = { .hwaddr_changed = lacp_event_watch_hwaddr_changed, .port_added = lacp_event_watch_port_added, .port_removed = lacp_event_watch_port_removed, .port_changed = lacp_event_watch_port_changed, + .admin_state_changed = lacp_event_watch_admin_state_changed, }; static int lacp_carrier_init(struct teamd_context *ctx, struct lacp *lacp) @@ -1816,7 +1843,7 @@ teamd_log_err("Failed to initialize carrier."); return err; } - err = teamd_event_watch_register(ctx, &lacp_port_watch_ops, lacp); + err = teamd_event_watch_register(ctx, &lacp_event_watch_ops, lacp); if (err) { teamd_log_err("Failed to register event watch."); return err; @@ -1836,7 +1863,7 @@ balancer_fini: teamd_balancer_fini(lacp->tb); event_watch_unregister: - teamd_event_watch_unregister(ctx, &lacp_port_watch_ops, lacp); + teamd_event_watch_unregister(ctx, &lacp_event_watch_ops, lacp); return err; } @@ -1846,7 +1873,7 @@ teamd_state_val_unregister(ctx, &lacp_state_vg, lacp); teamd_balancer_fini(lacp->tb); - teamd_event_watch_unregister(ctx, &lacp_port_watch_ops, lacp); + teamd_event_watch_unregister(ctx, &lacp_event_watch_ops, lacp); lacp_carrier_fini(ctx, lacp); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/teamd_runner_loadbalance.c new/libteam-1.22/teamd/teamd_runner_loadbalance.c --- old/libteam-1.18/teamd/teamd_runner_loadbalance.c 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/teamd/teamd_runner_loadbalance.c 2015-10-05 15:37:26.000000000 +0200 @@ -60,7 +60,26 @@ return teamd_port_check_enable(ctx, tdport, port_up, !port_up); } +static int lb_event_watch_hwaddr_changed(struct teamd_context *ctx, void *priv) +{ + struct teamd_port *tdport; + int err; + + teamd_for_each_tdport(tdport, ctx) { + err = team_hwaddr_set(ctx->th, tdport->ifindex, ctx->hwaddr, + ctx->hwaddr_len); + if (err) { + teamd_log_err("%s: Failed to set port hardware address.", + tdport->ifname); + return err; + } + } + + return 0; +} + static const struct teamd_event_watch_ops lb_port_watch_ops = { + .hwaddr_changed = lb_event_watch_hwaddr_changed, .port_added = lb_event_watch_port_added, .port_removed = lb_event_watch_port_removed, .port_link_changed = lb_event_watch_port_link_changed, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libteam-1.18/teamd/teamd_usock.c new/libteam-1.22/teamd/teamd_usock.c --- old/libteam-1.18/teamd/teamd_usock.c 2015-04-02 12:30:54.000000000 +0200 +++ new/libteam-1.22/teamd/teamd_usock.c 2015-10-05 15:37:26.000000000 +0200 @@ -298,16 +298,19 @@ int sock; int err; - err = teamd_make_rundir(); - if (err) - return err; - sock = socket(AF_UNIX, SOCK_SEQPACKET, 0); if (sock == -1) { teamd_log_err("usock: Failed to create socket."); return -errno; } + err = fchmod(sock, 0700); + if (err == -1) { + teamd_log_err("usock: Failed to change socket permissions."); + err = -errno; + goto close_sock; + } + addr.sun_family = AF_UNIX; teamd_usock_get_sockpath(addr.sun_path, sizeof(addr.sun_path), ctx->team_devname);