-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limited implementation (no options) of EDNS #7
base: master
Are you sure you want to change the base?
Conversation
I added a new function |
src/dns.zig
Outdated
const domain = try DomainName.from_string(allocator, "."); | ||
var flags: i32 = 0; // EDNS version 0 (RFC 6891) | ||
if (edns.do_dnssec) { | ||
flags = 0x8000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do these flag values represent? It would be nice to have the flags represented by a packed struct to avoid unnamed constants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do these flag values represent? It would be nice to have the flags represented by a packed struct to avoid unnamed constants.
0x8000 is just the DO (DNSSEC OK) bit set, everything else clear (which means EDNS version 0). But I agree (it's in my second commit) that a packed struct would be nicer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, next version will have:
pub const PackedEDNSTTL = packed struct(u32) {
extendedRcode: u8 = 0,
version: u8 = 0, // EDNS version 0 (RFC 6891)
z1: u7 = 0, // Zig put fields in the unexpected order inside a byte.
do: bool = true,
z2: u8 = 0,
};
...
pub fn createEDNSQuery(allocator: mem.Allocator, address: []const u8, qtype: QType, edns: EDNS) !Message {
...
var flags = PackedEDNSTTL{};
flags.do = edns.do_dnssec;
No more 0x800. But I'm still struggling to produce a proper patch now that [read,write}IntBig disappeared and that non-mutated vars are forbidden. There are a lot of things to change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must update the code to work with the latest Zig master release. Asking any PR to manage that migration on top of a new feature is a lot.
I have yet to have the time to work on this recently, but handling that migration is next on my list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect most of my Zig projects need to be updated. Dealing with breaking changes every couple of months becomes overwhelming when you have a couple of larger projects you're working on in your spare time.
OK, now without unnamed constants. |
Create and parse messages with EDNS. It only implements basic EDNS (no options).
Example: