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 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'extensions/libct_proto_icmp.c') 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, -- cgit v1.2.3