Improve refcnt traceability and fix rpc_dplx_unref.

Increase caller location information in SVC_REF, SVC_RELEASE,
and SVC_DESTROY macros.

In addition to location, conditional tracing of caller remote
address and port are added.

Fix lost lock in rpc_dplx_unref.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Conflicts:
	src/clnt_internal.h
	src/clnt_vc.c
	src/svc_vc.c

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Remove vestigial _USE_TIRPC_IPV6 preprocessor conditional.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Update newxprt->lt_addr on accept (svc_vc)

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Add svc_getlocal_netbuf.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Client handle cardinality (svc_vc).

In order to support multiple client sessions on a single
connection, permit a caller to create additional client handles,
moving serialized call data (e.g., program number) into a
new ct_serialized structure.  This is linked from a new cl_p3
private member.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Unify svc_vc shared data handling.

This change both removes a trivial crash due to inconsistent
initialization of shared data, and while doing this, makes all
related code more uniform.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Implement rpcb_find_mapped_addr.

Designed to simplify lookup of mapped addresses by an NLM client.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix a portability issue in svc_dg_recv().

Signed-off-by: Sachin Bhamare <sbhamare@panasas.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>
In pmap_set(), make sure to use correct version of INADDR_ANY.

Signed-off-by: Sachin Bhamare <sbhamare@panasas.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Track source address and port on UDP requests (svc_dg).

WARNING!  This is a significant API change, as the svc_dg
caller is required to free rq_rtaddr, if assigned.

The decision to to store this information in an opaque form
might not be ideal, but is consistent with current transport
handle logic, so makes sense for now.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Conflicts:
	src/svc_dg.c

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Lock-free encoding and independent svc reply queue.

Implements an out-of-line, blocking reply queue for svc_vc
transports.

It -would- appear logical to add an xdr_ioq_truncate operation
permitting a caller to discard bytes at the end of the stream, if
the need for it arose.

Works, maybe consolidate vrec->off and vrec->len, which now appear the
same.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Conflicts:
	src/clnt_vc.c
	src/svc_vc.c

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Add extend-buffer interface.

As a workaround for current GSS mic and wrap interfaces which
cannot deal with segmented buffers, allow growing a single buffer
segment.

Use this only when auth flavor is RPCSEC_GSS.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Avoid use of uninitialized __rpc_sockinfo.

Moves __rpc2sockinfo call up in makefd_xprt.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix refcnt underruns.

The initial refcnt should be 1, not 0.  Also, must be initialized
in vrec_next, in the non-extend case.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Dont smash the stack in ioq_flushv.

There is no way to assume an iovcnt in advance, but it will be
small.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Use configured sendsize + 8K for ioq max segment size.

Pending support for GSSAPI iov interfaces, svc_vc_reply ecodes
in one buffer segment.  Since most replies are small, an initial
buffer segment of 8K ("page size") is tried first.  If a reply
would exceed this, it is reallocated with a larger size, which
with this change, is of length MaxRPCSendBufferSize + 8K.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Remove unused VREC_NIOVS.

(Rebaseme.)

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix buffer advance logic, plus refactor vrec_next.

Add missing advance of user-supplied buffer position on
segment advance (xdr_ioq_getbytes, xdr_ioq_putbytes).

Also reorganize vrec_next, which had acquired a special
case in its prologue.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Drain svc_ioq on svc_shutdown().

Waits 1s, then inifinite in 5s increments, for the ioq
to drain.

Also fixes a deadlock condition in svc_xprt_shutdown(),
which called SVC_DESTROY while holding the transport fd
rec locked.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix IOQ_FLAG_REALLOC cases in vrec_next.

The realloc path is taken only when using RPCSEC_GSS protection,
and will be avoided when we have an iovec equivalent to gss_getmic,
or workaround.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>