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>
This commit is contained in:
Jan Engelhardt 2010-03-22 19:39:04 +01:00
parent 110d99ed1c
commit d879e19e18
2 changed files with 19 additions and 36 deletions

View file

@ -49,7 +49,7 @@ o oprofile 0.9 # oprofiled --version
o udev 081 # udevinfo -V o udev 081 # udevinfo -V
o grub 0.93 # grub --version o grub 0.93 # grub --version
o mcelog 0.6 o mcelog 0.6
o iptables 1.4.1 # iptables -V o iptables 1.4.2 # iptables -V
Kernel compilation Kernel compilation

View file

@ -26,12 +26,10 @@ string_mt(const struct sk_buff *skb, const struct xt_match_param *par)
{ {
const struct xt_string_info *conf = par->matchinfo; const struct xt_string_info *conf = par->matchinfo;
struct ts_state state; struct ts_state state;
int invert; bool invert;
memset(&state, 0, sizeof(struct ts_state)); memset(&state, 0, sizeof(struct ts_state));
invert = conf->u.v1.flags & XT_STRING_FLAG_INVERT;
invert = (par->match->revision == 0 ? conf->u.v0.invert :
conf->u.v1.flags & XT_STRING_FLAG_INVERT);
return (skb_find_text((struct sk_buff *)skb, conf->from_offset, return (skb_find_text((struct sk_buff *)skb, conf->from_offset,
conf->to_offset, conf->config, &state) conf->to_offset, conf->config, &state)
@ -53,13 +51,11 @@ static int string_mt_check(const struct xt_mtchk_param *par)
return -EINVAL; return -EINVAL;
if (conf->patlen > XT_STRING_MAX_PATTERN_SIZE) if (conf->patlen > XT_STRING_MAX_PATTERN_SIZE)
return -EINVAL; return -EINVAL;
if (par->match->revision == 1) {
if (conf->u.v1.flags & if (conf->u.v1.flags &
~(XT_STRING_FLAG_IGNORECASE | XT_STRING_FLAG_INVERT)) ~(XT_STRING_FLAG_IGNORECASE | XT_STRING_FLAG_INVERT))
return -EINVAL; return -EINVAL;
if (conf->u.v1.flags & XT_STRING_FLAG_IGNORECASE) if (conf->u.v1.flags & XT_STRING_FLAG_IGNORECASE)
flags |= TS_IGNORECASE; flags |= TS_IGNORECASE;
}
ts_conf = textsearch_prepare(conf->algo, conf->pattern, conf->patlen, ts_conf = textsearch_prepare(conf->algo, conf->pattern, conf->patlen,
GFP_KERNEL, flags); GFP_KERNEL, flags);
if (IS_ERR(ts_conf)) if (IS_ERR(ts_conf))
@ -74,18 +70,7 @@ static void string_mt_destroy(const struct xt_mtdtor_param *par)
textsearch_destroy(STRING_TEXT_PRIV(par->matchinfo)->config); textsearch_destroy(STRING_TEXT_PRIV(par->matchinfo)->config);
} }
static struct xt_match xt_string_mt_reg[] __read_mostly = { static struct xt_match xt_string_mt_reg __read_mostly = {
{
.name = "string",
.revision = 0,
.family = NFPROTO_UNSPEC,
.checkentry = string_mt_check,
.match = string_mt,
.destroy = string_mt_destroy,
.matchsize = sizeof(struct xt_string_info),
.me = THIS_MODULE
},
{
.name = "string", .name = "string",
.revision = 1, .revision = 1,
.family = NFPROTO_UNSPEC, .family = NFPROTO_UNSPEC,
@ -93,19 +78,17 @@ static struct xt_match xt_string_mt_reg[] __read_mostly = {
.match = string_mt, .match = string_mt,
.destroy = string_mt_destroy, .destroy = string_mt_destroy,
.matchsize = sizeof(struct xt_string_info), .matchsize = sizeof(struct xt_string_info),
.me = THIS_MODULE .me = THIS_MODULE,
},
}; };
static int __init string_mt_init(void) static int __init string_mt_init(void)
{ {
return xt_register_matches(xt_string_mt_reg, return xt_register_match(&xt_string_mt_reg);
ARRAY_SIZE(xt_string_mt_reg));
} }
static void __exit string_mt_exit(void) static void __exit string_mt_exit(void)
{ {
xt_unregister_matches(xt_string_mt_reg, ARRAY_SIZE(xt_string_mt_reg)); xt_unregister_match(&xt_string_mt_reg);
} }
module_init(string_mt_init); module_init(string_mt_init);