From 6f542884d002d55d517a50dd9892068e95400b25 Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Mon, 2 Mar 2015 13:16:55 +0200 Subject: mz: Add igmp v1/v2 packet type crafting support Signed-off-by: Vadim Kochan Signed-off-by: Tobias Klauser --- staging/layer3.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'staging/layer3.c') diff --git a/staging/layer3.c b/staging/layer3.c index 3eca55d..0b17db1 100644 --- a/staging/layer3.c +++ b/staging/layer3.c @@ -154,17 +154,14 @@ libnet_ptag_t create_ip_packet (libnet_t *l) tx.ip_frag = 0; // Flags and Offset !!! tx.ip_sum = 0; // default: automatically calculate checksum tx.ip_tos = 0; - tx.ip_ttl = 255; - // temporary variables unsigned int dummy; size_t len; char *s; - T = tx.packet_mode; // >0 means automatic L2 creation - + if ( (getarg(tx.arg_string,"help", NULL)==1) && (mode==IP) ) { if (mz_port) @@ -284,13 +281,12 @@ libnet_ptag_t create_ip_packet (libnet_t *l) { tx.ip_frag |= 0x8000; } - - - if (getarg(tx.arg_string,"ttl", argval)==1) - { - tx.ip_ttl = (u_int8_t) str2int(argval); - } - + + if (getarg(tx.arg_string, "ttl", argval) == 1) + tx.ip_ttl = (u_int8_t)str2int(argval); + else if (tx.ip_ttl == 0) + tx.ip_ttl = 255; + if (getarg(tx.arg_string,"proto", argval)==1) { tx.ip_proto = (u_int8_t) str2int(argval); -- cgit v1.2.3-54-g00ecf