Print this page
3910 t_look(3NSL) should never return T_ERROR


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*

  23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  27 /* All Rights Reserved */
  28 /*
  29  * Portions of this source code were derived from Berkeley
  30  * 4.3 BSD under license from the Regents of the University of
  31  * California.
  32  */
  33 
  34 /*
  35  * svc_dg.c, Server side for connectionless RPC.
  36  *
  37  * Does some caching in the hopes of achieving execute-at-most-once semantics.
  38  */
  39 
  40 #include "mt.h"
  41 #include "rpc_mt.h"
  42 #include <stdio.h>


 367         struct netconfig *nconf;
 368 
 369         /* XXX: tudata should have been made a part of the server handle */
 370         if (tu_data->addr.maxlen == 0)
 371                 tu_data->addr = xprt->xp_rtaddr;
 372 again:
 373         tu_data->addr.len = 0;
 374         tu_data->opt.len  = 0;
 375         tu_data->udata.len  = 0;
 376 
 377         moreflag = 0;
 378         if (t_rcvudata(xprt->xp_fd, tu_data, &moreflag) == -1) {
 379 #ifdef RPC_DEBUG
 380                 syslog(LOG_ERR, "svc_dg_recv: t_rcvudata t_errno=%d errno=%d\n",
 381                     t_errno, errno);
 382 #endif
 383                 if (t_errno == TLOOK) {
 384                         int lookres;
 385 
 386                         lookres = t_look(xprt->xp_fd);
 387                         if ((lookres & T_UDERR) &&
 388                             (t_rcvuderr(xprt->xp_fd,
 389                                     (struct t_uderr *)0) < 0)) {
 390                                 /*EMPTY*/
 391 #ifdef RPC_DEBUG
 392                                 syslog(LOG_ERR,
 393                                 "svc_dg_recv: t_rcvuderr t_errno = %d\n",
 394                                         t_errno);
 395 #endif
 396                         }
 397                         if (lookres & T_DATA)
 398                                 goto again;
 399                 } else if ((errno == EINTR) && (t_errno == TSYSERR))
 400                         goto again;
 401                 else {
 402                         return (FALSE);
 403                 }
 404         }
 405 
 406         if ((moreflag) ||
 407             (tu_data->udata.len < 4 * (uint_t)sizeof (uint32_t))) {
 408                 /*
 409                  * If moreflag is set, drop that data packet. Something wrong
 410                  */
 411                 return (FALSE);
 412         }
 413         su->optbuf = tu_data->opt;
 414         xprt->xp_rtaddr.len = tu_data->addr.len;
 415         xdrs->x_op = XDR_DECODE;
 416         XDR_SETPOS(xdrs, 0);
 417         if (!xdr_callmsg(xdrs, msg))




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2014 Gary Mills
  24  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  25  * Use is subject to license terms.
  26  */
  27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  28 /* All Rights Reserved */
  29 /*
  30  * Portions of this source code were derived from Berkeley
  31  * 4.3 BSD under license from the Regents of the University of
  32  * California.
  33  */
  34 
  35 /*
  36  * svc_dg.c, Server side for connectionless RPC.
  37  *
  38  * Does some caching in the hopes of achieving execute-at-most-once semantics.
  39  */
  40 
  41 #include "mt.h"
  42 #include "rpc_mt.h"
  43 #include <stdio.h>


 368         struct netconfig *nconf;
 369 
 370         /* XXX: tudata should have been made a part of the server handle */
 371         if (tu_data->addr.maxlen == 0)
 372                 tu_data->addr = xprt->xp_rtaddr;
 373 again:
 374         tu_data->addr.len = 0;
 375         tu_data->opt.len  = 0;
 376         tu_data->udata.len  = 0;
 377 
 378         moreflag = 0;
 379         if (t_rcvudata(xprt->xp_fd, tu_data, &moreflag) == -1) {
 380 #ifdef RPC_DEBUG
 381                 syslog(LOG_ERR, "svc_dg_recv: t_rcvudata t_errno=%d errno=%d\n",
 382                     t_errno, errno);
 383 #endif
 384                 if (t_errno == TLOOK) {
 385                         int lookres;
 386 
 387                         lookres = t_look(xprt->xp_fd);
 388                         if ((lookres == T_UDERR) &&
 389                             (t_rcvuderr(xprt->xp_fd,
 390                                     (struct t_uderr *)0) < 0)) {
 391                                 /*EMPTY*/
 392 #ifdef RPC_DEBUG
 393                                 syslog(LOG_ERR,
 394                                 "svc_dg_recv: t_rcvuderr t_errno = %d\n",
 395                                         t_errno);
 396 #endif
 397                         }
 398                         if (lookres == T_DATA)
 399                                 goto again;
 400                 } else if ((errno == EINTR) && (t_errno == TSYSERR))
 401                         goto again;
 402                 else {
 403                         return (FALSE);
 404                 }
 405         }
 406 
 407         if ((moreflag) ||
 408             (tu_data->udata.len < 4 * (uint_t)sizeof (uint32_t))) {
 409                 /*
 410                  * If moreflag is set, drop that data packet. Something wrong
 411                  */
 412                 return (FALSE);
 413         }
 414         su->optbuf = tu_data->opt;
 415         xprt->xp_rtaddr.len = tu_data->addr.len;
 416         xdrs->x_op = XDR_DECODE;
 417         XDR_SETPOS(xdrs, 0);
 418         if (!xdr_callmsg(xdrs, msg))