aboutsummaryrefslogtreecommitdiff
path: root/net/ethernet
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@redhat.com>2007-10-23 20:19:37 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-23 21:27:50 -0700
commitbada339ba24dee9e143bfb42e1dc61f146619846 (patch)
tree69e14af15764a1b38d61cd1f0b55560e45779f23 /net/ethernet
parentc9927c2bf4f45bb85e8b502ab3fb79ad6483c244 (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.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index ed8a3d49487..6b2e454ae31 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)
return 0;
}
+static int eth_validate_addr(struct net_device *dev)
+{
+ if (!is_valid_ether_addr(dev->dev_addr))
+ return -EINVAL;
+
+ return 0;
+}
+
const struct header_ops eth_header_ops ____cacheline_aligned = {
.create = eth_header,
.parse = eth_header_parse,
@@ -317,6 +325,7 @@ void ether_setup(struct net_device *dev)
dev->change_mtu = eth_change_mtu;
dev->set_mac_address = eth_mac_addr;
+ dev->validate_addr = eth_validate_addr;
dev->type = ARPHRD_ETHER;
dev->hard_header_len = ETH_HLEN;