Skip to content

Commit

Permalink
added comment justifying assignment of None change
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitochondrion2 authored Jan 23, 2023
1 parent df7b214 commit aadc7fa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions layers/dns_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ def dns_decompress(packet, logger):
# Next, we must rebuild the DNS packet itself. If we try to have scapy parse either dns_qr1 or dns_qr2, they
# will look malformed, since neither contains a complete request. Therefore, we must build the entire
# DNS packet at once. First, we must remove the original DNSQR, since this contains the original request
# Need to set qd field to None instead of deleting it to be compatible with scapy 2.5
# deleting the qd field in scapy 2.5 causes the qd field to be populated with a question record for example.com
packet["DNS"].qd = None

# Once the DNSQR is removed, scapy automatically sets the qdcount to 0. Adjust it to 2
Expand Down

0 comments on commit aadc7fa

Please sign in to comment.