From 70d8e5ad156fd31120a15ad2769110af3154aaaf Mon Sep 17 00:00:00 2001 From: bol-van Date: Thu, 19 Feb 2026 10:05:50 +0300 Subject: [PATCH] AI fixes --- nfq2/darkmagic.c | 4 ++-- nfq2/desync.c | 2 +- nfq2/protocol.c | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/nfq2/darkmagic.c b/nfq2/darkmagic.c index ff8507f..90aec49 100644 --- a/nfq2/darkmagic.c +++ b/nfq2/darkmagic.c @@ -335,7 +335,7 @@ void str_tcphdr(char *s, size_t s_len, const struct tcphdr *tcphdr) if (tcphdr->th_flags & TH_PUSH) *f++='P'; if (tcphdr->th_flags & TH_URG) *f++='U'; *f=0; - snprintf(s,s_len,"sport=%u dport=%u flags=%s seq=%u ack_seq=%u",htons(tcphdr->th_sport),htons(tcphdr->th_dport),flags,htonl(tcphdr->th_seq),htonl(tcphdr->th_ack)); + snprintf(s,s_len,"sport=%u dport=%u flags=%s seq=%u ack_seq=%u",ntohs(tcphdr->th_sport),ntohs(tcphdr->th_dport),flags,ntohl(tcphdr->th_seq),ntohl(tcphdr->th_ack)); } void print_tcphdr(const struct tcphdr *tcphdr) { @@ -345,7 +345,7 @@ void print_tcphdr(const struct tcphdr *tcphdr) } void str_udphdr(char *s, size_t s_len, const struct udphdr *udphdr) { - snprintf(s,s_len,"sport=%u dport=%u",htons(udphdr->uh_sport),htons(udphdr->uh_dport)); + snprintf(s,s_len,"sport=%u dport=%u",ntohs(udphdr->uh_sport),ntohs(udphdr->uh_dport)); } void print_udphdr(const struct udphdr *udphdr) { diff --git a/nfq2/desync.c b/nfq2/desync.c index b423378..ced24de 100644 --- a/nfq2/desync.c +++ b/nfq2/desync.c @@ -556,7 +556,7 @@ static bool reasm_client_start(t_ctrack *ctrack, uint8_t proto, size_t sz, size_ // server gave us too small tcp window // client will not send all pieces of reasm // if we drop packets and wait for next pieces we will see nothing but retransmissions - DLOG("reasm cancelled because server window size %u is smaller than expected reasm size %u\n", ctrack->pos.server.winsize_calc, sz); + DLOG("reasm cancelled because server window size %u is smaller than expected reasm size %zu\n", ctrack->pos.server.winsize_calc, sz); return false; } return reasm_start(ctrack, &ctrack->reasm_client, proto, (proto == IPPROTO_TCP) ? ctrack->pos.client.seq_last : 0, sz, szMax, data_payload, len_payload); diff --git a/nfq2/protocol.c b/nfq2/protocol.c index 2b43e61..27c11d0 100644 --- a/nfq2/protocol.c +++ b/nfq2/protocol.c @@ -1337,14 +1337,12 @@ bool IsQUICInitial(const uint8_t *data, size_t len) { // too small packets are not likely to be initials // long header, fixed bit - if (len < 128 || (data[0] & 0xF0)!=0xC0) return false; + if (len < 128) return false; uint32_t ver = QUICExtractVersion(data,len); if (QUICDraftVersion(ver) < 11) return false; - // quic v1 : initial packets are 00b - // quic v2 : initial packets are 01b - if ((data[0] & 0x30) != (is_quic_v2(ver) ? 0x10 : 0x00)) return false; + if ((data[0] & 0xF0) != (is_quic_v2(ver) ? 0xD0 : 0xC0)) return false; uint64_t offset=5, sz, sz2;