mirror of
https://github.com/bol-van/zapret2.git
synced 2026-03-13 22:03:09 +00:00
AI fixes
This commit is contained in:
@@ -557,12 +557,15 @@ void proto_dissect_l3l4(const uint8_t *data, size_t len, struct dissect *dis, bo
|
||||
dis->data_pkt = data;
|
||||
dis->len_pkt = len;
|
||||
|
||||
uint16_t iplen;
|
||||
|
||||
if (proto_check_ipv4(data, len) && (no_payload_check || proto_check_ipv4_payload(data, len)))
|
||||
{
|
||||
dis->ip = (const struct ip *) data;
|
||||
dis->proto = dis->ip->ip_p;
|
||||
p = data;
|
||||
dis->len_pkt = len = ntohs(((struct ip*)data)->ip_len);
|
||||
iplen = ntohs(((struct ip*)data)->ip_len);
|
||||
if (iplen<len) dis->len_pkt = len = iplen;
|
||||
proto_skip_ipv4(&data, &len, &dis->frag, &dis->frag_off);
|
||||
dis->len_l3 = data-p;
|
||||
}
|
||||
@@ -570,7 +573,8 @@ void proto_dissect_l3l4(const uint8_t *data, size_t len, struct dissect *dis, bo
|
||||
{
|
||||
dis->ip6 = (const struct ip6_hdr *) data;
|
||||
p = data;
|
||||
dis->len_pkt = len = ntohs(((struct ip6_hdr*)data)->ip6_ctlun.ip6_un1.ip6_un1_plen) + sizeof(struct ip6_hdr);
|
||||
iplen = ntohs(((struct ip6_hdr*)data)->ip6_ctlun.ip6_un1.ip6_un1_plen) + sizeof(struct ip6_hdr);
|
||||
if (iplen<len) dis->len_pkt = len = iplen;
|
||||
proto_skip_ipv6(&data, &len, &dis->proto, &dis->frag, &dis->frag_off);
|
||||
dis->len_l3 = data-p;
|
||||
}
|
||||
|
||||
@@ -387,6 +387,8 @@ static void notify_ready(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
// extra space for netlink headers
|
||||
#define NFQ_MAX_RECV_SIZE (RECONSTRUCT_MAX_SIZE+512)
|
||||
static int nfq_main(void)
|
||||
{
|
||||
struct nfq_handle *h = NULL;
|
||||
@@ -436,7 +438,7 @@ static int nfq_main(void)
|
||||
goto exok;
|
||||
}
|
||||
|
||||
if (!(buf = malloc(RECONSTRUCT_MAX_SIZE)) || !(mod = malloc(RECONSTRUCT_MAX_SIZE)))
|
||||
if (!(buf = malloc(NFQ_MAX_RECV_SIZE)) || !(mod = malloc(RECONSTRUCT_MAX_SIZE)))
|
||||
{
|
||||
DLOG_ERR("out of memory\n");
|
||||
goto err;
|
||||
@@ -466,7 +468,7 @@ static int nfq_main(void)
|
||||
do
|
||||
{
|
||||
if (bQuit) goto quit;
|
||||
while ((rd = recv(fd, buf, RECONSTRUCT_MAX_SIZE, 0)) >= 0)
|
||||
while ((rd = recv(fd, buf, NFQ_MAX_RECV_SIZE, 0)) >= 0)
|
||||
{
|
||||
if (!rd)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user