diff options
Diffstat (limited to 'net/netfilter/xt_dscp.c')
-rw-r--r-- | net/netfilter/xt_dscp.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/net/netfilter/xt_dscp.c b/net/netfilter/xt_dscp.c index 7f03aa13a95..57d61206135 100644 --- a/net/netfilter/xt_dscp.c +++ b/net/netfilter/xt_dscp.c | |||
@@ -26,23 +26,18 @@ MODULE_ALIAS("ipt_tos"); | |||
26 | MODULE_ALIAS("ip6t_tos"); | 26 | MODULE_ALIAS("ip6t_tos"); |
27 | 27 | ||
28 | static bool | 28 | static bool |
29 | dscp_mt(const struct sk_buff *skb, const struct net_device *in, | 29 | dscp_mt(const struct sk_buff *skb, const struct xt_match_param *par) |
30 | const struct net_device *out, const struct xt_match *match, | ||
31 | const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop) | ||
32 | { | 30 | { |
33 | const struct xt_dscp_info *info = matchinfo; | 31 | const struct xt_dscp_info *info = par->matchinfo; |
34 | u_int8_t dscp = ipv4_get_dsfield(ip_hdr(skb)) >> XT_DSCP_SHIFT; | 32 | u_int8_t dscp = ipv4_get_dsfield(ip_hdr(skb)) >> XT_DSCP_SHIFT; |
35 | 33 | ||
36 | return (dscp == info->dscp) ^ !!info->invert; | 34 | return (dscp == info->dscp) ^ !!info->invert; |
37 | } | 35 | } |
38 | 36 | ||
39 | static bool | 37 | static bool |
40 | dscp_mt6(const struct sk_buff *skb, const struct net_device *in, | 38 | dscp_mt6(const struct sk_buff *skb, const struct xt_match_param *par) |
41 | const struct net_device *out, const struct xt_match *match, | ||
42 | const void *matchinfo, int offset, unsigned int protoff, | ||
43 | bool *hotdrop) | ||
44 | { | 39 | { |
45 | const struct xt_dscp_info *info = matchinfo; | 40 | const struct xt_dscp_info *info = par->matchinfo; |
46 | u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT; | 41 | u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT; |
47 | 42 | ||
48 | return (dscp == info->dscp) ^ !!info->invert; | 43 | return (dscp == info->dscp) ^ !!info->invert; |
@@ -63,24 +58,19 @@ dscp_mt_check(const char *tablename, const void *info, | |||
63 | return true; | 58 | return true; |
64 | } | 59 | } |
65 | 60 | ||
66 | static bool tos_mt_v0(const struct sk_buff *skb, const struct net_device *in, | 61 | static bool |
67 | const struct net_device *out, | 62 | tos_mt_v0(const struct sk_buff *skb, const struct xt_match_param *par) |
68 | const struct xt_match *match, const void *matchinfo, | ||
69 | int offset, unsigned int protoff, bool *hotdrop) | ||
70 | { | 63 | { |
71 | const struct ipt_tos_info *info = matchinfo; | 64 | const struct ipt_tos_info *info = par->matchinfo; |
72 | 65 | ||
73 | return (ip_hdr(skb)->tos == info->tos) ^ info->invert; | 66 | return (ip_hdr(skb)->tos == info->tos) ^ info->invert; |
74 | } | 67 | } |
75 | 68 | ||
76 | static bool tos_mt(const struct sk_buff *skb, const struct net_device *in, | 69 | static bool tos_mt(const struct sk_buff *skb, const struct xt_match_param *par) |
77 | const struct net_device *out, const struct xt_match *match, | ||
78 | const void *matchinfo, int offset, unsigned int protoff, | ||
79 | bool *hotdrop) | ||
80 | { | 70 | { |
81 | const struct xt_tos_match_info *info = matchinfo; | 71 | const struct xt_tos_match_info *info = par->matchinfo; |
82 | 72 | ||
83 | if (match->family == NFPROTO_IPV4) | 73 | if (par->match->family == NFPROTO_IPV4) |
84 | return ((ip_hdr(skb)->tos & info->tos_mask) == | 74 | return ((ip_hdr(skb)->tos & info->tos_mask) == |
85 | info->tos_value) ^ !!info->invert; | 75 | info->tos_value) ^ !!info->invert; |
86 | else | 76 | else |