summaryrefslogtreecommitdiffstats
path: root/extensions/libnetfilter_conntrack_sctp.c
diff options
context:
space:
mode:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org>2005-10-30 14:58:23 +0000
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org>2005-10-30 14:58:23 +0000
commit8dbd12018152683d253ff59ca22f646a410c1a82 (patch)
treee4e4d961ec5af57b560fd3ea35b762fc248228d5 /extensions/libnetfilter_conntrack_sctp.c
parent62b2c282232df3407b966198a3cbd1292edb4913 (diff)
o make static protocol handler functions
o move build_tuple_proto and build_protoinfo to the extensions where it really belongs to. o Reworked the conntrack and expect netlink handlers o Fix expectation table output, now it's similar to the /proc output o Bumped version to 0.2.1
Diffstat (limited to 'extensions/libnetfilter_conntrack_sctp.c')
-rw-r--r--extensions/libnetfilter_conntrack_sctp.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/extensions/libnetfilter_conntrack_sctp.c b/extensions/libnetfilter_conntrack_sctp.c
index f533287..564d641 100644
--- a/extensions/libnetfilter_conntrack_sctp.c
+++ b/extensions/libnetfilter_conntrack_sctp.c
@@ -16,7 +16,7 @@
#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
#include <libnetfilter_conntrack/libnetfilter_conntrack_extensions.h>
-void parse_proto(struct nfattr *cda[], struct nfct_tuple *tuple)
+static void parse_proto(struct nfattr *cda[], struct nfct_tuple *tuple)
{
if (cda[CTA_PROTO_SRC_PORT-1])
tuple->l4src.sctp.port =
@@ -26,7 +26,7 @@ void parse_proto(struct nfattr *cda[], struct nfct_tuple *tuple)
*(u_int16_t *)NFA_DATA(cda[CTA_PROTO_DST_PORT-1]);
}
-void parse_protoinfo(struct nfattr *cda[], struct nfct_conntrack *ct)
+static void parse_protoinfo(struct nfattr *cda[], struct nfct_conntrack *ct)
{
/* if (cda[CTA_PROTOINFO_SCTP_STATE-1])
ct->protoinfo.sctp.state =
@@ -34,13 +34,22 @@ void parse_protoinfo(struct nfattr *cda[], struct nfct_conntrack *ct)
*/
}
-int print_protoinfo(char *buf, union nfct_protoinfo *protoinfo)
+static void build_tuple_proto(struct nfnlhdr *req, int size,
+ struct nfct_tuple *t)
+{
+ nfnl_addattr_l(&req->nlh, size, CTA_PROTO_SRC_PORT,
+ &t->l4src.tcp.port, sizeof(u_int16_t));
+ nfnl_addattr_l(&req->nlh, size, CTA_PROTO_DST_PORT,
+ &t->l4dst.tcp.port, sizeof(u_int16_t));
+}
+
+static int print_protoinfo(char *buf, union nfct_protoinfo *protoinfo)
{
/* fprintf(stdout, "%s ", states[protoinfo->sctp.state]); */
return 0;
}
-int print_proto(char *buf, struct nfct_tuple *tuple)
+static int print_proto(char *buf, struct nfct_tuple *tuple)
{
return(sprintf(buf, "sport=%u dport=%u ", htons(tuple->l4src.sctp.port),
htons(tuple->l4dst.sctp.port)));
@@ -51,14 +60,15 @@ static struct nfct_proto sctp = {
.protonum = IPPROTO_SCTP,
.parse_proto = parse_proto,
.parse_protoinfo = parse_protoinfo,
+ .build_tuple_proto = build_tuple_proto,
.print_proto = print_proto,
.print_protoinfo = print_protoinfo,
.version = LIBNETFILTER_CONNTRACK_VERSION
};
-void __attribute__ ((constructor)) init(void);
+static void __attribute__ ((constructor)) init(void);
-void init(void)
+static void init(void)
{
nfct_register_proto(&sctp);
}