Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 194937
b: refs/heads/master
c: d879e19
h: refs/heads/master
i:
  194935: 2d84c36
v: v3
  • Loading branch information
Jan Engelhardt committed Mar 25, 2010
1 parent 1ab865d commit c68d4ce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 37 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 110d99ed1c846458654e2771b3ad626319f19394
refs/heads/master: d879e19e18ebc69fc20a9b95612e9dd0acf4d7aa
2 changes: 1 addition & 1 deletion trunk/Documentation/Changes
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ o oprofile 0.9 # oprofiled --version
o udev 081 # udevinfo -V
o grub 0.93 # grub --version
o mcelog 0.6
o iptables 1.4.1 # iptables -V
o iptables 1.4.2 # iptables -V


Kernel compilation
Expand Down
53 changes: 18 additions & 35 deletions trunk/net/netfilter/xt_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
struct ts_state state;
int invert;
bool invert;

memset(&state, 0, sizeof(struct ts_state));

invert = (par->match->revision == 0 ? conf->u.v0.invert :
conf->u.v1.flags & XT_STRING_FLAG_INVERT);
invert = conf->u.v1.flags & XT_STRING_FLAG_INVERT;

return (skb_find_text((struct sk_buff *)skb, conf->from_offset,
conf->to_offset, conf->config, &state)
Expand All @@ -53,13 +51,11 @@ static int string_mt_check(const struct xt_mtchk_param *par)
return -EINVAL;
if (conf->patlen > XT_STRING_MAX_PATTERN_SIZE)
return -EINVAL;
if (par->match->revision == 1) {
if (conf->u.v1.flags &
~(XT_STRING_FLAG_IGNORECASE | XT_STRING_FLAG_INVERT))
return -EINVAL;
if (conf->u.v1.flags & XT_STRING_FLAG_IGNORECASE)
flags |= TS_IGNORECASE;
}
if (conf->u.v1.flags &
~(XT_STRING_FLAG_IGNORECASE | XT_STRING_FLAG_INVERT))
return -EINVAL;
if (conf->u.v1.flags & XT_STRING_FLAG_IGNORECASE)
flags |= TS_IGNORECASE;
ts_conf = textsearch_prepare(conf->algo, conf->pattern, conf->patlen,
GFP_KERNEL, flags);
if (IS_ERR(ts_conf))
Expand All @@ -74,38 +70,25 @@ static void string_mt_destroy(const struct xt_mtdtor_param *par)
textsearch_destroy(STRING_TEXT_PRIV(par->matchinfo)->config);
}

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",
.revision = 1,
.family = NFPROTO_UNSPEC,
.checkentry = string_mt_check,
.match = string_mt,
.destroy = string_mt_destroy,
.matchsize = sizeof(struct xt_string_info),
.me = THIS_MODULE
},
static struct xt_match xt_string_mt_reg __read_mostly = {
.name = "string",
.revision = 1,
.family = NFPROTO_UNSPEC,
.checkentry = string_mt_check,
.match = string_mt,
.destroy = string_mt_destroy,
.matchsize = sizeof(struct xt_string_info),
.me = THIS_MODULE,
};

static int __init string_mt_init(void)
{
return xt_register_matches(xt_string_mt_reg,
ARRAY_SIZE(xt_string_mt_reg));
return xt_register_match(&xt_string_mt_reg);
}

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);
Expand Down

0 comments on commit c68d4ce

Please sign in to comment.