Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
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);
}
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
static void string_mt_destroy(const struct xt_match *match, void *matchinfo)
{
    textsearch_destroy(STRING_TEXT_PRIV(matchinfo)->config);
}
Ejemplo n.º 6
0
static void em_text_destroy(struct tcf_proto *tp, struct tcf_ematch *m)
{
    textsearch_destroy(EM_TEXT_PRIV(m)->config);
}
Ejemplo n.º 7
0
static void string_mt_destroy(const struct xt_mtdtor_param *par)
{
	textsearch_destroy(STRING_TEXT_PRIV(par->matchinfo)->config);
}
Ejemplo n.º 8
0
static void destroy(const struct xt_match *match, void *matchinfo,
		    unsigned int matchsize)
{
	textsearch_destroy(STRING_TEXT_PRIV(matchinfo)->config);
}