From: Jan Engelhardt Date: Tue, 16 Mar 2010 20:44:44 +0000 (+0100) Subject: netfilter: xtables: limit xt_mac to ethernet devices X-Git-Tag: v2.6.35-rc1~473^2~168^2~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5042a290097b7c2fc9b6a247585b6ed07b13026;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git 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 --- diff --git a/net/netfilter/xt_mac.c b/net/netfilter/xt_mac.c index 2039d07..b971ce9 100644 --- a/net/netfilter/xt_mac.c +++ b/net/netfilter/xt_mac.c @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -29,6 +30,8 @@ static bool mac_mt(const struct sk_buff *skb, const struct xt_match_param *par) const struct xt_mac_info *info = par->matchinfo; bool ret; + if (skb->dev == NULL || skb->dev->type != ARPHRD_ETHER) + return false; if (skb_mac_header(skb) < skb->head) return false; if (skb_mac_header(skb) + ETH_HLEN > skb->data)