Utilize IP_BINDANY which provided the same semantics of OpenBSD's

SO_BINDANY.
This commit is contained in:
Xin LI 2010-04-15 23:21:24 +00:00
parent 55909abf07
commit 6856a5e345
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=206689

View File

@ -570,10 +570,8 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
if (sflag || pflag) {
struct addrinfo ahints, *ares;
#ifdef SO_BINDANY
/* try SO_BINDANY, but don't insist */
setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
#endif
/* try IP_BINDANY, but don't insist */
setsockopt(s, IPPROTO_IP, IP_BINDANY, &on, sizeof(on));
memset(&ahints, 0, sizeof(struct addrinfo));
ahints.ai_family = res0->ai_family;
ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;