summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorphessler <>2013-10-21 08:59:49 +0000
committerphessler <>2013-10-21 08:59:49 +0000
commit83fef489c03ffb155bd99adfdcf014cdcfcbd5ac (patch)
tree32155a4be5858bd827a4ac047bf121743e0967d3 /src
parentf11bd858b61eb841060f8a8541da72b668602c81 (diff)
downloadopenbsd-83fef489c03ffb155bd99adfdcf014cdcfcbd5ac.tar.gz
openbsd-83fef489c03ffb155bd99adfdcf014cdcfcbd5ac.tar.bz2
openbsd-83fef489c03ffb155bd99adfdcf014cdcfcbd5ac.zip
Set the requested rdomain on the socket instead of only on the IPv4 part.
Also, switching to rdomain zero is a legit option so we should allow that.
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/nc/netcat.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c
index c4f8ca96a8..6123b7e4e3 100644
--- a/src/usr.bin/nc/netcat.c
+++ b/src/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: netcat.c,v 1.114 2013/08/20 21:04:40 jmc Exp $ */ 1/* $OpenBSD: netcat.c,v 1.115 2013/10/21 08:59:49 phessler Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> 3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
4 * 4 *
@@ -588,11 +588,9 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
588 res0->ai_protocol)) < 0) 588 res0->ai_protocol)) < 0)
589 continue; 589 continue;
590 590
591 if (rtableid) { 591 if (setsockopt(s, SOL_SOCKET, SO_RTABLE, &rtableid,
592 if (setsockopt(s, SOL_SOCKET, SO_RTABLE, &rtableid, 592 sizeof(rtableid)) == -1)
593 sizeof(rtableid)) == -1) 593 err(1, "setsockopt SO_RTABLE");
594 err(1, "setsockopt SO_RTABLE");
595 }
596 594
597 /* Bind to a local port or source address if specified. */ 595 /* Bind to a local port or source address if specified. */
598 if (sflag || pflag) { 596 if (sflag || pflag) {
@@ -699,11 +697,9 @@ local_listen(char *host, char *port, struct addrinfo hints)
699 res0->ai_protocol)) < 0) 697 res0->ai_protocol)) < 0)
700 continue; 698 continue;
701 699
702 if (rtableid) { 700 if (setsockopt(s, SOL_SOCKET, SO_RTABLE, &rtableid,
703 if (setsockopt(s, IPPROTO_IP, SO_RTABLE, &rtableid, 701 sizeof(rtableid)) == -1)
704 sizeof(rtableid)) == -1) 702 err(1, "setsockopt SO_RTABLE");
705 err(1, "setsockopt SO_RTABLE");
706 }
707 703
708 ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); 704 ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
709 if (ret == -1) 705 if (ret == -1)