From: Matthew Dillon Date: Mon, 7 Dec 2009 04:28:36 +0000 (-0800) Subject: HAMMER Utility - Add -p option X-Git-Tag: v2.7.1~341 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/6c45ca3ea2a4c4e8fe9e2c884421d17bf34781b7 HAMMER Utility - Add -p option * Allows the ssh port for remote specification to be specified. This option is passed as '-p ' to ssh invocations. --- diff --git a/sbin/hammer/cmd_mirror.c b/sbin/hammer/cmd_mirror.c index a17fced114..d06ef41901 100644 --- a/sbin/hammer/cmd_mirror.c +++ b/sbin/hammer/cmd_mirror.c @@ -847,6 +847,10 @@ again: *ptr++ = 0; xac = 0; xav[xac++] = "ssh"; + if (SshPort) { + xav[xac++] = "-p"; + xav[xac++] = SshPort; + } xav[xac++] = av[0]; xav[xac++] = "hammer"; @@ -900,6 +904,10 @@ again: *ptr++ = 0; xac = 0; xav[xac++] = "ssh"; + if (SshPort) { + xav[xac++] = "-p"; + xav[xac++] = SshPort; + } xav[xac++] = av[1]; xav[xac++] = "hammer"; diff --git a/sbin/hammer/hammer.8 b/sbin/hammer/hammer.8 index 3e436ab5f8..0a98cf4682 100644 --- a/sbin/hammer/hammer.8 +++ b/sbin/hammer/hammer.8 @@ -49,6 +49,7 @@ .Op Fl f Ar blkdevs .\" .Op Fl s Ar linkpath .Op Fl i Ar delay +.Op Fl p Ar ssh-port .Op Fl t Ar seconds .Ar command .Op Ar argument ... @@ -136,6 +137,9 @@ When maintaining a streaming mirroring this option specifies the minimum delay after a batch ends before the next batch is allowed to start. The default is five seconds. +.It Fl p Ar ssh-port +This passes the -p option to ssh when using a remote +specification for the source and/or destination. .It Fl q Decrease verboseness. May be specified multiple times. diff --git a/sbin/hammer/hammer.c b/sbin/hammer/hammer.c index 07764c6207..fd1c1ed063 100644 --- a/sbin/hammer/hammer.c +++ b/sbin/hammer/hammer.c @@ -51,6 +51,7 @@ int NoSyncOpt; int TwoWayPipeOpt; int TimeoutOpt; int DelayOpt = 5; +char *SshPort; int ForceYesOpt = 0; int ForceOpt; int RunningIoctl; @@ -69,7 +70,7 @@ main(int ac, char **av) int ch; int cacheSize = 0; - while ((ch = getopt(ac, av, "b:c:dhf:i:qrs:t:v2yBC:F")) != -1) { + while ((ch = getopt(ac, av, "b:c:dhf:i:p:qrs:t:v2yBC:F")) != -1) { switch(ch) { case '2': TwoWayPipeOpt = 1; @@ -111,6 +112,9 @@ main(int ac, char **av) case 'i': DelayOpt = strtol(optarg, NULL, 0); break; + case 'p': + SshPort = optarg; + break; case 'r': RecurseOpt = 1; break; diff --git a/sbin/hammer/hammer.h b/sbin/hammer/hammer.h index de783a9d21..2bfb4c207a 100644 --- a/sbin/hammer/hammer.h +++ b/sbin/hammer/hammer.h @@ -66,6 +66,7 @@ extern int QuietOpt; extern int TwoWayPipeOpt; extern int TimeoutOpt; extern int DelayOpt; +extern char *SshPort; extern int ForceYesOpt; extern int RunningIoctl; extern int DidInterrupt;