summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
authordtucker <dtucker>2010-01-08 06:03:46 +0000
committerdtucker <dtucker>2010-01-08 06:03:46 +0000
commitd371ba82c78fb744fa2fcd49ad25bb28679083ad (patch)
tree016e05e5ec45ee2b6e711223eb7ad3cc06c57771 /channels.c
parenta6cf0ddbce8d7dbc128e5481689b263ab30f1d2c (diff)
downloadopenssh-d371ba82c78fb744fa2fcd49ad25bb28679083ad.tar.gz
- reyk@cvs.openbsd.org 2009/10/28 16:38:18
[ssh_config.5 sshd.c misc.h ssh-keyscan.1 readconf.h sshconnect.c channels.c channels.h servconf.h servconf.c ssh.1 ssh-keyscan.c scp.1 sftp.1 sshd_config.5 readconf.c ssh.c misc.c] Allow to set the rdomain in ssh/sftp/scp/sshd and ssh-keyscan. ok markus@
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/channels.c b/channels.c
index 22e7f628..884c14c9 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.296 2009/05/25 06:48:00 andreas Exp $ */
+/* $OpenBSD: channels.c,v 1.297 2009/10/28 16:38:18 reyk Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -162,6 +162,9 @@ static u_int x11_fake_data_len;
/* AF_UNSPEC or AF_INET or AF_INET6 */
static int IPv4or6 = AF_UNSPEC;
+/* Set the routing domain a.k.a. VRF */
+static int channel_rdomain = -1;
+
/* helper */
static void port_open_helper(Channel *c, char *rtype);
@@ -2461,6 +2464,12 @@ channel_set_af(int af)
IPv4or6 = af;
}
+void
+channel_set_rdomain(int rdomain)
+{
+ channel_rdomain = rdomain;
+}
+
static int
channel_setup_fwd_listener(int type, const char *listen_addr,
u_short listen_port, int *allocated_listen_port,
@@ -2569,7 +2578,8 @@ channel_setup_fwd_listener(int type, const char *listen_addr,
continue;
}
/* Create a port to listen for the host. */
- sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ sock = socket_rdomain(ai->ai_family, ai->ai_socktype,
+ ai->ai_protocol, channel_rdomain);
if (sock < 0) {
/* this is no error since kernel may not support ipv6 */
verbose("socket: %.100s", strerror(errno));
@@ -2910,8 +2920,9 @@ connect_next(struct channel_connect *cctx)
error("connect_next: getnameinfo failed");
continue;
}
- if ((sock = socket(cctx->ai->ai_family, cctx->ai->ai_socktype,
- cctx->ai->ai_protocol)) == -1) {
+ if ((sock = socket_rdomain(cctx->ai->ai_family,
+ cctx->ai->ai_socktype, cctx->ai->ai_protocol,
+ channel_rdomain)) == -1) {
if (cctx->ai->ai_next == NULL)
error("socket: %.100s", strerror(errno));
else
@@ -3097,8 +3108,8 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
for (ai = aitop; ai; ai = ai->ai_next) {
if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
continue;
- sock = socket(ai->ai_family, ai->ai_socktype,
- ai->ai_protocol);
+ sock = socket_rdomain(ai->ai_family, ai->ai_socktype,
+ ai->ai_protocol, channel_rdomain);
if (sock < 0) {
if ((errno != EINVAL) && (errno != EAFNOSUPPORT)) {
error("socket: %.100s", strerror(errno));
@@ -3273,7 +3284,8 @@ x11_connect_display(void)
}
for (ai = aitop; ai; ai = ai->ai_next) {
/* Create a socket. */
- sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ sock = socket_rdomain(ai->ai_family, ai->ai_socktype,
+ ai->ai_protocol, channel_rdomain);
if (sock < 0) {
debug2("socket: %.100s", strerror(errno));
continue;