summaryrefslogtreecommitdiff
path: root/extensions/libct_proto_icmp.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2008-11-18 10:33:35 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2008-11-18 10:33:35 +0100
commit40efc1ebb15be022453f8c820c31099a8a0ebebd (patch)
tree2a99ebde272d6b7d36bbb2118b5637f48e0ae422 /extensions/libct_proto_icmp.c
parent6d8903cbf33ac10e8e03f884a58e374adc366887 (diff)
downloadconntrack-tools-40efc1ebb15be022453f8c820c31099a8a0ebebd.tar.gz
conntrack-tools-40efc1ebb15be022453f8c820c31099a8a0ebebd.zip
conntrack: cleanup command line tool protocol extensions
This patch cleans up the protocol extensions. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'extensions/libct_proto_icmp.c')
-rw-r--r--extensions/libct_proto_icmp.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/extensions/libct_proto_icmp.c b/extensions/libct_proto_icmp.c
index 62ad00f..a2c9a85 100644
--- a/extensions/libct_proto_icmp.c
+++ b/extensions/libct_proto_icmp.c
@@ -67,40 +67,24 @@ static int parse(char c,
unsigned int *flags)
{
switch(c) {
+ u_int8_t tmp;
+ u_int16_t id;
case '1':
- if (!optarg)
- break;
-
- nfct_set_attr_u8(ct,
- ATTR_ICMP_TYPE,
- atoi(optarg));
-
+ tmp = atoi(optarg);
+ nfct_set_attr_u8(ct, ATTR_ICMP_TYPE, tmp);
nfct_set_attr_u8(ct, ATTR_L4PROTO, IPPROTO_ICMP);
-
*flags |= ICMP_TYPE;
break;
case '2':
- if (!optarg)
- break;
-
- nfct_set_attr_u8(ct,
- ATTR_ICMP_CODE,
- atoi(optarg));
-
+ tmp = atoi(optarg);
+ nfct_set_attr_u8(ct, ATTR_ICMP_CODE, tmp);
nfct_set_attr_u8(ct, ATTR_L4PROTO, IPPROTO_ICMP);
-
*flags |= ICMP_CODE;
break;
case '3':
- if (!optarg)
- break;
-
- nfct_set_attr_u16(ct,
- ATTR_ICMP_ID,
- htons(atoi(optarg)));
-
+ id = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ICMP_ID, id);
nfct_set_attr_u8(ct, ATTR_L4PROTO, IPPROTO_ICMP);
-
*flags |= ICMP_ID;
break;
}