Fixes bug on TCP passive socket binding on BSD.

BGP on BSD was bound to random port. I am surprised that
nobody noticed it already.
This commit is contained in:
Ondrej Zajicek 2009-06-26 13:33:41 +02:00
parent 5004d02cb9
commit 2d785e8d6a

View file

@ -934,7 +934,8 @@ sk_open(sock *s)
}
fill_in_sockaddr(&sa, s->saddr, port);
#ifdef CONFIG_SKIP_MC_BIND
if (type == SK_IP && bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0)
if ((type != SK_UDP_MC) && (type != SK_IP_MC) &&
bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0)
#else
if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0)
#endif