AAA Working Group Pat R. Calhoun Internet-Draft Sun Microsystems, Inc. Category: Standards Track Haseeb Akhtar Nortel Networks Jari Arkko Oy LM Ericsson Ab Erik Guttman Sun Microsystems, Inc. Allan C. Rubens Tut Systems, Inc. Glen Zorn Cisco Systems, Inc. May 2001 Diameter Base Protocol Status of this Memo This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC2026. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at: http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet-Draft Shadow Directories can be accessed at: http://www.ietf.org/shadow.html. Distribution of this memo is unlimited. Copyright (C) The Internet Society 2001. All Rights Reserved. Abstract The Diameter base protocol is intended to provide a AAA framework for Calhoun et al. expires October 2001 [Page 1] Internet-Draft May 2001 Mobile-IP, NASREQ and ROAMOPS. This draft specifies the message format, transport, error reporting and security services to be used by all Diameter extensions and MUST be supported by all Diameter implementations. Calhoun et al. expires October 2001 [Page 2] Internet-Draft May 2001 Table of Contents 1.0 Introduction 1.1 Diameter Protocol 1.2 Requirements language 1.3 Terminology 2.0 Protocol Overview 2.1 Transport 2.2 Securing Diameter Messages 2.3 Diameter Protocol Extensibility 2.3.1 Defining new AVP Values 2.3.2 Creating new AVPs 2.3.3 Creating a new Diameter extension 2.3.4 Extension authentication procedures 2.4 Diameter Extensions 2.5 Diameter Server Discovery 3.0 Diameter Header 3.1 Command Code Definitions 3.2 Command Code ABNF specification 3.3 Diameter Command Naming Conventions 3.3.1 Request/Answer 3.3.2 Indication/Failed Indication 4.0 Diameter AVPs 4.1 AVP Header 4.2 Optional Header Elements 4.3 AVP Data Formats 4.4 Grouped AVP Values 4.4.1 Example AVP with a Grouped Data type 4.5 Diameter Base Protocol AVPs 5.0 Message Forwarding 5.1 Origin-FQDN AVP 5.2 Origin-Realm AVP 5.3 Destination-FQDN AVP 6.0 Capabilities Negotiation 6.1 Extension Identifiers 6.2 Device-Reboot-Ind (DRI) Command 6.2.1 Vendor-Id AVP 6.2.2 Firmware-Revision AVP 6.2.3 Auth-Extension-Id AVP 6.2.4 Host-IP-Address AVP 6.2.5 Supported-Vendor-Id AVP 6.2.6 Product-Name AVP 6.2.7 Acct-Extension-Id AVP 7.0 Transport Failure Detection 7.1 Device-Watchdog-Request 7.2 Device-Watchdog-Answer 7.3 Failover/Failback Procedures 8.0 Peer State Machine Calhoun et al. expires October 2001 [Page 3] Internet-Draft May 2001 8.1 States 8.2 Events 8.3 Actions 8.4 The Election Process 9.0 Error Handling 9.1 End-to-End Error Handling 9.1.1 Result-Code AVP 9.1.1.1 Informational 9.1.1.2 Success 9.1.1.3 Transient Failures 9.1.1.4 Permanent Failures 9.1.2 Error-Message AVP 9.1.3 Error-Reporting-FQDN AVP 9.2 Hop-by-Hop Error Handling 9.2.1 Device-Status-Ind 9.2.2 DSI-Event AVP 9.2.2.1 Informational Events 9.2.2.2 Redirect Event 9.2.2.3 Transient Failure Events 9.2.2.4 Permanent Failure Events 9.3 Failed-AVP AVP 9.4 Offending-AVP AVP 9.5 Failed-Vendor-Id AVP 10.0 "User" Sessions 10.1 Authorization Session State Machine 10.2 Accounting Session State Machine 10.3 Session-Id AVP 10.4 Authorization-Lifetime AVP 10.5 Session-Timeout AVP 10.6 User-Name AVP 10.7 Max-Wait-Time AVP 10.8 Session Termination 10.8.1 Session-Termination-Ind 10.8.2 Session-Termination-Request 10.8.3 Session-Termination-Answer 11.0 Message Routing 11.1 Realm-Based Message Routing 11.1.1 Realm-Based Routing Table 11.2 Proxy and Redirect Server handling of requests 11.3 Redirect Server 11.3.1 Redirect-Host AVP 11.3.2 Redirect-Host-Address AVP 11.3.3 Redirect-Host-Port AVP 11.4 Proxy Server 11.4.1 Proxying Request and Indication messages 11.4.2 Proxying Answer and Failed Ind messages 11.4.3 Route-Record AVP 11.4.4 Proxy-Info AVP Calhoun et al. expires October 2001 [Page 4] Internet-Draft May 2001 11.4.5 Proxy-Address AVP 11.4.6 Proxy-State AVP 11.4.7 Destination-Realm AVP 11.5 Applying Local Policies 11.6 Hiding Network Topology 11.7 Loop Detection 12.0 Accounting 12.1 Server Directed Model 12.2 Protocol Messages 12.3 Extension document requirements 12.4 Fault Resilience 12.5 Accounting Records 13.0 Accounting Command-Codes 13.1 Accounting-Request (ACR) Command 13.2 Accounting-Answer (ACA) Command 13.3 Accounting-Status-Ind (ASI) Command 13.4 Accounting-Poll-Ind (API) Command 14.0 Accounting AVPs 14.1 Accounting-Record-Type AVP 14.2 Accounting-Interim-Interval AVP 14.3 Accounting-Record-Number AVP 14.4 Accounting-State AVP 14.5 Accounting-Session-Id AVP 15.0 AVP Occurrence Table 15.1 Base Protocol Command AVP Table 15.2 Accounting AVP Table 16.0 IANA Considerations 16.1 AVP Header 16.1.1 AVP Code 16.1.2 AVP Flags 16.2 Diameter Header 16.2.1 Command Codes 16.2.2 Message Flags 16.3 Extension Identifier Values 16.4 Result-Code AVP Values 16.5 DSI-Event AVP Values 16.6 Accounting-State AVP Values 16.7 Accounting-Record-Type AVP Values 16.8 Diameter TCP/SCTP Port Numbers 17.0 Open Issues 18.0 Diameter protocol related configurable parameters 19.0 Security Considerations 20.0 References 21.0 Acknowledgements 22.0 Authors' Addresses 23.0 Full Copyright Statement Appendix A. Diameter Service Template Calhoun et al. expires October 2001 [Page 5] Internet-Draft May 2001 1.0 Introduction Historically, the RADIUS protocol has been used to provide AAA services for dial-up PPP [42] and terminal server access. Over time, routers and network access servers (NAS) have increased in complexity and density, making the RADIUS protocol increasingly unsuitable for use in such networks. The Roaming Operations Working Group (ROAMOPS) has published a set of specifications [20, 43, 44] that define how a PPP user can gain access to the Internet without having to dial into his/her home service provider's modem pool. This is achieved by allowing service providers to cross-authenticate their users. Effectively, a user can dial into any service provider's point of presence (POP) that has a roaming agreement with his/her home Internet service provider (ISP), the benefit being that the user does not have to incur a long distance charge while traveling, which can sometimes be quite expensive. Given the number of ISPs today, ROAMOPS realized that requiring each ISP to set up roaming agreements with all other ISPs did not scale. Therefore, the working group defined a "broker", which acts as an intermediate server, whose sole purpose is to set up these roaming agreements. A collection of ISPs and a broker is called a "roaming consortium". There are many such brokers in existence today; many also provide settlement services for member ISPs. The Mobile-IP Working Group has recently changed its focus to inter administrative domain mobility, which is a requirement for cellular carriers wishing to deploy IETF-based mobility protocols. The current cellular carriers requirements [22, 23] are very similar to the ROAMOPS model, with the exception that the access protocol is Mobile-IP [45] instead of PPP. The Diameter protocol was not designed from the ground up. Instead, the basic RADIUS model was retained while fixing the flaws in the RADIUS protocol itself. Diameter does not share a common protocol data unit (PDU) with RADIUS, but does borrow sufficiently from the protocol to ease migration. The basic concept behind Diameter is to provide a base protocol that can be extended in order to provide AAA services to new access technologies. Currently, the protocol only concerns itself with Internet access, both in the traditional PPP sense as well as taking into account the ROAMOPS model, and Mobile-IP. Although Diameter could be used to solve a wider set of AAA problems, we are currently limiting the scope of the protocol in order to Calhoun et al. expires October 2001 [Page 6] Internet-Draft May 2001 ensure that the effort remains focused on satisfying the requirements of network access. Note that a truly generic AAA protocol used by many applications might provide functionality not provided by Diameter. Therefore, it is imperative that the designers of new applications understand their requirements before using Diameter. 1.1 Diameter Protocol The Diameter protocol allows peers to exchange a variety of messages. The base protocol provides the following facilities: - Delivery of AVPs (attribute value pairs) - Capabilities negotiation, as required in [20] - Error notification - Extensibility, through addition of new commands and AVPs, as required in [21] All data delivered by the protocol is in the form of an AVP. Some of these AVP values are used by the Diameter protocol itself, while others deliver data associated with particular applications which employ Diameter. AVPs may be added arbitrarily to Diameter messages, so long as the required AVPs are included and AVPs which are explicitly excluded are not included. AVPs are used by base Diameter protocol to support the following required features: - Transporting of user authentication information, for the purposes of enabling the Diameter server to authenticate the user. - Transporting of service specific authorization information, between client and servers, allowing the peers to decide whether a user's access request should be granted. - Exchanging resource usage information, which MAY be used for accounting purposes, capacity planning, etc. - Proxying and Re-directing of Diameter messages through a server hierarchy. The Diameter base protocol provides the minimum requirements needed for an AAA transport protocol, as required by NASREQ [21], Mobile IP [22, 23], and ROAMOPS [20]. The base protocol is not intended to be used by itself, and must be used with an application-specific extension, such as Mobile IP [10]. The Diameter protocol was heavily inspired and builds upon the tradition of the RADIUS [1] protocol. See section 2.4. for more information on Diameter extensions. Any node can initiate a request. In that sense, Diameter is a peer to peer protocol. In this document, a Diameter client is the device that normally initiates a request for authentication and/or authorization Calhoun et al. expires October 2001 [Page 7] Internet-Draft May 2001 of a user. A Diameter server is the device that either forwards the request to another Diameter server (known as a proxy), or one that performs the actual authentication and/or authorization of the user based on some profile. Given that the server MAY send unsolicited messages to clients, it is possible for the server to initiate such messages. An example of an unsolicited message would be for a request that the client issue an accounting update. 1.2 Requirements language In this document, the key words "MAY", "MUST", "MUST NOT", "optional", "recommended", "SHOULD", and "SHOULD NOT", are to be interpreted as described in [13]. 1.3 Terminology Accounting The act of collecting information on resource usage for the purpose of trend analysis, auditing, billing, or cost allocation. Accounting record A session record represents a summary of the resource consumption of a user over the entire session. Accounting gateways creating the session record may do so by processing interim accounting events or accounting events from several Authentication The act of verifying the identity of an entity (subject). Authorization The act of determining whether a requesting entity (subject) will be allowed access to a resource (object). AVP The Diameter protocol consists of a header followed by one or more Attribute-Value-Pair (AVP). The AVP includes a header and is used to encapsulation authentication, authorization or accounting information. Broker A broker is a business term commonly used in AAA infrastructures. A broker is either a proxy or redirect server, and MAY be operated by roaming consortiums. Diameter Client Calhoun et al. expires October 2001 [Page 8] Internet-Draft May 2001 A Diameter Client is a device at the edge of the network that performs access control. An example of a Diameter client is a Network Access Server (NAS) or a Foreign Agent (FA). Diameter Server A Diameter server is a device that is not acting as a NAS or FA. Servers can be proxy, redirect, or home servers Downstream Server Diameter Proxy servers identify a downstream server as one that is providing routing services towards the Diameter client. Home Domain A Home Domain is the administrative domain with whom the user maintains an account relationship. Home Server A Diameter Home Server is one that authenticates and/or authorizes access for users of a particular realm. The same server MAY also act as a proxy or redirect server for other realms, in which case it is not acting as a Home Server for these realms. Interim accounting An interim accounting message provides a snapshot of usage during a user's session. It is typically implemented in order to provide for partial accounting of a user's session in the event of a device reboot or other network problem that prevents the reception of a session summary message or session record. Local Domain A local domain is the administrative domain providing services to a user. An administrative domain MAY act as a local domain for certain users, while being a home domain for others. Network Access Identifier The Network Access Identifier, or NAI [3], is used in the Diameter protocol to extract a user's identity and realm. The identity is used to identify the user during authentication and/or authorization, while the realm is used for message routing purposes. Proxy Server A proxy server ”ses the realm portion of the NAI to route Diameter messages. Proxy servers are typically used to minimize the number of security relationships that are required between Diameter servers. Realm Calhoun et al. expires October 2001 [Page 9] Internet-Draft May 2001 The string in the NAI that immediately follows the '@' character. NAI realm names are required to be unique, and are piggybacked on the administration of the DNS namespace. Diameter makes use of the realm, also loosely referred to as domain, to determine whether messages can be satisfied locally, or whether they must be proxied. Real-time Accounting Real-time accounting involves the processing of information on resource usage within a defined time window. Time constraints are typically imposed in order to limit financial risk. Redirect Server A Diameter redirect server provides realm to address translation, by returning information necessary for Diameter peers to communicate directly. Redirect servers are different from proxies since they do not participate in the routing of messages between end Diameter nodes. Roaming Relationships Roaming relationships include relationships between companies and ISPs, relationships among peer ISPs within a roaming association, and relationships between an ISP and a roaming consortia. Together, the set of relationships forming a path between a local ISP's authentication proxy and the home authentication server is known as the roaming relationship path. Session The Diameter protocol is session based. When an authorization request is initially transmitted, it includes a session identifier that is used for the duration of the session. The Session- Identifier AVP contains the identifier and must be globally unique. devices serving the same user. Upstream Server Diameter Proxy servers identify an upstream server as one that is providing routing services towards the home server for a particular message. 2.0 Protocol Overview The base Diameter protocol is never used on its own. It is always extended for a particular application. Three extensions to Diameter are defined by companion documents: NASREQ [7], Mobile IP [10], End-to-End Security [11]. These options are introduced in this document but specified elsewhere. Additional extensions to Diameter may be defined in the future (see Section 16.3). Calhoun et al. expires October 2001 [Page 10] Internet-Draft May 2001 Diameter servers MUST support the Base protocol, which includes Accounting, and both the NASREQ and Mobile IP extensions. Diameter Clients MUST support the Base protocol, including Accounting, and MAY support any other extension that would be required to provide service. The base Diameter protocol concerns itself with capabilities negotiation, and how messages are sent and how peers may eventually be abandoned. The base protocol also defines certain rules which apply to all exchanges of messages between Diameter peers. Communication between Diameter peers begins with one peer sending a message to another Diameter peer. The set of AVPs included in the message is determined by a particular application of or extension to Diameter. We will refer to this as the Diameter extension. One AVP that is included to reference a user's session is the Session-Id. The initial request for authentication and/or authorization of a user would include the Session-Id. The Session-Id is then used in all subsequent messages to identify the user's session (see section 10.0 for more information). The communicating party may accept the request, or reject it by returning a response with Result-Code AVP set to indicate an error occurred. The specific behavior of the diameter server or client receiving a request depends on the Diameter extension employed. Session state (associated with a Session-Id) MUST be freed upon receipt of the Session-Termination-Request, Session-Termination- Answer, expiration of authorized service time in the Session-Timeout AVP, and according to rules established in a particular extension/application of Diameter. Exchanges of messages are either request/reply oriented, or in some special cases, do not require replies. All such messages that do not require replies have names ending with '-Ind' (short for Indication). The Diameter base protocol provides the Authorization-Lifetime AVP, which MAY be used by extensions to specify the duration of a specific authorized session. 2.1 Transport The base Diameter protocol is run on port TBD of both TCP [27] and SCTP [26] transport protocols (for interoperability test purposes port 1812 will be used until IANA assigns a port to the protocol). Diameter clients SHOULD support SCTP, but MUST support TCP if SCTP is not available. future versions of this specification may mandate that Calhoun et al. expires October 2001 [Page 11] Internet-Draft May 2001 clients support SCTP. Diameter servers MUST support both TCP and SCTP. A Diameter node MAY initiate connections from any source port, but MUST be prepared to receive connections on port TBD. Note that the source and destination addresses used in request and replies MAY any of a peer's valid IP addresses. A given Diameter process SHOULD use the same port number to send all messages to aid in identifying which process sent a given message. More than one Diameter process MAY exist within a single host, so the sender's port number is needed to discriminate them. When no transport connection exists with a peer, an attempt to connect SHOULD be periodically attempted. The recommended connection interval is 30 seconds. 2.2 Securing Diameter Messages All Diameter messages MUST be secured between peers, and both TLS [38] and IP Security [37] are supported. Network Access Servers (NASes) and Foreign Agents, commonly referred to as clients, MUST support IP Security, while servers MUST support both TLS and IP Security. The communication between a client and server MUST use IP Security, while communication between servers MUST use TLS. All hosts running the Diameter protocol MUST have the necessary security policies to ensure that unauthenticated Diameter packets are not processed. 2.3 Diameter Protocol Extensibility There are various ways the Diameter protocol can be extended. This section is intended to assist protocol designers in selecting the best method of using the Diameter protocol. 2.3.1 Defining new AVP Values Defining a new AVP value is the best approach when a new application needs to make use of an existing Diameter extension, but requires that an existing AVP communicate different service-specific information (e.g. NAS-Port-Type set to avian carriers). When an existing AVP can be used to communicate the new information, this approach is preferred over creating new AVPs. Calhoun et al. expires October 2001 [Page 12] Internet-Draft May 2001 In order to allocate a new AVP value, a request MUST be sent to IANA, with a detailed explanation of the value. Furthermore, if the command code on which the AVP value is to be used would require a different set of mandatory AVPs be present, the list of AVPs must accompany the request. 2.3.2 Creating new AVPs New AVPs may be created when a new application requiring Diameter support can make use of an existing Diameter extension, but requires new AVPs to communicate service-specific information. Prior to defining the AVP, the AVP type MUST be one of the types listed in section 4.3. In the event that a logical grouping of AVPs is necessary, and multiple "groups" are possible in a given command, it is highly recommended that a Grouped AVP be used (see Section 4.4). In order to create a new AVP, a request MUST be sent to IANA, with a detailed explanation of the AVP, its type and possible values. Furthermore, the request MUST include the commands that would make use of the AVP. Note that new AVPS to be used with an existing extension MUST NOT be defined to have the 'M'andatory bit set. 2.3.3 Creating new Diameter extensions Should a new application require Diameter support, but it cannot fit within an existing extension without requiring major changes to the specification, it may be desirable to create a new Diameter extension. Major changes to an extension include: - Requiring a whole different set of mandatory AVPs to a command - Requiring a command that has a different number of round trips to satisfy a request (e.g. Extension foo has a command that requires one round trip, but new extension bar has a command that requires two round trips to complete). - The method used to authenticate the user is drastically different from any existing extension, and the authentication information cannot be carried within the AVPs defined in the extension. Note that the creation of a new extension should be viewed as a last resort. New Diameter extensions MUST define at least one Command Code, the Calhoun et al. expires October 2001 [Page 13] Internet-Draft May 2001 expected AVPs in an ABNF [31] grammar (see section 3.2), and MAY also define new AVPs. If the Diameter extension has any accounting requirements, it MUST also specify the AVPs that are to be present in the Diameter Accounting messages (see section 12.3). When possible, a new Diameter extension SHOULD attempt to re-use any existing Diameter AVP, in order to reduce the possibility of having multiple AVPs that carry similar information. Every Diameter Extension specification MUST have an IANA assigned Extension Identifier (see section 2.4). 2.3.4 Extension authentication procedures When possible, extensions SHOULD be designed such that new authentication methods MAY be added without requiring changes to the extension. This MAY require that new AVP values be assigned to represent the new authentication transform, or any other scheme that produces similar results. When possible, authentication frameworks, such as Extensible Authentication Protocol [25], SHOULD be used. 2.4 Diameter Extension Compliance Extension Identifiers are advertised during the capabilities exchange phase (see section 6.0). For a given extension, there are two different ways of advertising support. First, advertising support of the extension via the Auth-Extension-Id implies that the sender supports all authentication and authorization command codes, and the AVPs specified in the associated ABNFs, described in the specification. Second, advertising support of the extension via the Acct-Extension-Id implies that the sender supports the Accounting command codes defined in this specification, as well as the accounting AVPs defined in the extension's specification. An implementation MAY add arbitrary AVPs to any command defined in an extension, including vendor-specific AVPs. However, such AVPs MUST NOT have the Mandatory ('M') bit set. An implementation that adds AVPs not specified in a command's ABNF, and sets the AVP's Mandatory bit MUST NOT advertise support of the extension. An implementation MAY support both a proprietary version of an extension by requesting an IANA extension identifier (see section 16.3), while supporting the original extension. During the capabilities exchange, a Diameter node can determine whether to exchange messages using the proprietary or standard version of the extension by inspecting the extensions advertised by the peer. Calhoun et al. expires October 2001 [Page 14] Internet-Draft May 2001 2.5 Diameter Server Discovery Allowing for dynamic Diameter server discovery will make it possible for simpler and more robust deployment of AAA services. In order to promote interoperable implementations of Diameter server discovery, the following mechanisms are described. These are based on existing IETF standards. There are two cases where Diameter server discovery may be performed. The first is when a Diameter client needs to discover a first-hop Diameter server. The second case is when a Diameter server needs to discover another server - for further handling of a Diameter operation. In both cases, the following 'search order' is recommended: 1. The Diameter implementation consults its list of static (manual) configured Diameter server locations. These will be used if they exist and respond. 2. The Diameter implementation uses SLPv2 [28] to discover Diameter services. The Diameter service template [32] is included in Appendix A. It is recommended that SLPv2 security be deployed (this requires distributing keys to SLPv2 agents.) This is discussed further in Appendix A. SLPv2 will allow Diameter implementations to discover the location of Diameter servers in the local site, as well as their characteristics. Diameter servers with specific capabilities (say support for the Accounting extension) can be requested, and only those will be discovered. 3. The Diameter implementation uses DNS to request the SRV RR [33] for the '_diameter._sctp' and/or '_diameter._tcp' server in a particular domain. The Diameter implementation has to know in advance which domain to look for an Diameter server in. This could be deduced, for example, from the 'realm' in a NAI that an Diameter implementation needed to perform an Diameter operation on. Diameter allows AAA peers to protect the integrity and privacy of communication as well as to perform end-point authentication. Still, it is prudent to employ DNS Security as a precaution when using DNS SRV RRs to look up the location of a Diameter server. [34, 35, 36] 3.0 Diameter Header Calhoun et al. expires October 2001 [Page 15] Internet-Draft May 2001 A summary of the Diameter header format is shown below. The fields are transmitted in network byte order. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |r r r r r r r r r F A I R| Ver | Message Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Hop-by-Hop Identifier | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | End-to-End Identifier | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Command-Code | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Vendor-ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | AVPs ... +-+-+-+-+-+-+-+-+-+-+-+-+- Flags The Message Flags field is thirteen bits. The following bits are assigned: r(eserved) MUST be zero - this flag bit is reserved for future use. F(ailed Ind) - The indication message was rejected. A(nswer) - The message is a response to a Request message. I(ndication) - This notification does not solicit a response. R(equest) - The message solicits an answer. These flags MUST be set depending on the command code used in a Diameter message. This enables the type of message to be interpreted, even if the specific command code is not recognized. Command Type Flags Set Indication - - - I Request - - R - Answer - A - - Failed Ind F - - - A Diameter node MUST NOT set these flags in any other combination. A Diameter node receiving a message in which these flags are not set appropriately MAY reject the message for this reason, but SHOULD log the event for diagnosis. Version This Version field MUST be set to 1 to indicate Diameter Version Calhoun et al. expires October 2001 [Page 16] Internet-Draft May 2001 1. Message Length The Message Length field is two octets and indicates the length of the Diameter message including the header fields. Hop-by-Hop Identifier The Hop-by-Hop Identifier field is four octets, and aids in matching requests and replies. The sender MUST ensure that the Hop-by-Hop identifier in a request or indication message is locally unique (to the sender) at any given time, and MAY attempt to ensure that the number is unique across reboots. The sender of an Answer or Failed Indication message MUST ensure that the Hop- by-Hop Identifier field contains the same value that was found in the corresponding request. The Hop-by-Hop identifier is normally a monotonically increasing number, whose start value was randomly generated. A message of type Answer or Failed Indication that is received with an unknown Hop-by-Hop Identifier MUST be discarded. End-to-End Identifier Unlike the Hop-by-Hop Identifier, the End-to-End Identifier is used by servers to detect duplicate messages, and proxies MUST NOT modify this field. The sender of a request, answer, indication or failed indication message MUST insert a locally unique value in this field. The combination of the Session-Id AVP and this field is used to detect duplicates. A message of type Answer or failed Indication which is received with a previously seen End-to-End Identifier, and is to be locally consumed (meaning that the Destination-FQDN AVP contains the local node's identity) SHOULD be silently discarded. Command-Code The Command-Code field is four octets, and is used in order to communicate the command associated with the message. The 32-bit address space is managed by IANA (see section 16.2). Vendor-ID In the event that the Command-Code field contains a vendor specific command, the four octet Vendor-ID field contains the IANA assigned "SMI Network Management Private Enterprise Codes" [2] value. If the Command-Code field contains an IETF standard Command, the Vendor-ID field MUST be set to zero (0). AVPs AVPs are a method of encapsulating information relevant to the Diameter message. See section 4. for more information on AVPs. Calhoun et al. expires October 2001 [Page 17] Internet-Draft May 2001 3.1 Command Codes There are two different command types supported in the Diameter protocol; Request/Answer and Indication messages. Each command type is assigned a command code, and the sub-type (e.g. request or answer, Indication or Indication failure) is identified via the message flags field in the Diameter header. Every Diameter message MUST contain a command code in its header's Command-Code field, which is used to determine the action that is to be taken for a particular message. The following Command Codes are defined in the Diameter base protocol: Command-Name Abbrev. Code Reference -------------------------------------------------------- Accounting-Answer ACA 271 13.2 Accounting-Poll-Ind API 273 13.4 Accounting-Request ACR 271 13.1 Accounting-Status-Ind ASI 279 13.3 Device-Reboot-Ind DRI 257 6.2 Device-Status-Ind DSI 282 9.2.1 Device-Watchdog-Answer DWA 280 7.2 Device-Watchdog-Req DWR 280 7.1 Session-Termination-Ind STI 274 10.8.1 Session-Termination- STR 275 10.8.2 Request Session-Termination- STA 275 10.8.3 Answer 3.2 Command Code ABNF specification Every Command Code defined MUST include a corresponding ABNF specification, which is used to define the AVPs that MUST, MAY and MUST NOT be present. The following format is used in the definition: command-def = command-name "::=" diameter-message diameter-name = ALPHA *(ALPHA / DIGIT / "-") command-name = diameter-name ; The command-name has to be Command name, ; defined in the base or extended Diameter ; specifications. diameter-message = header [ *fixed] [ *required] [ *optional] [ *fixed] header = "" Calhoun et al. expires October 2001 [Page 18] Internet-Draft May 2001 fixed = [qual] "<" avp-spec ">" required = [qual] "{" avp-spec "}" optional = [qual] "[" avp-name "]" ; The avp-name in the 'optional' rule cannot ; evaluate to any AVP Name which is included ; in a fixed or required rule. qual = [min] "*" [max] ; See ABNF conventions, RFC 2234 section 6.6. ; The absence of any qualifiers implies that one ; and only one such AVP MUST be present. ; ; NOTE: "[" and "]" have a different meaning ; than in ABNF (see the optional rule, above). ; These braces cannot be used to express ; optional fixed rules (such as an optional ; ICV at the end.) To do this, the convention ; is '0*1fixed'. min = 1*DIGIT ; The minimum number of times the element may ; be present. max = 1*DIGIT ; The maximum number of times the element may ; be present. avp-spec = diameter-name ; The avp-spec has to be an AVP Name, defined ; in the base or extended Diameter ; specifications. avp-name = avp-spec | "AVP" ; The string "AVP" stands for *any* arbitrary ; AVP Name, which does not conflict with the ; required or fixed position AVPs defined in ; the command code definition. The following is a definition of a fictitious command code: Example-Request ::= < Diameter-Header: 9999999, E > { User-Name } * { Origin-FQDN } * [ AVP ] Calhoun et al. expires October 2001 [Page 19] Internet-Draft May 2001 3.3 Diameter Command Naming Conventions The following conventions are required for the naming of Diameter messages. Diameter commands typically start with an object name, and end with one of the following verbs: 3.3.1 Request/Answer The Request/Answer message pair is used when a Diameter node requests that some action be performed by a peer (e.g. authorize a user, terminate a session). The corresponding message MUST contain either a positive or negative result code, informing the requester whether the request was successful or not. Other information MAY also be returned in the Answer message. Request and Answer messages share the same command code, and the message flags field in the Diameter header is used to identify whether a message is the request or answer. 3.3.2 Indication/Failed Indication Indication is used either when the node wishes to inform the peer that an event occurred, or is requesting that a particular function be performed, but is not expecting a response. A successfully processed Indication message is not responded to. However, should an Indication message cause an error, a response is returned with the 'I' bit cleared and the 'F' bit set in the Diameter header's message flags field. 4.0 Diameter AVPs Diameter AVPs carry specific authentication, accounting and authorization information, security information as well as configuration details for the request and reply. Some AVPs MAY be listed more than once. The effect of such an AVP is specific, and is specified in each case by the AVP description. Each AVP of type OctetString MUST be padded to align on a 32 bit boundary, while other AVP types align naturally. NULL bytes are added to the end of the AVP Data field till a word boundary is reached. The length of the padding is not reflected in the AVP Length field. 4.1 AVP Header Calhoun et al. expires October 2001 [Page 20] Internet-Draft May 2001 The fields in the AVP header MUST be sent in network byte order. The format of the header is: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | AVP Code | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | AVP Length | Reserved |P|r|V|r|M| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Vendor-ID (opt) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Data ... +-+-+-+-+-+-+-+-+ AVP Code The AVP Code identifies the attribute uniquely. The first 256 AVP numbers are reserved for backward compatibility with RADIUS and are to be interpreted as per NASREQ [7]. AVP numbers 256 and above are used for Diameter, which are allocated by IANA (see section 16.1). AVP Length The AVP Length field is two octets, and indicates the length of this AVP including the AVP Code, AVP Length, AVP Flags, Reserved, the Vendor-ID field (if present) and the AVP data. If a message is received with an invalid attribute length, the message SHOULD be rejected. AVP Flags The AVP Flags field informs the Diameter host how each attribute must be handled. Note that subsequent Diameter extensions MAY define bits to be used within the AVP Header, and an unrecognized bit should be considered an error. The 'r' and the reserved bits are unused and should be set to 0 and ignored on receipt, while the 'P' bit is defined in [11]. The 'M' Bit, known as the Mandatory bit, indicates whether support of the AVP is required. If an AVP is received by a Home server or NAS with the 'M' bit enabled and the receiver does not support the AVP, the message MUST be rejected. If such an AVP is received by a Proxy or Redirect Server, the message MUST be forwarded to its logical destination, and MUST NOT be rejected. It is the responsibility of the originator of a message that is rejected for this purpose to correct the error. AVPs without the 'M' bit enabled are informational only and a receiver that receives a message with such an AVP that is not supported MAY simply ignore the AVP. Calhoun et al. expires October 2001 [Page 21] Internet-Draft May 2001 The 'V' bit, known as the Vendor-Specific bit, indicates whether the optional Vendor-ID field is present in the AVP header. When set the AVP Code belongs to the specific vendor code address space. Unless otherwise noted, AVPs will have the following default AVP Flags field settings: The 'M' bit MUST be set. The 'V' bit MUST NOT be set. 4.2 Optional Header Elements The AVP Header contains one optional field. This field is only present if the respective bit-flag is enabled. Vendor-ID The Vendor-ID field is present if the 'V' bit is set in the AVP Flags field. The optional four octet Vendor-ID field contains the IANA assigned "SMI Network Management Private Enterprise Codes" [2] value, encoded in network byte order. Any vendor wishing to implement a Diameter extension MUST use their own Vendor-ID along with their privately managed AVP address space, guaranteeing that they will not collide with any other vendor's extensions, nor with future IETF extensions. A vendor ID value of zero (0) corresponds to the IETF adopted AVP values, as managed by the IANA. Since the absence of the vendor ID field implies that the AVP in question is not vendor specific, implementations SHOULD not use the zero (0) vendor ID. 4.3 AVP Data Formats The Data field is zero or more octets and contains information specific to the Attribute. The format and length of the Data field is determined by the AVP Code and AVP Length fields. The format of the Data field MAY be one of the following data types. The interpretation of the values depends on the specification of the AVP. For example, an OctetString may be used to transmit human readable string data and Unsigned32 may be used to transmit a time value. Conventions for these common interpretations are described below. OctetString The data contains arbitrary data of variable length. Unless otherwise noted, the AVP Length field MUST be set to at least 9 (13 if the 'V' bit is enabled). Data used to transmit (human Calhoun et al. expires October 2001 [Page 22] Internet-Draft May 2001 readable) character string data uses the UTF-8 [24] character set and is NOT NULL-terminated. The minimum Length field MUST be 9, but can be set to any value up to 65504 bytes. AVP Values of this type that do not align on a 32-bit boundary MUST have the necessary padding. Address 32 bit (IPv4) [17] or 128 bit (IPv6) [16] address, most significant octet first. The format of the address (IPv4 or IPv6) is determined by the length. If the attribute value is an IPv4 address, the AVP Length field MUST be 12 (16 if 'V' bit is enabled), otherwise the AVP Length field MUST be set to 24 (28 if the 'V' bit is enabled) for IPv6 addresses. Integer32 32 bit signed value, in network byte order. The AVP Length field MUST be set to 12 (16 if the 'V' bit is enabled). Integer64 64 bit signed value, in network byte order. The AVP Length field MUST be set to 16 (20 if the 'V' bit is enabled). Unsigned32 32 bit unsigned value, in network byte order. The AVP Length field MUST be set to 12 (16 if the 'V' bit is enabled). Unsigned32 values used to transmit time data contains the four most significant octets returned from NTP [18], in network byte order. Unsigned64 64 bit unsigned value, in network byte order. The AVP Length field MUST be set to 16 (20 if the 'V' bit is enabled). Float32 This represents floating point values of single precision as described by [30]. The 32 bit value is transmitted in network byte order. The AVP Length field MUST be set to 12 (16 if the 'V' bit is enabled). Float64 This represents floating point values of double precision as described by [30]. The 64 bit value is transmitted in network byte order. The AVP Length field MUST be set to 16 (20 if the 'V' bit is enabled). Float128 This represents floating point values of quadruple precision as described by [30]. The 128 bit value is transmitted in network Calhoun et al. expires October 2001 [Page 23] Internet-Draft May 2001 byte order. The AVP Length field MUST be set to 24 (28 if the 'V' bit is enabled). Grouped The Data field is specified as a sequence of AVPs. Each of these AVPs follows - in the order in which they are specified - including their headers and padding. The AVP Length field is set to 8 (12 if the 'V' bit is enabled) plus the total length of all included AVPs, including their headers and padding. 4.4 Grouped AVP Values The Diameter protocol allows AVP values of type 'Grouped.' This implies that the Data field is actually a well defined sequence of AVPs. It is possible to include an AVP with a Grouped type within a Grouped type, that is, to nest them. AVPs within an AVP of type Grouped have the same padding requirements as non-Grouped AVPs, as defined in section 4.0. Grouped type AVP specifications include an ABNF grammar [31] specifying the required sequence of AVPs. Grouped AVP values MUST be in the specified sequence and MUST NOT include other AVP values besides those specified by the Grouped AVP grammar. 4.4.1 Example AVP with a Grouped Data type The Example AVP (AVP Code 999999) is of type Grouped and is used to clarify how Grouped AVP values work. The Grouped Data field has the following ABNF grammar: example-avp-val = Origin-FQDN Host-IP-Address Origin-FQDN = ; See Section 5.1 Host-IP-Address = ; See Section 6.2.4 An Example AVP with the Grouped Data Origin-FQDN = "example.com", Host-IP-Address = "10.10.10.10" would be encoded as follows: Calhoun et al. expires October 2001 [Page 24] Internet-Draft May 2001 0 1 2 3 4 5 6 7 +-------+-------+-------+-------+-------+-------+-------+-------+ 0 | Example AVP Header (AVP Code = 999999), Length = 40 | +-------+-------+-------+-------+-------+-------+-------+-------+ 8 | Origin-FQDN AVP Header (AVP Code = 264), Length = 19 | +-------+-------+-------+-------+-------+-------+-------+-------+ 16 | 'e' | 'x' | 'a' | 'm' | 'p' | 'l' | 'e' | '.' | +-------+-------+-------+-------+-------+-------+-------+-------+ 24 | 'c' | 'o' | 'm' |Padding| Host-IP-Addr AVP Header | +-------+-------+-------+-------+-------+-------+-------+-------+ 32 | (AVP Code = 257), Length = 12 | 0x0a | 0x0a | 0x0a | 0x0a | +-------+-------+-------+-------+-------+-------+-------+-------+ 4.5 Diameter Base Protocol AVPs The following table describes the Diameter AVPs defined in the base protocol, their AVP Code values, types, possible flag values and whether the AVP MAY be encrypted. +---------------------+ | AVP Flag rules | |----+-----+----+-----|----+ AVP Section | | |SHLD| MUST|MAY | Attribute Name Code Defined Data Type |MUST| MAY | NOT| NOT|Encr| -----------------------------------------|----+-----+----+-----|----| Accounting- 482 14.2 Unsigned32 | M | P | | V | Y | Interim-Interval | | | | | | Accounting- 485 14.3 Unsigned32 | M | P | | V | Y | Record-Number | | | | | | Accounting- 480 14.1 Unsigned32 | M | P | | V | Y | Record-Type | | | | | | Accounting- 44 14.5 OctetString| M | P | | V | Y | Session-Id | | | | | | Accounting-State 486 14.4 Unsigned32 | M | P | | V | Y | Acct-Extension- 259 6.2.7 Integer32 | M | | | | Y | Id | | | | | | Auth-Extension- 258 6.2.3 Integer32 | M | | | | Y | Id | | | | | | Authorization- 291 10.4 Unsigned32 | M | | | | N | Lifetime | | | | | | Destination-FQDN 293 5.3 OctetString| M | | | | Y | Destination- 283 11.4.7 OctetString| M | | | V | N | Realm | | | | | | DSI-Event 297 9.2.2 Unsigned32 | M | | | | N | Error-Message 281 9.1.2 OctetString| | | | | N | -----------------------------------------|----+-----+----+-----|----| Calhoun et al. expires October 2001 [Page 25] Internet-Draft May 2001 +---------------------+ | AVP Flag rules | |----+-----+----+-----|----+ AVP Section | | |SHLD| MUST|MAY | Attribute Name Code Defined Data Type |MUST| MAY | NOT| NOT|Encr| -----------------------------------------|----+-----+----+-----|----| Error-Reporting- 294 9.1.3 OctetString| | | | | Y | FQDN | | | | | | Failed-AVP 279 9.3 OctetString| M | | | | Y | Failed-Vendor-Id 262 9.5 Unsigned32 | M | | | | Y | Firmware- 267 6.2.2 Unsigned32 | | | | V,M | Y | Revision | | | | | | Host-IP-Address 257 6.2.4 Address | M | | | V | N | Max-Wait-Time 295 10.7 Unsigned32 | M | | | V | N | Offending-AVP 271 9.4 OctetString| M | | | V | N | Origin-FQDN 264 5.1 OctetString| M | | | V | N | Origin-Realm 296 5.2 OctetString| M | | | V | N | Product-Name 269 6.2.6 OctetString| | | | | N | Proxy-Address 280 11.4.5 Address | M | | | V | N | Proxy-Info 284 11.4.4 Grouped | M | | | V | N | Proxy-State 33 11.4.6 OctetString| M | | | V | N | Redirect-Host 292 11.3.1 Grouped | M | | | | Y | Redirect-Host- 278 11.3.2 Address | M | | | | Y | Address | | | | | | Redirect-Host- 277 11.3.3 Unsigned32 | M | | | | Y | Port | | | | | | Result-Code 268 9.1.1 Unsigned32 | M | | | | N | Route-Record 282 11.4.3 OctetString| M | | | V | N | Session-Id 263 10.3 OctetString| M | | | | Y | Session-Timeout 27 10.5 Unsigned32 | M | | | | Y | Supported- 265 6.2.5 Unsigned32 | M | | | | N | Vendor-Id | | | | | | User-Name 1 10.6 OctetString| M | | | | Y | Vendor-Id 266 6.2.1 Unsigned32 | M | | | V,M | Y | -----------------------------------------|----+-----+----+-----|----| 5.0 Message Forwarding All Diameter messages MUST include the Origin-FQDN and Origin-Realm AVPs. These AVPs are used to identify the source of the message. When responding to a request or indication (via a failed indication) message, the Origin-FQDN and Origin-Realm AVPs are replaced with the local node's information. The Destination-FQDN AVP is used when the destination of the message is fixed, such as: Calhoun et al. expires October 2001 [Page 26] Internet-Draft May 2001 - Authentication requests that span multiple round trips - A Diameter message that uses a security mechanism that makes use of a pre-established session key shared between the source and the final destination of the message. - Server initiated messages that MUST be received by a specific Diameter client (e.g. access device), such as the Session- Termination-Ind message, which is used to request that a particular user's session be terminated. A message that includes the Destination-FQDN AVP containing the local hosts' identity is to be locally processed. Proxies receiving messages that contain the Destination-FQDN AVP MUST verify whether they are able to forward Diameter messages to the host specified in the AVP, and if so, MUST forward the message to the host in question. Otherwise, the message routing procedures described in section 11.0 MUST be followed. Unless otherwise specified, this section defines the Diameter AVPs that MUST be added in all messages originated by a Diameter node (including nodes creating Answer messages). 5.1 Origin-FQDN AVP The Origin-FQDN AVP (AVP Code 264) is of type OctetString, encoded in the UTF-8 [24] format. This AVP identifies the endpoint which originated the Diameter message, i.e. the access device, home server, or broker. Proxy servers do not modify this AVP. All Diameter messages MUST include the Origin-FQDN AVP, which contains the host name of the originator of the Diameter message and MUST follow the Fully Qualified Domain Name naming conventions. Note that the Origin-FQDN AVP may resolve to more than one address as the Diameter peer may support more than one address. 5.2 Origin-Realm AVP The Origin-Realm AVP (AVP Code 296) is of type OctetString, encoded in the UTF-8 [24] format. This AVP contains the Realm of the originator of any Diameter message. 5.3 Destination-FQDN AVP The Destination-FQDN AVP (AVP Code 293) is of type OctetString, encoded in the UTF-8 [24] format, and contains the Fully Qualified Calhoun et al. expires October 2001 [Page 27] Internet-Draft May 2001 Domain Name (FQDN) of the intended recipient of the message. This AVP MUST be present in all unsolicited server initiated messages, MAY be present in request or indication message, and MUST be present in Answer or failed Indication messages. The value of the Destination- FQDN AVP is set to the value of the Origin-FQDN AVP found in a message from the intended target host. 6.0 Capabilities Exchange When two Diameter peers establish a transport connection, they MUST send the Device-Reboot-Ind message. This message has two purposes. First it allows a peer's identity to be discovered, and allows for capabilities exchange, such as the supported protocol version number, and the locally supported extensions. The receiver uses the extensions advertised in order to determine whether it SHOULD send certain application-specific Diameter commands. A Diameter node MUST retain the supported extensions in order to ensure that unrecognized commands and/or AVPs are not sent to a peer. A receiver of a Device-Reboot-Ind message which does not have any extensions in common with the sender MUST return a DSI message to the peer with the DSI-Event AVP set to DIAMETER_NO_COMMON_EXTENSION, and disconnect the transport layer connection. The Device-Reboot-Ind message MUST NOT be proxied, or redirected. Since the DRI cannot be proxied, it is still possible that a upstream proxy receives a message for which it has no available peers to handle the extension that corresponds to the Command-Code. In such instances, the Device-Status-Ind message is used (see Section 9.2.1) to inform the downstream to take action. With the exception of the Device-Reboot-Ind message, a message of type Request or Indication that includes the Auth-Extension-Id or Acct-Extension-Id AVPs, or a message with an extension-specific command code, MAY only be forwarded to a host that has explicitly advertised support for the extension (or has advertised the Wildcard Extension). 6.1 Extension Identifiers Each Diameter extension draft MUST have an IANA assigned Extension Identifier (see section 16.3). The base protocol does not require an Extension Identifier since its support is mandatory. Calhoun et al. expires October 2001 [Page 28] Internet-Draft May 2001 Extension Identifiers are communicated via two separate AVPs; Auth- Extension-Id and Acct-Extension-Id. The Auth-Extension-Id AVP is used to communicate support for the authentication and authorization portion of an extension. The Acct-Extension-Id AVP, on the other hand, communicates support for the accounting portion of an extension. This separation of AVPs allows a server to communicate that it is willing to accept only accounting messages for a given extension. The following Extension Identifier values are defined: NASREQ 1 [7] End-to-End Security 2 [11] Resource Management 3 [29] Mobile-IP 4 [10] Wildcard Extension 0xffffffff Servers acting as Redirect or Proxy servers (see Section 11.0) MAY wish to either advertise all supported extensions, or the wildcard extension. The receiver of a wildcard extension MUST assume that the sender supports all extensions. Proxy servers are responsible for finding a downstream server that supports the extension of a particular message. If none can be found, a DSI message is returned with the DSI-Event AVP set to DIAMETER_UNABLE_TO_DELIVER. 6.2 Device-Reboot-Ind (DRI) Command The Device-Reboot-Ind (DRI), indicated by the Command-Code set to 257 and the message flags' 'I' bit set, is sent to inform a peer that a reboot has, or will, occur. When Diameter is run over SCTP [26], which allows for connections to span multiple interfaces, hence multiple IP addresses, the Device- Reboot-Ind message MUST contain one Host-IP-Address AVP for each potential IP address that MAY be locally used when transmitting Diameter messages. If a Diameter node receives a DRI message that results in an error, the message MUST be returned with the 'F' bit set, and the 'I' bit cleared. Message Format Calhoun et al. expires October 2001 [Page 29] Internet-Draft May 2001 ::= < Diameter Header: 257, I > { Origin-FQDN } { Origin-Realm } 1* { Host-IP-Address } { Vendor-Id } { Product-Name } * [ Supported-Vendor-Id ] * [ Auth-Extension-Id ] * [ Acct-Extension-Id ] [ Destination-FQDN ] [ Firmware-Revision ] * [ AVP ] 6.2.1 Vendor-Id AVP The Vendor-Id AVP (AVP Code 266) is of type Unsigned32 and contains the IANA "SMI Network Management Private Enterprise Codes" [2] value assigned to the vendor of the Diameter device. In combination with the Supported-Vendor-Id AVP (section 6.2.5), this MAY be used in order to know which vendor specific attributes may be sent to the peer. It is also envisioned that the combination of the Vendor-Id, Product-Name (section 6.2.6) and the Firmware-Revision (section 6.2.2) AVPs MAY provide very useful debugging information. A Vendor-Id value of zero in the DRI is reserved and indicates that the Diameter peer is in the experimental or concept stage and that an IANA Private Enterprise Number has yet to be obtained by the implementor. 6.2.2 Firmware-Revision AVP The Firmware-Revision AVP (AVP Code 267) is of type Unsigned32 and is used to inform a Diameter peer of the firmware revision of the issuing device. For devices that do not have a firmware revision (general purpose computers running Diameter software modules, for instance), the revision of the Diameter software module may be reported instead. 6.2.3 Auth-Extension-Id AVP The Auth-Extension-Id AVP (AVP Code 258) is of type Unsigned32 and is used in order to advertise support of the Authentication and Authorization portion of an extension (see Section 6.1). The Auth- Calhoun et al. expires October 2001 [Page 30] Internet-Draft May 2001 Extension-Id MUST also be present in all Authentication and/or Authorization messages that are defined in a separate Diameter specification and have an Extension ID assigned. 6.2.4 Host-IP-Address AVP The Host-IP-Address AVP (AVP Code 257) is of type Address and is used to inform a Diameter peer of the sender's IP address. All source addresses that a Diameter node expects to use with SCTP [26] MUST be advertised in the Device-Reboot-Ind message by including a Host-IP- Address AVP for each address. This AVP MUST ONLY be used in the Device-Reboot-Ind message. 6.2.5 Supported-Vendor-Id AVP The Supported-Vendor-Id AVP (AVP Code 265) is of type Unsigned32 and contains the IANA "SMI Network Management Private Enterprise Codes" [2] value assigned to a vendor other than the device vendor. This is used in the Device-Reboot-Ind message in order to inform the peer that the sender supports a subset of the vendor-specific commands and/or attributes defined by the vendor identified in this AVP. 6.2.6 Product-Name AVP The Product-Name AVP (AVP Code 269) is of type OctetString, encoded in the UTF-8 [24] format, and contains the vendor assigned name for the product. The Product-Name AVP SHOULD remain constant across firmware revisions for the same product. 6.2.7 Acct-Extension-Id AVP The Acct-Extension-Id AVP (AVP Code 259) is of type Unsigned32 and is used in order to advertise support of the Accounting portion of an extension (see Section 6.1). The Acct-Extension-Id MUST also be present in all Accounting messages that are defined in a separate Diameter specification and have an Extension ID assigned. 7.0 Transport Failure Detection Given the nature of the Diameter protocol, it is recommended that transport failures be detected as soon as possible. Detecting such failures will minimize the occurrence of messages sent to unavailable servers, resulting in unnecessary delays, and will provide better Calhoun et al. expires October 2001 [Page 31] Internet-Draft May 2001 failover performance. In order to pro-actively detect such failures, the Diameter protocol defines the Device-Watchdog-Request message, which is sent to an inactive peer. A peer is considered inactive if no messages were sent or received from the peer within the current watchdog interval period (see Section 18.0), and no request messages are pending with the peer. For implementations that have access to the Retransmission Time-Out (RTO) value of the underlying transport connection, a DWR SHOULD be sent once per RTO of that connection, plus the watchdog interval period, with a jittering of +/- 50%. If the DWR is unanswered, the time until the next DWR is sent MUST be recalculated after exponentially backing off the RTO portion. When the value of the DWR's current watchdog interval period reaches the maximum watchdog interval (Section 18.0), backoff is not continued, and the peer is marked as failed. DWR messages continue to be sent (jittered) at the final interval for detection for failover. The current watchdog interval is returned to its starting point when a DWA is received or the peer resumes activity. Implementations that do not have access to the RTO SHOULD perform an Round Trip Time (RTT) measurement for a given peer when a Device- Watchdog-Answer message is received for a non-backed off DWR. The fixed RTO base should be replaced by RTT-Multiplier (Section 18.0) times the measured RTT. An example of the backoff sequence, excluding jitter, would be: 30+RTO , 30+2*RTO , 30+4*RTO , 30+8*RTO, 60, 60, 60 Note that exponential backoff MUST be performed before the maximum is reached. 7.1 Device-Watchdog-Request The Device-Watchdog-Request (DWR), indicated by the Command-Code set to 280 and the message flags' 'R' bit set, is sent to a peer when no traffic has been exchanged between two peers as defined in Section 7.0, and no requests are pending with the peer. Message Format Calhoun et al. expires October 2001 [Page 32] Internet-Draft May 2001 ::= < Diameter Header: 280, R> { Origin-FQDN } { Origin-Realm } [ Destination-FQDN ] 7.2 Device-Watchdog-Answer The Device-Watchdog-Answer (DWA), indicated by the Command-Code set to 280 and the message flags' 'A' bit set, is sent as a response to the Device-Watchdog-Request message. A receiver of the DWA SHOULD perform RTT calculation in the event that the transport RTO information is not available. Message Format ::= < Diameter Header: 280, A > { Result-Code } { Origin-FQDN } { Origin-Realm } { Destination-FQDN } 7.3 Failover/Failback Procedures In the event that a transport failure is detected with a peer, it is necessary for all pending request and indication messages to be forwarded to an alternate server, if possible. This is commonly referred to as failover. In order for a Diameter node to perform failover procedures, it is necessary for the node to maintain a pending message queue for a given peer. When a response is received, the message is removed from the queue. The Hop-by-Hop Identifier field MAY be used to match the corresponding response with the queued request. When a transport failure is detected, all messages in the queue are sent to an alternate server, if possible. An example of a case where it is not possible for forward the message to an alternate server is when the message has a fixed destination, and the unavailable peer is the message's final destination (see Destination-FQDN AVP). Such an error requires that the server return an DSI with the DSI-Event AVP set to DIAMETER_UNABLE_TO_DELIVER. It is important to note that multiple identical request or responses MAY be received as a result of a failover. The End-to-End Identifier field in the Diameter header MUST be used to identify duplicate messages. Calhoun et al. expires October 2001 [Page 33] Internet-Draft May 2001 As described in section 2.1, a connection request should be periodically attempted with the failed peer in order to re-establish the transport connection. Once a connection has been successfully established, messages can once again be forwarded to the peer. This is commonly referred to as failback. 8.0 Peer State Machine This section contains a finite state machine, that MUST be observed by all Diameter implementations. Each Diameter node MUST follow the state machine described below when communicating with each peer. Multiple actions are separated by commas, and may continue on succeeding lines as space requires. Similarly, state and next state may also span multiple lines as space requires. There may be at most one transport connection between any two peers over which Diameter messages may be passed. This state machine is intended to handle both the simple case, in which one peer initiates a connection to the other, and the complex case, in which each peer simultaneously initiates a connection to the other. In the complex case, an election occurs to determine which transport connection will survive. I- is used to represent the initiator (connecting) connection, while the R- is used to represent the responder (listening) connection. The lack of a prefix indicates that the event or action is the same regardless of the connection on which the event occurred. The stable states that a state machine may be in are Closed, I-Open and R-Open; all other states are intermediate. Note that I-Open and R-Open are equivalent except for whether the initiator or responder transport connection is used for communication. A DRI message is always sent on the responder connection immediately after accepting the connection request. The non-elected connection will close down. All subsequent messages are sent on the elected connection. The state machine constrains only the behavior of a Diameter implementation as seen by Diameter peers through events on the wire. Any implementation that produces equivalent results is considered compliant. state event action next state ----------------------------------------------------------------- Closed Start I-Snd-Conn-Req Wait-Conn-Ack Calhoun et al. expires October 2001 [Page 34] Internet-Draft May 2001 R-Rcv-Conn-Req R-Snd-Conn-Ack Wait-R-DRI Wait-Conn-Ack I-Rcv-Conn-Ack I-Snd-DRI Wait-I-DRI I-Rcv-Conn-Nack Cleanup Closed R-Rcv-Conn-Req R-Snd-Conn-Ack Wait-Conn-Ack/ Wait-R-DRI Timeout Error Closed Wait-I-DRI I-Rcv-DRI Process-DRI I-Open R-Rcv-Conn-Req R-Snd-Conn-Ack Wait-R-DRI/ Elect I-Peer-Disc I-Disc Closed Timeout Error Closed Wait-Conn-Ack/ I-Rcv-Conn-Ack I-Snd-DRI Wait-R-DRI/ Wait-R-DRI Elect I-Rcv-Conn-Nack Cleanup Wait-R-DRI R-Rcv-DRI Process-DRI Wait-Conn-Ack/ Elect Timeout Error Closed Wait-R-DRI/ R-Rcv-DRI Process-DRI, Wait-Returns Elect Elect I-Peer-Disc I-Disc Wait-R-DRI Timeout Error Closed Wait-Conn-Ack/ I-Rcv-Conn-Ack I-Snd-DRI,Elect Wait-Returns Elect I-Rcv-Conn-Nack R-Snd-DRI R-Open R-Peer-Disc R-Disc Wait-Conn-Ack-2 Timeout Error Closed Wait-Returns Win-Election I-Disc,R-Snd-DRI R-Open I-Peer-Disc I-Disc,R-Snd-DRI R-Open I-Rcv-DRI R-Disc I-Open R-Peer-Disc R-Disc Wait-I-DRI-2 Timeout Error Closed Wait-Conn-Ack-2 I-Rcv-Conn-Ack I-Snd-DRI Wait-I-DRI-2 I-Rcv-Conn-Nack Cleanup Closed R-Rcv-Conn-Req R-Snd-Conn-Nack Wait-Conn-Ack-2 Timeout Error Closed Wait-I-DRI-2 I-Rcv-DRI Process-DRI I-Open I-Peer-Disc I-Disc Closed R-Rcv-Conn-Req R-Snd-Conn-Nack Wait-I-DRI-2 Timeout Error Closed Wait-R-DRI R-Rcv-DRI Process_DRI, R-Open Calhoun et al. expires October 2001 [Page 35] Internet-Draft May 2001 R-Snd-DRI Timeout Error Closed R-Open Send-Message R-Snd-Non-DRI R-Open R-Rcv-Non-DRI Process R-Open R-WatchDog-Timer R-Snd-DWR R-Open R-Rcv-DWA Process-DWA R-Open Stop R-Snd-Disc Closed R-Peer-Disc R-Disc Closed R-Rcv-DRI Error Closed I-Open Send-Message I-Snd-Non-DRI I-Open I-Rcv-Non-DRI Process I-Open I-WatchDog-Timer I-Snd-DWR I-Open I-Rcv-DWA Process-DWA I-Open Stop I-Disc Closed I-Peer-Disc I-Disc Closed I-Rcv-DRI Error Closed R-Rcv-Conn-Req R-Snd-Conn-Nack I-Open 8.1 States Following is a more detailed description of each automaton state. Closed A peer is initially in the closed state, and no transport connection exists with the peer. Wait-Conn-Ack A transport connection has been initiated with the peer, and an acknowledgement is pending. Wait-I-DRI The local Diameter node is waiting for the peer to issue a DRI. Wait-Conn-Ack/Wait-R-DRI A transport connection indication from the peer was received, while a transport connection has already been locally initiated. Wait-R-DRI/Elect Two transport connections have been established with the peer, and a DRI is pending on the responder connection. Wait-Conn-Ack/Elect A transport connection exists on the responder connection, while an acknowledgment has yet to be received on the initiator connection. Calhoun et al. expires October 2001 [Page 36] Internet-Draft May 2001 Wait-Returns Multiple transport connections caused an election to occur. Wait-Conn-Ack-2 While an acknowledgement to a locally initiated transport connection hasn't been received, an election has failed and the initiator connection will be used between the peers. Wait-I-DRI-2 Following an election, the initiator connection won, and a DRI has yet to be received by the peer. Wait-R-DRI A transport connection indication has been received from the peer, and a DRI has yet to be received by the peer. R-Open The responder connection will be used to communicate with the peer. I-Open The initiator connection will be used to communicate with the peer. 8.2 Events Transitions and actions in the automaton are caused by events. In this section we will ignore the -I and -R prefix, since the actual event would be identical, but would occur on one of two possible connections. Start The Diameter application has signaled that a connection should be initiated with the peer. Rcv-Conn-Req A transport connection indication from the peer has been received. Rcv-Conn-Ack A positive acknowledgement was received to a locally initiated transport connection. Rcv-Conn-Nack A negative acknowledgement was received to a locally initiated transport connection. Timeout An application-defined timer has expired while waiting for some event. Rcv-DRI A DRI message from the peer was received. Peer-Disc A disconnection indication from the peer was Calhoun et al. expires October 2001 [Page 37] Internet-Draft May 2001 received. Win-Election An election was held, and the local node was the winner. Send-Message A Non-DRI message is to be sent. Rcv-Non-DRI A Non-DRI message was received. WatchDog-Timer The Watchdog timer expired, indicating that a DWR message is to be sent to the peer. Rcv-DWA A DWA message was received. Stop The Diameter application has signaled that a connection should be terminated (e.g., on system shutdown). 8.3 Actions Actions in the automaton are caused by events and typically indicate the transmission of packets and/or an action to be taken on the connection. In this section we will ignore the -I and -R prefix, since the actual action would be identical, but would occur on one of two possible connections. Snd-Conn-Req A transport connection is initiated with the peer. Snd-Conn-Ack an acknowledgement is sent in response to a connect request, confirming that the transport layer connection is open. Snd-Conn-Nack A negative acknowledgement is sent in response to a connect request, indicating that the request was refused. Snd-DRI A DRI message is sent to the peer. Cleanup If necessary, the connection is shutdown, and any local resources are freed. Error The transport layer connection is disconnected, either politely or abortively, in response to an error condition. Local resources are freed. Process-DRI A received DRI is processed. Calhoun et al. expires October 2001 [Page 38] Internet-Draft May 2001 Disc The transport layer connection is disconnected, and local resources are freed. Elect An election occurs (see Section 8.4 for more information). Snd-Non-DRI A non-DRI message is sent. Snd-DWR A DWR message is sent. Process-DWA The DWA message is serviced. Process A non-DRI Diameter message is serviced. 8.4 The Election Process The election is performed on the responder. The responder compares the Origin-FQDN received in the DRI sent by its peer with its own Origin-FQDN (which it may or may not have actually sent). The transport layer connection with the higher value of Origin-FQDN is the one that survives. The comparison proceeds by considering the shorter OctetString to be null-padded to the length of the longer, then performing an octet by octet unsigned comparison with the first octet being most significant. Hanging octets are assumed to have value 0x80, but dimpled octets are ignored. 9.0 Error Handling This section will specify the how Diameter error handling occurs. There are two separate error types that are considered; end-to-end and hop-by-hop. 9.1 End-to-End Error Signaling An End-to-End error occurs when a Diameter entity sends a message and either an intermediate proxy, or the home server, wishes to return a failure. When a diameter message of type Request is received, and an error is identified, the 'A' bit is set and the Result-Code AVP is added to the message. The sender MAY also include additional AVPs that help identify the error condition. Certain Result-Code values require the presence of additional AVPs. When a diameter message of type Indication is received, and an error Calhoun et al. expires October 2001 [Page 39] Internet-Draft May 2001 is identified, the above procedures are followed except the 'F' bit is set, as opposed to the 'A' bit. In the event that an unrecognized AVP is received, and it is marked as Mandatory (the 'M' bit is set), the Result-Code AVP is added with the value DIAMETER_AVP_UNSUPPORTED, as is the Failed-AVP AVP, containing the offending AVP. Should an AVP be received with an unrecognized value, the Result-Code AVP is added with its value set to DIAMETER_INVALID_AVP_VALUE, as is the Failed-AVP AVP, containing the offending AVP. The Result-Code AVP lists many additional error conditions that may occur. 9.1.1 Result-Code AVP The Result-Code AVP (AVP Code 268) is of type Unsigned32 and indicates whether a particular request was completed successfully or whether an error occurred. All Diameter messages of type *-Answer, as well as *-Ind messages with the 'F' bit set, MUST include one Result-Code AVP. A non-successful Result-Code AVP (one containing a non 2001 value) MUST include the Error-Reporting-FQDN AVP. The Result-Code data field contains an IANA-managed 32-bit address space representing errors (see section 16.4). Diameter provides the following classes of errors, all identified by the thousands digit: - 1xxx (Informational) - 2xxx (Success) - 4xxx (Transient Failures) - 5xxx (Permanent Failure) A non-recognize class (one whose first digit is not defined in this section) MUST be handled as a permanent failure. 9.1.1.1 Informational Errors that fall within the Informational category are used to inform a requester that the request cannot be immediately satisfied and a further response will be issued in the near future. There are currently no errors that fall within this class. 9.1.1.2 Success Errors that fall within the Success category are used to inform a Calhoun et al. expires October 2001 [Page 40] Internet-Draft May 2001 peer that a request has been successfully completed. DIAMETER_SUCCESS 2001 The Request was successfully completed. 9.1.1.3 Transient Failures Errors that fall within the transient failures category are used to inform a peer that the request could not be satisfied at the time it was received, but MAY be able to satisfy the request in the future. DIAMETER_AUTHENTICATION_REJECTED 4001 The authentication process for the user failed, most likely due to an invalid password used by the user. Further attempts MUST only be tried after prompting the user for a new password. DIAMETER_END_2_END_SECURITY 4002 A proxy has detected that end-to-end security has been applied to portions of the Diameter message, and the proxy does not allow this security mode since it needs to alter the message by applying some local policies. DIAMETER_OUT_OF_SPACE 4003 A Diameter node received the accounting request but was unable to commit it to stable storage due to a temporary lack of space. 9.1.1.4 Permanent Failures Errors that fall within the permanent failures category are used to inform the peer that the request failed, and should not be attempted again. DIAMETER_USER_UNKNOWN 5001 A request was received for a user that is unknown, therefore authentication and/or authorization failed. DIAMETER_AVP_UNSUPPORTED 5002 The peer received a message that contained an AVP that is not recognized or supported and was marked with the Mandatory bit. A Diameter message with this error MUST contain one or more Failed-AVP AVP containing the AVPs that caused the failure. DIAMETER_UNKNOWN_SESSION_ID 5003 The request or response contained an unknown Session-Id. DIAMETER_AUTHORIZATION_REJECTED 5004 Calhoun et al. expires October 2001 [Page 41] Internet-Draft May 2001 A request was received for which the user could not be authorized. This error could occur if the service requested is not permitted to the user. DIAMETER_INVALID_AVP_VALUE 5005 The request contained an AVP with an invalid value in its data portion. A Diameter message indicating this error MUST include the offending AVPs within a Failed-AVP AVP. DIAMETER_MISSING_AVP 5006 The request did not contain an AVP that is required by the Command Code definition. If this value is sent in the Result- Code AVP, a Failed-AVP AVP SHOULD be included in the message. The data portion of the Failed-AVP MUST only contain the AVP Code of the missing AVP. DIAMETER_INVALID_CMS_DATA 5007 The Request did not contain a valid CMS-Data [11] AVP. DIAMETER_LOOP_DETECTED 5008 A Proxy or Redirect server detected a loop while trying to get the message to the Home Diameter server. The message MAY be sent to an alternate peer, if one is available, but the peer reporting the error has identified a configuration problem. DIAMETER_AUTHORIZATION_FAILED 5009 A request was received for which the user could not be authorized at this time. This error could occur when the user has already expended allowed resources, or is only permitted to access services within a time period. DIAMETER_CONTRADICTING_AVPS 5010 The Home Diameter server has detected AVPs in the request that contradicted each other, and is not willing to provide service to the user. One or more Failed-AVP AVPs MUST be present, containing the AVPs that contradicted each other. DIAMETER_AVP_NOT_ALLOWED 5011 A message was received with an AVP that MUST NOT be present. The Failed-AVP AVP MUST be included and contain the AVP Code of the offending AVP. DIAMETER_AVP_OCCURS_TOO_MANY_TIMES 5012 A message was received that included an AVP that appeared more often than permitted in the message definition. The Failed-AVP AVP MUST be included and contain the AVP Code of the offending AVP. Calhoun et al. expires October 2001 [Page 42] Internet-Draft May 2001 DIAMETER_VENDOR_ID_UNSUPPORTED 5013 The Home Diameter server has detected vendor-specific AVPs in the message, and the vendor dictionary is not supported. One or more Failed-AVP MUST be present, containing the offending AVPs. 9.1.2 Error-Message AVP The Error-Message AVP (AVP Code 281) is of type OctetString. It is a human readable UTF-8 character encoded string. It MAY accompany a Result-Code AVP as a human readable error message. The Error-Message AVP is not intended to be useful in real-time, and SHOULD NOT be expected to be parsed by network entities. 9.1.3 Error-Reporting-FQDN AVP The Error-Reporting-FQDN AVP (AVP Code 294) is of type OctetString, encoded in the UTF-8 [24] format. This AVP contains the FQDN of the Diameter host that set the Result-Code AVP to a value other than 2001 (Success). This AVP is intended to be used for troubleshooting purposes, and MUST be set when the Result-Code AVP indicates a failure. 9.2 Hop-by-Hop Error Handling There are many instances where error conditions occur on a Diameter node, that needs to be signaled to the downstream server, and not necessarily to the Diameter client. Examples of such error conditions are inability to forward a message to a particular domain, etc. In these cases, returning the error back to the Diameter client will only cause delay, and perhaps confusion in roaming networks. Therefore, when such errors occur, it is necessary for the error to be handled by the downstream next hop, and some local action be taken to rectify the problem, such as forwarding to a different next hop. Calhoun et al. expires October 2001 [Page 43] Internet-Draft May 2001 Request +--------+ Link Broken +-------------------------->|Diameter|----///----+ | +---------------------| | v +-----+---+ | DSI | Server | +--------+ |Diameter |<-+ (Unable to Forward) +--------+ |Diameter| |Client or| | | | Server |--+ +--------+ | Server | +---------+ | Request |Diameter| +--------+ +-------------------->| | ^ | Server |-----------+ +--------+ Figure 1 - Example of Per-Hop Error Condition If a message is received with an unrecognized Command-Code, an DSI message is returned with the DSI-Event AVP containing the value DIAMETER_COMMAND_UNSUPPORTED. 9.2.1 Device-Status-Ind The Device-Status-Ind (DSI), indicated by the Command-Code set to 282 and the message flags' 'I' bit set, is sent to inform a peer that an event has occurred. A Failed Indication would contain the same Command-Code, but would require that only be 'F' bit be set. When a Diameter node issues a DSI message downstream, the target peer MUST attempt to rectify the problem, or issue a similar message downstream. The Device-Status-Ind message MUST NOT be proxied, but MAY be forwarded, as long as the Origin-FQDN and Origin-Realm AVPs are replaced to include the local node's identity. The Device-Status-Ind message MUST contain the same Hop-by-Hop Identifier value in the header as the message which motivated sending the DSI. If the Session-Id AVP was present in the original message, the same AVP MUST be present in the DSI. Message Format ::= < Diameter Header: 282, I > { Origin-FQDN } { Origin-Realm } { DSI-Event } [ Destination-FQDN ] [ Session-Id ] * [ AVP ] Calhoun et al. expires October 2001 [Page 44] Internet-Draft May 2001 9.2.2 DSI-Event AVP The DSI-Event AVP (AVP Code 297) is of type Unsigned32 and indicates that an event occurred which requires attention from a Diameter peer. The DSI-Event contains an IANA-managed 32-bit address space representing events (see section 16.5). Diameter provides the following classes of event notification, all identified by the thousands digit: - 1xxx (Informational Events) - 3xxx (Redirect Notification) - 4xxx (Transient Failure Events) - 5xxx (Permanent Failure Events) A non-recognize class (one whose first digit is not defined in this section) MUST be handled as a permanent failure. 9.2.2.1 Informational Events Events that fall within the Informational category are used to inform a peer that a request cannot be immediately satisfied, and a further response will be issued in the near future. DIAMETER_STILL_WORKING 1001 A request's Max-Wait-Time has expired, and the request is still being serviced. This event MAY be sent prior to the Max-Wait- Time expiration, to inform the peer that the request is not expected to be serviced in the allotted time, but the request is not being abandoned. It is important to note that receiving this event will result in another Diameter message being received with the same Hop-by-Hop and End-to-End identifiers. 9.2.2.2 Redirect Event Errors that fall within the Redirect Event category are used to inform a peer that the request cannot be satisfied locally and should instead be forwarded to another server. DIAMETER_REDIRECT_INDICATION 3001 A proxy or redirect server has determined that the request could not be satisfied locally and the initiator of the request should direct the request directly to the server, whose contact information has been added to the response. 9.2.2.3 Transient Failure Events Calhoun et al. expires October 2001 [Page 45] Internet-Draft May 2001 Errors that fall within the transient failures category are used to inform a peer that the request could not be satisfied at the time it was received, but MAY be able to satisfy the request if the error is corrected. DIAMETER_UNSUPPORTED_TRANSFORM 4001 A message was received that included an CMS-Data AVP [11] that made use of an unsupported transform. 9.2.2.4 Permanent Failure Events Errors that fall within the permanent failures category are used to inform the peer that the request failed, and cannot be satisfied by the originator of the Device-Status-Ind. The receiver of a DSI message with the DSI-Event set to a value that falls within this event class SHOULD forward the message to an alternate peer, if one is available. DIAMETER_INVALID_ROUTE_RECORD 5001 The last Route-Record AVP in the message is not set to the identity of the sender of the message. See Section 11.0 for more information. DIAMETER_COMMAND_UNSUPPORTED 5002 The Request contained a Command-Code that the receiver did not recognize or support. DIAMETER_UNABLE_TO_DELIVER 5003 The request could not be delivered to a host that handles the realm, and extension, requested at this time. DIAMETER_REALM_NOT_SERVED 5004 The originator of the DSI message could not deliver the message since the realm requested is unknown. DIAMETER_TOO_BUSY 5005 When returned, a Diameter node SHOULD attempt to sent the message to an alternate peer. This value MAY also be used to inform a peer that the request is not expected to be processed within the Max-Wait-Time value, and is giving up on the request. DIAMETER_CANNOT_PROCESS_IN_TIME 5006 The time limit in a request's Max-Wait-Time AVP has expired, and no response is available. DIAMETER_NO_COMMON_EXTENSION 5007 Calhoun et al. expires October 2001 [Page 46] Internet-Draft May 2001 This event is returned when a DRI message is received, and there are no common extensions supported between the peer. DIAMETER_UNSUPPORTED_VERSION 5008 This event is returned when a DRI message is received, and the Diameter message is unsupported. 9.3 Failed-AVP AVP The Failed-AVP AVP (AVP Code 279) is of type Grouped and provides debugging information in cases where a request is rejected or not fully processed due to erroneous information in a specific AVP. The value of the Result-Code AVP will provide information on the reason for the Failed-AVP AVP. Failed-AVP = Offending-AVP Failed-Vendor-Id Offending-AVP = ; See Section 9.4 Failed-Vendor-Id = ; See Section 9.5 A Diameter message MAY contain one or more Failed-AVP AVPs, each containing a complete AVP that could not be processed successfully. The possible reasons for this AVP are the presence of an improperly constructed AVP, an unsupported or unrecognized AVP, an invalid AVP value, the omission of a required AVP, the presence of an explicitly excluded AVP (see table 13.0), or the presence of two or more occurrences of an AVP which table 15.1 restricts to 0, 1, or 0-1 occurrences. +---------------------------------------------------------------+ | AVP Header (AVP Code = 279) | +---------------------------------------------------------------+ | Offending-AVP AVP | +---------------------------------------------------------------+ | Failed-Vendor-Id AVP | +---------------------------------------------------------------+ 9.4 Offending-AVP AVP The Offending-AVP AVP (AVP Code 271) is of type OctetString and contains the offending AVP. 9.5 Failed-Vendor-Id AVP The Failed-Vendor-Id AVP (AVP Code 262) is of type Unsigned32 and contains the Vendor-Id of the AVP that caused the error. Calhoun et al. expires October 2001 [Page 47] Internet-Draft May 2001 10.0 "User" Sessions Diameter can provide two different type of services to applications. The first involves authentication and authorization, and can optionally make use of accounting. The second only makes use of accounting. When a service makes use of the authentication and/or authorization portion of an extension, and a user requests access to the network, the Diameter client issues an auth request to its local server. The auth request is defined in a service specific Diameter extension (e.g. NASREQ). The request contains a Session-Id AVP, which is used in subsequent messages (e.g. subsequent authorization, accounting, etc) relating to the user's session. The Session-Id AVP is a means for the client and servers to correlate a Diameter message with a user session. When a Diameter server authorizes a user to use network resources, it SHOULD add the Authorization-Lifetime AVP to the response. The Authorization-Lifetime AVP defines the maximum amount of time a user MAY make use of the resources before another authorization request is to be transmitted to the server. If the server does not receive another authorization request before the timeout occurs, it SHOULD release any state information related to the user's session. Note that the Authorization-Lifetime AVP implies how long the Diameter server is willing to pay for the services rendered, therefore a Diameter client SHOULD NOT expect payment for services rendered past the session expiration time. The base protocol does not include any authorization request messages, since these are largely application-specific and are defined in a Diameter protocol extension document. However, the base protocol does define a set of messages that are used to terminate user sessions. These are used to allow servers that maintain state information to free resources. When a service only makes use of the Accounting portion of the Diameter protocol, even in combination with an extension, the Session-Id is still used to identify user sessions. However, the session termination messages are not used, since a session is signaled as being terminated by issuing an accounting stop message. 10.1 Authorization Session State Machine This section contains a finite state machine, representing the life cycle of Diameter sessions, and MUST be observed by all Diameter implementations that makes use of the authentication and/or Calhoun et al. expires October 2001 [Page 48] Internet-Draft May 2001 authorization portion of a Diameter extension. The term Service- Specific below refers to a message defined in a Diameter extension (e.g. Mobile IP, NASREQ). The following table contains the authorization session state machine. State Event Action New State ------------------------------------------------------------- Idle Client or Device Requests send Pending access service specific auth req Idle Service-Specific authorization send serv. Open request received, and specific successfully processed response Pending Successful Service-Specific Grant Open Authorization response Access received Open Authorization-Lifetime about send Open to expire on access device service specific auth req Open Successful Service-Specific Extend Open Authorization response Access received Open Accounting message sent or process Open received Open Failed Service-Specific Discon. Closed Authorization response user/device received. Open Session-Timeout Expires on send STR Discon Access Device Open STI Received send STR Discon Open Session-Timeout or send STI Discon Authorization-Lifetime expires on home AAA server Discon STI Received ignore Discon Calhoun et al. expires October 2001 [Page 49] Internet-Draft May 2001 Discon STR Received Send STA Closed Discon STA Received Discon. Closed user/device Closed Transition to state Cleanup When the Cleanup action is invoked, the Diameter node MAY attempt to release all resources for the particular session. Any event not listed above MUST be considered as an error condition, and a response, if applicable, MUST be returned to the originator of the message. 10.2 Accounting Session State Machine For applications that only require accounting services, the following state machine MUST be supported. State Event Action New State ------------------------------------------------------------- Idle Client or device requests send Pending access accounting start req. Idle Accounting start request send Open received, and successfully accounting processed. start answer Pending Successful accounting grant Open start answer received access Open Receive Interim Record send Open accounting answer Open User service terminated send Discon accounting stop req. Open Accounting stop request send Closed received, and successfully accounting processed stop answer Discon Successful accounting discon. Closed stop answer received user/device Calhoun et al. expires October 2001 [Page 50] Internet-Draft May 2001 10.3 Session-Id AVP The Session-Id AVP (AVP Code 263) is of type OctetString and is used to identify a specific session (see section 10.0). The Session-Id data uses the UTF-8 [24] character set. All messages pertaining to a specific session MUST include only one Session-Id AVP and the same value MUST be used throughout the life of a session. When present, the Session-Id SHOULD appear immediately following the Diameter Header (see section 3.0). For messages that do not pertain to a specific session, multiple Session-Id AVPs MAY be present as long as they are encapsulated within an AVP of type Grouped. The Session-Id MUST be globally unique at any given time since it is used by the server to identify the session (or flow). The format of the session identifier SHOULD be as follows: The monotonically increasing 32 bit value SHOULD NOT start at zero upon reboot, but rather start at a random value. This will minimize the possibility of overlapping Session-Ids after a reboot. Alternatively, an implementation MAY keep track of the increasing value in non-volatile memory. The optional value is implementation specific but may include a modem's device Id, a layer 2 address, timestamp, etc. The session Id is created by the Diameter device initiating the session, which in most cases is done by the client. Note that a Session-Id MAY be used by more than one extension (e.g. authentication for a specific service and accounting, both of which have separate extensions). 10.4 Authorization-Lifetime AVP The Authorization-Lifetime AVP (AVP Code 291) is of type Unsigned32 and contains the maximum number of seconds of service to be provided to the user before the user is to be re-authenticated and/or re- authorized. Great care should be taken when the Authorization- Lifetime value is determined, since a low value could create significant Diameter traffic, which could congest both the network and the servers. If both this AVP and the Session-Timeout AVP are present in a message, the value of the latter MUST NOT be smaller than the Calhoun et al. expires October 2001 [Page 51] Internet-Draft May 2001 Authorization-Lifetime AVP. This AVP MAY be provided by the client as a hint of the maximum duration that it is willing to accept. However, the server DOES NOT have to observe the hint, and MAY return a value that is smaller than the hint. A value of zero means that no re-authorization is required. 10.5 Session-Timeout AVP The Session-Timeout AVP (AVP Code 27) [1] is of type Unsigned32 and contains the maximum number of seconds of service to be provided to the user before termination of the session. A session terminated due to the Session-Timeout expiration MUST NOT generate a re- authentication and/or re-authorization. A value of zero, or the absence of this AVP, means that this session has an unlimited number of seconds before termination. This AVP MAY be provided by the client as a hint of the maximum duration that it is willing to accept. However, the server DOES NOT have to observe the hint, and MAY return a value that is smaller than the hint. 10.6 User-Name AVP The User-Name AVP (AVP Code 1) [1] is of type OctetString, which contains the User-Name. The value is represented as a UTF-8 character encoded string in a format consistent with the NAI specification [8]. 10.7 Max-Wait-Time AVP The Max-Wait-Time AVP (AVP Code 295) is of type Unsigned32, and contains the maximum number of milliseconds the downstream server is willing to wait for a response. A server that determines that it cannot satisfy a request within the requested time MUST issue a DSI message with the DSI-Event set to DIAMETER_STILL_WORKING or DIAMETER_CANNOT_PROCESS_IN_TIME. 10.8 Session Termination The Diameter Base Protocol provides a set of messages that MUST be used by any peer to explicitly request that a previously authenticated and/or authorized session be terminated. Since the Calhoun et al. expires October 2001 [Page 52] Internet-Draft May 2001 Session-Id is typically tied to a particular service (i.e. Mobile IP, NASREQ, etc), the session termination messages are used to request that the service tied to the Session Id be terminated. Session Termination MAY be initiated by a Diameter server, by issuing a Session-Termination-Ind (STI) message to the access device. An access device MUST issue a Session-Termination-Request (STR) message either upon receipt of an STI, or when service to a particular user is terminated. A Diameter server MUST clean up resources (e.g. session state) if a session's authorization lifetime has expired, and no STR was received. This event could occur if an access device was to unexpectedly reboot. An access device MUST issue Session-Termination-Request messages for all active session prior to an orderly reboot. 10.8.1 Session-Termination-Ind The Session-Termination-Ind (STI), indicated by the Command-Code set to 274 and the message flags' 'I' bit set, MAY be sent by any Diameter entity to the access device to request that a particular session be terminated. This message MAY be used when a server detects that a session MUST be terminated, which is typically done as a policy decision (e.g. local resources have been expended, etc). The Destination-FQDN AVP MUST be present, and contain the fully qualified domain name of the access device that initiated the session (see section 10.0). A Failed STI would contain the same Command-Code, but would require that only be 'F' bit be set. Upon receipt of the STI message, the access device MUST issue a Session-Terminate-Request message. Message Format Calhoun et al. expires October 2001 [Page 53] Internet-Draft May 2001 ::= < Diameter Header: 274, I > < Session-Id > { Origin-FQDN } { Origin-Realm } { User-Name } { Destination-Realm } { Destination-FQDN } * [ AVP ] * [ Proxy-Info ] * [ Route-Record ] 10.8.2 Session-Termination-Request The Session-Termination-Request (STR), indicated by the Command-Code set to 275 and the message flags' 'R' bit set, is sent by the access device to inform the Diameter Server that an authenticated and/or authorized session is being terminated. If the STR message is generated upon receipt of an STI, the Route- Record AVPs in the STI MUST NOT be added to the STR. Message Format ::= < Diameter Header: 275, R > < Session-Id > { Origin-FQDN } { Origin-Realm } { User-Name } { Destination-Realm } { Destination-FQDN } [ Max-Wait-Time ] * [ AVP ] * [ Proxy-Info ] * [ Route-Record ] 10.8.3 Session-Termination-Answer The Session-Termination-Answer (STA), indicated by the Command-Code set to 275 and the message flags' 'A' bit set, is sent by the Diameter Server to acknowledge that the session has been terminated. The Result-Code AVP MUST be present, and MAY contain an indication that an error occurred while servicing the STR. Upon sending or receipt of the STA, the Diameter Server MUST release all resources for the session indicated by the Session-Id AVP. Any intermediate server in the Proxy-Chain MAY also release any Calhoun et al. expires October 2001 [Page 54] Internet-Draft May 2001 resources, if necessary. Message Format ::= < Diameter Header: 275, A > < Session-Id > { Result-Code } { Origin-FQDN } { Origin-Realm } { Destination-FQDN } { User-Name } * [ AVP ] * [ Proxy-Info ] * [ Route-Record ] 11.0 Message Routing This section describes the expected behavior of a Diameter server acting as a proxy or redirect server. 11.1 Realm-Based Message Routing Diameter request and indication message routing is done via realms. A Diameter entity creating a message that is proxyable MUST include the realm in the Destination-Realm AVP. The realm MAY be retrieved from the User-Name AVP, which is in the form of a Network Access Identifier (NAI). The realm portion of the NAI is inserted in the Destination-Realm AVP. Diameter servers have a list of locally supported realms, and MAY have a list of externally supported realms. When a request or indication message is received that includes a realm that is not locally supported, the message is proxied to the Diameter entity configured in the "route" table (see section 11.1.1). Figure 2 depicts an example where NAS is an access device and receives a request for network access from jow@abc.com. NAS looks up "abc.com" in its local realm route table and determines that the message must be proxied to PRS (Proxy Server). PRS does the same check, and proxies the message to HMS (Home Server). HMS checks its realm route table, and determines that the realm is locally supported, and processes the authentication request, and returns the response. How the response actually makes it back to the sender of the original request is described in the next section. Calhoun et al. expires October 2001 [Page 55] Internet-Draft May 2001 (Origin-FQDN=nas.mno.net) (Origin-FQDN=nas.mno.net) (Origin-Realm=mno.net) (Origin-Realm=mno.net) (Destination-Realm=abc.com) (Destination-Realm=abc.com) (Route-Record=prs.mno.net) +------+ ------> +------+ ------> +------+ | | (Request) | | (Request) | | | NAS +-------------------+ PRS +-------------------+ HMS | | | | | | | +------+ <------ +------+ <------ +------+ mno.net (Answer) mno.net (Answer) abc.com (Origin-FQDN=hms.abc.com) (Origin-FQDN=hms.abc.com) (Origin-Realm=abc.com) (Origin-Realm=abc.com) (Destination-FQDN=nas.mno.net) (Destination-FQDN=nas.mno.net) (Route-Record=prs.mno.net) Figure 2: Realm-Based Routing The above example can also be used for Indication and Failed- Indication messages. Note the processing rules contained in this section are intended to be used as general guidelines to Diameter developers. Certain implementations MAY use different methods than the ones described here, and still be in compliance with the protocol specification. 11.1.1 Realm-Based Routing Table All Realm-Based routing lookups are performed against what is commonly known as the Domain Routing Table (see section 18.0). A Domain Routing Table Entry contains the following fields: - Domain Name. The Domain Name is analogous to the realm portion of the NAI. This is the field that is typically used as a primary key in the routing table lookups. Note that some implementations perform their lookups based on longest-match- from-the-right on the realm rather than requiring an exact match. - Extension Identifier. It is possible for a routing entry to have a different destination based on the Auth-Extension-Id (for accounting messages) or Acct-Extension-Id (for non-accounting messages) of the message. This field is typically used as a secondary key field in routing table lookups. - Local Action. The Local Action field is used to identify how a message should be treated. The following actions are supported: 1. LOCAL - Diameter messages that resolve to a routing entry with the Local Action set to Local can be satisfied locally, and do not need to be forwarded to another server. 2. PROXY - All Diameter messages that fall within this category MUST be forwarded to a next hop server. The local Calhoun et al. expires October 2001 [Page 56] Internet-Draft May 2001 server MAY apply its local policies to the message by including new AVPs to the message prior to forwarding. See section 11.4 for more information. 3. REDIRECT - Diameter messages that fall within this category MUST have the identity of the home Diameter server(s) appended, and returned to the sender of the message. See section 11.3 for more information. - Server Identifier - One or more servers the message is to be forwarded to. When the Local Action is set to PROXY, this field contains the identities of the server(s) the message must be forwarded to. When the Local Action field is set to REDIRECT, this field contains the Home Diameter server(s) for the realm. It is important to note that Diameter servers MUST support at least one of the PROXY, REDIRECT, or LOCAL modes of operation. Servers do not need to support all modes of operation in order to conform with the protocol specification. Servers MUST NOT reorder AVPs with the same AVP Code. When a message is being proxied, the servers in a given domain routing entry MUST have advertised the Extension Identifier (see section 6.1) for the given message, or have advertised the Wildcard Extension. 11.2 Proxy and Redirect Server handling of requests When a message of type request or indication is received by a proxy or redirect server, and it is determined that the request cannot be locally handled, the next hop for the request is determined in the following order: 1. If the Destination-FQDN AVP is present, and the host specified in the AVP can be directly contacted, the message is forwarded to the host (see section 5.1 for more information), or 2. If the Destination-Realm AVP is present, a routing table lookup is performed using the domain specific in the AVP. A message that does not contain any of the above AVPs MUST NOT be routed. If the message in question cannot be handled locally, an answer or failed indication is sent with the Result-Code AVP set to an appropriate error condition. 11.3 Redirect Server A Redirect Server is one that provides Realm to Diameter Home Server address resolution. When a message is received by a peer, the Destination-Realm AVP (or the User-Name AVP if the Destination-Realm Calhoun et al. expires October 2001 [Page 57] Internet-Draft May 2001 AVP is not present) is extracted from the message, and is used to perform a lookup in the domain routing table. Implementations MAY also use the Extension Identifiers as a secondary key in the domain routing table lookup. Successful routing table lookups will return one or more home Diameter servers that could satisfy the message. The home servers are encoded in one or more Redirect-Host AVPs, and the Command-Code field is set to Device-Status-Ind. The Hop-by-Hop field in the Diameter