From b71178b667308922cf202c65a9aab840d52abcd4 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Mon, 17 Aug 2026 15:41:13 -0600 Subject: [PATCH] lua/dns: handle OPT answers like TXT records In "tx:answers()" don't attempt to push each OPT as its own string, instead concatenate into one string like we do with TXT. The previous method was broken and didn't work anyways, so we're not breaking something that previously worked. Ticket: 8843 --- rust/src/dns/lua.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rust/src/dns/lua.rs b/rust/src/dns/lua.rs index bba1cbbfd7..99094ccba9 100644 --- a/rust/src/dns/lua.rs +++ b/rust/src/dns/lua.rs @@ -201,10 +201,14 @@ pub extern "C" fn SCDnsLuaGetAnswerTable(clua: &mut CLuaState, tx: &mut DNSTrans DNSRData::OPT(ref opt) => { if !opt.is_empty() { lua.pushstring("addr"); - for option in opt.iter() { - lua.pushstring(&String::from_utf8_lossy(&option.code.to_be_bytes())); - lua.pushstring(&String::from_utf8_lossy(&option.data)); - } + let combined = opt + .iter() + .map(|option| { + format!("{}:{}", option.code, String::from_utf8_lossy(&option.data)) + }) + .collect::>() + .join(" "); + lua.pushstring(&combined); lua.settable(-3); } }