summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2011-06-21 17:31:08 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2011-06-21 17:31:08 +0000
commite7884bf87149523a28dac8c81b890d680655cbd8 (patch)
tree6fad4366ab0f38e88691278a55b07242076ede3d /usr.bin
parentb50edea001b4bd82ae333fbd20b35c63b80e60cc (diff)
Convert SO_RTABLE's protocol level to the SOL_SOCKET; ok claudio
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/nc/netcat.c4
-rw-r--r--usr.bin/tcpbench/tcpbench.c30
-rw-r--r--usr.bin/telnet/commands.c4
3 files changed, 22 insertions, 16 deletions
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c
index 5c81e43e859..a5f5745f3ad 100644
--- a/usr.bin/nc/netcat.c
+++ b/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.100 2011/01/09 22:16:46 jeremy Exp $ */
+/* $OpenBSD: netcat.c,v 1.101 2011/06/21 17:31:07 mikeb Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
*
@@ -552,7 +552,7 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
continue;
if (rtableid) {
- if (setsockopt(s, IPPROTO_IP, SO_RTABLE, &rtableid,
+ if (setsockopt(s, SOL_SOCKET, SO_RTABLE, &rtableid,
sizeof(rtableid)) == -1)
err(1, "setsockopt SO_RTABLE");
}
diff --git a/usr.bin/tcpbench/tcpbench.c b/usr.bin/tcpbench/tcpbench.c
index aac03e22df3..cdd60771570 100644
--- a/usr.bin/tcpbench/tcpbench.c
+++ b/usr.bin/tcpbench/tcpbench.c
@@ -719,12 +719,15 @@ server_init(struct addrinfo *aitop, struct statctx *udp_sc)
warn("socket");
continue;
}
- if (ptb->Vflag && ai->ai_family == AF_INET) {
- if (setsockopt(sock, IPPROTO_IP, SO_RTABLE,
- &ptb->Vflag, sizeof(ptb->Vflag)) == -1)
- err(1, "setsockopt SO_RTABLE");
- } else if (ptb->Vflag)
- warnx("rtable only supported on AF_INET");
+ if (ptb->Vflag) {
+ if (setsockopt(sock, SOL_SOCKET, SO_RTABLE,
+ &ptb->Vflag, sizeof(ptb->Vflag)) == -1) {
+ if (errno == ENOPROTOOPT)
+ warn("set rtable");
+ else
+ err(1, "setsockopt SO_RTABLE");
+ }
+ }
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
&on, sizeof(on)) == -1)
warn("reuse port");
@@ -817,12 +820,15 @@ client_init(struct addrinfo *aitop, int nconn, struct statctx *udp_sc)
warn("socket");
continue;
}
- if (ptb->Vflag && ai->ai_family == AF_INET) {
- if (setsockopt(sock, IPPROTO_IP, SO_RTABLE,
- &ptb->Vflag, sizeof(ptb->Vflag)) == -1)
- err(1, "setsockopt SO_RTABLE");
- } else if (ptb->Vflag)
- warnx("rtable only supported on AF_INET");
+ if (ptb->Vflag) {
+ if (setsockopt(sock, SOL_SOCKET, SO_RTABLE,
+ &ptb->Vflag, sizeof(ptb->Vflag)) == -1) {
+ if (errno == ENOPROTOOPT)
+ warn("set rtable");
+ else
+ err(1, "setsockopt SO_RTABLE");
+ }
+ }
if (ptb->Sflag) {
if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF,
&ptb->Sflag, sizeof(ptb->Sflag)) == -1)
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index 4d3b7e5bab5..e76082b4835 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.52 2010/07/03 04:44:51 guenther Exp $ */
+/* $OpenBSD: commands.c,v 1.53 2011/06/21 17:31:07 mikeb Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
@@ -2397,7 +2397,7 @@ tn(argc, argv)
continue;
if (rtableid) {
- if (setsockopt(net, IPPROTO_IP, SO_RTABLE, &rtableid,
+ if (setsockopt(net, SOL_SOCKET, SO_RTABLE, &rtableid,
sizeof(rtableid)) == -1)
perror("setsockopt (SO_RTABLE)");
}