Fix remaining bug of the off-by-one error ;)
[openwrt.git] / target / linux / generic-2.6 / patches-2.6.27 / 952-revert_xt_string_case_insensitive_match.patch
1 --- a/include/linux/netfilter/xt_string.h
2 +++ b/include/linux/netfilter/xt_string.h
3 @@ -4,11 +4,6 @@
4 #define XT_STRING_MAX_PATTERN_SIZE 128
5 #define XT_STRING_MAX_ALGO_NAME_SIZE 16
6
7 -enum {
8 - XT_STRING_FLAG_INVERT = 0x01,
9 - XT_STRING_FLAG_IGNORECASE = 0x02
10 -};
11 -
12 struct xt_string_info
13 {
14 u_int16_t from_offset;
15 @@ -16,15 +11,7 @@ struct xt_string_info
16 char algo[XT_STRING_MAX_ALGO_NAME_SIZE];
17 char pattern[XT_STRING_MAX_PATTERN_SIZE];
18 u_int8_t patlen;
19 - union {
20 - struct {
21 - u_int8_t invert;
22 - } v0;
23 -
24 - struct {
25 - u_int8_t flags;
26 - } v1;
27 - } u;
28 + u_int8_t invert;
29
30 /* Used internally by the kernel */
31 struct ts_config __attribute__((aligned(8))) *config;
32 --- a/net/netfilter/xt_string.c
33 +++ b/net/netfilter/xt_string.c
34 @@ -29,16 +29,12 @@ string_mt(const struct sk_buff *skb, con
35 {
36 const struct xt_string_info *conf = matchinfo;
37 struct ts_state state;
38 - int invert;
39
40 memset(&state, 0, sizeof(struct ts_state));
41
42 - invert = (match->revision == 0 ? conf->u.v0.invert :
43 - conf->u.v1.flags & XT_STRING_FLAG_INVERT);
44 -
45 return (skb_find_text((struct sk_buff *)skb, conf->from_offset,
46 conf->to_offset, conf->config, &state)
47 - != UINT_MAX) ^ invert;
48 + != UINT_MAX) ^ conf->invert;
49 }
50
51 #define STRING_TEXT_PRIV(m) ((struct xt_string_info *)(m))
52 @@ -50,7 +46,6 @@ string_mt_check(const char *tablename, c
53 {
54 struct xt_string_info *conf = matchinfo;
55 struct ts_config *ts_conf;
56 - int flags = TS_AUTOLOAD;
57
58 /* Damn, can't handle this case properly with iptables... */
59 if (conf->from_offset > conf->to_offset)
60 @@ -59,15 +54,8 @@ string_mt_check(const char *tablename, c
61 return false;
62 if (conf->patlen > XT_STRING_MAX_PATTERN_SIZE)
63 return false;
64 - if (match->revision == 1) {
65 - if (conf->u.v1.flags &
66 - ~(XT_STRING_FLAG_IGNORECASE | XT_STRING_FLAG_INVERT))
67 - return false;
68 - if (conf->u.v1.flags & XT_STRING_FLAG_IGNORECASE)
69 - flags |= TS_IGNORECASE;
70 - }
71 ts_conf = textsearch_prepare(conf->algo, conf->pattern, conf->patlen,
72 - GFP_KERNEL, flags);
73 + GFP_KERNEL, TS_AUTOLOAD);
74 if (IS_ERR(ts_conf))
75 return false;
76
77 @@ -84,17 +72,6 @@ static void string_mt_destroy(const stru
78 static struct xt_match string_mt_reg[] __read_mostly = {
79 {
80 .name = "string",
81 - .revision = 0,
82 - .family = AF_INET,
83 - .checkentry = string_mt_check,
84 - .match = string_mt,
85 - .destroy = string_mt_destroy,
86 - .matchsize = sizeof(struct xt_string_info),
87 - .me = THIS_MODULE
88 - },
89 - {
90 - .name = "string",
91 - .revision = 1,
92 .family = AF_INET,
93 .checkentry = string_mt_check,
94 .match = string_mt,
95 @@ -104,17 +81,6 @@ static struct xt_match string_mt_reg[] _
96 },
97 {
98 .name = "string",
99 - .revision = 0,
100 - .family = AF_INET6,
101 - .checkentry = string_mt_check,
102 - .match = string_mt,
103 - .destroy = string_mt_destroy,
104 - .matchsize = sizeof(struct xt_string_info),
105 - .me = THIS_MODULE
106 - },
107 - {
108 - .name = "string",
109 - .revision = 1,
110 .family = AF_INET6,
111 .checkentry = string_mt_check,
112 .match = string_mt,
This page took 0.052158 seconds and 5 git commands to generate.