aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/xt_string.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2010-03-22 14:39:04 -0400
committerJan Engelhardt <jengelh@medozas.de>2010-03-25 12:04:57 -0400
commitd879e19e18ebc69fc20a9b95612e9dd0acf4d7aa (patch)
tree654e1d4849941c064610ae74cd2e3cbadd80b0a8 /net/netfilter/xt_string.c
parent110d99ed1c846458654e2771b3ad626319f19394 (diff)
netfilter: xtables: remove xt_string revision 0
Superseded by xt_string revision 1 (linux v2.6.26-rc8-1127-g4ad3f26, iptables 1.4.2-rc1). Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'net/netfilter/xt_string.c')
-rw-r--r--net/netfilter/xt_string.c53
1 files changed, 18 insertions, 35 deletions
diff --git a/net/netfilter/xt_string.c b/net/netfilter/xt_string.c
index b0f8292db6f..488e368a2c4 100644
--- a/net/netfilter/xt_string.c
+++ b/net/netfilter/xt_string.c
@@ -26,12 +26,10 @@ string_mt(const struct sk_buff *skb, const struct xt_match_param *par)
26{ 26{
27 const struct xt_string_info *conf = par->matchinfo; 27 const struct xt_string_info *conf = par->matchinfo;
28 struct ts_state state; 28 struct ts_state state;
29 int invert; 29 bool invert;
30 30
31 memset(&state, 0, sizeof(struct ts_state)); 31 memset(&state, 0, sizeof(struct ts_state));
32 32 invert = conf->u.v1.flags & XT_STRING_FLAG_INVERT;
33 invert = (par->match->revision == 0 ? conf->u.v0.invert :
34 conf->u.v1.flags & XT_STRING_FLAG_INVERT);
35 33
36 return (skb_find_text((struct sk_buff *)skb, conf->from_offset, 34 return (skb_find_text((struct sk_buff *)skb, conf->from_offset,
37 conf->to_offset, conf->config, &state) 35 conf->to_offset, conf->config, &state)
@@ -53,13 +51,11 @@ static int string_mt_check(const struct xt_mtchk_param *par)
53 return -EINVAL; 51 return -EINVAL;
54 if (conf->patlen > XT_STRING_MAX_PATTERN_SIZE) 52 if (conf->patlen > XT_STRING_MAX_PATTERN_SIZE)
55 return -EINVAL; 53 return -EINVAL;
56 if (par->match->revision == 1) { 54 if (conf->u.v1.flags &
57 if (conf->u.v1.flags & 55 ~(XT_STRING_FLAG_IGNORECASE | XT_STRING_FLAG_INVERT))
58 ~(XT_STRING_FLAG_IGNORECASE | XT_STRING_FLAG_INVERT)) 56 return -EINVAL;
59 return -EINVAL; 57 if (conf->u.v1.flags & XT_STRING_FLAG_IGNORECASE)
60 if (conf->u.v1.flags & XT_STRING_FLAG_IGNORECASE) 58 flags |= TS_IGNORECASE;
61 flags |= TS_IGNORECASE;
62 }
63 ts_conf = textsearch_prepare(conf->algo, conf->pattern, conf->patlen, 59 ts_conf = textsearch_prepare(conf->algo, conf->pattern, conf->patlen,
64 GFP_KERNEL, flags); 60 GFP_KERNEL, flags);
65 if (IS_ERR(ts_conf)) 61 if (IS_ERR(ts_conf))
@@ -74,38 +70,25 @@ static void string_mt_destroy(const struct xt_mtdtor_param *par)
74 textsearch_destroy(STRING_TEXT_PRIV(par->matchinfo)->config); 70 textsearch_destroy(STRING_TEXT_PRIV(par->matchinfo)->config);
75} 71}
76 72
77static struct xt_match xt_string_mt_reg[] __read_mostly = { 73static struct xt_match xt_string_mt_reg __read_mostly = {
78 { 74 .name = "string",
79 .name = "string", 75 .revision = 1,
80 .revision = 0, 76 .family = NFPROTO_UNSPEC,
81 .family = NFPROTO_UNSPEC, 77 .checkentry = string_mt_check,
82 .checkentry = string_mt_check, 78 .match = string_mt,
83 .match = string_mt, 79 .destroy = string_mt_destroy,
84 .destroy = string_mt_destroy, 80 .matchsize = sizeof(struct xt_string_info),
85 .matchsize = sizeof(struct xt_string_info), 81 .me = THIS_MODULE,
86 .me = THIS_MODULE
87 },
88 {
89 .name = "string",
90 .revision = 1,
91 .family = NFPROTO_UNSPEC,
92 .checkentry = string_mt_check,
93 .match = string_mt,
94 .destroy = string_mt_destroy,
95 .matchsize = sizeof(struct xt_string_info),
96 .me = THIS_MODULE
97 },
98}; 82};
99 83
100static int __init string_mt_init(void) 84static int __init string_mt_init(void)
101{ 85{
102 return xt_register_matches(xt_string_mt_reg, 86 return xt_register_match(&xt_string_mt_reg);
103 ARRAY_SIZE(xt_string_mt_reg));
104} 87}
105 88
106static void __exit string_mt_exit(void) 89static void __exit string_mt_exit(void)
107{ 90{
108 xt_unregister_matches(xt_string_mt_reg, ARRAY_SIZE(xt_string_mt_reg)); 91 xt_unregister_match(&xt_string_mt_reg);
109} 92}
110 93
111module_init(string_mt_init); 94module_init(string_mt_init);