|
version 1.1.1.1, 2012/02/21 22:14:23
|
version 1.1.1.2, 2013/07/22 11:54:42
|
|
Line 40
|
Line 40
|
| #endif |
#endif |
| |
|
| int |
int |
| libnet_adv_cull_packet(libnet_t *l, u_int8_t **packet, u_int32_t *packet_s) | libnet_adv_cull_packet(libnet_t *l, uint8_t **packet, uint32_t *packet_s) |
| { |
{ |
| *packet = NULL; |
*packet = NULL; |
| *packet_s = 0; |
*packet_s = 0; |
|
Line 57 libnet_adv_cull_packet(libnet_t *l, u_int8_t **packet,
|
Line 57 libnet_adv_cull_packet(libnet_t *l, u_int8_t **packet,
|
| } |
} |
| |
|
| int |
int |
| libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, u_int8_t **header, | libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, uint8_t **header, |
| u_int32_t *header_s) | uint32_t *header_s) |
| { |
{ |
| libnet_pblock_t *p; |
libnet_pblock_t *p; |
| |
|
|
Line 86 libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag
|
Line 86 libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag
|
| } |
} |
| |
|
| int |
int |
| libnet_adv_write_link(libnet_t *l, u_int8_t *packet, u_int32_t packet_s) | libnet_adv_write_link(libnet_t *l, const uint8_t *packet, uint32_t packet_s) |
| { |
{ |
| int c; |
int c; |
| |
|
|
Line 119 libnet_adv_write_link(libnet_t *l, u_int8_t *packet, u
|
Line 119 libnet_adv_write_link(libnet_t *l, u_int8_t *packet, u
|
| return (c); |
return (c); |
| } |
} |
| |
|
| |
int |
| |
libnet_adv_write_raw_ipv4(libnet_t *l, const uint8_t *packet, uint32_t packet_s) |
| |
{ |
| |
int c; |
| |
|
| |
if (l->injection_type != LIBNET_RAW4_ADV) |
| |
{ |
| |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
| |
"%s(): advanced raw4 mode not enabled\n", __func__); |
| |
return (-1); |
| |
} |
| |
c = libnet_write_raw_ipv4(l, packet, packet_s); |
| |
|
| |
/* do statistics */ |
| |
if (c == packet_s) |
| |
{ |
| |
l->stats.packets_sent++; |
| |
l->stats.bytes_written += c; |
| |
} |
| |
else |
| |
{ |
| |
l->stats.packet_errors++; |
| |
/* |
| |
* XXX - we probably should have a way to retrieve the number of |
| |
* bytes actually written (since we might have written something). |
| |
*/ |
| |
if (c > 0) |
| |
{ |
| |
l->stats.bytes_written += c; |
| |
} |
| |
} |
| |
return (c); |
| |
} |
| |
|
| void |
void |
| libnet_adv_free_packet(libnet_t *l, u_int8_t *packet) | libnet_adv_free_packet(libnet_t *l, uint8_t *packet) |
| { |
{ |
| /* |
/* |
| * Restore original pointer address so free won't complain about a |
* Restore original pointer address so free won't complain about a |