summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2010-01-08 17:03:46 +1100
committerDarren Tucker <dtucker@zip.com.au>2010-01-08 17:03:46 +1100
commit34e314da1b832fee576e4ebd8b177154a45fec15 (patch)
tree0530be5f339034486b323ed96674f6291ab79d42 /channels.c
parentf1de4e5228ad86b191c3297bf6c528753587be5e (diff)
- 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 22e7f628b..884c14c99 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.296 2009/05/25 06:48:00 andreas Exp $ */ 1/* $OpenBSD: channels.c,v 1.297 2009/10/28 16:38:18 reyk Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -162,6 +162,9 @@ static u_int x11_fake_data_len;
162/* AF_UNSPEC or AF_INET or AF_INET6 */ 162/* AF_UNSPEC or AF_INET or AF_INET6 */
163static int IPv4or6 = AF_UNSPEC; 163static int IPv4or6 = AF_UNSPEC;
164 164
165/* Set the routing domain a.k.a. VRF */
166static int channel_rdomain = -1;
167
165/* helper */ 168/* helper */
166static void port_open_helper(Channel *c, char *rtype); 169static void port_open_helper(Channel *c, char *rtype);
167 170
@@ -2461,6 +2464,12 @@ channel_set_af(int af)
2461 IPv4or6 = af; 2464 IPv4or6 = af;
2462} 2465}
2463 2466
2467void
2468channel_set_rdomain(int rdomain)
2469{
2470 channel_rdomain = rdomain;
2471}
2472
2464static int 2473static int
2465channel_setup_fwd_listener(int type, const char *listen_addr, 2474channel_setup_fwd_listener(int type, const char *listen_addr,
2466 u_short listen_port, int *allocated_listen_port, 2475 u_short listen_port, int *allocated_listen_port,
@@ -2569,7 +2578,8 @@ channel_setup_fwd_listener(int type, const char *listen_addr,
2569 continue; 2578 continue;
2570 } 2579 }
2571 /* Create a port to listen for the host. */ 2580 /* Create a port to listen for the host. */
2572 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); 2581 sock = socket_rdomain(ai->ai_family, ai->ai_socktype,
2582 ai->ai_protocol, channel_rdomain);
2573 if (sock < 0) { 2583 if (sock < 0) {
2574 /* this is no error since kernel may not support ipv6 */ 2584 /* this is no error since kernel may not support ipv6 */
2575 verbose("socket: %.100s", strerror(errno)); 2585 verbose("socket: %.100s", strerror(errno));
@@ -2910,8 +2920,9 @@ connect_next(struct channel_connect *cctx)
2910 error("connect_next: getnameinfo failed"); 2920 error("connect_next: getnameinfo failed");
2911 continue; 2921 continue;
2912 } 2922 }
2913 if ((sock = socket(cctx->ai->ai_family, cctx->ai->ai_socktype, 2923 if ((sock = socket_rdomain(cctx->ai->ai_family,
2914 cctx->ai->ai_protocol)) == -1) { 2924 cctx->ai->ai_socktype, cctx->ai->ai_protocol,
2925 channel_rdomain)) == -1) {
2915 if (cctx->ai->ai_next == NULL) 2926 if (cctx->ai->ai_next == NULL)
2916 error("socket: %.100s", strerror(errno)); 2927 error("socket: %.100s", strerror(errno));
2917 else 2928 else
@@ -3097,8 +3108,8 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
3097 for (ai = aitop; ai; ai = ai->ai_next) { 3108 for (ai = aitop; ai; ai = ai->ai_next) {
3098 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) 3109 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
3099 continue; 3110 continue;
3100 sock = socket(ai->ai_family, ai->ai_socktype, 3111 sock = socket_rdomain(ai->ai_family, ai->ai_socktype,
3101 ai->ai_protocol); 3112 ai->ai_protocol, channel_rdomain);
3102 if (sock < 0) { 3113 if (sock < 0) {
3103 if ((errno != EINVAL) && (errno != EAFNOSUPPORT)) { 3114 if ((errno != EINVAL) && (errno != EAFNOSUPPORT)) {
3104 error("socket: %.100s", strerror(errno)); 3115 error("socket: %.100s", strerror(errno));
@@ -3273,7 +3284,8 @@ x11_connect_display(void)
3273 } 3284 }
3274 for (ai = aitop; ai; ai = ai->ai_next) { 3285 for (ai = aitop; ai; ai = ai->ai_next) {
3275 /* Create a socket. */ 3286 /* Create a socket. */
3276 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); 3287 sock = socket_rdomain(ai->ai_family, ai->ai_socktype,
3288 ai->ai_protocol, channel_rdomain);
3277 if (sock < 0) { 3289 if (sock < 0) {
3278 debug2("socket: %.100s", strerror(errno)); 3290 debug2("socket: %.100s", strerror(errno));
3279 continue; 3291 continue;