blob: 6a45b0ebabc22290dec423f093bf050de7514e77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*
* (C) 2006-2007 by Pablo Neira Ayuso <pablo@netfilter.org>
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include "internal/internal.h"
int __expect_callback(struct nlmsghdr *nlh, struct nfattr *nfa[], void *data)
{
int ret = NFNL_CB_STOP;
unsigned int type;
struct nf_expect *exp;
int len = nlh->nlmsg_len;
struct __data_container *container = data;
len -= NLMSG_LENGTH(sizeof(struct nfgenmsg));
if (len < 0)
return NFNL_CB_CONTINUE;
type = __parse_message_type(nlh);
if (!(type & container->type))
return NFNL_CB_CONTINUE;
exp = nfexp_new();
if (!exp)
return NFNL_CB_CONTINUE;
__parse_expect(nlh, nfa, exp);
if (container->h->expect_cb)
ret = container->h->expect_cb(type, exp, container->data);
switch(ret) {
case NFCT_CB_FAILURE:
free(exp);
ret = NFNL_CB_FAILURE;
break;
case NFCT_CB_STOP:
free(exp);
ret = NFNL_CB_STOP;
break;
case NFCT_CB_CONTINUE:
free(exp);
ret = NFNL_CB_CONTINUE;
break;
case NFCT_CB_STOLEN:
ret = NFNL_CB_CONTINUE;
break;
}
return ret;
}
|