diff options
author | Andy Gospodarek <andy@greyhouse.net> | 2010-07-28 11:13:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-31 02:27:57 -0400 |
commit | c5cb002fb0c82a0ccaef24e002ab370165b55be7 (patch) | |
tree | 023901db3964b3fafa72b629727676b42d192940 /drivers/net/bonding/bond_sysfs.c | |
parent | 75f5e1c6f6cef2c201da688b2279cf15156db56d (diff) |
bonding: prevent sysfs from allowing arp monitoring with alb/tlb
When using module options arp monitoring and balance-alb/balance-tlb
are mutually exclusive options. Anytime balance-alb/balance-tlb are
enabled mii monitoring is forced to 100ms if not set. When configuring
via sysfs no checking is currently done.
Handling these cases with sysfs has to be done a bit differently because
we do not have all configuration information available at once. This
patch will not allow a mode change to balance-alb/balance-tlb if
arp_interval is already non-zero. It will also not allow the user to
set a non-zero arp_interval value if the mode is already set to
balance-alb/balance-tlb. They are still mutually exclusive on a
first-come, first serve basis.
Tested with initscripts on Fedora and manual setting via sysfs.
Signed-off-by: Andy Gospodarek <gospo@redhat.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 1a9976487099..c311aed9bd02 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -313,19 +313,26 @@ static ssize_t bonding_store_mode(struct device *d, | |||
313 | bond->dev->name, (int)strlen(buf) - 1, buf); | 313 | bond->dev->name, (int)strlen(buf) - 1, buf); |
314 | ret = -EINVAL; | 314 | ret = -EINVAL; |
315 | goto out; | 315 | goto out; |
316 | } else { | 316 | } |
317 | if (bond->params.mode == BOND_MODE_8023AD) | 317 | if ((new_value == BOND_MODE_ALB || |
318 | bond_unset_master_3ad_flags(bond); | 318 | new_value == BOND_MODE_TLB) && |
319 | bond->params.arp_interval) { | ||
320 | pr_err("%s: %s mode is incompatible with arp monitoring.\n", | ||
321 | bond->dev->name, bond_mode_tbl[new_value].modename); | ||
322 | ret = -EINVAL; | ||
323 | goto out; | ||
324 | } | ||
325 | if (bond->params.mode == BOND_MODE_8023AD) | ||
326 | bond_unset_master_3ad_flags(bond); | ||
319 | 327 | ||
320 | if (bond->params.mode == BOND_MODE_ALB) | 328 | if (bond->params.mode == BOND_MODE_ALB) |
321 | bond_unset_master_alb_flags(bond); | 329 | bond_unset_master_alb_flags(bond); |
322 | 330 | ||
323 | bond->params.mode = new_value; | 331 | bond->params.mode = new_value; |
324 | bond_set_mode_ops(bond, bond->params.mode); | 332 | bond_set_mode_ops(bond, bond->params.mode); |
325 | pr_info("%s: setting mode to %s (%d).\n", | 333 | pr_info("%s: setting mode to %s (%d).\n", |
326 | bond->dev->name, bond_mode_tbl[new_value].modename, | 334 | bond->dev->name, bond_mode_tbl[new_value].modename, |
327 | new_value); | 335 | new_value); |
328 | } | ||
329 | out: | 336 | out: |
330 | return ret; | 337 | return ret; |
331 | } | 338 | } |
@@ -510,7 +517,13 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
510 | ret = -EINVAL; | 517 | ret = -EINVAL; |
511 | goto out; | 518 | goto out; |
512 | } | 519 | } |
513 | 520 | if (bond->params.mode == BOND_MODE_ALB || | |
521 | bond->params.mode == BOND_MODE_TLB) { | ||
522 | pr_info("%s: ARP monitoring cannot be used with ALB/TLB. Only MII monitoring is supported on %s.\n", | ||
523 | bond->dev->name, bond->dev->name); | ||
524 | ret = -EINVAL; | ||
525 | goto out; | ||
526 | } | ||
514 | pr_info("%s: Setting ARP monitoring interval to %d.\n", | 527 | pr_info("%s: Setting ARP monitoring interval to %d.\n", |
515 | bond->dev->name, new_value); | 528 | bond->dev->name, new_value); |
516 | bond->params.arp_interval = new_value; | 529 | bond->params.arp_interval = new_value; |