Skip to content
This repository has been archived by the owner on Jun 30, 2019. It is now read-only.

adapt to domain-name phantom type API #31

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

adapt to domain-name phantom type API #31

wants to merge 11 commits into from

Conversation

hannesm
Copy link
Contributor

@hannesm hannesm commented Jun 18, 2019

esp last commit is of interest, will clean up other commits. I'm sure there's more [ `host ] Domain_name.t to be introduced (i.e. all zone boundaries should be on hostnames, ...) -- but it's also a bit unclear where to require hostnames, and where domain names are sufficient (i.e. zone parser -- should origin be a hostname? can we verify that each zone we add to dns_trie is a hostname?).

in respect to regression2/3 -- I'm not sure whether SOA nameserver (/MX) should really be hostname -- from what our server should accept, this is very reasonable, for what odig should accept & print, I think this is a bit too limited.

Copy link
Contributor

@cfcs cfcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scanned over, most of the DNS logic I lack background knowledge / context to review properly.

What does the ?mac argument in the tsig_verify code represent / do? It feels a bit scary reading this with so many optional arguments.

EDIT: Re: SOA + odig: Agreed, perhaps the validation function could return the rejected value in a polymorphic error variant so that odig can pick it up?

Log.err (fun m -> m "error %a while establishing tcp connection to %a:%d"
T.pp_error e Ipaddr.V4.pp ip dport) ;
Lwt.async (fun () ->
TIME.sleep_ns (Duration.of_sec 5) >>= fun () ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we waiting 5 seconds here before closing?

(* outstanding notifications, with timestamp and retry count
(at most one per zone per ip) *)
type outstanding =
(int64 * int * Packet.t * Domain_name.t option) Domain_name.Map.t IPM.t
(int64 * int * Cstruct.t option * Packet.t * Domain_name.t option) Domain_name.Map.t IPM.t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume int64 is timestamp, int is retry count, maybe document what the Cstruct.option is?

let packet =
let question = Packet.Question.create zone Soa
and header =
(* TODO: all are getting the same ID *)
let id = Randomconv.int ~bound:(1 lsl 16 - 1) server.rng in
Copy link
Contributor

@cfcs cfcs Jun 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about Randomconv.int16 server.rng, or does this need to be 0 .. 65534 specifically?

Same here:
https://github.com/roburio/udns/blob/445035a96f3aab000aa97d84a548e966fe81756e/server/udns_server.ml#L909

65534 (1 lsl 16 = 0x10000, 1 lsl 16 - 1 = 0xffff, bound being exclusive in Randomconv.int ~bound meaning you get 0 ... 0xfffe inclusively) seems like a weird number to me; usually you'd want 0x0 ... 0xffff?

@hannesm
Copy link
Contributor Author

hannesm commented Jun 27, 2019

What does the ?mac argument in the tsig_verify code represent / do? It feels a bit scary reading this with so many optional arguments.

well, the request does not contain a mac, but the reply the mac of the request, as defined in https://tools.ietf.org/html/rfc2845

Why are we waiting 5 seconds here before closing?

that's my home-grown reconnection logic ;) wait 5 seconds till next attempt ;p (yes, the connection logic in mirage requires some work)

I assume int64 is timestamp, int is retry count, maybe document what the Cstruct.option is?

yes, good idea. its the mac of the request (in this case a notify)

How about Randomconv.int16 server.rng, or does this need to be 0 .. 65534 specifically?

I guess #9 should include this..

I opened #32 which superseeds this (but does not address your points, will attempt to work on a separate PR with your concerns above) and #29

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants