idnits 2.17.1 draft-ietf-dime-rfc3588bis-26.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There is 1 instance of too long lines in the document, the longest one being 3 characters in excess of 72. == There are 2 instances of lines with non-RFC2606-compliant FQDNs in the document. -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? -- The draft header indicates that this document obsoletes RFC3588, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 6494 has weird spacing: '...service rege...' == Line 6515 has weird spacing: '...service rege...' -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (January 20, 2011) is 4845 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'TBD' is mentioned on line 6147, but not defined == Missing Reference: 'PXY' is mentioned on line 4253, but not defined == Unused Reference: 'RADTYPE' is defined on line 6271, but no explicit reference was found in the text == Unused Reference: 'RFC3692' is defined on line 6411, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'FLOATPOINT' -- Possible downref: Non-RFC (?) normative reference: ref. 'IANAADFAM' -- Possible downref: Non-RFC (?) normative reference: ref. 'RADTYPE' ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) ** Obsolete normative reference: RFC 4005 (Obsoleted by RFC 7155) ** Obsolete normative reference: RFC 4006 (Obsoleted by RFC 8506) ** Obsolete normative reference: RFC 3588 (Obsoleted by RFC 6733) ** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126) ** Obsolete normative reference: RFC 4282 (Obsoleted by RFC 7542) ** Obsolete normative reference: RFC 4960 (Obsoleted by RFC 9260) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 4347 (Obsoleted by RFC 6347) Summary: 10 errors (**), 0 flaws (~~), 8 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 DIME V. Fajardo, Ed. 3 Internet-Draft Telcordia Technologies 4 Obsoletes: 3588 (if approved) J. Arkko 5 Intended status: Standards Track Ericsson Research 6 Expires: July 24, 2011 J. Loughney 7 Nokia Research Center 8 G. Zorn 9 Network Zen 10 January 20, 2011 12 Diameter Base Protocol 13 draft-ietf-dime-rfc3588bis-26.txt 15 Abstract 17 The Diameter base protocol is intended to provide an Authentication, 18 Authorization and Accounting (AAA) framework for applications such as 19 network access or IP mobility in both local and roaming situations. 20 This document specifies the message format, transport, error 21 reporting, accounting and security services used by all Diameter 22 applications. The Diameter base protocol as defined in this document 23 must be supported by all Diameter implementations. 25 Status of this Memo 27 This Internet-Draft is submitted in full conformance with the 28 provisions of BCP 78 and BCP 79. 30 Internet-Drafts are working documents of the Internet Engineering 31 Task Force (IETF). Note that other groups may also distribute 32 working documents as Internet-Drafts. The list of current Internet- 33 Drafts is at http://datatracker.ietf.org/drafts/current/. 35 Internet-Drafts are draft documents valid for a maximum of six months 36 and may be updated, replaced, or obsoleted by other documents at any 37 time. It is inappropriate to use Internet-Drafts as reference 38 material or to cite them other than as "work in progress." 40 This Internet-Draft will expire on July 24, 2011. 42 Copyright Notice 44 Copyright (c) 2011 IETF Trust and the persons identified as the 45 document authors. All rights reserved. 47 This document is subject to BCP 78 and the IETF Trust's Legal 48 Provisions Relating to IETF Documents 49 (http://trustee.ietf.org/license-info) in effect on the date of 50 publication of this document. Please review these documents 51 carefully, as they describe your rights and restrictions with respect 52 to this document. Code Components extracted from this document must 53 include Simplified BSD License text as described in Section 4.e of 54 the Trust Legal Provisions and are provided without warranty as 55 described in the Simplified BSD License. 57 Table of Contents 59 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 60 1.1. Diameter Protocol . . . . . . . . . . . . . . . . . . . . 8 61 1.1.1. Description of the Document Set . . . . . . . . . . . 9 62 1.1.2. Conventions Used in This Document . . . . . . . . . . 10 63 1.1.3. Changes from RFC3588 . . . . . . . . . . . . . . . . 10 64 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 12 65 1.3. Approach to Extensibility . . . . . . . . . . . . . . . . 17 66 1.3.1. Defining New AVP Values . . . . . . . . . . . . . . . 18 67 1.3.2. Creating New AVPs . . . . . . . . . . . . . . . . . . 18 68 1.3.3. Creating New Commands . . . . . . . . . . . . . . . . 18 69 1.3.4. Creating New Diameter Applications . . . . . . . . . 19 70 2. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 21 71 2.1. Transport . . . . . . . . . . . . . . . . . . . . . . . . 22 72 2.1.1. SCTP Guidelines . . . . . . . . . . . . . . . . . . . 23 73 2.2. Securing Diameter Messages . . . . . . . . . . . . . . . 24 74 2.3. Diameter Application Compliance . . . . . . . . . . . . . 24 75 2.4. Application Identifiers . . . . . . . . . . . . . . . . . 24 76 2.5. Connections vs. Sessions . . . . . . . . . . . . . . . . 25 77 2.6. Peer Table . . . . . . . . . . . . . . . . . . . . . . . 26 78 2.7. Routing Table . . . . . . . . . . . . . . . . . . . . . . 27 79 2.8. Role of Diameter Agents . . . . . . . . . . . . . . . . . 28 80 2.8.1. Relay Agents . . . . . . . . . . . . . . . . . . . . 29 81 2.8.2. Proxy Agents . . . . . . . . . . . . . . . . . . . . 30 82 2.8.3. Redirect Agents . . . . . . . . . . . . . . . . . . . 31 83 2.8.4. Translation Agents . . . . . . . . . . . . . . . . . 32 84 2.9. Diameter Path Authorization . . . . . . . . . . . . . . . 33 85 3. Diameter Header . . . . . . . . . . . . . . . . . . . . . . . 35 86 3.1. Command Codes . . . . . . . . . . . . . . . . . . . . . . 38 87 3.2. Command Code ABNF specification . . . . . . . . . . . . . 38 88 3.3. Diameter Command Naming Conventions . . . . . . . . . . . 41 89 4. Diameter AVPs . . . . . . . . . . . . . . . . . . . . . . . . 42 90 4.1. AVP Header . . . . . . . . . . . . . . . . . . . . . . . 42 91 4.1.1. Optional Header Elements . . . . . . . . . . . . . . 43 92 4.2. Basic AVP Data Formats . . . . . . . . . . . . . . . . . 44 93 4.3. Derived AVP Data Formats . . . . . . . . . . . . . . . . 45 94 4.3.1. Common Derived AVPs . . . . . . . . . . . . . . . . . 45 95 4.4. Grouped AVP Values . . . . . . . . . . . . . . . . . . . 52 96 4.4.1. Example AVP with a Grouped Data type . . . . . . . . 53 97 4.5. Diameter Base Protocol AVPs . . . . . . . . . . . . . . . 56 98 5. Diameter Peers . . . . . . . . . . . . . . . . . . . . . . . 59 99 5.1. Peer Connections . . . . . . . . . . . . . . . . . . . . 59 100 5.2. Diameter Peer Discovery . . . . . . . . . . . . . . . . . 60 101 5.3. Capabilities Exchange . . . . . . . . . . . . . . . . . . 61 102 5.3.1. Capabilities-Exchange-Request . . . . . . . . . . . . 63 103 5.3.2. Capabilities-Exchange-Answer . . . . . . . . . . . . 63 104 5.3.3. Vendor-Id AVP . . . . . . . . . . . . . . . . . . . . 64 105 5.3.4. Firmware-Revision AVP . . . . . . . . . . . . . . . . 64 106 5.3.5. Host-IP-Address AVP . . . . . . . . . . . . . . . . . 64 107 5.3.6. Supported-Vendor-Id AVP . . . . . . . . . . . . . . . 65 108 5.3.7. Product-Name AVP . . . . . . . . . . . . . . . . . . 65 109 5.4. Disconnecting Peer connections . . . . . . . . . . . . . 65 110 5.4.1. Disconnect-Peer-Request . . . . . . . . . . . . . . . 66 111 5.4.2. Disconnect-Peer-Answer . . . . . . . . . . . . . . . 66 112 5.4.3. Disconnect-Cause AVP . . . . . . . . . . . . . . . . 66 113 5.5. Transport Failure Detection . . . . . . . . . . . . . . . 67 114 5.5.1. Device-Watchdog-Request . . . . . . . . . . . . . . . 67 115 5.5.2. Device-Watchdog-Answer . . . . . . . . . . . . . . . 67 116 5.5.3. Transport Failure Algorithm . . . . . . . . . . . . . 68 117 5.5.4. Failover and Failback Procedures . . . . . . . . . . 68 118 5.6. Peer State Machine . . . . . . . . . . . . . . . . . . . 69 119 5.6.1. Incoming connections . . . . . . . . . . . . . . . . 71 120 5.6.2. Events . . . . . . . . . . . . . . . . . . . . . . . 72 121 5.6.3. Actions . . . . . . . . . . . . . . . . . . . . . . . 73 122 5.6.4. The Election Process . . . . . . . . . . . . . . . . 75 123 6. Diameter message processing . . . . . . . . . . . . . . . . . 76 124 6.1. Diameter Request Routing Overview . . . . . . . . . . . . 76 125 6.1.1. Originating a Request . . . . . . . . . . . . . . . . 77 126 6.1.2. Sending a Request . . . . . . . . . . . . . . . . . . 77 127 6.1.3. Receiving Requests . . . . . . . . . . . . . . . . . 78 128 6.1.4. Processing Local Requests . . . . . . . . . . . . . . 78 129 6.1.5. Request Forwarding . . . . . . . . . . . . . . . . . 78 130 6.1.6. Request Routing . . . . . . . . . . . . . . . . . . . 78 131 6.1.7. Predictive Loop Avoidance . . . . . . . . . . . . . . 79 132 6.1.8. Redirecting Requests . . . . . . . . . . . . . . . . 79 133 6.1.9. Relaying and Proxying Requests . . . . . . . . . . . 80 134 6.2. Diameter Answer Processing . . . . . . . . . . . . . . . 82 135 6.2.1. Processing received Answers . . . . . . . . . . . . . 82 136 6.2.2. Relaying and Proxying Answers . . . . . . . . . . . . 82 137 6.3. Origin-Host AVP . . . . . . . . . . . . . . . . . . . . . 83 138 6.4. Origin-Realm AVP . . . . . . . . . . . . . . . . . . . . 83 139 6.5. Destination-Host AVP . . . . . . . . . . . . . . . . . . 83 140 6.6. Destination-Realm AVP . . . . . . . . . . . . . . . . . . 84 141 6.7. Routing AVPs . . . . . . . . . . . . . . . . . . . . . . 84 142 6.7.1. Route-Record AVP . . . . . . . . . . . . . . . . . . 84 143 6.7.2. Proxy-Info AVP . . . . . . . . . . . . . . . . . . . 84 144 6.7.3. Proxy-Host AVP . . . . . . . . . . . . . . . . . . . 85 145 6.7.4. Proxy-State AVP . . . . . . . . . . . . . . . . . . . 85 146 6.8. Auth-Application-Id AVP . . . . . . . . . . . . . . . . . 85 147 6.9. Acct-Application-Id AVP . . . . . . . . . . . . . . . . . 85 148 6.10. Inband-Security-Id AVP . . . . . . . . . . . . . . . . . 85 149 6.11. Vendor-Specific-Application-Id AVP . . . . . . . . . . . 86 150 6.12. Redirect-Host AVP . . . . . . . . . . . . . . . . . . . . 87 151 6.13. Redirect-Host-Usage AVP . . . . . . . . . . . . . . . . . 87 152 6.14. Redirect-Max-Cache-Time AVP . . . . . . . . . . . . . . . 88 153 7. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 90 154 7.1. Result-Code AVP . . . . . . . . . . . . . . . . . . . . . 92 155 7.1.1. Informational . . . . . . . . . . . . . . . . . . . . 92 156 7.1.2. Success . . . . . . . . . . . . . . . . . . . . . . . 93 157 7.1.3. Protocol Errors . . . . . . . . . . . . . . . . . . . 93 158 7.1.4. Transient Failures . . . . . . . . . . . . . . . . . 94 159 7.1.5. Permanent Failures . . . . . . . . . . . . . . . . . 95 160 7.2. Error Bit . . . . . . . . . . . . . . . . . . . . . . . . 98 161 7.3. Error-Message AVP . . . . . . . . . . . . . . . . . . . . 99 162 7.4. Error-Reporting-Host AVP . . . . . . . . . . . . . . . . 99 163 7.5. Failed-AVP AVP . . . . . . . . . . . . . . . . . . . . . 99 164 7.6. Experimental-Result AVP . . . . . . . . . . . . . . . . . 100 165 7.7. Experimental-Result-Code AVP . . . . . . . . . . . . . . 100 166 8. Diameter User Sessions . . . . . . . . . . . . . . . . . . . 101 167 8.1. Authorization Session State Machine . . . . . . . . . . . 102 168 8.2. Accounting Session State Machine . . . . . . . . . . . . 107 169 8.3. Server-Initiated Re-Auth . . . . . . . . . . . . . . . . 112 170 8.3.1. Re-Auth-Request . . . . . . . . . . . . . . . . . . . 112 171 8.3.2. Re-Auth-Answer . . . . . . . . . . . . . . . . . . . 113 172 8.4. Session Termination . . . . . . . . . . . . . . . . . . . 114 173 8.4.1. Session-Termination-Request . . . . . . . . . . . . . 115 174 8.4.2. Session-Termination-Answer . . . . . . . . . . . . . 115 175 8.5. Aborting a Session . . . . . . . . . . . . . . . . . . . 116 176 8.5.1. Abort-Session-Request . . . . . . . . . . . . . . . . 116 177 8.5.2. Abort-Session-Answer . . . . . . . . . . . . . . . . 117 178 8.6. Inferring Session Termination from Origin-State-Id . . . 118 179 8.7. Auth-Request-Type AVP . . . . . . . . . . . . . . . . . . 118 180 8.8. Session-Id AVP . . . . . . . . . . . . . . . . . . . . . 119 181 8.9. Authorization-Lifetime AVP . . . . . . . . . . . . . . . 120 182 8.10. Auth-Grace-Period AVP . . . . . . . . . . . . . . . . . . 121 183 8.11. Auth-Session-State AVP . . . . . . . . . . . . . . . . . 121 184 8.12. Re-Auth-Request-Type AVP . . . . . . . . . . . . . . . . 121 185 8.13. Session-Timeout AVP . . . . . . . . . . . . . . . . . . . 122 186 8.14. User-Name AVP . . . . . . . . . . . . . . . . . . . . . . 122 187 8.15. Termination-Cause AVP . . . . . . . . . . . . . . . . . . 122 188 8.16. Origin-State-Id AVP . . . . . . . . . . . . . . . . . . . 124 189 8.17. Session-Binding AVP . . . . . . . . . . . . . . . . . . . 124 190 8.18. Session-Server-Failover AVP . . . . . . . . . . . . . . . 125 191 8.19. Multi-Round-Time-Out AVP . . . . . . . . . . . . . . . . 126 192 8.20. Class AVP . . . . . . . . . . . . . . . . . . . . . . . . 126 193 8.21. Event-Timestamp AVP . . . . . . . . . . . . . . . . . . . 126 194 9. Accounting . . . . . . . . . . . . . . . . . . . . . . . . . 127 195 9.1. Server Directed Model . . . . . . . . . . . . . . . . . . 127 196 9.2. Protocol Messages . . . . . . . . . . . . . . . . . . . . 128 197 9.3. Accounting Application Extension and Requirements . . . . 128 198 9.4. Fault Resilience . . . . . . . . . . . . . . . . . . . . 129 199 9.5. Accounting Records . . . . . . . . . . . . . . . . . . . 129 200 9.6. Correlation of Accounting Records . . . . . . . . . . . . 130 201 9.7. Accounting Command-Codes . . . . . . . . . . . . . . . . 131 202 9.7.1. Accounting-Request . . . . . . . . . . . . . . . . . 131 203 9.7.2. Accounting-Answer . . . . . . . . . . . . . . . . . . 132 204 9.8. Accounting AVPs . . . . . . . . . . . . . . . . . . . . . 133 205 9.8.1. Accounting-Record-Type AVP . . . . . . . . . . . . . 133 206 9.8.2. Acct-Interim-Interval AVP . . . . . . . . . . . . . . 134 207 9.8.3. Accounting-Record-Number AVP . . . . . . . . . . . . 135 208 9.8.4. Acct-Session-Id AVP . . . . . . . . . . . . . . . . . 135 209 9.8.5. Acct-Multi-Session-Id AVP . . . . . . . . . . . . . . 135 210 9.8.6. Accounting-Sub-Session-Id AVP . . . . . . . . . . . . 135 211 9.8.7. Accounting-Realtime-Required AVP . . . . . . . . . . 136 212 10. AVP Occurrence Table . . . . . . . . . . . . . . . . . . . . 137 213 10.1. Base Protocol Command AVP Table . . . . . . . . . . . . . 137 214 10.2. Accounting AVP Table . . . . . . . . . . . . . . . . . . 138 215 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 140 216 11.1. Changes to AVP Header Allocation . . . . . . . . . . . . 140 217 11.2. Diameter Header . . . . . . . . . . . . . . . . . . . . . 140 218 11.3. AVP Values . . . . . . . . . . . . . . . . . . . . . . . 140 219 11.3.1. Experimental-Result-Code AVP . . . . . . . . . . . . 140 220 11.4. Diameter TCP, SCTP, TLS/TCP and DTLS/SCTP Port Numbers . 141 221 11.5. S-NAPTR Parameters . . . . . . . . . . . . . . . . . . . 141 222 12. Diameter protocol related configurable parameters . . . . . . 142 223 13. Security Considerations . . . . . . . . . . . . . . . . . . . 143 224 13.1. TLS/TCP and DTLS/SCTP Usage . . . . . . . . . . . . . . . 143 225 13.2. Peer-to-Peer Considerations . . . . . . . . . . . . . . . 144 226 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 145 227 14.1. Normative References . . . . . . . . . . . . . . . . . . 145 228 14.2. Informational References . . . . . . . . . . . . . . . . 147 229 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 149 230 A.1. RFC3588bis . . . . . . . . . . . . . . . . . . . . . . . 149 231 A.2. RFC3588 . . . . . . . . . . . . . . . . . . . . . . . . . 150 232 Appendix B. S-NAPTR Example . . . . . . . . . . . . . . . . . . 151 233 Appendix C. Duplicate Detection . . . . . . . . . . . . . . . . 152 234 Appendix D. Internationalized Domain Names . . . . . . . . . . . 154 235 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 155 237 1. Introduction 239 Authentication, Authorization and Accounting (AAA) protocols such as 240 TACACS [RFC1492] and RADIUS [RFC2865] were initially deployed to 241 provide dial-up PPP [RFC1661] and terminal server access. Over time, 242 AAA support was needed on many new access technologies, the scale and 243 complexity of AAA networks grew, and AAA was also used on new 244 applications (such as voice over IP). This lead to new demands on 245 AAA protocols. 247 Network access requirements for AAA protocols are summarized in 248 [RFC2989]. These include: 250 Failover 252 [RFC2865] does not define failover mechanisms, and as a result, 253 failover behavior differs between implementations. In order to 254 provide well-defined failover behavior, Diameter supports 255 application-layer acknowledgements, and defines failover 256 algorithms and the associated state machine. This is described in 257 Section 5.5 and [RFC3539]. 259 Transmission-level security 261 [RFC2865] defines an application-layer authentication and 262 integrity scheme that is required only for use with Response 263 packets. While [RFC2869] defines an additional authentication and 264 integrity mechanism, use is only required during Extensible 265 Authentication Protocol (EAP) sessions. While attribute-hiding is 266 supported, [RFC2865] does not provide support for per-packet 267 confidentiality. In accounting, [RFC2866] assumes that replay 268 protection is provided by the backend billing server, rather than 269 within the protocol itself. 271 While [RFC3162] defines the use of IPsec with RADIUS, support for 272 IPsec is not required. In order to provide universal support for 273 transmission-level security, and enable both intra- and inter- 274 domain AAA deployments, Diameter provides support for TLS/TCP and 275 DTLS/SCTP. Security is discussed in Section 13. 277 Reliable transport 279 RADIUS runs over UDP, and does not define retransmission behavior; 280 as a result, reliability varies between implementations. As 281 described in [RFC2975], this is a major issue in accounting, where 282 packet loss may translate directly into revenue loss. In order to 283 provide well defined transport behavior, Diameter runs over 284 reliable transport mechanisms (TCP, SCTP) as defined in [RFC3539]. 286 Agent support 288 [RFC2865] does not provide for explicit support for agents, 289 including Proxies, Redirects and Relays. Since the expected 290 behavior is not defined, it varies between implementations. 291 Diameter defines agent behavior explicitly; this is described in 292 Section 2.8. 294 Server-initiated messages 296 While RADIUS server-initiated messages are defined in [RFC5176], 297 support is optional. This makes it difficult to implement 298 features such as unsolicited disconnect or re-authentication/ 299 re-authorization on demand across a heterogeneous deployment. To 300 tackle this issue, support for server-initiated messages is 301 mandatory in Diameter. 303 Transition support 305 While Diameter does not share a common protocol data unit (PDU) 306 with RADIUS, considerable effort has been expended in enabling 307 backward compatibility with RADIUS, so that the two protocols may 308 be deployed in the same network. Initially, it is expected that 309 Diameter will be deployed within new network devices, as well as 310 within gateways enabling communication between legacy RADIUS 311 devices and Diameter agents. This capability enables Diameter 312 support to be added to legacy networks, by addition of a gateway 313 or server speaking both RADIUS and Diameter. 315 In addition to addressing the above requirements, Diameter also 316 provides support for the following: 318 Capability negotiation 320 RADIUS does not support error messages, capability negotiation, or 321 a mandatory/non-mandatory flag for attributes. Since RADIUS 322 clients and servers are not aware of each other's capabilities, 323 they may not be able to successfully negotiate a mutually 324 acceptable service, or in some cases, even be aware of what 325 service has been implemented. Diameter includes support for error 326 handling (Section 7), capability negotiation (Section 5.3), and 327 mandatory/non-mandatory Attribute-Value Pairs (AVPs) (Section 328 4.1). 330 Peer discovery and configuration 332 RADIUS implementations typically require that the name or address 333 of servers or clients be manually configured, along with the 334 corresponding shared secrets. This results in a large 335 administrative burden, and creates the temptation to reuse the 336 RADIUS shared secret, which can result in major security 337 vulnerabilities if the Request Authenticator is not globally and 338 temporally unique as required in [RFC2865]. Through DNS, Diameter 339 enables dynamic discovery of peers (see Section 5.2). Derivation 340 of dynamic session keys is enabled via transmission-level 341 security. 343 Over time, the capabilities of Network Access Server (NAS) devices 344 have increased substantially. As a result, while Diameter is a 345 considerably more sophisticated protocol than RADIUS, it remains 346 feasible to implement it within embedded devices. 348 1.1. Diameter Protocol 350 The Diameter base protocol provides the following facilities: 352 o Ability to exchange messages and deliver AVPs 354 o Capabilities negotiation 356 o Error notification 358 o Extensibility, through addition of new applications, commands and 359 AVPs (required in [RFC2989]). 361 o Basic services necessary for applications, such as handling of 362 user sessions or accounting 364 All data delivered by the protocol is in the form of AVPs. Some of 365 these AVP values are used by the Diameter protocol itself, while 366 others deliver data associated with particular applications that 367 employ Diameter. AVPs may be arbitrarily added to Diameter messages, 368 the only restriction being that the Augmented Backus-Naur Form (ABNF, 369 [RFC5234]) Command Code syntax specification (Section 3.2) is 370 satisfied. AVPs are used by the base Diameter protocol to support 371 the following required features: 373 o Transporting of user authentication information, for the purposes 374 of enabling the Diameter server to authenticate the user. 376 o Transporting of service-specific authorization information, 377 between client and servers, allowing the peers to decide whether a 378 user's access request should be granted. 380 o Exchanging resource usage information, which may be used for 381 accounting purposes, capacity planning, etc. 383 o Routing, relaying, proxying and redirecting of Diameter messages 384 through a server hierarchy. 386 The Diameter base protocol satisfies the minimum requirements for an 387 AAA protocol, as specified by [RFC2989]. The base protocol may be 388 used by itself for accounting purposes only, or it may be used with a 389 Diameter application, such as Mobile IPv4 [RFC4004], or network 390 access [RFC4005]. It is also possible for the base protocol to be 391 extended for use in new applications, via the addition of new 392 commands or AVPs. The initial focus of Diameter was network access 393 and accounting applications. A truly generic AAA protocol used by 394 many applications might provide functionality not provided by 395 Diameter. Therefore, it is imperative that the designers of new 396 applications understand their requirements before using Diameter. 397 See Section 2.4 for more information on Diameter applications. 399 Any node can initiate a request. In that sense, Diameter is a peer- 400 to-peer protocol. In this document, a Diameter Client is a device at 401 the edge of the network that performs access control, such as a 402 Network Access Server (NAS) or a Foreign Agent (FA). A Diameter 403 client generates Diameter messages to request authentication, 404 authorization, and accounting services for the user. A Diameter 405 agent is a node that does not provide local user authentication or 406 authorization services; agents include proxies, redirects and relay 407 agents. A Diameter server performs authentication and/or 408 authorization of the user. A Diameter node may act as an agent for 409 certain requests while acting as a server for others. 411 The Diameter protocol also supports server-initiated messages, such 412 as a request to abort service to a particular user. 414 1.1.1. Description of the Document Set 416 The Diameter specification consists of an updated version of the base 417 protocol specification (this document) and the Transport Profile 418 [RFC3539]. This document obsoletes RFC 3588. A summary of the base 419 protocol updates included in this document can be found in 420 Section 1.1.3. 422 This document defines the base protocol specification for AAA, which 423 includes support for accounting. There are also a myriad of 424 applications documents describing applications that use this base 425 specification for Authentication, Authorization and Accounting. 426 These application documents specify how to use the Diameter protocol 427 within the context of their application. 429 The Transport Profile document [RFC3539] discusses transport layer 430 issues that arise with AAA protocols and recommendations on how to 431 overcome these issues. This document also defines the Diameter 432 failover algorithm and state machine. 434 Clarifications on the Routing of Diameter Request based on Username 435 and the Realm [RFC5729] defines specific behavior on how to route 436 request based on the content of the User-Name AVP (Attribute Value 437 Pair). 439 1.1.2. Conventions Used in This Document 441 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 442 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 443 document are to be interpreted as described in [RFC2119]. 445 1.1.3. Changes from RFC3588 447 This document obsoletes RFC 3588 but is fully backward compatible 448 with that document. The changes introduced in this document focus on 449 fixing issues that have surfaced during implementation of [RFC3588]. 450 An overview of some the major changes are given below. 452 o Deprecated the use of Inband-Security AVP for negotiating 453 transport layer security. It has been generally considered that 454 bootstrapping of TLS via Inband-Security AVP creates certain 455 security risk because it does not completely protect the 456 information carried in the CER (Capabilities Exchange Request)/CEA 457 (Capabilities Exchange Answer). This version of Diameter adopted 458 a common approach of defining a well-known secured port that peers 459 should use when communicating via TLS/TCP and DTLS/SCTP. This new 460 approach augments the existing Inband-Security negotiation but 461 does not completely replace it. The old method is kept for 462 backwards compatibility reasons. 464 o Deprecated the exchange of CER/CEA messages in the open state. 465 This feature was implied in the peer state machine table of 466 [RFC3588] but it was not clearly defined anywhere else in that 467 document. As work on this document progressed, it became clear 468 that the multiplicity of meaning and use of Application Id AVPs in 469 the CER/CEA messages (and the messages themselves) is seen as an 470 abuse of the Diameter extensibility rules and thus required 471 simplification. It is assumed that the capabilities exchange in 472 the open state will be re-introduced in a separate specification 473 which clearly defines new commands for this feature. 475 o Simplified Security Requirements. The use of a secured transport 476 for exchanging Diameter messages remains mandatory. However, TLS/ 477 TCP and DTLS/SCTP has become the primary method of securing 478 Diameter and IPsec is a secondary alternative. See Section 13 for 479 details. The support for the End-to-End security framework 480 (E2ESequence AVP and 'P'-bit in the AVP header) has also been 481 deprecated. 483 o Diameter Extensibility Changes. This includes fixes to the 484 Diameter extensibility description (Section 1.3 and others) to 485 better aid Diameter application designers; in addition, the new 486 specification relaxes the policy with respect to the allocation of 487 command codes for vendor-specific uses. 489 o Application Id Usage. Clarify the proper use of Application Id 490 information which can be found in multiple places within a 491 Diameter message. This includes correlating Application Ids found 492 in the message headers and AVPs. These changes also clearly 493 specify the proper Application Id value to use for specific base 494 protocol messages (ASR/ASA, STR/STA) as well as clarifying the 495 content and use of Vendor-Specific-Application-Id. 497 o Routing Fixes. This document more clearly specifies what 498 information (AVPs and Application Id) can be used for making 499 general routing decisions. A rule for the prioritization of 500 redirect routing criteria when multiple route entries are found 501 via redirects has also been added (See Section 6.13 for details). 503 o Simplification of Diameter Peer Discovery. The Diameter discovery 504 process now supports only widely used discovery schemes; the rest 505 have been deprecated (see Section 5.2 for details). 507 There are many other many miscellaneous fixes that have been 508 introduced in this document that may not be considered significant 509 but they are important nonetheless. Examples are removal of obsolete 510 types, fixes to command ABNFs, fixes to the state machine, 511 clarification of the election process, message validation, fixes to 512 Failed-AVP and Result-Code AVP values, etc. A comprehensive list of 513 changes is not shown here for practical reasons. 515 1.2. Terminology 517 AAA 519 Authentication, Authorization and Accounting. 521 ABNF 523 Augmented Backus-Naur Form [RFC5234]. A metalanguage with its own 524 formal syntax and rules. It is based on the Backus-Naur Form and 525 is used to define message exchanges in a bi-directional 526 communications protocol. 528 Accounting 530 The act of collecting information on resource usage for the 531 purpose of capacity planning, auditing, billing or cost 532 allocation. 534 Accounting Record 536 An accounting record represents a summary of the resource 537 consumption of a user over the entire session. Accounting servers 538 creating the accounting record may do so by processing interim 539 accounting events or accounting events from several devices 540 serving the same user. 542 Authentication 544 The act of verifying the identity of an entity (subject). 546 Authorization 548 The act of determining whether a requesting entity (subject) will 549 be allowed access to a resource (object). 551 AVP 553 The Diameter protocol consists of a header followed by one or more 554 Attribute-Value-Pairs (AVPs). An AVP includes a header and is 555 used to encapsulate protocol-specific data (e.g., routing 556 information) as well as authentication, authorization or 557 accounting information. 559 Diameter Agent 561 A Diameter Agent is a Diameter Node that provides either relay, 562 proxy, redirect or translation services. 564 Diameter Client 566 A Diameter Client is a Diameter Node that supports Diameter client 567 applications as well as the base protocol. Diameter Clients are 568 often implemented in devices situated at the edge of a network and 569 provide access control services for that network. Typical 570 examples of Diameter Clients include the Network Access Server 571 (NAS) and the Mobile IP Foreign Agent (FA). 573 Diameter Node 575 A Diameter Node is a host process that implements the Diameter 576 protocol, and acts either as a Client, Agent or Server. 578 Diameter Peer 580 If a Diameter Node shares a direct transport connection with 581 another Diameter Node, it is a Diameter Peer to that Diameter 582 Node. 584 Diameter Server 586 A Diameter Server is a Diameter Node that handles authentication, 587 authorization and accounting requests for a particular realm. By 588 its very nature, a Diameter Server must support Diameter server 589 applications in addition to the base protocol. 591 Downstream 593 Downstream is used to identify the direction of a particular 594 Diameter message from the Home Server towards the Diameter Client. 596 Home Realm 598 A Home Realm is the administrative domain with which the user 599 maintains an account relationship. 601 Home Server 603 A Diameter Server which serves the Home Realm. 605 Interim accounting 607 An interim accounting message provides a snapshot of usage during 608 a user's session. It is typically implemented in order to provide 609 for partial accounting of a user's session in the case a device 610 reboot or other network problem prevents the delivery of a session 611 summary message or session record. 613 Local Realm 615 A local realm is the administrative domain providing services to a 616 user. An administrative domain may act as a local realm for 617 certain users, while being a home realm for others. 619 Multi-session 621 A multi-session represents a logical linking of several sessions. 622 Multi-sessions are tracked by using the Acct-Multi-Session-Id. An 623 example of a multi-session would be a Multi-link PPP bundle. Each 624 leg of the bundle would be a session while the entire bundle would 625 be a multi-session. 627 Network Access Identifier 629 The Network Access Identifier, or NAI [RFC4282], is used in the 630 Diameter protocol to extract a user's identity and realm. The 631 identity is used to identify the user during authentication and/or 632 authorization, while the realm is used for message routing 633 purposes. 635 Proxy Agent or Proxy 637 In addition to forwarding requests and responses, proxies make 638 policy decisions relating to resource usage and provisioning. 639 This is typically accomplished by tracking the state of NAS 640 devices. While proxies typically do not respond to client 641 Requests prior to receiving a Response from the server, they may 642 originate Reject messages in cases where policies are violated. 643 As a result, proxies need to understand the semantics of the 644 messages passing through them, and may not support all Diameter 645 applications. 647 Realm 649 The string in the NAI that immediately follows the '@' character. 650 NAI realm names are required to be unique, and are piggybacked on 651 the administration of the DNS namespace. Diameter makes use of 652 the realm, also loosely referred to as domain, to determine 653 whether messages can be satisfied locally, or whether they must be 654 routed or redirected. In RADIUS, realm names are not necessarily 655 piggybacked on the DNS namespace but may be independent of it. 657 Real-time Accounting 659 Real-time accounting involves the processing of information on 660 resource usage within a defined time window. Time constraints are 661 typically imposed in order to limit financial risk. The Diameter 662 Credit Control Application [RFC4006] is an example of an 663 application that defines real-time accounting functionality. 665 Relay Agent or Relay 667 Relays forward requests and responses based on routing-related 668 AVPs and routing table entries. Since relays do not make policy 669 decisions, they do not examine or alter non-routing AVPs. As a 670 result, relays never originate messages, do not need to understand 671 the semantics of messages or non-routing AVPs, and are capable of 672 handling any Diameter application or message type. Since relays 673 make decisions based on information in routing AVPs and realm 674 forwarding tables they do not keep state on NAS resource usage or 675 sessions in progress. 677 Redirect Agent 679 Rather than forwarding requests and responses between clients and 680 servers, redirect agents refer clients to servers and allow them 681 to communicate directly. Since redirect agents do not sit in the 682 forwarding path, they do not alter any AVPs transiting between 683 client and server. Redirect agents do not originate messages and 684 are capable of handling any message type, although they may be 685 configured only to redirect messages of certain types, while 686 acting as relay or proxy agents for other types. As with proxy 687 agents, redirect agents do not keep state with respect to sessions 688 or NAS resources. 690 Session 692 A session is a related progression of events devoted to a 693 particular activity. Diameter application documents provide 694 guidelines as to when a session begins and ends. All Diameter 695 packets with the same Session-Id are considered to be part of the 696 same session. 698 Stateful Agent 700 A stateful agent is one that maintains session state information, 701 by keeping track of all authorized active sessions. Each 702 authorized session is bound to a particular service, and its state 703 is considered active either until it is notified otherwise, or by 704 expiration. 706 Sub-session 708 A sub-session represents a distinct service (e.g., QoS or data 709 characteristics) provided to a given session. These services may 710 happen concurrently (e.g., simultaneous voice and data transfer 711 during the same session) or serially. These changes in sessions 712 are tracked with the Accounting-Sub-Session-Id. 714 Transaction state 716 The Diameter protocol requires that agents maintain transaction 717 state, which is used for failover purposes. Transaction state 718 implies that upon forwarding a request, the Hop-by-Hop identifier 719 is saved; the field is replaced with a locally unique identifier, 720 which is restored to its original value when the corresponding 721 answer is received. The request's state is released upon receipt 722 of the answer. A stateless agent is one that only maintains 723 transaction state. 725 Translation Agent 727 A translation agent is a stateful Diameter node that performs 728 protocol translation between Diameter and another AAA protocol, 729 such as RADIUS. 731 Transport Connection 733 A transport connection is a TCP or SCTP connection existing 734 directly between two Diameter peers, otherwise known as a Peer-to- 735 Peer Connection. 737 Upstream 739 Upstream is used to identify the direction of a particular 740 Diameter message from the Diameter Client towards the Home Server. 742 User 744 The entity or device requesting or using some resource, in support 745 of which a Diameter client has generated a request. 747 1.3. Approach to Extensibility 749 The Diameter protocol is designed to be extensible, using several 750 mechanisms, including: 752 o Defining new AVP values 754 o Creating new AVPs 756 o Creating new commands 758 o Creating new applications 760 From the point of view of extensibility Diameter authentication, 761 authorization and accounting applications are treated in the same 762 way. 764 Note: Protocol designers should try to re-use existing functionality, 765 namely AVP values, AVPs, commands, and Diameter applications. Reuse 766 simplifies standardization and implementation. To avoid potential 767 interoperability issues it is important to ensure that the semantics 768 of the re-used features are well understood. Given that Diameter can 769 also carry RADIUS attributes as Diameter AVPs, such re-use 770 considerations apply also to existing RADIUS attributes that may be 771 useful in a Diameter application. 773 1.3.1. Defining New AVP Values 775 In order to allocate a new AVP value for AVPs defined in the Diameter 776 Base protocol, the IETF needs to approve a new RFC that describes the 777 AVP value. IANA considerations for these AVP values are discussed in 778 Section 11.4. 780 The allocation of AVP values for other AVPs is guided by the IANA 781 considerations of the document that defines those AVPs. Typically, 782 allocation of new values for an AVP defined in an IETF RFC should 783 require IETF Review [RFC5226], whereas values for vendor-specific 784 AVPs can be allocated by the vendor. 786 1.3.2. Creating New AVPs 788 A new AVP being defined MUST use one of the data types listed in 789 Section 4.2 or Section 4.3. If an appropriate derived data type is 790 already defined, it SHOULD be used instead of a base data type to 791 encourage reusability and good design practice. 793 In the event that a logical grouping of AVPs is necessary, and 794 multiple "groups" are possible in a given command, it is recommended 795 that a Grouped AVP be used (see Section 4.4). 797 The creation of new AVPs can happen in various ways. The recommended 798 approach is to define a new general-purpose AVP in a standards track 799 RFC approved by the IETF. However, as described in Section 11.1.1 800 there are also other mechanisms. 802 1.3.3. Creating New Commands 804 A new Command Code MUST be allocated when required AVPs (those 805 indicated as {AVP} in the ABNF definition) are added to, deleted from 806 or redefined in (for example, by changing a required AVP into an 807 optional one) an existing command. 809 Furthermore, if the transport characteristics of a command are 810 changed (for example, with respect to the number of round trips 811 required) a new Command Code MUST be registered. 813 A change to the ABNF of a command, such as described above, MUST 814 result in the definition of a new Command Code. This subsequently 815 leads to the need to define a new Diameter Application for any 816 application that will use that new Command. 818 The IANA considerations for commands are discussed in Section 11.2.1. 820 1.3.4. Creating New Diameter Applications 822 Every Diameter application specification MUST have an IANA assigned 823 Application Id (see Section 2.4 and Section 11.3). The managed 824 Application Id space is flat and there is no relationship between 825 different Diameter applications with respect to their Application 826 Ids. As such, there is no versioning support provided by these 827 application Ids itself; every Diameter application is a standalone 828 application. If the application has a relationship with other 829 Diameter applications, such a relationship is not known to Diameter. 831 Before describing the rules for creating new Diameter applications it 832 is important to discuss the semantics of the AVPs occurrences as 833 stated in the ABNF and the M-bit flag (Section 4.1) for an AVP. 834 There is no relationship imposed between the two; they are set 835 independently. 837 o The ABNF indicates what AVPs are placed into a Diameter Command by 838 the sender of that Command. Often, since there are multiple modes 839 of protocol interactions many of the AVPs are indicated as 840 optional. 842 o The M-bit allows the sender to indicate to the receiver whether or 843 not understanding the semantics of an AVP and its content is 844 mandatory. If the M-bit is set by the sender and the receiver 845 does not understand the AVP or the values carried within that AVP 846 then a failure is generated (see Section 7). 848 It is the decision of the protocol designer when to develop a new 849 Diameter application rather than extending Diameter in other ways. 850 However, a new Diameter application MUST be created when one or more 851 of the following criteria are met: 853 M-bit Setting 855 An AVP with the M-bit in the MUST column of the AVP flag table is 856 added to an existing Command/Application. 858 An AVP with the M-bit in the MAY column of the AVP flag table is 859 added to an existing Command/Application. 861 Note: The M-bit setting for a given AVP is relevant to an 862 Application and each command within that application which 863 includes the AVP. That is, if an AVP appears in two commands for 864 application Foo and the M-bit settings are different in each 865 command, then there should be two AVP flag tables describing when 866 to set the M-bit. 868 Commands 870 A new command is used within the existing application either 871 because an additional command is added, an existing command has 872 been modified so that a new Command Code had to be registered, or 873 a command has been deleted. 875 If the ABNF definition of a command allows it, an implementation may 876 add arbitrary optional AVPs with the M-bit cleared (including vendor- 877 specific AVPs) to that command without needing to define a new 878 application. Please refer to Section 11.1.1 for details. 880 2. Protocol Overview 882 The base Diameter protocol concerns itself with establishing 883 connections to peers, capabilities negotiation, how messages are sent 884 and routed through peers, and how the connections are eventually torn 885 down. The base protocol also defines certain rules that apply to all 886 message exchanges between Diameter nodes. 888 Communication between Diameter peers begins with one peer sending a 889 message to another Diameter peer. The set of AVPs included in the 890 message is determined by a particular Diameter application. One AVP 891 that is included to reference a user's session is the Session-Id. 893 The initial request for authentication and/or authorization of a user 894 would include the Session-Id AVP. The Session-Id is then used in all 895 subsequent messages to identify the user's session (see Section 8 for 896 more information). The communicating party may accept the request, 897 or reject it by returning an answer message with the Result-Code AVP 898 set to indicate an error occurred. The specific behavior of the 899 Diameter server or client receiving a request depends on the Diameter 900 application employed. 902 Session state (associated with a Session-Id) MUST be freed upon 903 receipt of the Session-Termination-Request, Session-Termination- 904 Answer, expiration of authorized service time in the Session-Timeout 905 AVP, and according to rules established in a particular Diameter 906 application. 908 The base Diameter protocol may be used by itself for accounting 909 applications. For authentication and authorization, it is always 910 extended for a particular application. 912 Diameter Clients MUST support the base protocol, which includes 913 accounting. In addition, they MUST fully support each Diameter 914 application that is needed to implement the client's service, e.g., 915 NASREQ and/or Mobile IPv4. A Diameter Client MUST be referred to as 916 "Diameter X Client" where X is the application which it supports, and 917 not a "Diameter Client". 919 Diameter Servers MUST support the base protocol, which includes 920 accounting. In addition, they MUST fully support each Diameter 921 application that is needed to implement the intended service, e.g., 922 NASREQ and/or Mobile IPv4. A Diameter Server MUST be referred to as 923 "Diameter X Server" where X is the application which it supports, and 924 not a "Diameter Server". 926 Diameter Relays and redirect agents are transparent to the Diameter 927 applications but they MUST support the Diameter base protocol, which 928 includes accounting, and all Diameter applications. 930 Diameter proxies MUST support the base protocol, which includes 931 accounting. In addition, they MUST fully support each Diameter 932 application that is needed to implement proxied services, e.g., 933 NASREQ and/or Mobile IPv4. A Diameter proxy MUST be referred to as 934 "Diameter X Proxy" where X is the application which it supports, and 935 not a "Diameter Proxy". 937 2.1. Transport 939 The Diameter Transport profile is defined in [RFC3539]. 941 The base Diameter protocol is run on port 3868 for both TCP [RFC793] 942 and SCTP [RFC4960]. For TLS [RFC5246] and DTLS [RFC4347], a Diameter 943 node that initiate a connection prior to any message exchanges MUST 944 run on port [TBD]. It is assumed that TLS is run on top of TCP when 945 it is used and DTLS is run on top of SCTP when it is used. 947 If the Diameter peer does not support receiving TLS/TCP and DTLS/SCTP 948 connections on port [TBD], i.e. the peer complies only with 949 [RFC3588], then the initiator MAY revert to using TCP or SCTP and on 950 port 3868. Note that this scheme is kept for the purpose of 951 backwards compatibility only and that there are inherent security 952 vulnerabilities when the initial CER/CEA messages are sent un- 953 protected (see Section 5.6). 955 Diameter clients MUST support either TCP or SCTP, while agents and 956 servers SHOULD support both. 958 A Diameter node MAY initiate connections from a source port other 959 than the one that it declares it accepts incoming connections on, and 960 MUST be prepared to receive connections on port 3868 for TCP or SCTP 961 and port [TBD] for TLS/TCP and DTLS/SCTP connections. A given 962 Diameter instance of the peer state machine MUST NOT use more than 963 one transport connection to communicate with a given peer, unless 964 multiple instances exist on the peer in which case a separate 965 connection per process is allowed. 967 When no transport connection exists with a peer, an attempt to 968 connect SHOULD be periodically made. This behavior is handled via 969 the Tc timer (see Section 12 for details), whose recommended value is 970 30 seconds. There are certain exceptions to this rule, such as when 971 a peer has terminated the transport connection stating that it does 972 not wish to communicate. 974 When connecting to a peer and either zero or more transports are 975 specified, TLS SHOULD be tried first, followed by DTLS, then by TCP 976 and finally by SCTP. See Section 5.2 for more information on peer 977 discovery. 979 Diameter implementations SHOULD be able to interpret ICMP protocol 980 port unreachable messages as explicit indications that the server is 981 not reachable, subject to security policy on trusting such messages. 982 Further guidance regarding the treatment of ICMP errors can be found 983 in [RFC5927] and [RFC5461]. Diameter implementations SHOULD also be 984 able to interpret a reset from the transport and timed-out connection 985 attempts. If Diameter receives data from the lower layer that cannot 986 be parsed or identified as a Diameter error made by the peer, the 987 stream is compromised and cannot be recovered. The transport 988 connection MUST be closed using a RESET call (send a TCP RST bit) or 989 an SCTP ABORT message (graceful closure is compromised). 991 2.1.1. SCTP Guidelines 993 Diameter messages SHOULD be mapped into SCTP streams in a way that 994 avoids head-of-the-line (HOL) blocking. Among different ways of 995 performing the mapping that fulfill this requirement it is 996 RECOMMENDED that a Diameter node sends every Diameter message 997 (request or response) over the stream zero with the unordered flag 998 set. However, Diameter nodes MAY select and implement other design 999 alternatives for avoiding HOL blocking such as using multiple streams 1000 with the unordered flag cleared (as originally instructed in 1001 RFC3588). On the receiving side, a Diameter entity MUST be ready to 1002 receive Diameter messages over any stream and it is free to return 1003 responses over a different stream. This way, both sides manage the 1004 available streams in the sending direction, independently of the 1005 streams chosen by the other side to send a particular Diameter 1006 message. These messages can be out-of-order and belong to different 1007 Diameter sessions. 1009 Out-of-order delivery has special concerns during a connection 1010 establishment and termination. When a connection is established, the 1011 responder side sends a CEA message and moves to R-Open state as 1012 specified in Section 5.6. If an application message is sent shortly 1013 after the CEA and delivered out-of-order, the initiator side, still 1014 in Wait-I-CEA state, will discard the application message and close 1015 the connection. In order to avoid this race condition, the receiver 1016 side SHOULD NOT use out-of-order delivery methods until the first 1017 message has been received from the initiator, proving that it has 1018 moved to I-Open state. To trigger such message, the receiver side 1019 could send a DWR immediatly after sending CEA. Upon reception of the 1020 corresponding DWA, the receiver side should start using out-of-order 1021 delivery methods to counter the HOL blocking. 1023 Another race condition may occur when DPR and DPA messages are used. 1025 Both DPR and DPA are small in size, thus they may be delivered faster 1026 to the peer than application messages when out-of-order delivery 1027 mechanism is used. Therefore, it is possible that a DPR/DPA exchange 1028 completes while application messages are still in transit, resulting 1029 to a loss of these messages. An implementation could mitigate this 1030 race condition, for example, using timers and wait for a short period 1031 of time for pending application level messages to arrive before 1032 proceeding to disconnect the transport connection. Eventually, lost 1033 messages are handled by the retransmission mechanism described in 1034 Section 5.5.4. 1036 2.2. Securing Diameter Messages 1038 Connections between Diameter peers SHOULD be protected by TLS/TCP and 1039 DTLS/SCTP. All Diameter base protocol implementations MUST support 1040 the use of TLS/TCP and DTLS/SCTP. If desired, alternative security 1041 mechanisms that are independent of Diameter, such as IPsec [RFC4301], 1042 can be deployed to secure connections between peers. The Diameter 1043 protocol MUST NOT be used without any security mechanism. 1045 2.3. Diameter Application Compliance 1047 Application Ids are advertised during the capabilities exchange phase 1048 (see Section 5.3). Advertising support of an application implies 1049 that the sender supports the functionality specified in the 1050 respective Diameter application specification. 1052 Implementations MAY add arbitrary optional AVPs with the M-bit 1053 cleared (including vendor-specific AVPs) to a command defined in an 1054 application, but only if the command's ABNF syntax specification 1055 allows for it. Please refer to Section 11.1.1 for details. 1057 2.4. Application Identifiers 1059 Each Diameter application MUST have an IANA assigned Application Id 1060 (see Section 11.3). The base protocol does not require an 1061 Application Id since its support is mandatory. During the 1062 capabilities exchange, Diameter nodes inform their peers of locally 1063 supported applications. Furthermore, all Diameter messages contain 1064 an Application Id, which is used in the message forwarding process. 1066 The following Application Id values are defined: 1068 Diameter Common Messages 0 1069 Diameter Base Accounting 3 1070 Relay 0xffffffff 1072 Relay and redirect agents MUST advertise the Relay Application 1073 Identifier, while all other Diameter nodes MUST advertise locally 1074 supported applications. The receiver of a Capabilities Exchange 1075 message advertising Relay service MUST assume that the sender 1076 supports all current and future applications. 1078 Diameter relay and proxy agents are responsible for finding an 1079 upstream server that supports the application of a particular 1080 message. If none can be found, an error message is returned with the 1081 Result-Code AVP set to DIAMETER_UNABLE_TO_DELIVER. 1083 2.5. Connections vs. Sessions 1085 This section attempts to provide the reader with an understanding of 1086 the difference between connection and session, which are terms used 1087 extensively throughout this document. 1089 A connection refers to a transport level connection between two peers 1090 that is used to send and receive Diameter messages. A session is a 1091 logical concept at the application layer existing between the 1092 Diameter client and the Diameter server; it is identified via the 1093 Session-Id AVP. 1095 +--------+ +-------+ +--------+ 1096 | Client | | Relay | | Server | 1097 +--------+ +-------+ +--------+ 1098 <----------> <----------> 1099 peer connection A peer connection B 1101 <-----------------------------> 1102 User session x 1104 Figure 1: Diameter connections and sessions 1106 In the example provided in Figure 1, peer connection A is established 1107 between the Client and the Relay. Peer connection B is established 1108 between the Relay and the Server. User session X spans from the 1109 Client via the Relay to the Server. Each "user" of a service causes 1110 an auth request to be sent, with a unique session identifier. Once 1111 accepted by the server, both the client and the server are aware of 1112 the session. 1114 It is important to note that there is no relationship between a 1115 connection and a session, and that Diameter messages for multiple 1116 sessions are all multiplexed through a single connection. Also note 1117 that Diameter messages pertaining to the session, both application 1118 specific and those that are defined in this document such as ASR/ASA, 1119 RAR/RAA and STR/STA MUST carry the Application Id of the application. 1121 Diameter messages pertaining to peer connection establishment and 1122 maintenance such as CER/CEA, DWR/DWA and DPR/DPA MUST carry an 1123 Application Id of zero (0). 1125 2.6. Peer Table 1127 The Diameter Peer Table is used in message forwarding, and referenced 1128 by the Routing Table. A Peer Table entry contains the following 1129 fields: 1131 Host identity 1133 Following the conventions described for the DiameterIdentity 1134 derived AVP data format in Section 4.3. This field contains the 1135 contents of the Origin-Host (Section 6.3) AVP found in the CER or 1136 CEA message. 1138 StatusT 1140 This is the state of the peer entry, and MUST match one of the 1141 values listed in Section 5.6. 1143 Static or Dynamic 1145 Specifies whether a peer entry was statically configured or 1146 dynamically discovered. 1148 Expiration time 1150 Specifies the time at which dynamically discovered peer table 1151 entries are to be either refreshed, or expired. 1153 TLS/TCP and DTLS/SCTP Enabled 1155 Specifies whether TLS/TCP and DTLS/SCTP is to be used when 1156 communicating with the peer. 1158 Additional security information, when needed (e.g., keys, 1159 certificates) 1161 2.7. Routing Table 1163 All Realm-Based routing lookups are performed against what is 1164 commonly known as the Routing Table (see Section 12). A Routing 1165 Table Entry contains the following fields: 1167 Realm Name 1169 This is the field that is MUST be used as a primary key in the 1170 routing table lookups. Note that some implementations perform 1171 their lookups based on longest-match-from-the-right on the realm 1172 rather than requiring an exact match. 1174 Application Identifier 1176 An application is identified by an Application Id. A route entry 1177 can have a different destination based on the Application Id in 1178 the message header. This field MUST be used as a secondary key 1179 field in routing table lookups. 1181 Local Action 1183 The Local Action field is used to identify how a message should be 1184 treated. The following actions are supported: 1186 1. LOCAL - Diameter messages that can be satisfied locally, and 1187 do not need to be routed to another Diameter entity. 1189 2. RELAY - All Diameter messages that fall within this category 1190 MUST be routed to a next hop Diameter entity that is indicated 1191 by the identifier described below. Routing is done without 1192 modifying any non-routing AVPs. See Section 6.1.9 for 1193 relaying guidelines 1195 3. PROXY - All Diameter messages that fall within this category 1196 MUST be routed to a next Diameter entity that is indicated by 1197 the identifier described below. The local server MAY apply 1198 its local policies to the message by including new AVPs to the 1199 message prior to routing. See Section 6.1.9 for proxying 1200 guidelines. 1202 4. REDIRECT - Diameter messages that fall within this category 1203 MUST have the identity of the home Diameter server(s) 1204 appended, and returned to the sender of the message. See 1205 Section 6.1.8 for redirect guidelines. 1207 Server Identifier 1209 One or more servers to which the message is to be routed. These 1210 servers MUST also be present in the Peer table. When the Local 1211 Action is set to RELAY or PROXY, this field contains the identity 1212 of the server(s) the message MUST be routed to. When the Local 1213 Action field is set to REDIRECT, this field contains the identity 1214 of one or more servers the message MUST be redirected to. 1216 Static or Dynamic 1218 Specifies whether a route entry was statically configured or 1219 dynamically discovered. 1221 Expiration time 1223 Specifies the time at which a dynamically discovered route table 1224 entry expires. 1226 It is important to note that Diameter agents MUST support at least 1227 one of the LOCAL, RELAY, PROXY or REDIRECT modes of operation. 1228 Agents do not need to support all modes of operation in order to 1229 conform with the protocol specification, but MUST follow the protocol 1230 compliance guidelines in Section 2. Relay agents and proxies MUST 1231 NOT reorder AVPs. 1233 The routing table MAY include a default entry that MUST be used for 1234 any requests not matching any of the other entries. The routing 1235 table MAY consist of only such an entry. 1237 When a request is routed, the target server MUST have advertised the 1238 Application Id (see Section 2.4) for the given message, or have 1239 advertised itself as a relay or proxy agent. Otherwise, an error is 1240 returned with the Result-Code AVP set to DIAMETER_UNABLE_TO_DELIVER. 1242 2.8. Role of Diameter Agents 1244 In addition to clients and servers, the Diameter protocol introduces 1245 relay, proxy, redirect, and translation agents, each of which is 1246 defined in Section 1.3. These Diameter agents are useful for several 1247 reasons: 1249 o They can distribute administration of systems to a configurable 1250 grouping, including the maintenance of security associations. 1252 o They can be used for concentration of requests from an number of 1253 co-located or distributed NAS equipment sets to a set of like user 1254 groups. 1256 o They can do value-added processing to the requests or responses. 1258 o They can be used for load balancing. 1260 o A complex network will have multiple authentication sources, they 1261 can sort requests and forward towards the correct target. 1263 The Diameter protocol requires that agents maintain transaction 1264 state, which is used for failover purposes. Transaction state 1265 implies that upon forwarding a request, its Hop-by-Hop identifier is 1266 saved; the field is replaced with a locally unique identifier, which 1267 is restored to its original value when the corresponding answer is 1268 received. The request's state is released upon receipt of the 1269 answer. A stateless agent is one that only maintains transaction 1270 state. 1272 The Proxy-Info AVP allows stateless agents to add local state to a 1273 Diameter request, with the guarantee that the same state will be 1274 present in the answer. However, the protocol's failover procedures 1275 require that agents maintain a copy of pending requests. 1277 A stateful agent is one that maintains session state information by 1278 keeping track of all authorized active sessions. Each authorized 1279 session is bound to a particular service, and its state is considered 1280 active either until the agent is notified otherwise, or the session 1281 expires. Each authorized session has an expiration, which is 1282 communicated by Diameter servers via the Session-Timeout AVP. 1284 Maintaining session state may be useful in certain applications, such 1285 as: 1287 o Protocol translation (e.g., RADIUS <-> Diameter) 1289 o Limiting resources authorized to a particular user 1291 o Per user or transaction auditing 1293 A Diameter agent MAY act in a stateful manner for some requests and 1294 be stateless for others. A Diameter implementation MAY act as one 1295 type of agent for some requests, and as another type of agent for 1296 others. 1298 2.8.1. Relay Agents 1300 Relay Agents are Diameter agents that accept requests and route 1301 messages to other Diameter nodes based on information found in the 1302 messages (e.g., Destination-Realm). This routing decision is 1303 performed using a list of supported realms, and known peers. This is 1304 known as the Routing Table, as is defined further in Section 2.7. 1306 Relays may, for example, be used to aggregate requests from multiple 1307 Network Access Servers (NASes) within a common geographical area 1308 (POP). The use of Relays is advantageous since it eliminates the 1309 need for NASes to be configured with the necessary security 1310 information they would otherwise require to communicate with Diameter 1311 servers in other realms. Likewise, this reduces the configuration 1312 load on Diameter servers that would otherwise be necessary when NASes 1313 are added, changed or deleted. 1315 Relays modify Diameter messages by inserting and removing routing 1316 information, but do not modify any other portion of a message. 1317 Relays SHOULD NOT maintain session state but MUST maintain 1318 transaction state. 1320 +------+ ---------> +------+ ---------> +------+ 1321 | | 1. Request | | 2. Request | | 1322 | NAS | | DRL | | HMS | 1323 | | 4. Answer | | 3. Answer | | 1324 +------+ <--------- +------+ <--------- +------+ 1325 example.net example.net example.com 1327 Figure 2: Relaying of Diameter messages 1329 The example provided in Figure 2 depicts a request issued from NAS, 1330 which is an access device, for the user bob@example.com. Prior to 1331 issuing the request, NAS performs a Diameter route lookup, using 1332 "example.com" as the key, and determines that the message is to be 1333 relayed to DRL, which is a Diameter Relay. DRL performs the same 1334 route lookup as NAS, and relays the message to HMS, which is 1335 example.com's Home Diameter Server. HMS identifies that the request 1336 can be locally supported (via the realm), processes the 1337 authentication and/or authorization request, and replies with an 1338 answer, which is routed back to NAS using saved transaction state. 1340 Since Relays do not perform any application level processing, they 1341 provide relaying services for all Diameter applications, and 1342 therefore MUST advertise the Relay Application Id. 1344 2.8.2. Proxy Agents 1346 Similarly to relays, proxy agents route Diameter messages using the 1347 Diameter Routing Table. However, they differ since they modify 1348 messages to implement policy enforcement. This requires that proxies 1349 maintain the state of their downstream peers (e.g., access devices) 1350 to enforce resource usage, provide admission control, and 1351 provisioning. 1353 Proxies may, for example, be used in call control centers or access 1354 ISPs that provide outsourced connections, they can monitor the number 1355 and types of ports in use, and make allocation and admission 1356 decisions according to their configuration. 1358 Since enforcing policies requires an understanding of the service 1359 being provided, Proxies MUST only advertise the Diameter applications 1360 they support. 1362 2.8.3. Redirect Agents 1364 Redirect agents are useful in scenarios where the Diameter routing 1365 configuration needs to be centralized. An example is a redirect 1366 agent that provides services to all members of a consortium, but does 1367 not wish to be burdened with relaying all messages between realms. 1368 This scenario is advantageous since it does not require that the 1369 consortium provide routing updates to its members when changes are 1370 made to a member's infrastructure. 1372 Since redirect agents do not relay messages, and only return an 1373 answer with the information necessary for Diameter agents to 1374 communicate directly, they do not modify messages. Since redirect 1375 agents do not receive answer messages, they cannot maintain session 1376 state. 1378 The example provided in Figure 3 depicts a request issued from the 1379 access device, NAS, for the user bob@example.com. The message is 1380 forwarded by the NAS to its relay, DRL, which does not have a routing 1381 entry in its Diameter Routing Table for example.com. DRL has a 1382 default route configured to DRD, which is a redirect agent that 1383 returns a redirect notification to DRL, as well as HMS' contact 1384 information. Upon receipt of the redirect notification, DRL 1385 establishes a transport connection with HMS, if one doesn't already 1386 exist, and forwards the request to it. 1388 +------+ 1389 | | 1390 | DRD | 1391 | | 1392 +------+ 1393 ^ | 1394 2. Request | | 3. Redirection 1395 | | Notification 1396 | v 1397 +------+ ---------> +------+ ---------> +------+ 1398 | | 1. Request | | 4. Request | | 1399 | NAS | | DRL | | HMS | 1400 | | 6. Answer | | 5. Answer | | 1401 +------+ <--------- +------+ <--------- +------+ 1402 example.net example.net example.com 1404 Figure 3: Redirecting a Diameter Message 1406 Since redirect agents do not perform any application level 1407 processing, they provide relaying services for all Diameter 1408 applications, and therefore MUST advertise the Relay Application 1409 Identifier. 1411 2.8.4. Translation Agents 1413 A translation agent is a device that provides translation between two 1414 protocols (e.g., RADIUS<->Diameter, TACACS+<->Diameter). Translation 1415 agents are likely to be used as aggregation servers to communicate 1416 with a Diameter infrastructure, while allowing for the embedded 1417 systems to be migrated at a slower pace. 1419 Given that the Diameter protocol introduces the concept of long-lived 1420 authorized sessions, translation agents MUST be session stateful and 1421 MUST maintain transaction state. 1423 Translation of messages can only occur if the agent recognizes the 1424 application of a particular request, and therefore translation agents 1425 MUST only advertise their locally supported applications. 1427 +------+ ---------> +------+ ---------> +------+ 1428 | | RADIUS Request | | Diameter Request | | 1429 | NAS | | TLA | | HMS | 1430 | | RADIUS Answer | | Diameter Answer | | 1431 +------+ <--------- +------+ <--------- +------+ 1432 example.net example.net example.com 1434 Figure 4: Translation of RADIUS to Diameter 1436 2.9. Diameter Path Authorization 1438 As noted in Section 2.2, Diameter provides transmission level 1439 security for each connection using TLS/TCP and DTLS/SCTP. Therefore, 1440 each connection can be authenticated, replay and integrity protected. 1442 In addition to authenticating each connection, each connection as 1443 well as the entire session MUST also be authorized. Before 1444 initiating a connection, a Diameter Peer MUST check that its peers 1445 are authorized to act in their roles. For example, a Diameter peer 1446 may be authentic, but that does not mean that it is authorized to act 1447 as a Diameter Server advertising a set of Diameter applications. 1449 Prior to bringing up a connection, authorization checks are performed 1450 at each connection along the path. Diameter capabilities negotiation 1451 (CER/CEA) also MUST be carried out, in order to determine what 1452 Diameter applications are supported by each peer. Diameter sessions 1453 MUST be routed only through authorized nodes that have advertised 1454 support for the Diameter application required by the session. 1456 As noted in Section 6.1.9, a relay or proxy agent MUST append a 1457 Route-Record AVP to all requests forwarded. The AVP contains the 1458 identity of the peer the request was received from. 1460 The home Diameter server, prior to authorizing a session, MUST check 1461 the Route-Record AVPs to make sure that the route traversed by the 1462 request is acceptable. For example, administrators within the home 1463 realm may not wish to honor requests that have been routed through an 1464 untrusted realm. By authorizing a request, the home Diameter server 1465 is implicitly indicating its willingness to engage in the business 1466 transaction as specified by the contractual relationship between the 1467 server and the previous hop. A DIAMETER_AUTHORIZATION_REJECTED error 1468 message (see Section 7.1.5) is sent if the route traversed by the 1469 request is unacceptable. 1471 A home realm may also wish to check that each accounting request 1472 message corresponds to a Diameter response authorizing the session. 1473 Accounting requests without corresponding authorization responses 1474 SHOULD be subjected to further scrutiny, as should accounting 1475 requests indicating a difference between the requested and provided 1476 service. 1478 Forwarding of an authorization response is considered evidence of a 1479 willingness to take on financial risk relative to the session. A 1480 local realm may wish to limit this exposure, for example, by 1481 establishing credit limits for intermediate realms and refusing to 1482 accept responses which would violate those limits. By issuing an 1483 accounting request corresponding to the authorization response, the 1484 local realm implicitly indicates its agreement to provide the service 1485 indicated in the authorization response. If the service cannot be 1486 provided by the local realm, then a DIAMETER_UNABLE_TO_COMPLY error 1487 message MUST be sent within the accounting request; a Diameter client 1488 receiving an authorization response for a service that it cannot 1489 perform MUST NOT substitute an alternate service, and then send 1490 accounting requests for the alternate service instead. 1492 3. Diameter Header 1494 A summary of the Diameter header format is shown below. The fields 1495 are transmitted in network byte order. 1497 0 1 2 3 1498 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 1499 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1500 | Version | Message Length | 1501 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1502 | command flags | Command-Code | 1503 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1504 | Application-ID | 1505 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1506 | Hop-by-Hop Identifier | 1507 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1508 | End-to-End Identifier | 1509 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1510 | AVPs ... 1511 +-+-+-+-+-+-+-+-+-+-+-+-+- 1513 Version 1515 This Version field MUST be set to 1 to indicate Diameter Version 1516 1. 1518 Message Length 1520 The Message Length field is three octets and indicates the length 1521 of the Diameter message including the header fields and the padded 1522 AVPs. Thus the message length field is always a multiple of 4. 1524 Command Flags 1526 The Command Flags field is eight bits. The following bits are 1527 assigned: 1529 0 1 2 3 4 5 6 7 1530 +-+-+-+-+-+-+-+-+ 1531 |R P E T r r r r| 1532 +-+-+-+-+-+-+-+-+ 1534 R(equest) 1536 If set, the message is a request. If cleared, the message is 1537 an answer. 1539 P(roxiable) 1541 If set, the message MAY be proxied, relayed or redirected. If 1542 cleared, the message MUST be locally processed. 1544 E(rror) 1546 If set, the message contains a protocol error, and the message 1547 will not conform to the ABNF described for this command. 1548 Messages with the 'E' bit set are commonly referred to as error 1549 messages. This bit MUST NOT be set in request messages. See 1550 Section 7.2. 1552 T(Potentially re-transmitted message) 1554 This flag is set after a link failover procedure, to aid the 1555 removal of duplicate requests. It is set when resending 1556 requests not yet acknowledged, as an indication of a possible 1557 duplicate due to a link failure. This bit MUST be cleared when 1558 sending a request for the first time, otherwise the sender MUST 1559 set this flag. Diameter agents only need to be concerned about 1560 the number of requests they send based on a single received 1561 request; retransmissions by other entities need not be tracked. 1562 Diameter agents that receive a request with the T flag set, 1563 MUST keep the T flag set in the forwarded request. This flag 1564 MUST NOT be set if an error answer message (e.g., a protocol 1565 error) has been received for the earlier message. It can be 1566 set only in cases where no answer has been received from the 1567 server for a request and the request is sent again. This flag 1568 MUST NOT be set in answer messages. 1570 r(eserved) 1572 These flag bits are reserved for future use, and MUST be set to 1573 zero, and ignored by the receiver. 1575 Command-Code 1577 The Command-Code field is three octets, and is used in order to 1578 communicate the command associated with the message. The 24-bit 1579 address space is managed by IANA (see Section 11.2.1). 1581 Command-Code values 16,777,214 and 16,777,215 (hexadecimal values 1582 FFFFFE -FFFFFF) are reserved for experimental use (See Section 1583 11.3). 1585 Application-ID 1587 Application-ID is four octets and is used to identify to which 1588 application the message is applicable for. The application can be 1589 an authentication application, an accounting application or a 1590 vendor specific application. See Section 11.3 for the possible 1591 values that the application-id may use. 1593 The value of the application-id field in the header MUST be the 1594 same as any relevant application-id AVPs contained in the message. 1596 Hop-by-Hop Identifier 1598 The Hop-by-Hop Identifier is an unsigned 32-bit integer field (in 1599 network byte order) and aids in matching requests and replies. 1600 The sender MUST ensure that the Hop-by-Hop identifier in a request 1601 is unique on a given connection at any given time, and MAY attempt 1602 to ensure that the number is unique across reboots. The sender of 1603 an Answer message MUST ensure that the Hop-by-Hop Identifier field 1604 contains the same value that was found in the corresponding 1605 request. The Hop-by-Hop identifier is normally a monotonically 1606 increasing number, whose start value was randomly generated. An 1607 answer message that is received with an unknown Hop-by-Hop 1608 Identifier MUST be discarded. 1610 End-to-End Identifier 1612 The End-to-End Identifier is an unsigned 32-bit integer field (in 1613 network byte order) and is used to detect duplicate messages. 1614 Upon reboot implementations MAY set the high order 12 bits to 1615 contain the low order 12 bits of current time, and the low order 1616 20 bits to a random value. Senders of request messages MUST 1617 insert a unique identifier on each message. The identifier MUST 1618 remain locally unique for a period of at least 4 minutes, even 1619 across reboots. The originator of an Answer message MUST ensure 1620 that the End-to-End Identifier field contains the same value that 1621 was found in the corresponding request. The End-to-End Identifier 1622 MUST NOT be modified by Diameter agents of any kind. The 1623 combination of the Origin-Host (see Section 6.3) and this field is 1624 used to detect duplicates. Duplicate requests SHOULD cause the 1625 same answer to be transmitted (modulo the hop-by-hop Identifier 1626 field and any routing AVPs that may be present), and MUST NOT 1627 affect any state that was set when the original request was 1628 processed. Duplicate answer messages that are to be locally 1629 consumed (see Section 6.2) SHOULD be silently discarded. 1631 AVPs 1633 AVPs are a method of encapsulating information relevant to the 1634 Diameter message. See Section 4 for more information on AVPs. 1636 3.1. Command Codes 1638 Each command Request/Answer pair is assigned a command code, and the 1639 sub-type (i.e., request or answer) is identified via the 'R' bit in 1640 the Command Flags field of the Diameter header. 1642 Every Diameter message MUST contain a command code in its header's 1643 Command-Code field, which is used to determine the action that is to 1644 be taken for a particular message. The following Command Codes are 1645 defined in the Diameter base protocol: 1647 Command-Name Abbrev. Code Reference 1648 -------------------------------------------------------- 1649 Abort-Session-Request ASR 274 8.5.1 1650 Abort-Session-Answer ASA 274 8.5.2 1651 Accounting-Request ACR 271 9.7.1 1652 Accounting-Answer ACA 271 9.7.2 1653 Capabilities-Exchange- CER 257 5.3.1 1654 Request 1655 Capabilities-Exchange- CEA 257 5.3.2 1656 Answer 1657 Device-Watchdog-Request DWR 280 5.5.1 1658 Device-Watchdog-Answer DWA 280 5.5.2 1659 Disconnect-Peer-Request DPR 282 5.4.1 1660 Disconnect-Peer-Answer DPA 282 5.4.2 1661 Re-Auth-Request RAR 258 8.3.1 1662 Re-Auth-Answer RAA 258 8.3.2 1663 Session-Termination- STR 275 8.4.1 1664 Request 1665 Session-Termination- STA 275 8.4.2 1666 Answer 1668 3.2. Command Code ABNF specification 1670 Every Command Code defined MUST include a corresponding ABNF 1671 specification, which is used to define the AVPs that MUST or MAY be 1672 present when sending the message. The following format is used in 1673 the definition: 1675 command-def = "::=" diameter-message 1677 command-name = diameter-name 1678 diameter-name = ALPHA *(ALPHA / DIGIT / "-") 1680 diameter-message = header [ *fixed] [ *required] [ *optional] 1682 header = "<" "Diameter Header:" command-id 1683 [r-bit] [p-bit] [e-bit] [application-id] ">" 1685 application-id = 1*DIGIT 1687 command-id = 1*DIGIT 1688 ; The Command Code assigned to the command 1690 r-bit = ", REQ" 1691 ; If present, the 'R' bit in the Command 1692 ; Flags is set, indicating that the message 1693 ; is a request, as opposed to an answer. 1695 p-bit = ", PXY" 1696 ; If present, the 'P' bit in the Command 1697 ; Flags is set, indicating that the message 1698 ; is proxiable. 1700 e-bit = ", ERR" 1701 ; If present, the 'E' bit in the Command 1702 ; Flags is set, indicating that the answer 1703 ; message contains a Result-Code AVP in 1704 ; the "protocol error" class. 1706 fixed = [qual] "<" avp-spec ">" 1707 ; Defines the fixed position of an AVP 1709 required = [qual] "{" avp-spec "}" 1710 ; The AVP MUST be present and can appear 1711 ; anywhere in the message. 1713 optional = [qual] "[" avp-name "]" 1714 ; The avp-name in the 'optional' rule cannot 1715 ; evaluate to any AVP Name which is included 1716 ; in a fixed or required rule. The AVP can 1717 ; appear anywhere in the message. 1718 ; 1719 ; NOTE: "[" and "]" have a slightly different 1720 ; meaning than in ABNF (RFC 5234]). These braces 1721 ; cannot be used to express optional fixed rules 1722 ; (such as an optional ICV at the end). To do this, 1723 ; the convention is '0*1fixed'. 1725 qual = [min] "*" [max] 1726 ; See ABNF conventions, RFC 5234 Section 4. 1727 ; The absence of any qualifiers depends on 1728 ; whether it precedes a fixed, required, or 1729 ; optional rule. If a fixed or required rule has 1730 ; no qualifier, then exactly one such AVP MUST 1731 ; be present. If an optional rule has no 1732 ; qualifier, then 0 or 1 such AVP may be 1733 ; present. If an optional rule has a qualifier, 1734 ; then the value of min MUST be 0 if present. 1736 min = 1*DIGIT 1737 ; The minimum number of times the element may 1738 ; be present. If absent, the default value is zero 1739 ; for fixed and optional rules and one for required 1740 ; rules. The value MUST be at least one for for 1741 ; required rules. 1743 max = 1*DIGIT 1744 ; The maximum number of times the element may 1745 ; be present. If absent, the default value is 1746 ; infinity. A value of zero implies the AVP MUST 1747 ; NOT be present. 1749 avp-spec = diameter-name 1750 ; The avp-spec has to be an AVP Name, defined 1751 ; in the base or extended Diameter 1752 ; specifications. 1754 avp-name = avp-spec / "AVP" 1755 ; The string "AVP" stands for *any* arbitrary AVP 1756 ; Name, not otherwise listed in that command code 1757 ; definition. Addition this AVP is recommended for 1758 ; all command ABNFs to allow for extensibility. 1760 The following is a definition of a fictitious command code: 1762 Example-Request ::= < Diameter Header: 9999999, REQ, PXY > 1763 { User-Name } 1764 * { Origin-Host } 1765 * [ AVP ] 1767 3.3. Diameter Command Naming Conventions 1769 Diameter command names typically includes one or more English words 1770 followed by the verb Request or Answer. Each English word is 1771 delimited by a hyphen. A three-letter acronym for both the request 1772 and answer is also normally provided. 1774 An example is a message set used to terminate a session. The command 1775 name is Session-Terminate-Request and Session-Terminate-Answer, while 1776 the acronyms are STR and STA, respectively. 1778 Both the request and the answer for a given command share the same 1779 command code. The request is identified by the R(equest) bit in the 1780 Diameter header set to one (1), to ask that a particular action be 1781 performed, such as authorizing a user or terminating a session. Once 1782 the receiver has completed the request it issues the corresponding 1783 answer, which includes a result code that communicates one of the 1784 following: 1786 o The request was successful 1788 o The request failed 1790 o An additional request has to be sent to provide information the 1791 peer requires prior to returning a successful or failed answer. 1793 o The receiver could not process the request, but provides 1794 information about a Diameter peer that is able to satisfy the 1795 request, known as redirect. 1797 Additional information, encoded within AVPs, may also be included in 1798 answer messages. 1800 4. Diameter AVPs 1802 Diameter AVPs carry specific authentication, accounting, 1803 authorization and routing information as well as configuration 1804 details for the request and reply. 1806 Each AVP of type OctetString MUST be padded to align on a 32-bit 1807 boundary, while other AVP types align naturally. A number of zero- 1808 valued bytes are added to the end of the AVP Data field till a word 1809 boundary is reached. The length of the padding is not reflected in 1810 the AVP Length field. 1812 4.1. AVP Header 1814 The fields in the AVP header MUST be sent in network byte order. The 1815 format of the header is: 1817 0 1 2 3 1818 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 1819 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1820 | AVP Code | 1821 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1822 |V M P r r r r r| AVP Length | 1823 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1824 | Vendor-ID (opt) | 1825 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1826 | Data ... 1827 +-+-+-+-+-+-+-+-+ 1829 AVP Code 1831 The AVP Code, combined with the Vendor-Id field, identifies the 1832 attribute uniquely. AVP numbers 1 through 255 are reserved for 1833 re-use of RADIUS attributes, without setting the Vendor-Id field. 1834 AVP numbers 256 and above are used for Diameter, which are 1835 allocated by IANA (see Section 11.1). 1837 AVP Flags 1839 The AVP Flags field informs the receiver how each attribute must 1840 be handled. The 'r' (reserved) bits are unused and SHOULD be set 1841 to 0. Note that subsequent Diameter applications MAY define 1842 additional bits within the AVP Header, and an unrecognized bit 1843 SHOULD be considered an error. The 'P' bit has been reserved for 1844 future usage of end-to-end security. At the time of writing there 1845 are no end-to-end security mechanisms specified therefore the 'P' 1846 bit SHOULD be set to 0. 1848 The 'M' Bit, known as the Mandatory bit, indicates whether the 1849 receiver of the AVP MUST parse and understand the semantic of the 1850 AVP including its content. The receiving entity MUST return an 1851 appropriate error message if it receives an AVP that has the M-bit 1852 set but does not understand it. An exception applies when the AVP 1853 is embedded within a Grouped AVP. See Section 4.4 for details. 1854 Diameter Relay and redirect agents MUST NOT reject messages with 1855 unrecognized AVPs. 1857 The 'M' bit MUST be set according to the rules defined in the 1858 application specification which introduces or re-uses this AVP. 1859 Within a given application, the M-bit setting for an AVP is either 1860 defined for all command types or for each command type. 1862 AVPs with the 'M' bit cleared are informational only and a 1863 receiver that receives a message with such an AVP that is not 1864 supported, or whose value is not supported, MAY simply ignore the 1865 AVP. 1867 The 'V' bit, known as the Vendor-Specific bit, indicates whether 1868 the optional Vendor-ID field is present in the AVP header. When 1869 set the AVP Code belongs to the specific vendor code address 1870 space. 1872 AVP Length 1874 The AVP Length field is three octets, and indicates the number of 1875 octets in this AVP including the AVP Code, AVP Length, AVP Flags, 1876 Vendor-ID field (if present) and the AVP data. If a message is 1877 received with an invalid attribute length, the message MUST be 1878 rejected. 1880 4.1.1. Optional Header Elements 1882 The AVP Header contains one optional field. This field is only 1883 present if the respective bit-flag is enabled. 1885 Vendor-ID 1887 The Vendor-ID field is present if the 'V' bit is set in the AVP 1888 Flags field. The optional four-octet Vendor-ID field contains the 1889 IANA assigned "SMI Network Management Private Enterprise Codes" 1890 [RFC3232] value, encoded in network byte order. Any vendor or 1891 standardization organization that are also treated like vendors in 1892 the IANA managed "SMI Network Management Private Enterprise Codes" 1893 space wishing to implement a vendor-specific Diameter AVP MUST use 1894 their own Vendor-ID along with their privately managed AVP address 1895 space, guaranteeing that they will not collide with any other 1896 vendor's vendor-specific AVP(s), nor with future IETF AVPs. 1898 A vendor ID value of zero (0) corresponds to the IETF adopted AVP 1899 values, as managed by the IANA. Since the absence of the vendor 1900 ID field implies that the AVP in question is not vendor specific, 1901 implementations MUST NOT use the zero (0) vendor ID. 1903 4.2. Basic AVP Data Formats 1905 The Data field is zero or more octets and contains information 1906 specific to the Attribute. The format and length of the Data field 1907 is determined by the AVP Code and AVP Length fields. The format of 1908 the Data field MUST be one of the following base data types or a data 1909 type derived from the base data types. In the event that a new Basic 1910 AVP Data Format is needed, a new version of this RFC MUST be created. 1912 OctetString 1914 The data contains arbitrary data of variable length. Unless 1915 otherwise noted, the AVP Length field MUST be set to at least 8 1916 (12 if the 'V' bit is enabled). AVP Values of this type that are 1917 not a multiple of four-octets in length is followed by the 1918 necessary padding so that the next AVP (if any) will start on a 1919 32-bit boundary. 1921 Integer32 1923 32 bit signed value, in network byte order. The AVP Length field 1924 MUST be set to 12 (16 if the 'V' bit is enabled). 1926 Integer64 1928 64 bit signed value, in network byte order. The AVP Length field 1929 MUST be set to 16 (20 if the 'V' bit is enabled). 1931 Unsigned32 1933 32 bit unsigned value, in network byte order. The AVP Length 1934 field MUST be set to 12 (16 if the 'V' bit is enabled). 1936 Unsigned64 1938 64 bit unsigned value, in network byte order. The AVP Length 1939 field MUST be set to 16 (20 if the 'V' bit is enabled). 1941 Float32 1943 This represents floating point values of single precision as 1944 described by [FLOATPOINT]. The 32-bit value is transmitted in 1945 network byte order. The AVP Length field MUST be set to 12 (16 if 1946 the 'V' bit is enabled). 1948 Float64 1950 This represents floating point values of double precision as 1951 described by [FLOATPOINT]. The 64-bit value is transmitted in 1952 network byte order. The AVP Length field MUST be set to 16 (20 if 1953 the 'V' bit is enabled). 1955 Grouped 1957 The Data field is specified as a sequence of AVPs. Each of these 1958 AVPs follows - in the order in which they are specified - 1959 including their headers and padding. The AVP Length field is set 1960 to 8 (12 if the 'V' bit is enabled) plus the total length of all 1961 included AVPs, including their headers and padding. Thus the AVP 1962 length field of an AVP of type Grouped is always a multiple of 4. 1964 4.3. Derived AVP Data Formats 1966 In addition to using the Basic AVP Data Formats, applications may 1967 define data formats derived from the Basic AVP Data Formats. An 1968 application that defines new Derived AVP Data Formats MUST include 1969 them in a section entitled "Derived AVP Data Formats", using the same 1970 format as the definitions below. Each new definition MUST be either 1971 defined or listed with a reference to the RFC that defines the 1972 format. 1974 4.3.1. Common Derived AVPs 1976 The following are commonly used Derived AVP Data Formats. 1978 Address 1980 The Address format is derived from the OctetString AVP Base 1981 Format. It is a discriminated union, representing, for example a 1982 32-bit (IPv4) [RFC791] or 128-bit (IPv6) [RFC4291] address, most 1983 significant octet first. The first two octets of the Address AVP 1984 represents the AddressType, which contains an Address Family 1985 defined in [IANAADFAM]. The AddressType is used to discriminate 1986 the content and format of the remaining octets. 1988 Time 1990 The Time format is derived from the OctetString AVP Base Format. 1991 The string MUST contain four octets, in the same format as the 1992 first four bytes are in the NTP timestamp format. The NTP 1993 Timestamp format is defined in Chapter 3 of [RFC5905]. 1995 This represents the number of seconds since 0h on 1 January 1900 1996 with respect to the Coordinated Universal Time (UTC). 1998 On 6h 28m 16s UTC, 7 February 2036 the time value will overflow. 1999 SNTP [RFC5905] describes a procedure to extend the time to 2104. 2000 This procedure MUST be supported by all Diameter nodes. 2002 UTF8String 2004 The UTF8String format is derived from the OctetString AVP Base 2005 Format. This is a human readable string represented using the 2006 ISO/IEC IS 10646-1 character set, encoded as an OctetString using 2007 the UTF-8 [RFC3629] transformation format described in RFC 3629. 2009 Since additional code points are added by amendments to the 10646 2010 standard from time to time, implementations MUST be prepared to 2011 encounter any code point from 0x00000001 to 0x7fffffff. Byte 2012 sequences that do not correspond to the valid encoding of a code 2013 point into UTF-8 charset or are outside this range are prohibited. 2015 The use of control codes SHOULD be avoided. When it is necessary 2016 to represent a new line, the control code sequence CR LF SHOULD be 2017 used. 2019 The use of leading or trailing white space SHOULD be avoided. 2021 For code points not directly supported by user interface hardware 2022 or software, an alternative means of entry and display, such as 2023 hexadecimal, MAY be provided. 2025 For information encoded in 7-bit US-ASCII, the UTF-8 charset is 2026 identical to the US-ASCII charset. 2028 UTF-8 may require multiple bytes to represent a single character / 2029 code point; thus the length of an UTF8String in octets may be 2030 different from the number of characters encoded. 2032 Note that the AVP Length field of an UTF8String is measured in 2033 octets, not characters. 2035 DiameterIdentity 2037 The DiameterIdentity format is derived from the OctetString AVP 2038 Base Format. 2040 DiameterIdentity = FQDN/Realm 2042 DiameterIdentity value is used to uniquely identify either: 2044 * A Diameter node for purposes of duplicate connection and 2045 routing loop detection. 2047 * A Realm to determine whether messages can be satisfied locally, 2048 or whether they must be routed or redirected. 2050 When a DiameterIdentity is used to identify a Diameter node the 2051 contents of the string MUST be the FQDN of the Diameter node. If 2052 multiple Diameter nodes run on the same host, each Diameter node 2053 MUST be assigned a unique DiameterIdentity. If a Diameter node 2054 can be identified by several FQDNs, a single FQDN should be picked 2055 at startup, and used as the only DiameterIdentity for that node, 2056 whatever the connection it is sent on. Note that in this 2057 document, DiameterIdentity is in ASCII form in order to be 2058 compatible with existing DNS infrastructure. See Appendix D for 2059 interactions between the Diameter protocol and Internationalized 2060 Domain Name (IDNs). 2062 DiameterURI 2064 The DiameterURI MUST follow the Uniform Resource Identifiers (URI) 2065 syntax [RFC3986] rules specified below: 2067 "aaa://" FQDN [ port ] [ transport ] [ protocol ] 2069 ; No transport security 2071 "aaas://" FQDN [ port ] [ transport ] [ protocol ] 2073 ; Transport security used 2075 FQDN = Fully Qualified Host Name 2077 port = ":" 1*DIGIT 2079 ; One of the ports used to listen for 2080 ; incoming connections. 2081 ; If absent, the default Diameter port 2082 ; (3868) is assumed if no transport 2083 ; security is used and port (TBD) when 2084 ; transport security (TLS/TCP and DTLS/SCTP) is used. 2086 transport = ";transport=" transport-protocol 2088 ; One of the transports used to listen 2089 ; for incoming connections. If absent, 2090 ; the default protocol is assumed to be TCP. 2091 ; UDP MUST NOT be used when the aaa-protocol 2092 ; field is set to diameter. 2094 transport-protocol = ( "tcp" / "sctp" / "udp" ) 2096 protocol = ";protocol=" aaa-protocol 2098 ; If absent, the default AAA protocol 2099 ; is Diameter. 2101 aaa-protocol = ( "diameter" / "radius" / "tacacs+" ) 2103 The following are examples of valid Diameter host identities: 2105 aaa://host.example.com;transport=tcp 2106 aaa://host.example.com:6666;transport=tcp 2107 aaa://host.example.com;protocol=diameter 2108 aaa://host.example.com:6666;protocol=diameter 2109 aaa://host.example.com:6666;transport=tcp;protocol=diameter 2110 aaa://host.example.com:1813;transport=udp;protocol=radius 2112 Enumerated 2114 Enumerated is derived from the Integer32 AVP Base Format. The 2115 definition contains a list of valid values and their 2116 interpretation and is described in the Diameter application 2117 introducing the AVP. 2119 IPFilterRule 2121 The IPFilterRule format is derived from the OctetString AVP Base 2122 Format and uses the ASCII charset. The rule syntax is a modified 2123 subset of ipfw(8) from FreeBSD. Packets may be filtered based on 2124 the following information that is associated with it: 2126 Direction (in or out) 2127 Source and destination IP address (possibly masked) 2128 Protocol 2129 Source and destination port (lists or ranges) 2130 TCP flags 2131 IP fragment flag 2132 IP options 2133 ICMP types 2135 Rules for the appropriate direction are evaluated in order, with 2136 the first matched rule terminating the evaluation. Each packet is 2137 evaluated once. If no rule matches, the packet is dropped if the 2138 last rule evaluated was a permit, and passed if the last rule was 2139 a deny. 2141 IPFilterRule filters MUST follow the format: 2143 action dir proto from src to dst [options] 2145 action permit - Allow packets that match the rule. 2146 deny - Drop packets that match the rule. 2148 dir "in" is from the terminal, "out" is to the 2149 terminal. 2151 proto An IP protocol specified by number. The "ip" 2152 keyword means any protocol will match. 2154 src and dst
[ports] 2156 The
may be specified as: 2157 ipno An IPv4 or IPv6 number in dotted- 2158 quad or canonical IPv6 form. Only 2159 this exact IP number will match the 2160 rule. 2161 ipno/bits An IP number as above with a mask 2162 width of the form 192.0.2.10/24. In 2163 this case, all IP numbers from 2164 192.0.2.0 to 192.0.2.255 will match. 2165 The bit width MUST be valid for the 2166 IP version and the IP number MUST 2167 NOT have bits set beyond the mask. 2168 For a match to occur, the same IP 2169 version must be present in the 2170 packet that was used in describing 2171 the IP address. To test for a 2172 particular IP version, the bits part 2173 can be set to zero. The keyword 2174 "any" is 0.0.0.0/0 or the IPv6 2175 equivalent. The keyword "assigned" 2176 is the address or set of addresses 2177 assigned to the terminal. For IPv4, 2178 a typical first rule is often "deny 2179 in ip! assigned" 2181 The sense of the match can be inverted by 2182 preceding an address with the not modifier (!), 2183 causing all other addresses to be matched 2184 instead. This does not affect the selection of 2185 port numbers. 2187 With the TCP, UDP and SCTP protocols, optional 2188 ports may be specified as: 2190 {port/port-port}[,ports[,...]] 2192 The '-' notation specifies a range of ports 2193 (including boundaries). 2195 Fragmented packets that have a non-zero offset 2196 (i.e., not the first fragment) will never match 2197 a rule that has one or more port 2198 specifications. See the frag option for 2199 details on matching fragmented packets. 2201 options: 2202 frag Match if the packet is a fragment and this is not 2203 the first fragment of the datagram. frag may not 2204 be used in conjunction with either tcpflags or 2205 TCP/UDP port specifications. 2207 ipoptions spec 2208 Match if the IP header contains the comma 2209 separated list of options specified in spec. The 2210 supported IP options are: 2212 ssrr (strict source route), lsrr (loose source 2213 route), rr (record packet route) and ts 2214 (timestamp). The absence of a particular option 2215 may be denoted with a '!'. 2217 tcpoptions spec 2218 Match if the TCP header contains the comma 2219 separated list of options specified in spec. The 2220 supported TCP options are: 2222 mss (maximum segment size), window (tcp window 2223 advertisement), sack (selective ack), ts (rfc1323 2224 timestamp) and cc (rfc1644 t/tcp connection 2225 count). The absence of a particular option may 2226 be denoted with a '!'. 2228 established 2229 TCP packets only. Match packets that have the RST 2230 or ACK bits set. 2232 setup TCP packets only. Match packets that have the SYN 2233 bit set but no ACK bit. 2235 tcpflags spec 2236 TCP packets only. Match if the TCP header 2237 contains the comma separated list of flags 2238 specified in spec. The supported TCP flags are: 2240 fin, syn, rst, psh, ack and urg. The absence of a 2241 particular flag may be denoted with a '!'. A rule 2242 that contains a tcpflags specification can never 2243 match a fragmented packet that has a non-zero 2244 offset. See the frag option for details on 2245 matching fragmented packets. 2247 icmptypes types 2248 ICMP packets only. Match if the ICMP type is in 2249 the list types. The list may be specified as any 2250 combination of ranges or individual types 2251 separated by commas. Both the numeric values and 2252 the symbolic values listed below can be used. The 2253 supported ICMP types are: 2255 echo reply (0), destination unreachable (3), 2256 source quench (4), redirect (5), echo request 2257 (8), router advertisement (9), router 2258 solicitation (10), time-to-live exceeded (11), IP 2259 header bad (12), timestamp request (13), 2260 timestamp reply (14), information request (15), 2261 information reply (16), address mask request (17) 2262 and address mask reply (18). 2264 There is one kind of packet that the access device MUST always 2265 discard, that is an IP fragment with a fragment offset of one. 2266 This is a valid packet, but it only has one use, to try to 2267 circumvent firewalls. 2269 An access device that is unable to interpret or apply a deny rule 2270 MUST terminate the session. An access device that is unable to 2271 interpret or apply a permit rule MAY apply a more restrictive 2272 rule. An access device MAY apply deny rules of its own before the 2273 supplied rules, for example to protect the access device owner's 2274 infrastructure. 2276 4.4. Grouped AVP Values 2278 The Diameter protocol allows AVP values of type 'Grouped'. This 2279 implies that the Data field is actually a sequence of AVPs. It is 2280 possible to include an AVP with a Grouped type within a Grouped type, 2281 that is, to nest them. AVPs within an AVP of type Grouped have the 2282 same padding requirements as non-Grouped AVPs, as defined in Section 2283 4. 2285 The AVP Code numbering space of all AVPs included in a Grouped AVP is 2286 the same as for non-grouped AVPs. Receivers of a Grouped AVP that 2287 does not have the 'M' (mandatory) bit set and one or more of the 2288 encapsulated AVPs within the group has the 'M' (mandatory) bit set 2289 MAY simply be ignored if the Grouped AVP itself is unrecognized. The 2290 rule applies even if the encapsulated AVP with its 'M' (mandatory) 2291 bit set is further encapsulated within other sub-groups; i.e. other 2292 Grouped AVPs embedded within the Grouped AVP. 2294 Every Grouped AVP defined MUST include a corresponding grammar, using 2295 ABNF [RFC5234] (with modifications), as defined below. 2297 grouped-avp-def = "::=" avp 2299 name-fmt = ALPHA *(ALPHA / DIGIT / "-") 2301 name = name-fmt 2302 ; The name has to be the name of an AVP, 2303 ; defined in the base or extended Diameter 2304 ; specifications. 2306 avp = header [ *fixed] [ *required] [ *optional] 2308 header = "<" "AVP-Header:" avpcode [vendor] ">" 2310 avpcode = 1*DIGIT 2311 ; The AVP Code assigned to the Grouped AVP 2313 vendor = 1*DIGIT 2314 ; The Vendor-ID assigned to the Grouped AVP. 2315 ; If absent, the default value of zero is 2316 ; used. 2318 4.4.1. Example AVP with a Grouped Data type 2320 The Example-AVP (AVP Code 999999) is of type Grouped and is used to 2321 clarify how Grouped AVP values work. The Grouped Data field has the 2322 following ABNF grammar: 2324 Example-AVP ::= < AVP Header: 999999 > 2325 { Origin-Host } 2326 1*{ Session-Id } 2327 *[ AVP ] 2329 An Example-AVP with Grouped Data follows. 2331 The Origin-Host AVP is required (Section 6.3). In this case: 2333 Origin-Host = "example.com". 2335 One or more Session-Ids must follow. Here there are two: 2337 Session-Id = 2338 "grump.example.com:33041;23432;893;0AF3B81" 2340 Session-Id = 2341 "grump.example.com:33054;23561;2358;0AF3B82" 2343 optional AVPs included are 2345 Recovery-Policy = 2346 2163bc1d0ad82371f6bc09484133c3f09ad74a0dd5346d54195a7cf0b35 2347 2cabc881839a4fdcfbc1769e2677a4c1fb499284c5f70b48f58503a45c5 2348 c2d6943f82d5930f2b7c1da640f476f0e9c9572a50db8ea6e51e1c2c7bd 2349 f8bb43dc995144b8dbe297ac739493946803e1cee3e15d9b765008a1b2a 2350 cf4ac777c80041d72c01e691cf751dbf86e85f509f3988e5875dc905119 2351 26841f00f0e29a6d1ddc1a842289d440268681e052b30fb638045f7779c 2352 1d873c784f054f688f5001559ecff64865ef975f3e60d2fd7966b8c7f92 2354 Futuristic-Acct-Record = 2355 fe19da5802acd98b07a5b86cb4d5d03f0314ab9ef1ad0b67111ff3b90a0 2356 57fe29620bf3585fd2dd9fcc38ce62f6cc208c6163c008f4258d1bc88b8 2357 17694a74ccad3ec69269461b14b2e7a4c111fb239e33714da207983f58c 2358 41d018d56fe938f3cbf089aac12a912a2f0d1923a9390e5f789cb2e5067 2359 d3427475e49968f841 2361 The data for the optional AVPs is represented in hex since the format 2362 of these AVPs is neither known at the time of definition of the 2363 Example-AVP group, nor (likely) at the time when the example instance 2364 of this AVP is interpreted - except by Diameter implementations which 2365 support the same set of AVPs. The encoding example illustrates how 2366 padding is used and how length fields are calculated. Also note that 2367 AVPs may be present in the Grouped AVP value which the receiver 2368 cannot interpret (here, the Recover-Policy and Futuristic-Acct-Record 2369 AVPs). The length of the Example-AVP is the sum of all the length of 2370 the member AVPs including their padding plus the Example-AVP header 2371 size. 2373 This AVP would be encoded as follows: 2375 0 1 2 3 4 5 6 7 2376 +-------+-------+-------+-------+-------+-------+-------+-------+ 2377 0 | Example AVP Header (AVP Code = 999999), Length = 496 | 2378 +-------+-------+-------+-------+-------+-------+-------+-------+ 2379 8 | Origin-Host AVP Header (AVP Code = 264), Length = 19 | 2380 +-------+-------+-------+-------+-------+-------+-------+-------+ 2381 16 | 'e' | 'x' | 'a' | 'm' | 'p' | 'l' | 'e' | '.' | 2382 +-------+-------+-------+-------+-------+-------+-------+-------+ 2383 24 | 'c' | 'o' | 'm' |Padding| Session-Id AVP Header | 2384 +-------+-------+-------+-------+-------+-------+-------+-------+ 2385 32 | (AVP Code = 263), Length = 49 | 'g' | 'r' | 'u' | 'm' | 2386 +-------+-------+-------+-------+-------+-------+-------+-------+ 2387 . . . 2388 +-------+-------+-------+-------+-------+-------+-------+-------+ 2389 72 | 'F' | '3' | 'B' | '8' | '1' |Padding|Padding|Padding| 2390 +-------+-------+-------+-------+-------+-------+-------+-------+ 2391 80 | Session-Id AVP Header (AVP Code = 263), Length = 50 | 2392 +-------+-------+-------+-------+-------+-------+-------+-------+ 2393 88 | 'g' | 'r' | 'u' | 'm' | 'p' | '.' | 'e' | 'x' | 2394 +-------+-------+-------+-------+-------+-------+-------+-------+ 2395 . . . 2396 +-------+-------+-------+-------+-------+-------+-------+-------+ 2397 120| '5' | '8' | ';' | '0' | 'A' | 'F' | '3' | 'B' | 2398 +-------+-------+-------+-------+-------+-------+-------+-------+ 2399 128| '8' | '2' |Padding|Padding| Recovery-Policy Header (AVP | 2400 +-------+-------+-------+-------+-------+-------+-------+-------+ 2401 136| Code = 8341), Length = 223 | 0x21 | 0x63 | 0xbc | 0x1d | 2402 +-------+-------+-------+-------+-------+-------+-------+-------+ 2403 144| 0x0a | 0xd8 | 0x23 | 0x71 | 0xf6 | 0xbc | 0x09 | 0x48 | 2404 +-------+-------+-------+-------+-------+-------+-------+-------+ 2405 . . . 2406 +-------+-------+-------+-------+-------+-------+-------+-------+ 2407 352| 0x8c | 0x7f | 0x92 |Padding| Futuristic-Acct-Record Header | 2408 +-------+-------+-------+-------+-------+-------+-------+-------+ 2409 328|(AVP Code = 15930),Length = 137| 0xfe | 0x19 | 0xda | 0x58 | 2410 +-------+-------+-------+-------+-------+-------+-------+-------+ 2411 336| 0x02 | 0xac | 0xd9 | 0x8b | 0x07 | 0xa5 | 0xb8 | 0xc6 | 2412 +-------+-------+-------+-------+-------+-------+-------+-------+ 2413 . . . 2414 +-------+-------+-------+-------+-------+-------+-------+-------+ 2415 488| 0xe4 | 0x99 | 0x68 | 0xf8 | 0x41 |Padding|Padding|Padding| 2416 +-------+-------+-------+-------+-------+-------+-------+-------+ 2418 4.5. Diameter Base Protocol AVPs 2420 The following table describes the Diameter AVPs defined in the base 2421 protocol, their AVP Code values, types, possible flag values. 2423 Due to space constraints, the short form DiamIdent is used to 2424 represent DiameterIdentity. 2426 +----------+ 2427 | AVP Flag | 2428 | rules | 2429 |----+-----| 2430 AVP Section | |MUST | 2431 Attribute Name Code Defined Data Type |MUST| NOT | 2432 -----------------------------------------|----+-----| 2433 Acct- 85 9.8.2 Unsigned32 | M | V | 2434 Interim-Interval | | | 2435 Accounting- 483 9.8.7 Enumerated | M | V | 2436 Realtime-Required | | | 2437 Acct- 50 9.8.5 UTF8String | M | V | 2438 Multi-Session-Id | | | 2439 Accounting- 485 9.8.3 Unsigned32 | M | V | 2440 Record-Number | | | 2441 Accounting- 480 9.8.1 Enumerated | M | V | 2442 Record-Type | | | 2443 Accounting- 44 9.8.4 OctetString| M | V | 2444 Session-Id | | | 2445 Accounting- 287 9.8.6 Unsigned64 | M | V | 2446 Sub-Session-Id | | | 2447 Acct- 259 6.9 Unsigned32 | M | V | 2448 Application-Id | | | 2449 Auth- 258 6.8 Unsigned32 | M | V | 2450 Application-Id | | | 2451 Auth-Request- 274 8.7 Enumerated | M | V | 2452 Type | | | 2453 Authorization- 291 8.9 Unsigned32 | M | V | 2454 Lifetime | | | 2455 Auth-Grace- 276 8.10 Unsigned32 | M | V | 2456 Period | | | 2457 Auth-Session- 277 8.11 Enumerated | M | V | 2458 State | | | 2459 Re-Auth-Request- 285 8.12 Enumerated | M | V | 2460 Type | | | 2461 Class 25 8.20 OctetString| M | V | 2462 Destination-Host 293 6.5 DiamIdent | M | V | 2463 Destination- 283 6.6 DiamIdent | M | V | 2464 Realm | | | 2465 Disconnect-Cause 273 5.4.3 Enumerated | M | V | 2466 Error-Message 281 7.3 UTF8String | | V,M | 2467 Error-Reporting- 294 7.4 DiamIdent | | V,M | 2468 Host | | | 2469 Event-Timestamp 55 8.21 Time | M | V | 2470 Experimental- 297 7.6 Grouped | M | V | 2471 Result | | | 2472 -----------------------------------------|----+-----| 2473 +----------+ 2474 | AVP Flag | 2475 | rules | 2476 |----+-----| 2477 AVP Section | |MUST | 2478 Attribute Name Code Defined Data Type |MUST| NOT | 2479 -----------------------------------------|----+-----| 2480 Experimental- 298 7.7 Unsigned32 | M | V | 2481 Result-Code | | | 2482 Failed-AVP 279 7.5 Grouped | M | V | 2483 Firmware- 267 5.3.4 Unsigned32 | | V,M | 2484 Revision | | | 2485 Host-IP-Address 257 5.3.5 Address | M | V | 2486 Inband-Security | M | V | 2487 -Id 299 6.10 Unsigned32 | | | 2488 Multi-Round- 272 8.19 Unsigned32 | M | V | 2489 Time-Out | | | 2490 Origin-Host 264 6.3 DiamIdent | M | V | 2491 Origin-Realm 296 6.4 DiamIdent | M | V | 2492 Origin-State-Id 278 8.16 Unsigned32 | M | V | 2493 Product-Name 269 5.3.7 UTF8String | | V,M | 2494 Proxy-Host 280 6.7.3 DiamIdent | M | V | 2495 Proxy-Info 284 6.7.2 Grouped | M | V | 2496 Proxy-State 33 6.7.4 OctetString| M | V | 2497 Redirect-Host 292 6.12 DiamURI | M | V | 2498 Redirect-Host- 261 6.13 Enumerated | M | V | 2499 Usage | | | 2500 Redirect-Max- 262 6.14 Unsigned32 | M | V | 2501 Cache-Time | | | 2502 Result-Code 268 7.1 Unsigned32 | M | V | 2503 Route-Record 282 6.7.1 DiamIdent | M | V | 2504 Session-Id 263 8.8 UTF8String | M | V | 2505 Session-Timeout 27 8.13 Unsigned32 | M | V | 2506 Session-Binding 270 8.17 Unsigned32 | M | V | 2507 Session-Server- 271 8.18 Enumerated | M | V | 2508 Failover | | | 2509 Supported- 265 5.3.6 Unsigned32 | M | V | 2510 Vendor-Id | | | 2511 Termination- 295 8.15 Enumerated | M | V | 2512 Cause | | | 2513 User-Name 1 8.14 UTF8String | M | V | 2514 Vendor-Id 266 5.3.3 Unsigned32 | M | V | 2515 Vendor-Specific- 260 6.11 Grouped | M | V | 2516 Application-Id | | | 2517 -----------------------------------------|----+-----| 2519 5. Diameter Peers 2521 This section describes how Diameter nodes establish connections and 2522 communicate with peers. 2524 5.1. Peer Connections 2526 Connections between diameter peers are established using their valid 2527 DiameterIdentity. A Diameter node initiating a connection to a peer 2528 MUST know the peers DiameterIdentity. Methods for discovering a 2529 Diameter peer can be found in Section 5.2. 2531 Although a Diameter node may have many possible peers that it is able 2532 to communicate with, it may not be economical to have an established 2533 connection to all of them. At a minimum, a Diameter node SHOULD have 2534 an established connection with two peers per realm, known as the 2535 primary and secondary peers. Of course, a node MAY have additional 2536 connections, if it is deemed necessary. Typically, all messages for 2537 a realm are sent to the primary peer, but in the event that failover 2538 procedures are invoked, any pending requests are sent to the 2539 secondary peer. However, implementations are free to load balance 2540 requests between a set of peers. 2542 Note that a given peer MAY act as a primary for a given realm, while 2543 acting as a secondary for another realm. 2545 When a peer is deemed suspect, which could occur for various reasons, 2546 including not receiving a DWA within an allotted timeframe, no new 2547 requests should be forwarded to the peer, but failover procedures are 2548 invoked. When an active peer is moved to this mode, additional 2549 connections SHOULD be established to ensure that the necessary number 2550 of active connections exists. 2552 There are two ways that a peer is removed from the suspect peer list: 2554 1. The peer is no longer reachable, causing the transport connection 2555 to be shutdown. The peer is moved to the closed state. 2557 2. Three watchdog messages are exchanged with accepted round trip 2558 times, and the connection to the peer is considered stabilized. 2560 In the event the peer being removed is either the primary or 2561 secondary, an alternate peer SHOULD replace the deleted peer, and 2562 assume the role of either primary or secondary. 2564 5.2. Diameter Peer Discovery 2566 Allowing for dynamic Diameter agent discovery will make it possible 2567 for simpler and more robust deployment of Diameter services. In 2568 order to promote interoperable implementations of Diameter peer 2569 discovery, the following mechanisms are described. These are based 2570 on existing IETF standards. The first option (manual configuration) 2571 MUST be supported by all Diameter nodes, while the latter option 2572 (DNS) MAY be supported. 2574 There are two cases where Diameter peer discovery may be performed. 2575 The first is when a Diameter client needs to discover a first-hop 2576 Diameter agent. The second case is when a Diameter agent needs to 2577 discover another agent - for further handling of a Diameter 2578 operation. In both cases, the following 'search order' is 2579 recommended: 2581 1. The Diameter implementation consults its list of static 2582 (manually) configured Diameter agent locations. These will be 2583 used if they exist and respond. 2585 2. The Diameter implementation performs a NAPTR query for a server 2586 in a particular realm. The Diameter implementation has to know 2587 in advance which realm to look for a Diameter agent. This could 2588 be deduced, for example, from the 'realm' in a NAI that a 2589 Diameter implementation needed to perform a Diameter operation 2590 on. 2592 The NAPTR usage in Diameter follows the S-NAPTR DDDS application 2593 [RFC3958] in which the SERVICE field includes tags for the 2594 desired application and supported application protocol. The 2595 application service tag for a Diameter application is 'aaa' and 2596 the supported application protocol tags are 'diameter.tcp', 2597 'diameter.sctp', 'diameter.dtls' or 'diameter.tls.tcp'. 2599 The client can follow the resolution process defined by the 2600 S-NAPTR DDDS [RFC3958] application to find a matching SRV, A or 2601 AAAA record of a suitable peer. The domain suffixes in the NAPTR 2602 replacement field SHOULD match the domain of the original query. 2603 An example can be found in Appendix B. 2605 3. If no NAPTR records are found, the requester directly queries for 2606 SRV records '_diameter._sctp'.realm, '_diameter._dtls'.realm, 2607 '_diameter._tcp'.realm and '_diameter._tls'.realm depending on 2608 the requesters network protocol capabilities. If SRV records are 2609 found then the requester can perform address record query (A RR's 2610 and/or AAAA RR's) for the target hostname specified in the SRV 2611 records. If no SRV records are found, the requester gives up. 2613 If the server is using a site certificate, the domain name in the 2614 NAPTR query and the domain name in the replacement field MUST both be 2615 valid based on the site certificate handed out by the server in the 2616 TLS/TCP and DTLS/SCTP or IKE exchange. Similarly, the domain name in 2617 the SRV query and the domain name in the target in the SRV record 2618 MUST both be valid based on the same site certificate. Otherwise, an 2619 attacker could modify the DNS records to contain replacement values 2620 in a different domain, and the client could not validate that this 2621 was the desired behavior, or the result of an attack. 2623 Also, the Diameter Peer MUST check to make sure that the discovered 2624 peers are authorized to act in its role. Authentication via IKE or 2625 TLS/TCP and DTLS/SCTP, or validation of DNS RRs via DNSSEC is not 2626 sufficient to conclude this. For example, a web server may have 2627 obtained a valid TLS/TCP and DTLS/SCTP certificate, and secured RRs 2628 may be included in the DNS, but this does not imply that it is 2629 authorized to act as a Diameter Server. 2631 Authorization can be achieved for example, by configuration of a 2632 Diameter Server CA. Alternatively this can be achieved by definition 2633 of OIDs within TLS/TCP and DTLS/SCTP or IKE certificates so as to 2634 signify Diameter Server authorization. 2636 A dynamically discovered peer causes an entry in the Peer Table (see 2637 Section 2.6) to be created. Note that entries created via DNS MUST 2638 expire (or be refreshed) within the DNS TTL. If a peer is discovered 2639 outside of the local realm, a routing table entry (see Section 2.7) 2640 for the peer's realm is created. The routing table entry's 2641 expiration MUST match the peer's expiration value. 2643 5.3. Capabilities Exchange 2645 When two Diameter peers establish a transport connection, they MUST 2646 exchange the Capabilities Exchange messages, as specified in the peer 2647 state machine (see Section 5.6). This message allows the discovery 2648 of a peer's identity and its capabilities (protocol version number, 2649 supported Diameter applications, security mechanisms, etc.) 2651 The receiver only issues commands to its peers that have advertised 2652 support for the Diameter application that defines the command. A 2653 Diameter node MUST cache the supported applications in order to 2654 ensure that unrecognized commands and/or AVPs are not unnecessarily 2655 sent to a peer. 2657 A receiver of a Capabilities-Exchange-Req (CER) message that does not 2658 have any applications in common with the sender MUST return a 2659 Capabilities-Exchange-Answer (CEA) with the Result-Code AVP set to 2660 DIAMETER_NO_COMMON_APPLICATION, and SHOULD disconnect the transport 2661 layer connection. Note that receiving a CER or CEA from a peer 2662 advertising itself as a Relay (see Section 2.4) MUST be interpreted 2663 as having common applications with the peer. 2665 The receiver of the Capabilities-Exchange-Request (CER) MUST 2666 determine common applications by computing the intersection of its 2667 own set of supported Application Id against all of the application 2668 identifier AVPs (Auth-Application-Id, Acct-Application-Id and Vendor- 2669 Specific-Application-Id) present in the CER. The value of the 2670 Vendor-Id AVP in the Vendor-Specific-Application-Id MUST NOT be used 2671 during computation. The sender of the Capabilities-Exchange-Answer 2672 (CEA) SHOULD include all of its supported applications as a hint to 2673 the receiver regarding all of its application capabilities. 2675 Diameter implementations SHOULD first attempt to establish a TLS/TCP 2676 and DTLS/SCTP connection prior to the CER/CEA exchange. This 2677 protects the capabilities information of both peers. To support 2678 older Diameter implementations that do not fully conform to this 2679 document, the transport security MAY still be negotiated via Inband- 2680 Security AVP. In this case, the receiver of a Capabilities-Exchange- 2681 Req (CER) message that does not have any security mechanisms in 2682 common with the sender MUST return a Capabilities-Exchange-Answer 2683 (CEA) with the Result-Code AVP set to DIAMETER_NO_COMMON_SECURITY, 2684 and SHOULD disconnect the transport layer connection. 2686 CERs received from unknown peers MAY be silently discarded, or a CEA 2687 MAY be issued with the Result-Code AVP set to DIAMETER_UNKNOWN_PEER. 2688 In both cases, the transport connection is closed. If the local 2689 policy permits receiving CERs from unknown hosts, a successful CEA 2690 MAY be returned. If a CER from an unknown peer is answered with a 2691 successful CEA, the lifetime of the peer entry is equal to the 2692 lifetime of the transport connection. In case of a transport 2693 failure, all the pending transactions destined to the unknown peer 2694 can be discarded. 2696 The CER and CEA messages MUST NOT be proxied, redirected or relayed. 2698 Since the CER/CEA messages cannot be proxied, it is still possible 2699 that an upstream agent receives a message for which it has no 2700 available peers to handle the application that corresponds to the 2701 Command-Code. In such instances, the 'E' bit is set in the answer 2702 message (see Section 7.) with the Result-Code AVP set to 2703 DIAMETER_UNABLE_TO_DELIVER to inform the downstream to take action 2704 (e.g., re-routing request to an alternate peer). 2706 With the exception of the Capabilities-Exchange-Request message, a 2707 message of type Request that includes the Auth-Application-Id or 2708 Acct-Application-Id AVPs, or a message with an application-specific 2709 command code, MAY only be forwarded to a host that has explicitly 2710 advertised support for the application (or has advertised the Relay 2711 Application Id). 2713 5.3.1. Capabilities-Exchange-Request 2715 The Capabilities-Exchange-Request (CER), indicated by the Command- 2716 Code set to 257 and the Command Flags' 'R' bit set, is sent to 2717 exchange local capabilities. Upon detection of a transport failure, 2718 this message MUST NOT be sent to an alternate peer. 2720 When Diameter is run over SCTP [RFC4960] or DTLS/SCTP [RFC6083], 2721 which allow for connections to span multiple interfaces and multiple 2722 IP addresses, the Capabilities-Exchange-Request message MUST contain 2723 one Host-IP- Address AVP for each potential IP address that MAY be 2724 locally used when transmitting Diameter messages. 2726 Message Format 2728 ::= < Diameter Header: 257, REQ > 2729 { Origin-Host } 2730 { Origin-Realm } 2731 1* { Host-IP-Address } 2732 { Vendor-Id } 2733 { Product-Name } 2734 [ Origin-State-Id ] 2735 * [ Supported-Vendor-Id ] 2736 * [ Auth-Application-Id ] 2737 * [ Inband-Security-Id ] 2738 * [ Acct-Application-Id ] 2739 * [ Vendor-Specific-Application-Id ] 2740 [ Firmware-Revision ] 2741 * [ AVP ] 2743 5.3.2. Capabilities-Exchange-Answer 2745 The Capabilities-Exchange-Answer (CEA), indicated by the Command-Code 2746 set to 257 and the Command Flags' 'R' bit cleared, is sent in 2747 response to a CER message. 2749 When Diameter is run over SCTP [RFC4960] or DTLS/SCTP [RFC6083], 2750 which allow connections to span multiple interfaces, hence, multiple 2751 IP addresses, the Capabilities-Exchange-Answer message MUST contain 2752 one Host-IP-Address AVP for each potential IP address that MAY be 2753 locally used when transmitting Diameter messages. 2755 Message Format 2757 ::= < Diameter Header: 257 > 2758 { Result-Code } 2759 { Origin-Host } 2760 { Origin-Realm } 2761 1* { Host-IP-Address } 2762 { Vendor-Id } 2763 { Product-Name } 2764 [ Origin-State-Id ] 2765 [ Error-Message ] 2766 [ Failed-AVP ] 2767 * [ Supported-Vendor-Id ] 2768 * [ Auth-Application-Id ] 2769 * [ Inband-Security-Id ] 2770 * [ Acct-Application-Id ] 2771 * [ Vendor-Specific-Application-Id ] 2772 [ Firmware-Revision ] 2773 * [ AVP ] 2775 5.3.3. Vendor-Id AVP 2777 The Vendor-Id AVP (AVP Code 266) is of type Unsigned32 and contains 2778 the IANA "SMI Network Management Private Enterprise Codes" [RFC3232] 2779 value assigned to the vendor of the Diameter device. It is 2780 envisioned that the combination of the Vendor-Id, Product-Name 2781 (Section 5.3.7) and the Firmware-Revision (Section 5.3.4) AVPs may 2782 provide useful debugging information. 2784 A Vendor-Id value of zero in the CER or CEA messages is reserved and 2785 indicates that this field is ignored. 2787 5.3.4. Firmware-Revision AVP 2789 The Firmware-Revision AVP (AVP Code 267) is of type Unsigned32 and is 2790 used to inform a Diameter peer of the firmware revision of the 2791 issuing device. 2793 For devices that do not have a firmware revision (general purpose 2794 computers running Diameter software modules, for instance), the 2795 revision of the Diameter software module may be reported instead. 2797 5.3.5. Host-IP-Address AVP 2799 The Host-IP-Address AVP (AVP Code 257) is of type Address and is used 2800 to inform a Diameter peer of the sender's IP address. All source 2801 addresses that a Diameter node expects to use with SCTP [RFC4960] or 2802 DTLS/SCTP [RFC6083] MUST be advertised in the CER and CEA messages by 2803 including a Host-IP-Address AVP for each address. 2805 5.3.6. Supported-Vendor-Id AVP 2807 The Supported-Vendor-Id AVP (AVP Code 265) is of type Unsigned32 and 2808 contains the IANA "SMI Network Management Private Enterprise Codes" 2809 [RFC3232] value assigned to a vendor other than the device vendor but 2810 including the application vendor. This is used in the CER and CEA 2811 messages in order to inform the peer that the sender supports (a 2812 subset of) the vendor-specific AVPs defined by the vendor identified 2813 in this AVP. The value of this AVP MUST NOT be set to zero. 2814 Multiple instances of this AVP containing the same value SHOULD NOT 2815 be sent. 2817 5.3.7. Product-Name AVP 2819 The Product-Name AVP (AVP Code 269) is of type UTF8String, and 2820 contains the vendor assigned name for the product. The Product-Name 2821 AVP SHOULD remain constant across firmware revisions for the same 2822 product. 2824 5.4. Disconnecting Peer connections 2826 When a Diameter node disconnects one of its transport connections, 2827 its peer cannot know the reason for the disconnect, and will most 2828 likely assume that a connectivity problem occurred, or that the peer 2829 has rebooted. In these cases, the peer may periodically attempt to 2830 reconnect, as stated in Section 2.1. In the event that the 2831 disconnect was a result of either a shortage of internal resources, 2832 or simply that the node in question has no intentions of forwarding 2833 any Diameter messages to the peer in the foreseeable future, a 2834 periodic connection request would not be welcomed. The 2835 Disconnection-Reason AVP contains the reason the Diameter node issued 2836 the Disconnect-Peer-Request message. 2838 The Disconnect-Peer-Request message is used by a Diameter node to 2839 inform its peer of its intent to disconnect the transport layer, and 2840 that the peer shouldn't reconnect unless it has a valid reason to do 2841 so (e.g., message to be forwarded). Upon receipt of the message, the 2842 Disconnect-Peer-Answer is returned, which SHOULD contain an error if 2843 messages have recently been forwarded, and are likely in flight, 2844 which would otherwise cause a race condition. 2846 The receiver of the Disconnect-Peer-Answer initiates the transport 2847 disconnect. The sender of the Disconnect-Peer-Answer should be able 2848 to detect the transport closure and cleanup the connection. 2850 5.4.1. Disconnect-Peer-Request 2852 The Disconnect-Peer-Request (DPR), indicated by the Command-Code set 2853 to 282 and the Command Flags' 'R' bit set, is sent to a peer to 2854 inform its intentions to shutdown the transport connection. Upon 2855 detection of a transport failure, this message MUST NOT be sent to an 2856 alternate peer. 2858 Message Format 2860 ::= < Diameter Header: 282, REQ > 2861 { Origin-Host } 2862 { Origin-Realm } 2863 { Disconnect-Cause } 2864 * [ AVP ] 2866 5.4.2. Disconnect-Peer-Answer 2868 The Disconnect-Peer-Answer (DPA), indicated by the Command-Code set 2869 to 282 and the Command Flags' 'R' bit cleared, is sent as a response 2870 to the Disconnect-Peer-Request message. Upon receipt of this 2871 message, the transport connection is shutdown. 2873 Message Format 2875 ::= < Diameter Header: 282 > 2876 { Result-Code } 2877 { Origin-Host } 2878 { Origin-Realm } 2879 [ Error-Message ] 2880 [ Failed-AVP ] 2881 * [ AVP ] 2883 5.4.3. Disconnect-Cause AVP 2885 The Disconnect-Cause AVP (AVP Code 273) is of type Enumerated. A 2886 Diameter node MUST include this AVP in the Disconnect-Peer-Request 2887 message to inform the peer of the reason for its intention to 2888 shutdown the transport connection. The following values are 2889 supported: 2891 REBOOTING 0 2892 A scheduled reboot is imminent. Receiver of DPR with above result 2893 code MAY attempt reconnection. 2895 BUSY 1 2896 The peer's internal resources are constrained, and it has 2897 determined that the transport connection needs to be closed. 2898 Receiver of DPR with above result code SHOULD NOT attempt 2899 reconnection. 2901 DO_NOT_WANT_TO_TALK_TO_YOU 2 2902 The peer has determined that it does not see a need for the 2903 transport connection to exist, since it does not expect any 2904 messages to be exchanged in the near future. Receiver of DPR 2905 with above result code SHOULD NOT attempt reconnection. 2907 5.5. Transport Failure Detection 2909 Given the nature of the Diameter protocol, it is recommended that 2910 transport failures be detected as soon as possible. Detecting such 2911 failures will minimize the occurrence of messages sent to unavailable 2912 agents, resulting in unnecessary delays, and will provide better 2913 failover performance. The Device-Watchdog-Request and Device- 2914 Watchdog-Answer messages, defined in this section, are used to pro- 2915 actively detect transport failures. 2917 5.5.1. Device-Watchdog-Request 2919 The Device-Watchdog-Request (DWR), indicated by the Command-Code set 2920 to 280 and the Command Flags' 'R' bit set, is sent to a peer when no 2921 traffic has been exchanged between two peers (see Section 5.5.3). 2922 Upon detection of a transport failure, this message MUST NOT be sent 2923 to an alternate peer. 2925 Message Format 2927 ::= < Diameter Header: 280, REQ > 2928 { Origin-Host } 2929 { Origin-Realm } 2930 [ Origin-State-Id ] 2931 * [ AVP ] 2933 5.5.2. Device-Watchdog-Answer 2935 The Device-Watchdog-Answer (DWA), indicated by the Command-Code set 2936 to 280 and the Command Flags' 'R' bit cleared, is sent as a response 2937 to the Device-Watchdog-Request message. 2939 Message Format 2941 ::= < Diameter Header: 280 > 2942 { Result-Code } 2943 { Origin-Host } 2944 { Origin-Realm } 2945 [ Error-Message ] 2946 [ Failed-AVP ] 2947 [ Origin-State-Id ] 2948 * [ AVP ] 2950 5.5.3. Transport Failure Algorithm 2952 The transport failure algorithm is defined in [RFC3539]. All 2953 Diameter implementations MUST support the algorithm defined in the 2954 specification in order to be compliant to the Diameter base protocol. 2956 5.5.4. Failover and Failback Procedures 2958 In the event that a transport failure is detected with a peer, it is 2959 necessary for all pending request messages to be forwarded to an 2960 alternate agent, if possible. This is commonly referred to as 2961 failover. 2963 In order for a Diameter node to perform failover procedures, it is 2964 necessary for the node to maintain a pending message queue for a 2965 given peer. When an answer message is received, the corresponding 2966 request is removed from the queue. The Hop-by-Hop Identifier field 2967 is used to match the answer with the queued request. 2969 When a transport failure is detected, if possible all messages in the 2970 queue are sent to an alternate agent with the T flag set. On booting 2971 a Diameter client or agent, the T flag is also set on any records 2972 still remaining to be transmitted in non-volatile storage. An 2973 example of a case where it is not possible to forward the message to 2974 an alternate server is when the message has a fixed destination, and 2975 the unavailable peer is the message's final destination (see 2976 Destination-Host AVP). Such an error requires that the agent return 2977 an answer message with the 'E' bit set and the Result-Code AVP set to 2978 DIAMETER_UNABLE_TO_DELIVER. 2980 It is important to note that multiple identical requests or answers 2981 MAY be received as a result of a failover. The End-to-End Identifier 2982 field in the Diameter header along with the Origin-Host AVP MUST be 2983 used to identify duplicate messages. 2985 As described in Section 2.1, a connection request should be 2986 periodically attempted with the failed peer in order to re-establish 2987 the transport connection. Once a connection has been successfully 2988 established, messages can once again be forwarded to the peer. This 2989 is commonly referred to as failback. 2991 5.6. Peer State Machine 2993 This section contains a finite state machine that MUST be observed by 2994 all Diameter implementations. Each Diameter node MUST follow the 2995 state machine described below when communicating with each peer. 2996 Multiple actions are separated by commas, and may continue on 2997 succeeding lines, as space requires. Similarly, state and next state 2998 may also span multiple lines, as space requires. 3000 This state machine is closely coupled with the state machine 3001 described in [RFC3539], which is used to open, close, failover, 3002 probe, and reopen transport connections. Note in particular that 3003 [RFC3539] requires the use of watchdog messages to probe connections. 3004 For Diameter, DWR and DWA messages are to be used. 3006 I- is used to represent the initiator (connecting) connection, while 3007 the R- is used to represent the responder (listening) connection. 3008 The lack of a prefix indicates that the event or action is the same 3009 regardless of the connection on which the event occurred. 3011 The stable states that a state machine may be in are Closed, I-Open 3012 and R-Open; all other states are intermediate. Note that I-Open and 3013 R-Open are equivalent except for whether the initiator or responder 3014 transport connection is used for communication. 3016 A CER message is always sent on the initiating connection immediately 3017 after the connection request is successfully completed. In the case 3018 of an election, one of the two connections will shut down. The 3019 responder connection will survive if the Origin-Host of the local 3020 Diameter entity is higher than that of the peer; the initiator 3021 connection will survive if the peer's Origin-Host is higher. All 3022 subsequent messages are sent on the surviving connection. Note that 3023 the results of an election on one peer are guaranteed to be the 3024 inverse of the results on the other. 3026 For TLS/TCP and DTLS/SCTP usage, TLS/TCP and DTLS/SCTP handshake 3027 SHOULD begin when both ends are in the closed state prior to any 3028 Diameter message exchanges. The TLS/TCP and DTLS/SCTP connection 3029 SHOULD be established before sending any CER or CEA message to secure 3030 and protect the capabilities information of both peers. The TLS/TCP 3031 and DTLS/SCTP connection SHOULD be disconnected when the state 3032 machine moves to the closed state. When connecting to responders 3033 that do not conform to this document (i.e. older Diameter 3034 implementations that are not prepared to received TLS/TCP and DTLS/ 3035 SCTP connections in the closed state), the initial TLS/TCP and DTLS/ 3036 SCTP connection attempt will fail. The initiator MAY then attempt to 3037 connect via TCP or SCTP and initiate the TLS/TCP and DTLS/SCTP 3038 handshake when both ends are in the open state. If the handshake is 3039 successful, all further messages will be sent via TLS/TCP and DTLS/ 3040 SCTP. If the handshake fails, both ends move to the closed state. 3042 The state machine constrains only the behavior of a Diameter 3043 implementation as seen by Diameter peers through events on the wire. 3045 Any implementation that produces equivalent results is considered 3046 compliant. 3048 state event action next state 3049 ----------------------------------------------------------------- 3050 Closed Start I-Snd-Conn-Req Wait-Conn-Ack 3051 R-Conn-CER R-Accept, R-Open 3052 Process-CER, 3053 R-Snd-CEA 3055 Wait-Conn-Ack I-Rcv-Conn-Ack I-Snd-CER Wait-I-CEA 3056 I-Rcv-Conn-Nack Cleanup Closed 3057 R-Conn-CER R-Accept, Wait-Conn-Ack/ 3058 Process-CER Elect 3059 Timeout Error Closed 3061 Wait-I-CEA I-Rcv-CEA Process-CEA I-Open 3062 R-Conn-CER R-Accept, Wait-Returns 3063 Process-CER, 3064 Elect 3065 I-Peer-Disc I-Disc Closed 3066 I-Rcv-Non-CEA Error Closed 3067 Timeout Error Closed 3069 Wait-Conn-Ack/ I-Rcv-Conn-Ack I-Snd-CER,Elect Wait-Returns 3070 Elect I-Rcv-Conn-Nack R-Snd-CEA R-Open 3071 R-Peer-Disc R-Disc Wait-Conn-Ack 3072 R-Conn-CER R-Reject Wait-Conn-Ack/ 3073 Elect 3074 Timeout Error Closed 3076 Wait-Returns Win-Election I-Disc,R-Snd-CEA R-Open 3077 I-Peer-Disc I-Disc, R-Open 3078 R-Snd-CEA 3079 I-Rcv-CEA R-Disc I-Open 3080 R-Peer-Disc R-Disc Wait-I-CEA 3081 R-Conn-CER R-Reject Wait-Returns 3082 Timeout Error Closed 3084 R-Open Send-Message R-Snd-Message R-Open 3085 R-Rcv-Message Process R-Open 3086 R-Rcv-DWR Process-DWR, R-Open 3087 R-Snd-DWA 3088 R-Rcv-DWA Process-DWA R-Open 3089 R-Conn-CER R-Reject R-Open 3090 Stop R-Snd-DPR Closing 3091 R-Rcv-DPR R-Snd-DPA, Closed 3092 R-Disc 3093 R-Peer-Disc R-Disc Closed 3095 I-Open Send-Message I-Snd-Message I-Open 3096 I-Rcv-Message Process I-Open 3097 I-Rcv-DWR Process-DWR, I-Open 3098 I-Snd-DWA 3099 I-Rcv-DWA Process-DWA I-Open 3100 R-Conn-CER R-Reject I-Open 3101 Stop I-Snd-DPR Closing 3102 I-Rcv-DPR I-Snd-DPA, Closed 3103 I-Disc 3104 I-Peer-Disc I-Disc Closed 3106 Closing I-Rcv-DPA I-Disc Closed 3107 R-Rcv-DPA R-Disc Closed 3108 Timeout Error Closed 3109 I-Peer-Disc I-Disc Closed 3110 R-Peer-Disc R-Disc Closed 3112 5.6.1. Incoming connections 3114 When a connection request is received from a Diameter peer, it is 3115 not, in the general case, possible to know the identity of that peer 3116 until a CER is received from it. This is because host and port 3117 determine the identity of a Diameter peer; and the source port of an 3118 incoming connection is arbitrary. Upon receipt of CER, the identity 3119 of the connecting peer can be uniquely determined from Origin-Host. 3121 For this reason, a Diameter peer must employ logic separate from the 3122 state machine to receive connection requests, accept them, and await 3123 CER. Once CER arrives on a new connection, the Origin-Host that 3124 identifies the peer is used to locate the state machine associated 3125 with that peer, and the new connection and CER are passed to the 3126 state machine as an R-Conn-CER event. 3128 The logic that handles incoming connections SHOULD close and discard 3129 the connection if any message other than CER arrives, or if an 3130 implementation-defined timeout occurs prior to receipt of CER. 3132 Because handling of incoming connections up to and including receipt 3133 of CER requires logic, separate from that of any individual state 3134 machine associated with a particular peer, it is described separately 3135 in this section rather than in the state machine above. 3137 5.6.2. Events 3139 Transitions and actions in the automaton are caused by events. In 3140 this section, we will ignore the -I and -R prefix, since the actual 3141 event would be identical, but would occur on one of two possible 3142 connections. 3144 Start The Diameter application has signaled that a 3145 connection should be initiated with the peer. 3147 R-Conn-CER An acknowledgement is received stating that the 3148 transport connection has been established, and the 3149 associated CER has arrived. 3151 Rcv-Conn-Ack A positive acknowledgement is received confirming that 3152 the transport connection is established. 3154 Rcv-Conn-Nack A negative acknowledgement was received stating that 3155 the transport connection was not established. 3157 Timeout An application-defined timer has expired while waiting 3158 for some event. 3160 Rcv-CER A CER message from the peer was received. 3162 Rcv-CEA A CEA message from the peer was received. 3164 Rcv-Non-CEA A message other than CEA from the peer was received. 3166 Peer-Disc A disconnection indication from the peer was received. 3168 Rcv-DPR A DPR message from the peer was received. 3170 Rcv-DPA A DPA message from the peer was received. 3172 Win-Election An election was held, and the local node was the 3173 winner. 3175 Send-Message A message is to be sent. 3177 Rcv-Message A message other than CER, CEA, DPR, DPA, DWR or DWA 3178 was received. 3180 Stop The Diameter application has signaled that a 3181 connection should be terminated (e.g., on system 3182 shutdown). 3184 5.6.3. Actions 3186 Actions in the automaton are caused by events and typically indicate 3187 the transmission of packets and/or an action to be taken on the 3188 connection. In this section we will ignore the I- and R-prefix, 3189 since the actual action would be identical, but would occur on one of 3190 two possible connections. 3192 Snd-Conn-Req A transport connection is initiated with the peer. 3194 Accept The incoming connection associated with the R-Conn-CER 3195 is accepted as the responder connection. 3197 Reject The incoming connection associated with the R-Conn-CER 3198 is disconnected. 3200 Process-CER The CER associated with the R-Conn-CER is processed. 3201 Snd-CER A CER message is sent to the peer. 3203 Snd-CEA A CEA message is sent to the peer. 3205 Cleanup If necessary, the connection is shutdown, and any 3206 local resources are freed. 3208 Error The transport layer connection is disconnected, 3209 either politely or abortively, in response to 3210 an error condition. Local resources are freed. 3212 Process-CEA A received CEA is processed. 3214 Snd-DPR A DPR message is sent to the peer. 3216 Snd-DPA A DPA message is sent to the peer. 3218 Disc The transport layer connection is disconnected, 3219 and local resources are freed. 3221 Elect An election occurs (see Section 5.6.4 for more 3222 information). 3224 Snd-Message A message is sent. 3226 Snd-DWR A DWR message is sent. 3228 Snd-DWA A DWA message is sent. 3230 Process-DWR The DWR message is serviced. 3232 Process-DWA The DWA message is serviced. 3234 Process A message is serviced. 3236 5.6.4. The Election Process 3238 The election is performed on the responder. The responder compares 3239 the Origin-Host received in the CER with its own Origin-Host as two 3240 streams of octets. If the local Origin-Host lexicographically 3241 succeeds the received Origin-Host a Win-Election event is issued 3242 locally. Diameter identities are in ASCII form therefore the lexical 3243 comparison is consistent with DNS case insensitivity where octets 3244 that fall in the ASCII range 'a' through 'z' MUST compare equally to 3245 their upper-case counterparts between 'A' and 'Z'. See Appendix D 3246 for interactions between the Diameter protocol and Internationalized 3247 Domain Name (IDNs). 3249 The winner of the election MUST close the connection it initiated. 3250 Historically, maintaining the responder side of a connection was more 3251 efficient than maintaining the initiator side. However, current 3252 practices makes this distinction irrelevant. 3254 6. Diameter message processing 3256 This section describes how Diameter requests and answers are created 3257 and processed. 3259 6.1. Diameter Request Routing Overview 3261 A request is sent towards its final destination using a combination 3262 of the Destination-Realm and Destination-Host AVPs, in one of these 3263 three combinations: 3265 o a request that is not able to be proxied (such as CER) MUST NOT 3266 contain either Destination-Realm or Destination-Host AVPs. 3268 o a request that needs to be sent to a home server serving a 3269 specific realm, but not to a specific server (such as the first 3270 request of a series of round-trips), MUST contain a Destination- 3271 Realm AVP, but MUST NOT contain a Destination-Host AVP. For 3272 Diameter clients, the value of the Destination-Realm AVP MAY be 3273 extracted from the User-Name AVP, or other methods. 3275 o otherwise, a request that needs to be sent to a specific home 3276 server among those serving a given realm, MUST contain both the 3277 Destination-Realm and Destination-Host AVPs. 3279 The Destination-Host AVP is used as described above when the 3280 destination of the request is fixed, which includes: 3282 o Authentication requests that span multiple round trips 3284 o A Diameter message that uses a security mechanism that makes use 3285 of a pre-established session key shared between the source and the 3286 final destination of the message. 3288 o Server initiated messages that MUST be received by a specific 3289 Diameter client (e.g., access device), such as the Abort-Session- 3290 Request message, which is used to request that a particular user's 3291 session be terminated. 3293 Note that an agent can forward a request to a host described in the 3294 Destination-Host AVP only if the host in question is included in its 3295 peer table (see Section 2.7). Otherwise, the request is routed based 3296 on the Destination-Realm only (see Sections 6.1.6). 3298 When a message is received, the message is processed in the following 3299 order: 3301 o If the message is destined for the local host, the procedures 3302 listed in Section 6.1.4 are followed. 3304 o If the message is intended for a Diameter peer with whom the local 3305 host is able to directly communicate, the procedures listed in 3306 Section 6.1.5 are followed. This is known as Request Forwarding. 3308 o The procedures listed in Section 6.1.6 are followed, which is 3309 known as Request Routing. 3311 o If none of the above is successful, an answer is returned with the 3312 Result-Code set to DIAMETER_UNABLE_TO_DELIVER, with the E-bit set. 3314 For routing of Diameter messages to work within an administrative 3315 domain, all Diameter nodes within the realm MUST be peers. 3317 Note the processing rules contained in this section are intended to 3318 be used as general guidelines to Diameter developers. Certain 3319 implementations MAY use different methods than the ones described 3320 here, and still comply with the protocol specification. See Section 3321 7 for more detail on error handling. 3323 6.1.1. Originating a Request 3325 When creating a request, in addition to any other procedures 3326 described in the application definition for that specific request, 3327 the following procedures MUST be followed: 3329 o the Command-Code is set to the appropriate value 3331 o the 'R' bit is set 3333 o the End-to-End Identifier is set to a locally unique value 3335 o the Origin-Host and Origin-Realm AVPs MUST be set to the 3336 appropriate values, used to identify the source of the message 3338 o the Destination-Host and Destination-Realm AVPs MUST be set to the 3339 appropriate values as described in Section 6.1. 3341 6.1.2. Sending a Request 3343 When sending a request, originated either locally, or as the result 3344 of a forwarding or routing operation, the following procedures SHOULD 3345 be followed: 3347 o The Hop-by-Hop Identifier SHOULD be set to a locally unique value. 3349 o The message SHOULD be saved in the list of pending requests. 3351 Other actions to perform on the message based on the particular role 3352 the agent is playing are described in the following sections. 3354 6.1.3. Receiving Requests 3356 A relay or proxy agent MUST check for forwarding loops when receiving 3357 requests. A loop is detected if the server finds its own identity in 3358 a Route-Record AVP. When such an event occurs, the agent MUST answer 3359 with the Result-Code AVP set to DIAMETER_LOOP_DETECTED. 3361 6.1.4. Processing Local Requests 3363 A request is known to be for local consumption when one of the 3364 following conditions occur: 3366 o The Destination-Host AVP contains the local host's identity, 3368 o The Destination-Host AVP is not present, the Destination-Realm AVP 3369 contains a realm the server is configured to process locally, and 3370 the Diameter application is locally supported, or 3372 o Both the Destination-Host and the Destination-Realm are not 3373 present. 3375 When a request is locally processed, the rules in Section 6.2 should 3376 be used to generate the corresponding answer. 3378 6.1.5. Request Forwarding 3380 Request forwarding is done using the Diameter Peer Table. The 3381 Diameter peer table contains all of the peers that the local node is 3382 able to directly communicate with. 3384 When a request is received, and the host encoded in the Destination- 3385 Host AVP is one that is present in the peer table, the message SHOULD 3386 be forwarded to the peer. 3388 6.1.6. Request Routing 3390 Diameter request message routing is done via realms and application 3391 identifiers. A Diameter message that may be forwarded by Diameter 3392 agents (proxies, redirect or relay agents) MUST include the target 3393 realm in the Destination-Realm AVP. Request routing SHOULD rely on 3394 the Destination-Realm AVP and the Application Id present in the 3395 request message header to aid in the routing decision. The realm MAY 3396 be retrieved from the User-Name AVP, which is in the form of a 3397 Network Access Identifier (NAI). The realm portion of the NAI is 3398 inserted in the Destination-Realm AVP. 3400 Diameter agents MAY have a list of locally supported realms and 3401 applications, and MAY have a list of externally supported realms and 3402 applications. When a request is received that includes a realm 3403 and/or application that is not locally supported, the message is 3404 routed to the peer configured in the Routing Table (see Section 2.7). 3406 Realm names and Application Ids are the minimum supported routing 3407 criteria, additional information may be needed to support redirect 3408 semantics. 3410 6.1.7. Predictive Loop Avoidance 3412 Before forwarding or routing a request, Diameter agents, in addition 3413 to processing done in Section 6.1.3, SHOULD check for the presence of 3414 candidate route's peer identity in any of the Route-Record AVPs. In 3415 an event of the agent detecting the presence of a candidate route's 3416 peer identity in a Route-Record AVP, the agent MUST ignore such route 3417 for the Diameter request message and attempt alternate routes if any. 3418 In case all the candidate routes are eliminated by the above 3419 criteria, the agent SHOULD return DIAMETER_UNABLE_TO_DELIVER message. 3421 6.1.8. Redirecting Requests 3423 When a redirect agent receives a request whose routing entry is set 3424 to REDIRECT, it MUST reply with an answer message with the 'E' bit 3425 set, while maintaining the Hop-by-Hop Identifier in the header, and 3426 include the Result-Code AVP to DIAMETER_REDIRECT_INDICATION. Each of 3427 the servers associated with the routing entry are added in separate 3428 Redirect-Host AVP. 3430 +------------------+ 3431 | Diameter | 3432 | Redirect Agent | 3433 +------------------+ 3434 ^ | 2. command + 'E' bit 3435 1. Request | | Result-Code = 3436 joe@example.com | | DIAMETER_REDIRECT_INDICATION + 3437 | | Redirect-Host AVP(s) 3438 | v 3439 +-------------+ 3. Request +-------------+ 3440 | example.com |------------->| example.net | 3441 | Relay | | Diameter | 3442 | Agent |<-------------| Server | 3443 +-------------+ 4. Answer +-------------+ 3444 Figure 5: Diameter Redirect Agent 3446 The receiver of the answer message with the 'E' bit set, and the 3447 Result-Code AVP set to DIAMETER_REDIRECT_INDICATION uses the hop-by- 3448 hop field in the Diameter header to identify the request in the 3449 pending message queue (see Section 5.3) that is to be redirected. If 3450 no transport connection exists with the new agent, one is created, 3451 and the request is sent directly to it. 3453 Multiple Redirect-Host AVPs are allowed. The receiver of the answer 3454 message with the 'E' bit set selects exactly one of these hosts as 3455 the destination of the redirected message. 3457 When the Redirect-Host-Usage AVP included in the answer message has a 3458 non-zero value, a route entry for the redirect indications is created 3459 and cached by the receiver. The redirect usage for such route entry 3460 is set by the value of Redirect-Host-Usage AVP and the lifetime of 3461 the cached route entry is set by Redirect-Max-Cache-Time AVP value. 3463 It is possible that multiple redirect indications can create multiple 3464 cached route entries differing only in their redirect usage and the 3465 peer to forward messages to. As an example, two(2) route entries 3466 that are created by two(2) redirect indications results in two(2) 3467 cached routes for the same realm and Application Id. However, one 3468 has a redirect usage of ALL_SESSION where matching request will be 3469 forwarded to one peer and the other has a redirect usage of ALL_REALM 3470 where request are forwarded to another peer. Therefore, an incoming 3471 request that matches the realm and Application Id of both routes will 3472 need additional resolution. In such a case, a routing precedence 3473 rule MUST be used against the redirect usage value to resolve the 3474 contention. The precedence rule can be found in Section 6.13. 3476 6.1.9. Relaying and Proxying Requests 3478 A relay or proxy agent MUST append a Route-Record AVP to all requests 3479 forwarded. The AVP contains the identity of the peer the request was 3480 received from. 3482 The Hop-by-Hop identifier in the request is saved, and replaced with 3483 a locally unique value. The source of the request is also saved, 3484 which includes the IP address, port and protocol. 3486 A relay or proxy agent MAY include the Proxy-Info AVP in requests if 3487 it requires access to any local state information when the 3488 corresponding response is received. The Proxy-Info AVP has security 3489 implications as state information is distribute to other entities. 3490 As such, it is RECOMMMENDED to protect the content of the Proxy-Info 3491 AVP with cryptographic mechanisms, for example by using a keyed 3492 message digest. Such a mechanism, however, requires the management 3493 of keys, although only locally at the Diameter server. Still, a full 3494 description of the management of the keys used to protect the Proxy- 3495 Info AVP is beyond the scope of this document. Below is a list of 3496 commonly recommended: 3498 o The keys should be generated securely following the randomness 3499 recommendations in [RFC4086]. 3501 o The keys and cryptographic protection algorithms should be at 3502 least 128 bits in strength. 3504 o The keys should not be used for any other purpose than generating 3505 and verifying tickets. 3507 o The keys should be changed regularly. 3509 o The keys should be changed if the ticket format or cryptographic 3510 protection algorithms change. 3512 The message is then forwarded to the next hop, as identified in the 3513 Routing Table. 3515 Figure 6 provides an example of message routing using the procedures 3516 listed in these sections. 3518 (Origin-Host=nas.example.net) (Origin-Host=nas.example.net) 3519 (Origin-Realm=example.net) (Origin-Realm=example.net) 3520 (Destination-Realm=example.com) (Destination- 3521 Realm=example.com) 3522 (Route-Record=nas.example.net) 3523 +------+ ------> +------+ ------> +------+ 3524 | | (Request) | | (Request) | | 3525 | NAS +-------------------+ DRL +-------------------+ HMS | 3526 | | | | | | 3527 +------+ <------ +------+ <------ +------+ 3528 example.net (Answer) example.net (Answer) example.com 3529 (Origin-Host=hms.example.com) (Origin-Host=hms.example.com) 3530 (Origin-Realm=example.com) (Origin-Realm=example.com) 3532 Figure 6: Routing of Diameter messages 3534 Relay and proxy agents are not required to perform full inspection of 3535 incoming messages. At a minimum, validation of the message header 3536 and relevant routing AVPs has to be done when relaying messages. 3537 Proxy agents may optionally perform more in-depth message validation 3538 for applications it is interested in. 3540 6.2. Diameter Answer Processing 3542 When a request is locally processed, the following procedures MUST be 3543 applied to create the associated answer, in addition to any 3544 additional procedures that MAY be discussed in the Diameter 3545 application defining the command: 3547 o The same Hop-by-Hop identifier in the request is used in the 3548 answer. 3550 o The local host's identity is encoded in the Origin-Host AVP. 3552 o The Destination-Host and Destination-Realm AVPs MUST NOT be 3553 present in the answer message. 3555 o The Result-Code AVP is added with its value indicating success or 3556 failure. 3558 o If the Session-Id is present in the request, it MUST be included 3559 in the answer. 3561 o Any Proxy-Info AVPs in the request MUST be added to the answer 3562 message, in the same order they were present in the request. 3564 o The 'P' bit is set to the same value as the one in the request. 3566 o The same End-to-End identifier in the request is used in the 3567 answer. 3569 Note that the error messages (see Section 7.3) are also subjected to 3570 the above processing rules. 3572 6.2.1. Processing received Answers 3574 A Diameter client or proxy MUST match the Hop-by-Hop Identifier in an 3575 answer received against the list of pending requests. The 3576 corresponding message should be removed from the list of pending 3577 requests. It SHOULD ignore answers received that do not match a 3578 known Hop-by-Hop Identifier. 3580 6.2.2. Relaying and Proxying Answers 3582 If the answer is for a request which was proxied or relayed, the 3583 agent MUST restore the original value of the Diameter header's Hop- 3584 by-Hop Identifier field. 3586 If the last Proxy-Info AVP in the message is targeted to the local 3587 Diameter server, the AVP MUST be removed before the answer is 3588 forwarded. 3590 If a relay or proxy agent receives an answer with a Result-Code AVP 3591 indicating a failure, it MUST NOT modify the contents of the AVP. 3592 Any additional local errors detected SHOULD be logged, but not 3593 reflected in the Result-Code AVP. If the agent receives an answer 3594 message with a Result-Code AVP indicating success, and it wishes to 3595 modify the AVP to indicate an error, it MUST modify the Result-Code 3596 AVP to contain the appropriate error in the message destined towards 3597 the access device as well as include the Error-Reporting-Host AVP and 3598 it MUST issue an STR on behalf of the access device towards the 3599 Diameter server. 3601 The agent MUST then send the answer to the host that it received the 3602 original request from. 3604 6.3. Origin-Host AVP 3606 The Origin-Host AVP (AVP Code 264) is of type DiameterIdentity, and 3607 MUST be present in all Diameter messages. This AVP identifies the 3608 endpoint that originated the Diameter message. Relay agents MUST NOT 3609 modify this AVP. 3611 The value of the Origin-Host AVP is guaranteed to be unique within a 3612 single host. 3614 Note that the Origin-Host AVP may resolve to more than one address as 3615 the Diameter peer may support more than one address. 3617 This AVP SHOULD be placed as close to the Diameter header as 3618 possible. 3620 6.4. Origin-Realm AVP 3622 The Origin-Realm AVP (AVP Code 296) is of type DiameterIdentity. 3623 This AVP contains the Realm of the originator of any Diameter message 3624 and MUST be present in all messages. 3626 This AVP SHOULD be placed as close to the Diameter header as 3627 possible. 3629 6.5. Destination-Host AVP 3631 The Destination-Host AVP (AVP Code 293) is of type DiameterIdentity. 3632 This AVP MUST be present in all unsolicited agent initiated messages, 3633 MAY be present in request messages, and MUST NOT be present in Answer 3634 messages. 3636 The absence of the Destination-Host AVP will cause a message to be 3637 sent to any Diameter server supporting the application within the 3638 realm specified in Destination-Realm AVP. 3640 This AVP SHOULD be placed as close to the Diameter header as 3641 possible. 3643 6.6. Destination-Realm AVP 3645 The Destination-Realm AVP (AVP Code 283) is of type DiameterIdentity, 3646 and contains the realm the message is to be routed to. The 3647 Destination-Realm AVP MUST NOT be present in Answer messages. 3648 Diameter Clients insert the realm portion of the User-Name AVP. 3649 Diameter servers initiating a request message use the value of the 3650 Origin-Realm AVP from a previous message received from the intended 3651 target host (unless it is known a priori). When present, the 3652 Destination-Realm AVP is used to perform message routing decisions. 3654 An ABNF for a request message that includes the Destination-Realm AVP 3655 SHOULD list the Destination-Realm AVP as a required AVP (an AVP 3656 indicated as {AVP}) otherwise the message is inherently a non- 3657 routable message. 3659 This AVP SHOULD be placed as close to the Diameter header as 3660 possible. 3662 6.7. Routing AVPs 3664 The AVPs defined in this section are Diameter AVPs used for routing 3665 purposes. These AVPs change as Diameter messages are processed by 3666 agents. 3668 6.7.1. Route-Record AVP 3670 The Route-Record AVP (AVP Code 282) is of type DiameterIdentity. The 3671 identity added in this AVP MUST be the same as the one received in 3672 the Origin-Host of the Capabilities Exchange message. 3674 6.7.2. Proxy-Info AVP 3676 The Proxy-Info AVP (AVP Code 284) is of type Grouped. This AVP 3677 contains the identity and local state information of the Diameter 3678 node that creates and adds it to a message. The Grouped Data field 3679 has the following ABNF grammar: 3681 Proxy-Info ::= < AVP Header: 284 > 3682 { Proxy-Host } 3683 { Proxy-State } 3685 * [ AVP ] 3687 6.7.3. Proxy-Host AVP 3689 The Proxy-Host AVP (AVP Code 280) is of type DiameterIdentity. This 3690 AVP contains the identity of the host that added the Proxy-Info AVP. 3692 6.7.4. Proxy-State AVP 3694 The Proxy-State AVP (AVP Code 33) is of type OctetString. It 3695 contains state information that would otherwise be stored at the 3696 Diameter entity that created it. As such, this AVP MUST be treated 3697 as opaque data by other Diameter entities. 3699 6.8. Auth-Application-Id AVP 3701 The Auth-Application-Id AVP (AVP Code 258) is of type Unsigned32 and 3702 is used in order to advertise support of the Authentication and 3703 Authorization portion of an application (see Section 2.4). If 3704 present in a message other than CER and CEA, the value of the Auth- 3705 Application-Id AVP MUST match the Application Id present in the 3706 Diameter message header. 3708 6.9. Acct-Application-Id AVP 3710 The Acct-Application-Id AVP (AVP Code 259) is of type Unsigned32 and 3711 is used in order to advertise support of the Accounting portion of an 3712 application (see Section 2.4). If present in a message other than 3713 CER and CEA, the value of the Acct-Application-Id AVP MUST match the 3714 Application Id present in the Diameter message header. 3716 6.10. Inband-Security-Id AVP 3718 The Inband-Security-Id AVP (AVP Code 299) is of type Unsigned32 and 3719 is used in order to advertise support of the security portion of the 3720 application. The use of this AVP in CER and CEA messages is no 3721 longer recommended. Instead, discovery of a Diameter entities 3722 security capabilities can be done either through static configuration 3723 or via Diameter Peer Discovery described in Section 5.2. 3725 The following values are supported: 3727 NO_INBAND_SECURITY 0 3729 This peer does not support TLS/TCP and DTLS/SCTP. This is the 3730 default value, if the AVP is omitted. 3732 TLS 1 3734 This node supports TLS/TCP and DTLS/SCTP security, as defined by 3735 [RFC5246]. 3737 6.11. Vendor-Specific-Application-Id AVP 3739 The Vendor-Specific-Application-Id AVP (AVP Code 260) is of type 3740 Grouped and is used to advertise support of a vendor-specific 3741 Diameter Application. Exactly one instance of either Auth- 3742 Application-Id or Acct-Application-Id AVP MUST be present. The 3743 Application Id carried by either Auth-Application-Id or Acct- 3744 Application-Id AVP MUST comply with vendor specific Application Id 3745 assignment described in Sec 11.3. It MUST also match the Application 3746 Id present in the Diameter header except when used in a CER or CEA 3747 message. 3749 The Vendor-Id AVP is an informational AVP pertaining to the vendor 3750 who may have authorship of the vendor-specific Diameter application. 3751 It MUST NOT be used as a means of defining a completely separate 3752 vendor-specific Application Id space. 3754 The Vendor-Specific-Application-Id AVP SHOULD be placed as close to 3755 the Diameter header as possible. 3757 AVP Format 3759 ::= < AVP Header: 260 > 3760 { Vendor-Id } 3761 [ Auth-Application-Id ] 3762 [ Acct-Application-Id ] 3764 A Vendor-Specific-Application-Id AVP MUST contain exactly one of 3765 either Auth-Application-Id or Acct-Application-Id. If a Vendor- 3766 Specific-Application-Id is received without any of these two AVPs, 3767 then the recipient SHOULD issue an answer with a Result-Code set to 3768 DIAMETER_MISSING_AVP. The answer SHOULD also include a Failed-AVP 3769 which MUST contain an example of an Auth-Application-Id AVP and an 3770 Acct-Application-Id AVP. 3772 If a Vendor-Specific-Application-Id is received that contains both 3773 Auth-Application-Id and Acct-Application-Id, then the recipient MUST 3774 issue an answer with Result-Code set to 3775 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES. The answer MUST also include a 3776 Failed-AVP which MUST contain the received Auth-Application-Id AVP 3777 and Acct-Application-Id AVP. 3779 6.12. Redirect-Host AVP 3781 The Redirect-Host AVP (AVP Code 292) is of type DiameterURI. One or 3782 more of instances of this AVP MUST be present if the answer message's 3783 'E' bit is set and the Result-Code AVP is set to 3784 DIAMETER_REDIRECT_INDICATION. 3786 Upon receiving the above, the receiving Diameter node SHOULD forward 3787 the request directly to one of the hosts identified in these AVPs. 3788 The server contained in the selected Redirect-Host AVP SHOULD be used 3789 for all messages matching the criteria set by the Redirect-Host-Usage 3790 AVP. 3792 6.13. Redirect-Host-Usage AVP 3794 The Redirect-Host-Usage AVP (AVP Code 261) is of type Enumerated. 3795 This AVP MAY be present in answer messages whose 'E' bit is set and 3796 the Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION. 3798 When present, this AVP provides a hints about how the routing entry 3799 resulting from the Redirect-Host is to be used. The following values 3800 are supported: 3802 DONT_CACHE 0 3804 The host specified in the Redirect-Host AVP SHOULD NOT be cached. 3805 This is the default value. 3807 ALL_SESSION 1 3809 All messages within the same session, as defined by the same value 3810 of the Session-ID AVP SHOULD be sent to the host specified in the 3811 Redirect-Host AVP. 3813 ALL_REALM 2 3815 All messages destined for the realm requested SHOULD be sent to 3816 the host specified in the Redirect-Host AVP. 3818 REALM_AND_APPLICATION 3 3820 All messages for the application requested to the realm specified 3821 SHOULD be sent to the host specified in the Redirect-Host AVP. 3823 ALL_APPLICATION 4 3825 All messages for the application requested SHOULD be sent to the 3826 host specified in the Redirect-Host AVP. 3828 ALL_HOST 5 3830 All messages that would be sent to the host that generated the 3831 Redirect-Host SHOULD be sent to the host specified in the 3832 Redirect- Host AVP. 3834 ALL_USER 6 3836 All messages for the user requested SHOULD be sent to the host 3837 specified in the Redirect-Host AVP. 3839 When multiple cached routes are created by redirect indications and 3840 they differ only in redirect usage and peers to forward requests to 3841 (see Section 6.1.8), a precedence rule MUST be applied to the 3842 redirect usage values of the cached routes during normal routing to 3843 resolve contentions that may occur. The precedence rule is the order 3844 that dictate which redirect usage should be considered before any 3845 other as they appear. The order is as follows: 3847 1. ALL_SESSION 3849 2. ALL_USER 3851 3. REALM_AND_APPLICATION 3853 4. ALL_REALM 3855 5. ALL_APPLICATION 3857 6. ALL_HOST 3859 6.14. Redirect-Max-Cache-Time AVP 3861 The Redirect-Max-Cache-Time AVP (AVP Code 262) is of type Unsigned32. 3862 This AVP MUST be present in answer messages whose 'E' bit is set, the 3863 Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION and the 3864 Redirect-Host-Usage AVP set to a non-zero value. 3866 This AVP contains the maximum number of seconds the peer and route 3867 table entries, created as a result of the Redirect-Host, SHOULD be 3868 cached. Note that once a host is no longer reachable, any associated 3869 cache, peer and routing table entries MUST be deleted. 3871 7. Error Handling 3873 There are two different types of errors in Diameter; protocol and 3874 application errors. A protocol error is one that occurs at the base 3875 protocol level, and MAY require per hop attention (e.g., message 3876 routing error). Application errors, on the other hand, generally 3877 occur due to a problem with a function specified in a Diameter 3878 application (e.g., user authentication, missing AVP). 3880 Result-Code AVP values that are used to report protocol errors MUST 3881 only be present in answer messages whose 'E' bit is set. When a 3882 request message is received that causes a protocol error, an answer 3883 message is returned with the 'E' bit set, and the Result-Code AVP is 3884 set to the appropriate protocol error value. As the answer is sent 3885 back towards the originator of the request, each proxy or relay agent 3886 MAY take action on the message. 3888 1. Request +---------+ Link Broken 3889 +-------------------------->|Diameter |----///----+ 3890 | +---------------------| | v 3891 +------+--+ | 2. answer + 'E' set | Relay 2 | +--------+ 3892 |Diameter |<-+ (Unable to Forward) +---------+ |Diameter| 3893 | | | Home | 3894 | Relay 1 |--+ +---------+ | Server | 3895 +---------+ | 3. Request |Diameter | +--------+ 3896 +-------------------->| | ^ 3897 | Relay 3 |-----------+ 3898 +---------+ 3900 Figure 7: Example of Protocol Error causing answer message 3902 Figure 7 provides an example of a message forwarded upstream by a 3903 Diameter relay. When the message is received by Relay 2, and it 3904 detects that it cannot forward the request to the home server, an 3905 answer message is returned with the 'E' bit set and the Result-Code 3906 AVP set to DIAMETER_UNABLE_TO_DELIVER. Given that this error falls 3907 within the protocol error category, Relay 1 would take special 3908 action, and given the error, attempt to route the message through its 3909 alternate Relay 3. 3911 +---------+ 1. Request +---------+ 2. Request +---------+ 3912 | Access |------------>|Diameter |------------>|Diameter | 3913 | | | | | Home | 3914 | Device |<------------| Relay |<------------| Server | 3915 +---------+ 4. Answer +---------+ 3. Answer +---------+ 3916 (Missing AVP) (Missing AVP) 3918 Figure 8: Example of Application Error Answer message 3920 Figure 8 provides an example of a Diameter message that caused an 3921 application error. When application errors occur, the Diameter 3922 entity reporting the error clears the 'R' bit in the Command Flags, 3923 and adds the Result-Code AVP with the proper value. Application 3924 errors do not require any proxy or relay agent involvement, and 3925 therefore the message would be forwarded back to the originator of 3926 the request. 3928 In the case where the answer message itself contains errors, any 3929 related session SHOULD be terminated by sending an STR or ASR 3930 message. The Termination-Cause AVP in the STR MAY be filled with the 3931 appropriate value to indicate the cause of the error. An application 3932 MAY also send an application-specific request instead of STR or ASR 3933 to signal the error in the case where no state is maintained or to 3934 allow for some form of error recovery with the corresponding Diameter 3935 entity. 3937 There are certain Result-Code AVP application errors that require 3938 additional AVPs to be present in the answer. In these cases, the 3939 Diameter node that sets the Result-Code AVP to indicate the error 3940 MUST add the AVPs. Examples are: 3942 o A request with an unrecognized AVP is received with the 'M' bit 3943 (Mandatory bit) set, causes an answer to be sent with the Result- 3944 Code AVP set to DIAMETER_AVP_UNSUPPORTED, and the Failed-AVP AVP 3945 containing the offending AVP. 3947 o A request with an AVP that is received with an unrecognized value 3948 causes an answer to be returned with the Result-Code AVP set to 3949 DIAMETER_INVALID_AVP_VALUE, with the Failed-AVP AVP containing the 3950 AVP causing the error. 3952 o A received command which is missing AVP(s) that are defined as 3953 required in the commands ABNF; examples are AVPs indicated as 3954 {AVP}. The receiver issues an answer with the Result-Code set to 3955 DIAMETER_MISSING_AVP, and creates an AVP with the AVP Code and 3956 other fields set as expected in the missing AVP. The created AVP 3957 is then added to the Failed- AVP AVP. 3959 The Result-Code AVP describes the error that the Diameter node 3960 encountered in its processing. In case there are multiple errors, 3961 the Diameter node MUST report only the first error it encountered 3962 (detected possibly in some implementation dependent order). The 3963 specific errors that can be described by this AVP are described in 3964 the following section. 3966 7.1. Result-Code AVP 3968 The Result-Code AVP (AVP Code 268) is of type Unsigned32 and 3969 indicates whether a particular request was completed successfully or 3970 whether an error occurred. All Diameter answer messages in IETF 3971 defined Diameter application specification MUST include one Result- 3972 Code AVP. A non-successful Result-Code AVP (one containing a non 3973 2xxx value other than DIAMETER_REDIRECT_INDICATION) MUST include the 3974 Error-Reporting-Host AVP if the host setting the Result-Code AVP is 3975 different from the identity encoded in the Origin-Host AVP. 3977 The Result-Code data field contains an IANA-managed 32-bit address 3978 space representing errors (see Section 11.4). Diameter provides the 3979 following classes of errors, all identified by the thousands digit in 3980 the decimal notation: 3982 o 1xxx (Informational) 3984 o 2xxx (Success) 3986 o 3xxx (Protocol Errors) 3988 o 4xxx (Transient Failures) 3990 o 5xxx (Permanent Failure) 3992 A non-recognized class (one whose first digit is not defined in this 3993 section) MUST be handled as a permanent failure. 3995 7.1.1. Informational 3997 Errors that fall within this category are used to inform the 3998 requester that a request could not be satisfied, and additional 3999 action is required on its part before access is granted. 4001 DIAMETER_MULTI_ROUND_AUTH 1001 4003 This informational error is returned by a Diameter server to 4004 inform the access device that the authentication mechanism being 4005 used requires multiple round trips, and a subsequent request needs 4006 to be issued in order for access to be granted. 4008 7.1.2. Success 4010 Errors that fall within the Success category are used to inform a 4011 peer that a request has been successfully completed. 4013 DIAMETER_SUCCESS 2001 4015 The request was successfully completed. 4017 DIAMETER_LIMITED_SUCCESS 2002 4019 When returned, the request was successfully completed, but 4020 additional processing is required by the application in order to 4021 provide service to the user. 4023 7.1.3. Protocol Errors 4025 Errors that fall within the Protocol Error category SHOULD be treated 4026 on a per-hop basis, and Diameter proxies MAY attempt to correct the 4027 error, if it is possible. Note that these errors MUST only be used 4028 in answer messages whose 'E' bit is set. This document omits some 4029 error codes defined in [RFC3588]. To provide backward compatibility 4030 with [RFC3588] implementations these error code values are not re- 4031 used and hence the error codes values enumerated below are non- 4032 sequential. 4034 DIAMETER_UNABLE_TO_DELIVER 3002 4036 This error is given when Diameter can not deliver the message to 4037 the destination, either because no host within the realm 4038 supporting the required application was available to process the 4039 request, or because Destination-Host AVP was given without the 4040 associated Destination-Realm AVP. 4042 DIAMETER_REALM_NOT_SERVED 3003 4044 The intended realm of the request is not recognized. 4046 DIAMETER_TOO_BUSY 3004 4048 When returned, a Diameter node SHOULD attempt to send the message 4049 to an alternate peer. This error MUST only be used when a 4050 specific server is requested, and it cannot provide the requested 4051 service. 4053 DIAMETER_LOOP_DETECTED 3005 4055 An agent detected a loop while trying to get the message to the 4056 intended recipient. The message MAY be sent to an alternate peer, 4057 if one is available, but the peer reporting the error has 4058 identified a configuration problem. 4060 DIAMETER_REDIRECT_INDICATION 3006 4062 A redirect agent has determined that the request could not be 4063 satisfied locally and the initiator of the request SHOULD direct 4064 the request directly to the server, whose contact information has 4065 been added to the response. When set, the Redirect-Host AVP MUST 4066 be present. 4068 DIAMETER_APPLICATION_UNSUPPORTED 3007 4070 A request was sent for an application that is not supported. 4072 DIAMETER_INVALID_BIT_IN_HEADER 3011 4074 This error is returned when a reserved bit in the Diameter header 4075 is set to one (1) or the bits in the Diameter header defined in 4076 Section 3 are set incorrectly. 4078 DIAMETER_INVALID_MESSAGE_LENGTH 3012 4080 This error is returned when a request is received with an invalid 4081 message length. 4083 7.1.4. Transient Failures 4085 Errors that fall within the transient failures category are used to 4086 inform a peer that the request could not be satisfied at the time it 4087 was received, but MAY be able to satisfy the request in the future. 4088 Note that these errors MUST be used in answer messages whose 'E' bit 4089 is not set. 4091 DIAMETER_AUTHENTICATION_REJECTED 4001 4093 The authentication process for the user failed, most likely due to 4094 an invalid password used by the user. Further attempts MUST only 4095 be tried after prompting the user for a new password. 4097 DIAMETER_OUT_OF_SPACE 4002 4099 A Diameter node received the accounting request but was unable to 4100 commit it to stable storage due to a temporary lack of space. 4102 ELECTION_LOST 4003 4104 The peer has determined that it has lost the election process and 4105 has therefore disconnected the transport connection. 4107 7.1.5. Permanent Failures 4109 Errors that fall within the permanent failures category are used to 4110 inform the peer that the request failed, and should not be attempted 4111 again. Note that these errors SHOULD be used in answer messages 4112 whose 'E' bit is not set. In error conditions where it is not 4113 possible or efficient to compose application-specific answer grammar 4114 then answer messages with E-bit set and complying to the grammar 4115 described in 7.2 MAY also be used for permanent errors. 4117 To provide backward compatibility with existing implementations that 4118 follow [RFC3588], some of the error values that have previously been 4119 used in this category by [RFC3588] will not be re-used. Therefore 4120 the error values enumerated here may be non-sequential. 4122 DIAMETER_AVP_UNSUPPORTED 5001 4124 The peer received a message that contained an AVP that is not 4125 recognized or supported and was marked with the Mandatory bit. A 4126 Diameter message with this error MUST contain one or more Failed- 4127 AVP AVP containing the AVPs that caused the failure. 4129 DIAMETER_UNKNOWN_SESSION_ID 5002 4131 The request contained an unknown Session-Id. 4133 DIAMETER_AUTHORIZATION_REJECTED 5003 4135 A request was received for which the user could not be authorized. 4136 This error could occur if the service requested is not permitted 4137 to the user. 4139 DIAMETER_INVALID_AVP_VALUE 5004 4141 The request contained an AVP with an invalid value in its data 4142 portion. A Diameter message indicating this error MUST include 4143 the offending AVPs within a Failed-AVP AVP. 4145 DIAMETER_MISSING_AVP 5005 4147 The request did not contain an AVP that is required by the Command 4148 Code definition. If this value is sent in the Result-Code AVP, a 4149 Failed-AVP AVP SHOULD be included in the message. The Failed-AVP 4150 AVP MUST contain an example of the missing AVP complete with the 4151 Vendor-Id if applicable. The value field of the missing AVP 4152 should be of correct minimum length and contain zeroes. 4154 DIAMETER_RESOURCES_EXCEEDED 5006 4156 A request was received that cannot be authorized because the user 4157 has already expended allowed resources. An example of this error 4158 condition is a user that is restricted to one dial-up PPP port, 4159 attempts to establish a second PPP connection. 4161 DIAMETER_CONTRADICTING_AVPS 5007 4163 The Home Diameter server has detected AVPs in the request that 4164 contradicted each other, and is not willing to provide service to 4165 the user. The Failed-AVP AVPs MUST be present which contains the 4166 AVPs that contradicted each other. 4168 DIAMETER_AVP_NOT_ALLOWED 5008 4170 A message was received with an AVP that MUST NOT be present. The 4171 Failed-AVP AVP MUST be included and contain a copy of the 4172 offending AVP. 4174 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES 5009 4176 A message was received that included an AVP that appeared more 4177 often than permitted in the message definition. The Failed-AVP 4178 AVP MUST be included and contain a copy of the first instance of 4179 the offending AVP that exceeded the maximum number of occurrences 4181 DIAMETER_NO_COMMON_APPLICATION 5010 4183 This error is returned by a Diameter node that receives a CER 4184 whereby no applications are common between the CER sending peer 4185 and the CER receiving peer. 4187 DIAMETER_UNSUPPORTED_VERSION 5011 4189 This error is returned when a request was received, whose version 4190 number is unsupported. 4192 DIAMETER_UNABLE_TO_COMPLY 5012 4194 This error is returned when a request is rejected for unspecified 4195 reasons. 4197 DIAMETER_INVALID_AVP_LENGTH 5014 4199 The request contained an AVP with an invalid length. A Diameter 4200 message indicating this error MUST include the offending AVPs 4201 within a Failed-AVP AVP. In cases where the erroneous AVP length 4202 value exceeds the message length or is less than the minimum AVP 4203 header length, it is sufficient to include the offending AVP 4204 header and a zero filled payload of the minimum required length 4205 for the payloads data type. If the AVP is a grouped AVP, the 4206 grouped AVP header with an empty payload would be sufficient to 4207 indicate the offending AVP. In the case where the offending AVP 4208 header cannot be fully decoded when the AVP length is less than 4209 the minimum AVP header length, it is sufficient to include an 4210 offending AVP header that is formulated by padding the incomplete 4211 AVP header with zero up to the minimum AVP header length. 4213 DIAMETER_NO_COMMON_SECURITY 5017 4215 This error is returned when a CER message is received, and there 4216 are no common security mechanisms supported between the peers. A 4217 Capabilities-Exchange-Answer (CEA) MUST be returned with the 4218 Result-Code AVP set to DIAMETER_NO_COMMON_SECURITY. 4220 DIAMETER_UNKNOWN_PEER 5018 4222 A CER was received from an unknown peer. 4224 DIAMETER_COMMAND_UNSUPPORTED 5019 4226 This error code is used when a Diameter entity receives a message 4227 with a Command Code that it does not support. 4229 DIAMETER_INVALID_HDR_BITS 5020 4231 A request was received whose bits in the Diameter header were 4232 either set to an invalid combination, or to a value that is 4233 inconsistent with the command code's definition. 4235 DIAMETER_INVALID_AVP_BITS 5021 4237 A request was received that included an AVP whose flag bits are 4238 set to an unrecognized value, or that is inconsistent with the 4239 AVP's definition. 4241 7.2. Error Bit 4243 The 'E' (Error Bit) in the Diameter header is set when the request 4244 caused a protocol-related error (see Section 7.1.3). A message with 4245 the 'E' bit MUST NOT be sent as a response to an answer message. 4246 Note that a message with the 'E' bit set is still subjected to the 4247 processing rules defined in Section 6.2. When set, the answer 4248 message will not conform to the ABNF specification for the command, 4249 and will instead conform to the following ABNF: 4251 Message Format 4253 ::= < Diameter Header: code, ERR [PXY] > 4254 0*1< Session-Id > 4255 { Origin-Host } 4256 { Origin-Realm } 4257 { Result-Code } 4258 [ Origin-State-Id ] 4259 [ Error-Message ] 4260 [ Error-Reporting-Host ] 4261 [ Failed-AVP ] 4262 [ Experimental-Result ] 4263 * [ Proxy-Info ] 4264 * [ AVP ] 4266 Note that the code used in the header is the same than the one found 4267 in the request message, but with the 'R' bit cleared and the 'E' bit 4268 set. The 'P' bit in the header is set to the same value as the one 4269 found in the request message. 4271 7.3. Error-Message AVP 4273 The Error-Message AVP (AVP Code 281) is of type UTF8String. It MAY 4274 accompany a Result-Code AVP as a human readable error message. The 4275 Error-Message AVP is not intended to be useful in an environment 4276 where error messages are processed automatically. It SHOULD NOT be 4277 expected that the content of this AVP is parsed by network entities. 4279 7.4. Error-Reporting-Host AVP 4281 The Error-Reporting-Host AVP (AVP Code 294) is of type 4282 DiameterIdentity. This AVP contains the identity of the Diameter 4283 host that sent the Result-Code AVP to a value other than 2001 4284 (Success), only if the host setting the Result-Code is different from 4285 the one encoded in the Origin-Host AVP. This AVP is intended to be 4286 used for troubleshooting purposes, and MUST be set when the Result- 4287 Code AVP indicates a failure. 4289 7.5. Failed-AVP AVP 4291 The Failed-AVP AVP (AVP Code 279) is of type Grouped and provides 4292 debugging information in cases where a request is rejected or not 4293 fully processed due to erroneous information in a specific AVP. The 4294 value of the Result-Code AVP will provide information on the reason 4295 for the Failed-AVP AVP. A Diameter message SHOULD contain only one 4296 Failed-AVP that corresponds to the error indicated by the Result-Code 4297 AVP. For practical purposes, this Failed-AVP would typically refer 4298 to the first AVP processing error that a Diameter node encounters. 4300 The possible reasons for this AVP are the presence of an improperly 4301 constructed AVP, an unsupported or unrecognized AVP, an invalid AVP 4302 value, the omission of a required AVP, the presence of an explicitly 4303 excluded AVP (see tables in Section 10), or the presence of two or 4304 more occurrences of an AVP which is restricted to 0, 1, or 0-1 4305 occurrences. 4307 A Diameter message SHOULD contain one Failed-AVP AVP, containing the 4308 entire AVP that could not be processed successfully. If the failure 4309 reason is omission of a required AVP, an AVP with the missing AVP 4310 code, the missing vendor id, and a zero filled payload of the minimum 4311 required length for the omitted AVP will be added. If the failure 4312 reason is an invalid AVP length where the reported length is less 4313 than the minimum AVP header length or greater than the reported 4314 message length, a copy of the offending AVP header and a zero filled 4315 payload of the minimum required length SHOULD be added. 4317 In the case where the offending AVP is embedded within a grouped AVP, 4318 the Failed-AVP MAY contain the grouped AVP which in turn contains the 4319 single offending AVP. The same method MAY be employed if the grouped 4320 AVP itself is embedded in yet another grouped AVP and so on. In this 4321 case, the Failed-AVP MAY contain the grouped AVP hierarchy up to the 4322 single offending AVP. This enables the recipient to detect the 4323 location of the offending AVP when embedded in a group. 4325 AVP Format 4327 ::= < AVP Header: 279 > 4328 1* {AVP} 4330 7.6. Experimental-Result AVP 4332 The Experimental-Result AVP (AVP Code 297) is of type Grouped, and 4333 indicates whether a particular vendor-specific request was completed 4334 successfully or whether an error occurred. This AVP has the 4335 following structure: 4337 AVP Format 4339 Experimental-Result ::= < AVP Header: 297 > 4340 { Vendor-Id } 4341 { Experimental-Result-Code } 4343 The Vendor-Id AVP (see Section 5.3.3) in this grouped AVP identifies 4344 the vendor responsible for the assignment of the result code which 4345 follows. All Diameter answer messages defined in vendor-specific 4346 applications MUST include either one Result-Code AVP or one 4347 Experimental-Result AVP. 4349 7.7. Experimental-Result-Code AVP 4351 The Experimental-Result-Code AVP (AVP Code 298) is of type Unsigned32 4352 and contains a vendor-assigned value representing the result of 4353 processing the request. 4355 It is recommended that vendor-specific result codes follow the same 4356 conventions given for the Result-Code AVP regarding the different 4357 types of result codes and the handling of errors (for non 2xxx 4358 values). 4360 8. Diameter User Sessions 4362 In general, Diameter can provide two different types of services to 4363 applications. The first involves authentication and authorization, 4364 and can optionally make use of accounting. The second only makes use 4365 of accounting. 4367 When a service makes use of the authentication and/or authorization 4368 portion of an application, and a user requests access to the network, 4369 the Diameter client issues an auth request to its local server. The 4370 auth request is defined in a service-specific Diameter application 4371 (e.g., NASREQ). The request contains a Session-Id AVP, which is used 4372 in subsequent messages (e.g., subsequent authorization, accounting, 4373 etc) relating to the user's session. The Session-Id AVP is a means 4374 for the client and servers to correlate a Diameter message with a 4375 user session. 4377 When a Diameter server authorizes a user to use network resources for 4378 a finite amount of time, and it is willing to extend the 4379 authorization via a future request, it MUST add the Authorization- 4380 Lifetime AVP to the answer message. The Authorization-Lifetime AVP 4381 defines the maximum number of seconds a user MAY make use of the 4382 resources before another authorization request is expected by the 4383 server. The Auth-Grace-Period AVP contains the number of seconds 4384 following the expiration of the Authorization-Lifetime, after which 4385 the server will release all state information related to the user's 4386 session. Note that if payment for services is expected by the 4387 serving realm from the user's home realm, the Authorization-Lifetime 4388 AVP, combined with the Auth-Grace-Period AVP, implies the maximum 4389 length of the session the home realm is willing to be fiscally 4390 responsible for. Services provided past the expiration of the 4391 Authorization-Lifetime and Auth-Grace-Period AVPs are the 4392 responsibility of the access device. Of course, the actual cost of 4393 services rendered is clearly outside the scope of the protocol. 4395 An access device that does not expect to send a re-authorization or a 4396 session termination request to the server MAY include the Auth- 4397 Session-State AVP with the value set to NO_STATE_MAINTAINED as a hint 4398 to the server. If the server accepts the hint, it agrees that since 4399 no session termination message will be received once service to the 4400 user is terminated, it cannot maintain state for the session. If the 4401 answer message from the server contains a different value in the 4402 Auth-Session-State AVP (or the default value if the AVP is absent), 4403 the access device MUST follow the server's directives. Note that the 4404 value NO_STATE_MAINTAINED MUST NOT be set in subsequent re- 4405 authorization requests and answers. 4407 The base protocol does not include any authorization request 4408 messages, since these are largely application-specific and are 4409 defined in a Diameter application document. However, the base 4410 protocol does define a set of messages that are used to terminate 4411 user sessions. These are used to allow servers that maintain state 4412 information to free resources. 4414 When a service only makes use of the Accounting portion of the 4415 Diameter protocol, even in combination with an application, the 4416 Session-Id is still used to identify user sessions. However, the 4417 session termination messages are not used, since a session is 4418 signaled as being terminated by issuing an accounting stop message. 4420 Diameter may also be used for services that cannot be easily 4421 categorized as authentication, authorization or accounting (e.g., 4422 certain 3GPP IMS interfaces). In such cases, the finite state 4423 machine defined in subsequent sections may not be applicable. 4424 Therefore, the applications itself MAY need to define its own finite 4425 state machine. However, such application-specific state machines 4426 SHOULD follow the general state machine framework outlined in this 4427 document such as the use of Session-Id AVPs and the use of STR/STA, 4428 ASR/ASA messages for stateful sessions. 4430 8.1. Authorization Session State Machine 4432 This section contains a set of finite state machines, representing 4433 the life cycle of Diameter sessions, and which MUST be observed by 4434 all Diameter implementations that make use of the authentication 4435 and/or authorization portion of a Diameter application. The term 4436 Service-Specific below refers to a message defined in a Diameter 4437 application (e.g., Mobile IPv4, NASREQ). 4439 There are four different authorization session state machines 4440 supported in the Diameter base protocol. The first two describe a 4441 session in which the server is maintaining session state, indicated 4442 by the value of the Auth-Session-State AVP (or its absence). One 4443 describes the session from a client perspective, the other from a 4444 server perspective. The second two state machines are used when the 4445 server does not maintain session state. Here again, one describes 4446 the session from a client perspective, the other from a server 4447 perspective. 4449 When a session is moved to the Idle state, any resources that were 4450 allocated for the particular session must be released. Any event not 4451 listed in the state machines MUST be considered as an error 4452 condition, and an answer, if applicable, MUST be returned to the 4453 originator of the message. 4455 In the case that an application does not support re-auth, the state 4456 transitions related to server-initiated re-auth when both client and 4457 server session maintains state (e.g., Send RAR, Pending, Receive RAA) 4458 MAY be ignored. 4460 In the state table, the event 'Failure to send X' means that the 4461 Diameter agent is unable to send command X to the desired 4462 destination. This could be due to the peer being down, or due to the 4463 peer sending back a transient failure or temporary protocol error 4464 notification DIAMETER_TOO_BUSY or DIAMETER_LOOP_DETECTED in the 4465 Result-Code AVP of the corresponding Answer command. The event 'X 4466 successfully sent' is the complement of 'Failure to send X'. 4468 The following state machine is observed by a client when state is 4469 maintained on the server: 4471 CLIENT, STATEFUL 4472 State Event Action New State 4473 --------------------------------------------------------------- 4474 Idle Client or Device Requests Send Pending 4475 access service 4476 specific 4477 auth req 4479 Idle ASR Received Send ASA Idle 4480 for unknown session with 4481 Result-Code = 4482 UNKNOWN_ 4483 SESSION_ID 4485 Idle RAR Received Send RAA Idle 4486 for unknown session with 4487 Result-Code = 4488 UNKNOWN_ 4489 SESSION_ID 4491 Pending Successful Service-specific Grant Open 4492 authorization answer Access 4493 received with default 4494 Auth-Session-State value 4496 Pending Successful Service-specific Sent STR Discon 4497 authorization answer received 4498 but service not provided 4500 Pending Error processing successful Sent STR Discon 4501 Service-specific authorization 4502 answer 4504 Pending Failed Service-specific Cleanup Idle 4505 authorization answer received 4507 Open User or client device Send Open 4508 requests access to service service 4509 specific 4510 auth req 4512 Open Successful Service-specific Provide Open 4513 authorization answer received Service 4515 Open Failed Service-specific Discon. Idle 4516 authorization answer user/device 4517 received. 4519 Open RAR received and client will Send RAA Open 4520 perform subsequent re-auth with 4521 Result-Code = 4522 SUCCESS 4524 Open RAR received and client will Send RAA Idle 4525 not perform subsequent with 4526 re-auth Result-Code != 4527 SUCCESS, 4528 Discon. 4529 user/device 4531 Open Session-Timeout Expires on Send STR Discon 4532 Access Device 4534 Open ASR Received, Send ASA Discon 4535 client will comply with 4536 with request to end the Result-Code = 4537 session = SUCCESS, 4538 Send STR. 4540 Open ASR Received, Send ASA Open 4541 client will not comply with 4542 with request to end the Result-Code != 4543 session != SUCCESS 4545 Open Authorization-Lifetime + Send STR Discon 4546 Auth-Grace-Period expires on 4547 access device 4549 Discon ASR Received Send ASA Discon 4551 Discon STA Received Discon. Idle 4552 user/device 4554 The following state machine is observed by a server when it is 4555 maintaining state for the session: 4557 SERVER, STATEFUL 4558 State Event Action New State 4559 --------------------------------------------------------------- 4560 Idle Service-specific authorization Send Open 4561 request received, and successful 4562 user is authorized serv. 4563 specific 4564 answer 4566 Idle Service-specific authorization Send Idle 4567 request received, and failed serv. 4568 user is not authorized specific 4569 answer 4571 Open Service-specific authorization Send Open 4572 request received, and user successful 4573 is authorized serv. specific 4574 answer 4576 Open Service-specific authorization Send Idle 4577 request received, and user failed serv. 4578 is not authorized specific 4579 answer, 4580 Cleanup 4582 Open Home server wants to confirm Send RAR Pending 4583 authentication and/or 4584 authorization of the user 4586 Pending Received RAA with a failed Cleanup Idle 4587 Result-Code 4589 Pending Received RAA with Result-Code Update Open 4590 = SUCCESS session 4592 Open Home server wants to Send ASR Discon 4593 terminate the service 4595 Open Authorization-Lifetime (and Cleanup Idle 4596 Auth-Grace-Period) expires 4597 on home server. 4599 Open Session-Timeout expires on Cleanup Idle 4600 home server 4602 Discon Failure to send ASR Wait, Discon 4603 resend ASR 4605 Discon ASR successfully sent and Cleanup Idle 4606 ASA Received with Result-Code 4608 Not ASA Received None No Change. 4609 Discon 4611 Any STR Received Send STA, Idle 4612 Cleanup. 4614 The following state machine is observed by a client when state is not 4615 maintained on the server: 4617 CLIENT, STATELESS 4618 State Event Action New State 4619 --------------------------------------------------------------- 4620 Idle Client or Device Requests Send Pending 4621 access service 4622 specific 4623 auth req 4625 Pending Successful Service-specific Grant Open 4626 authorization answer Access 4627 received with Auth-Session- 4628 State set to 4629 NO_STATE_MAINTAINED 4631 Pending Failed Service-specific Cleanup Idle 4632 authorization answer 4633 received 4635 Open Session-Timeout Expires on Discon. Idle 4636 Access Device user/device 4638 Open Service to user is terminated Discon. Idle 4639 user/device 4641 The following state machine is observed by a server when it is not 4642 maintaining state for the session: 4644 SERVER, STATELESS 4645 State Event Action New State 4646 --------------------------------------------------------------- 4647 Idle Service-specific authorization Send serv. Idle 4648 request received, and specific 4649 successfully processed answer 4651 8.2. Accounting Session State Machine 4653 The following state machines MUST be supported for applications that 4654 have an accounting portion or that require only accounting services. 4655 The first state machine is to be observed by clients. 4657 See Section 9.7 for Accounting Command Codes and Section 9.8 for 4658 Accounting AVPs. 4660 The server side in the accounting state machine depends in some cases 4661 on the particular application. The Diameter base protocol defines a 4662 default state machine that MUST be followed by all applications that 4663 have not specified other state machines. This is the second state 4664 machine in this section described below. 4666 The default server side state machine requires the reception of 4667 accounting records in any order and at any time, and does not place 4668 any standards requirement on the processing of these records. 4669 Implementations of Diameter may perform checking, ordering, 4670 correlation, fraud detection, and other tasks based on these records. 4671 AVPs may need to be inspected as a part of these tasks. The tasks 4672 can happen either immediately after record reception or in a post- 4673 processing phase. However, as these tasks are typically application 4674 or even policy dependent, they are not standardized by the Diameter 4675 specifications. Applications MAY define requirements on when to 4676 accept accounting records based on the used value of Accounting- 4677 Realtime-Required AVP, credit limits checks, and so on. 4679 However, the Diameter base protocol defines one optional server side 4680 state machine that MAY be followed by applications that require 4681 keeping track of the session state at the accounting server. Note 4682 that such tracking is incompatible with the ability to sustain long 4683 duration connectivity problems. Therefore, the use of this state 4684 machine is recommended only in applications where the value of the 4685 Accounting-Realtime-Required AVP is DELIVER_AND_GRANT, and hence 4686 accounting connectivity problems are required to cause the serviced 4687 user to be disconnected. Otherwise, records produced by the client 4688 may be lost by the server which no longer accepts them after the 4689 connectivity is re-established. This state machine is the third 4690 state machine in this section. The state machine is supervised by a 4691 supervision session timer Ts, which the value should be reasonably 4692 higher than the Acct_Interim_Interval value. Ts MAY be set to two 4693 times the value of the Acct_Interim_Interval so as to avoid the 4694 accounting session in the Diameter server to change to Idle state in 4695 case of short transient network failure. 4697 Any event not listed in the state machines MUST be considered as an 4698 error condition, and a corresponding answer, if applicable, MUST be 4699 returned to the originator of the message. 4701 In the state table, the event 'Failure to send' means that the 4702 Diameter client is unable to communicate with the desired 4703 destination. This could be due to the peer being down, or due to the 4704 peer sending back a transient failure or temporary protocol error 4705 notification DIAMETER_OUT_OF_SPACE, DIAMETER_TOO_BUSY, or 4706 DIAMETER_LOOP_DETECTED in the Result-Code AVP of the Accounting 4707 Answer command. 4709 The event 'Failed answer' means that the Diameter client received a 4710 non-transient failure notification in the Accounting Answer command. 4712 Note that the action 'Disconnect user/dev' MUST have an effect also 4713 to the authorization session state table, e.g., cause the STR message 4714 to be sent, if the given application has both authentication/ 4715 authorization and accounting portions. 4717 The states PendingS, PendingI, PendingL, PendingE and PendingB stand 4718 for pending states to wait for an answer to an accounting request 4719 related to a Start, Interim, Stop, Event or buffered record, 4720 respectively. 4722 CLIENT, ACCOUNTING 4723 State Event Action New State 4724 --------------------------------------------------------------- 4725 Idle Client or device requests Send PendingS 4726 access accounting 4727 start req. 4729 Idle Client or device requests Send PendingE 4730 a one-time service accounting 4731 event req 4733 Idle Records in storage Send PendingB 4734 record 4736 PendingS Successful accounting Open 4737 start answer received 4739 PendingS Failure to send and buffer Store Open 4740 space available and realtime Start 4741 not equal to DELIVER_AND_GRANT Record 4743 PendingS Failure to send and no buffer Open 4744 space available and realtime 4745 equal to GRANT_AND_LOSE 4747 PendingS Failure to send and no Disconnect Idle 4748 buffer space available and user/dev 4749 realtime not equal to 4750 GRANT_AND_LOSE 4752 PendingS Failed accounting start answer Open 4753 received and realtime equal 4754 to GRANT_AND_LOSE 4756 PendingS Failed accounting start answer Disconnect Idle 4757 received and realtime not user/dev 4758 equal to GRANT_AND_LOSE 4760 PendingS User service terminated Store PendingS 4761 stop 4762 record 4764 Open Interim interval elapses Send PendingI 4765 accounting 4766 interim 4767 record 4768 Open User service terminated Send PendingL 4769 accounting 4770 stop req. 4772 PendingI Successful accounting interim Open 4773 answer received 4775 PendingI Failure to send and (buffer Store Open 4776 space available or old interim 4777 record can be overwritten) record 4778 and realtime not equal to 4779 DELIVER_AND_GRANT 4781 PendingI Failure to send and no buffer Open 4782 space available and realtime 4783 equal to GRANT_AND_LOSE 4785 PendingI Failure to send and no Disconnect Idle 4786 buffer space available and user/dev 4787 realtime not equal to 4788 GRANT_AND_LOSE 4790 PendingI Failed accounting interim Open 4791 answer received and realtime 4792 equal to GRANT_AND_LOSE 4794 PendingI Failed accounting interim Disconnect Idle 4795 answer received and user/dev 4796 realtime not equal to 4797 GRANT_AND_LOSE 4799 PendingI User service terminated Store PendingI 4800 stop 4801 record 4802 PendingE Successful accounting Idle 4803 event answer received 4805 PendingE Failure to send and buffer Store Idle 4806 space available event 4807 record 4809 PendingE Failure to send and no buffer Idle 4810 space available 4812 PendingE Failed accounting event answer Idle 4813 received 4815 PendingB Successful accounting answer Delete Idle 4816 received record 4818 PendingB Failure to send Idle 4820 PendingB Failed accounting answer Delete Idle 4821 received record 4823 PendingL Successful accounting Idle 4824 stop answer received 4826 PendingL Failure to send and buffer Store Idle 4827 space available stop 4828 record 4830 PendingL Failure to send and no buffer Idle 4831 space available 4833 PendingL Failed accounting stop answer Idle 4834 received 4835 SERVER, STATELESS ACCOUNTING 4836 State Event Action New State 4837 --------------------------------------------------------------- 4839 Idle Accounting start request Send Idle 4840 received, and successfully accounting 4841 processed. start 4842 answer 4844 Idle Accounting event request Send Idle 4845 received, and successfully accounting 4846 processed. event 4847 answer 4849 Idle Interim record received, Send Idle 4850 and successfully processed. accounting 4851 interim 4852 answer 4854 Idle Accounting stop request Send Idle 4855 received, and successfully accounting 4856 processed stop answer 4858 Idle Accounting request received, Send Idle 4859 no space left to store accounting 4860 records answer, 4861 Result-Code = 4862 OUT_OF_ 4863 SPACE 4865 SERVER, STATEFUL ACCOUNTING 4866 State Event Action New State 4867 --------------------------------------------------------------- 4869 Idle Accounting start request Send Open 4870 received, and successfully accounting 4871 processed. start 4872 answer, 4873 Start Ts 4875 Idle Accounting event request Send Idle 4876 received, and successfully accounting 4877 processed. event 4878 answer 4880 Idle Accounting request received, Send Idle 4881 no space left to store accounting 4882 records answer, 4883 Result-Code = 4884 OUT_OF_ 4885 SPACE 4887 Open Interim record received, Send Open 4888 and successfully processed. accounting 4889 interim 4890 answer, 4891 Restart Ts 4893 Open Accounting stop request Send Idle 4894 received, and successfully accounting 4895 processed stop answer, 4896 Stop Ts 4898 Open Accounting request received, Send Idle 4899 no space left to store accounting 4900 records answer, 4901 Result-Code = 4902 OUT_OF_ 4903 SPACE, 4904 Stop Ts 4906 Open Session supervision timer Ts Stop Ts Idle 4907 expired 4909 8.3. Server-Initiated Re-Auth 4911 A Diameter server may initiate a re-authentication and/or re- 4912 authorization service for a particular session by issuing a Re-Auth- 4913 Request (RAR). 4915 For example, for pre-paid services, the Diameter server that 4916 originally authorized a session may need some confirmation that the 4917 user is still using the services. 4919 An access device that receives a RAR message with Session-Id equal to 4920 a currently active session MUST initiate a re-auth towards the user, 4921 if the service supports this particular feature. Each Diameter 4922 application MUST state whether server-initiated re-auth is supported, 4923 since some applications do not allow access devices to prompt the 4924 user for re-auth. 4926 8.3.1. Re-Auth-Request 4928 The Re-Auth-Request (RAR), indicated by the Command-Code set to 258 4929 and the message flags' 'R' bit set, may be sent by any server to the 4930 access device that is providing session service, to request that the 4931 user be re-authenticated and/or re-authorized. 4933 Message Format 4935 ::= < Diameter Header: 258, REQ, PXY > 4936 < Session-Id > 4937 { Origin-Host } 4938 { Origin-Realm } 4939 { Destination-Realm } 4940 { Destination-Host } 4941 { Auth-Application-Id } 4942 { Re-Auth-Request-Type } 4943 [ User-Name ] 4944 [ Origin-State-Id ] 4945 * [ Proxy-Info ] 4946 * [ Route-Record ] 4947 * [ AVP ] 4949 8.3.2. Re-Auth-Answer 4951 The Re-Auth-Answer (RAA), indicated by the Command-Code set to 258 4952 and the message flags' 'R' bit clear, is sent in response to the RAR. 4953 The Result-Code AVP MUST be present, and indicates the disposition of 4954 the request. 4956 A successful RAA message MUST be followed by an application-specific 4957 authentication and/or authorization message. 4959 Message Format 4961 ::= < Diameter Header: 258, PXY > 4962 < Session-Id > 4963 { Result-Code } 4964 { Origin-Host } 4965 { Origin-Realm } 4966 [ User-Name ] 4967 [ Origin-State-Id ] 4968 [ Error-Message ] 4969 [ Error-Reporting-Host ] 4970 [ Failed-AVP ] 4971 * [ Redirect-Host ] 4972 [ Redirect-Host-Usage ] 4973 [ Redirect-Max-Cache-Time ] 4974 * [ Proxy-Info ] 4975 * [ AVP ] 4977 8.4. Session Termination 4979 It is necessary for a Diameter server that authorized a session, for 4980 which it is maintaining state, to be notified when that session is no 4981 longer active, both for tracking purposes as well as to allow 4982 stateful agents to release any resources that they may have provided 4983 for the user's session. For sessions whose state is not being 4984 maintained, this section is not used. 4986 When a user session that required Diameter authorization terminates, 4987 the access device that provided the service MUST issue a Session- 4988 Termination-Request (STR) message to the Diameter server that 4989 authorized the service, to notify it that the session is no longer 4990 active. An STR MUST be issued when a user session terminates for any 4991 reason, including user logoff, expiration of Session-Timeout, 4992 administrative action, termination upon receipt of an Abort-Session- 4993 Request (see below), orderly shutdown of the access device, etc. 4995 The access device also MUST issue an STR for a session that was 4996 authorized but never actually started. This could occur, for 4997 example, due to a sudden resource shortage in the access device, or 4998 because the access device is unwilling to provide the type of service 4999 requested in the authorization, or because the access device does not 5000 support a mandatory AVP returned in the authorization, etc. 5002 It is also possible that a session that was authorized is never 5003 actually started due to action of a proxy. For example, a proxy may 5004 modify an authorization answer, converting the result from success to 5005 failure, prior to forwarding the message to the access device. If 5006 the answer did not contain an Auth-Session-State AVP with the value 5007 NO_STATE_MAINTAINED, a proxy that causes an authorized session not to 5008 be started MUST issue an STR to the Diameter server that authorized 5009 the session, since the access device has no way of knowing that the 5010 session had been authorized. 5012 A Diameter server that receives an STR message MUST clean up 5013 resources (e.g., session state) associated with the Session-Id 5014 specified in the STR, and return a Session-Termination-Answer. 5016 A Diameter server also MUST clean up resources when the Session- 5017 Timeout expires, or when the Authorization-Lifetime and the Auth- 5018 Grace-Period AVPs expires without receipt of a re-authorization 5019 request, regardless of whether an STR for that session is received. 5020 The access device is not expected to provide service beyond the 5021 expiration of these timers; thus, expiration of either of these 5022 timers implies that the access device may have unexpectedly shut 5023 down. 5025 8.4.1. Session-Termination-Request 5027 The Session-Termination-Request (STR), indicated by the Command-Code 5028 set to 275 and the Command Flags' 'R' bit set, is sent by a Diameter 5029 client or by a Diameter proxy to inform the Diameter Server that an 5030 authenticated and/or authorized session is being terminated. 5032 Message Format 5034 ::= < Diameter Header: 275, REQ, PXY > 5035 < Session-Id > 5036 { Origin-Host } 5037 { Origin-Realm } 5038 { Destination-Realm } 5039 { Auth-Application-Id } 5040 { Termination-Cause } 5041 [ User-Name ] 5042 [ Destination-Host ] 5043 * [ Class ] 5044 [ Origin-State-Id ] 5045 * [ Proxy-Info ] 5046 * [ Route-Record ] 5047 * [ AVP ] 5049 8.4.2. Session-Termination-Answer 5051 The Session-Termination-Answer (STA), indicated by the Command-Code 5052 set to 275 and the message flags' 'R' bit clear, is sent by the 5053 Diameter Server to acknowledge the notification that the session has 5054 been terminated. The Result-Code AVP MUST be present, and MAY 5055 contain an indication that an error occurred while servicing the STR. 5057 Upon sending or receipt of the STA, the Diameter Server MUST release 5058 all resources for the session indicated by the Session-Id AVP. Any 5059 intermediate server in the Proxy-Chain MAY also release any 5060 resources, if necessary. 5062 Message Format 5064 ::= < Diameter Header: 275, PXY > 5065 < Session-Id > 5066 { Result-Code } 5067 { Origin-Host } 5068 { Origin-Realm } 5069 [ User-Name ] 5070 * [ Class ] 5071 [ Error-Message ] 5072 [ Error-Reporting-Host ] 5073 [ Failed-AVP ] 5074 [ Origin-State-Id ] 5075 * [ Redirect-Host ] 5076 [ Redirect-Host-Usage ] 5077 [ Redirect-Max-Cache-Time ] 5078 * [ Proxy-Info ] 5079 * [ AVP ] 5081 8.5. Aborting a Session 5083 A Diameter server may request that the access device stop providing 5084 service for a particular session by issuing an Abort-Session-Request 5085 (ASR). 5087 For example, the Diameter server that originally authorized the 5088 session may be required to cause that session to be stopped for lack 5089 of credit or other reasons that were not anticipated when the session 5090 was first authorized. 5092 An access device that receives an ASR with Session-ID equal to a 5093 currently active session MAY stop the session. Whether the access 5094 device stops the session or not is implementation- and/or 5095 configuration-dependent. For example, an access device may honor 5096 ASRs from certain agents only. In any case, the access device MUST 5097 respond with an Abort-Session-Answer, including a Result-Code AVP to 5098 indicate what action it took. 5100 8.5.1. Abort-Session-Request 5102 The Abort-Session-Request (ASR), indicated by the Command-Code set to 5103 274 and the message flags' 'R' bit set, may be sent by any Diameter 5104 server or any Diameter proxy to the access device that is providing 5105 session service, to request that the session identified by the 5106 Session-Id be stopped. 5108 Message Format 5110 ::= < Diameter Header: 274, REQ, PXY > 5111 < Session-Id > 5112 { Origin-Host } 5113 { Origin-Realm } 5114 { Destination-Realm } 5115 { Destination-Host } 5116 { Auth-Application-Id } 5117 [ User-Name ] 5118 [ Origin-State-Id ] 5119 * [ Proxy-Info ] 5120 * [ Route-Record ] 5121 * [ AVP ] 5123 8.5.2. Abort-Session-Answer 5125 The Abort-Session-Answer (ASA), indicated by the Command-Code set to 5126 274 and the message flags' 'R' bit clear, is sent in response to the 5127 ASR. The Result-Code AVP MUST be present, and indicates the 5128 disposition of the request. 5130 If the session identified by Session-Id in the ASR was successfully 5131 terminated, Result-Code is set to DIAMETER_SUCCESS. If the session 5132 is not currently active, Result-Code is set to 5133 DIAMETER_UNKNOWN_SESSION_ID. If the access device does not stop the 5134 session for any other reason, Result-Code is set to 5135 DIAMETER_UNABLE_TO_COMPLY. 5137 Message Format 5139 ::= < Diameter Header: 274, PXY > 5140 < Session-Id > 5141 { Result-Code } 5142 { Origin-Host } 5143 { Origin-Realm } 5144 [ User-Name ] 5145 [ Origin-State-Id ] 5146 [ Error-Message ] 5147 [ Error-Reporting-Host ] 5148 [ Failed-AVP ] 5149 * [ Redirect-Host ] 5150 [ Redirect-Host-Usage ] 5151 [ Redirect-Max-Cache-Time ] 5152 * [ Proxy-Info ] 5153 * [ AVP ] 5155 8.6. Inferring Session Termination from Origin-State-Id 5157 The Origin-State-Id is used to allow detection of terminated sessions 5158 for which no STR would have been issued, due to unanticipated 5159 shutdown of an access device. 5161 A Diameter client or access device increments the value of the 5162 Origin-State-Id every time it is started or powered-up. The new 5163 Origin-State-Id is then sent in the CER/CEA message immediately upon 5164 connection to the server. The Diameter server receiving the new 5165 Origin-State-Id can determine whether the sending Diameter client had 5166 abruptly shutdown by comparing the old value of the Origin-State-Id 5167 it has kept for that specific client is less than the new value and 5168 whether it has un-terminated sessions originating from that client. 5170 An access device can also include the Origin-State-Id in request 5171 messages other than CER if there are relays or proxies in between the 5172 access device and the server. In this case, however, the server 5173 cannot discover that the access device has been restarted unless and 5174 until it receives a new request from it. Therefore this mechanism is 5175 more opportunistic across proxies and relays. 5177 The Diameter server may assume that all sessions that were active 5178 prior to detection of a client restart have been terminated. The 5179 Diameter server MAY clean up all session state associated with such 5180 lost sessions, and MAY also issues STRs for all such lost sessions 5181 that were authorized on upstream servers, to allow session state to 5182 be cleaned up globally. 5184 8.7. Auth-Request-Type AVP 5186 The Auth-Request-Type AVP (AVP Code 274) is of type Enumerated and is 5187 included in application-specific auth requests to inform the peers 5188 whether a user is to be authenticated only, authorized only or both. 5189 Note any value other than both MAY cause RADIUS interoperability 5190 issues. The following values are defined: 5192 AUTHENTICATE_ONLY 1 5194 The request being sent is for authentication only, and MUST 5195 contain the relevant application specific authentication AVPs that 5196 are needed by the Diameter server to authenticate the user. 5198 AUTHORIZE_ONLY 2 5200 The request being sent is for authorization only, and MUST contain 5201 the application-specific authorization AVPs that are necessary to 5202 identify the service being requested/offered. 5204 AUTHORIZE_AUTHENTICATE 3 5206 The request contains a request for both authentication and 5207 authorization. The request MUST include both the relevant 5208 application-specific authentication information, and authorization 5209 information necessary to identify the service being requested/ 5210 offered. 5212 8.8. Session-Id AVP 5214 The Session-Id AVP (AVP Code 263) is of type UTF8String and is used 5215 to identify a specific session (see Section 8). All messages 5216 pertaining to a specific session MUST include only one Session-Id AVP 5217 and the same value MUST be used throughout the life of a session. 5218 When present, the Session-Id SHOULD appear immediately following the 5219 Diameter Header (see Section 3). 5221 The Session-Id MUST be globally and eternally unique, as it is meant 5222 to uniquely identify a user session without reference to any other 5223 information, and may be needed to correlate historical authentication 5224 information with accounting information. The Session-Id includes a 5225 mandatory portion and an implementation-defined portion; a 5226 recommended format for the implementation-defined portion is outlined 5227 below. 5229 The Session-Id MUST begin with the sender's identity encoded in the 5230 DiameterIdentity type (see Section 4.4). The remainder of the 5231 Session-Id is delimited by a ";" character, and MAY be any sequence 5232 that the client can guarantee to be eternally unique; however, the 5233 following format is recommended, (square brackets [] indicate an 5234 optional element): 5236 ;;[;] 5238 and are decimal representations of the 5239 high and low 32 bits of a monotonically increasing 64-bit value. The 5240 64-bit value is rendered in two part to simplify formatting by 32-bit 5241 processors. At startup, the high 32 bits of the 64-bit value MAY be 5242 initialized to the time in NTP format [RFC5905], and the low 32 bits 5243 MAY be initialized to zero. This will for practical purposes 5244 eliminate the possibility of overlapping Session-Ids after a reboot, 5245 assuming the reboot process takes longer than a second. 5246 Alternatively, an implementation MAY keep track of the increasing 5247 value in non-volatile memory. 5249 is implementation specific but may include a modem's 5250 device Id, a layer 2 address, timestamp, etc. 5252 Example, in which there is no optional value: 5254 accesspoint7.example.com;1876543210;523 5256 Example, in which there is an optional value: 5258 accesspoint7.example.com;1876543210;523;mobile@200.1.1.88 5260 The Session-Id is created by the Diameter application initiating the 5261 session, which in most cases is done by the client. Note that a 5262 Session-Id MAY be used for both the authentication, authorization and 5263 accounting commands of a given application. 5265 8.9. Authorization-Lifetime AVP 5267 The Authorization-Lifetime AVP (AVP Code 291) is of type Unsigned32 5268 and contains the maximum number of seconds of service to be provided 5269 to the user before the user is to be re-authenticated and/or re- 5270 authorized. Care should be taken when the Authorization- Lifetime 5271 value is determined, since a low, non-zero, value could create 5272 significant Diameter traffic, which could congest both the network 5273 and the agents. 5275 A value of zero (0) means that immediate re-auth is necessary by the 5276 access device. The absence of this AVP, or a value of all ones 5277 (meaning all bits in the 32 bit field are set to one) means no re- 5278 auth is expected. 5280 If both this AVP and the Session-Timeout AVP are present in a 5281 message, the value of the latter MUST NOT be smaller than the 5282 Authorization-Lifetime AVP. 5284 An Authorization-Lifetime AVP MAY be present in re-authorization 5285 messages, and contains the number of seconds the user is authorized 5286 to receive service from the time the re-auth answer message is 5287 received by the access device. 5289 This AVP MAY be provided by the client as a hint of the maximum 5290 lifetime that it is willing to accept. The server MUST return a 5291 value that is equal to, or smaller, than the one provided by the 5292 client. 5294 8.10. Auth-Grace-Period AVP 5296 The Auth-Grace-Period AVP (AVP Code 276) is of type Unsigned32 and 5297 contains the number of seconds the Diameter server will wait 5298 following the expiration of the Authorization-Lifetime AVP before 5299 cleaning up resources for the session. 5301 8.11. Auth-Session-State AVP 5303 The Auth-Session-State AVP (AVP Code 277) is of type Enumerated and 5304 specifies whether state is maintained for a particular session. The 5305 client MAY include this AVP in requests as a hint to the server, but 5306 the value in the server's answer message is binding. The following 5307 values are supported: 5309 STATE_MAINTAINED 0 5311 This value is used to specify that session state is being 5312 maintained, and the access device MUST issue a session termination 5313 message when service to the user is terminated. This is the 5314 default value. 5316 NO_STATE_MAINTAINED 1 5318 This value is used to specify that no session termination messages 5319 will be sent by the access device upon expiration of the 5320 Authorization-Lifetime. 5322 8.12. Re-Auth-Request-Type AVP 5324 The Re-Auth-Request-Type AVP (AVP Code 285) is of type Enumerated and 5325 is included in application-specific auth answers to inform the client 5326 of the action expected upon expiration of the Authorization-Lifetime. 5327 If the answer message contains an Authorization-Lifetime AVP with a 5328 positive value, the Re-Auth-Request-Type AVP MUST be present in an 5329 answer message. The following values are defined: 5331 AUTHORIZE_ONLY 0 5333 An authorization only re-auth is expected upon expiration of the 5334 Authorization-Lifetime. This is the default value if the AVP is 5335 not present in answer messages that include the Authorization- 5336 Lifetime. 5338 AUTHORIZE_AUTHENTICATE 1 5340 An authentication and authorization re-auth is expected upon 5341 expiration of the Authorization-Lifetime. 5343 8.13. Session-Timeout AVP 5345 The Session-Timeout AVP (AVP Code 27) [RFC2865] is of type Unsigned32 5346 and contains the maximum number of seconds of service to be provided 5347 to the user before termination of the session. When both the 5348 Session-Timeout and the Authorization-Lifetime AVPs are present in an 5349 answer message, the former MUST be equal to or greater than the value 5350 of the latter. 5352 A session that terminates on an access device due to the expiration 5353 of the Session-Timeout MUST cause an STR to be issued, unless both 5354 the access device and the home server had previously agreed that no 5355 session termination messages would be sent (see Section 8.11). 5357 A Session-Timeout AVP MAY be present in a re-authorization answer 5358 message, and contains the remaining number of seconds from the 5359 beginning of the re-auth. 5361 A value of zero, or the absence of this AVP, means that this session 5362 has an unlimited number of seconds before termination. 5364 This AVP MAY be provided by the client as a hint of the maximum 5365 timeout that it is willing to accept. However, the server MAY return 5366 a value that is equal to, or smaller, than the one provided by the 5367 client. 5369 8.14. User-Name AVP 5371 The User-Name AVP (AVP Code 1) [RFC2865] is of type UTF8String, which 5372 contains the User-Name, in a format consistent with the NAI 5373 specification [RFC4282]. 5375 8.15. Termination-Cause AVP 5377 The Termination-Cause AVP (AVP Code 295) is of type Enumerated, and 5378 is used to indicate the reason why a session was terminated on the 5379 access device. The following values are defined: 5381 DIAMETER_LOGOUT 1 5383 The user initiated a disconnect 5385 DIAMETER_SERVICE_NOT_PROVIDED 2 5387 This value is used when the user disconnected prior to the receipt 5388 of the authorization answer message. 5390 DIAMETER_BAD_ANSWER 3 5392 This value indicates that the authorization answer received by the 5393 access device was not processed successfully. 5395 DIAMETER_ADMINISTRATIVE 4 5397 The user was not granted access, or was disconnected, due to 5398 administrative reasons, such as the receipt of a Abort-Session- 5399 Request message. 5401 DIAMETER_LINK_BROKEN 5 5403 The communication to the user was abruptly disconnected. 5405 DIAMETER_AUTH_EXPIRED 6 5407 The user's access was terminated since its authorized session time 5408 has expired. 5410 DIAMETER_USER_MOVED 7 5412 The user is receiving services from another access device. 5414 DIAMETER_SESSION_TIMEOUT 8 5416 The user's session has timed out, and service has been terminated. 5418 8.16. Origin-State-Id AVP 5420 The Origin-State-Id AVP (AVP Code 278), of type Unsigned32, is a 5421 monotonically increasing value that is advanced whenever a Diameter 5422 entity restarts with loss of previous state, for example upon reboot. 5423 Origin-State-Id MAY be included in any Diameter message, including 5424 CER. 5426 A Diameter entity issuing this AVP MUST create a higher value for 5427 this AVP each time its state is reset. A Diameter entity MAY set 5428 Origin-State-Id to the time of startup, or it MAY use an incrementing 5429 counter retained in non-volatile memory across restarts. 5431 The Origin-State-Id, if present, MUST reflect the state of the entity 5432 indicated by Origin-Host. If a proxy modifies Origin-Host, it MUST 5433 either remove Origin-State-Id or modify it appropriately as well. 5434 Typically, Origin-State-Id is used by an access device that always 5435 starts up with no active sessions; that is, any session active prior 5436 to restart will have been lost. By including Origin-State-Id in a 5437 message, it allows other Diameter entities to infer that sessions 5438 associated with a lower Origin-State-Id are no longer active. If an 5439 access device does not intend for such inferences to be made, it MUST 5440 either not include Origin-State-Id in any message, or set its value 5441 to 0. 5443 8.17. Session-Binding AVP 5445 The Session-Binding AVP (AVP Code 270) is of type Unsigned32, and MAY 5446 be present in application-specific authorization answer messages. If 5447 present, this AVP MAY inform the Diameter client that all future 5448 application-specific re-auth and Session-Termination-Request messages 5449 for this session MUST be sent to the same authorization server. 5451 This field is a bit mask, and the following bits have been defined: 5453 RE_AUTH 1 5455 When set, future re-auth messages for this session MUST NOT 5456 include the Destination-Host AVP. When cleared, the default 5457 value, the Destination-Host AVP MUST be present in all re-auth 5458 messages for this session. 5460 STR 2 5462 When set, the STR message for this session MUST NOT include the 5463 Destination-Host AVP. When cleared, the default value, the 5464 Destination-Host AVP MUST be present in the STR message for this 5465 session. 5467 ACCOUNTING 4 5469 When set, all accounting messages for this session MUST NOT 5470 include the Destination-Host AVP. When cleared, the default 5471 value, the Destination-Host AVP, if known, MUST be present in all 5472 accounting messages for this session. 5474 8.18. Session-Server-Failover AVP 5476 The Session-Server-Failover AVP (AVP Code 271) is of type Enumerated, 5477 and MAY be present in application-specific authorization answer 5478 messages that either do not include the Session-Binding AVP or 5479 include the Session-Binding AVP with any of the bits set to a zero 5480 value. If present, this AVP MAY inform the Diameter client that if a 5481 re-auth or STR message fails due to a delivery problem, the Diameter 5482 client SHOULD issue a subsequent message without the Destination-Host 5483 AVP. When absent, the default value is REFUSE_SERVICE. 5485 The following values are supported: 5487 REFUSE_SERVICE 0 5489 If either the re-auth or the STR message delivery fails, terminate 5490 service with the user, and do not attempt any subsequent attempts. 5492 TRY_AGAIN 1 5494 If either the re-auth or the STR message delivery fails, resend 5495 the failed message without the Destination-Host AVP present. 5497 ALLOW_SERVICE 2 5499 If re-auth message delivery fails, assume that re-authorization 5500 succeeded. If STR message delivery fails, terminate the session. 5502 TRY_AGAIN_ALLOW_SERVICE 3 5504 If either the re-auth or the STR message delivery fails, resend 5505 the failed message without the Destination-Host AVP present. If 5506 the second delivery fails for re-auth, assume re-authorization 5507 succeeded. If the second delivery fails for STR, terminate the 5508 session. 5510 8.19. Multi-Round-Time-Out AVP 5512 The Multi-Round-Time-Out AVP (AVP Code 272) is of type Unsigned32, 5513 and SHOULD be present in application-specific authorization answer 5514 messages whose Result-Code AVP is set to DIAMETER_MULTI_ROUND_AUTH. 5515 This AVP contains the maximum number of seconds that the access 5516 device MUST provide the user in responding to an authentication 5517 request. 5519 8.20. Class AVP 5521 The Class AVP (AVP Code 25) is of type OctetString and is used by 5522 Diameter servers to return state information to the access device. 5523 When one or more Class AVPs are present in application-specific 5524 authorization answer messages, they MUST be present in subsequent re- 5525 authorization, session termination and accounting messages. Class 5526 AVPs found in a re-authorization answer message override the ones 5527 found in any previous authorization answer message. Diameter server 5528 implementations SHOULD NOT return Class AVPs that require more than 5529 4096 bytes of storage on the Diameter client. A Diameter client that 5530 receives Class AVPs whose size exceeds local available storage MUST 5531 terminate the session. 5533 8.21. Event-Timestamp AVP 5535 The Event-Timestamp (AVP Code 55) is of type Time, and MAY be 5536 included in an Accounting-Request and Accounting-Answer messages to 5537 record the time that the reported event occurred, in seconds since 5538 January 1, 1900 00:00 UTC. 5540 9. Accounting 5542 This accounting protocol is based on a server directed model with 5543 capabilities for real-time delivery of accounting information. 5544 Several fault resilience methods [RFC2975] have been built in to the 5545 protocol in order minimize loss of accounting data in various fault 5546 situations and under different assumptions about the capabilities of 5547 the used devices. 5549 9.1. Server Directed Model 5551 The server directed model means that the device generating the 5552 accounting data gets information from either the authorization server 5553 (if contacted) or the accounting server regarding the way accounting 5554 data shall be forwarded. This information includes accounting record 5555 timeliness requirements. 5557 As discussed in [RFC2975], real-time transfer of accounting records 5558 is a requirement, such as the need to perform credit limit checks and 5559 fraud detection. Note that batch accounting is not a requirement, 5560 and is therefore not supported by Diameter. Should batched 5561 accounting be required in the future, a new Diameter application will 5562 need to be created, or it could be handled using another protocol. 5563 Note, however, that even if at the Diameter layer accounting requests 5564 are processed one by one, transport protocols used under Diameter 5565 typically batch several requests in the same packet under heavy 5566 traffic conditions. This may be sufficient for many applications. 5568 The authorization server (chain) directs the selection of proper 5569 transfer strategy, based on its knowledge of the user and 5570 relationships of roaming partnerships. The server (or agents) uses 5571 the Acct-Interim-Interval and Accounting-Realtime-Required AVPs to 5572 control the operation of the Diameter peer operating as a client. 5573 The Acct-Interim-Interval AVP, when present, instructs the Diameter 5574 node acting as a client to produce accounting records continuously 5575 even during a session. Accounting-Realtime-Required AVP is used to 5576 control the behavior of the client when the transfer of accounting 5577 records from the Diameter client is delayed or unsuccessful. 5579 The Diameter accounting server MAY override the interim interval or 5580 the realtime requirements by including the Acct-Interim-Interval or 5581 Accounting-Realtime-Required AVP in the Accounting-Answer message. 5582 When one of these AVPs is present, the latest value received SHOULD 5583 be used in further accounting activities for the same session. 5585 9.2. Protocol Messages 5587 A Diameter node that receives a successful authentication and/or 5588 authorization messages from the Diameter server SHOULD collect 5589 accounting information for the session. The Accounting-Request 5590 message is used to transmit the accounting information to the 5591 Diameter server, which MUST reply with the Accounting-Answer message 5592 to confirm reception. The Accounting-Answer message includes the 5593 Result-Code AVP, which MAY indicate that an error was present in the 5594 accounting message. The value of the Accounting-Realtime-Required 5595 AVP received earlier for the session in question may indicate that 5596 the user's session has to be terminated when a rejected Accounting- 5597 Request message was received. 5599 9.3. Accounting Application Extension and Requirements 5601 Each Diameter application (e.g., NASREQ, MobileIP), SHOULD define 5602 their Service-Specific AVPs that MUST be present in the Accounting- 5603 Request message in a section entitled "Accounting AVPs". The 5604 application MUST assume that the AVPs described in this document will 5605 be present in all Accounting messages, so only their respective 5606 service-specific AVPs need to be defined in that section. 5608 Applications have the option of using one or both of the following 5609 accounting application extension models: 5611 Split Accounting Service 5613 The accounting message will carry the Application Id of the 5614 Diameter base accounting application (see Section 2.4). 5615 Accounting messages may be routed to Diameter nodes other than the 5616 corresponding Diameter application. These nodes might be 5617 centralized accounting servers that provide accounting service for 5618 multiple different Diameter applications. These nodes MUST 5619 advertise the Diameter base accounting Application Id during 5620 capabilities exchange. 5622 Coupled Accounting Service 5624 The accounting messages will carry the Application Id of the 5625 application that is using it. The application itself will process 5626 the received accounting records or forward them to an accounting 5627 server. There is no accounting application advertisement required 5628 during capabilities exchange and the accounting messages will be 5629 routed the same as any of the other application messages. 5631 In cases where an application does not define its own accounting 5632 service, it is preferred that the split accounting model be used. 5634 9.4. Fault Resilience 5636 Diameter Base protocol mechanisms are used to overcome small message 5637 loss and network faults of temporary nature. 5639 Diameter peers acting as clients MUST implement the use of failover 5640 to guard against server failures and certain network failures. 5641 Diameter peers acting as agents or related off-line processing 5642 systems MUST detect duplicate accounting records caused by the 5643 sending of same record to several servers and duplication of messages 5644 in transit. This detection MUST be based on the inspection of the 5645 Session-Id and Accounting-Record-Number AVP pairs. Appendix C 5646 discusses duplicate detection needs and implementation issues. 5648 Diameter clients MAY have non-volatile memory for the safe storage of 5649 accounting records over reboots or extended network failures, network 5650 partitions, and server failures. If such memory is available, the 5651 client SHOULD store new accounting records there as soon as the 5652 records are created and until a positive acknowledgement of their 5653 reception from the Diameter Server has been received. Upon a reboot, 5654 the client MUST starting sending the records in the non-volatile 5655 memory to the accounting server with appropriate modifications in 5656 termination cause, session length, and other relevant information in 5657 the records. 5659 A further application of this protocol may include AVPs to control 5660 how many accounting records may at most be stored in the Diameter 5661 client without committing them to the non-volatile memory or 5662 transferring them to the Diameter server. 5664 The client SHOULD NOT remove the accounting data from any of its 5665 memory areas before the correct Accounting-Answer has been received. 5666 The client MAY remove oldest, undelivered or yet unacknowledged 5667 accounting data if it runs out of resources such as memory. It is an 5668 implementation dependent matter for the client to accept new sessions 5669 under this condition. 5671 9.5. Accounting Records 5673 In all accounting records, the Session-Id AVP MUST be present; the 5674 User-Name AVP MUST be present if it is available to the Diameter 5675 client. 5677 Different types of accounting records are sent depending on the 5678 actual type of accounted service and the authorization server's 5679 directions for interim accounting. If the accounted service is a 5680 one-time event, meaning that the start and stop of the event are 5681 simultaneous, then the Accounting-Record-Type AVP MUST be present and 5682 set to the value EVENT_RECORD. 5684 If the accounted service is of a measurable length, then the AVP MUST 5685 use the values START_RECORD, STOP_RECORD, and possibly, 5686 INTERIM_RECORD. If the authorization server has not directed interim 5687 accounting to be enabled for the session, two accounting records MUST 5688 be generated for each service of type session. When the initial 5689 Accounting-Request for a given session is sent, the Accounting- 5690 Record-Type AVP MUST be set to the value START_RECORD. When the last 5691 Accounting-Request is sent, the value MUST be STOP_RECORD. 5693 If the authorization server has directed interim accounting to be 5694 enabled, the Diameter client MUST produce additional records between 5695 the START_RECORD and STOP_RECORD, marked INTERIM_RECORD. The 5696 production of these records is directed by Acct-Interim-Interval as 5697 well as any re-authentication or re-authorization of the session. 5698 The Diameter client MUST overwrite any previous interim accounting 5699 records that are locally stored for delivery, if a new record is 5700 being generated for the same session. This ensures that only one 5701 pending interim record can exist on an access device for any given 5702 session. 5704 A particular value of Accounting-Sub-Session-Id MUST appear only in 5705 one sequence of accounting records from a DIAMETER client, except for 5706 the purposes of retransmission. The one sequence that is sent MUST 5707 be either one record with Accounting-Record-Type AVP set to the value 5708 EVENT_RECORD, or several records starting with one having the value 5709 START_RECORD, followed by zero or more INTERIM_RECORD and a single 5710 STOP_RECORD. A particular Diameter application specification MUST 5711 define the type of sequences that MUST be used. 5713 9.6. Correlation of Accounting Records 5715 If an application uses accounting messages, it can correlate 5716 accounting records with a specific application session by using the 5717 Session-Id of the particular application session in the accounting 5718 messages. Accounting messages MAY also use a different Session-Id 5719 from that of the application sessions in which case other session 5720 related information is needed to perform correlation. 5722 In cases where an application requires multiple accounting sub- 5723 session, an Accounting-Sub-Session-Id AVP is used to differentiate 5724 each sub-session. The Session-Id would remain constant for all sub- 5725 sessions and is be used to correlate all the sub-sessions to a 5726 particular application session. Note that receiving a STOP_RECORD 5727 with no Accounting-Sub-Session-Id AVP when sub-sessions were 5728 originally used in the START_RECORD messages implies that all sub- 5729 sessions are terminated. 5731 There are also cases where an application needs to correlate multiple 5732 application sessions into a single accounting record; the accounting 5733 record may span multiple different Diameter applications and sessions 5734 used by the same user at a given time. In such cases, the Acct- 5735 Multi-Session-Id AVP is used. The Acct-Multi-Session-Id AVP SHOULD 5736 be signaled by the server to the access device (typically during 5737 authorization) when it determines that a request belongs to an 5738 existing session. The access device MUST then include the Acct- 5739 Multi-Session-Id AVP in all subsequent accounting messages. 5741 The Acct-Multi-Session-Id AVP MAY include the value of the original 5742 Session-Id. It's contents are implementation specific, but MUST be 5743 globally unique across other Acct-Multi-Session-Id, and MUST NOT 5744 change during the life of a session. 5746 A Diameter application document MUST define the exact concept of a 5747 session that is being accounted, and MAY define the concept of a 5748 multi-session. For instance, the NASREQ DIAMETER application treats 5749 a single PPP connection to a Network Access Server as one session, 5750 and a set of Multilink PPP sessions as one multi-session. 5752 9.7. Accounting Command-Codes 5754 This section defines Command-Code values that MUST be supported by 5755 all Diameter implementations that provide Accounting services. 5757 9.7.1. Accounting-Request 5759 The Accounting-Request (ACR) command, indicated by the Command-Code 5760 field set to 271 and the Command Flags' 'R' bit set, is sent by a 5761 Diameter node, acting as a client, in order to exchange accounting 5762 information with a peer. 5764 The AVP listed below SHOULD include service-specific accounting AVPs, 5765 as described in Section 9.3. 5767 Message Format 5769 ::= < Diameter Header: 271, REQ, PXY > 5770 < Session-Id > 5771 { Origin-Host } 5772 { Origin-Realm } 5773 { Destination-Realm } 5774 { Accounting-Record-Type } 5775 { Accounting-Record-Number } 5776 [ Acct-Application-Id ] 5777 [ Vendor-Specific-Application-Id ] 5778 [ User-Name ] 5779 [ Destination-Host ] 5780 [ Accounting-Sub-Session-Id ] 5781 [ Acct-Session-Id ] 5782 [ Acct-Multi-Session-Id ] 5783 [ Acct-Interim-Interval ] 5784 [ Accounting-Realtime-Required ] 5785 [ Origin-State-Id ] 5786 [ Event-Timestamp ] 5787 * [ Proxy-Info ] 5788 * [ Route-Record ] 5789 * [ AVP ] 5791 9.7.2. Accounting-Answer 5793 The Accounting-Answer (ACA) command, indicated by the Command-Code 5794 field set to 271 and the Command Flags' 'R' bit cleared, is used to 5795 acknowledge an Accounting-Request command. The Accounting-Answer 5796 command contains the same Session-Id as the corresponding request. 5798 Only the target Diameter Server, known as the home Diameter Server, 5799 SHOULD respond with the Accounting-Answer command. 5801 The AVP listed below SHOULD include service-specific accounting AVPs, 5802 as described in Section 9.3. 5804 Message Format 5806 ::= < Diameter Header: 271, PXY > 5807 < Session-Id > 5808 { Result-Code } 5809 { Origin-Host } 5810 { Origin-Realm } 5811 { Accounting-Record-Type } 5812 { Accounting-Record-Number } 5813 [ Acct-Application-Id ] 5814 [ Vendor-Specific-Application-Id ] 5815 [ User-Name ] 5816 [ Accounting-Sub-Session-Id ] 5817 [ Acct-Session-Id ] 5818 [ Acct-Multi-Session-Id ] 5819 [ Error-Message ] 5820 [ Error-Reporting-Host ] 5821 [ Failed-AVP ] 5822 [ Acct-Interim-Interval ] 5823 [ Accounting-Realtime-Required ] 5824 [ Origin-State-Id ] 5825 [ Event-Timestamp ] 5826 * [ Proxy-Info ] 5827 * [ AVP ] 5829 9.8. Accounting AVPs 5831 This section contains AVPs that describe accounting usage information 5832 related to a specific session. 5834 9.8.1. Accounting-Record-Type AVP 5836 The Accounting-Record-Type AVP (AVP Code 480) is of type Enumerated 5837 and contains the type of accounting record being sent. The following 5838 values are currently defined for the Accounting-Record-Type AVP: 5840 EVENT_RECORD 1 5842 An Accounting Event Record is used to indicate that a one-time 5843 event has occurred (meaning that the start and end of the event 5844 are simultaneous). This record contains all information relevant 5845 to the service, and is the only record of the service. 5847 START_RECORD 2 5849 An Accounting Start, Interim, and Stop Records are used to 5850 indicate that a service of a measurable length has been given. An 5851 Accounting Start Record is used to initiate an accounting session, 5852 and contains accounting information that is relevant to the 5853 initiation of the session. 5855 INTERIM_RECORD 3 5857 An Interim Accounting Record contains cumulative accounting 5858 information for an existing accounting session. Interim 5859 Accounting Records SHOULD be sent every time a re-authentication 5860 or re-authorization occurs. Further, additional interim record 5861 triggers MAY be defined by application-specific Diameter 5862 applications. The selection of whether to use INTERIM_RECORD 5863 records is done by the Acct-Interim-Interval AVP. 5865 STOP_RECORD 4 5867 An Accounting Stop Record is sent to terminate an accounting 5868 session and contains cumulative accounting information relevant to 5869 the existing session. 5871 9.8.2. Acct-Interim-Interval AVP 5873 The Acct-Interim-Interval AVP (AVP Code 85) is of type Unsigned32 and 5874 is sent from the Diameter home authorization server to the Diameter 5875 client. The client uses information in this AVP to decide how and 5876 when to produce accounting records. With different values in this 5877 AVP, service sessions can result in one, two, or two+N accounting 5878 records, based on the needs of the home-organization. The following 5879 accounting record production behavior is directed by the inclusion of 5880 this AVP: 5882 1. The omission of the Acct-Interim-Interval AVP or its inclusion 5883 with Value field set to 0 means that EVENT_RECORD, START_RECORD, 5884 and STOP_RECORD are produced, as appropriate for the service. 5886 2. The inclusion of the AVP with Value field set to a non-zero value 5887 means that INTERIM_RECORD records MUST be produced between the 5888 START_RECORD and STOP_RECORD records. The Value field of this 5889 AVP is the nominal interval between these records in seconds. 5891 The Diameter node that originates the accounting information, 5892 known as the client, MUST produce the first INTERIM_RECORD record 5893 roughly at the time when this nominal interval has elapsed from 5894 the START_RECORD, the next one again as the interval has elapsed 5895 once more, and so on until the session ends and a STOP_RECORD 5896 record is produced. 5898 The client MUST ensure that the interim record production times 5899 are randomized so that large accounting message storms are not 5900 created either among records or around a common service start 5901 time. 5903 9.8.3. Accounting-Record-Number AVP 5905 The Accounting-Record-Number AVP (AVP Code 485) is of type Unsigned32 5906 and identifies this record within one session. As Session-Id AVPs 5907 are globally unique, the combination of Session-Id and Accounting- 5908 Record-Number AVPs is also globally unique, and can be used in 5909 matching accounting records with confirmations. An easy way to 5910 produce unique numbers is to set the value to 0 for records of type 5911 EVENT_RECORD and START_RECORD, and set the value to 1 for the first 5912 INTERIM_RECORD, 2 for the second, and so on until the value for 5913 STOP_RECORD is one more than for the last INTERIM_RECORD. 5915 9.8.4. Acct-Session-Id AVP 5917 The Acct-Session-Id AVP (AVP Code 44) is of type OctetString is only 5918 used when RADIUS/Diameter translation occurs. This AVP contains the 5919 contents of the RADIUS Acct-Session-Id attribute. 5921 9.8.5. Acct-Multi-Session-Id AVP 5923 The Acct-Multi-Session-Id AVP (AVP Code 50) is of type UTF8String, 5924 following the format specified in Section 8.8. The Acct-Multi- 5925 Session-Id AVP is used to link together multiple related accounting 5926 sessions, where each session would have a unique Session-Id, but the 5927 same Acct-Multi-Session-Id AVP. This AVP MAY be returned by the 5928 Diameter server in an authorization answer, and MUST be used in all 5929 accounting messages for the given session. 5931 9.8.6. Accounting-Sub-Session-Id AVP 5933 The Accounting-Sub-Session-Id AVP (AVP Code 287) is of type 5934 Unsigned64 and contains the accounting sub-session identifier. The 5935 combination of the Session-Id and this AVP MUST be unique per sub- 5936 session, and the value of this AVP MUST be monotonically increased by 5937 one for all new sub-sessions. The absence of this AVP implies no 5938 sub-sessions are in use, with the exception of an Accounting-Request 5939 whose Accounting-Record-Type is set to STOP_RECORD. A STOP_RECORD 5940 message with no Accounting-Sub-Session-Id AVP present will signal the 5941 termination of all sub-sessions for a given Session-Id. 5943 9.8.7. Accounting-Realtime-Required AVP 5945 The Accounting-Realtime-Required AVP (AVP Code 483) is of type 5946 Enumerated and is sent from the Diameter home authorization server to 5947 the Diameter client or in the Accounting-Answer from the accounting 5948 server. The client uses information in this AVP to decide what to do 5949 if the sending of accounting records to the accounting server has 5950 been temporarily prevented due to, for instance, a network problem. 5952 DELIVER_AND_GRANT 1 5954 The AVP with Value field set to DELIVER_AND_GRANT means that the 5955 service MUST only be granted as long as there is a connection to 5956 an accounting server. Note that the set of alternative accounting 5957 servers are treated as one server in this sense. Having to move 5958 the accounting record stream to a backup server is not a reason to 5959 discontinue the service to the user. 5961 GRANT_AND_STORE 2 5963 The AVP with Value field set to GRANT_AND_STORE means that service 5964 SHOULD be granted if there is a connection, or as long as records 5965 can still be stored as described in Section 9.4. 5967 This is the default behavior if the AVP isn't included in the 5968 reply from the authorization server. 5970 GRANT_AND_LOSE 3 5972 The AVP with Value field set to GRANT_AND_LOSE means that service 5973 SHOULD be granted even if the records cannot be delivered or 5974 stored. 5976 10. AVP Occurrence Table 5978 The following tables presents the AVPs defined in this document, and 5979 specifies in which Diameter messages they MAY be present or not. 5980 AVPs that occur only inside a Grouped AVP are not shown in this 5981 table. 5983 The table uses the following symbols: 5985 0 The AVP MUST NOT be present in the message. 5987 0+ Zero or more instances of the AVP MAY be present in the 5988 message. 5990 0-1 Zero or one instance of the AVP MAY be present in the message. 5991 It is considered an error if there are more than one instance of 5992 the AVP. 5994 1 One instance of the AVP MUST be present in the message. 5996 1+ At least one instance of the AVP MUST be present in the 5997 message. 5999 10.1. Base Protocol Command AVP Table 6001 The table in this section is limited to the non-accounting Command 6002 Codes defined in this specification. 6004 +-----------------------------------------------+ 6005 | Command-Code | 6006 +---+---+---+---+---+---+---+---+---+---+---+---+ 6007 Attribute Name |CER|CEA|DPR|DPA|DWR|DWA|RAR|RAA|ASR|ASA|STR|STA| 6008 --------------------+---+---+---+---+---+---+---+---+---+---+---+---+ 6009 Acct-Interim- |0 |0 |0 |0 |0 |0 |0-1|0 |0 |0 |0 |0 | 6010 Interval | | | | | | | | | | | | | 6011 Accounting-Realtime-|0 |0 |0 |0 |0 |0 |0-1|0 |0 |0 |0 |0 | 6012 Required | | | | | | | | | | | | | 6013 Acct-Application-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6014 Auth-Application-Id |0+ |0+ |0 |0 |0 |0 |1 |0 |1 |0 |1 |0 | 6015 Auth-Grace-Period |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6016 Auth-Request-Type |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6017 Auth-Session-State |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6018 Authorization- |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6019 Lifetime | | | | | | | | | | | | | 6020 Class |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0+ |0+ | 6021 Destination-Host |0 |0 |0 |0 |0 |0 |1 |0 |1 |0 |0-1|0 | 6022 Destination-Realm |0 |0 |0 |0 |0 |0 |1 |0 |1 |0 |1 |0 | 6023 Disconnect-Cause |0 |0 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6024 Error-Message |0 |0-1|0 |0-1|0 |0-1|0 |0-1|0 |0-1|0 |0-1| 6025 Error-Reporting-Host|0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6026 Failed-AVP |0 |0+ |0 |0+ |0 |0+ |0 |0+ |0 |0+ |0 |0+ | 6027 Firmware-Revision |0-1|0-1|0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6028 Host-IP-Address |1+ |1+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6029 Inband-Security-Id |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6030 Multi-Round-Time-Out|0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6031 Origin-Host |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 | 6032 Origin-Realm |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 | 6033 Origin-State-Id |0-1|0-1|0 |0 |0-1|0-1|0-1|0-1|0-1|0-1|0-1|0-1| 6034 Product-Name |1 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6035 Proxy-Info |0 |0 |0 |0 |0 |0 |0+ |0+ |0+ |0+ |0+ |0+ | 6036 Redirect-Host |0 |0 |0 |0 |0 |0 |0 |0+ |0 |0+ |0 |0+ | 6037 Redirect-Host-Usage |0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6038 Redirect-Max-Cache- |0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6039 Time | | | | | | | | | | | | | 6040 Result-Code |0 |1 |0 |1 |0 |1 |0 |1 |0 |1 |0 |1 | 6041 Re-Auth-Request-Type|0 |0 |0 |0 |0 |0 |1 |0 |0 |0 |0 |0 | 6042 Route-Record |0 |0 |0 |0 |0 |0 |0+ |0 |0+ |0 |0+ |0 | 6043 Session-Binding |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6044 Session-Id |0 |0 |0 |0 |0 |0 |1 |1 |1 |1 |1 |1 | 6045 Session-Server- |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6046 Failover | | | | | | | | | | | | | 6047 Session-Timeout |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6048 Supported-Vendor-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6049 Termination-Cause |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |1 |0 | 6050 User-Name |0 |0 |0 |0 |0 |0 |0-1|0-1|0-1|0-1|0-1|0-1| 6051 Vendor-Id |1 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6052 Vendor-Specific- |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6053 Application-Id | | | | | | | | | | | | | 6054 --------------------+---+---+---+---+---+---+---+---+---+---+---+---+ 6056 10.2. Accounting AVP Table 6058 The table in this section is used to represent which AVPs defined in 6059 this document are to be present in the Accounting messages. These 6060 AVP occurrence requirements are guidelines, which may be expanded, 6061 and/or overridden by application-specific requirements in the 6062 Diameter applications documents. 6064 +-----------+ 6065 | Command | 6066 | Code | 6067 +-----+-----+ 6068 Attribute Name | ACR | ACA | 6069 ------------------------------+-----+-----+ 6070 Acct-Interim-Interval | 0-1 | 0-1 | 6071 Acct-Multi-Session-Id | 0-1 | 0-1 | 6072 Accounting-Record-Number | 1 | 1 | 6073 Accounting-Record-Type | 1 | 1 | 6074 Acct-Session-Id | 0-1 | 0-1 | 6075 Accounting-Sub-Session-Id | 0-1 | 0-1 | 6076 Accounting-Realtime-Required | 0-1 | 0-1 | 6077 Acct-Application-Id | 0-1 | 0-1 | 6078 Auth-Application-Id | 0 | 0 | 6079 Class | 0+ | 0+ | 6080 Destination-Host | 0-1 | 0 | 6081 Destination-Realm | 1 | 0 | 6082 Error-Reporting-Host | 0 | 0+ | 6083 Event-Timestamp | 0-1 | 0-1 | 6084 Origin-Host | 1 | 1 | 6085 Origin-Realm | 1 | 1 | 6086 Proxy-Info | 0+ | 0+ | 6087 Route-Record | 0+ | 0 | 6088 Result-Code | 0 | 1 | 6089 Session-Id | 1 | 1 | 6090 Termination-Cause | 0 | 0 | 6091 User-Name | 0-1 | 0-1 | 6092 Vendor-Specific-Application-Id| 0-1 | 0-1 | 6093 ------------------------------+-----+-----+ 6095 11. IANA Considerations 6097 This section provides guidance to the Internet Assigned Numbers 6098 Authority (IANA) regarding registration of values related to the 6099 Diameter protocol, in accordance with BCP 26 [RFC5226]. The policies 6100 and procedures for the IANA put in place by [RFC3588] applies here. 6101 The criteria used by the IANA for assignment of numbers within this 6102 namespace remains the same unless otherwise stated in this section. 6103 Existing assignments remains the same unless explicitly updated or 6104 deprecated in this secion. 6106 11.1. Changes to AVP Header Allocation 6108 For AVP Headers, the only change is the AVP code block allocations. 6109 Block allocation (release of more than 3 at a time for a given 6110 purpose) now only require IETF Review as opposed to an IETF 6111 Consensus. 6113 11.2. Diameter Header 6115 For the Diameter Header, the command code namespace allocation has 6116 changed. The new allocation rules are as follows: 6118 The command code values 256 - 8,388,607 (0x100 to 0x7fffff) are 6119 for permanent, standard commands, allocated by IETF Review 6120 [RFC5226]. 6122 The values 8,388,608 - 16,777,213 (0x800000 - 0xfffffd) are 6123 reserved for vendor-specific command codes, to be allocated on a 6124 First Come, First Served basis by IANA [RFC5226]. The request to 6125 IANA for a Vendor-Specific Command Code SHOULD include a reference 6126 to a publicly available specification which documents the command 6127 in sufficient detail to aid in interoperability between 6128 independent implementations. If the specification cannot be made 6129 publicly available, the request for a vendor-specific command code 6130 MUST include the contact information of persons and/or entities 6131 responsible for authoring and maintaining the command. 6133 11.3. AVP Values 6135 For AVP values, the Experimental-Result-Code AVP value allocation has 6136 been added. The new rule is as follows: 6138 11.3.1. Experimental-Result-Code AVP 6140 Values for this AVP are purely local to the indicated vendor, and no 6141 IANA registry is maintained for them. 6143 11.4. Diameter TCP, SCTP, TLS/TCP and DTLS/SCTP Port Numbers 6145 Updated port number assignments are described in this section. The 6146 IANA has assigned port number 3868 for TCP and SCTP. The port number 6147 [TBD] has been assigned for TLS/TCP and DTLS/SCTP. 6149 11.5. S-NAPTR Parameters 6151 This document registers a new S-NAPTR Application Service Tag value 6152 of "aaa". 6154 This document also registers the following S-NAPTR Application 6155 Protocol Tags: 6157 Tag | Protocol 6158 -------------------|--------- 6159 diameter.tcp | TCP 6160 diameter.sctp | SCTP 6161 diameter.tls.tcp | TLS/TCP 6162 diameter.dtls.sctp | DTLS/SCTP 6164 12. Diameter protocol related configurable parameters 6166 This section contains the configurable parameters that are found 6167 throughout this document: 6169 Diameter Peer 6171 A Diameter entity MAY communicate with peers that are statically 6172 configured. A statically configured Diameter peer would require 6173 that either the IP address or the fully qualified domain name 6174 (FQDN) be supplied, which would then be used to resolve through 6175 DNS. 6177 Routing Table 6179 A Diameter proxy server routes messages based on the realm portion 6180 of a Network Access Identifier (NAI). The server MUST have a 6181 table of Realm Names, and the address of the peer to which the 6182 message must be forwarded to. The routing table MAY also include 6183 a "default route", which is typically used for all messages that 6184 cannot be locally processed. 6186 Tc timer 6188 The Tc timer controls the frequency that transport connection 6189 attempts are done to a peer with whom no active transport 6190 connection exists. The recommended value is 30 seconds. 6192 13. Security Considerations 6194 The Diameter base protocol messages SHOULD be secured by using TLS 6195 [RFC5246] or DTLS/SCTP [RFC6083]. Additional security mechanisms 6196 such as IPsec [RFC4301] MAY also be deployed to secure connections 6197 between peers. However, all Diameter base protocol implementations 6198 MUST support the use of TLS/TCP and DTLS/SCTP and the Diameter 6199 protocol MUST NOT be used without any security mechanism. 6201 If a Diameter connection is to be protected via TLS/TCP and DTLS/SCTP 6202 or IPsec, then TLS/TCP and DTLS/SCTP or IPsec/IKE SHOULD begin prior 6203 to any Diameter message exchange. All security parameters for TLS/ 6204 TCP and DTLS/SCTP or IPsec are configured independent of the Diameter 6205 protocol. All Diameter message will be sent through the TLS/TCP and 6206 DTLS/SCTP or IPsec connection after a successful setup. 6208 For TLS/TCP and DTLS/SCTP connections to be established in the open 6209 state, the CER/CEA exchange MUST include an Inband-Security-ID AVP 6210 with a value of TLS/TCP and DTLS/SCTP. The TLS/TCP and DTLS/SCTP 6211 handshake will begin when both ends successfully reached the open 6212 state, after completion of the CER/CEA exchange. If the TLS/TCP and 6213 DTLS/SCTP handshake is successful, all further messages will be sent 6214 via TLS/TCP and DTLS/SCTP. If the handshake fails, both ends move to 6215 the closed state. See Sections 13.1 for more details. 6217 13.1. TLS/TCP and DTLS/SCTP Usage 6219 Diameter nodes using TLS/TCP and DTLS/SCTP for security MUST mutually 6220 authenticate as part of TLS/TCP and DTLS/SCTP session establishment. 6221 In order to ensure mutual authentication, the Diameter node acting as 6222 TLS/TCP and DTLS/SCTP server MUST request a certificate from the 6223 Diameter node acting as TLS/TCP and DTLS/SCTP client, and the 6224 Diameter node acting as TLS/TCP and DTLS/SCTP client MUST be prepared 6225 to supply a certificate on request. 6227 Diameter nodes MUST be able to negotiate the following TLS/TCP and 6228 DTLS/SCTP cipher suites: 6230 TLS_RSA_WITH_RC4_128_MD5 6231 TLS_RSA_WITH_RC4_128_SHA 6232 TLS_RSA_WITH_3DES_EDE_CBC_SHA 6234 Diameter nodes SHOULD be able to negotiate the following TLS/TCP and 6235 DTLS/SCTP cipher suite: 6237 TLS_RSA_WITH_AES_128_CBC_SHA 6239 Diameter nodes MAY negotiate other TLS/TCP and DTLS/SCTP cipher 6240 suites. 6242 13.2. Peer-to-Peer Considerations 6244 As with any peer-to-peer protocol, proper configuration of the trust 6245 model within a Diameter peer is essential to security. When 6246 certificates are used, it is necessary to configure the root 6247 certificate authorities trusted by the Diameter peer. These root CAs 6248 are likely to be unique to Diameter usage and distinct from the root 6249 CAs that might be trusted for other purposes such as Web browsing. 6250 In general, it is expected that those root CAs will be configured so 6251 as to reflect the business relationships between the organization 6252 hosting the Diameter peer and other organizations. As a result, a 6253 Diameter peer will typically not be configured to allow connectivity 6254 with any arbitrary peer. With certificate authentication, Diameter 6255 peers may not be known beforehand and therefore peer discovery may be 6256 required. 6258 14. References 6260 14.1. Normative References 6262 [FLOATPOINT] 6263 Institute of Electrical and Electronics Engineers, "IEEE 6264 Standard for Binary Floating-Point Arithmetic, ANSI/IEEE 6265 Standard 754-1985", August 1985. 6267 [IANAADFAM] 6268 IANA,, "Address Family Numbers", 6269 http://www.iana.org/assignments/address-family-numbers. 6271 [RADTYPE] IANA,, "RADIUS Types", 6272 http://www.iana.org/assignments/radius-types. 6274 [RFC791] Postel, J., "Internet Protocol", RFC 791, September 1981. 6276 [RFC793] Postel, J., "Transmission Control Protocol", RFC 793, 6277 January 1981. 6279 [RFC3539] Aboba, B. and J. Wood, "Authentication, Authorization and 6280 Accounting (AAA) Transport Profile", RFC 3539, June 2003. 6282 [RFC4004] Calhoun, P., Johansson, T., Perkins, C., Hiller, T., and 6283 P. McCann, "Diameter Mobile IPv4 Application", RFC 4004, 6284 August 2005. 6286 [RFC4005] Calhoun, P., Zorn, G., Spence, D., and D. Mitton, 6287 "Diameter Network Access Server Application", RFC 4005, 6288 August 2005. 6290 [RFC4006] Hakala, H., Mattila, L., Koskinen, J-P., Stura, M., and J. 6291 Loughney, "Diameter Credit-Control Application", RFC 4006, 6292 August 2005. 6294 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 6295 Specifications: ABNF", STD 68, RFC 5234, January 2008. 6297 [RFC3588] Calhoun, P., Loughney, J., Guttman, E., Zorn, G., and J. 6298 Arkko, "Diameter Base Protocol", RFC 3588, September 2003. 6300 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 6301 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 6302 May 2008. 6304 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing 6305 Architecture", RFC 4291, February 2006. 6307 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6308 Requirement Levels", BCP 14, RFC 2119, March 1997. 6310 [RFC4282] Aboba, B., Beadles, M., Arkko, J., and P. Eronen, "The 6311 Network Access Identifier", RFC 4282, December 2005. 6313 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 6314 Requirements for Security", BCP 106, RFC 4086, June 2005. 6316 [RFC4960] Stewart, R., "Stream Control Transmission Protocol", 6317 RFC 4960, September 2007. 6319 [RFC3958] Daigle, L. and A. Newton, "Domain-Based Application 6320 Service Location Using SRV RRs and the Dynamic Delegation 6321 Discovery Service (DDDS)", RFC 3958, January 2005. 6323 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 6324 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 6326 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 6327 Resource Identifier (URI): Generic Syntax", STD 66, 6328 RFC 3986, January 2005. 6330 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 6331 10646", STD 63, RFC 3629, November 2003. 6333 [RFC5890] Klensin, J., "Internationalized Domain Names for 6334 Applications (IDNA): Definitions and Document Framework", 6335 RFC 5890, August 2010. 6337 [RFC5891] Klensin, J., "Internationalized Domain Names in 6338 Applications (IDNA): Protocol", RFC 5891, August 2010. 6340 [RFC3492] Costello, A., "Punycode: A Bootstring encoding of Unicode 6341 for Internationalized Domain Names in Applications 6342 (IDNA)", RFC 3492, March 2003. 6344 [RFC5729] Korhonen, J., Jones, M., Morand, L., and T. Tsou, 6345 "Clarifications on the Routing of Diameter Requests Based 6346 on the Username and the Realm", RFC 5729, December 2009. 6348 [RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 6349 Security", RFC 4347, April 2006. 6351 [RFC6083] Tuexen, M., Seggelmann, R., and E. Rescorla, "Datagram 6352 Transport Layer Security (DTLS) for Stream Control 6353 Transmission Protocol (SCTP)", RFC 6083, January 2011. 6355 14.2. Informational References 6357 [RFC2989] Aboba, B., Calhoun, P., Glass, S., Hiller, T., McCann, P., 6358 Shiino, H., Walsh, P., Zorn, G., Dommety, G., Perkins, C., 6359 Patil, B., Mitton, D., Manning, S., Beadles, M., Chen, X., 6360 Sivalingham, S., Hameed, A., Munson, M., Jacobs, S., Lim, 6361 B., Hirschman, B., Hsu, R., Koo, H., Lipford, M., 6362 Campbell, E., Xu, Y., Baba, S., and E. Jaques, "Criteria 6363 for Evaluating AAA Protocols for Network Access", 6364 RFC 2989, November 2000. 6366 [RFC2975] Aboba, B., Arkko, J., and D. Harrington, "Introduction to 6367 Accounting Management", RFC 2975, October 2000. 6369 [RFC3232] Reynolds, J., "Assigned Numbers: RFC 1700 is Replaced by 6370 an On-line Database", RFC 3232, January 2002. 6372 [RFC5176] Chiba, M., Dommety, G., Eklund, M., Mitton, D., and B. 6373 Aboba, "Dynamic Authorization Extensions to Remote 6374 Authentication Dial In User Service (RADIUS)", RFC 5176, 6375 January 2008. 6377 [RFC1661] Simpson, W., "The Point-to-Point Protocol (PPP)", STD 51, 6378 RFC 1661, July 1994. 6380 [RFC2866] Rigney, C., "RADIUS Accounting", RFC 2866, June 2000. 6382 [RFC2869] Rigney, C., Willats, W., and P. Calhoun, "RADIUS 6383 Extensions", RFC 2869, June 2000. 6385 [RFC2865] Rigney, C., Willens, S., Rubens, A., and W. Simpson, 6386 "Remote Authentication Dial In User Service (RADIUS)", 6387 RFC 2865, June 2000. 6389 [RFC3162] Aboba, B., Zorn, G., and D. Mitton, "RADIUS and IPv6", 6390 RFC 3162, August 2001. 6392 [RFC4301] Kent, S. and K. Seo, "Security Architecture for the 6393 Internet Protocol", RFC 4301, December 2005. 6395 [RFC5905] Mills, D., Martin, J., Burbank, J., and W. Kasch, "Network 6396 Time Protocol Version 4: Protocol and Algorithms 6397 Specification", RFC 5905, June 2010. 6399 [RFC1492] Finseth, C., "An Access Control Protocol, Sometimes Called 6400 TACACS", RFC 1492, July 1993. 6402 [RFC4690] Klensin, J., Faltstrom, P., Karp, C., and IAB, "Review and 6403 Recommendations for Internationalized Domain Names 6404 (IDNs)", RFC 4690, September 2006. 6406 [RFC5461] Gont, F., "TCP's Reaction to Soft Errors", RFC 5461, 6407 February 2009. 6409 [RFC5927] Gont, F., "ICMP Attacks against TCP", RFC 5927, July 2010. 6411 [RFC3692] Narten, T., "Assigning Experimental and Testing Numbers 6412 Considered Useful", BCP 82, RFC 3692, January 2004. 6414 Appendix A. Acknowledgements 6416 A.1. RFC3588bis 6418 The authors would like to thank the following people that have 6419 provided proposals and contributions to this document: 6421 To Vishnu Ram and Satendra Gera for their contributions on 6422 Capabilities Updates, Predictive Loop Avoidance as well as many other 6423 technical proposals. To Tolga Asveren for his insights and 6424 contributions on almost all of the proposed solutions incorporated 6425 into this document. To Timothy Smith for helping on the Capabilities 6426 Updates and other topics. To Tony Zhang for providing fixes to loop 6427 holes on composing Failed-AVPs as well as many other issues and 6428 topics. To Jan Nordqvist for clearly stating the usage of 6429 Application Ids. To Anders Kristensen for providing needed technical 6430 opinions. To David Frascone for providing invaluable review of the 6431 document. To Mark Jones for providing clarifying text on vendor 6432 command codes and other vendor specific indicators. 6434 Special thanks to the Diameter extensibility design team which helped 6435 resolve the tricky question of mandatory AVPs and ABNF semantics. 6436 The members of this team are as follows: 6438 Avi Lior, Jari Arkko, Glen Zorn, Lionel Morand, Mark Jones, Tolga 6439 Asveren Jouni Korhonen, Glenn McGregor. 6441 Special thanks also to people who have provided invaluable comments 6442 and inputs especially in resolving controversial issues: 6444 Glen Zorn, Yoshihiro Ohba, Marco Stura, and Pasi Eronen. 6446 Finally, we would like to thank the original authors of this 6447 document: 6449 Pat Calhoun, John Loughney, Jari Arkko, Erik Guttman and Glen Zorn. 6451 Their invaluable knowledge and experience has given us a robust and 6452 flexible AAA protocol that many people have seen great value in 6453 adopting. We greatly appreciate their support and stewardship for 6454 the continued improvements of Diameter as a protocol. We would also 6455 like to extend our gratitude to folks aside from the authors who have 6456 assisted and contributed to the original version of this document. 6457 Their efforts significantly contributed to the success of Diameter. 6459 A.2. RFC3588 6461 The authors would like to thank Nenad Trifunovic, Tony Johansson and 6462 Pankaj Patel for their participation in the pre-IETF Document Reading 6463 Party. Allison Mankin, Jonathan Wood and Bernard Aboba provided 6464 invaluable assistance in working out transport issues, and similarly 6465 with Steven Bellovin in the security area. 6467 Paul Funk and David Mitton were instrumental in getting the Peer 6468 State Machine correct, and our deep thanks go to them for their time. 6470 Text in this document was also provided by Paul Funk, Mark Eklund, 6471 Mark Jones and Dave Spence. Jacques Caron provided many great 6472 comments as a result of a thorough review of the spec. 6474 The authors would also like to acknowledge the following people for 6475 their contribution in the development of the Diameter protocol: 6477 Allan C. Rubens, Haseeb Akhtar, William Bulley, Stephen Farrell, 6478 David Frascone, Daniel C. Fox, Lol Grant, Ignacio Goyret, Nancy 6479 Greene, Peter Heitman, Fredrik Johansson, Mark Jones, Martin Julien, 6480 Bob Kopacz, Paul Krumviede, Fergal Ladley, Ryan Moats, Victor Muslin, 6481 Kenneth Peirce, John Schnizlein, Sumit Vakil, John R. Vollbrecht and 6482 Jeff Weisberg. 6484 Finally, Pat Calhoun would like to thank Sun Microsystems since most 6485 of the effort put into this document was done while he was in their 6486 employ. 6488 Appendix B. S-NAPTR Example 6490 As an example, consider a client that wishes to resolve aaa: 6491 example1.com. The client performs a NAPTR query for that domain, and 6492 the following NAPTR records are returned: 6494 ;; order pref flags service regexp replacement 6495 IN NAPTR 50 50 "s" "aaa:diameter.tls.tcp" "" 6496 _diameter._tls.example1.com 6497 IN NAPTR 100 50 "s" "aaa:diameter.tcp" "" 6498 _aaa._tcp.example1.com 6499 IN NAPTR 150 50 "s" "aaa:diameter.sctp" "" 6500 _diameter._sctp.example1.com 6502 This indicates that the server supports TLS, TCP and SCTP in that 6503 order. If the client supports TLS, TLS will be used, targeted to a 6504 host determined by an SRV lookup of _diameter._tls.example1.com. 6505 That lookup would return: 6507 ;; Priority Weight Port Target 6508 IN SRV 0 1 5060 server1.example1.com 6509 IN SRV 0 2 5060 server2.example1.com 6511 As an alternative example, a client that wishes to resolve aaa: 6512 example2.com. The client performs a NAPTR query for that domain, and 6513 the following NAPTR records are returned: 6515 ;; order pref flags service regexp replacement 6516 IN NAPTR 150 50 "a" "aaa:diameter.tls.tcp" "" 6517 server1.example2.com 6518 IN NAPTR 150 50 "a" "aaa:diameter.tls.tcp" "" 6519 server2.example2.com 6521 This indicates that the server supports TCP available at the returned 6522 host names. 6524 Appendix C. Duplicate Detection 6526 As described in Section 9.4, accounting record duplicate detection is 6527 based on session identifiers. Duplicates can appear for various 6528 reasons: 6530 o Failover to an alternate server. Where close to real-time 6531 performance is required, failover thresholds need to be kept low 6532 and this may lead to an increased likelihood of duplicates. 6533 Failover can occur at the client or within Diameter agents. 6535 o Failure of a client or agent after sending of a record from non- 6536 volatile memory, but prior to receipt of an application layer ACK 6537 and deletion of the record. record to be sent. This will result 6538 in retransmission of the record soon after the client or agent has 6539 rebooted. 6541 o Duplicates received from RADIUS gateways. Since the 6542 retransmission behavior of RADIUS is not defined within [RFC2865], 6543 the likelihood of duplication will vary according to the 6544 implementation. 6546 o Implementation problems and misconfiguration. 6548 The T flag is used as an indication of an application layer 6549 retransmission event, e.g., due to failover to an alternate server. 6550 It is defined only for request messages sent by Diameter clients or 6551 agents. For instance, after a reboot, a client may not know whether 6552 it has already tried to send the accounting records in its non- 6553 volatile memory before the reboot occurred. Diameter servers MAY use 6554 the T flag as an aid when processing requests and detecting duplicate 6555 messages. However, servers that do this MUST ensure that duplicates 6556 are found even when the first transmitted request arrives at the 6557 server after the retransmitted request. It can be used only in cases 6558 where no answer has been received from the Server for a request and 6559 the request is sent again, (e.g., due to a failover to an alternate 6560 peer, due to a recovered primary peer or due to a client re-sending a 6561 stored record from non-volatile memory such as after reboot of a 6562 client or agent). 6564 In some cases the Diameter accounting server can delay the duplicate 6565 detection and accounting record processing until a post-processing 6566 phase takes place. At that time records are likely to be sorted 6567 according to the included User-Name and duplicate elimination is easy 6568 in this case. In other situations it may be necessary to perform 6569 real-time duplicate detection, such as when credit limits are imposed 6570 or real-time fraud detection is desired. 6572 In general, only generation of duplicates due to failover or re- 6573 sending of records in non-volatile storage can be reliably detected 6574 by Diameter clients or agents. In such cases the Diameter client or 6575 agents can mark the message as possible duplicate by setting the T 6576 flag. Since the Diameter server is responsible for duplicate 6577 detection, it can choose to make use of the T flag or not, in order 6578 to optimize duplicate detection. Since the T flag does not affect 6579 interoperability, and may not be needed by some servers, generation 6580 of the T flag is REQUIRED for Diameter clients and agents, but MAY be 6581 implemented by Diameter servers. 6583 As an example, it can be usually be assumed that duplicates appear 6584 within a time window of longest recorded network partition or device 6585 fault, perhaps a day. So only records within this time window need 6586 to be looked at in the backward direction. Secondly, hashing 6587 techniques or other schemes, such as the use of the T flag in the 6588 received messages, may be used to eliminate the need to do a full 6589 search even in this set except for rare cases. 6591 The following is an example of how the T flag may be used by the 6592 server to detect duplicate requests. 6594 A Diameter server MAY check the T flag of the received message to 6595 determine if the record is a possible duplicate. If the T flag is 6596 set in the request message, the server searches for a duplicate 6597 within a configurable duplication time window backward and 6598 forward. This limits database searching to those records where 6599 the T flag is set. In a well run network, network partitions and 6600 device faults will presumably be rare events, so this approach 6601 represents a substantial optimization of the duplicate detection 6602 process. During failover, it is possible for the original record 6603 to be received after the T flag marked record, due to differences 6604 in network delays experienced along the path by the original and 6605 duplicate transmissions. The likelihood of this occurring 6606 increases as the failover interval is decreased. In order to be 6607 able to detect out of order duplicates, the Diameter server should 6608 use backward and forward time windows when performing duplicate 6609 checking for the T flag marked request. For example, in order to 6610 allow time for the original record to exit the network and be 6611 recorded by the accounting server, the Diameter server can delay 6612 processing records with the T flag set until a time period 6613 TIME_WAIT + RECORD_PROCESSING_TIME has elapsed after the closing 6614 of the original transport connection. After this time period has 6615 expired, then it may check the T flag marked records against the 6616 database with relative assurance that the original records, if 6617 sent, have been received and recorded. 6619 Appendix D. Internationalized Domain Names 6621 To be compatible with the existing DNS infrastructure and simplify 6622 host and domain name comparison, Diameter identities (FQDNs) are 6623 represented in ASCII form. This allows the Diameter protocol to fall 6624 in-line with the DNS strategy of being transparent from the effects 6625 of Internationalized Domain Names (IDNs) by following the 6626 recommendations in [RFC4690] and [RFC5890]. Applications that 6627 provide support for IDNs outside of the Diameter protocol but 6628 interacting with it SHOULD use the representation and conversion 6629 framework described in [RFC5890], [RFC5891] and [RFC3492]. 6631 Authors' Addresses 6633 Victor Fajardo (editor) 6634 Telcordia Technologies 6635 One Telcordia Drive, 1S-222 6636 Piscataway, NJ 08854 6637 USA 6639 Phone: +1-908-421-1845 6640 Email: vf0213@gmail.com 6642 Jari Arkko 6643 Ericsson Research 6644 02420 Jorvas 6645 Finland 6647 Phone: +358 40 5079256 6648 Email: jari.arkko@ericsson.com 6650 John Loughney 6651 Nokia Research Center 6652 955 Page Mill Road 6653 Palo Alto, CA 94304 6654 US 6656 Phone: +1-650-283-8068 6657 Email: john.loughney@nokia.com 6659 Glenn Zorn 6660 Network Zen 6661 1310 East Thomas Street 6662 Seattle, WA 98102 6663 US 6665 Phone: 6666 Email: gwz@net-zen.net