alexdalitz / dnsruby

Dnsruby is a feature-complete DNS(SEC) client for Ruby, as used by many of the world's largest DNS registries and the OpenDNSSEC project
Other
197 stars 77 forks source link

Malformed Packet #188

Closed xxz199539 closed 11 months ago

xxz199539 commented 1 year ago

when I used dnsruby(1.53) to send nsupdate, if num of NAPTR more than 146(packet size 17296),i got Dnsruby::TsigNotSignedResponseError。packet in wireshark like: image image

alexdalitz commented 1 year ago

Could you please send some code which demonstrates the issue?Sent from my iPhoneOn 28 Jul 2023, at 08:23, 伊邪那岐 @.***> wrote: when I used dnsruby(1.53) to send nsupdate, if num of NAPTR more than 146(packet size 17296),i got Dnsruby::TsigNotSignedResponseError。packet in wireshark like:

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

xxz199539 commented 1 year ago

thanks, my code: ` image

`

c.txt saved NAPTR records, like: TAC-LB04.tac-hb1A.tac.epc.mnc001.mcc460.3gppnetwork.org. 86400 NAPTR 10 10 "S" "x-3gpp-sgw:x-s11+nc-nr:x-s5-gtp+nc-nr:x-s8-gtp+nc-nr" "" sgw-pool-ncnr.bj.bj.node.epc.mnc001.mcc460.3gppnetwork.org. TAC-LB04.tac-hb1A.tac.epc.mnc001.mcc460.3gppnetwork.org. 86400 NAPTR 20 10 "S" "x-3gpp-sgw:x-s11:x-s5-gtp:x-s8-gtp" "" sgw-pool1-smf.bj.bj.node.epc.mnc001.mcc460.3gppnetwork.org. ........ @alexdalitz

alexdalitz commented 1 year ago

Thanks!I’m afraid I’m away from computers until early September, when I can take a look.In the meantime, could this be related to the TXT record 255 byte limit?Thanks, and apologies!Sent from my iPhoneOn 28 Jul 2023, at 09:23, 伊邪那岐 @.***> wrote: thanks, my code: file_path = '/Users/xiangxianzhang/Desktop/c.txt' File.open(file_path, 'r') do |file| file.each_line.with_index(1) do |line, line_number| data = line.split(" ") name, ttl, data_type, rdata = data[0],data[1], data[2], data[3..-1].join(" ") rr1 = Dns_RR.create_rr(name, ttl, data_type, rdata).qualified("tac.epc.mnc001.mcc460.3gppnetwork.org") rrs << rr1 if line_number == 146 break end end end bind_rrs = rrs.map{|rr| rr.bind_rr} package = Dnsruby::Update.new("tac-lb5e.tac-hb1a.tac.epc.mnc001.mcc460.3gppnetwork.org.") package.add(bind_rrs) key = Key.new(to_ascii("default"), "vSfQ/ug7dVJ1+w6W95yKwA==", to_ascii("default"), "no", "hmac-md5$128") resolver = Dnsruby::Resolver.new(:nameserver => "10.2.18.107",:port => 53) resolver.recurse = false if key resolver.tsig = key.name, key.secret, key.algorithm.split("$")[0] end resolver.send_message(package) c.txt saved NAPTR records, like: TAC-LB04.tac-hb1A.tac.epc.mnc001.mcc460.3gppnetwork.org. 86400 NAPTR 10 10 "S" "x-3gpp-sgw:x-s11+nc-nr:x-s5-gtp+nc-nr:x-s8-gtp+nc-nr" "" sgw-pool-ncnr.bj.bj.node.epc.mnc001.mcc460.3gppnetwork.org. TAC-LB04.tac-hb1A.tac.epc.mnc001.mcc460.3gppnetwork.org. 86400 NAPTR 20 10 "S" "x-3gpp-sgw:x-s11:x-s5-gtp:x-s8-gtp" "" sgw-pool1-smf.bj.bj.node.epc.mnc001.mcc460.3gppnetwork.org. ........ @alexdalitz

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

xxz199539 commented 1 year ago

yes, TXT record limit 255, otherwise get Malformed Packet. @alexdalitz

alexdalitz commented 1 year ago

Hi - I'm sorry it's taken me so long to back in front a computer! However, I think your problem (if it is still a problem for you!) is related to this : https://github.com/alexdalitz/dnsruby/issues/187

Basically, instead of a string containing strings of all the inidividual sub-255 byte strings in the rdata of a TXT record (or anything based on a TXT record), like so : ""string1" "string2" "string3"", Dnsruby expects an array of strings, like : ["string1", "string2", "string3"]

Hopefully this will fix the problem - please let me know!

However, given that you are the second person to get caught out by in recent times, perhaps I should look at changing the interface so that both are, somehow, supported.

alexdalitz commented 12 months ago

Hi - I haven't heard back, so I think I will close this ticket if there is still no response.

alexdalitz commented 11 months ago

There has been no response to the solution, so I'm going to close this ticket.