git: please honor DNS SRV records
Get series with b4
b4 am 20110606093019.GD8015@elieVersions newest first
- v1 Latest6 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | transport: expose git_tcp_connect and friends in new tcp.hMakefile connect.c tcp.c +1 more | +280 | 0 replies | |
| 2/6 | daemon: make host resolution into a separate functiondaemon.c | +63 | 0 replies | |
| 3/6 | daemon: move locate_host to tcp.cMakefile daemon.c tcp.c +1 more | +59 | 0 replies | |
| 4/6 | transport: fix index in ipv6 connection failed messagetcp.c | +2 | 0 replies | |
| 5/6 | tcp: unify ipv4 and ipv6 code pathsMakefile dns-ipv4.c dns-ipv4.h +3 more | +211 | 1 reply | |
| 6/6 | transport: learn to honor DNS SRV recordsMakefile srv.c srv.h +1 more | +375 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC/PATCH 0/6] git: please honor DNS SRV records
Hi,
Quoted 8 lines · Julien Cristau
Quoted 6 lines · Jonathan Nieder
As rfc2782 explains, SRV records allow administrators "to use serveral servers for a single domain, to move services from host to host with little fuss, and to designate some hosts as primary servers for a service and others as backups". Julien Cristau noticed that in the recent alioth move that second part would have been very handy (since the git protocol doesn't include a concept of redirects).
[...]
Quoted 3 lines
I played with this a bit tonight, came up with
http://people.debian.org/~jcristau/git-srv-hack.diff which seems to work for me. In case somebody wants to test/polish it up...
So I have played with it a little more. Very rough, completely untested, in desperate need of a test script, but I think it is ready for some feedback. To recap, this is really just an evil workaround for the lack of support for redirects in git protocol, but it has a nice side effect of making load balancing a little easier for server administrators.
Patches 1-3 are code movement, to give the code that is being changed a home and make it a little easier to contemplate. In particular patch 3 draws attention to some code from git daemon that makes DNS lookups to get the canonical hostname and IP a client contacted. Should it pay attention to SRV records?
Patch 5 is another cleanup patch. It unifies the ipv4 and ipv6 implementations of git_tcp_connect by abstracting away some of the differences between the underlying OS interfaces. Patch 4 is a tiny bugfix noticed in the process.
None of the above should be necessary for or even has much to do with patch 6, the nominal topic of the series. Sorry about that.
Anyway, patch 6 is an attempt to implement rfc2782, expanded from the implementation of a subset that Julien sent. It doesn't pay attention to the "additional data" section of the SRV response to avoid A or AAAA lookups, but it probably should.
At the back of my head there is this nagging feeling that getaddrinfo should accept an ai_flags bit to do this for us automatically, but it doesn't as far as I can tell. Maybe this can be a stepping stone toward that...
If nothing else, it's kind of fun. Thoughts? Does the general idea seem sane? Am I overlooking some standard function that takes care of this all automatically?