lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140114115043.GF4132@redhat.com>
Date:	Tue, 14 Jan 2014 12:50:43 +0100
From:	Veaceslav Falico <vfalico@...hat.com>
To:	netdev@...r.kernel.org
Cc:	Ding Tianhong <dingtianhong@...wei.com>,
	Jay Vosburgh <fubar@...ibm.com>,
	Andy Gospodarek <andy@...yhouse.net>
Subject: Re: [PATCH net-next] bonding: handle slave's name change with
 primary_slave logic

On Tue, Jan 14, 2014 at 11:50:45AM +0100, Veaceslav Falico wrote:
>Currently, if a slave's name change, we just pass it by. However, if the
>slave is a current primary_slave, then we end up with using a slave, whose
>name != params.primary, for primary_slave. And vice-versa, if we don't have
>a primary_slave but have params.primary set - we will not detected a new
>primary_slave.
>
>Fix this by catching the NETDEV_CHANGENAME event and setting primary_slave
>accordingly. Also, if the primary_slave was changed, issue a reselection of
>the active slave, cause the priorities have changed.
>
>Reported-by: Ding Tianhong <dingtianhong@...wei.com>
>CC: Ding Tianhong <dingtianhong@...wei.com>
>CC: Jay Vosburgh <fubar@...ibm.com>
>CC: Andy Gospodarek <andy@...yhouse.net>
>Signed-off-by: Veaceslav Falico <vfalico@...hat.com>

Self-NAK, too busy reviewing other patches.

Sent v2.

>---
> drivers/net/bonding/bond_main.c | 23 ++++++++++++++++++++---
> 1 file changed, 20 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index e06c445..b16d7ec 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -2860,9 +2860,26 @@ static int bond_slave_netdev_event(unsigned long event,
> 		 */
> 		break;
> 	case NETDEV_CHANGENAME:
>-		/*
>-		 * TODO: handle changing the primary's name
>-		 */
>+		/* we don't care if we don't have primary set */
>+		if (!USES_PRIMARY(bond->params.mode) ||
>+		    !bond->params.primary[0])
>+			break;
>+
>+		if (slave == bond->primary_slave) {
>+			/* slave's name changed - he's no longer primary */
>+			bond->primary_slave = NULL;
>+		} else if (!strcmp(slave_dev->name, bond->params.primary)( {
>+			/* we have a new primary slave */
>+			bond->primary_slave = slave;
>+		} else  /* we didn't change primary - exit */
>+			break;
>+
>+		pr_info("%s: Primary slave changed to %s, re-electing.\n",
>+			bond->dev->name, bond->primary_slave ? slave_dev->name :
>+							       "none");
>+		write_lock_bh(&bond->curr_slave_lock);
>+		bond_select_active_slave(bond);
>+		write_unlock_bh(&bond->curr_slave_lock);
> 		break;
> 	case NETDEV_FEAT_CHANGE:
> 		bond_compute_features(bond);
>-- 
>1.8.4
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ