summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2017-10-25 00:17:08 +0000
committerDamien Miller <djm@mindrot.org>2017-10-25 12:26:13 +1100
commit35eb33fb957979e3fcbe6ea0eaee8bf4a217421a (patch)
tree6ff628a3a477e2e2c7c4757a74b06ab29d3430a2 /misc.c
parentacf559e1cffbd1d6167cc1742729fc381069f06b (diff)
upstream commit
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@ Upstream-ID: be2358e86346b5cacf20d90f59f980b87d1af0f5
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/misc.c b/misc.c
index cc22fbef4..9b1ea4fa6 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.c,v 1.117 2017/10/25 00:15:35 djm Exp $ */ 1/* $OpenBSD: misc.c,v 1.118 2017/10/25 00:17:08 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved. 4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -180,7 +180,23 @@ set_reuseaddr(int fd)
180 return 0; 180 return 0;
181} 181}
182 182
183/* Set routing table */ 183/* Get/set routing domain */
184char *
185get_rdomain(int fd)
186{
187 int rtable;
188 char *ret;
189 socklen_t len = sizeof(rtable);
190
191 if (getsockopt(fd, SOL_SOCKET, SO_RTABLE, &rtable, &len) == -1) {
192 error("Failed to get routing domain for fd %d: %s",
193 fd, strerror(errno));
194 return NULL;
195 }
196 xasprintf(&ret, "%d", rtable);
197 return ret;
198}
199
184int 200int
185set_rdomain(int fd, const char *name) 201set_rdomain(int fd, const char *name)
186{ 202{