summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-02-23 02:34:33 +0000
committerDamien Miller <djm@mindrot.org>2018-02-23 13:37:49 +1100
commitac2e3026bbee1367e4cda34765d1106099be3287 (patch)
tree83d0a8e3b1edcc01b087feb6ea98d67ec8607179 /ssh.c
parentfcdb9d777839a3fa034b3bc3067ba8c1f6886679 (diff)
upstream: Add BindInterface ssh_config directive and -B
command-line argument to ssh(1) that directs it to bind its outgoing connection to the address of the specified network interface. BindInterface prefers to use addresses that aren't loopback or link- local, but will fall back to those if no other addresses of the required family are available on that interface. Based on patch by Mike Manning in bz#2820, ok dtucker@ OpenBSD-Commit-ID: c5064d285c2851f773dd736a2c342aa384fbf713
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/ssh.c b/ssh.c
index 2d8f6506b..fa57290be 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.473 2018/02/13 03:36:56 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.474 2018/02/23 02:34:33 djm 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
@@ -201,13 +201,13 @@ static void
201usage(void) 201usage(void)
202{ 202{
203 fprintf(stderr, 203 fprintf(stderr,
204"usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]\n" 204"usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]\n"
205" [-D [bind_address:]port] [-E log_file] [-e escape_char]\n" 205" [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]\n"
206" [-F configfile] [-I pkcs11] [-i identity_file]\n" 206" [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]\n"
207" [-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec]\n" 207" [-i identity_file] [-J [user@]host[:port]] [-L address]\n"
208" [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address]\n" 208" [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n"
209" [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]\n" 209" [-Q query_option] [-R address] [-S ctl_path] [-W host:port]\n"
210" destination [command]\n" 210" [-w local_tun[:remote_tun]] destination [command]\n"
211 ); 211 );
212 exit(255); 212 exit(255);
213} 213}
@@ -663,7 +663,7 @@ main(int ac, char **av)
663 663
664 again: 664 again:
665 while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx" 665 while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx"
666 "ACD:E:F:GI:J:KL:MNO:PQ:R:S:TVw:W:XYy")) != -1) { 666 "AB:CD:E:F:GI:J:KL:MNO:PQ:R:S:TVw:W:XYy")) != -1) {
667 switch (opt) { 667 switch (opt) {
668 case '1': 668 case '1':
669 fatal("SSH protocol v.1 is no longer supported"); 669 fatal("SSH protocol v.1 is no longer supported");
@@ -973,6 +973,9 @@ main(int ac, char **av)
973 case 'b': 973 case 'b':
974 options.bind_address = optarg; 974 options.bind_address = optarg;
975 break; 975 break;
976 case 'B':
977 options.bind_interface = optarg;
978 break;
976 case 'F': 979 case 'F':
977 config = optarg; 980 config = optarg;
978 break; 981 break;