diff options
author | shin <shin@FreeBSD.org> | 2000-02-15 15:11:40 +0000 |
---|---|---|
committer | shin <shin@FreeBSD.org> | 2000-02-15 15:11:40 +0000 |
commit | c83f0a97bdc03cca93e16e1bc2758c713aef5fdf (patch) | |
tree | 04189aeeb90e88a6a240f49392fa61d89316107a /usr.bin/rsh | |
parent | 6768336e3b66310544efe8dbe769fdda673c93f8 (diff) | |
download | FreeBSD-src-c83f0a97bdc03cca93e16e1bc2758c713aef5fdf.zip FreeBSD-src-c83f0a97bdc03cca93e16e1bc2758c713aef5fdf.tar.gz |
Add -4 and -6 options.
Current getaddrinfo() implemetation has a problem of too much resolving
waiting time on INET6 enabled systems.
-4 and -6 options can limit name resolving address family and is a possible
workaround for the problem.
Approved by: jkh
Diffstat (limited to 'usr.bin/rsh')
-rw-r--r-- | usr.bin/rsh/rsh.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/usr.bin/rsh/rsh.c b/usr.bin/rsh/rsh.c index aecb818..69579ff 100644 --- a/usr.bin/rsh/rsh.c +++ b/usr.bin/rsh/rsh.c @@ -85,6 +85,8 @@ extern char *krb_realmofhost(); */ int rfd2; +int family = PF_UNSPEC; + char *copyargs __P((char **)); void sendsig __P((int)); void talk __P((int, long, pid_t, int, int)); @@ -129,15 +131,23 @@ main(argc, argv) #ifdef KERBEROS #ifdef CRYPT -#define OPTIONS "8KLde:k:l:nt:wx" +#define OPTIONS "468KLde:k:l:nt:wx" #else -#define OPTIONS "8KLde:k:l:nt:w" +#define OPTIONS "468KLde:k:l:nt:w" #endif #else -#define OPTIONS "8KLde:l:nt:w" +#define OPTIONS "468KLde:l:nt:w" #endif while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1) switch(ch) { + case '4': + family = PF_INET; + break; + + case '6': + family = PF_INET6; + break; + case 'K': #ifdef KERBEROS use_kerberos = 0; @@ -270,11 +280,11 @@ try_connect: if (doencrypt) errx(1, "the -x flag requires Kerberos authentication"); rem = rcmd_af(&host, sp->s_port, pw->pw_name, user, args, - &rfd2, PF_UNSPEC); + &rfd2, family); } #else rem = rcmd_af(&host, sp->s_port, pw->pw_name, user, args, &rfd2, - PF_UNSPEC); + family); #endif if (rem < 0) @@ -479,7 +489,7 @@ usage() { (void)fprintf(stderr, - "usage: rsh [-nd%s]%s[-l login] [-t timeout] host [command]\n", + "usage: rsh [-46] [-nd%s]%s[-l login] [-t timeout] host [command]\n", #ifdef KERBEROS #ifdef CRYPT "x", " [-k realm] "); |