Răsfoiți Sursa

fix: dnsproxy库有txid超范围的问题

Wendal Chen 1 an în urmă
părinte
comite
2a18abc481
1 a modificat fișierele cu 4 adăugiri și 1 ștergeri
  1. 4 1
      script/libs/dnsproxy.lua

+ 4 - 1
script/libs/dnsproxy.lua

@@ -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)
@@ -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