git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC/PATCH 0/6] git: please honor DNS SRV records

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jun 6, 2011, 09:30 UTC
Message-ID
<20110606093019.GD8015@elie>
In-Reply-To
<20110524230900.GA9440@radis.liafa.jussieu.fr>
Hi,
Julien Cristau wrote:
> On Tue, May 24, 2011 at 15:22:55 -0500, Jonathan Nieder wrote:
Show 6 quoted lines
>> 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).
[...]
> 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?

Next: Jonathan Nieder
Message 1 of 9 in “git: please honor DNS SRV records”
  1. 0/6 git: please honor DNS SRV recordsJonathan Nieder, Jun 6, 2011
  2. 1/6 transport: expose git_tcp_connect and friends in new tcp.hJonathan Nieder, Jun 6, 2011
  3. 2/6 daemon: make host resolution into a separate functionJonathan Nieder, Jun 6, 2011
  4. 3/6 daemon: move locate_host to tcp.cJonathan Nieder, Jun 6, 2011
  5. 4/6 transport: fix index in ipv6 connection failed messageJonathan Nieder, Jun 6, 2011
  6. 5/6 tcp: unify ipv4 and ipv6 code pathsJonathan Nieder, Jun 6, 2011
  7. Jonathan NiederJun 6, 2011
  8. 6/6 transport: learn to honor DNS SRV recordsJonathan Nieder, Jun 6, 2011
  9. Jonathan NiederJun 6, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.