From 8dbd12018152683d253ff59ca22f646a410c1a82 Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org" Date: Sun, 30 Oct 2005 14:58:23 +0000 Subject: 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 --- extensions/libnetfilter_conntrack_sctp.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'extensions/libnetfilter_conntrack_sctp.c') 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 #include -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); } -- cgit v1.2.3