aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2010-03-16 16:09:04 -0400
committerJan Engelhardt <jengelh@medozas.de>2010-03-18 09:20:06 -0400
commit1d1c397db95f1c0cd95f6fa633c1e68acfaacec3 (patch)
treea73194780ee95ca32ceae75a8be425060b420169 /net
parent7d5f7ed802507999c22949b84686d03987fe57ec (diff)
netfilter: xtables: clean up xt_mac match routine
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/xt_mac.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/net/netfilter/xt_mac.c b/net/netfilter/xt_mac.c
index c2007116ce5b..2039d0741b37 100644
--- a/net/netfilter/xt_mac.c
+++ b/net/netfilter/xt_mac.c
@@ -26,14 +26,16 @@ MODULE_ALIAS("ip6t_mac");
26 26
27static bool mac_mt(const struct sk_buff *skb, const struct xt_match_param *par) 27static bool mac_mt(const struct sk_buff *skb, const struct xt_match_param *par)
28{ 28{
29 const struct xt_mac_info *info = par->matchinfo; 29 const struct xt_mac_info *info = par->matchinfo;
30 30 bool ret;
31 /* Is mac pointer valid? */ 31
32 return skb_mac_header(skb) >= skb->head && 32 if (skb_mac_header(skb) < skb->head)
33 skb_mac_header(skb) + ETH_HLEN <= skb->data 33 return false;
34 /* If so, compare... */ 34 if (skb_mac_header(skb) + ETH_HLEN > skb->data)
35 && ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr)) 35 return false;
36 ^ info->invert); 36 ret = compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr) == 0;
37 ret ^= info->invert;
38 return ret;
37} 39}
38 40
39static struct xt_match mac_mt_reg __read_mostly = { 41static struct xt_match mac_mt_reg __read_mostly = {