diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-05-14 16:21:13 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-05-14 16:21:13 +0200 |
commit | 3a35c7f2f84dde96c42de015cfd5fc44d115a0d7 (patch) | |
tree | 3471b94fb795f4eb7255ef672f68c2fa8667e9fe /examples/nfct-helper-add.c | |
parent | 850be7cc038f39d0293d0478927e4185c327768a (diff) |
examples: fix nfct-helper-add example
to adapt it to the new API
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'examples/nfct-helper-add.c')
-rw-r--r-- | examples/nfct-helper-add.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/examples/nfct-helper-add.c b/examples/nfct-helper-add.c index 4371761..6c47626 100644 --- a/examples/nfct-helper-add.c +++ b/examples/nfct-helper-add.c @@ -13,6 +13,7 @@ int main(int argc, char *argv[]) struct nlmsghdr *nlh; uint32_t portid, seq; struct nfct_helper *nfct_helper; + struct nfct_helper_policy *p; int ret; if (argc != 3) { @@ -28,11 +29,19 @@ int main(int argc, char *argv[]) nfct_helper_attr_set(nfct_helper, NFCTH_ATTR_NAME, argv[1]); nfct_helper_attr_set_u32(nfct_helper, NFCTH_ATTR_QUEUE_NUM, atoi(argv[2])); - nfct_helper_attr_set(nfct_helper, NFCTH_ATTR_EXP_POLICY_NAME, "test"); nfct_helper_attr_set_u16(nfct_helper, NFCTH_ATTR_PROTO_L3NUM, AF_INET); nfct_helper_attr_set_u8(nfct_helper, NFCTH_ATTR_PROTO_L4NUM, IPPROTO_TCP); - nfct_helper_attr_set_u32(nfct_helper, NFCTH_ATTR_EXP_POLICY_TIMEOUT, 100); - nfct_helper_attr_set_u32(nfct_helper, NFCTH_ATTR_EXP_POLICY_MAX, 100); + + p = nfct_helper_policy_alloc(); + if (p == NULL) { + perror("OOM"); + exit(EXIT_FAILURE); + } + nfct_helper_policy_attr_set(p, NFCTH_ATTR_POLICY_NAME, "test"); + nfct_helper_policy_attr_set_u32(p, NFCTH_ATTR_POLICY_TIMEOUT, 100); + nfct_helper_policy_attr_set_u32(p, NFCTH_ATTR_POLICY_MAX, 100); + + nfct_helper_attr_set(nfct_helper, NFCTH_ATTR_POLICY, p); seq = time(NULL); nlh = nfct_helper_nlmsg_build_hdr(buf, NFNL_MSG_CTHELPER_NEW, @@ -40,6 +49,7 @@ int main(int argc, char *argv[]) nfct_helper_nlmsg_build_payload(nlh, nfct_helper); nfct_helper_free(nfct_helper); + nfct_helper_policy_free(p); nl = mnl_socket_open(NETLINK_NETFILTER); if (nl == NULL) { |