robur-coop / happy-eyeballs

An implementation of happy eyeballs (RFC 8305) in OCaml with lwt
ISC License
22 stars 4 forks source link

Wrong printing of ip on error #33

Closed rand00 closed 1 year ago

rand00 commented 1 year ago

I was playing around with some different values for the --remote argument for unipi, and noticed that happy-eyeballs printed the IP I gave it backwards.

Specifically:

2023-03-06 18:22:42 -00:00: WRN [happy-eyeballs] connection failed to 1.1.0.10.in-addr.arpa: cancelled; no entry in conns

.. where I gave it the IP 10.0.1.1

reynir commented 1 year ago

That is how IP addresses are translated into domain names. For example, if you use dig -x to do a reverse lookup you will notice the query and answer has the ip "reversed":

$ dig -x 8.8.4.4

; <<>> DiG 9.16.37-Debian <<>> -x 8.8.4.4
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27682
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;4.4.8.8.in-addr.arpa.      IN  PTR

;; ANSWER SECTION:
4.4.8.8.in-addr.arpa.   1685    IN  PTR dns.google.

;; Query time: 3 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Tue Mar 07 09:31:03 CET 2023
;; MSG SIZE  rcvd: 73

It may be helpful to think how subnets and domain names are ordered in respective hierarchies:

That a domain name is printed is perhaps a quirk of the implementation.