summaryrefslogtreecommitdiff
path: root/extensions/libct_proto_tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/libct_proto_tcp.c')
-rw-r--r--extensions/libct_proto_tcp.c49
1 files changed, 8 insertions, 41 deletions
diff --git a/extensions/libct_proto_tcp.c b/extensions/libct_proto_tcp.c
index 4f3094f..3b06aa2 100644
--- a/extensions/libct_proto_tcp.c
+++ b/extensions/libct_proto_tcp.c
@@ -12,8 +12,7 @@
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h> /* For htons */
-#include <linux/netfilter/nfnetlink_conntrack.h>
-#include <libnfnetlink_conntrack/libnfnetlink_conntrack.h>
+#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
#include "libct_proto.h"
@@ -76,10 +75,10 @@ void help()
}
int parse_options(char c, char *argv[],
- struct ctnl_tuple *orig,
- struct ctnl_tuple *reply,
- struct ctnl_tuple *mask,
- union ctnl_protoinfo *proto,
+ struct nfct_tuple *orig,
+ struct nfct_tuple *reply,
+ struct nfct_tuple *mask,
+ union nfct_protoinfo *proto,
unsigned int *flags)
{
switch(c) {
@@ -139,8 +138,8 @@ int parse_options(char c, char *argv[],
}
int final_check(unsigned int flags,
- struct ctnl_tuple *orig,
- struct ctnl_tuple *reply)
+ struct nfct_tuple *orig,
+ struct nfct_tuple *reply)
{
if ((flags & (ORIG_SPORT|ORIG_DPORT))
&& !(flags & (REPL_SPORT|REPL_DPORT))) {
@@ -160,42 +159,10 @@ int final_check(unsigned int flags,
return 0;
}
-void parse_proto(struct nfattr *cda[], struct ctnl_tuple *tuple)
-{
- if (cda[CTA_PROTO_SRC_PORT-1])
- tuple->l4src.tcp.port =
- *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_SRC_PORT-1]);
- if (cda[CTA_PROTO_DST_PORT-1])
- tuple->l4dst.tcp.port =
- *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_DST_PORT-1]);
-}
-
-void parse_protoinfo(struct nfattr *cda[], struct ctnl_conntrack *ct)
-{
- if (cda[CTA_PROTOINFO_TCP_STATE-1])
- ct->protoinfo.tcp.state =
- *(u_int8_t *)NFA_DATA(cda[CTA_PROTOINFO_TCP_STATE-1]);
-}
-
-void print_protoinfo(union ctnl_protoinfo *protoinfo)
-{
- fprintf(stdout, "%s ", states[protoinfo->tcp.state]);
-}
-
-void print_proto(struct ctnl_tuple *tuple)
-{
- fprintf(stdout, "sport=%u dport=%u ", htons(tuple->l4src.tcp.port),
- htons(tuple->l4dst.tcp.port));
-}
-
static struct ctproto_handler tcp = {
.name = "tcp",
- .protonum = 6,
+ .protonum = IPPROTO_TCP,
.parse_opts = parse_options,
- .parse_protoinfo = parse_protoinfo,
- .parse_proto = parse_proto,
- .print_proto = print_proto,
- .print_protoinfo = print_protoinfo,
.final_check = final_check,
.help = help,
.opts = opts,