summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/misc.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2017-10-25 00:17:09 +0000
committerDamien Miller <djm@cvs.openbsd.org>2017-10-25 00:17:09 +0000
commit9e208c0cbdee8f2773b06a0477e34e3d64cf65f8 (patch)
tree3f6b6655545b786b8d953f4a6861055daeb71484 /usr.bin/ssh/misc.c
parenta8cc86a7e0de53165cacc1023814833aed836e36 (diff)
add sshd_config RDomain keyword to place sshd and the subsequent
user session (including the shell and any TCP/IP forwardings) into the specified rdomain(4) ok markus@
Diffstat (limited to 'usr.bin/ssh/misc.c')
-rw-r--r--usr.bin/ssh/misc.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index af648b71b3c..aee2d030fef 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.117 2017/10/25 00:15:35 djm Exp $ */
+/* $OpenBSD: misc.c,v 1.118 2017/10/25 00:17:08 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -168,7 +168,23 @@ set_reuseaddr(int fd)
return 0;
}
-/* Set routing table */
+/* Get/set routing domain */
+char *
+get_rdomain(int fd)
+{
+ int rtable;
+ char *ret;
+ socklen_t len = sizeof(rtable);
+
+ if (getsockopt(fd, SOL_SOCKET, SO_RTABLE, &rtable, &len) == -1) {
+ error("Failed to get routing domain for fd %d: %s",
+ fd, strerror(errno));
+ return NULL;
+ }
+ xasprintf(&ret, "%d", rtable);
+ return ret;
+}
+
int
set_rdomain(int fd, const char *name)
{