Mailing List Archive

libnasl/nasl nasl_packet_forgery.c,1.2,1.3 nasl_init.c,1.5,1.6
Update of /usr/local/cvs/libnasl/nasl
In directory raccoon.nessus.org:/tmp/cvs-serv80507

Modified Files:
nasl_packet_forgery.c nasl_init.c
Log Message:
icmp checksum can be overriden by the user


Index: nasl_packet_forgery.c
===================================================================
RCS file: /usr/local/cvs/libnasl/nasl/nasl_packet_forgery.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- nasl_packet_forgery.c 7 Jan 2003 01:39:30 -0000 1.2
+++ nasl_packet_forgery.c 14 Jan 2003 18:49:44 -0000 1.3
@@ -857,6 +857,7 @@

{
data = get_str_local_var_by_name(lexic, "data");
len = data == NULL ? 0 : get_var_size_by_name(lexic, "data");
+

t = get_int_local_var_by_name(lexic, "icmp_type", 0);
if(t == 13 || t == 14) len += 3 * sizeof(time_t);
@@ -884,10 +885,13 @@

icmp->icmp_type = t;
icmp->icmp_seq = htonl(get_int_local_var_by_name(lexic, "icmp_seq", 0));
icmp->icmp_id = htons(get_int_local_var_by_name(lexic, "icmp_id", 0));
-
+ icmp->icmp_cksum = htons(get_int_local_var_by_name(lexic, "icmp_cksum", 0));
+
if(data != NULL)bcopy(data, &(p[8]), len);

- icmp->icmp_cksum = np_in_cksum((u_short *) icmp, len+8);
+ if(icmp->icmp_cksum == 0)
+ icmp->icmp_cksum = np_in_cksum((u_short *) icmp, len + 8);
+
retc = alloc_tree_cell(0, NULL);
retc->type = CONST_DATA;
retc->x.str_val = pkt;

Index: nasl_init.c
===================================================================
RCS file: /usr/local/cvs/libnasl/nasl/nasl_init.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- nasl_init.c 13 Jan 2003 13:21:33 -0000 1.5
+++ nasl_init.c 14 Jan 2003 18:49:44 -0000 1.6
@@ -194,7 +194,7 @@

"dump_udp_packet", dump_udp_packet, 999, { NULL },

"forge_icmp_packet",forge_icmp_packet, 0,
- { "data", "icmp_code", "icmp_id", "icmp_seq", "icmp_type",
+ { "data", "icmp_cksum", "icmp_code", "icmp_id", "icmp_seq", "icmp_type",
"ip", "update_ip_len", NULL },