bonding: send IPv6 neighbor advertisement on failover
Subsystems (5)
PATCH v3 1/1 bonding: send IPv6 neighbor advertisement on failover
Jay,
I updated this patch to support the new "%pI6" format specifier. Based on net-next-2.6 so it might not apply cleanly to your tree.
-Brian
---
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.
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);
@@ -2463,6 +2468,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 ();
@@ -3158,6 +3169,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 ();
@@ -3827,6 +3844,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 ;
@@ -4542,6 +4560,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);
@@ -4789,6 +4808,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) {
@@ -4990,6 +5016,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;
@@ -5142,6 +5169,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:
@@ -5164,6 +5192,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