diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-04-04 10:03:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-04 20:22:29 -0400 |
commit | 14f98f258f1936e0dba77474bd7eda63f61a9826 (patch) | |
tree | b74a80e8736c937be34291fb432f15a3f6aff67c /net/bridge/br_private.h | |
parent | bb900b27a2f49b37bc38c08e656ea13048fee13b (diff) |
bridge: range check STP parameters
Apply restrictions on STP parameters based 802.1D 1998 standard.
* Fixes missing locking in set path cost ioctl
* Uses common code for both ioctl and sysfs
This is based on an earlier patch Sasikanth V but with overhaul.
Note:
1. It does NOT enforce the restriction on the relationship max_age and
forward delay or hello time because in existing implementation these are
set as independant operations.
2. If STP is disabled, there is no restriction on forward delay
3. No restriction on holding time because users use Linux code to act
as hub or be sticky.
4. Although standard allow 0-255, Linux only allows 0-63 for port priority
because more bits are reserved for port number.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_private.h')
-rw-r--r-- | net/bridge/br_private.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 4bbe0d14c9a2..e2a40343aa09 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -495,6 +495,11 @@ extern struct net_bridge_port *br_get_port(struct net_bridge *br, | |||
495 | extern void br_init_port(struct net_bridge_port *p); | 495 | extern void br_init_port(struct net_bridge_port *p); |
496 | extern void br_become_designated_port(struct net_bridge_port *p); | 496 | extern void br_become_designated_port(struct net_bridge_port *p); |
497 | 497 | ||
498 | extern int br_set_forward_delay(struct net_bridge *br, unsigned long x); | ||
499 | extern int br_set_hello_time(struct net_bridge *br, unsigned long x); | ||
500 | extern int br_set_max_age(struct net_bridge *br, unsigned long x); | ||
501 | |||
502 | |||
498 | /* br_stp_if.c */ | 503 | /* br_stp_if.c */ |
499 | extern void br_stp_enable_bridge(struct net_bridge *br); | 504 | extern void br_stp_enable_bridge(struct net_bridge *br); |
500 | extern void br_stp_disable_bridge(struct net_bridge *br); | 505 | extern void br_stp_disable_bridge(struct net_bridge *br); |
@@ -505,10 +510,10 @@ extern bool br_stp_recalculate_bridge_id(struct net_bridge *br); | |||
505 | extern void br_stp_change_bridge_id(struct net_bridge *br, const unsigned char *a); | 510 | extern void br_stp_change_bridge_id(struct net_bridge *br, const unsigned char *a); |
506 | extern void br_stp_set_bridge_priority(struct net_bridge *br, | 511 | extern void br_stp_set_bridge_priority(struct net_bridge *br, |
507 | u16 newprio); | 512 | u16 newprio); |
508 | extern void br_stp_set_port_priority(struct net_bridge_port *p, | 513 | extern int br_stp_set_port_priority(struct net_bridge_port *p, |
509 | u8 newprio); | 514 | unsigned long newprio); |
510 | extern void br_stp_set_path_cost(struct net_bridge_port *p, | 515 | extern int br_stp_set_path_cost(struct net_bridge_port *p, |
511 | u32 path_cost); | 516 | unsigned long path_cost); |
512 | extern ssize_t br_show_bridge_id(char *buf, const struct bridge_id *id); | 517 | extern ssize_t br_show_bridge_id(char *buf, const struct bridge_id *id); |
513 | 518 | ||
514 | /* br_stp_bpdu.c */ | 519 | /* br_stp_bpdu.c */ |