BUG: proto_tcp: don't try to bind to a foreign address if sin_family is unknown
This is 1.5-specific. It causes issues with transparent source binding involving
hdr_ip. We must not try to bind() to a foreign address when the family is not set,
and we must set the family when an address is set.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index ecef63f..caeb539 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -146,6 +146,9 @@
if (flags & 2)
((struct sockaddr_in6 *)&bind_addr)->sin6_port = ((struct sockaddr_in6 *)remote)->sin6_port;
break;
+ default:
+ /* we don't want to try to bind to an unknown address family */
+ foreign_ok = 0;
}
}