2006-11-02 17:53:21

by Chuck Lever

[permalink] [raw]
Subject: Forming an NFSv4 clientid

While considering what will need to change to support IPv6, I noticed
this logic, which forms the NFSv4 clientid:

2927 setclientid.sc_name_len = scnprintf(setclientid.sc_name,
2928 sizeof(setclientid.sc_name),
"%s/%u.%u.%u.%u %s %u",
2929 clp->cl_ipaddr,
NIPQUAD(clp->cl_addr.sin_addr),
2930 cred->cr_ops->cr_name,
2931 clp->cl_id_uniquifier);

When would the contents of cl_ipaddr not be the same as the result of
the NIPQUAD? For IPv6, the NIPQUAD will have to be replaced, or
removed. Any suggestions?

--
"We who cut mere stones must always be envisioning cathedrals"
-- Quarry worker's creed

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs


2006-11-02 19:06:29

by Trond Myklebust

[permalink] [raw]
Subject: Re: Forming an NFSv4 clientid

On Thu, 2006-11-02 at 12:53 -0500, Chuck Lever wrote:
> While considering what will need to change to support IPv6, I noticed
> this logic, which forms the NFSv4 clientid:
>
> 2927 setclientid.sc_name_len = scnprintf(setclientid.sc_name,
> 2928 sizeof(setclientid.sc_name),
> "%s/%u.%u.%u.%u %s %u",
> 2929 clp->cl_ipaddr,
> NIPQUAD(clp->cl_addr.sin_addr),
> 2930 cred->cr_ops->cr_name,
> 2931 clp->cl_id_uniquifier);
>
> When would the contents of cl_ipaddr not be the same as the result of
> the NIPQUAD? For IPv6, the NIPQUAD will have to be replaced, or
> removed. Any suggestions?

They are _not_ the same. cl_ipaddr is the client ip address, whereas
clp->cl_addr is the server ip address.

Just replace clp->cl_addr with your usual "print server address"
routine, increase the size of cl_ipaddr so that it can take an IPv6
string, and adjust the size of setclientid.sc_name accordingly.

Cheers,
Trond


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2006-11-02 19:24:29

by Chuck Lever

[permalink] [raw]
Subject: Re: Forming an NFSv4 clientid

On 11/2/06, Trond Myklebust <[email protected]> wrote:
> On Thu, 2006-11-02 at 12:53 -0500, Chuck Lever wrote:
> > While considering what will need to change to support IPv6, I noticed
> > this logic, which forms the NFSv4 clientid:
> >
> > 2927 setclientid.sc_name_len = scnprintf(setclientid.sc_name,
> > 2928 sizeof(setclientid.sc_name),
> > "%s/%u.%u.%u.%u %s %u",
> > 2929 clp->cl_ipaddr,
> > NIPQUAD(clp->cl_addr.sin_addr),
> > 2930 cred->cr_ops->cr_name,
> > 2931 clp->cl_id_uniquifier);
> >
> > When would the contents of cl_ipaddr not be the same as the result of
> > the NIPQUAD? For IPv6, the NIPQUAD will have to be replaced, or
> > removed. Any suggestions?
>
> They are _not_ the same. cl_ipaddr is the client ip address, whereas
> clp->cl_addr is the server ip address.

The names of these fields are a little confusing. The structure is
"nfs_client" and the field is "cl_addr", yet this is the address of
the remote peer. I'd like cl_srvaddr or cl_remote_addr better.

Not much distinction for the "cl_ipaddr" field either. Maybe
cl_formattedlocaladdr, although ugly, would be more descriptive. Or
following the precedent set in the RPC client: cl_local_addrbuf?

> Just replace clp->cl_addr with your usual "print server address"
> routine, increase the size of cl_ipaddr so that it can take an IPv6
> string, and adjust the size of setclientid.sc_name accordingly.

Yep, sounds good.

--
"We who cut mere stones must always be envisioning cathedrals"
-- Quarry worker's creed

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2006-11-03 18:44:34

by J. Bruce Fields

[permalink] [raw]
Subject: Re: Forming an NFSv4 clientid

On Thu, Nov 02, 2006 at 02:24:21PM -0500, Chuck Lever wrote:
> On 11/2/06, Trond Myklebust <[email protected]> wrote:
> >On Thu, 2006-11-02 at 12:53 -0500, Chuck Lever wrote:
> >> While considering what will need to change to support IPv6, I noticed
> >> this logic, which forms the NFSv4 clientid:
> >>
> >> 2927 setclientid.sc_name_len =
> >scnprintf(setclientid.sc_name,
> >> 2928 sizeof(setclientid.sc_name),
> >> "%s/%u.%u.%u.%u %s %u",
> >> 2929 clp->cl_ipaddr,
> >> NIPQUAD(clp->cl_addr.sin_addr),
> >> 2930 cred->cr_ops->cr_name,
> >> 2931 clp->cl_id_uniquifier);
> >>
> >> When would the contents of cl_ipaddr not be the same as the result of
> >> the NIPQUAD? For IPv6, the NIPQUAD will have to be replaced, or
> >> removed. Any suggestions?
> >
> >They are _not_ the same. cl_ipaddr is the client ip address, whereas
> >clp->cl_addr is the server ip address.
>
> The names of these fields are a little confusing.

Completely agreed. I stumble over that regularly.

--b.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2006-11-03 18:47:47

by Trond Myklebust

[permalink] [raw]
Subject: Re: Forming an NFSv4 clientid

On Fri, 2006-11-03 at 13:44 -0500, J. Bruce Fields wrote:
> On Thu, Nov 02, 2006 at 02:24:21PM -0500, Chuck Lever wrote:
> > On 11/2/06, Trond Myklebust <[email protected]> wrote:
> > >On Thu, 2006-11-02 at 12:53 -0500, Chuck Lever wrote:
> > >> While considering what will need to change to support IPv6, I noticed
> > >> this logic, which forms the NFSv4 clientid:
> > >>
> > >> 2927 setclientid.sc_name_len =
> > >scnprintf(setclientid.sc_name,
> > >> 2928 sizeof(setclientid.sc_name),
> > >> "%s/%u.%u.%u.%u %s %u",
> > >> 2929 clp->cl_ipaddr,
> > >> NIPQUAD(clp->cl_addr.sin_addr),
> > >> 2930 cred->cr_ops->cr_name,
> > >> 2931 clp->cl_id_uniquifier);
> > >>
> > >> When would the contents of cl_ipaddr not be the same as the result of
> > >> the NIPQUAD? For IPv6, the NIPQUAD will have to be replaced, or
> > >> removed. Any suggestions?
> > >
> > >They are _not_ the same. cl_ipaddr is the client ip address, whereas
> > >clp->cl_addr is the server ip address.
> >
> > The names of these fields are a little confusing.
>
> Completely agreed. I stumble over that regularly.

I'm always willing to accept patches :-)

Trond


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs