From 37ef0a638d19ca5145f6d4868e42b7aa2c735d46 Mon Sep 17 00:00:00 2001 From: "/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org" Date: Sun, 6 May 2007 17:36:13 +0000 Subject: - add warning note to ctnl_test.c: old API is deprecated - split expect_api_test.c into small example files expect_*.c - introduce alias tags for original tuple attributes - introduce nfexp_sizeof and nfexp_maxsize - build expectation attributes iif they are set - fix l3num setting in expect/build.c --- extensions/libct_proto_icmp.c | 56 ++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 25 deletions(-) (limited to 'extensions/libct_proto_icmp.c') diff --git a/extensions/libct_proto_icmp.c b/extensions/libct_proto_icmp.c index e7cb04d..7b02dec 100644 --- a/extensions/libct_proto_icmp.c +++ b/extensions/libct_proto_icmp.c @@ -1,6 +1,6 @@ /* - * (C) 2005 by Pablo Neira Ayuso - * Harald Welte + * (C) 2005-2007 by Pablo Neira Ayuso + * 2005 by 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 @@ -43,35 +43,42 @@ static u_int8_t invmap[] [ICMP_ADDRESSREPLY] = ICMP_ADDRESS + 1}; static int parse(char c, char *argv[], - struct nfct_tuple *orig, - struct nfct_tuple *reply, - struct nfct_tuple *exptuple, - struct nfct_tuple *mask, - union nfct_protoinfo *proto, + struct nf_conntrack *ct, + struct nf_conntrack *exptuple, + struct nf_conntrack *mask, unsigned int *flags) { switch(c) { case '1': - if (optarg) { - orig->l4dst.icmp.type = atoi(optarg); - reply->l4dst.icmp.type = - invmap[orig->l4dst.icmp.type] - 1; - *flags |= ICMP_TYPE; - } + if (!optarg) + break; + + nfct_set_attr_u8(ct, + ATTR_ICMP_TYPE, + atoi(optarg)); + /* FIXME: + reply->l4dst.icmp.type = + invmap[orig->l4dst.icmp.type] - 1; + */ + *flags |= ICMP_TYPE; break; case '2': - if (optarg) { - orig->l4dst.icmp.code = atoi(optarg); - reply->l4dst.icmp.code = 0; - *flags |= ICMP_CODE; - } + if (!optarg) + break; + + nfct_set_attr_u8(ct, + ATTR_ICMP_CODE, + atoi(optarg)); + *flags |= ICMP_CODE; break; case '3': - if (optarg) { - orig->l4src.icmp.id = htons(atoi(optarg)); - reply->l4dst.icmp.id = 0; - *flags |= ICMP_ID; - } + if (!optarg) + break; + + nfct_set_attr_u16(ct, + ATTR_ICMP_ID, + htons(atoi(optarg))); + *flags |= ICMP_ID; break; } return 1; @@ -79,8 +86,7 @@ static int parse(char c, char *argv[], static int final_check(unsigned int flags, unsigned int command, - struct nfct_tuple *orig, - struct nfct_tuple *reply) + struct nf_conntrack *ct) { if (!(flags & ICMP_TYPE)) return 0; -- cgit v1.2.3