From 0fca9b95fed33823b6b9443d0afd18d1bf9e5dc7 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 2 Feb 2012 00:25:02 +0100 Subject: cthelper: add NFCTH_ATTR_PRIV_DATA_LEN New attribute that is mandatory to set the size of the private data. Signed-off-by: Pablo Neira Ayuso --- include/libnetfilter_cthelper/libnetfilter_cthelper.h | 1 + include/linux/netfilter/nfnetlink_cthelper.h | 1 + src/libnetfilter_cthelper.c | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/include/libnetfilter_cthelper/libnetfilter_cthelper.h b/include/libnetfilter_cthelper/libnetfilter_cthelper.h index 13bfca8..d0fcfa7 100644 --- a/include/libnetfilter_cthelper/libnetfilter_cthelper.h +++ b/include/libnetfilter_cthelper/libnetfilter_cthelper.h @@ -14,6 +14,7 @@ enum nfct_helper_attr_type { NFCTH_ATTR_EXP_POLICY_NAME, NFCTH_ATTR_EXP_POLICY_TIMEOUT, NFCTH_ATTR_EXP_POLICY_MAX, + NFCTH_ATTR_PRIV_DATA_LEN, }; struct nfct_helper *nfct_helper_alloc(void); diff --git a/include/linux/netfilter/nfnetlink_cthelper.h b/include/linux/netfilter/nfnetlink_cthelper.h index 52c365b..4676922 100644 --- a/include/linux/netfilter/nfnetlink_cthelper.h +++ b/include/linux/netfilter/nfnetlink_cthelper.h @@ -14,6 +14,7 @@ enum nfnl_cthelper_type { NFCTH_TUPLE, NFCTH_QUEUE_NUM, NFCTH_POLICY, + NFCTH_PRIV_DATA_LEN, __NFCTH_MAX }; #define NFCTH_MAX (__NFCTH_MAX - 1) diff --git a/src/libnetfilter_cthelper.c b/src/libnetfilter_cthelper.c index c70a5eb..51f6cea 100644 --- a/src/libnetfilter_cthelper.c +++ b/src/libnetfilter_cthelper.c @@ -66,6 +66,7 @@ struct nfct_helper { char name[NF_CT_HELPER_NAME_MAX]; + uint32_t priv_data_len; uint32_t queue_num; uint32_t policy_num; struct { @@ -152,6 +153,10 @@ nfct_helper_attr_set(struct nfct_helper *nfct_helper, nfct_helper->expect_policy[0].expect_max = *((uint32_t *) data); nfct_helper->bitset |= (1 << NFCTH_ATTR_EXP_POLICY_MAX); break; + case NFCTH_ATTR_PRIV_DATA_LEN: + nfct_helper->priv_data_len = *((uint32_t *) data); + nfct_helper->bitset |= (1 << NFCTH_ATTR_PRIV_DATA_LEN); + break; } } EXPORT_SYMBOL(nfct_helper_attr_set); @@ -402,6 +407,8 @@ void nfct_helper_nlmsg_build_payload(struct nlmsghdr *nlh, mnl_attr_put_strz(nlh, NFCTH_NAME, nfct_helper->name); mnl_attr_put_u32(nlh, NFCTH_QUEUE_NUM, htonl(nfct_helper->queue_num)); + mnl_attr_put_u32(nlh, NFCTH_PRIV_DATA_LEN, + htonl(nfct_helper->priv_data_len)); nest = mnl_attr_nest_start(nlh, NFCTH_TUPLE); mnl_attr_put_u16(nlh, NFCTH_TUPLE_L3PROTONUM, nfct_helper->tuple.l3num); -- cgit v1.2.3