You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DNS packet header bit QR is set to 0 for queries and 1 for a response. domain::base::header::Header casts this to a bool where 0 becomes false and 1 becomes true.
This is incredibly confusing to me since qr is clearly meant to mean query, so when you use the qr() method you basically have to to the opposite of what the header field indicates.
While I agree this is technically correct (as it just describes wether the flag is set) this took me about 1hr and largely re-implementing a dns parser from scratch to figure out. Soooo maybe we should do something about that 😄
The text was updated successfully, but these errors were encountered:
I agree that the definition of the QR bit is unfortunate. However, having a method that returns false when the bit is set only makes things worse. What I think we could do is adding a separate method is_query that does the flipping. The more elaborate name would likely cause people to pick that one over plain qr, so I think that is a good solution?
Hm, yes. But then this flag behaves differently from the other flags, which I kind of dislike. Also, msg.is_query() is shorter and perhaps more straightforward than matches!(msg.qr(), Qr::Query).
The DNS packet header bit
QR
is set to0
for queries and1
for a response.domain::base::header::Header
casts this to abool
where0
becomesfalse
and1
becomestrue
.This is incredibly confusing to me since
qr
is clearly meant to meanquery
, so when you use theqr()
method you basically have to to the opposite of what the header field indicates.While I agree this is technically correct (as it just describes wether the flag is set) this took me about 1hr and largely re-implementing a dns parser from scratch to figure out. Soooo maybe we should do something about that 😄
The text was updated successfully, but these errors were encountered: