Skip to content

Commit

Permalink
fix: dnsproxy库有txid超范围的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wendal committed Feb 16, 2025
1 parent 7f56957 commit 2a18abc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion script/libs/dnsproxy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local sys = require "sys"

local dnsproxy = {}
dnsproxy.map = {}
dnsproxy.txid = 0x1234
dnsproxy.txid = 0x123
dnsproxy.rxbuff = zbuff.create(1500)

function dnsproxy.on_request(sc, event)
Expand All @@ -31,6 +31,9 @@ function dnsproxy.on_request(sc, event)
local txid_request = rxbuff[0] + rxbuff[1] * 256
local txid_map = dnsproxy.txid
dnsproxy.txid = dnsproxy.txid + 1
if dnsproxy.txid > 65000 then
dnsproxy.txid = 0x123
end
table.insert(dnsproxy.map, {txid_request, txid_map, remote_ip, remote_port})
rxbuff[0] = txid_map % 256
rxbuff[1] = txid_map // 256
Expand Down

0 comments on commit 2a18abc

Please sign in to comment.