]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[MINOR] make use of addr_to_str() and get_host_port() to replace many inet_ntop()
authorWilly Tarreau <w@1wt.eu>
Sun, 4 Sep 2011 22:36:48 +0000 (00:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 4 Sep 2011 22:54:36 +0000 (00:54 +0200)
commit631f01c2f1c44eecd19e2b306a20b67fed3c301b
tree701dc4283cd68a6305d521404e74bbcd6f7dda1f
parent3c92c5f682c5b017d01ffe46baa99582a64217fa
[MINOR] make use of addr_to_str() and get_host_port() to replace many inet_ntop()

Many inet_ntop calls were partially right, which was hard to detect given
the complex combinations. Some of them were relying on the listener's proto
instead of the address itself, which could have been different when dealing
with an accept-proxy connection.

The new addr_to_str() function does the dirty job and returns the family, which
makes it particularly suited to calls from switch/case statements. A large number
of if/else statements were removed and the stats output could even be cleaned up
in the case of session dump.

As a side effect of doing this, the resulting code is smaller by almost 1kB.
All changed parts have been tested and provided expected output.
include/common/standard.h
src/dumpstats.c
src/frontend.c
src/log.c
src/proto_http.c
src/proto_tcp.c
src/standard.c