afd8123f97
Make rpcinfo -p/-u/-t options support IPv6 (bnc# 859448) OBS-URL: https://build.opensuse.org/request/show/214491 OBS-URL: https://build.opensuse.org/package/show/network/rpcbind?expand=0&rev=30
72 lines
1.9 KiB
Diff
72 lines
1.9 KiB
Diff
From 00ad3e8c82610179177d02c5490c941907fcd109 Mon Sep 17 00:00:00 2001
|
|
From: Olaf Kirch <okir@suse.de>
|
|
Date: Mon, 20 Jan 2014 12:26:40 +0100
|
|
Subject: [PATCH 20/23] rpcinfo: make -t/-u options support IPv6 addresses,
|
|
too
|
|
|
|
Currently, rpcinfo supports two ways to test whether a given
|
|
service is alive.
|
|
|
|
For IPv4 hosts, you can use -u and -t. But for IPv6, you need
|
|
to use "rpcinfo -a" and specify the host through a universal
|
|
address, which is fairly inconvenient.
|
|
|
|
This patch modifies ip_ping to allow using -u and -t for IPv6
|
|
addresses and hosts as well.
|
|
|
|
Signed-off-by: Olaf Kirch <okir@suse.de>
|
|
---
|
|
src/rpcinfo.c | 15 ++++++++-------
|
|
1 file changed, 8 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/src/rpcinfo.c b/src/rpcinfo.c
|
|
index 89dee56..3fea753 100644
|
|
--- a/src/rpcinfo.c
|
|
+++ b/src/rpcinfo.c
|
|
@@ -412,16 +412,15 @@ ip_ping_one(client, vers)
|
|
* version 0 calls succeeds, it tries for MAXVERS call and repeats the same.
|
|
*/
|
|
static void
|
|
-ip_ping (portnum, trans, argc, argv)
|
|
+ip_ping (portnum, proto, argc, argv)
|
|
u_short portnum;
|
|
- char *trans;
|
|
+ char *proto;
|
|
int argc;
|
|
char **argv;
|
|
{
|
|
CLIENT *client;
|
|
- int fd = RPC_ANYFD;
|
|
- struct sockaddr_in addr;
|
|
enum clnt_stat rpc_stat;
|
|
+ const char *hostname;
|
|
u_long prognum, vers, minvers, maxvers;
|
|
struct rpc_err rpcerr;
|
|
int failure = 0;
|
|
@@ -431,8 +430,9 @@ ip_ping (portnum, trans, argc, argv)
|
|
usage ();
|
|
exit (1);
|
|
}
|
|
+
|
|
+ hostname = argv[0];
|
|
prognum = getprognum (argv[1]);
|
|
- get_inet_address (&addr, argv[0]);
|
|
if (argc == 2)
|
|
{ /* Version number not known */
|
|
/*
|
|
@@ -445,8 +445,9 @@ ip_ping (portnum, trans, argc, argv)
|
|
{
|
|
vers = getvers (argv[2]);
|
|
}
|
|
- addr.sin_port = htons (portnum);
|
|
- client = clnt_com_create (&addr, prognum, vers, &fd, trans);
|
|
+
|
|
+ client = ip_getclient(hostname, prognum, vers, proto);
|
|
+
|
|
rpc_stat = ip_ping_one(client, vers);
|
|
if (argc != 2)
|
|
{
|
|
--
|
|
1.7.12.4
|
|
|