diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2012-11-01 09:10:04 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-02 21:34:05 -0400 |
commit | 4197f24b5bd8be03e84d23920e90f6a1313f4b79 (patch) | |
tree | 47e398311668cb2f9d1b45b1f7dec205e31ffba1 | |
parent | 3ba368c43565f31528b3aea585bb4119fded4eb1 (diff) | |
download | op-kernel-dev-4197f24b5bd8be03e84d23920e90f6a1313f4b79.zip op-kernel-dev-4197f24b5bd8be03e84d23920e90f6a1313f4b79.tar.gz |
bridge: Use is_link_local() in store_group_addr()
Parse the string into an array of bytes rather than ints, so we can
use is_link_local() rather than reimplementing it.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/bridge/br_sysfs_br.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c index e157b0d..82385fd 100644 --- a/net/bridge/br_sysfs_br.c +++ b/net/bridge/br_sysfs_br.c @@ -298,23 +298,18 @@ static ssize_t store_group_addr(struct device *d, const char *buf, size_t len) { struct net_bridge *br = to_bridge(d); - unsigned int new_addr[6]; + u8 new_addr[6]; int i; if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (sscanf(buf, "%x:%x:%x:%x:%x:%x", + if (sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &new_addr[0], &new_addr[1], &new_addr[2], &new_addr[3], &new_addr[4], &new_addr[5]) != 6) return -EINVAL; - /* Must be 01:80:c2:00:00:0X */ - for (i = 0; i < 5; i++) - if (new_addr[i] != br_reserved_address[i]) - return -EINVAL; - - if (new_addr[5] & ~0xf) + if (!is_link_local(new_addr)) return -EINVAL; if (new_addr[5] == 1 || /* 802.3x Pause address */ |