Skip to content

transport: unify ipv4 and ipv6 code paths

Jonathan Nieder git 1 version In review

Get series with b4
b4 am 20120308124857.GA7666@burratino

Versions newest first

  1. v1 Latest5 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5transport: expose git_tcp_connect() and friends in new tcp.hMakefile connect.c tcp.c +1 more+289 -2761 reply
2/5daemon: make host resolution a separate functiondaemon.c+63 -490 replies
3/5daemon: move locate_host() to tcp libMakefile daemon.c tcp.c +1 more+63 -650 replies
4/5tcp: unify ipv4 and ipv6 code pathsMakefile dns-ipv4.c dns-ipv4.h +3 more+218 -1512 replies
5/5daemon: check for errors retrieving IP addressdns-ipv4.h dns-ipv6.c tcp.c+17 -160 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] transport: unify ipv4 and ipv6 code paths

Hi,

These patches eliminate some ifdef-ery concerning NO_IPV6. I used them when writing the SRV patch, which applies on top, but it's probably best to think of it as an independent topic.

Patch 4 is the heart of the series. It provides an interface similar to getaddrinfo that can be implemented on top of either gethostbyname or getaddrinfo and puts each implementation in a separate file. This way, callers can just use the common API and they do not need to have two copies of their code, one for each host resolution API.

Patches 1-3 move code around until all the code that patch 4 touches is in one place.

Patches 5 is a potential error handling improvement noticed while writing patches 1-4. It's probably not actually needed but it was a comfort to me.

These patches have been in use in Debian since June of last year. I'd like to see this in mainline early in the 1.7.11 cycle to make coding that touches this area during that cycle more pleasant. Thoughts of all kinds welcome.

Jonathan Nieder (5):
transport: expose git_tcp_connect and friends in new tcp.h
daemon: make host resolution into a separate function
daemon: move locate_host() to tcp.c
tcp: unify ipv4 and ipv6 code paths
daemon: check for errors retrieving IP address

 Makefile   |    7 ++
 connect.c  |  277 +-----------------------------------------------------------
 daemon.c   |   58 ++-----------
 dns-ipv4.c |   33 ++++++++
 dns-ipv4.h |   68 +++++++++++++++
 dns-ipv6.c |   49 +++++++++++
 dns-ipv6.h |   31 +++++++
 tcp.c      |  217 +++++++++++++++++++++++++++++++++++++++++++++++
 tcp.h      |   11 +++
 9 files changed, 422 insertions(+), 329 deletions(-)
 create mode 100644 dns-ipv4.c
 create mode 100644 dns-ipv4.h
 create mode 100644 dns-ipv6.c
 create mode 100644 dns-ipv6.h
 create mode 100644 tcp.c
 create mode 100644 tcp.h