Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/rpc For an accepted connection (tcp), set xp_netid, ...



details:   https://anonhg.NetBSD.org/src/rev/471703cc0998
branches:  trunk
changeset: 495683:471703cc0998
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Thu Aug 03 00:01:53 2000 +0000

description:
For an accepted connection (tcp), set xp_netid, as it might be examined
by some applications, most notably rpcbind.

diffstat:

 lib/libc/rpc/svc_vc.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r 450e3feb1d64 -r 471703cc0998 lib/libc/rpc/svc_vc.c
--- a/lib/libc/rpc/svc_vc.c     Wed Aug 02 23:51:07 2000 +0000
+++ b/lib/libc/rpc/svc_vc.c     Thu Aug 03 00:01:53 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svc_vc.c,v 1.6 2000/07/08 11:41:50 kleink Exp $        */
+/*     $NetBSD: svc_vc.c,v 1.7 2000/08/03 00:01:53 fvdl Exp $  */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
 static char *sccsid = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
 static char *sccsid = "@(#)svc_tcp.c   2.2 88/08/01 4.0 RPCSRC";
 #else
-__RCSID("$NetBSD: svc_vc.c,v 1.6 2000/07/08 11:41:50 kleink Exp $");
+__RCSID("$NetBSD: svc_vc.c,v 1.7 2000/08/03 00:01:53 fvdl Exp $");
 #endif
 #endif
 
@@ -252,12 +252,14 @@
 {
        SVCXPRT *xprt;
        struct cf_conn *cd;
+       const char *netid;
+       struct __rpc_sockinfo si;
  
        _DIAGASSERT(fd != -1);
 
        xprt = mem_alloc(sizeof(SVCXPRT));
        if (xprt == NULL) {
-               warnx("svc_tcp: makefd_xprt: out of memory");
+               warnx("svc_vc: makefd_xprt: out of memory");
                goto done;
        }
        memset(xprt, 0, sizeof *xprt);
@@ -276,6 +278,9 @@
        svc_vc_ops(xprt);  /* truely deals with calls */
        xprt->xp_port = 0;  /* this is a connection, not a rendezvouser */
        xprt->xp_fd = fd;
+        if (__rpc_fd2sockinfo(fd, &si) && __rpc_sockinfo2netid(&si, &netid))
+               xprt->xp_netid = strdup(netid);
+
        xprt_register(xprt);
 done:
        return (xprt);



Home | Main Index | Thread Index | Old Index