diff --git a/main.c b/main.c index ee9630f..2e8001a 100644 --- a/main.c +++ b/main.c @@ -117,6 +117,7 @@ int sender_keeps_checksum = 0; # endif static struct sigaction sigact; #endif +extern int default_af_hint; struct pid_status { pid_t pid; @@ -454,6 +455,23 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in *t++ = '\0'; } +#ifdef AF_INET + if (default_af_hint == AF_INET) { + if (strncmp(cmd, "ssh", 3) == 0 || strstr(cmd, "/ssh") != NULL) { + /* we're using ssh so we can add a -4 option */ + args[argc++] = "-4"; + } + } +#endif +#ifdef AF_INET6 + if (default_af_hint == AF_INET6) { + if (strncmp(cmd, "ssh", 3) == 0 || strstr(cmd, "/ssh") != NULL) { + /* we're using ssh so we can add a -6 option */ + args[argc++] = "-6"; + } + } +#endif + /* check to see if we've already been given '-l user' in * the remote-shell command */ for (i = 0; i < argc-1; i++) {