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
pull/16213/head
Jason Ish 2 months ago committed by Victor Julien
parent bddf04d99b
commit b71178b667

@ -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::<Vec<_>>()
.join(" ");
lua.pushstring(&combined);
lua.settable(-3);
}
}

Loading…
Cancel
Save