idnits 2.17.1 draft-ietf-dime-rfc3588bis-29.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 are 1 instance 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? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 1770 has weird spacing: '...equired rules...' == Line 6626 has weird spacing: '...service rege...' == Line 6647 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 (August 30, 2011) is 4621 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 6261, but not defined == Missing Reference: 'PXY' is mentioned on line 4282, but not defined -- Possible downref: Non-RFC (?) normative reference: ref. 'FLOATPOINT' -- Possible downref: Non-RFC (?) normative reference: ref. 'IANAADFAM' ** 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: 9 errors (**), 0 flaws (~~), 7 warnings (==), 5 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: March 2, 2012 J. Loughney 7 Nokia Research Center 8 G. Zorn 9 Network Zen 10 August 30, 2011 12 Diameter Base Protocol 13 draft-ietf-dime-rfc3588bis-29.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 obsoletes RFC 3588 and must be supported by all new Diameter 24 implementations. 26 Status of this Memo 28 This Internet-Draft is submitted in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at http://datatracker.ietf.org/drafts/current/. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on March 2, 2012. 43 Copyright Notice 45 Copyright (c) 2011 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents 50 (http://trustee.ietf.org/license-info) in effect on the date of 51 publication of this document. Please review these documents 52 carefully, as they describe your rights and restrictions with respect 53 to this document. Code Components extracted from this document must 54 include Simplified BSD License text as described in Section 4.e of 55 the Trust Legal Provisions and are provided without warranty as 56 described in the Simplified BSD License. 58 Table of Contents 60 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 7 61 1.1. Diameter Protocol . . . . . . . . . . . . . . . . . . . . 9 62 1.1.1. Description of the Document Set . . . . . . . . . . 10 63 1.1.2. Conventions Used in This Document . . . . . . . . . 11 64 1.1.3. Changes from RFC3588 . . . . . . . . . . . . . . . . 11 65 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 13 66 1.3. Approach to Extensibility . . . . . . . . . . . . . . . . 18 67 1.3.1. Defining New AVP Values . . . . . . . . . . . . . . 19 68 1.3.2. Creating New AVPs . . . . . . . . . . . . . . . . . 19 69 1.3.3. Creating New Commands . . . . . . . . . . . . . . . 19 70 1.3.4. Creating New Diameter Applications . . . . . . . . . 20 71 2. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 21 72 2.1. Transport . . . . . . . . . . . . . . . . . . . . . . . . 22 73 2.1.1. SCTP Guidelines . . . . . . . . . . . . . . . . . . 23 74 2.2. Securing Diameter Messages . . . . . . . . . . . . . . . 24 75 2.3. Diameter Application Compliance . . . . . . . . . . . . . 25 76 2.4. Application Identifiers . . . . . . . . . . . . . . . . . 25 77 2.5. Connections vs. Sessions . . . . . . . . . . . . . . . . 25 78 2.6. Peer Table . . . . . . . . . . . . . . . . . . . . . . . 26 79 2.7. Routing Table . . . . . . . . . . . . . . . . . . . . . . 27 80 2.8. Role of Diameter Agents . . . . . . . . . . . . . . . . . 29 81 2.8.1. Relay Agents . . . . . . . . . . . . . . . . . . . . 30 82 2.8.2. Proxy Agents . . . . . . . . . . . . . . . . . . . . 31 83 2.8.3. Redirect Agents . . . . . . . . . . . . . . . . . . 31 84 2.8.4. Translation Agents . . . . . . . . . . . . . . . . . 32 85 2.9. Diameter Path Authorization . . . . . . . . . . . . . . . 33 86 3. Diameter Header . . . . . . . . . . . . . . . . . . . . . . . 34 87 3.1. Command Codes . . . . . . . . . . . . . . . . . . . . . . 37 88 3.2. Command Code ABNF specification . . . . . . . . . . . . . 38 89 3.3. Diameter Command Naming Conventions . . . . . . . . . . . 40 90 4. Diameter AVPs . . . . . . . . . . . . . . . . . . . . . . . . 41 91 4.1. AVP Header . . . . . . . . . . . . . . . . . . . . . . . 41 92 4.1.1. Optional Header Elements . . . . . . . . . . . . . . 43 93 4.2. Basic AVP Data Formats . . . . . . . . . . . . . . . . . 43 94 4.3. Derived AVP Data Formats . . . . . . . . . . . . . . . . 45 95 4.3.1. Common Derived AVPs . . . . . . . . . . . . . . . . 45 97 4.4. Grouped AVP Values . . . . . . . . . . . . . . . . . . . 52 98 4.4.1. Example AVP with a Grouped Data type . . . . . . . . 53 99 4.5. Diameter Base Protocol AVPs . . . . . . . . . . . . . . . 56 100 5. Diameter Peers . . . . . . . . . . . . . . . . . . . . . . . 59 101 5.1. Peer Connections . . . . . . . . . . . . . . . . . . . . 59 102 5.2. Diameter Peer Discovery . . . . . . . . . . . . . . . . . 60 103 5.3. Capabilities Exchange . . . . . . . . . . . . . . . . . . 61 104 5.3.1. Capabilities-Exchange-Request . . . . . . . . . . . 63 105 5.3.2. Capabilities-Exchange-Answer . . . . . . . . . . . . 63 106 5.3.3. Vendor-Id AVP . . . . . . . . . . . . . . . . . . . 64 107 5.3.4. Firmware-Revision AVP . . . . . . . . . . . . . . . 64 108 5.3.5. Host-IP-Address AVP . . . . . . . . . . . . . . . . 64 109 5.3.6. Supported-Vendor-Id AVP . . . . . . . . . . . . . . 65 110 5.3.7. Product-Name AVP . . . . . . . . . . . . . . . . . . 65 111 5.4. Disconnecting Peer connections . . . . . . . . . . . . . 65 112 5.4.1. Disconnect-Peer-Request . . . . . . . . . . . . . . 66 113 5.4.2. Disconnect-Peer-Answer . . . . . . . . . . . . . . . 66 114 5.4.3. Disconnect-Cause AVP . . . . . . . . . . . . . . . . 66 115 5.5. Transport Failure Detection . . . . . . . . . . . . . . . 67 116 5.5.1. Device-Watchdog-Request . . . . . . . . . . . . . . 67 117 5.5.2. Device-Watchdog-Answer . . . . . . . . . . . . . . . 67 118 5.5.3. Transport Failure Algorithm . . . . . . . . . . . . 68 119 5.5.4. Failover and Failback Procedures . . . . . . . . . . 68 120 5.6. Peer State Machine . . . . . . . . . . . . . . . . . . . 69 121 5.6.1. Incoming connections . . . . . . . . . . . . . . . . 71 122 5.6.2. Events . . . . . . . . . . . . . . . . . . . . . . . 72 123 5.6.3. Actions . . . . . . . . . . . . . . . . . . . . . . 73 124 5.6.4. The Election Process . . . . . . . . . . . . . . . . 75 125 6. Diameter message processing . . . . . . . . . . . . . . . . . 75 126 6.1. Diameter Request Routing Overview . . . . . . . . . . . . 75 127 6.1.1. Originating a Request . . . . . . . . . . . . . . . 76 128 6.1.2. Sending a Request . . . . . . . . . . . . . . . . . 77 129 6.1.3. Receiving Requests . . . . . . . . . . . . . . . . . 77 130 6.1.4. Processing Local Requests . . . . . . . . . . . . . 77 131 6.1.5. Request Forwarding . . . . . . . . . . . . . . . . . 78 132 6.1.6. Request Routing . . . . . . . . . . . . . . . . . . 78 133 6.1.7. Predictive Loop Avoidance . . . . . . . . . . . . . 78 134 6.1.8. Redirecting Requests . . . . . . . . . . . . . . . . 78 135 6.1.9. Relaying and Proxying Requests . . . . . . . . . . . 80 136 6.2. Diameter Answer Processing . . . . . . . . . . . . . . . 81 137 6.2.1. Processing received Answers . . . . . . . . . . . . 82 138 6.2.2. Relaying and Proxying Answers . . . . . . . . . . . 82 139 6.3. Origin-Host AVP . . . . . . . . . . . . . . . . . . . . . 82 140 6.4. Origin-Realm AVP . . . . . . . . . . . . . . . . . . . . 83 141 6.5. Destination-Host AVP . . . . . . . . . . . . . . . . . . 83 142 6.6. Destination-Realm AVP . . . . . . . . . . . . . . . . . . 83 143 6.7. Routing AVPs . . . . . . . . . . . . . . . . . . . . . . 84 144 6.7.1. Route-Record AVP . . . . . . . . . . . . . . . . . . 84 145 6.7.2. Proxy-Info AVP . . . . . . . . . . . . . . . . . . . 84 146 6.7.3. Proxy-Host AVP . . . . . . . . . . . . . . . . . . . 84 147 6.7.4. Proxy-State AVP . . . . . . . . . . . . . . . . . . 84 148 6.8. Auth-Application-Id AVP . . . . . . . . . . . . . . . . . 84 149 6.9. Acct-Application-Id AVP . . . . . . . . . . . . . . . . . 85 150 6.10. Inband-Security-Id AVP . . . . . . . . . . . . . . . . . 85 151 6.11. Vendor-Specific-Application-Id AVP . . . . . . . . . . . 85 152 6.12. Redirect-Host AVP . . . . . . . . . . . . . . . . . . . . 86 153 6.13. Redirect-Host-Usage AVP . . . . . . . . . . . . . . . . . 86 154 6.14. Redirect-Max-Cache-Time AVP . . . . . . . . . . . . . . . 88 155 7. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 88 156 7.1. Result-Code AVP . . . . . . . . . . . . . . . . . . . . . 90 157 7.1.1. Informational . . . . . . . . . . . . . . . . . . . 91 158 7.1.2. Success . . . . . . . . . . . . . . . . . . . . . . 91 159 7.1.3. Protocol Errors . . . . . . . . . . . . . . . . . . 91 160 7.1.4. Transient Failures . . . . . . . . . . . . . . . . . 93 161 7.1.5. Permanent Failures . . . . . . . . . . . . . . . . . 94 162 7.2. Error Bit . . . . . . . . . . . . . . . . . . . . . . . . 97 163 7.3. Error-Message AVP . . . . . . . . . . . . . . . . . . . . 97 164 7.4. Error-Reporting-Host AVP . . . . . . . . . . . . . . . . 97 165 7.5. Failed-AVP AVP . . . . . . . . . . . . . . . . . . . . . 98 166 7.6. Experimental-Result AVP . . . . . . . . . . . . . . . . . 99 167 7.7. Experimental-Result-Code AVP . . . . . . . . . . . . . . 99 168 8. Diameter User Sessions . . . . . . . . . . . . . . . . . . . 99 169 8.1. Authorization Session State Machine . . . . . . . . . . . 101 170 8.2. Accounting Session State Machine . . . . . . . . . . . . 105 171 8.3. Server-Initiated Re-Auth . . . . . . . . . . . . . . . . 111 172 8.3.1. Re-Auth-Request . . . . . . . . . . . . . . . . . . 111 173 8.3.2. Re-Auth-Answer . . . . . . . . . . . . . . . . . . . 112 174 8.4. Session Termination . . . . . . . . . . . . . . . . . . . 112 175 8.4.1. Session-Termination-Request . . . . . . . . . . . . 113 176 8.4.2. Session-Termination-Answer . . . . . . . . . . . . . 114 177 8.5. Aborting a Session . . . . . . . . . . . . . . . . . . . 115 178 8.5.1. Abort-Session-Request . . . . . . . . . . . . . . . 115 179 8.5.2. Abort-Session-Answer . . . . . . . . . . . . . . . . 116 180 8.6. Inferring Session Termination from Origin-State-Id . . . 116 181 8.7. Auth-Request-Type AVP . . . . . . . . . . . . . . . . . . 117 182 8.8. Session-Id AVP . . . . . . . . . . . . . . . . . . . . . 118 183 8.9. Authorization-Lifetime AVP . . . . . . . . . . . . . . . 119 184 8.10. Auth-Grace-Period AVP . . . . . . . . . . . . . . . . . . 119 185 8.11. Auth-Session-State AVP . . . . . . . . . . . . . . . . . 119 186 8.12. Re-Auth-Request-Type AVP . . . . . . . . . . . . . . . . 120 187 8.13. Session-Timeout AVP . . . . . . . . . . . . . . . . . . . 120 188 8.14. User-Name AVP . . . . . . . . . . . . . . . . . . . . . . 121 189 8.15. Termination-Cause AVP . . . . . . . . . . . . . . . . . . 121 190 8.16. Origin-State-Id AVP . . . . . . . . . . . . . . . . . . . 122 191 8.17. Session-Binding AVP . . . . . . . . . . . . . . . . . . . 123 192 8.18. Session-Server-Failover AVP . . . . . . . . . . . . . . . 123 193 8.19. Multi-Round-Time-Out AVP . . . . . . . . . . . . . . . . 124 194 8.20. Class AVP . . . . . . . . . . . . . . . . . . . . . . . . 124 195 8.21. Event-Timestamp AVP . . . . . . . . . . . . . . . . . . . 125 196 9. Accounting . . . . . . . . . . . . . . . . . . . . . . . . . 125 197 9.1. Server Directed Model . . . . . . . . . . . . . . . . . . 125 198 9.2. Protocol Messages . . . . . . . . . . . . . . . . . . . . 126 199 9.3. Accounting Application Extension and Requirements . . . . 126 200 9.4. Fault Resilience . . . . . . . . . . . . . . . . . . . . 127 201 9.5. Accounting Records . . . . . . . . . . . . . . . . . . . 128 202 9.6. Correlation of Accounting Records . . . . . . . . . . . . 129 203 9.7. Accounting Command-Codes . . . . . . . . . . . . . . . . 129 204 9.7.1. Accounting-Request . . . . . . . . . . . . . . . . . 129 205 9.7.2. Accounting-Answer . . . . . . . . . . . . . . . . . 130 206 9.8. Accounting AVPs . . . . . . . . . . . . . . . . . . . . . 131 207 9.8.1. Accounting-Record-Type AVP . . . . . . . . . . . . . 131 208 9.8.2. Acct-Interim-Interval AVP . . . . . . . . . . . . . 132 209 9.8.3. Accounting-Record-Number AVP . . . . . . . . . . . . 133 210 9.8.4. Acct-Session-Id AVP . . . . . . . . . . . . . . . . 133 211 9.8.5. Acct-Multi-Session-Id AVP . . . . . . . . . . . . . 133 212 9.8.6. Accounting-Sub-Session-Id AVP . . . . . . . . . . . 133 213 9.8.7. Accounting-Realtime-Required AVP . . . . . . . . . . 134 214 10. AVP Occurrence Table . . . . . . . . . . . . . . . . . . . . 134 215 10.1. Base Protocol Command AVP Table . . . . . . . . . . . . . 135 216 10.2. Accounting AVP Table . . . . . . . . . . . . . . . . . . 136 217 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 137 218 11.1. AVP Header . . . . . . . . . . . . . . . . . . . . . . . 137 219 11.1.1. AVP Codes . . . . . . . . . . . . . . . . . . . . . 138 220 11.1.2. AVP Flags . . . . . . . . . . . . . . . . . . . . . 138 221 11.2. Diameter Header . . . . . . . . . . . . . . . . . . . . . 138 222 11.2.1. Command Codes . . . . . . . . . . . . . . . . . . . 138 223 11.2.2. Command Flags . . . . . . . . . . . . . . . . . . . 139 224 11.3. AVP Values . . . . . . . . . . . . . . . . . . . . . . . 139 225 11.3.1. Experimental-Result-Code AVP . . . . . . . . . . . . 139 226 11.3.2. Result-Code AVP Values . . . . . . . . . . . . . . . 139 227 11.3.3. Accounting-Record-Type AVP Values . . . . . . . . . 139 228 11.3.4. Termination-Cause AVP Values . . . . . . . . . . . . 139 229 11.3.5. Redirect-Host-Usage AVP Values . . . . . . . . . . . 139 230 11.3.6. Session-Server-Failover AVP Values . . . . . . . . . 139 231 11.3.7. Session-Binding AVP Values . . . . . . . . . . . . . 139 232 11.3.8. Disconnect-Cause AVP Values . . . . . . . . . . . . 140 233 11.3.9. Auth-Request-Type AVP Values . . . . . . . . . . . . 140 234 11.3.10. Auth-Session-State AVP Values . . . . . . . . . . . 140 235 11.3.11. Re-Auth-Request-Type AVP Values . . . . . . . . . . 140 236 11.3.12. Accounting-Realtime-Required AVP Values . . . . . . 140 237 11.3.13. Inband-Security-Id AVP (code 299) . . . . . . . . . 140 238 11.4. Diameter TCP, SCTP, TLS/TCP and DTLS/SCTP Port Numbers . 140 239 11.5. SCTP Payload Protocol Identifiers . . . . . . . . . . . . 140 240 11.6. S-NAPTR Parameters . . . . . . . . . . . . . . . . . . . 140 242 12. Diameter protocol related configurable parameters . . . . . . 141 243 13. Security Considerations . . . . . . . . . . . . . . . . . . . 141 244 13.1. TLS/TCP and DTLS/SCTP Usage . . . . . . . . . . . . . . . 142 245 13.2. Peer-to-Peer Considerations . . . . . . . . . . . . . . . 142 246 13.3. AVP Considerations . . . . . . . . . . . . . . . . . . . 143 247 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 143 248 14.1. Normative References . . . . . . . . . . . . . . . . . . 143 249 14.2. Informational References . . . . . . . . . . . . . . . . 145 250 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 146 251 A.1. RFC3588bis . . . . . . . . . . . . . . . . . . . . . . . 146 252 A.2. RFC3588 . . . . . . . . . . . . . . . . . . . . . . . . . 147 253 Appendix B. S-NAPTR Example . . . . . . . . . . . . . . . . . . 148 254 Appendix C. Duplicate Detection . . . . . . . . . . . . . . . . 148 255 Appendix D. Internationalized Domain Names . . . . . . . . . . . 150 256 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 151 258 1. Introduction 260 Authentication, Authorization and Accounting (AAA) protocols such as 261 TACACS [RFC1492] and RADIUS [RFC2865] were initially deployed to 262 provide dial-up PPP [RFC1661] and terminal server access. Over time, 263 AAA support was needed on many new access technologies, the scale and 264 complexity of AAA networks grew, and AAA was also used on new 265 applications (such as voice over IP). This lead to new demands on 266 AAA protocols. 268 Network access requirements for AAA protocols are summarized in 269 [RFC2989]. These include: 271 Failover 273 [RFC2865] does not define failover mechanisms, and as a result, 274 failover behavior differs between implementations. In order to 275 provide well-defined failover behavior, Diameter supports 276 application-layer acknowledgements, and defines failover 277 algorithms and the associated state machine. This is described in 278 Section 5.5 and [RFC3539]. 280 Transmission-level security 282 [RFC2865] defines an application-layer authentication and 283 integrity scheme that is required only for use with Response 284 packets. While [RFC2869] defines an additional authentication and 285 integrity mechanism, use is only required during Extensible 286 Authentication Protocol (EAP) [RFC3748] sessions. While 287 attribute-hiding is supported, [RFC2865] does not provide support 288 for per-packet confidentiality. In accounting, [RFC2866] assumes 289 that replay protection is provided by the backend billing server, 290 rather than within the protocol itself. 292 While [RFC3162] defines the use of IPsec with RADIUS, support for 293 IPsec is not required. In order to provide universal support for 294 transmission-level security, and enable both intra- and inter- 295 domain AAA deployments, Diameter provides support for TLS/TCP and 296 DTLS/SCTP. Security is discussed in Section 13. 298 Reliable transport 300 RADIUS runs over UDP, and does not define retransmission behavior; 301 as a result, reliability varies between implementations. As 302 described in [RFC2975], this is a major issue in accounting, where 303 packet loss may translate directly into revenue loss. In order to 304 provide well defined transport behavior, Diameter runs over 305 reliable transport mechanisms (TCP, SCTP) as defined in [RFC3539]. 307 Agent support 309 [RFC2865] does not provide for explicit support for agents, 310 including Proxies, Redirects and Relays. Since the expected 311 behavior is not defined, it varies between implementations. 312 Diameter defines agent behavior explicitly; this is described in 313 Section 2.8. 315 Server-initiated messages 317 While RADIUS server-initiated messages are defined in [RFC5176], 318 support is optional. This makes it difficult to implement 319 features such as unsolicited disconnect or re-authentication/ 320 re-authorization on demand across a heterogeneous deployment. To 321 tackle this issue, support for server-initiated messages is 322 mandatory in Diameter. 324 Transition support 326 While Diameter does not share a common protocol data unit (PDU) 327 with RADIUS, considerable effort has been expended in enabling 328 backward compatibility with RADIUS, so that the two protocols may 329 be deployed in the same network. Initially, it is expected that 330 Diameter will be deployed within new network devices, as well as 331 within gateways enabling communication between legacy RADIUS 332 devices and Diameter agents. This capability enables Diameter 333 support to be added to legacy networks, by addition of a gateway 334 or server speaking both RADIUS and Diameter. 336 In addition to addressing the above requirements, Diameter also 337 provides support for the following: 339 Capability negotiation 341 RADIUS does not support error messages, capability negotiation, or 342 a mandatory/non-mandatory flag for attributes. Since RADIUS 343 clients and servers are not aware of each other's capabilities, 344 they may not be able to successfully negotiate a mutually 345 acceptable service, or in some cases, even be aware of what 346 service has been implemented. Diameter includes support for error 347 handling (Section 7), capability negotiation (Section 5.3), and 348 mandatory/non-mandatory Attribute-Value Pairs (AVPs) (Section 349 4.1). 351 Peer discovery and configuration 353 RADIUS implementations typically require that the name or address 354 of servers or clients be manually configured, along with the 355 corresponding shared secrets. This results in a large 356 administrative burden, and creates the temptation to reuse the 357 RADIUS shared secret, which can result in major security 358 vulnerabilities if the Request Authenticator is not globally and 359 temporally unique as required in [RFC2865]. Through DNS, Diameter 360 enables dynamic discovery of peers (see Section 5.2). Derivation 361 of dynamic session keys is enabled via transmission-level 362 security. 364 Over time, the capabilities of Network Access Server (NAS) devices 365 have increased substantially. As a result, while Diameter is a 366 considerably more sophisticated protocol than RADIUS, it remains 367 feasible to implement it within embedded devices. 369 1.1. Diameter Protocol 371 The Diameter base protocol provides the following facilities: 373 o Ability to exchange messages and deliver AVPs 375 o Capabilities negotiation 377 o Error notification 379 o Extensibility, through addition of new applications, commands and 380 AVPs (required in [RFC2989]). 382 o Basic services necessary for applications, such as handling of 383 user sessions or accounting 385 All data delivered by the protocol is in the form of AVPs. Some of 386 these AVP values are used by the Diameter protocol itself, while 387 others deliver data associated with particular applications that 388 employ Diameter. AVPs may be arbitrarily added to Diameter messages, 389 the only restriction being that the Augmented Backus-Naur Form (ABNF, 390 [RFC5234]) Command Code syntax specification (Section 3.2) is 391 satisfied. AVPs are used by the base Diameter protocol to support 392 the following required features: 394 o Transporting of user authentication information, for the purposes 395 of enabling the Diameter server to authenticate the user. 397 o Transporting of service-specific authorization information, 398 between client and servers, allowing the peers to decide whether a 399 user's access request should be granted. 401 o Exchanging resource usage information, which may be used for 402 accounting purposes, capacity planning, etc. 404 o Routing, relaying, proxying and redirecting of Diameter messages 405 through a server hierarchy. 407 The Diameter base protocol satisfies the minimum requirements for an 408 AAA protocol, as specified by [RFC2989]. The base protocol may be 409 used by itself for accounting purposes only, or it may be used with a 410 Diameter application, such as Mobile IPv4 [RFC4004], or network 411 access [RFC4005]. It is also possible for the base protocol to be 412 extended for use in new applications, via the addition of new 413 commands or AVPs. The initial focus of Diameter was network access 414 and accounting applications. A truly generic AAA protocol used by 415 many applications might provide functionality not provided by 416 Diameter. Therefore, it is imperative that the designers of new 417 applications understand their requirements before using Diameter. 418 See Section 2.4 for more information on Diameter applications. 420 Any node can initiate a request. In that sense, Diameter is a peer- 421 to-peer protocol. In this document, a Diameter Client is a device at 422 the edge of the network that performs access control, such as a 423 Network Access Server (NAS) or a Foreign Agent (FA). A Diameter 424 client generates Diameter messages to request authentication, 425 authorization, and accounting services for the user. A Diameter 426 agent is a node that does not provide local user authentication or 427 authorization services; agents include proxies, redirects and relay 428 agents. A Diameter server performs authentication and/or 429 authorization of the user. A Diameter node may act as an agent for 430 certain requests while acting as a server for others. 432 The Diameter protocol also supports server-initiated messages, such 433 as a request to abort service to a particular user. 435 1.1.1. Description of the Document Set 437 The Diameter specification consists of an updated version of the base 438 protocol specification (this document) and the Transport Profile 439 [RFC3539]. This document obsoletes RFC 3588. A summary of the base 440 protocol updates included in this document can be found in 441 Section 1.1.3. 443 This document defines the base protocol specification for AAA, which 444 includes support for accounting. There are also a myriad of 445 applications documents describing applications that use this base 446 specification for Authentication, Authorization and Accounting. 447 These application documents specify how to use the Diameter protocol 448 within the context of their application. 450 The Transport Profile document [RFC3539] discusses transport layer 451 issues that arise with AAA protocols and recommendations on how to 452 overcome these issues. This document also defines the Diameter 453 failover algorithm and state machine. 455 Clarifications on the Routing of Diameter Request based on Username 456 and the Realm [RFC5729] defines specific behavior on how to route 457 request based on the content of the User-Name AVP (Attribute Value 458 Pair). 460 1.1.2. Conventions Used in This Document 462 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 463 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 464 document are to be interpreted as described in [RFC2119]. 466 1.1.3. Changes from RFC3588 468 This document obsoletes RFC 3588 but is fully backward compatible 469 with that document. The changes introduced in this document focus on 470 fixing issues that have surfaced during implementation of [RFC3588]. 471 An overview of some the major changes are given below. 473 o Deprecated the use of Inband-Security AVP for negotiating 474 transport layer security. It has been generally considered that 475 bootstrapping of TLS via Inband-Security AVP creates certain 476 security risk because it does not completely protect the 477 information carried in the CER (Capabilities Exchange Request)/CEA 478 (Capabilities Exchange Answer). This version of Diameter adopted 479 a common approach of defining a well-known secured port that peers 480 should use when communicating via TLS/TCP and DTLS/SCTP. This new 481 approach augments the existing Inband-Security negotiation but 482 does not completely replace it. The old method is kept for 483 backwards compatibility reasons. 485 o Deprecated the exchange of CER/CEA messages in the open state. 486 This feature was implied in the peer state machine table of 487 [RFC3588] but it was not clearly defined anywhere else in that 488 document. As work on this document progressed, it became clear 489 that the multiplicity of meaning and use of Application Id AVPs in 490 the CER/CEA messages (and the messages themselves) is seen as an 491 abuse of the Diameter extensibility rules and thus required 492 simplification. It is assumed that the capabilities exchange in 493 the open state will be re-introduced in a separate specification 494 which clearly defines new commands for this feature. 496 o Simplified Security Requirements. The use of a secured transport 497 for exchanging Diameter messages remains mandatory. However, TLS/ 498 TCP and DTLS/SCTP has become the primary method of securing 499 Diameter and IPsec is a secondary alternative. See Section 13 for 500 details. The support for the End-to-End security framework (E2E- 501 Sequence AVP and 'P'-bit in the AVP header) has also been 502 deprecated. 504 o Diameter Extensibility Changes. This includes fixes to the 505 Diameter extensibility description (Section 1.3 and others) to 506 better aid Diameter application designers; in addition, the new 507 specification relaxes the policy with respect to the allocation of 508 command codes for vendor-specific uses. 510 o Application Id Usage. Clarify the proper use of Application Id 511 information which can be found in multiple places within a 512 Diameter message. This includes correlating Application Ids found 513 in the message headers and AVPs. These changes also clearly 514 specify the proper Application Id value to use for specific base 515 protocol messages (ASR/ASA, STR/STA) as well as clarifying the 516 content and use of Vendor-Specific-Application-Id. 518 o Routing Fixes. This document more clearly specifies what 519 information (AVPs and Application Id) can be used for making 520 general routing decisions. A rule for the prioritization of 521 redirect routing criteria when multiple route entries are found 522 via redirects has also been added (See Section 6.13 for details). 524 o Simplification of Diameter Peer Discovery. The Diameter discovery 525 process now supports only widely used discovery schemes; the rest 526 have been deprecated (see Section 5.2 for details). 528 There are many other many miscellaneous fixes that have been 529 introduced in this document that may not be considered significant 530 but they are important nonetheless. Examples are removal of obsolete 531 types, fixes to command ABNFs, fixes to the state machine, 532 clarification of the election process, message validation, fixes to 533 Failed-AVP and Result-Code AVP values, etc. A comprehensive list of 534 changes is not shown here for practical reasons. 536 1.2. Terminology 538 AAA 540 Authentication, Authorization and Accounting. 542 ABNF 544 Augmented Backus-Naur Form [RFC5234]. A metalanguage with its own 545 formal syntax and rules. It is based on the Backus-Naur Form and 546 is used to define message exchanges in a bi-directional 547 communications protocol. 549 Accounting 551 The act of collecting information on resource usage for the 552 purpose of capacity planning, auditing, billing or cost 553 allocation. 555 Accounting Record 557 An accounting record represents a summary of the resource 558 consumption of a user over the entire session. Accounting servers 559 creating the accounting record may do so by processing interim 560 accounting events or accounting events from several devices 561 serving the same user. 563 Authentication 565 The act of verifying the identity of an entity (subject). 567 Authorization 569 The act of determining whether a requesting entity (subject) will 570 be allowed access to a resource (object). 572 AVP 574 The Diameter protocol consists of a header followed by one or more 575 Attribute-Value-Pairs (AVPs). An AVP includes a header and is 576 used to encapsulate protocol-specific data (e.g., routing 577 information) as well as authentication, authorization or 578 accounting information. 580 Diameter Agent 582 A Diameter Agent is a Diameter Node that provides either relay, 583 proxy, redirect or translation services. 585 Diameter Client 587 A Diameter Client is a Diameter Node that supports Diameter client 588 applications as well as the base protocol. Diameter Clients are 589 often implemented in devices situated at the edge of a network and 590 provide access control services for that network. Typical 591 examples of Diameter Clients include the Network Access Server 592 (NAS) and the Mobile IP Foreign Agent (FA). 594 Diameter Node 596 A Diameter Node is a host process that implements the Diameter 597 protocol, and acts either as a Client, Agent or Server. 599 Diameter Peer 601 Two Diameter Nodes sharing a direct TCP or SCTP transport 602 connection are called Diameter Peers. 604 Diameter Server 606 A Diameter Server is a Diameter Node that handles authentication, 607 authorization and accounting requests for a particular realm. By 608 its very nature, a Diameter Server must support Diameter server 609 applications in addition to the base protocol. 611 Downstream 613 Downstream is used to identify the direction of a particular 614 Diameter message from the Home Server towards the Diameter Client. 616 Home Realm 618 A Home Realm is the administrative domain with which the user 619 maintains an account relationship. 621 Home Server 623 A Diameter Server which serves the Home Realm. 625 Interim accounting 627 An interim accounting message provides a snapshot of usage during 628 a user's session. It is typically implemented in order to provide 629 for partial accounting of a user's session in the case a device 630 reboot or other network problem prevents the delivery of a session 631 summary message or session record. 633 Local Realm 635 A local realm is the administrative domain providing services to a 636 user. An administrative domain may act as a local realm for 637 certain users, while being a home realm for others. 639 Multi-session 641 A multi-session represents a logical linking of several sessions. 642 Multi-sessions are tracked by using the Acct-Multi-Session-Id. An 643 example of a multi-session would be a Multi-link PPP bundle. Each 644 leg of the bundle would be a session while the entire bundle would 645 be a multi-session. 647 Network Access Identifier 649 The Network Access Identifier, or NAI [RFC4282], is used in the 650 Diameter protocol to extract a user's identity and realm. The 651 identity is used to identify the user during authentication and/or 652 authorization, while the realm is used for message routing 653 purposes. 655 Proxy Agent or Proxy 657 In addition to forwarding requests and responses, proxies make 658 policy decisions relating to resource usage and provisioning. 659 This is typically accomplished by tracking the state of NAS 660 devices. While proxies typically do not respond to client 661 Requests prior to receiving a Response from the server, they may 662 originate Reject messages in cases where policies are violated. 663 As a result, proxies need to understand the semantics of the 664 messages passing through them, and may not support all Diameter 665 applications. 667 Realm 669 The string in the NAI that immediately follows the '@' character. 670 NAI realm names are required to be unique, and are piggybacked on 671 the administration of the DNS namespace. Diameter makes use of 672 the realm, also loosely referred to as domain, to determine 673 whether messages can be satisfied locally, or whether they must be 674 routed or redirected. In RADIUS, realm names are not necessarily 675 piggybacked on the DNS namespace but may be independent of it. 677 Real-time Accounting 679 Real-time accounting involves the processing of information on 680 resource usage within a defined time window. Time constraints are 681 typically imposed in order to limit financial risk. The Diameter 682 Credit Control Application [RFC4006] is an example of an 683 application that defines real-time accounting functionality. 685 Relay Agent or Relay 687 Relays forward requests and responses based on routing-related 688 AVPs and routing table entries. Since relays do not make policy 689 decisions, they do not examine or alter non-routing AVPs. As a 690 result, relays never originate messages, do not need to understand 691 the semantics of messages or non-routing AVPs, and are capable of 692 handling any Diameter application or message type. Since relays 693 make decisions based on information in routing AVPs and realm 694 forwarding tables they do not keep state on NAS resource usage or 695 sessions in progress. 697 Redirect Agent 699 Rather than forwarding requests and responses between clients and 700 servers, redirect agents refer clients to servers and allow them 701 to communicate directly. Since redirect agents do not sit in the 702 forwarding path, they do not alter any AVPs transiting between 703 client and server. Redirect agents do not originate messages and 704 are capable of handling any message type, although they may be 705 configured only to redirect messages of certain types, while 706 acting as relay or proxy agents for other types. As with relay 707 agents, redirect agents do not keep state with respect to sessions 708 or NAS resources. 710 Session 712 A session is a related progression of events devoted to a 713 particular activity. Diameter application documents provide 714 guidelines as to when a session begins and ends. All Diameter 715 packets with the same Session-Id are considered to be part of the 716 same session. 718 Stateful Agent 720 A stateful agent is one that maintains session state information, 721 by keeping track of all authorized active sessions. Each 722 authorized session is bound to a particular service, and its state 723 is considered active either until it is notified otherwise, or by 724 expiration. 726 Sub-session 728 A sub-session represents a distinct service (e.g., QoS or data 729 characteristics) provided to a given session. These services may 730 happen concurrently (e.g., simultaneous voice and data transfer 731 during the same session) or serially. These changes in sessions 732 are tracked with the Accounting-Sub-Session-Id. 734 Transaction state 736 The Diameter protocol requires that agents maintain transaction 737 state, which is used for failover purposes. Transaction state 738 implies that upon forwarding a request, the Hop-by-Hop identifier 739 is saved; the field is replaced with a locally unique identifier, 740 which is restored to its original value when the corresponding 741 answer is received. The request's state is released upon receipt 742 of the answer. A stateless agent is one that only maintains 743 transaction state. 745 Translation Agent 747 A translation agent is a stateful Diameter node that performs 748 protocol translation between Diameter and another AAA protocol, 749 such as RADIUS. 751 Upstream 753 Upstream is used to identify the direction of a particular 754 Diameter message from the Diameter Client towards the Home Server. 756 User 758 The entity or device requesting or using some resource, in support 759 of which a Diameter client has generated a request. 761 1.3. Approach to Extensibility 763 The Diameter protocol is designed to be extensible, using several 764 mechanisms, including: 766 o Defining new AVP values 768 o Creating new AVPs 770 o Creating new commands 772 o Creating new applications 774 From the point of view of extensibility Diameter authentication, 775 authorization and accounting applications are treated in the same 776 way. 778 Note: Protocol designers should try to re-use existing functionality, 779 namely AVP values, AVPs, commands, and Diameter applications. Reuse 780 simplifies standardization and implementation. To avoid potential 781 interoperability issues it is important to ensure that the semantics 782 of the re-used features are well understood. Given that Diameter can 783 also carry RADIUS attributes as Diameter AVPs, such re-use 784 considerations apply also to existing RADIUS attributes that may be 785 useful in a Diameter application. 787 1.3.1. Defining New AVP Values 789 In order to allocate a new AVP value for AVPs defined in the Diameter 790 Base protocol, the IETF needs to approve a new RFC that describes the 791 AVP value. IANA considerations for these AVP values are discussed in 792 Section 11.4. 794 The allocation of AVP values for other AVPs is guided by the IANA 795 considerations of the document that defines those AVPs. Typically, 796 allocation of new values for an AVP defined in an IETF RFC should 797 require IETF Review [RFC5226], whereas values for vendor-specific 798 AVPs can be allocated by the vendor. 800 1.3.2. Creating New AVPs 802 A new AVP being defined MUST use one of the data types listed in 803 Section 4.2 or Section 4.3. If an appropriate derived data type is 804 already defined, it SHOULD be used instead of a base data type to 805 encourage reusability and good design practice. 807 In the event that a logical grouping of AVPs is necessary, and 808 multiple "groups" are possible in a given command, it is recommended 809 that a Grouped AVP be used (see Section 4.4). 811 The creation of new AVPs can happen in various ways. The recommended 812 approach is to define a new general-purpose AVP in a standards track 813 RFC approved by the IETF. However, as described in Section 11.1.1 814 there are also other mechanisms. 816 1.3.3. Creating New Commands 818 A new Command Code MUST be allocated when required AVPs (those 819 indicated as {AVP} in the ABNF definition) are added to, deleted from 820 or redefined in (for example, by changing a required AVP into an 821 optional one) an existing command. 823 Furthermore, if the transport characteristics of a command are 824 changed (for example, with respect to the number of round trips 825 required) a new Command Code MUST be registered. 827 A change to the ABNF of a command, such as described above, MUST 828 result in the definition of a new Command Code. This subsequently 829 leads to the need to define a new Diameter Application for any 830 application that will use that new Command. 832 The IANA considerations for commands are discussed in Section 11.2.1. 834 1.3.4. Creating New Diameter Applications 836 Every Diameter application specification MUST have an IANA assigned 837 Application Id (see Section 2.4 and Section 11.3). The managed 838 Application Id space is flat and there is no relationship between 839 different Diameter applications with respect to their Application 840 Ids. As such, there is no versioning support provided by these 841 application Ids itself; every Diameter application is a standalone 842 application. If the application has a relationship with other 843 Diameter applications, such a relationship is not known to Diameter. 845 Before describing the rules for creating new Diameter applications it 846 is important to discuss the semantics of the AVPs occurrences as 847 stated in the ABNF and the M-bit flag (Section 4.1) for an AVP. 848 There is no relationship imposed between the two; they are set 849 independently. 851 o The ABNF indicates what AVPs are placed into a Diameter Command by 852 the sender of that Command. Often, since there are multiple modes 853 of protocol interactions many of the AVPs are indicated as 854 optional. 856 o The M-bit allows the sender to indicate to the receiver whether or 857 not understanding the semantics of an AVP and its content is 858 mandatory. If the M-bit is set by the sender and the receiver 859 does not understand the AVP or the values carried within that AVP 860 then a failure is generated (see Section 7). 862 It is the decision of the protocol designer when to develop a new 863 Diameter application rather than extending Diameter in other ways. 864 However, a new Diameter application MUST be created when one or more 865 of the following criteria are met: 867 M-bit Setting 869 An AVP with the M-bit in the MUST column of the AVP flag table is 870 added to an existing Command/Application. 872 An AVP with the M-bit in the MAY column of the AVP flag table is 873 added to an existing Command/Application. 875 Note: The M-bit setting for a given AVP is relevant to an 876 Application and each command within that application which 877 includes the AVP. That is, if an AVP appears in two commands for 878 application Foo and the M-bit settings are different in each 879 command, then there should be two AVP flag tables describing when 880 to set the M-bit. 882 Commands 884 A new command is used within the existing application either 885 because an additional command is added, an existing command has 886 been modified so that a new Command Code had to be registered, or 887 a command has been deleted. 889 AVP Flag bits 891 An existing application changes the meaning/semantics of their AVP 892 Flags or adds new flag bits then a new Diameter application MUST 893 be created. 895 If the ABNF definition of a command allows it, an implementation may 896 add arbitrary optional AVPs with the M-bit cleared (including vendor- 897 specific AVPs) to that command without needing to define a new 898 application. Please refer to Section 11.1.1 for details. 900 2. Protocol Overview 902 The base Diameter protocol concerns itself with establishing 903 connections to peers, capabilities negotiation, how messages are sent 904 and routed through peers, and how the connections are eventually torn 905 down. The base protocol also defines certain rules that apply to all 906 message exchanges between Diameter nodes. 908 Communication between Diameter peers begins with one peer sending a 909 message to another Diameter peer. The set of AVPs included in the 910 message is determined by a particular Diameter application. One AVP 911 that is included to reference a user's session is the Session-Id. 913 The initial request for authentication and/or authorization of a user 914 would include the Session-Id AVP. The Session-Id is then used in all 915 subsequent messages to identify the user's session (see Section 8 for 916 more information). The communicating party may accept the request, 917 or reject it by returning an answer message with the Result-Code AVP 918 set to indicate an error occurred. The specific behavior of the 919 Diameter server or client receiving a request depends on the Diameter 920 application employed. 922 Session state (associated with a Session-Id) MUST be freed upon 923 receipt of the Session-Termination-Request, Session-Termination- 924 Answer, expiration of authorized service time in the Session-Timeout 925 AVP, and according to rules established in a particular Diameter 926 application. 928 The base Diameter protocol may be used by itself for accounting 929 applications. For authentication and authorization, it is always 930 extended for a particular application. 932 Diameter Clients MUST support the base protocol, which includes 933 accounting. In addition, they MUST fully support each Diameter 934 application that is needed to implement the client's service, e.g., 935 NASREQ and/or Mobile IPv4. A Diameter Client MUST be referred to as 936 "Diameter X Client" where X is the application which it supports, and 937 not a "Diameter Client". 939 Diameter Servers MUST support the base protocol, which includes 940 accounting. In addition, they MUST fully support each Diameter 941 application that is needed to implement the intended service, e.g., 942 NASREQ and/or Mobile IPv4. A Diameter Server MUST be referred to as 943 "Diameter X Server" where X is the application which it supports, and 944 not a "Diameter Server". 946 Diameter Relays and redirect agents are transparent to the Diameter 947 applications but they MUST support the Diameter base protocol, which 948 includes accounting, and all Diameter applications. 950 Diameter proxies MUST support the base protocol, which includes 951 accounting. In addition, they MUST fully support each Diameter 952 application that is needed to implement proxied services, e.g., 953 NASREQ and/or Mobile IPv4. A Diameter proxy MUST be referred to as 954 "Diameter X Proxy" where X is the application which it supports, and 955 not a "Diameter Proxy". 957 2.1. Transport 959 The Diameter Transport profile is defined in [RFC3539]. 961 The base Diameter protocol is run on port 3868 for both TCP [RFC793] 962 and SCTP [RFC4960]. For TLS [RFC5246] and DTLS [RFC4347], a Diameter 963 node that initiate a connection prior to any message exchanges MUST 964 run on port [TBD]. It is assumed that TLS is run on top of TCP when 965 it is used and DTLS is run on top of SCTP when it is used. 967 If the Diameter peer does not support receiving TLS/TCP and DTLS/SCTP 968 connections on port [TBD], i.e. the peer complies only with 969 [RFC3588], then the initiator MAY revert to using TCP or SCTP and on 970 port 3868. Note that this scheme is kept for the purpose of 971 backwards compatibility only and that there are inherent security 972 vulnerabilities when the initial CER/CEA messages are sent un- 973 protected (see Section 5.6). 975 Diameter clients MUST support either TCP or SCTP, while agents and 976 servers SHOULD support both. 978 A Diameter node MAY initiate connections from a source port other 979 than the one that it declares it accepts incoming connections on, and 980 MUST be prepared to receive connections on port 3868 for TCP or SCTP 981 and port [TBD] for TLS/TCP and DTLS/SCTP connections. A given 982 Diameter instance of the peer state machine MUST NOT use more than 983 one transport connection to communicate with a given peer, unless 984 multiple instances exist on the peer in which case a separate 985 connection per process is allowed. 987 When no transport connection exists with a peer, an attempt to 988 connect SHOULD be periodically made. This behavior is handled via 989 the Tc timer (see Section 12 for details), whose recommended value is 990 30 seconds. There are certain exceptions to this rule, such as when 991 a peer has terminated the transport connection stating that it does 992 not wish to communicate. 994 When connecting to a peer and either zero or more transports are 995 specified, TLS SHOULD be tried first, followed by DTLS, then by TCP 996 and finally by SCTP. See Section 5.2 for more information on peer 997 discovery. 999 Diameter implementations SHOULD be able to interpret ICMP protocol 1000 port unreachable messages as explicit indications that the server is 1001 not reachable, subject to security policy on trusting such messages. 1002 Further guidance regarding the treatment of ICMP errors can be found 1003 in [RFC5927] and [RFC5461]. Diameter implementations SHOULD also be 1004 able to interpret a reset from the transport and timed-out connection 1005 attempts. If Diameter receives data from the lower layer that cannot 1006 be parsed or identified as a Diameter error made by the peer, the 1007 stream is compromised and cannot be recovered. The transport 1008 connection MUST be closed using a RESET call (send a TCP RST bit) or 1009 an SCTP ABORT message (graceful closure is compromised). 1011 2.1.1. SCTP Guidelines 1013 Diameter messages SHOULD be mapped into SCTP streams in a way that 1014 avoids head-of-the-line (HOL) blocking. Among different ways of 1015 performing the mapping that fulfill this requirement it is 1016 RECOMMENDED that a Diameter node sends every Diameter message 1017 (request or response) over the stream zero with the unordered flag 1018 set. However, Diameter nodes MAY select and implement other design 1019 alternatives for avoiding HOL blocking such as using multiple streams 1020 with the unordered flag cleared (as originally instructed in 1021 RFC3588). On the receiving side, a Diameter entity MUST be ready to 1022 receive Diameter messages over any stream and it is free to return 1023 responses over a different stream. This way, both sides manage the 1024 available streams in the sending direction, independently of the 1025 streams chosen by the other side to send a particular Diameter 1026 message. These messages can be out-of-order and belong to different 1027 Diameter sessions. 1029 Out-of-order delivery has special concerns during a connection 1030 establishment and termination. When a connection is established, the 1031 responder side sends a CEA message and moves to R-Open state as 1032 specified in Section 5.6. If an application message is sent shortly 1033 after the CEA and delivered out-of-order, the initiator side, still 1034 in Wait-I-CEA state, will discard the application message and close 1035 the connection. In order to avoid this race condition, the receiver 1036 side SHOULD NOT use out-of-order delivery methods until the first 1037 message has been received from the initiator, proving that it has 1038 moved to I-Open state. To trigger such message, the receiver side 1039 could send a DWR immediatly after sending CEA. Upon reception of the 1040 corresponding DWA, the receiver side should start using out-of-order 1041 delivery methods to counter the HOL blocking. 1043 Another race condition may occur when DPR and DPA messages are used. 1044 Both DPR and DPA are small in size, thus they may be delivered faster 1045 to the peer than application messages when out-of-order delivery 1046 mechanism is used. Therefore, it is possible that a DPR/DPA exchange 1047 completes while application messages are still in transit, resulting 1048 to a loss of these messages. An implementation could mitigate this 1049 race condition, for example, using timers and wait for a short period 1050 of time for pending application level messages to arrive before 1051 proceeding to disconnect the transport connection. Eventually, lost 1052 messages are handled by the retransmission mechanism described in 1053 Section 5.5.4. 1055 A Diameter agent SHOULD use dedicated payload protocol identifiers 1056 (PPID) for clear text and encrypted SCTP DATA chunks instead of only 1057 using the unspecified payload protocol identifier (value 0). For 1058 this purpose two PPID values are allocated. The PPID value TBD2 is 1059 for Diameter messages in clear text SCTP DATA chunks and the PPID 1060 value TBD3 is for Diameter messages in protected DTLS/SCTP DATA 1061 chunks. 1063 2.2. Securing Diameter Messages 1065 Connections between Diameter peers SHOULD be protected by TLS/TCP and 1066 DTLS/SCTP. All Diameter base protocol implementations MUST support 1067 the use of TLS/TCP and DTLS/SCTP. If desired, alternative security 1068 mechanisms that are independent of Diameter, such as IPsec [RFC4301], 1069 can be deployed to secure connections between peers. The Diameter 1070 protocol MUST NOT be used without any security mechanism. 1072 2.3. Diameter Application Compliance 1074 Application Ids are advertised during the capabilities exchange phase 1075 (see Section 5.3). Advertising support of an application implies 1076 that the sender supports the functionality specified in the 1077 respective Diameter application specification. 1079 Implementations MAY add arbitrary optional AVPs with the M-bit 1080 cleared (including vendor-specific AVPs) to a command defined in an 1081 application, but only if the command's ABNF syntax specification 1082 allows for it. Please refer to Section 11.1.1 for details. 1084 2.4. Application Identifiers 1086 Each Diameter application MUST have an IANA assigned Application Id 1087 (see Section 11.3). The base protocol does not require an 1088 Application Id since its support is mandatory. During the 1089 capabilities exchange, Diameter nodes inform their peers of locally 1090 supported applications. Furthermore, all Diameter messages contain 1091 an Application Id, which is used in the message forwarding process. 1093 The following Application Id values are defined: 1095 Diameter Common Messages 0 1096 Diameter Base Accounting 3 1097 Relay 0xffffffff 1099 Relay and redirect agents MUST advertise the Relay Application 1100 Identifier, while all other Diameter nodes MUST advertise locally 1101 supported applications. The receiver of a Capabilities Exchange 1102 message advertising Relay service MUST assume that the sender 1103 supports all current and future applications. 1105 Diameter relay and proxy agents are responsible for finding an 1106 upstream server that supports the application of a particular 1107 message. If none can be found, an error message is returned with the 1108 Result-Code AVP set to DIAMETER_UNABLE_TO_DELIVER. 1110 2.5. Connections vs. Sessions 1112 This section attempts to provide the reader with an understanding of 1113 the difference between connection and session, which are terms used 1114 extensively throughout this document. 1116 A connection refers to a transport level connection between two peers 1117 that is used to send and receive Diameter messages. A session is a 1118 logical concept at the application layer existing between the 1119 Diameter client and the Diameter server; it is identified via the 1120 Session-Id AVP. 1122 +--------+ +-------+ +--------+ 1123 | Client | | Relay | | Server | 1124 +--------+ +-------+ +--------+ 1125 <----------> <----------> 1126 peer connection A peer connection B 1128 <-----------------------------> 1129 User session x 1131 Figure 1: Diameter connections and sessions 1133 In the example provided in Figure 1, peer connection A is established 1134 between the Client and the Relay. Peer connection B is established 1135 between the Relay and the Server. User session X spans from the 1136 Client via the Relay to the Server. Each "user" of a service causes 1137 an auth request to be sent, with a unique session identifier. Once 1138 accepted by the server, both the client and the server are aware of 1139 the session. 1141 It is important to note that there is no relationship between a 1142 connection and a session, and that Diameter messages for multiple 1143 sessions are all multiplexed through a single connection. Also note 1144 that Diameter messages pertaining to the session, both application 1145 specific and those that are defined in this document such as ASR/ASA, 1146 RAR/RAA and STR/STA MUST carry the Application Id of the application. 1147 Diameter messages pertaining to peer connection establishment and 1148 maintenance such as CER/CEA, DWR/DWA and DPR/DPA MUST carry an 1149 Application Id of zero (0). 1151 2.6. Peer Table 1153 The Diameter Peer Table is used in message forwarding, and referenced 1154 by the Routing Table. A Peer Table entry contains the following 1155 fields: 1157 Host identity 1159 Following the conventions described for the DiameterIdentity 1160 derived AVP data format in Section 4.3. This field contains the 1161 contents of the Origin-Host (Section 6.3) AVP found in the CER or 1162 CEA message. 1164 StatusT 1166 This is the state of the peer entry, and MUST match one of the 1167 values listed in Section 5.6. 1169 Static or Dynamic 1171 Specifies whether a peer entry was statically configured or 1172 dynamically discovered. 1174 Expiration time 1176 Specifies the time at which dynamically discovered peer table 1177 entries are to be either refreshed, or expired. 1179 TLS/TCP and DTLS/SCTP Enabled 1181 Specifies whether TLS/TCP and DTLS/SCTP is to be used when 1182 communicating with the peer. 1184 Additional security information, when needed (e.g., keys, 1185 certificates) 1187 2.7. Routing Table 1189 All Realm-Based routing lookups are performed against what is 1190 commonly known as the Routing Table (see Section 12). A Routing 1191 Table Entry contains the following fields: 1193 Realm Name 1195 This is the field that is MUST be used as a primary key in the 1196 routing table lookups. Note that some implementations perform 1197 their lookups based on longest-match-from-the-right on the realm 1198 rather than requiring an exact match. 1200 Application Identifier 1202 An application is identified by an Application Id. A route entry 1203 can have a different destination based on the Application Id in 1204 the message header. This field MUST be used as a secondary key 1205 field in routing table lookups. 1207 Local Action 1209 The Local Action field is used to identify how a message should be 1210 treated. The following actions are supported: 1212 1. LOCAL - Diameter messages that can be satisfied locally, and 1213 do not need to be routed to another Diameter entity. 1215 2. RELAY - All Diameter messages that fall within this category 1216 MUST be routed to a next hop Diameter entity that is indicated 1217 by the identifier described below. Routing is done without 1218 modifying any non-routing AVPs. See Section 6.1.9 for 1219 relaying guidelines 1221 3. PROXY - All Diameter messages that fall within this category 1222 MUST be routed to a next Diameter entity that is indicated by 1223 the identifier described below. The local server MAY apply 1224 its local policies to the message by including new AVPs to the 1225 message prior to routing. See Section 6.1.9 for proxying 1226 guidelines. 1228 4. REDIRECT - Diameter messages that fall within this category 1229 MUST have the identity of the home Diameter server(s) 1230 appended, and returned to the sender of the message. See 1231 Section 6.1.8 for redirect guidelines. 1233 Server Identifier 1235 One or more servers to which the message is to be routed. These 1236 servers MUST also be present in the Peer table. When the Local 1237 Action is set to RELAY or PROXY, this field contains the identity 1238 of the server(s) the message MUST be routed to. When the Local 1239 Action field is set to REDIRECT, this field contains the identity 1240 of one or more servers the message MUST be redirected to. 1242 Static or Dynamic 1244 Specifies whether a route entry was statically configured or 1245 dynamically discovered. 1247 Expiration time 1249 Specifies the time at which a dynamically discovered route table 1250 entry expires. 1252 It is important to note that Diameter agents MUST support at least 1253 one of the LOCAL, RELAY, PROXY or REDIRECT modes of operation. 1255 Agents do not need to support all modes of operation in order to 1256 conform with the protocol specification, but MUST follow the protocol 1257 compliance guidelines in Section 2. Relay agents and proxies MUST 1258 NOT reorder AVPs. 1260 The routing table MAY include a default entry that MUST be used for 1261 any requests not matching any of the other entries. The routing 1262 table MAY consist of only such an entry. 1264 When a request is routed, the target server MUST have advertised the 1265 Application Id (see Section 2.4) for the given message, or have 1266 advertised itself as a relay or proxy agent. Otherwise, an error is 1267 returned with the Result-Code AVP set to DIAMETER_UNABLE_TO_DELIVER. 1269 2.8. Role of Diameter Agents 1271 In addition to clients and servers, the Diameter protocol introduces 1272 relay, proxy, redirect, and translation agents, each of which is 1273 defined in Section 1.3. These Diameter agents are useful for several 1274 reasons: 1276 o They can distribute administration of systems to a configurable 1277 grouping, including the maintenance of security associations. 1279 o They can be used for concentration of requests from an number of 1280 co-located or distributed NAS equipment sets to a set of like user 1281 groups. 1283 o They can do value-added processing to the requests or responses. 1285 o They can be used for load balancing. 1287 o A complex network will have multiple authentication sources, they 1288 can sort requests and forward towards the correct target. 1290 The Diameter protocol requires that agents maintain transaction 1291 state, which is used for failover purposes. Transaction state 1292 implies that upon forwarding a request, its Hop-by-Hop identifier is 1293 saved; the field is replaced with a locally unique identifier, which 1294 is restored to its original value when the corresponding answer is 1295 received. The request's state is released upon receipt of the 1296 answer. A stateless agent is one that only maintains transaction 1297 state. 1299 The Proxy-Info AVP allows stateless agents to add local state to a 1300 Diameter request, with the guarantee that the same state will be 1301 present in the answer. However, the protocol's failover procedures 1302 require that agents maintain a copy of pending requests. 1304 A stateful agent is one that maintains session state information by 1305 keeping track of all authorized active sessions. Each authorized 1306 session is bound to a particular service, and its state is considered 1307 active either until the agent is notified otherwise, or the session 1308 expires. Each authorized session has an expiration, which is 1309 communicated by Diameter servers via the Session-Timeout AVP. 1311 Maintaining session state may be useful in certain applications, such 1312 as: 1314 o Protocol translation (e.g., RADIUS <-> Diameter) 1316 o Limiting resources authorized to a particular user 1318 o Per user or transaction auditing 1320 A Diameter agent MAY act in a stateful manner for some requests and 1321 be stateless for others. A Diameter implementation MAY act as one 1322 type of agent for some requests, and as another type of agent for 1323 others. 1325 2.8.1. Relay Agents 1327 Relay Agents are Diameter agents that accept requests and route 1328 messages to other Diameter nodes based on information found in the 1329 messages (e.g., Destination-Realm). This routing decision is 1330 performed using a list of supported realms, and known peers. This is 1331 known as the Routing Table, as is defined further in Section 2.7. 1333 Relays may, for example, be used to aggregate requests from multiple 1334 Network Access Servers (NASes) within a common geographical area 1335 (POP). The use of Relays is advantageous since it eliminates the 1336 need for NASes to be configured with the necessary security 1337 information they would otherwise require to communicate with Diameter 1338 servers in other realms. Likewise, this reduces the configuration 1339 load on Diameter servers that would otherwise be necessary when NASes 1340 are added, changed or deleted. 1342 Relays modify Diameter messages by inserting and removing routing 1343 information, but do not modify any other portion of a message. 1344 Relays SHOULD NOT maintain session state but MUST maintain 1345 transaction state. 1347 +------+ ---------> +------+ ---------> +------+ 1348 | | 1. Request | | 2. Request | | 1349 | NAS | | DRL | | HMS | 1350 | | 4. Answer | | 3. Answer | | 1351 +------+ <--------- +------+ <--------- +------+ 1352 example.net example.net example.com 1354 Figure 2: Relaying of Diameter messages 1356 The example provided in Figure 2 depicts a request issued from NAS, 1357 which is an access device, for the user bob@example.com. Prior to 1358 issuing the request, NAS performs a Diameter route lookup, using 1359 "example.com" as the key, and determines that the message is to be 1360 relayed to DRL, which is a Diameter Relay. DRL performs the same 1361 route lookup as NAS, and relays the message to HMS, which is 1362 example.com's Home Diameter Server. HMS identifies that the request 1363 can be locally supported (via the realm), processes the 1364 authentication and/or authorization request, and replies with an 1365 answer, which is routed back to NAS using saved transaction state. 1367 Since Relays do not perform any application level processing, they 1368 provide relaying services for all Diameter applications, and 1369 therefore MUST advertise the Relay Application Id. 1371 2.8.2. Proxy Agents 1373 Similarly to relays, proxy agents route Diameter messages using the 1374 Diameter Routing Table. However, they differ since they modify 1375 messages to implement policy enforcement. This requires that proxies 1376 maintain the state of their downstream peers (e.g., access devices) 1377 to enforce resource usage, provide admission control, and 1378 provisioning. 1380 Proxies may, for example, be used in call control centers or access 1381 ISPs that provide outsourced connections, they can monitor the number 1382 and types of ports in use, and make allocation and admission 1383 decisions according to their configuration. 1385 Since enforcing policies requires an understanding of the service 1386 being provided, Proxies MUST only advertise the Diameter applications 1387 they support. 1389 2.8.3. Redirect Agents 1391 Redirect agents are useful in scenarios where the Diameter routing 1392 configuration needs to be centralized. An example is a redirect 1393 agent that provides services to all members of a consortium, but does 1394 not wish to be burdened with relaying all messages between realms. 1396 This scenario is advantageous since it does not require that the 1397 consortium provide routing updates to its members when changes are 1398 made to a member's infrastructure. 1400 Since redirect agents do not relay messages, and only return an 1401 answer with the information necessary for Diameter agents to 1402 communicate directly, they do not modify messages. Since redirect 1403 agents do not receive answer messages, they cannot maintain session 1404 state. 1406 The example provided in Figure 3 depicts a request issued from the 1407 access device, NAS, for the user bob@example.com. The message is 1408 forwarded by the NAS to its relay, DRL, which does not have a routing 1409 entry in its Diameter Routing Table for example.com. DRL has a 1410 default route configured to DRD, which is a redirect agent that 1411 returns a redirect notification to DRL, as well as HMS' contact 1412 information. Upon receipt of the redirect notification, DRL 1413 establishes a transport connection with HMS, if one doesn't already 1414 exist, and forwards the request to it. 1416 +------+ 1417 | | 1418 | DRD | 1419 | | 1420 +------+ 1421 ^ | 1422 2. Request | | 3. Redirection 1423 | | Notification 1424 | v 1425 +------+ ---------> +------+ ---------> +------+ 1426 | | 1. Request | | 4. Request | | 1427 | NAS | | DRL | | HMS | 1428 | | 6. Answer | | 5. Answer | | 1429 +------+ <--------- +------+ <--------- +------+ 1430 example.net example.net example.com 1432 Figure 3: Redirecting a Diameter Message 1434 Since redirect agents do not perform any application level 1435 processing, they provide relaying services for all Diameter 1436 applications, and therefore MUST advertise the Relay Application 1437 Identifier. 1439 2.8.4. Translation Agents 1441 A translation agent is a device that provides translation between two 1442 protocols (e.g., RADIUS<->Diameter, TACACS+<->Diameter). Translation 1443 agents are likely to be used as aggregation servers to communicate 1444 with a Diameter infrastructure, while allowing for the embedded 1445 systems to be migrated at a slower pace. 1447 Given that the Diameter protocol introduces the concept of long-lived 1448 authorized sessions, translation agents MUST be session stateful and 1449 MUST maintain transaction state. 1451 Translation of messages can only occur if the agent recognizes the 1452 application of a particular request, and therefore translation agents 1453 MUST only advertise their locally supported applications. 1455 +------+ ---------> +------+ ---------> +------+ 1456 | | RADIUS Request | | Diameter Request | | 1457 | NAS | | TLA | | HMS | 1458 | | RADIUS Answer | | Diameter Answer | | 1459 +------+ <--------- +------+ <--------- +------+ 1460 example.net example.net example.com 1462 Figure 4: Translation of RADIUS to Diameter 1464 2.9. Diameter Path Authorization 1466 As noted in Section 2.2, Diameter provides transmission level 1467 security for each connection using TLS/TCP and DTLS/SCTP. Therefore, 1468 each connection can be authenticated, replay and integrity protected. 1470 In addition to authenticating each connection, each connection as 1471 well as the entire session MUST also be authorized. Before 1472 initiating a connection, a Diameter Peer MUST check that its peers 1473 are authorized to act in their roles. For example, a Diameter peer 1474 may be authentic, but that does not mean that it is authorized to act 1475 as a Diameter Server advertising a set of Diameter applications. 1477 Prior to bringing up a connection, authorization checks are performed 1478 at each connection along the path. Diameter capabilities negotiation 1479 (CER/CEA) also MUST be carried out, in order to determine what 1480 Diameter applications are supported by each peer. Diameter sessions 1481 MUST be routed only through authorized nodes that have advertised 1482 support for the Diameter application required by the session. 1484 As noted in Section 6.1.9, a relay or proxy agent MUST append a 1485 Route-Record AVP to all requests forwarded. The AVP contains the 1486 identity of the peer the request was received from. 1488 The home Diameter server, prior to authorizing a session, MUST check 1489 the Route-Record AVPs to make sure that the route traversed by the 1490 request is acceptable. For example, administrators within the home 1491 realm may not wish to honor requests that have been routed through an 1492 untrusted realm. By authorizing a request, the home Diameter server 1493 is implicitly indicating its willingness to engage in the business 1494 transaction as specified by the contractual relationship between the 1495 server and the previous hop. A DIAMETER_AUTHORIZATION_REJECTED error 1496 message (see Section 7.1.5) is sent if the route traversed by the 1497 request is unacceptable. 1499 A home realm may also wish to check that each accounting request 1500 message corresponds to a Diameter response authorizing the session. 1501 Accounting requests without corresponding authorization responses 1502 SHOULD be subjected to further scrutiny, as should accounting 1503 requests indicating a difference between the requested and provided 1504 service. 1506 Forwarding of an authorization response is considered evidence of a 1507 willingness to take on financial risk relative to the session. A 1508 local realm may wish to limit this exposure, for example, by 1509 establishing credit limits for intermediate realms and refusing to 1510 accept responses which would violate those limits. By issuing an 1511 accounting request corresponding to the authorization response, the 1512 local realm implicitly indicates its agreement to provide the service 1513 indicated in the authorization response. If the service cannot be 1514 provided by the local realm, then a DIAMETER_UNABLE_TO_COMPLY error 1515 message MUST be sent within the accounting request; a Diameter client 1516 receiving an authorization response for a service that it cannot 1517 perform MUST NOT substitute an alternate service, and then send 1518 accounting requests for the alternate service instead. 1520 3. Diameter Header 1522 A summary of the Diameter header format is shown below. The fields 1523 are transmitted in network byte order. 1525 0 1 2 3 1526 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 1527 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1528 | Version | Message Length | 1529 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1530 | command flags | Command-Code | 1531 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1532 | Application-ID | 1533 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1534 | Hop-by-Hop Identifier | 1535 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1536 | End-to-End Identifier | 1537 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1538 | AVPs ... 1540 +-+-+-+-+-+-+-+-+-+-+-+-+- 1542 Version 1544 This Version field MUST be set to 1 to indicate Diameter Version 1545 1. 1547 Message Length 1549 The Message Length field is three octets and indicates the length 1550 of the Diameter message including the header fields and the padded 1551 AVPs. Thus the message length field is always a multiple of 4. 1553 Command Flags 1555 The Command Flags field is eight bits. The following bits are 1556 assigned: 1558 0 1 2 3 4 5 6 7 1559 +-+-+-+-+-+-+-+-+ 1560 |R P E T r r r r| 1561 +-+-+-+-+-+-+-+-+ 1563 R(equest) 1565 If set, the message is a request. If cleared, the message is 1566 an answer. 1568 P(roxiable) 1570 If set, the message MAY be proxied, relayed or redirected. If 1571 cleared, the message MUST be locally processed. 1573 E(rror) 1575 If set, the message contains a protocol error, and the message 1576 will not conform to the ABNF described for this command. 1577 Messages with the 'E' bit set are commonly referred to as error 1578 messages. This bit MUST NOT be set in request messages. See 1579 Section 7.2. 1581 T(Potentially re-transmitted message) 1583 This flag is set after a link failover procedure, to aid the 1584 removal of duplicate requests. It is set when resending 1585 requests not yet acknowledged, as an indication of a possible 1586 duplicate due to a link failure. This bit MUST be cleared when 1587 sending a request for the first time, otherwise the sender MUST 1588 set this flag. Diameter agents only need to be concerned about 1589 the number of requests they send based on a single received 1590 request; retransmissions by other entities need not be tracked. 1591 Diameter agents that receive a request with the T flag set, 1592 MUST keep the T flag set in the forwarded request. This flag 1593 MUST NOT be set if an error answer message (e.g., a protocol 1594 error) has been received for the earlier message. It can be 1595 set only in cases where no answer has been received from the 1596 server for a request and the request is sent again. This flag 1597 MUST NOT be set in answer messages. 1599 r(eserved) 1601 These flag bits are reserved for future use, and MUST be set to 1602 zero, and ignored by the receiver. 1604 Command-Code 1606 The Command-Code field is three octets, and is used in order to 1607 communicate the command associated with the message. The 24-bit 1608 address space is managed by IANA (see Section 11.2.1). 1610 Command-Code values 16,777,214 and 16,777,215 (hexadecimal values 1611 FFFFFE -FFFFFF) are reserved for experimental use (See Section 1612 11.3). 1614 Application-ID 1616 Application-ID is four octets and is used to identify to which 1617 application the message is applicable for. The application can be 1618 an authentication application, an accounting application or a 1619 vendor specific application. See Section 11.3 for the possible 1620 values that the application-id may use. 1622 The value of the application-id field in the header MUST be the 1623 same as any relevant application-id AVPs contained in the message. 1625 Hop-by-Hop Identifier 1627 The Hop-by-Hop Identifier is an unsigned 32-bit integer field (in 1628 network byte order) and aids in matching requests and replies. 1629 The sender MUST ensure that the Hop-by-Hop identifier in a request 1630 is unique on a given connection at any given time, and MAY attempt 1631 to ensure that the number is unique across reboots. The sender of 1632 an Answer message MUST ensure that the Hop-by-Hop Identifier field 1633 contains the same value that was found in the corresponding 1634 request. The Hop-by-Hop identifier is normally a monotonically 1635 increasing number, whose start value was randomly generated. An 1636 answer message that is received with an unknown Hop-by-Hop 1637 Identifier MUST be discarded. 1639 End-to-End Identifier 1641 The End-to-End Identifier is an unsigned 32-bit integer field (in 1642 network byte order) and is used to detect duplicate messages. 1643 Upon reboot implementations MAY set the high order 12 bits to 1644 contain the low order 12 bits of current time, and the low order 1645 20 bits to a random value. Senders of request messages MUST 1646 insert a unique identifier on each message. The identifier MUST 1647 remain locally unique for a period of at least 4 minutes, even 1648 across reboots. The originator of an Answer message MUST ensure 1649 that the End-to-End Identifier field contains the same value that 1650 was found in the corresponding request. The End-to-End Identifier 1651 MUST NOT be modified by Diameter agents of any kind. The 1652 combination of the Origin-Host (see Section 6.3) and this field is 1653 used to detect duplicates. Duplicate requests SHOULD cause the 1654 same answer to be transmitted (modulo the hop-by-hop Identifier 1655 field and any routing AVPs that may be present), and MUST NOT 1656 affect any state that was set when the original request was 1657 processed. Duplicate answer messages that are to be locally 1658 consumed (see Section 6.2) SHOULD be silently discarded. 1660 AVPs 1662 AVPs are a method of encapsulating information relevant to the 1663 Diameter message. See Section 4 for more information on AVPs. 1665 3.1. Command Codes 1667 Each command Request/Answer pair is assigned a command code, and the 1668 sub-type (i.e., request or answer) is identified via the 'R' bit in 1669 the Command Flags field of the Diameter header. 1671 Every Diameter message MUST contain a command code in its header's 1672 Command-Code field, which is used to determine the action that is to 1673 be taken for a particular message. The following Command Codes are 1674 defined in the Diameter base protocol: 1676 Command-Name Abbrev. Code Reference 1677 -------------------------------------------------------- 1678 Abort-Session-Request ASR 274 8.5.1 1679 Abort-Session-Answer ASA 274 8.5.2 1680 Accounting-Request ACR 271 9.7.1 1681 Accounting-Answer ACA 271 9.7.2 1682 Capabilities-Exchange- CER 257 5.3.1 1683 Request 1684 Capabilities-Exchange- CEA 257 5.3.2 1685 Answer 1686 Device-Watchdog-Request DWR 280 5.5.1 1687 Device-Watchdog-Answer DWA 280 5.5.2 1688 Disconnect-Peer-Request DPR 282 5.4.1 1689 Disconnect-Peer-Answer DPA 282 5.4.2 1690 Re-Auth-Request RAR 258 8.3.1 1691 Re-Auth-Answer RAA 258 8.3.2 1692 Session-Termination- STR 275 8.4.1 1693 Request 1694 Session-Termination- STA 275 8.4.2 1695 Answer 1697 3.2. Command Code ABNF specification 1699 Every Command Code defined MUST include a corresponding ABNF 1700 specification, which is used to define the AVPs that MUST or MAY be 1701 present when sending the message. The following format is used in 1702 the definition: 1704 command-def = "::=" diameter-message 1706 command-name = diameter-name 1708 diameter-name = ALPHA *(ALPHA / DIGIT / "-") 1710 diameter-message = header [ *fixed] [ *required] [ *optional] 1712 header = "<" "Diameter Header:" command-id 1713 [r-bit] [p-bit] [e-bit] [application-id] ">" 1715 application-id = 1*DIGIT 1717 command-id = 1*DIGIT 1718 ; The Command Code assigned to the command 1720 r-bit = ", REQ" 1721 ; If present, the 'R' bit in the Command 1722 ; Flags is set, indicating that the message 1723 ; is a request, as opposed to an answer. 1725 p-bit = ", PXY" 1726 ; If present, the 'P' bit in the Command 1727 ; Flags is set, indicating that the message 1728 ; is proxiable. 1730 e-bit = ", ERR" 1731 ; If present, the 'E' bit in the Command 1732 ; Flags is set, indicating that the answer 1733 ; message contains a Result-Code AVP in 1734 ; the "protocol error" class. 1736 fixed = [qual] "<" avp-spec ">" 1737 ; Defines the fixed position of an AVP 1739 required = [qual] "{" avp-spec "}" 1740 ; The AVP MUST be present and can appear 1741 ; anywhere in the message. 1743 optional = [qual] "[" avp-name "]" 1744 ; The avp-name in the 'optional' rule cannot 1745 ; evaluate to any AVP Name which is included 1746 ; in a fixed or required rule. The AVP can 1747 ; appear anywhere in the message. 1748 ; 1749 ; NOTE: "[" and "]" have a slightly different 1750 ; meaning than in ABNF (RFC 5234]). These braces 1751 ; cannot be used to express optional fixed rules 1752 ; (such as an optional ICV at the end). To do 1753 ; this, the convention is '0*1fixed'. 1755 qual = [min] "*" [max] 1756 ; See ABNF conventions, RFC 5234 Section 4. 1757 ; The absence of any qualifiers depends on 1758 ; whether it precedes a fixed, required, or 1759 ; optional rule. If a fixed or required rule has 1760 ; no qualifier, then exactly one such AVP MUST 1761 ; be present. If an optional rule has no 1762 ; qualifier, then 0 or 1 such AVP may be 1763 ; present. If an optional rule has a qualifier, 1764 ; then the value of min MUST be 0 if present. 1766 min = 1*DIGIT 1767 ; The minimum number of times the element may 1768 ; be present. If absent, the default value is zero 1769 ; for fixed and optional rules and one for 1770 ; required rules. The value MUST be at least one 1771 ; for required rules. 1773 max = 1*DIGIT 1774 ; The maximum number of times the element may 1775 ; be present. If absent, the default value is 1776 ; infinity. A value of zero implies the AVP MUST 1777 ; NOT be present. 1779 avp-spec = diameter-name 1780 ; The avp-spec has to be an AVP Name, defined 1781 ; in the base or extended Diameter 1782 ; specifications. 1784 avp-name = avp-spec / "AVP" 1785 ; The string "AVP" stands for *any* arbitrary AVP 1786 ; Name, not otherwise listed in that command code 1787 ; definition. Addition this AVP is recommended for 1788 ; all command ABNFs to allow for extensibility. 1790 The following is a definition of a fictitious command code: 1792 Example-Request ::= < Diameter Header: 9999999, REQ, PXY > 1793 { User-Name } 1794 * { Origin-Host } 1795 * [ AVP ] 1797 3.3. Diameter Command Naming Conventions 1799 Diameter command names typically includes one or more English words 1800 followed by the verb Request or Answer. Each English word is 1801 delimited by a hyphen. A three-letter acronym for both the request 1802 and answer is also normally provided. 1804 An example is a message set used to terminate a session. The command 1805 name is Session-Terminate-Request and Session-Terminate-Answer, while 1806 the acronyms are STR and STA, respectively. 1808 Both the request and the answer for a given command share the same 1809 command code. The request is identified by the R(equest) bit in the 1810 Diameter header set to one (1), to ask that a particular action be 1811 performed, such as authorizing a user or terminating a session. Once 1812 the receiver has completed the request it issues the corresponding 1813 answer, which includes a result code that communicates one of the 1814 following: 1816 o The request was successful 1817 o The request failed 1819 o An additional request has to be sent to provide information the 1820 peer requires prior to returning a successful or failed answer. 1822 o The receiver could not process the request, but provides 1823 information about a Diameter peer that is able to satisfy the 1824 request, known as redirect. 1826 Additional information, encoded within AVPs, may also be included in 1827 answer messages. 1829 4. Diameter AVPs 1831 Diameter AVPs carry specific authentication, accounting, 1832 authorization and routing information as well as configuration 1833 details for the request and reply. 1835 Each AVP of type OctetString MUST be padded to align on a 32-bit 1836 boundary, while other AVP types align naturally. A number of zero- 1837 valued bytes are added to the end of the AVP Data field till a word 1838 boundary is reached. The length of the padding is not reflected in 1839 the AVP Length field. 1841 4.1. AVP Header 1843 The fields in the AVP header MUST be sent in network byte order. The 1844 format of the header is: 1846 0 1 2 3 1847 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 1848 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1849 | AVP Code | 1850 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1851 |V M P r r r r r| AVP Length | 1852 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1853 | Vendor-ID (opt) | 1854 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1855 | Data ... 1856 +-+-+-+-+-+-+-+-+ 1858 AVP Code 1860 The AVP Code, combined with the Vendor-Id field, identifies the 1861 attribute uniquely. AVP numbers 1 through 255 are reserved for 1862 re-use of RADIUS attributes, without setting the Vendor-Id field. 1864 AVP numbers 256 and above are used for Diameter, which are 1865 allocated by IANA (see Section 11.1). 1867 AVP Flags 1869 The AVP Flags field informs the receiver how each attribute must 1870 be handled. New Diameter applications SHOULD NOT define 1871 additional AVP Flag bits. The sender of the AVP MUST set 'r' 1872 (reserved) bits to 0 and the receiver SHOULD ignore all 'r' 1873 (reserved) bits. Unrecognized bits SHOULD be considered an error. 1874 The 'P' bit has been reserved for future usage of end-to-end 1875 security. At the time of writing there are no end-to-end security 1876 mechanisms specified therefore the 'P' bit SHOULD be set to 0. 1878 The 'M' Bit, known as the Mandatory bit, indicates whether the 1879 receiver of the AVP MUST parse and understand the semantic of the 1880 AVP including its content. The receiving entity MUST return an 1881 appropriate error message if it receives an AVP that has the M-bit 1882 set but does not understand it. An exception applies when the AVP 1883 is embedded within a Grouped AVP. See Section 4.4 for details. 1884 Diameter Relay and redirect agents MUST NOT reject messages with 1885 unrecognized AVPs. 1887 The 'M' bit MUST be set according to the rules defined in the 1888 application specification which introduces or re-uses this AVP. 1889 Within a given application, the M-bit setting for an AVP is either 1890 defined for all command types or for each command type. 1892 AVPs with the 'M' bit cleared are informational only and a 1893 receiver that receives a message with such an AVP that is not 1894 supported, or whose value is not supported, MAY simply ignore the 1895 AVP. 1897 The 'V' bit, known as the Vendor-Specific bit, indicates whether 1898 the optional Vendor-ID field is present in the AVP header. When 1899 set the AVP Code belongs to the specific vendor code address 1900 space. 1902 AVP Length 1904 The AVP Length field is three octets, and indicates the number of 1905 octets in this AVP including the AVP Code, AVP Length, AVP Flags, 1906 Vendor-ID field (if present) and the AVP data. If a message is 1907 received with an invalid attribute length, the message MUST be 1908 rejected. 1910 4.1.1. Optional Header Elements 1912 The AVP Header contains one optional field. This field is only 1913 present if the respective bit-flag is enabled. 1915 Vendor-ID 1917 The Vendor-ID field is present if the 'V' bit is set in the AVP 1918 Flags field. The optional four-octet Vendor-ID field contains the 1919 IANA assigned "SMI Network Management Private Enterprise Codes" 1920 [RFC3232] value, encoded in network byte order. Any vendor or 1921 standardization organization that are also treated like vendors in 1922 the IANA managed "SMI Network Management Private Enterprise Codes" 1923 space wishing to implement a vendor-specific Diameter AVP MUST use 1924 their own Vendor-ID along with their privately managed AVP address 1925 space, guaranteeing that they will not collide with any other 1926 vendor's vendor-specific AVP(s), nor with future IETF AVPs. 1928 A vendor ID value of zero (0) corresponds to the IETF adopted AVP 1929 values, as managed by the IANA. Since the absence of the vendor 1930 ID field implies that the AVP in question is not vendor specific, 1931 implementations MUST NOT use the zero (0) vendor ID. 1933 4.2. Basic AVP Data Formats 1935 The Data field is zero or more octets and contains information 1936 specific to the Attribute. The format and length of the Data field 1937 is determined by the AVP Code and AVP Length fields. The format of 1938 the Data field MUST be one of the following base data types or a data 1939 type derived from the base data types. In the event that a new Basic 1940 AVP Data Format is needed, a new version of this RFC MUST be created. 1942 OctetString 1944 The data contains arbitrary data of variable length. Unless 1945 otherwise noted, the AVP Length field MUST be set to at least 8 1946 (12 if the 'V' bit is enabled). AVP Values of this type that are 1947 not a multiple of four-octets in length is followed by the 1948 necessary padding so that the next AVP (if any) will start on a 1949 32-bit boundary. 1951 Integer32 1953 32 bit signed value, in network byte order. The AVP Length field 1954 MUST be set to 12 (16 if the 'V' bit is enabled). 1956 Integer64 1958 64 bit signed value, in network byte order. The AVP Length field 1959 MUST be set to 16 (20 if the 'V' bit is enabled). 1961 Unsigned32 1963 32 bit unsigned value, in network byte order. The AVP Length 1964 field MUST be set to 12 (16 if the 'V' bit is enabled). 1966 Unsigned64 1968 64 bit unsigned value, in network byte order. The AVP Length 1969 field MUST be set to 16 (20 if the 'V' bit is enabled). 1971 Float32 1973 This represents floating point values of single precision as 1974 described by [FLOATPOINT]. The 32-bit value is transmitted in 1975 network byte order. The AVP Length field MUST be set to 12 (16 if 1976 the 'V' bit is enabled). 1978 Float64 1980 This represents floating point values of double precision as 1981 described by [FLOATPOINT]. The 64-bit value is transmitted in 1982 network byte order. The AVP Length field MUST be set to 16 (20 if 1983 the 'V' bit is enabled). 1985 Grouped 1987 The Data field is specified as a sequence of AVPs. Each of these 1988 AVPs follows - in the order in which they are specified - 1989 including their headers and padding. The AVP Length field is set 1990 to 8 (12 if the 'V' bit is enabled) plus the total length of all 1991 included AVPs, including their headers and padding. Thus the AVP 1992 length field of an AVP of type Grouped is always a multiple of 4. 1994 4.3. Derived AVP Data Formats 1996 In addition to using the Basic AVP Data Formats, applications may 1997 define data formats derived from the Basic AVP Data Formats. An 1998 application that defines new Derived AVP Data Formats MUST include 1999 them in a section entitled "Derived AVP Data Formats", using the same 2000 format as the definitions below. Each new definition MUST be either 2001 defined or listed with a reference to the RFC that defines the 2002 format. 2004 4.3.1. Common Derived AVPs 2006 The following are commonly used Derived AVP Data Formats. 2008 Address 2010 The Address format is derived from the OctetString AVP Base 2011 Format. It is a discriminated union, representing, for example a 2012 32-bit (IPv4) [RFC791] or 128-bit (IPv6) [RFC4291] address, most 2013 significant octet first. The first two octets of the Address AVP 2014 represents the AddressType, which contains an Address Family 2015 defined in [IANAADFAM]. The AddressType is used to discriminate 2016 the content and format of the remaining octets. 2018 Time 2020 The Time format is derived from the OctetString AVP Base Format. 2021 The string MUST contain four octets, in the same format as the 2022 first four bytes are in the NTP timestamp format. The NTP 2023 Timestamp format is defined in Chapter 3 of [RFC5905]. 2025 This represents the number of seconds since 0h on 1 January 1900 2026 with respect to the Coordinated Universal Time (UTC). 2028 On 6h 28m 16s UTC, 7 February 2036 the time value will overflow. 2029 SNTP [RFC5905] describes a procedure to extend the time to 2104. 2030 This procedure MUST be supported by all Diameter nodes. 2032 UTF8String 2034 The UTF8String format is derived from the OctetString AVP Base 2035 Format. This is a human readable string represented using the 2036 ISO/IEC IS 10646-1 character set, encoded as an OctetString using 2037 the UTF-8 [RFC3629] transformation format described in RFC 3629. 2039 Since additional code points are added by amendments to the 10646 2040 standard from time to time, implementations MUST be prepared to 2041 encounter any code point from 0x00000001 to 0x7fffffff. Byte 2042 sequences that do not correspond to the valid encoding of a code 2043 point into UTF-8 charset or are outside this range are prohibited. 2045 The use of control codes SHOULD be avoided. When it is necessary 2046 to represent a new line, the control code sequence CR LF SHOULD be 2047 used. 2049 The use of leading or trailing white space SHOULD be avoided. 2051 For code points not directly supported by user interface hardware 2052 or software, an alternative means of entry and display, such as 2053 hexadecimal, MAY be provided. 2055 For information encoded in 7-bit US-ASCII, the UTF-8 charset is 2056 identical to the US-ASCII charset. 2058 UTF-8 may require multiple bytes to represent a single character / 2059 code point; thus the length of an UTF8String in octets may be 2060 different from the number of characters encoded. 2062 Note that the AVP Length field of an UTF8String is measured in 2063 octets, not characters. 2065 DiameterIdentity 2067 The DiameterIdentity format is derived from the OctetString AVP 2068 Base Format. 2070 DiameterIdentity = FQDN/Realm 2072 DiameterIdentity value is used to uniquely identify either: 2074 * A Diameter node for purposes of duplicate connection and 2075 routing loop detection. 2077 * A Realm to determine whether messages can be satisfied locally, 2078 or whether they must be routed or redirected. 2080 When a DiameterIdentity is used to identify a Diameter node the 2081 contents of the string MUST be the FQDN of the Diameter node. If 2082 multiple Diameter nodes run on the same host, each Diameter node 2083 MUST be assigned a unique DiameterIdentity. If a Diameter node 2084 can be identified by several FQDNs, a single FQDN should be picked 2085 at startup, and used as the only DiameterIdentity for that node, 2086 whatever the connection it is sent on. Note that in this 2087 document, DiameterIdentity is in ASCII form in order to be 2088 compatible with existing DNS infrastructure. See Appendix D for 2089 interactions between the Diameter protocol and Internationalized 2090 Domain Name (IDNs). 2092 DiameterURI 2094 The DiameterURI MUST follow the Uniform Resource Identifiers (URI) 2095 syntax [RFC3986] rules specified below: 2097 "aaa://" FQDN [ port ] [ transport ] [ protocol ] 2099 ; No transport security 2101 "aaas://" FQDN [ port ] [ transport ] [ protocol ] 2103 ; Transport security used 2105 FQDN = Fully Qualified Host Name 2107 port = ":" 1*DIGIT 2109 ; One of the ports used to listen for 2110 ; incoming connections. 2111 ; If absent, the default Diameter port 2112 ; (3868) is assumed if no transport 2113 ; security is used and port (TBD) when 2114 ; transport security (TLS/TCP and DTLS/SCTP) 2115 ; is used. 2117 transport = ";transport=" transport-protocol 2119 ; One of the transports used to listen 2120 ; for incoming connections. If absent, 2121 ; the default protocol is assumed to be TCP. 2122 ; UDP MUST NOT be used when the aaa-protocol 2123 ; field is set to diameter. 2125 transport-protocol = ( "tcp" / "sctp" / "udp" ) 2127 protocol = ";protocol=" aaa-protocol 2129 ; If absent, the default AAA protocol 2130 ; is Diameter. 2132 aaa-protocol = ( "diameter" / "radius" / "tacacs+" ) 2134 The following are examples of valid Diameter host identities: 2136 aaa://host.example.com;transport=tcp 2137 aaa://host.example.com:6666;transport=tcp 2138 aaa://host.example.com;protocol=diameter 2139 aaa://host.example.com:6666;protocol=diameter 2140 aaa://host.example.com:6666;transport=tcp;protocol=diameter 2141 aaa://host.example.com:1813;transport=udp;protocol=radius 2143 Enumerated 2145 Enumerated is derived from the Integer32 AVP Base Format. The 2146 definition contains a list of valid values and their 2147 interpretation and is described in the Diameter application 2148 introducing the AVP. 2150 IPFilterRule 2152 The IPFilterRule format is derived from the OctetString AVP Base 2153 Format and uses the ASCII charset. The rule syntax is a modified 2154 subset of ipfw(8) from FreeBSD. Packets may be filtered based on 2155 the following information that is associated with it: 2157 Direction (in or out) 2158 Source and destination IP address (possibly masked) 2159 Protocol 2160 Source and destination port (lists or ranges) 2161 TCP flags 2162 IP fragment flag 2163 IP options 2164 ICMP types 2166 Rules for the appropriate direction are evaluated in order, with 2167 the first matched rule terminating the evaluation. Each packet is 2168 evaluated once. If no rule matches, the packet is dropped if the 2169 last rule evaluated was a permit, and passed if the last rule was 2170 a deny. 2172 IPFilterRule filters MUST follow the format: 2174 action dir proto from src to dst [options] 2176 action permit - Allow packets that match the rule. 2177 deny - Drop packets that match the rule. 2179 dir "in" is from the terminal, "out" is to the 2180 terminal. 2182 proto An IP protocol specified by number. The "ip" 2183 keyword means any protocol will match. 2185 src and dst
[ports] 2187 The
may be specified as: 2188 ipno An IPv4 or IPv6 number in dotted- 2189 quad or canonical IPv6 form. Only 2190 this exact IP number will match the 2191 rule. 2192 ipno/bits An IP number as above with a mask 2193 width of the form 192.0.2.10/24. In 2194 this case, all IP numbers from 2195 192.0.2.0 to 192.0.2.255 will match. 2196 The bit width MUST be valid for the 2197 IP version and the IP number MUST 2198 NOT have bits set beyond the mask. 2199 For a match to occur, the same IP 2200 version must be present in the 2201 packet that was used in describing 2202 the IP address. To test for a 2203 particular IP version, the bits part 2204 can be set to zero. The keyword 2205 "any" is 0.0.0.0/0 or the IPv6 2206 equivalent. The keyword "assigned" 2207 is the address or set of addresses 2208 assigned to the terminal. For IPv4, 2209 a typical first rule is often "deny 2210 in ip! assigned" 2212 The sense of the match can be inverted by 2213 preceding an address with the not modifier (!), 2214 causing all other addresses to be matched 2215 instead. This does not affect the selection of 2216 port numbers. 2218 With the TCP, UDP and SCTP protocols, optional 2219 ports may be specified as: 2221 {port/port-port}[,ports[,...]] 2223 The '-' notation specifies a range of ports 2224 (including boundaries). 2226 Fragmented packets that have a non-zero offset 2227 (i.e., not the first fragment) will never match 2228 a rule that has one or more port 2229 specifications. See the frag option for 2230 details on matching fragmented packets. 2232 options: 2233 frag Match if the packet is a fragment and this is not 2234 the first fragment of the datagram. frag may not 2235 be used in conjunction with either tcpflags or 2236 TCP/UDP port specifications. 2238 ipoptions spec 2239 Match if the IP header contains the comma 2240 separated list of options specified in spec. The 2241 supported IP options are: 2243 ssrr (strict source route), lsrr (loose source 2244 route), rr (record packet route) and ts 2245 (timestamp). The absence of a particular option 2246 may be denoted with a '!'. 2248 tcpoptions spec 2249 Match if the TCP header contains the comma 2250 separated list of options specified in spec. The 2251 supported TCP options are: 2253 mss (maximum segment size), window (tcp window 2254 advertisement), sack (selective ack), ts (rfc1323 2255 timestamp) and cc (rfc1644 t/tcp connection 2256 count). The absence of a particular option may 2257 be denoted with a '!'. 2259 established 2260 TCP packets only. Match packets that have the RST 2261 or ACK bits set. 2263 setup TCP packets only. Match packets that have the SYN 2264 bit set but no ACK bit. 2266 tcpflags spec 2267 TCP packets only. Match if the TCP header 2268 contains the comma separated list of flags 2269 specified in spec. The supported TCP flags are: 2271 fin, syn, rst, psh, ack and urg. The absence of a 2272 particular flag may be denoted with a '!'. A rule 2273 that contains a tcpflags specification can never 2274 match a fragmented packet that has a non-zero 2275 offset. See the frag option for details on 2276 matching fragmented packets. 2278 icmptypes types 2279 ICMP packets only. Match if the ICMP type is in 2280 the list types. The list may be specified as any 2281 combination of ranges or individual types 2282 separated by commas. Both the numeric values and 2283 the symbolic values listed below can be used. The 2284 supported ICMP types are: 2286 echo reply (0), destination unreachable (3), 2287 source quench (4), redirect (5), echo request 2288 (8), router advertisement (9), router 2289 solicitation (10), time-to-live exceeded (11), IP 2290 header bad (12), timestamp request (13), 2291 timestamp reply (14), information request (15), 2292 information reply (16), address mask request (17) 2293 and address mask reply (18). 2295 There is one kind of packet that the access device MUST always 2296 discard, that is an IP fragment with a fragment offset of one. 2297 This is a valid packet, but it only has one use, to try to 2298 circumvent firewalls. 2300 An access device that is unable to interpret or apply a deny rule 2301 MUST terminate the session. An access device that is unable to 2302 interpret or apply a permit rule MAY apply a more restrictive 2303 rule. An access device MAY apply deny rules of its own before the 2304 supplied rules, for example to protect the access device owner's 2305 infrastructure. 2307 4.4. Grouped AVP Values 2309 The Diameter protocol allows AVP values of type 'Grouped'. This 2310 implies that the Data field is actually a sequence of AVPs. It is 2311 possible to include an AVP with a Grouped type within a Grouped type, 2312 that is, to nest them. AVPs within an AVP of type Grouped have the 2313 same padding requirements as non-Grouped AVPs, as defined in Section 2314 4. 2316 The AVP Code numbering space of all AVPs included in a Grouped AVP is 2317 the same as for non-grouped AVPs. Receivers of a Grouped AVP that 2318 does not have the 'M' (mandatory) bit set and one or more of the 2319 encapsulated AVPs within the group has the 'M' (mandatory) bit set 2320 MAY simply be ignored if the Grouped AVP itself is unrecognized. The 2321 rule applies even if the encapsulated AVP with its 'M' (mandatory) 2322 bit set is further encapsulated within other sub-groups; i.e. other 2323 Grouped AVPs embedded within the Grouped AVP. 2325 Every Grouped AVP defined MUST include a corresponding grammar, using 2326 ABNF [RFC5234] (with modifications), as defined below. 2328 grouped-avp-def = "::=" avp 2330 name-fmt = ALPHA *(ALPHA / DIGIT / "-") 2332 name = name-fmt 2333 ; The name has to be the name of an AVP, 2334 ; defined in the base or extended Diameter 2335 ; specifications. 2337 avp = header [ *fixed] [ *required] [ *optional] 2339 header = "<" "AVP-Header:" avpcode [vendor] ">" 2341 avpcode = 1*DIGIT 2342 ; The AVP Code assigned to the Grouped AVP 2344 vendor = 1*DIGIT 2345 ; The Vendor-ID assigned to the Grouped AVP. 2346 ; If absent, the default value of zero is 2347 ; used. 2349 4.4.1. Example AVP with a Grouped Data type 2351 The Example-AVP (AVP Code 999999) is of type Grouped and is used to 2352 clarify how Grouped AVP values work. The Grouped Data field has the 2353 following ABNF grammar: 2355 Example-AVP ::= < AVP Header: 999999 > 2356 { Origin-Host } 2357 1*{ Session-Id } 2358 *[ AVP ] 2360 An Example-AVP with Grouped Data follows. 2362 The Origin-Host AVP is required (Section 6.3). In this case: 2364 Origin-Host = "example.com". 2366 One or more Session-Ids must follow. Here there are two: 2368 Session-Id = 2369 "grump.example.com:33041;23432;893;0AF3B81" 2371 Session-Id = 2372 "grump.example.com:33054;23561;2358;0AF3B82" 2374 optional AVPs included are 2376 Recovery-Policy = 2377 2163bc1d0ad82371f6bc09484133c3f09ad74a0dd5346d54195a7cf0b35 2378 2cabc881839a4fdcfbc1769e2677a4c1fb499284c5f70b48f58503a45c5 2379 c2d6943f82d5930f2b7c1da640f476f0e9c9572a50db8ea6e51e1c2c7bd 2380 f8bb43dc995144b8dbe297ac739493946803e1cee3e15d9b765008a1b2a 2381 cf4ac777c80041d72c01e691cf751dbf86e85f509f3988e5875dc905119 2382 26841f00f0e29a6d1ddc1a842289d440268681e052b30fb638045f7779c 2383 1d873c784f054f688f5001559ecff64865ef975f3e60d2fd7966b8c7f92 2385 Futuristic-Acct-Record = 2386 fe19da5802acd98b07a5b86cb4d5d03f0314ab9ef1ad0b67111ff3b90a0 2387 57fe29620bf3585fd2dd9fcc38ce62f6cc208c6163c008f4258d1bc88b8 2388 17694a74ccad3ec69269461b14b2e7a4c111fb239e33714da207983f58c 2389 41d018d56fe938f3cbf089aac12a912a2f0d1923a9390e5f789cb2e5067 2390 d3427475e49968f841 2392 The data for the optional AVPs is represented in hex since the format 2393 of these AVPs is neither known at the time of definition of the 2394 Example-AVP group, nor (likely) at the time when the example instance 2395 of this AVP is interpreted - except by Diameter implementations which 2396 support the same set of AVPs. The encoding example illustrates how 2397 padding is used and how length fields are calculated. Also note that 2398 AVPs may be present in the Grouped AVP value which the receiver 2399 cannot interpret (here, the Recover-Policy and Futuristic-Acct-Record 2400 AVPs). The length of the Example-AVP is the sum of all the length of 2401 the member AVPs including their padding plus the Example-AVP header 2402 size. 2404 This AVP would be encoded as follows: 2406 0 1 2 3 4 5 6 7 2407 +-------+-------+-------+-------+-------+-------+-------+-------+ 2408 0 | Example AVP Header (AVP Code = 999999), Length = 496 | 2409 +-------+-------+-------+-------+-------+-------+-------+-------+ 2410 8 | Origin-Host AVP Header (AVP Code = 264), Length = 19 | 2411 +-------+-------+-------+-------+-------+-------+-------+-------+ 2412 16 | 'e' | 'x' | 'a' | 'm' | 'p' | 'l' | 'e' | '.' | 2413 +-------+-------+-------+-------+-------+-------+-------+-------+ 2414 24 | 'c' | 'o' | 'm' |Padding| Session-Id AVP Header | 2415 +-------+-------+-------+-------+-------+-------+-------+-------+ 2416 32 | (AVP Code = 263), Length = 49 | 'g' | 'r' | 'u' | 'm' | 2417 +-------+-------+-------+-------+-------+-------+-------+-------+ 2418 . . . 2419 +-------+-------+-------+-------+-------+-------+-------+-------+ 2420 72 | 'F' | '3' | 'B' | '8' | '1' |Padding|Padding|Padding| 2421 +-------+-------+-------+-------+-------+-------+-------+-------+ 2422 80 | Session-Id AVP Header (AVP Code = 263), Length = 50 | 2423 +-------+-------+-------+-------+-------+-------+-------+-------+ 2424 88 | 'g' | 'r' | 'u' | 'm' | 'p' | '.' | 'e' | 'x' | 2425 +-------+-------+-------+-------+-------+-------+-------+-------+ 2426 . . . 2427 +-------+-------+-------+-------+-------+-------+-------+-------+ 2428 120| '5' | '8' | ';' | '0' | 'A' | 'F' | '3' | 'B' | 2429 +-------+-------+-------+-------+-------+-------+-------+-------+ 2430 128| '8' | '2' |Padding|Padding| Recovery-Policy Header (AVP | 2431 +-------+-------+-------+-------+-------+-------+-------+-------+ 2432 136| Code = 8341), Length = 223 | 0x21 | 0x63 | 0xbc | 0x1d | 2433 +-------+-------+-------+-------+-------+-------+-------+-------+ 2434 144| 0x0a | 0xd8 | 0x23 | 0x71 | 0xf6 | 0xbc | 0x09 | 0x48 | 2435 +-------+-------+-------+-------+-------+-------+-------+-------+ 2436 . . . 2437 +-------+-------+-------+-------+-------+-------+-------+-------+ 2438 352| 0x8c | 0x7f | 0x92 |Padding| Futuristic-Acct-Record Header | 2439 +-------+-------+-------+-------+-------+-------+-------+-------+ 2440 328|(AVP Code = 15930),Length = 137| 0xfe | 0x19 | 0xda | 0x58 | 2441 +-------+-------+-------+-------+-------+-------+-------+-------+ 2442 336| 0x02 | 0xac | 0xd9 | 0x8b | 0x07 | 0xa5 | 0xb8 | 0xc6 | 2443 +-------+-------+-------+-------+-------+-------+-------+-------+ 2444 . . . 2445 +-------+-------+-------+-------+-------+-------+-------+-------+ 2446 488| 0xe4 | 0x99 | 0x68 | 0xf8 | 0x41 |Padding|Padding|Padding| 2447 +-------+-------+-------+-------+-------+-------+-------+-------+ 2449 4.5. Diameter Base Protocol AVPs 2451 The following table describes the Diameter AVPs defined in the base 2452 protocol, their AVP Code values, types, possible flag values. 2454 Due to space constraints, the short form DiamIdent is used to 2455 represent DiameterIdentity. 2457 +----------+ 2458 | AVP Flag | 2459 | rules | 2460 |----+-----| 2461 AVP Section | |MUST | 2462 Attribute Name Code Defined Data Type |MUST| NOT | 2463 -----------------------------------------|----+-----| 2464 Acct- 85 9.8.2 Unsigned32 | M | V | 2465 Interim-Interval | | | 2466 Accounting- 483 9.8.7 Enumerated | M | V | 2467 Realtime-Required | | | 2468 Acct- 50 9.8.5 UTF8String | M | V | 2469 Multi-Session-Id | | | 2470 Accounting- 485 9.8.3 Unsigned32 | M | V | 2471 Record-Number | | | 2472 Accounting- 480 9.8.1 Enumerated | M | V | 2473 Record-Type | | | 2474 Accounting- 44 9.8.4 OctetString| M | V | 2475 Session-Id | | | 2476 Accounting- 287 9.8.6 Unsigned64 | M | V | 2477 Sub-Session-Id | | | 2478 Acct- 259 6.9 Unsigned32 | M | V | 2479 Application-Id | | | 2480 Auth- 258 6.8 Unsigned32 | M | V | 2481 Application-Id | | | 2482 Auth-Request- 274 8.7 Enumerated | M | V | 2483 Type | | | 2484 Authorization- 291 8.9 Unsigned32 | M | V | 2485 Lifetime | | | 2486 Auth-Grace- 276 8.10 Unsigned32 | M | V | 2487 Period | | | 2488 Auth-Session- 277 8.11 Enumerated | M | V | 2489 State | | | 2490 Re-Auth-Request- 285 8.12 Enumerated | M | V | 2491 Type | | | 2492 Class 25 8.20 OctetString| M | V | 2493 Destination-Host 293 6.5 DiamIdent | M | V | 2494 Destination- 283 6.6 DiamIdent | M | V | 2495 Realm | | | 2496 Disconnect-Cause 273 5.4.3 Enumerated | M | V | 2497 Error-Message 281 7.3 UTF8String | | V,M | 2498 Error-Reporting- 294 7.4 DiamIdent | | V,M | 2499 Host | | | 2500 Event-Timestamp 55 8.21 Time | M | V | 2501 Experimental- 297 7.6 Grouped | M | V | 2502 Result | | | 2503 -----------------------------------------|----+-----| 2504 +----------+ 2505 | AVP Flag | 2506 | rules | 2507 |----+-----| 2508 AVP Section | |MUST | 2509 Attribute Name Code Defined Data Type |MUST| NOT | 2510 -----------------------------------------|----+-----| 2511 Experimental- 298 7.7 Unsigned32 | M | V | 2512 Result-Code | | | 2513 Failed-AVP 279 7.5 Grouped | M | V | 2514 Firmware- 267 5.3.4 Unsigned32 | | V,M | 2515 Revision | | | 2516 Host-IP-Address 257 5.3.5 Address | M | V | 2517 Inband-Security | M | V | 2518 -Id 299 6.10 Unsigned32 | | | 2519 Multi-Round- 272 8.19 Unsigned32 | M | V | 2520 Time-Out | | | 2521 Origin-Host 264 6.3 DiamIdent | M | V | 2522 Origin-Realm 296 6.4 DiamIdent | M | V | 2523 Origin-State-Id 278 8.16 Unsigned32 | M | V | 2524 Product-Name 269 5.3.7 UTF8String | | V,M | 2525 Proxy-Host 280 6.7.3 DiamIdent | M | V | 2526 Proxy-Info 284 6.7.2 Grouped | M | V | 2527 Proxy-State 33 6.7.4 OctetString| M | V | 2528 Redirect-Host 292 6.12 DiamURI | M | V | 2529 Redirect-Host- 261 6.13 Enumerated | M | V | 2530 Usage | | | 2531 Redirect-Max- 262 6.14 Unsigned32 | M | V | 2532 Cache-Time | | | 2533 Result-Code 268 7.1 Unsigned32 | M | V | 2534 Route-Record 282 6.7.1 DiamIdent | M | V | 2535 Session-Id 263 8.8 UTF8String | M | V | 2536 Session-Timeout 27 8.13 Unsigned32 | M | V | 2537 Session-Binding 270 8.17 Unsigned32 | M | V | 2538 Session-Server- 271 8.18 Enumerated | M | V | 2539 Failover | | | 2540 Supported- 265 5.3.6 Unsigned32 | M | V | 2541 Vendor-Id | | | 2542 Termination- 295 8.15 Enumerated | M | V | 2543 Cause | | | 2544 User-Name 1 8.14 UTF8String | M | V | 2545 Vendor-Id 266 5.3.3 Unsigned32 | M | V | 2546 Vendor-Specific- 260 6.11 Grouped | M | V | 2547 Application-Id | | | 2548 -----------------------------------------|----+-----| 2550 5. Diameter Peers 2552 This section describes how Diameter nodes establish connections and 2553 communicate with peers. 2555 5.1. Peer Connections 2557 Connections between diameter peers are established using their valid 2558 DiameterIdentity. A Diameter node initiating a connection to a peer 2559 MUST know the peers DiameterIdentity. Methods for discovering a 2560 Diameter peer can be found in Section 5.2. 2562 Although a Diameter node may have many possible peers that it is able 2563 to communicate with, it may not be economical to have an established 2564 connection to all of them. At a minimum, a Diameter node SHOULD have 2565 an established connection with two peers per realm, known as the 2566 primary and secondary peers. Of course, a node MAY have additional 2567 connections, if it is deemed necessary. Typically, all messages for 2568 a realm are sent to the primary peer, but in the event that failover 2569 procedures are invoked, any pending requests are sent to the 2570 secondary peer. However, implementations are free to load balance 2571 requests between a set of peers. 2573 Note that a given peer MAY act as a primary for a given realm, while 2574 acting as a secondary for another realm. 2576 When a peer is deemed suspect, which could occur for various reasons, 2577 including not receiving a DWA within an allotted timeframe, no new 2578 requests should be forwarded to the peer, but failover procedures are 2579 invoked. When an active peer is moved to this mode, additional 2580 connections SHOULD be established to ensure that the necessary number 2581 of active connections exists. 2583 There are two ways that a peer is removed from the suspect peer list: 2585 1. The peer is no longer reachable, causing the transport connection 2586 to be shutdown. The peer is moved to the closed state. 2588 2. Three watchdog messages are exchanged with accepted round trip 2589 times, and the connection to the peer is considered stabilized. 2591 In the event the peer being removed is either the primary or 2592 secondary, an alternate peer SHOULD replace the deleted peer, and 2593 assume the role of either primary or secondary. 2595 5.2. Diameter Peer Discovery 2597 Allowing for dynamic Diameter agent discovery will make it possible 2598 for simpler and more robust deployment of Diameter services. In 2599 order to promote interoperable implementations of Diameter peer 2600 discovery, the following mechanisms are described. These are based 2601 on existing IETF standards. The first option (manual configuration) 2602 MUST be supported by all Diameter nodes, while the latter option 2603 (DNS) MAY be supported. 2605 There are two cases where Diameter peer discovery may be performed. 2606 The first is when a Diameter client needs to discover a first-hop 2607 Diameter agent. The second case is when a Diameter agent needs to 2608 discover another agent - for further handling of a Diameter 2609 operation. In both cases, the following 'search order' is 2610 recommended: 2612 1. The Diameter implementation consults its list of static 2613 (manually) configured Diameter agent locations. These will be 2614 used if they exist and respond. 2616 2. The Diameter implementation performs a NAPTR query for a server 2617 in a particular realm. The Diameter implementation has to know 2618 in advance which realm to look for a Diameter agent. This could 2619 be deduced, for example, from the 'realm' in a NAI that a 2620 Diameter implementation needed to perform a Diameter operation 2621 on. 2623 The NAPTR usage in Diameter follows the S-NAPTR DDDS application 2624 [RFC3958] in which the SERVICE field includes tags for the 2625 desired application and supported application protocol. The 2626 application service tag for a Diameter application is 'aaa' and 2627 the supported application protocol tags are 'diameter.tcp', 2628 'diameter.sctp', 'diameter.dtls' or 'diameter.tls.tcp'. 2630 The client can follow the resolution process defined by the 2631 S-NAPTR DDDS [RFC3958] application to find a matching SRV, A or 2632 AAAA record of a suitable peer. The domain suffixes in the NAPTR 2633 replacement field SHOULD match the domain of the original query. 2634 An example can be found in Appendix B. 2636 3. If no NAPTR records are found, the requester directly queries for 2637 SRV records '_diameter._sctp'.realm, '_diameter._dtls'.realm, 2638 '_diameter._tcp'.realm and '_diameter._tls'.realm depending on 2639 the requesters network protocol capabilities. If SRV records are 2640 found then the requester can perform address record query (A RR's 2641 and/or AAAA RR's) for the target hostname specified in the SRV 2642 records. If no SRV records are found, the requester gives up. 2644 If the server is using a site certificate, the domain name in the 2645 NAPTR query and the domain name in the replacement field MUST both be 2646 valid based on the site certificate handed out by the server in the 2647 TLS/TCP and DTLS/SCTP or IKE exchange. Similarly, the domain name in 2648 the SRV query and the domain name in the target in the SRV record 2649 MUST both be valid based on the same site certificate. Otherwise, an 2650 attacker could modify the DNS records to contain replacement values 2651 in a different domain, and the client could not validate that this 2652 was the desired behavior, or the result of an attack. 2654 Also, the Diameter Peer MUST check to make sure that the discovered 2655 peers are authorized to act in its role. Authentication via IKE or 2656 TLS/TCP and DTLS/SCTP, or validation of DNS RRs via DNSSEC is not 2657 sufficient to conclude this. For example, a web server may have 2658 obtained a valid TLS/TCP and DTLS/SCTP certificate, and secured RRs 2659 may be included in the DNS, but this does not imply that it is 2660 authorized to act as a Diameter Server. 2662 Authorization can be achieved for example, by configuration of a 2663 Diameter Server CA. Alternatively this can be achieved by definition 2664 of OIDs within TLS/TCP and DTLS/SCTP or IKE certificates so as to 2665 signify Diameter Server authorization. 2667 A dynamically discovered peer causes an entry in the Peer Table (see 2668 Section 2.6) to be created. Note that entries created via DNS MUST 2669 expire (or be refreshed) within the DNS TTL. If a peer is discovered 2670 outside of the local realm, a routing table entry (see Section 2.7) 2671 for the peer's realm is created. The routing table entry's 2672 expiration MUST match the peer's expiration value. 2674 5.3. Capabilities Exchange 2676 When two Diameter peers establish a transport connection, they MUST 2677 exchange the Capabilities Exchange messages, as specified in the peer 2678 state machine (see Section 5.6). This message allows the discovery 2679 of a peer's identity and its capabilities (protocol version number, 2680 supported Diameter applications, security mechanisms, etc.) 2682 The receiver only issues commands to its peers that have advertised 2683 support for the Diameter application that defines the command. A 2684 Diameter node MUST cache the supported applications in order to 2685 ensure that unrecognized commands and/or AVPs are not unnecessarily 2686 sent to a peer. 2688 A receiver of a Capabilities-Exchange-Req (CER) message that does not 2689 have any applications in common with the sender MUST return a 2690 Capabilities-Exchange-Answer (CEA) with the Result-Code AVP set to 2691 DIAMETER_NO_COMMON_APPLICATION, and SHOULD disconnect the transport 2692 layer connection. Note that receiving a CER or CEA from a peer 2693 advertising itself as a Relay (see Section 2.4) MUST be interpreted 2694 as having common applications with the peer. 2696 The receiver of the Capabilities-Exchange-Request (CER) MUST 2697 determine common applications by computing the intersection of its 2698 own set of supported Application Id against all of the application 2699 identifier AVPs (Auth-Application-Id, Acct-Application-Id and Vendor- 2700 Specific-Application-Id) present in the CER. The value of the 2701 Vendor-Id AVP in the Vendor-Specific-Application-Id MUST NOT be used 2702 during computation. The sender of the Capabilities-Exchange-Answer 2703 (CEA) SHOULD include all of its supported applications as a hint to 2704 the receiver regarding all of its application capabilities. 2706 Diameter implementations SHOULD first attempt to establish a TLS/TCP 2707 and DTLS/SCTP connection prior to the CER/CEA exchange. This 2708 protects the capabilities information of both peers. To support 2709 older Diameter implementations that do not fully conform to this 2710 document, the transport security MAY still be negotiated via Inband- 2711 Security AVP. In this case, the receiver of a Capabilities-Exchange- 2712 Req (CER) message that does not have any security mechanisms in 2713 common with the sender MUST return a Capabilities-Exchange-Answer 2714 (CEA) with the Result-Code AVP set to DIAMETER_NO_COMMON_SECURITY, 2715 and SHOULD disconnect the transport layer connection. 2717 CERs received from unknown peers MAY be silently discarded, or a CEA 2718 MAY be issued with the Result-Code AVP set to DIAMETER_UNKNOWN_PEER. 2719 In both cases, the transport connection is closed. If the local 2720 policy permits receiving CERs from unknown hosts, a successful CEA 2721 MAY be returned. If a CER from an unknown peer is answered with a 2722 successful CEA, the lifetime of the peer entry is equal to the 2723 lifetime of the transport connection. In case of a transport 2724 failure, all the pending transactions destined to the unknown peer 2725 can be discarded. 2727 The CER and CEA messages MUST NOT be proxied, redirected or relayed. 2729 Since the CER/CEA messages cannot be proxied, it is still possible 2730 that an upstream agent receives a message for which it has no 2731 available peers to handle the application that corresponds to the 2732 Command-Code. In such instances, the 'E' bit is set in the answer 2733 message (see Section 7.) with the Result-Code AVP set to 2734 DIAMETER_UNABLE_TO_DELIVER to inform the downstream to take action 2735 (e.g., re-routing request to an alternate peer). 2737 With the exception of the Capabilities-Exchange-Request message, a 2738 message of type Request that includes the Auth-Application-Id or 2739 Acct-Application-Id AVPs, or a message with an application-specific 2740 command code, MAY only be forwarded to a host that has explicitly 2741 advertised support for the application (or has advertised the Relay 2742 Application Id). 2744 5.3.1. Capabilities-Exchange-Request 2746 The Capabilities-Exchange-Request (CER), indicated by the Command- 2747 Code set to 257 and the Command Flags' 'R' bit set, is sent to 2748 exchange local capabilities. Upon detection of a transport failure, 2749 this message MUST NOT be sent to an alternate peer. 2751 When Diameter is run over SCTP [RFC4960] or DTLS/SCTP [RFC6083], 2752 which allow for connections to span multiple interfaces and multiple 2753 IP addresses, the Capabilities-Exchange-Request message MUST contain 2754 one Host-IP- Address AVP for each potential IP address that MAY be 2755 locally used when transmitting Diameter messages. 2757 Message Format 2759 ::= < Diameter Header: 257, REQ > 2760 { Origin-Host } 2761 { Origin-Realm } 2762 1* { Host-IP-Address } 2763 { Vendor-Id } 2764 { Product-Name } 2765 [ Origin-State-Id ] 2766 * [ Supported-Vendor-Id ] 2767 * [ Auth-Application-Id ] 2768 * [ Inband-Security-Id ] 2769 * [ Acct-Application-Id ] 2770 * [ Vendor-Specific-Application-Id ] 2771 [ Firmware-Revision ] 2772 * [ AVP ] 2774 5.3.2. Capabilities-Exchange-Answer 2776 The Capabilities-Exchange-Answer (CEA), indicated by the Command-Code 2777 set to 257 and the Command Flags' 'R' bit cleared, is sent in 2778 response to a CER message. 2780 When Diameter is run over SCTP [RFC4960] or DTLS/SCTP [RFC6083], 2781 which allow connections to span multiple interfaces, hence, multiple 2782 IP addresses, the Capabilities-Exchange-Answer message MUST contain 2783 one Host-IP-Address AVP for each potential IP address that MAY be 2784 locally used when transmitting Diameter messages. 2786 Message Format 2788 ::= < Diameter Header: 257 > 2789 { Result-Code } 2790 { Origin-Host } 2791 { Origin-Realm } 2792 1* { Host-IP-Address } 2793 { Vendor-Id } 2794 { Product-Name } 2795 [ Origin-State-Id ] 2796 [ Error-Message ] 2797 [ Failed-AVP ] 2798 * [ Supported-Vendor-Id ] 2799 * [ Auth-Application-Id ] 2800 * [ Inband-Security-Id ] 2801 * [ Acct-Application-Id ] 2802 * [ Vendor-Specific-Application-Id ] 2803 [ Firmware-Revision ] 2804 * [ AVP ] 2806 5.3.3. Vendor-Id AVP 2808 The Vendor-Id AVP (AVP Code 266) is of type Unsigned32 and contains 2809 the IANA "SMI Network Management Private Enterprise Codes" [RFC3232] 2810 value assigned to the Diameter Software vendor. It is envisioned 2811 that the combination of the Vendor-Id, Product-Name (Section 5.3.7) 2812 and the Firmware-Revision (Section 5.3.4) AVPs may provide useful 2813 debugging information. 2815 A Vendor-Id value of zero in the CER or CEA messages is reserved and 2816 indicates that this field is ignored. 2818 5.3.4. Firmware-Revision AVP 2820 The Firmware-Revision AVP (AVP Code 267) is of type Unsigned32 and is 2821 used to inform a Diameter peer of the firmware revision of the 2822 issuing device. 2824 For devices that do not have a firmware revision (general purpose 2825 computers running Diameter software modules, for instance), the 2826 revision of the Diameter software module may be reported instead. 2828 5.3.5. Host-IP-Address AVP 2830 The Host-IP-Address AVP (AVP Code 257) is of type Address and is used 2831 to inform a Diameter peer of the sender's IP address. All source 2832 addresses that a Diameter node expects to use with SCTP [RFC4960] or 2833 DTLS/SCTP [RFC6083] MUST be advertised in the CER and CEA messages by 2834 including a Host-IP-Address AVP for each address. 2836 5.3.6. Supported-Vendor-Id AVP 2838 The Supported-Vendor-Id AVP (AVP Code 265) is of type Unsigned32 and 2839 contains the IANA "SMI Network Management Private Enterprise Codes" 2840 [RFC3232] value assigned to a vendor other than the device vendor but 2841 including the application vendor. This is used in the CER and CEA 2842 messages in order to inform the peer that the sender supports (a 2843 subset of) the vendor-specific AVPs defined by the vendor identified 2844 in this AVP. The value of this AVP MUST NOT be set to zero. 2845 Multiple instances of this AVP containing the same value SHOULD NOT 2846 be sent. 2848 5.3.7. Product-Name AVP 2850 The Product-Name AVP (AVP Code 269) is of type UTF8String, and 2851 contains the vendor assigned name for the product. The Product-Name 2852 AVP SHOULD remain constant across firmware revisions for the same 2853 product. 2855 5.4. Disconnecting Peer connections 2857 When a Diameter node disconnects one of its transport connections, 2858 its peer cannot know the reason for the disconnect, and will most 2859 likely assume that a connectivity problem occurred, or that the peer 2860 has rebooted. In these cases, the peer may periodically attempt to 2861 reconnect, as stated in Section 2.1. In the event that the 2862 disconnect was a result of either a shortage of internal resources, 2863 or simply that the node in question has no intentions of forwarding 2864 any Diameter messages to the peer in the foreseeable future, a 2865 periodic connection request would not be welcomed. The 2866 Disconnection-Reason AVP contains the reason the Diameter node issued 2867 the Disconnect-Peer-Request message. 2869 The Disconnect-Peer-Request message is used by a Diameter node to 2870 inform its peer of its intent to disconnect the transport layer, and 2871 that the peer shouldn't reconnect unless it has a valid reason to do 2872 so (e.g., message to be forwarded). Upon receipt of the message, the 2873 Disconnect-Peer-Answer is returned, which SHOULD contain an error if 2874 messages have recently been forwarded, and are likely in flight, 2875 which would otherwise cause a race condition. 2877 The receiver of the Disconnect-Peer-Answer initiates the transport 2878 disconnect. The sender of the Disconnect-Peer-Answer should be able 2879 to detect the transport closure and cleanup the connection. 2881 5.4.1. Disconnect-Peer-Request 2883 The Disconnect-Peer-Request (DPR), indicated by the Command-Code set 2884 to 282 and the Command Flags' 'R' bit set, is sent to a peer to 2885 inform its intentions to shutdown the transport connection. Upon 2886 detection of a transport failure, this message MUST NOT be sent to an 2887 alternate peer. 2889 Message Format 2891 ::= < Diameter Header: 282, REQ > 2892 { Origin-Host } 2893 { Origin-Realm } 2894 { Disconnect-Cause } 2895 * [ AVP ] 2897 5.4.2. Disconnect-Peer-Answer 2899 The Disconnect-Peer-Answer (DPA), indicated by the Command-Code set 2900 to 282 and the Command Flags' 'R' bit cleared, is sent as a response 2901 to the Disconnect-Peer-Request message. Upon receipt of this 2902 message, the transport connection is shutdown. 2904 Message Format 2906 ::= < Diameter Header: 282 > 2907 { Result-Code } 2908 { Origin-Host } 2909 { Origin-Realm } 2910 [ Error-Message ] 2911 [ Failed-AVP ] 2912 * [ AVP ] 2914 5.4.3. Disconnect-Cause AVP 2916 The Disconnect-Cause AVP (AVP Code 273) is of type Enumerated. A 2917 Diameter node MUST include this AVP in the Disconnect-Peer-Request 2918 message to inform the peer of the reason for its intention to 2919 shutdown the transport connection. The following values are 2920 supported: 2922 REBOOTING 0 2923 A scheduled reboot is imminent. Receiver of DPR with above 2924 result code MAY attempt reconnection. 2926 BUSY 1 2927 The peer's internal resources are constrained, and it has 2928 determined that the transport connection needs to be closed. 2929 Receiver of DPR with above result code SHOULD NOT attempt 2930 reconnection. 2932 DO_NOT_WANT_TO_TALK_TO_YOU 2 2933 The peer has determined that it does not see a need for the 2934 transport connection to exist, since it does not expect any 2935 messages to be exchanged in the near future. Receiver of DPR 2936 with above result code SHOULD NOT attempt reconnection. 2938 5.5. Transport Failure Detection 2940 Given the nature of the Diameter protocol, it is recommended that 2941 transport failures be detected as soon as possible. Detecting such 2942 failures will minimize the occurrence of messages sent to unavailable 2943 agents, resulting in unnecessary delays, and will provide better 2944 failover performance. The Device-Watchdog-Request and Device- 2945 Watchdog-Answer messages, defined in this section, are used to pro- 2946 actively detect transport failures. 2948 5.5.1. Device-Watchdog-Request 2950 The Device-Watchdog-Request (DWR), indicated by the Command-Code set 2951 to 280 and the Command Flags' 'R' bit set, is sent to a peer when no 2952 traffic has been exchanged between two peers (see Section 5.5.3). 2953 Upon detection of a transport failure, this message MUST NOT be sent 2954 to an alternate peer. 2956 Message Format 2958 ::= < Diameter Header: 280, REQ > 2959 { Origin-Host } 2960 { Origin-Realm } 2961 [ Origin-State-Id ] 2962 * [ AVP ] 2964 5.5.2. Device-Watchdog-Answer 2966 The Device-Watchdog-Answer (DWA), indicated by the Command-Code set 2967 to 280 and the Command Flags' 'R' bit cleared, is sent as a response 2968 to the Device-Watchdog-Request message. 2970 Message Format 2972 ::= < Diameter Header: 280 > 2973 { Result-Code } 2974 { Origin-Host } 2975 { Origin-Realm } 2976 [ Error-Message ] 2977 [ Failed-AVP ] 2978 [ Origin-State-Id ] 2979 * [ AVP ] 2981 5.5.3. Transport Failure Algorithm 2983 The transport failure algorithm is defined in [RFC3539]. All 2984 Diameter implementations MUST support the algorithm defined in the 2985 specification in order to be compliant to the Diameter base protocol. 2987 5.5.4. Failover and Failback Procedures 2989 In the event that a transport failure is detected with a peer, it is 2990 necessary for all pending request messages to be forwarded to an 2991 alternate agent, if possible. This is commonly referred to as 2992 failover. 2994 In order for a Diameter node to perform failover procedures, it is 2995 necessary for the node to maintain a pending message queue for a 2996 given peer. When an answer message is received, the corresponding 2997 request is removed from the queue. The Hop-by-Hop Identifier field 2998 is used to match the answer with the queued request. 3000 When a transport failure is detected, if possible all messages in the 3001 queue are sent to an alternate agent with the T flag set. On booting 3002 a Diameter client or agent, the T flag is also set on any records 3003 still remaining to be transmitted in non-volatile storage. An 3004 example of a case where it is not possible to forward the message to 3005 an alternate server is when the message has a fixed destination, and 3006 the unavailable peer is the message's final destination (see 3007 Destination-Host AVP). Such an error requires that the agent return 3008 an answer message with the 'E' bit set and the Result-Code AVP set to 3009 DIAMETER_UNABLE_TO_DELIVER. 3011 It is important to note that multiple identical requests or answers 3012 MAY be received as a result of a failover. The End-to-End Identifier 3013 field in the Diameter header along with the Origin-Host AVP MUST be 3014 used to identify duplicate messages. 3016 As described in Section 2.1, a connection request should be 3017 periodically attempted with the failed peer in order to re-establish 3018 the transport connection. Once a connection has been successfully 3019 established, messages can once again be forwarded to the peer. This 3020 is commonly referred to as failback. 3022 5.6. Peer State Machine 3024 This section contains a finite state machine that MUST be observed by 3025 all Diameter implementations. Each Diameter node MUST follow the 3026 state machine described below when communicating with each peer. 3027 Multiple actions are separated by commas, and may continue on 3028 succeeding lines, as space requires. Similarly, state and next state 3029 may also span multiple lines, as space requires. 3031 This state machine is closely coupled with the state machine 3032 described in [RFC3539], which is used to open, close, failover, 3033 probe, and reopen transport connections. Note in particular that 3034 [RFC3539] requires the use of watchdog messages to probe connections. 3035 For Diameter, DWR and DWA messages are to be used. 3037 I- is used to represent the initiator (connecting) connection, while 3038 the R- is used to represent the responder (listening) connection. 3039 The lack of a prefix indicates that the event or action is the same 3040 regardless of the connection on which the event occurred. 3042 The stable states that a state machine may be in are Closed, I-Open 3043 and R-Open; all other states are intermediate. Note that I-Open and 3044 R-Open are equivalent except for whether the initiator or responder 3045 transport connection is used for communication. 3047 A CER message is always sent on the initiating connection immediately 3048 after the connection request is successfully completed. In the case 3049 of an election, one of the two connections will shut down. The 3050 responder connection will survive if the Origin-Host of the local 3051 Diameter entity is higher than that of the peer; the initiator 3052 connection will survive if the peer's Origin-Host is higher. All 3053 subsequent messages are sent on the surviving connection. Note that 3054 the results of an election on one peer are guaranteed to be the 3055 inverse of the results on the other. 3057 For TLS/TCP and DTLS/SCTP usage, TLS/TCP and DTLS/SCTP handshake 3058 SHOULD begin when both ends are in the closed state prior to any 3059 Diameter message exchanges. The TLS/TCP and DTLS/SCTP connection 3060 SHOULD be established before sending any CER or CEA message to secure 3061 and protect the capabilities information of both peers. The TLS/TCP 3062 and DTLS/SCTP connection SHOULD be disconnected when the state 3063 machine moves to the closed state. When connecting to responders 3064 that do not conform to this document (i.e. older Diameter 3065 implementations that are not prepared to received TLS/TCP and DTLS/ 3066 SCTP connections in the closed state), the initial TLS/TCP and DTLS/ 3067 SCTP connection attempt will fail. The initiator MAY then attempt to 3068 connect via TCP or SCTP and initiate the TLS/TCP and DTLS/SCTP 3069 handshake when both ends are in the open state. If the handshake is 3070 successful, all further messages will be sent via TLS/TCP and DTLS/ 3071 SCTP. If the handshake fails, both ends move to the closed state. 3073 The state machine constrains only the behavior of a Diameter 3074 implementation as seen by Diameter peers through events on the wire. 3076 Any implementation that produces equivalent results is considered 3077 compliant. 3079 state event action next state 3080 ----------------------------------------------------------------- 3081 Closed Start I-Snd-Conn-Req Wait-Conn-Ack 3082 R-Conn-CER R-Accept, R-Open 3083 Process-CER, 3084 R-Snd-CEA 3086 Wait-Conn-Ack I-Rcv-Conn-Ack I-Snd-CER Wait-I-CEA 3087 I-Rcv-Conn-Nack Cleanup Closed 3088 R-Conn-CER R-Accept, Wait-Conn-Ack/ 3089 Process-CER Elect 3090 Timeout Error Closed 3092 Wait-I-CEA I-Rcv-CEA Process-CEA I-Open 3093 R-Conn-CER R-Accept, Wait-Returns 3094 Process-CER, 3095 Elect 3096 I-Peer-Disc I-Disc Closed 3097 I-Rcv-Non-CEA Error Closed 3098 Timeout Error Closed 3100 Wait-Conn-Ack/ I-Rcv-Conn-Ack I-Snd-CER,Elect Wait-Returns 3101 Elect I-Rcv-Conn-Nack R-Snd-CEA R-Open 3102 R-Peer-Disc R-Disc Wait-Conn-Ack 3103 R-Conn-CER R-Reject Wait-Conn-Ack/ 3104 Elect 3105 Timeout Error Closed 3107 Wait-Returns Win-Election I-Disc,R-Snd-CEA R-Open 3108 I-Peer-Disc I-Disc, R-Open 3109 R-Snd-CEA 3110 I-Rcv-CEA R-Disc I-Open 3111 R-Peer-Disc R-Disc Wait-I-CEA 3112 R-Conn-CER R-Reject Wait-Returns 3113 Timeout Error Closed 3115 R-Open Send-Message R-Snd-Message R-Open 3116 R-Rcv-Message Process R-Open 3117 R-Rcv-DWR Process-DWR, R-Open 3118 R-Snd-DWA 3119 R-Rcv-DWA Process-DWA R-Open 3120 R-Conn-CER R-Reject R-Open 3121 Stop R-Snd-DPR Closing 3122 R-Rcv-DPR R-Snd-DPA, Closed 3123 R-Disc 3124 R-Peer-Disc R-Disc Closed 3126 I-Open Send-Message I-Snd-Message I-Open 3127 I-Rcv-Message Process I-Open 3128 I-Rcv-DWR Process-DWR, I-Open 3129 I-Snd-DWA 3130 I-Rcv-DWA Process-DWA I-Open 3131 R-Conn-CER R-Reject I-Open 3132 Stop I-Snd-DPR Closing 3133 I-Rcv-DPR I-Snd-DPA, Closed 3134 I-Disc 3135 I-Peer-Disc I-Disc Closed 3137 Closing I-Rcv-DPA I-Disc Closed 3138 R-Rcv-DPA R-Disc Closed 3139 Timeout Error Closed 3140 I-Peer-Disc I-Disc Closed 3141 R-Peer-Disc R-Disc Closed 3143 5.6.1. Incoming connections 3145 When a connection request is received from a Diameter peer, it is 3146 not, in the general case, possible to know the identity of that peer 3147 until a CER is received from it. This is because host and port 3148 determine the identity of a Diameter peer; and the source port of an 3149 incoming connection is arbitrary. Upon receipt of CER, the identity 3150 of the connecting peer can be uniquely determined from Origin-Host. 3152 For this reason, a Diameter peer must employ logic separate from the 3153 state machine to receive connection requests, accept them, and await 3154 CER. Once CER arrives on a new connection, the Origin-Host that 3155 identifies the peer is used to locate the state machine associated 3156 with that peer, and the new connection and CER are passed to the 3157 state machine as an R-Conn-CER event. 3159 The logic that handles incoming connections SHOULD close and discard 3160 the connection if any message other than CER arrives, or if an 3161 implementation-defined timeout occurs prior to receipt of CER. 3163 Because handling of incoming connections up to and including receipt 3164 of CER requires logic, separate from that of any individual state 3165 machine associated with a particular peer, it is described separately 3166 in this section rather than in the state machine above. 3168 5.6.2. Events 3170 Transitions and actions in the automaton are caused by events. In 3171 this section, we will ignore the -I and -R prefix, since the actual 3172 event would be identical, but would occur on one of two possible 3173 connections. 3175 Start The Diameter application has signaled that a 3176 connection should be initiated with the peer. 3178 R-Conn-CER An acknowledgement is received stating that the 3179 transport connection has been established, and the 3180 associated CER has arrived. 3182 Rcv-Conn-Ack A positive acknowledgement is received confirming that 3183 the transport connection is established. 3185 Rcv-Conn-Nack A negative acknowledgement was received stating that 3186 the transport connection was not established. 3188 Timeout An application-defined timer has expired while waiting 3189 for some event. 3191 Rcv-CER A CER message from the peer was received. 3193 Rcv-CEA A CEA message from the peer was received. 3195 Rcv-Non-CEA A message other than CEA from the peer was received. 3197 Peer-Disc A disconnection indication from the peer was received. 3199 Rcv-DPR A DPR message from the peer was received. 3201 Rcv-DPA A DPA message from the peer was received. 3203 Win-Election An election was held, and the local node was the 3204 winner. 3206 Send-Message A message is to be sent. 3208 Rcv-Message A message other than CER, CEA, DPR, DPA, DWR or DWA 3209 was received. 3211 Stop The Diameter application has signaled that a 3212 connection should be terminated (e.g., on system 3213 shutdown). 3215 5.6.3. Actions 3217 Actions in the automaton are caused by events and typically indicate 3218 the transmission of packets and/or an action to be taken on the 3219 connection. In this section we will ignore the I- and R-prefix, 3220 since the actual action would be identical, but would occur on one of 3221 two possible connections. 3223 Snd-Conn-Req A transport connection is initiated with the peer. 3225 Accept The incoming connection associated with the R-Conn-CER 3226 is accepted as the responder connection. 3228 Reject The incoming connection associated with the R-Conn-CER 3229 is disconnected. 3231 Process-CER The CER associated with the R-Conn-CER is processed. 3232 Snd-CER A CER message is sent to the peer. 3234 Snd-CEA A CEA message is sent to the peer. 3236 Cleanup If necessary, the connection is shutdown, and any 3237 local resources are freed. 3239 Error The transport layer connection is disconnected, 3240 either politely or abortively, in response to 3241 an error condition. Local resources are freed. 3243 Process-CEA A received CEA is processed. 3245 Snd-DPR A DPR message is sent to the peer. 3247 Snd-DPA A DPA message is sent to the peer. 3249 Disc The transport layer connection is disconnected, 3250 and local resources are freed. 3252 Elect An election occurs (see Section 5.6.4 for more 3253 information). 3255 Snd-Message A message is sent. 3257 Snd-DWR A DWR message is sent. 3259 Snd-DWA A DWA message is sent. 3261 Process-DWR The DWR message is serviced. 3263 Process-DWA The DWA message is serviced. 3265 Process A message is serviced. 3267 5.6.4. The Election Process 3269 The election is performed on the responder. The responder compares 3270 the Origin-Host received in the CER with its own Origin-Host as two 3271 streams of octets. If the local Origin-Host lexicographically 3272 succeeds the received Origin-Host a Win-Election event is issued 3273 locally. Diameter identities are in ASCII form therefore the lexical 3274 comparison is consistent with DNS case insensitivity where octets 3275 that fall in the ASCII range 'a' through 'z' MUST compare equally to 3276 their upper-case counterparts between 'A' and 'Z'. See Appendix D 3277 for interactions between the Diameter protocol and Internationalized 3278 Domain Name (IDNs). 3280 The winner of the election MUST close the connection it initiated. 3281 Historically, maintaining the responder side of a connection was more 3282 efficient than maintaining the initiator side. However, current 3283 practices makes this distinction irrelevant. 3285 6. Diameter message processing 3287 This section describes how Diameter requests and answers are created 3288 and processed. 3290 6.1. Diameter Request Routing Overview 3292 A request is sent towards its final destination using a combination 3293 of the Destination-Realm and Destination-Host AVPs, in one of these 3294 three combinations: 3296 o a request that is not able to be proxied (such as CER) MUST NOT 3297 contain either Destination-Realm or Destination-Host AVPs. 3299 o a request that needs to be sent to a home server serving a 3300 specific realm, but not to a specific server (such as the first 3301 request of a series of round-trips), MUST contain a Destination- 3302 Realm AVP, but MUST NOT contain a Destination-Host AVP. For 3303 Diameter clients, the value of the Destination-Realm AVP MAY be 3304 extracted from the User-Name AVP, or other methods. 3306 o otherwise, a request that needs to be sent to a specific home 3307 server among those serving a given realm, MUST contain both the 3308 Destination-Realm and Destination-Host AVPs. 3310 The Destination-Host AVP is used as described above when the 3311 destination of the request is fixed, which includes: 3313 o Authentication requests that span multiple round trips 3315 o A Diameter message that uses a security mechanism that makes use 3316 of a pre-established session key shared between the source and the 3317 final destination of the message. 3319 o Server initiated messages that MUST be received by a specific 3320 Diameter client (e.g., access device), such as the Abort-Session- 3321 Request message, which is used to request that a particular user's 3322 session be terminated. 3324 Note that an agent can forward a request to a host described in the 3325 Destination-Host AVP only if the host in question is included in its 3326 peer table (see Section 2.7). Otherwise, the request is routed based 3327 on the Destination-Realm only (see Sections 6.1.6). 3329 When a message is received, the message is processed in the following 3330 order: 3332 o If the message is destined for the local host, the procedures 3333 listed in Section 6.1.4 are followed. 3335 o If the message is intended for a Diameter peer with whom the local 3336 host is able to directly communicate, the procedures listed in 3337 Section 6.1.5 are followed. This is known as Request Forwarding. 3339 o The procedures listed in Section 6.1.6 are followed, which is 3340 known as Request Routing. 3342 o If none of the above is successful, an answer is returned with the 3343 Result-Code set to DIAMETER_UNABLE_TO_DELIVER, with the E-bit set. 3345 For routing of Diameter messages to work within an administrative 3346 domain, all Diameter nodes within the realm MUST be peers. 3348 Note the processing rules contained in this section are intended to 3349 be used as general guidelines to Diameter developers. Certain 3350 implementations MAY use different methods than the ones described 3351 here, and still comply with the protocol specification. See Section 3352 7 for more detail on error handling. 3354 6.1.1. Originating a Request 3356 When creating a request, in addition to any other procedures 3357 described in the application definition for that specific request, 3358 the following procedures MUST be followed: 3360 o the Command-Code is set to the appropriate value 3362 o the 'R' bit is set 3364 o the End-to-End Identifier is set to a locally unique value 3366 o the Origin-Host and Origin-Realm AVPs MUST be set to the 3367 appropriate values, used to identify the source of the message 3369 o the Destination-Host and Destination-Realm AVPs MUST be set to the 3370 appropriate values as described in Section 6.1. 3372 6.1.2. Sending a Request 3374 When sending a request, originated either locally, or as the result 3375 of a forwarding or routing operation, the following procedures SHOULD 3376 be followed: 3378 o The Hop-by-Hop Identifier SHOULD be set to a locally unique value. 3380 o The message SHOULD be saved in the list of pending requests. 3382 Other actions to perform on the message based on the particular role 3383 the agent is playing are described in the following sections. 3385 6.1.3. Receiving Requests 3387 A relay or proxy agent MUST check for forwarding loops when receiving 3388 requests. A loop is detected if the server finds its own identity in 3389 a Route-Record AVP. When such an event occurs, the agent MUST answer 3390 with the Result-Code AVP set to DIAMETER_LOOP_DETECTED. 3392 6.1.4. Processing Local Requests 3394 A request is known to be for local consumption when one of the 3395 following conditions occur: 3397 o The Destination-Host AVP contains the local host's identity, 3399 o The Destination-Host AVP is not present, the Destination-Realm AVP 3400 contains a realm the server is configured to process locally, and 3401 the Diameter application is locally supported, or 3403 o Both the Destination-Host and the Destination-Realm are not 3404 present. 3406 When a request is locally processed, the rules in Section 6.2 should 3407 be used to generate the corresponding answer. 3409 6.1.5. Request Forwarding 3411 Request forwarding is done using the Diameter Peer Table. The 3412 Diameter peer table contains all of the peers that the local node is 3413 able to directly communicate with. 3415 When a request is received, and the host encoded in the Destination- 3416 Host AVP is one that is present in the peer table, the message SHOULD 3417 be forwarded to the peer. 3419 6.1.6. Request Routing 3421 Diameter request message routing is done via realms and application 3422 identifiers. A Diameter message that may be forwarded by Diameter 3423 agents (proxies, redirect or relay agents) MUST include the target 3424 realm in the Destination-Realm AVP. Request routing SHOULD rely on 3425 the Destination-Realm AVP and the Application Id present in the 3426 request message header to aid in the routing decision. The realm MAY 3427 be retrieved from the User-Name AVP, which is in the form of a 3428 Network Access Identifier (NAI). The realm portion of the NAI is 3429 inserted in the Destination-Realm AVP. 3431 Diameter agents MAY have a list of locally supported realms and 3432 applications, and MAY have a list of externally supported realms and 3433 applications. When a request is received that includes a realm 3434 and/or application that is not locally supported, the message is 3435 routed to the peer configured in the Routing Table (see Section 2.7). 3437 Realm names and Application Ids are the minimum supported routing 3438 criteria, additional information may be needed to support redirect 3439 semantics. 3441 6.1.7. Predictive Loop Avoidance 3443 Before forwarding or routing a request, Diameter agents, in addition 3444 to processing done in Section 6.1.3, SHOULD check for the presence of 3445 candidate route's peer identity in any of the Route-Record AVPs. In 3446 an event of the agent detecting the presence of a candidate route's 3447 peer identity in a Route-Record AVP, the agent MUST ignore such route 3448 for the Diameter request message and attempt alternate routes if any. 3449 In case all the candidate routes are eliminated by the above 3450 criteria, the agent SHOULD return DIAMETER_UNABLE_TO_DELIVER message. 3452 6.1.8. Redirecting Requests 3454 When a redirect agent receives a request whose routing entry is set 3455 to REDIRECT, it MUST reply with an answer message with the 'E' bit 3456 set, while maintaining the Hop-by-Hop Identifier in the header, and 3457 include the Result-Code AVP to DIAMETER_REDIRECT_INDICATION. Each of 3458 the servers associated with the routing entry are added in separate 3459 Redirect-Host AVP. 3461 +------------------+ 3462 | Diameter | 3463 | Redirect Agent | 3464 +------------------+ 3465 ^ | 2. command + 'E' bit 3466 1. Request | | Result-Code = 3467 joe@example.com | | DIAMETER_REDIRECT_INDICATION + 3468 | | Redirect-Host AVP(s) 3469 | v 3470 +-------------+ 3. Request +-------------+ 3471 | example.com |------------->| example.net | 3472 | Relay | | Diameter | 3473 | Agent |<-------------| Server | 3474 +-------------+ 4. Answer +-------------+ 3476 Figure 5: Diameter Redirect Agent 3478 The receiver of the answer message with the 'E' bit set, and the 3479 Result-Code AVP set to DIAMETER_REDIRECT_INDICATION uses the hop-by- 3480 hop field in the Diameter header to identify the request in the 3481 pending message queue (see Section 5.3) that is to be redirected. If 3482 no transport connection exists with the new agent, one is created, 3483 and the request is sent directly to it. 3485 Multiple Redirect-Host AVPs are allowed. The receiver of the answer 3486 message with the 'E' bit set selects exactly one of these hosts as 3487 the destination of the redirected message. 3489 When the Redirect-Host-Usage AVP included in the answer message has a 3490 non-zero value, a route entry for the redirect indications is created 3491 and cached by the receiver. The redirect usage for such route entry 3492 is set by the value of Redirect-Host-Usage AVP and the lifetime of 3493 the cached route entry is set by Redirect-Max-Cache-Time AVP value. 3495 It is possible that multiple redirect indications can create multiple 3496 cached route entries differing only in their redirect usage and the 3497 peer to forward messages to. As an example, two(2) route entries 3498 that are created by two(2) redirect indications results in two(2) 3499 cached routes for the same realm and Application Id. However, one 3500 has a redirect usage of ALL_SESSION where matching request will be 3501 forwarded to one peer and the other has a redirect usage of ALL_REALM 3502 where request are forwarded to another peer. Therefore, an incoming 3503 request that matches the realm and Application Id of both routes will 3504 need additional resolution. In such a case, a routing precedence 3505 rule MUST be used against the redirect usage value to resolve the 3506 contention. The precedence rule can be found in Section 6.13. 3508 6.1.9. Relaying and Proxying Requests 3510 A relay or proxy agent MUST append a Route-Record AVP to all requests 3511 forwarded. The AVP contains the identity of the peer the request was 3512 received from. 3514 The Hop-by-Hop identifier in the request is saved, and replaced with 3515 a locally unique value. The source of the request is also saved, 3516 which includes the IP address, port and protocol. 3518 A relay or proxy agent MAY include the Proxy-Info AVP in requests if 3519 it requires access to any local state information when the 3520 corresponding response is received. The Proxy-Info AVP has security 3521 implications as state information is distribute to other entities. 3522 As such, it is RECOMMMENDED to protect the content of the Proxy-Info 3523 AVP with cryptographic mechanisms, for example by using a keyed 3524 message digest. Such a mechanism, however, requires the management 3525 of keys, although only locally at the Diameter server. Still, a full 3526 description of the management of the keys used to protect the Proxy- 3527 Info AVP is beyond the scope of this document. Below is a list of 3528 commonly recommended: 3530 o The keys should be generated securely following the randomness 3531 recommendations in [RFC4086]. 3533 o The keys and cryptographic protection algorithms should be at 3534 least 128 bits in strength. 3536 o The keys should not be used for any other purpose than generating 3537 and verifying tickets. 3539 o The keys should be changed regularly. 3541 o The keys should be changed if the ticket format or cryptographic 3542 protection algorithms change. 3544 The message is then forwarded to the next hop, as identified in the 3545 Routing Table. 3547 Figure 6 provides an example of message routing using the procedures 3548 listed in these sections. 3550 (Origin-Host=nas.example.net) (Origin-Host=nas.example.net) 3551 (Origin-Realm=example.net) (Origin-Realm=example.net) 3552 (Destination-Realm=example.com) (Destination- 3553 Realm=example.com) 3554 (Route-Record=nas.example.net) 3555 +------+ ------> +------+ ------> +------+ 3556 | | (Request) | | (Request) | | 3557 | NAS +-------------------+ DRL +-------------------+ HMS | 3558 | | | | | | 3559 +------+ <------ +------+ <------ +------+ 3560 example.net (Answer) example.net (Answer) example.com 3561 (Origin-Host=hms.example.com) (Origin-Host=hms.example.com) 3562 (Origin-Realm=example.com) (Origin-Realm=example.com) 3564 Figure 6: Routing of Diameter messages 3566 Relay and proxy agents are not required to perform full inspection of 3567 incoming messages. At a minimum, validation of the message header 3568 and relevant routing AVPs has to be done when relaying messages. 3569 Proxy agents may optionally perform more in-depth message validation 3570 for applications it is interested in. 3572 6.2. Diameter Answer Processing 3574 When a request is locally processed, the following procedures MUST be 3575 applied to create the associated answer, in addition to any 3576 additional procedures that MAY be discussed in the Diameter 3577 application defining the command: 3579 o The same Hop-by-Hop identifier in the request is used in the 3580 answer. 3582 o The local host's identity is encoded in the Origin-Host AVP. 3584 o The Destination-Host and Destination-Realm AVPs MUST NOT be 3585 present in the answer message. 3587 o The Result-Code AVP is added with its value indicating success or 3588 failure. 3590 o If the Session-Id is present in the request, it MUST be included 3591 in the answer. 3593 o Any Proxy-Info AVPs in the request MUST be added to the answer 3594 message, in the same order they were present in the request. 3596 o The 'P' bit is set to the same value as the one in the request. 3598 o The same End-to-End identifier in the request is used in the 3599 answer. 3601 Note that the error messages (see Section 7.3) are also subjected to 3602 the above processing rules. 3604 6.2.1. Processing received Answers 3606 A Diameter client or proxy MUST match the Hop-by-Hop Identifier in an 3607 answer received against the list of pending requests. The 3608 corresponding message should be removed from the list of pending 3609 requests. It SHOULD ignore answers received that do not match a 3610 known Hop-by-Hop Identifier. 3612 6.2.2. Relaying and Proxying Answers 3614 If the answer is for a request which was proxied or relayed, the 3615 agent MUST restore the original value of the Diameter header's Hop- 3616 by-Hop Identifier field. 3618 If the last Proxy-Info AVP in the message is targeted to the local 3619 Diameter server, the AVP MUST be removed before the answer is 3620 forwarded. 3622 If a relay or proxy agent receives an answer with a Result-Code AVP 3623 indicating a failure, it MUST NOT modify the contents of the AVP. 3624 Any additional local errors detected SHOULD be logged, but not 3625 reflected in the Result-Code AVP. If the agent receives an answer 3626 message with a Result-Code AVP indicating success, and it wishes to 3627 modify the AVP to indicate an error, it MUST modify the Result-Code 3628 AVP to contain the appropriate error in the message destined towards 3629 the access device as well as include the Error-Reporting-Host AVP and 3630 it MUST issue an STR on behalf of the access device towards the 3631 Diameter server. 3633 The agent MUST then send the answer to the host that it received the 3634 original request from. 3636 6.3. Origin-Host AVP 3638 The Origin-Host AVP (AVP Code 264) is of type DiameterIdentity, and 3639 MUST be present in all Diameter messages. This AVP identifies the 3640 endpoint that originated the Diameter message. Relay agents MUST NOT 3641 modify this AVP. 3643 The value of the Origin-Host AVP is guaranteed to be unique within a 3644 single host. 3646 Note that the Origin-Host AVP may resolve to more than one address as 3647 the Diameter peer may support more than one address. 3649 This AVP SHOULD be placed as close to the Diameter header as 3650 possible. 3652 6.4. Origin-Realm AVP 3654 The Origin-Realm AVP (AVP Code 296) is of type DiameterIdentity. 3655 This AVP contains the Realm of the originator of any Diameter message 3656 and MUST be present in all messages. 3658 This AVP SHOULD be placed as close to the Diameter header as 3659 possible. 3661 6.5. Destination-Host AVP 3663 The Destination-Host AVP (AVP Code 293) is of type DiameterIdentity. 3664 This AVP MUST be present in all unsolicited agent initiated messages, 3665 MAY be present in request messages, and MUST NOT be present in Answer 3666 messages. 3668 The absence of the Destination-Host AVP will cause a message to be 3669 sent to any Diameter server supporting the application within the 3670 realm specified in Destination-Realm AVP. 3672 This AVP SHOULD be placed as close to the Diameter header as 3673 possible. 3675 6.6. Destination-Realm AVP 3677 The Destination-Realm AVP (AVP Code 283) is of type DiameterIdentity, 3678 and contains the realm the message is to be routed to. The 3679 Destination-Realm AVP MUST NOT be present in Answer messages. 3680 Diameter Clients insert the realm portion of the User-Name AVP. 3681 Diameter servers initiating a request message use the value of the 3682 Origin-Realm AVP from a previous message received from the intended 3683 target host (unless it is known a priori). When present, the 3684 Destination-Realm AVP is used to perform message routing decisions. 3686 An ABNF for a request message that includes the Destination-Realm AVP 3687 SHOULD list the Destination-Realm AVP as a required AVP (an AVP 3688 indicated as {AVP}) otherwise the message is inherently a non- 3689 routable message. 3691 This AVP SHOULD be placed as close to the Diameter header as 3692 possible. 3694 6.7. Routing AVPs 3696 The AVPs defined in this section are Diameter AVPs used for routing 3697 purposes. These AVPs change as Diameter messages are processed by 3698 agents. 3700 6.7.1. Route-Record AVP 3702 The Route-Record AVP (AVP Code 282) is of type DiameterIdentity. The 3703 identity added in this AVP MUST be the same as the one received in 3704 the Origin-Host of the Capabilities Exchange message. 3706 6.7.2. Proxy-Info AVP 3708 The Proxy-Info AVP (AVP Code 284) is of type Grouped. This AVP 3709 contains the identity and local state information of the Diameter 3710 node that creates and adds it to a message. The Grouped Data field 3711 has the following ABNF grammar: 3713 Proxy-Info ::= < AVP Header: 284 > 3714 { Proxy-Host } 3715 { Proxy-State } 3716 * [ AVP ] 3718 6.7.3. Proxy-Host AVP 3720 The Proxy-Host AVP (AVP Code 280) is of type DiameterIdentity. This 3721 AVP contains the identity of the host that added the Proxy-Info AVP. 3723 6.7.4. Proxy-State AVP 3725 The Proxy-State AVP (AVP Code 33) is of type OctetString. It 3726 contains state information that would otherwise be stored at the 3727 Diameter entity that created it. As such, this AVP MUST be treated 3728 as opaque data by other Diameter entities. 3730 6.8. Auth-Application-Id AVP 3732 The Auth-Application-Id AVP (AVP Code 258) is of type Unsigned32 and 3733 is used in order to advertise support of the Authentication and 3734 Authorization portion of an application (see Section 2.4). If 3735 present in a message other than CER and CEA, the value of the Auth- 3736 Application-Id AVP MUST match the Application Id present in the 3737 Diameter message header. 3739 6.9. Acct-Application-Id AVP 3741 The Acct-Application-Id AVP (AVP Code 259) is of type Unsigned32 and 3742 is used in order to advertise support of the Accounting portion of an 3743 application (see Section 2.4). If present in a message other than 3744 CER and CEA, the value of the Acct-Application-Id AVP MUST match the 3745 Application Id present in the Diameter message header. 3747 6.10. Inband-Security-Id AVP 3749 The Inband-Security-Id AVP (AVP Code 299) is of type Unsigned32 and 3750 is used in order to advertise support of the security portion of the 3751 application. The use of this AVP in CER and CEA messages is no 3752 longer recommended. Instead, discovery of a Diameter entities 3753 security capabilities can be done either through static configuration 3754 or via Diameter Peer Discovery described in Section 5.2. 3756 The following values are supported: 3758 NO_INBAND_SECURITY 0 3760 This peer does not support TLS/TCP and DTLS/SCTP. This is the 3761 default value, if the AVP is omitted. 3763 TLS 1 3765 This node supports TLS/TCP and DTLS/SCTP security, as defined by 3766 [RFC5246]. 3768 6.11. Vendor-Specific-Application-Id AVP 3770 The Vendor-Specific-Application-Id AVP (AVP Code 260) is of type 3771 Grouped and is used to advertise support of a vendor-specific 3772 Diameter Application. Exactly one instance of either Auth- 3773 Application-Id or Acct-Application-Id AVP MUST be present. The 3774 Application Id carried by either Auth-Application-Id or Acct- 3775 Application-Id AVP MUST comply with vendor specific Application Id 3776 assignment described in Sec 11.3. It MUST also match the Application 3777 Id present in the Diameter header except when used in a CER or CEA 3778 message. 3780 The Vendor-Id AVP is an informational AVP pertaining to the vendor 3781 who may have authorship of the vendor-specific Diameter application. 3782 It MUST NOT be used as a means of defining a completely separate 3783 vendor-specific Application Id space. 3785 The Vendor-Specific-Application-Id AVP SHOULD be placed as close to 3786 the Diameter header as possible. 3788 AVP Format 3790 ::= < AVP Header: 260 > 3791 { Vendor-Id } 3792 [ Auth-Application-Id ] 3793 [ Acct-Application-Id ] 3795 A Vendor-Specific-Application-Id AVP MUST contain exactly one of 3796 either Auth-Application-Id or Acct-Application-Id. If a Vendor- 3797 Specific-Application-Id is received without any of these two AVPs, 3798 then the recipient SHOULD issue an answer with a Result-Code set to 3799 DIAMETER_MISSING_AVP. The answer SHOULD also include a Failed-AVP 3800 which MUST contain an example of an Auth-Application-Id AVP and an 3801 Acct-Application-Id AVP. 3803 If a Vendor-Specific-Application-Id is received that contains both 3804 Auth-Application-Id and Acct-Application-Id, then the recipient MUST 3805 issue an answer with Result-Code set to 3806 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES. The answer MUST also include a 3807 Failed-AVP which MUST contain the received Auth-Application-Id AVP 3808 and Acct-Application-Id AVP. 3810 6.12. Redirect-Host AVP 3812 The Redirect-Host AVP (AVP Code 292) is of type DiameterURI. One or 3813 more of instances of this AVP MUST be present if the answer message's 3814 'E' bit is set and the Result-Code AVP is set to 3815 DIAMETER_REDIRECT_INDICATION. 3817 Upon receiving the above, the receiving Diameter node SHOULD forward 3818 the request directly to one of the hosts identified in these AVPs. 3819 The server contained in the selected Redirect-Host AVP SHOULD be used 3820 for all messages matching the criteria set by the Redirect-Host-Usage 3821 AVP. 3823 6.13. Redirect-Host-Usage AVP 3825 The Redirect-Host-Usage AVP (AVP Code 261) is of type Enumerated. 3826 This AVP MAY be present in answer messages whose 'E' bit is set and 3827 the Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION. 3829 When present, this AVP provides a hints about how the routing entry 3830 resulting from the Redirect-Host is to be used. The following values 3831 are supported: 3833 DONT_CACHE 0 3835 The host specified in the Redirect-Host AVP SHOULD NOT be cached. 3836 This is the default value. 3838 ALL_SESSION 1 3840 All messages within the same session, as defined by the same value 3841 of the Session-ID AVP SHOULD be sent to the host specified in the 3842 Redirect-Host AVP. 3844 ALL_REALM 2 3846 All messages destined for the realm requested SHOULD be sent to 3847 the host specified in the Redirect-Host AVP. 3849 REALM_AND_APPLICATION 3 3851 All messages for the application requested to the realm specified 3852 SHOULD be sent to the host specified in the Redirect-Host AVP. 3854 ALL_APPLICATION 4 3856 All messages for the application requested SHOULD be sent to the 3857 host specified in the Redirect-Host AVP. 3859 ALL_HOST 5 3861 All messages that would be sent to the host that generated the 3862 Redirect-Host SHOULD be sent to the host specified in the 3863 Redirect- Host AVP. 3865 ALL_USER 6 3867 All messages for the user requested SHOULD be sent to the host 3868 specified in the Redirect-Host AVP. 3870 When multiple cached routes are created by redirect indications and 3871 they differ only in redirect usage and peers to forward requests to 3872 (see Section 6.1.8), a precedence rule MUST be applied to the 3873 redirect usage values of the cached routes during normal routing to 3874 resolve contentions that may occur. The precedence rule is the order 3875 that dictate which redirect usage should be considered before any 3876 other as they appear. The order is as follows: 3878 1. ALL_SESSION 3880 2. ALL_USER 3882 3. REALM_AND_APPLICATION 3884 4. ALL_REALM 3886 5. ALL_APPLICATION 3888 6. ALL_HOST 3890 6.14. Redirect-Max-Cache-Time AVP 3892 The Redirect-Max-Cache-Time AVP (AVP Code 262) is of type Unsigned32. 3893 This AVP MUST be present in answer messages whose 'E' bit is set, the 3894 Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION and the 3895 Redirect-Host-Usage AVP set to a non-zero value. 3897 This AVP contains the maximum number of seconds the peer and route 3898 table entries, created as a result of the Redirect-Host, SHOULD be 3899 cached. Note that once a host is no longer reachable, any associated 3900 cache, peer and routing table entries MUST be deleted. 3902 7. Error Handling 3904 There are two different types of errors in Diameter; protocol and 3905 application errors. A protocol error is one that occurs at the base 3906 protocol level, and MAY require per hop attention (e.g., message 3907 routing error). Application errors, on the other hand, generally 3908 occur due to a problem with a function specified in a Diameter 3909 application (e.g., user authentication, missing AVP). 3911 Result-Code AVP values that are used to report protocol errors MUST 3912 only be present in answer messages whose 'E' bit is set. When a 3913 request message is received that causes a protocol error, an answer 3914 message is returned with the 'E' bit set, and the Result-Code AVP is 3915 set to the appropriate protocol error value. As the answer is sent 3916 back towards the originator of the request, each proxy or relay agent 3917 MAY take action on the message. 3919 1. Request +---------+ Link Broken 3920 +-------------------------->|Diameter |----///----+ 3921 | +---------------------| | v 3922 +------+--+ | 2. answer + 'E' set | Relay 2 | +--------+ 3923 |Diameter |<-+ (Unable to Forward) +---------+ |Diameter| 3924 | | | Home | 3925 | Relay 1 |--+ +---------+ | Server | 3926 +---------+ | 3. Request |Diameter | +--------+ 3927 +-------------------->| | ^ 3928 | Relay 3 |-----------+ 3929 +---------+ 3931 Figure 7: Example of Protocol Error causing answer message 3933 Figure 7 provides an example of a message forwarded upstream by a 3934 Diameter relay. When the message is received by Relay 2, and it 3935 detects that it cannot forward the request to the home server, an 3936 answer message is returned with the 'E' bit set and the Result-Code 3937 AVP set to DIAMETER_UNABLE_TO_DELIVER. Given that this error falls 3938 within the protocol error category, Relay 1 would take special 3939 action, and given the error, attempt to route the message through its 3940 alternate Relay 3. 3942 +---------+ 1. Request +---------+ 2. Request +---------+ 3943 | Access |------------>|Diameter |------------>|Diameter | 3944 | | | | | Home | 3945 | Device |<------------| Relay |<------------| Server | 3946 +---------+ 4. Answer +---------+ 3. Answer +---------+ 3947 (Missing AVP) (Missing AVP) 3949 Figure 8: Example of Application Error Answer message 3951 Figure 8 provides an example of a Diameter message that caused an 3952 application error. When application errors occur, the Diameter 3953 entity reporting the error clears the 'R' bit in the Command Flags, 3954 and adds the Result-Code AVP with the proper value. Application 3955 errors do not require any proxy or relay agent involvement, and 3956 therefore the message would be forwarded back to the originator of 3957 the request. 3959 In the case where the answer message itself contains errors, any 3960 related session SHOULD be terminated by sending an STR or ASR 3961 message. The Termination-Cause AVP in the STR MAY be filled with the 3962 appropriate value to indicate the cause of the error. An application 3963 MAY also send an application-specific request instead of STR or ASR 3964 to signal the error in the case where no state is maintained or to 3965 allow for some form of error recovery with the corresponding Diameter 3966 entity. 3968 There are certain Result-Code AVP application errors that require 3969 additional AVPs to be present in the answer. In these cases, the 3970 Diameter node that sets the Result-Code AVP to indicate the error 3971 MUST add the AVPs. Examples are: 3973 o A request with an unrecognized AVP is received with the 'M' bit 3974 (Mandatory bit) set, causes an answer to be sent with the Result- 3975 Code AVP set to DIAMETER_AVP_UNSUPPORTED, and the Failed-AVP AVP 3976 containing the offending AVP. 3978 o A request with an AVP that is received with an unrecognized value 3979 causes an answer to be returned with the Result-Code AVP set to 3980 DIAMETER_INVALID_AVP_VALUE, with the Failed-AVP AVP containing the 3981 AVP causing the error. 3983 o A received command which is missing AVP(s) that are defined as 3984 required in the commands ABNF; examples are AVPs indicated as 3985 {AVP}. The receiver issues an answer with the Result-Code set to 3986 DIAMETER_MISSING_AVP, and creates an AVP with the AVP Code and 3987 other fields set as expected in the missing AVP. The created AVP 3988 is then added to the Failed- AVP AVP. 3990 The Result-Code AVP describes the error that the Diameter node 3991 encountered in its processing. In case there are multiple errors, 3992 the Diameter node MUST report only the first error it encountered 3993 (detected possibly in some implementation dependent order). The 3994 specific errors that can be described by this AVP are described in 3995 the following section. 3997 7.1. Result-Code AVP 3999 The Result-Code AVP (AVP Code 268) is of type Unsigned32 and 4000 indicates whether a particular request was completed successfully or 4001 whether an error occurred. All Diameter answer messages in IETF 4002 defined Diameter application specification MUST include one Result- 4003 Code AVP. A non-successful Result-Code AVP (one containing a non 4004 2xxx value other than DIAMETER_REDIRECT_INDICATION) MUST include the 4005 Error-Reporting-Host AVP if the host setting the Result-Code AVP is 4006 different from the identity encoded in the Origin-Host AVP. 4008 The Result-Code data field contains an IANA-managed 32-bit address 4009 space representing errors (see Section 11.4). Diameter provides the 4010 following classes of errors, all identified by the thousands digit in 4011 the decimal notation: 4013 o 1xxx (Informational) 4015 o 2xxx (Success) 4017 o 3xxx (Protocol Errors) 4019 o 4xxx (Transient Failures) 4021 o 5xxx (Permanent Failure) 4023 A non-recognized class (one whose first digit is not defined in this 4024 section) MUST be handled as a permanent failure. 4026 7.1.1. Informational 4028 Errors that fall within this category are used to inform the 4029 requester that a request could not be satisfied, and additional 4030 action is required on its part before access is granted. 4032 DIAMETER_MULTI_ROUND_AUTH 1001 4034 This informational error is returned by a Diameter server to 4035 inform the access device that the authentication mechanism being 4036 used requires multiple round trips, and a subsequent request needs 4037 to be issued in order for access to be granted. 4039 7.1.2. Success 4041 Errors that fall within the Success category are used to inform a 4042 peer that a request has been successfully completed. 4044 DIAMETER_SUCCESS 2001 4046 The request was successfully completed. 4048 DIAMETER_LIMITED_SUCCESS 2002 4050 When returned, the request was successfully completed, but 4051 additional processing is required by the application in order to 4052 provide service to the user. 4054 7.1.3. Protocol Errors 4056 Errors that fall within the Protocol Error category SHOULD be treated 4057 on a per-hop basis, and Diameter proxies MAY attempt to correct the 4058 error, if it is possible. Note that these errors MUST only be used 4059 in answer messages whose 'E' bit is set. 4061 DIAMETER_COMMAND_UNSUPPORTED 3001 4063 This error code is used when a Diameter entity receives a message 4064 with a Command Code that it does not support. 4066 DIAMETER_UNABLE_TO_DELIVER 3002 4068 This error is given when Diameter can not deliver the message to 4069 the destination, either because no host within the realm 4070 supporting the required application was available to process the 4071 request, or because Destination-Host AVP was given without the 4072 associated Destination-Realm AVP. 4074 DIAMETER_REALM_NOT_SERVED 3003 4076 The intended realm of the request is not recognized. 4078 DIAMETER_TOO_BUSY 3004 4080 When returned, a Diameter node SHOULD attempt to send the message 4081 to an alternate peer. This error MUST only be used when a 4082 specific server is requested, and it cannot provide the requested 4083 service. 4085 DIAMETER_LOOP_DETECTED 3005 4087 An agent detected a loop while trying to get the message to the 4088 intended recipient. The message MAY be sent to an alternate peer, 4089 if one is available, but the peer reporting the error has 4090 identified a configuration problem. 4092 DIAMETER_REDIRECT_INDICATION 3006 4094 A redirect agent has determined that the request could not be 4095 satisfied locally and the initiator of the request SHOULD direct 4096 the request directly to the server, whose contact information has 4097 been added to the response. When set, the Redirect-Host AVP MUST 4098 be present. 4100 DIAMETER_APPLICATION_UNSUPPORTED 3007 4102 A request was sent for an application that is not supported. 4104 DIAMETER_INVALID_HDR_BITS 3008 4106 A request was received whose bits in the Diameter header were 4107 either set to an invalid combination, or to a value that is 4108 inconsistent with the command code's definition. 4110 DIAMETER_INVALID_AVP_BITS 3009 4112 A request was received that included an AVP whose flag bits are 4113 set to an unrecognized value, or that is inconsistent with the 4114 AVP's definition. 4116 DIAMETER_UNKNOWN_PEER 3010 4118 A CER was received from an unknown peer. 4120 7.1.4. Transient Failures 4122 Errors that fall within the transient failures category are used to 4123 inform a peer that the request could not be satisfied at the time it 4124 was received, but MAY be able to satisfy the request in the future. 4125 Note that these errors MUST be used in answer messages whose 'E' bit 4126 is not set. 4128 DIAMETER_AUTHENTICATION_REJECTED 4001 4130 The authentication process for the user failed, most likely due to 4131 an invalid password used by the user. Further attempts MUST only 4132 be tried after prompting the user for a new password. 4134 DIAMETER_OUT_OF_SPACE 4002 4136 A Diameter node received the accounting request but was unable to 4137 commit it to stable storage due to a temporary lack of space. 4139 ELECTION_LOST 4003 4141 The peer has determined that it has lost the election process and 4142 has therefore disconnected the transport connection. 4144 7.1.5. Permanent Failures 4146 Errors that fall within the permanent failures category are used to 4147 inform the peer that the request failed, and should not be attempted 4148 again. Note that these errors SHOULD be used in answer messages 4149 whose 'E' bit is not set. In error conditions where it is not 4150 possible or efficient to compose application-specific answer grammar 4151 then answer messages with E-bit set and complying to the grammar 4152 described in 7.2 MAY also be used for permanent errors. 4154 DIAMETER_AVP_UNSUPPORTED 5001 4156 The peer received a message that contained an AVP that is not 4157 recognized or supported and was marked with the Mandatory bit. A 4158 Diameter message with this error MUST contain one or more Failed- 4159 AVP AVP containing the AVPs that caused the failure. 4161 DIAMETER_UNKNOWN_SESSION_ID 5002 4163 The request contained an unknown Session-Id. 4165 DIAMETER_AUTHORIZATION_REJECTED 5003 4167 A request was received for which the user could not be authorized. 4168 This error could occur if the service requested is not permitted 4169 to the user. 4171 DIAMETER_INVALID_AVP_VALUE 5004 4173 The request contained an AVP with an invalid value in its data 4174 portion. A Diameter message indicating this error MUST include 4175 the offending AVPs within a Failed-AVP AVP. 4177 DIAMETER_MISSING_AVP 5005 4179 The request did not contain an AVP that is required by the Command 4180 Code definition. If this value is sent in the Result-Code AVP, a 4181 Failed-AVP AVP SHOULD be included in the message. The Failed-AVP 4182 AVP MUST contain an example of the missing AVP complete with the 4183 Vendor-Id if applicable. The value field of the missing AVP 4184 should be of correct minimum length and contain zeroes. 4186 DIAMETER_RESOURCES_EXCEEDED 5006 4188 A request was received that cannot be authorized because the user 4189 has already expended allowed resources. An example of this error 4190 condition is a user that is restricted to one dial-up PPP port, 4191 attempts to establish a second PPP connection. 4193 DIAMETER_CONTRADICTING_AVPS 5007 4195 The Home Diameter server has detected AVPs in the request that 4196 contradicted each other, and is not willing to provide service to 4197 the user. The Failed-AVP AVPs MUST be present which contains the 4198 AVPs that contradicted each other. 4200 DIAMETER_AVP_NOT_ALLOWED 5008 4202 A message was received with an AVP that MUST NOT be present. The 4203 Failed-AVP AVP MUST be included and contain a copy of the 4204 offending AVP. 4206 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES 5009 4208 A message was received that included an AVP that appeared more 4209 often than permitted in the message definition. The Failed-AVP 4210 AVP MUST be included and contain a copy of the first instance of 4211 the offending AVP that exceeded the maximum number of occurrences 4213 DIAMETER_NO_COMMON_APPLICATION 5010 4215 This error is returned by a Diameter node that receives a CER 4216 whereby no applications are common between the CER sending peer 4217 and the CER receiving peer. 4219 DIAMETER_UNSUPPORTED_VERSION 5011 4221 This error is returned when a request was received, whose version 4222 number is unsupported. 4224 DIAMETER_UNABLE_TO_COMPLY 5012 4226 This error is returned when a request is rejected for unspecified 4227 reasons. 4229 DIAMETER_INVALID_BIT_IN_HEADER 5013 4231 This error is returned when a reserved bit in the Diameter header 4232 is set to one (1) or the bits in the Diameter header defined in 4233 Section 3 are set incorrectly. 4235 DIAMETER_INVALID_AVP_LENGTH 5014 4237 The request contained an AVP with an invalid length. A Diameter 4238 message indicating this error MUST include the offending AVPs 4239 within a Failed-AVP AVP. In cases where the erroneous AVP length 4240 value exceeds the message length or is less than the minimum AVP 4241 header length, it is sufficient to include the offending AVP 4242 header and a zero filled payload of the minimum required length 4243 for the payloads data type. If the AVP is a grouped AVP, the 4244 grouped AVP header with an empty payload would be sufficient to 4245 indicate the offending AVP. In the case where the offending AVP 4246 header cannot be fully decoded when the AVP length is less than 4247 the minimum AVP header length, it is sufficient to include an 4248 offending AVP header that is formulated by padding the incomplete 4249 AVP header with zero up to the minimum AVP header length. 4251 DIAMETER_INVALID_MESSAGE_LENGTH 5015 4253 This error is returned when a request is received with an invalid 4254 message length. 4256 DIAMETER_INVALID_AVP_BIT_COMBO 5016 4258 The request contained an AVP with which is not allowed to have the 4259 given value in the AVP Flags field. A Diameter message indicating 4260 this error MUST include the offending AVPs within a Failed-AVP 4261 AVP. 4263 DIAMETER_NO_COMMON_SECURITY 5017 4265 This error is returned when a CER message is received, and there 4266 are no common security mechanisms supported between the peers. A 4267 Capabilities-Exchange-Answer (CEA) MUST be returned with the 4268 Result-Code AVP set to DIAMETER_NO_COMMON_SECURITY. 4270 7.2. Error Bit 4272 The 'E' (Error Bit) in the Diameter header is set when the request 4273 caused a protocol-related error (see Section 7.1.3). A message with 4274 the 'E' bit MUST NOT be sent as a response to an answer message. 4275 Note that a message with the 'E' bit set is still subjected to the 4276 processing rules defined in Section 6.2. When set, the answer 4277 message will not conform to the ABNF specification for the command, 4278 and will instead conform to the following ABNF: 4280 Message Format 4282 ::= < Diameter Header: code, ERR [PXY] > 4283 0*1< Session-Id > 4284 { Origin-Host } 4285 { Origin-Realm } 4286 { Result-Code } 4287 [ Origin-State-Id ] 4288 [ Error-Message ] 4289 [ Error-Reporting-Host ] 4290 [ Failed-AVP ] 4291 [ Experimental-Result ] 4292 * [ Proxy-Info ] 4293 * [ AVP ] 4295 Note that the code used in the header is the same than the one found 4296 in the request message, but with the 'R' bit cleared and the 'E' bit 4297 set. The 'P' bit in the header is set to the same value as the one 4298 found in the request message. 4300 7.3. Error-Message AVP 4302 The Error-Message AVP (AVP Code 281) is of type UTF8String. It MAY 4303 accompany a Result-Code AVP as a human readable error message. The 4304 Error-Message AVP is not intended to be useful in an environment 4305 where error messages are processed automatically. It SHOULD NOT be 4306 expected that the content of this AVP is parsed by network entities. 4308 7.4. Error-Reporting-Host AVP 4310 The Error-Reporting-Host AVP (AVP Code 294) is of type 4311 DiameterIdentity. This AVP contains the identity of the Diameter 4312 host that sent the Result-Code AVP to a value other than 2001 4313 (Success), only if the host setting the Result-Code is different from 4314 the one encoded in the Origin-Host AVP. This AVP is intended to be 4315 used for troubleshooting purposes, and MUST be set when the Result- 4316 Code AVP indicates a failure. 4318 7.5. Failed-AVP AVP 4320 The Failed-AVP AVP (AVP Code 279) is of type Grouped and provides 4321 debugging information in cases where a request is rejected or not 4322 fully processed due to erroneous information in a specific AVP. The 4323 value of the Result-Code AVP will provide information on the reason 4324 for the Failed-AVP AVP. A Diameter message SHOULD contain only one 4325 Failed-AVP that corresponds to the error indicated by the Result-Code 4326 AVP. For practical purposes, this Failed-AVP would typically refer 4327 to the first AVP processing error that a Diameter node encounters. 4329 The possible reasons for this AVP are the presence of an improperly 4330 constructed AVP, an unsupported or unrecognized AVP, an invalid AVP 4331 value, the omission of a required AVP, the presence of an explicitly 4332 excluded AVP (see tables in Section 10), or the presence of two or 4333 more occurrences of an AVP which is restricted to 0, 1, or 0-1 4334 occurrences. 4336 A Diameter message SHOULD contain one Failed-AVP AVP, containing the 4337 entire AVP that could not be processed successfully. If the failure 4338 reason is omission of a required AVP, an AVP with the missing AVP 4339 code, the missing vendor id, and a zero filled payload of the minimum 4340 required length for the omitted AVP will be added. If the failure 4341 reason is an invalid AVP length where the reported length is less 4342 than the minimum AVP header length or greater than the reported 4343 message length, a copy of the offending AVP header and a zero filled 4344 payload of the minimum required length SHOULD be added. 4346 In the case where the offending AVP is embedded within a grouped AVP, 4347 the Failed-AVP MAY contain the grouped AVP which in turn contains the 4348 single offending AVP. The same method MAY be employed if the grouped 4349 AVP itself is embedded in yet another grouped AVP and so on. In this 4350 case, the Failed-AVP MAY contain the grouped AVP hierarchy up to the 4351 single offending AVP. This enables the recipient to detect the 4352 location of the offending AVP when embedded in a group. 4354 AVP Format 4356 ::= < AVP Header: 279 > 4357 1* {AVP} 4359 7.6. Experimental-Result AVP 4361 The Experimental-Result AVP (AVP Code 297) is of type Grouped, and 4362 indicates whether a particular vendor-specific request was completed 4363 successfully or whether an error occurred. This AVP has the 4364 following structure: 4366 AVP Format 4368 Experimental-Result ::= < AVP Header: 297 > 4369 { Vendor-Id } 4370 { Experimental-Result-Code } 4372 The Vendor-Id AVP (see Section 5.3.3) in this grouped AVP identifies 4373 the vendor responsible for the assignment of the result code which 4374 follows. All Diameter answer messages defined in vendor-specific 4375 applications MUST include either one Result-Code AVP or one 4376 Experimental-Result AVP. 4378 7.7. Experimental-Result-Code AVP 4380 The Experimental-Result-Code AVP (AVP Code 298) is of type Unsigned32 4381 and contains a vendor-assigned value representing the result of 4382 processing the request. 4384 It is recommended that vendor-specific result codes follow the same 4385 conventions given for the Result-Code AVP regarding the different 4386 types of result codes and the handling of errors (for non 2xxx 4387 values). 4389 8. Diameter User Sessions 4391 In general, Diameter can provide two different types of services to 4392 applications. The first involves authentication and authorization, 4393 and can optionally make use of accounting. The second only makes use 4394 of accounting. 4396 When a service makes use of the authentication and/or authorization 4397 portion of an application, and a user requests access to the network, 4398 the Diameter client issues an auth request to its local server. The 4399 auth request is defined in a service-specific Diameter application 4400 (e.g., NASREQ). The request contains a Session-Id AVP, which is used 4401 in subsequent messages (e.g., subsequent authorization, accounting, 4402 etc) relating to the user's session. The Session-Id AVP is a means 4403 for the client and servers to correlate a Diameter message with a 4404 user session. 4406 When a Diameter server authorizes a user to use network resources for 4407 a finite amount of time, and it is willing to extend the 4408 authorization via a future request, it MUST add the Authorization- 4409 Lifetime AVP to the answer message. The Authorization-Lifetime AVP 4410 defines the maximum number of seconds a user MAY make use of the 4411 resources before another authorization request is expected by the 4412 server. The Auth-Grace-Period AVP contains the number of seconds 4413 following the expiration of the Authorization-Lifetime, after which 4414 the server will release all state information related to the user's 4415 session. Note that if payment for services is expected by the 4416 serving realm from the user's home realm, the Authorization-Lifetime 4417 AVP, combined with the Auth-Grace-Period AVP, implies the maximum 4418 length of the session the home realm is willing to be fiscally 4419 responsible for. Services provided past the expiration of the 4420 Authorization-Lifetime and Auth-Grace-Period AVPs are the 4421 responsibility of the access device. Of course, the actual cost of 4422 services rendered is clearly outside the scope of the protocol. 4424 An access device that does not expect to send a re-authorization or a 4425 session termination request to the server MAY include the Auth- 4426 Session-State AVP with the value set to NO_STATE_MAINTAINED as a hint 4427 to the server. If the server accepts the hint, it agrees that since 4428 no session termination message will be received once service to the 4429 user is terminated, it cannot maintain state for the session. If the 4430 answer message from the server contains a different value in the 4431 Auth-Session-State AVP (or the default value if the AVP is absent), 4432 the access device MUST follow the server's directives. Note that the 4433 value NO_STATE_MAINTAINED MUST NOT be set in subsequent re- 4434 authorization requests and answers. 4436 The base protocol does not include any authorization request 4437 messages, since these are largely application-specific and are 4438 defined in a Diameter application document. However, the base 4439 protocol does define a set of messages that are used to terminate 4440 user sessions. These are used to allow servers that maintain state 4441 information to free resources. 4443 When a service only makes use of the Accounting portion of the 4444 Diameter protocol, even in combination with an application, the 4445 Session-Id is still used to identify user sessions. However, the 4446 session termination messages are not used, since a session is 4447 signaled as being terminated by issuing an accounting stop message. 4449 Diameter may also be used for services that cannot be easily 4450 categorized as authentication, authorization or accounting (e.g., 4451 certain 3GPP IMS interfaces). In such cases, the finite state 4452 machine defined in subsequent sections may not be applicable. 4453 Therefore, the applications itself MAY need to define its own finite 4454 state machine. However, such application-specific state machines 4455 SHOULD follow the general state machine framework outlined in this 4456 document such as the use of Session-Id AVPs and the use of STR/STA, 4457 ASR/ASA messages for stateful sessions. 4459 8.1. Authorization Session State Machine 4461 This section contains a set of finite state machines, representing 4462 the life cycle of Diameter sessions, and which MUST be observed by 4463 all Diameter implementations that make use of the authentication 4464 and/or authorization portion of a Diameter application. The term 4465 Service-Specific below refers to a message defined in a Diameter 4466 application (e.g., Mobile IPv4, NASREQ). 4468 There are four different authorization session state machines 4469 supported in the Diameter base protocol. The first two describe a 4470 session in which the server is maintaining session state, indicated 4471 by the value of the Auth-Session-State AVP (or its absence). One 4472 describes the session from a client perspective, the other from a 4473 server perspective. The second two state machines are used when the 4474 server does not maintain session state. Here again, one describes 4475 the session from a client perspective, the other from a server 4476 perspective. 4478 When a session is moved to the Idle state, any resources that were 4479 allocated for the particular session must be released. Any event not 4480 listed in the state machines MUST be considered as an error 4481 condition, and an answer, if applicable, MUST be returned to the 4482 originator of the message. 4484 In the case that an application does not support re-auth, the state 4485 transitions related to server-initiated re-auth when both client and 4486 server session maintains state (e.g., Send RAR, Pending, Receive RAA) 4487 MAY be ignored. 4489 In the state table, the event 'Failure to send X' means that the 4490 Diameter agent is unable to send command X to the desired 4491 destination. This could be due to the peer being down, or due to the 4492 peer sending back a transient failure or temporary protocol error 4493 notification DIAMETER_TOO_BUSY or DIAMETER_LOOP_DETECTED in the 4494 Result-Code AVP of the corresponding Answer command. The event 'X 4495 successfully sent' is the complement of 'Failure to send X'. 4497 The following state machine is observed by a client when state is 4498 maintained on the server: 4500 CLIENT, STATEFUL 4501 State Event Action New State 4502 --------------------------------------------------------------- 4503 Idle Client or Device Requests Send Pending 4504 access service 4505 specific 4506 auth req 4508 Idle ASR Received Send ASA Idle 4509 for unknown session with 4510 Result-Code = 4511 UNKNOWN_ 4512 SESSION_ID 4514 Idle RAR Received Send RAA Idle 4515 for unknown session with 4516 Result-Code = 4517 UNKNOWN_ 4518 SESSION_ID 4520 Pending Successful Service-specific Grant Open 4521 authorization answer Access 4522 received with default 4523 Auth-Session-State value 4525 Pending Successful Service-specific Sent STR Discon 4526 authorization answer received 4527 but service not provided 4529 Pending Error processing successful Sent STR Discon 4530 Service-specific authorization 4531 answer 4533 Pending Failed Service-specific Cleanup Idle 4534 authorization answer received 4536 Open User or client device Send Open 4537 requests access to service service 4538 specific 4539 auth req 4541 Open Successful Service-specific Provide Open 4542 authorization answer received Service 4544 Open Failed Service-specific Discon. Idle 4545 authorization answer user/device 4546 received. 4548 Open RAR received and client will Send RAA Open 4549 perform subsequent re-auth with 4550 Result-Code = 4551 SUCCESS 4553 Open RAR received and client will Send RAA Idle 4554 not perform subsequent with 4555 re-auth Result-Code != 4556 SUCCESS, 4557 Discon. 4558 user/device 4560 Open Session-Timeout Expires on Send STR Discon 4561 Access Device 4563 Open ASR Received, Send ASA Discon 4564 client will comply with 4565 with request to end the Result-Code = 4566 session = SUCCESS, 4567 Send STR. 4569 Open ASR Received, Send ASA Open 4570 client will not comply with 4571 with request to end the Result-Code != 4572 session != SUCCESS 4574 Open Authorization-Lifetime + Send STR Discon 4575 Auth-Grace-Period expires on 4576 access device 4578 Discon ASR Received Send ASA Discon 4580 Discon STA Received Discon. Idle 4581 user/device 4583 The following state machine is observed by a server when it is 4584 maintaining state for the session: 4586 SERVER, STATEFUL 4587 State Event Action New State 4588 --------------------------------------------------------------- 4589 Idle Service-specific authorization Send Open 4590 request received, and successful 4591 user is authorized serv. 4592 specific 4593 answer 4595 Idle Service-specific authorization Send Idle 4596 request received, and failed serv. 4597 user is not authorized specific 4598 answer 4600 Open Service-specific authorization Send Open 4601 request received, and user successful 4602 is authorized serv. specific 4603 answer 4605 Open Service-specific authorization Send Idle 4606 request received, and user failed serv. 4607 is not authorized specific 4608 answer, 4609 Cleanup 4611 Open Home server wants to confirm Send RAR Pending 4612 authentication and/or 4613 authorization of the user 4615 Pending Received RAA with a failed Cleanup Idle 4616 Result-Code 4618 Pending Received RAA with Result-Code Update Open 4619 = SUCCESS session 4621 Open Home server wants to Send ASR Discon 4622 terminate the service 4624 Open Authorization-Lifetime (and Cleanup Idle 4625 Auth-Grace-Period) expires 4626 on home server. 4628 Open Session-Timeout expires on Cleanup Idle 4629 home server 4631 Discon Failure to send ASR Wait, Discon 4632 resend ASR 4634 Discon ASR successfully sent and Cleanup Idle 4635 ASA Received with Result-Code 4637 Not ASA Received None No Change. 4638 Discon 4640 Any STR Received Send STA, Idle 4641 Cleanup. 4643 The following state machine is observed by a client when state is not 4644 maintained on the server: 4646 CLIENT, STATELESS 4647 State Event Action New State 4648 --------------------------------------------------------------- 4649 Idle Client or Device Requests Send Pending 4650 access service 4651 specific 4652 auth req 4654 Pending Successful Service-specific Grant Open 4655 authorization answer Access 4656 received with Auth-Session- 4657 State set to 4658 NO_STATE_MAINTAINED 4660 Pending Failed Service-specific Cleanup Idle 4661 authorization answer 4662 received 4664 Open Session-Timeout Expires on Discon. Idle 4665 Access Device user/device 4667 Open Service to user is terminated Discon. Idle 4668 user/device 4670 The following state machine is observed by a server when it is not 4671 maintaining state for the session: 4673 SERVER, STATELESS 4674 State Event Action New State 4675 --------------------------------------------------------------- 4676 Idle Service-specific authorization Send serv. Idle 4677 request received, and specific 4678 successfully processed answer 4680 8.2. Accounting Session State Machine 4682 The following state machines MUST be supported for applications that 4683 have an accounting portion or that require only accounting services. 4684 The first state machine is to be observed by clients. 4686 See Section 9.7 for Accounting Command Codes and Section 9.8 for 4687 Accounting AVPs. 4689 The server side in the accounting state machine depends in some cases 4690 on the particular application. The Diameter base protocol defines a 4691 default state machine that MUST be followed by all applications that 4692 have not specified other state machines. This is the second state 4693 machine in this section described below. 4695 The default server side state machine requires the reception of 4696 accounting records in any order and at any time, and does not place 4697 any standards requirement on the processing of these records. 4698 Implementations of Diameter may perform checking, ordering, 4699 correlation, fraud detection, and other tasks based on these records. 4700 AVPs may need to be inspected as a part of these tasks. The tasks 4701 can happen either immediately after record reception or in a post- 4702 processing phase. However, as these tasks are typically application 4703 or even policy dependent, they are not standardized by the Diameter 4704 specifications. Applications MAY define requirements on when to 4705 accept accounting records based on the used value of Accounting- 4706 Realtime-Required AVP, credit limits checks, and so on. 4708 However, the Diameter base protocol defines one optional server side 4709 state machine that MAY be followed by applications that require 4710 keeping track of the session state at the accounting server. Note 4711 that such tracking is incompatible with the ability to sustain long 4712 duration connectivity problems. Therefore, the use of this state 4713 machine is recommended only in applications where the value of the 4714 Accounting-Realtime-Required AVP is DELIVER_AND_GRANT, and hence 4715 accounting connectivity problems are required to cause the serviced 4716 user to be disconnected. Otherwise, records produced by the client 4717 may be lost by the server which no longer accepts them after the 4718 connectivity is re-established. This state machine is the third 4719 state machine in this section. The state machine is supervised by a 4720 supervision session timer Ts, which the value should be reasonably 4721 higher than the Acct_Interim_Interval value. Ts MAY be set to two 4722 times the value of the Acct_Interim_Interval so as to avoid the 4723 accounting session in the Diameter server to change to Idle state in 4724 case of short transient network failure. 4726 Any event not listed in the state machines MUST be considered as an 4727 error condition, and a corresponding answer, if applicable, MUST be 4728 returned to the originator of the message. 4730 In the state table, the event 'Failure to send' means that the 4731 Diameter client is unable to communicate with the desired 4732 destination. This could be due to the peer being down, or due to the 4733 peer sending back a transient failure or temporary protocol error 4734 notification DIAMETER_OUT_OF_SPACE, DIAMETER_TOO_BUSY, or 4735 DIAMETER_LOOP_DETECTED in the Result-Code AVP of the Accounting 4736 Answer command. 4738 The event 'Failed answer' means that the Diameter client received a 4739 non-transient failure notification in the Accounting Answer command. 4741 Note that the action 'Disconnect user/dev' MUST have an effect also 4742 to the authorization session state table, e.g., cause the STR message 4743 to be sent, if the given application has both authentication/ 4744 authorization and accounting portions. 4746 The states PendingS, PendingI, PendingL, PendingE and PendingB stand 4747 for pending states to wait for an answer to an accounting request 4748 related to a Start, Interim, Stop, Event or buffered record, 4749 respectively. 4751 CLIENT, ACCOUNTING 4752 State Event Action New State 4753 --------------------------------------------------------------- 4754 Idle Client or device requests Send PendingS 4755 access accounting 4756 start req. 4758 Idle Client or device requests Send PendingE 4759 a one-time service accounting 4760 event req 4762 Idle Records in storage Send PendingB 4763 record 4765 PendingS Successful accounting Open 4766 start answer received 4768 PendingS Failure to send and buffer Store Open 4769 space available and realtime Start 4770 not equal to DELIVER_AND_GRANT Record 4772 PendingS Failure to send and no buffer Open 4773 space available and realtime 4774 equal to GRANT_AND_LOSE 4776 PendingS Failure to send and no Disconnect Idle 4777 buffer space available and user/dev 4778 realtime not equal to 4779 GRANT_AND_LOSE 4781 PendingS Failed accounting start answer Open 4782 received and realtime equal 4783 to GRANT_AND_LOSE 4785 PendingS Failed accounting start answer Disconnect Idle 4786 received and realtime not user/dev 4787 equal to GRANT_AND_LOSE 4789 PendingS User service terminated Store PendingS 4790 stop 4791 record 4793 Open Interim interval elapses Send PendingI 4794 accounting 4795 interim 4796 record 4797 Open User service terminated Send PendingL 4798 accounting 4799 stop req. 4801 PendingI Successful accounting interim Open 4802 answer received 4804 PendingI Failure to send and (buffer Store Open 4805 space available or old interim 4806 record can be overwritten) record 4807 and realtime not equal to 4808 DELIVER_AND_GRANT 4810 PendingI Failure to send and no buffer Open 4811 space available and realtime 4812 equal to GRANT_AND_LOSE 4814 PendingI Failure to send and no Disconnect Idle 4815 buffer space available and user/dev 4816 realtime not equal to 4817 GRANT_AND_LOSE 4819 PendingI Failed accounting interim Open 4820 answer received and realtime 4821 equal to GRANT_AND_LOSE 4823 PendingI Failed accounting interim Disconnect Idle 4824 answer received and user/dev 4825 realtime not equal to 4826 GRANT_AND_LOSE 4828 PendingI User service terminated Store PendingI 4829 stop 4830 record 4831 PendingE Successful accounting Idle 4832 event answer received 4834 PendingE Failure to send and buffer Store Idle 4835 space available event 4836 record 4838 PendingE Failure to send and no buffer Idle 4839 space available 4841 PendingE Failed accounting event answer Idle 4842 received 4844 PendingB Successful accounting answer Delete Idle 4845 received record 4847 PendingB Failure to send Idle 4849 PendingB Failed accounting answer Delete Idle 4850 received record 4852 PendingL Successful accounting Idle 4853 stop answer received 4855 PendingL Failure to send and buffer Store Idle 4856 space available stop 4857 record 4859 PendingL Failure to send and no buffer Idle 4860 space available 4862 PendingL Failed accounting stop answer Idle 4863 received 4865 SERVER, STATELESS ACCOUNTING 4866 State Event Action New State 4867 --------------------------------------------------------------- 4869 Idle Accounting start request Send Idle 4870 received, and successfully accounting 4871 processed. start 4872 answer 4874 Idle Accounting event request Send Idle 4875 received, and successfully accounting 4876 processed. event 4877 answer 4879 Idle Interim record received, Send Idle 4880 and successfully processed. accounting 4881 interim 4882 answer 4884 Idle Accounting stop request Send Idle 4885 received, and successfully accounting 4886 processed stop answer 4888 Idle Accounting request received, Send Idle 4889 no space left to store accounting 4890 records answer, 4891 Result-Code = 4892 OUT_OF_ 4893 SPACE 4895 SERVER, STATEFUL ACCOUNTING 4896 State Event Action New State 4897 --------------------------------------------------------------- 4899 Idle Accounting start request Send Open 4900 received, and successfully accounting 4901 processed. start 4902 answer, 4903 Start Ts 4905 Idle Accounting event request Send Idle 4906 received, and successfully accounting 4907 processed. event 4908 answer 4910 Idle Accounting request received, Send Idle 4911 no space left to store accounting 4912 records answer, 4913 Result-Code = 4914 OUT_OF_ 4915 SPACE 4917 Open Interim record received, Send Open 4918 and successfully processed. accounting 4919 interim 4920 answer, 4921 Restart Ts 4923 Open Accounting stop request Send Idle 4924 received, and successfully accounting 4925 processed stop answer, 4926 Stop Ts 4928 Open Accounting request received, Send Idle 4929 no space left to store accounting 4930 records answer, 4931 Result-Code = 4932 OUT_OF_ 4933 SPACE, 4934 Stop Ts 4936 Open Session supervision timer Ts Stop Ts Idle 4937 expired 4939 8.3. Server-Initiated Re-Auth 4941 A Diameter server may initiate a re-authentication and/or re- 4942 authorization service for a particular session by issuing a Re-Auth- 4943 Request (RAR). 4945 For example, for pre-paid services, the Diameter server that 4946 originally authorized a session may need some confirmation that the 4947 user is still using the services. 4949 An access device that receives a RAR message with Session-Id equal to 4950 a currently active session MUST initiate a re-auth towards the user, 4951 if the service supports this particular feature. Each Diameter 4952 application MUST state whether server-initiated re-auth is supported, 4953 since some applications do not allow access devices to prompt the 4954 user for re-auth. 4956 8.3.1. Re-Auth-Request 4958 The Re-Auth-Request (RAR), indicated by the Command-Code set to 258 4959 and the message flags' 'R' bit set, may be sent by any server to the 4960 access device that is providing session service, to request that the 4961 user be re-authenticated and/or re-authorized. 4963 Message Format 4965 ::= < Diameter Header: 258, REQ, PXY > 4966 < Session-Id > 4967 { Origin-Host } 4968 { Origin-Realm } 4969 { Destination-Realm } 4970 { Destination-Host } 4971 { Auth-Application-Id } 4972 { Re-Auth-Request-Type } 4973 [ User-Name ] 4974 [ Origin-State-Id ] 4975 * [ Proxy-Info ] 4976 * [ Route-Record ] 4977 * [ AVP ] 4979 8.3.2. Re-Auth-Answer 4981 The Re-Auth-Answer (RAA), indicated by the Command-Code set to 258 4982 and the message flags' 'R' bit clear, is sent in response to the RAR. 4983 The Result-Code AVP MUST be present, and indicates the disposition of 4984 the request. 4986 A successful RAA message MUST be followed by an application-specific 4987 authentication and/or authorization message. 4989 Message Format 4991 ::= < Diameter Header: 258, PXY > 4992 < Session-Id > 4993 { Result-Code } 4994 { Origin-Host } 4995 { Origin-Realm } 4996 [ User-Name ] 4997 [ Origin-State-Id ] 4998 [ Error-Message ] 4999 [ Error-Reporting-Host ] 5000 [ Failed-AVP ] 5001 * [ Redirect-Host ] 5002 [ Redirect-Host-Usage ] 5003 [ Redirect-Max-Cache-Time ] 5004 * [ Proxy-Info ] 5005 * [ AVP ] 5007 8.4. Session Termination 5009 It is necessary for a Diameter server that authorized a session, for 5010 which it is maintaining state, to be notified when that session is no 5011 longer active, both for tracking purposes as well as to allow 5012 stateful agents to release any resources that they may have provided 5013 for the user's session. For sessions whose state is not being 5014 maintained, this section is not used. 5016 When a user session that required Diameter authorization terminates, 5017 the access device that provided the service MUST issue a Session- 5018 Termination-Request (STR) message to the Diameter server that 5019 authorized the service, to notify it that the session is no longer 5020 active. An STR MUST be issued when a user session terminates for any 5021 reason, including user logoff, expiration of Session-Timeout, 5022 administrative action, termination upon receipt of an Abort-Session- 5023 Request (see below), orderly shutdown of the access device, etc. 5025 The access device also MUST issue an STR for a session that was 5026 authorized but never actually started. This could occur, for 5027 example, due to a sudden resource shortage in the access device, or 5028 because the access device is unwilling to provide the type of service 5029 requested in the authorization, or because the access device does not 5030 support a mandatory AVP returned in the authorization, etc. 5032 It is also possible that a session that was authorized is never 5033 actually started due to action of a proxy. For example, a proxy may 5034 modify an authorization answer, converting the result from success to 5035 failure, prior to forwarding the message to the access device. If 5036 the answer did not contain an Auth-Session-State AVP with the value 5037 NO_STATE_MAINTAINED, a proxy that causes an authorized session not to 5038 be started MUST issue an STR to the Diameter server that authorized 5039 the session, since the access device has no way of knowing that the 5040 session had been authorized. 5042 A Diameter server that receives an STR message MUST clean up 5043 resources (e.g., session state) associated with the Session-Id 5044 specified in the STR, and return a Session-Termination-Answer. 5046 A Diameter server also MUST clean up resources when the Session- 5047 Timeout expires, or when the Authorization-Lifetime and the Auth- 5048 Grace-Period AVPs expires without receipt of a re-authorization 5049 request, regardless of whether an STR for that session is received. 5050 The access device is not expected to provide service beyond the 5051 expiration of these timers; thus, expiration of either of these 5052 timers implies that the access device may have unexpectedly shut 5053 down. 5055 8.4.1. Session-Termination-Request 5057 The Session-Termination-Request (STR), indicated by the Command-Code 5058 set to 275 and the Command Flags' 'R' bit set, is sent by a Diameter 5059 client or by a Diameter proxy to inform the Diameter Server that an 5060 authenticated and/or authorized session is being terminated. 5062 Message Format 5064 ::= < Diameter Header: 275, REQ, PXY > 5065 < Session-Id > 5066 { Origin-Host } 5067 { Origin-Realm } 5068 { Destination-Realm } 5069 { Auth-Application-Id } 5070 { Termination-Cause } 5071 [ User-Name ] 5072 [ Destination-Host ] 5073 * [ Class ] 5074 [ Origin-State-Id ] 5075 * [ Proxy-Info ] 5076 * [ Route-Record ] 5077 * [ AVP ] 5079 8.4.2. Session-Termination-Answer 5081 The Session-Termination-Answer (STA), indicated by the Command-Code 5082 set to 275 and the message flags' 'R' bit clear, is sent by the 5083 Diameter Server to acknowledge the notification that the session has 5084 been terminated. The Result-Code AVP MUST be present, and MAY 5085 contain an indication that an error occurred while servicing the STR. 5087 Upon sending or receipt of the STA, the Diameter Server MUST release 5088 all resources for the session indicated by the Session-Id AVP. Any 5089 intermediate server in the Proxy-Chain MAY also release any 5090 resources, if necessary. 5092 Message Format 5094 ::= < Diameter Header: 275, PXY > 5095 < Session-Id > 5096 { Result-Code } 5097 { Origin-Host } 5098 { Origin-Realm } 5099 [ User-Name ] 5100 * [ Class ] 5101 [ Error-Message ] 5102 [ Error-Reporting-Host ] 5103 [ Failed-AVP ] 5104 [ Origin-State-Id ] 5105 * [ Redirect-Host ] 5106 [ Redirect-Host-Usage ] 5107 [ Redirect-Max-Cache-Time ] 5108 * [ Proxy-Info ] 5109 * [ AVP ] 5111 8.5. Aborting a Session 5113 A Diameter server may request that the access device stop providing 5114 service for a particular session by issuing an Abort-Session-Request 5115 (ASR). 5117 For example, the Diameter server that originally authorized the 5118 session may be required to cause that session to be stopped for lack 5119 of credit or other reasons that were not anticipated when the session 5120 was first authorized. 5122 An access device that receives an ASR with Session-ID equal to a 5123 currently active session MAY stop the session. Whether the access 5124 device stops the session or not is implementation- and/or 5125 configuration-dependent. For example, an access device may honor 5126 ASRs from certain agents only. In any case, the access device MUST 5127 respond with an Abort-Session-Answer, including a Result-Code AVP to 5128 indicate what action it took. 5130 8.5.1. Abort-Session-Request 5132 The Abort-Session-Request (ASR), indicated by the Command-Code set to 5133 274 and the message flags' 'R' bit set, may be sent by any Diameter 5134 server or any Diameter proxy to the access device that is providing 5135 session service, to request that the session identified by the 5136 Session-Id be stopped. 5138 Message Format 5140 ::= < Diameter Header: 274, REQ, PXY > 5141 < Session-Id > 5142 { Origin-Host } 5143 { Origin-Realm } 5144 { Destination-Realm } 5145 { Destination-Host } 5146 { Auth-Application-Id } 5147 [ User-Name ] 5148 [ Origin-State-Id ] 5149 * [ Proxy-Info ] 5150 * [ Route-Record ] 5151 * [ AVP ] 5153 8.5.2. Abort-Session-Answer 5155 The Abort-Session-Answer (ASA), indicated by the Command-Code set to 5156 274 and the message flags' 'R' bit clear, is sent in response to the 5157 ASR. The Result-Code AVP MUST be present, and indicates the 5158 disposition of the request. 5160 If the session identified by Session-Id in the ASR was successfully 5161 terminated, Result-Code is set to DIAMETER_SUCCESS. If the session 5162 is not currently active, Result-Code is set to 5163 DIAMETER_UNKNOWN_SESSION_ID. If the access device does not stop the 5164 session for any other reason, Result-Code is set to 5165 DIAMETER_UNABLE_TO_COMPLY. 5167 Message Format 5169 ::= < Diameter Header: 274, PXY > 5170 < Session-Id > 5171 { Result-Code } 5172 { Origin-Host } 5173 { Origin-Realm } 5174 [ User-Name ] 5175 [ Origin-State-Id ] 5176 [ Error-Message ] 5177 [ Error-Reporting-Host ] 5178 [ Failed-AVP ] 5179 * [ Redirect-Host ] 5180 [ Redirect-Host-Usage ] 5181 [ Redirect-Max-Cache-Time ] 5182 * [ Proxy-Info ] 5183 * [ AVP ] 5185 8.6. Inferring Session Termination from Origin-State-Id 5187 The Origin-State-Id is used to allow detection of terminated sessions 5188 for which no STR would have been issued, due to unanticipated 5189 shutdown of an access device. 5191 A Diameter client or access device increments the value of the 5192 Origin-State-Id every time it is started or powered-up. The new 5193 Origin-State-Id is then sent in the CER/CEA message immediately upon 5194 connection to the server. The Diameter server receiving the new 5195 Origin-State-Id can determine whether the sending Diameter client had 5196 abruptly shutdown by comparing the old value of the Origin-State-Id 5197 it has kept for that specific client is less than the new value and 5198 whether it has un-terminated sessions originating from that client. 5200 An access device can also include the Origin-State-Id in request 5201 messages other than CER if there are relays or proxies in between the 5202 access device and the server. In this case, however, the server 5203 cannot discover that the access device has been restarted unless and 5204 until it receives a new request from it. Therefore this mechanism is 5205 more opportunistic across proxies and relays. 5207 The Diameter server may assume that all sessions that were active 5208 prior to detection of a client restart have been terminated. The 5209 Diameter server MAY clean up all session state associated with such 5210 lost sessions, and MAY also issues STRs for all such lost sessions 5211 that were authorized on upstream servers, to allow session state to 5212 be cleaned up globally. 5214 8.7. Auth-Request-Type AVP 5216 The Auth-Request-Type AVP (AVP Code 274) is of type Enumerated and is 5217 included in application-specific auth requests to inform the peers 5218 whether a user is to be authenticated only, authorized only or both. 5219 Note any value other than both MAY cause RADIUS interoperability 5220 issues. The following values are defined: 5222 AUTHENTICATE_ONLY 1 5224 The request being sent is for authentication only, and MUST 5225 contain the relevant application specific authentication AVPs that 5226 are needed by the Diameter server to authenticate the user. 5228 AUTHORIZE_ONLY 2 5230 The request being sent is for authorization only, and MUST contain 5231 the application-specific authorization AVPs that are necessary to 5232 identify the service being requested/offered. 5234 AUTHORIZE_AUTHENTICATE 3 5236 The request contains a request for both authentication and 5237 authorization. The request MUST include both the relevant 5238 application-specific authentication information, and authorization 5239 information necessary to identify the service being requested/ 5240 offered. 5242 8.8. Session-Id AVP 5244 The Session-Id AVP (AVP Code 263) is of type UTF8String and is used 5245 to identify a specific session (see Section 8). All messages 5246 pertaining to a specific session MUST include only one Session-Id AVP 5247 and the same value MUST be used throughout the life of a session. 5248 When present, the Session-Id SHOULD appear immediately following the 5249 Diameter Header (see Section 3). 5251 The Session-Id MUST be globally and eternally unique, as it is meant 5252 to uniquely identify a user session without reference to any other 5253 information, and may be needed to correlate historical authentication 5254 information with accounting information. The Session-Id includes a 5255 mandatory portion and an implementation-defined portion; a 5256 recommended format for the implementation-defined portion is outlined 5257 below. 5259 The Session-Id MUST begin with the sender's identity encoded in the 5260 DiameterIdentity type (see Section 4.4). The remainder of the 5261 Session-Id is delimited by a ";" character, and MAY be any sequence 5262 that the client can guarantee to be eternally unique; however, the 5263 following format is recommended, (square brackets [] indicate an 5264 optional element): 5266 ;;[;] 5268 and are decimal representations of the 5269 high and low 32 bits of a monotonically increasing 64-bit value. The 5270 64-bit value is rendered in two part to simplify formatting by 32-bit 5271 processors. At startup, the high 32 bits of the 64-bit value MAY be 5272 initialized to the time in NTP format [RFC5905], and the low 32 bits 5273 MAY be initialized to zero. This will for practical purposes 5274 eliminate the possibility of overlapping Session-Ids after a reboot, 5275 assuming the reboot process takes longer than a second. 5276 Alternatively, an implementation MAY keep track of the increasing 5277 value in non-volatile memory. 5279 is implementation specific but may include a modem's 5280 device Id, a layer 2 address, timestamp, etc. 5282 Example, in which there is no optional value: 5284 accesspoint7.example.com;1876543210;523 5286 Example, in which there is an optional value: 5288 accesspoint7.example.com;1876543210;523;mobile@200.1.1.88 5290 The Session-Id is created by the Diameter application initiating the 5291 session, which in most cases is done by the client. Note that a 5292 Session-Id MAY be used for both the authentication, authorization and 5293 accounting commands of a given application. 5295 8.9. Authorization-Lifetime AVP 5297 The Authorization-Lifetime AVP (AVP Code 291) is of type Unsigned32 5298 and contains the maximum number of seconds of service to be provided 5299 to the user before the user is to be re-authenticated and/or re- 5300 authorized. Care should be taken when the Authorization- Lifetime 5301 value is determined, since a low, non-zero, value could create 5302 significant Diameter traffic, which could congest both the network 5303 and the agents. 5305 A value of zero (0) means that immediate re-auth is necessary by the 5306 access device. The absence of this AVP, or a value of all ones 5307 (meaning all bits in the 32 bit field are set to one) means no re- 5308 auth is expected. 5310 If both this AVP and the Session-Timeout AVP are present in a 5311 message, the value of the latter MUST NOT be smaller than the 5312 Authorization-Lifetime AVP. 5314 An Authorization-Lifetime AVP MAY be present in re-authorization 5315 messages, and contains the number of seconds the user is authorized 5316 to receive service from the time the re-auth answer message is 5317 received by the access device. 5319 This AVP MAY be provided by the client as a hint of the maximum 5320 lifetime that it is willing to accept. The server MUST return a 5321 value that is equal to, or smaller, than the one provided by the 5322 client. 5324 8.10. Auth-Grace-Period AVP 5326 The Auth-Grace-Period AVP (AVP Code 276) is of type Unsigned32 and 5327 contains the number of seconds the Diameter server will wait 5328 following the expiration of the Authorization-Lifetime AVP before 5329 cleaning up resources for the session. 5331 8.11. Auth-Session-State AVP 5333 The Auth-Session-State AVP (AVP Code 277) is of type Enumerated and 5334 specifies whether state is maintained for a particular session. The 5335 client MAY include this AVP in requests as a hint to the server, but 5336 the value in the server's answer message is binding. The following 5337 values are supported: 5339 STATE_MAINTAINED 0 5341 This value is used to specify that session state is being 5342 maintained, and the access device MUST issue a session termination 5343 message when service to the user is terminated. This is the 5344 default value. 5346 NO_STATE_MAINTAINED 1 5348 This value is used to specify that no session termination messages 5349 will be sent by the access device upon expiration of the 5350 Authorization-Lifetime. 5352 8.12. Re-Auth-Request-Type AVP 5354 The Re-Auth-Request-Type AVP (AVP Code 285) is of type Enumerated and 5355 is included in application-specific auth answers to inform the client 5356 of the action expected upon expiration of the Authorization-Lifetime. 5357 If the answer message contains an Authorization-Lifetime AVP with a 5358 positive value, the Re-Auth-Request-Type AVP MUST be present in an 5359 answer message. The following values are defined: 5361 AUTHORIZE_ONLY 0 5363 An authorization only re-auth is expected upon expiration of the 5364 Authorization-Lifetime. This is the default value if the AVP is 5365 not present in answer messages that include the Authorization- 5366 Lifetime. 5368 AUTHORIZE_AUTHENTICATE 1 5370 An authentication and authorization re-auth is expected upon 5371 expiration of the Authorization-Lifetime. 5373 8.13. Session-Timeout AVP 5375 The Session-Timeout AVP (AVP Code 27) [RFC2865] is of type Unsigned32 5376 and contains the maximum number of seconds of service to be provided 5377 to the user before termination of the session. When both the 5378 Session-Timeout and the Authorization-Lifetime AVPs are present in an 5379 answer message, the former MUST be equal to or greater than the value 5380 of the latter. 5382 A session that terminates on an access device due to the expiration 5383 of the Session-Timeout MUST cause an STR to be issued, unless both 5384 the access device and the home server had previously agreed that no 5385 session termination messages would be sent (see Section 8.11). 5387 A Session-Timeout AVP MAY be present in a re-authorization answer 5388 message, and contains the remaining number of seconds from the 5389 beginning of the re-auth. 5391 A value of zero, or the absence of this AVP, means that this session 5392 has an unlimited number of seconds before termination. 5394 This AVP MAY be provided by the client as a hint of the maximum 5395 timeout that it is willing to accept. However, the server MAY return 5396 a value that is equal to, or smaller, than the one provided by the 5397 client. 5399 8.14. User-Name AVP 5401 The User-Name AVP (AVP Code 1) [RFC2865] is of type UTF8String, which 5402 contains the User-Name, in a format consistent with the NAI 5403 specification [RFC4282]. 5405 8.15. Termination-Cause AVP 5407 The Termination-Cause AVP (AVP Code 295) is of type Enumerated, and 5408 is used to indicate the reason why a session was terminated on the 5409 access device. The following values are defined: 5411 DIAMETER_LOGOUT 1 5413 The user initiated a disconnect 5415 DIAMETER_SERVICE_NOT_PROVIDED 2 5417 This value is used when the user disconnected prior to the receipt 5418 of the authorization answer message. 5420 DIAMETER_BAD_ANSWER 3 5422 This value indicates that the authorization answer received by the 5423 access device was not processed successfully. 5425 DIAMETER_ADMINISTRATIVE 4 5427 The user was not granted access, or was disconnected, due to 5428 administrative reasons, such as the receipt of a Abort-Session- 5429 Request message. 5431 DIAMETER_LINK_BROKEN 5 5433 The communication to the user was abruptly disconnected. 5435 DIAMETER_AUTH_EXPIRED 6 5437 The user's access was terminated since its authorized session time 5438 has expired. 5440 DIAMETER_USER_MOVED 7 5442 The user is receiving services from another access device. 5444 DIAMETER_SESSION_TIMEOUT 8 5446 The user's session has timed out, and service has been terminated. 5448 8.16. Origin-State-Id AVP 5450 The Origin-State-Id AVP (AVP Code 278), of type Unsigned32, is a 5451 monotonically increasing value that is advanced whenever a Diameter 5452 entity restarts with loss of previous state, for example upon reboot. 5453 Origin-State-Id MAY be included in any Diameter message, including 5454 CER. 5456 A Diameter entity issuing this AVP MUST create a higher value for 5457 this AVP each time its state is reset. A Diameter entity MAY set 5458 Origin-State-Id to the time of startup, or it MAY use an incrementing 5459 counter retained in non-volatile memory across restarts. 5461 The Origin-State-Id, if present, MUST reflect the state of the entity 5462 indicated by Origin-Host. If a proxy modifies Origin-Host, it MUST 5463 either remove Origin-State-Id or modify it appropriately as well. 5464 Typically, Origin-State-Id is used by an access device that always 5465 starts up with no active sessions; that is, any session active prior 5466 to restart will have been lost. By including Origin-State-Id in a 5467 message, it allows other Diameter entities to infer that sessions 5468 associated with a lower Origin-State-Id are no longer active. If an 5469 access device does not intend for such inferences to be made, it MUST 5470 either not include Origin-State-Id in any message, or set its value 5471 to 0. 5473 8.17. Session-Binding AVP 5475 The Session-Binding AVP (AVP Code 270) is of type Unsigned32, and MAY 5476 be present in application-specific authorization answer messages. If 5477 present, this AVP MAY inform the Diameter client that all future 5478 application-specific re-auth and Session-Termination-Request messages 5479 for this session MUST be sent to the same authorization server. 5481 This field is a bit mask, and the following bits have been defined: 5483 RE_AUTH 1 5485 When set, future re-auth messages for this session MUST NOT 5486 include the Destination-Host AVP. When cleared, the default 5487 value, the Destination-Host AVP MUST be present in all re-auth 5488 messages for this session. 5490 STR 2 5492 When set, the STR message for this session MUST NOT include the 5493 Destination-Host AVP. When cleared, the default value, the 5494 Destination-Host AVP MUST be present in the STR message for this 5495 session. 5497 ACCOUNTING 4 5499 When set, all accounting messages for this session MUST NOT 5500 include the Destination-Host AVP. When cleared, the default 5501 value, the Destination-Host AVP, if known, MUST be present in all 5502 accounting messages for this session. 5504 8.18. Session-Server-Failover AVP 5506 The Session-Server-Failover AVP (AVP Code 271) is of type Enumerated, 5507 and MAY be present in application-specific authorization answer 5508 messages that either do not include the Session-Binding AVP or 5509 include the Session-Binding AVP with any of the bits set to a zero 5510 value. If present, this AVP MAY inform the Diameter client that if a 5511 re-auth or STR message fails due to a delivery problem, the Diameter 5512 client SHOULD issue a subsequent message without the Destination-Host 5513 AVP. When absent, the default value is REFUSE_SERVICE. 5515 The following values are supported: 5517 REFUSE_SERVICE 0 5519 If either the re-auth or the STR message delivery fails, terminate 5520 service with the user, and do not attempt any subsequent attempts. 5522 TRY_AGAIN 1 5524 If either the re-auth or the STR message delivery fails, resend 5525 the failed message without the Destination-Host AVP present. 5527 ALLOW_SERVICE 2 5529 If re-auth message delivery fails, assume that re-authorization 5530 succeeded. If STR message delivery fails, terminate the session. 5532 TRY_AGAIN_ALLOW_SERVICE 3 5534 If either the re-auth or the STR message delivery fails, resend 5535 the failed message without the Destination-Host AVP present. If 5536 the second delivery fails for re-auth, assume re-authorization 5537 succeeded. If the second delivery fails for STR, terminate the 5538 session. 5540 8.19. Multi-Round-Time-Out AVP 5542 The Multi-Round-Time-Out AVP (AVP Code 272) is of type Unsigned32, 5543 and SHOULD be present in application-specific authorization answer 5544 messages whose Result-Code AVP is set to DIAMETER_MULTI_ROUND_AUTH. 5545 This AVP contains the maximum number of seconds that the access 5546 device MUST provide the user in responding to an authentication 5547 request. 5549 8.20. Class AVP 5551 The Class AVP (AVP Code 25) is of type OctetString and is used by 5552 Diameter servers to return state information to the access device. 5553 When one or more Class AVPs are present in application-specific 5554 authorization answer messages, they MUST be present in subsequent re- 5555 authorization, session termination and accounting messages. Class 5556 AVPs found in a re-authorization answer message override the ones 5557 found in any previous authorization answer message. Diameter server 5558 implementations SHOULD NOT return Class AVPs that require more than 5559 4096 bytes of storage on the Diameter client. A Diameter client that 5560 receives Class AVPs whose size exceeds local available storage MUST 5561 terminate the session. 5563 8.21. Event-Timestamp AVP 5565 The Event-Timestamp (AVP Code 55) is of type Time, and MAY be 5566 included in an Accounting-Request and Accounting-Answer messages to 5567 record the time that the reported event occurred, in seconds since 5568 January 1, 1900 00:00 UTC. 5570 9. Accounting 5572 This accounting protocol is based on a server directed model with 5573 capabilities for real-time delivery of accounting information. 5574 Several fault resilience methods [RFC2975] have been built in to the 5575 protocol in order minimize loss of accounting data in various fault 5576 situations and under different assumptions about the capabilities of 5577 the used devices. 5579 9.1. Server Directed Model 5581 The server directed model means that the device generating the 5582 accounting data gets information from either the authorization server 5583 (if contacted) or the accounting server regarding the way accounting 5584 data shall be forwarded. This information includes accounting record 5585 timeliness requirements. 5587 As discussed in [RFC2975], real-time transfer of accounting records 5588 is a requirement, such as the need to perform credit limit checks and 5589 fraud detection. Note that batch accounting is not a requirement, 5590 and is therefore not supported by Diameter. Should batched 5591 accounting be required in the future, a new Diameter application will 5592 need to be created, or it could be handled using another protocol. 5593 Note, however, that even if at the Diameter layer accounting requests 5594 are processed one by one, transport protocols used under Diameter 5595 typically batch several requests in the same packet under heavy 5596 traffic conditions. This may be sufficient for many applications. 5598 The authorization server (chain) directs the selection of proper 5599 transfer strategy, based on its knowledge of the user and 5600 relationships of roaming partnerships. The server (or agents) uses 5601 the Acct-Interim-Interval and Accounting-Realtime-Required AVPs to 5602 control the operation of the Diameter peer operating as a client. 5603 The Acct-Interim-Interval AVP, when present, instructs the Diameter 5604 node acting as a client to produce accounting records continuously 5605 even during a session. Accounting-Realtime-Required AVP is used to 5606 control the behavior of the client when the transfer of accounting 5607 records from the Diameter client is delayed or unsuccessful. 5609 The Diameter accounting server MAY override the interim interval or 5610 the realtime requirements by including the Acct-Interim-Interval or 5611 Accounting-Realtime-Required AVP in the Accounting-Answer message. 5612 When one of these AVPs is present, the latest value received SHOULD 5613 be used in further accounting activities for the same session. 5615 9.2. Protocol Messages 5617 A Diameter node that receives a successful authentication and/or 5618 authorization messages from the Diameter server SHOULD collect 5619 accounting information for the session. The Accounting-Request 5620 message is used to transmit the accounting information to the 5621 Diameter server, which MUST reply with the Accounting-Answer message 5622 to confirm reception. The Accounting-Answer message includes the 5623 Result-Code AVP, which MAY indicate that an error was present in the 5624 accounting message. The value of the Accounting-Realtime-Required 5625 AVP received earlier for the session in question may indicate that 5626 the user's session has to be terminated when a rejected Accounting- 5627 Request message was received. 5629 9.3. Accounting Application Extension and Requirements 5631 Each Diameter application (e.g., NASREQ, MobileIP), SHOULD define 5632 their Service-Specific AVPs that MUST be present in the Accounting- 5633 Request message in a section entitled "Accounting AVPs". The 5634 application MUST assume that the AVPs described in this document will 5635 be present in all Accounting messages, so only their respective 5636 service-specific AVPs need to be defined in that section. 5638 Applications have the option of using one or both of the following 5639 accounting application extension models: 5641 Split Accounting Service 5643 The accounting message will carry the Application Id of the 5644 Diameter base accounting application (see Section 2.4). 5645 Accounting messages may be routed to Diameter nodes other than the 5646 corresponding Diameter application. These nodes might be 5647 centralized accounting servers that provide accounting service for 5648 multiple different Diameter applications. These nodes MUST 5649 advertise the Diameter base accounting Application Id during 5650 capabilities exchange. 5652 Coupled Accounting Service 5654 The accounting messages will carry the Application Id of the 5655 application that is using it. The application itself will process 5656 the received accounting records or forward them to an accounting 5657 server. There is no accounting application advertisement required 5658 during capabilities exchange and the accounting messages will be 5659 routed the same as any of the other application messages. 5661 In cases where an application does not define its own accounting 5662 service, it is preferred that the split accounting model be used. 5664 9.4. Fault Resilience 5666 Diameter Base protocol mechanisms are used to overcome small message 5667 loss and network faults of temporary nature. 5669 Diameter peers acting as clients MUST implement the use of failover 5670 to guard against server failures and certain network failures. 5671 Diameter peers acting as agents or related off-line processing 5672 systems MUST detect duplicate accounting records caused by the 5673 sending of same record to several servers and duplication of messages 5674 in transit. This detection MUST be based on the inspection of the 5675 Session-Id and Accounting-Record-Number AVP pairs. Appendix C 5676 discusses duplicate detection needs and implementation issues. 5678 Diameter clients MAY have non-volatile memory for the safe storage of 5679 accounting records over reboots or extended network failures, network 5680 partitions, and server failures. If such memory is available, the 5681 client SHOULD store new accounting records there as soon as the 5682 records are created and until a positive acknowledgement of their 5683 reception from the Diameter Server has been received. Upon a reboot, 5684 the client MUST starting sending the records in the non-volatile 5685 memory to the accounting server with appropriate modifications in 5686 termination cause, session length, and other relevant information in 5687 the records. 5689 A further application of this protocol may include AVPs to control 5690 how many accounting records may at most be stored in the Diameter 5691 client without committing them to the non-volatile memory or 5692 transferring them to the Diameter server. 5694 The client SHOULD NOT remove the accounting data from any of its 5695 memory areas before the correct Accounting-Answer has been received. 5696 The client MAY remove oldest, undelivered or yet unacknowledged 5697 accounting data if it runs out of resources such as memory. It is an 5698 implementation dependent matter for the client to accept new sessions 5699 under this condition. 5701 9.5. Accounting Records 5703 In all accounting records, the Session-Id AVP MUST be present; the 5704 User-Name AVP MUST be present if it is available to the Diameter 5705 client. 5707 Different types of accounting records are sent depending on the 5708 actual type of accounted service and the authorization server's 5709 directions for interim accounting. If the accounted service is a 5710 one-time event, meaning that the start and stop of the event are 5711 simultaneous, then the Accounting-Record-Type AVP MUST be present and 5712 set to the value EVENT_RECORD. 5714 If the accounted service is of a measurable length, then the AVP MUST 5715 use the values START_RECORD, STOP_RECORD, and possibly, 5716 INTERIM_RECORD. If the authorization server has not directed interim 5717 accounting to be enabled for the session, two accounting records MUST 5718 be generated for each service of type session. When the initial 5719 Accounting-Request for a given session is sent, the Accounting- 5720 Record-Type AVP MUST be set to the value START_RECORD. When the last 5721 Accounting-Request is sent, the value MUST be STOP_RECORD. 5723 If the authorization server has directed interim accounting to be 5724 enabled, the Diameter client MUST produce additional records between 5725 the START_RECORD and STOP_RECORD, marked INTERIM_RECORD. The 5726 production of these records is directed by Acct-Interim-Interval as 5727 well as any re-authentication or re-authorization of the session. 5728 The Diameter client MUST overwrite any previous interim accounting 5729 records that are locally stored for delivery, if a new record is 5730 being generated for the same session. This ensures that only one 5731 pending interim record can exist on an access device for any given 5732 session. 5734 A particular value of Accounting-Sub-Session-Id MUST appear only in 5735 one sequence of accounting records from a DIAMETER client, except for 5736 the purposes of retransmission. The one sequence that is sent MUST 5737 be either one record with Accounting-Record-Type AVP set to the value 5738 EVENT_RECORD, or several records starting with one having the value 5739 START_RECORD, followed by zero or more INTERIM_RECORD and a single 5740 STOP_RECORD. A particular Diameter application specification MUST 5741 define the type of sequences that MUST be used. 5743 9.6. Correlation of Accounting Records 5745 If an application uses accounting messages, it can correlate 5746 accounting records with a specific application session by using the 5747 Session-Id of the particular application session in the accounting 5748 messages. Accounting messages MAY also use a different Session-Id 5749 from that of the application sessions in which case other session 5750 related information is needed to perform correlation. 5752 In cases where an application requires multiple accounting sub- 5753 session, an Accounting-Sub-Session-Id AVP is used to differentiate 5754 each sub-session. The Session-Id would remain constant for all sub- 5755 sessions and is be used to correlate all the sub-sessions to a 5756 particular application session. Note that receiving a STOP_RECORD 5757 with no Accounting-Sub-Session-Id AVP when sub-sessions were 5758 originally used in the START_RECORD messages implies that all sub- 5759 sessions are terminated. 5761 There are also cases where an application needs to correlate multiple 5762 application sessions into a single accounting record; the accounting 5763 record may span multiple different Diameter applications and sessions 5764 used by the same user at a given time. In such cases, the Acct- 5765 Multi-Session-Id AVP is used. The Acct-Multi-Session-Id AVP SHOULD 5766 be signaled by the server to the access device (typically during 5767 authorization) when it determines that a request belongs to an 5768 existing session. The access device MUST then include the Acct- 5769 Multi-Session-Id AVP in all subsequent accounting messages. 5771 The Acct-Multi-Session-Id AVP MAY include the value of the original 5772 Session-Id. It's contents are implementation specific, but MUST be 5773 globally unique across other Acct-Multi-Session-Id, and MUST NOT 5774 change during the life of a session. 5776 A Diameter application document MUST define the exact concept of a 5777 session that is being accounted, and MAY define the concept of a 5778 multi-session. For instance, the NASREQ DIAMETER application treats 5779 a single PPP connection to a Network Access Server as one session, 5780 and a set of Multilink PPP sessions as one multi-session. 5782 9.7. Accounting Command-Codes 5784 This section defines Command-Code values that MUST be supported by 5785 all Diameter implementations that provide Accounting services. 5787 9.7.1. Accounting-Request 5789 The Accounting-Request (ACR) command, indicated by the Command-Code 5790 field set to 271 and the Command Flags' 'R' bit set, is sent by a 5791 Diameter node, acting as a client, in order to exchange accounting 5792 information with a peer. 5794 The AVP listed below SHOULD include service-specific accounting AVPs, 5795 as described in Section 9.3. 5797 Message Format 5799 ::= < Diameter Header: 271, REQ, PXY > 5800 < Session-Id > 5801 { Origin-Host } 5802 { Origin-Realm } 5803 { Destination-Realm } 5804 { Accounting-Record-Type } 5805 { Accounting-Record-Number } 5806 [ Acct-Application-Id ] 5807 [ Vendor-Specific-Application-Id ] 5808 [ User-Name ] 5809 [ Destination-Host ] 5810 [ Accounting-Sub-Session-Id ] 5811 [ Acct-Session-Id ] 5812 [ Acct-Multi-Session-Id ] 5813 [ Acct-Interim-Interval ] 5814 [ Accounting-Realtime-Required ] 5815 [ Origin-State-Id ] 5816 [ Event-Timestamp ] 5817 * [ Proxy-Info ] 5818 * [ Route-Record ] 5819 * [ AVP ] 5821 9.7.2. Accounting-Answer 5823 The Accounting-Answer (ACA) command, indicated by the Command-Code 5824 field set to 271 and the Command Flags' 'R' bit cleared, is used to 5825 acknowledge an Accounting-Request command. The Accounting-Answer 5826 command contains the same Session-Id as the corresponding request. 5828 Only the target Diameter Server, known as the home Diameter Server, 5829 SHOULD respond with the Accounting-Answer command. 5831 The AVP listed below SHOULD include service-specific accounting AVPs, 5832 as described in Section 9.3. 5834 Message Format 5836 ::= < Diameter Header: 271, PXY > 5837 < Session-Id > 5838 { Result-Code } 5839 { Origin-Host } 5840 { Origin-Realm } 5841 { Accounting-Record-Type } 5842 { Accounting-Record-Number } 5843 [ Acct-Application-Id ] 5844 [ Vendor-Specific-Application-Id ] 5845 [ User-Name ] 5846 [ Accounting-Sub-Session-Id ] 5847 [ Acct-Session-Id ] 5848 [ Acct-Multi-Session-Id ] 5849 [ Error-Message ] 5850 [ Error-Reporting-Host ] 5851 [ Failed-AVP ] 5852 [ Acct-Interim-Interval ] 5853 [ Accounting-Realtime-Required ] 5854 [ Origin-State-Id ] 5855 [ Event-Timestamp ] 5856 * [ Proxy-Info ] 5857 * [ AVP ] 5859 9.8. Accounting AVPs 5861 This section contains AVPs that describe accounting usage information 5862 related to a specific session. 5864 9.8.1. Accounting-Record-Type AVP 5866 The Accounting-Record-Type AVP (AVP Code 480) is of type Enumerated 5867 and contains the type of accounting record being sent. The following 5868 values are currently defined for the Accounting-Record-Type AVP: 5870 EVENT_RECORD 1 5872 An Accounting Event Record is used to indicate that a one-time 5873 event has occurred (meaning that the start and end of the event 5874 are simultaneous). This record contains all information relevant 5875 to the service, and is the only record of the service. 5877 START_RECORD 2 5879 An Accounting Start, Interim, and Stop Records are used to 5880 indicate that a service of a measurable length has been given. An 5881 Accounting Start Record is used to initiate an accounting session, 5882 and contains accounting information that is relevant to the 5883 initiation of the session. 5885 INTERIM_RECORD 3 5887 An Interim Accounting Record contains cumulative accounting 5888 information for an existing accounting session. Interim 5889 Accounting Records SHOULD be sent every time a re-authentication 5890 or re-authorization occurs. Further, additional interim record 5891 triggers MAY be defined by application-specific Diameter 5892 applications. The selection of whether to use INTERIM_RECORD 5893 records is done by the Acct-Interim-Interval AVP. 5895 STOP_RECORD 4 5897 An Accounting Stop Record is sent to terminate an accounting 5898 session and contains cumulative accounting information relevant to 5899 the existing session. 5901 9.8.2. Acct-Interim-Interval AVP 5903 The Acct-Interim-Interval AVP (AVP Code 85) is of type Unsigned32 and 5904 is sent from the Diameter home authorization server to the Diameter 5905 client. The client uses information in this AVP to decide how and 5906 when to produce accounting records. With different values in this 5907 AVP, service sessions can result in one, two, or two+N accounting 5908 records, based on the needs of the home-organization. The following 5909 accounting record production behavior is directed by the inclusion of 5910 this AVP: 5912 1. The omission of the Acct-Interim-Interval AVP or its inclusion 5913 with Value field set to 0 means that EVENT_RECORD, START_RECORD, 5914 and STOP_RECORD are produced, as appropriate for the service. 5916 2. The inclusion of the AVP with Value field set to a non-zero value 5917 means that INTERIM_RECORD records MUST be produced between the 5918 START_RECORD and STOP_RECORD records. The Value field of this 5919 AVP is the nominal interval between these records in seconds. 5921 The Diameter node that originates the accounting information, 5922 known as the client, MUST produce the first INTERIM_RECORD record 5923 roughly at the time when this nominal interval has elapsed from 5924 the START_RECORD, the next one again as the interval has elapsed 5925 once more, and so on until the session ends and a STOP_RECORD 5926 record is produced. 5928 The client MUST ensure that the interim record production times 5929 are randomized so that large accounting message storms are not 5930 created either among records or around a common service start 5931 time. 5933 9.8.3. Accounting-Record-Number AVP 5935 The Accounting-Record-Number AVP (AVP Code 485) is of type Unsigned32 5936 and identifies this record within one session. As Session-Id AVPs 5937 are globally unique, the combination of Session-Id and Accounting- 5938 Record-Number AVPs is also globally unique, and can be used in 5939 matching accounting records with confirmations. An easy way to 5940 produce unique numbers is to set the value to 0 for records of type 5941 EVENT_RECORD and START_RECORD, and set the value to 1 for the first 5942 INTERIM_RECORD, 2 for the second, and so on until the value for 5943 STOP_RECORD is one more than for the last INTERIM_RECORD. 5945 9.8.4. Acct-Session-Id AVP 5947 The Acct-Session-Id AVP (AVP Code 44) is of type OctetString is only 5948 used when RADIUS/Diameter translation occurs. This AVP contains the 5949 contents of the RADIUS Acct-Session-Id attribute. 5951 9.8.5. Acct-Multi-Session-Id AVP 5953 The Acct-Multi-Session-Id AVP (AVP Code 50) is of type UTF8String, 5954 following the format specified in Section 8.8. The Acct-Multi- 5955 Session-Id AVP is used to link together multiple related accounting 5956 sessions, where each session would have a unique Session-Id, but the 5957 same Acct-Multi-Session-Id AVP. This AVP MAY be returned by the 5958 Diameter server in an authorization answer, and MUST be used in all 5959 accounting messages for the given session. 5961 9.8.6. Accounting-Sub-Session-Id AVP 5963 The Accounting-Sub-Session-Id AVP (AVP Code 287) is of type 5964 Unsigned64 and contains the accounting sub-session identifier. The 5965 combination of the Session-Id and this AVP MUST be unique per sub- 5966 session, and the value of this AVP MUST be monotonically increased by 5967 one for all new sub-sessions. The absence of this AVP implies no 5968 sub-sessions are in use, with the exception of an Accounting-Request 5969 whose Accounting-Record-Type is set to STOP_RECORD. A STOP_RECORD 5970 message with no Accounting-Sub-Session-Id AVP present will signal the 5971 termination of all sub-sessions for a given Session-Id. 5973 9.8.7. Accounting-Realtime-Required AVP 5975 The Accounting-Realtime-Required AVP (AVP Code 483) is of type 5976 Enumerated and is sent from the Diameter home authorization server to 5977 the Diameter client or in the Accounting-Answer from the accounting 5978 server. The client uses information in this AVP to decide what to do 5979 if the sending of accounting records to the accounting server has 5980 been temporarily prevented due to, for instance, a network problem. 5982 DELIVER_AND_GRANT 1 5984 The AVP with Value field set to DELIVER_AND_GRANT means that the 5985 service MUST only be granted as long as there is a connection to 5986 an accounting server. Note that the set of alternative accounting 5987 servers are treated as one server in this sense. Having to move 5988 the accounting record stream to a backup server is not a reason to 5989 discontinue the service to the user. 5991 GRANT_AND_STORE 2 5993 The AVP with Value field set to GRANT_AND_STORE means that service 5994 SHOULD be granted if there is a connection, or as long as records 5995 can still be stored as described in Section 9.4. 5997 This is the default behavior if the AVP isn't included in the 5998 reply from the authorization server. 6000 GRANT_AND_LOSE 3 6002 The AVP with Value field set to GRANT_AND_LOSE means that service 6003 SHOULD be granted even if the records cannot be delivered or 6004 stored. 6006 10. AVP Occurrence Table 6008 The following tables presents the AVPs defined in this document, and 6009 specifies in which Diameter messages they MAY be present or not. 6010 AVPs that occur only inside a Grouped AVP are not shown in this 6011 table. 6013 The table uses the following symbols: 6015 0 The AVP MUST NOT be present in the message. 6017 0+ Zero or more instances of the AVP MAY be present in the 6018 message. 6020 0-1 Zero or one instance of the AVP MAY be present in the message. 6021 It is considered an error if there are more than one instance of 6022 the AVP. 6024 1 One instance of the AVP MUST be present in the message. 6026 1+ At least one instance of the AVP MUST be present in the 6027 message. 6029 10.1. Base Protocol Command AVP Table 6031 The table in this section is limited to the non-accounting Command 6032 Codes defined in this specification. 6034 +-----------------------------------------------+ 6035 | Command-Code | 6036 +---+---+---+---+---+---+---+---+---+---+---+---+ 6037 Attribute Name |CER|CEA|DPR|DPA|DWR|DWA|RAR|RAA|ASR|ASA|STR|STA| 6038 --------------------+---+---+---+---+---+---+---+---+---+---+---+---+ 6039 Acct-Interim- |0 |0 |0 |0 |0 |0 |0-1|0 |0 |0 |0 |0 | 6040 Interval | | | | | | | | | | | | | 6041 Accounting-Realtime-|0 |0 |0 |0 |0 |0 |0-1|0 |0 |0 |0 |0 | 6042 Required | | | | | | | | | | | | | 6043 Acct-Application-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6044 Auth-Application-Id |0+ |0+ |0 |0 |0 |0 |1 |0 |1 |0 |1 |0 | 6045 Auth-Grace-Period |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6046 Auth-Request-Type |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6047 Auth-Session-State |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6048 Authorization- |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6049 Lifetime | | | | | | | | | | | | | 6050 Class |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0+ |0+ | 6051 Destination-Host |0 |0 |0 |0 |0 |0 |1 |0 |1 |0 |0-1|0 | 6052 Destination-Realm |0 |0 |0 |0 |0 |0 |1 |0 |1 |0 |1 |0 | 6053 Disconnect-Cause |0 |0 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6054 Error-Message |0 |0-1|0 |0-1|0 |0-1|0 |0-1|0 |0-1|0 |0-1| 6055 Error-Reporting-Host|0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6056 Failed-AVP |0 |0+ |0 |0+ |0 |0+ |0 |0+ |0 |0+ |0 |0+ | 6057 Firmware-Revision |0-1|0-1|0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6058 Host-IP-Address |1+ |1+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6059 Inband-Security-Id |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6060 Multi-Round-Time-Out|0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6061 Origin-Host |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 | 6062 Origin-Realm |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 | 6063 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| 6064 Product-Name |1 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6065 Proxy-Info |0 |0 |0 |0 |0 |0 |0+ |0+ |0+ |0+ |0+ |0+ | 6066 Redirect-Host |0 |0 |0 |0 |0 |0 |0 |0+ |0 |0+ |0 |0+ | 6067 Redirect-Host-Usage |0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6068 Redirect-Max-Cache- |0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6069 Time | | | | | | | | | | | | | 6070 Result-Code |0 |1 |0 |1 |0 |1 |0 |1 |0 |1 |0 |1 | 6071 Re-Auth-Request-Type|0 |0 |0 |0 |0 |0 |1 |0 |0 |0 |0 |0 | 6072 Route-Record |0 |0 |0 |0 |0 |0 |0+ |0 |0+ |0 |0+ |0 | 6073 Session-Binding |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6074 Session-Id |0 |0 |0 |0 |0 |0 |1 |1 |1 |1 |1 |1 | 6075 Session-Server- |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6076 Failover | | | | | | | | | | | | | 6077 Session-Timeout |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6078 Supported-Vendor-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6079 Termination-Cause |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |1 |0 | 6080 User-Name |0 |0 |0 |0 |0 |0 |0-1|0-1|0-1|0-1|0-1|0-1| 6081 Vendor-Id |1 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6082 Vendor-Specific- |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6083 Application-Id | | | | | | | | | | | | | 6084 --------------------+---+---+---+---+---+---+---+---+---+---+---+---+ 6086 10.2. Accounting AVP Table 6088 The table in this section is used to represent which AVPs defined in 6089 this document are to be present in the Accounting messages. These 6090 AVP occurrence requirements are guidelines, which may be expanded, 6091 and/or overridden by application-specific requirements in the 6092 Diameter applications documents. 6094 +-----------+ 6095 | Command | 6096 | Code | 6097 +-----+-----+ 6098 Attribute Name | ACR | ACA | 6099 ------------------------------+-----+-----+ 6100 Acct-Interim-Interval | 0-1 | 0-1 | 6101 Acct-Multi-Session-Id | 0-1 | 0-1 | 6102 Accounting-Record-Number | 1 | 1 | 6103 Accounting-Record-Type | 1 | 1 | 6104 Acct-Session-Id | 0-1 | 0-1 | 6105 Accounting-Sub-Session-Id | 0-1 | 0-1 | 6106 Accounting-Realtime-Required | 0-1 | 0-1 | 6107 Acct-Application-Id | 0-1 | 0-1 | 6108 Auth-Application-Id | 0 | 0 | 6109 Class | 0+ | 0+ | 6110 Destination-Host | 0-1 | 0 | 6111 Destination-Realm | 1 | 0 | 6112 Error-Reporting-Host | 0 | 0+ | 6113 Event-Timestamp | 0-1 | 0-1 | 6114 Origin-Host | 1 | 1 | 6115 Origin-Realm | 1 | 1 | 6116 Proxy-Info | 0+ | 0+ | 6117 Route-Record | 0+ | 0 | 6118 Result-Code | 0 | 1 | 6119 Session-Id | 1 | 1 | 6120 Termination-Cause | 0 | 0 | 6121 User-Name | 0-1 | 0-1 | 6122 Vendor-Specific-Application-Id| 0-1 | 0-1 | 6123 ------------------------------+-----+-----+ 6125 11. IANA Considerations 6127 This section provides guidance to the Internet Assigned Numbers 6128 Authority (IANA) regarding registration of values related to the 6129 Diameter protocol, in accordance with [RFC5226]. Existing IANA 6130 registries and assignments put in place by [RFC3588] remain the same 6131 unless explicitly updated or deprecated in this section. 6133 11.1. AVP Header 6135 As defined in Section 4, the AVP header contains three fields that 6136 requires IANA namespace management; the AVP Code, Vendor-ID and Flags 6137 field. 6139 11.1.1. AVP Codes 6141 There are multiple namespaces. Vendors can have their own AVP Codes 6142 namespace which will be identified by their Vendor-ID (also known as 6143 Enterprise-Number) and they control the assignments of their vendor- 6144 specific AVP codes within their own namespace. The absence of a 6145 Vendor-ID or a Vendor-ID value of zero (0) identifies the IETF IANA 6146 controlled AVP Codes namespace. The AVP Codes and sometimes also 6147 possible values in an AVP are controlled and maintained by IANA. AVP 6148 Code 0 is not used. AVP Codes 1-255 are managed separately as RADIUS 6149 Attribute Types. Where a Vendor-Specific AVP is implemented by more 6150 than one vendor, allocation of global AVPs should be encouraged 6151 instead. 6153 AVPs may be allocated following Expert Review (or Designated Expert) 6154 with Specification Required [RFC5226]. As a change from RFC3588, a 6155 block allocation (release of more than 3 at a time for a given 6156 purpose) now only require IETF Review as opposed to an IETF Consensus 6157 in RFC3588. 6159 11.1.2. AVP Flags 6161 Section 4.1 describes the existing AVP Flags. The remaining bits can 6162 only be assigned via a Standards Action [RFC5226]. 6164 11.2. Diameter Header 6166 11.2.1. Command Codes 6168 For the Diameter Header, the command code namespace allocation has 6169 changed. The new allocation rules are as follows: 6171 The command code values 256 - 8,388,607 (0x100 to 0x7fffff) are 6172 for permanent, standard commands, allocated by IETF Review 6173 [RFC5226]. 6175 The values 8,388,608 - 16,777,213 (0x800000 - 0xfffffd) are 6176 reserved for vendor-specific command codes, to be allocated on a 6177 First Come, First Served basis by IANA [RFC5226]. The request to 6178 IANA for a Vendor-Specific Command Code SHOULD include a reference 6179 to a publicly available specification which documents the command 6180 in sufficient detail to aid in interoperability between 6181 independent implementations. If the specification cannot be made 6182 publicly available, the request for a vendor-specific command code 6183 MUST include the contact information of persons and/or entities 6184 responsible for authoring and maintaining the command. 6186 The values 16,777,214 and 16,777,215 (hexadecimal values 0xfffffe 6187 - 0xffffff) are reserved for experimental commands. As these 6188 codes are only for experimental and testing purposes, no guarantee 6189 is made for interoperability between Diameter peers using 6190 experimental commands. 6192 11.2.2. Command Flags 6194 Section 3 describes the existing Command Flag field. The remaining 6195 bits can only be assigned via a Standards Action [RFC5226]. 6197 11.3. AVP Values 6199 For AVP values, the Experimental-Result-Code AVP value allocation has 6200 been added, see Section 11.3.1. The old AVP value allocation rule 6201 IETF Consensus has been updated to IETF Review as per [RFC5226] and 6202 affected AVPs are listed as reminders. 6204 11.3.1. Experimental-Result-Code AVP 6206 Values for this AVP are purely local to the indicated vendor, and no 6207 IANA registry is maintained for them. 6209 11.3.2. Result-Code AVP Values 6211 New values are available for assignment via IETF Review [RFC5226]. 6213 11.3.3. Accounting-Record-Type AVP Values 6215 New values are available for assignment via IETF Review [RFC5226]. 6217 11.3.4. Termination-Cause AVP Values 6219 New values are available for assignment via IETF Review [RFC5226]. 6221 11.3.5. Redirect-Host-Usage AVP Values 6223 New values are available for assignment via IETF Review [RFC5226]. 6225 11.3.6. Session-Server-Failover AVP Values 6227 New values are available for assignment via IETF Review [RFC5226]. 6229 11.3.7. Session-Binding AVP Values 6231 New values are available for assignment via IETF Review [RFC5226]. 6233 11.3.8. Disconnect-Cause AVP Values 6235 New values are available for assignment via IETF Review [RFC5226]. 6237 11.3.9. Auth-Request-Type AVP Values 6239 New values are available for assignment via IETF Review [RFC5226]. 6241 11.3.10. Auth-Session-State AVP Values 6243 New values are available for assignment via IETF Review [RFC5226]. 6245 11.3.11. Re-Auth-Request-Type AVP Values 6247 New values are available for assignment via IETF Review [RFC5226]. 6249 11.3.12. Accounting-Realtime-Required AVP Values 6251 New values are available for assignment via IETF Review [RFC5226]. 6253 11.3.13. Inband-Security-Id AVP (code 299) 6255 The use of this AVP has been deprecated. 6257 11.4. Diameter TCP, SCTP, TLS/TCP and DTLS/SCTP Port Numbers 6259 Updated port number assignments are described in this section. The 6260 IANA has assigned port number 3868 for TCP and SCTP. The port number 6261 [TBD] has been assigned for TLS/TCP and DTLS/SCTP. 6263 11.5. SCTP Payload Protocol Identifiers 6265 Two SCTP payload protocol identifiers are registered in SCTP Payload 6266 Protocol Identifier registry: 6268 Value | SCTP Payload Protocol Identifier 6269 --------|----------------------------------- 6270 TBD2 | Diameter in a SCTP DATA chunk 6271 TBD3 | Diameter in a DTLS/SCTP DATA chunk 6273 11.6. S-NAPTR Parameters 6275 This document also registers the following S-NAPTR Application 6276 Protocol Tags registry: 6278 Tag | Protocol 6279 -------------------|--------- 6280 diameter.dtls.sctp | DTLS/SCTP 6282 12. Diameter protocol related configurable parameters 6284 This section contains the configurable parameters that are found 6285 throughout this document: 6287 Diameter Peer 6289 A Diameter entity MAY communicate with peers that are statically 6290 configured. A statically configured Diameter peer would require 6291 that either the IP address or the fully qualified domain name 6292 (FQDN) be supplied, which would then be used to resolve through 6293 DNS. 6295 Routing Table 6297 A Diameter proxy server routes messages based on the realm portion 6298 of a Network Access Identifier (NAI). The server MUST have a 6299 table of Realm Names, and the address of the peer to which the 6300 message must be forwarded to. The routing table MAY also include 6301 a "default route", which is typically used for all messages that 6302 cannot be locally processed. 6304 Tc timer 6306 The Tc timer controls the frequency that transport connection 6307 attempts are done to a peer with whom no active transport 6308 connection exists. The recommended value is 30 seconds. 6310 13. Security Considerations 6312 The Diameter base protocol messages SHOULD be secured by using TLS 6313 [RFC5246] or DTLS/SCTP [RFC6083]. Additional security mechanisms 6314 such as IPsec [RFC4301] MAY also be deployed to secure connections 6315 between peers. However, all Diameter base protocol implementations 6316 MUST support the use of TLS/TCP and DTLS/SCTP and the Diameter 6317 protocol MUST NOT be used without any security mechanism. 6319 If a Diameter connection is to be protected via TLS/TCP and DTLS/SCTP 6320 or IPsec, then TLS/TCP and DTLS/SCTP or IPsec/IKE SHOULD begin prior 6321 to any Diameter message exchange. All security parameters for TLS/ 6322 TCP and DTLS/SCTP or IPsec are configured independent of the Diameter 6323 protocol. All Diameter message will be sent through the TLS/TCP and 6324 DTLS/SCTP or IPsec connection after a successful setup. 6326 For TLS/TCP and DTLS/SCTP connections to be established in the open 6327 state, the CER/CEA exchange MUST include an Inband-Security-ID AVP 6328 with a value of TLS/TCP and DTLS/SCTP. The TLS/TCP and DTLS/SCTP 6329 handshake will begin when both ends successfully reached the open 6330 state, after completion of the CER/CEA exchange. If the TLS/TCP and 6331 DTLS/SCTP handshake is successful, all further messages will be sent 6332 via TLS/TCP and DTLS/SCTP. If the handshake fails, both ends move to 6333 the closed state. See Sections Section 13.1 for more details. 6335 13.1. TLS/TCP and DTLS/SCTP Usage 6337 Diameter nodes using TLS/TCP and DTLS/SCTP for security MUST mutually 6338 authenticate as part of TLS/TCP and DTLS/SCTP session establishment. 6339 In order to ensure mutual authentication, the Diameter node acting as 6340 TLS/TCP and DTLS/SCTP server MUST request a certificate from the 6341 Diameter node acting as TLS/TCP and DTLS/SCTP client, and the 6342 Diameter node acting as TLS/TCP and DTLS/SCTP client MUST be prepared 6343 to supply a certificate on request. 6345 Diameter nodes MUST be able to negotiate the following TLS/TCP and 6346 DTLS/SCTP cipher suites: 6348 TLS_RSA_WITH_RC4_128_MD5 6349 TLS_RSA_WITH_RC4_128_SHA 6350 TLS_RSA_WITH_3DES_EDE_CBC_SHA 6352 Diameter nodes SHOULD be able to negotiate the following TLS/TCP and 6353 DTLS/SCTP cipher suite: 6355 TLS_RSA_WITH_AES_128_CBC_SHA 6357 Diameter nodes MAY negotiate other TLS/TCP and DTLS/SCTP cipher 6358 suites. 6360 13.2. Peer-to-Peer Considerations 6362 As with any peer-to-peer protocol, proper configuration of the trust 6363 model within a Diameter peer is essential to security. When 6364 certificates are used, it is necessary to configure the root 6365 certificate authorities trusted by the Diameter peer. These root CAs 6366 are likely to be unique to Diameter usage and distinct from the root 6367 CAs that might be trusted for other purposes such as Web browsing. 6368 In general, it is expected that those root CAs will be configured so 6369 as to reflect the business relationships between the organization 6370 hosting the Diameter peer and other organizations. As a result, a 6371 Diameter peer will typically not be configured to allow connectivity 6372 with any arbitrary peer. With certificate authentication, Diameter 6373 peers may not be known beforehand and therefore peer discovery may be 6374 required. 6376 13.3. AVP Considerations 6378 Diameter AVPs often contain security-sensitive data; for example, 6379 user passwords and location data, network addresses and cryptographic 6380 keys. The Diameter messages containing such AVPs MUST only be sent 6381 protected via mutually authenticated TLS or IPsec. In addition, 6382 those messages SHOULD NOT be sent via intermediate nodes that would 6383 expose the sensitive data at those nodes except in cases where an 6384 intermediary is known to be operated as part of the same 6385 administrative domain as the endpoints so that an ability to 6386 successfully compromise the intermediary would imply a high 6387 probability of being able to compromise the endpoints as well. 6389 14. References 6391 14.1. Normative References 6393 [FLOATPOINT] 6394 Institute of Electrical and Electronics Engineers, "IEEE 6395 Standard for Binary Floating-Point Arithmetic, ANSI/IEEE 6396 Standard 754-1985", August 1985. 6398 [IANAADFAM] 6399 IANA,, "Address Family Numbers", 6400 http://www.iana.org/assignments/address-family-numbers. 6402 [RFC791] Postel, J., "Internet Protocol", RFC 791, September 1981. 6404 [RFC793] Postel, J., "Transmission Control Protocol", RFC 793, 6405 January 1981. 6407 [RFC3539] Aboba, B. and J. Wood, "Authentication, Authorization and 6408 Accounting (AAA) Transport Profile", RFC 3539, June 2003. 6410 [RFC4004] Calhoun, P., Johansson, T., Perkins, C., Hiller, T., and 6411 P. McCann, "Diameter Mobile IPv4 Application", RFC 4004, 6412 August 2005. 6414 [RFC4005] Calhoun, P., Zorn, G., Spence, D., and D. Mitton, 6415 "Diameter Network Access Server Application", RFC 4005, 6416 August 2005. 6418 [RFC4006] Hakala, H., Mattila, L., Koskinen, J-P., Stura, M., and J. 6419 Loughney, "Diameter Credit-Control Application", RFC 4006, 6420 August 2005. 6422 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 6423 Specifications: ABNF", STD 68, RFC 5234, January 2008. 6425 [RFC3588] Calhoun, P., Loughney, J., Guttman, E., Zorn, G., and J. 6426 Arkko, "Diameter Base Protocol", RFC 3588, September 2003. 6428 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 6429 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 6430 May 2008. 6432 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing 6433 Architecture", RFC 4291, February 2006. 6435 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6436 Requirement Levels", BCP 14, RFC 2119, March 1997. 6438 [RFC4282] Aboba, B., Beadles, M., Arkko, J., and P. Eronen, "The 6439 Network Access Identifier", RFC 4282, December 2005. 6441 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 6442 Requirements for Security", BCP 106, RFC 4086, June 2005. 6444 [RFC4960] Stewart, R., "Stream Control Transmission Protocol", 6445 RFC 4960, September 2007. 6447 [RFC3958] Daigle, L. and A. Newton, "Domain-Based Application 6448 Service Location Using SRV RRs and the Dynamic Delegation 6449 Discovery Service (DDDS)", RFC 3958, January 2005. 6451 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 6452 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 6454 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 6455 Resource Identifier (URI): Generic Syntax", STD 66, 6456 RFC 3986, January 2005. 6458 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 6459 10646", STD 63, RFC 3629, November 2003. 6461 [RFC5890] Klensin, J., "Internationalized Domain Names for 6462 Applications (IDNA): Definitions and Document Framework", 6463 RFC 5890, August 2010. 6465 [RFC5891] Klensin, J., "Internationalized Domain Names in 6466 Applications (IDNA): Protocol", RFC 5891, August 2010. 6468 [RFC3492] Costello, A., "Punycode: A Bootstring encoding of Unicode 6469 for Internationalized Domain Names in Applications 6470 (IDNA)", RFC 3492, March 2003. 6472 [RFC5729] Korhonen, J., Jones, M., Morand, L., and T. Tsou, 6473 "Clarifications on the Routing of Diameter Requests Based 6474 on the Username and the Realm", RFC 5729, December 2009. 6476 [RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 6477 Security", RFC 4347, April 2006. 6479 [RFC6083] Tuexen, M., Seggelmann, R., and E. Rescorla, "Datagram 6480 Transport Layer Security (DTLS) for Stream Control 6481 Transmission Protocol (SCTP)", RFC 6083, January 2011. 6483 14.2. Informational References 6485 [RFC2989] Aboba, B., Calhoun, P., Glass, S., Hiller, T., McCann, P., 6486 Shiino, H., Walsh, P., Zorn, G., Dommety, G., Perkins, C., 6487 Patil, B., Mitton, D., Manning, S., Beadles, M., Chen, X., 6488 Sivalingham, S., Hameed, A., Munson, M., Jacobs, S., Lim, 6489 B., Hirschman, B., Hsu, R., Koo, H., Lipford, M., 6490 Campbell, E., Xu, Y., Baba, S., and E. Jaques, "Criteria 6491 for Evaluating AAA Protocols for Network Access", 6492 RFC 2989, November 2000. 6494 [RFC2975] Aboba, B., Arkko, J., and D. Harrington, "Introduction to 6495 Accounting Management", RFC 2975, October 2000. 6497 [RFC3232] Reynolds, J., "Assigned Numbers: RFC 1700 is Replaced by 6498 an On-line Database", RFC 3232, January 2002. 6500 [RFC5176] Chiba, M., Dommety, G., Eklund, M., Mitton, D., and B. 6501 Aboba, "Dynamic Authorization Extensions to Remote 6502 Authentication Dial In User Service (RADIUS)", RFC 5176, 6503 January 2008. 6505 [RFC1661] Simpson, W., "The Point-to-Point Protocol (PPP)", STD 51, 6506 RFC 1661, July 1994. 6508 [RFC2866] Rigney, C., "RADIUS Accounting", RFC 2866, June 2000. 6510 [RFC2869] Rigney, C., Willats, W., and P. Calhoun, "RADIUS 6511 Extensions", RFC 2869, June 2000. 6513 [RFC2865] Rigney, C., Willens, S., Rubens, A., and W. Simpson, 6514 "Remote Authentication Dial In User Service (RADIUS)", 6515 RFC 2865, June 2000. 6517 [RFC3162] Aboba, B., Zorn, G., and D. Mitton, "RADIUS and IPv6", 6518 RFC 3162, August 2001. 6520 [RFC4301] Kent, S. and K. Seo, "Security Architecture for the 6521 Internet Protocol", RFC 4301, December 2005. 6523 [RFC5905] Mills, D., Martin, J., Burbank, J., and W. Kasch, "Network 6524 Time Protocol Version 4: Protocol and Algorithms 6525 Specification", RFC 5905, June 2010. 6527 [RFC1492] Finseth, C., "An Access Control Protocol, Sometimes Called 6528 TACACS", RFC 1492, July 1993. 6530 [RFC4690] Klensin, J., Faltstrom, P., Karp, C., and IAB, "Review and 6531 Recommendations for Internationalized Domain Names 6532 (IDNs)", RFC 4690, September 2006. 6534 [RFC5461] Gont, F., "TCP's Reaction to Soft Errors", RFC 5461, 6535 February 2009. 6537 [RFC5927] Gont, F., "ICMP Attacks against TCP", RFC 5927, July 2010. 6539 [RFC3748] Aboba, B., Blunk, L., Vollbrecht, J., Carlson, J., and H. 6540 Levkowetz, "Extensible Authentication Protocol (EAP)", 6541 RFC 3748, June 2004. 6543 Appendix A. Acknowledgements 6545 A.1. RFC3588bis 6547 The authors would like to thank the following people that have 6548 provided proposals and contributions to this document: 6550 To Vishnu Ram and Satendra Gera for their contributions on 6551 Capabilities Updates, Predictive Loop Avoidance as well as many other 6552 technical proposals. To Tolga Asveren for his insights and 6553 contributions on almost all of the proposed solutions incorporated 6554 into this document. To Timothy Smith for helping on the Capabilities 6555 Updates and other topics. To Tony Zhang for providing fixes to loop 6556 holes on composing Failed-AVPs as well as many other issues and 6557 topics. To Jan Nordqvist for clearly stating the usage of 6558 Application Ids. To Anders Kristensen for providing needed technical 6559 opinions. To David Frascone for providing invaluable review of the 6560 document. To Mark Jones for providing clarifying text on vendor 6561 command codes and other vendor specific indicators. To Jouni 6562 Korhonen for taking over the editing task and resolving last bits 6563 from -27 version onwards. 6565 Special thanks to the Diameter extensibility design team which helped 6566 resolve the tricky question of mandatory AVPs and ABNF semantics. 6568 The members of this team are as follows: 6570 Avi Lior, Jari Arkko, Glen Zorn, Lionel Morand, Mark Jones, Tolga 6571 Asveren Jouni Korhonen, Glenn McGregor. 6573 Special thanks also to people who have provided invaluable comments 6574 and inputs especially in resolving controversial issues: 6576 Glen Zorn, Yoshihiro Ohba, Marco Stura, and Pasi Eronen. 6578 Finally, we would like to thank the original authors of this 6579 document: 6581 Pat Calhoun, John Loughney, Jari Arkko, Erik Guttman and Glen Zorn. 6583 Their invaluable knowledge and experience has given us a robust and 6584 flexible AAA protocol that many people have seen great value in 6585 adopting. We greatly appreciate their support and stewardship for 6586 the continued improvements of Diameter as a protocol. We would also 6587 like to extend our gratitude to folks aside from the authors who have 6588 assisted and contributed to the original version of this document. 6589 Their efforts significantly contributed to the success of Diameter. 6591 A.2. RFC3588 6593 The authors would like to thank Nenad Trifunovic, Tony Johansson and 6594 Pankaj Patel for their participation in the pre-IETF Document Reading 6595 Party. Allison Mankin, Jonathan Wood and Bernard Aboba provided 6596 invaluable assistance in working out transport issues, and similarly 6597 with Steven Bellovin in the security area. 6599 Paul Funk and David Mitton were instrumental in getting the Peer 6600 State Machine correct, and our deep thanks go to them for their time. 6602 Text in this document was also provided by Paul Funk, Mark Eklund, 6603 Mark Jones and Dave Spence. Jacques Caron provided many great 6604 comments as a result of a thorough review of the spec. 6606 The authors would also like to acknowledge the following people for 6607 their contribution in the development of the Diameter protocol: 6609 Allan C. Rubens, Haseeb Akhtar, William Bulley, Stephen Farrell, 6610 David Frascone, Daniel C. Fox, Lol Grant, Ignacio Goyret, Nancy 6611 Greene, Peter Heitman, Fredrik Johansson, Mark Jones, Martin Julien, 6612 Bob Kopacz, Paul Krumviede, Fergal Ladley, Ryan Moats, Victor Muslin, 6613 Kenneth Peirce, John Schnizlein, Sumit Vakil, John R. Vollbrecht and 6614 Jeff Weisberg. 6616 Finally, Pat Calhoun would like to thank Sun Microsystems since most 6617 of the effort put into this document was done while he was in their 6618 employ. 6620 Appendix B. S-NAPTR Example 6622 As an example, consider a client that wishes to resolve aaa: 6623 ex1.example.com. The client performs a NAPTR query for that domain, 6624 and the following NAPTR records are returned: 6626 ;; order pref flags service regexp replacement 6627 IN NAPTR 50 50 "s" "aaa:diameter.tls.tcp" "" 6628 _diameter._tls.ex1.example.com 6629 IN NAPTR 100 50 "s" "aaa:diameter.tcp" "" 6630 _aaa._tcp.ex1.example.com 6631 IN NAPTR 150 50 "s" "aaa:diameter.sctp" "" 6632 _diameter._sctp.ex1.example.com 6634 This indicates that the server supports TLS, TCP and SCTP in that 6635 order. If the client supports TLS, TLS will be used, targeted to a 6636 host determined by an SRV lookup of _diameter._tls.ex1.example.com. 6637 That lookup would return: 6639 ;; Priority Weight Port Target 6640 IN SRV 0 1 5060 server1.ex1.example.com 6641 IN SRV 0 2 5060 server2.ex1.example.com 6643 As an alternative example, a client that wishes to resolve aaa: 6644 ex2.example.com. The client performs a NAPTR query for that domain, 6645 and the following NAPTR records are returned: 6647 ;; order pref flags service regexp replacement 6648 IN NAPTR 150 50 "a" "aaa:diameter.tls.tcp" "" 6649 server1.ex2.example.com 6650 IN NAPTR 150 50 "a" "aaa:diameter.tls.tcp" "" 6651 server2.ex2.example.com 6653 This indicates that the server supports TCP available at the returned 6654 host names. 6656 Appendix C. Duplicate Detection 6658 As described in Section 9.4, accounting record duplicate detection is 6659 based on session identifiers. Duplicates can appear for various 6660 reasons: 6662 o Failover to an alternate server. Where close to real-time 6663 performance is required, failover thresholds need to be kept low 6664 and this may lead to an increased likelihood of duplicates. 6665 Failover can occur at the client or within Diameter agents. 6667 o Failure of a client or agent after sending of a record from non- 6668 volatile memory, but prior to receipt of an application layer ACK 6669 and deletion of the record. record to be sent. This will result 6670 in retransmission of the record soon after the client or agent has 6671 rebooted. 6673 o Duplicates received from RADIUS gateways. Since the 6674 retransmission behavior of RADIUS is not defined within [RFC2865], 6675 the likelihood of duplication will vary according to the 6676 implementation. 6678 o Implementation problems and misconfiguration. 6680 The T flag is used as an indication of an application layer 6681 retransmission event, e.g., due to failover to an alternate server. 6682 It is defined only for request messages sent by Diameter clients or 6683 agents. For instance, after a reboot, a client may not know whether 6684 it has already tried to send the accounting records in its non- 6685 volatile memory before the reboot occurred. Diameter servers MAY use 6686 the T flag as an aid when processing requests and detecting duplicate 6687 messages. However, servers that do this MUST ensure that duplicates 6688 are found even when the first transmitted request arrives at the 6689 server after the retransmitted request. It can be used only in cases 6690 where no answer has been received from the Server for a request and 6691 the request is sent again, (e.g., due to a failover to an alternate 6692 peer, due to a recovered primary peer or due to a client re-sending a 6693 stored record from non-volatile memory such as after reboot of a 6694 client or agent). 6696 In some cases the Diameter accounting server can delay the duplicate 6697 detection and accounting record processing until a post-processing 6698 phase takes place. At that time records are likely to be sorted 6699 according to the included User-Name and duplicate elimination is easy 6700 in this case. In other situations it may be necessary to perform 6701 real-time duplicate detection, such as when credit limits are imposed 6702 or real-time fraud detection is desired. 6704 In general, only generation of duplicates due to failover or re- 6705 sending of records in non-volatile storage can be reliably detected 6706 by Diameter clients or agents. In such cases the Diameter client or 6707 agents can mark the message as possible duplicate by setting the T 6708 flag. Since the Diameter server is responsible for duplicate 6709 detection, it can choose to make use of the T flag or not, in order 6710 to optimize duplicate detection. Since the T flag does not affect 6711 interoperability, and may not be needed by some servers, generation 6712 of the T flag is REQUIRED for Diameter clients and agents, but MAY be 6713 implemented by Diameter servers. 6715 As an example, it can be usually be assumed that duplicates appear 6716 within a time window of longest recorded network partition or device 6717 fault, perhaps a day. So only records within this time window need 6718 to be looked at in the backward direction. Secondly, hashing 6719 techniques or other schemes, such as the use of the T flag in the 6720 received messages, may be used to eliminate the need to do a full 6721 search even in this set except for rare cases. 6723 The following is an example of how the T flag may be used by the 6724 server to detect duplicate requests. 6726 A Diameter server MAY check the T flag of the received message to 6727 determine if the record is a possible duplicate. If the T flag is 6728 set in the request message, the server searches for a duplicate 6729 within a configurable duplication time window backward and 6730 forward. This limits database searching to those records where 6731 the T flag is set. In a well run network, network partitions and 6732 device faults will presumably be rare events, so this approach 6733 represents a substantial optimization of the duplicate detection 6734 process. During failover, it is possible for the original record 6735 to be received after the T flag marked record, due to differences 6736 in network delays experienced along the path by the original and 6737 duplicate transmissions. The likelihood of this occurring 6738 increases as the failover interval is decreased. In order to be 6739 able to detect out of order duplicates, the Diameter server should 6740 use backward and forward time windows when performing duplicate 6741 checking for the T flag marked request. For example, in order to 6742 allow time for the original record to exit the network and be 6743 recorded by the accounting server, the Diameter server can delay 6744 processing records with the T flag set until a time period 6745 TIME_WAIT + RECORD_PROCESSING_TIME has elapsed after the closing 6746 of the original transport connection. After this time period has 6747 expired, then it may check the T flag marked records against the 6748 database with relative assurance that the original records, if 6749 sent, have been received and recorded. 6751 Appendix D. Internationalized Domain Names 6753 To be compatible with the existing DNS infrastructure and simplify 6754 host and domain name comparison, Diameter identities (FQDNs) are 6755 represented in ASCII form. This allows the Diameter protocol to fall 6756 in-line with the DNS strategy of being transparent from the effects 6757 of Internationalized Domain Names (IDNs) by following the 6758 recommendations in [RFC4690] and [RFC5890]. Applications that 6759 provide support for IDNs outside of the Diameter protocol but 6760 interacting with it SHOULD use the representation and conversion 6761 framework described in [RFC5890], [RFC5891] and [RFC3492]. 6763 Authors' Addresses 6765 Victor Fajardo (editor) 6766 Telcordia Technologies 6767 One Telcordia Drive, 1S-222 6768 Piscataway, NJ 08854 6769 USA 6771 Phone: +1-908-421-1845 6772 Email: vf0213@gmail.com 6774 Jari Arkko 6775 Ericsson Research 6776 02420 Jorvas 6777 Finland 6779 Phone: +358 40 5079256 6780 Email: jari.arkko@ericsson.com 6782 John Loughney 6783 Nokia Research Center 6784 955 Page Mill Road 6785 Palo Alto, CA 94304 6786 US 6788 Phone: +1-650-283-8068 6789 Email: john.loughney@nokia.com 6791 Glenn Zorn 6792 Network Zen 6793 1310 East Thomas Street 6794 Seattle, WA 98102 6795 US 6797 Phone: 6798 Email: gwz@net-zen.net