12 #include <linux/slab.h>
13 #include <linux/module.h>
14 #include <linux/types.h>
15 #include <linux/kernel.h>
16 #include <linux/string.h>
30 #define EM_TEXT_PRIV(m) ((struct text_match *) (m)->data)
32 static int em_text_match(
struct sk_buff *
skb,
struct tcf_ematch *
m,
48 static int em_text_change(
struct tcf_proto *tp,
void *
data,
int len,
56 if (len <
sizeof(*conf) || len < (
sizeof(*conf) + conf->
pattern_len))
73 if (IS_ERR(ts_conf)) {
74 if (PTR_ERR(ts_conf) == -
ENOENT && !(flags & TS_AUTOLOAD)) {
79 return PTR_ERR(ts_conf);
80 }
else if (flags & TS_AUTOLOAD) {
97 m->datalen =
sizeof(*tm);
98 m->data = (
unsigned long) tm;
103 static void em_text_destroy(
struct tcf_proto *tp,
struct tcf_ematch *m)
109 static int em_text_dump(
struct sk_buff *
skb,
struct tcf_ematch *m)
123 goto nla_put_failure;
125 textsearch_get_pattern(tm->
config)) < 0)
126 goto nla_put_failure;
133 static struct tcf_ematch_ops em_text_ops = {
135 .change = em_text_change,
136 .match = em_text_match,
137 .destroy = em_text_destroy,
138 .dump = em_text_dump,
143 static int __init init_em_text(
void)
148 static void __exit exit_em_text(
void)