MINOR: protocols: use is_inet_addr() when only INET addresses are desired
We used to have is_addr() in place to validate sometimes the existence
of an address, sometimes a valid IPv4 or IPv6 address. Replace them
carefully so that is_inet_addr() is used wherever we can only use an
IPv4/IPv6 address.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index f77203a..a672de4 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -201,14 +201,14 @@
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
if (foreign_ok) {
- if (is_addr(&bind_addr)) {
+ if (is_inet_addr(&bind_addr)) {
ret = bind(fd, (struct sockaddr *)&bind_addr, get_addr_len(&bind_addr));
if (ret < 0)
return 2;
}
}
else {
- if (is_addr(local)) {
+ if (is_inet_addr(local)) {
ret = bind(fd, (struct sockaddr *)local, get_addr_len(local));
if (ret < 0)
return 1;
@@ -367,7 +367,7 @@
if (src) {
int ret, flags = 0;
- if (is_addr(&conn->addr.from)) {
+ if (is_inet_addr(&conn->addr.from)) {
switch (src->opts & CO_SRC_TPROXY_MASK) {
case CO_SRC_TPROXY_ADDR:
case CO_SRC_TPROXY_CLI: