idnits 2.17.1 draft-ietf-dime-rfc3588bis-34.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? -- The draft header indicates that this document obsoletes RFC5719, but the abstract doesn't seem to directly say this. It does mention RFC5719 though, so this could be OK. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 1792 has weird spacing: '...equired rules...' == Line 6707 has weird spacing: '...service rege...' == Line 6728 has weird spacing: '...service rege...' -- The document seems to contain a disclaimer for pre-RFC5378 work, and may have content which was first submitted before 10 November 2008. The disclaimer is necessary when there are original authors that you have been unable to contact, or if some do not wish to grant the BCP78 rights to the IETF Trust. If you are able to get all authors (current and original) to grant those rights, you can and should remove the disclaimer; otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (June 23, 2012) is 4324 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) -- Possible downref: Non-RFC (?) normative reference: ref. 'FLOATPOINT' -- Possible downref: Non-RFC (?) normative reference: ref. 'IANAADFAM' ** Obsolete normative reference: RFC 4005 (Obsoleted by RFC 7155) ** Obsolete normative reference: RFC 4006 (Obsoleted by RFC 8506) ** Obsolete normative reference: RFC 4282 (Obsoleted by RFC 7542) ** Obsolete normative reference: RFC 4960 (Obsoleted by RFC 9260) ** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 6347 (Obsoleted by RFC 9147) ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 3588 (Obsoleted by RFC 6733) Summary: 8 errors (**), 0 flaws (~~), 5 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group V. Fajardo, Ed. 3 Internet-Draft Telcordia Technologies 4 Obsoletes: 3588 5719 (if approved) J. Arkko 5 Intended status: Standards Track Ericsson Research 6 Expires: December 25, 2012 J. Loughney 7 Nokia Research Center 8 G. Zorn, Ed. 9 Network Zen 10 June 23, 2012 12 Diameter Base Protocol 13 draft-ietf-dime-rfc3588bis-34.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 RFC 5719 and must be supported by all new 24 Diameter 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 December 25, 2012. 43 Copyright Notice 45 Copyright (c) 2012 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 This document may contain material from IETF Documents or IETF 59 Contributions published or made publicly available before November 60 10, 2008. The person(s) controlling the copyright in some of this 61 material may not have granted the IETF Trust the right to allow 62 modifications of such material outside the IETF Standards Process. 63 Without obtaining an adequate license from the person(s) controlling 64 the copyright in such materials, this document may not be modified 65 outside the IETF Standards Process, and derivative works of it may 66 not be created outside the IETF Standards Process, except to format 67 it for publication as an RFC or to translate it into languages other 68 than English. 70 Table of Contents 72 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 73 1.1. Diameter Protocol . . . . . . . . . . . . . . . . . . . . 10 74 1.1.1. Description of the Document Set . . . . . . . . . . 11 75 1.1.2. Conventions Used in This Document . . . . . . . . . 12 76 1.1.3. Changes from RFC3588 . . . . . . . . . . . . . . . . 12 77 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 14 78 1.3. Approach to Extensibility . . . . . . . . . . . . . . . . 19 79 1.3.1. Defining New AVP Values . . . . . . . . . . . . . . 20 80 1.3.2. Creating New AVPs . . . . . . . . . . . . . . . . . 20 81 1.3.3. Creating New Commands . . . . . . . . . . . . . . . 20 82 1.3.4. Creating New Diameter Applications . . . . . . . . . 21 83 2. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 22 84 2.1. Transport . . . . . . . . . . . . . . . . . . . . . . . . 23 85 2.1.1. SCTP Guidelines . . . . . . . . . . . . . . . . . . 24 86 2.2. Securing Diameter Messages . . . . . . . . . . . . . . . 25 87 2.3. Diameter Application Compliance . . . . . . . . . . . . . 26 88 2.4. Application Identifiers . . . . . . . . . . . . . . . . . 26 89 2.5. Connections vs. Sessions . . . . . . . . . . . . . . . . 26 90 2.6. Peer Table . . . . . . . . . . . . . . . . . . . . . . . 27 91 2.7. Routing Table . . . . . . . . . . . . . . . . . . . . . . 28 92 2.8. Role of Diameter Agents . . . . . . . . . . . . . . . . . 30 93 2.8.1. Relay Agents . . . . . . . . . . . . . . . . . . . . 31 94 2.8.2. Proxy Agents . . . . . . . . . . . . . . . . . . . . 32 95 2.8.3. Redirect Agents . . . . . . . . . . . . . . . . . . 33 96 2.8.4. Translation Agents . . . . . . . . . . . . . . . . . 34 97 2.9. Diameter Path Authorization . . . . . . . . . . . . . . . 34 98 3. Diameter Header . . . . . . . . . . . . . . . . . . . . . . . 35 99 3.1. Command Codes . . . . . . . . . . . . . . . . . . . . . . 39 100 3.2. Command Code Format Specification . . . . . . . . . . . . 39 101 3.3. Diameter Command Naming Conventions . . . . . . . . . . . 41 102 4. Diameter AVPs . . . . . . . . . . . . . . . . . . . . . . . . 42 103 4.1. AVP Header . . . . . . . . . . . . . . . . . . . . . . . 42 104 4.1.1. Optional Header Elements . . . . . . . . . . . . . . 44 105 4.2. Basic AVP Data Formats . . . . . . . . . . . . . . . . . 44 106 4.3. Derived AVP Data Formats . . . . . . . . . . . . . . . . 46 107 4.3.1. Common Derived AVP Data Formats . . . . . . . . . . 46 108 4.4. Grouped AVP Values . . . . . . . . . . . . . . . . . . . 53 109 4.4.1. Example AVP with a Grouped Data type . . . . . . . . 54 110 4.5. Diameter Base Protocol AVPs . . . . . . . . . . . . . . . 57 111 5. Diameter Peers . . . . . . . . . . . . . . . . . . . . . . . 60 112 5.1. Peer Connections . . . . . . . . . . . . . . . . . . . . 60 113 5.2. Diameter Peer Discovery . . . . . . . . . . . . . . . . . 61 114 5.3. Capabilities Exchange . . . . . . . . . . . . . . . . . . 62 115 5.3.1. Capabilities-Exchange-Request . . . . . . . . . . . 64 116 5.3.2. Capabilities-Exchange-Answer . . . . . . . . . . . . 65 117 5.3.3. Vendor-Id AVP . . . . . . . . . . . . . . . . . . . 65 118 5.3.4. Firmware-Revision AVP . . . . . . . . . . . . . . . 65 119 5.3.5. Host-IP-Address AVP . . . . . . . . . . . . . . . . 66 120 5.3.6. Supported-Vendor-Id AVP . . . . . . . . . . . . . . 66 121 5.3.7. Product-Name AVP . . . . . . . . . . . . . . . . . . 66 122 5.4. Disconnecting Peer connections . . . . . . . . . . . . . 66 123 5.4.1. Disconnect-Peer-Request . . . . . . . . . . . . . . 67 124 5.4.2. Disconnect-Peer-Answer . . . . . . . . . . . . . . . 67 125 5.4.3. Disconnect-Cause AVP . . . . . . . . . . . . . . . . 68 126 5.5. Transport Failure Detection . . . . . . . . . . . . . . . 68 127 5.5.1. Device-Watchdog-Request . . . . . . . . . . . . . . 68 128 5.5.2. Device-Watchdog-Answer . . . . . . . . . . . . . . . 69 129 5.5.3. Transport Failure Algorithm . . . . . . . . . . . . 69 130 5.5.4. Failover and Failback Procedures . . . . . . . . . . 69 131 5.6. Peer State Machine . . . . . . . . . . . . . . . . . . . 70 132 5.6.1. Incoming connections . . . . . . . . . . . . . . . . 72 133 5.6.2. Events . . . . . . . . . . . . . . . . . . . . . . . 73 134 5.6.3. Actions . . . . . . . . . . . . . . . . . . . . . . 74 135 5.6.4. The Election Process . . . . . . . . . . . . . . . . 76 136 6. Diameter Message Processing . . . . . . . . . . . . . . . . . 76 137 6.1. Diameter Request Routing Overview . . . . . . . . . . . . 76 138 6.1.1. Originating a Request . . . . . . . . . . . . . . . 77 139 6.1.2. Sending a Request . . . . . . . . . . . . . . . . . 78 140 6.1.3. Receiving Requests . . . . . . . . . . . . . . . . . 78 141 6.1.4. Processing Local Requests . . . . . . . . . . . . . 78 142 6.1.5. Request Forwarding . . . . . . . . . . . . . . . . . 79 143 6.1.6. Request Routing . . . . . . . . . . . . . . . . . . 79 144 6.1.7. Predictive Loop Avoidance . . . . . . . . . . . . . 79 145 6.1.8. Redirecting Requests . . . . . . . . . . . . . . . . 79 146 6.1.9. Relaying and Proxying Requests . . . . . . . . . . . 81 147 6.2. Diameter Answer Processing . . . . . . . . . . . . . . . 82 148 6.2.1. Processing Received Answers . . . . . . . . . . . . 83 149 6.2.2. Relaying and Proxying Answers . . . . . . . . . . . 83 150 6.3. Origin-Host AVP . . . . . . . . . . . . . . . . . . . . . 83 151 6.4. Origin-Realm AVP . . . . . . . . . . . . . . . . . . . . 84 152 6.5. Destination-Host AVP . . . . . . . . . . . . . . . . . . 84 153 6.6. Destination-Realm AVP . . . . . . . . . . . . . . . . . . 84 154 6.7. Routing AVPs . . . . . . . . . . . . . . . . . . . . . . 85 155 6.7.1. Route-Record AVP . . . . . . . . . . . . . . . . . . 85 156 6.7.2. Proxy-Info AVP . . . . . . . . . . . . . . . . . . . 85 157 6.7.3. Proxy-Host AVP . . . . . . . . . . . . . . . . . . . 85 158 6.7.4. Proxy-State AVP . . . . . . . . . . . . . . . . . . 85 159 6.8. Auth-Application-Id AVP . . . . . . . . . . . . . . . . . 85 160 6.9. Acct-Application-Id AVP . . . . . . . . . . . . . . . . . 86 161 6.10. Inband-Security-Id AVP . . . . . . . . . . . . . . . . . 86 162 6.11. Vendor-Specific-Application-Id AVP . . . . . . . . . . . 86 163 6.12. Redirect-Host AVP . . . . . . . . . . . . . . . . . . . . 87 164 6.13. Redirect-Host-Usage AVP . . . . . . . . . . . . . . . . . 87 165 6.14. Redirect-Max-Cache-Time AVP . . . . . . . . . . . . . . . 89 167 7. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 89 168 7.1. Result-Code AVP . . . . . . . . . . . . . . . . . . . . . 91 169 7.1.1. Informational . . . . . . . . . . . . . . . . . . . 92 170 7.1.2. Success . . . . . . . . . . . . . . . . . . . . . . 92 171 7.1.3. Protocol Errors . . . . . . . . . . . . . . . . . . 92 172 7.1.4. Transient Failures . . . . . . . . . . . . . . . . . 94 173 7.1.5. Permanent Failures . . . . . . . . . . . . . . . . . 95 174 7.2. Error Bit . . . . . . . . . . . . . . . . . . . . . . . . 98 175 7.3. Error-Message AVP . . . . . . . . . . . . . . . . . . . . 98 176 7.4. Error-Reporting-Host AVP . . . . . . . . . . . . . . . . 98 177 7.5. Failed-AVP AVP . . . . . . . . . . . . . . . . . . . . . 99 178 7.6. Experimental-Result AVP . . . . . . . . . . . . . . . . . 100 179 7.7. Experimental-Result-Code AVP . . . . . . . . . . . . . . 100 180 8. Diameter User Sessions . . . . . . . . . . . . . . . . . . . 100 181 8.1. Authorization Session State Machine . . . . . . . . . . . 102 182 8.2. Accounting Session State Machine . . . . . . . . . . . . 106 183 8.3. Server-Initiated Re-Auth . . . . . . . . . . . . . . . . 112 184 8.3.1. Re-Auth-Request . . . . . . . . . . . . . . . . . . 112 185 8.3.2. Re-Auth-Answer . . . . . . . . . . . . . . . . . . . 113 186 8.4. Session Termination . . . . . . . . . . . . . . . . . . . 113 187 8.4.1. Session-Termination-Request . . . . . . . . . . . . 114 188 8.4.2. Session-Termination-Answer . . . . . . . . . . . . . 115 189 8.5. Aborting a Session . . . . . . . . . . . . . . . . . . . 116 190 8.5.1. Abort-Session-Request . . . . . . . . . . . . . . . 116 191 8.5.2. Abort-Session-Answer . . . . . . . . . . . . . . . . 117 192 8.6. Inferring Session Termination from Origin-State-Id . . . 117 193 8.7. Auth-Request-Type AVP . . . . . . . . . . . . . . . . . . 118 194 8.8. Session-Id AVP . . . . . . . . . . . . . . . . . . . . . 119 195 8.9. Authorization-Lifetime AVP . . . . . . . . . . . . . . . 120 196 8.10. Auth-Grace-Period AVP . . . . . . . . . . . . . . . . . . 120 197 8.11. Auth-Session-State AVP . . . . . . . . . . . . . . . . . 120 198 8.12. Re-Auth-Request-Type AVP . . . . . . . . . . . . . . . . 121 199 8.13. Session-Timeout AVP . . . . . . . . . . . . . . . . . . . 121 200 8.14. User-Name AVP . . . . . . . . . . . . . . . . . . . . . . 122 201 8.15. Termination-Cause AVP . . . . . . . . . . . . . . . . . . 122 202 8.16. Origin-State-Id AVP . . . . . . . . . . . . . . . . . . . 123 203 8.17. Session-Binding AVP . . . . . . . . . . . . . . . . . . . 124 204 8.18. Session-Server-Failover AVP . . . . . . . . . . . . . . . 124 205 8.19. Multi-Round-Time-Out AVP . . . . . . . . . . . . . . . . 125 206 8.20. Class AVP . . . . . . . . . . . . . . . . . . . . . . . . 125 207 8.21. Event-Timestamp AVP . . . . . . . . . . . . . . . . . . . 126 208 9. Accounting . . . . . . . . . . . . . . . . . . . . . . . . . 126 209 9.1. Server Directed Model . . . . . . . . . . . . . . . . . . 126 210 9.2. Protocol Messages . . . . . . . . . . . . . . . . . . . . 127 211 9.3. Accounting Application Extension and Requirements . . . . 127 212 9.4. Fault Resilience . . . . . . . . . . . . . . . . . . . . 128 213 9.5. Accounting Records . . . . . . . . . . . . . . . . . . . 129 214 9.6. Correlation of Accounting Records . . . . . . . . . . . . 130 215 9.7. Accounting Command-Codes . . . . . . . . . . . . . . . . 130 216 9.7.1. Accounting-Request . . . . . . . . . . . . . . . . . 130 217 9.7.2. Accounting-Answer . . . . . . . . . . . . . . . . . 131 218 9.8. Accounting AVPs . . . . . . . . . . . . . . . . . . . . . 132 219 9.8.1. Accounting-Record-Type AVP . . . . . . . . . . . . . 132 220 9.8.2. Acct-Interim-Interval AVP . . . . . . . . . . . . . 133 221 9.8.3. Accounting-Record-Number AVP . . . . . . . . . . . . 134 222 9.8.4. Acct-Session-Id AVP . . . . . . . . . . . . . . . . 134 223 9.8.5. Acct-Multi-Session-Id AVP . . . . . . . . . . . . . 134 224 9.8.6. Accounting-Sub-Session-Id AVP . . . . . . . . . . . 134 225 9.8.7. Accounting-Realtime-Required AVP . . . . . . . . . . 135 226 10. AVP Occurrence Tables . . . . . . . . . . . . . . . . . . . . 135 227 10.1. Base Protocol Command AVP Table . . . . . . . . . . . . . 136 228 10.2. Accounting AVP Table . . . . . . . . . . . . . . . . . . 137 229 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 138 230 11.1. AVP Header . . . . . . . . . . . . . . . . . . . . . . . 138 231 11.1.1. AVP Codes . . . . . . . . . . . . . . . . . . . . . 139 232 11.1.2. AVP Flags . . . . . . . . . . . . . . . . . . . . . 139 233 11.2. Diameter Header . . . . . . . . . . . . . . . . . . . . . 139 234 11.2.1. Command Codes . . . . . . . . . . . . . . . . . . . 139 235 11.2.2. Command Flags . . . . . . . . . . . . . . . . . . . 140 236 11.3. AVP Values . . . . . . . . . . . . . . . . . . . . . . . 140 237 11.3.1. Experimental-Result-Code AVP . . . . . . . . . . . . 140 238 11.3.2. Result-Code AVP Values . . . . . . . . . . . . . . . 140 239 11.3.3. Accounting-Record-Type AVP Values . . . . . . . . . 140 240 11.3.4. Termination-Cause AVP Values . . . . . . . . . . . . 140 241 11.3.5. Redirect-Host-Usage AVP Values . . . . . . . . . . . 140 242 11.3.6. Session-Server-Failover AVP Values . . . . . . . . . 140 243 11.3.7. Session-Binding AVP Values . . . . . . . . . . . . . 140 244 11.3.8. Disconnect-Cause AVP Values . . . . . . . . . . . . 141 245 11.3.9. Auth-Request-Type AVP Values . . . . . . . . . . . . 141 246 11.3.10. Auth-Session-State AVP Values . . . . . . . . . . . 141 247 11.3.11. Re-Auth-Request-Type AVP Values . . . . . . . . . . 141 248 11.3.12. Accounting-Realtime-Required AVP Values . . . . . . 141 249 11.3.13. Inband-Security-Id AVP (code 299) . . . . . . . . . 141 250 11.4. _diameters Service Name and Port Number Registration . . 141 251 11.5. SCTP Payload Protocol Identifiers . . . . . . . . . . . . 142 252 11.6. S-NAPTR Parameters . . . . . . . . . . . . . . . . . . . 142 253 12. Diameter Protocol-related Configurable Parameters . . . . . . 142 254 13. Security Considerations . . . . . . . . . . . . . . . . . . . 143 255 13.1. TLS/TCP and DTLS/SCTP Usage . . . . . . . . . . . . . . . 143 256 13.2. Peer-to-Peer Considerations . . . . . . . . . . . . . . . 144 257 13.3. AVP Considerations . . . . . . . . . . . . . . . . . . . 144 258 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 144 259 14.1. Normative References . . . . . . . . . . . . . . . . . . 144 260 14.2. Informational References . . . . . . . . . . . . . . . . 147 261 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 148 262 A.1. RFC3588bis . . . . . . . . . . . . . . . . . . . . . . . 148 263 A.2. RFC3588 . . . . . . . . . . . . . . . . . . . . . . . . . 149 264 Appendix B. S-NAPTR Example . . . . . . . . . . . . . . . . . . 150 265 Appendix C. Duplicate Detection . . . . . . . . . . . . . . . . 151 266 Appendix D. Internationalized Domain Names . . . . . . . . . . . 153 267 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 153 269 1. Introduction 271 Authentication, Authorization and Accounting (AAA) protocols such as 272 TACACS [RFC1492] and RADIUS [RFC2865] were initially deployed to 273 provide dial-up PPP [RFC1661] and terminal server access. Over time, 274 AAA support was needed on many new access technologies, the scale and 275 complexity of AAA networks grew, and AAA was also used on new 276 applications (such as voice over IP). This lead to new demands on 277 AAA protocols. 279 Network access requirements for AAA protocols are summarized in 280 [RFC2989]. These include: 282 Failover 284 [RFC2865] does not define failover mechanisms, and as a result, 285 failover behavior differs between implementations. In order to 286 provide well-defined failover behavior, Diameter supports 287 application-layer acknowledgements, and defines failover 288 algorithms and the associated state machine. This is described in 289 Section 5.5 [RFC3539]. 291 Transmission-level security 293 [RFC2865] defines an application-layer authentication and 294 integrity scheme that is required only for use with Response 295 packets. While [RFC2869] defines an additional authentication and 296 integrity mechanism, use is only required during Extensible 297 Authentication Protocol (EAP) [RFC3748] sessions. While 298 attribute-hiding is supported, [RFC2865] does not provide support 299 for per-packet confidentiality. In accounting, [RFC2866] assumes 300 that replay protection is provided by the backend billing server, 301 rather than within the protocol itself. 303 While [RFC3162] defines the use of IPsec with RADIUS, support for 304 IPsec is not required. In order to provide universal support for 305 transmission-level security, and enable both intra- and inter- 306 domain AAA deployments, Diameter provides support for TLS/TCP and 307 DTLS/SCTP. Security is discussed in Section 13. 309 Reliable transport 311 RADIUS runs over UDP, and does not define retransmission behavior; 312 as a result, reliability varies between implementations. As 313 described in [RFC2975], this is a major issue in accounting, where 314 packet loss may translate directly into revenue loss. In order to 315 provide well defined transport behavior, Diameter runs over 316 reliable transport mechanisms (TCP, SCTP) as defined in [RFC3539]. 318 Agent support 320 [RFC2865] does not provide for explicit support for agents, 321 including Proxies, Redirects and Relays. Since the expected 322 behavior is not defined, it varies between implementations. 323 Diameter defines agent behavior explicitly; this is described in 324 Section 2.8. 326 Server-initiated messages 328 While RADIUS server-initiated messages are defined [RFC5176], 329 support is optional. This makes it difficult to implement 330 features such as unsolicited disconnect or re-authentication/ 331 re-authorization on demand across a heterogeneous deployment. To 332 address this issue, support for server-initiated messages is 333 mandatory in Diameter. 335 Transition support 337 While Diameter does not share a common protocol data unit (PDU) 338 with RADIUS, considerable effort has been expended in enabling 339 backward compatibility with RADIUS, so that the two protocols may 340 be deployed in the same network. Initially, it is expected that 341 Diameter will be deployed within new network devices, as well as 342 within gateways enabling communication between legacy RADIUS 343 devices and Diameter agents. This capability enables Diameter 344 support to be added to legacy networks, by addition of a gateway 345 or server speaking both RADIUS and Diameter. 347 In addition to addressing the above requirements, Diameter also 348 provides support for the following: 350 Capability negotiation 352 RADIUS does not support error messages, capability negotiation, or 353 a mandatory/non-mandatory flag for attributes. Since RADIUS 354 clients and servers are not aware of each other's capabilities, 355 they may not be able to successfully negotiate a mutually 356 acceptable service, or in some cases, even be aware of what 357 service has been implemented. Diameter includes support for error 358 handling (Section 7), capability negotiation (Section 5.3), and 359 mandatory/non-mandatory Attribute-Value Pairs (AVPs) 360 (Section 4.1). 362 Peer discovery and configuration 364 RADIUS implementations typically require that the name or address 365 of servers or clients be manually configured, along with the 366 corresponding shared secrets. This results in a large 367 administrative burden, and creates the temptation to reuse the 368 RADIUS shared secret, which can result in major security 369 vulnerabilities if the Request Authenticator is not globally and 370 temporally unique as required in [RFC2865]. Through DNS, Diameter 371 enables dynamic discovery of peers (see Section 5.2). Derivation 372 of dynamic session keys is enabled via transmission-level 373 security. 375 Over time, the capabilities of Network Access Server (NAS) devices 376 have increased substantially. As a result, while Diameter is a 377 considerably more sophisticated protocol than RADIUS, it remains 378 feasible to implement it within embedded devices. 380 1.1. Diameter Protocol 382 The Diameter base protocol provides the following facilities: 384 o Ability to exchange messages and deliver AVPs 386 o Capabilities negotiation 388 o Error notification 390 o Extensibility, through addition of new applications, commands and 391 AVPs (required in [RFC2989]). 393 o Basic services necessary for applications, such as handling of 394 user sessions or accounting 396 All data delivered by the protocol is in the form of AVPs. Some of 397 these AVP values are used by the Diameter protocol itself, while 398 others deliver data associated with particular applications that 399 employ Diameter. AVPs may be arbitrarily added to Diameter messages, 400 the only restriction being that the Command Code Format specification 401 Section 3.2 is satisfied. AVPs are used by the base Diameter 402 protocol to support the following required features: 404 o Transporting of user authentication information, for the purposes 405 of enabling the Diameter server to authenticate the user. 407 o Transporting of service-specific authorization information, 408 between client and servers, allowing the peers to decide whether a 409 user's access request should be granted. 411 o Exchanging resource usage information, which may be used for 412 accounting purposes, capacity planning, etc. 414 o Routing, relaying, proxying and redirecting of Diameter messages 415 through a server hierarchy. 417 The Diameter base protocol satisfies the minimum requirements for an 418 AAA protocol, as specified by [RFC2989]. The base protocol may be 419 used by itself for accounting purposes only, or it may be used with a 420 Diameter application, such as Mobile IPv4 [RFC4004], or network 421 access [RFC4005]. It is also possible for the base protocol to be 422 extended for use in new applications, via the addition of new 423 commands or AVPs. The initial focus of Diameter was network access 424 and accounting applications. A truly generic AAA protocol used by 425 many applications might provide functionality not provided by 426 Diameter. Therefore, it is imperative that the designers of new 427 applications understand their requirements before using Diameter. 428 See Section 1.3.4 for more information on Diameter applications. 430 Any node can initiate a request. In that sense, Diameter is a peer- 431 to-peer protocol. In this document, a Diameter Client is a device at 432 the edge of the network that performs access control, such as a 433 Network Access Server (NAS) or a Foreign Agent (FA). A Diameter 434 client generates Diameter messages to request authentication, 435 authorization, and accounting services for the user. A Diameter 436 agent is a node that does not provide local user authentication or 437 authorization services; agents include proxies, redirects and relay 438 agents. A Diameter server performs authentication and/or 439 authorization of the user. A Diameter node may act as an agent for 440 certain requests while acting as a server for others. 442 The Diameter protocol also supports server-initiated messages, such 443 as a request to abort service to a particular user. 445 1.1.1. Description of the Document Set 447 The Diameter specification consists of an updated version of the base 448 protocol specification (this document) and the Transport Profile 449 [RFC3539]. This document obsoletes both RFC 3588 and RFC 5719. A 450 summary of the base protocol updates included in this document can be 451 found in Section 1.1.3. 453 This document defines the base protocol specification for AAA, which 454 includes support for accounting. There are also a myriad of 455 applications documents describing applications that use this base 456 specification for Authentication, Authorization and Accounting. 457 These application documents specify how to use the Diameter protocol 458 within the context of their application. 460 The Transport Profile document [RFC3539] discusses transport layer 461 issues that arise with AAA protocols and recommendations on how to 462 overcome these issues. This document also defines the Diameter 463 failover algorithm and state machine. 465 Clarifications on the Routing of Diameter Request based on Username 466 and the Realm [RFC5729] defines specific behavior on how to route 467 requests based on the content of the User-Name AVP (Attribute Value 468 Pair). 470 1.1.2. Conventions Used in This Document 472 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 473 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 474 document are to be interpreted as described in [RFC2119]. 476 1.1.3. Changes from RFC3588 478 This document obsoletes RFC 3588 but is fully backward compatible 479 with that document. The changes introduced in this document focus on 480 fixing issues that have surfaced during implementation of Diameter 481 [RFC3588]. An overview of some the major changes are given below. 483 o Deprecated the use of Inband-Security AVP for negotiating 484 transport layer security. It has been generally considered that 485 bootstrapping of TLS via Inband-Security AVP creates certain 486 security risk because it does not completely protect the 487 information carried in the CER (Capabilities Exchange Request)/CEA 488 (Capabilities Exchange Answer). This version of Diameter adopted 489 a common approach of defining a well-known secured port that peers 490 should use when communicating via TLS/TCP and DTLS/SCTP. This new 491 approach augments the existing Inband-Security negotiation but 492 does not completely replace it. The old method is kept for 493 backwards compatibility reasons. 495 o Deprecated the exchange of CER/CEA messages in the open state. 496 This feature was implied in the peer state machine table of 497 [RFC3588] but it was not clearly defined anywhere else in that 498 document. As work on this document progressed, it became clear 499 that the multiplicity of meaning and use of Application Id AVPs in 500 the CER/CEA messages (and the messages themselves) is seen as an 501 abuse of the Diameter extensibility rules and thus required 502 simplification. It is assumed that the capabilities exchange in 503 the open state will be re-introduced in a separate specification 504 which clearly defines new commands for this feature. 506 o Simplified Security Requirements. The use of a secured transport 507 for exchanging Diameter messages remains mandatory. However, TLS/ 508 TCP and DTLS/SCTP has become the primary method of securing 509 Diameter and IPsec is a secondary alternative. See Section 13 for 510 details. The support for the End-to-End security framework (E2E- 511 Sequence AVP and 'P'-bit in the AVP header) has also been 512 deprecated. 514 o Diameter Extensibility Changes. This includes fixes to the 515 Diameter extensibility description (Section 1.3 and others) to 516 better aid Diameter application designers; in addition, the new 517 specification relaxes the policy with respect to the allocation of 518 command codes for vendor-specific uses. 520 o Application Id Usage. Clarify the proper use of Application Id 521 information which can be found in multiple places within a 522 Diameter message. This includes correlating Application Ids found 523 in the message headers and AVPs. These changes also clearly 524 specify the proper Application Id value to use for specific base 525 protocol messages (ASR/ASA, STR/STA) as well as clarifying the 526 content and use of Vendor-Specific-Application-Id. 528 o Routing Fixes. This document more clearly specifies what 529 information (AVPs and Application Id) can be used for making 530 general routing decisions. A rule for the prioritization of 531 redirect routing criteria when multiple route entries are found 532 via redirects has also been added (see Section 6.13. 534 o Simplification of Diameter Peer Discovery. The Diameter discovery 535 process now supports only widely used discovery schemes; the rest 536 have been deprecated (see Section 5.2 for details). 538 There are many other many miscellaneous fixes that have been 539 introduced in this document that may not be considered significant 540 but they are important nonetheless. Examples are removal of obsolete 541 types, fixes to the state machine, clarification of the election 542 process, message validation, fixes to Failed-AVP and Result-Code AVP 543 values, etc. All of the errata previously filed against RFC 3588 544 have been fixed. A comprehensive list of changes is not shown here 545 for practical reasons. 547 1.2. Terminology 549 AAA 551 Authentication, Authorization and Accounting. 553 ABNF 555 Augmented Backus-Naur Form [RFC5234]. A metalanguage with its own 556 formal syntax and rules. It is based on the Backus-Naur Form and 557 is used to define message exchanges in a bi-directional 558 communications protocol. 560 Accounting 562 The act of collecting information on resource usage for the 563 purpose of capacity planning, auditing, billing or cost 564 allocation. 566 Accounting Record 568 An accounting record represents a summary of the resource 569 consumption of a user over the entire session. Accounting servers 570 creating the accounting record may do so by processing interim 571 accounting events or accounting events from several devices 572 serving the same user. 574 Authentication 576 The act of verifying the identity of an entity (subject). 578 Authorization 580 The act of determining whether a requesting entity (subject) will 581 be allowed access to a resource (object). 583 Attribute-Value Pair (AVP) 585 The Diameter protocol consists of a header followed by one or more 586 Attribute-Value-Pairs (AVPs). An AVP includes a header and is 587 used to encapsulate protocol-specific data (e.g., routing 588 information) as well as authentication, authorization or 589 accounting information. 591 Command Code Format (CCF) 593 A modified form of ABNF used to define Diameter commands (see 594 Section 3.2). 596 Diameter Agent 598 A Diameter Agent is a Diameter Node that provides either relay, 599 proxy, redirect or translation services. 601 Diameter Client 603 A Diameter Client is a Diameter Node that supports Diameter client 604 applications as well as the base protocol. Diameter Clients are 605 often implemented in devices situated at the edge of a network and 606 provide access control services for that network. Typical 607 examples of Diameter Clients include the Network Access Server 608 (NAS) and the Mobile IP Foreign Agent (FA). 610 Diameter Node 612 A Diameter Node is a host process that implements the Diameter 613 protocol, and acts either as a Client, Agent or Server. 615 Diameter Peer 617 Two Diameter Nodes sharing a direct TCP or SCTP transport 618 connection are called Diameter Peers. 620 Diameter Server 622 A Diameter Server is a Diameter Node that handles authentication, 623 authorization and accounting requests for a particular realm. By 624 its very nature, a Diameter Server must support Diameter server 625 applications in addition to the base protocol. 627 Downstream 629 Downstream is used to identify the direction of a particular 630 Diameter message from the Home Server towards the Diameter Client. 632 Home Realm 634 A Home Realm is the administrative domain with which the user 635 maintains an account relationship. 637 Home Server 639 A Diameter Server which serves the Home Realm. 641 Interim accounting 643 An interim accounting message provides a snapshot of usage during 644 a user's session. It is typically implemented in order to provide 645 for partial accounting of a user's session in the case a device 646 reboot or other network problem prevents the delivery of a session 647 summary message or session record. 649 Local Realm 651 A local realm is the administrative domain providing services to a 652 user. An administrative domain may act as a local realm for 653 certain users, while being a home realm for others. 655 Multi-session 657 A multi-session represents a logical linking of several sessions. 658 Multi-sessions are tracked by using the Acct-Multi-Session-Id. An 659 example of a multi-session would be a Multi-link PPP bundle. Each 660 leg of the bundle would be a session while the entire bundle would 661 be a multi-session. 663 Network Access Identifier 665 The Network Access Identifier, or NAI [RFC4282], is used in the 666 Diameter protocol to extract a user's identity and realm. The 667 identity is used to identify the user during authentication and/or 668 authorization, while the realm is used for message routing 669 purposes. 671 Proxy Agent or Proxy 673 In addition to forwarding requests and responses, proxies make 674 policy decisions relating to resource usage and provisioning. 675 This is typically accomplished by tracking the state of NAS 676 devices. While proxies typically do not respond to client 677 Requests prior to receiving a Response from the server, they may 678 originate Reject messages in cases where policies are violated. 679 As a result, proxies need to understand the semantics of the 680 messages passing through them, and may not support all Diameter 681 applications. 683 Realm 685 The string in the NAI that immediately follows the '@' character. 686 NAI realm names are required to be unique, and are piggybacked on 687 the administration of the DNS namespace. Diameter makes use of 688 the realm, also loosely referred to as domain, to determine 689 whether messages can be satisfied locally, or whether they must be 690 routed or redirected. In RADIUS, realm names are not necessarily 691 piggybacked on the DNS namespace but may be independent of it. 693 Real-time Accounting 695 Real-time accounting involves the processing of information on 696 resource usage within a defined time window. Time constraints are 697 typically imposed in order to limit financial risk. The Diameter 698 Credit Control Application [RFC4006] is an example of an 699 application that defines real-time accounting functionality. 701 Relay Agent or Relay 703 Relays forward requests and responses based on routing-related 704 AVPs and routing table entries. Since relays do not make policy 705 decisions, they do not examine or alter non-routing AVPs. As a 706 result, relays never originate messages, do not need to understand 707 the semantics of messages or non-routing AVPs, and are capable of 708 handling any Diameter application or message type. Since relays 709 make decisions based on information in routing AVPs and realm 710 forwarding tables they do not keep state on NAS resource usage or 711 sessions in progress. 713 Redirect Agent 715 Rather than forwarding requests and responses between clients and 716 servers, redirect agents refer clients to servers and allow them 717 to communicate directly. Since redirect agents do not sit in the 718 forwarding path, they do not alter any AVPs transiting between 719 client and server. Redirect agents do not originate messages and 720 are capable of handling any message type, although they may be 721 configured only to redirect messages of certain types, while 722 acting as relay or proxy agents for other types. As with relay 723 agents, redirect agents do not keep state with respect to sessions 724 or NAS resources. 726 Session 728 A session is a related progression of events devoted to a 729 particular activity. Diameter application documents provide 730 guidelines as to when a session begins and ends. All Diameter 731 packets with the same Session-Id are considered to be part of the 732 same session. 734 Stateful Agent 736 A stateful agent is one that maintains session state information, 737 by keeping track of all authorized active sessions. Each 738 authorized session is bound to a particular service, and its state 739 is considered active either until it is notified otherwise, or by 740 expiration. 742 Sub-session 744 A sub-session represents a distinct service (e.g., QoS or data 745 characteristics) provided to a given session. These services may 746 happen concurrently (e.g., simultaneous voice and data transfer 747 during the same session) or serially. These changes in sessions 748 are tracked with the Accounting-Sub-Session-Id. 750 Transaction state 752 The Diameter protocol requires that agents maintain transaction 753 state, which is used for failover purposes. Transaction state 754 implies that upon forwarding a request, the Hop-by-Hop identifier 755 is saved; the field is replaced with a locally unique identifier, 756 which is restored to its original value when the corresponding 757 answer is received. The request's state is released upon receipt 758 of the answer. A stateless agent is one that only maintains 759 transaction state. 761 Translation Agent 763 A translation agent is a stateful Diameter node that performs 764 protocol translation between Diameter and another AAA protocol, 765 such as RADIUS. 767 Upstream 769 Upstream is used to identify the direction of a particular 770 Diameter message from the Diameter Client towards the Home Server. 772 User 774 The entity or device requesting or using some resource, in support 775 of which a Diameter client has generated a request. 777 1.3. Approach to Extensibility 779 The Diameter protocol is designed to be extensible, using several 780 mechanisms, including: 782 o Defining new AVP values 784 o Creating new AVPs 786 o Creating new commands 788 o Creating new applications 790 From the point of view of extensibility Diameter authentication, 791 authorization and accounting applications are treated in the same 792 way. 794 Note: Protocol designers should try to re-use existing functionality, 795 namely AVP values, AVPs, commands, and Diameter applications. Reuse 796 simplifies standardization and implementation. To avoid potential 797 interoperability issues it is important to ensure that the semantics 798 of the re-used features are well understood. Given that Diameter can 799 also carry RADIUS attributes as Diameter AVPs, such re-use 800 considerations apply also to existing RADIUS attributes that may be 801 useful in a Diameter application. 803 1.3.1. Defining New AVP Values 805 In order to allocate a new AVP value for AVPs defined in the Diameter 806 Base protocol, the IETF needs to approve a new RFC that describes the 807 AVP value. IANA considerations for these AVP values are discussed in 808 Section 11.3. 810 The allocation of AVP values for other AVPs is guided by the IANA 811 considerations of the document that defines those AVPs. Typically, 812 allocation of new values for an AVP defined in an IETF RFC would 813 require IETF Review [RFC5226], whereas values for vendor-specific 814 AVPs can be allocated by the vendor. 816 1.3.2. Creating New AVPs 818 A new AVP being defined MUST use one of the data types listed in 819 Section 4.2 or Section 4.3. If an appropriate derived data type is 820 already defined, it SHOULD be used instead of a base data type to 821 encourage reusability and good design practice. 823 In the event that a logical grouping of AVPs is necessary, and 824 multiple "groups" are possible in a given command, it is recommended 825 that a Grouped AVP be used (see Section 4.4). 827 The creation of new AVPs can happen in various ways. The recommended 828 approach is to define a new general-purpose AVP in a standards track 829 RFC approved by the IETF. However, as described in Section 11.1.1 830 there are also other mechanisms. 832 1.3.3. Creating New Commands 834 A new Command Code MUST be allocated when required AVPs (those 835 indicated as {AVP} in the CCF definition) are added to, deleted from 836 or redefined in (for example, by changing a required AVP into an 837 optional one) an existing command. 839 Furthermore, if the transport characteristics of a command are 840 changed (for example, with respect to the number of round trips 841 required) a new Command Code MUST be registered. 843 A change to the CCF of a command, such as described above, MUST 844 result in the definition of a new Command Code. This subsequently 845 leads to the need to define a new Diameter Application for any 846 application that will use that new Command. 848 The IANA considerations for command codes are discussed in 849 Section 3.1. 851 1.3.4. Creating New Diameter Applications 853 Every Diameter application specification MUST have an IANA assigned 854 Application Id (see Section 2.4). The managed Application Id space 855 is flat and there is no relationship between different Diameter 856 applications with respect to their Application Ids. As such, there is 857 no versioning support provided by these application Ids itself; every 858 Diameter application is a standalone application. If the application 859 has a relationship with other Diameter applications, such a 860 relationship is not known to Diameter. 862 Before describing the rules for creating new Diameter applications it 863 is important to discuss the semantics of the AVP occurrences as 864 stated in the CCF and the M-bit flag (Section 4.1) for an AVP. There 865 is no relationship imposed between the two; they are set 866 independently. 868 o The CCF indicates what AVPs are placed into a Diameter Command by 869 the sender of that Command. Often, since there are multiple modes 870 of protocol interactions many of the AVPs are indicated as 871 optional. 873 o The M-bit allows the sender to indicate to the receiver whether or 874 not understanding the semantics of an AVP and its content is 875 mandatory. If the M-bit is set by the sender and the receiver 876 does not understand the AVP or the values carried within that AVP 877 then a failure is generated (see Section 7). 879 It is the decision of the protocol designer when to develop a new 880 Diameter application rather than extending Diameter in other ways. 881 However, a new Diameter application MUST be created when one or more 882 of the following criteria are met: 884 M-bit Setting 886 An AVP with the M-bit in the MUST column of the AVP flag table is 887 added to an existing Command/Application. 889 An AVP with the M-bit in the MAY column of the AVP flag table is 890 added to an existing Command/Application. 892 Note: The M-bit setting for a given AVP is relevant to an 893 Application and each command within that application which 894 includes the AVP. That is, if an AVP appears in two commands for 895 application Foo and the M-bit settings are different in each 896 command, then there should be two AVP flag tables describing when 897 to set the M-bit. 899 Commands 901 A new command is used within the existing application either 902 because an additional command is added, an existing command has 903 been modified so that a new Command Code had to be registered, or 904 a command has been deleted. 906 AVP Flag bits 908 An existing application changes the meaning/semantics of their AVP 909 Flags or adds new flag bits then a new Diameter application MUST 910 be created. 912 If the CCF definition of a command allows it, an implementation may 913 add arbitrary optional AVPs with the M-bit cleared (including vendor- 914 specific AVPs) to that command without needing to define a new 915 application. Please refer to Section 11.1.1 for details. 917 2. Protocol Overview 919 The base Diameter protocol concerns itself with establishing 920 connections to peers, capabilities negotiation, how messages are sent 921 and routed through peers, and how the connections are eventually torn 922 down. The base protocol also defines certain rules that apply to all 923 message exchanges between Diameter nodes. 925 Communication between Diameter peers begins with one peer sending a 926 message to another Diameter peer. The set of AVPs included in the 927 message is determined by a particular Diameter application. One AVP 928 that is included to reference a user's session is the Session-Id. 930 The initial request for authentication and/or authorization of a user 931 would include the Session-Id AVP. The Session-Id is then used in all 932 subsequent messages to identify the user's session (see Section 8 for 933 more information). The communicating party may accept the request, 934 or reject it by returning an answer message with the Result-Code AVP 935 set to indicate an error occurred. The specific behavior of the 936 Diameter server or client receiving a request depends on the Diameter 937 application employed. 939 Session state (associated with a Session-Id) MUST be freed upon 940 receipt of the Session-Termination-Request, Session-Termination- 941 Answer, expiration of authorized service time in the Session-Timeout 942 AVP, and according to rules established in a particular Diameter 943 application. 945 The base Diameter protocol may be used by itself for accounting 946 applications. For authentication and authorization, it is always 947 extended for a particular application. 949 Diameter Clients MUST support the base protocol, which includes 950 accounting. In addition, they MUST fully support each Diameter 951 application that is needed to implement the client's service, e.g., 952 NASREQ and/or Mobile IPv4. A Diameter Client MUST be referred to as 953 "Diameter X Client" where X is the application which it supports, and 954 not a "Diameter Client". 956 Diameter Servers MUST support the base protocol, which includes 957 accounting. In addition, they MUST fully support each Diameter 958 application that is needed to implement the intended service, e.g., 959 NASREQ and/or Mobile IPv4. A Diameter Server MUST be referred to as 960 "Diameter X Server" where X is the application which it supports, and 961 not a "Diameter Server". 963 Diameter Relays and redirect agents are transparent to the Diameter 964 applications but they MUST support the Diameter base protocol, which 965 includes accounting, and all Diameter applications. 967 Diameter proxies MUST support the base protocol, which includes 968 accounting. In addition, they MUST fully support each Diameter 969 application that is needed to implement proxied services, e.g., 970 NASREQ and/or Mobile IPv4. A Diameter proxy MUST be referred to as 971 "Diameter X Proxy" where X is the application which it supports, and 972 not a "Diameter Proxy". 974 2.1. Transport 976 The Diameter Transport profile is defined in [RFC3539]. 978 The base Diameter protocol is run on port 3868 for both TCP [RFC793] 979 and SCTP [RFC4960]. For TLS [RFC5246] and DTLS [RFC6347], a Diameter 980 node that initiate a connection prior to any message exchanges MUST 981 run on port . It is assumed that TLS is run on top of TCP when 982 it is used and DTLS is run on top of SCTP when it is used. 984 If the Diameter peer does not support receiving TLS/TCP and DTLS/SCTP 985 connections on port (i.e., the peer complies only with 986 [RFC3588]), then the initiator MAY revert to using TCP or SCTP on 987 port 3868. Note that this scheme is kept only for the purpose of 988 backward compatibility and that there are inherent security 989 vulnerabilities when the initial CER/CEA messages are sent 990 unprotected (see Section 5.6). 992 Diameter clients MUST support either TCP or SCTP; agents and servers 993 SHOULD support both. 995 A Diameter node MAY initiate connections from a source port other 996 than the one that it declares it accepts incoming connections on, and 997 MUST always be prepared to receive connections on port 3868 for TCP 998 or SCTP and port for TLS/TCP and DTLS/SCTP connections. When 999 DNS-based peer discovery (Section 5.2) is used, the port numbers 1000 received from SRV records take precedence over the default ports 1001 (3868 and ). 1003 A given Diameter instance of the peer state machine MUST NOT use more 1004 than one transport connection to communicate with a given peer, 1005 unless multiple instances exist on the peer in which case a separate 1006 connection per process is allowed. 1008 When no transport connection exists with a peer, an attempt to 1009 connect SHOULD be periodically made. This behavior is handled via 1010 the Tc timer (see Section 12 for details), whose recommended value is 1011 30 seconds. There are certain exceptions to this rule, such as when 1012 a peer has terminated the transport connection stating that it does 1013 not wish to communicate. 1015 When connecting to a peer and either zero or more transports are 1016 specified, TLS SHOULD be tried first, followed by DTLS, then by TCP 1017 and finally by SCTP. See Section 5.2 for more information on peer 1018 discovery. 1020 Diameter implementations SHOULD be able to interpret ICMP protocol 1021 port unreachable messages as explicit indications that the server is 1022 not reachable, subject to security policy on trusting such messages. 1023 Further guidance regarding the treatment of ICMP errors can be found 1024 in [RFC5927] and [RFC5461]. Diameter implementations SHOULD also be 1025 able to interpret a reset from the transport and timed-out connection 1026 attempts. If Diameter receives data from the lower layer that cannot 1027 be parsed or identified as a Diameter error made by the peer, the 1028 stream is compromised and cannot be recovered. The transport 1029 connection MUST be closed using a RESET call (send a TCP RST bit) or 1030 an SCTP ABORT message (graceful closure is compromised). 1032 2.1.1. SCTP Guidelines 1034 Diameter messages SHOULD be mapped into SCTP streams in a way that 1035 avoids head-of-the-line (HOL) blocking. Among different ways of 1036 performing the mapping that fulfill this requirement it is 1037 RECOMMENDED that a Diameter node sends every Diameter message 1038 (request or response) over the stream zero with the unordered flag 1039 set. However, Diameter nodes MAY select and implement other design 1040 alternatives for avoiding HOL blocking such as using multiple streams 1041 with the unordered flag cleared (as originally instructed in 1042 RFC3588). On the receiving side, a Diameter entity MUST be ready to 1043 receive Diameter messages over any stream and it is free to return 1044 responses over a different stream. This way, both sides manage the 1045 available streams in the sending direction, independently of the 1046 streams chosen by the other side to send a particular Diameter 1047 message. These messages can be out-of-order and belong to different 1048 Diameter sessions. 1050 Out-of-order delivery has special concerns during a connection 1051 establishment and termination. When a connection is established, the 1052 responder side sends a CEA message and moves to R-Open state as 1053 specified in Section 5.6. If an application message is sent shortly 1054 after the CEA and delivered out-of-order, the initiator side, still 1055 in Wait-I-CEA state, will discard the application message and close 1056 the connection. In order to avoid this race condition, the receiver 1057 side SHOULD NOT use out-of-order delivery methods until the first 1058 message has been received from the initiator, proving that it has 1059 moved to I-Open state. To trigger such message, the receiver side 1060 could send a DWR immediatly after sending CEA. Upon reception of the 1061 corresponding DWA, the receiver side should start using out-of-order 1062 delivery methods to counter the HOL blocking. 1064 Another race condition may occur when DPR and DPA messages are used. 1065 Both DPR and DPA are small in size, thus they may be delivered faster 1066 to the peer than application messages when out-of-order delivery 1067 mechanism is used. Therefore, it is possible that a DPR/DPA exchange 1068 completes while application messages are still in transit, resulting 1069 to a loss of these messages. An implementation could mitigate this 1070 race condition, for example, using timers and wait for a short period 1071 of time for pending application level messages to arrive before 1072 proceeding to disconnect the transport connection. Eventually, lost 1073 messages are handled by the retransmission mechanism described in 1074 Section 5.5.4. 1076 A Diameter agent SHOULD use dedicated payload protocol identifiers 1077 (PPID) for clear text and encrypted SCTP DATA chunks instead of only 1078 using the unspecified payload protocol identifier (value 0). For 1079 this purpose two PPID values are allocated. The PPID value is 1080 for Diameter messages in clear text SCTP DATA chunks and the PPID 1081 value is for Diameter messages in protected DTLS/SCTP DATA 1082 chunks. 1084 2.2. Securing Diameter Messages 1086 Connections between Diameter peers SHOULD be protected by TLS/TCP and 1087 DTLS/SCTP. All Diameter base protocol implementations MUST support 1088 the use of TLS/TCP and DTLS/SCTP. If desired, alternative security 1089 mechanisms that are independent of Diameter, such as IPsec [RFC4301], 1090 can be deployed to secure connections between peers. The Diameter 1091 protocol MUST NOT be used without one of TLS, DTLS or IPsec. 1093 2.3. Diameter Application Compliance 1095 Application Ids are advertised during the capabilities exchange phase 1096 (see Section 5.3). Advertising support of an application implies 1097 that the sender supports the functionality specified in the 1098 respective Diameter application specification. 1100 Implementations MAY add arbitrary optional AVPs with the M-bit 1101 cleared (including vendor-specific AVPs) to a command defined in an 1102 application, but only if the command's CCF syntax specification 1103 allows for it. Please refer to Section 11.1.1 for details. 1105 2.4. Application Identifiers 1107 Each Diameter application MUST have an IANA assigned Application Id. 1108 The base protocol does not require an Application Id since its 1109 support is mandatory. During the capabilities exchange, Diameter 1110 nodes inform their peers of locally supported applications. 1111 Furthermore, all Diameter messages contain an Application Id, which 1112 is used in the message forwarding process. 1114 The following Application Id values are defined: 1116 Diameter Common Messages 0 1117 Diameter Base Accounting 3 1118 Relay 0xffffffff 1120 Relay and redirect agents MUST advertise the Relay Application 1121 Identifier, while all other Diameter nodes MUST advertise locally 1122 supported applications. The receiver of a Capabilities Exchange 1123 message advertising Relay service MUST assume that the sender 1124 supports all current and future applications. 1126 Diameter relay and proxy agents are responsible for finding an 1127 upstream server that supports the application of a particular 1128 message. If none can be found, an error message is returned with the 1129 Result-Code AVP set to DIAMETER_UNABLE_TO_DELIVER. 1131 2.5. Connections vs. Sessions 1133 This section attempts to provide the reader with an understanding of 1134 the difference between connection and session, which are terms used 1135 extensively throughout this document. 1137 A connection refers to a transport level connection between two peers 1138 that is used to send and receive Diameter messages. A session is a 1139 logical concept at the application layer existing between the 1140 Diameter client and the Diameter server; it is identified via the 1141 Session-Id AVP. 1143 +--------+ +-------+ +--------+ 1144 | Client | | Relay | | Server | 1145 +--------+ +-------+ +--------+ 1146 <----------> <----------> 1147 peer connection A peer connection B 1149 <-----------------------------> 1150 User session x 1152 Figure 1: Diameter connections and sessions 1154 In the example provided in Figure 1, peer connection A is established 1155 between the Client and the Relay. Peer connection B is established 1156 between the Relay and the Server. User session X spans from the 1157 Client via the Relay to the Server. Each "user" of a service causes 1158 an auth request to be sent, with a unique session identifier. Once 1159 accepted by the server, both the client and the server are aware of 1160 the session. 1162 It is important to note that there is no relationship between a 1163 connection and a session, and that Diameter messages for multiple 1164 sessions are all multiplexed through a single connection. Also note 1165 that Diameter messages pertaining to the session, both application 1166 specific and those that are defined in this document such as ASR/ASA, 1167 RAR/RAA and STR/STA MUST carry the Application Id of the application. 1168 Diameter messages pertaining to peer connection establishment and 1169 maintenance such as CER/CEA, DWR/DWA and DPR/DPA MUST carry an 1170 Application Id of zero (0). 1172 2.6. Peer Table 1174 The Diameter Peer Table is used in message forwarding, and referenced 1175 by the Routing Table. A Peer Table entry contains the following 1176 fields: 1178 Host identity 1180 Following the conventions described for the DiameterIdentity 1181 derived AVP data format in Section 4.3.1, this field contains the 1182 contents of the Origin-Host (Section 6.3) AVP found in the CER or 1183 CEA message. 1185 StatusT 1187 This is the state of the peer entry, and MUST match one of the 1188 values listed in Section 5.6. 1190 Static or Dynamic 1192 Specifies whether a peer entry was statically configured or 1193 dynamically discovered. 1195 Expiration time 1197 Specifies the time at which dynamically discovered peer table 1198 entries are to be either refreshed, or expired. If public key 1199 certificates are used for Diameter security (e.g., with TLS), this 1200 value MUST NOT be greater than the expiry times in the relevant 1201 certificates. 1203 TLS/TCP and DTLS/SCTP Enabled 1205 Specifies whether TLS/TCP and DTLS/SCTP is to be used when 1206 communicating with the peer. 1208 Additional security information, when needed (e.g., keys, 1209 certificates). 1211 2.7. Routing Table 1213 All Realm-Based routing lookups are performed against what is 1214 commonly known as the Routing Table (see Section 12). Each Routing 1215 Table entry contains the following fields: 1217 Realm Name 1219 This is the field that MUST be used as a primary key in the 1220 routing table lookups. Note that some implementations perform 1221 their lookups based on longest-match-from-the-right on the realm 1222 rather than requiring an exact match. 1224 Application Identifier 1226 An application is identified by an Application Id. A route entry 1227 can have a different destination based on the Application Id in 1228 the message header. This field MUST be used as a secondary key 1229 field in routing table lookups. 1231 Local Action 1233 The Local Action field is used to identify how a message should be 1234 treated. The following actions are supported: 1236 1. LOCAL - Diameter messages that can be satisfied locally, and 1237 do not need to be routed to another Diameter entity. 1239 2. RELAY - All Diameter messages that fall within this category 1240 MUST be routed to a next hop Diameter entity that is indicated 1241 by the identifier described below. Routing is done without 1242 modifying any non-routing AVPs. See Section 6.1.9 for 1243 relaying guidelines. 1245 3. PROXY - All Diameter messages that fall within this category 1246 MUST be routed to a next Diameter entity that is indicated by 1247 the identifier described below. The local server MAY apply 1248 its local policies to the message by including new AVPs to the 1249 message prior to routing. See Section 6.1.9 for proxying 1250 guidelines. 1252 4. REDIRECT - Diameter messages that fall within this category 1253 MUST have the identity of the home Diameter server(s) 1254 appended, and returned to the sender of the message. See 1255 Section 6.1.8 for redirection guidelines. 1257 Server Identifier 1259 The identity of one or more servers to which the message is to be 1260 routed. This identity MUST also be present in the Host Identity 1261 field of the Peer Table (Section 2.6). When the Local Action is 1262 set to RELAY or PROXY, this field contains the identity of the 1263 server(s) to which the message MUST be routed. When the Local 1264 Action field is set to REDIRECT, this field contains the identity 1265 of one or more servers to which the message MUST be redirected. 1267 Static or Dynamic 1269 Specifies whether a route entry was statically configured or 1270 dynamically discovered. 1272 Expiration time 1274 Specifies the time at which a dynamically discovered route table 1275 entry expires. If public key certificates are used for Diameter 1276 security (e.g., with TLS), this value MUST NOT be greater than the 1277 expiry time in the relevant certificates. 1279 It is important to note that Diameter agents MUST support at least 1280 one of the LOCAL, RELAY, PROXY or REDIRECT modes of operation. 1281 Agents do not need to support all modes of operation in order to 1282 conform with the protocol specification, but MUST follow the protocol 1283 compliance guidelines in Section 2. Relay agents and proxies MUST 1284 NOT reorder AVPs. 1286 The routing table MAY include a default entry that MUST be used for 1287 any requests not matching any of the other entries. The routing 1288 table MAY consist of only such an entry. 1290 When a request is routed, the target server MUST have advertised the 1291 Application Id (see Section 2.4) for the given message, or have 1292 advertised itself as a relay or proxy agent. Otherwise, an error is 1293 returned with the Result-Code AVP set to DIAMETER_UNABLE_TO_DELIVER. 1295 2.8. Role of Diameter Agents 1297 In addition to clients and servers, the Diameter protocol introduces 1298 relay, proxy, redirect, and translation agents, each of which is 1299 defined in Section 1.2. Diameter agents are useful for several 1300 reasons: 1302 o They can distribute administration of systems to a configurable 1303 grouping, including the maintenance of security associations. 1305 o They can be used for concentration of requests from an number of 1306 co-located or distributed NAS equipment sets to a set of like user 1307 groups. 1309 o They can do value-added processing to the requests or responses. 1311 o They can be used for load balancing. 1313 o A complex network will have multiple authentication sources, they 1314 can sort requests and forward towards the correct target. 1316 The Diameter protocol requires that agents maintain transaction 1317 state, which is used for failover purposes. Transaction state 1318 implies that upon forwarding a request, its Hop-by-Hop identifier is 1319 saved; the field is replaced with a locally unique identifier, which 1320 is restored to its original value when the corresponding answer is 1321 received. The request's state is released upon receipt of the 1322 answer. A stateless agent is one that only maintains transaction 1323 state. 1325 The Proxy-Info AVP allows stateless agents to add local state to a 1326 Diameter request, with the guarantee that the same state will be 1327 present in the answer. However, the protocol's failover procedures 1328 require that agents maintain a copy of pending requests. 1330 A stateful agent is one that maintains session state information by 1331 keeping track of all authorized active sessions. Each authorized 1332 session is bound to a particular service, and its state is considered 1333 active either until the agent is notified otherwise, or the session 1334 expires. Each authorized session has an expiration, which is 1335 communicated by Diameter servers via the Session-Timeout AVP. 1337 Maintaining session state may be useful in certain applications, such 1338 as: 1340 o Protocol translation (e.g., RADIUS <-> Diameter) 1342 o Limiting resources authorized to a particular user 1344 o Per user or transaction auditing 1346 A Diameter agent MAY act in a stateful manner for some requests and 1347 be stateless for others. A Diameter implementation MAY act as one 1348 type of agent for some requests, and as another type of agent for 1349 others. 1351 2.8.1. Relay Agents 1353 Relay Agents are Diameter agents that accept requests and route 1354 messages to other Diameter nodes based on information found in the 1355 messages (e.g., Destination-Realm). This routing decision is 1356 performed using a list of supported realms, and known peers. This is 1357 known as the Routing Table, as is defined further in Section 2.7. 1359 Relays may, for example, be used to aggregate requests from multiple 1360 Network Access Servers (NASes) within a common geographical area 1361 (POP). The use of Relays is advantageous since it eliminates the 1362 need for NASes to be configured with the necessary security 1363 information they would otherwise require to communicate with Diameter 1364 servers in other realms. Likewise, this reduces the configuration 1365 load on Diameter servers that would otherwise be necessary when NASes 1366 are added, changed or deleted. 1368 Relays modify Diameter messages by inserting and removing routing 1369 information, but do not modify any other portion of a message. 1370 Relays SHOULD NOT maintain session state but MUST maintain 1371 transaction state. 1373 +------+ ---------> +------+ ---------> +------+ 1374 | | 1. Request | | 2. Request | | 1375 | NAS | | DRL | | HMS | 1376 | | 4. Answer | | 3. Answer | | 1377 +------+ <--------- +------+ <--------- +------+ 1378 example.net example.net example.com 1380 Figure 2: Relaying of Diameter messages 1382 The example provided in Figure 2 depicts a request issued from NAS, 1383 which is an access device, for the user bob@example.com. Prior to 1384 issuing the request, NAS performs a Diameter route lookup, using 1385 "example.com" as the key, and determines that the message is to be 1386 relayed to DRL, which is a Diameter Relay. DRL performs the same 1387 route lookup as NAS, and relays the message to HMS, which is 1388 example.com's Home Diameter Server. HMS identifies that the request 1389 can be locally supported (via the realm), processes the 1390 authentication and/or authorization request, and replies with an 1391 answer, which is routed back to NAS using saved transaction state. 1393 Since Relays do not perform any application level processing, they 1394 provide relaying services for all Diameter applications, and 1395 therefore MUST advertise the Relay Application Id. 1397 2.8.2. Proxy Agents 1399 Similarly to relays, proxy agents route Diameter messages using the 1400 Diameter Routing Table. However, they differ since they modify 1401 messages to implement policy enforcement. This requires that proxies 1402 maintain the state of their downstream peers (e.g., access devices) 1403 to enforce resource usage, provide admission control, and 1404 provisioning. 1406 Proxies may, for example, be used in call control centers or access 1407 ISPs that provide outsourced connections, they can monitor the number 1408 and types of ports in use, and make allocation and admission 1409 decisions according to their configuration. 1411 Since enforcing policies requires an understanding of the service 1412 being provided, Proxies MUST only advertise the Diameter applications 1413 they support. 1415 2.8.3. Redirect Agents 1417 Redirect agents are useful in scenarios where the Diameter routing 1418 configuration needs to be centralized. An example is a redirect 1419 agent that provides services to all members of a consortium, but does 1420 not wish to be burdened with relaying all messages between realms. 1421 This scenario is advantageous since it does not require that the 1422 consortium provide routing updates to its members when changes are 1423 made to a member's infrastructure. 1425 Since redirect agents do not relay messages, and only return an 1426 answer with the information necessary for Diameter agents to 1427 communicate directly, they do not modify messages. Since redirect 1428 agents do not receive answer messages, they cannot maintain session 1429 state. 1431 The example provided in Figure 3 depicts a request issued from the 1432 access device, NAS, for the user bob@example.com. The message is 1433 forwarded by the NAS to its relay, DRL, which does not have a routing 1434 entry in its Diameter Routing Table for example.com. DRL has a 1435 default route configured to DRD, which is a redirect agent that 1436 returns a redirect notification to DRL, as well as HMS' contact 1437 information. Upon receipt of the redirect notification, DRL 1438 establishes a transport connection with HMS, if one doesn't already 1439 exist, and forwards the request to it. 1441 +------+ 1442 | | 1443 | DRD | 1444 | | 1445 +------+ 1446 ^ | 1447 2. Request | | 3. Redirection 1448 | | Notification 1449 | v 1450 +------+ ---------> +------+ ---------> +------+ 1451 | | 1. Request | | 4. Request | | 1452 | NAS | | DRL | | HMS | 1453 | | 6. Answer | | 5. Answer | | 1454 +------+ <--------- +------+ <--------- +------+ 1455 example.net example.net example.com 1457 Figure 3: Redirecting a Diameter Message 1459 Since redirect agents do not perform any application level 1460 processing, they provide relaying services for all Diameter 1461 applications, and therefore MUST advertise the Relay Application 1462 Identifier. 1464 2.8.4. Translation Agents 1466 A translation agent is a device that provides translation between two 1467 protocols (e.g., RADIUS<->Diameter, TACACS+<->Diameter). Translation 1468 agents are likely to be used as aggregation servers to communicate 1469 with a Diameter infrastructure, while allowing for the embedded 1470 systems to be migrated at a slower pace. 1472 Given that the Diameter protocol introduces the concept of long-lived 1473 authorized sessions, translation agents MUST be session stateful and 1474 MUST maintain transaction state. 1476 Translation of messages can only occur if the agent recognizes the 1477 application of a particular request, and therefore translation agents 1478 MUST only advertise their locally supported applications. 1480 +------+ ---------> +------+ ---------> +------+ 1481 | | RADIUS Request | | Diameter Request | | 1482 | NAS | | TLA | | HMS | 1483 | | RADIUS Answer | | Diameter Answer | | 1484 +------+ <--------- +------+ <--------- +------+ 1485 example.net example.net example.com 1487 Figure 4: Translation of RADIUS to Diameter 1489 2.9. Diameter Path Authorization 1491 As noted in Section 2.2, Diameter provides transmission level 1492 security for each connection using TLS/TCP and DTLS/SCTP. Therefore, 1493 each connection can be authenticated, replay and integrity protected. 1495 In addition to authenticating each connection, each connection as 1496 well as the entire session MUST also be authorized. Before 1497 initiating a connection, a Diameter Peer MUST check that its peers 1498 are authorized to act in their roles. For example, a Diameter peer 1499 may be authentic, but that does not mean that it is authorized to act 1500 as a Diameter Server advertising a set of Diameter applications. 1502 Prior to bringing up a connection, authorization checks are performed 1503 at each connection along the path. Diameter capabilities negotiation 1504 (CER/CEA) also MUST be carried out, in order to determine what 1505 Diameter applications are supported by each peer. Diameter sessions 1506 MUST be routed only through authorized nodes that have advertised 1507 support for the Diameter application required by the session. 1509 As noted in Section 6.1.9, a relay or proxy agent MUST append a 1510 Route-Record AVP to all requests forwarded. The AVP contains the 1511 identity of the peer the request was received from. 1513 The home Diameter server, prior to authorizing a session, MUST check 1514 the Route-Record AVPs to make sure that the route traversed by the 1515 request is acceptable. For example, administrators within the home 1516 realm may not wish to honor requests that have been routed through an 1517 untrusted realm. By authorizing a request, the home Diameter server 1518 is implicitly indicating its willingness to engage in the business 1519 transaction as specified by the contractual relationship between the 1520 server and the previous hop. A DIAMETER_AUTHORIZATION_REJECTED error 1521 message (see Section 7.1.5) is sent if the route traversed by the 1522 request is unacceptable. 1524 A home realm may also wish to check that each accounting request 1525 message corresponds to a Diameter response authorizing the session. 1526 Accounting requests without corresponding authorization responses 1527 SHOULD be subjected to further scrutiny, as should accounting 1528 requests indicating a difference between the requested and provided 1529 service. 1531 Forwarding of an authorization response is considered evidence of a 1532 willingness to take on financial risk relative to the session. A 1533 local realm may wish to limit this exposure, for example, by 1534 establishing credit limits for intermediate realms and refusing to 1535 accept responses which would violate those limits. By issuing an 1536 accounting request corresponding to the authorization response, the 1537 local realm implicitly indicates its agreement to provide the service 1538 indicated in the authorization response. If the service cannot be 1539 provided by the local realm, then a DIAMETER_UNABLE_TO_COMPLY error 1540 message MUST be sent within the accounting request; a Diameter client 1541 receiving an authorization response for a service that it cannot 1542 perform MUST NOT substitute an alternate service, and then send 1543 accounting requests for the alternate service instead. 1545 3. Diameter Header 1547 A summary of the Diameter header format is shown below. The fields 1548 are transmitted in network byte order. 1550 0 1 2 3 1551 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 1552 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1553 | Version | Message Length | 1554 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1555 | command flags | Command-Code | 1556 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1557 | Application-ID | 1558 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1559 | Hop-by-Hop Identifier | 1560 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1561 | End-to-End Identifier | 1562 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1563 | AVPs ... 1564 +-+-+-+-+-+-+-+-+-+-+-+-+- 1566 Version 1568 This Version field MUST be set to 1 to indicate Diameter Version 1569 1. 1571 Message Length 1573 The Message Length field is three octets and indicates the length 1574 of the Diameter message including the header fields and the padded 1575 AVPs. Thus the message length field is always a multiple of 4. 1577 Command Flags 1579 The Command Flags field is eight bits. The following bits are 1580 assigned: 1582 0 1 2 3 4 5 6 7 1583 +-+-+-+-+-+-+-+-+ 1584 |R P E T r r r r| 1585 +-+-+-+-+-+-+-+-+ 1587 R(equest) 1589 If set, the message is a request. If cleared, the message is 1590 an answer. 1592 P(roxiable) 1594 If set, the message MAY be proxied, relayed or redirected. If 1595 cleared, the message MUST be locally processed. 1597 E(rror) 1599 If set, the message contains a protocol error, and the message 1600 will not conform to the CCF described for this command. 1601 Messages with the 'E' bit set are commonly referred to as error 1602 messages. This bit MUST NOT be set in request messages (see 1603 Section 7.2). 1605 T(Potentially re-transmitted message) 1607 This flag is set after a link failover procedure, to aid the 1608 removal of duplicate requests. It is set when resending 1609 requests not yet acknowledged, as an indication of a possible 1610 duplicate due to a link failure. This bit MUST be cleared when 1611 sending a request for the first time, otherwise the sender MUST 1612 set this flag. Diameter agents only need to be concerned about 1613 the number of requests they send based on a single received 1614 request; retransmissions by other entities need not be tracked. 1615 Diameter agents that receive a request with the T flag set, 1616 MUST keep the T flag set in the forwarded request. This flag 1617 MUST NOT be set if an error answer message (e.g., a protocol 1618 error) has been received for the earlier message. It can be 1619 set only in cases where no answer has been received from the 1620 server for a request and the request is sent again. This flag 1621 MUST NOT be set in answer messages. 1623 r(eserved) 1625 These flag bits are reserved for future use, and MUST be set to 1626 zero, and ignored by the receiver. 1628 Command-Code 1630 The Command-Code field is three octets, and is used in order to 1631 communicate the command associated with the message. The 24-bit 1632 address space is managed by IANA (see Section 3.1). 1634 Command-Code values 16,777,214 and 16,777,215 (hexadecimal values 1635 FFFFFE -FFFFFF) are reserved for experimental use (see 1636 Section 11.2). 1638 Application-ID 1640 Application-ID is four octets and is used to identify to which 1641 application the message is applicable for. The application can be 1642 an authentication application, an accounting application or a 1643 vendor specific application. 1645 The value of the application-id field in the header MUST be the 1646 same as any relevant application-id AVPs contained in the message. 1648 Hop-by-Hop Identifier 1650 The Hop-by-Hop Identifier is an unsigned 32-bit integer field (in 1651 network byte order) and aids in matching requests and replies. 1652 The sender MUST ensure that the Hop-by-Hop identifier in a request 1653 is unique on a given connection at any given time, and MAY attempt 1654 to ensure that the number is unique across reboots. The sender of 1655 an Answer message MUST ensure that the Hop-by-Hop Identifier field 1656 contains the same value that was found in the corresponding 1657 request. The Hop-by-Hop identifier is normally a monotonically 1658 increasing number, whose start value was randomly generated. An 1659 answer message that is received with an unknown Hop-by-Hop 1660 Identifier MUST be discarded. 1662 End-to-End Identifier 1664 The End-to-End Identifier is an unsigned 32-bit integer field (in 1665 network byte order) and is used to detect duplicate messages. 1666 Upon reboot implementations MAY set the high order 12 bits to 1667 contain the low order 12 bits of current time, and the low order 1668 20 bits to a random value. Senders of request messages MUST 1669 insert a unique identifier on each message. The identifier MUST 1670 remain locally unique for a period of at least 4 minutes, even 1671 across reboots. The originator of an Answer message MUST ensure 1672 that the End-to-End Identifier field contains the same value that 1673 was found in the corresponding request. The End-to-End Identifier 1674 MUST NOT be modified by Diameter agents of any kind. The 1675 combination of the Origin-Host AVP (Section 6.3 and this field is 1676 used to detect duplicates. Duplicate requests SHOULD cause the 1677 same answer to be transmitted (modulo the hop-by-hop Identifier 1678 field and any routing AVPs that may be present), and MUST NOT 1679 affect any state that was set when the original request was 1680 processed. Duplicate answer messages that are to be locally 1681 consumed (see Section 6.2) SHOULD be silently discarded. 1683 AVPs 1685 AVPs are a method of encapsulating information relevant to the 1686 Diameter message. See Section 4 for more information on AVPs. 1688 3.1. Command Codes 1690 Each command Request/Answer pair is assigned a command code, and the 1691 sub-type (i.e., request or answer) is identified via the 'R' bit in 1692 the Command Flags field of the Diameter header. 1694 Every Diameter message MUST contain a command code in its header's 1695 Command-Code field, which is used to determine the action that is to 1696 be taken for a particular message. The following Command Codes are 1697 defined in the Diameter base protocol: 1699 Command-Name Abbrev. Code Reference 1700 -------------------------------------------------------- 1701 Abort-Session-Request ASR 274 8.5.1 1702 Abort-Session-Answer ASA 274 8.5.2 1703 Accounting-Request ACR 271 9.7.1 1704 Accounting-Answer ACA 271 9.7.2 1705 Capabilities-Exchange- CER 257 5.3.1 1706 Request 1707 Capabilities-Exchange- CEA 257 5.3.2 1708 Answer 1709 Device-Watchdog-Request DWR 280 5.5.1 1710 Device-Watchdog-Answer DWA 280 5.5.2 1711 Disconnect-Peer-Request DPR 282 5.4.1 1712 Disconnect-Peer-Answer DPA 282 5.4.2 1713 Re-Auth-Request RAR 258 8.3.1 1714 Re-Auth-Answer RAA 258 8.3.2 1715 Session-Termination- STR 275 8.4.1 1716 Request 1717 Session-Termination- STA 275 8.4.2 1718 Answer 1720 3.2. Command Code Format Specification 1722 Every Command Code defined MUST include a corresponding Command Code 1723 Format (CCF) specification, which is used to define the AVPs that 1724 MUST or MAY be present when sending the message. The following ABNF 1725 specifies the CCF used in the definition: 1727 command-def = "<" command-name ">" "::=" diameter-message 1729 command-name = diameter-name 1731 diameter-name = ALPHA *(ALPHA / DIGIT / "-") 1733 diameter-message = header *fixed *required *optional 1734 header = "<" "Diameter Header:" command-id 1735 [r-bit] [p-bit] [e-bit] [application-id] ">" 1737 application-id = 1*DIGIT 1739 command-id = 1*DIGIT 1740 ; The Command Code assigned to the command 1742 r-bit = ", REQ" 1743 ; If present, the 'R' bit in the Command 1744 ; Flags is set, indicating that the message 1745 ; is a request, as opposed to an answer. 1747 p-bit = ", PXY" 1748 ; If present, the 'P' bit in the Command 1749 ; Flags is set, indicating that the message 1750 ; is proxiable. 1752 e-bit = ", ERR" 1753 ; If present, the 'E' bit in the Command 1754 ; Flags is set, indicating that the answer 1755 ; message contains a Result-Code AVP in 1756 ; the "protocol error" class. 1758 fixed = [qual] "<" avp-spec ">" 1759 ; Defines the fixed position of an AVP 1761 required = [qual] "{" avp-spec "}" 1762 ; The AVP MUST be present and can appear 1763 ; anywhere in the message. 1765 optional = [qual] "[" avp-name "]" 1766 ; The avp-name in the 'optional' rule cannot 1767 ; evaluate to any AVP Name which is included 1768 ; in a fixed or required rule. The AVP can 1769 ; appear anywhere in the message. 1770 ; 1771 ; NOTE: "[" and "]" have a slightly different 1772 ; meaning than in ABNF. These braces 1773 ; cannot be used to express optional fixed rules 1774 ; (such as an optional ICV at the end). To do 1775 ; this, the convention is '0*1fixed'. 1777 qual = [min] "*" [max] 1778 ; See ABNF conventions, RFC 5234, Section 4. 1779 ; The absence of any qualifiers depends on 1780 ; whether it precedes a fixed, required, or 1781 ; optional rule. If a fixed or required rule has 1782 ; no qualifier, then exactly one such AVP MUST 1783 ; be present. If an optional rule has no 1784 ; qualifier, then 0 or 1 such AVP may be 1785 ; present. If an optional rule has a qualifier, 1786 ; then the value of min MUST be 0 if present. 1788 min = 1*DIGIT 1789 ; The minimum number of times the element may 1790 ; be present. If absent, the default value is zero 1791 ; for fixed and optional rules and one for 1792 ; required rules. The value MUST be at least one 1793 ; for required rules. 1795 max = 1*DIGIT 1796 ; The maximum number of times the element may 1797 ; be present. If absent, the default value is 1798 ; infinity. A value of zero implies the AVP MUST 1799 ; NOT be present. 1801 avp-spec = diameter-name 1802 ; The avp-spec has to be an AVP Name, defined 1803 ; in the base or extended Diameter 1804 ; specifications. 1806 avp-name = avp-spec / "AVP" 1807 ; The string "AVP" stands for *any* arbitrary AVP 1808 ; Name, not otherwise listed in that command code 1809 ; definition. The inclusion of this string 1810 ; is recommended for all CCFs to allow for 1811 ; extensibility. 1813 The following is a definition of a fictitious command code: 1815 Example-Request ::= < Diameter Header: 9999999, REQ, PXY > 1816 { User-Name } 1817 1* { Origin-Host } 1818 * [ AVP ] 1820 3.3. Diameter Command Naming Conventions 1822 Diameter command names typically includes one or more English words 1823 followed by the verb Request or Answer. Each English word is 1824 delimited by a hyphen. A three-letter acronym for both the request 1825 and answer is also normally provided. 1827 An example is a message set used to terminate a session. The command 1828 name is Session-Terminate-Request and Session-Terminate-Answer, while 1829 the acronyms are STR and STA, respectively. 1831 Both the request and the answer for a given command share the same 1832 command code. The request is identified by the R(equest) bit in the 1833 Diameter header set to one (1), to ask that a particular action be 1834 performed, such as authorizing a user or terminating a session. Once 1835 the receiver has completed the request it issues the corresponding 1836 answer, which includes a result code that communicates one of the 1837 following: 1839 o The request was successful 1841 o The request failed 1843 o An additional request has to be sent to provide information the 1844 peer requires prior to returning a successful or failed answer. 1846 o The receiver could not process the request, but provides 1847 information about a Diameter peer that is able to satisfy the 1848 request, known as redirect. 1850 Additional information, encoded within AVPs, may also be included in 1851 answer messages. 1853 4. Diameter AVPs 1855 Diameter AVPs carry specific authentication, accounting, 1856 authorization and routing information as well as configuration 1857 details for the request and reply. 1859 Each AVP of type OctetString MUST be padded to align on a 32-bit 1860 boundary, while other AVP types align naturally. A number of zero- 1861 valued bytes are added to the end of the AVP Data field till a word 1862 boundary is reached. The length of the padding is not reflected in 1863 the AVP Length field. 1865 4.1. AVP Header 1867 The fields in the AVP header MUST be sent in network byte order. The 1868 format of the header is: 1870 0 1 2 3 1871 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 1872 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1873 | AVP Code | 1874 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1875 |V M P r r r r r| AVP Length | 1876 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1877 | Vendor-ID (opt) | 1878 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1879 | Data ... 1880 +-+-+-+-+-+-+-+-+ 1882 AVP Code 1884 The AVP Code, combined with the Vendor-Id field, identifies the 1885 attribute uniquely. AVP numbers 1 through 255 are reserved for 1886 re-use of RADIUS attributes, without setting the Vendor-Id field. 1887 AVP numbers 256 and above are used for Diameter, which are 1888 allocated by IANA (see Section 11.1.1). 1890 AVP Flags 1892 The AVP Flags field informs the receiver how each attribute must 1893 be handled. New Diameter applications SHOULD NOT define 1894 additional AVP Flag bits. Note however, that new Diameter 1895 applications MAY define additional bits within the AVP Header, and 1896 an unrecognized bit SHOULD be considered an error. The sender of 1897 the AVP MUST set 'r' (reserved) bits to 0 and the receiver SHOULD 1898 ignore all 'r' (reserved) bits. The 'P' bit has been reserved for 1899 future usage of end-to-end security. At the time of writing there 1900 are no end-to-end security mechanisms specified therefore the 'P' 1901 bit SHOULD be set to 0. 1903 The 'M' Bit, known as the Mandatory bit, indicates whether the 1904 receiver of the AVP MUST parse and understand the semantic of the 1905 AVP including its content. The receiving entity MUST return an 1906 appropriate error message if it receives an AVP that has the M-bit 1907 set but does not understand it. An exception applies when the AVP 1908 is embedded within a Grouped AVP. See Section 4.4 for details. 1909 Diameter Relay and redirect agents MUST NOT reject messages with 1910 unrecognized AVPs. 1912 The 'M' bit MUST be set according to the rules defined in the 1913 application specification which introduces or re-uses this AVP. 1914 Within a given application, the M-bit setting for an AVP is either 1915 defined for all command types or for each command type. 1917 AVPs with the 'M' bit cleared are informational only and a 1918 receiver that receives a message with such an AVP that is not 1919 supported, or whose value is not supported, MAY simply ignore the 1920 AVP. 1922 The 'V' bit, known as the Vendor-Specific bit, indicates whether 1923 the optional Vendor-ID field is present in the AVP header. When 1924 set the AVP Code belongs to the specific vendor code address 1925 space. 1927 AVP Length 1929 The AVP Length field is three octets, and indicates the number of 1930 octets in this AVP including the AVP Code, AVP Length, AVP Flags, 1931 Vendor-ID field (if present) and the AVP data. If a message is 1932 received with an invalid attribute length, the message MUST be 1933 rejected. 1935 4.1.1. Optional Header Elements 1937 The AVP Header contains one optional field. This field is only 1938 present if the respective bit-flag is enabled. 1940 Vendor-ID 1942 The Vendor-ID field is present if the 'V' bit is set in the AVP 1943 Flags field. The optional four-octet Vendor-ID field contains the 1944 IANA assigned "SMI Network Management Private Enterprise Codes" 1945 [ENTERPRISE] value, encoded in network byte order. Any vendor or 1946 standardization organization that are also treated like vendors in 1947 the IANA managed "SMI Network Management Private Enterprise Codes" 1948 space wishing to implement a vendor-specific Diameter AVP MUST use 1949 their own Vendor-ID along with their privately managed AVP address 1950 space, guaranteeing that they will not collide with any other 1951 vendor's vendor-specific AVP(s), nor with future IETF AVPs. 1953 A vendor ID value of zero (0) corresponds to the IETF adopted AVP 1954 values, as managed by the IANA. Since the absence of the vendor 1955 ID field implies that the AVP in question is not vendor specific, 1956 implementations MUST NOT use the zero (0) vendor ID. 1958 4.2. Basic AVP Data Formats 1960 The Data field is zero or more octets and contains information 1961 specific to the Attribute. The format and length of the Data field 1962 is determined by the AVP Code and AVP Length fields. The format of 1963 the Data field MUST be one of the following base data types or a data 1964 type derived from the base data types. In the event that a new Basic 1965 AVP Data Format is needed, a new version of this RFC MUST be created. 1967 OctetString 1969 The data contains arbitrary data of variable length. Unless 1970 otherwise noted, the AVP Length field MUST be set to at least 8 1971 (12 if the 'V' bit is enabled). AVP Values of this type that are 1972 not a multiple of four-octets in length is followed by the 1973 necessary padding so that the next AVP (if any) will start on a 1974 32-bit boundary. 1976 Integer32 1978 32 bit signed value, in network byte order. The AVP Length field 1979 MUST be set to 12 (16 if the 'V' bit is enabled). 1981 Integer64 1983 64 bit signed value, in network byte order. The AVP Length field 1984 MUST be set to 16 (20 if the 'V' bit is enabled). 1986 Unsigned32 1988 32 bit unsigned value, in network byte order. The AVP Length 1989 field MUST be set to 12 (16 if the 'V' bit is enabled). 1991 Unsigned64 1993 64 bit unsigned value, in network byte order. The AVP Length 1994 field MUST be set to 16 (20 if the 'V' bit is enabled). 1996 Float32 1998 This represents floating point values of single precision as 1999 described by [FLOATPOINT]. The 32-bit value is transmitted in 2000 network byte order. The AVP Length field MUST be set to 12 (16 if 2001 the 'V' bit is enabled). 2003 Float64 2005 This represents floating point values of double precision as 2006 described by [FLOATPOINT]. The 64-bit value is transmitted in 2007 network byte order. The AVP Length field MUST be set to 16 (20 if 2008 the 'V' bit is enabled). 2010 Grouped 2012 The Data field is specified as a sequence of AVPs. Each of these 2013 AVPs follows - in the order in which they are specified - 2014 including their headers and padding. The AVP Length field is set 2015 to 8 (12 if the 'V' bit is enabled) plus the total length of all 2016 included AVPs, including their headers and padding. Thus the AVP 2017 length field of an AVP of type Grouped is always a multiple of 4. 2019 4.3. Derived AVP Data Formats 2021 In addition to using the Basic AVP Data Formats, applications may 2022 define data formats derived from the Basic AVP Data Formats. An 2023 application that defines new Derived AVP Data Formats MUST include 2024 them in a section entitled "Derived AVP Data Formats", using the same 2025 format as the definitions below. Each new definition MUST be either 2026 defined or listed with a reference to the RFC that defines the 2027 format. 2029 4.3.1. Common Derived AVP Data Formats 2031 The following are commonly used Derived AVP Data Formats. 2033 Address 2035 The Address format is derived from the OctetString AVP Base 2036 Format. It is a discriminated union, representing, for example a 2037 32-bit (IPv4) [RFC791] or 128-bit (IPv6) [RFC4291] address, most 2038 significant octet first. The first two octets of the Address AVP 2039 represents the AddressType, which contains an Address Family 2040 defined in [IANAADFAM]. The AddressType is used to discriminate 2041 the content and format of the remaining octets. 2043 Time 2045 The Time format is derived from the OctetString AVP Base Format. 2046 The string MUST contain four octets, in the same format as the 2047 first four bytes are in the NTP timestamp format. The NTP 2048 Timestamp format is defined in Chapter 3 of [RFC5905]. 2050 This represents the number of seconds since 0h on 1 January 1900 2051 with respect to the Coordinated Universal Time (UTC). 2053 On 6h 28m 16s UTC, 7 February 2036 the time value will overflow. 2054 SNTP [RFC5905] describes a procedure to extend the time to 2104. 2055 This procedure MUST be supported by all Diameter nodes. 2057 UTF8String 2059 The UTF8String format is derived from the OctetString AVP Base 2060 Format. This is a human readable string represented using the 2061 ISO/IEC IS 10646-1 character set, encoded as an OctetString using 2062 the UTF-8 transformation format [RFC3629]. 2064 Since additional code points are added by amendments to the 10646 2065 standard from time to time, implementations MUST be prepared to 2066 encounter any code point from 0x00000001 to 0x7fffffff. Byte 2067 sequences that do not correspond to the valid encoding of a code 2068 point into UTF-8 charset or are outside this range are prohibited. 2070 The use of control codes SHOULD be avoided. When it is necessary 2071 to represent a new line, the control code sequence CR LF SHOULD be 2072 used. 2074 The use of leading or trailing white space SHOULD be avoided. 2076 For code points not directly supported by user interface hardware 2077 or software, an alternative means of entry and display, such as 2078 hexadecimal, MAY be provided. 2080 For information encoded in 7-bit US-ASCII, the UTF-8 charset is 2081 identical to the US-ASCII charset. 2083 UTF-8 may require multiple bytes to represent a single character / 2084 code point; thus the length of an UTF8String in octets may be 2085 different from the number of characters encoded. 2087 Note that the AVP Length field of an UTF8String is measured in 2088 octets, not characters. 2090 DiameterIdentity 2092 The DiameterIdentity format is derived from the OctetString AVP 2093 Base Format. 2095 DiameterIdentity = FQDN/Realm 2097 DiameterIdentity value is used to uniquely identify either: 2099 * A Diameter node for purposes of duplicate connection and 2100 routing loop detection. 2102 * A Realm to determine whether messages can be satisfied locally, 2103 or whether they must be routed or redirected. 2105 When a DiameterIdentity is used to identify a Diameter node the 2106 contents of the string MUST be the FQDN of the Diameter node. If 2107 multiple Diameter nodes run on the same host, each Diameter node 2108 MUST be assigned a unique DiameterIdentity. If a Diameter node 2109 can be identified by several FQDNs, a single FQDN should be picked 2110 at startup, and used as the only DiameterIdentity for that node, 2111 whatever the connection it is sent on. Note that in this 2112 document, DiameterIdentity is in ASCII form in order to be 2113 compatible with existing DNS infrastructure. See Appendix D for 2114 interactions between the Diameter protocol and Internationalized 2115 Domain Name (IDNs). 2117 DiameterURI 2119 The DiameterURI MUST follow the Uniform Resource Identifiers 2120 (RFC3986) syntax [RFC3986] rules specified below: 2122 "aaa://" FQDN [ port ] [ transport ] [ protocol ] 2124 ; No transport security 2126 "aaas://" FQDN [ port ] [ transport ] [ protocol ] 2128 ; Transport security used 2130 FQDN = < Fully Qualified Domain Name > 2132 port = ":" 1*DIGIT 2134 ; One of the ports used to listen for 2135 ; incoming connections. 2136 ; If absent, the default Diameter port 2137 ; (3868) is assumed if no transport 2138 ; security is used and port when 2139 ; transport security (TLS/TCP and DTLS/SCTP) 2140 ; is used. 2142 transport = ";transport=" transport-protocol 2144 ; One of the transports used to listen 2145 ; for incoming connections. If absent, 2146 ; the default protocol is assumed to be TCP. 2147 ; UDP MUST NOT be used when the aaa-protocol 2148 ; field is set to diameter. 2150 transport-protocol = ( "tcp" / "sctp" / "udp" ) 2152 protocol = ";protocol=" aaa-protocol 2154 ; If absent, the default AAA protocol 2155 ; is Diameter. 2157 aaa-protocol = ( "diameter" / "radius" / "tacacs+" ) 2159 The following are examples of valid Diameter host identities: 2161 aaa://host.example.com;transport=tcp 2162 aaa://host.example.com:6666;transport=tcp 2163 aaa://host.example.com;protocol=diameter 2164 aaa://host.example.com:6666;protocol=diameter 2165 aaa://host.example.com:6666;transport=tcp;protocol=diameter 2166 aaa://host.example.com:1813;transport=udp;protocol=radius 2168 Enumerated 2170 Enumerated is derived from the Integer32 AVP Base Format. The 2171 definition contains a list of valid values and their 2172 interpretation and is described in the Diameter application 2173 introducing the AVP. 2175 IPFilterRule 2177 The IPFilterRule format is derived from the OctetString AVP Base 2178 Format and uses the ASCII charset. The rule syntax is a modified 2179 subset of ipfw(8) from FreeBSD. Packets may be filtered based on 2180 the following information that is associated with it: 2182 Direction (in or out) 2183 Source and destination IP address (possibly masked) 2184 Protocol 2185 Source and destination port (lists or ranges) 2186 TCP flags 2187 IP fragment flag 2188 IP options 2189 ICMP types 2191 Rules for the appropriate direction are evaluated in order, with 2192 the first matched rule terminating the evaluation. Each packet is 2193 evaluated once. If no rule matches, the packet is dropped if the 2194 last rule evaluated was a permit, and passed if the last rule was 2195 a deny. 2197 IPFilterRule filters MUST follow the format: 2199 action dir proto from src to dst [options] 2201 action permit - Allow packets that match the rule. 2202 deny - Drop packets that match the rule. 2204 dir "in" is from the terminal, "out" is to the 2205 terminal. 2207 proto An IP protocol specified by number. The "ip" 2208 keyword means any protocol will match. 2210 src and dst
[ports] 2212 The
may be specified as: 2213 ipno An IPv4 or IPv6 number in dotted- 2214 quad or canonical IPv6 form. Only 2215 this exact IP number will match the 2216 rule. 2217 ipno/bits An IP number as above with a mask 2218 width of the form 192.0.2.10/24. In 2219 this case, all IP numbers from 2220 192.0.2.0 to 192.0.2.255 will match. 2221 The bit width MUST be valid for the 2222 IP version and the IP number MUST 2223 NOT have bits set beyond the mask. 2224 For a match to occur, the same IP 2225 version must be present in the 2226 packet that was used in describing 2227 the IP address. To test for a 2228 particular IP version, the bits part 2229 can be set to zero. The keyword 2230 "any" is 0.0.0.0/0 or the IPv6 2231 equivalent. The keyword "assigned" 2232 is the address or set of addresses 2233 assigned to the terminal. For IPv4, 2234 a typical first rule is often "deny 2235 in ip! assigned" 2237 The sense of the match can be inverted by 2238 preceding an address with the not modifier (!), 2239 causing all other addresses to be matched 2240 instead. This does not affect the selection of 2241 port numbers. 2243 With the TCP, UDP and SCTP protocols, optional 2244 ports may be specified as: 2246 {port/port-port}[,ports[,...]] 2248 The '-' notation specifies a range of ports 2249 (including boundaries). 2251 Fragmented packets that have a non-zero offset 2252 (i.e., not the first fragment) will never match 2253 a rule that has one or more port 2254 specifications. See the frag option for 2255 details on matching fragmented packets. 2257 options: 2258 frag Match if the packet is a fragment and this is not 2259 the first fragment of the datagram. frag may not 2260 be used in conjunction with either tcpflags or 2261 TCP/UDP port specifications. 2263 ipoptions spec 2264 Match if the IP header contains the comma 2265 separated list of options specified in spec. The 2266 supported IP options are: 2268 ssrr (strict source route), lsrr (loose source 2269 route), rr (record packet route) and ts 2270 (timestamp). The absence of a particular option 2271 may be denoted with a '!'. 2273 tcpoptions spec 2274 Match if the TCP header contains the comma 2275 separated list of options specified in spec. The 2276 supported TCP options are: 2278 mss (maximum segment size), window (tcp window 2279 advertisement), sack (selective ack), ts (rfc1323 2280 timestamp) and cc (rfc1644 t/tcp connection 2281 count). The absence of a particular option may 2282 be denoted with a '!'. 2284 established 2285 TCP packets only. Match packets that have the RST 2286 or ACK bits set. 2288 setup TCP packets only. Match packets that have the SYN 2289 bit set but no ACK bit. 2291 tcpflags spec 2292 TCP packets only. Match if the TCP header 2293 contains the comma separated list of flags 2294 specified in spec. The supported TCP flags are: 2296 fin, syn, rst, psh, ack and urg. The absence of a 2297 particular flag may be denoted with a '!'. A rule 2298 that contains a tcpflags specification can never 2299 match a fragmented packet that has a non-zero 2300 offset. See the frag option for details on 2301 matching fragmented packets. 2303 icmptypes types 2304 ICMP packets only. Match if the ICMP type is in 2305 the list types. The list may be specified as any 2306 combination of ranges or individual types 2307 separated by commas. Both the numeric values and 2308 the symbolic values listed below can be used. The 2309 supported ICMP types are: 2311 echo reply (0), destination unreachable (3), 2312 source quench (4), redirect (5), echo request 2313 (8), router advertisement (9), router 2314 solicitation (10), time-to-live exceeded (11), IP 2315 header bad (12), timestamp request (13), 2316 timestamp reply (14), information request (15), 2317 information reply (16), address mask request (17) 2318 and address mask reply (18). 2320 There is one kind of packet that the access device MUST always 2321 discard, that is an IP fragment with a fragment offset of one. 2322 This is a valid packet, but it only has one use, to try to 2323 circumvent firewalls. 2325 An access device that is unable to interpret or apply a deny rule 2326 MUST terminate the session. An access device that is unable to 2327 interpret or apply a permit rule MAY apply a more restrictive 2328 rule. An access device MAY apply deny rules of its own before the 2329 supplied rules, for example to protect the access device owner's 2330 infrastructure. 2332 4.4. Grouped AVP Values 2334 The Diameter protocol allows AVP values of type 'Grouped'. This 2335 implies that the Data field is actually a sequence of AVPs. It is 2336 possible to include an AVP with a Grouped type within a Grouped type, 2337 that is, to nest them. AVPs within an AVP of type Grouped have the 2338 same padding requirements as non-Grouped AVPs, as defined in 2339 Section 4.4. 2341 The AVP Code numbering space of all AVPs included in a Grouped AVP is 2342 the same as for non-grouped AVPs. Receivers of a Grouped AVP that 2343 does not have the 'M' (mandatory) bit set and one or more of the 2344 encapsulated AVPs within the group has the 'M' (mandatory) bit set 2345 MAY simply be ignored if the Grouped AVP itself is unrecognized. The 2346 rule applies even if the encapsulated AVP with its 'M' (mandatory) 2347 bit set is further encapsulated within other sub-groups; i.e. other 2348 Grouped AVPs embedded within the Grouped AVP. 2350 Every Grouped AVP defined MUST include a corresponding grammar, using 2351 CCF [RFC5234] (with modifications), as defined below. 2353 grouped-avp-def = "<" name ">" "::=" avp 2355 name-fmt = ALPHA *(ALPHA / DIGIT / "-") 2357 name = name-fmt 2358 ; The name has to be the name of an AVP, 2359 ; defined in the base or extended Diameter 2360 ; specifications. 2362 avp = header *fixed *required *optional 2364 header = "<" "AVP-Header:" avpcode [vendor] ">" 2366 avpcode = 1*DIGIT 2367 ; The AVP Code assigned to the Grouped AVP 2369 vendor = 1*DIGIT 2370 ; The Vendor-ID assigned to the Grouped AVP. 2371 ; If absent, the default value of zero is 2372 ; used. 2374 4.4.1. Example AVP with a Grouped Data type 2376 The Example-AVP (AVP Code 999999) is of type Grouped and is used to 2377 clarify how Grouped AVP values work. The Grouped Data field has the 2378 following CCF grammar: 2380 Example-AVP ::= < AVP Header: 999999 > 2381 { Origin-Host } 2382 1*{ Session-Id } 2383 *[ AVP ] 2385 An Example-AVP with Grouped Data follows. 2387 The Origin-Host AVP (Section 6.3) is required. In this case: 2389 Origin-Host = "example.com". 2391 One or more Session-Ids must follow. Here there are two: 2393 Session-Id = 2394 "grump.example.com:33041;23432;893;0AF3B81" 2396 Session-Id = 2397 "grump.example.com:33054;23561;2358;0AF3B82" 2399 optional AVPs included are 2401 Recovery-Policy = 2402 2163bc1d0ad82371f6bc09484133c3f09ad74a0dd5346d54195a7cf0b35 2403 2cabc881839a4fdcfbc1769e2677a4c1fb499284c5f70b48f58503a45c5 2404 c2d6943f82d5930f2b7c1da640f476f0e9c9572a50db8ea6e51e1c2c7bd 2405 f8bb43dc995144b8dbe297ac739493946803e1cee3e15d9b765008a1b2a 2406 cf4ac777c80041d72c01e691cf751dbf86e85f509f3988e5875dc905119 2407 26841f00f0e29a6d1ddc1a842289d440268681e052b30fb638045f7779c 2408 1d873c784f054f688f5001559ecff64865ef975f3e60d2fd7966b8c7f92 2410 Futuristic-Acct-Record = 2411 fe19da5802acd98b07a5b86cb4d5d03f0314ab9ef1ad0b67111ff3b90a0 2412 57fe29620bf3585fd2dd9fcc38ce62f6cc208c6163c008f4258d1bc88b8 2413 17694a74ccad3ec69269461b14b2e7a4c111fb239e33714da207983f58c 2414 41d018d56fe938f3cbf089aac12a912a2f0d1923a9390e5f789cb2e5067 2415 d3427475e49968f841 2417 The data for the optional AVPs is represented in hex since the format 2418 of these AVPs is neither known at the time of definition of the 2419 Example-AVP group, nor (likely) at the time when the example instance 2420 of this AVP is interpreted - except by Diameter implementations which 2421 support the same set of AVPs. The encoding example illustrates how 2422 padding is used and how length fields are calculated. Also note that 2423 AVPs may be present in the Grouped AVP value which the receiver 2424 cannot interpret (here, the Recover-Policy and Futuristic-Acct-Record 2425 AVPs). The length of the Example-AVP is the sum of all the length of 2426 the member AVPs including their padding plus the Example-AVP header 2427 size. 2429 This AVP would be encoded as follows: 2431 0 1 2 3 4 5 6 7 2432 +-------+-------+-------+-------+-------+-------+-------+-------+ 2433 0 | Example AVP Header (AVP Code = 999999), Length = 496 | 2434 +-------+-------+-------+-------+-------+-------+-------+-------+ 2435 8 | Origin-Host AVP Header (AVP Code = 264), Length = 19 | 2436 +-------+-------+-------+-------+-------+-------+-------+-------+ 2437 16 | 'e' | 'x' | 'a' | 'm' | 'p' | 'l' | 'e' | '.' | 2438 +-------+-------+-------+-------+-------+-------+-------+-------+ 2439 24 | 'c' | 'o' | 'm' |Padding| Session-Id AVP Header | 2440 +-------+-------+-------+-------+-------+-------+-------+-------+ 2441 32 | (AVP Code = 263), Length = 49 | 'g' | 'r' | 'u' | 'm' | 2442 +-------+-------+-------+-------+-------+-------+-------+-------+ 2443 . . . 2444 +-------+-------+-------+-------+-------+-------+-------+-------+ 2445 72 | 'F' | '3' | 'B' | '8' | '1' |Padding|Padding|Padding| 2446 +-------+-------+-------+-------+-------+-------+-------+-------+ 2447 80 | Session-Id AVP Header (AVP Code = 263), Length = 50 | 2448 +-------+-------+-------+-------+-------+-------+-------+-------+ 2449 88 | 'g' | 'r' | 'u' | 'm' | 'p' | '.' | 'e' | 'x' | 2450 +-------+-------+-------+-------+-------+-------+-------+-------+ 2451 . . . 2452 +-------+-------+-------+-------+-------+-------+-------+-------+ 2453 120| '5' | '8' | ';' | '0' | 'A' | 'F' | '3' | 'B' | 2454 +-------+-------+-------+-------+-------+-------+-------+-------+ 2455 128| '8' | '2' |Padding|Padding| Recovery-Policy Header (AVP | 2456 +-------+-------+-------+-------+-------+-------+-------+-------+ 2457 136| Code = 8341), Length = 223 | 0x21 | 0x63 | 0xbc | 0x1d | 2458 +-------+-------+-------+-------+-------+-------+-------+-------+ 2459 144| 0x0a | 0xd8 | 0x23 | 0x71 | 0xf6 | 0xbc | 0x09 | 0x48 | 2460 +-------+-------+-------+-------+-------+-------+-------+-------+ 2461 . . . 2462 +-------+-------+-------+-------+-------+-------+-------+-------+ 2463 352| 0x8c | 0x7f | 0x92 |Padding| Futuristic-Acct-Record Header | 2464 +-------+-------+-------+-------+-------+-------+-------+-------+ 2465 328|(AVP Code = 15930),Length = 137| 0xfe | 0x19 | 0xda | 0x58 | 2466 +-------+-------+-------+-------+-------+-------+-------+-------+ 2467 336| 0x02 | 0xac | 0xd9 | 0x8b | 0x07 | 0xa5 | 0xb8 | 0xc6 | 2468 +-------+-------+-------+-------+-------+-------+-------+-------+ 2469 . . . 2470 +-------+-------+-------+-------+-------+-------+-------+-------+ 2471 488| 0xe4 | 0x99 | 0x68 | 0xf8 | 0x41 |Padding|Padding|Padding| 2472 +-------+-------+-------+-------+-------+-------+-------+-------+ 2474 4.5. Diameter Base Protocol AVPs 2476 The following table describes the Diameter AVPs defined in the base 2477 protocol, their AVP Code values, types, possible flag values. 2479 Due to space constraints, the short form DiamIdent is used to 2480 represent DiameterIdentity. 2482 +----------+ 2483 | AVP Flag | 2484 | rules | 2485 |----+-----| 2486 AVP Section | |MUST | 2487 Attribute Name Code Defined Data Type |MUST| NOT | 2488 -----------------------------------------|----+-----| 2489 Acct- 85 9.8.2 Unsigned32 | M | V | 2490 Interim-Interval | | | 2491 Accounting- 483 9.8.7 Enumerated | M | V | 2492 Realtime-Required | | | 2493 Acct- 50 9.8.5 UTF8String | M | V | 2494 Multi-Session-Id | | | 2495 Accounting- 485 9.8.3 Unsigned32 | M | V | 2496 Record-Number | | | 2497 Accounting- 480 9.8.1 Enumerated | M | V | 2498 Record-Type | | | 2499 Accounting- 44 9.8.4 OctetString| M | V | 2500 Session-Id | | | 2501 Accounting- 287 9.8.6 Unsigned64 | M | V | 2502 Sub-Session-Id | | | 2503 Acct- 259 6.9 Unsigned32 | M | V | 2504 Application-Id | | | 2505 Auth- 258 6.8 Unsigned32 | M | V | 2506 Application-Id | | | 2507 Auth-Request- 274 8.7 Enumerated | M | V | 2508 Type | | | 2509 Authorization- 291 8.9 Unsigned32 | M | V | 2510 Lifetime | | | 2511 Auth-Grace- 276 8.10 Unsigned32 | M | V | 2512 Period | | | 2513 Auth-Session- 277 8.11 Enumerated | M | V | 2514 State | | | 2515 Re-Auth-Request- 285 8.12 Enumerated | M | V | 2516 Type | | | 2517 Class 25 8.20 OctetString| M | V | 2518 Destination-Host 293 6.5 DiamIdent | M | V | 2519 Destination- 283 6.6 DiamIdent | M | V | 2520 Realm | | | 2521 Disconnect-Cause 273 5.4.3 Enumerated | M | V | 2522 Error-Message 281 7.3 UTF8String | | V,M | 2523 Error-Reporting- 294 7.4 DiamIdent | | V,M | 2524 Host | | | 2525 Event-Timestamp 55 8.21 Time | M | V | 2526 Experimental- 297 7.6 Grouped | M | V | 2527 Result | | | 2528 -----------------------------------------|----+-----| 2529 +----------+ 2530 | AVP Flag | 2531 | rules | 2532 |----+-----| 2533 AVP Section | |MUST | 2534 Attribute Name Code Defined Data Type |MUST| NOT | 2535 -----------------------------------------|----+-----| 2536 Experimental- 298 7.7 Unsigned32 | M | V | 2537 Result-Code | | | 2538 Failed-AVP 279 7.5 Grouped | M | V | 2539 Firmware- 267 5.3.4 Unsigned32 | | V,M | 2540 Revision | | | 2541 Host-IP-Address 257 5.3.5 Address | M | V | 2542 Inband-Security | M | V | 2543 -Id 299 6.10 Unsigned32 | | | 2544 Multi-Round- 272 8.19 Unsigned32 | M | V | 2545 Time-Out | | | 2546 Origin-Host 264 6.3 DiamIdent | M | V | 2547 Origin-Realm 296 6.4 DiamIdent | M | V | 2548 Origin-State-Id 278 8.16 Unsigned32 | M | V | 2549 Product-Name 269 5.3.7 UTF8String | | V,M | 2550 Proxy-Host 280 6.7.3 DiamIdent | M | V | 2551 Proxy-Info 284 6.7.2 Grouped | M | V | 2552 Proxy-State 33 6.7.4 OctetString| M | V | 2553 Redirect-Host 292 6.12 DiamURI | M | V | 2554 Redirect-Host- 261 6.13 Enumerated | M | V | 2555 Usage | | | 2556 Redirect-Max- 262 6.14 Unsigned32 | M | V | 2557 Cache-Time | | | 2558 Result-Code 268 7.1 Unsigned32 | M | V | 2559 Route-Record 282 6.7.1 DiamIdent | M | V | 2560 Session-Id 263 8.8 UTF8String | M | V | 2561 Session-Timeout 27 8.13 Unsigned32 | M | V | 2562 Session-Binding 270 8.17 Unsigned32 | M | V | 2563 Session-Server- 271 8.18 Enumerated | M | V | 2564 Failover | | | 2565 Supported- 265 5.3.6 Unsigned32 | M | V | 2566 Vendor-Id | | | 2567 Termination- 295 8.15 Enumerated | M | V | 2568 Cause | | | 2569 User-Name 1 8.14 UTF8String | M | V | 2570 Vendor-Id 266 5.3.3 Unsigned32 | M | V | 2571 Vendor-Specific- 260 6.11 Grouped | M | V | 2572 Application-Id | | | 2573 -----------------------------------------|----+-----| 2575 5. Diameter Peers 2577 This section describes how Diameter nodes establish connections and 2578 communicate with peers. 2580 5.1. Peer Connections 2582 Connections between diameter peers are established using their valid 2583 DiameterIdentity. A Diameter node initiating a connection to a peer 2584 MUST know the peers DiameterIdentity. Methods for discovering a 2585 Diameter peer can be found in Section 5.2. 2587 Although a Diameter node may have many possible peers that it is able 2588 to communicate with, it may not be economical to have an established 2589 connection to all of them. At a minimum, a Diameter node SHOULD have 2590 an established connection with two peers per realm, known as the 2591 primary and secondary peers. Of course, a node MAY have additional 2592 connections, if it is deemed necessary. Typically, all messages for 2593 a realm are sent to the primary peer, but in the event that failover 2594 procedures are invoked, any pending requests are sent to the 2595 secondary peer. However, implementations are free to load balance 2596 requests between a set of peers. 2598 Note that a given peer MAY act as a primary for a given realm, while 2599 acting as a secondary for another realm. 2601 When a peer is deemed suspect, which could occur for various reasons, 2602 including not receiving a DWA within an allotted timeframe, no new 2603 requests should be forwarded to the peer, but failover procedures are 2604 invoked. When an active peer is moved to this mode, additional 2605 connections SHOULD be established to ensure that the necessary number 2606 of active connections exists. 2608 There are two ways that a peer is removed from the suspect peer list: 2610 1. The peer is no longer reachable, causing the transport connection 2611 to be shutdown. The peer is moved to the closed state. 2613 2. Three watchdog messages are exchanged with accepted round trip 2614 times, and the connection to the peer is considered stabilized. 2616 In the event the peer being removed is either the primary or 2617 secondary, an alternate peer SHOULD replace the deleted peer, and 2618 assume the role of either primary or secondary. 2620 5.2. Diameter Peer Discovery 2622 Allowing for dynamic Diameter agent discovery makes possible simpler 2623 and more robust deployment of Diameter services. In order to promote 2624 interoperable implementations of Diameter peer discovery, the 2625 following mechanisms (manual configuration and DNS) are described. 2626 These are based on existing IETF standards. Both mechanisms MUST be 2627 supported by all Diameter implementations; either MAY be used. 2629 There are two cases where Diameter peer discovery may be performed. 2630 The first is when a Diameter client needs to discover a first-hop 2631 Diameter agent. The second case is when a Diameter agent needs to 2632 discover another agent - for further handling of a Diameter 2633 operation. In both cases, the following 'search order' is 2634 recommended: 2636 1. The Diameter implementation consults its list of static 2637 (manually) configured Diameter agent locations. These will be 2638 used if they exist and respond. 2640 2. The Diameter implementation performs a NAPTR query for a server 2641 in a particular realm. The Diameter implementation has to know 2642 in advance which realm to look for a Diameter agent. This could 2643 be deduced, for example, from the 'realm' in a NAI that a 2644 Diameter implementation needed to perform a Diameter operation 2645 on. 2647 The NAPTR usage in Diameter follows the S-NAPTR DDDS application 2648 [RFC3958] in which the SERVICE field includes tags for the 2649 desired application and supported application protocol. The 2650 application service tag for a Diameter application is 'aaa' and 2651 the supported application protocol tags are 'diameter.tcp', 2652 'diameter.sctp', 'diameter.dtls' or 'diameter.tls.tcp' [RFC6408]. 2654 The client can follow the resolution process defined by the 2655 S-NAPTR DDDS [RFC3958] application to find a matching SRV, A or 2656 AAAA record of a suitable peer. The domain suffixes in the NAPTR 2657 replacement field SHOULD match the domain of the original query. 2658 An example can be found in Appendix B. 2660 3. If no NAPTR records are found, the requester directly queries for 2661 one of the following SRV records: for Diameter over TCP, use 2662 "_diameter._tcp.realm"; for Diameter over TLS, use 2663 "_diameters._tcp.realm"; for Diameter over SCTP, use 2664 "_diameter._sctp.realm"; for Diameter over DTLS, use 2665 "_diameters._sctp.realm". If SRV records are found then the 2666 requester can perform address record query (A RR's and/or AAAA 2667 RR's) for the target hostname specified in the SRV records 2668 following the rules given in Gulbrandsen, et al. [RFC2782]. If 2669 no SRV records are found, the requester gives up. 2671 If the server is using a site certificate, the domain name in the 2672 NAPTR query and the domain name in the replacement field MUST both be 2673 valid based on the site certificate handed out by the server in the 2674 TLS/TCP and DTLS/SCTP or IKE exchange. Similarly, the domain name in 2675 the SRV query and the domain name in the target in the SRV record 2676 MUST both be valid based on the same site certificate. Otherwise, an 2677 attacker could modify the DNS records to contain replacement values 2678 in a different domain, and the client could not validate that this 2679 was the desired behavior, or the result of an attack. 2681 Also, the Diameter Peer MUST check to make sure that the discovered 2682 peers are authorized to act in its role. Authentication via IKE or 2683 TLS/TCP and DTLS/SCTP, or validation of DNS RRs via DNSSEC is not 2684 sufficient to conclude this. For example, a web server may have 2685 obtained a valid TLS/TCP and DTLS/SCTP certificate, and secured RRs 2686 may be included in the DNS, but this does not imply that it is 2687 authorized to act as a Diameter Server. 2689 Authorization can be achieved for example, by configuration of a 2690 Diameter Server Certification Authority (CA). The Server CA issues a 2691 certificate to the Diameter Server, which includes an Object 2692 Identifier (OID) to indicate the subject is a Diameter Server in the 2693 Extended Key Usage extension [RFC5280]. This certificate is then 2694 used during TLS/TCP, DTLS/SCTP, or IKE security negotiation. Note, 2695 however, that at the time of writing no Diameter Server Certification 2696 Authorities exist. 2698 A dynamically discovered peer causes an entry in the Peer Table (see 2699 Section 2.6) to be created. Note that entries created via DNS MUST 2700 expire (or be refreshed) within the DNS TTL. If a peer is discovered 2701 outside of the local realm, a routing table entry (see Section 2.7) 2702 for the peer's realm is created. The routing table entry's 2703 expiration MUST match the peer's expiration value. 2705 5.3. Capabilities Exchange 2707 When two Diameter peers establish a transport connection, they MUST 2708 exchange the Capabilities Exchange messages, as specified in the peer 2709 state machine (see Section 5.6). This message allows the discovery 2710 of a peer's identity and its capabilities (protocol version number, 2711 the identifiers of supported Diameter applications, security 2712 mechanisms, etc.) 2713 The receiver only issues commands to its peers that have advertised 2714 support for the Diameter application that defines the command. A 2715 Diameter node MUST cache the supported Application Ids in order to 2716 ensure that unrecognized commands and/or AVPs are not unnecessarily 2717 sent to a peer. 2719 A receiver of a Capabilities-Exchange-Req (CER) message that does not 2720 have any applications in common with the sender MUST return a 2721 Capabilities-Exchange-Answer (CEA) with the Result-Code AVP set to 2722 DIAMETER_NO_COMMON_APPLICATION, and SHOULD disconnect the transport 2723 layer connection. Note that receiving a CER or CEA from a peer 2724 advertising itself as a Relay (see Section 2.4) MUST be interpreted 2725 as having common applications with the peer. 2727 The receiver of the Capabilities-Exchange-Request (CER) MUST 2728 determine common applications by computing the intersection of its 2729 own set of supported Application Id against all of the application 2730 identifier AVPs (Auth-Application-Id, Acct-Application-Id and Vendor- 2731 Specific-Application-Id) present in the CER. The value of the 2732 Vendor-Id AVP in the Vendor-Specific-Application-Id MUST NOT be used 2733 during computation. The sender of the Capabilities-Exchange-Answer 2734 (CEA) SHOULD include all of its supported applications as a hint to 2735 the receiver regarding all of its application capabilities. 2737 Diameter implementations SHOULD first attempt to establish a TLS/TCP 2738 and DTLS/SCTP connection prior to the CER/CEA exchange. This 2739 protects the capabilities information of both peers. To support 2740 older Diameter implementations that do not fully conform to this 2741 document, the transport security MAY still be negotiated via Inband- 2742 Security AVP. In this case, the receiver of a Capabilities-Exchange- 2743 Req (CER) message that does not have any security mechanisms in 2744 common with the sender MUST return a Capabilities-Exchange-Answer 2745 (CEA) with the Result-Code AVP set to DIAMETER_NO_COMMON_SECURITY, 2746 and SHOULD disconnect the transport layer connection. 2748 CERs received from unknown peers MAY be silently discarded, or a CEA 2749 MAY be issued with the Result-Code AVP set to DIAMETER_UNKNOWN_PEER. 2750 In both cases, the transport connection is closed. If the local 2751 policy permits receiving CERs from unknown hosts, a successful CEA 2752 MAY be returned. If a CER from an unknown peer is answered with a 2753 successful CEA, the lifetime of the peer entry is equal to the 2754 lifetime of the transport connection. In case of a transport 2755 failure, all the pending transactions destined to the unknown peer 2756 can be discarded. 2758 The CER and CEA messages MUST NOT be proxied, redirected or relayed. 2760 Since the CER/CEA messages cannot be proxied, it is still possible 2761 that an upstream agent receives a message for which it has no 2762 available peers to handle the application that corresponds to the 2763 Command-Code. In such instances, the 'E' bit is set in the answer 2764 message (Section 7) with the Result-Code AVP set to 2765 DIAMETER_UNABLE_TO_DELIVER to inform the downstream to take action 2766 (e.g., re-routing request to an alternate peer). 2768 With the exception of the Capabilities-Exchange-Request message, a 2769 message of type Request that includes the Auth-Application-Id or 2770 Acct-Application-Id AVPs, or a message with an application-specific 2771 command code, MAY only be forwarded to a host that has explicitly 2772 advertised support for the application (or has advertised the Relay 2773 Application Id). 2775 5.3.1. Capabilities-Exchange-Request 2777 The Capabilities-Exchange-Request (CER), indicated by the Command- 2778 Code set to 257 and the Command Flags' 'R' bit set, is sent to 2779 exchange local capabilities. Upon detection of a transport failure, 2780 this message MUST NOT be sent to an alternate peer. 2782 When Diameter is run over SCTP [RFC4960] or DTLS/SCTP [RFC6083], 2783 which allow for connections to span multiple interfaces and multiple 2784 IP addresses, the Capabilities-Exchange-Request message MUST contain 2785 one Host-IP-Address AVP for each potential IP address that MAY be 2786 locally used when transmitting Diameter messages. 2788 Message Format 2790 ::= < Diameter Header: 257, REQ > 2791 { Origin-Host } 2792 { Origin-Realm } 2793 1* { Host-IP-Address } 2794 { Vendor-Id } 2795 { Product-Name } 2796 [ Origin-State-Id ] 2797 * [ Supported-Vendor-Id ] 2798 * [ Auth-Application-Id ] 2799 * [ Inband-Security-Id ] 2800 * [ Acct-Application-Id ] 2801 * [ Vendor-Specific-Application-Id ] 2802 [ Firmware-Revision ] 2803 * [ AVP ] 2805 5.3.2. Capabilities-Exchange-Answer 2807 The Capabilities-Exchange-Answer (CEA), indicated by the Command-Code 2808 set to 257 and the Command Flags' 'R' bit cleared, is sent in 2809 response to a CER message. 2811 When Diameter is run over SCTP [RFC4960] or DTLS/SCTP [RFC6083], 2812 which allow connections to span multiple interfaces, hence, multiple 2813 IP addresses, the Capabilities-Exchange-Answer message MUST contain 2814 one Host-IP-Address AVP for each potential IP address that MAY be 2815 locally used when transmitting Diameter messages. 2817 Message Format 2819 ::= < Diameter Header: 257 > 2820 { Result-Code } 2821 { Origin-Host } 2822 { Origin-Realm } 2823 1* { Host-IP-Address } 2824 { Vendor-Id } 2825 { Product-Name } 2826 [ Origin-State-Id ] 2827 [ Error-Message ] 2828 [ Failed-AVP ] 2829 * [ Supported-Vendor-Id ] 2830 * [ Auth-Application-Id ] 2831 * [ Inband-Security-Id ] 2832 * [ Acct-Application-Id ] 2833 * [ Vendor-Specific-Application-Id ] 2834 [ Firmware-Revision ] 2835 * [ AVP ] 2837 5.3.3. Vendor-Id AVP 2839 The Vendor-Id AVP (AVP Code 266) is of type Unsigned32 and contains 2840 the IANA "SMI Network Management Private Enterprise Codes" 2841 [ENTERPRISE] value assigned to the Diameter Software vendor. It is 2842 envisioned that the combination of the Vendor-Id, Product-Name 2843 (Section 5.3.7) and the Firmware-Revision (Section 5.3.4) AVPs may 2844 provide useful debugging information. 2846 A Vendor-Id value of zero in the CER or CEA messages is reserved and 2847 indicates that this field is ignored. 2849 5.3.4. Firmware-Revision AVP 2851 The Firmware-Revision AVP (AVP Code 267) is of type Unsigned32 and is 2852 used to inform a Diameter peer of the firmware revision of the 2853 issuing device. 2855 For devices that do not have a firmware revision (general purpose 2856 computers running Diameter software modules, for instance), the 2857 revision of the Diameter software module may be reported instead. 2859 5.3.5. Host-IP-Address AVP 2861 The Host-IP-Address AVP (AVP Code 257) is of type Address and is used 2862 to inform a Diameter peer of the sender's IP address. All source 2863 addresses that a Diameter node expects to use with SCTP [RFC4960] or 2864 DTLS/SCTP [RFC6083] MUST be advertised in the CER and CEA messages by 2865 including a Host-IP-Address AVP for each address. 2867 5.3.6. Supported-Vendor-Id AVP 2869 The Supported-Vendor-Id AVP (AVP Code 265) is of type Unsigned32 and 2870 contains the IANA "SMI Network Management Private Enterprise Codes" 2871 [ENTERPRISE] value assigned to a vendor other than the device vendor 2872 but including the application vendor. This is used in the CER and 2873 CEA messages in order to inform the peer that the sender supports (a 2874 subset of) the vendor-specific AVPs defined by the vendor identified 2875 in this AVP. The value of this AVP MUST NOT be set to zero. 2876 Multiple instances of this AVP containing the same value SHOULD NOT 2877 be sent. 2879 5.3.7. Product-Name AVP 2881 The Product-Name AVP (AVP Code 269) is of type UTF8String, and 2882 contains the vendor assigned name for the product. The Product-Name 2883 AVP SHOULD remain constant across firmware revisions for the same 2884 product. 2886 5.4. Disconnecting Peer connections 2888 When a Diameter node disconnects one of its transport connections, 2889 its peer cannot know the reason for the disconnect, and will most 2890 likely assume that a connectivity problem occurred, or that the peer 2891 has rebooted. In these cases, the peer may periodically attempt to 2892 reconnect, as stated in Section 2.1. In the event that the 2893 disconnect was a result of either a shortage of internal resources, 2894 or simply that the node in question has no intentions of forwarding 2895 any Diameter messages to the peer in the foreseeable future, a 2896 periodic connection request would not be welcomed. The 2897 Disconnection-Reason AVP contains the reason the Diameter node issued 2898 the Disconnect-Peer-Request message. 2900 The Disconnect-Peer-Request message is used by a Diameter node to 2901 inform its peer of its intent to disconnect the transport layer, and 2902 that the peer shouldn't reconnect unless it has a valid reason to do 2903 so (e.g., message to be forwarded). Upon receipt of the message, the 2904 Disconnect-Peer-Answer is returned, which SHOULD contain an error if 2905 messages have recently been forwarded, and are likely in flight, 2906 which would otherwise cause a race condition. 2908 The receiver of the Disconnect-Peer-Answer initiates the transport 2909 disconnect. The sender of the Disconnect-Peer-Answer should be able 2910 to detect the transport closure and cleanup the connection. 2912 5.4.1. Disconnect-Peer-Request 2914 The Disconnect-Peer-Request (DPR), indicated by the Command-Code set 2915 to 282 and the Command Flags' 'R' bit set, is sent to a peer to 2916 inform its intentions to shutdown the transport connection. Upon 2917 detection of a transport failure, this message MUST NOT be sent to an 2918 alternate peer. 2920 Message Format 2922 ::= < Diameter Header: 282, REQ > 2923 { Origin-Host } 2924 { Origin-Realm } 2925 { Disconnect-Cause } 2926 * [ AVP ] 2928 5.4.2. Disconnect-Peer-Answer 2930 The Disconnect-Peer-Answer (DPA), indicated by the Command-Code set 2931 to 282 and the Command Flags' 'R' bit cleared, is sent as a response 2932 to the Disconnect-Peer-Request message. Upon receipt of this 2933 message, the transport connection is shutdown. 2935 Message Format 2937 ::= < Diameter Header: 282 > 2938 { Result-Code } 2939 { Origin-Host } 2940 { Origin-Realm } 2941 [ Error-Message ] 2942 [ Failed-AVP ] 2943 * [ AVP ] 2945 5.4.3. Disconnect-Cause AVP 2947 The Disconnect-Cause AVP (AVP Code 273) is of type Enumerated. A 2948 Diameter node MUST include this AVP in the Disconnect-Peer-Request 2949 message to inform the peer of the reason for its intention to 2950 shutdown the transport connection. The following values are 2951 supported: 2953 REBOOTING 0 2954 A scheduled reboot is imminent. Receiver of DPR with above 2955 result code MAY attempt reconnection. 2957 BUSY 1 2958 The peer's internal resources are constrained, and it has 2959 determined that the transport connection needs to be closed. 2960 Receiver of DPR with above result code SHOULD NOT attempt 2961 reconnection. 2963 DO_NOT_WANT_TO_TALK_TO_YOU 2 2964 The peer has determined that it does not see a need for the 2965 transport connection to exist, since it does not expect any 2966 messages to be exchanged in the near future. Receiver of DPR 2967 with above result code SHOULD NOT attempt reconnection. 2969 5.5. Transport Failure Detection 2971 Given the nature of the Diameter protocol, it is recommended that 2972 transport failures be detected as soon as possible. Detecting such 2973 failures will minimize the occurrence of messages sent to unavailable 2974 agents, resulting in unnecessary delays, and will provide better 2975 failover performance. The Device-Watchdog-Request and Device- 2976 Watchdog-Answer messages, defined in this section, are used to pro- 2977 actively detect transport failures. 2979 5.5.1. Device-Watchdog-Request 2981 The Device-Watchdog-Request (DWR), indicated by the Command-Code set 2982 to 280 and the Command Flags' 'R' bit set, is sent to a peer when no 2983 traffic has been exchanged between two peers (see Section 5.5.3). 2984 Upon detection of a transport failure, this message MUST NOT be sent 2985 to an alternate peer. 2987 Message Format 2989 ::= < Diameter Header: 280, REQ > 2990 { Origin-Host } 2991 { Origin-Realm } 2992 [ Origin-State-Id ] 2994 * [ AVP ] 2996 5.5.2. Device-Watchdog-Answer 2998 The Device-Watchdog-Answer (DWA), indicated by the Command-Code set 2999 to 280 and the Command Flags' 'R' bit cleared, is sent as a response 3000 to the Device-Watchdog-Request message. 3002 Message Format 3004 ::= < Diameter Header: 280 > 3005 { Result-Code } 3006 { Origin-Host } 3007 { Origin-Realm } 3008 [ Error-Message ] 3009 [ Failed-AVP ] 3010 [ Origin-State-Id ] 3011 * [ AVP ] 3013 5.5.3. Transport Failure Algorithm 3015 The transport failure algorithm is defined in [RFC3539]. All 3016 Diameter implementations MUST support the algorithm defined in the 3017 specification in order to be compliant to the Diameter base protocol. 3019 5.5.4. Failover and Failback Procedures 3021 In the event that a transport failure is detected with a peer, it is 3022 necessary for all pending request messages to be forwarded to an 3023 alternate agent, if possible. This is commonly referred to as 3024 failover. 3026 In order for a Diameter node to perform failover procedures, it is 3027 necessary for the node to maintain a pending message queue for a 3028 given peer. When an answer message is received, the corresponding 3029 request is removed from the queue. The Hop-by-Hop Identifier field 3030 is used to match the answer with the queued request. 3032 When a transport failure is detected, if possible all messages in the 3033 queue are sent to an alternate agent with the T flag set. On booting 3034 a Diameter client or agent, the T flag is also set on any records 3035 still remaining to be transmitted in non-volatile storage. An 3036 example of a case where it is not possible to forward the message to 3037 an alternate server is when the message has a fixed destination, and 3038 the unavailable peer is the message's final destination (see 3039 Destination-Host AVP). Such an error requires that the agent return 3040 an answer message with the 'E' bit set and the Result-Code AVP set to 3041 DIAMETER_UNABLE_TO_DELIVER. 3043 It is important to note that multiple identical requests or answers 3044 MAY be received as a result of a failover. The End-to-End Identifier 3045 field in the Diameter header along with the Origin-Host AVP MUST be 3046 used to identify duplicate messages. 3048 As described in Section 2.1, a connection request should be 3049 periodically attempted with the failed peer in order to re-establish 3050 the transport connection. Once a connection has been successfully 3051 established, messages can once again be forwarded to the peer. This 3052 is commonly referred to as failback. 3054 5.6. Peer State Machine 3056 This section contains a finite state machine that MUST be observed by 3057 all Diameter implementations. Each Diameter node MUST follow the 3058 state machine described below when communicating with each peer. 3059 Multiple actions are separated by commas, and may continue on 3060 succeeding lines, as space requires. Similarly, state and next state 3061 may also span multiple lines, as space requires. 3063 This state machine is closely coupled with the state machine 3064 described in [RFC3539], which is used to open, close, failover, 3065 probe, and reopen transport connections. Note in particular that 3066 [RFC3539] requires the use of watchdog messages to probe connections. 3067 For Diameter, DWR and DWA messages are to be used. 3069 I- is used to represent the initiator (connecting) connection, while 3070 the R- is used to represent the responder (listening) connection. 3071 The lack of a prefix indicates that the event or action is the same 3072 regardless of the connection on which the event occurred. 3074 The stable states that a state machine may be in are Closed, I-Open 3075 and R-Open; all other states are intermediate. Note that I-Open and 3076 R-Open are equivalent except for whether the initiator or responder 3077 transport connection is used for communication. 3079 A CER message is always sent on the initiating connection immediately 3080 after the connection request is successfully completed. In the case 3081 of an election, one of the two connections will shut down. The 3082 responder connection will survive if the Origin-Host of the local 3083 Diameter entity is higher than that of the peer; the initiator 3084 connection will survive if the peer's Origin-Host is higher. All 3085 subsequent messages are sent on the surviving connection. Note that 3086 the results of an election on one peer are guaranteed to be the 3087 inverse of the results on the other. 3089 For TLS/TCP and DTLS/SCTP usage, TLS/TCP and DTLS/SCTP handshake 3090 SHOULD begin when both ends are in the closed state prior to any 3091 Diameter message exchanges. The TLS/TCP and DTLS/SCTP connection 3092 SHOULD be established before sending any CER or CEA message to secure 3093 and protect the capabilities information of both peers. The TLS/TCP 3094 and DTLS/SCTP connection SHOULD be disconnected when the state 3095 machine moves to the closed state. When connecting to responders 3096 that do not conform to this document (i.e. older Diameter 3097 implementations that are not prepared to received TLS/TCP and DTLS/ 3098 SCTP connections in the closed state), the initial TLS/TCP and DTLS/ 3099 SCTP connection attempt will fail. The initiator MAY then attempt to 3100 connect via TCP or SCTP and initiate the TLS/TCP and DTLS/SCTP 3101 handshake when both ends are in the open state. If the handshake is 3102 successful, all further messages will be sent via TLS/TCP and DTLS/ 3103 SCTP. If the handshake fails, both ends move to the closed state. 3105 The state machine constrains only the behavior of a Diameter 3106 implementation as seen by Diameter peers through events on the wire. 3108 Any implementation that produces equivalent results is considered 3109 compliant. 3111 state event action next state 3112 ----------------------------------------------------------------- 3113 Closed Start I-Snd-Conn-Req Wait-Conn-Ack 3114 R-Conn-CER R-Accept, R-Open 3115 Process-CER, 3116 R-Snd-CEA 3118 Wait-Conn-Ack I-Rcv-Conn-Ack I-Snd-CER Wait-I-CEA 3119 I-Rcv-Conn-Nack Cleanup Closed 3120 R-Conn-CER R-Accept, Wait-Conn-Ack/ 3121 Process-CER Elect 3122 Timeout Error Closed 3124 Wait-I-CEA I-Rcv-CEA Process-CEA I-Open 3125 R-Conn-CER R-Accept, Wait-Returns 3126 Process-CER, 3127 Elect 3128 I-Peer-Disc I-Disc Closed 3129 I-Rcv-Non-CEA Error Closed 3130 Timeout Error Closed 3132 Wait-Conn-Ack/ I-Rcv-Conn-Ack I-Snd-CER,Elect Wait-Returns 3133 Elect I-Rcv-Conn-Nack R-Snd-CEA R-Open 3134 R-Peer-Disc R-Disc Wait-Conn-Ack 3135 R-Conn-CER R-Reject Wait-Conn-Ack/ 3136 Elect 3137 Timeout Error Closed 3139 Wait-Returns Win-Election I-Disc,R-Snd-CEA R-Open 3140 I-Peer-Disc I-Disc, R-Open 3141 R-Snd-CEA 3142 I-Rcv-CEA R-Disc I-Open 3143 R-Peer-Disc R-Disc Wait-I-CEA 3144 R-Conn-CER R-Reject Wait-Returns 3145 Timeout Error Closed 3147 R-Open Send-Message R-Snd-Message R-Open 3148 R-Rcv-Message Process R-Open 3149 R-Rcv-DWR Process-DWR, R-Open 3150 R-Snd-DWA 3151 R-Rcv-DWA Process-DWA R-Open 3152 R-Conn-CER R-Reject R-Open 3153 Stop R-Snd-DPR Closing 3154 R-Rcv-DPR R-Snd-DPA, Closed 3155 R-Disc 3156 R-Peer-Disc R-Disc Closed 3158 I-Open Send-Message I-Snd-Message I-Open 3159 I-Rcv-Message Process I-Open 3160 I-Rcv-DWR Process-DWR, I-Open 3161 I-Snd-DWA 3162 I-Rcv-DWA Process-DWA I-Open 3163 R-Conn-CER R-Reject I-Open 3164 Stop I-Snd-DPR Closing 3165 I-Rcv-DPR I-Snd-DPA, Closed 3166 I-Disc 3167 I-Peer-Disc I-Disc Closed 3169 Closing I-Rcv-DPA I-Disc Closed 3170 R-Rcv-DPA R-Disc Closed 3171 Timeout Error Closed 3172 I-Peer-Disc I-Disc Closed 3173 R-Peer-Disc R-Disc Closed 3175 5.6.1. Incoming connections 3177 When a connection request is received from a Diameter peer, it is 3178 not, in the general case, possible to know the identity of that peer 3179 until a CER is received from it. This is because host and port 3180 determine the identity of a Diameter peer; and the source port of an 3181 incoming connection is arbitrary. Upon receipt of CER, the identity 3182 of the connecting peer can be uniquely determined from Origin-Host. 3184 For this reason, a Diameter peer must employ logic separate from the 3185 state machine to receive connection requests, accept them, and await 3186 CER. Once CER arrives on a new connection, the Origin-Host that 3187 identifies the peer is used to locate the state machine associated 3188 with that peer, and the new connection and CER are passed to the 3189 state machine as an R-Conn-CER event. 3191 The logic that handles incoming connections SHOULD close and discard 3192 the connection if any message other than CER arrives, or if an 3193 implementation-defined timeout occurs prior to receipt of CER. 3195 Because handling of incoming connections up to and including receipt 3196 of CER requires logic, separate from that of any individual state 3197 machine associated with a particular peer, it is described separately 3198 in this section rather than in the state machine above. 3200 5.6.2. Events 3202 Transitions and actions in the automaton are caused by events. In 3203 this section, we will ignore the -I and -R prefix, since the actual 3204 event would be identical, but would occur on one of two possible 3205 connections. 3207 Start The Diameter application has signaled that a 3208 connection should be initiated with the peer. 3210 R-Conn-CER An acknowledgement is received stating that the 3211 transport connection has been established, and the 3212 associated CER has arrived. 3214 Rcv-Conn-Ack A positive acknowledgement is received confirming that 3215 the transport connection is established. 3217 Rcv-Conn-Nack A negative acknowledgement was received stating that 3218 the transport connection was not established. 3220 Timeout An application-defined timer has expired while waiting 3221 for some event. 3223 Rcv-CER A CER message from the peer was received. 3225 Rcv-CEA A CEA message from the peer was received. 3227 Rcv-Non-CEA A message other than CEA from the peer was received. 3229 Peer-Disc A disconnection indication from the peer was received. 3231 Rcv-DPR A DPR message from the peer was received. 3233 Rcv-DPA A DPA message from the peer was received. 3235 Win-Election An election was held, and the local node was the 3236 winner. 3238 Send-Message A message is to be sent. 3240 Rcv-Message A message other than CER, CEA, DPR, DPA, DWR or DWA 3241 was received. 3243 Stop The Diameter application has signaled that a 3244 connection should be terminated (e.g., on system 3245 shutdown). 3247 5.6.3. Actions 3249 Actions in the automaton are caused by events and typically indicate 3250 the transmission of packets and/or an action to be taken on the 3251 connection. In this section we will ignore the I- and R-prefix, 3252 since the actual action would be identical, but would occur on one of 3253 two possible connections. 3255 Snd-Conn-Req A transport connection is initiated with the peer. 3257 Accept The incoming connection associated with the R-Conn-CER 3258 is accepted as the responder connection. 3260 Reject The incoming connection associated with the R-Conn-CER 3261 is disconnected. 3263 Process-CER The CER associated with the R-Conn-CER is processed. 3264 Snd-CER A CER message is sent to the peer. 3266 Snd-CEA A CEA message is sent to the peer. 3268 Cleanup If necessary, the connection is shutdown, and any 3269 local resources are freed. 3271 Error The transport layer connection is disconnected, 3272 either politely or abortively, in response to 3273 an error condition. Local resources are freed. 3275 Process-CEA A received CEA is processed. 3277 Snd-DPR A DPR message is sent to the peer. 3279 Snd-DPA A DPA message is sent to the peer. 3281 Disc The transport layer connection is disconnected, 3282 and local resources are freed. 3284 Elect An election occurs (see Section 5.6.4 for more 3285 information). 3287 Snd-Message A message is sent. 3289 Snd-DWR A DWR message is sent. 3291 Snd-DWA A DWA message is sent. 3293 Process-DWR The DWR message is serviced. 3295 Process-DWA The DWA message is serviced. 3297 Process A message is serviced. 3299 5.6.4. The Election Process 3301 The election is performed on the responder. The responder compares 3302 the Origin-Host received in the CER with its own Origin-Host as two 3303 streams of octets. If the local Origin-Host lexicographically 3304 succeeds the received Origin-Host a Win-Election event is issued 3305 locally. Diameter identities are in ASCII form therefore the lexical 3306 comparison is consistent with DNS case insensitivity where octets 3307 that fall in the ASCII range 'a' through 'z' MUST compare equally to 3308 their upper-case counterparts between 'A' and 'Z'. See Appendix D 3309 for interactions between the Diameter protocol and Internationalized 3310 Domain Name (IDNs). 3312 The winner of the election MUST close the connection it initiated. 3313 Historically, maintaining the responder side of a connection was more 3314 efficient than maintaining the initiator side. However, current 3315 practices makes this distinction irrelevant. 3317 6. Diameter Message Processing 3319 This section describes how Diameter requests and answers are created 3320 and processed. 3322 6.1. Diameter Request Routing Overview 3324 A request is sent towards its final destination using a combination 3325 of the Destination-Realm and Destination-Host AVPs, in one of these 3326 three combinations: 3328 o a request that is not able to be proxied (such as CER) MUST NOT 3329 contain either Destination-Realm or Destination-Host AVPs. 3331 o a request that needs to be sent to a home server serving a 3332 specific realm, but not to a specific server (such as the first 3333 request of a series of round-trips), MUST contain a Destination- 3334 Realm AVP, but MUST NOT contain a Destination-Host AVP. For 3335 Diameter clients, the value of the Destination-Realm AVP MAY be 3336 extracted from the User-Name AVP, or other methods. 3338 o otherwise, a request that needs to be sent to a specific home 3339 server among those serving a given realm, MUST contain both the 3340 Destination-Realm and Destination-Host AVPs. 3342 The Destination-Host AVP is used as described above when the 3343 destination of the request is fixed, which includes: 3345 o Authentication requests that span multiple round trips 3347 o A Diameter message that uses a security mechanism that makes use 3348 of a pre-established session key shared between the source and the 3349 final destination of the message. 3351 o Server initiated messages that MUST be received by a specific 3352 Diameter client (e.g., access device), such as the Abort-Session- 3353 Request message, which is used to request that a particular user's 3354 session be terminated. 3356 Note that an agent can forward a request to a host described in the 3357 Destination-Host AVP only if the host in question is included in its 3358 peer table (see Section 2.6). Otherwise, the request is routed based 3359 on the Destination-Realm only (see Section 6.1.6). 3361 When a message is received, the message is processed in the following 3362 order: 3364 o If the message is destined for the local host, the procedures 3365 listed in Section 6.1.4 are followed. 3367 o If the message is intended for a Diameter peer with whom the local 3368 host is able to directly communicate, the procedures listed in 3369 Section 6.1.5 are followed. This is known as Request Forwarding. 3371 o The procedures listed in Section 6.1.6 are followed, which is 3372 known as Request Routing. 3374 o If none of the above is successful, an answer is returned with the 3375 Result-Code set to DIAMETER_UNABLE_TO_DELIVER, with the 'E' bit 3376 set. 3378 For routing of Diameter messages to work within an administrative 3379 domain, all Diameter nodes within the realm MUST be peers. 3381 The overview contained in this section (6.1) is intended to provide 3382 general guidelines to Diameter developers. Implementations are free 3383 to use different methods than the ones described here as long as they 3384 conform to the requirements specified in Sections 6.1.1 through 3385 6.1.9. See Section 7 for more detail on error handling. 3387 6.1.1. Originating a Request 3389 When creating a request, in addition to any other procedures 3390 described in the application definition for that specific request, 3391 the following procedures MUST be followed: 3393 o the Command-Code is set to the appropriate value 3395 o the 'R' bit is set 3397 o the End-to-End Identifier is set to a locally unique value 3399 o the Origin-Host and Origin-Realm AVPs MUST be set to the 3400 appropriate values, used to identify the source of the message 3402 o the Destination-Host and Destination-Realm AVPs MUST be set to the 3403 appropriate values as described in Section 6.1. 3405 6.1.2. Sending a Request 3407 When sending a request, originated either locally, or as the result 3408 of a forwarding or routing operation, the following procedures SHOULD 3409 be followed: 3411 o The Hop-by-Hop Identifier SHOULD be set to a locally unique value. 3413 o The message SHOULD be saved in the list of pending requests. 3415 Other actions to perform on the message based on the particular role 3416 the agent is playing are described in the following sections. 3418 6.1.3. Receiving Requests 3420 A relay or proxy agent MUST check for forwarding loops when receiving 3421 requests. A loop is detected if the server finds its own identity in 3422 a Route-Record AVP. When such an event occurs, the agent MUST answer 3423 with the Result-Code AVP set to DIAMETER_LOOP_DETECTED. 3425 6.1.4. Processing Local Requests 3427 A request is known to be for local consumption when one of the 3428 following conditions occur: 3430 o The Destination-Host AVP contains the local host's identity, 3432 o The Destination-Host AVP is not present, the Destination-Realm AVP 3433 contains a realm the server is configured to process locally, and 3434 the Diameter application is locally supported, or 3436 o Both the Destination-Host and the Destination-Realm are not 3437 present. 3439 When a request is locally processed, the rules in Section 6.2 should 3440 be used to generate the corresponding answer. 3442 6.1.5. Request Forwarding 3444 Request forwarding is done using the Diameter Peer Table. The 3445 Diameter peer table contains all of the peers that the local node is 3446 able to directly communicate with. 3448 When a request is received, and the host encoded in the Destination- 3449 Host AVP is one that is present in the peer table, the message SHOULD 3450 be forwarded to the peer. 3452 6.1.6. Request Routing 3454 Diameter request message routing is done via realms and application 3455 identifiers. A Diameter message that may be forwarded by Diameter 3456 agents (proxies, redirect or relay agents) MUST include the target 3457 realm in the Destination-Realm AVP. Request routing SHOULD rely on 3458 the Destination-Realm AVP and the Application Id present in the 3459 request message header to aid in the routing decision. The realm MAY 3460 be retrieved from the User-Name AVP, which is in the form of a 3461 Network Access Identifier (NAI). The realm portion of the NAI is 3462 inserted in the Destination-Realm AVP. 3464 Diameter agents MAY have a list of locally supported realms and 3465 applications, and MAY have a list of externally supported realms and 3466 applications. When a request is received that includes a realm 3467 and/or application that is not locally supported, the message is 3468 routed to the peer configured in the Routing Table (see Section 2.7). 3470 Realm names and Application Ids are the minimum supported routing 3471 criteria, additional information may be needed to support redirect 3472 semantics. 3474 6.1.7. Predictive Loop Avoidance 3476 Before forwarding or routing a request Diameter agents, in addition 3477 to performing the processing described in Section 6.1.3, SHOULD check 3478 for the presence of candidate route's peer identity in any of the 3479 Route-Record AVPs. In an event of the agent detecting the presence 3480 of a candidate route's peer identity in a Route-Record AVP, the agent 3481 MUST ignore such route for the Diameter request message and attempt 3482 alternate routes if any. In case all the candidate routes are 3483 eliminated by the above criteria, the agent SHOULD return 3484 DIAMETER_UNABLE_TO_DELIVER message. 3486 6.1.8. Redirecting Requests 3488 When a redirect agent receives a request whose routing entry is set 3489 to REDIRECT, it MUST reply with an answer message with the 'E' bit 3490 set, while maintaining the Hop-by-Hop Identifier in the header, and 3491 include the Result-Code AVP to DIAMETER_REDIRECT_INDICATION. Each of 3492 the servers associated with the routing entry are added in separate 3493 Redirect-Host AVP. 3495 +------------------+ 3496 | Diameter | 3497 | Redirect Agent | 3498 +------------------+ 3499 ^ | 2. command + 'E' bit 3500 1. Request | | Result-Code = 3501 joe@example.com | | DIAMETER_REDIRECT_INDICATION + 3502 | | Redirect-Host AVP(s) 3503 | v 3504 +-------------+ 3. Request +-------------+ 3505 | example.com |------------->| example.net | 3506 | Relay | | Diameter | 3507 | Agent |<-------------| Server | 3508 +-------------+ 4. Answer +-------------+ 3510 Figure 5: Diameter Redirect Agent 3512 The receiver of an answer message with the 'E' bit set and the 3513 Result-Code AVP set to DIAMETER_REDIRECT_INDICATION uses the Hop-by- 3514 Hop Identifier in the Diameter header to identify the request in the 3515 pending message queue (see Section 5.5.4) that is to be redirected. 3516 If no transport connection exists with the new agent, one is created, 3517 and the request is sent directly to it. 3519 Multiple Redirect-Host AVPs are allowed. The receiver of the answer 3520 message with the 'E' bit set selects exactly one of these hosts as 3521 the destination of the redirected message. 3523 When the Redirect-Host-Usage AVP included in the answer message has a 3524 non-zero value, a route entry for the redirect indications is created 3525 and cached by the receiver. The redirect usage for such route entry 3526 is set by the value of Redirect-Host-Usage AVP and the lifetime of 3527 the cached route entry is set by Redirect-Max-Cache-Time AVP value. 3529 It is possible that multiple redirect indications can create multiple 3530 cached route entries differing only in their redirect usage and the 3531 peer to forward messages to. As an example, two(2) route entries 3532 that are created by two(2) redirect indications results in two(2) 3533 cached routes for the same realm and Application Id. However, one 3534 has a redirect usage of ALL_SESSION where matching request will be 3535 forwarded to one peer and the other has a redirect usage of ALL_REALM 3536 where request are forwarded to another peer. Therefore, an incoming 3537 request that matches the realm and Application Id of both routes will 3538 need additional resolution. In such a case, a routing precedence 3539 rule MUST be used against the redirect usage value to resolve the 3540 contention. The precedence rule can be found in Section 6.13. 3542 6.1.9. Relaying and Proxying Requests 3544 A relay or proxy agent MUST append a Route-Record AVP to all requests 3545 forwarded. The AVP contains the identity of the peer the request was 3546 received from. 3548 The Hop-by-Hop identifier in the request is saved, and replaced with 3549 a locally unique value. The source of the request is also saved, 3550 which includes the IP address, port and protocol. 3552 A relay or proxy agent MAY include the Proxy-Info AVP in requests if 3553 it requires access to any local state information when the 3554 corresponding response is received. The Proxy-Info AVP has security 3555 implications as state information is distributed to other entities. 3556 As such, it is RECOMMENDED that the content of the Proxy-Info AVP be 3557 protected with cryptographic mechanisms, for example by using a keyed 3558 message digest such as HMAC-SHA1 [RFC2104]. Such a mechanism, 3559 however, requires the management of keys, although only locally at 3560 the Diameter server. Still, a full description of the management of 3561 the keys used to protect the Proxy-Info AVP is beyond the scope of 3562 this document. Below is a list of common recommendations: 3564 o The keys should be generated securely following the randomness 3565 recommendations in [RFC4086]. 3567 o The keys and cryptographic protection algorithms should be at 3568 least 128 bits in strength. 3570 o The keys should not be used for any other purpose than generating 3571 and verifying tickets. 3573 o The keys should be changed regularly. 3575 o The keys should be changed if the ticket format or cryptographic 3576 protection algorithms change. 3578 The message is then forwarded to the next hop, as identified in the 3579 Routing Table. 3581 Figure 6 provides an example of message routing using the procedures 3582 listed in these sections. 3584 (Origin-Host=nas.example.net) (Origin-Host=nas.example.net) 3585 (Origin-Realm=example.net) (Origin-Realm=example.net) 3586 (Destination-Realm=example.com) (Destination- 3587 Realm=example.com) 3588 (Route-Record=nas.example.net) 3589 +------+ ------> +------+ ------> +------+ 3590 | | (Request) | | (Request) | | 3591 | NAS +-------------------+ DRL +-------------------+ HMS | 3592 | | | | | | 3593 +------+ <------ +------+ <------ +------+ 3594 example.net (Answer) example.net (Answer) example.com 3595 (Origin-Host=hms.example.com) (Origin-Host=hms.example.com) 3596 (Origin-Realm=example.com) (Origin-Realm=example.com) 3598 Figure 6: Routing of Diameter messages 3600 Relay and proxy agents are not required to perform full inspection of 3601 incoming messages. At a minimum, validation of the message header 3602 and relevant routing AVPs has to be done when relaying messages. 3603 Proxy agents may optionally perform more in-depth message validation 3604 for applications it is interested in. 3606 6.2. Diameter Answer Processing 3608 When a request is locally processed, the following procedures MUST be 3609 applied to create the associated answer, in addition to any 3610 additional procedures that MAY be discussed in the Diameter 3611 application defining the command: 3613 o The same Hop-by-Hop identifier in the request is used in the 3614 answer. 3616 o The local host's identity is encoded in the Origin-Host AVP. 3618 o The Destination-Host and Destination-Realm AVPs MUST NOT be 3619 present in the answer message. 3621 o The Result-Code AVP is added with its value indicating success or 3622 failure. 3624 o If the Session-Id is present in the request, it MUST be included 3625 in the answer. 3627 o Any Proxy-Info AVPs in the request MUST be added to the answer 3628 message, in the same order they were present in the request. 3630 o The 'P' bit is set to the same value as the one in the request. 3632 o The same End-to-End identifier in the request is used in the 3633 answer. 3635 Note that the error messages (see Section 7) are also subjected to 3636 the above processing rules. 3638 6.2.1. Processing Received Answers 3640 A Diameter client or proxy MUST match the Hop-by-Hop Identifier in an 3641 answer received against the list of pending requests. The 3642 corresponding message should be removed from the list of pending 3643 requests. It SHOULD ignore answers received that do not match a 3644 known Hop-by-Hop Identifier. 3646 6.2.2. Relaying and Proxying Answers 3648 If the answer is for a request which was proxied or relayed, the 3649 agent MUST restore the original value of the Diameter header's Hop- 3650 by-Hop Identifier field. 3652 If the last Proxy-Info AVP in the message is targeted to the local 3653 Diameter server, the AVP MUST be removed before the answer is 3654 forwarded. 3656 If a relay or proxy agent receives an answer with a Result-Code AVP 3657 indicating a failure, it MUST NOT modify the contents of the AVP. 3658 Any additional local errors detected SHOULD be logged, but not 3659 reflected in the Result-Code AVP. If the agent receives an answer 3660 message with a Result-Code AVP indicating success, and it wishes to 3661 modify the AVP to indicate an error, it MUST modify the Result-Code 3662 AVP to contain the appropriate error in the message destined towards 3663 the access device as well as include the Error-Reporting-Host AVP and 3664 it MUST issue an STR on behalf of the access device towards the 3665 Diameter server. 3667 The agent MUST then send the answer to the host that it received the 3668 original request from. 3670 6.3. Origin-Host AVP 3672 The Origin-Host AVP (AVP Code 264) is of type DiameterIdentity, and 3673 MUST be present in all Diameter messages. This AVP identifies the 3674 endpoint that originated the Diameter message. Relay agents MUST NOT 3675 modify this AVP. 3677 The value of the Origin-Host AVP is guaranteed to be unique within a 3678 single host. 3680 Note that the Origin-Host AVP may resolve to more than one address as 3681 the Diameter peer may support more than one address. 3683 This AVP SHOULD be placed as close to the Diameter header as 3684 possible. 3686 6.4. Origin-Realm AVP 3688 The Origin-Realm AVP (AVP Code 296) is of type DiameterIdentity. 3689 This AVP contains the Realm of the originator of any Diameter message 3690 and MUST be present in all messages. 3692 This AVP SHOULD be placed as close to the Diameter header as 3693 possible. 3695 6.5. Destination-Host AVP 3697 The Destination-Host AVP (AVP Code 293) is of type DiameterIdentity. 3698 This AVP MUST be present in all unsolicited agent initiated messages, 3699 MAY be present in request messages, and MUST NOT be present in Answer 3700 messages. 3702 The absence of the Destination-Host AVP will cause a message to be 3703 sent to any Diameter server supporting the application within the 3704 realm specified in Destination-Realm AVP. 3706 This AVP SHOULD be placed as close to the Diameter header as 3707 possible. 3709 6.6. Destination-Realm AVP 3711 The Destination-Realm AVP (AVP Code 283) is of type DiameterIdentity, 3712 and contains the realm the message is to be routed to. The 3713 Destination-Realm AVP MUST NOT be present in Answer messages. 3714 Diameter Clients insert the realm portion of the User-Name AVP. 3715 Diameter servers initiating a request message use the value of the 3716 Origin-Realm AVP from a previous message received from the intended 3717 target host (unless it is known a priori). When present, the 3718 Destination-Realm AVP is used to perform message routing decisions. 3720 The CCF for a request message that includes the Destination-Realm AVP 3721 SHOULD list the Destination-Realm AVP as a required AVP (an AVP 3722 indicated as {AVP}) otherwise the message is inherently a non- 3723 routable message. 3725 This AVP SHOULD be placed as close to the Diameter header as 3726 possible. 3728 6.7. Routing AVPs 3730 The AVPs defined in this section are Diameter AVPs used for routing 3731 purposes. These AVPs change as Diameter messages are processed by 3732 agents. 3734 6.7.1. Route-Record AVP 3736 The Route-Record AVP (AVP Code 282) is of type DiameterIdentity. The 3737 identity added in this AVP MUST be the same as the one received in 3738 the Origin-Host of the Capabilities Exchange message. 3740 6.7.2. Proxy-Info AVP 3742 The Proxy-Info AVP (AVP Code 284) is of type Grouped. This AVP 3743 contains the identity and local state information of the Diameter 3744 node that creates and adds it to a message. The Grouped Data field 3745 has the following CCF grammar: 3747 Proxy-Info ::= < AVP Header: 284 > 3748 { Proxy-Host } 3749 { Proxy-State } 3750 * [ AVP ] 3752 6.7.3. Proxy-Host AVP 3754 The Proxy-Host AVP (AVP Code 280) is of type DiameterIdentity. This 3755 AVP contains the identity of the host that added the Proxy-Info AVP. 3757 6.7.4. Proxy-State AVP 3759 The Proxy-State AVP (AVP Code 33) is of type OctetString. It 3760 contains state information that would otherwise be stored at the 3761 Diameter entity that created it. As such, this AVP MUST be treated 3762 as opaque data by other Diameter entities. 3764 6.8. Auth-Application-Id AVP 3766 The Auth-Application-Id AVP (AVP Code 258) is of type Unsigned32 and 3767 is used in order to advertise support of the Authentication and 3768 Authorization portion of an application (see Section 2.4). If 3769 present in a message other than CER and CEA, the value of the Auth- 3770 Application-Id AVP MUST match the Application Id present in the 3771 Diameter message header. 3773 6.9. Acct-Application-Id AVP 3775 The Acct-Application-Id AVP (AVP Code 259) is of type Unsigned32 and 3776 is used in order to advertise support of the Accounting portion of an 3777 application (see Section 2.4). If present in a message other than 3778 CER and CEA, the value of the Acct-Application-Id AVP MUST match the 3779 Application Id present in the Diameter message header. 3781 6.10. Inband-Security-Id AVP 3783 The Inband-Security-Id AVP (AVP Code 299) is of type Unsigned32 and 3784 is used in order to advertise support of the security portion of the 3785 application. The use of this AVP in CER and CEA messages is NOT 3786 RECCOMENDED. Instead, discovery of a Diameter entities security 3787 capabilities can be done either through static configuration or via 3788 Diameter Peer Discovery as described in Section 5.2. 3790 The following values are supported: 3792 NO_INBAND_SECURITY 0 3794 This peer does not support TLS/TCP and DTLS/SCTP. This is the 3795 default value, if the AVP is omitted. 3797 TLS 1 3799 This node supports TLS/TCP [RFC5246] and DTLS/SCTP [RFC6083] 3800 security. 3802 6.11. Vendor-Specific-Application-Id AVP 3804 The Vendor-Specific-Application-Id AVP (AVP Code 260) is of type 3805 Grouped and is used to advertise support of a vendor-specific 3806 Diameter Application. Exactly one instance of either Auth- 3807 Application-Id or Acct-Application-Id AVP MUST be present. The 3808 Application Id carried by either Auth-Application-Id or Acct- 3809 Application-Id AVP MUST comply with vendor specific Application Id 3810 assignment described in Sec 11.3. It MUST also match the Application 3811 Id present in the Diameter header except when used in a CER or CEA 3812 message. 3814 The Vendor-Id AVP is an informational AVP pertaining to the vendor 3815 who may have authorship of the vendor-specific Diameter application. 3816 It MUST NOT be used as a means of defining a completely separate 3817 vendor-specific Application Id space. 3819 The Vendor-Specific-Application-Id AVP SHOULD be placed as close to 3820 the Diameter header as possible. 3822 AVP Format 3824 ::= < AVP Header: 260 > 3825 { Vendor-Id } 3826 [ Auth-Application-Id ] 3827 [ Acct-Application-Id ] 3829 A Vendor-Specific-Application-Id AVP MUST contain exactly one of 3830 either Auth-Application-Id or Acct-Application-Id. If a Vendor- 3831 Specific-Application-Id is received without any of these two AVPs, 3832 then the recipient SHOULD issue an answer with a Result-Code set to 3833 DIAMETER_MISSING_AVP. The answer SHOULD also include a Failed-AVP 3834 which MUST contain an example of an Auth-Application-Id AVP and an 3835 Acct-Application-Id AVP. 3837 If a Vendor-Specific-Application-Id is received that contains both 3838 Auth-Application-Id and Acct-Application-Id, then the recipient MUST 3839 issue an answer with Result-Code set to 3840 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES. The answer MUST also include a 3841 Failed-AVP which MUST contain the received Auth-Application-Id AVP 3842 and Acct-Application-Id AVP. 3844 6.12. Redirect-Host AVP 3846 The Redirect-Host AVP (AVP Code 292) is of type DiameterURI. One or 3847 more of instances of this AVP MUST be present if the answer message's 3848 'E' bit is set and the Result-Code AVP is set to 3849 DIAMETER_REDIRECT_INDICATION. 3851 Upon receiving the above, the receiving Diameter node SHOULD forward 3852 the request directly to one of the hosts identified in these AVPs. 3853 The server contained in the selected Redirect-Host AVP SHOULD be used 3854 for all messages matching the criteria set by the Redirect-Host-Usage 3855 AVP. 3857 6.13. Redirect-Host-Usage AVP 3859 The Redirect-Host-Usage AVP (AVP Code 261) is of type Enumerated. 3860 This AVP MAY be present in answer messages whose 'E' bit is set and 3861 the Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION. 3863 When present, this AVP provides a hints about how the routing entry 3864 resulting from the Redirect-Host is to be used. The following values 3865 are supported: 3867 DONT_CACHE 0 3869 The host specified in the Redirect-Host AVP SHOULD NOT be cached. 3870 This is the default value. 3872 ALL_SESSION 1 3874 All messages within the same session, as defined by the same value 3875 of the Session-ID AVP SHOULD be sent to the host specified in the 3876 Redirect-Host AVP. 3878 ALL_REALM 2 3880 All messages destined for the realm requested SHOULD be sent to 3881 the host specified in the Redirect-Host AVP. 3883 REALM_AND_APPLICATION 3 3885 All messages for the application requested to the realm specified 3886 SHOULD be sent to the host specified in the Redirect-Host AVP. 3888 ALL_APPLICATION 4 3890 All messages for the application requested SHOULD be sent to the 3891 host specified in the Redirect-Host AVP. 3893 ALL_HOST 5 3895 All messages that would be sent to the host that generated the 3896 Redirect-Host SHOULD be sent to the host specified in the 3897 Redirect-Host AVP. 3899 ALL_USER 6 3901 All messages for the user requested SHOULD be sent to the host 3902 specified in the Redirect-Host AVP. 3904 When multiple cached routes are created by redirect indications and 3905 they differ only in redirect usage and peers to forward requests to 3906 (see Section 6.1.8, a precedence rule MUST be applied to the redirect 3907 usage values of the cached routes during normal routing to resolve 3908 contentions that may occur. The precedence rule is the order that 3909 dictate which redirect usage should be considered before any other as 3910 they appear. The order is as follows: 3912 1. ALL_SESSION 3914 2. ALL_USER 3916 3. REALM_AND_APPLICATION 3918 4. ALL_REALM 3920 5. ALL_APPLICATION 3922 6. ALL_HOST 3924 6.14. Redirect-Max-Cache-Time AVP 3926 The Redirect-Max-Cache-Time AVP (AVP Code 262) is of type Unsigned32. 3927 This AVP MUST be present in answer messages whose 'E' bit is set, the 3928 Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION and the 3929 Redirect-Host-Usage AVP set to a non-zero value. 3931 This AVP contains the maximum number of seconds the peer and route 3932 table entries, created as a result of the Redirect-Host, SHOULD be 3933 cached. Note that once a host is no longer reachable, any associated 3934 cache, peer and routing table entries MUST be deleted. 3936 7. Error Handling 3938 There are two different types of errors in Diameter; protocol and 3939 application errors. A protocol error is one that occurs at the base 3940 protocol level, and MAY require per hop attention (e.g., message 3941 routing error). Application errors, on the other hand, generally 3942 occur due to a problem with a function specified in a Diameter 3943 application (e.g., user authentication, missing AVP). 3945 Result-Code AVP values that are used to report protocol errors MUST 3946 only be present in answer messages whose 'E' bit is set. When a 3947 request message is received that causes a protocol error, an answer 3948 message is returned with the 'E' bit set, and the Result-Code AVP is 3949 set to the appropriate protocol error value. As the answer is sent 3950 back towards the originator of the request, each proxy or relay agent 3951 MAY take action on the message. 3953 1. Request +---------+ Link Broken 3954 +-------------------------->|Diameter |----///----+ 3955 | +---------------------| | v 3956 +------+--+ | 2. answer + 'E' set | Relay 2 | +--------+ 3957 |Diameter |<-+ (Unable to Forward) +---------+ |Diameter| 3958 | | | Home | 3959 | Relay 1 |--+ +---------+ | Server | 3960 +---------+ | 3. Request |Diameter | +--------+ 3961 +-------------------->| | ^ 3962 | Relay 3 |-----------+ 3963 +---------+ 3965 Figure 7: Example of Protocol Error causing answer message 3967 Figure 7 provides an example of a message forwarded upstream by a 3968 Diameter relay. When the message is received by Relay 2, and it 3969 detects that it cannot forward the request to the home server, an 3970 answer message is returned with the 'E' bit set and the Result-Code 3971 AVP set to DIAMETER_UNABLE_TO_DELIVER. Given that this error falls 3972 within the protocol error category, Relay 1 would take special 3973 action, and given the error, attempt to route the message through its 3974 alternate Relay 3. 3976 +---------+ 1. Request +---------+ 2. Request +---------+ 3977 | Access |------------>|Diameter |------------>|Diameter | 3978 | | | | | Home | 3979 | Device |<------------| Relay |<------------| Server | 3980 +---------+ 4. Answer +---------+ 3. Answer +---------+ 3981 (Missing AVP) (Missing AVP) 3983 Figure 8: Example of Application Error Answer message 3985 Figure 8 provides an example of a Diameter message that caused an 3986 application error. When application errors occur, the Diameter 3987 entity reporting the error clears the 'R' bit in the Command Flags, 3988 and adds the Result-Code AVP with the proper value. Application 3989 errors do not require any proxy or relay agent involvement, and 3990 therefore the message would be forwarded back to the originator of 3991 the request. 3993 In the case where the answer message itself contains errors, any 3994 related session SHOULD be terminated by sending an STR or ASR 3995 message. The Termination-Cause AVP in the STR MAY be filled with the 3996 appropriate value to indicate the cause of the error. An application 3997 MAY also send an application-specific request instead of STR or ASR 3998 to signal the error in the case where no state is maintained or to 3999 allow for some form of error recovery with the corresponding Diameter 4000 entity. 4002 There are certain Result-Code AVP application errors that require 4003 additional AVPs to be present in the answer. In these cases, the 4004 Diameter node that sets the Result-Code AVP to indicate the error 4005 MUST add the AVPs. Examples are: 4007 o A request with an unrecognized AVP is received with the 'M' bit 4008 (Mandatory bit) set, causes an answer to be sent with the Result- 4009 Code AVP set to DIAMETER_AVP_UNSUPPORTED, and the Failed-AVP AVP 4010 containing the offending AVP. 4012 o A request with an AVP that is received with an unrecognized value 4013 causes an answer to be returned with the Result-Code AVP set to 4014 DIAMETER_INVALID_AVP_VALUE, with the Failed-AVP AVP containing the 4015 AVP causing the error. 4017 o A received command which is missing AVP(s) that are defined as 4018 required in the commands CCF; examples are AVPs indicated as 4019 {AVP}. The receiver issues an answer with the Result-Code set to 4020 DIAMETER_MISSING_AVP, and creates an AVP with the AVP Code and 4021 other fields set as expected in the missing AVP. The created AVP 4022 is then added to the Failed-AVP AVP. 4024 The Result-Code AVP describes the error that the Diameter node 4025 encountered in its processing. In case there are multiple errors, 4026 the Diameter node MUST report only the first error it encountered 4027 (detected possibly in some implementation dependent order). The 4028 specific errors that can be described by this AVP are described in 4029 the following section. 4031 7.1. Result-Code AVP 4033 The Result-Code AVP (AVP Code 268) is of type Unsigned32 and 4034 indicates whether a particular request was completed successfully or 4035 whether an error occurred. All Diameter answer messages in IETF 4036 defined Diameter application specification MUST include one Result- 4037 Code AVP. A non-successful Result-Code AVP (one containing a non 4038 2xxx value other than DIAMETER_REDIRECT_INDICATION) MUST include the 4039 Error-Reporting-Host AVP if the host setting the Result-Code AVP is 4040 different from the identity encoded in the Origin-Host AVP. 4042 The Result-Code data field contains an IANA-managed 32-bit address 4043 space representing errors (see Section 11.3.2). Diameter provides 4044 the following classes of errors, all identified by the thousands 4045 digit in the decimal notation: 4047 o 1xxx (Informational) 4049 o 2xxx (Success) 4051 o 3xxx (Protocol Errors) 4053 o 4xxx (Transient Failures) 4055 o 5xxx (Permanent Failure) 4057 A non-recognized class (one whose first digit is not defined in this 4058 section) MUST be handled as a permanent failure. 4060 7.1.1. Informational 4062 Errors that fall within this category are used to inform the 4063 requester that a request could not be satisfied, and additional 4064 action is required on its part before access is granted. 4066 DIAMETER_MULTI_ROUND_AUTH 1001 4068 This informational error is returned by a Diameter server to 4069 inform the access device that the authentication mechanism being 4070 used requires multiple round trips, and a subsequent request needs 4071 to be issued in order for access to be granted. 4073 7.1.2. Success 4075 Errors that fall within the Success category are used to inform a 4076 peer that a request has been successfully completed. 4078 DIAMETER_SUCCESS 2001 4080 The request was successfully completed. 4082 DIAMETER_LIMITED_SUCCESS 2002 4084 When returned, the request was successfully completed, but 4085 additional processing is required by the application in order to 4086 provide service to the user. 4088 7.1.3. Protocol Errors 4090 Errors that fall within the Protocol Error category SHOULD be treated 4091 on a per-hop basis, and Diameter proxies MAY attempt to correct the 4092 error, if it is possible. Note that these errors MUST only be used 4093 in answer messages whose 'E' bit is set. 4095 DIAMETER_COMMAND_UNSUPPORTED 3001 4097 This error code is used when a Diameter entity receives a message 4098 with a Command Code that it does not support. 4100 DIAMETER_UNABLE_TO_DELIVER 3002 4102 This error is given when Diameter can not deliver the message to 4103 the destination, either because no host within the realm 4104 supporting the required application was available to process the 4105 request, or because Destination-Host AVP was given without the 4106 associated Destination-Realm AVP. 4108 DIAMETER_REALM_NOT_SERVED 3003 4110 The intended realm of the request is not recognized. 4112 DIAMETER_TOO_BUSY 3004 4114 When returned, a Diameter node SHOULD attempt to send the message 4115 to an alternate peer. This error MUST only be used when a 4116 specific server is requested, and it cannot provide the requested 4117 service. 4119 DIAMETER_LOOP_DETECTED 3005 4121 An agent detected a loop while trying to get the message to the 4122 intended recipient. The message MAY be sent to an alternate peer, 4123 if one is available, but the peer reporting the error has 4124 identified a configuration problem. 4126 DIAMETER_REDIRECT_INDICATION 3006 4128 A redirect agent has determined that the request could not be 4129 satisfied locally and the initiator of the request SHOULD direct 4130 the request directly to the server, whose contact information has 4131 been added to the response. When set, the Redirect-Host AVP MUST 4132 be present. 4134 DIAMETER_APPLICATION_UNSUPPORTED 3007 4136 A request was sent for an application that is not supported. 4138 DIAMETER_INVALID_HDR_BITS 3008 4140 A request was received whose bits in the Diameter header were 4141 either set to an invalid combination, or to a value that is 4142 inconsistent with the command code's definition. 4144 DIAMETER_INVALID_AVP_BITS 3009 4146 A request was received that included an AVP whose flag bits are 4147 set to an unrecognized value, or that is inconsistent with the 4148 AVP's definition. 4150 DIAMETER_UNKNOWN_PEER 3010 4152 A CER was received from an unknown peer. 4154 7.1.4. Transient Failures 4156 Errors that fall within the transient failures category are used to 4157 inform a peer that the request could not be satisfied at the time it 4158 was received, but MAY be able to satisfy the request in the future. 4159 Note that these errors MUST be used in answer messages whose 'E' bit 4160 is not set. 4162 DIAMETER_AUTHENTICATION_REJECTED 4001 4164 The authentication process for the user failed, most likely due to 4165 an invalid password used by the user. Further attempts MUST only 4166 be tried after prompting the user for a new password. 4168 DIAMETER_OUT_OF_SPACE 4002 4170 A Diameter node received the accounting request but was unable to 4171 commit it to stable storage due to a temporary lack of space. 4173 ELECTION_LOST 4003 4175 The peer has determined that it has lost the election process and 4176 has therefore disconnected the transport connection. 4178 7.1.5. Permanent Failures 4180 Errors that fall within the permanent failures category are used to 4181 inform the peer that the request failed, and should not be attempted 4182 again. Note that these errors SHOULD be used in answer messages 4183 whose 'E' bit is not set. In error conditions where it is not 4184 possible or efficient to compose application-specific answer grammar 4185 then answer messages with E-bit set and complying to the grammar 4186 described in 7.2 MAY also be used for permanent errors. 4188 DIAMETER_AVP_UNSUPPORTED 5001 4190 The peer received a message that contained an AVP that is not 4191 recognized or supported and was marked with the Mandatory bit. A 4192 Diameter message with this error MUST contain one or more Failed- 4193 AVP AVP containing the AVPs that caused the failure. 4195 DIAMETER_UNKNOWN_SESSION_ID 5002 4197 The request contained an unknown Session-Id. 4199 DIAMETER_AUTHORIZATION_REJECTED 5003 4201 A request was received for which the user could not be authorized. 4202 This error could occur if the service requested is not permitted 4203 to the user. 4205 DIAMETER_INVALID_AVP_VALUE 5004 4207 The request contained an AVP with an invalid value in its data 4208 portion. A Diameter message indicating this error MUST include 4209 the offending AVPs within a Failed-AVP AVP. 4211 DIAMETER_MISSING_AVP 5005 4213 The request did not contain an AVP that is required by the Command 4214 Code definition. If this value is sent in the Result-Code AVP, a 4215 Failed-AVP AVP SHOULD be included in the message. The Failed-AVP 4216 AVP MUST contain an example of the missing AVP complete with the 4217 Vendor-Id if applicable. The value field of the missing AVP 4218 should be of correct minimum length and contain zeroes. 4220 DIAMETER_RESOURCES_EXCEEDED 5006 4222 A request was received that cannot be authorized because the user 4223 has already expended allowed resources. An example of this error 4224 condition is a user that is restricted to one dial-up PPP port, 4225 attempts to establish a second PPP connection. 4227 DIAMETER_CONTRADICTING_AVPS 5007 4229 The Home Diameter server has detected AVPs in the request that 4230 contradicted each other, and is not willing to provide service to 4231 the user. The Failed-AVP AVPs MUST be present which contains the 4232 AVPs that contradicted each other. 4234 DIAMETER_AVP_NOT_ALLOWED 5008 4236 A message was received with an AVP that MUST NOT be present. The 4237 Failed-AVP AVP MUST be included and contain a copy of the 4238 offending AVP. 4240 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES 5009 4242 A message was received that included an AVP that appeared more 4243 often than permitted in the message definition. The Failed-AVP 4244 AVP MUST be included and contain a copy of the first instance of 4245 the offending AVP that exceeded the maximum number of occurrences 4247 DIAMETER_NO_COMMON_APPLICATION 5010 4249 This error is returned by a Diameter node that receives a CER 4250 whereby no applications are common between the CER sending peer 4251 and the CER receiving peer. 4253 DIAMETER_UNSUPPORTED_VERSION 5011 4255 This error is returned when a request was received, whose version 4256 number is unsupported. 4258 DIAMETER_UNABLE_TO_COMPLY 5012 4260 This error is returned when a request is rejected for unspecified 4261 reasons. 4263 DIAMETER_INVALID_BIT_IN_HEADER 5013 4265 This error is returned when a reserved bit in the Diameter header 4266 is set to one (1) or the bits in the Diameter header are set 4267 incorrectly. 4269 DIAMETER_INVALID_AVP_LENGTH 5014 4271 The request contained an AVP with an invalid length. A Diameter 4272 message indicating this error MUST include the offending AVPs 4273 within a Failed-AVP AVP. In cases where the erroneous AVP length 4274 value exceeds the message length or is less than the minimum AVP 4275 header length, it is sufficient to include the offending AVP 4276 header and a zero filled payload of the minimum required length 4277 for the payloads data type. If the AVP is a grouped AVP, the 4278 grouped AVP header with an empty payload would be sufficient to 4279 indicate the offending AVP. In the case where the offending AVP 4280 header cannot be fully decoded when the AVP length is less than 4281 the minimum AVP header length, it is sufficient to include an 4282 offending AVP header that is formulated by padding the incomplete 4283 AVP header with zero up to the minimum AVP header length. 4285 DIAMETER_INVALID_MESSAGE_LENGTH 5015 4287 This error is returned when a request is received with an invalid 4288 message length. 4290 DIAMETER_INVALID_AVP_BIT_COMBO 5016 4292 The request contained an AVP with which is not allowed to have the 4293 given value in the AVP Flags field. A Diameter message indicating 4294 this error MUST include the offending AVPs within a Failed-AVP 4295 AVP. 4297 DIAMETER_NO_COMMON_SECURITY 5017 4299 This error is returned when a CER message is received, and there 4300 are no common security mechanisms supported between the peers. A 4301 Capabilities-Exchange-Answer (CEA) MUST be returned with the 4302 Result-Code AVP set to DIAMETER_NO_COMMON_SECURITY. 4304 7.2. Error Bit 4306 The 'E' (Error Bit) in the Diameter header is set when the request 4307 caused a protocol-related error (see Section 7.1.3). A message with 4308 the 'E' bit MUST NOT be sent as a response to an answer message. 4309 Note that a message with the 'E' bit set is still subjected to the 4310 processing rules defined in Section 6.2. When set, the answer 4311 message will not conform to the CCF specification for the command, 4312 and will instead conform to the following CCF: 4314 Message Format 4316 ::= < Diameter Header: code, ERR [, PXY] > 4317 0*1< Session-Id > 4318 { Origin-Host } 4319 { Origin-Realm } 4320 { Result-Code } 4321 [ Origin-State-Id ] 4322 [ Error-Message ] 4323 [ Error-Reporting-Host ] 4324 [ Failed-AVP ] 4325 [ Experimental-Result ] 4326 * [ Proxy-Info ] 4327 * [ AVP ] 4329 Note that the code used in the header is the same than the one found 4330 in the request message, but with the 'R' bit cleared and the 'E' bit 4331 set. The 'P' bit in the header is set to the same value as the one 4332 found in the request message. 4334 7.3. Error-Message AVP 4336 The Error-Message AVP (AVP Code 281) is of type UTF8String. It MAY 4337 accompany a Result-Code AVP as a human readable error message. The 4338 Error-Message AVP is not intended to be useful in an environment 4339 where error messages are processed automatically. It SHOULD NOT be 4340 expected that the content of this AVP is parsed by network entities. 4342 7.4. Error-Reporting-Host AVP 4344 The Error-Reporting-Host AVP (AVP Code 294) is of type 4345 DiameterIdentity. This AVP contains the identity of the Diameter 4346 host that sent the Result-Code AVP to a value other than 2001 4347 (Success), only if the host setting the Result-Code is different from 4348 the one encoded in the Origin-Host AVP. This AVP is intended to be 4349 used for troubleshooting purposes, and MUST be set when the Result- 4350 Code AVP indicates a failure. 4352 7.5. Failed-AVP AVP 4354 The Failed-AVP AVP (AVP Code 279) is of type Grouped and provides 4355 debugging information in cases where a request is rejected or not 4356 fully processed due to erroneous information in a specific AVP. The 4357 value of the Result-Code AVP will provide information on the reason 4358 for the Failed-AVP AVP. A Diameter answer message SHOULD contain 4359 only one Failed-AVP that corresponds to the error indicated by the 4360 Result-Code AVP. For practical purposes, this Failed-AVP would 4361 typically refer to the first AVP processing error that a Diameter 4362 node encounters. 4364 The possible reasons for this AVP are the presence of an improperly 4365 constructed AVP, an unsupported or unrecognized AVP, an invalid AVP 4366 value, the omission of a required AVP, the presence of an explicitly 4367 excluded AVP (see tables in Section 10) or the presence of two or 4368 more occurrences of an AVP which is restricted to 0, 1, or 0-1 4369 occurrences. 4371 A Diameter message SHOULD contain one Failed-AVP AVP, containing the 4372 entire AVP that could not be processed successfully. If the failure 4373 reason is omission of a required AVP, an AVP with the missing AVP 4374 code, the missing vendor id, and a zero filled payload of the minimum 4375 required length for the omitted AVP will be added. If the failure 4376 reason is an invalid AVP length where the reported length is less 4377 than the minimum AVP header length or greater than the reported 4378 message length, a copy of the offending AVP header and a zero filled 4379 payload of the minimum required length SHOULD be added. 4381 In the case where the offending AVP is embedded within a grouped AVP, 4382 the Failed-AVP MAY contain the grouped AVP which in turn contains the 4383 single offending AVP. The same method MAY be employed if the grouped 4384 AVP itself is embedded in yet another grouped AVP and so on. In this 4385 case, the Failed-AVP MAY contain the grouped AVP hierarchy up to the 4386 single offending AVP. This enables the recipient to detect the 4387 location of the offending AVP when embedded in a group. 4389 AVP Format 4391 ::= < AVP Header: 279 > 4392 1* {AVP} 4394 7.6. Experimental-Result AVP 4396 The Experimental-Result AVP (AVP Code 297) is of type Grouped, and 4397 indicates whether a particular vendor-specific request was completed 4398 successfully or whether an error occurred. This AVP has the 4399 following structure: 4401 AVP Format 4403 Experimental-Result ::= < AVP Header: 297 > 4404 { Vendor-Id } 4405 { Experimental-Result-Code } 4407 The Vendor-Id AVP (see Section 5.3.3 in this grouped AVP identifies 4408 the vendor responsible for the assignment of the result code which 4409 follows. All Diameter answer messages defined in vendor-specific 4410 applications MUST include either one Result-Code AVP or one 4411 Experimental-Result AVP. 4413 7.7. Experimental-Result-Code AVP 4415 The Experimental-Result-Code AVP (AVP Code 298) is of type Unsigned32 4416 and contains a vendor-assigned value representing the result of 4417 processing the request. 4419 It is recommended that vendor-specific result codes follow the same 4420 conventions given for the Result-Code AVP regarding the different 4421 types of result codes and the handling of errors (for non 2xxx 4422 values). 4424 8. Diameter User Sessions 4426 In general, Diameter can provide two different types of services to 4427 applications. The first involves authentication and authorization, 4428 and can optionally make use of accounting. The second only makes use 4429 of accounting. 4431 When a service makes use of the authentication and/or authorization 4432 portion of an application, and a user requests access to the network, 4433 the Diameter client issues an auth request to its local server. The 4434 auth request is defined in a service-specific Diameter application 4435 (e.g., NASREQ). The request contains a Session-Id AVP, which is used 4436 in subsequent messages (e.g., subsequent authorization, accounting, 4437 etc) relating to the user's session. The Session-Id AVP is a means 4438 for the client and servers to correlate a Diameter message with a 4439 user session. 4441 When a Diameter server authorizes a user to use network resources for 4442 a finite amount of time, and it is willing to extend the 4443 authorization via a future request, it MUST add the Authorization- 4444 Lifetime AVP to the answer message. The Authorization-Lifetime AVP 4445 defines the maximum number of seconds a user MAY make use of the 4446 resources before another authorization request is expected by the 4447 server. The Auth-Grace-Period AVP contains the number of seconds 4448 following the expiration of the Authorization-Lifetime, after which 4449 the server will release all state information related to the user's 4450 session. Note that if payment for services is expected by the 4451 serving realm from the user's home realm, the Authorization-Lifetime 4452 AVP, combined with the Auth-Grace-Period AVP, implies the maximum 4453 length of the session the home realm is willing to be fiscally 4454 responsible for. Services provided past the expiration of the 4455 Authorization-Lifetime and Auth-Grace-Period AVPs are the 4456 responsibility of the access device. Of course, the actual cost of 4457 services rendered is clearly outside the scope of the protocol. 4459 An access device that does not expect to send a re-authorization or a 4460 session termination request to the server MAY include the Auth- 4461 Session-State AVP with the value set to NO_STATE_MAINTAINED as a hint 4462 to the server. If the server accepts the hint, it agrees that since 4463 no session termination message will be received once service to the 4464 user is terminated, it cannot maintain state for the session. If the 4465 answer message from the server contains a different value in the 4466 Auth-Session-State AVP (or the default value if the AVP is absent), 4467 the access device MUST follow the server's directives. Note that the 4468 value NO_STATE_MAINTAINED MUST NOT be set in subsequent re- 4469 authorization requests and answers. 4471 The base protocol does not include any authorization request 4472 messages, since these are largely application-specific and are 4473 defined in a Diameter application document. However, the base 4474 protocol does define a set of messages that are used to terminate 4475 user sessions. These are used to allow servers that maintain state 4476 information to free resources. 4478 When a service only makes use of the Accounting portion of the 4479 Diameter protocol, even in combination with an application, the 4480 Session-Id is still used to identify user sessions. However, the 4481 session termination messages are not used, since a session is 4482 signaled as being terminated by issuing an accounting stop message. 4484 Diameter may also be used for services that cannot be easily 4485 categorized as authentication, authorization or accounting (e.g., 4486 certain 3GPP IMS interfaces). In such cases, the finite state 4487 machine defined in subsequent sections may not be applicable. 4488 Therefore, the applications itself MAY need to define its own finite 4489 state machine. However, such application-specific state machines 4490 SHOULD follow the general state machine framework outlined in this 4491 document such as the use of Session-Id AVPs and the use of STR/STA, 4492 ASR/ASA messages for stateful sessions. 4494 8.1. Authorization Session State Machine 4496 This section contains a set of finite state machines, representing 4497 the life cycle of Diameter sessions, and which MUST be observed by 4498 all Diameter implementations that make use of the authentication 4499 and/or authorization portion of a Diameter application. The term 4500 Service-Specific below refers to a message defined in a Diameter 4501 application (e.g., Mobile IPv4, NASREQ). 4503 There are four different authorization session state machines 4504 supported in the Diameter base protocol. The first two describe a 4505 session in which the server is maintaining session state, indicated 4506 by the value of the Auth-Session-State AVP (or its absence). One 4507 describes the session from a client perspective, the other from a 4508 server perspective. The second two state machines are used when the 4509 server does not maintain session state. Here again, one describes 4510 the session from a client perspective, the other from a server 4511 perspective. 4513 When a session is moved to the Idle state, any resources that were 4514 allocated for the particular session must be released. Any event not 4515 listed in the state machines MUST be considered as an error 4516 condition, and an answer, if applicable, MUST be returned to the 4517 originator of the message. 4519 In the case that an application does not support re-auth, the state 4520 transitions related to server-initiated re-auth when both client and 4521 server session maintains state (e.g., Send RAR, Pending, Receive RAA) 4522 MAY be ignored. 4524 In the state table, the event 'Failure to send X' means that the 4525 Diameter agent is unable to send command X to the desired 4526 destination. This could be due to the peer being down, or due to the 4527 peer sending back a transient failure or temporary protocol error 4528 notification DIAMETER_TOO_BUSY or DIAMETER_LOOP_DETECTED in the 4529 Result-Code AVP of the corresponding Answer command. The event 'X 4530 successfully sent' is the complement of 'Failure to send X'. 4532 The following state machine is observed by a client when state is 4533 maintained on the server: 4535 CLIENT, STATEFUL 4536 State Event Action New State 4537 --------------------------------------------------------------- 4538 Idle Client or Device Requests Send Pending 4539 access service 4540 specific 4541 auth req 4543 Idle ASR Received Send ASA Idle 4544 for unknown session with 4545 Result-Code = 4546 UNKNOWN_ 4547 SESSION_ID 4549 Idle RAR Received Send RAA Idle 4550 for unknown session with 4551 Result-Code = 4552 UNKNOWN_ 4553 SESSION_ID 4555 Pending Successful Service-specific Grant Open 4556 authorization answer Access 4557 received with default 4558 Auth-Session-State value 4560 Pending Successful Service-specific Sent STR Discon 4561 authorization answer received 4562 but service not provided 4564 Pending Error processing successful Sent STR Discon 4565 Service-specific authorization 4566 answer 4568 Pending Failed Service-specific Cleanup Idle 4569 authorization answer received 4571 Open User or client device Send Open 4572 requests access to service service 4573 specific 4574 auth req 4576 Open Successful Service-specific Provide Open 4577 authorization answer received Service 4579 Open Failed Service-specific Discon. Idle 4580 authorization answer user/device 4581 received. 4583 Open RAR received and client will Send RAA Open 4584 perform subsequent re-auth with 4585 Result-Code = 4586 SUCCESS 4588 Open RAR received and client will Send RAA Idle 4589 not perform subsequent with 4590 re-auth Result-Code != 4591 SUCCESS, 4592 Discon. 4593 user/device 4595 Open Session-Timeout Expires on Send STR Discon 4596 Access Device 4598 Open ASR Received, Send ASA Discon 4599 client will comply with 4600 with request to end the Result-Code = 4601 session = SUCCESS, 4602 Send STR. 4604 Open ASR Received, Send ASA Open 4605 client will not comply with 4606 with request to end the Result-Code != 4607 session != SUCCESS 4609 Open Authorization-Lifetime + Send STR Discon 4610 Auth-Grace-Period expires on 4611 access device 4613 Discon ASR Received Send ASA Discon 4615 Discon STA Received Discon. Idle 4616 user/device 4618 The following state machine is observed by a server when it is 4619 maintaining state for the session: 4621 SERVER, STATEFUL 4622 State Event Action New State 4623 --------------------------------------------------------------- 4624 Idle Service-specific authorization Send Open 4625 request received, and successful 4626 user is authorized serv. 4627 specific 4628 answer 4630 Idle Service-specific authorization Send Idle 4631 request received, and failed serv. 4632 user is not authorized specific 4633 answer 4635 Open Service-specific authorization Send Open 4636 request received, and user successful 4637 is authorized serv. specific 4638 answer 4640 Open Service-specific authorization Send Idle 4641 request received, and user failed serv. 4642 is not authorized specific 4643 answer, 4644 Cleanup 4646 Open Home server wants to confirm Send RAR Pending 4647 authentication and/or 4648 authorization of the user 4650 Pending Received RAA with a failed Cleanup Idle 4651 Result-Code 4653 Pending Received RAA with Result-Code Update Open 4654 = SUCCESS session 4656 Open Home server wants to Send ASR Discon 4657 terminate the service 4659 Open Authorization-Lifetime (and Cleanup Idle 4660 Auth-Grace-Period) expires 4661 on home server. 4663 Open Session-Timeout expires on Cleanup Idle 4664 home server 4666 Discon Failure to send ASR Wait, Discon 4667 resend ASR 4669 Discon ASR successfully sent and Cleanup Idle 4670 ASA Received with Result-Code 4672 Not ASA Received None No Change. 4673 Discon 4675 Any STR Received Send STA, Idle 4676 Cleanup. 4678 The following state machine is observed by a client when state is not 4679 maintained on the server: 4681 CLIENT, STATELESS 4682 State Event Action New State 4683 --------------------------------------------------------------- 4684 Idle Client or Device Requests Send Pending 4685 access service 4686 specific 4687 auth req 4689 Pending Successful Service-specific Grant Open 4690 authorization answer Access 4691 received with Auth-Session- 4692 State set to 4693 NO_STATE_MAINTAINED 4695 Pending Failed Service-specific Cleanup Idle 4696 authorization answer 4697 received 4699 Open Session-Timeout Expires on Discon. Idle 4700 Access Device user/device 4702 Open Service to user is terminated Discon. Idle 4703 user/device 4705 The following state machine is observed by a server when it is not 4706 maintaining state for the session: 4708 SERVER, STATELESS 4709 State Event Action New State 4710 --------------------------------------------------------------- 4711 Idle Service-specific authorization Send serv. Idle 4712 request received, and specific 4713 successfully processed answer 4715 8.2. Accounting Session State Machine 4717 The following state machines MUST be supported for applications that 4718 have an accounting portion or that require only accounting services. 4719 The first state machine is to be observed by clients. 4721 See Section 9.7 for Accounting Command Codes and Section 9.8 for 4722 Accounting AVPs. 4724 The server side in the accounting state machine depends in some cases 4725 on the particular application. The Diameter base protocol defines a 4726 default state machine that MUST be followed by all applications that 4727 have not specified other state machines. This is the second state 4728 machine in this section described below. 4730 The default server side state machine requires the reception of 4731 accounting records in any order and at any time, and does not place 4732 any standards requirement on the processing of these records. 4733 Implementations of Diameter may perform checking, ordering, 4734 correlation, fraud detection, and other tasks based on these records. 4735 AVPs may need to be inspected as a part of these tasks. The tasks 4736 can happen either immediately after record reception or in a post- 4737 processing phase. However, as these tasks are typically application 4738 or even policy dependent, they are not standardized by the Diameter 4739 specifications. Applications MAY define requirements on when to 4740 accept accounting records based on the used value of Accounting- 4741 Realtime-Required AVP, credit limits checks, and so on. 4743 However, the Diameter base protocol defines one optional server side 4744 state machine that MAY be followed by applications that require 4745 keeping track of the session state at the accounting server. Note 4746 that such tracking is incompatible with the ability to sustain long 4747 duration connectivity problems. Therefore, the use of this state 4748 machine is recommended only in applications where the value of the 4749 Accounting-Realtime-Required AVP is DELIVER_AND_GRANT, and hence 4750 accounting connectivity problems are required to cause the serviced 4751 user to be disconnected. Otherwise, records produced by the client 4752 may be lost by the server which no longer accepts them after the 4753 connectivity is re-established. This state machine is the third 4754 state machine in this section. The state machine is supervised by a 4755 supervision session timer Ts, which the value should be reasonably 4756 higher than the Acct_Interim_Interval value. Ts MAY be set to two 4757 times the value of the Acct_Interim_Interval so as to avoid the 4758 accounting session in the Diameter server to change to Idle state in 4759 case of short transient network failure. 4761 Any event not listed in the state machines MUST be considered as an 4762 error condition, and a corresponding answer, if applicable, MUST be 4763 returned to the originator of the message. 4765 In the state table, the event 'Failure to send' means that the 4766 Diameter client is unable to communicate with the desired 4767 destination. This could be due to the peer being down, or due to the 4768 peer sending back a transient failure or temporary protocol error 4769 notification DIAMETER_OUT_OF_SPACE, DIAMETER_TOO_BUSY, or 4770 DIAMETER_LOOP_DETECTED in the Result-Code AVP of the Accounting 4771 Answer command. 4773 The event 'Failed answer' means that the Diameter client received a 4774 non-transient failure notification in the Accounting Answer command. 4776 Note that the action 'Disconnect user/dev' MUST have an effect also 4777 to the authorization session state table, e.g., cause the STR message 4778 to be sent, if the given application has both authentication/ 4779 authorization and accounting portions. 4781 The states PendingS, PendingI, PendingL, PendingE and PendingB stand 4782 for pending states to wait for an answer to an accounting request 4783 related to a Start, Interim, Stop, Event or buffered record, 4784 respectively. 4786 CLIENT, ACCOUNTING 4787 State Event Action New State 4788 --------------------------------------------------------------- 4789 Idle Client or device requests Send PendingS 4790 access accounting 4791 start req. 4793 Idle Client or device requests Send PendingE 4794 a one-time service accounting 4795 event req 4797 Idle Records in storage Send PendingB 4798 record 4800 PendingS Successful accounting Open 4801 start answer received 4803 PendingS Failure to send and buffer Store Open 4804 space available and realtime Start 4805 not equal to DELIVER_AND_GRANT Record 4807 PendingS Failure to send and no buffer Open 4808 space available and realtime 4809 equal to GRANT_AND_LOSE 4811 PendingS Failure to send and no Disconnect Idle 4812 buffer space available and user/dev 4813 realtime not equal to 4814 GRANT_AND_LOSE 4816 PendingS Failed accounting start answer Open 4817 received and realtime equal 4818 to GRANT_AND_LOSE 4820 PendingS Failed accounting start answer Disconnect Idle 4821 received and realtime not user/dev 4822 equal to GRANT_AND_LOSE 4824 PendingS User service terminated Store PendingS 4825 stop 4826 record 4828 Open Interim interval elapses Send PendingI 4829 accounting 4830 interim 4831 record 4832 Open User service terminated Send PendingL 4833 accounting 4834 stop req. 4836 PendingI Successful accounting interim Open 4837 answer received 4839 PendingI Failure to send and (buffer Store Open 4840 space available or old interim 4841 record can be overwritten) record 4842 and realtime not equal to 4843 DELIVER_AND_GRANT 4845 PendingI Failure to send and no buffer Open 4846 space available and realtime 4847 equal to GRANT_AND_LOSE 4849 PendingI Failure to send and no Disconnect Idle 4850 buffer space available and user/dev 4851 realtime not equal to 4852 GRANT_AND_LOSE 4854 PendingI Failed accounting interim Open 4855 answer received and realtime 4856 equal to GRANT_AND_LOSE 4858 PendingI Failed accounting interim Disconnect Idle 4859 answer received and user/dev 4860 realtime not equal to 4861 GRANT_AND_LOSE 4863 PendingI User service terminated Store PendingI 4864 stop 4865 record 4866 PendingE Successful accounting Idle 4867 event answer received 4869 PendingE Failure to send and buffer Store Idle 4870 space available event 4871 record 4873 PendingE Failure to send and no buffer Idle 4874 space available 4876 PendingE Failed accounting event answer Idle 4877 received 4879 PendingB Successful accounting answer Delete Idle 4880 received record 4882 PendingB Failure to send Idle 4884 PendingB Failed accounting answer Delete Idle 4885 received record 4887 PendingL Successful accounting Idle 4888 stop answer received 4890 PendingL Failure to send and buffer Store Idle 4891 space available stop 4892 record 4894 PendingL Failure to send and no buffer Idle 4895 space available 4897 PendingL Failed accounting stop answer Idle 4898 received 4900 SERVER, STATELESS ACCOUNTING 4901 State Event Action New State 4902 --------------------------------------------------------------- 4904 Idle Accounting start request Send Idle 4905 received, and successfully accounting 4906 processed. start 4907 answer 4909 Idle Accounting event request Send Idle 4910 received, and successfully accounting 4911 processed. event 4912 answer 4914 Idle Interim record received, Send Idle 4915 and successfully processed. accounting 4916 interim 4917 answer 4919 Idle Accounting stop request Send Idle 4920 received, and successfully accounting 4921 processed stop answer 4923 Idle Accounting request received, Send Idle 4924 no space left to store accounting 4925 records answer, 4926 Result-Code = 4927 OUT_OF_ 4928 SPACE 4930 SERVER, STATEFUL ACCOUNTING 4931 State Event Action New State 4932 --------------------------------------------------------------- 4934 Idle Accounting start request Send Open 4935 received, and successfully accounting 4936 processed. start 4937 answer, 4938 Start Ts 4940 Idle Accounting event request Send Idle 4941 received, and successfully accounting 4942 processed. event 4943 answer 4945 Idle Accounting request received, Send Idle 4946 no space left to store accounting 4947 records answer, 4948 Result-Code = 4949 OUT_OF_ 4950 SPACE 4952 Open Interim record received, Send Open 4953 and successfully processed. accounting 4954 interim 4955 answer, 4956 Restart Ts 4958 Open Accounting stop request Send Idle 4959 received, and successfully accounting 4960 processed stop answer, 4961 Stop Ts 4963 Open Accounting request received, Send Idle 4964 no space left to store accounting 4965 records answer, 4966 Result-Code = 4967 OUT_OF_ 4968 SPACE, 4969 Stop Ts 4971 Open Session supervision timer Ts Stop Ts Idle 4972 expired 4974 8.3. Server-Initiated Re-Auth 4976 A Diameter server may initiate a re-authentication and/or re- 4977 authorization service for a particular session by issuing a Re-Auth- 4978 Request (RAR). 4980 For example, for pre-paid services, the Diameter server that 4981 originally authorized a session may need some confirmation that the 4982 user is still using the services. 4984 An access device that receives a RAR message with Session-Id equal to 4985 a currently active session MUST initiate a re-auth towards the user, 4986 if the service supports this particular feature. Each Diameter 4987 application MUST state whether server-initiated re-auth is supported, 4988 since some applications do not allow access devices to prompt the 4989 user for re-auth. 4991 8.3.1. Re-Auth-Request 4993 The Re-Auth-Request (RAR), indicated by the Command-Code set to 258 4994 and the message flags' 'R' bit set, may be sent by any server to the 4995 access device that is providing session service, to request that the 4996 user be re-authenticated and/or re-authorized. 4998 Message Format 5000 ::= < Diameter Header: 258, REQ, PXY > 5001 < Session-Id > 5002 { Origin-Host } 5003 { Origin-Realm } 5004 { Destination-Realm } 5005 { Destination-Host } 5006 { Auth-Application-Id } 5007 { Re-Auth-Request-Type } 5008 [ User-Name ] 5009 [ Origin-State-Id ] 5010 * [ Proxy-Info ] 5011 * [ Route-Record ] 5012 * [ AVP ] 5014 8.3.2. Re-Auth-Answer 5016 The Re-Auth-Answer (RAA), indicated by the Command-Code set to 258 5017 and the message flags' 'R' bit clear, is sent in response to the RAR. 5018 The Result-Code AVP MUST be present, and indicates the disposition of 5019 the request. 5021 A successful RAA message MUST be followed by an application-specific 5022 authentication and/or authorization message. 5024 Message Format 5026 ::= < Diameter Header: 258, PXY > 5027 < Session-Id > 5028 { Result-Code } 5029 { Origin-Host } 5030 { Origin-Realm } 5031 [ User-Name ] 5032 [ Origin-State-Id ] 5033 [ Error-Message ] 5034 [ Error-Reporting-Host ] 5035 [ Failed-AVP ] 5036 * [ Redirect-Host ] 5037 [ Redirect-Host-Usage ] 5038 [ Redirect-Max-Cache-Time ] 5039 * [ Proxy-Info ] 5040 * [ AVP ] 5042 8.4. Session Termination 5044 It is necessary for a Diameter server that authorized a session, for 5045 which it is maintaining state, to be notified when that session is no 5046 longer active, both for tracking purposes as well as to allow 5047 stateful agents to release any resources that they may have provided 5048 for the user's session. For sessions whose state is not being 5049 maintained, this section is not used. 5051 When a user session that required Diameter authorization terminates, 5052 the access device that provided the service MUST issue a Session- 5053 Termination-Request (STR) message to the Diameter server that 5054 authorized the service, to notify it that the session is no longer 5055 active. An STR MUST be issued when a user session terminates for any 5056 reason, including user logoff, expiration of Session-Timeout, 5057 administrative action, termination upon receipt of an Abort-Session- 5058 Request (see below), orderly shutdown of the access device, etc. 5060 The access device also MUST issue an STR for a session that was 5061 authorized but never actually started. This could occur, for 5062 example, due to a sudden resource shortage in the access device, or 5063 because the access device is unwilling to provide the type of service 5064 requested in the authorization, or because the access device does not 5065 support a mandatory AVP returned in the authorization, etc. 5067 It is also possible that a session that was authorized is never 5068 actually started due to action of a proxy. For example, a proxy may 5069 modify an authorization answer, converting the result from success to 5070 failure, prior to forwarding the message to the access device. If 5071 the answer did not contain an Auth-Session-State AVP with the value 5072 NO_STATE_MAINTAINED, a proxy that causes an authorized session not to 5073 be started MUST issue an STR to the Diameter server that authorized 5074 the session, since the access device has no way of knowing that the 5075 session had been authorized. 5077 A Diameter server that receives an STR message MUST clean up 5078 resources (e.g., session state) associated with the Session-Id 5079 specified in the STR, and return a Session-Termination-Answer. 5081 A Diameter server also MUST clean up resources when the Session- 5082 Timeout expires, or when the Authorization-Lifetime and the Auth- 5083 Grace-Period AVPs expires without receipt of a re-authorization 5084 request, regardless of whether an STR for that session is received. 5085 The access device is not expected to provide service beyond the 5086 expiration of these timers; thus, expiration of either of these 5087 timers implies that the access device may have unexpectedly shut 5088 down. 5090 8.4.1. Session-Termination-Request 5092 The Session-Termination-Request (STR), indicated by the Command-Code 5093 set to 275 and the Command Flags' 'R' bit set, is sent by a Diameter 5094 client or by a Diameter proxy to inform the Diameter Server that an 5095 authenticated and/or authorized session is being terminated. 5097 Message Format 5099 ::= < Diameter Header: 275, REQ, PXY > 5100 < Session-Id > 5101 { Origin-Host } 5102 { Origin-Realm } 5103 { Destination-Realm } 5104 { Auth-Application-Id } 5105 { Termination-Cause } 5106 [ User-Name ] 5107 [ Destination-Host ] 5108 * [ Class ] 5109 [ Origin-State-Id ] 5110 * [ Proxy-Info ] 5111 * [ Route-Record ] 5112 * [ AVP ] 5114 8.4.2. Session-Termination-Answer 5116 The Session-Termination-Answer (STA), indicated by the Command-Code 5117 set to 275 and the message flags' 'R' bit clear, is sent by the 5118 Diameter Server to acknowledge the notification that the session has 5119 been terminated. The Result-Code AVP MUST be present, and MAY 5120 contain an indication that an error occurred while servicing the STR. 5122 Upon sending or receipt of the STA, the Diameter Server MUST release 5123 all resources for the session indicated by the Session-Id AVP. Any 5124 intermediate server in the Proxy-Chain MAY also release any 5125 resources, if necessary. 5127 Message Format 5129 ::= < Diameter Header: 275, PXY > 5130 < Session-Id > 5131 { Result-Code } 5132 { Origin-Host } 5133 { Origin-Realm } 5134 [ User-Name ] 5135 * [ Class ] 5136 [ Error-Message ] 5137 [ Error-Reporting-Host ] 5138 [ Failed-AVP ] 5139 [ Origin-State-Id ] 5140 * [ Redirect-Host ] 5141 [ Redirect-Host-Usage ] 5142 [ Redirect-Max-Cache-Time ] 5143 * [ Proxy-Info ] 5144 * [ AVP ] 5146 8.5. Aborting a Session 5148 A Diameter server may request that the access device stop providing 5149 service for a particular session by issuing an Abort-Session-Request 5150 (ASR). 5152 For example, the Diameter server that originally authorized the 5153 session may be required to cause that session to be stopped for lack 5154 of credit or other reasons that were not anticipated when the session 5155 was first authorized. 5157 An access device that receives an ASR with Session-ID equal to a 5158 currently active session MAY stop the session. Whether the access 5159 device stops the session or not is implementation- and/or 5160 configuration-dependent. For example, an access device may honor 5161 ASRs from certain agents only. In any case, the access device MUST 5162 respond with an Abort-Session-Answer, including a Result-Code AVP to 5163 indicate what action it took. 5165 8.5.1. Abort-Session-Request 5167 The Abort-Session-Request (ASR), indicated by the Command-Code set to 5168 274 and the message flags' 'R' bit set, may be sent by any Diameter 5169 server or any Diameter proxy to the access device that is providing 5170 session service, to request that the session identified by the 5171 Session-Id be stopped. 5173 Message Format 5175 ::= < Diameter Header: 274, REQ, PXY > 5176 < Session-Id > 5177 { Origin-Host } 5178 { Origin-Realm } 5179 { Destination-Realm } 5180 { Destination-Host } 5181 { Auth-Application-Id } 5182 [ User-Name ] 5183 [ Origin-State-Id ] 5184 * [ Proxy-Info ] 5185 * [ Route-Record ] 5186 * [ AVP ] 5188 8.5.2. Abort-Session-Answer 5190 The Abort-Session-Answer (ASA), indicated by the Command-Code set to 5191 274 and the message flags' 'R' bit clear, is sent in response to the 5192 ASR. The Result-Code AVP MUST be present, and indicates the 5193 disposition of the request. 5195 If the session identified by Session-Id in the ASR was successfully 5196 terminated, Result-Code is set to DIAMETER_SUCCESS. If the session 5197 is not currently active, Result-Code is set to 5198 DIAMETER_UNKNOWN_SESSION_ID. If the access device does not stop the 5199 session for any other reason, Result-Code is set to 5200 DIAMETER_UNABLE_TO_COMPLY. 5202 Message Format 5204 ::= < Diameter Header: 274, PXY > 5205 < Session-Id > 5206 { Result-Code } 5207 { Origin-Host } 5208 { Origin-Realm } 5209 [ User-Name ] 5210 [ Origin-State-Id ] 5211 [ Error-Message ] 5212 [ Error-Reporting-Host ] 5213 [ Failed-AVP ] 5214 * [ Redirect-Host ] 5215 [ Redirect-Host-Usage ] 5216 [ Redirect-Max-Cache-Time ] 5217 * [ Proxy-Info ] 5218 * [ AVP ] 5220 8.6. Inferring Session Termination from Origin-State-Id 5222 The Origin-State-Id is used to allow detection of terminated sessions 5223 for which no STR would have been issued, due to unanticipated 5224 shutdown of an access device. 5226 A Diameter client or access device increments the value of the 5227 Origin-State-Id every time it is started or powered-up. The new 5228 Origin-State-Id is then sent in the CER/CEA message immediately upon 5229 connection to the server. The Diameter server receiving the new 5230 Origin-State-Id can determine whether the sending Diameter client had 5231 abruptly shutdown by comparing the old value of the Origin-State-Id 5232 it has kept for that specific client is less than the new value and 5233 whether it has un-terminated sessions originating from that client. 5235 An access device can also include the Origin-State-Id in request 5236 messages other than CER if there are relays or proxies in between the 5237 access device and the server. In this case, however, the server 5238 cannot discover that the access device has been restarted unless and 5239 until it receives a new request from it. Therefore this mechanism is 5240 more opportunistic across proxies and relays. 5242 The Diameter server may assume that all sessions that were active 5243 prior to detection of a client restart have been terminated. The 5244 Diameter server MAY clean up all session state associated with such 5245 lost sessions, and MAY also issues STRs for all such lost sessions 5246 that were authorized on upstream servers, to allow session state to 5247 be cleaned up globally. 5249 8.7. Auth-Request-Type AVP 5251 The Auth-Request-Type AVP (AVP Code 274) is of type Enumerated and is 5252 included in application-specific auth requests to inform the peers 5253 whether a user is to be authenticated only, authorized only or both. 5254 Note any value other than both MAY cause RADIUS interoperability 5255 issues. The following values are defined: 5257 AUTHENTICATE_ONLY 1 5259 The request being sent is for authentication only, and MUST 5260 contain the relevant application specific authentication AVPs that 5261 are needed by the Diameter server to authenticate the user. 5263 AUTHORIZE_ONLY 2 5265 The request being sent is for authorization only, and MUST contain 5266 the application-specific authorization AVPs that are necessary to 5267 identify the service being requested/offered. 5269 AUTHORIZE_AUTHENTICATE 3 5271 The request contains a request for both authentication and 5272 authorization. The request MUST include both the relevant 5273 application-specific authentication information, and authorization 5274 information necessary to identify the service being requested/ 5275 offered. 5277 8.8. Session-Id AVP 5279 The Session-Id AVP (AVP Code 263) is of type UTF8String and is used 5280 to identify a specific session (see Section 8). All messages 5281 pertaining to a specific session MUST include only one Session-Id AVP 5282 and the same value MUST be used throughout the life of a session. 5283 When present, the Session-Id SHOULD appear immediately following the 5284 Diameter Header (see Section 3). 5286 The Session-Id MUST be globally and eternally unique, as it is meant 5287 to uniquely identify a user session without reference to any other 5288 information, and may be needed to correlate historical authentication 5289 information with accounting information. The Session-Id includes a 5290 mandatory portion and an implementation-defined portion; a 5291 recommended format for the implementation-defined portion is outlined 5292 below. 5294 The Session-Id MUST begin with the sender's identity encoded in the 5295 DiameterIdentity type (see Section 4.3.1). The remainder of the 5296 Session-Id is delimited by a ";" character, and MAY be any sequence 5297 that the client can guarantee to be eternally unique; however, the 5298 following format is recommended, (square brackets [] indicate an 5299 optional element): 5301 ;;[;] 5303 and are decimal representations of the 5304 high and low 32 bits of a monotonically increasing 64-bit value. The 5305 64-bit value is rendered in two part to simplify formatting by 32-bit 5306 processors. At startup, the high 32 bits of the 64-bit value MAY be 5307 initialized to the time in NTP format [RFC5905], and the low 32 bits 5308 MAY be initialized to zero. This will for practical purposes 5309 eliminate the possibility of overlapping Session-Ids after a reboot, 5310 assuming the reboot process takes longer than a second. 5311 Alternatively, an implementation MAY keep track of the increasing 5312 value in non-volatile memory. 5314 is implementation specific but may include a modem's 5315 device Id, a layer 2 address, timestamp, etc. 5317 Example, in which there is no optional value: 5319 accesspoint7.example.com;1876543210;523 5321 Example, in which there is an optional value: 5323 accesspoint7.example.com;1876543210;523;mobile@200.1.1.88 5325 The Session-Id is created by the Diameter application initiating the 5326 session, which in most cases is done by the client. Note that a 5327 Session-Id MAY be used for both the authentication, authorization and 5328 accounting commands of a given application. 5330 8.9. Authorization-Lifetime AVP 5332 The Authorization-Lifetime AVP (AVP Code 291) is of type Unsigned32 5333 and contains the maximum number of seconds of service to be provided 5334 to the user before the user is to be re-authenticated and/or re- 5335 authorized. Care should be taken when the Authorization-Lifetime 5336 value is determined, since a low, non-zero, value could create 5337 significant Diameter traffic, which could congest both the network 5338 and the agents. 5340 A value of zero (0) means that immediate re-auth is necessary by the 5341 access device. The absence of this AVP, or a value of all ones 5342 (meaning all bits in the 32 bit field are set to one) means no re- 5343 auth is expected. 5345 If both this AVP and the Session-Timeout AVP are present in a 5346 message, the value of the latter MUST NOT be smaller than the 5347 Authorization-Lifetime AVP. 5349 An Authorization-Lifetime AVP MAY be present in re-authorization 5350 messages, and contains the number of seconds the user is authorized 5351 to receive service from the time the re-auth answer message is 5352 received by the access device. 5354 This AVP MAY be provided by the client as a hint of the maximum 5355 lifetime that it is willing to accept. The server MUST return a 5356 value that is equal to, or smaller, than the one provided by the 5357 client. 5359 8.10. Auth-Grace-Period AVP 5361 The Auth-Grace-Period AVP (AVP Code 276) is of type Unsigned32 and 5362 contains the number of seconds the Diameter server will wait 5363 following the expiration of the Authorization-Lifetime AVP before 5364 cleaning up resources for the session. 5366 8.11. Auth-Session-State AVP 5368 The Auth-Session-State AVP (AVP Code 277) is of type Enumerated and 5369 specifies whether state is maintained for a particular session. The 5370 client MAY include this AVP in requests as a hint to the server, but 5371 the value in the server's answer message is binding. The following 5372 values are supported: 5374 STATE_MAINTAINED 0 5376 This value is used to specify that session state is being 5377 maintained, and the access device MUST issue a session termination 5378 message when service to the user is terminated. This is the 5379 default value. 5381 NO_STATE_MAINTAINED 1 5383 This value is used to specify that no session termination messages 5384 will be sent by the access device upon expiration of the 5385 Authorization-Lifetime. 5387 8.12. Re-Auth-Request-Type AVP 5389 The Re-Auth-Request-Type AVP (AVP Code 285) is of type Enumerated and 5390 is included in application-specific auth answers to inform the client 5391 of the action expected upon expiration of the Authorization-Lifetime. 5392 If the answer message contains an Authorization-Lifetime AVP with a 5393 positive value, the Re-Auth-Request-Type AVP MUST be present in an 5394 answer message. The following values are defined: 5396 AUTHORIZE_ONLY 0 5398 An authorization only re-auth is expected upon expiration of the 5399 Authorization-Lifetime. This is the default value if the AVP is 5400 not present in answer messages that include the Authorization- 5401 Lifetime. 5403 AUTHORIZE_AUTHENTICATE 1 5405 An authentication and authorization re-auth is expected upon 5406 expiration of the Authorization-Lifetime. 5408 8.13. Session-Timeout AVP 5410 The Session-Timeout AVP (AVP Code 27) [RFC2865] is of type Unsigned32 5411 and contains the maximum number of seconds of service to be provided 5412 to the user before termination of the session. When both the 5413 Session-Timeout and the Authorization-Lifetime AVPs are present in an 5414 answer message, the former MUST be equal to or greater than the value 5415 of the latter. 5417 A session that terminates on an access device due to the expiration 5418 of the Session-Timeout MUST cause an STR to be issued, unless both 5419 the access device and the home server had previously agreed that no 5420 session termination messages would be sent (see Section 8). 5422 A Session-Timeout AVP MAY be present in a re-authorization answer 5423 message, and contains the remaining number of seconds from the 5424 beginning of the re-auth. 5426 A value of zero, or the absence of this AVP, means that this session 5427 has an unlimited number of seconds before termination. 5429 This AVP MAY be provided by the client as a hint of the maximum 5430 timeout that it is willing to accept. However, the server MAY return 5431 a value that is equal to, or smaller, than the one provided by the 5432 client. 5434 8.14. User-Name AVP 5436 The User-Name AVP (AVP Code 1) [RFC2865] is of type UTF8String, which 5437 contains the User-Name, in a format consistent with the NAI 5438 specification [RFC4282]. 5440 8.15. Termination-Cause AVP 5442 The Termination-Cause AVP (AVP Code 295) is of type Enumerated, and 5443 is used to indicate the reason why a session was terminated on the 5444 access device. The following values are defined: 5446 DIAMETER_LOGOUT 1 5448 The user initiated a disconnect 5450 DIAMETER_SERVICE_NOT_PROVIDED 2 5452 This value is used when the user disconnected prior to the receipt 5453 of the authorization answer message. 5455 DIAMETER_BAD_ANSWER 3 5457 This value indicates that the authorization answer received by the 5458 access device was not processed successfully. 5460 DIAMETER_ADMINISTRATIVE 4 5462 The user was not granted access, or was disconnected, due to 5463 administrative reasons, such as the receipt of a Abort-Session- 5464 Request message. 5466 DIAMETER_LINK_BROKEN 5 5468 The communication to the user was abruptly disconnected. 5470 DIAMETER_AUTH_EXPIRED 6 5472 The user's access was terminated since its authorized session time 5473 has expired. 5475 DIAMETER_USER_MOVED 7 5477 The user is receiving services from another access device. 5479 DIAMETER_SESSION_TIMEOUT 8 5481 The user's session has timed out, and service has been terminated. 5483 8.16. Origin-State-Id AVP 5485 The Origin-State-Id AVP (AVP Code 278), of type Unsigned32, is a 5486 monotonically increasing value that is advanced whenever a Diameter 5487 entity restarts with loss of previous state, for example upon reboot. 5488 Origin-State-Id MAY be included in any Diameter message, including 5489 CER. 5491 A Diameter entity issuing this AVP MUST create a higher value for 5492 this AVP each time its state is reset. A Diameter entity MAY set 5493 Origin-State-Id to the time of startup, or it MAY use an incrementing 5494 counter retained in non-volatile memory across restarts. 5496 The Origin-State-Id, if present, MUST reflect the state of the entity 5497 indicated by Origin-Host. If a proxy modifies Origin-Host, it MUST 5498 either remove Origin-State-Id or modify it appropriately as well. 5499 Typically, Origin-State-Id is used by an access device that always 5500 starts up with no active sessions; that is, any session active prior 5501 to restart will have been lost. By including Origin-State-Id in a 5502 message, it allows other Diameter entities to infer that sessions 5503 associated with a lower Origin-State-Id are no longer active. If an 5504 access device does not intend for such inferences to be made, it MUST 5505 either not include Origin-State-Id in any message, or set its value 5506 to 0. 5508 8.17. Session-Binding AVP 5510 The Session-Binding AVP (AVP Code 270) is of type Unsigned32, and MAY 5511 be present in application-specific authorization answer messages. If 5512 present, this AVP MAY inform the Diameter client that all future 5513 application-specific re-auth and Session-Termination-Request messages 5514 for this session MUST be sent to the same authorization server. 5516 This field is a bit mask, and the following bits have been defined: 5518 RE_AUTH 1 5520 When set, future re-auth messages for this session MUST NOT 5521 include the Destination-Host AVP. When cleared, the default 5522 value, the Destination-Host AVP MUST be present in all re-auth 5523 messages for this session. 5525 STR 2 5527 When set, the STR message for this session MUST NOT include the 5528 Destination-Host AVP. When cleared, the default value, the 5529 Destination-Host AVP MUST be present in the STR message for this 5530 session. 5532 ACCOUNTING 4 5534 When set, all accounting messages for this session MUST NOT 5535 include the Destination-Host AVP. When cleared, the default 5536 value, the Destination-Host AVP, if known, MUST be present in all 5537 accounting messages for this session. 5539 8.18. Session-Server-Failover AVP 5541 The Session-Server-Failover AVP (AVP Code 271) is of type Enumerated, 5542 and MAY be present in application-specific authorization answer 5543 messages that either do not include the Session-Binding AVP or 5544 include the Session-Binding AVP with any of the bits set to a zero 5545 value. If present, this AVP MAY inform the Diameter client that if a 5546 re-auth or STR message fails due to a delivery problem, the Diameter 5547 client SHOULD issue a subsequent message without the Destination-Host 5548 AVP. When absent, the default value is REFUSE_SERVICE. 5550 The following values are supported: 5552 REFUSE_SERVICE 0 5554 If either the re-auth or the STR message delivery fails, terminate 5555 service with the user, and do not attempt any subsequent attempts. 5557 TRY_AGAIN 1 5559 If either the re-auth or the STR message delivery fails, resend 5560 the failed message without the Destination-Host AVP present. 5562 ALLOW_SERVICE 2 5564 If re-auth message delivery fails, assume that re-authorization 5565 succeeded. If STR message delivery fails, terminate the session. 5567 TRY_AGAIN_ALLOW_SERVICE 3 5569 If either the re-auth or the STR message delivery fails, resend 5570 the failed message without the Destination-Host AVP present. If 5571 the second delivery fails for re-auth, assume re-authorization 5572 succeeded. If the second delivery fails for STR, terminate the 5573 session. 5575 8.19. Multi-Round-Time-Out AVP 5577 The Multi-Round-Time-Out AVP (AVP Code 272) is of type Unsigned32, 5578 and SHOULD be present in application-specific authorization answer 5579 messages whose Result-Code AVP is set to DIAMETER_MULTI_ROUND_AUTH. 5580 This AVP contains the maximum number of seconds that the access 5581 device MUST provide the user in responding to an authentication 5582 request. 5584 8.20. Class AVP 5586 The Class AVP (AVP Code 25) is of type OctetString and is used by 5587 Diameter servers to return state information to the access device. 5588 When one or more Class AVPs are present in application-specific 5589 authorization answer messages, they MUST be present in subsequent re- 5590 authorization, session termination and accounting messages. Class 5591 AVPs found in a re-authorization answer message override the ones 5592 found in any previous authorization answer message. Diameter server 5593 implementations SHOULD NOT return Class AVPs that require more than 5594 4096 bytes of storage on the Diameter client. A Diameter client that 5595 receives Class AVPs whose size exceeds local available storage MUST 5596 terminate the session. 5598 8.21. Event-Timestamp AVP 5600 The Event-Timestamp (AVP Code 55) is of type Time, and MAY be 5601 included in an Accounting-Request and Accounting-Answer messages to 5602 record the time that the reported event occurred, in seconds since 5603 January 1, 1900 00:00 UTC. 5605 9. Accounting 5607 This accounting protocol is based on a server directed model with 5608 capabilities for real-time delivery of accounting information. 5609 Several fault resilience methods [RFC2975] have been built in to the 5610 protocol in order minimize loss of accounting data in various fault 5611 situations and under different assumptions about the capabilities of 5612 the used devices. 5614 9.1. Server Directed Model 5616 The server directed model means that the device generating the 5617 accounting data gets information from either the authorization server 5618 (if contacted) or the accounting server regarding the way accounting 5619 data shall be forwarded. This information includes accounting record 5620 timeliness requirements. 5622 As discussed in [RFC2975], real-time transfer of accounting records 5623 is a requirement, such as the need to perform credit limit checks and 5624 fraud detection. Note that batch accounting is not a requirement, 5625 and is therefore not supported by Diameter. Should batched 5626 accounting be required in the future, a new Diameter application will 5627 need to be created, or it could be handled using another protocol. 5628 Note, however, that even if at the Diameter layer accounting requests 5629 are processed one by one, transport protocols used under Diameter 5630 typically batch several requests in the same packet under heavy 5631 traffic conditions. This may be sufficient for many applications. 5633 The authorization server (chain) directs the selection of proper 5634 transfer strategy, based on its knowledge of the user and 5635 relationships of roaming partnerships. The server (or agents) uses 5636 the Acct-Interim-Interval and Accounting-Realtime-Required AVPs to 5637 control the operation of the Diameter peer operating as a client. 5638 The Acct-Interim-Interval AVP, when present, instructs the Diameter 5639 node acting as a client to produce accounting records continuously 5640 even during a session. Accounting-Realtime-Required AVP is used to 5641 control the behavior of the client when the transfer of accounting 5642 records from the Diameter client is delayed or unsuccessful. 5644 The Diameter accounting server MAY override the interim interval or 5645 the realtime requirements by including the Acct-Interim-Interval or 5646 Accounting-Realtime-Required AVP in the Accounting-Answer message. 5647 When one of these AVPs is present, the latest value received SHOULD 5648 be used in further accounting activities for the same session. 5650 9.2. Protocol Messages 5652 A Diameter node that receives a successful authentication and/or 5653 authorization messages from the Diameter server SHOULD collect 5654 accounting information for the session. The Accounting-Request 5655 message is used to transmit the accounting information to the 5656 Diameter server, which MUST reply with the Accounting-Answer message 5657 to confirm reception. The Accounting-Answer message includes the 5658 Result-Code AVP, which MAY indicate that an error was present in the 5659 accounting message. The value of the Accounting-Realtime-Required 5660 AVP received earlier for the session in question may indicate that 5661 the user's session has to be terminated when a rejected Accounting- 5662 Request message was received. 5664 9.3. Accounting Application Extension and Requirements 5666 Each Diameter application (e.g., NASREQ, MobileIP), SHOULD define 5667 their Service-Specific AVPs that MUST be present in the Accounting- 5668 Request message in a section entitled "Accounting AVPs". The 5669 application MUST assume that the AVPs described in this document will 5670 be present in all Accounting messages, so only their respective 5671 service-specific AVPs need to be defined in that section. 5673 Applications have the option of using one or both of the following 5674 accounting application extension models: 5676 Split Accounting Service 5678 The accounting message will carry the Application Id of the 5679 Diameter base accounting application (see Section 2.4). 5680 Accounting messages may be routed to Diameter nodes other than the 5681 corresponding Diameter application. These nodes might be 5682 centralized accounting servers that provide accounting service for 5683 multiple different Diameter applications. These nodes MUST 5684 advertise the Diameter base accounting Application Id during 5685 capabilities exchange. 5687 Coupled Accounting Service 5689 The accounting messages will carry the Application Id of the 5690 application that is using it. The application itself will process 5691 the received accounting records or forward them to an accounting 5692 server. There is no accounting application advertisement required 5693 during capabilities exchange and the accounting messages will be 5694 routed the same as any of the other application messages. 5696 In cases where an application does not define its own accounting 5697 service, it is preferred that the split accounting model be used. 5699 9.4. Fault Resilience 5701 Diameter Base protocol mechanisms are used to overcome small message 5702 loss and network faults of temporary nature. 5704 Diameter peers acting as clients MUST implement the use of failover 5705 to guard against server failures and certain network failures. 5706 Diameter peers acting as agents or related off-line processing 5707 systems MUST detect duplicate accounting records caused by the 5708 sending of the same record to several servers and duplication of 5709 messages in transit. This detection MUST be based on the inspection 5710 of the Session-Id and Accounting-Record-Number AVP pairs. Appendix C 5711 discusses duplicate detection needs and implementation issues. 5713 Diameter clients MAY have non-volatile memory for the safe storage of 5714 accounting records over reboots or extended network failures, network 5715 partitions, and server failures. If such memory is available, the 5716 client SHOULD store new accounting records there as soon as the 5717 records are created and until a positive acknowledgement of their 5718 reception from the Diameter Server has been received. Upon a reboot, 5719 the client MUST starting sending the records in the non-volatile 5720 memory to the accounting server with appropriate modifications in 5721 termination cause, session length, and other relevant information in 5722 the records. 5724 A further application of this protocol may include AVPs to control 5725 how many accounting records may at most be stored in the Diameter 5726 client without committing them to the non-volatile memory or 5727 transferring them to the Diameter server. 5729 The client SHOULD NOT remove the accounting data from any of its 5730 memory areas before the correct Accounting-Answer has been received. 5731 The client MAY remove oldest, undelivered or yet unacknowledged 5732 accounting data if it runs out of resources such as memory. It is an 5733 implementation dependent matter for the client to accept new sessions 5734 under this condition. 5736 9.5. Accounting Records 5738 In all accounting records, the Session-Id AVP MUST be present; the 5739 User-Name AVP MUST be present if it is available to the Diameter 5740 client. 5742 Different types of accounting records are sent depending on the 5743 actual type of accounted service and the authorization server's 5744 directions for interim accounting. If the accounted service is a 5745 one-time event, meaning that the start and stop of the event are 5746 simultaneous, then the Accounting-Record-Type AVP MUST be present and 5747 set to the value EVENT_RECORD. 5749 If the accounted service is of a measurable length, then the AVP MUST 5750 use the values START_RECORD, STOP_RECORD, and possibly, 5751 INTERIM_RECORD. If the authorization server has not directed interim 5752 accounting to be enabled for the session, two accounting records MUST 5753 be generated for each service of type session. When the initial 5754 Accounting-Request for a given session is sent, the Accounting- 5755 Record-Type AVP MUST be set to the value START_RECORD. When the last 5756 Accounting-Request is sent, the value MUST be STOP_RECORD. 5758 If the authorization server has directed interim accounting to be 5759 enabled, the Diameter client MUST produce additional records between 5760 the START_RECORD and STOP_RECORD, marked INTERIM_RECORD. The 5761 production of these records is directed by Acct-Interim-Interval as 5762 well as any re-authentication or re-authorization of the session. 5763 The Diameter client MUST overwrite any previous interim accounting 5764 records that are locally stored for delivery, if a new record is 5765 being generated for the same session. This ensures that only one 5766 pending interim record can exist on an access device for any given 5767 session. 5769 A particular value of Accounting-Sub-Session-Id MUST appear only in 5770 one sequence of accounting records from a Diameter client, except for 5771 the purposes of retransmission. The one sequence that is sent MUST 5772 be either one record with Accounting-Record-Type AVP set to the value 5773 EVENT_RECORD, or several records starting with one having the value 5774 START_RECORD, followed by zero or more INTERIM_RECORD and a single 5775 STOP_RECORD. A particular Diameter application specification MUST 5776 define the type of sequences that MUST be used. 5778 9.6. Correlation of Accounting Records 5780 If an application uses accounting messages, it can correlate 5781 accounting records with a specific application session by using the 5782 Session-Id of the particular application session in the accounting 5783 messages. Accounting messages MAY also use a different Session-Id 5784 from that of the application sessions in which case other session 5785 related information is needed to perform correlation. 5787 In cases where an application requires multiple accounting sub- 5788 session, an Accounting-Sub-Session-Id AVP is used to differentiate 5789 each sub-session. The Session-Id would remain constant for all sub- 5790 sessions and is be used to correlate all the sub-sessions to a 5791 particular application session. Note that receiving a STOP_RECORD 5792 with no Accounting-Sub-Session-Id AVP when sub-sessions were 5793 originally used in the START_RECORD messages implies that all sub- 5794 sessions are terminated. 5796 There are also cases where an application needs to correlate multiple 5797 application sessions into a single accounting record; the accounting 5798 record may span multiple different Diameter applications and sessions 5799 used by the same user at a given time. In such cases, the Acct- 5800 Multi-Session-Id AVP is used. The Acct-Multi-Session-Id AVP SHOULD 5801 be signaled by the server to the access device (typically during 5802 authorization) when it determines that a request belongs to an 5803 existing session. The access device MUST then include the Acct- 5804 Multi-Session-Id AVP in all subsequent accounting messages. 5806 The Acct-Multi-Session-Id AVP MAY include the value of the original 5807 Session-Id. It's contents are implementation specific, but MUST be 5808 globally unique across other Acct-Multi-Session-Id, and MUST NOT 5809 change during the life of a session. 5811 A Diameter application document MUST define the exact concept of a 5812 session that is being accounted, and MAY define the concept of a 5813 multi-session. For instance, the NASREQ DIAMETER application treats 5814 a single PPP connection to a Network Access Server as one session, 5815 and a set of Multilink PPP sessions as one multi-session. 5817 9.7. Accounting Command-Codes 5819 This section defines Command-Code values that MUST be supported by 5820 all Diameter implementations that provide Accounting services. 5822 9.7.1. Accounting-Request 5824 The Accounting-Request (ACR) command, indicated by the Command-Code 5825 field set to 271 and the Command Flags' 'R' bit set, is sent by a 5826 Diameter node, acting as a client, in order to exchange accounting 5827 information with a peer. 5829 In addition to the AVPs listed below, Accounting-Request messages 5830 SHOULD include service-specific accounting AVPs. 5832 Message Format 5834 ::= < Diameter Header: 271, REQ, PXY > 5835 < Session-Id > 5836 { Origin-Host } 5837 { Origin-Realm } 5838 { Destination-Realm } 5839 { Accounting-Record-Type } 5840 { Accounting-Record-Number } 5841 [ Acct-Application-Id ] 5842 [ Vendor-Specific-Application-Id ] 5843 [ User-Name ] 5844 [ Destination-Host ] 5845 [ Accounting-Sub-Session-Id ] 5846 [ Acct-Session-Id ] 5847 [ Acct-Multi-Session-Id ] 5848 [ Acct-Interim-Interval ] 5849 [ Accounting-Realtime-Required ] 5850 [ Origin-State-Id ] 5851 [ Event-Timestamp ] 5852 * [ Proxy-Info ] 5853 * [ Route-Record ] 5854 * [ AVP ] 5856 9.7.2. Accounting-Answer 5858 The Accounting-Answer (ACA) command, indicated by the Command-Code 5859 field set to 271 and the Command Flags' 'R' bit cleared, is used to 5860 acknowledge an Accounting-Request command. The Accounting-Answer 5861 command contains the same Session-Id as the corresponding request. 5863 Only the target Diameter Server, known as the home Diameter Server, 5864 SHOULD respond with the Accounting-Answer command. 5866 In addition to the AVPs listed below, Accounting-Answer messages 5867 SHOULD include service-specific accounting AVPs. 5869 Message Format 5871 ::= < Diameter Header: 271, PXY > 5872 < Session-Id > 5873 { Result-Code } 5874 { Origin-Host } 5875 { Origin-Realm } 5876 { Accounting-Record-Type } 5877 { Accounting-Record-Number } 5878 [ Acct-Application-Id ] 5879 [ Vendor-Specific-Application-Id ] 5880 [ User-Name ] 5881 [ Accounting-Sub-Session-Id ] 5882 [ Acct-Session-Id ] 5883 [ Acct-Multi-Session-Id ] 5884 [ Error-Message ] 5885 [ Error-Reporting-Host ] 5886 [ Failed-AVP ] 5887 [ Acct-Interim-Interval ] 5888 [ Accounting-Realtime-Required ] 5889 [ Origin-State-Id ] 5890 [ Event-Timestamp ] 5891 * [ Proxy-Info ] 5892 * [ AVP ] 5894 9.8. Accounting AVPs 5896 This section contains AVPs that describe accounting usage information 5897 related to a specific session. 5899 9.8.1. Accounting-Record-Type AVP 5901 The Accounting-Record-Type AVP (AVP Code 480) is of type Enumerated 5902 and contains the type of accounting record being sent. The following 5903 values are currently defined for the Accounting-Record-Type AVP: 5905 EVENT_RECORD 1 5907 An Accounting Event Record is used to indicate that a one-time 5908 event has occurred (meaning that the start and end of the event 5909 are simultaneous). This record contains all information relevant 5910 to the service, and is the only record of the service. 5912 START_RECORD 2 5914 An Accounting Start, Interim, and Stop Records are used to 5915 indicate that a service of a measurable length has been given. An 5916 Accounting Start Record is used to initiate an accounting session, 5917 and contains accounting information that is relevant to the 5918 initiation of the session. 5920 INTERIM_RECORD 3 5922 An Interim Accounting Record contains cumulative accounting 5923 information for an existing accounting session. Interim 5924 Accounting Records SHOULD be sent every time a re-authentication 5925 or re-authorization occurs. Further, additional interim record 5926 triggers MAY be defined by application-specific Diameter 5927 applications. The selection of whether to use INTERIM_RECORD 5928 records is done by the Acct-Interim-Interval AVP. 5930 STOP_RECORD 4 5932 An Accounting Stop Record is sent to terminate an accounting 5933 session and contains cumulative accounting information relevant to 5934 the existing session. 5936 9.8.2. Acct-Interim-Interval AVP 5938 The Acct-Interim-Interval AVP (AVP Code 85) is of type Unsigned32 and 5939 is sent from the Diameter home authorization server to the Diameter 5940 client. The client uses information in this AVP to decide how and 5941 when to produce accounting records. With different values in this 5942 AVP, service sessions can result in one, two, or two+N accounting 5943 records, based on the needs of the home-organization. The following 5944 accounting record production behavior is directed by the inclusion of 5945 this AVP: 5947 1. The omission of the Acct-Interim-Interval AVP or its inclusion 5948 with Value field set to 0 means that EVENT_RECORD, START_RECORD, 5949 and STOP_RECORD are produced, as appropriate for the service. 5951 2. The inclusion of the AVP with Value field set to a non-zero value 5952 means that INTERIM_RECORD records MUST be produced between the 5953 START_RECORD and STOP_RECORD records. The Value field of this 5954 AVP is the nominal interval between these records in seconds. 5956 The Diameter node that originates the accounting information, 5957 known as the client, MUST produce the first INTERIM_RECORD record 5958 roughly at the time when this nominal interval has elapsed from 5959 the START_RECORD, the next one again as the interval has elapsed 5960 once more, and so on until the session ends and a STOP_RECORD 5961 record is produced. 5963 The client MUST ensure that the interim record production times 5964 are randomized so that large accounting message storms are not 5965 created either among records or around a common service start 5966 time. 5968 9.8.3. Accounting-Record-Number AVP 5970 The Accounting-Record-Number AVP (AVP Code 485) is of type Unsigned32 5971 and identifies this record within one session. As Session-Id AVPs 5972 are globally unique, the combination of Session-Id and Accounting- 5973 Record-Number AVPs is also globally unique, and can be used in 5974 matching accounting records with confirmations. An easy way to 5975 produce unique numbers is to set the value to 0 for records of type 5976 EVENT_RECORD and START_RECORD, and set the value to 1 for the first 5977 INTERIM_RECORD, 2 for the second, and so on until the value for 5978 STOP_RECORD is one more than for the last INTERIM_RECORD. 5980 9.8.4. Acct-Session-Id AVP 5982 The Acct-Session-Id AVP (AVP Code 44) is of type OctetString is only 5983 used when RADIUS/Diameter translation occurs. This AVP contains the 5984 contents of the RADIUS Acct-Session-Id attribute. 5986 9.8.5. Acct-Multi-Session-Id AVP 5988 The Acct-Multi-Session-Id AVP (AVP Code 50) is of type UTF8String, 5989 following the format specified in Section 8.8. The Acct-Multi- 5990 Session-Id AVP is used to link together multiple related accounting 5991 sessions, where each session would have a unique Session-Id, but the 5992 same Acct-Multi-Session-Id AVP. This AVP MAY be returned by the 5993 Diameter server in an authorization answer, and MUST be used in all 5994 accounting messages for the given session. 5996 9.8.6. Accounting-Sub-Session-Id AVP 5998 The Accounting-Sub-Session-Id AVP (AVP Code 287) is of type 5999 Unsigned64 and contains the accounting sub-session identifier. The 6000 combination of the Session-Id and this AVP MUST be unique per sub- 6001 session, and the value of this AVP MUST be monotonically increased by 6002 one for all new sub-sessions. The absence of this AVP implies no 6003 sub-sessions are in use, with the exception of an Accounting-Request 6004 whose Accounting-Record-Type is set to STOP_RECORD. A STOP_RECORD 6005 message with no Accounting-Sub-Session-Id AVP present will signal the 6006 termination of all sub-sessions for a given Session-Id. 6008 9.8.7. Accounting-Realtime-Required AVP 6010 The Accounting-Realtime-Required AVP (AVP Code 483) is of type 6011 Enumerated and is sent from the Diameter home authorization server to 6012 the Diameter client or in the Accounting-Answer from the accounting 6013 server. The client uses information in this AVP to decide what to do 6014 if the sending of accounting records to the accounting server has 6015 been temporarily prevented due to, for instance, a network problem. 6017 DELIVER_AND_GRANT 1 6019 The AVP with Value field set to DELIVER_AND_GRANT means that the 6020 service MUST only be granted as long as there is a connection to 6021 an accounting server. Note that the set of alternative accounting 6022 servers are treated as one server in this sense. Having to move 6023 the accounting record stream to a backup server is not a reason to 6024 discontinue the service to the user. 6026 GRANT_AND_STORE 2 6028 The AVP with Value field set to GRANT_AND_STORE means that service 6029 SHOULD be granted if there is a connection, or as long as records 6030 can still be stored as described in Section 9.4. 6032 This is the default behavior if the AVP isn't included in the 6033 reply from the authorization server. 6035 GRANT_AND_LOSE 3 6037 The AVP with Value field set to GRANT_AND_LOSE means that service 6038 SHOULD be granted even if the records cannot be delivered or 6039 stored. 6041 10. AVP Occurrence Tables 6043 The following tables presents the AVPs defined in this document, and 6044 specifies in which Diameter messages they MAY be present or not. 6045 AVPs that occur only inside a Grouped AVP are not shown in this 6046 table. 6048 The table uses the following symbols: 6050 0 The AVP MUST NOT be present in the message. 6052 0+ Zero or more instances of the AVP MAY be present in the 6053 message. 6055 0-1 Zero or one instance of the AVP MAY be present in the message. 6056 It is considered an error if there are more than one instance of 6057 the AVP. 6059 1 One instance of the AVP MUST be present in the message. 6061 1+ At least one instance of the AVP MUST be present in the 6062 message. 6064 10.1. Base Protocol Command AVP Table 6066 The table in this section is limited to the non-accounting Command 6067 Codes defined in this specification. 6069 +-----------------------------------------------+ 6070 | Command-Code | 6071 +---+---+---+---+---+---+---+---+---+---+---+---+ 6072 Attribute Name |CER|CEA|DPR|DPA|DWR|DWA|RAR|RAA|ASR|ASA|STR|STA| 6073 --------------------+---+---+---+---+---+---+---+---+---+---+---+---+ 6074 Acct-Interim- |0 |0 |0 |0 |0 |0 |0-1|0 |0 |0 |0 |0 | 6075 Interval | | | | | | | | | | | | | 6076 Accounting-Realtime-|0 |0 |0 |0 |0 |0 |0-1|0 |0 |0 |0 |0 | 6077 Required | | | | | | | | | | | | | 6078 Acct-Application-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6079 Auth-Application-Id |0+ |0+ |0 |0 |0 |0 |1 |0 |1 |0 |1 |0 | 6080 Auth-Grace-Period |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6081 Auth-Request-Type |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6082 Auth-Session-State |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6083 Authorization- |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6084 Lifetime | | | | | | | | | | | | | 6085 Class |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0+ |0+ | 6086 Destination-Host |0 |0 |0 |0 |0 |0 |1 |0 |1 |0 |0-1|0 | 6087 Destination-Realm |0 |0 |0 |0 |0 |0 |1 |0 |1 |0 |1 |0 | 6088 Disconnect-Cause |0 |0 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6089 Error-Message |0 |0-1|0 |0-1|0 |0-1|0 |0-1|0 |0-1|0 |0-1| 6090 Error-Reporting-Host|0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6091 Failed-AVP |0 |0+ |0 |0+ |0 |0+ |0 |0+ |0 |0+ |0 |0+ | 6092 Firmware-Revision |0-1|0-1|0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6093 Host-IP-Address |1+ |1+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6094 Inband-Security-Id |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6095 Multi-Round-Time-Out|0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6096 Origin-Host |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 | 6097 Origin-Realm |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 | 6098 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| 6099 Product-Name |1 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6100 Proxy-Info |0 |0 |0 |0 |0 |0 |0+ |0+ |0+ |0+ |0+ |0+ | 6101 Redirect-Host |0 |0 |0 |0 |0 |0 |0 |0+ |0 |0+ |0 |0+ | 6102 Redirect-Host-Usage |0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6103 Redirect-Max-Cache- |0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6104 Time | | | | | | | | | | | | | 6105 Result-Code |0 |1 |0 |1 |0 |1 |0 |1 |0 |1 |0 |1 | 6106 Re-Auth-Request-Type|0 |0 |0 |0 |0 |0 |1 |0 |0 |0 |0 |0 | 6107 Route-Record |0 |0 |0 |0 |0 |0 |0+ |0 |0+ |0 |0+ |0 | 6108 Session-Binding |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6109 Session-Id |0 |0 |0 |0 |0 |0 |1 |1 |1 |1 |1 |1 | 6110 Session-Server- |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6111 Failover | | | | | | | | | | | | | 6112 Session-Timeout |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6113 Supported-Vendor-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6114 Termination-Cause |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |1 |0 | 6115 User-Name |0 |0 |0 |0 |0 |0 |0-1|0-1|0-1|0-1|0-1|0-1| 6116 Vendor-Id |1 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6117 Vendor-Specific- |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6118 Application-Id | | | | | | | | | | | | | 6119 --------------------+---+---+---+---+---+---+---+---+---+---+---+---+ 6121 10.2. Accounting AVP Table 6123 The table in this section is used to represent which AVPs defined in 6124 this document are to be present in the Accounting messages. These 6125 AVP occurrence requirements are guidelines, which may be expanded, 6126 and/or overridden by application-specific requirements in the 6127 Diameter applications documents. 6129 +-----------+ 6130 | Command | 6131 | Code | 6132 +-----+-----+ 6133 Attribute Name | ACR | ACA | 6134 ------------------------------+-----+-----+ 6135 Acct-Interim-Interval | 0-1 | 0-1 | 6136 Acct-Multi-Session-Id | 0-1 | 0-1 | 6137 Accounting-Record-Number | 1 | 1 | 6138 Accounting-Record-Type | 1 | 1 | 6139 Acct-Session-Id | 0-1 | 0-1 | 6140 Accounting-Sub-Session-Id | 0-1 | 0-1 | 6141 Accounting-Realtime-Required | 0-1 | 0-1 | 6142 Acct-Application-Id | 0-1 | 0-1 | 6143 Auth-Application-Id | 0 | 0 | 6144 Class | 0+ | 0+ | 6145 Destination-Host | 0-1 | 0 | 6146 Destination-Realm | 1 | 0 | 6147 Error-Reporting-Host | 0 | 0+ | 6148 Event-Timestamp | 0-1 | 0-1 | 6149 Origin-Host | 1 | 1 | 6150 Origin-Realm | 1 | 1 | 6151 Proxy-Info | 0+ | 0+ | 6152 Route-Record | 0+ | 0 | 6153 Result-Code | 0 | 1 | 6154 Session-Id | 1 | 1 | 6155 Termination-Cause | 0 | 0 | 6156 User-Name | 0-1 | 0-1 | 6157 Vendor-Specific-Application-Id| 0-1 | 0-1 | 6158 ------------------------------+-----+-----+ 6160 11. IANA Considerations 6162 This section provides guidance to the Internet Assigned Numbers 6163 Authority (IANA) regarding registration of values related to the 6164 Diameter protocol, in accordance with [RFC5226]. Existing IANA 6165 registries and assignments put in place by [RFC3588] remain the same 6166 unless explicitly updated or deprecated in this section. 6168 11.1. AVP Header 6170 As defined in Section 4, the AVP header contains three fields that 6171 requires IANA namespace management; the AVP Code, Vendor-ID and Flags 6172 field. 6174 11.1.1. AVP Codes 6176 There are multiple namespaces. Vendors can have their own AVP Codes 6177 namespace which will be identified by their Vendor-ID (also known as 6178 Enterprise-Number) and they control the assignments of their vendor- 6179 specific AVP codes within their own namespace. The absence of a 6180 Vendor-ID or a Vendor-ID value of zero (0) identifies the IETF IANA 6181 controlled AVP Codes namespace. The AVP Codes and sometimes also 6182 possible values in an AVP are controlled and maintained by IANA. AVP 6183 Code 0 is not used. AVP Codes 1-255 are managed separately as RADIUS 6184 Attribute Types. Where a Vendor-Specific AVP is implemented by more 6185 than one vendor, allocation of global AVPs should be encouraged 6186 instead. 6188 AVPs may be allocated following Expert Review (or Designated Expert) 6189 with Specification Required [RFC5226]. A block allocation (release 6190 of more than 3 AVPs at a time for a given purpose) requires IETF 6191 Review. 6193 11.1.2. AVP Flags 6195 Section 4.1 describes the existing AVP Flags. The remaining bits can 6196 only be assigned via a Standards Action [RFC5226]. 6198 11.2. Diameter Header 6200 11.2.1. Command Codes 6202 For the Diameter Header, the command code namespace allocation has 6203 changed. The new allocation rules are as follows: 6205 The command code values 256 - 8,388,607 (0x100 to 0x7fffff) are 6206 for permanent, standard commands, allocated by IETF Review 6207 [RFC5226]. 6209 The values 8,388,608 - 16,777,213 (0x800000 - 0xfffffd) are 6210 reserved for vendor-specific command codes, to be allocated on a 6211 First Come, First Served basis by IANA [RFC5226]. The request to 6212 IANA for a Vendor-Specific Command Code SHOULD include a reference 6213 to a publicly available specification which documents the command 6214 in sufficient detail to aid in interoperability between 6215 independent implementations. If the specification cannot be made 6216 publicly available, the request for a vendor-specific command code 6217 MUST include the contact information of persons and/or entities 6218 responsible for authoring and maintaining the command. 6220 The values 16,777,214 and 16,777,215 (hexadecimal values 0xfffffe 6221 - 0xffffff) are reserved for experimental commands. As these 6222 codes are only for experimental and testing purposes, no guarantee 6223 is made for interoperability between Diameter peers using 6224 experimental commands. 6226 11.2.2. Command Flags 6228 Section 3 describes the existing Command Flag field. The remaining 6229 bits can only be assigned via a Standards Action [RFC5226]. 6231 11.3. AVP Values 6233 For AVP values, the Experimental-Result-Code AVP value allocation has 6234 been added, see Section 11.3.1. The old AVP value allocation rule 6235 IETF Consensus has been updated to IETF Review as per [RFC5226] and 6236 affected AVPs are listed as reminders. 6238 11.3.1. Experimental-Result-Code AVP 6240 Values for this AVP are purely local to the indicated vendor, and no 6241 IANA registry is maintained for them. 6243 11.3.2. Result-Code AVP Values 6245 New values are available for assignment via IETF Review [RFC5226]. 6247 11.3.3. Accounting-Record-Type AVP Values 6249 New values are available for assignment via IETF Review [RFC5226]. 6251 11.3.4. Termination-Cause AVP Values 6253 New values are available for assignment via IETF Review [RFC5226]. 6255 11.3.5. Redirect-Host-Usage AVP Values 6257 New values are available for assignment via IETF Review [RFC5226]. 6259 11.3.6. Session-Server-Failover AVP Values 6261 New values are available for assignment via IETF Review [RFC5226]. 6263 11.3.7. Session-Binding AVP Values 6265 New values are available for assignment via IETF Review [RFC5226]. 6267 11.3.8. Disconnect-Cause AVP Values 6269 New values are available for assignment via IETF Review [RFC5226]. 6271 11.3.9. Auth-Request-Type AVP Values 6273 New values are available for assignment via IETF Review [RFC5226]. 6275 11.3.10. Auth-Session-State AVP Values 6277 New values are available for assignment via IETF Review [RFC5226]. 6279 11.3.11. Re-Auth-Request-Type AVP Values 6281 New values are available for assignment via IETF Review [RFC5226]. 6283 11.3.12. Accounting-Realtime-Required AVP Values 6285 New values are available for assignment via IETF Review [RFC5226]. 6287 11.3.13. Inband-Security-Id AVP (code 299) 6289 The use of this AVP has been deprecated. 6291 11.4. _diameters Service Name and Port Number Registration 6293 This section requests the IANA to register the "_diameters" service 6294 name and assign port numbers for TLS/TCP and DTLS/SCTP according to 6295 the guidelines given in Cotton, et al. [RFC6335]. 6297 Service Name: _diameters 6299 Transport Protocols: TCP, SCTP 6301 Assignee: IESG 6303 Contact: IETF Chair 6305 Description: Diameter over TLS/TCP and DTLS/SCTP 6307 Reference: draft-ietf-dime-rfc3588bis 6309 Port Number: , from the User Range 6311 11.5. SCTP Payload Protocol Identifiers 6313 Two SCTP payload protocol identifiers are registered in SCTP Payload 6314 Protocol Identifier registry: 6316 Value | SCTP Payload Protocol Identifier 6317 -------|----------------------------------- 6318 | Diameter in a SCTP DATA chunk 6319 | Diameter in a DTLS/SCTP DATA chunk 6321 11.6. S-NAPTR Parameters 6323 This document also registers the following S-NAPTR Application 6324 Protocol Tags registry: 6326 Tag | Protocol 6327 -------------------|--------- 6328 diameter.dtls.sctp | DTLS/SCTP 6330 12. Diameter Protocol-related Configurable Parameters 6332 This section contains the configurable parameters that are found 6333 throughout this document: 6335 Diameter Peer 6337 A Diameter entity MAY communicate with peers that are statically 6338 configured. A statically configured Diameter peer would require 6339 that either the IP address or the fully qualified domain name 6340 (FQDN) be supplied, which would then be used to resolve through 6341 DNS. 6343 Routing Table 6345 A Diameter proxy server routes messages based on the realm portion 6346 of a Network Access Identifier (NAI). The server MUST have a 6347 table of Realm Names, and the address of the peer to which the 6348 message must be forwarded to. The routing table MAY also include 6349 a "default route", which is typically used for all messages that 6350 cannot be locally processed. 6352 Tc timer 6354 The Tc timer controls the frequency that transport connection 6355 attempts are done to a peer with whom no active transport 6356 connection exists. The recommended value is 30 seconds. 6358 13. Security Considerations 6360 The Diameter base protocol messages SHOULD be secured by using TLS 6361 [RFC5246] or DTLS/SCTP [RFC6083]. Additional security mechanisms 6362 such as IPsec [RFC4301] MAY also be deployed to secure connections 6363 between peers. However, all Diameter base protocol implementations 6364 MUST support the use of TLS/TCP and DTLS/SCTP and the Diameter 6365 protocol MUST NOT be used without one of TLS, DTLS or IPsec. 6367 If a Diameter connection is to be protected via TLS/TCP and DTLS/SCTP 6368 or IPsec, then TLS/TCP and DTLS/SCTP or IPsec/IKE SHOULD begin prior 6369 to any Diameter message exchange. All security parameters for TLS/ 6370 TCP and DTLS/SCTP or IPsec are configured independent of the Diameter 6371 protocol. All Diameter messages will be sent through the TLS/TCP and 6372 DTLS/SCTP or IPsec connection after a successful setup. 6374 For TLS/TCP and DTLS/SCTP connections to be established in the open 6375 state, the CER/CEA exchange MUST include an Inband-Security-ID AVP 6376 with a value of TLS/TCP and DTLS/SCTP. The TLS/TCP and DTLS/SCTP 6377 handshake will begin when both ends successfully reached the open 6378 state, after completion of the CER/CEA exchange. If the TLS/TCP and 6379 DTLS/SCTP handshake is successful, all further messages will be sent 6380 via TLS/TCP and DTLS/SCTP. If the handshake fails, both ends MUST 6381 move to the closed state. See Section 13.1 for more details. 6383 13.1. TLS/TCP and DTLS/SCTP Usage 6385 Diameter nodes using TLS/TCP and DTLS/SCTP for security MUST mutually 6386 authenticate as part of TLS/TCP and DTLS/SCTP session establishment. 6387 In order to ensure mutual authentication, the Diameter node acting as 6388 the TLS/TCP and DTLS/SCTP server MUST request a certificate from the 6389 Diameter node acting as TLS/TCP and DTLS/SCTP client, and the 6390 Diameter node acting as the TLS/TCP and DTLS/SCTP client MUST be 6391 prepared to supply a certificate on request. 6393 Diameter nodes MUST be able to negotiate the following TLS/TCP and 6394 DTLS/SCTP cipher suites: 6396 TLS_RSA_WITH_RC4_128_MD5 6397 TLS_RSA_WITH_RC4_128_SHA 6398 TLS_RSA_WITH_3DES_EDE_CBC_SHA 6400 Diameter nodes SHOULD be able to negotiate the following TLS/TCP and 6401 DTLS/SCTP cipher suite: 6403 TLS_RSA_WITH_AES_128_CBC_SHA 6405 Note that that it is quite possible that support for the 6406 TLS_RSA_WITH_AES_128_CBC_SHA ciphersuite will be REQUIRED at some 6407 future date. Diameter nodes MAY negotiate other TLS/TCP and DTLS/ 6408 SCTP cipher suites. 6410 If public key certificates are used for Diameter security (for 6411 example, with TLS), the value of the expiration times in the routing 6412 and peer tables MUST NOT be greater than the expiry time in the 6413 relevant certificates. 6415 13.2. Peer-to-Peer Considerations 6417 As with any peer-to-peer protocol, proper configuration of the trust 6418 model within a Diameter peer is essential to security. When 6419 certificates are used, it is necessary to configure the root 6420 certificate authorities trusted by the Diameter peer. These root CAs 6421 are likely to be unique to Diameter usage and distinct from the root 6422 CAs that might be trusted for other purposes such as Web browsing. 6423 In general, it is expected that those root CAs will be configured so 6424 as to reflect the business relationships between the organization 6425 hosting the Diameter peer and other organizations. As a result, a 6426 Diameter peer will typically not be configured to allow connectivity 6427 with any arbitrary peer. With certificate authentication, Diameter 6428 peers may not be known beforehand and therefore peer discovery may be 6429 required. 6431 13.3. AVP Considerations 6433 Diameter AVPs often contain security-sensitive data; for example, 6434 user passwords and location data, network addresses and cryptographic 6435 keys. The Diameter messages containing such AVPs MUST only be sent 6436 protected via mutually authenticated TLS or IPsec. In addition, 6437 those messages SHOULD NOT be sent via intermediate nodes that would 6438 expose the sensitive data at those nodes except in cases where an 6439 intermediary is known to be operated as part of the same 6440 administrative domain as the endpoints so that an ability to 6441 successfully compromise the intermediary would imply a high 6442 probability of being able to compromise the endpoints as well. 6444 14. References 6446 14.1. Normative References 6448 [FLOATPOINT] 6449 Institute of Electrical and Electronics Engineers, "IEEE 6450 Standard for Binary Floating-Point Arithmetic, ANSI/IEEE 6451 Standard 754-1985", August 1985. 6453 [IANAADFAM] 6454 IANA,, "Address Family Numbers", 6455 http://www.iana.org/assignments/address-family-numbers. 6457 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6458 Requirement Levels", BCP 14, RFC 2119, March 1997. 6460 [RFC3492] Costello, A., "Punycode: A Bootstring encoding of Unicode 6461 for Internationalized Domain Names in Applications 6462 (IDNA)", RFC 3492, March 2003. 6464 [RFC3539] Aboba, B. and J. Wood, "Authentication, Authorization and 6465 Accounting (AAA) Transport Profile", RFC 3539, June 2003. 6467 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 6468 10646", STD 63, RFC 3629, November 2003. 6470 [RFC3958] Daigle, L. and A. Newton, "Domain-Based Application 6471 Service Location Using SRV RRs and the Dynamic Delegation 6472 Discovery Service (DDDS)", RFC 3958, January 2005. 6474 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 6475 Resource Identifier (URI): Generic Syntax", STD 66, 6476 RFC 3986, January 2005. 6478 [RFC4004] Calhoun, P., Johansson, T., Perkins, C., Hiller, T., and 6479 P. McCann, "Diameter Mobile IPv4 Application", RFC 4004, 6480 August 2005. 6482 [RFC4005] Calhoun, P., Zorn, G., Spence, D., and D. Mitton, 6483 "Diameter Network Access Server Application", RFC 4005, 6484 August 2005. 6486 [RFC4006] Hakala, H., Mattila, L., Koskinen, J-P., Stura, M., and J. 6487 Loughney, "Diameter Credit-Control Application", RFC 4006, 6488 August 2005. 6490 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 6491 Requirements for Security", BCP 106, RFC 4086, June 2005. 6493 [RFC4282] Aboba, B., Beadles, M., Arkko, J., and P. Eronen, "The 6494 Network Access Identifier", RFC 4282, December 2005. 6496 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing 6497 Architecture", RFC 4291, February 2006. 6499 [RFC4960] Stewart, R., "Stream Control Transmission Protocol", 6500 RFC 4960, September 2007. 6502 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 6503 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 6504 May 2008. 6506 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 6507 Specifications: ABNF", STD 68, RFC 5234, January 2008. 6509 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 6510 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 6512 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 6513 Housley, R., and W. Polk, "Internet X.509 Public Key 6514 Infrastructure Certificate and Certificate Revocation List 6515 (CRL) Profile", RFC 5280, May 2008. 6517 [RFC5729] Korhonen, J., Jones, M., Morand, L., and T. Tsou, 6518 "Clarifications on the Routing of Diameter Requests Based 6519 on the Username and the Realm", RFC 5729, December 2009. 6521 [RFC5890] Klensin, J., "Internationalized Domain Names for 6522 Applications (IDNA): Definitions and Document Framework", 6523 RFC 5890, August 2010. 6525 [RFC5891] Klensin, J., "Internationalized Domain Names in 6526 Applications (IDNA): Protocol", RFC 5891, August 2010. 6528 [RFC6083] Tuexen, M., Seggelmann, R., and E. Rescorla, "Datagram 6529 Transport Layer Security (DTLS) for Stream Control 6530 Transmission Protocol (SCTP)", RFC 6083, January 2011. 6532 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 6533 Security Version 1.2", RFC 6347, January 2012. 6535 [RFC6408] Jones, M., Korhonen, J., and L. Morand, "Diameter 6536 Straightforward-Naming Authority Pointer (S-NAPTR) Usage", 6537 RFC 6408, November 2011. 6539 [RFC791] Postel, J., "Internet Protocol", RFC 791, September 1981. 6541 [RFC793] Postel, J., "Transmission Control Protocol", RFC 793, 6542 January 1981. 6544 14.2. Informational References 6546 [ENTERPRISE] 6547 IANA, "SMI Network Management Private Enterprise Codes", 6548 http://www.iana.org/assignments/enterprise-numbers. 6550 [RFC1492] Finseth, C., "An Access Control Protocol, Sometimes Called 6551 TACACS", RFC 1492, July 1993. 6553 [RFC1661] Simpson, W., "The Point-to-Point Protocol (PPP)", STD 51, 6554 RFC 1661, July 1994. 6556 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 6557 Hashing for Message Authentication", RFC 2104, 6558 February 1997. 6560 [RFC2782] Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for 6561 specifying the location of services (DNS SRV)", RFC 2782, 6562 February 2000. 6564 [RFC2865] Rigney, C., Willens, S., Rubens, A., and W. Simpson, 6565 "Remote Authentication Dial In User Service (RADIUS)", 6566 RFC 2865, June 2000. 6568 [RFC2866] Rigney, C., "RADIUS Accounting", RFC 2866, June 2000. 6570 [RFC2869] Rigney, C., Willats, W., and P. Calhoun, "RADIUS 6571 Extensions", RFC 2869, June 2000. 6573 [RFC2975] Aboba, B., Arkko, J., and D. Harrington, "Introduction to 6574 Accounting Management", RFC 2975, October 2000. 6576 [RFC2989] Aboba, B., Calhoun, P., Glass, S., Hiller, T., McCann, P., 6577 Shiino, H., Walsh, P., Zorn, G., Dommety, G., Perkins, C., 6578 Patil, B., Mitton, D., Manning, S., Beadles, M., Chen, X., 6579 Sivalingham, S., Hameed, A., Munson, M., Jacobs, S., Lim, 6580 B., Hirschman, B., Hsu, R., Koo, H., Lipford, M., 6581 Campbell, E., Xu, Y., Baba, S., and E. Jaques, "Criteria 6582 for Evaluating AAA Protocols for Network Access", 6583 RFC 2989, November 2000. 6585 [RFC3162] Aboba, B., Zorn, G., and D. Mitton, "RADIUS and IPv6", 6586 RFC 3162, August 2001. 6588 [RFC3588] Calhoun, P., Loughney, J., Guttman, E., Zorn, G., and J. 6589 Arkko, "Diameter Base Protocol", RFC 3588, September 2003. 6591 [RFC3748] Aboba, B., Blunk, L., Vollbrecht, J., Carlson, J., and H. 6593 Levkowetz, "Extensible Authentication Protocol (EAP)", 6594 RFC 3748, June 2004. 6596 [RFC4301] Kent, S. and K. Seo, "Security Architecture for the 6597 Internet Protocol", RFC 4301, December 2005. 6599 [RFC4690] Klensin, J., Faltstrom, P., Karp, C., and IAB, "Review and 6600 Recommendations for Internationalized Domain Names 6601 (IDNs)", RFC 4690, September 2006. 6603 [RFC5176] Chiba, M., Dommety, G., Eklund, M., Mitton, D., and B. 6604 Aboba, "Dynamic Authorization Extensions to Remote 6605 Authentication Dial In User Service (RADIUS)", RFC 5176, 6606 January 2008. 6608 [RFC5461] Gont, F., "TCP's Reaction to Soft Errors", RFC 5461, 6609 February 2009. 6611 [RFC5905] Mills, D., Martin, J., Burbank, J., and W. Kasch, "Network 6612 Time Protocol Version 4: Protocol and Algorithms 6613 Specification", RFC 5905, June 2010. 6615 [RFC5927] Gont, F., "ICMP Attacks against TCP", RFC 5927, July 2010. 6617 [RFC6335] Cotton, M., Eggert, L., Touch, J., Westerlund, M., and S. 6618 Cheshire, "Internet Assigned Numbers Authority (IANA) 6619 Procedures for the Management of the Service Name and 6620 Transport Protocol Port Number Registry", BCP 165, 6621 RFC 6335, August 2011. 6623 Appendix A. Acknowledgements 6625 A.1. RFC3588bis 6627 The authors would like to thank the following people that have 6628 provided proposals and contributions to this document: 6630 To Vishnu Ram and Satendra Gera for their contributions on 6631 Capabilities Updates, and Predictive Loop Avoidance as well as many 6632 other technical proposals. To Tolga Asveren for his insights and 6633 contributions on almost all of the proposed solutions incorporated 6634 into this document. To Timothy Smith for helping on the Capabilities 6635 Update and other topics. To Tony Zhang for providing fixes to loop 6636 holes on composing Failed-AVPs as well as many other issues and 6637 topics. To Jan Nordqvist for clearly stating the usage of 6638 Application Ids. To Anders Kristensen for providing needed technical 6639 opinions. To David Frascone for providing invaluable review of the 6640 document. To Mark Jones for providing clarifying text on vendor 6641 command codes and other vendor specific indicators. To Jouni 6642 Korhonen for taking over the editing task and resolving last bits 6643 from -27 through -29. 6645 Special thanks to the Diameter extensibility design team which helped 6646 resolve the tricky question of mandatory AVPs and ABNF semantics. 6647 The members of this team are as follows: 6649 Avi Lior, Jari Arkko, Glen Zorn, Lionel Morand, Mark Jones, Tolga 6650 Asveren Jouni Korhonen, Glenn McGregor. 6652 Special thanks also to people who have provided invaluable comments 6653 and inputs especially in resolving controversial issues: 6655 Glen Zorn, Yoshihiro Ohba, Marco Stura, Stephen Farrel, Pete Resnick, 6656 Peter Saint-Andre, Robert Sparks, Krishna Prasad, Sean Turner, Barry 6657 Leiba and Pasi Eronen. 6659 Finally, we would like to thank the original authors of this 6660 document: 6662 Pat Calhoun, John Loughney, Jari Arkko, Erik Guttman and Glen Zorn. 6664 Their invaluable knowledge and experience has given us a robust and 6665 flexible AAA protocol that many people have seen great value in 6666 adopting. We greatly appreciate their support and stewardship for 6667 the continued improvements of Diameter as a protocol. We would also 6668 like to extend our gratitude to folks aside from the authors who have 6669 assisted and contributed to the original version of this document. 6670 Their efforts significantly contributed to the success of Diameter. 6672 A.2. RFC3588 6674 The authors would like to thank Nenad Trifunovic, Tony Johansson and 6675 Pankaj Patel for their participation in the pre-IETF Document Reading 6676 Party. Allison Mankin, Jonathan Wood and Bernard Aboba provided 6677 invaluable assistance in working out transport issues, and similarly 6678 with Steven Bellovin in the security area. 6680 Paul Funk and David Mitton were instrumental in getting the Peer 6681 State Machine correct, and our deep thanks go to them for their time. 6683 Text in this document was also provided by Paul Funk, Mark Eklund, 6684 Mark Jones and Dave Spence. Jacques Caron provided many great 6685 comments as a result of a thorough review of the spec. 6687 The authors would also like to acknowledge the following people for 6688 their contribution in the development of the Diameter protocol: 6690 Allan C. Rubens, Haseeb Akhtar, William Bulley, Stephen Farrell, 6691 David Frascone, Daniel C. Fox, Lol Grant, Ignacio Goyret, Nancy 6692 Greene, Peter Heitman, Fredrik Johansson, Mark Jones, Martin Julien, 6693 Bob Kopacz, Paul Krumviede, Fergal Ladley, Ryan Moats, Victor Muslin, 6694 Kenneth Peirce, John Schnizlein, Sumit Vakil, John R. Vollbrecht and 6695 Jeff Weisberg. 6697 Finally, Pat Calhoun would like to thank Sun Microsystems since most 6698 of the effort put into this document was done while he was in their 6699 employ. 6701 Appendix B. S-NAPTR Example 6703 As an example, consider a client that wishes to resolve aaa: 6704 ex1.example.com. The client performs a NAPTR query for that domain, 6705 and the following NAPTR records are returned: 6707 ;; order pref flags service regexp replacement 6708 IN NAPTR 50 50 "s" "aaa:diameter.tls.tcp" "" 6709 _diameter._tls.ex1.example.com 6710 IN NAPTR 100 50 "s" "aaa:diameter.tcp" "" 6711 _aaa._tcp.ex1.example.com 6712 IN NAPTR 150 50 "s" "aaa:diameter.sctp" "" 6713 _diameter._sctp.ex1.example.com 6715 This indicates that the server supports TLS, TCP and SCTP in that 6716 order. If the client supports TLS, TLS will be used, targeted to a 6717 host determined by an SRV lookup of _diameter._tls.ex1.example.com. 6718 That lookup would return: 6720 ;; Priority Weight Port Target 6721 IN SRV 0 1 5060 server1.ex1.example.com 6722 IN SRV 0 2 5060 server2.ex1.example.com 6724 As an alternative example, a client that wishes to resolve aaa: 6725 ex2.example.com. The client performs a NAPTR query for that domain, 6726 and the following NAPTR records are returned: 6728 ;; order pref flags service regexp replacement 6729 IN NAPTR 150 50 "a" "aaa:diameter.tls.tcp" "" 6730 server1.ex2.example.com 6731 IN NAPTR 150 50 "a" "aaa:diameter.tls.tcp" "" 6732 server2.ex2.example.com 6734 This indicates that the server supports TCP available at the returned 6735 host names. 6737 Appendix C. Duplicate Detection 6739 As described in Section 9.4, accounting record duplicate detection is 6740 based on session identifiers. Duplicates can appear for various 6741 reasons: 6743 o Failover to an alternate server. Where close to real-time 6744 performance is required, failover thresholds need to be kept low 6745 and this may lead to an increased likelihood of duplicates. 6746 Failover can occur at the client or within Diameter agents. 6748 o Failure of a client or agent after sending of a record from non- 6749 volatile memory, but prior to receipt of an application layer ACK 6750 and deletion of the record. record to be sent. This will result 6751 in retransmission of the record soon after the client or agent has 6752 rebooted. 6754 o Duplicates received from RADIUS gateways. Since the 6755 retransmission behavior of RADIUS is not defined within [RFC2865], 6756 the likelihood of duplication will vary according to the 6757 implementation. 6759 o Implementation problems and misconfiguration. 6761 The T flag is used as an indication of an application layer 6762 retransmission event, e.g., due to failover to an alternate server. 6763 It is defined only for request messages sent by Diameter clients or 6764 agents. For instance, after a reboot, a client may not know whether 6765 it has already tried to send the accounting records in its non- 6766 volatile memory before the reboot occurred. Diameter servers MAY use 6767 the T flag as an aid when processing requests and detecting duplicate 6768 messages. However, servers that do this MUST ensure that duplicates 6769 are found even when the first transmitted request arrives at the 6770 server after the retransmitted request. It can be used only in cases 6771 where no answer has been received from the Server for a request and 6772 the request is sent again, (e.g., due to a failover to an alternate 6773 peer, due to a recovered primary peer or due to a client re-sending a 6774 stored record from non-volatile memory such as after reboot of a 6775 client or agent). 6777 In some cases the Diameter accounting server can delay the duplicate 6778 detection and accounting record processing until a post-processing 6779 phase takes place. At that time records are likely to be sorted 6780 according to the included User-Name and duplicate elimination is easy 6781 in this case. In other situations it may be necessary to perform 6782 real-time duplicate detection, such as when credit limits are imposed 6783 or real-time fraud detection is desired. 6785 In general, only generation of duplicates due to failover or re- 6786 sending of records in non-volatile storage can be reliably detected 6787 by Diameter clients or agents. In such cases the Diameter client or 6788 agents can mark the message as possible duplicate by setting the T 6789 flag. Since the Diameter server is responsible for duplicate 6790 detection, it can choose to make use of the T flag or not, in order 6791 to optimize duplicate detection. Since the T flag does not affect 6792 interoperability, and may not be needed by some servers, generation 6793 of the T flag is REQUIRED for Diameter clients and agents, but MAY be 6794 implemented by Diameter servers. 6796 As an example, it can be usually be assumed that duplicates appear 6797 within a time window of longest recorded network partition or device 6798 fault, perhaps a day. So only records within this time window need 6799 to be looked at in the backward direction. Secondly, hashing 6800 techniques or other schemes, such as the use of the T flag in the 6801 received messages, may be used to eliminate the need to do a full 6802 search even in this set except for rare cases. 6804 The following is an example of how the T flag may be used by the 6805 server to detect duplicate requests. 6807 A Diameter server MAY check the T flag of the received message to 6808 determine if the record is a possible duplicate. If the T flag is 6809 set in the request message, the server searches for a duplicate 6810 within a configurable duplication time window backward and 6811 forward. This limits database searching to those records where 6812 the T flag is set. In a well run network, network partitions and 6813 device faults will presumably be rare events, so this approach 6814 represents a substantial optimization of the duplicate detection 6815 process. During failover, it is possible for the original record 6816 to be received after the T flag marked record, due to differences 6817 in network delays experienced along the path by the original and 6818 duplicate transmissions. The likelihood of this occurring 6819 increases as the failover interval is decreased. In order to be 6820 able to detect out of order duplicates, the Diameter server should 6821 use backward and forward time windows when performing duplicate 6822 checking for the T flag marked request. For example, in order to 6823 allow time for the original record to exit the network and be 6824 recorded by the accounting server, the Diameter server can delay 6825 processing records with the T flag set until a time period 6826 TIME_WAIT + RECORD_PROCESSING_TIME has elapsed after the closing 6827 of the original transport connection. After this time period has 6828 expired, then it may check the T flag marked records against the 6829 database with relative assurance that the original records, if 6830 sent, have been received and recorded. 6832 Appendix D. Internationalized Domain Names 6834 To be compatible with the existing DNS infrastructure and simplify 6835 host and domain name comparison, Diameter identities (FQDNs) are 6836 represented in ASCII form. This allows the Diameter protocol to fall 6837 in-line with the DNS strategy of being transparent from the effects 6838 of Internationalized Domain Names (IDNs) by following the 6839 recommendations in [RFC4690] and [RFC5890]. Applications that 6840 provide support for IDNs outside of the Diameter protocol but 6841 interacting with it SHOULD use the representation and conversion 6842 framework described in [RFC5890], [RFC5891] and [RFC3492]. 6844 Authors' Addresses 6846 Victor Fajardo (editor) 6847 Telcordia Technologies 6848 One Telcordia Drive, 1S-222 6849 Piscataway, NJ 08854 6850 USA 6852 Phone: +1-908-421-1845 6853 Email: vf0213@gmail.com 6855 Jari Arkko 6856 Ericsson Research 6857 02420 Jorvas 6858 Finland 6860 Phone: +358 40 5079256 6861 Email: jari.arkko@ericsson.com 6863 John Loughney 6864 Nokia Research Center 6865 955 Page Mill Road 6866 Palo Alto, CA 94304 6867 US 6869 Phone: +1-650-283-8068 6870 Email: john.loughney@nokia.com 6871 Glen Zorn (editor) 6872 Network Zen 6873 227/358 Thanon Sanphawut 6874 Bang Na, Bangkok 10260 6875 Thailand 6877 Phone: +66 (0) 87-0404617 6878 Email: glenzorn@gmail.com