rpcb_clnt.c config to try protocolversion 2 first
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Thomas -
Quoted 3 lines · Thomas Blume via Libtirpc-devel
In some setups, it is necessary to try rpc protocol version 2 first.
Before applying this, I hope we can review previous discussions of this issue. I've forgotten the reason some users prefer it, or maybe I'm just imagining we've discussed it before :-)
The patch description, at the very least, has to have a lot more detail about why this change is needed. Can it provide a URL to threads in an email archive, for example?
Quoted 1 line
Creating the file
/etc/netconfig-try-2-firstwill enforce this.
A nicer administrative API would enable you to update the whole rpcbind version order, but that might be more work than you want to pursue.
It would be a nicer if, instead of a separate file, a line is added to /etc/netconfig to toggle this behavior, or provide the whole version order. E.g.
# rpcbind 4 3 2
# rpcbind 2 4
Really, though, this isn't related to the transport definitions in /etc/netconfig, so a separate configuration file might be more appropriate.
Quoted 28 lines
Signed-off-by Thomas Blume <[email protected]>---
man/Makefile.am | 1 + man/netconfig-try-2-first.7 | 18 ++++++++++++++++++ man/netconfig.5 | 1 + src/rpcb_clnt.c | 29 ++++++++++++++++++++++++++--- 4 files changed, 46 insertions(+), 3 deletions(-)create mode 100644 man/netconfig-try-2-first.7
man/Makefile.am +1
-0@@ -16,6 +16,7 @@ RPCSEC_MANS = rpcsec_gss.3t rpc_gss_get_error.3t \ rpc_gss_get_principal_name.3t rpc_gss_set_callback.3t \ rpc_gss_set_svc_name.3t rpc_gss_svc_max_data_length.3t +dist_man7_MANS = netconfig-try-2-first.7
dist_man5_MANS= netconfig.5dist_man3_MANS = $(LOOKUP_MANS) $(NETCONFIG_MANS) \ $(BIND_MANS) $(GENERIC_MANS) $(COMPAT_MANS) \man/netconfig-try-2-first.7 new file +1
-0@@ -0,0 +1,18 @@ +.Dd January 16, 2019
man/netconfig-try-2-first.7 line 11
Quoted 10 lines
man/netconfig-try-2-first.7 new file +10
-0+.Dt NETCONFIG-TRY-2-FIRST 7 +.Os +.Sh NAME +.Nm netconfig-try-2-first +.Nd indicator to enfore tcp protocol version 2 +.Sh SYNOPSIS +.Pa /etc/netconfig-try-2-first +.Sh DESCRIPTION +libtirpc tries per default for transport UDP and TCP the rpc protocol versions +in the sequence 4, 3, 2.
There is good reason for this behavior. The man page needs to explain the risks of changing it.
Does this break behavior on IPv6-only setups? Is there an added security risk?
Quoted 86 lines
man/netconfig-try-2-first.7 new file +7
-0+In some setups, it is necessary to try rpc protocol version 2 first. +Creating the file +.Nm +will enforce this. +.Ed +.Sh FILES +/etc/netconfig-try-2-firstman/netconfig.5 +0
-0@@ -119,5 +119,6 @@ struct netconfig {.It Pa
/etc/netconfig
.El
.Sh SEE ALSO
+.Xr netconfig-try-2-first 7 ,
.Xr getnetconfig 3 ,
.Xr getnetpath 3src/rpcb_clnt.c +26
-3@@ -32,6 +32,7 @@*/ #include <pthread.h> #include <reentrant.h> +#include <sys/stat.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> @@ -838,6 +839,9 @@ __rpcb_findaddr_timed(program, version, nconf, host, clpp, tp) {#ifdef NOTUSED static bool_t check_rpcbind = TRUE; +#endif +#ifdef PORTMAP +bool_t portmap_first = FALSE;#endif CLIENT *client =NULL ;RPCB parms;@@ -884,6 +888,17 @@ __rpcb_findaddr_timed(program, version, nconf, host, clpp, tp) parms.r_addr =NULL ; } +#ifdef PORTMAP +/*enforce protocol version 2 if file exists */ +struct stat fileStat; + +if (stat ("/etc/netconfig-try-2-first" ,&fileStat) ==0 ) { + portmap_first = TRUE; + goto portmap; + } +#endif + +rpcbind:if (client ==NULL ) { client =getclnthandle (host, nconf, &parms.r_addr);if (client ==NULL ) {@@ -943,17 +958,25 @@ __rpcb_findaddr_timed(program, version, nconf, host, clpp, tp) } } +if (portmap_first) { + goto check_address; + } + +portmap:#ifdef PORTMAP /* Try version 2 for TCP or UDP */ if (strcmp (nconf->nc_protofmly,NC_INET ) ==0 ) { address =__try_protocol_version_2 (program, version, nconf, host, tp); -if (address ==NULL ) +if (address ==NULL && portmap_first) + goto rpcbind; +else goto error; }#endif /* PORTMAP */ +check_address:if ((address ==NULL ) || (address->len ==0 )) { - rpc_createerr.cf_stat =RPC_PROGNOTREGISTERED ; -clnt_geterr (client, &rpc_createerr.cf_error); + rpc_createerr.cf_stat =RPC_PROGNOTREGISTERED ; +clnt_geterr (client, &rpc_createerr.cf_error); }
Quoted 10 lines
error:
Signature · 8 lines
2.34.1 _______________________________________________ Libtirpc-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libtirpc-devel
--
Chuck Lever
Hello Chuck,
Quoted 7 lines · Chuck Lever III
Quoted 3 lines · Thomas Blume via Libtirpc-devel
In some setups, it is necessary to try rpc protocol version 2 first.
Before applying this, I hope we can review previous discussions of this issue. I've forgotten the reason some users prefer it, or maybe I'm just imagining we've discussed it before :-)
We've had a discussion about 1 year ago:
https://sourceforge.net/p/libtirpc/mailman/message/37227894/
actually that encouraged me to send a patch, even though I initially thought is wasn't good enough for upstream.
Quoted 3 lines
The patch description, at the very least, has to have a lot more detail about why this change is needed. Can it provide a URL to threads in an email archive, for example?
This goes back to an old SUSE bugreport following the change of rpc protocol version 2, 3, 4 to 4, 3, 2.
Below an description of issue the customer was seeing:
-->
An 3rd party NFS Server is behind a F5 front end load balancer device. The F5 front end load balancer device is replacing IP addresses in packets as they head to a NFS server.
It replaces IP addresses in headers but as you might expect it does not replace the IP address within the RPC data payload, i.e. within RPC GETADDR request, which places an address there for the universal address or hint. Without a correct hint, the GETADDR reply which comes back gives an unexpected address which happens to be unroutable from the nfs client's point of view. --<
We agreed that this is rather an issue of the loadbalancer hardware, but we would have to address that anyway due to backward compatibility.
So, the first question is, do we want to stay backward compatible upstream? We have to do that as distributor, but of course upstream is different.
Quoted 10 lines
Quoted 1 line
Creating the file
/etc/netconfig-try-2-firstwill enforce this.A nicer administrative API would enable you to update the whole rpcbind version order, but that might be more work than you want to pursue.
It would be a nicer if, instead of a separate file, a line is added to
/etc/netconfigto toggle this behavior, or provide the whole version order. E.g.
Quoted 7 lines
# rpcbind 4 3 2# rpcbind 2 4Really, though, this isn't related to the transport definitions in
/etc/netconfig, so a separate configuration file might be more appropriate.
Thanks for the hints, if you deem a patch would be still desireable I will work on that.
Best regards
Thomas Blume
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5
90409 Nürnberg
Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Quoted 16 lines · Thomas Blume
Hello Chuck,
Quoted 7 lines · Chuck Lever III
Quoted 3 lines · Thomas Blume via Libtirpc-devel
In some setups, it is necessary to try rpc protocol version 2 first.
Before applying this, I hope we can review previous discussions of this issue. I've forgotten the reason some users prefer it, or maybe I'm just imagining we've discussed it before :-)
Quoted 6 lines
We've had a discussion about 1 year ago:
https://sourceforge.net/p/libtirpc/mailman/message/37227894/
actually that encouraged me to send a patch, even though I initially thought is wasn't good enough for upstream.
I agree that adding the sidecar file to toggle the rpcbind version order is a bit rough.
Quoted 19 lines
Quoted 3 lines
The patch description, at the very least, has to have a lot more detail about why this change is needed. Can it provide a URL to threads in an email archive, for example?
This goes back to an old SUSE bugreport following the change of rpc protocol version 2, 3, 4 to 4, 3, 2.
Below an description of issue the customer was seeing:-->
An 3rd party NFS Server is behind a F5 front end load balancer device. The F5 front end load balancer device is replacing IP addresses in packets as they head to a NFS server.
It replaces IP addresses in headers but as you might expect it does not replace the IP address within the RPC data payload, i.e. within RPC GETADDR request, which places an address there for the universal address or hint. Without a correct hint, the GETADDR reply which comes back gives an unexpected address which happens to be unroutable from the nfs client's point of view. --<
Quoted 5 lines
We agreed that this is rather an issue of the loadbalancer hardware, but we would have to address that anyway due to backward compatibility.
So, the first question is, do we want to stay backward compatible upstream? We have to do that as distributor, but of course upstream is different.
Thanks for the reminder. I suggest that it should be included in the patch description if you post again so that it becomes part of the libtirpc commit history.
Quoted 12 lines
Quoted 12 lines
Quoted 1 line
Creating the file
/etc/netconfig-try-2-firstwill enforce this.A nicer administrative API would enable you to update the whole rpcbind version order, but that might be more work than you want to pursue.
It would be a nicer if, instead of a separate file, a line is added to
/etc/netconfigto toggle this behavior, or provide the whole version order. E.g.# rpcbind 4 3 2
Quoted 8 lines
Quoted 5 lines
# rpcbind 2 4Really, though, this isn't related to the transport definitions in
/etc/netconfig, so a separate configuration file might be more appropriate.Thanks for the hints, if you deem a patch would be still desireable I will work on that.
I'd like to hear other opinions. I'm not the maintainer of libtirpc, I'm just someone who is very opinionated :-)
--
Chuck Lever
Quoted 90 lines · Chuck Lever III
Quoted 19 lines · Thomas Blume
Hello Chuck,
Quoted 10 lines · Chuck Lever III
Quoted 5 lines
On Feb 14, 2022, at 4:26 AM, Thomas Blume via Libtirpc-devel <[email protected]> wrote:
In some setups, it is necessary to try rpc protocol version 2 first.
Before applying this, I hope we can review previous discussions of
this issue. I've forgotten the reason some users prefer it, or maybe I'm just imagining we've discussed it before :-)Quoted 7 lines
We've had a discussion about 1 year ago:
https://sourceforge.net/p/libtirpc/mailman/message/37227894/
actually that encouraged me to send a patch, even though I initially thought
is wasn't good enough for upstream.I agree that adding the sidecar file to toggle the rpcbind version order is a bit rough.
Quoted 26 lines
Quoted 3 lines
The patch description, at the very least, has to have a lot more detail about why this change is needed. Can it provide a URL to threads in an email archive, for example?
This goes back to an old SUSE bugreport following the change of rpc protocol
version 2, 3, 4 to 4, 3, 2.
Below an description of issue the customer was seeing:-->
An 3rd party NFS Server is behind a F5 front end load balancer device.
The F5 front end load balancer device is replacing IP addresses in packets as
they head to a NFS server.
It replaces IP addresses in headers but as you might expect it does not replace
the IP address within the RPC data payload, i.e. within RPC GETADDR request,
which places an address there for the universal address or hint. Without a
correct hint, the GETADDR reply which comes back gives an unexpected address
which happens to be unroutable from the nfs client's point of view. --<Quoted 8 lines
We agreed that this is rather an issue of the loadbalancer hardware, but we
would have to address that anyway due to backward compatibility.So, the first question is, do we want to stay backward compatible upstream?
We have to do that as distributor, but of course upstream is different.Thanks for the reminder. I suggest that it should be included in the patch description if you post again so that it becomes part of the libtirpc commit history.
Quoted 19 lines
Quoted 18 lines
Quoted 2 lines
Creating the file
/etc/netconfig-try-2-firstwill enforce this.A nicer administrative API would enable you to update the whole rpcbind version order, but that might be more work than you want to pursue.
It would be a nicer if, instead of a separate file, a line is added to
/etc/netconfigto toggle this behavior, or provide the whole version order. E.g.# rpcbind 4 3 2# rpcbind 2 4Really, though, this isn't related to the transport definitions in
/etc/netconfig, so a separate configuration file might be more appropriate.
Quoted 8 lines
Quoted 3 lines
Thanks for the hints, if you deem a patch would be still desireable I will work
on that.I'd like to hear other opinions. I'm not the maintainer of libtirpc, I'm just someone who is very opinionated :-)
Quite frankly, if you're relying on the IP address in GETADDR being correct, then you're going to be disappointed in a lot of
circumstances: the common practice of using NAT and MASQUERADING in modern data centres (particularly when using virtualisation) typically break it pretty badly.
In 1995, when RFC1833 was published, there wasn't that much widespread use of NAT, and there certainly wasn't heavy use of containers for hosting services like NFS, so it is understandable why this happened, but today we should know better.
So which applications are still relying on the address from GETADDR in order to work correctly? As far as I know, 'mount' does not. I seem to remember that 'showmount' is borken, and needs to be fixed. Others?
Signature · 3 lines
Trond Myklebust Linux NFS client maintainer, Hammerspace [email protected]
Quoted 104 lines · Trond Myklebust
Quoted 90 lines · Chuck Lever III
Quoted 19 lines · Thomas Blume
Hello Chuck,
Quoted 10 lines · Chuck Lever III
Quoted 5 lines
On Feb 14, 2022, at 4:26 AM, Thomas Blume via Libtirpc-devel <[email protected]> wrote:
In some setups, it is necessary to try rpc protocol version 2 first.
Before applying this, I hope we can review previous discussions of
this issue. I've forgotten the reason some users prefer it, or maybe I'm just imagining we've discussed it before :-)Quoted 7 lines
We've had a discussion about 1 year ago:
https://sourceforge.net/p/libtirpc/mailman/message/37227894/
actually that encouraged me to send a patch, even though I initially thought
is wasn't good enough for upstream.I agree that adding the sidecar file to toggle the rpcbind version order is a bit rough.
Quoted 26 lines
Quoted 3 lines
The patch description, at the very least, has to have a lot more detail about why this change is needed. Can it provide a URL to threads in an email archive, for example?
This goes back to an old SUSE bugreport following the change of rpc protocol
version 2, 3, 4 to 4, 3, 2.
Below an description of issue the customer was seeing:-->
An 3rd party NFS Server is behind a F5 front end load balancer device.
The F5 front end load balancer device is replacing IP addresses in packets as
they head to a NFS server.
It replaces IP addresses in headers but as you might expect it does not replace
the IP address within the RPC data payload, i.e. within RPC GETADDR request,
which places an address there for the universal address or hint. Without a
correct hint, the GETADDR reply which comes back gives an unexpected address
which happens to be unroutable from the nfs client's point of view. --<Quoted 8 lines
We agreed that this is rather an issue of the loadbalancer hardware, but we
would have to address that anyway due to backward compatibility.So, the first question is, do we want to stay backward compatible upstream?
We have to do that as distributor, but of course upstream is different.Thanks for the reminder. I suggest that it should be included in the patch description if you post again so that it becomes part of the libtirpc commit history.
Quoted 19 lines
Quoted 18 lines
Quoted 2 lines
Creating the file
/etc/netconfig-try-2-firstwill enforce this.A nicer administrative API would enable you to update the whole rpcbind version order, but that might be more work than you want to pursue.
It would be a nicer if, instead of a separate file, a line is added to
/etc/netconfigto toggle this behavior, or provide the whole version order. E.g.# rpcbind 4 3 2# rpcbind 2 4Really, though, this isn't related to the transport definitions in
/etc/netconfig, so a separate configuration file might be more appropriate.Quoted 8 lines
Quoted 3 lines
Thanks for the hints, if you deem a patch would be still desireable I will work
on that.I'd like to hear other opinions. I'm not the maintainer of libtirpc, I'm just someone who is very opinionated :-)
Quoted 9 lines
Quite frankly, if you're relying on the IP address in GETADDR being correct, then you're going to be disappointed in a lot of
circumstances: the common practice of using NAT and MASQUERADING in modern data centres (particularly when using virtualisation) typically break it pretty badly.
In 1995, when RFC1833 was published, there wasn't that much widespread use of NAT, and there certainly wasn't heavy use of containers for hosting services like NFS, so it is understandable why this happened, but today we should know better.
Hi Thomas-
Would it make sense to change the behavior of the libtirpc GETADDR implementation to ignore the embedded IP address and extract only the port number from the returned universal address? Then administrative intervention would be unnecessary.
Quoted 3 lines
So which applications are still relying on the address from GETADDR in order to work correctly? As far as I know, 'mount' does not. I seem to remember that 'showmount' is borken, and needs to be fixed. Others?
--
Chuck Lever