All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2] bonding: Prevent IPv6 link local address on enslaved devices
@ 2016-01-11 13:28 Karl Heiss
  2016-01-11 16:30 ` Jay Vosburgh
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Karl Heiss @ 2016-01-11 13:28 UTC (permalink / raw)
  To: netdev; +Cc: Jay Vosburgh, Veaceslav Falico, Andy Gospodarek

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.

In order to ensure that addrconf knows to ignore the slave devices on state
change, set IFF_SLAVE before dev_open() during bonding enslavement.

Fixes: 1f718f0f4f97 ("bonding: populate neighbour's private on enslave")

Signed-off-by: Karl Heiss <kheiss@gmail.com>
---
- Changes since 'v1':
  - Revert clearing the IFF_SLAVE flag later during bond release so that
    RTM_NEWLINK messages will correctly reflect the slave state.
  - Update commit message for clarity.
---
 drivers/net/bonding/bond_main.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 9e0f8a7..f1692e4 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;
 }
@@ -1465,6 +1464,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 +1727,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
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net v2] bonding: Prevent IPv6 link local address on enslaved devices
  2016-01-11 13:28 [PATCH net v2] bonding: Prevent IPv6 link local address on enslaved devices Karl Heiss
@ 2016-01-11 16:30 ` Jay Vosburgh
  2016-01-11 20:11 ` Jarod Wilson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jay Vosburgh @ 2016-01-11 16:30 UTC (permalink / raw)
  To: Karl Heiss; +Cc: netdev, Veaceslav Falico, Andy Gospodarek

Karl Heiss <kheiss@gmail.com> wrote:

>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.
>
>In order to ensure that addrconf knows to ignore the slave devices on state
>change, set IFF_SLAVE before dev_open() during bonding enslavement.
>
>Fixes: 1f718f0f4f97 ("bonding: populate neighbour's private on enslave")
>
>Signed-off-by: Karl Heiss <kheiss@gmail.com>

Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>

>---
>- Changes since 'v1':
>  - Revert clearing the IFF_SLAVE flag later during bond release so that
>    RTM_NEWLINK messages will correctly reflect the slave state.
>  - Update commit message for clarity.
>---
> drivers/net/bonding/bond_main.c |    5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 9e0f8a7..f1692e4 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;
> }
>@@ -1465,6 +1464,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 +1727,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
>-- 
>1.7.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net v2] bonding: Prevent IPv6 link local address on enslaved devices
  2016-01-11 13:28 [PATCH net v2] bonding: Prevent IPv6 link local address on enslaved devices Karl Heiss
  2016-01-11 16:30 ` Jay Vosburgh
@ 2016-01-11 20:11 ` Jarod Wilson
  2016-01-11 21:08 ` Andy Gospodarek
  2016-01-11 22:57 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Jarod Wilson @ 2016-01-11 20:11 UTC (permalink / raw)
  To: Karl Heiss; +Cc: netdev, Jay Vosburgh, Veaceslav Falico, Andy Gospodarek

On Mon, Jan 11, 2016 at 08:28:43AM -0500, Karl Heiss wrote:
> 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.
> 
> In order to ensure that addrconf knows to ignore the slave devices on state
> change, set IFF_SLAVE before dev_open() during bonding enslavement.
> 
> Fixes: 1f718f0f4f97 ("bonding: populate neighbour's private on enslave")
> 
> Signed-off-by: Karl Heiss <kheiss@gmail.com>
> ---
> - Changes since 'v1':
>   - Revert clearing the IFF_SLAVE flag later during bond release so that
>     RTM_NEWLINK messages will correctly reflect the slave state.
>   - Update commit message for clarity.

Looks good to me as well, and I've actually got a recent Red Hat bugzilla
report about this same issue.

Reviewed-by: Jarod Wilson <jarod@redhat.com>

-- 
Jarod Wilson
jarod@redhat.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net v2] bonding: Prevent IPv6 link local address on enslaved devices
  2016-01-11 13:28 [PATCH net v2] bonding: Prevent IPv6 link local address on enslaved devices Karl Heiss
  2016-01-11 16:30 ` Jay Vosburgh
  2016-01-11 20:11 ` Jarod Wilson
@ 2016-01-11 21:08 ` Andy Gospodarek
  2016-01-11 22:57 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Gospodarek @ 2016-01-11 21:08 UTC (permalink / raw)
  To: Karl Heiss; +Cc: netdev, Jay Vosburgh, Veaceslav Falico

On Mon, Jan 11, 2016 at 08:28:43AM -0500, Karl Heiss wrote:
> 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.
> 
> In order to ensure that addrconf knows to ignore the slave devices on state
> change, set IFF_SLAVE before dev_open() during bonding enslavement.
> 
> Fixes: 1f718f0f4f97 ("bonding: populate neighbour's private on enslave")
> 
> Signed-off-by: Karl Heiss <kheiss@gmail.com>

Good find.

Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>

> ---
> - Changes since 'v1':
>   - Revert clearing the IFF_SLAVE flag later during bond release so that
>     RTM_NEWLINK messages will correctly reflect the slave state.
>   - Update commit message for clarity.
> ---
>  drivers/net/bonding/bond_main.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 9e0f8a7..f1692e4 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;
>  }
> @@ -1465,6 +1464,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 +1727,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
> -- 
> 1.7.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net v2] bonding: Prevent IPv6 link local address on enslaved devices
  2016-01-11 13:28 [PATCH net v2] bonding: Prevent IPv6 link local address on enslaved devices Karl Heiss
                   ` (2 preceding siblings ...)
  2016-01-11 21:08 ` Andy Gospodarek
@ 2016-01-11 22:57 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2016-01-11 22:57 UTC (permalink / raw)
  To: kheiss; +Cc: netdev, j.vosburgh, vfalico, gospo

From: Karl Heiss <kheiss@gmail.com>
Date: Mon, 11 Jan 2016 08:28:43 -0500

> 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.
> 
> In order to ensure that addrconf knows to ignore the slave devices on state
> change, set IFF_SLAVE before dev_open() during bonding enslavement.
> 
> Fixes: 1f718f0f4f97 ("bonding: populate neighbour's private on enslave")
> 
> Signed-off-by: Karl Heiss <kheiss@gmail.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-11 22:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-11 13:28 [PATCH net v2] bonding: Prevent IPv6 link local address on enslaved devices Karl Heiss
2016-01-11 16:30 ` Jay Vosburgh
2016-01-11 20:11 ` Jarod Wilson
2016-01-11 21:08 ` Andy Gospodarek
2016-01-11 22:57 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.