Chuck Lever 29ed1407ed NSM: Support IPv6 version of mon_name
The "mon_name" argument of the NSMPROC_MON and NSMPROC_UNMON upcalls
is a string that contains the hostname or IP address of the remote peer
to be notified when this host has rebooted.  The sm-notify command uses
this identifier to contact the peer when we reboot, so it must be
either a well-qualified DNS hostname or a presentation format IP
address string.

When the "nsm_use_hostnames" sysctl is set to zero, the kernel's NSM
provides a presentation format IP address in the "mon_name" argument.
Otherwise, the "caller_name" argument from NLM requests is used,
which is usually just the DNS hostname of the peer.

To support IPv6 addresses for the mon_name argument, we use the
nsm_handle's address eye-catcher, which already contains an appropriate
presentation format address string.  Using the eye-catcher string
obviates the need to use a large buffer on the stack to form the
presentation address string for the upcall.

This patch also addresses a subtle bug.

An NSMPROC_MON request and the subsequent NSMPROC_UNMON request for the
same peer are required to use the same value for the "mon_name"
argument.  Otherwise, rpc.statd's NSMPROC_UNMON processing cannot
locate the database entry for that peer and remove it.

If the setting of nsm_use_hostnames is changed between the time the
kernel sends an NSMPROC_MON request and the time it sends the
NSMPROC_UNMON request for the same peer, the "mon_name" argument for
these two requests may not be the same.  This is because the value of
"mon_name" is currently chosen at the moment the call is made based on
the setting of nsm_use_hostnames

To ensure both requests pass identical contents in the "mon_name"
argument, we now select which string to use for the argument in the
nsm_monitor() function.  A pointer to this string is saved in the
nsm_handle so it can be used for a subsequent NSMPROC_UNMON upcall.

NB: There are other potential problems, such as how nlm_host_rebooted()
might behave if nsm_use_hostnames were changed while hosts are still
being monitored.  This patch does not attempt to address those
problems.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2009-01-06 11:53:51 -05:00
..
2008-12-25 11:40:09 +11:00
2009-01-05 11:54:28 -05:00
2008-12-31 18:07:43 -05:00
2009-01-05 07:45:02 +00:00
2008-11-14 10:39:25 +11:00
2009-01-05 08:40:30 -08:00
2008-10-17 02:38:36 +11:00
2009-01-05 11:54:27 -05:00
2009-01-05 11:54:28 -05:00
2008-11-18 15:08:56 +01:00
2009-01-05 11:54:28 -05:00
2008-12-04 17:16:36 +11:00
2008-12-29 16:47:18 +11:00
2008-12-29 08:29:50 +01:00
2008-12-31 18:07:43 -05:00
2009-01-03 11:45:54 -08:00
2008-12-29 08:29:53 +01:00
2008-10-23 05:12:59 -04:00
2008-12-31 18:07:38 -05:00
2008-12-25 11:40:09 +11:00
2009-01-05 11:54:28 -05:00
2009-01-05 07:38:46 +00:00
2008-12-31 18:07:41 -05:00
2009-01-05 11:54:28 -05:00
2009-01-04 15:14:41 -05:00
2008-10-30 11:38:45 -07:00
2009-01-05 11:54:28 -05:00
2009-01-05 11:54:28 -05:00
2009-01-05 11:54:28 -05:00