static void wildstring_mt_destroy(const struct xt_mtdtor_param *par) { struct xt_wildstring_info *conf = WILDSTRING_TEXT_PRIV(par->matchinfo); if (conf->pattern_part1) textsearch_destroy(conf->config_part1); if (conf->pattern_part2) textsearch_destroy(conf->config_part2); if (conf->pattern_part3) textsearch_destroy(conf->config_part3); }
static int em_text_change(struct tcf_proto *tp, void *data, int len, struct tcf_ematch *m) { struct text_match *tm; struct tcf_em_text *conf = data; struct ts_config *ts_conf; int flags = 0; if (len < sizeof(*conf) || len < (sizeof(*conf) + conf->pattern_len)) return -EINVAL; if (conf->from_layer > conf->to_layer) return -EINVAL; if (conf->from_layer == conf->to_layer && conf->from_offset > conf->to_offset) return -EINVAL; retry: ts_conf = textsearch_prepare(conf->algo, (u8 *) conf + sizeof(*conf), conf->pattern_len, GFP_KERNEL, flags); if (flags & TS_AUTOLOAD) rtnl_lock(); if (IS_ERR(ts_conf)) { if (PTR_ERR(ts_conf) == -ENOENT && !(flags & TS_AUTOLOAD)) { rtnl_unlock(); flags |= TS_AUTOLOAD; goto retry; } else return PTR_ERR(ts_conf); } else if (flags & TS_AUTOLOAD) { textsearch_destroy(ts_conf); return -EAGAIN; } tm = kmalloc(sizeof(*tm), GFP_KERNEL); if (tm == NULL) { textsearch_destroy(ts_conf); return -ENOBUFS; } tm->from_offset = conf->from_offset; tm->to_offset = conf->to_offset; tm->from_layer = conf->from_layer; tm->to_layer = conf->to_layer; tm->config = ts_conf; m->datalen = sizeof(*tm); m->data = (unsigned long) tm; return 0; }
static void __exit ip_conntrack_amanda_fini(void) { int i; ip_conntrack_helper_unregister(&amanda_helper); for (i = 0; i < ARRAY_SIZE(search); i++) textsearch_destroy(search[i].ts); }
static int __init ip_conntrack_amanda_init(void) { int ret, i; ret = -ENOMEM; for (i = 0; i < ARRAY_SIZE(search); i++) { search[i].ts = textsearch_prepare(ts_algo, search[i].string, search[i].len, GFP_KERNEL, TS_AUTOLOAD); if (search[i].ts == NULL) goto err; } ret = ip_conntrack_helper_register(&amanda_helper); if (ret < 0) goto err; return 0; err: for (; i >= 0; i--) { if (search[i].ts) textsearch_destroy(search[i].ts); } return ret; }
static void string_mt_destroy(const struct xt_match *match, void *matchinfo) { textsearch_destroy(STRING_TEXT_PRIV(matchinfo)->config); }
static void em_text_destroy(struct tcf_proto *tp, struct tcf_ematch *m) { textsearch_destroy(EM_TEXT_PRIV(m)->config); }
static void string_mt_destroy(const struct xt_mtdtor_param *par) { textsearch_destroy(STRING_TEXT_PRIV(par->matchinfo)->config); }
static void destroy(const struct xt_match *match, void *matchinfo, unsigned int matchsize) { textsearch_destroy(STRING_TEXT_PRIV(matchinfo)->config); }