Permalink
Browse files

Don't use bind() with AF_UNSPEC

tcp_bind_connect() may be called with a non NULL bind_addr variable
but filled with 0. This cause bind() to be called with AF_UNSPEC and
make it fail with recent kernels.
  • Loading branch information...
vincentbernat authored and acassen committed Dec 5, 2011
1 parent 625abb2 commit c70570412521db6384b61689882453a7846e4ca9
Showing with 1 addition and 1 deletion.
  1. +1 −1 keepalived/core/layer4.c
View
@@ -43,7 +43,7 @@ tcp_bind_connect(int fd, struct sockaddr_storage *addr, struct sockaddr_storage
fcntl(fd, F_SETFL, val | O_NONBLOCK);
/* Bind socket */
if (bind_addr) {
if (bind_addr && ((struct sockaddr *) bind_addr)->sa_family != AF_UNSPEC) {
addrlen = sizeof(*bind_addr);
if (bind(fd, (struct sockaddr *) bind_addr, addrlen) != 0)
return connect_error;

0 comments on commit c705704

Please sign in to comment.