summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-11-13 17:04:48 +0000
committerderaadt <deraadt@openbsd.org>2015-11-13 17:04:48 +0000
commit9c8dc3cb882e10590efdd1a8ac28f6f0cbaacb1d (patch)
treeb7e17ca3f2f35f49f42bcddc51664b584c48ba7a
parentRemove support for the debug command; noone needs setsockopt SO_DEBUG (diff)
downloadwireguard-openbsd-9c8dc3cb882e10590efdd1a8ac28f6f0cbaacb1d.tar.xz
wireguard-openbsd-9c8dc3cb882e10590efdd1a8ac28f6f0cbaacb1d.zip
Use setrtable() for the entire process, rather than doing it for the
socket later. Same idea as in nc(1).
-rw-r--r--usr.bin/telnet/commands.c6
-rw-r--r--usr.bin/telnet/main.c8
2 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index f45d8533a34..8e39951df01 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.78 2015/11/13 17:01:12 deraadt Exp $ */
+/* $OpenBSD: commands.c,v 1.79 2015/11/13 17:04:48 deraadt Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
@@ -1843,10 +1843,6 @@ tn(int argc, char *argv[])
if (net < 0)
continue;
- if (rtableid >= 0 && (setsockopt(net, SOL_SOCKET, SO_RTABLE, &rtableid,
- sizeof(rtableid)) == -1))
- perror("setsockopt (SO_RTABLE)");
-
if (aliasp) {
struct addrinfo ahints, *ares;
diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c
index 8fbcd89ab53..eac5c34331f 100644
--- a/usr.bin/telnet/main.c
+++ b/usr.bin/telnet/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.31 2015/11/13 17:01:12 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.32 2015/11/13 17:04:48 deraadt Exp $ */
/* $NetBSD: main.c,v 1.5 1996/02/28 21:04:05 thorpej Exp $ */
/*
@@ -163,6 +163,12 @@ main(int argc, char *argv[])
}
}
+ if (rtableid >= 0)
+ if (setrtable(rtableid) == -1) {
+ perror("setrtable");
+ exit(1);
+ }
+
if (autologin == -1)
autologin = (rlogin == _POSIX_VDISABLE) ? 0 : 1;