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_udp.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'extensions/libnetfilter_conntrack_udp.c') diff --git a/extensions/libnetfilter_conntrack_udp.c b/extensions/libnetfilter_conntrack_udp.c index 44fd85c..2fe3da2 100644 --- a/extensions/libnetfilter_conntrack_udp.c +++ b/extensions/libnetfilter_conntrack_udp.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.udp.port = @@ -26,23 +26,33 @@ void parse_proto(struct nfattr *cda[], struct nfct_tuple *tuple) *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_DST_PORT-1]); } -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.udp.port), htons(tuple->l4dst.udp.port))); } +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 struct nfct_proto udp = { .name = "udp", .protonum = IPPROTO_UDP, + .build_tuple_proto = build_tuple_proto, .parse_proto = parse_proto, .print_proto = print_proto, .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(&udp); } -- cgit v1.2.3