diff options
author | Jeff Garzik <jgarzik@redhat.com> | 2007-10-23 23:19:37 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-24 00:27:50 -0400 |
commit | bada339ba24dee9e143bfb42e1dc61f146619846 (patch) | |
tree | 69e14af15764a1b38d61cd1f0b55560e45779f23 /net/ethernet | |
parent | c9927c2bf4f45bb85e8b502ab3fb79ad6483c244 (diff) |
[NET]: Validate device addr prior to interface-up
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethernet')
-rw-r--r-- | net/ethernet/eth.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index ed8a3d49487d..6b2e454ae313 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c | |||
@@ -298,6 +298,14 @@ static int eth_change_mtu(struct net_device *dev, int new_mtu) | |||
298 | return 0; | 298 | return 0; |
299 | } | 299 | } |
300 | 300 | ||
301 | static int eth_validate_addr(struct net_device *dev) | ||
302 | { | ||
303 | if (!is_valid_ether_addr(dev->dev_addr)) | ||
304 | return -EINVAL; | ||
305 | |||
306 | return 0; | ||
307 | } | ||
308 | |||
301 | const struct header_ops eth_header_ops ____cacheline_aligned = { | 309 | const struct header_ops eth_header_ops ____cacheline_aligned = { |
302 | .create = eth_header, | 310 | .create = eth_header, |
303 | .parse = eth_header_parse, | 311 | .parse = eth_header_parse, |
@@ -317,6 +325,7 @@ void ether_setup(struct net_device *dev) | |||
317 | 325 | ||
318 | dev->change_mtu = eth_change_mtu; | 326 | dev->change_mtu = eth_change_mtu; |
319 | dev->set_mac_address = eth_mac_addr; | 327 | dev->set_mac_address = eth_mac_addr; |
328 | dev->validate_addr = eth_validate_addr; | ||
320 | 329 | ||
321 | dev->type = ARPHRD_ETHER; | 330 | dev->type = ARPHRD_ETHER; |
322 | dev->hard_header_len = ETH_HLEN; | 331 | dev->hard_header_len = ETH_HLEN; |