2004-11-16 21:19:09

by Marc Eshel

[permalink] [raw]
Subject: [PATCH] nfs-utils: fix for statd with the -n option





Hi Neil,

Here is another fix for statd, I hope that you are the right person to
handle this request patch nfs-utils. This fix will send the notify msg
using the IP address specified with the -n option to statd. This will fix
the problem that statd in the kernel has of not being able to convert
mon_name to an IP address (no gethostbyname() in the kernel) and any other
clients that ignore the mon_name in the notify msg and use the source IP
address from the RPC request.


--- rmtcall.c.orig 2004-11-16 11:02:59.374758344 -0800
+++ rmtcall.c 2004-11-16 10:42:03.901619272 -0800
@@ -65,6 +65,16 @@ statd_get_socket(int port)
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = port;
+ /*
+ * If a local hostname is given (-n option to statd), bind to the
address
+ * specified. This is required to support clients that ignore the
mon_name in
+ * the statd protocol but use the source address from the request
packet.
+ */
+ if (MY_NAME) {
+ struct hostent *hp = gethostbyname(MY_NAME);
+ if (hp)
+ sin.sin_addr = *(struct in_addr *) hp->h_addr;
+ }
if (bindresvport(sockfd, &sin) < 0) {
dprintf(N_WARNING,
"process_hosts: can't bind to reserved port\n");



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs


2004-11-17 00:56:55

by Marc Eshel

[permalink] [raw]
Subject: Re: [PATCH] nfs-utils: fix for statd with the -n option

Hi Olaf

Can you (or if you prefer I can) add the statd option -n to sm-notify. Once
the option is available the code needs
to bind to that address so the client get the notification from the IP
address that it is monitoring in the case of multiple IP address.
The following is my fix for statd to do the same.

Thanks, Marc.

Marc Eshel <[email protected]> wrote on 11/16/2004 01:16:23 PM:

> Hi Neil,

> Here is another fix for statd, I hope that you are the right person to
> handle this request patch nfs-utils. This fix will send the notify msg
> using the IP address specified with the -n option to statd. This will fix
> the problem that statd in the kernel has of not being able to convert
> mon_name to an IP address (no gethostbyname() in the kernel) and any
other
> clients that ignore the mon_name in the notify msg and use the source IP
> address from the RPC request.

>
> --- rmtcall.c.orig 2004-11-16 11:02:59.374758344 -0800
> +++ rmtcall.c 2004-11-16 10:42:03.901619272 -0800
> @@ -65,6 +65,16 @@ statd_get_socket(int port)
> memset(&sin, 0, sizeof(sin));
> sin.sin_family = AF_INET;
> sin.sin_port = port;
> + /*
> + * If a local hostname is given (-n option to statd), bind to the
> address
> + * specified. This is required to support clients that ignore the
> mon_name in
> + * the statd protocol but use the source address from the request
> packet.
> + */
> + if (MY_NAME) {
> + struct hostent *hp = gethostbyname(MY_NAME);
> + if (hp)
> + sin.sin_addr = *(struct in_addr *) hp->h_addr;
> + }
> if (bindresvport(sockfd, &sin) < 0) {
> dprintf(N_WARNING,
> "process_hosts: can't bind to reserved port\n");

>
> -------------------------------------------------------
> This SF.Net email is sponsored by: InterSystems CACHE
> FREE OODBMS DOWNLOAD - A multidimensional database that combines
> robust object and relational technologies, making it a perfect match
> for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
> _______________________________________________
> NFS maillist - [email protected]
> https://lists.sourceforge.net/lists/listinfo/nfs



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs