summaryrefslogtreecommitdiff
path: root/staging/layer3.c
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2015-03-02 13:16:55 +0200
committerTobias Klauser <tklauser@distanz.ch>2015-03-17 11:45:33 +0100
commit6f542884d002d55d517a50dd9892068e95400b25 (patch)
tree6d1075d2ae80cf6deb83cb361518890dc8d66d1a /staging/layer3.c
parent814902086268083d4d024853027fdc99b345ebf9 (diff)
mz: Add igmp v1/v2 packet type crafting support
Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'staging/layer3.c')
-rw-r--r--staging/layer3.c18
1 files changed, 7 insertions, 11 deletions
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);