mirror of
https://github.com/bol-van/zapret2.git
synced 2026-10-29 06:02:05 +00:00
nfqws2: fix wrong ipv6 dissection
This commit is contained in:
1 parent
5026199f24
commit
a2d567c7a0
2 files changed
+7
-7
No files matched your search
+1
-1
@@ -193,4 +193,4 @@ v0.8.1
|
|||||||
0.8.6
|
0.8.6
|
||||||
|
|
||||||
* winws2, blockcheck2: allow multiple instances in windows, linux, freebsd (not openbsd)
|
* winws2, blockcheck2: allow multiple instances in windows, linux, freebsd (not openbsd)
|
||||||
* zapret-antidpi: oob instance cutoff if called not from the very beginning of tcp
|
* nfqws2: fix critical bug - wrong ipv6 dissection
|
||||||
+6
-6
@@ -347,17 +347,18 @@ bool proto_check_ipv6_payload(const uint8_t *data, size_t len)
|
|||||||
}
|
}
|
||||||
// move to transport protocol
|
// move to transport protocol
|
||||||
// proto_type = 0 => error
|
// proto_type = 0 => error
|
||||||
void proto_skip_ipv6(const uint8_t **data, size_t *len, uint8_t *proto_type, const uint8_t **last_header_type)
|
void proto_skip_ipv6(const uint8_t **data, size_t *len, uint8_t *proto_type)
|
||||||
{
|
{
|
||||||
size_t hdrlen;
|
size_t hdrlen;
|
||||||
uint8_t HeaderType;
|
uint8_t HeaderType;
|
||||||
uint16_t plen;
|
uint16_t plen;
|
||||||
|
struct ip6_hdr *ip6 = (struct ip6_hdr*)*data;
|
||||||
|
|
||||||
if (proto_type) *proto_type = 0; // put error in advance
|
if (proto_type) *proto_type = 0; // put error in advance
|
||||||
|
|
||||||
HeaderType = (*data)[6]; // NextHeader field
|
HeaderType = ip6->ip6_nxt;
|
||||||
if (last_header_type) *last_header_type = (*data)+6;
|
if (proto_type) *proto_type = HeaderType;
|
||||||
plen = ntohs(((struct ip6_hdr*)data)->ip6_ctlun.ip6_un1.ip6_un1_plen);
|
plen = ntohs(ip6->ip6_ctlun.ip6_un1.ip6_un1_plen);
|
||||||
*data += sizeof(struct ip6_hdr); *len -= sizeof(struct ip6_hdr); // skip ipv6 base header
|
*data += sizeof(struct ip6_hdr); *len -= sizeof(struct ip6_hdr); // skip ipv6 base header
|
||||||
if (plen < *len) *len = plen;
|
if (plen < *len) *len = plen;
|
||||||
while (*len) // need at least one byte for NextHeader field
|
while (*len) // need at least one byte for NextHeader field
|
||||||
@@ -390,7 +391,6 @@ void proto_skip_ipv6(const uint8_t **data, size_t *len, uint8_t *proto_type, con
|
|||||||
}
|
}
|
||||||
if (*len < hdrlen) return; // error
|
if (*len < hdrlen) return; // error
|
||||||
HeaderType = **data;
|
HeaderType = **data;
|
||||||
if (last_header_type) *last_header_type = *data;
|
|
||||||
// advance to the next header location
|
// advance to the next header location
|
||||||
*len -= hdrlen;
|
*len -= hdrlen;
|
||||||
*data += hdrlen;
|
*data += hdrlen;
|
||||||
@@ -466,7 +466,7 @@ void proto_dissect_l3l4(const uint8_t *data, size_t len, struct dissect *dis)
|
|||||||
{
|
{
|
||||||
dis->ip6 = (const struct ip6_hdr *) data;
|
dis->ip6 = (const struct ip6_hdr *) data;
|
||||||
p = data;
|
p = data;
|
||||||
proto_skip_ipv6(&data, &len, &dis->proto, NULL);
|
proto_skip_ipv6(&data, &len, &dis->proto);
|
||||||
dis->len_l3 = data-p;
|
dis->len_l3 = data-p;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in new issue
Block a user