Accepting request 544370 from home:ndas:branches:network

- 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.

OBS-URL: https://build.opensuse.org/request/show/544370
OBS-URL: https://build.opensuse.org/package/show/network/libteam?expand=0&rev=9
This commit is contained in:
Nirmoy Das 2017-11-22 10:50:23 +00:00 committed by Git OBS Bridge
parent 96ef0cee6d
commit 199c9dfa9b
5 changed files with 123 additions and 1 deletions

View 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);

View 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:

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Wed Nov 22 11:26:44 CET 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 00:59:27 UTC 2016 - jengelh@inai.de Mon Nov 21 00:59:27 UTC 2016 - jengelh@inai.de

View File

@ -39,9 +39,21 @@ BuildRequires: pkgconfig(libnl-3.0) >= 3.2.0
BuildRequires: pkgconfig(libnl-cli-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-genl-3.0) >= 3.2.0
BuildRequires: pkgconfig(libnl-route-3.0) >= 3.2.0 BuildRequires: pkgconfig(libnl-route-3.0) >= 3.2.0
BuildRequires: libcap-devel
%if 0%{?suse_version} >= 1220 %if 0%{?suse_version} >= 1220
BuildRequires: systemd-rpm-macros BuildRequires: systemd-rpm-macros
%endif %endif
Patch0: check_if_psr_ops_were_initialized.patch
Patch1: start_teamd_from_usr_sbin.patch
Patch2: ignore_ebusy_for_team_hwaddr_set.patch
# Some defines
#
%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 %description
A library which is the user-space counterpart for the team network A library which is the user-space counterpart for the team network
@ -109,10 +121,16 @@ programs that will manipulate team network devices.
%prep %prep
%setup -q %setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build %build
%configure --includedir="%_includedir/pkg/%name" --bindir="%_sbindir" \ %configure --includedir="%_includedir/pkg/%name" --bindir="%_sbindir" \
--disable-static --disable-static \
--with-run-dir=%teamd_daemon_directory \
--with-user=%teamd_user \
--with-group=%teamd_group
# Use CFLAGS= to kill -Werror # Use CFLAGS= to kill -Werror
make %{?_smp_mflags} CFLAGS="%optflags" make %{?_smp_mflags} CFLAGS="%optflags"
@ -133,15 +151,26 @@ mkdir -p "$b/%_unitdir";
install -pm0644 teamd/redhat/systemd/*.service "$b/%_unitdir/"; install -pm0644 teamd/redhat/systemd/*.service "$b/%_unitdir/";
%endif %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 %check
make check make check
%pre tools %pre tools
%{_sbindir}/groupadd -r %teamd_group 2> /dev/null || :
%{_sbindir}/useradd -r -g %teamd_group -s /bin/false -c "Teamd daemon user" -d %{_localstatedir}/lib/empty %teamd_user 2> /dev/null || :
%{_sbindir}/usermod -g %teamd_group %teamd_user 2>/dev/null || :
test -L %teamd_daemon_directory || rm -rf %teamd_daemon_directory && :
%if 0%{?_unitdir:1} %if 0%{?_unitdir:1}
%service_add_pre teamd@.service %service_add_pre teamd@.service
%endif %endif
%post tools %post tools
# reload dbus to apply new teamd's policy
/usr/bin/systemctl reload dbus.service 2>/dev/null || :
%if 0%{?_unitdir:1} %if 0%{?_unitdir:1}
%service_add_post teamd@.service %service_add_post teamd@.service
%endif %endif
@ -155,6 +184,10 @@ make check
%if 0%{?_unitdir:1} %if 0%{?_unitdir:1}
%service_del_postun teamd@.service %service_del_postun teamd@.service
%endif %endif
# reload dbus to forget teamd's policy
if [ ${FIRST_ARG:-$1} -eq 0 ]; then
/usr/bin/systemctl reload dbus.service 2>/dev/null || :
fi
%post -n libteam5 -p /sbin/ldconfig %post -n libteam5 -p /sbin/ldconfig
%postun -n libteam5 -p /sbin/ldconfig %postun -n libteam5 -p /sbin/ldconfig
@ -180,6 +213,9 @@ make check
%defattr(-,root,root) %defattr(-,root,root)
%_sbindir/bond2team %_sbindir/bond2team
%_sbindir/team* %_sbindir/team*
%dir %_sysconfdir/dbus-1
%dir %teamd_dbus_policy_directory
%config %teamd_dbus_policy_directory/%teamd_dbus_policy_name
%_mandir/man1/* %_mandir/man1/*
%_mandir/man5/* %_mandir/man5/*
%_mandir/man8/* %_mandir/man8/*

View 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