Skip to content

Commit

Permalink
fix flag rd condition
Browse files Browse the repository at this point in the history
  • Loading branch information
dmachard committed Dec 3, 2024
1 parent dc62a7e commit fba459e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dnsutils/dnsmessage_text.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ func (dm *DNSMessage) ToTextLine(format []string, fieldDelimiter string, fieldBo
s.WriteByte('-')
}
case directive == "rd":
if flags.AD {
if flags.RD {
s.WriteString("RD")
} else {
s.WriteByte('-')
Expand Down
11 changes: 8 additions & 3 deletions dnsutils/dnsmessage_text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,14 @@ func TestDnsMessage_TextFormat_DefaultDirectives(t *testing.T) {
expected: "PKTERR",
},
{
format: "tc aa ra ad rd",
dm: DNSMessage{DNS: DNS{Flags: DNSFlags{TC: true, AA: true, RA: true, AD: true, RD: true}}},
expected: "TC AA RA AD RD",
format: "tc aa ra ad",
dm: DNSMessage{DNS: DNS{Flags: DNSFlags{TC: true, AA: true, RA: true, AD: true}}},
expected: "TC AA RA AD",
},
{
format: "rd",
dm: DNSMessage{DNS: DNS{Flags: DNSFlags{RD: true}}},
expected: "RD",
},
{
format: "tc aa ra ad rd",
Expand Down

0 comments on commit fba459e

Please sign in to comment.