src != NULL is equivalent to passive, and dst != NULL equivalent
to !passive.
}
flowopt_setopts(sockfd, fo);
- if (src) {
+ if (passive) {
if (bind(sockfd, src->ai_addr, src->ai_addrlen) < 0) {
close(sockfd);
goto get_next_src;
}
/* bind completed successfully */
break;
+ } else {
+ if (connect(sockfd, dst->ai_addr, dst->ai_addrlen) == 0)
+ break; /* connection completed successfully */
}
-
- if (dst && connect(sockfd, dst->ai_addr, dst->ai_addrlen) == 0)
- break; /* connection completed successfully */
close(sockfd);
get_next_dst:
if (dst && (dst = dst->ai_next))