Exemple #1
0
static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
{
	struct text_match *tm = EM_TEXT_PRIV(m);
	struct tcf_em_text conf;

	strncpy(conf.algo, tm->config->ops->name, sizeof(conf.algo) - 1);
	conf.from_offset = tm->from_offset;
	conf.to_offset = tm->to_offset;
	conf.from_layer = tm->from_layer;
	conf.to_layer = tm->to_layer;
	conf.pattern_len = textsearch_get_pattern_len(tm->config);
	conf.pad = 0;

	RTA_PUT_NOHDR(skb, sizeof(conf), &conf);
	RTA_APPEND(skb, conf.pattern_len, textsearch_get_pattern(tm->config));
	return 0;

rtattr_failure:
	return -1;
}
Exemple #2
0
static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
{
    struct text_match *tm = EM_TEXT_PRIV(m);
    struct tcf_em_text conf;

    strncpy(conf.algo, tm->config->ops->name, sizeof(conf.algo) - 1);
    conf.from_offset = tm->from_offset;
    conf.to_offset = tm->to_offset;
    conf.from_layer = tm->from_layer;
    conf.to_layer = tm->to_layer;
    conf.pattern_len = textsearch_get_pattern_len(tm->config);
    conf.pad = 0;

    if (nla_put_nohdr(skb, sizeof(conf), &conf) < 0)
        goto nla_put_failure;
    if (nla_append(skb, conf.pattern_len,
                   textsearch_get_pattern(tm->config)) < 0)
        goto nla_put_failure;
    return 0;

nla_put_failure:
    return -1;
}