From 7ec2f918a384e62ca5b0a62e204d1fbe882718d7 Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org" Date: Fri, 22 Jul 2005 07:40:26 +0000 Subject: major re-sync with current names/definitions in libctnetlink and kernel --- extensions/libct_proto_icmp.c | 19 ++++++++++++++++++- extensions/libct_proto_sctp.c | 9 +++++---- extensions/libct_proto_tcp.c | 9 +++++---- extensions/libct_proto_udp.c | 8 ++++---- 4 files changed, 32 insertions(+), 13 deletions(-) (limited to 'extensions') diff --git a/extensions/libct_proto_icmp.c b/extensions/libct_proto_icmp.c index 24d3d3f..e0de27e 100644 --- a/extensions/libct_proto_icmp.c +++ b/extensions/libct_proto_icmp.c @@ -1,5 +1,6 @@ /* * (C) 2005 by Pablo Neira Ayuso + * Harald Welte * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -68,6 +69,21 @@ int parse(char c, char *argv[], return 1; } +void parse_proto(struct nfattr *cda[], struct ctnl_tuple *tuple) +{ + if (cda[CTA_PROTO_ICMP_TYPE-1]) + tuple->l4dst.icmp.type = + *(u_int8_t *)NFA_DATA(cda[CTA_PROTO_ICMP_TYPE-1]); + + if (cda[CTA_PROTO_ICMP_CODE-1]) + tuple->l4dst.icmp.code = + *(u_int8_t *)NFA_DATA(cda[CTA_PROTO_ICMP_CODE-1]); + + if (cda[CTA_PROTO_ICMP_ID-1]) + tuple->l4src.icmp.id = + *(u_int8_t *)NFA_DATA(cda[CTA_PROTO_ICMP_ID-1]); +} + int final_check(unsigned int flags, struct ctnl_tuple *orig, struct ctnl_tuple *reply) @@ -82,7 +98,7 @@ int final_check(unsigned int flags, void print_proto(struct ctnl_tuple *t) { - fprintf(stdout, "type=%d code=%d id=%d", t->l4dst.icmp.type, + fprintf(stdout, "type=%d code=%d id=%d ", t->l4dst.icmp.type, t->l4dst.icmp.code, t->l4src.icmp.id); } @@ -91,6 +107,7 @@ static struct ctproto_handler icmp = { .name = "icmp", .protonum = 1, .parse_opts = parse, + .parse_proto = parse_proto, .print_proto = print_proto, .final_check = final_check, .help = help, diff --git a/extensions/libct_proto_sctp.c b/extensions/libct_proto_sctp.c index 5b50fbc..d5ff298 100644 --- a/extensions/libct_proto_sctp.c +++ b/extensions/libct_proto_sctp.c @@ -10,6 +10,7 @@ #include #include #include +#include #include /* For htons */ #include #include "libct_proto.h" @@ -138,12 +139,12 @@ int final_check(unsigned int flags, void parse_proto(struct nfattr *cda[], struct ctnl_tuple *tuple) { - if (cda[CTA_PROTO_SCTP_SRC-1]) + if (cda[CTA_PROTO_SRC_PORT-1]) tuple->l4src.sctp.port = - *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_SCTP_SRC-1]); - if (cda[CTA_PROTO_SCTP_DST-1]) + *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_SRC_PORT-1]); + if (cda[CTA_PROTO_DST_PORT-1]) tuple->l4dst.sctp.port = - *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_SCTP_DST-1]); + *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_DST_PORT-1]); } void parse_protoinfo(struct nfattr *cda[], struct ctnl_conntrack *ct) diff --git a/extensions/libct_proto_tcp.c b/extensions/libct_proto_tcp.c index 5fa3652..973c5ab 100644 --- a/extensions/libct_proto_tcp.c +++ b/extensions/libct_proto_tcp.c @@ -10,6 +10,7 @@ #include #include #include +#include #include /* For htons */ #include #include "libct_proto.h" @@ -160,12 +161,12 @@ int final_check(unsigned int flags, void parse_proto(struct nfattr *cda[], struct ctnl_tuple *tuple) { - if (cda[CTA_PROTO_TCP_SRC-1]) + if (cda[CTA_PROTO_SRC_PORT-1]) tuple->l4src.tcp.port = - *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_TCP_SRC-1]); - if (cda[CTA_PROTO_TCP_DST-1]) + *(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_TCP_DST-1]); + *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_DST_PORT-1]); } void parse_protoinfo(struct nfattr *cda[], struct ctnl_conntrack *ct) diff --git a/extensions/libct_proto_udp.c b/extensions/libct_proto_udp.c index aa733f0..7821d5b 100644 --- a/extensions/libct_proto_udp.c +++ b/extensions/libct_proto_udp.c @@ -127,12 +127,12 @@ int final_check(unsigned int flags, void parse_proto(struct nfattr *cda[], struct ctnl_tuple *tuple) { - if (cda[CTA_PROTO_UDP_SRC-1]) + if (cda[CTA_PROTO_SRC_PORT-1]) tuple->l4src.udp.port = - *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_UDP_SRC-1]); - if (cda[CTA_PROTO_UDP_DST-1]) + *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_SRC_PORT-1]); + if (cda[CTA_PROTO_DST_PORT-1]) tuple->l4dst.udp.port = - *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_UDP_DST-1]); + *(u_int16_t *)NFA_DATA(cda[CTA_PROTO_DST_PORT-1]); } void print_proto(struct ctnl_tuple *tuple) -- cgit v1.2.3