Skip to content

Commit

Permalink
DNS: use the right type in MX RRs
Browse files Browse the repository at this point in the history
  • Loading branch information
evverx authored and gpotter2 committed Dec 9, 2023
1 parent d33c7b4 commit a562a06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scapy/layers/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def default_payload_class(self, payload):
class DNSRRMX(_DNSRRdummy):
name = "DNS MX Resource Record"
fields_desc = [DNSStrField("rrname", ""),
ShortEnumField("type", 6, dnstypes),
ShortEnumField("type", 15, dnstypes),
ShortEnumField("rclass", 1, dnsclasses),
IntField("ttl", 0),
ShortField("rdlen", None),
Expand Down
5 changes: 5 additions & 0 deletions test/scapy/layers/dns.uts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ full = b"\x04data\xc0\x0f"
assert dns_get_str(full, full=full)[0] == b"data."


= DNS record type 15 (MX)

p = DNS(raw(DNS(qd=[],an=DNSRRMX(exchange='example.com'))))
assert p.an[0].exchange == b'example.com.'

= DNS record type 16 (TXT)

p = DNS(raw(DNS(id=1,ra=1,qd=[],an=DNSRR(rrname='scapy', type='TXT', rdata="niceday", ttl=1))))
Expand Down

0 comments on commit a562a06

Please sign in to comment.