From patchwork Fri Jan 8 19:33:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Heiss X-Patchwork-Id: 565035 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 34C27140BA4 for ; Sat, 9 Jan 2016 06:33:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=V92UNl7D; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754523AbcAHTdm (ORCPT ); Fri, 8 Jan 2016 14:33:42 -0500 Received: from mail-qg0-f68.google.com ([209.85.192.68]:35062 "EHLO mail-qg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752069AbcAHTdl (ORCPT ); Fri, 8 Jan 2016 14:33:41 -0500 Received: by mail-qg0-f68.google.com with SMTP id b35so34971177qge.2 for ; Fri, 08 Jan 2016 11:33:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=/Z2euMqg+GsQu5/Q7wPOGnBwaxc6TjNCWVERyoELPLg=; b=V92UNl7DbpdaAzmVUP4GA15ImhrjVipVEnsAr79+WzLM7malicJIsBbgv5Ij8hA/EZ lX/aNhRju5/DCTDk1Qz8j1VQ/cvP1qp1QC4f4p8x5cnBL/yReRARhYdTUzfmOeL6nFFs IHp3iRGSGpggtuiWkcoSH6orzUAIkVgFBQlOdTD9IH4Vv/JARqy8fO5jvN1DBI62s4qb IlhuNpGmQS0iBr/xmteaAZ1tAjLhnHfPq1rrojSIAYG3Ap69RvBDbMh81k+OODJQIE0X 2b+hstDJwHM9J0VwwBVmnj1ndtNb99pupLENtQZKQF23FFAo3Gm/yyMOyoeGrb2/GRDp dvOQ== X-Received: by 10.140.237.74 with SMTP id i71mr92076345qhc.55.1452281620562; Fri, 08 Jan 2016 11:33:40 -0800 (PST) Received: from localhost.localdomain ([198.89.36.10]) by smtp.gmail.com with ESMTPSA id x136sm37672414qka.0.2016.01.08.11.33.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jan 2016 11:33:39 -0800 (PST) From: Karl Heiss To: Jay Vosburgh , Veaceslav Falico , Andy Gospodarek Cc: netdev@vger.kernel.org Subject: [PATCH net] bonding: Prevent IPv6 link local address on enslaved devices Date: Fri, 8 Jan 2016 14:33:36 -0500 Message-Id: <1452281616-14447-1-git-send-email-kheiss@gmail.com> X-Mailer: git-send-email 1.7.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Upstream commit 1f718f0f4f97 ("bonding: populate neighbour's private on enslave") undoes the fix provided by commit c2edacf80e15 ("bonding / ipv6: no addrconf for slaves separately from master") by effectively setting the slave flag after the slave has been opened. If the slave comes up quickly enough, it will go through the IPv6 addrconf before the slave flag has been set and will get a link local IPv6 address. Set IFF_SLAVE before dev_open() and clear it after dev_close() to ensure that addrconf knows to ignore on state change. Fixes: 1f718f0f4f97 ("bonding: populate neighbour's private on enslave") Signed-off-by: Karl Heiss --- drivers/net/bonding/bond_main.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 9e0f8a7..200358e 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1207,7 +1207,6 @@ static int bond_master_upper_dev_link(struct net_device *bond_dev, err = netdev_master_upper_dev_link_private(slave_dev, bond_dev, slave); if (err) return err; - slave_dev->flags |= IFF_SLAVE; rtmsg_ifinfo(RTM_NEWLINK, slave_dev, IFF_SLAVE, GFP_KERNEL); return 0; } @@ -1216,7 +1215,6 @@ static void bond_upper_dev_unlink(struct net_device *bond_dev, struct net_device *slave_dev) { netdev_upper_dev_unlink(slave_dev, bond_dev); - slave_dev->flags &= ~IFF_SLAVE; rtmsg_ifinfo(RTM_NEWLINK, slave_dev, IFF_SLAVE, GFP_KERNEL); } @@ -1465,6 +1463,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) } } + /* set slave flag before open to prevent IPv6 addrconf */ + slave_dev->flags |= IFF_SLAVE; + /* open the slave since the application closed it */ res = dev_open(slave_dev); if (res) { @@ -1725,6 +1726,7 @@ err_close: dev_close(slave_dev); err_restore_mac: + slave_dev->flags &= ~IFF_SLAVE; if (!bond->params.fail_over_mac || BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { /* XXX TODO - fom follow mode needs to change master's @@ -1906,6 +1908,8 @@ static int __bond_release_one(struct net_device *bond_dev, /* close slave before restoring its mac address */ dev_close(slave_dev); + slave_dev->flags &= ~IFF_SLAVE; + if (bond->params.fail_over_mac != BOND_FOM_ACTIVE || BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { /* restore original ("permanent") mac address */