diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2010-03-16 16:44:44 -0400 |
---|---|---|
committer | Jan Engelhardt <jengelh@medozas.de> | 2010-03-18 09:20:06 -0400 |
commit | e5042a290097b7c2fc9b6a247585b6ed07b13026 (patch) | |
tree | b5eae5b4eb0c45c93fb4c752c164419c7e01535e | |
parent | 1d1c397db95f1c0cd95f6fa633c1e68acfaacec3 (diff) |
netfilter: xtables: limit xt_mac to ethernet devices
I do not see a point of allowing the MAC module to work with devices
that don't possibly have one, e.g. various tunnel interfaces such as
tun and sit.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
-rw-r--r-- | net/netfilter/xt_mac.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/netfilter/xt_mac.c b/net/netfilter/xt_mac.c index 2039d0741b37..b971ce93773e 100644 --- a/net/netfilter/xt_mac.c +++ b/net/netfilter/xt_mac.c | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/skbuff.h> | 12 | #include <linux/skbuff.h> |
13 | #include <linux/if_arp.h> | ||
13 | #include <linux/if_ether.h> | 14 | #include <linux/if_ether.h> |
14 | #include <linux/etherdevice.h> | 15 | #include <linux/etherdevice.h> |
15 | 16 | ||
@@ -29,6 +30,8 @@ static bool mac_mt(const struct sk_buff *skb, const struct xt_match_param *par) | |||
29 | const struct xt_mac_info *info = par->matchinfo; | 30 | const struct xt_mac_info *info = par->matchinfo; |
30 | bool ret; | 31 | bool ret; |
31 | 32 | ||
33 | if (skb->dev == NULL || skb->dev->type != ARPHRD_ETHER) | ||
34 | return false; | ||
32 | if (skb_mac_header(skb) < skb->head) | 35 | if (skb_mac_header(skb) < skb->head) |
33 | return false; | 36 | return false; |
34 | if (skb_mac_header(skb) + ETH_HLEN > skb->data) | 37 | if (skb_mac_header(skb) + ETH_HLEN > skb->data) |