diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-10-03 14:14:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-06 15:27:56 -0400 |
commit | 515853ccecc6987dfb8ed809dd8bf8900286f29e (patch) | |
tree | ddd361a7bacb3d37a95f6101ef541af91c01d9ba /net/bridge/br_sysfs_br.c | |
parent | 45b58465acaa9d98354e7fa730e3172c5355da06 (diff) |
bridge: allow forwarding some link local frames
This is based on an earlier patch by Nick Carter with comments
by David Lamparter but with some refinements. Thanks for their patience
this is a confusing area with overlap of standards, user requirements,
and compatibility with earlier releases.
It adds a new sysfs attribute
/sys/class/net/brX/bridge/group_fwd_mask
that controls forwarding of frames with address of: 01-80-C2-00-00-0X
The default setting has no forwarding to retain compatibility.
One change from earlier releases is that forwarding of group
addresses is not dependent on STP being enabled or disabled. This
choice was made based on interpretation of tie 802.1 standards.
I expect complaints will arise because of this, but better to follow
the standard than continue acting incorrectly by default.
The filtering mask is writeable, but only values that don't forward
known control frames are allowed. It intentionally blocks attempts
to filter control protocols. For example: writing a 8 allows
forwarding 802.1X PAE addresses which is the most common request.
Reported-by: David Lamparter <equinox@diac24.net>
Original-patch-by: Nick Carter <ncarter100@gmail.com>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Tested-by: Benjamin Poirier <benjamin.poirier@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_sysfs_br.c')
-rw-r--r-- | net/bridge/br_sysfs_br.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c index 68b893ea8c3a..c236c0e43984 100644 --- a/net/bridge/br_sysfs_br.c +++ b/net/bridge/br_sysfs_br.c | |||
@@ -149,6 +149,39 @@ static ssize_t store_stp_state(struct device *d, | |||
149 | static DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state, | 149 | static DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state, |
150 | store_stp_state); | 150 | store_stp_state); |
151 | 151 | ||
152 | static ssize_t show_group_fwd_mask(struct device *d, | ||
153 | struct device_attribute *attr, char *buf) | ||
154 | { | ||
155 | struct net_bridge *br = to_bridge(d); | ||
156 | return sprintf(buf, "%#x\n", br->group_fwd_mask); | ||
157 | } | ||
158 | |||
159 | |||
160 | static ssize_t store_group_fwd_mask(struct device *d, | ||
161 | struct device_attribute *attr, const char *buf, | ||
162 | size_t len) | ||
163 | { | ||
164 | struct net_bridge *br = to_bridge(d); | ||
165 | char *endp; | ||
166 | unsigned long val; | ||
167 | |||
168 | if (!capable(CAP_NET_ADMIN)) | ||
169 | return -EPERM; | ||
170 | |||
171 | val = simple_strtoul(buf, &endp, 0); | ||
172 | if (endp == buf) | ||
173 | return -EINVAL; | ||
174 | |||
175 | if (val & BR_GROUPFWD_RESTRICTED) | ||
176 | return -EINVAL; | ||
177 | |||
178 | br->group_fwd_mask = val; | ||
179 | |||
180 | return len; | ||
181 | } | ||
182 | static DEVICE_ATTR(group_fwd_mask, S_IRUGO | S_IWUSR, show_group_fwd_mask, | ||
183 | store_group_fwd_mask); | ||
184 | |||
152 | static ssize_t show_priority(struct device *d, struct device_attribute *attr, | 185 | static ssize_t show_priority(struct device *d, struct device_attribute *attr, |
153 | char *buf) | 186 | char *buf) |
154 | { | 187 | { |
@@ -652,6 +685,7 @@ static struct attribute *bridge_attrs[] = { | |||
652 | &dev_attr_max_age.attr, | 685 | &dev_attr_max_age.attr, |
653 | &dev_attr_ageing_time.attr, | 686 | &dev_attr_ageing_time.attr, |
654 | &dev_attr_stp_state.attr, | 687 | &dev_attr_stp_state.attr, |
688 | &dev_attr_group_fwd_mask.attr, | ||
655 | &dev_attr_priority.attr, | 689 | &dev_attr_priority.attr, |
656 | &dev_attr_bridge_id.attr, | 690 | &dev_attr_bridge_id.attr, |
657 | &dev_attr_root_id.attr, | 691 | &dev_attr_root_id.attr, |