diff options
author | Jay Vosburgh <fubar@us.ibm.com> | 2006-09-23 00:54:53 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-09-25 20:08:09 -0400 |
commit | f5b2b966f032f22d3a289045a5afd4afa09f09c6 (patch) | |
tree | cb3c505d8f444438bed09353788f6c96150f68ad /drivers/net/bonding/bonding.h | |
parent | 70298705bb29fb7982b85089adf17cd37b94baa7 (diff) |
[PATCH] bonding: Validate probe replies in ARP monitor
Add logic to check ARP request / reply packets used for ARP
monitor link integrity checking.
The current method simply examines the slave device to see if it
has sent and received traffic; this can be fooled by extraneous traffic.
For example, if multiple hosts running bonding are behind a common
switch, the probe traffic from the multiple instances of bonding will
update the tx/rx times on each other's slave devices.
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/bonding/bonding.h')
-rw-r--r-- | drivers/net/bonding/bonding.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 17caafe58247..db16fee40a5f 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -22,8 +22,8 @@ | |||
22 | #include "bond_3ad.h" | 22 | #include "bond_3ad.h" |
23 | #include "bond_alb.h" | 23 | #include "bond_alb.h" |
24 | 24 | ||
25 | #define DRV_VERSION "3.0.3" | 25 | #define DRV_VERSION "3.1.0-test" |
26 | #define DRV_RELDATE "March 23, 2006" | 26 | #define DRV_RELDATE "September 9, 2006" |
27 | #define DRV_NAME "bonding" | 27 | #define DRV_NAME "bonding" |
28 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" | 28 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" |
29 | 29 | ||
@@ -126,6 +126,7 @@ struct bond_params { | |||
126 | int xmit_policy; | 126 | int xmit_policy; |
127 | int miimon; | 127 | int miimon; |
128 | int arp_interval; | 128 | int arp_interval; |
129 | int arp_validate; | ||
129 | int use_carrier; | 130 | int use_carrier; |
130 | int updelay; | 131 | int updelay; |
131 | int downdelay; | 132 | int downdelay; |
@@ -151,6 +152,7 @@ struct slave { | |||
151 | struct slave *prev; | 152 | struct slave *prev; |
152 | int delay; | 153 | int delay; |
153 | u32 jiffies; | 154 | u32 jiffies; |
155 | u32 last_arp_rx; | ||
154 | s8 link; /* one of BOND_LINK_XXXX */ | 156 | s8 link; /* one of BOND_LINK_XXXX */ |
155 | s8 state; /* one of BOND_STATE_XXXX */ | 157 | s8 state; /* one of BOND_STATE_XXXX */ |
156 | u32 original_flags; | 158 | u32 original_flags; |
@@ -198,6 +200,7 @@ struct bonding { | |||
198 | struct bond_params params; | 200 | struct bond_params params; |
199 | struct list_head vlan_list; | 201 | struct list_head vlan_list; |
200 | struct vlan_group *vlgrp; | 202 | struct vlan_group *vlgrp; |
203 | struct packet_type arp_mon_pt; | ||
201 | }; | 204 | }; |
202 | 205 | ||
203 | /** | 206 | /** |
@@ -228,6 +231,25 @@ static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) | |||
228 | return (struct bonding *)slave->dev->master->priv; | 231 | return (struct bonding *)slave->dev->master->priv; |
229 | } | 232 | } |
230 | 233 | ||
234 | #define BOND_ARP_VALIDATE_NONE 0 | ||
235 | #define BOND_ARP_VALIDATE_ACTIVE (1 << BOND_STATE_ACTIVE) | ||
236 | #define BOND_ARP_VALIDATE_BACKUP (1 << BOND_STATE_BACKUP) | ||
237 | #define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \ | ||
238 | BOND_ARP_VALIDATE_BACKUP) | ||
239 | |||
240 | extern inline int slave_do_arp_validate(struct bonding *bond, struct slave *slave) | ||
241 | { | ||
242 | return bond->params.arp_validate & (1 << slave->state); | ||
243 | } | ||
244 | |||
245 | extern inline u32 slave_last_rx(struct bonding *bond, struct slave *slave) | ||
246 | { | ||
247 | if (slave_do_arp_validate(bond, slave)) | ||
248 | return slave->last_arp_rx; | ||
249 | |||
250 | return slave->dev->last_rx; | ||
251 | } | ||
252 | |||
231 | static inline void bond_set_slave_inactive_flags(struct slave *slave) | 253 | static inline void bond_set_slave_inactive_flags(struct slave *slave) |
232 | { | 254 | { |
233 | struct bonding *bond = slave->dev->master->priv; | 255 | struct bonding *bond = slave->dev->master->priv; |
@@ -235,12 +257,14 @@ static inline void bond_set_slave_inactive_flags(struct slave *slave) | |||
235 | bond->params.mode != BOND_MODE_ALB) | 257 | bond->params.mode != BOND_MODE_ALB) |
236 | slave->state = BOND_STATE_BACKUP; | 258 | slave->state = BOND_STATE_BACKUP; |
237 | slave->dev->priv_flags |= IFF_SLAVE_INACTIVE; | 259 | slave->dev->priv_flags |= IFF_SLAVE_INACTIVE; |
260 | if (slave_do_arp_validate(bond, slave)) | ||
261 | slave->dev->priv_flags |= IFF_SLAVE_NEEDARP; | ||
238 | } | 262 | } |
239 | 263 | ||
240 | static inline void bond_set_slave_active_flags(struct slave *slave) | 264 | static inline void bond_set_slave_active_flags(struct slave *slave) |
241 | { | 265 | { |
242 | slave->state = BOND_STATE_ACTIVE; | 266 | slave->state = BOND_STATE_ACTIVE; |
243 | slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE; | 267 | slave->dev->priv_flags &= ~(IFF_SLAVE_INACTIVE | IFF_SLAVE_NEEDARP); |
244 | } | 268 | } |
245 | 269 | ||
246 | static inline void bond_set_master_3ad_flags(struct bonding *bond) | 270 | static inline void bond_set_master_3ad_flags(struct bonding *bond) |
@@ -284,6 +308,8 @@ int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl); | |||
284 | const char *bond_mode_name(int mode); | 308 | const char *bond_mode_name(int mode); |
285 | void bond_select_active_slave(struct bonding *bond); | 309 | void bond_select_active_slave(struct bonding *bond); |
286 | void bond_change_active_slave(struct bonding *bond, struct slave *new_active); | 310 | void bond_change_active_slave(struct bonding *bond, struct slave *new_active); |
311 | void bond_register_arp(struct bonding *); | ||
312 | void bond_unregister_arp(struct bonding *); | ||
287 | 313 | ||
288 | #endif /* _LINUX_BONDING_H */ | 314 | #endif /* _LINUX_BONDING_H */ |
289 | 315 | ||