Change prognum, versnum, minvers, and maxvers in progping to u_int32_t from u_long
Subsystems (2)
PATCH 1/1 Change prognum, versnum, minvers, and maxvers in progping to u_int32_t from u_long
This fixes a problem where "rpcinfo -T transport host prognum" fails on a PPC64 because CLNT_CONTROL expects the version number to be a 32 bit quantity. u_long probably works fine on little endian machines, but won't work on big endian machines.
--- src/rpcinfo.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
src/rpcinfo.c +1 -1
@@ -1591,7 +1591,7 @@ progping (netid, argc, argv)CLIENT *client;struct timeval to;enum clnt_stat rpc_stat; -u_long prognum, versnum, minvers, maxvers; +u_int32_t prognum, versnum, minvers, maxvers;struct rpc_err rpcerr;int failure =0 ;struct netconfig *nconf;
Signature · 1 line
1.5.2.2
Quoted 4 lines · Frank Filz
This fixes a problem where "rpcinfo -T transport host prognum" fails on a PPC64 because
CLNT_CONTROLexpects the version number to be a 32 bit quantity.u_longprobably works fine on little endian machines, but won't work on big endian machines.
Hrm. These variables are unsigned long pretty much everywhere in the legacy RPC code. And, isn't SPARC big endian? Is the real problem 32- v. 64- bit?
This might be fixed more generically by adding a type cast to CLNT_CONTROL.
Quoted 10 lines
Signed-off-by Frank Filz <[email protected]>---
src/rpcinfo.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)src/rpcinfo.c +0
-0
src/rpcinfo.c progping (netid, argc, argv) · line 1597
Quoted 8 lines
src/rpcinfo.c +1
-1@@ -1591,7 +1591,7 @@ progping (netid, argc, argv)CLIENT *client;struct timeval to;enum clnt_stat rpc_stat; -u_long prognum, versnum, minvers, maxvers; +u_int32_t prognum, versnum, minvers, maxvers;struct rpc_err rpcerr;int failure =0 ;struct netconfig *nconf;
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
Quoted 9 lines · Chuck Lever
Quoted 7 lines · Frank Filz
This fixes a problem where "rpcinfo -T transport host prognum" fails on a PPC64
becauseCLNT_CONTROLexpects the version number to be a 32 bit quantity.u_long
probably works fine on little endian machines, but won't work on big endian
machines.
Quoted 3 lines
Hrm. These variables are unsigned long pretty much everywhere in the legacy RPC code. And, isn't SPARC big endian? Is the real problem 32- v. 64- bit?
I at first though it would be a 64/32 bit problen, but now I think it would still affect 32 bit, since unsigned long would still be a 64 bit quantity, with the low order 32 bits being in the 5th through 8th bytes on big endian, and therefore the 1st through 4th bytes which will be accessed by casting a (void *) t (int *) would be 0.
Quoted 2 lines
This might be fixed more generically by adding a type cast to
CLNT_CONTROL.
I did try a type cast at first, but it didn't work, though I might not have done it right.
But look at these definitions from /usr/include/rpc/types.h:
/* This needs to be changed to uint32_t in the future */ typedef unsigned long rpcprog_t;
typedef unsigned long rpcvers_t;
typedef unsigned long rpcproc_t;
typedef unsigned long rpcprot_t;
typedef unsigned long rpcport_t;
Now look at the same definitions from /usr/include/tirpc/rpc/types.h:
typedef u_int32_t rpcprog_t;
typedef u_int32_t rpcvers_t;
typedef u_int32_t rpcproc_t;
typedef u_int32_t rpcprot_t;
typedef u_int32_t rpcport_t;
Actually, the patch probably should change the definitions to:
rpcprog_t prognum;
rpcvers_t versnum, minvers, maxvers;
(though internally, the CLNT_CONTROL is casting to u_int32_t, not rpcvers_t or rpcprog_t).
It is curious though that in RFC 1833, there is this definition:
struct rpcb {
unsigned long r_prog; /* program number */
unsigned long r_vers; /* version number */
string r_netid<>; /* network id */
string r_addr<>; /* universal address */
string r_owner<>; /* owner of this service */
};
But pretty much every where else, including the RPC protocol, prog and vers are unsigned int...
Quoted 22 lines
Quoted 10 lines
Signed-off-by Frank Filz <[email protected]>---
src/rpcinfo.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)src/rpcinfo.c +0
-0src/rpcinfo.c progping (netid, argc, argv) · line 1597
Quoted 8 lines
src/rpcinfo.c +1
-1@@ -1591,7 +1591,7 @@ progping (netid, argc, argv)CLIENT *client;struct timeval to;enum clnt_stat rpc_stat; -u_long prognum, versnum, minvers, maxvers; +u_int32_t prognum, versnum, minvers, maxvers;struct rpc_err rpcerr;int failure =0 ;struct netconfig *nconf;--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
Quoted 16 lines · Frank Filz
This fixes a problem where "rpcinfo -T transport host prognum" fails on a PPC64 because
CLNT_CONTROLexpects the version number to be a 32 bit quantity.u_longprobably works fine on little endian machines, but won't work on big endian machines.Signed-off-by Frank Filz <[email protected]>---
src/rpcinfo.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)src/rpcinfo.c +0
-0
src/rpcinfo.c progping (netid, argc, argv) · line 1594
Quoted 5 lines
src/rpcinfo.c +1
-1@@ -1591,7 +1591,7 @@ progping (netid, argc, argv)CLIENT *client;struct timeval to;enum clnt_stat rpc_stat; -u_long prognum, versnum, minvers, maxvers; +u_int32_t prognum, versnum, minvers, maxvers;
Right, looking at the TI-RPC type definitions, we really want:
rpcprog_t prognum;
rpcvers_t versnum, minvers, maxvers;
Now, this won't work if rpcinfo is built against the legacy RPC headers in /usr/include. The TI-RPC headers define these types correctly as u_int32_t, but the legacy headers use u_long.
Quoted 8 lines
src/rpcinfo.c +0
-0struct rpc_err rpcerr;int failure =0 ;struct netconfig *nconf;Signature · 1 line
1.5.2.2
Signature · 2 lines
Chuck Lever chuck[dot]lever[at]oracle[dot]com
Quoted 28 lines · Chuck Lever
Quoted 19 lines · Frank Filz
This fixes a problem where "rpcinfo -T transport host prognum" fails on a PPC64
becauseCLNT_CONTROLexpects the version number to be a 32 bit quantity.u_long
probably works fine on little endian machines, but won't work on big endian
machines.Signed-off-by Frank Filz <[email protected]>---
src/rpcinfo.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)src/rpcinfo.c +0
-0src/rpcinfo.c progping (netid, argc, argv) · line 1594
Quoted 5 lines
src/rpcinfo.c +1
-1@@ -1591,7 +1591,7 @@ progping (netid, argc, argv)CLIENT *client;struct timeval to;enum clnt_stat rpc_stat; -u_long prognum, versnum, minvers, maxvers; +u_int32_t prognum, versnum, minvers, maxvers;Right, looking at the TI-RPC type definitions, we really want:
Quoted 6 lines
rpcprog_tprognum;
rpcvers_tversnum, minvers, maxvers;Now, this won't work if rpcinfo is built against the legacy RPC headers in
/usr/include. The TI-RPC headers define these types correctly asu_int32_t, but the legacy headers useu_long.
I take that back. Replacing u_long with rpcvers_t will work in both cases. glibc's CLNT_CONTROL expects a u_long here, but TI-RPC expects an u_int32_t. These match the typedef for rpcvers_t for each of these.
So, you have to make sure you are building with the headers that go with your RPC library. The headers in /usr/include/rpc go with glibc, and the headers in /usr/include/tirpc/rpc go with libtirpc.
Quoted 3 lines
src/rpcinfo.c progping (netid, argc, argv) · line 1597
Quoted 3 lines
src/rpcinfo.c +0
-0struct rpc_err rpcerr;int failure =0 ;struct netconfig *nconf;
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
PATCH 1/1 rpcbind: Change prognum, versnum, minvers, and maxvers in progping to rpcprog_t and rpcvers_t from u_long
Quoted 7 lines · Chuck Lever
I take that back. Replacing
u_longwithrpcvers_twill work in both cases. glibc'sCLNT_CONTROLexpects au_longhere, but TI-RPC expects anu_int32_t. These match the typedef forrpcvers_tfor each of these.So, you have to make sure you are building with the headers that go with your RPC library. The headers in
/usr/include/rpcgo with glibc, and the headers in/usr/include/tirpc/rpcgo with libtirpc.
Ok, here's a patch that implements it that way. It works fine on PPC64.
This fixes a problem where "rpcinfo -T transport host prognum" fails on a PPC64 because CLNT_CONTROL expects the version number to be a 32 bit quantity. u_long probably works fine on little endian machines, but won't work on big endian machines.
--- src/rpcinfo.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
src/rpcinfo.c +2 -1
@@ -1591,7 +1591,8 @@ progping (netid, argc, argv)CLIENT *client;struct timeval to;enum clnt_stat rpc_stat; -u_long prognum, versnum, minvers, maxvers; +rpcprog_t prognum; +rpcvers_t versnum, minvers, maxvers;struct rpc_err rpcerr;int failure =0 ;struct netconfig *nconf;
Signature · 1 line
1.5.2.2
Re: [PATCH] rpcbind: Change prognum, versnum, minvers, and maxvers in progping to rpcprog_t and rpcvers_t from u_long
Quoted 9 lines · Frank Filz
Quoted 7 lines · Chuck Lever
I take that back. Replacing
u_longwithrpcvers_twill work in both cases. glibc'sCLNT_CONTROLexpects au_longhere, but TI-RPC expects anu_int32_t. These match the typedef forrpcvers_tfor each of these.So, you have to make sure you are building with the headers that go with your RPC library. The headers in
/usr/include/rpcgo with glibc, and the headers in/usr/include/tirpc/rpcgo with libtirpc.
Quoted 6 lines
Ok, here's a patch that implements it that way. It works fine on PPC64.
This fixes a problem where "rpcinfo -T transport host prognum" fails on a PPC64 because
CLNT_CONTROLexpects the version number to be a 32 bit quantity.u_longprobably works fine on little endian machines, but won't work on big endian machines.
Thanks for testing.
The description is somewhat incorrect, though. TI-RPC's CLNT_CONTROL expects the version number to be a 32-bit quantity. glibc's RPC implementation of CLNT_CONTROL is just dandy with u_long. I think that does bear some emphasis in the description.
Changing the types of these variables means that this code will now work unchanged with both glibc and TI-RPC (with a recompile, of course).
Quoted 28 lines
Signed-off-by Frank Filz <[email protected]>---
src/rpcinfo.c| 3 ++-1 files changed, 2 insertions(+), 1 deletions(-)src/rpcinfo.c +2
-1@@ -1591,7 +1591,8 @@ progping (netid, argc, argv)CLIENT *client;struct timeval to;enum clnt_stat rpc_stat; -u_long prognum, versnum, minvers, maxvers; +rpcprog_t prognum; +rpcvers_t versnum, minvers, maxvers;struct rpc_err rpcerr;int failure =0 ;struct netconfig *nconf;Signature · 8 lines
1.5.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Chuck Lever chuck[dot]lever[at]oracle[dot]com