diff options
| author | Joyu Liao <joyul@juniper.net> | 2024-07-06 20:39:07 +0000 |
|---|---|---|
| committer | Rick Macklem <rmacklem@FreeBSD.org> | 2024-07-06 20:39:07 +0000 |
| commit | d8a99eaa1f06bc3b3c017dce3e6ddf6b1fa37bcb (patch) | |
| tree | 45b93012b33b1d6a803040273ae1f79a8365184a /usr.sbin/rpcbind | |
| parent | 6677621bad00191dfec1b0a20ae1618b92745d9b (diff) | |
Diffstat (limited to 'usr.sbin/rpcbind')
| -rw-r--r-- | usr.sbin/rpcbind/rpcbind.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/rpcbind/rpcbind.c b/usr.sbin/rpcbind/rpcbind.c index de05330d0ca5..44adae366bed 100644 --- a/usr.sbin/rpcbind/rpcbind.c +++ b/usr.sbin/rpcbind/rpcbind.c @@ -88,6 +88,7 @@ int libwrap = 0; #endif int nofork = 0; int verboselog = 0; +int nobind_localhost = 0; static char **hosts = NULL; static struct sockaddr **bound_sa; @@ -342,9 +343,9 @@ init_transport(struct netconfig *nconf) if (nhostsbak == 1) hosts[0] = "*"; else { - if (hints.ai_family == AF_INET) { + if (hints.ai_family == AF_INET && nobind_localhost == 0) { hosts[nhostsbak - 1] = "127.0.0.1"; - } else if (hints.ai_family == AF_INET6) { + } else if (hints.ai_family == AF_INET6 && nobind_localhost == 0) { hosts[nhostsbak - 1] = "::1"; } else return 1; @@ -802,7 +803,7 @@ parseargs(int argc, char *argv[]) #else #define WRAPOP "" #endif - while ((c = getopt(argc, argv, "6adh:iLlNs" WRAPOP WSOP)) != -1) { + while ((c = getopt(argc, argv, "6adh:IiLlNs" WRAPOP WSOP)) != -1) { switch (c) { case '6': ipv6_only = 1; @@ -823,6 +824,9 @@ parseargs(int argc, char *argv[]) if (hosts[nhosts - 1] == NULL) errx(1, "Out of memory"); break; + case 'I': + nobind_localhost = 1; + break; case 'i': insecure = 1; break; @@ -850,7 +854,7 @@ parseargs(int argc, char *argv[]) #endif default: /* error */ fprintf(stderr, - "usage: rpcbind [-6adiLls%s%s] [-h bindip]\n", + "usage: rpcbind [-6adIiLls%s%s] [-h bindip]\n", WRAPOP, WSOP); exit (1); } |
