version 1.1.1.2, 2013/07/22 11:54:42
|
version 1.1.1.3, 2023/09/27 11:11:38
|
Line 30
|
Line 30
|
* |
* |
*/ |
*/ |
|
|
#if (HAVE_CONFIG_H) | #include "common.h" |
#include "../include/config.h" | |
#endif | |
#if (!(_WIN32) || (__CYGWIN__)) | |
#include "../include/libnet.h" | |
#else | |
#include "../include/win32/libnet.h" | |
#endif | |
#include <assert.h> |
#include <assert.h> |
|
|
libnet_pblock_t * |
libnet_pblock_t * |
Line 81 libnet_pblock_probe(libnet_t *l, libnet_ptag_t ptag, u
|
Line 74 libnet_pblock_probe(libnet_t *l, libnet_ptag_t ptag, u
|
if (p->buf == NULL) |
if (p->buf == NULL) |
{ |
{ |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
"%s(): can't resize pblock buffer: %s\n", __func__, | "%s(): can't resize pblock buffer: %s", __func__, |
strerror(errno)); |
strerror(errno)); |
return (NULL); |
return (NULL); |
} |
} |
Line 108 static void* zmalloc(libnet_t* l, uint32_t size, const
|
Line 101 static void* zmalloc(libnet_t* l, uint32_t size, const
|
if(v) |
if(v) |
memset(v, 0, size); |
memset(v, 0, size); |
else |
else |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s\n", func, | snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s", func, |
strerror(errno)); |
strerror(errno)); |
return v; |
return v; |
} |
} |
Line 261 libnet_pblock_find(libnet_t *l, libnet_ptag_t ptag)
|
Line 254 libnet_pblock_find(libnet_t *l, libnet_ptag_t ptag)
|
} |
} |
} |
} |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
"%s(): couldn't find protocol block\n", __func__); | "%s(): couldn't find protocol block", __func__); |
return (NULL); |
return (NULL); |
} |
} |
|
|
Line 271 libnet_pblock_append(libnet_t *l, libnet_pblock_t *p,
|
Line 264 libnet_pblock_append(libnet_t *l, libnet_pblock_t *p,
|
if (len && !buf) |
if (len && !buf) |
{ |
{ |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
"%s(): payload inconsistency\n", __func__); | "%s(): payload inconsistency", __func__); |
return -1; |
return -1; |
} |
} |
|
|
if (p->copied + len > p->b_len) |
if (p->copied + len > p->b_len) |
{ |
{ |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
"%s(): memcpy would overflow buffer\n", __func__); | "%s(): memcpy would overflow buffer", __func__); |
return (-1); |
return (-1); |
} |
} |
memcpy(p->buf + p->copied, buf, len); |
memcpy(p->buf + p->copied, buf, len); |
Line 360 libnet_pblock_coalesce(libnet_t *l, uint8_t **packet,
|
Line 353 libnet_pblock_coalesce(libnet_t *l, uint8_t **packet,
|
} |
} |
if (*packet == NULL) |
if (*packet == NULL) |
{ |
{ |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s\n", | snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s", |
__func__, strerror(errno)); |
__func__, strerror(errno)); |
return (-1); |
return (-1); |
} |
} |
Line 387 libnet_pblock_coalesce(libnet_t *l, uint8_t **packet,
|
Line 380 libnet_pblock_coalesce(libnet_t *l, uint8_t **packet,
|
(l->pblock_end->type != LIBNET_PBLOCK_802_3_H)) |
(l->pblock_end->type != LIBNET_PBLOCK_802_3_H)) |
{ |
{ |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
"%s(): packet assembly cannot find a layer 2 header\n", | "%s(): packet assembly cannot find a layer 2 header", |
__func__); |
__func__); |
goto err; |
goto err; |
} |
} |
Line 396 libnet_pblock_coalesce(libnet_t *l, uint8_t **packet,
|
Line 389 libnet_pblock_coalesce(libnet_t *l, uint8_t **packet,
|
if ((l->pblock_end->type != LIBNET_PBLOCK_IPV4_H)) |
if ((l->pblock_end->type != LIBNET_PBLOCK_IPV4_H)) |
{ |
{ |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
"%s(): packet assembly cannot find an IPv4 header\n", | "%s(): packet assembly cannot find an IPv4 header", |
__func__); |
__func__); |
goto err; |
goto err; |
} |
} |
Line 405 libnet_pblock_coalesce(libnet_t *l, uint8_t **packet,
|
Line 398 libnet_pblock_coalesce(libnet_t *l, uint8_t **packet,
|
if ((l->pblock_end->type != LIBNET_PBLOCK_IPV6_H)) |
if ((l->pblock_end->type != LIBNET_PBLOCK_IPV6_H)) |
{ |
{ |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
"%s(): packet assembly cannot find an IPv6 header\n", | "%s(): packet assembly cannot find an IPv6 header", |
__func__); |
__func__); |
goto err; |
goto err; |
} |
} |
Line 413 libnet_pblock_coalesce(libnet_t *l, uint8_t **packet,
|
Line 406 libnet_pblock_coalesce(libnet_t *l, uint8_t **packet,
|
default: |
default: |
/* we should not end up here ever */ |
/* we should not end up here ever */ |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
"%s(): suddenly the dungeon collapses -- you die\n", | "%s(): suddenly the dungeon collapses -- you die", |
__func__); |
__func__); |
goto err; |
goto err; |
break; |
break; |
Line 622 libnet_pblock_record_ip_offset(libnet_t *l, libnet_pbl
|
Line 615 libnet_pblock_record_ip_offset(libnet_t *l, libnet_pbl
|
*/ |
*/ |
} |
} |
|
|
| /** |
| * Local Variables: |
| * indent-tabs-mode: nil |
| * c-file-style: "stroustrup" |
| * End: |
| */ |