From 9698c6b78265c868f4dca92803bce1d84837ca59 Mon Sep 17 00:00:00 2001 From: "[anp/hsw]" Date: Sat, 17 Aug 2024 21:33:34 +0700 Subject: [PATCH] rewrite fix for ip6hdr dereference --- nfq/desync.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/nfq/desync.c b/nfq/desync.c index a72f86e..6e8bace 100644 --- a/nfq/desync.c +++ b/nfq/desync.c @@ -1237,13 +1237,10 @@ static uint8_t dpi_desync_udp_packet_play(bool replay, size_t reasm_offset, uint uint32_t desync_fwmark = fwmark | params.desync_fwmark; - if (ip6hdr) { - ttl_orig = ip ? ip->ip_ttl : ip6hdr->ip6_ctlun.ip6_un1.ip6_un1_hlim; - ttl_fake = params.desync_ttl6 ? params.desync_ttl6 : ttl_orig; - } else { - ttl_orig = ip ? ip->ip_ttl : 0; - ttl_fake = params.desync_ttl ? params.desync_ttl : ttl_orig; - } + ttl_orig = ip ? ip->ip_ttl : (ip6hdr ? ip6hdr->ip6_ctlun.ip6_un1.ip6_un1_hlim : 0); + if (ip6hdr) ttl_fake = params.desync_ttl6 ? params.desync_ttl6 : ttl_orig; + else ttl_fake = params.desync_ttl ? params.desync_ttl : ttl_orig; + extract_endpoints(ip, ip6hdr, NULL, udphdr, &src, &dst); if (len_payload)