=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/nc/netcat.c,v retrieving revision 1.90 retrieving revision 1.91 diff -c -r1.90 -r1.91 *** src/usr.bin/nc/netcat.c 2008/05/06 05:47:39 1.90 --- src/usr.bin/nc/netcat.c 2008/05/09 09:00:11 1.91 *************** *** 1,4 **** ! /* $OpenBSD: netcat.c,v 1.90 2008/05/06 05:47:39 djm Exp $ */ /* * Copyright (c) 2001 Eric Jackson * --- 1,4 ---- ! /* $OpenBSD: netcat.c,v 1.91 2008/05/09 09:00:11 markus Exp $ */ /* * Copyright (c) 2001 Eric Jackson * *************** *** 487,493 **** remote_connect(const char *host, const char *port, struct addrinfo hints) { struct addrinfo *res, *res0; ! int s, error; if ((error = getaddrinfo(host, port, &hints, &res))) errx(1, "getaddrinfo: %s", gai_strerror(error)); --- 487,493 ---- remote_connect(const char *host, const char *port, struct addrinfo hints) { struct addrinfo *res, *res0; ! int s, error, on = 1; if ((error = getaddrinfo(host, port, &hints, &res))) errx(1, "getaddrinfo: %s", gai_strerror(error)); *************** *** 502,507 **** --- 502,509 ---- if (sflag || pflag) { struct addrinfo ahints, *ares; + /* try SO_BINDANY, but don't insist */ + setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on)); memset(&ahints, 0, sizeof(struct addrinfo)); ahints.ai_family = res0->ai_family; ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;