bonding: send IPv6 neighbor advertisement on failover
Subsystems (5)
PATCH v2 1/1 bonding: send IPv6 neighbor advertisement on failover
Updated to address Vlad's comment about storing the link-local IPv6 address in the bond/vlan structure, I no longer overwrite the existing address with a newer one. Also added missed locking for the inet6_dev.
I don't see any way to address David Steven's comment since there is currently no NA tunable in the IPv6 code.
---
This patch adds better IPv6 failover support for bonding devices, especially when in active-backup mode and there are only IPv6 addresses configured, as reported by Alex Sidorenko.
- Creates a new file, net/drivers/bonding/bond_ipv6.c, for the IPv6-specific routines. Both regular bonds and VLANs over bonds are supported.
- Adds a new tunable, num_unsol_na, to limit the number of unsolicited IPv6 Neighbor Advertisements that are sent on a failover event. Default is 1.
- Creates two new IPv6 neighbor discovery functions:
ndisc_build_skb()
ndisc_send_skb()
These were required to support VLANs since we have to be able to add the VLAN id to the skb since ndisc_send_na() and friends shouldn't be asked to do this. These two routines are basically __ndisc_send() split into two pieces, in a slightly different order.
- Updates Documentation/networking/bonding.txt and bumps the rev of bond support to 3.4.0.
On failover, this new code will generate one packet:
- An unsolicited IPv6 Neighbor Advertisement, which helps the switch learn that the address has moved to the new slave.
Testing has shown that sending just the NA results in pretty good behavior when in active-back mode, I saw no lost ping packets for example.
-Brian
---
Documentation/networking/bonding.txt +10 -0
@@ -551,6 +551,16 @@ num_grat_arp affects only the active-backup mode. This option was added for bonding version 3.3.0. +num_unsol_na + + Specifies the number of unsolicited IPv6 Neighbor Advertisements + to be issued after a failover event. One unsolicited NA is issued + immediately after the failover. + + The valid range is 0 - 255; the default value is 1. This option + affects only the active-backup mode. This option was added for + bonding version 3.4.0. + primary A string (eth0, eth2, etc) specifying which slave is the
drivers/net/Kconfig +1 -0
@@ -61,6 +61,7 @@ config DUMMY config BONDING tristate "Bonding driver support" depends on INET + depends on IPV6 || IPV6=n ---help--- Say 'Y' or 'M' if you wish to be able to 'bond' multiple Ethernet Channels together. This is called 'Etherchannel' by Cisco,
drivers/net/bonding/Makefile +3 -0
@@ -6,3 +6,6 @@ obj-$(CONFIG_BONDING) += bonding.o bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o +ipv6-$(subst m,y,$(CONFIG_IPV6)) += bond_ipv6.o +bonding-objs += $(ipv6-y) +
drivers/net/bonding/bond_ipv6.c new file +218 -0
218 lines not on this page · raw message
drivers/net/bonding/bond_main.c +31 -2
@@ -89,6 +89,7 @@static int max_bonds =BOND_DEFAULT_MAX_BONDS ;static int num_grat_arp =1 ; +static int num_unsol_na =1 ;static int miimon =BOND_LINK_MON_INTERV ;static int updelay =0 ;static int downdelay =0 ;
@@ -107,6 +108,8 @@ module_param(max_bonds, int, 0);MODULE_PARM_DESC (max_bonds,"Max number of bonded devices" );module_param (num_grat_arp, int,0644 );MODULE_PARM_DESC (num_grat_arp,"Number of gratuitous ARP packets to send on failover event" ); +module_param (num_unsol_na, int,0644 ); +MODULE_PARM_DESC (num_unsol_na,"Number of unsolicited IPv6 Neighbor Advertisements packets to send on failover event" );module_param (miimon, int,0 );MODULE_PARM_DESC (miimon,"Link check interval in milliseconds" );module_param (updelay, int,0 );
@@ -242,14 +245,13 @@ static int bond_add_vlan(struct bonding *bond, unsigned short vlan_id)dprintk ("bond: %s, vlan id %d\n" , (bond ? bond->dev->name:"None" ), vlan_id); - vlan =kmalloc (sizeof (struct vlan_entry ),GFP_KERNEL ); + vlan =kzalloc (sizeof (struct vlan_entry ),GFP_KERNEL );if (!vlan) {return -ENOMEM ; }INIT_LIST_HEAD (&vlan->vlan_list); vlan->vlan_id = vlan_id; - vlan->vlan_ip =0 ;write_lock_bh (&bond->lock);
@@ -1208,6 +1210,9 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) bond->send_grat_arp = bond->params.num_grat_arp;bond_send_gratuitous_arp (bond); + bond->send_unsol_na = bond->params.num_unsol_na; +bond_send_unsolicited_na (bond); +write_unlock_bh (&bond->curr_slave_lock);read_unlock (&bond->lock);
@@ -2441,6 +2446,12 @@ void bond_mii_monitor(struct work_struct *work)read_unlock (&bond->curr_slave_lock); } +if (bond->send_unsol_na) { +read_lock (&bond->curr_slave_lock); +bond_send_unsolicited_na (bond); +read_unlock (&bond->curr_slave_lock); + } +if (bond_miimon_inspect (bond)) {read_unlock (&bond->lock);rtnl_lock ();
@@ -3138,6 +3149,12 @@ void bond_activebackup_arp_mon(struct work_struct *work)read_unlock (&bond->curr_slave_lock); } +if (bond->send_unsol_na) { +read_lock (&bond->curr_slave_lock); +bond_send_unsolicited_na (bond); +read_unlock (&bond->curr_slave_lock); + } +if (bond_ab_arp_inspect (bond, delta_in_ticks)) {read_unlock (&bond->lock);rtnl_lock ();
@@ -3813,6 +3830,7 @@ static int bond_close(struct net_device *bond_dev)write_lock_bh (&bond->lock); bond->send_grat_arp =0 ; + bond->send_unsol_na =0 ;/* signal timers not to re-arm */ bond->kill_timers =1 ;
@@ -4528,6 +4546,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params) bond->primary_slave =NULL ; bond->dev = bond_dev; bond->send_grat_arp =0 ; + bond->send_unsol_na =0 ; bond->setup_by_slave =0 ;INIT_LIST_HEAD (&bond->vlan_list);
@@ -4776,6 +4795,13 @@ static int bond_check_params(struct bond_params *params) num_grat_arp =1 ; } +if (num_unsol_na <0 || num_unsol_na >255 ) { + printk(KERN_WARNING DRV_NAME +": Warning: num_unsol_na (%d) not in range 0-255 so it " + "was reset to 1 \n", num_unsol_na); + num_unsol_na =1 ; + } +/* reset values for 802.3ad */ if (bond_mode ==BOND_MODE_8023AD ) {if (!miimon) {
@@ -4977,6 +5003,7 @@ static int bond_check_params(struct bond_params *params) params->xmit_policy = xmit_hashtype; params->miimon = miimon; params->num_grat_arp = num_grat_arp; + params->num_unsol_na = num_unsol_na; params->arp_interval = arp_interval; params->arp_validate = arp_validate_value; params->updelay = updelay;
@@ -5129,6 +5156,7 @@ static int __init bonding_init(void)register_netdevice_notifier (&bond_netdev_notifier);register_inetaddr_notifier (&bond_inetaddr_notifier); +bond_register_ipv6_notifier (); goto out; err:
@@ -5151,6 +5179,7 @@ static void __exit bonding_exit(void) {unregister_netdevice_notifier (&bond_netdev_notifier);unregister_inetaddr_notifier (&bond_inetaddr_notifier); +bond_unregister_ipv6_notifier ();bond_destroy_sysfs ();
drivers/net/bonding/bond_sysfs.c +42 -0
54 lines not on this page · raw message
drivers/net/bonding/bonding.h +32 -2
@@ -19,16 +19,19 @@#include <linux/proc_fs.h> #include <linux/if_bonding.h> #include <linux/kobject.h> +#include <linux/in6.h> #include "bond_3ad.h" #include "bond_alb.h" -#define DRV_VERSION "3.3.0" -#define DRV_RELDATE "June 10, 2008" +#define DRV_VERSION "3.4.0" +#define DRV_RELDATE "October 7, 2008"#define DRV_NAME "bonding"#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"#define BOND_MAX_ARP_TARGETS 16 +extern struct list_head bond_dev_list; +#ifdef BONDING_DEBUG #define dprintk(fmt, args...) \ printk(KERN_DEBUG \
@@ -126,6 +129,7 @@ struct bond_params {int xmit_policy;int miimon;int num_grat_arp; +int num_unsol_na;int arp_interval;int arp_validate;int use_carrier;
@@ -148,6 +152,9 @@ struct vlan_entry {struct list_head vlan_list;__be32 vlan_ip;unsigned short vlan_id; +#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) +struct in6_addr vlan_ipv6; +#endif };struct slave {
@@ -195,6 +202,7 @@ struct bonding {rwlock_t curr_slave_lock;s8 kill_timers;s8 send_grat_arp; +s8 send_unsol_na;s8 setup_by_slave;struct net_device_stats stats;#ifdef CONFIG_PROC_FS
@@ -218,6 +226,9 @@ struct bonding {struct delayed_work arp_work;struct delayed_work alb_work;struct delayed_work ad_work; +#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) +struct in6_addr master_ipv6; +#endif };/**
@@ -341,5 +352,24 @@ extern struct bond_parm_tbl xmit_hashtype_tbl[];extern struct bond_parm_tbl arp_validate_tbl[];extern struct bond_parm_tbl fail_over_mac_tbl[]; +#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) +void bond_send_unsolicited_na (struct bonding *bond); +void bond_register_ipv6_notifier (void ); +void bond_unregister_ipv6_notifier (void ); +#else +static inline void bond_send_unsolicited_na (struct bonding *bond) +{ +return ; +} +static inline void bond_register_ipv6_notifier (void ) +{ +return ; +} +static inline void bond_unregister_ipv6_notifier (void ) +{ +return ; +} +#endif +#endif /* _LINUX_BONDING_H */
include/net/ndisc.h +14 -0
@@ -108,6 +108,20 @@ extern void ndisc_send_redirect(struct sk_buff *skb,extern int ndisc_mc_map (struct in6_addr *addr,char *buf,struct net_device *dev,int dir); +extern struct sk_buff *ndisc_build_skb (struct net_device *dev, +const struct in6_addr *daddr, +const struct in6_addr *saddr, +struct icmp6hdr *icmp6h, +const struct in6_addr *target, +int llinfo); + +extern void ndisc_send_skb (struct sk_buff *skb, +struct net_device *dev, +struct neighbour *neigh, +const struct in6_addr *daddr, +const struct in6_addr *saddr, +struct icmp6hdr *icmp6h); +/*
net/ipv6/ndisc.c +65 -27
123 lines not on this page · raw message
Quoted 2 lines
I don't see any way to address David Steven's comment since there is currently no NA tunable in the IPv6 code.
Brian,
How do you feel about doubling up with dad_transmits for that
part?
At least the switch/cache updating portion is the same
in both cases.
+-DLS
Quoted 5 lines · David Stevens
Quoted 1 line
I don't see any way to address David Steven's comment since there is currently no NA tunable in the IPv6 code.
Brian,
How do you feel about doubling up withdad_transmitsfor that
part?
I don't really want to since this is bonding-specific behavior, and we're not performing DAD for the address. This is just another sysfs entry: /sys/class/net/bond*/bonding/num_unsol_na, not a sysctl.
Quoted 2 lines
At least the switch/cache updating portion is the same
in both cases.
I don't think they are. In the DAD case we're probing for another node that might have the address configured, in the bond failover case we want to update the switch quickly so we don't drop packets.
-Brian
Brian Haley <[email protected]> wrote on 10/10/2008 07:34:58 AM:
Quoted 3 lines
I don't really want to since this is bonding-specific behavior, and we're not performing DAD for the address. This is just another sysfs
entry:/sys/class/net/bond*/bonding/num_unsol_na, not a sysctl.
I think they really are the same case, and doing DAD
would solve the problem just as well. But I can hold my nose a little bit and live with it. :-) Getting the problem solved is more important than the details.
+-DLS
Quoted 10 lines · David Stevens
Brian Haley <[email protected]> wrote on 10/10/2008 07:34:58 AM:
Quoted 3 lines
I don't really want to since this is bonding-specific behavior, and we're not performing DAD for the address. This is just another sysfs
entry:/sys/class/net/bond*/bonding/num_unsol_na, not a sysctl.I think they really are the same case, and doing DAD
would solve the problem just as well. But I can hold my nose a little bit and live with it. :-) Getting the problem solved is more important than the details.
If I'm reading things correctly, DAD sends neighbor
solicitations, and we're sending neighbor advertisements, and not running the DAD logic.
As a semi-related question, what does IPv6 do if it receives a
gratutitous NA, and finds a duplicate?
I agree that doing DAD would update the switches, peers, etc,
but, if I'm reading the IPv6 code correctly, the delay between probes is one second (nd_tbl.retrans_time), and it looks like there's an initial delay of up to 1 second as well (in addrconf_dad_kick, the rtr_solicit_delay). For failover purposes, we want to issue the gratuitous ARP or NA packets immediately with a minimal delay between probes.
Is my understanding of the DAD behavior correct? -J
---
-Jay Vosburgh, IBM Linux Technology Center, [email protected]
Quoted 2 lines · Jay Vosburgh
As a semi-related question, what does IPv6 do if it receives a
gratutitous NA, and finds a duplicate?
If a node has an IPv6 neighbor entry and receives an unsolicited NA it will change it's state to stale, forcing a re-lookup on the next transmit. An un-solicited NA will change the state to reachable.
Quoted 7 lines
I agree that doing DAD would update the switches, peers, etc,
but, if I'm reading the IPv6 code correctly, the delay between probes is one second (nd_tbl.retrans_time), and it looks like there's an initial delay of up to 1 second as well (inaddrconf_dad_kick, thertr_solicit_delay). For failover purposes, we want to issue the gratuitous ARP or NA packets immediately with a minimal delay between probes.
Right, and since a bond failover event should be rare, I think sending the NA immediately is OK. All those random delays are meant to cover the case, for example, when a router sends an advertisement with a new prefix - you don't want everyone that receives it to do DAD immediately since it could overwhelm the network.
-Brian
Quoted 7 lines · Brian Haley
Quoted 2 lines · Jay Vosburgh
As a semi-related question, what does IPv6 do if it receives a
gratutitous NA, and finds a duplicate?If a node has an IPv6 neighbor entry and receives an unsolicited NA it will change it's state to stale, forcing a re-lookup on the next transmit. An un-solicited NA will change the state to reachable.
^^^^^^^^^^^^
You probably meant to say "solicited". Unsolicited NAs can only change the state to STALE.
Also, the re-lookup will happen on a delay after the transmit.
-vlad
Quoted 21 lines
Quoted 8 lines
I agree that doing DAD would update the switches, peers, etc,
but, if I'm reading the IPv6 code correctly, the delay between probes is one second (nd_tbl.retrans_time), and it looks like there's an initial delay of up to 1 second as well (inaddrconf_dad_kick, thertr_solicit_delay). For failover purposes, we want to issue the gratuitous ARP or NA packets immediately with a minimal delay between probes.Right, and since a bond failover event should be rare, I think sending the NA immediately is OK. All those random delays are meant to cover the case, for example, when a router sends an advertisement with a new prefix - you don't want everyone that receives it to do DAD immediately since it could overwhelm the network.
-Brian
Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Vlad Yasevich
Quoted 3 lines · Brian Haley
Quoted 2 lines · Jay Vosburgh
As a semi-related question, what does IPv6 do if it receives a
gratutitous NA, and finds a duplicate?
I think Jay was asking about the case where the target address in the NA matches the address of the receiving interface. The RFCs don't describe how to handle such a case and leave it to the implementation. Linux logs a warning message and ignores such NA.
Thanks
Sridhar
Quoted 12 lines
Quoted 4 lines
If a node has an IPv6 neighbor entry and receives an unsolicited NA it will change it's state to stale, forcing a re-lookup on the next transmit. An un-solicited NA will change the state to reachable.
^^^^^^^^^^^^You probably meant to say "solicited". Unsolicited NAs can only change the state to STALE.
Also, the re-lookup will happen on a delay after the transmit.
-vlad
Quoted 11 lines · Sridhar Samudrala
Quoted 4 lines · Vlad Yasevich
Quoted 3 lines · Brian Haley
Quoted 2 lines · Jay Vosburgh
As a semi-related question, what does IPv6 do if it receives a
gratutitous NA, and finds a duplicate?I think Jay was asking about the case where the target address in the NA matches the address of the receiving interface. The RFCs don't describe how to handle such a case and leave it to the implementation. Linux logs a warning message and ignores such NA.
Yes, but in this case, you have duplicate addresses configured. This can happen when subnets merge and isn't really related to bonding driver.
In such a case, if we do an NS, it will trigger an NA and we'll end up logging such a warning. If we do an NA, the other end, if it's linux, will log this warning, or deal with it in its own manner.
So, it's really a draw.
-vlad
Quoted 16 lines
Thanks
SridharQuoted 11 lines
Quoted 3 lines
If a node has an IPv6 neighbor entry and receives an unsolicited NA it will change it's state to stale, forcing a re-lookup on the next transmit. An un-solicited NA will change the state to reachable.
^^^^^^^^^^^^You probably meant to say "solicited". Unsolicited NAs can only change the state to STALE.
Also, the re-lookup will happen on a delay after the transmit.
-vlad
Quoted 39 lines · Brian Haley
Updated to address Vlad's comment about storing the link-local IPv6 address in the bond/vlan structure, I no longer overwrite the existing address with a newer one. Also added missed locking for the
inet6_dev.I don't see any way to address David Steven's comment since there is currently no NA tunable in the IPv6 code.
---
This patch adds better IPv6 failover support for bonding devices, especially when in active-backup mode and there are only IPv6 addresses configured, as reported by Alex Sidorenko.
- Creates a new file,
net/drivers/bonding/bond_ipv6.c, for the IPv6-specific routines. Both regular bonds and VLANs over bonds are supported.- Adds a new tunable,
num_unsol_na, to limit the number of unsolicited IPv6 Neighbor Advertisements that are sent on a failover event. Default is 1.- Creates two new IPv6 neighbor discovery functions:
ndisc_build_skb()
ndisc_send_skb()These were required to support VLANs since we have to be able to add the VLAN id to the skb since
ndisc_send_na()and friends shouldn't be asked to do this. These two routines are basically__ndisc_send()split into two pieces, in a slightly different order.- Updates
Documentation/networking/bonding.txtand bumps the rev of bond support to 3.4.0.On failover, this new code will generate one packet:
- An unsolicited IPv6 Neighbor Advertisement, which helps the switch learn that the address has moved to the new slave.
Quoted 8 lines
Testing has shown that sending just the NA results in pretty good behavior when in active-back mode, I saw no lost ping packets for example.
-Brian
Signed-off-by Brian Haley <[email protected]>---
Looks good to me. This provides a nice base that we can build on.
-vlad
Hi Jay,
Did you ever get a chance to look at this patch? Now that net-next is open I'd like to resubmit it.
Thanks,
-Brian
Quoted 44 lines · Brian Haley
Updated to address Vlad's comment about storing the link-local IPv6 address in the bond/vlan structure, I no longer overwrite the existing address with a newer one. Also added missed locking for the
inet6_dev.I don't see any way to address David Steven's comment since there is currently no NA tunable in the IPv6 code.
---
This patch adds better IPv6 failover support for bonding devices, especially when in active-backup mode and there are only IPv6 addresses configured, as reported by Alex Sidorenko.
- Creates a new file,
net/drivers/bonding/bond_ipv6.c, for the IPv6-specific routines. Both regular bonds and VLANs over bonds are supported.- Adds a new tunable,
num_unsol_na, to limit the number of unsolicited IPv6 Neighbor Advertisements that are sent on a failover event. Default is 1.- Creates two new IPv6 neighbor discovery functions:
ndisc_build_skb()
ndisc_send_skb()These were required to support VLANs since we have to be able to add the VLAN id to the skb since
ndisc_send_na()and friends shouldn't be asked to do this. These two routines are basically__ndisc_send()split into two pieces, in a slightly different order.- Updates
Documentation/networking/bonding.txtand bumps the rev of bond support to 3.4.0.On failover, this new code will generate one packet:
- An unsolicited IPv6 Neighbor Advertisement, which helps the switch learn that the address has moved to the new slave.
Testing has shown that sending just the NA results in pretty good behavior when in active-back mode, I saw no lost ping packets for example.
-Brian
Signed-off-by Brian Haley <[email protected]>---
Quoted 4 lines · Brian Haley
Hi Jay,
Did you ever get a chance to look at this patch? Now that net-next is open I'd like to resubmit it.
I'm good with it; I'm merging it with a couple of other feature
things and I'll post it with that set in a day or two when things open (unless I missed a mail, I don't think net-next is open as I type this).
-J
---
-Jay Vosburgh, IBM Linux Technology Center, [email protected]
Quoted 56 lines
Thanks,
-Brian
Quoted 39 lines · Brian Haley
Updated to address Vlad's comment about storing the link-local IPv6 address in the bond/vlan structure, I no longer overwrite the existing address with a newer one. Also added missed locking for the
inet6_dev.I don't see any way to address David Steven's comment since there is currently no NA tunable in the IPv6 code.
---
This patch adds better IPv6 failover support for bonding devices, especially when in active-backup mode and there are only IPv6 addresses configured, as reported by Alex Sidorenko.
- Creates a new file,
net/drivers/bonding/bond_ipv6.c, for the IPv6-specific routines. Both regular bonds and VLANs over bonds are supported.- Adds a new tunable,
num_unsol_na, to limit the number of unsolicited IPv6 Neighbor Advertisements that are sent on a failover event. Default is 1.- Creates two new IPv6 neighbor discovery functions:
ndisc_build_skb()
ndisc_send_skb()These were required to support VLANs since we have to be able to add the VLAN id to the skb since
ndisc_send_na()and friends shouldn't be asked to do this. These two routines are basically__ndisc_send()split into two pieces, in a slightly different order.- Updates
Documentation/networking/bonding.txtand bumps the rev of bond support to 3.4.0.On failover, this new code will generate one packet:
- An unsolicited IPv6 Neighbor Advertisement, which helps the switch learn that the address has moved to the new slave.
Quoted 8 lines
Testing has shown that sending just the NA results in pretty good behavior when in active-back mode, I saw no lost ping packets for example.
-Brian
Signed-off-by Brian Haley <[email protected]>---
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html