Tech-invite3GPPspaceIETF RFCsSIP
929190898887868584838281807978777675747372717069686766656463626160595857565554535251504948474645444342414039383736353433323130292827262524232221201918171615141312111009080706050403020100
in Index   Prev   Next

RFC 5531

RPC: Remote Procedure Call Protocol Specification Version 2

Pages: 63
Draft Standard
Errata
Obsoletes:  1831
Part 1 of 4 – Pages 1 to 16
None   None   Next

Top   ToC   RFC5531 - Page 1
Network Working Group                                         R. Thurlow
Request for Comments: 5531                              Sun Microsystems
Obsoletes: 1831                                                 May 2009
Category: Standards Track


      RPC: Remote Procedure Call Protocol Specification Version 2

Status of This Memo

   This document specifies an Internet standards track protocol for the
   Internet community, and requests discussion and suggestions for
   improvements.  Please refer to the current edition of the "Internet
   Official Protocol Standards" (STD 1) for the standardization state
   and status of this protocol.  Distribution of this memo is unlimited.

Copyright Notice

   Copyright (c) 2009 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents in effect on the date of
   publication of this document (http://trustee.ietf.org/license-info).
   Please review these documents carefully, as they describe your rights
   and restrictions with respect to this document.

Abstract

This document describes the Open Network Computing (ONC) Remote Procedure Call (RPC) version 2 protocol as it is currently deployed and accepted. This document obsoletes RFC 1831.
Top   ToC   RFC5531 - Page 2

Table of Contents

1. Introduction ....................................................3 1.1. Requirements Language ......................................3 2. Changes since RFC 1831 ..........................................3 3. Terminology .....................................................3 4. The RPC Model ...................................................4 5. Transports and Semantics ........................................5 6. Binding and Rendezvous Independence .............................7 7. Authentication ..................................................7 8. RPC Protocol Requirements .......................................7 8.1. RPC Programs and Procedures ................................8 8.2. Authentication, Integrity, and Privacy .....................9 8.3. Program Number Assignment .................................10 8.4. Other Uses of the RPC Protocol ............................10 8.4.1. Batching ...........................................10 8.4.2. Broadcast Remote Procedure Calls ...................11 9. The RPC Message Protocol .......................................11 10. Authentication Protocols ......................................15 10.1. Null Authentication ......................................15 11. Record Marking Standard .......................................16 12. The RPC Language ..............................................16 12.1. An Example Service Described in the RPC Language .........17 12.2. The RPC Language Specification ...........................18 12.3. Syntax Notes .............................................18 13. IANA Considerations ...........................................19 13.1. Numbering Requests to IANA ...............................19 13.2. Protecting Past Assignments ..............................19 13.3. RPC Number Assignment ....................................19 13.3.1. To be assigned by IANA ............................20 13.3.2. Defined by Local Administrator ....................20 13.3.3. Transient Block ...................................20 13.3.4. Reserved Block ....................................21 13.3.5. RPC Number Sub-Blocks .............................21 13.4. RPC Authentication Flavor Number Assignment ..............22 13.4.1. Assignment Policy .................................22 13.4.2. Auth Flavors vs. Pseudo-Flavors ...................23 13.5. Authentication Status Number Assignment ..................23 13.5.1. Assignment Policy .................................23 14. Security Considerations .......................................24 Appendix A: System Authentication .................................25 Appendix B: Requesting RPC-Related Numbers from IANA .............26 Appendix C: Current Number Assignments ...........................27 Normative References .............................................62 Informative References ...........................................62
Top   ToC   RFC5531 - Page 3

1. Introduction

This document specifies version 2 of the message protocol used in ONC Remote Procedure Call (RPC). The message protocol is specified with the eXternal Data Representation (XDR) language [RFC4506]. This document assumes that the reader is familiar with XDR. It does not attempt to justify remote procedure call systems or describe their use. The paper by Birrell and Nelson [XRPC] is recommended as an excellent background for the remote procedure call concept.

1.1. Requirements Language

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

2. Changes since RFC 1831

This document obsoletes [RFC1831] as the authoritative document describing RPC, without introducing any over-the-wire protocol changes. The main changes from RFC 1831 are: o Addition of an Appendix that describes how an implementor can request new RPC program numbers, authentication flavor numbers, and authentication status numbers from IANA, rather than from Sun Microsystems o Addition of an "IANA Considerations" section that describes past number assignment policy and how IANA is intended to assign them in the future o Clarification of the RPC Language Specification to match current usage o Enhancement of the "Security Considerations" section to reflect experience with strong security flavors o Specification of new authentication errors that are in common use in modern RPC implementations o Updates for the latest IETF intellectual property statements

3. Terminology

This document discusses clients, calls, servers, replies, services, programs, procedures, and versions. Each remote procedure call has two sides: an active client side that makes the call to a server side, which sends back a reply. A network service is a collection of
Top   ToC   RFC5531 - Page 4
   one or more remote programs.  A remote program implements one or more
   remote procedures; the procedures, their parameters, and results are
   documented in the specific program's protocol specification.  A
   server may support more than one version of a remote program in order
   to be compatible with changing protocols.

   For example, a network file service may be composed of two programs.
   One program may deal with high-level applications such as file system
   access control and locking.  The other may deal with low-level file
   input and output and have procedures like "read" and "write".  A
   client of the network file service would call the procedures
   associated with the two programs of the service on behalf of the
   client.

   The terms "client" and "server" only apply to a particular
   transaction; a particular hardware entity (host) or software entity
   (process or program) could operate in both roles at different times.
   For example, a program that supplies remote execution service could
   also be a client of a network file service.

4. The RPC Model

The ONC RPC protocol is based on the remote procedure call model, which is similar to the local procedure call model. In the local case, the caller places arguments to a procedure in some well- specified location (such as a register window). It then transfers control to the procedure, and eventually regains control. At that point, the results of the procedure are extracted from the well- specified location, and the caller continues execution. The remote procedure call model is similar. One thread of control logically winds through two processes: the caller's process and a server's process. The caller first sends a call message to the server process and waits (blocks) for a reply message. The call message includes the procedure's parameters, and the reply message includes the procedure's results. Once the reply message is received, the results of the procedure are extracted, and the caller's execution is resumed. On the server side, a process is dormant awaiting the arrival of a call message. When one arrives, the server process extracts the procedure's parameters, computes the results, sends a reply message, and then awaits the next call message. In this model, only one of the two processes is active at any given time. However, this model is only given as an example. The ONC RPC protocol makes no restrictions on the concurrency model implemented, and others are possible. For example, an implementation may choose
Top   ToC   RFC5531 - Page 5
   to have RPC calls be asynchronous so that the client may do useful
   work while waiting for the reply from the server.  Another
   possibility is to have the server create a separate task to process
   an incoming call so that the original server can be free to receive
   other requests.

   There are a few important ways in which remote procedure calls differ
   from local procedure calls.

   o  Error handling: failures of the remote server or network must be
      handled when using remote procedure calls.

   o  Global variables and side effects: since the server does not have
      access to the client's address space, hidden arguments cannot be
      passed as global variables or returned as side effects.

   o  Performance:  remote procedures usually operate at one or more
      orders of magnitude slower than local procedure calls.

   o  Authentication: since remote procedure calls can be transported
      over unsecured networks, authentication may be necessary.
      Authentication prevents one entity from masquerading as some other
      entity.

   The conclusion is that even though there are tools to automatically
   generate client and server libraries for a given service, protocols
   must still be designed carefully.

5. Transports and Semantics

The RPC protocol can be implemented on several different transport protocols. The scope of the definition of the RPC protocol excludes how a message is passed from one process to another, and includes only the specification and interpretation of messages. However, the application may wish to obtain information about (and perhaps control over) the transport layer through an interface not specified in this document. For example, the transport protocol may impose a restriction on the maximum size of RPC messages, or it may be stream-oriented like TCP [RFC0793] with no size limit. The client and server must agree on their transport protocol choices. It is important to point out that RPC does not try to implement any kind of reliability and that the application may need to be aware of the type of transport protocol underneath RPC. If it knows it is running on top of a reliable transport such as TCP, then most of the work is already done for it. On the other hand, if it is running on
Top   ToC   RFC5531 - Page 6
   top of an unreliable transport such as UDP [RFC0768], it must
   implement its own time-out, retransmission, and duplicate detection
   policies as the RPC protocol does not provide these services.

   Because of transport independence, the RPC protocol does not attach
   specific semantics to the remote procedures or their execution
   requirements.  Semantics can be inferred from (but should be
   explicitly specified by) the underlying transport protocol.  For
   example, consider RPC running on top of an unreliable transport such
   as UDP.  If an application retransmits RPC call messages after time-
   outs, and does not receive a reply, it cannot infer anything about
   the number of times the procedure was executed.  If it does receive a
   reply, then it can infer that the procedure was executed at least
   once.

   A server may wish to remember previously granted requests from a
   client and not regrant them, in order to insure some degree of
   execute-at-most-once semantics.  A server can do this by taking
   advantage of the transaction ID that is packaged with every RPC
   message.  The main use of this transaction ID is by the client RPC
   entity in matching replies to calls.  However, a client application
   may choose to reuse its previous transaction ID when retransmitting a
   call.  The server may choose to remember this ID after executing a
   call and not execute calls with the same ID, in order to achieve some
   degree of execute-at-most-once semantics.  The server is not allowed
   to examine this ID in any other way except as a test for equality.

   On the other hand, if using a "reliable" transport such as TCP, the
   application can infer from a reply message that the procedure was
   executed exactly once, but if it receives no reply message, it cannot
   assume that the remote procedure was not executed.  Note that even if
   a connection-oriented protocol like TCP is used, an application still
   needs time-outs and reconnections to handle server crashes.

   There are other possibilities for transports besides datagram- or
   connection-oriented protocols.  For example, a request-reply protocol
   such as [VMTP] is perhaps a natural transport for RPC.  ONC RPC
   currently uses both TCP and UDP transport protocols.  Section 11
   ("Record Marking Standard") describes the mechanism employed by ONC
   RPC to utilize a connection-oriented, stream-oriented transport such
   as TCP.  The mechanism by which future transports having different
   structural characteristics should be used to transfer ONC RPC
   messages should be specified by means of a Standards Track RFC, once
   such additional transports are defined.
Top   ToC   RFC5531 - Page 7

6. Binding and Rendezvous Independence

The act of binding a particular client to a particular service and transport parameters is NOT part of this RPC protocol specification. This important and necessary function is left up to some higher-level software. Implementors could think of the RPC protocol as the jump-subroutine instruction (JSR) of a network; the loader (binder) makes JSR useful, and the loader itself uses JSR to accomplish its task. Likewise, the binding software makes RPC useful, possibly using RPC to accomplish this task.

7. Authentication

The RPC protocol provides the fields necessary for a client to identify itself to a service, and vice-versa, in each call and reply message. Security and access control mechanisms can be built on top of this message authentication. Several different authentication protocols can be supported. A field in the RPC header indicates which protocol is being used. More information on specific authentication protocols is in Section 8.2, "Authentication, Integrity and Privacy".

8. RPC Protocol Requirements

The RPC protocol must provide for the following: o Unique specification of a procedure to be called o Provisions for matching response messages to request messages o Provisions for authenticating the caller to service and vice-versa Besides these requirements, features that detect the following are worth supporting because of protocol roll-over errors, implementation bugs, user error, and network administration: o RPC protocol mismatches o Remote program protocol version mismatches o Protocol errors (such as misspecification of a procedure's parameters) o Reasons why remote authentication failed o Any other reasons why the desired procedure was not called
Top   ToC   RFC5531 - Page 8

8.1. RPC Programs and Procedures

The RPC call message has three unsigned-integer fields -- remote program number, remote program version number, and remote procedure number -- that uniquely identify the procedure to be called. Program numbers are administered by a central authority (IANA). Once implementors have a program number, they can implement their remote program; the first implementation would most likely have the version number 1 but MUST NOT be the number zero. Because most new protocols evolve, a "version" field of the call message identifies which version of the protocol the caller is using. Version numbers enable support of both old and new protocols through the same server process. The procedure number identifies the procedure to be called. These numbers are documented in the specific program's protocol specification. For example, a file service's protocol specification may state that its procedure number 5 is "read" and procedure number 12 is "write". Just as remote program protocols may change over several versions, the actual RPC message protocol could also change. Therefore, the call message also has in it the RPC version number, which is always equal to 2 for the version of RPC described here. The reply message to a request message has enough information to distinguish the following error conditions: o The remote implementation of RPC does not support protocol version 2. The lowest and highest supported RPC version numbers are returned. o The remote program is not available on the remote system. o The remote program does not support the requested version number. The lowest and highest supported remote program version numbers are returned. o The requested procedure number does not exist. (This is usually a client-side protocol or programming error.) o The parameters to the remote procedure appear to be garbage from the server's point of view. (Again, this is usually caused by a disagreement about the protocol between client and service.)
Top   ToC   RFC5531 - Page 9

8.2. Authentication, Integrity, and Privacy

Provisions for authentication of caller to service and vice-versa are provided as a part of the RPC protocol. The call message has two authentication fields: the credential and the verifier. The reply message has one authentication field: the response verifier. The RPC protocol specification defines all three fields to be the following opaque type (in the eXternal Data Representation (XDR) language [RFC4506]): enum auth_flavor { AUTH_NONE = 0, AUTH_SYS = 1, AUTH_SHORT = 2, AUTH_DH = 3, RPCSEC_GSS = 6 /* and more to be defined */ }; struct opaque_auth { auth_flavor flavor; opaque body<400>; }; In other words, any "opaque_auth" structure is an "auth_flavor" enumeration followed by up to 400 bytes that are opaque to (uninterpreted by) the RPC protocol implementation. The interpretation and semantics of the data contained within the authentication fields are specified by individual, independent authentication protocol specifications. If authentication parameters were rejected, the reply message contains information stating why they were rejected. As demonstrated by RPCSEC_GSS, it is possible for an "auth_flavor" to also support integrity and privacy.
Top   ToC   RFC5531 - Page 10

8.3. Program Number Assignment

Program numbers are given out in groups according to the following chart: 0x00000000 Reserved 0x00000001 - 0x1fffffff To be assigned by IANA 0x20000000 - 0x3fffffff Defined by local administrator (some blocks assigned here) 0x40000000 - 0x5fffffff Transient 0x60000000 - 0x7effffff Reserved 0x7f000000 - 0x7fffffff Assignment outstanding 0x80000000 - 0xffffffff Reserved The first group is a range of numbers administered by IANA and should be identical for all sites. The second range is for applications peculiar to a particular site. This range is intended primarily for debugging new programs. When a site develops an application that might be of general interest, that application should be given an assigned number in the first range. Application developers may apply for blocks of RPC program numbers in the first range by methods described in Appendix B. The third group is for applications that generate program numbers dynamically. The final groups are reserved for future use, and should not be used.

8.4. Other Uses of the RPC Protocol

The intended use of this protocol is for calling remote procedures. Normally, each call message is matched with a reply message. However, the protocol itself is a message-passing protocol with which other (non-procedure-call) protocols can be implemented.

8.4.1. Batching

Batching is useful when a client wishes to send an arbitrarily large sequence of call messages to a server. Batching typically uses reliable byte stream protocols (like TCP) for its transport. In the case of batching, the client never waits for a reply from the server, and the server does not send replies to batch calls. A sequence of batch calls is usually terminated by a legitimate remote procedure call operation in order to flush the pipeline and get positive acknowledgement.
Top   ToC   RFC5531 - Page 11

8.4.2. Broadcast Remote Procedure Calls

In broadcast protocols, the client sends a broadcast call to the network and waits for numerous replies. This requires the use of packet-based protocols (like UDP) as its transport protocol. Servers that support broadcast protocols usually respond only when the call is successfully processed and are silent in the face of errors, but this varies with the application. The principles of broadcast RPC also apply to multicasting -- an RPC request can be sent to a multicast address.

9. The RPC Message Protocol

This section defines the RPC message protocol in the XDR data description language [RFC4506]. enum msg_type { CALL = 0, REPLY = 1 }; A reply to a call message can take on two forms: the message was either accepted or rejected. enum reply_stat { MSG_ACCEPTED = 0, MSG_DENIED = 1 }; Given that a call message was accepted, the following is the status of an attempt to call a remote procedure. enum accept_stat { SUCCESS = 0, /* RPC executed successfully */ PROG_UNAVAIL = 1, /* remote hasn't exported program */ PROG_MISMATCH = 2, /* remote can't support version # */ PROC_UNAVAIL = 3, /* program can't support procedure */ GARBAGE_ARGS = 4, /* procedure can't decode params */ SYSTEM_ERR = 5 /* e.g. memory allocation failure */ }; Reasons why a call message was rejected: enum reject_stat { RPC_MISMATCH = 0, /* RPC version number != 2 */ AUTH_ERROR = 1 /* remote can't authenticate caller */ };
Top   ToC   RFC5531 - Page 12
   Why authentication failed:

      enum auth_stat {
         AUTH_OK           = 0,  /* success                        */
         /*
          * failed at remote end
          */
         AUTH_BADCRED      = 1,  /* bad credential (seal broken)   */
         AUTH_REJECTEDCRED = 2,  /* client must begin new session  */
         AUTH_BADVERF      = 3,  /* bad verifier (seal broken)     */
         AUTH_REJECTEDVERF = 4,  /* verifier expired or replayed   */
         AUTH_TOOWEAK      = 5,  /* rejected for security reasons  */
         /*
          * failed locally
          */
         AUTH_INVALIDRESP  = 6,  /* bogus response verifier        */
         AUTH_FAILED       = 7,  /* reason unknown                 */
         /*
          * AUTH_KERB errors; deprecated.  See [RFC2695]
          */
         AUTH_KERB_GENERIC = 8,  /* kerberos generic error */
         AUTH_TIMEEXPIRE = 9,    /* time of credential expired */
         AUTH_TKT_FILE = 10,     /* problem with ticket file */
         AUTH_DECODE = 11,       /* can't decode authenticator */
         AUTH_NET_ADDR = 12,     /* wrong net address in ticket */
         /*
          * RPCSEC_GSS GSS related errors
          */
         RPCSEC_GSS_CREDPROBLEM = 13, /* no credentials for user */
         RPCSEC_GSS_CTXPROBLEM = 14   /* problem with context */
      };

   As new authentication mechanisms are added, there may be a need for
   more status codes to support them.  IANA will hand out new auth_stat
   numbers on a simple First Come First Served basis as defined in the
   "IANA Considerations" and Appendix B.

   The RPC message:

   All messages start with a transaction identifier, xid, followed by a
   two-armed discriminated union.  The union's discriminant is a
   msg_type that switches to one of the two types of the message.  The
   xid of a REPLY message always matches that of the initiating CALL
   message.  NB: The "xid" field is only used for clients matching reply
   messages with call messages or for servers detecting retransmissions;
   the service side cannot treat this id as any type of sequence number.
Top   ToC   RFC5531 - Page 13
         struct rpc_msg {
            unsigned int xid;
            union switch (msg_type mtype) {
            case CALL:
               call_body cbody;
            case REPLY:
               reply_body rbody;
            } body;
         };

   Body of an RPC call:

   In version 2 of the RPC protocol specification, rpcvers MUST be equal
   to 2.  The fields "prog", "vers", and "proc" specify the remote
   program, its version number, and the procedure within the remote
   program to be called.  After these fields are two authentication
   parameters: cred (authentication credential) and verf (authentication
   verifier).  The two authentication parameters are followed by the
   parameters to the remote procedure, which are specified by the
   specific program protocol.

   The purpose of the authentication verifier is to validate the
   authentication credential.  Note that these two items are
   historically separate, but are always used together as one logical
   entity.

        struct call_body {
           unsigned int rpcvers;       /* must be equal to two (2) */
           unsigned int prog;
           unsigned int vers;
           unsigned int proc;
           opaque_auth cred;
           opaque_auth verf;
           /* procedure-specific parameters start here */
        };

   Body of a reply to an RPC call:

         union reply_body switch (reply_stat stat) {
         case MSG_ACCEPTED:
            accepted_reply areply;
         case MSG_DENIED:
            rejected_reply rreply;
         } reply;
Top   ToC   RFC5531 - Page 14
   Reply to an RPC call that was accepted by the server:

   There could be an error even though the call was accepted.  The first
   field is an authentication verifier that the server generates in
   order to validate itself to the client.  It is followed by a union
   whose discriminant is an enum accept_stat.  The SUCCESS arm of the
   union is protocol-specific.  The PROG_UNAVAIL, PROC_UNAVAIL,
   GARBAGE_ARGS, and SYSTEM_ERR arms of the union are void.  The
   PROG_MISMATCH arm specifies the lowest and highest version numbers of
   the remote program supported by the server.

         struct accepted_reply {
            opaque_auth verf;
            union switch (accept_stat stat) {
            case SUCCESS:
               opaque results[0];
               /*
                * procedure-specific results start here
                */
             case PROG_MISMATCH:
                struct {
                   unsigned int low;
                   unsigned int high;
                } mismatch_info;
             default:
                /*
                 * Void.  Cases include PROG_UNAVAIL, PROC_UNAVAIL,
                 * GARBAGE_ARGS, and SYSTEM_ERR.
                 */
                void;
             } reply_data;
         };

   Reply to an RPC call that was rejected by the server:

   The call can be rejected for two reasons: either the server is not
   running a compatible version of the RPC protocol (RPC_MISMATCH) or
   the server rejects the identity of the caller (AUTH_ERROR).  In case
   of an RPC version mismatch, the server returns the lowest and highest
   supported RPC version numbers.  In case of invalid authentication,
   failure status is returned.
Top   ToC   RFC5531 - Page 15
         union rejected_reply switch (reject_stat stat) {
         case RPC_MISMATCH:
            struct {
               unsigned int low;
               unsigned int high;
            } mismatch_info;
         case AUTH_ERROR:
            auth_stat stat;
         };

10. Authentication Protocols

As previously stated, authentication parameters are opaque, but open-ended to the rest of the RPC protocol. This section defines two standard flavors of authentication. Implementors are free to invent new authentication types, with the same rules of flavor number assignment as there are for program number assignment. The flavor of a credential or verifier refers to the value of the "flavor" field in the opaque_auth structure. Flavor numbers, like RPC program numbers, are also administered centrally, and developers may assign new flavor numbers by methods described in Appendix B. Credentials and verifiers are represented as variable-length opaque data (the "body" field in the opaque_auth structure). In this document, two flavors of authentication are described. Of these, Null authentication (described in the next subsection) is mandatory -- it MUST be available in all implementations. System authentication (AUTH_SYS) is described in Appendix A. Implementors MAY include AUTH_SYS in their implementations to support existing applications. See "Security Considerations" for information about other, more secure, authentication flavors.

10.1. Null Authentication

Often, calls must be made where the client does not care about its identity or the server does not care who the client is. In this case, the flavor of the RPC message's credential, verifier, and reply verifier is "AUTH_NONE". Opaque data associated with "AUTH_NONE" is undefined. It is recommended that the length of the opaque data be zero.
Top   ToC   RFC5531 - Page 16

11. Record Marking Standard

When RPC messages are passed on top of a byte stream transport protocol (like TCP), it is necessary to delimit one message from another in order to detect and possibly recover from protocol errors. This is called record marking (RM). One RPC message fits into one RM record. A record is composed of one or more record fragments. A record fragment is a four-byte header followed by 0 to (2**31) - 1 bytes of fragment data. The bytes encode an unsigned binary number; as with XDR integers, the byte order is from highest to lowest. The number encodes two values -- a boolean that indicates whether the fragment is the last fragment of the record (bit value 1 implies the fragment is the last fragment) and a 31-bit unsigned binary value that is the length in bytes of the fragment's data. The boolean value is the highest-order bit of the header; the length is the 31 low-order bits. (Note that this record specification is NOT in XDR standard form!)


(page 16 continued on part 2)

Next Section