idnits 2.17.1 draft-ietf-dime-rfc3588bis-10.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 20. -- Found old boilerplate from RFC 3978, Section 5.5, updated by RFC 4748 on line 6877. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 6888. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 6895. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 6901. 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 2 instances of lines with non-RFC2606-compliant FQDNs in the document. == There are 2 instances of lines with non-RFC6890-compliant IPv4 addresses in the document. If these are example addresses, they should be changed. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust Copyright Line does not match the current year == Line 4561 has weird spacing: '...ly with wit...' == Line 4769 has weird spacing: '...ealtime user...' == Line 4797 has weird spacing: '... record inter...' == Line 4807 has weird spacing: '...ealtime user...' == Line 4815 has weird spacing: '...ealtime user...' == (1 more instance...) -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (January 22, 2008) is 5939 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'PXY' is mentioned on line 4276, but not defined -- Possible downref: Non-RFC (?) normative reference: ref. 'FLOATPOINT' -- Possible downref: Non-RFC (?) normative reference: ref. 'IANAADFAM' -- Possible downref: Non-RFC (?) normative reference: ref. 'RADTYPE' ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) ** Obsolete normative reference: RFC 4005 (Obsoleted by RFC 7155) ** Obsolete normative reference: RFC 4006 (Obsoleted by RFC 8506) ** Obsolete normative reference: RFC 4234 (Obsoleted by RFC 5234) ** Obsolete normative reference: RFC 3588 (Obsoleted by RFC 6733) ** Obsolete normative reference: RFC 2434 (Obsoleted by RFC 5226) ** Obsolete normative reference: RFC 4306 (Obsoleted by RFC 5996) ** Obsolete normative reference: RFC 4282 (Obsoleted by RFC 7542) ** Obsolete normative reference: RFC 2960 (Obsoleted by RFC 4960) ** Obsolete normative reference: RFC 4346 (Obsoleted by RFC 5246) ** Obsolete normative reference: RFC 3280 (Obsoleted by RFC 5280) ** Obsolete normative reference: RFC 3490 (Obsoleted by RFC 5890, RFC 5891) ** Obsolete normative reference: RFC 3491 (Obsoleted by RFC 5891) -- Obsolete informational reference (is this intentional?): RFC 3576 (Obsoleted by RFC 5176) -- Obsolete informational reference (is this intentional?): RFC 4330 (Obsoleted by RFC 5905) Summary: 14 errors (**), 0 flaws (~~), 10 warnings (==), 12 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 DIME V. Fajardo, Ed. 3 Internet-Draft Toshiba America Research 4 Intended status: Standards Track J. Arkko 5 Expires: July 25, 2008 Ericsson Research 6 J. Loughney 7 Nokia Research Center 8 G. Zorn 9 NetCube 10 January 22, 2008 12 Diameter Base Protocol 13 draft-ietf-dime-rfc3588bis-10.txt 15 Status of this Memo 17 By submitting this Internet-Draft, each author represents that any 18 applicable patent or other IPR claims of which he or she is aware 19 have been or will be disclosed, and any of which he or she becomes 20 aware will be disclosed, in accordance with Section 6 of BCP 79. 22 Internet-Drafts are working documents of the Internet Engineering 23 Task Force (IETF), its areas, and its working groups. Note that 24 other groups may also distribute working documents as Internet- 25 Drafts. 27 Internet-Drafts are draft documents valid for a maximum of six months 28 and may be updated, replaced, or obsoleted by other documents at any 29 time. It is inappropriate to use Internet-Drafts as reference 30 material or to cite them other than as "work in progress." 32 The list of current Internet-Drafts can be accessed at 33 http://www.ietf.org/ietf/1id-abstracts.txt. 35 The list of Internet-Draft Shadow Directories can be accessed at 36 http://www.ietf.org/shadow.html. 38 This Internet-Draft will expire on July 25, 2008. 40 Copyright Notice 42 Copyright (C) The IETF Trust (2008). 44 Abstract 46 The Diameter base protocol is intended to provide an Authentication, 47 Authorization and Accounting (AAA) framework for applications such as 48 network access or IP mobility. Diameter is also intended to work in 49 both local Authentication, Authorization & Accounting and roaming 50 situations. This document specifies the message format, transport, 51 error reporting, accounting and security services to be used by all 52 Diameter applications. The Diameter base application needs to be 53 supported by all Diameter implementations. 55 Table of Contents 57 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 7 58 1.1. Diameter Protocol . . . . . . . . . . . . . . . . . . . . 9 59 1.1.1. Description of the Document Set . . . . . . . . . . 11 60 1.1.2. Conventions Used in This Document . . . . . . . . . 12 61 1.1.3. Changes from RFC3588 . . . . . . . . . . . . . . . . 12 62 1.2. Approach to Extensibility . . . . . . . . . . . . . . . . 13 63 1.2.1. Defining New AVP Values . . . . . . . . . . . . . . 13 64 1.2.2. Creating New AVPs . . . . . . . . . . . . . . . . . 13 65 1.2.3. Creating New Commands . . . . . . . . . . . . . . . 14 66 1.2.4. Creating New Authentication Applications . . . . . . 14 67 1.2.5. Creating New Accounting Applications . . . . . . . . 15 68 1.2.6. Application Authentication Procedures . . . . . . . 16 69 1.3. Terminology . . . . . . . . . . . . . . . . . . . . . . . 16 70 2. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 23 71 2.1. Transport . . . . . . . . . . . . . . . . . . . . . . . . 24 72 2.1.1. SCTP Guidelines . . . . . . . . . . . . . . . . . . 25 73 2.2. Securing Diameter Messages . . . . . . . . . . . . . . . 25 74 2.3. Diameter Application Compliance . . . . . . . . . . . . . 25 75 2.4. Application Identifiers . . . . . . . . . . . . . . . . . 25 76 2.5. Connections vs. Sessions . . . . . . . . . . . . . . . . 26 77 2.6. Peer Table . . . . . . . . . . . . . . . . . . . . . . . 27 78 2.7. Routing Table . . . . . . . . . . . . . . . . . . . . . . 28 79 2.8. Role of Diameter Agents . . . . . . . . . . . . . . . . . 29 80 2.8.1. Relay Agents . . . . . . . . . . . . . . . . . . . . 31 81 2.8.2. Proxy Agents . . . . . . . . . . . . . . . . . . . . 32 82 2.8.3. Redirect Agents . . . . . . . . . . . . . . . . . . 32 83 2.8.4. Translation Agents . . . . . . . . . . . . . . . . . 33 84 2.9. Diameter Path Authorization . . . . . . . . . . . . . . . 34 85 3. Diameter Header . . . . . . . . . . . . . . . . . . . . . . . 36 86 3.1. Command Codes . . . . . . . . . . . . . . . . . . . . . . 39 87 3.2. Command Code ABNF specification . . . . . . . . . . . . . 39 88 3.3. Diameter Command Naming Conventions . . . . . . . . . . . 41 89 4. Diameter AVPs . . . . . . . . . . . . . . . . . . . . . . . . 43 90 4.1. AVP Header . . . . . . . . . . . . . . . . . . . . . . . 43 91 4.1.1. Optional Header Elements . . . . . . . . . . . . . . 45 92 4.2. Basic AVP Data Formats . . . . . . . . . . . . . . . . . 45 93 4.3. Derived AVP Data Formats . . . . . . . . . . . . . . . . 47 94 4.4. Grouped AVP Values . . . . . . . . . . . . . . . . . . . 54 95 4.4.1. Example AVP with a Grouped Data type . . . . . . . . 55 96 4.5. Diameter Base Protocol AVPs . . . . . . . . . . . . . . . 58 97 5. Diameter Peers . . . . . . . . . . . . . . . . . . . . . . . 61 98 5.1. Peer Connections . . . . . . . . . . . . . . . . . . . . 61 99 5.2. Diameter Peer Discovery . . . . . . . . . . . . . . . . . 61 100 5.3. Capabilities Exchange . . . . . . . . . . . . . . . . . . 64 101 5.3.1. Capabilities-Exchange-Request . . . . . . . . . . . 65 102 5.3.2. Capabilities-Exchange-Answer . . . . . . . . . . . . 66 103 5.3.3. Vendor-Id AVP . . . . . . . . . . . . . . . . . . . 66 104 5.3.4. Firmware-Revision AVP . . . . . . . . . . . . . . . 66 105 5.3.5. Host-IP-Address AVP . . . . . . . . . . . . . . . . 67 106 5.3.6. Supported-Vendor-Id AVP . . . . . . . . . . . . . . 67 107 5.3.7. Product-Name AVP . . . . . . . . . . . . . . . . . . 67 108 5.4. Disconnecting Peer connections . . . . . . . . . . . . . 67 109 5.4.1. Disconnect-Peer-Request . . . . . . . . . . . . . . 68 110 5.4.2. Disconnect-Peer-Answer . . . . . . . . . . . . . . . 68 111 5.4.3. Disconnect-Cause AVP . . . . . . . . . . . . . . . . 68 112 5.5. Transport Failure Detection . . . . . . . . . . . . . . . 69 113 5.5.1. Device-Watchdog-Request . . . . . . . . . . . . . . 69 114 5.5.2. Device-Watchdog-Answer . . . . . . . . . . . . . . . 70 115 5.5.3. Transport Failure Algorithm . . . . . . . . . . . . 70 116 5.5.4. Failover and Failback Procedures . . . . . . . . . . 70 117 5.6. Peer State Machine . . . . . . . . . . . . . . . . . . . 71 118 5.6.1. Incoming connections . . . . . . . . . . . . . . . . 73 119 5.6.2. Events . . . . . . . . . . . . . . . . . . . . . . . 74 120 5.6.3. Actions . . . . . . . . . . . . . . . . . . . . . . 75 121 5.6.4. The Election Process . . . . . . . . . . . . . . . . 77 122 5.6.5. Capabilities Update . . . . . . . . . . . . . . . . 77 123 6. Diameter message processing . . . . . . . . . . . . . . . . . 78 124 6.1. Diameter Request Routing Overview . . . . . . . . . . . . 78 125 6.1.1. Originating a Request . . . . . . . . . . . . . . . 79 126 6.1.2. Sending a Request . . . . . . . . . . . . . . . . . 79 127 6.1.3. Receiving Requests . . . . . . . . . . . . . . . . . 80 128 6.1.4. Processing Local Requests . . . . . . . . . . . . . 80 129 6.1.5. Request Forwarding . . . . . . . . . . . . . . . . . 80 130 6.1.6. Request Routing . . . . . . . . . . . . . . . . . . 80 131 6.1.7. Predictive Loop Avoidance . . . . . . . . . . . . . 81 132 6.1.8. Redirecting requests . . . . . . . . . . . . . . . . 81 133 6.1.9. Relaying and Proxying Requests . . . . . . . . . . . 83 134 6.2. Diameter Answer Processing . . . . . . . . . . . . . . . 83 135 6.2.1. Processing received Answers . . . . . . . . . . . . 84 136 6.2.2. Relaying and Proxying Answers . . . . . . . . . . . 84 137 6.3. Origin-Host AVP . . . . . . . . . . . . . . . . . . . . . 85 138 6.4. Origin-Realm AVP . . . . . . . . . . . . . . . . . . . . 85 139 6.5. Destination-Host AVP . . . . . . . . . . . . . . . . . . 85 140 6.6. Destination-Realm AVP . . . . . . . . . . . . . . . . . . 86 141 6.7. Routing AVPs . . . . . . . . . . . . . . . . . . . . . . 86 142 6.7.1. Route-Record AVP . . . . . . . . . . . . . . . . . . 86 143 6.7.2. Proxy-Info AVP . . . . . . . . . . . . . . . . . . . 86 144 6.7.3. Proxy-Host AVP . . . . . . . . . . . . . . . . . . . 86 145 6.7.4. Proxy-State AVP . . . . . . . . . . . . . . . . . . 86 146 6.8. Auth-Application-Id AVP . . . . . . . . . . . . . . . . . 87 147 6.9. Acct-Application-Id AVP . . . . . . . . . . . . . . . . . 87 148 6.10. Inband-Security-Id AVP . . . . . . . . . . . . . . . . . 87 149 6.11. Vendor-Specific-Application-Id AVP . . . . . . . . . . . 87 150 6.12. Redirect-Host AVP . . . . . . . . . . . . . . . . . . . . 88 151 6.13. Redirect-Host-Usage AVP . . . . . . . . . . . . . . . . . 88 152 6.14. Redirect-Max-Cache-Time AVP . . . . . . . . . . . . . . . 90 153 7. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 91 154 7.1. Result-Code AVP . . . . . . . . . . . . . . . . . . . . . 92 155 7.1.1. Informational . . . . . . . . . . . . . . . . . . . 93 156 7.1.2. Success . . . . . . . . . . . . . . . . . . . . . . 93 157 7.1.3. Protocol Errors . . . . . . . . . . . . . . . . . . 94 158 7.1.4. Transient Failures . . . . . . . . . . . . . . . . . 95 159 7.1.5. Permanent Failures . . . . . . . . . . . . . . . . . 96 160 7.2. Error Bit . . . . . . . . . . . . . . . . . . . . . . . . 99 161 7.3. Error-Message AVP . . . . . . . . . . . . . . . . . . . . 99 162 7.4. Error-Reporting-Host AVP . . . . . . . . . . . . . . . . 99 163 7.5. Failed-AVP AVP . . . . . . . . . . . . . . . . . . . . . 100 164 7.6. Experimental-Result AVP . . . . . . . . . . . . . . . . . 101 165 7.7. Experimental-Result-Code AVP . . . . . . . . . . . . . . 101 166 8. Diameter User Sessions . . . . . . . . . . . . . . . . . . . 102 167 8.1. Authorization Session State Machine . . . . . . . . . . . 103 168 8.2. Accounting Session State Machine . . . . . . . . . . . . 108 169 8.3. Server-Initiated Re-Auth . . . . . . . . . . . . . . . . 113 170 8.3.1. Re-Auth-Request . . . . . . . . . . . . . . . . . . 113 171 8.3.2. Re-Auth-Answer . . . . . . . . . . . . . . . . . . . 114 172 8.4. Session Termination . . . . . . . . . . . . . . . . . . . 115 173 8.4.1. Session-Termination-Request . . . . . . . . . . . . 116 174 8.4.2. Session-Termination-Answer . . . . . . . . . . . . . 116 175 8.5. Aborting a Session . . . . . . . . . . . . . . . . . . . 117 176 8.5.1. Abort-Session-Request . . . . . . . . . . . . . . . 118 177 8.5.2. Abort-Session-Answer . . . . . . . . . . . . . . . . 118 178 8.6. Inferring Session Termination from Origin-State-Id . . . 119 179 8.7. Auth-Request-Type AVP . . . . . . . . . . . . . . . . . . 120 180 8.8. Session-Id AVP . . . . . . . . . . . . . . . . . . . . . 120 181 8.9. Authorization-Lifetime AVP . . . . . . . . . . . . . . . 121 182 8.10. Auth-Grace-Period AVP . . . . . . . . . . . . . . . . . . 122 183 8.11. Auth-Session-State AVP . . . . . . . . . . . . . . . . . 122 184 8.12. Re-Auth-Request-Type AVP . . . . . . . . . . . . . . . . 123 185 8.13. Session-Timeout AVP . . . . . . . . . . . . . . . . . . . 123 186 8.14. User-Name AVP . . . . . . . . . . . . . . . . . . . . . . 124 187 8.15. Termination-Cause AVP . . . . . . . . . . . . . . . . . . 124 188 8.16. Origin-State-Id AVP . . . . . . . . . . . . . . . . . . . 125 189 8.17. Session-Binding AVP . . . . . . . . . . . . . . . . . . . 126 190 8.18. Session-Server-Failover AVP . . . . . . . . . . . . . . . 126 191 8.19. Multi-Round-Time-Out AVP . . . . . . . . . . . . . . . . 127 192 8.20. Class AVP . . . . . . . . . . . . . . . . . . . . . . . . 127 193 8.21. Event-Timestamp AVP . . . . . . . . . . . . . . . . . . . 128 194 9. Accounting . . . . . . . . . . . . . . . . . . . . . . . . . 129 195 9.1. Server Directed Model . . . . . . . . . . . . . . . . . . 129 196 9.2. Protocol Messages . . . . . . . . . . . . . . . . . . . . 130 197 9.3. Accounting Application Extension and Requirements . . . . 130 198 9.4. Fault Resilience . . . . . . . . . . . . . . . . . . . . 131 199 9.5. Accounting Records . . . . . . . . . . . . . . . . . . . 131 200 9.6. Correlation of Accounting Records . . . . . . . . . . . . 132 201 9.7. Accounting Command-Codes . . . . . . . . . . . . . . . . 133 202 9.7.1. Accounting-Request . . . . . . . . . . . . . . . . . 133 203 9.7.2. Accounting-Answer . . . . . . . . . . . . . . . . . 134 204 9.8. Accounting AVPs . . . . . . . . . . . . . . . . . . . . . 135 205 9.8.1. Accounting-Record-Type AVP . . . . . . . . . . . . . 135 206 9.8.2. Acct-Interim-Interval AVP . . . . . . . . . . . . . 136 207 9.8.3. Accounting-Record-Number AVP . . . . . . . . . . . . 137 208 9.8.4. Acct-Session-Id AVP . . . . . . . . . . . . . . . . 137 209 9.8.5. Acct-Multi-Session-Id AVP . . . . . . . . . . . . . 137 210 9.8.6. Accounting-Sub-Session-Id AVP . . . . . . . . . . . 137 211 9.8.7. Accounting-Realtime-Required AVP . . . . . . . . . . 138 212 10. AVP Occurrence Table . . . . . . . . . . . . . . . . . . . . 139 213 10.1. Base Protocol Command AVP Table . . . . . . . . . . . . . 139 214 10.2. Accounting AVP Table . . . . . . . . . . . . . . . . . . 140 215 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 142 216 11.1. AVP Header . . . . . . . . . . . . . . . . . . . . . . . 142 217 11.1.1. AVP Codes . . . . . . . . . . . . . . . . . . . . . 142 218 11.1.2. AVP Flags . . . . . . . . . . . . . . . . . . . . . 143 219 11.2. Diameter Header . . . . . . . . . . . . . . . . . . . . . 143 220 11.2.1. Command Codes . . . . . . . . . . . . . . . . . . . 143 221 11.2.2. Command Flags . . . . . . . . . . . . . . . . . . . 144 222 11.3. Application Identifiers . . . . . . . . . . . . . . . . . 144 223 11.4. AVP Values . . . . . . . . . . . . . . . . . . . . . . . 145 224 11.4.1. Result-Code AVP Values . . . . . . . . . . . . . . . 145 225 11.4.2. Accounting-Record-Type AVP Values . . . . . . . . . 145 226 11.4.3. Termination-Cause AVP Values . . . . . . . . . . . . 145 227 11.4.4. Redirect-Host-Usage AVP Values . . . . . . . . . . . 145 228 11.4.5. Session-Server-Failover AVP Values . . . . . . . . . 145 229 11.4.6. Session-Binding AVP Values . . . . . . . . . . . . . 145 230 11.4.7. Disconnect-Cause AVP Values . . . . . . . . . . . . 146 231 11.4.8. Auth-Request-Type AVP Values . . . . . . . . . . . . 146 232 11.4.9. Auth-Session-State AVP Values . . . . . . . . . . . 146 233 11.4.10. Re-Auth-Request-Type AVP Values . . . . . . . . . . 146 234 11.4.11. Accounting-Realtime-Required AVP Values . . . . . . 146 235 11.4.12. Inband-Security-Id AVP (code 299) . . . . . . . . . 146 236 11.5. Diameter TCP/SCTP Port Numbers . . . . . . . . . . . . . 146 237 11.6. NAPTR Service Fields . . . . . . . . . . . . . . . . . . 146 238 12. Diameter protocol related configurable parameters . . . . . . 148 239 13. Security Considerations . . . . . . . . . . . . . . . . . . . 149 240 13.1. TLS Usage . . . . . . . . . . . . . . . . . . . . . . . . 149 241 13.2. Peer-to-Peer Considerations . . . . . . . . . . . . . . . 150 242 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 151 243 14.1. Normative References . . . . . . . . . . . . . . . . . . 151 244 14.2. Informational References . . . . . . . . . . . . . . . . 153 245 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 155 246 Appendix B. NAPTR Example . . . . . . . . . . . . . . . . . . . 156 247 Appendix C. Duplicate Detection . . . . . . . . . . . . . . . . 157 248 Appendix D. Internationalized Domain Names . . . . . . . . . . . 159 249 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 160 250 Intellectual Property and Copyright Statements . . . . . . . . . 161 252 1. Introduction 254 Authentication, Authorization and Accounting (AAA) protocols such as 255 TACACS [RFC1492] and RADIUS [RFC2865] were initially deployed to 256 provide dial-up PPP [RFC1661] and terminal server access. Over time, 257 with the growth of the Internet and the introduction of new access 258 technologies (including wireless, DSL, Mobile IP and Ethernet), both 259 the amount and complexity of processing performed by routers and 260 network access servers (NAS) have increased, putting new demands on 261 AAA protocols. 263 Network access requirements for AAA protocols are summarized in 264 [RFC2989]. These include: 266 Failover 268 [RFC2865] does not define failover mechanisms, and as a result, 269 failover behavior differs between implementations. In order to 270 provide well defined failover behavior, Diameter supports 271 application-layer acknowledgements, and defines failover 272 algorithms and the associated state machine. This is described in 273 Section 5.5 and [RFC3539]. 275 Transmission-level security 277 [RFC2865] defines an application-layer authentication and 278 integrity scheme that is required only for use with Response 279 packets. While [RFC2869] defines an additional authentication and 280 integrity mechanism, use is only required during Extensible 281 Authentication Protocol (EAP) sessions. While attribute-hiding is 282 supported, [RFC2865] does not provide support for per-packet 283 confidentiality. In accounting, [RFC2866] assumes that replay 284 protection is provided by the backend billing server, rather than 285 within the protocol itself. 287 While [RFC3162] defines the use of IPsec with RADIUS, support for 288 IPsec is not required. Since within [RFC4306] authentication 289 occurs only within Phase 1 prior to the establishment of IPsec SAs 290 in Phase 2, it is typically not possible to define separate trust 291 or authorization schemes for each application. This limits the 292 usefulness of IPsec in inter-domain AAA applications (such as 293 roaming) where it may be desirable to define a distinct 294 certificate hierarchy for use in a AAA deployment. In order to 295 provide universal support for transmission-level security, and 296 enable both intra- and inter-domain AAA deployments, Diameter 297 provides support for TLS. Security is discussed in Section 13. 299 Reliable transport 301 RADIUS runs over UDP, and does not define retransmission behavior; 302 as a result, reliability varies between implementations. As 303 described in [RFC2975], this is a major issue in accounting, where 304 packet loss may translate directly into revenue loss. In order to 305 provide well defined transport behavior, Diameter runs over 306 reliable transport mechanisms (TCP, SCTP) as defined in [RFC3539]. 308 Agent support 310 [RFC2865] does not provide for explicit support for agents, 311 including Proxies, Redirects and Relays. Since the expected 312 behavior is not defined, it varies between implementations. 313 Diameter defines agent behavior explicitly; this is described in 314 Section 2.8. 316 Server-initiated messages 318 While RADIUS server-initiated messages are defined in [RFC3576], 319 support is optional. This makes it difficult to implement 320 features such as unsolicited disconnect or reauthentication/ 321 reauthorization on demand across a heterogeneous deployment. 322 Support for server-initiated messages is mandatory in Diameter, 323 and is described in Section 8. 325 Transition support 327 While Diameter does not share a common protocol data unit (PDU) 328 with RADIUS, considerable effort has been expended in enabling 329 backward compatibility with RADIUS, so that the two protocols may 330 be deployed in the same network. Initially, it is expected that 331 Diameter will be deployed within new network devices, as well as 332 within gateways enabling communication between legacy RADIUS 333 devices and Diameter agents. This capability, described in 334 [RFC4005], enables Diameter support to be added to legacy 335 networks, by addition of a gateway or server speaking both RADIUS 336 and Diameter. 338 In addition to addressing the above requirements, Diameter also 339 provides support for the following: 341 Capability negotiation 343 RADIUS does not support error messages, capability negotiation, or 344 a mandatory/non-mandatory flag for attributes. Since RADIUS 345 clients and servers are not aware of each other's capabilities, 346 they may not be able to successfully negotiate a mutually 347 acceptable service, or in some cases, even be aware of what 348 service has been implemented. Diameter includes support for error 349 handling (Section 7), capability negotiation (Section 5.3), and 350 mandatory/non-mandatory attribute-value pairs (AVPs) (Section 351 4.1). 353 Peer discovery and configuration 355 RADIUS implementations typically require that the name or address 356 of servers or clients be manually configured, along with the 357 corresponding shared secrets. This results in a large 358 administrative burden, and creates the temptation to reuse the 359 RADIUS shared secret, which can result in major security 360 vulnerabilities if the Request Authenticator is not globally and 361 temporally unique as required in [RFC2865]. Through DNS, Diameter 362 enables dynamic discovery of peers. Derivation of dynamic session 363 keys is enabled via transmission-level security. 365 Over time, the capabilities of Network Access Server (NAS) devices 366 have increased substantially. As a result, while Diameter is a 367 considerably more sophisticated protocol than RADIUS, it remains 368 feasible to implement within embedded devices, given improvements in 369 processor speeds and the widespread availability of embedded TLS 370 implementations. 372 1.1. Diameter Protocol 374 The Diameter base protocol provides the following facilities: 376 o Delivery of AVPs (attribute value pairs) 378 o Capabilities negotiation 380 o Error notification 382 o Extensibility, through addition of new applications, commands and 383 AVPs (required in [RFC2989]). 385 o Basic services necessary for applications, such as handling of 386 user sessions or accounting 388 All data delivered by the protocol is in the form of an AVP. Some of 389 these AVP values are used by the Diameter protocol itself, while 390 others deliver data associated with particular applications that 391 employ Diameter. AVPs may be added arbitrarily to Diameter messages, 392 so long as the requirements of a message's ABNF are met and the ABNF 393 allows for it. AVPs are used by the base Diameter protocol to 394 support the following required features: 396 o Transporting of user authentication information, for the purposes 397 of enabling the Diameter server to authenticate the user. 399 o Transporting of service specific authorization information, 400 between client and servers, allowing the peers to decide whether a 401 user's access request should be granted. 403 o Exchanging resource usage information, which MAY be used for 404 accounting purposes, capacity planning, etc. 406 o Relaying, proxying and redirecting of Diameter messages through a 407 server hierarchy. 409 The Diameter base protocol provides the minimum requirements needed 410 for a AAA protocol, as required by [RFC2989]. The base protocol may 411 be used by itself for accounting purposes only, or it may be used 412 with a Diameter application, such as Mobile IPv4 [RFC4004], or 413 network access [RFC4005]. It is also possible for the base protocol 414 to be extended for use in new applications, via the addition of new 415 commands or AVPs. At this time the focus of Diameter is network 416 access and accounting applications. A truly generic AAA protocol 417 used by many applications might provide functionality not provided by 418 Diameter. Therefore, it is imperative that the designers of new 419 applications understand their requirements before using Diameter. 420 See Section 2.4 for more information on Diameter applications. 422 Any node can initiate a request. In that sense, Diameter is a peer- 423 to-peer protocol. In this document, a Diameter Client is a device at 424 the edge of the network that performs access control, such as a 425 Network Access Server (NAS) or a Foreign Agent (FA). A Diameter 426 client generates Diameter messages to request authentication, 427 authorization, and accounting services for the user. A Diameter 428 agent is a node that does not provide local user authentication or 429 authorization services; agents include proxies, redirects and relay 430 agents. A Diameter server performs authentication and/or 431 authorization of the user. A Diameter node MAY act as an agent for 432 certain requests while acting as a server for others. 434 The Diameter protocol also supports server-initiated messages, such 435 as a request to abort service to a particular user. 437 1.1.1. Description of the Document Set 439 Currently, the Diameter specification consists of an updated version 440 of the base protocol specification (this document), Transport Profile 441 [RFC3539] and applications: Mobile IPv4 [RFC4004], NASREQ [RFC4005], 442 Credit Control [RFC4006], EAP [RFC4072] and SIP [RFC4740]. Note that 443 this document deprecates [RFC3588]. A summary of the base protocol 444 updates included in this document can be found in Section 1.1.3. 446 The Transport Profile document [RFC3539] discusses transport layer 447 issues that arise with AAA protocols and recommendations on how to 448 overcome these issues. This document also defines the Diameter 449 failover algorithm and state machine. 451 The Mobile IPv4 [RFC4004] application defines a Diameter application 452 that allows a Diameter server to perform AAA functions for Mobile 453 IPv4 services to a mobile node. 455 The NASREQ [RFC4005] application defines a Diameter Application that 456 allows a Diameter server to be used in a PPP/SLIP Dial-Up and 457 Terminal Server Access environment. Consideration was given for 458 servers that need to perform protocol conversion between Diameter and 459 RADIUS. 461 The Credit Control [RFC4006] application defines a Diameter 462 Application that can be used to implement real-time credit-control 463 for a variety of end user services such as network access, SIP 464 services, messaging services, and download services. It provides a 465 general solution to real-time cost and credit-control. 467 The EAP [RFC4072] application defines a Diameter Application that can 468 be used to carry EAP packets between the Network Access Server (NAS) 469 working as an EAP authenticator and a back-end authentication server. 470 The Diameter EAP application is based on NASREQ and intended for a 471 similar environment. 473 The SIP [RFC4740] application defines a Diameter Application that 474 allows a Diameter client to request authentication and authorization 475 information to a Diameter server for SIP-based IP multimedia services 476 (see SIP [RFC3261]). 478 In summary, this document defines the base protocol specification for 479 AAA, which includes support for accounting. The applications 480 documents describe applications that use this base specification for 481 Authentication, Authorization and Accounting. 483 1.1.2. Conventions Used in This Document 485 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 486 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 487 document are to be interpreted as described in [RFC2119]. 489 1.1.3. Changes from RFC3588 491 This document deprecates [RFC3588] but is fully backward compatible 492 with that document. The changes introduced in this document focuses 493 on fixing issues that has surfaced during implementation of 494 [RFC3588]. An overview of some the major changes are shown below. 496 o Simplified Security Requirements. The use of a secured transport 497 for exchanging diameter messages remains mandatory. However, TLS 498 has become the primary method of securing diameter and IPSec is a 499 secondary alternative. See Section 13 for details. Along with 500 this, support for the End-to-End security framework (E2ESequence 501 AVP and 'P'-bit in the AVP header) has also been deprecated. 503 o Diameter Extensibility Changes. This includes fixes to the 504 diameter extensibility specification (Section 1.2 and others) to 505 better aid diameter application designers. It also includes 506 allocation of vendor specific command code space. The new 507 specification relaxes the allocation of command codes for vendor 508 specific uses. See Section 11.2.1 for details. 510 o Application Id Usage. Clarify the proper use of Application Id 511 information which can be found in multiple places within a 512 diameter message. This includes co-relating Application Ids found 513 in the message headers and AVPs. These changes also clearly 514 specifies the proper Application Id value to use for specific base 515 protocol messages (ASR/ASA, STR/STA) as well as clarifying the 516 content and use of Vendor-Specific-Application-Id. 518 o Routing Fixes. For general routing, specifies much more clearly 519 what information (AVPs and Application Id) can be used for making 520 routing decisions. Prioritization of redirect routing criterias 521 when multiple route entries are found via redirects has also been 522 added (See Section 6.13 for details). 524 o Simplification of Diameter Peer Discovery. The diameter discovery 525 process now supports only well known discovery schemes. The rest 526 has been deprecated. (See Section 5.2 for details). 528 There are many other many miscellaneous fixes that has been 529 introduced in this document that may not be considered significant 530 but they are important nonetheless. Examples are removal of obselete 531 types, fixes to command ABNFs, fixes state machine, clarification on 532 election process, message validation, fixes to Failed-AVP and Result- 533 Code AVP values etc. A comprehensive list of changes is now shown 534 here for practical reasons. Though, that can be generated via a diff 535 comparison between this document and [RFC3588]. 537 1.2. Approach to Extensibility 539 The Diameter protocol is designed to be extensible, using several 540 mechanisms, including: 542 o Defining new AVP values 544 o Creating new AVPs 546 o Creating new commands 548 o Creating new authentication/authorization applications 550 o Creating new accounting applications 552 o Application authentication procedures 554 Reuse of existing AVP values, AVPs, commands and Diameter 555 applications are strongly recommended. Reuse simplifies 556 standardization and implementation and avoids potential 557 interoperability issues. 559 1.2.1. Defining New AVP Values 561 New applications should attempt to reuse AVPs defined in existing 562 applications when possible, as opposed to creating new AVPs. For 563 AVPs of type Enumerated, an application may require a new value to 564 communicate some service-specific information. 566 In order to allocate a new AVP value for a standards track AVP, a 567 request MUST be sent to IANA [RFC2434], along with an explanation of 568 the new AVP value. IANA considerations for AVP values are discussed 569 in Section 11.4. 571 1.2.2. Creating New AVPs 573 When no existing AVP can be reused, a new AVP should be created. The 574 new AVP being defined MUST use one of the data types listed in 575 Section 4.2 or 4.3. If an appropriate derived data type is already 576 defined, it SHOULD be used instead of the base data type to encourage 577 reusability and good design practice. 579 In the event that a logical grouping of AVPs is necessary, and 580 multiple "groups" are possible in a given command, it is recommended 581 that a Grouped AVP be used (see Section 4.4). 583 In order to create a new standards track AVP, a request MUST be sent 584 to IANA with a reference to the specification that defines the AVP. 585 IANA considerations for AVPs are discussed in Section 11.1.1. 587 1.2.3. Creating New Commands 589 A new command should only be created when no suitable command can be 590 reused from an existing application. A new command MUST result in 591 the definition of a new application. In order to create a new 592 command, a request MUST be sent to IANA. The IANA considerations for 593 commands are discussed in Section 11.2.1. 595 1.2.4. Creating New Authentication Applications 597 Every Diameter application specification MUST have an IANA assigned 598 Application Id (see Section 2.4 and Section 11.3). 600 Should a new Diameter usage scenario find itself unable to fit within 601 an existing application without requiring major changes to the 602 specification, it may be desirable to create a new Diameter 603 application. Major changes to an application include: 605 o Adding new AVPs to the command, which have the "M" bit set. 607 o Requiring a command that has a different number of round trips to 608 satisfy a request (e.g., application foo has a command that 609 requires one round trip, but new application bar has a command 610 that requires two round trips to complete). 612 o Adding support for an authentication method requiring definition 613 of new AVPs for use with the application. Since a new EAP 614 authentication method can be supported within Diameter without 615 requiring new AVPs, addition of EAP methods does not require the 616 creation of a new authentication application. 618 Creation of a new application should be viewed as a last resort. An 619 implementation MAY add arbitrary non-mandatory AVPs to a command 620 defined in an application, including vendor-specific AVPs without 621 needing to define a new application. This can be done if the 622 commands ABNF allows for it. Please refer to Section 11.1.1 for 623 details. 625 In order to justify allocation of a new Application Id, Diameter 626 applications MUST define one Command Code, add new mandatory AVPs to 627 the ABNF or significantly change the state machine or processing 628 rules of an existing application. 630 The expected AVPs MUST be defined in an ABNF [RFC4234] grammar (see 631 Section 3.2). If the Diameter application has accounting 632 requirements, it MUST also specify the AVPs that are to be present in 633 the Diameter Accounting messages (see Section 9.3). However, just 634 because a new authentication Application Id is required, does not 635 imply that a new accounting Application Id is required. 637 When possible, a new Diameter application SHOULD reuse existing 638 Diameter AVPs, in order to avoid defining multiple AVPs that carry 639 similar information. 641 1.2.5. Creating New Accounting Applications 643 There are services that only require Diameter accounting. Such 644 services need to define the AVPs carried in the Accounting-Request 645 (ACR)/ Accounting-Answer (ACA) messages, but do not need to define 646 new command codes. An implementation MAY add arbitrary non-mandatory 647 AVPs (AVPs with the "M" bit not set) to any command defined in an 648 application, including vendor-specific AVPs, without needing to 649 define a new accounting application. Please refer to Section 11.1.1 650 for details. 652 Application Ids are still required for Diameter capability exchange. 653 Every Diameter accounting application specification MUST have an IANA 654 assigned Application Id (see Section 2.4) or a vendor specific 655 Application Id. 657 Every Diameter implementation MUST support accounting. Basic 658 accounting support is sufficient to handle any application that uses 659 the ACR/ACA commands defined in this document, as long as no new 660 mandatory AVPs are added. A mandatory AVP is defined as one which 661 has the "M" bit set when sent within an accounting command, 662 regardless of whether it is required or optional within the ABNF for 663 the accounting application. 665 The creation of a new accounting application should be viewed as a 666 last resort and MUST NOT be used unless a new command or additional 667 mechanisms (e.g., application defined state machine) is defined 668 within the application, or new mandatory AVPs are added to the ABNF. 670 Within an accounting command, setting the "M" bit implies that a 671 backend server (e.g., billing server) or the accounting server itself 672 MUST understand the AVP in order to compute a correct bill. If the 673 AVP is not relevant to the billing process, when the AVP is included 674 within an accounting command, it MUST NOT have the "M" bit set, even 675 if the "M" bit is set when the same AVP is used within other Diameter 676 commands (i.e., authentication/authorization commands). 678 A DIAMETER base accounting implementation MUST be configurable to 679 advertise supported accounting applications in order to prevent the 680 accounting server from accepting accounting requests for unbillable 681 services. The combination of the home domain and the accounting 682 Application Id can be used in order to route the request to the 683 appropriate accounting server. 685 When possible, a new Diameter accounting application SHOULD attempt 686 to reuse existing AVPs, in order to avoid defining multiple AVPs that 687 carry similar information. 689 If the base accounting is used without any mandatory AVPs, new 690 commands or additional mechanisms (e.g., application defined state 691 machine), then the base protocol defined standard accounting 692 Application Id (Section 2.4) MUST be used in ACR/ACA commands. 694 1.2.6. Application Authentication Procedures 696 When possible, applications SHOULD be designed such that new 697 authentication methods MAY be added without requiring changes to the 698 application. This MAY require that new AVP values be assigned to 699 represent the new authentication transform, or any other scheme that 700 produces similar results. When possible, authentication frameworks, 701 such as Extensible Authentication Protocol [RFC3748], SHOULD be used. 703 1.3. Terminology 705 AAA 707 Authentication, Authorization and Accounting. 709 Accounting 711 The act of collecting information on resource usage for the 712 purpose of capacity planning, auditing, billing or cost 713 allocation. 715 Accounting Record 717 An accounting record represents a summary of the resource 718 consumption of a user over the entire session. Accounting servers 719 creating the accounting record may do so by processing interim 720 accounting events or accounting events from several devices 721 serving the same user. 723 Authentication 725 The act of verifying the identity of an entity (subject). 727 Authorization 729 The act of determining whether a requesting entity (subject) will 730 be allowed access to a resource (object). 732 AVP 734 The Diameter protocol consists of a header followed by one or more 735 Attribute-Value-Pairs (AVPs). An AVP includes a header and is 736 used to encapsulate protocol-specific data (e.g., routing 737 information) as well as authentication, authorization or 738 accounting information. 740 Broker 742 A broker is a business term commonly used in AAA infrastructures. 743 A broker is either a relay, proxy or redirect agent, and MAY be 744 operated by roaming consortiums. Depending on the business model, 745 a broker may either choose to deploy relay agents or proxy agents. 747 Diameter Agent 749 A Diameter Agent is a Diameter node that provides either relay, 750 proxy, redirect or translation services. 752 Diameter Client 754 A Diameter Client is a device at the edge of the network that 755 performs access control. An example of a Diameter client is a 756 Network Access Server (NAS) or a Foreign Agent (FA). By its very 757 nature, a Diameter Client MUST support Diameter client 758 applications in addition to the base protocol. 760 Diameter Node 762 A Diameter node is a host process that implements the Diameter 763 protocol, and acts either as a Client, Agent or Server. 765 Diameter Peer 767 A Diameter Peer is a Diameter Node to which a given Diameter Node 768 has a direct transport connection. 770 Diameter Server 772 A Diameter Server is one that handles authentication, 773 authorization and accounting requests for a particular realm. By 774 its very nature, a Diameter Server MUST support Diameter server 775 applications in addition to the base protocol. 777 Downstream 779 Downstream is used to identify the direction of a particular 780 Diameter message from the home server towards the access device. 782 Home Realm 784 A Home Realm is the administrative domain with which the user 785 maintains an account relationship. 787 Home Server 789 A Diameter Server which serves the Home Realm. 791 Interim accounting 793 An interim accounting message provides a snapshot of usage during 794 a user's session. It is typically implemented in order to provide 795 for partial accounting of a user's session in the case of a device 796 reboot or other network problem prevents the reception of a 797 session summary message or session record. 799 Local Realm 801 A local realm is the administrative domain providing services to a 802 user. An administrative domain MAY act as a local realm for 803 certain users, while being a home realm for others. 805 Multi-session 807 A multi-session represents a logical linking of several sessions. 808 Multi-sessions are tracked by using the Acct-Multi-Session-Id. An 809 example of a multi-session would be a Multi-link PPP bundle. Each 810 leg of the bundle would be a session while the entire bundle would 811 be a multi-session. 813 Network Access Identifier 815 The Network Access Identifier, or NAI [RFC4282], is used in the 816 Diameter protocol to extract a user's identity and realm. The 817 identity is used to identify the user during authentication and/or 818 authorization, while the realm is used for message routing 819 purposes. 821 Proxy Agent or Proxy 823 In addition to forwarding requests and responses, proxies make 824 policy decisions relating to resource usage and provisioning. 825 This is typically accomplished by tracking the state of NAS 826 devices. While proxies typically do not respond to client 827 Requests prior to receiving a Response from the server, they may 828 originate Reject messages in cases where policies are violated. 829 As a result, proxies need to understand the semantics of the 830 messages passing through them, and may not support all Diameter 831 applications. 833 Realm 835 The string in the NAI that immediately follows the '@' character. 836 NAI realm names are required to be unique, and are piggybacked on 837 the administration of the DNS namespace. Diameter makes use of 838 the realm, also loosely referred to as domain, to determine 839 whether messages can be satisfied locally, or whether they must be 840 routed or redirected. In RADIUS, realm names are not necessarily 841 piggybacked on the DNS namespace but may be independent of it. 843 Real-time Accounting 845 Real-time accounting involves the processing of information on 846 resource usage within a defined time window. Time constraints are 847 typically imposed in order to limit financial risk. 849 Relay Agent or Relay 851 Relays forward requests and responses based on routing-related 852 AVPs and routing table entries. Since relays do not make policy 853 decisions, they do not examine or alter non-routing AVPs. As a 854 result, relays never originate messages, do not need to understand 855 the semantics of messages or non-routing AVPs, and are capable of 856 handling any Diameter application or message type. Since relays 857 make decisions based on information in routing AVPs and realm 858 forwarding tables they do not keep state on NAS resource usage or 859 sessions in progress. 861 Redirect Agent 863 Rather than forwarding requests and responses between clients and 864 servers, redirect agents refer clients to servers and allow them 865 to communicate directly. Since redirect agents do not sit in the 866 forwarding path, they do not alter any AVPs transiting between 867 client and server. Redirect agents do not originate messages and 868 are capable of handling any message type, although they may be 869 configured only to redirect messages of certain types, while 870 acting as relay or proxy agents for other types. As with proxy 871 agents, redirect agents do not keep state with respect to sessions 872 or NAS resources. 874 Roaming Relationships 876 Roaming relationships include relationships between companies and 877 ISPs, relationships among peer ISPs within a roaming consortium, 878 and relationships between an ISP and a roaming consortium. 880 Session 882 A session is a related progression of events devoted to a 883 particular activity. Each application SHOULD provide guidelines 884 as to when a session begins and ends. All Diameter packets with 885 the same Session-Identifier are considered to be part of the same 886 session. 888 Session state 890 A stateful agent is one that maintains session state information, 891 by keeping track of all authorized active sessions. Each 892 authorized session is bound to a particular service, and its state 893 is considered active either until it is notified otherwise, or by 894 expiration. 896 Sub-session 898 A sub-session represents a distinct service (e.g., QoS or data 899 characteristics) provided to a given session. These services may 900 happen concurrently (e.g., simultaneous voice and data transfer 901 during the same session) or serially. These changes in sessions 902 are tracked with the Accounting-Sub-Session-Id. 904 Transaction state 906 The Diameter protocol requires that agents maintain transaction 907 state, which is used for failover purposes. Transaction state 908 implies that upon forwarding a request, the Hop-by-Hop identifier 909 is saved; the field is replaced with a locally unique identifier, 910 which is restored to its original value when the corresponding 911 answer is received. The request's state is released upon receipt 912 of the answer. A stateless agent is one that only maintains 913 transaction state. 915 Translation Agent 917 A translation agent is a stateful Diameter node that performs 918 protocol translation between Diameter and another AAA protocol, 919 such as RADIUS. 921 Transport Connection 923 A transport connection is a TCP or SCTP connection existing 924 directly between two Diameter peers, otherwise known as a Peer- 925 to-Peer Connection. 927 Upstream 929 Upstream is used to identify the direction of a particular 930 Diameter message from the access device towards the home server. 932 User 934 The entity requesting or using some resource, in support of which 935 a Diameter client has generated a request. 937 2. Protocol Overview 939 The base Diameter protocol may be used by itself for accounting 940 applications, but for use in authentication and authorization it is 941 always extended for a particular application. Two Diameter 942 applications are defined by companion documents: NASREQ [RFC4005], 943 Mobile IPv4 [RFC4004]. These applications are introduced in this 944 document but specified elsewhere. Additional Diameter applications 945 MAY be defined in the future (see Section 11.3). 947 Diameter Clients MUST support the base protocol, which includes 948 accounting. In addition, they MUST fully support each Diameter 949 application that is needed to implement the client's service, e.g., 950 NASREQ and/or Mobile IPv4. A Diameter Client that does not support 951 both NASREQ and Mobile IPv4, MUST be referred to as "Diameter X 952 Client" where X is the application which it supports, and not a 953 "Diameter Client". 955 Diameter Servers MUST support the base protocol, which includes 956 accounting. In addition, they MUST fully support each Diameter 957 application that is needed to implement the intended service, e.g., 958 NASREQ and/or Mobile IPv4. A Diameter Server that does not support 959 both NASREQ and Mobile IPv4, MUST be referred to as "Diameter X 960 Server" where X is the application which it supports, and not a 961 "Diameter Server". 963 Diameter Relays and redirect agents are, by definition, protocol 964 transparent, and MUST transparently support the Diameter base 965 protocol, which 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 which does not support 971 also both NASREQ and Mobile IPv4, MUST be referred to as "Diameter X 972 Proxy" where X is the application which it supports, and not a 973 "Diameter Proxy". 975 The base Diameter protocol concerns itself with capabilities 976 negotiation, how messages are sent and how peers may eventually be 977 abandoned. The base protocol also defines certain rules that apply 978 to all exchanges of messages between Diameter nodes. 980 Communication between Diameter peers begins with one peer sending a 981 message to another Diameter peer. The set of AVPs included in the 982 message is determined by a particular Diameter application. One AVP 983 that is included to reference a user's session is the Session-Id. 985 The initial request for authentication and/or authorization of a user 986 would include the Session-Id. The Session-Id is then used in all 987 subsequent messages to identify the user's session (see Section 8 for 988 more information). The communicating party may accept the request, 989 or reject it by returning an answer message with the Result-Code AVP 990 set to indicate an error occurred. The specific behavior of the 991 Diameter server or client receiving a request depends on the Diameter 992 application employed. 994 Session state (associated with a Session-Id) MUST be freed upon 995 receipt of the Session-Termination-Request, Session-Termination- 996 Answer, expiration of authorized service time in the Session-Timeout 997 AVP, and according to rules established in a particular Diameter 998 application. 1000 2.1. Transport 1002 Transport profile is defined in [RFC3539]. 1004 The base Diameter protocol is run on port 3868 of both TCP [RFC793] 1005 and SCTP [RFC2960] transport protocols. 1007 Diameter clients MUST support either TCP or SCTP, while agents and 1008 servers MUST support both. Future versions of this specification MAY 1009 mandate that clients support SCTP. 1011 A Diameter node MAY initiate connections from a source port other 1012 than the one that it declares it accepts incoming connections on, and 1013 MUST be prepared to receive connections on port 3868. A given 1014 Diameter instance of the peer state machine MUST NOT use more than 1015 one transport connection to communicate with a given peer, unless 1016 multiple instances exist on the peer in which case a separate 1017 connection per process is allowed. 1019 When no transport connection exists with a peer, an attempt to 1020 connect SHOULD be periodically made. This behavior is handled via 1021 the Tc timer, whose recommended value is 30 seconds. There are 1022 certain exceptions to this rule, such as when a peer has terminated 1023 the transport connection stating that it does not wish to 1024 communicate. 1026 When connecting to a peer and either zero or more transports are 1027 specified, SCTP SHOULD be tried first, followed by TCP. See Section 1028 5.2 for more information on peer discovery. 1030 Diameter implementations SHOULD be able to interpret ICMP protocol 1031 port unreachable messages as explicit indications that the server is 1032 not reachable, subject to security policy on trusting such messages. 1034 Diameter implementations SHOULD also be able to interpret a reset 1035 from the transport and timed-out connection attempts. If Diameter 1036 receives data up from TCP that cannot be parsed or identified as a 1037 Diameter error made by the peer, the stream is compromised and cannot 1038 be recovered. The transport connection MUST be closed using a RESET 1039 call (send a TCP RST bit) or an SCTP ABORT message (graceful closure 1040 is compromised). 1042 2.1.1. SCTP Guidelines 1044 The following are guidelines for Diameter implementations that 1045 support SCTP: 1047 1. For interoperability: All Diameter nodes MUST be prepared to 1048 receive Diameter messages on any SCTP stream in the association. 1050 2. To prevent blocking: All Diameter nodes SHOULD utilize all SCTP 1051 streams available to the association to prevent head-of-the-line 1052 blocking. 1054 2.2. Securing Diameter Messages 1056 Connections between Diameter peers SHOULD be protected by TLS. All 1057 Diameter base protocol implementations MUST support the use of TLS. 1058 If desired, additional security measures that are transparent to and 1059 independent of Diameter, such as IPSec [RFC4301], can be deployed to 1060 secure connections between peers. The Diameter protocol MUST NOT be 1061 used without any security mechanism. 1063 2.3. Diameter Application Compliance 1065 Application Ids are advertised during the capabilities exchange phase 1066 (see Section 5.3). For a given application, advertising support of 1067 an application implies that the sender supports all command codes, 1068 and the AVPs specified in the associated ABNFs, described in the 1069 specification. 1071 An implementation MAY add arbitrary non-mandatory AVPs to a command 1072 defined in an application, including vendor-specific AVPs only if the 1073 commands ABNF allows for it. Please refer to Section 11.1.1 for 1074 details. 1076 2.4. Application Identifiers 1078 Each Diameter application MUST have an IANA assigned Application Id 1079 (see Section 11.3). The base protocol does not require an 1080 Application Id since its support is mandatory. During the 1081 capabilities exchange, Diameter nodes inform their peers of locally 1082 supported applications. Furthermore, all Diameter messages contain 1083 an Application Id, which is used in the message forwarding process. 1085 The following Application Id values are defined: 1087 Diameter Common Messages 0 1088 NASREQ 1 [RFC4005] 1089 Mobile-IP 2 [RFC4004] 1090 Diameter Base Accounting 3 1091 Relay 0xffffffff 1093 Relay and redirect agents MUST advertise the Relay Application 1094 Identifier, while all other Diameter nodes MUST advertise locally 1095 supported applications. The receiver of a Capabilities Exchange 1096 message advertising Relay service MUST assume that the sender 1097 supports all current and future applications. 1099 Diameter relay and proxy agents are responsible for finding an 1100 upstream server that supports the application of a particular 1101 message. If none can be found, an error message is returned with the 1102 Result-Code AVP set to DIAMETER_UNABLE_TO_DELIVER. 1104 2.5. Connections vs. Sessions 1106 This section attempts to provide the reader with an understanding of 1107 the difference between connection and session, which are terms used 1108 extensively throughout this document. 1110 A connection is a transport level connection between two peers, used 1111 to send and receive Diameter messages. A session is a logical 1112 concept at the application layer, and is shared between an access 1113 device and a server, and is identified via the Session-Id AVP. 1115 +--------+ +-------+ +--------+ 1116 | Client | | Relay | | Server | 1117 +--------+ +-------+ +--------+ 1118 <----------> <----------> 1119 peer connection A peer connection B 1121 <-----------------------------> 1122 User session x 1124 Figure 1: Diameter connections and sessions 1126 In the example provided in Figure 1, peer connection A is established 1127 between the Client and its local Relay. Peer connection B is 1128 established between the Relay and the Server. User session X spans 1129 from the Client via the Relay to the Server. Each "user" of a 1130 service causes an auth request to be sent, with a unique session 1131 identifier. Once accepted by the server, both the client and the 1132 server are aware of the session. 1134 It is important to note that there is no relationship between a 1135 connection and a session, and that Diameter messages for multiple 1136 sessions are all multiplexed through a single connection. Also note 1137 that Diameter messages pertaining to the session, both application 1138 specific and those that are defined in this document such as ASR/ASA, 1139 RAR/RAA and STR/STA MUST carry the Application Id of the application. 1140 Diameter messages pertaining to peer connection establishment and 1141 maintenance such as CER/CEA, DWR/DWA and DPR/DPA MUST carry an 1142 Application Id of zero (0). 1144 2.6. Peer Table 1146 The Diameter Peer Table is used in message forwarding, and referenced 1147 by the Routing Table. A Peer Table entry contains the following 1148 fields: 1150 Host identity 1152 Following the conventions described for the DiameterIdentity 1153 derived AVP data format in Section 4.4. This field contains the 1154 contents of the Origin-Host (Section 6.3) AVP found in the CER or 1155 CEA message. 1157 StatusT 1159 This is the state of the peer entry, and MUST match one of the 1160 values listed in Section 5.6. 1162 Static or Dynamic 1164 Specifies whether a peer entry was statically configured, or 1165 dynamically discovered. 1167 Expiration time 1169 Specifies the time at which dynamically discovered peer table 1170 entries are to be either refreshed, or expired. 1172 TLS Enabled 1174 Specifies whether TLS is to be used when communicating with the 1175 peer. 1177 Additional security information, when needed (e.g., keys, 1178 certificates) 1180 2.7. Routing Table 1182 All Realm-Based routing lookups are performed against what is 1183 commonly known as the Routing Table (see Section 12). A Routing 1184 Table Entry contains the following fields: 1186 Realm Name 1188 This is the field that is typically used as a primary key in the 1189 routing table lookups. Note that some implementations perform 1190 their lookups based on longest-match-from-the-right on the realm 1191 rather than requiring an exact match. 1193 Application Identifier 1195 An application is identified by an Application Id. A route entry 1196 can have a different destination based on the Application Id in 1197 the message header. This field MUST be used as a secondary key 1198 field in routing table lookups. 1200 Local Action 1202 The Local Action field is used to identify how a message should be 1203 treated. The following actions are supported: 1205 1. LOCAL - Diameter messages that resolve to a route entry with 1206 the Local Action set to Local can be satisfied locally, and do 1207 not need to be routed to another server. 1209 2. RELAY - All Diameter messages that fall within this category 1210 MUST be routed to a next hop server, without modifying any 1211 non-routing AVPs. See Section 6.1.9 for relaying guidelines 1213 3. PROXY - All Diameter messages that fall within this category 1214 MUST be routed to a next hop server. The local server MAY 1215 apply its local policies to the message by including new AVPs 1216 to the message prior to routing. See Section 6.1.9 for 1217 proxying guidelines. 1219 4. REDIRECT - Diameter messages that fall within this category 1220 MUST have the identity of the home Diameter server(s) 1221 appended, and returned to the sender of the message. See 1222 Section 6.1.9 for redirect guidelines. 1224 Server Identifier 1226 One or more servers the message is to be routed to. These servers 1227 MUST also be present in the Peer table. When the Local Action is 1228 set to RELAY or PROXY, this field contains the identity of the 1229 server(s) the message must be routed to. When the Local Action 1230 field is set to REDIRECT, this field contains the identity of one 1231 or more servers the message should be redirected to. 1233 Static or Dynamic 1235 Specifies whether a route entry was statically configured, or 1236 dynamically discovered. 1238 Expiration time 1240 Specifies the time which a dynamically discovered route table 1241 entry expires. 1243 It is important to note that Diameter agents MUST support at least 1244 one of the LOCAL, RELAY, PROXY or REDIRECT modes of operation. 1245 Agents do not need to support all modes of operation in order to 1246 conform with the protocol specification, but MUST follow the protocol 1247 compliance guidelines in Section 2. Relay agents MUST NOT reorder 1248 AVPs, and proxies MUST NOT reorder AVPs. 1250 The routing table MAY include a default entry that MUST be used for 1251 any requests not matching any of the other entries. The routing 1252 table MAY consist of only such an entry. 1254 When a request is routed, the target server MUST have advertised the 1255 Application Id (see Section 2.4) for the given message, or have 1256 advertised itself as a relay or proxy agent. Otherwise, an error is 1257 returned with the Result-Code AVP set to DIAMETER_UNABLE_TO_DELIVER. 1259 2.8. Role of Diameter Agents 1261 In addition to client and servers, the Diameter protocol introduces 1262 relay, proxy, redirect, and translation agents, each of which is 1263 defined in Section 1.3. These Diameter agents are useful for several 1264 reasons: 1266 o They can distribute administration of systems to a configurable 1267 grouping, including the maintenance of security associations. 1269 o They can be used for concentration of requests from an number of 1270 co-located or distributed NAS equipment sets to a set of like user 1271 groups. 1273 o They can do value-added processing to the requests or responses. 1275 o They can be used for load balancing. 1277 o A complex network will have multiple authentication sources, they 1278 can sort requests and forward towards the correct target. 1280 The Diameter protocol requires that agents maintain transaction 1281 state, which is used for failover purposes. Transaction state 1282 implies that upon forwarding a request, its Hop-by-Hop identifier is 1283 saved; the field is replaced with a locally unique identifier, which 1284 is restored to its original value when the corresponding answer is 1285 received. The request's state is released upon receipt of the 1286 answer. A stateless agent is one that only maintains transaction 1287 state. 1289 The Proxy-Info AVP allows stateless agents to add local state to a 1290 Diameter request, with the guarantee that the same state will be 1291 present in the answer. However, the protocol's failover procedures 1292 require that agents maintain a copy of pending requests. 1294 A stateful agent is one that maintains session state information; by 1295 keeping track of all authorized active sessions. Each authorized 1296 session is bound to a particular service, and its state is considered 1297 active either until it is notified otherwise, or by expiration. Each 1298 authorized session has an expiration, which is communicated by 1299 Diameter servers via the Session-Timeout AVP. 1301 Maintaining session state MAY be useful in certain applications, such 1302 as: 1304 o Protocol translation (e.g., RADIUS <-> Diameter) 1306 o Limiting resources authorized to a particular user 1308 o Per user or transaction auditing 1310 A Diameter agent MAY act in a stateful manner for some requests and 1311 be stateless for others. A Diameter implementation MAY act as one 1312 type of agent for some requests, and as another type of agent for 1313 others. 1315 2.8.1. Relay Agents 1317 Relay Agents are Diameter agents that accept requests and route 1318 messages to other Diameter nodes based on information found in the 1319 messages (e.g., Destination-Realm). This routing decision is 1320 performed using a list of supported realms, and known peers. This is 1321 known as the Routing Table, as is defined further in Section 2.7. 1323 Relays MAY be used to aggregate requests from multiple Network Access 1324 Servers (NASes) within a common geographical area (POP). The use of 1325 Relays is advantageous since it eliminates the need for NASes to be 1326 configured with the necessary security information they would 1327 otherwise require to communicate with Diameter servers in other 1328 realms. Likewise, this reduces the configuration load on Diameter 1329 servers that would otherwise be necessary when NASes are added, 1330 changed or deleted. 1332 Relays modify Diameter messages by inserting and removing routing 1333 information, but do not modify any other portion of a message. 1334 Relays SHOULD NOT maintain session state but MUST maintain 1335 transaction state. 1337 +------+ ---------> +------+ ---------> +------+ 1338 | | 1. Request | | 2. Request | | 1339 | NAS | | DRL | | HMS | 1340 | | 4. Answer | | 3. Answer | | 1341 +------+ <--------- +------+ <--------- +------+ 1342 example.net example.net example.com 1344 Figure 2: Relaying of Diameter messages 1346 The example provided in Figure 2 depicts a request issued from NAS, 1347 which is an access device, for the user bob@example.com. Prior to 1348 issuing the request, NAS performs a Diameter route lookup, using 1349 "example.com" as the key, and determines that the message is to be 1350 relayed to DRL, which is a Diameter Relay. DRL performs the same 1351 route lookup as NAS, and relays the message to HMS, which is 1352 example.com's Home Diameter Server. HMS identifies that the request 1353 can be locally supported (via the realm), processes the 1354 authentication and/or authorization request, and replies with an 1355 answer, which is routed back to NAS using saved transaction state. 1357 Since Relays do not perform any application level processing, they 1358 provide relaying services for all Diameter applications, and 1359 therefore MUST advertise the Relay Application Id. 1361 2.8.2. Proxy Agents 1363 Similarly to relays, proxy agents route Diameter messages using the 1364 Diameter Routing Table. However, they differ since they modify 1365 messages to implement policy enforcement. This requires that proxies 1366 maintain the state of their downstream peers (e.g., access devices) 1367 to enforce resource usage, provide admission control, and 1368 provisioning. 1370 Proxies MAY be used in call control centers or access ISPs that 1371 provide outsourced connections, they can monitor the number and types 1372 of ports in use, and make allocation and admission decisions 1373 according to their configuration. 1375 Proxies that wish to limit resources MUST maintain session state. 1376 All proxies MUST maintain transaction state. 1378 Since enforcing policies requires an understanding of the service 1379 being provided, Proxies MUST only advertise the Diameter applications 1380 they support. 1382 2.8.3. Redirect Agents 1384 Redirect agents are useful in scenarios where the Diameter routing 1385 configuration needs to be centralized. An example is a redirect 1386 agent that provides services to all members of a consortium, but does 1387 not wish to be burdened with relaying all messages between realms. 1388 This scenario is advantageous since it does not require that the 1389 consortium provide routing updates to its members when changes are 1390 made to a member's infrastructure. 1392 Since redirect agents do not relay messages, and only return an 1393 answer with the information necessary for Diameter agents to 1394 communicate directly, they do not modify messages. Since redirect 1395 agents do not receive answer messages, they cannot maintain session 1396 state. Further, since redirect agents never relay requests, they are 1397 not required to maintain transaction state. 1399 The example provided in Figure 3 depicts a request issued from the 1400 access device, NAS, for the user bob@example.com. The message is 1401 forwarded by the NAS to its relay, DRL, which does not have a routing 1402 entry in its Diameter Routing Table for example.com. DRL has a 1403 default route configured to DRD, which is a redirect agent that 1404 returns a redirect notification to DRL, as well as HMS' contact 1405 information. Upon receipt of the redirect notification, DRL 1406 establishes a transport connection with HMS, if one doesn't already 1407 exist, and forwards the request to it. 1409 +------+ 1410 | | 1411 | DRD | 1412 | | 1413 +------+ 1414 ^ | 1415 2. Request | | 3. Redirection 1416 | | Notification 1417 | v 1418 +------+ ---------> +------+ ---------> +------+ 1419 | | 1. Request | | 4. Request | | 1420 | NAS | | DRL | | HMS | 1421 | | 6. Answer | | 5. Answer | | 1422 +------+ <--------- +------+ <--------- +------+ 1423 example.net example.net example.com 1425 Figure 3: Redirecting a Diameter Message 1427 Since redirect agents do not perform any application level 1428 processing, they provide relaying services for all Diameter 1429 applications, and therefore MUST advertise the Relay Application 1430 Identifier. 1432 2.8.4. Translation Agents 1434 A translation agent is a device that provides translation between two 1435 protocols (e.g., RADIUS<->Diameter, TACACS+<->Diameter). Translation 1436 agents are likely to be used as aggregation servers to communicate 1437 with a Diameter infrastructure, while allowing for the embedded 1438 systems to be migrated at a slower pace. 1440 Given that the Diameter protocol introduces the concept of long-lived 1441 authorized sessions, translation agents MUST be session stateful and 1442 MUST maintain transaction state. 1444 Translation of messages can only occur if the agent recognizes the 1445 application of a particular request, and therefore translation agents 1446 MUST only advertise their locally supported applications. 1448 +------+ ---------> +------+ ---------> +------+ 1449 | | RADIUS Request | | Diameter Request | | 1450 | NAS | | TLA | | HMS | 1451 | | RADIUS Answer | | Diameter Answer | | 1452 +------+ <--------- +------+ <--------- +------+ 1453 example.net example.net example.com 1455 Figure 4: Translation of RADIUS to Diameter 1457 2.9. Diameter Path Authorization 1459 As noted in Section 2.2, Diameter provides transmission level 1460 security for each connection using TLS. Therefore, each connection 1461 can be authenticated, replay and integrity protected. 1463 In addition to authenticating each connection, each connection as 1464 well as the entire session MUST also be authorized. Before 1465 initiating a connection, a Diameter Peer MUST check that its peers 1466 are authorized to act in their roles. For example, a Diameter peer 1467 may be authentic, but that does not mean that it is authorized to act 1468 as a Diameter Server advertising a set of Diameter applications. 1470 Prior to bringing up a connection, authorization checks are performed 1471 at each connection along the path. Diameter capabilities negotiation 1472 (CER/CEA) also MUST be carried out, in order to determine what 1473 Diameter applications are supported by each peer. Diameter sessions 1474 MUST be routed only through authorized nodes that have advertised 1475 support for the Diameter application required by the session. 1477 As noted in Section 6.1.9, a relay or proxy agent MUST append a 1478 Route-Record AVP to all requests forwarded. The AVP contains the 1479 identity of the peer the request was received from. 1481 The home Diameter server, prior to authorizing a session, MUST check 1482 the Route-Record AVPs to make sure that the route traversed by the 1483 request is acceptable. For example, administrators within the home 1484 realm may not wish to honor requests that have been routed through an 1485 untrusted realm. By authorizing a request, the home Diameter server 1486 is implicitly indicating its willingness to engage in the business 1487 transaction as specified by the contractual relationship between the 1488 server and the previous hop. A DIAMETER_AUTHORIZATION_REJECTED error 1489 message (see Section 7.1.5) is sent if the route traversed by the 1490 request is unacceptable. 1492 A home realm may also wish to check that each accounting request 1493 message corresponds to a Diameter response authorizing the session. 1494 Accounting requests without corresponding authorization responses 1495 SHOULD be subjected to further scrutiny, as should accounting 1496 requests indicating a difference between the requested and provided 1497 service. 1499 Forwarding of an authorization response is considered evidence of a 1500 willingness to take on financial risk relative to the session. A 1501 local realm may wish to limit this exposure, for example, by 1502 establishing credit limits for intermediate realms and refusing to 1503 accept responses which would violate those limits. By issuing an 1504 accounting request corresponding to the authorization response, the 1505 local realm implicitly indicates its agreement to provide the service 1506 indicated in the authorization response. If the service cannot be 1507 provided by the local realm, then a DIAMETER_UNABLE_TO_COMPLY error 1508 message MUST be sent within the accounting request; a Diameter client 1509 receiving an authorization response for a service that it cannot 1510 perform MUST NOT substitute an alternate service, and then send 1511 accounting requests for the alternate service instead. 1513 3. Diameter Header 1515 A summary of the Diameter header format is shown below. The fields 1516 are transmitted in network byte order. 1518 0 1 2 3 1519 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 1520 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1521 | Version | Message Length | 1522 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1523 | command flags | Command-Code | 1524 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1525 | Application-ID | 1526 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1527 | Hop-by-Hop Identifier | 1528 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1529 | End-to-End Identifier | 1530 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1531 | AVPs ... 1532 +-+-+-+-+-+-+-+-+-+-+-+-+- 1534 Version 1536 This Version field MUST be set to 1 to indicate Diameter Version 1537 1. 1539 Message Length 1541 The Message Length field is three octets and indicates the length 1542 of the Diameter message including the header fields. 1544 Command Flags 1546 The Command Flags field is eight bits. The following bits are 1547 assigned: 1549 0 1 2 3 4 5 6 7 1550 +-+-+-+-+-+-+-+-+ 1551 |R P E T r r r r| 1552 +-+-+-+-+-+-+-+-+ 1554 R(equest) 1556 If set, the message is a request. If cleared, the message is 1557 an answer. 1559 P(roxiable) 1561 If set, the message MAY be proxied, relayed or redirected. If 1562 cleared, the message MUST be locally processed. 1564 E(rror) 1566 If set, the message contains a protocol error, and the message 1567 will not conform to the ABNF described for this command. 1568 Messages with the 'E' bit set are commonly referred to as error 1569 messages. This bit MUST NOT be set in request messages. See 1570 Section 7.2. 1572 T(Potentially re-transmitted message) 1574 This flag is set after a link failover procedure, to aid the 1575 removal of duplicate requests. It is set when resending 1576 requests not yet acknowledged, as an indication of a possible 1577 duplicate due to a link failure. This bit MUST be cleared when 1578 sending a request for the first time, otherwise the sender MUST 1579 set this flag. Diameter agents only need to be concerned about 1580 the number of requests they send based on a single received 1581 request; retransmissions by other entities need not be tracked. 1582 Diameter agents that receive a request with the T flag set, 1583 MUST keep the T flag set in the forwarded request. This flag 1584 MUST NOT be set if an error answer message (e.g., a protocol 1585 error) has been received for the earlier message. It can be 1586 set only in cases where no answer has been received from the 1587 server for a request and the request is sent again. This flag 1588 MUST NOT be set in answer messages. 1590 r(eserved) 1592 These flag bits are reserved for future use, and MUST be set to 1593 zero, and ignored by the receiver. 1595 Command-Code 1597 The Command-Code field is three octets, and is used in order to 1598 communicate the command associated with the message. The 24-bit 1599 address space is managed by IANA (see Section 11.2.1). 1601 Command-Code values 16,777,214 and 16,777,215 (hexadecimal values 1602 FFFFFE -FFFFFF) are reserved for experimental use (See Section 1603 11.3). 1605 Application-ID 1607 Application-ID is four octets and is used to identify to which 1608 application the message is applicable for. The application can be 1609 an authentication application, an accounting application or a 1610 vendor specific application. See Section 11.3 for the possible 1611 values that the application-id may use. 1613 The application-id in the header MUST be the same as what is 1614 contained in any relevant application-id AVPs contained in the 1615 message. 1617 Hop-by-Hop Identifier 1619 The Hop-by-Hop Identifier is an unsigned 32-bit integer field (in 1620 network byte order) and aids in matching requests and replies. 1621 The sender MUST ensure that the Hop-by-Hop identifier in a request 1622 is unique on a given connection at any given time, and MAY attempt 1623 to ensure that the number is unique across reboots. The sender of 1624 an Answer message MUST ensure that the Hop-by-Hop Identifier field 1625 contains the same value that was found in the corresponding 1626 request. The Hop-by-Hop identifier is normally a monotonically 1627 increasing number, whose start value was randomly generated. An 1628 answer message that is received with an unknown Hop-by-Hop 1629 Identifier MUST be discarded. 1631 End-to-End Identifier 1633 The End-to-End Identifier is an unsigned 32-bit integer field (in 1634 network byte order) and is used to detect duplicate messages. 1635 Upon reboot implementations MAY set the high order 12 bits to 1636 contain the low order 12 bits of current time, and the low order 1637 20 bits to a random value. Senders of request messages MUST 1638 insert a unique identifier on each message. The identifier MUST 1639 remain locally unique for a period of at least 4 minutes, even 1640 across reboots. The originator of an Answer message MUST ensure 1641 that the End-to-End Identifier field contains the same value that 1642 was found in the corresponding request. The End-to-End Identifier 1643 MUST NOT be modified by Diameter agents of any kind. The 1644 combination of the Origin-Host (see Section 6.3) and this field is 1645 used to detect duplicates. Duplicate requests SHOULD cause the 1646 same answer to be transmitted (modulo the hop-by-hop Identifier 1647 field and any routing AVPs that may be present), and MUST NOT 1648 affect any state that was set when the original request was 1649 processed. Duplicate answer messages that are to be locally 1650 consumed (see Section 6.2) SHOULD be silently discarded. 1652 AVPs 1654 AVPs are a method of encapsulating information relevant to the 1655 Diameter message. See Section 4 for more information on AVPs. 1657 3.1. Command Codes 1659 Each command Request/Answer pair is assigned a command code, and the 1660 sub-type (i.e., request or answer) is identified via the 'R' bit in 1661 the Command Flags field of the Diameter header. 1663 Every Diameter message MUST contain a command code in its header's 1664 Command-Code field, which is used to determine the action that is to 1665 be taken for a particular message. The following Command Codes are 1666 defined in the Diameter base protocol: 1668 Command-Name Abbrev. Code Reference 1669 -------------------------------------------------------- 1670 Abort-Session-Request ASR 274 8.5.1 1671 Abort-Session-Answer ASA 274 8.5.2 1672 Accounting-Request ACR 271 9.7.1 1673 Accounting-Answer ACA 271 9.7.2 1674 Capabilities-Exchange- CER 257 5.3.1 1675 Request 1676 Capabilities-Exchange- CEA 257 5.3.2 1677 Answer 1678 Device-Watchdog-Request DWR 280 5.5.1 1679 Device-Watchdog-Answer DWA 280 5.5.2 1680 Disconnect-Peer-Request DPR 282 5.4.1 1681 Disconnect-Peer-Answer DPA 282 5.4.2 1682 Re-Auth-Request RAR 258 8.3.1 1683 Re-Auth-Answer RAA 258 8.3.2 1684 Session-Termination- STR 275 8.4.1 1685 Request 1686 Session-Termination- STA 275 8.4.2 1687 Answer 1689 3.2. Command Code ABNF specification 1691 Every Command Code defined MUST include a corresponding ABNF 1692 specification, which is used to define the AVPs that MUST or MAY be 1693 present. The following format is used in the definition: 1695 command-def = command-name "::=" diameter-message 1697 command-name = diameter-name 1698 diameter-name = ALPHA *(ALPHA / DIGIT / "-") 1700 diameter-message = header [ *fixed] [ *required] [ *optional] 1702 header = "<" "Diameter Header:" command-id 1703 [r-bit] [p-bit] [e-bit] [application-id] ">" 1705 application-id = 1*DIGIT 1707 command-id = 1*DIGIT 1708 ; The Command Code assigned to the command 1710 r-bit = ", REQ" 1711 ; If present, the 'R' bit in the Command 1712 ; Flags is set, indicating that the message 1713 ; is a request, as opposed to an answer. 1715 p-bit = ", PXY" 1716 ; If present, the 'P' bit in the Command 1717 ; Flags is set, indicating that the message 1718 ; is proxiable. 1720 e-bit = ", ERR" 1721 ; If present, the 'E' bit in the Command 1722 ; Flags is set, indicating that the answer 1723 ; message contains a Result-Code AVP in 1724 ; the "protocol error" class. 1726 fixed = [qual] "<" avp-spec ">" 1727 ; Defines the fixed position of an AVP 1729 required = [qual] "{" avp-spec "}" 1730 ; The AVP MUST be present and can appear 1731 ; anywhere in the message. 1733 optional = [qual] "[" avp-name "]" 1734 ; The avp-name in the 'optional' rule cannot 1735 ; evaluate to any AVP Name which is included 1736 ; in a fixed or required rule. The AVP can 1737 ; appear anywhere in the message. 1739 qual = [min] "*" [max] 1740 ; See ABNF conventions, RFC 4234 Section 6.6. 1741 ; The absence of any qualifiers depends on 1742 ; whether it precedes a fixed, required, or 1743 ; optional rule. If a fixed or required rule has 1744 ; no qualifier, then exactly one such AVP MUST 1745 ; be present. If an optional rule has no 1746 ; qualifier, then 0 or 1 such AVP may be 1747 ; present. If an optional rule has a qualifier, 1748 ; then the value of min MUST be 0 if present. 1749 ; 1750 ; NOTE: "[" and "]" have a different meaning 1751 ; than in ABNF (see the optional rule, above). 1752 ; These braces cannot be used to express 1753 ; optional fixed rules (such as an optional 1754 ; ICV at the end). To do this, the convention 1755 ; is '0*1fixed'. 1757 min = 1*DIGIT 1758 ; The minimum number of times the element may 1759 ; be present. The default value is zero. 1761 max = 1*DIGIT 1762 ; The maximum number of times the element may 1763 ; be present. The default value is infinity. A 1764 ; value of zero implies the AVP MUST NOT be 1765 ; present. 1767 avp-spec = diameter-name 1768 ; The avp-spec has to be an AVP Name, defined 1769 ; in the base or extended Diameter 1770 ; specifications. 1772 avp-name = avp-spec / "AVP" 1773 ; The string "AVP" stands for *any* arbitrary AVP 1774 ; Name, not otherwise listed in that command code 1775 ; definition. 1777 The following is a definition of a fictitious command code: 1779 Example-Request ::= < Diameter Header: 9999999, REQ, PXY > 1780 { User-Name } 1781 * { Origin-Host } 1782 * [ AVP 1784 3.3. Diameter Command Naming Conventions 1786 Diameter command names typically includes one or more English words 1787 followed by the verb Request or Answer. Each English word is 1788 delimited by a hyphen. A three-letter acronym for both the request 1789 and answer is also normally provided. 1791 An example is a message set used to terminate a session. The command 1792 name is Session-Terminate-Request and Session-Terminate-Answer, while 1793 the acronyms are STR and STA, respectively. 1795 Both the request and the answer for a given command share the same 1796 command code. The request is identified by the R(equest) bit in the 1797 Diameter header set to one (1), to ask that a particular action be 1798 performed, such as authorizing a user or terminating a session. Once 1799 the receiver has completed the request it issues the corresponding 1800 answer, which includes a result code that communicates one of the 1801 following: 1803 o The request was successful 1805 o The request failed 1807 o An additional request MUST be sent to provide information the peer 1808 requires prior to returning a successful or failed answer. 1810 o The receiver could not process the request, but provides 1811 information about a Diameter peer that is able to satisfy the 1812 request, known as redirect. 1814 Additional information, encoded within AVPs, MAY also be included in 1815 answer messages. 1817 4. Diameter AVPs 1819 Diameter AVPs carry specific authentication, accounting, 1820 authorization and routing information as well as configuration 1821 details for the request and reply. 1823 Some AVPs MAY be listed more than once. The effect of such an AVP is 1824 specific, and is specified in each case by the AVP description. 1826 Each AVP of type OctetString MUST be padded to align on a 32-bit 1827 boundary, while other AVP types align naturally. A number of zero- 1828 valued bytes are added to the end of the AVP Data field till a word 1829 boundary is reached. The length of the padding is not reflected in 1830 the AVP Length field. 1832 4.1. AVP Header 1834 The fields in the AVP header MUST be sent in network byte order. The 1835 format of the header is: 1837 0 1 2 3 1838 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 1839 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1840 | AVP Code | 1841 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1842 |V M r r r r r r| AVP Length | 1843 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1844 | Vendor-ID (opt) | 1845 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1846 | Data ... 1847 +-+-+-+-+-+-+-+-+ 1849 AVP Code 1851 The AVP Code, combined with the Vendor-Id field, identifies the 1852 attribute uniquely. AVP numbers 1 through 255 are reserved for 1853 backward compatibility with RADIUS, without setting the Vendor-Id 1854 field. AVP numbers 256 and above are used for Diameter, which are 1855 allocated by IANA (see Section 11.1). 1857 AVP Flags 1859 The AVP Flags field informs the receiver how each attribute must 1860 be handled. The 'r' (reserved) bits are unused and SHOULD be set 1861 to 0. Note that subsequent Diameter applications MAY define 1862 additional bits within the AVP Header, and an unrecognized bit 1863 SHOULD be considered an error. The 'P' bit indicates the need for 1864 encryption for end-to-end security. Note that the 'P' bit has 1865 been deprecated and MUST be to zero(0) when sending an AVP and 1866 ingnored on receipt of an AVP. 1868 The 'M' Bit, known as the Mandatory bit, indicates whether support 1869 of the AVP is required. If an AVP with the 'M' bit set is 1870 received by a Diameter client, server, proxy, or translation agent 1871 and either the AVP or its value is unrecognized, the message MUST 1872 be rejected. An exception to this rule applies when the AVP is 1873 embedded within a Grouped AVP. See Section 4.4 for details. 1874 Diameter Relay and redirect agents MUST NOT reject messages with 1875 unrecognized AVPs. 1877 The 'M' bit MUST be set according to the rules defined for the AVP 1878 containing it. In order to preserve interoperability, a Diameter 1879 implementation MUST be able to exclude from a Diameter message any 1880 Mandatory AVP which is neither defined in the base Diameter 1881 protocol nor in any of the Diameter Application specifications 1882 governing the message in which it appears. It MAY do this in one 1883 of the following ways: 1885 1. If a message is rejected because it contains a Mandatory AVP 1886 which is neither defined in the base Diameter standard nor in 1887 any of the Diameter Application specifications governing the 1888 message in which it appears, the implementation may resend the 1889 message without the AVP, possibly inserting additional 1890 standard AVPs instead. 1892 2. A configuration option may be provided on a system wide, per 1893 peer, or per realm basis that would allow/prevent particular 1894 Mandatory AVPs to be sent. Thus an administrator could change 1895 the configuration to avoid interoperability problems. 1897 Diameter implementations are required to support all Mandatory 1898 AVPs which are allowed by the message's formal syntax and defined 1899 either in the base Diameter standard or in one of the Diameter 1900 Application specifications governing the message. 1902 AVPs with the 'M' bit cleared are informational only and a 1903 receiver that receives a message with such an AVP that is not 1904 supported, or whose value is not supported, MAY simply ignore the 1905 AVP. 1907 The 'V' bit, known as the Vendor-Specific bit, indicates whether 1908 the optional Vendor-ID field is present in the AVP header. When 1909 set the AVP Code belongs to the specific vendor code address 1910 space. 1912 Unless otherwise noted, AVPs will have the following default AVP 1913 Flags field settings: 1915 The 'M' bit MUST be set. The 'V' bit MUST NOT be set. 1917 AVP Length 1919 The AVP Length field is three octets, and indicates the number of 1920 octets in this AVP including the AVP Code, AVP Length, AVP Flags, 1921 Vendor-ID field (if present) and the AVP data. If a message is 1922 received with an invalid attribute length, the message SHOULD be 1923 rejected. 1925 4.1.1. Optional Header Elements 1927 The AVP Header contains one optional field. This field is only 1928 present if the respective bit-flag is enabled. 1930 Vendor-ID 1932 The Vendor-ID field is present if the 'V' bit is set in the AVP 1933 Flags field. The optional four-octet Vendor-ID field contains the 1934 IANA assigned "SMI Network Management Private Enterprise Codes" 1935 [RFC3232] value, encoded in network byte order. Any vendor 1936 wishing to implement a vendor-specific Diameter AVP MUST use their 1937 own Vendor-ID along with their privately managed AVP address 1938 space, guaranteeing that they will not collide with any other 1939 vendor's vendor-specific AVP(s), nor with future IETF 1940 applications. 1942 A vendor ID value of zero (0) corresponds to the IETF adopted AVP 1943 values, as managed by the IANA. Since the absence of the vendor 1944 ID field implies that the AVP in question is not vendor specific, 1945 implementations MUST NOT use the zero (0) vendor ID. 1947 4.2. Basic AVP Data Formats 1949 The Data field is zero or more octets and contains information 1950 specific to the Attribute. The format and length of the Data field 1951 is determined by the AVP Code and AVP Length fields. The format of 1952 the Data field MUST be one of the following base data types or a data 1953 type derived from the base data types. In the event that a new Basic 1954 AVP Data Format is needed, a new version of this RFC MUST be created. 1956 OctetString 1958 The data contains arbitrary data of variable length. Unless 1959 otherwise noted, the AVP Length field MUST be set to at least 8 1960 (12 if the 'V' bit is enabled). AVP Values of this type that are 1961 not a multiple of four-octets in length is followed by the 1962 necessary padding so that the next AVP (if any) will start on a 1963 32-bit boundary. 1965 Integer32 1967 32 bit signed value, in network byte order. The AVP Length field 1968 MUST be set to 12 (16 if the 'V' bit is enabled). 1970 Integer64 1972 64 bit signed value, in network byte order. The AVP Length field 1973 MUST be set to 16 (20 if the 'V' bit is enabled). 1975 Unsigned32 1977 32 bit unsigned value, in network byte order. The AVP Length 1978 field MUST be set to 12 (16 if the 'V' bit is enabled). 1980 Unsigned64 1982 64 bit unsigned value, in network byte order. The AVP Length 1983 field MUST be set to 16 (20 if the 'V' bit is enabled). 1985 Float32 1987 This represents floating point values of single precision as 1988 described by [FLOATPOINT]. The 32-bit value is transmitted in 1989 network byte order. The AVP Length field MUST be set to 12 (16 if 1990 the 'V' bit is enabled). 1992 Float64 1994 This represents floating point values of double precision as 1995 described by [FLOATPOINT]. The 64-bit value is transmitted in 1996 network byte order. The AVP Length field MUST be set to 16 (20 if 1997 the 'V' bit is enabled). 1999 Grouped 2001 The Data field is specified as a sequence of AVPs. Each of these 2002 AVPs follows - in the order in which they are specified - 2003 including their headers and padding. The AVP Length field is set 2004 to 8 (12 if the 'V' bit is enabled) plus the total length of all 2005 included AVPs, including their headers and padding. Thus the AVP 2006 length field of an AVP of type Grouped is always a multiple of 4. 2008 4.3. Derived AVP Data Formats 2010 In addition to using the Basic AVP Data Formats, applications may 2011 define data formats derived from the Basic AVP Data Formats. An 2012 application that defines new AVP Derived Data Formats MUST include 2013 them in a section entitled "AVP Derived Data Formats", using the same 2014 format as the definitions below. Each new definition MUST be either 2015 defined or listed with a reference to the RFC that defines the 2016 format. 2018 The below AVP Derived Data Formats are commonly used by applications. 2020 Address 2022 The Address format is derived from the OctetString AVP Base 2023 Format. It is a discriminated union, representing, for example a 2024 32-bit (IPv4) [RFC791] or 128-bit (IPv6) [RFC4291] address, most 2025 significant octet first. The first two octets of the Address AVP 2026 represents the AddressType, which contains an Address Family 2027 defined in [IANAADFAM]. The AddressType is used to discriminate 2028 the content and format of the remaining octets. 2030 Time 2032 The Time format is derived from the OctetString AVP Base Format. 2033 The string MUST contain four octets, in the same format as the 2034 first four bytes are in the NTP timestamp format. The NTP 2035 Timestamp format is defined in chapter 3 of [RFC4330]. 2037 This represents the number of seconds since 0h on 1 January 1900 2038 with respect to the Coordinated Universal Time (UTC). 2040 On 6h 28m 16s UTC, 7 February 2036 the time value will overflow. 2041 SNTP [RFC4330] describes a procedure to extend the time to 2104. 2042 This procedure MUST be supported by all DIAMETER nodes. 2044 UTF8String 2046 The UTF8String format is derived from the OctetString AVP Base 2047 Format. This is a human readable string represented using the 2048 ISO/IEC IS 10646-1 character set, encoded as an OctetString using 2049 the UTF-8 [RFC3629] transformation format described in RFC 3629. 2051 Since additional code points are added by amendments to the 10646 2052 standard from time to time, implementations MUST be prepared to 2053 encounter any code point from 0x00000001 to 0x7fffffff. Byte 2054 sequences that do not correspond to the valid encoding of a code 2055 point into UTF-8 charset or are outside this range are prohibited. 2057 The use of control codes SHOULD be avoided. When it is necessary 2058 to represent a new line, the control code sequence CR LF SHOULD be 2059 used. 2061 The use of leading or trailing white space SHOULD be avoided. 2063 For code points not directly supported by user interface hardware 2064 or software, an alternative means of entry and display, such as 2065 hexadecimal, MAY be provided. 2067 For information encoded in 7-bit US-ASCII, the UTF-8 charset is 2068 identical to the US-ASCII charset. 2070 UTF-8 may require multiple bytes to represent a single character / 2071 code point; thus the length of an UTF8String in octets may be 2072 different from the number of characters encoded. 2074 Note that the AVP Length field of an UTF8String is measured in 2075 octets, not characters. 2077 DiameterIdentity 2079 The DiameterIdentity format is derived from the OctetString AVP 2080 Base Format. 2082 DiameterIdentity = FQDN 2084 DiameterIdentity value is used to uniquely identify a Diameter 2085 node for purposes of duplicate connection and routing loop 2086 detection. 2088 The contents of the string MUST be the FQDN of the Diameter node. 2089 If multiple Diameter nodes run on the same host, each Diameter 2090 node MUST be assigned a unique DiameterIdentity. If a Diameter 2091 node can be identified by several FQDNs, a single FQDN should be 2092 picked at startup, and used as the only DiameterIdentity for that 2093 node, whatever the connection it is sent on. Note that in this 2094 document, DiameterIdentity is in ASCII form in order to be 2095 compatible with existing DNS infrastructure. See Appendix D for 2096 interactions between the Diameter protocol and Internationalized 2097 Domain Name (IDNs). 2099 DiameterURI 2101 The DiameterURI MUST follow the Uniform Resource Identifiers (URI) 2102 syntax [RFC3986] rules specified below: 2104 "aaa://" FQDN [ port ] [ transport ] [ protocol ] 2106 ; No transport security 2108 "aaas://" FQDN [ port ] [ transport ] [ protocol ] 2110 ; Transport security used 2112 FQDN = Fully Qualified Host Name 2114 port = ":" 1*DIGIT 2116 ; One of the ports used to listen for 2117 ; incoming connections. 2118 ; If absent, 2119 ; the default Diameter port (3868) is 2120 ; assumed. 2122 transport = ";transport=" transport-protocol 2124 ; One of the transports used to listen 2125 ; for incoming connections. If absent, 2126 ; the default SCTP [RFC2960] protocol is 2127 ; assumed. UDP MUST NOT be used when 2128 ; the aaa-protocol field is set to 2129 ; diameter. 2131 transport-protocol = ( "tcp" / "sctp" / "udp" ) 2133 protocol = ";protocol=" aaa-protocol 2135 ; If absent, the default AAA protocol 2136 ; is diameter. 2138 aaa-protocol = ( "diameter" / "radius" / "tacacs+" ) 2140 The following are examples of valid Diameter host identities: 2142 aaa://host.example.com;transport=tcp 2143 aaa://host.example.com:6666;transport=tcp 2144 aaa://host.example.com;protocol=diameter 2145 aaa://host.example.com:6666;protocol=diameter 2146 aaa://host.example.com:6666;transport=tcp;protocol=diameter 2147 aaa://host.example.com:1813;transport=udp;protocol=radius 2149 Enumerated 2151 Enumerated is derived from the Integer32 AVP Base Format. The 2152 definition contains a list of valid values and their 2153 interpretation and is described in the Diameter application 2154 introducing the AVP. 2156 IPFilterRule 2158 The IPFilterRule format is derived from the OctetString AVP Base 2159 Format and uses the ASCII charset. The rule syntax is a modified 2160 subset of ipfw(8) from FreeBSD. Packets may be filtered based on 2161 the following information that is associated with it: 2163 Direction (in or out) 2164 Source and destination IP address (possibly masked) 2165 Protocol 2166 Source and destination port (lists or ranges) 2167 TCP flags 2168 IP fragment flag 2169 IP options 2170 ICMP types 2172 Rules for the appropriate direction are evaluated in order, with 2173 the first matched rule terminating the evaluation. Each packet is 2174 evaluated once. If no rule matches, the packet is dropped if the 2175 last rule evaluated was a permit, and passed if the last rule was 2176 a deny. 2178 IPFilterRule filters MUST follow the format: 2180 action dir proto from src to dst [options] 2182 action permit - Allow packets that match the rule. 2183 deny - Drop packets that match the rule. 2185 dir "in" is from the terminal, "out" is to the 2186 terminal. 2188 proto An IP protocol specified by number. The "ip" 2189 keyword means any protocol will match. 2191 src and dst
[ports] 2193 The
may be specified as: 2194 ipno An IPv4 or IPv6 number in dotted- 2195 quad or canonical IPv6 form. Only 2196 this exact IP number will match the 2197 rule. 2198 ipno/bits An IP number as above with a mask 2199 width of the form 1.2.3.4/24. In 2200 this case, all IP numbers from 2201 1.2.3.0 to 1.2.3.255 will match. 2202 The bit width MUST be valid for the 2203 IP version and the IP number MUST 2204 NOT have bits set beyond the mask. 2205 For a match to occur, the same IP 2206 version must be present in the 2207 packet that was used in describing 2208 the IP address. To test for a 2209 particular IP version, the bits part 2210 can be set to zero. The keyword 2211 "any" is 0.0.0.0/0 or the IPv6 2212 equivalent. The keyword "assigned" 2213 is the address or set of addresses 2214 assigned to the terminal. For IPv4, 2215 a typical first rule is often "deny 2216 in ip! assigned" 2218 The sense of the match can be inverted by 2219 preceding an address with the not modifier (!), 2220 causing all other addresses to be matched 2221 instead. This does not affect the selection of 2222 port numbers. 2224 With the TCP, UDP and SCTP protocols, optional 2225 ports may be specified as: 2227 {port/port-port}[,ports[,...]] 2229 The '-' notation specifies a range of ports 2230 (including boundaries). 2232 Fragmented packets that have a non-zero offset 2233 (i.e., not the first fragment) will never match 2234 a rule that has one or more port 2235 specifications. See the frag option for 2236 details on matching fragmented packets. 2238 options: 2239 frag Match if the packet is a fragment and this is not 2240 the first fragment of the datagram. frag may not 2241 be used in conjunction with either tcpflags or 2242 TCP/UDP port specifications. 2244 ipoptions spec 2245 Match if the IP header contains the comma 2246 separated list of options specified in spec. The 2247 supported IP options are: 2249 ssrr (strict source route), lsrr (loose source 2250 route), rr (record packet route) and ts 2251 (timestamp). The absence of a particular option 2252 may be denoted with a '!'. 2254 tcpoptions spec 2255 Match if the TCP header contains the comma 2256 separated list of options specified in spec. The 2257 supported TCP options are: 2259 mss (maximum segment size), window (tcp window 2260 advertisement), sack (selective ack), ts (rfc1323 2261 timestamp) and cc (rfc1644 t/tcp connection 2262 count). The absence of a particular option may 2263 be denoted with a '!'. 2265 established 2266 TCP packets only. Match packets that have the RST 2267 or ACK bits set. 2269 setup TCP packets only. Match packets that have the SYN 2270 bit set but no ACK bit. 2272 tcpflags spec 2273 TCP packets only. Match if the TCP header 2274 contains the comma separated list of flags 2275 specified in spec. The supported TCP flags are: 2277 fin, syn, rst, psh, ack and urg. The absence of a 2278 particular flag may be denoted with a '!'. A rule 2279 that contains a tcpflags specification can never 2280 match a fragmented packet that has a non-zero 2281 offset. See the frag option for details on 2282 matching fragmented packets. 2284 icmptypes types 2285 ICMP packets only. Match if the ICMP type is in 2286 the list types. The list may be specified as any 2287 combination of ranges or individual types 2288 separated by commas. Both the numeric values and 2289 the symbolic values listed below can be used. The 2290 supported ICMP types are: 2292 echo reply (0), destination unreachable (3), 2293 source quench (4), redirect (5), echo request 2294 (8), router advertisement (9), router 2295 solicitation (10), time-to-live exceeded (11), IP 2296 header bad (12), timestamp request (13), 2297 timestamp reply (14), information request (15), 2298 information reply (16), address mask request (17) 2299 and address mask reply (18). 2301 There is one kind of packet that the access device MUST always 2302 discard, that is an IP fragment with a fragment offset of one. 2303 This is a valid packet, but it only has one use, to try to 2304 circumvent firewalls. 2306 An access device that is unable to interpret or apply a deny rule 2307 MUST terminate the session. An access device that is unable to 2308 interpret or apply a permit rule MAY apply a more restrictive 2309 rule. An access device MAY apply deny rules of its own before the 2310 supplied rules, for example to protect the access device owner's 2311 infrastructure. 2313 4.4. Grouped AVP Values 2315 The Diameter protocol allows AVP values of type 'Grouped.' This 2316 implies that the Data field is actually a sequence of AVPs. It is 2317 possible to include an AVP with a Grouped type within a Grouped type, 2318 that is, to nest them. AVPs within an AVP of type Grouped have the 2319 same padding requirements as non-Grouped AVPs, as defined in Section 2320 4. 2322 The AVP Code numbering space of all AVPs included in a Grouped AVP is 2323 the same as for non-grouped AVPs. Receivers of a Grouped AVP that 2324 does not have the 'M' (mandatory) bit set and one or more of the 2325 encapsulated AVPs within the group has the 'M' (mandatory) bit set 2326 MAY simply be ignored if the Grouped AVP itself is unrecognized. The 2327 rule applies even if the encapsulated AVP with its 'M' (mandatory) 2328 bit set is further encapsulated within other sub-groups; i.e. other 2329 Grouped AVPs embedded within the Grouped AVP. 2331 Every Grouped AVP defined MUST include a corresponding grammar, using 2332 ABNF [RFC4234] (with modifications), as defined below. 2334 grouped-avp-def = name "::=" avp 2336 name-fmt = ALPHA *(ALPHA / DIGIT / "-") 2338 name = name-fmt 2339 ; The name has to be the name of an AVP, 2340 ; defined in the base or extended Diameter 2341 ; specifications. 2343 avp = header [ *fixed] [ *required] [ *optional] 2345 header = "<" "AVP-Header:" avpcode [vendor] ">" 2347 avpcode = 1*DIGIT 2348 ; The AVP Code assigned to the Grouped AVP 2350 vendor = 1*DIGIT 2351 ; The Vendor-ID assigned to the Grouped AVP. 2352 ; If absent, the default value of zero is 2353 ; used. 2355 4.4.1. Example AVP with a Grouped Data type 2357 The Example-AVP (AVP Code 999999) is of type Grouped and is used to 2358 clarify how Grouped AVP values work. The Grouped Data field has the 2359 following ABNF grammar: 2361 Example-AVP ::= < AVP Header: 999999 > 2362 { Origin-Host } 2363 1*{ Session-Id } 2364 *[ AVP ] 2366 An Example-AVP with Grouped Data follows. 2368 The Origin-Host AVP is required (Section 6.3). In this case: 2370 Origin-Host = "example.com". 2372 One or more Session-Ids must follow. Here there are two: 2374 Session-Id = 2375 "grump.example.com:33041;23432;893;0AF3B81" 2377 Session-Id = 2378 "grump.example.com:33054;23561;2358;0AF3B82" 2380 optional AVPs included are 2382 Recovery-Policy = 2383 2163bc1d0ad82371f6bc09484133c3f09ad74a0dd5346d54195a7cf0b35 2384 2cabc881839a4fdcfbc1769e2677a4c1fb499284c5f70b48f58503a45c5 2385 c2d6943f82d5930f2b7c1da640f476f0e9c9572a50db8ea6e51e1c2c7bd 2386 f8bb43dc995144b8dbe297ac739493946803e1cee3e15d9b765008a1b2a 2387 cf4ac777c80041d72c01e691cf751dbf86e85f509f3988e5875dc905119 2388 26841f00f0e29a6d1ddc1a842289d440268681e052b30fb638045f7779c 2389 1d873c784f054f688f5001559ecff64865ef975f3e60d2fd7966b8c7f92 2391 Futuristic-Acct-Record = 2392 fe19da5802acd98b07a5b86cb4d5d03f0314ab9ef1ad0b67111ff3b90a0 2393 57fe29620bf3585fd2dd9fcc38ce62f6cc208c6163c008f4258d1bc88b8 2394 17694a74ccad3ec69269461b14b2e7a4c111fb239e33714da207983f58c 2395 41d018d56fe938f3cbf089aac12a912a2f0d1923a9390e5f789cb2e5067 2396 d3427475e49968f841 2398 The data for the optional AVPs is represented in hex since the format 2399 of these AVPs is neither known at the time of definition of the 2400 Example-AVP group, nor (likely) at the time when the example instance 2401 of this AVP is interpreted - except by Diameter implementations which 2402 support the same set of AVPs. The encoding example illustrates how 2403 padding is used and how length fields are calculated. Also note that 2404 AVPs may be present in the Grouped AVP value which the receiver 2405 cannot interpret (here, the Recover-Policy and Futuristic-Acct-Record 2406 AVPs). The length of the Example-AVP is the sum of all the length of 2407 the member AVPs including their padding plus the Example-AVP header 2408 size. 2410 This AVP would be encoded as follows: 2412 0 1 2 3 4 5 6 7 2413 +-------+-------+-------+-------+-------+-------+-------+-------+ 2414 0 | Example AVP Header (AVP Code = 999999), Length = 496 | 2415 +-------+-------+-------+-------+-------+-------+-------+-------+ 2416 8 | Origin-Host AVP Header (AVP Code = 264), Length = 19 | 2417 +-------+-------+-------+-------+-------+-------+-------+-------+ 2418 16 | 'e' | 'x' | 'a' | 'm' | 'p' | 'l' | 'e' | '.' | 2419 +-------+-------+-------+-------+-------+-------+-------+-------+ 2420 24 | 'c' | 'o' | 'm' |Padding| Session-Id AVP Header | 2421 +-------+-------+-------+-------+-------+-------+-------+-------+ 2422 32 | (AVP Code = 263), Length = 49 | 'g' | 'r' | 'u' | 'm' | 2423 +-------+-------+-------+-------+-------+-------+-------+-------+ 2424 . . . 2425 +-------+-------+-------+-------+-------+-------+-------+-------+ 2426 72 | 'F' | '3' | 'B' | '8' | '1' |Padding|Padding|Padding| 2427 +-------+-------+-------+-------+-------+-------+-------+-------+ 2428 80 | Session-Id AVP Header (AVP Code = 263), Length = 50 | 2429 +-------+-------+-------+-------+-------+-------+-------+-------+ 2430 88 | 'g' | 'r' | 'u' | 'm' | 'p' | '.' | 'e' | 'x' | 2431 +-------+-------+-------+-------+-------+-------+-------+-------+ 2432 . . . 2433 +-------+-------+-------+-------+-------+-------+-------+-------+ 2434 120| '5' | '8' | ';' | '0' | 'A' | 'F' | '3' | 'B' | 2435 +-------+-------+-------+-------+-------+-------+-------+-------+ 2436 128| '8' | '2' |Padding|Padding| Recovery-Policy Header (AVP | 2437 +-------+-------+-------+-------+-------+-------+-------+-------+ 2438 136| Code = 8341), Length = 223 | 0x21 | 0x63 | 0xbc | 0x1d | 2439 +-------+-------+-------+-------+-------+-------+-------+-------+ 2440 144| 0x0a | 0xd8 | 0x23 | 0x71 | 0xf6 | 0xbc | 0x09 | 0x48 | 2441 +-------+-------+-------+-------+-------+-------+-------+-------+ 2442 . . . 2443 +-------+-------+-------+-------+-------+-------+-------+-------+ 2444 352| 0x8c | 0x7f | 0x92 |Padding| Futuristic-Acct-Record Header | 2445 +-------+-------+-------+-------+-------+-------+-------+-------+ 2446 328|(AVP Code = 15930),Length = 137| 0xfe | 0x19 | 0xda | 0x58 | 2447 +-------+-------+-------+-------+-------+-------+-------+-------+ 2448 336| 0x02 | 0xac | 0xd9 | 0x8b | 0x07 | 0xa5 | 0xb8 | 0xc6 | 2449 +-------+-------+-------+-------+-------+-------+-------+-------+ 2450 . . . 2451 +-------+-------+-------+-------+-------+-------+-------+-------+ 2452 488| 0xe4 | 0x99 | 0x68 | 0xf8 | 0x41 |Padding|Padding|Padding| 2453 +-------+-------+-------+-------+-------+-------+-------+-------+ 2455 4.5. Diameter Base Protocol AVPs 2457 The following table describes the Diameter AVPs defined in the base 2458 protocol, their AVP Code values, types, possible flag values. 2460 Due to space constraints, the short form DiamIdent is used to 2461 represent DiameterIdentity. 2463 +---------------------+ 2464 | AVP Flag rules | 2465 |----+-----+----+-----| 2466 AVP Section | | |SHLD| MUST| 2467 Attribute Name Code Defined Data Type |MUST| MAY | NOT| NOT| 2468 -----------------------------------------|----+-----+----+-----| 2469 Acct- 85 9.8.2 Unsigned32 | M | | | V | 2470 Interim-Interval | | | | | 2471 Accounting- 483 9.8.7 Enumerated | M | | | V | 2472 Realtime-Required | | | | | 2473 Acct- 50 9.8.5 UTF8String | M | | | V | 2474 Multi-Session-Id | | | | | 2475 Accounting- 485 9.8.3 Unsigned32 | M | | | V | 2476 Record-Number | | | | | 2477 Accounting- 480 9.8.1 Enumerated | M | | | V | 2478 Record-Type | | | | | 2479 Accounting- 44 9.8.4 OctetString| M | | | V | 2480 Session-Id | | | | | 2481 Accounting- 287 9.8.6 Unsigned64 | M | | | V | 2482 Sub-Session-Id | | | | | 2483 Acct- 259 6.9 Unsigned32 | M | | | V | 2484 Application-Id | | | | | 2485 Auth- 258 6.8 Unsigned32 | M | | | V | 2486 Application-Id | | | | | 2487 Auth-Request- 274 8.7 Enumerated | M | | | V | 2488 Type | | | | | 2489 Authorization- 291 8.9 Unsigned32 | M | | | V | 2490 Lifetime | | | | | 2491 Auth-Grace- 276 8.10 Unsigned32 | M | | | V | 2492 Period | | | | | 2493 Auth-Session- 277 8.11 Enumerated | M | | | V | 2494 State | | | | | 2495 Re-Auth-Request- 285 8.12 Enumerated | M | | | V | 2496 Type | | | | | 2497 Class 25 8.20 OctetString| M | | | V | 2498 Destination-Host 293 6.5 DiamIdent | M | | | V | 2499 Destination- 283 6.6 DiamIdent | M | | | V | 2500 Realm | | | | | 2501 Disconnect-Cause 273 5.4.3 Enumerated | M | | | V | 2502 Error-Message 281 7.3 UTF8String | | | | V,M | 2503 Error-Reporting- 294 7.4 DiamIdent | | | | V,M | 2504 Host | | | | | 2505 Event-Timestamp 55 8.21 Time | M | | | V | 2506 Experimental- 297 7.6 Grouped | M | | | V | 2507 Result | | | | | 2508 -----------------------------------------|----+-----+----+-----| 2509 +---------------------+ 2510 | AVP Flag rules | 2511 |----+-----+----+-----| 2512 AVP Section | | |SHLD| MUST| 2513 Attribute Name Code Defined Data Type |MUST| MAY | NOT| NOT| 2514 -----------------------------------------|----+-----+----+-----| 2515 Experimental- 298 7.7 Unsigned32 | M | | | V | 2516 Result-Code | | | | | 2517 Failed-AVP 279 7.5 Grouped | M | | | V | 2518 Firmware- 267 5.3.4 Unsigned32 | | | | V,M | 2519 Revision | | | | | 2520 Host-IP-Address 257 5.3.5 Address | M | | | V | 2521 Inband-Security | M | | | V | 2522 -Id 299 6.10 Unsigned32 | | | | | 2523 Multi-Round- 272 8.19 Unsigned32 | M | | | V | 2524 Time-Out | | | | | 2525 Origin-Host 264 6.3 DiamIdent | M | | | V | 2526 Origin-Realm 296 6.4 DiamIdent | M | | | V | 2527 Origin-State-Id 278 8.16 Unsigned32 | M | | | V | 2528 Product-Name 269 5.3.7 UTF8String | | | | V,M | 2529 Proxy-Host 280 6.7.3 DiamIdent | M | | | V | 2530 Proxy-Info 284 6.7.2 Grouped | M | | | V | 2531 Proxy-State 33 6.7.4 OctetString| M | | | V | 2532 Redirect-Host 292 6.12 DiamURI | M | | | V | 2533 Redirect-Host- 261 6.13 Enumerated | M | | | V | 2534 Usage | | | | | 2535 Redirect-Max- 262 6.14 Unsigned32 | M | | | V | 2536 Cache-Time | | | | | 2537 Result-Code 268 7.1 Unsigned32 | M | | | V | 2538 Route-Record 282 6.7.1 DiamIdent | M | | | V | 2539 Session-Id 263 8.8 UTF8String | M | | | V | 2540 Session-Timeout 27 8.13 Unsigned32 | M | | | V | 2541 Session-Binding 270 8.17 Unsigned32 | M | | | V | 2542 Session-Server- 271 8.18 Enumerated | M | | | V | 2543 Failover | | | | | 2544 Supported- 265 5.3.6 Unsigned32 | M | | | V | 2545 Vendor-Id | | | | | 2546 Termination- 295 8.15 Enumerated | M | | | V | 2547 Cause | | | | | 2548 User-Name 1 8.14 UTF8String | M | | | V | 2549 Vendor-Id 266 5.3.3 Unsigned32 | M | | | V | 2550 Vendor-Specific- 260 6.11 Grouped | M | | | V | 2551 Application-Id | | | | | 2552 -----------------------------------------|----+-----+----+-----| 2554 5. Diameter Peers 2556 This section describes how Diameter nodes establish connections and 2557 communicate with peers. 2559 5.1. Peer Connections 2561 Although a Diameter node may have many possible peers that it is able 2562 to communicate with, it may not be economical to have an established 2563 connection to all of them. At a minimum, a Diameter node SHOULD have 2564 an established connection with two peers per realm, known as the 2565 primary and secondary peers. Of course, a node MAY have additional 2566 connections, if it is deemed necessary. Typically, all messages for 2567 a realm are sent to the primary peer, but in the event that failover 2568 procedures are invoked, any pending requests are sent to the 2569 secondary peer. However, implementations are free to load balance 2570 requests between a set of peers. 2572 Note that a given peer MAY act as a primary for a given realm, while 2573 acting as a secondary for another realm. 2575 When a peer is deemed suspect, which could occur for various reasons, 2576 including not receiving a DWA within an allotted timeframe, no new 2577 requests should be forwarded to the peer, but failover procedures are 2578 invoked. When an active peer is moved to this mode, additional 2579 connections SHOULD be established to ensure that the necessary number 2580 of active connections exists. 2582 There are two ways that a peer is removed from the suspect peer list: 2584 1. The peer is no longer reachable, causing the transport connection 2585 to be shutdown. The peer is moved to the closed state. 2587 2. Three watchdog messages are exchanged with accepted round trip 2588 times, and the connection to the peer is considered stabilized. 2590 In the event the peer being removed is either the primary or 2591 secondary, an alternate peer SHOULD replace the deleted peer, and 2592 assume the role of either primary or secondary. 2594 5.2. Diameter Peer Discovery 2596 Allowing for dynamic Diameter agent discovery will make it possible 2597 for simpler and more robust deployment of Diameter services. In 2598 order to promote interoperable implementations of Diameter peer 2599 discovery, the following mechanisms are described. These are based 2600 on existing IETF standards. The first option (manual configuration) 2601 MUST be supported by all DIAMETER nodes, while the latter option 2602 (DNS) MAY be supported. 2604 There are two cases where Diameter peer discovery may be performed. 2605 The first is when a Diameter client needs to discover a first-hop 2606 Diameter agent. The second case is when a Diameter agent needs to 2607 discover another agent - for further handling of a Diameter 2608 operation. In both cases, the following 'search order' is 2609 recommended: 2611 1. The Diameter implementation consults its list of static 2612 (manually) configured Diameter agent locations. These will be 2613 used if they exist and respond. 2615 2. The Diameter implementation performs a NAPTR query for a server 2616 in a particular realm. The Diameter implementation has to know 2617 in advance which realm to look for a Diameter agent in. This 2618 could be deduced, for example, from the 'realm' in a NAI that a 2619 Diameter implementation needed to perform a Diameter operation 2620 on. 2622 * The services relevant for the task of transport protocol 2623 selection are those with NAPTR service fields with values 2624 "AAA+D2x", where x is a letter that corresponds to a transport 2625 protocol supported by the domain. This specification defines 2626 D2T for TCP and D2S for SCTP. We also establish an IANA 2627 registry for NAPTR service name to transport protocol 2628 mappings. 2630 These NAPTR records provide a mapping from a domain, to the 2631 SRV record for contacting a server with the specific transport 2632 protocol in the NAPTR services field. The resource record 2633 will contain an empty regular expression and a replacement 2634 value, which is the SRV record for that particular transport 2635 protocol. If the server supports multiple transport 2636 protocols, there will be multiple NAPTR records, each with a 2637 different service value. As per [RFC3403], the client 2638 discards any records whose services fields are not applicable. 2639 For the purposes of this specification, several rules are 2640 defined. 2642 * A client MUST discard any service fields that identify a 2643 resolution service whose value is not "D2X", for values of X 2644 that indicate transport protocols supported by the client. 2645 The NAPTR processing as described in [RFC3403] will result in 2646 discovery of the most preferred transport protocol of the 2647 server that is supported by the client, as well as an SRV 2648 record for the server. 2650 The domain suffixes in the NAPTR replacement field SHOULD 2651 match the domain of the original query. 2653 3. If no NAPTR records are found, the requester queries for those 2654 address records for the destination address, 2655 '_diameter._sctp'.realm or '_diameter._tcp'.realm. Address 2656 records include A RR's, AAAA RR's or other similar records, 2657 chosen according to the requestor's network protocol 2658 capabilities. If the DNS server returns no address records, the 2659 requestor gives up. 2661 If the server is using a site certificate, the domain name in the 2662 query and the domain name in the replacement field MUST both be 2663 valid based on the site certificate handed out by the server in 2664 the TLS or IKE exchange. Similarly, the domain name in the SRV 2665 query and the domain name in the target in the SRV record MUST 2666 both be valid based on the same site certificate. Otherwise, an 2667 attacker could modify the DNS records to contain replacement 2668 values in a different domain, and the client could not validate 2669 that this was the desired behavior, or the result of an attack 2671 Also, the Diameter Peer MUST check to make sure that the 2672 discovered peers are authorized to act in its role. 2673 Authentication via IKE or TLS, or validation of DNS RRs via 2674 DNSSEC is not sufficient to conclude this. For example, a web 2675 server may have obtained a valid TLS certificate, and secured RRs 2676 may be included in the DNS, but this does not imply that it is 2677 authorized to act as a Diameter Server. 2679 Authorization can be achieved for example, by configuration of a 2680 Diameter Server CA. Alternatively this can be achieved by 2681 definition of OIDs within TLS or IKE certificates so as to 2682 signify Diameter Server authorization. 2684 A dynamically discovered peer causes an entry in the Peer Table (see 2685 Section 2.6) to be created. Note that entries created via DNS MUST 2686 expire (or be refreshed) within the DNS TTL. If a peer is discovered 2687 outside of the local realm, a routing table entry (see Section 2.7) 2688 for the peer's realm is created. The routing table entry's 2689 expiration MUST match the peer's expiration value. 2691 5.3. Capabilities Exchange 2693 When two Diameter peers establish a transport connection, they MUST 2694 exchange the Capabilities Exchange messages, as specified in the peer 2695 state machine (see Section 5.6). This message allows the discovery 2696 of a peer's identity and its capabilities (protocol version number, 2697 supported Diameter applications, security mechanisms, etc.) 2699 The receiver only issues commands to its peers that have advertised 2700 support for the Diameter application that defines the command. A 2701 Diameter node MUST cache the supported applications in order to 2702 ensure that unrecognized commands and/or AVPs are not unnecessarily 2703 sent to a peer. 2705 A receiver of a Capabilities-Exchange-Req (CER) message that does not 2706 have any applications in common with the sender MUST return a 2707 Capabilities-Exchange-Answer (CEA) with the Result-Code AVP set to 2708 DIAMETER_NO_COMMON_APPLICATION, and SHOULD disconnect the transport 2709 layer connection. Note that receiving a CER or CEA from a peer 2710 advertising itself as a Relay (see Section 2.4) MUST be interpreted 2711 as having common applications with the peer. 2713 The receiver of the Capabilities-Exchange-Request (CER) MUST 2714 determine common applications by computing the intersection of its 2715 own set of supported Application Id against all of the application 2716 indentifier AVPs (Auth-Application-Id, Acct-Application-Id and 2717 Vendor-Specific-Application-Id) present in the CER. The value of the 2718 Vendor-Id AVP in the Vendor-Specific-Application-Id MUST NOT be used 2719 during computation. The sender of the Capabilities-Exchange-Answer 2720 (CEA) SHOULD include all of its supported applications as a hint to 2721 the receiver regarding all of its application capabilities. 2723 Similarly, a receiver of a Capabilities-Exchange-Req (CER) message 2724 that does not have any security mechanisms in common with the sender 2725 MUST return a Capabilities-Exchange-Answer (CEA) with the Result-Code 2726 AVP set to DIAMETER_NO_COMMON_SECURITY, and SHOULD disconnect the 2727 transport layer connection. 2729 CERs received from unknown peers MAY be silently discarded, or a CEA 2730 MAY be issued with the Result-Code AVP set to DIAMETER_UNKNOWN_PEER. 2731 In both cases, the transport connection is closed. If the local 2732 policy permits receiving CERs from unknown hosts, a successful CEA 2733 MAY be returned. If a CER from an unknown peer is answered with a 2734 successful CEA, the lifetime of the peer entry is equal to the 2735 lifetime of the transport connection. In case of a transport 2736 failure, all the pending transactions destined to the unknown peer 2737 can be discarded. 2739 The CER and CEA messages MUST NOT be proxied, redirected or relayed. 2741 Since the CER/CEA messages cannot be proxied, it is still possible 2742 that an upstream agent receives a message for which it has no 2743 available peers to handle the application that corresponds to the 2744 Command-Code. In such instances, the 'E' bit is set in the answer 2745 message (see Section 7.) with the Result-Code AVP set to 2746 DIAMETER_UNABLE_TO_DELIVER to inform the downstream to take action 2747 (e.g., re-routing request to an alternate peer). 2749 With the exception of the Capabilities-Exchange-Request message, a 2750 message of type Request that includes the Auth-Application-Id or 2751 Acct-Application-Id AVPs, or a message with an application-specific 2752 command code, MAY only be forwarded to a host that has explicitly 2753 advertised support for the application (or has advertised the Relay 2754 Application Id). 2756 5.3.1. Capabilities-Exchange-Request 2758 The Capabilities-Exchange-Request (CER), indicated by the Command- 2759 Code set to 257 and the Command Flags' 'R' bit set, is sent to 2760 exchange local capabilities. Upon detection of a transport failure, 2761 this message MUST NOT be sent to an alternate peer. 2763 When Diameter is run over SCTP [RFC2960], which allows for 2764 connections to span multiple interfaces and multiple IP addresses, 2765 the Capabilities-Exchange-Request message MUST contain one Host-IP- 2766 Address AVP for each potential IP address that MAY be locally used 2767 when transmitting Diameter messages. 2769 Message Format 2771 ::= < Diameter Header: 257, REQ > 2772 { Origin-Host } 2773 { Origin-Realm } 2774 1* { Host-IP-Address } 2775 { Vendor-Id } 2776 { Product-Name } 2777 [ Origin-State-Id ] 2778 * [ Supported-Vendor-Id ] 2779 * [ Auth-Application-Id ] 2780 * [ Inband-Security-Id ] 2781 * [ Acct-Application-Id ] 2782 * [ Vendor-Specific-Application-Id ] 2783 [ Firmware-Revision ] 2784 * [ AVP ] 2786 5.3.2. Capabilities-Exchange-Answer 2788 The Capabilities-Exchange-Answer (CEA), indicated by the Command-Code 2789 set to 257 and the Command Flags' 'R' bit cleared, is sent in 2790 response to a CER message. 2792 When Diameter is run over SCTP [RFC2960], which allows connections to 2793 span multiple interfaces, hence, multiple IP addresses, the 2794 Capabilities-Exchange-Answer message MUST contain one Host-IP-Address 2795 AVP for each potential IP address that MAY be locally used when 2796 transmitting Diameter messages. 2798 Message Format 2800 ::= < Diameter Header: 257 > 2801 { Result-Code } 2802 { Origin-Host } 2803 { Origin-Realm } 2804 1* { Host-IP-Address } 2805 { Vendor-Id } 2806 { Product-Name } 2807 [ Origin-State-Id ] 2808 [ Error-Message ] 2809 [ Failed-AVP ] 2810 * [ Supported-Vendor-Id ] 2811 * [ Auth-Application-Id ] 2812 * [ Inband-Security-Id ] 2813 * [ Acct-Application-Id ] 2814 * [ Vendor-Specific-Application-Id ] 2815 [ Firmware-Revision ] 2816 * [ AVP ] 2818 5.3.3. Vendor-Id AVP 2820 The Vendor-Id AVP (AVP Code 266) is of type Unsigned32 and contains 2821 the IANA "SMI Network Management Private Enterprise Codes" [RFC3232] 2822 value assigned to the vendor of the Diameter device. It is 2823 envisioned that the combination of the Vendor-Id, Product-Name 2824 (Section 5.3.7) and the Firmware-Revision (Section 5.3.4) AVPs may 2825 provide useful debugging information. 2827 A Vendor-Id value of zero in the CER or CEA messages is reserved and 2828 indicates that this field is ignored. 2830 5.3.4. Firmware-Revision AVP 2832 The Firmware-Revision AVP (AVP Code 267) is of type Unsigned32 and is 2833 used to inform a Diameter peer of the firmware revision of the 2834 issuing device. 2836 For devices that do not have a firmware revision (general purpose 2837 computers running Diameter software modules, for instance), the 2838 revision of the Diameter software module may be reported instead. 2840 5.3.5. Host-IP-Address AVP 2842 The Host-IP-Address AVP (AVP Code 257) is of type Address and is used 2843 to inform a Diameter peer of the sender's IP address. All source 2844 addresses that a Diameter node expects to use with SCTP [RFC2960] 2845 MUST be advertised in the CER and CEA messages by including a 2846 Host-IP- Address AVP for each address. This AVP MUST ONLY be used in 2847 the CER and CEA messages. 2849 5.3.6. Supported-Vendor-Id AVP 2851 The Supported-Vendor-Id AVP (AVP Code 265) is of type Unsigned32 and 2852 contains the IANA "SMI Network Management Private Enterprise Codes" 2853 [RFC3232] value assigned to a vendor other than the device vendor but 2854 including the application vendor. This is used in the CER and CEA 2855 messages in order to inform the peer that the sender supports (a 2856 subset of) the vendor-specific AVPs defined by the vendor identified 2857 in this AVP. The value of this AVP SHOULD NOT be set to zero. 2858 Multiple instances of this AVP containing the same value SHOULD NOT 2859 be sent. 2861 5.3.7. Product-Name AVP 2863 The Product-Name AVP (AVP Code 269) is of type UTF8String, and 2864 contains the vendor assigned name for the product. The Product-Name 2865 AVP SHOULD remain constant across firmware revisions for the same 2866 product. 2868 5.4. Disconnecting Peer connections 2870 When a Diameter node disconnects one of its transport connections, 2871 its peer cannot know the reason for the disconnect, and will most 2872 likely assume that a connectivity problem occurred, or that the peer 2873 has rebooted. In these cases, the peer may periodically attempt to 2874 reconnect, as stated in Section 2.1. In the event that the 2875 disconnect was a result of either a shortage of internal resources, 2876 or simply that the node in question has no intentions of forwarding 2877 any Diameter messages to the peer in the foreseeable future, a 2878 periodic connection request would not be welcomed. The 2879 Disconnection-Reason AVP contains the reason the Diameter node issued 2880 the Disconnect-Peer-Request message. 2882 The Disconnect-Peer-Request message is used by a Diameter node to 2883 inform its peer of its intent to disconnect the transport layer, and 2884 that the peer shouldn't reconnect unless it has a valid reason to do 2885 so (e.g., message to be forwarded). Upon receipt of the message, the 2886 Disconnect-Peer-Answer is returned, which SHOULD contain an error if 2887 messages have recently been forwarded, and are likely in flight, 2888 which would otherwise cause a race condition. 2890 The receiver of the Disconnect-Peer-Answer initiates the transport 2891 disconnect. The sender of the Disconnect-Peer-Answer should be able 2892 to detect the transport closure and cleanup the connection. 2894 5.4.1. Disconnect-Peer-Request 2896 The Disconnect-Peer-Request (DPR), indicated by the Command-Code set 2897 to 282 and the Command Flags' 'R' bit set, is sent to a peer to 2898 inform its intentions to shutdown the transport connection. Upon 2899 detection of a transport failure, this message MUST NOT be sent to an 2900 alternate peer. 2902 Message Format 2904 ::= < Diameter Header: 282, REQ > 2905 { Origin-Host } 2906 { Origin-Realm } 2907 { Disconnect-Cause } 2909 5.4.2. Disconnect-Peer-Answer 2911 The Disconnect-Peer-Answer (DPA), indicated by the Command-Code set 2912 to 282 and the Command Flags' 'R' bit cleared, is sent as a response 2913 to the Disconnect-Peer-Request message. Upon receipt of this 2914 message, the transport connection is shutdown. 2916 Message Format 2918 ::= < Diameter Header: 282 > 2919 { Result-Code } 2920 { Origin-Host } 2921 { Origin-Realm } 2922 [ Error-Message ] 2923 [ Failed-AVP ] 2925 5.4.3. Disconnect-Cause AVP 2927 The Disconnect-Cause AVP (AVP Code 273) is of type Enumerated. A 2928 Diameter node MUST include this AVP in the Disconnect-Peer-Request 2929 message to inform the peer of the reason for its intention to 2930 shutdown the transport connection. The following values are 2931 supported: 2933 REBOOTING 0 2934 A scheduled reboot is imminent. Receiver of DPR with above result 2935 code MAY attempt reconnection. 2937 BUSY 1 2938 The peer's internal resources are constrained, and it has 2939 determined that the transport connection needs to be closed. 2940 Receiver of DPR with above result code SHOULD NOT attempt 2941 reconnection. 2943 DO_NOT_WANT_TO_TALK_TO_YOU 2 2944 The peer has determined that it does not see a need for the 2945 transport connection to exist, since it does not expect any 2946 messages to be exchanged in the near future. Receiver of DPR 2947 with above result code SHOULD NOT attempt reconnection. 2949 5.5. Transport Failure Detection 2951 Given the nature of the Diameter protocol, it is recommended that 2952 transport failures be detected as soon as possible. Detecting such 2953 failures will minimize the occurrence of messages sent to unavailable 2954 agents, resulting in unnecessary delays, and will provide better 2955 failover performance. The Device-Watchdog-Request and Device- 2956 Watchdog-Answer messages, defined in this section, are used to pro- 2957 actively detect transport failures. 2959 5.5.1. Device-Watchdog-Request 2961 The Device-Watchdog-Request (DWR), indicated by the Command-Code set 2962 to 280 and the Command Flags' 'R' bit set, is sent to a peer when no 2963 traffic has been exchanged between two peers (see Section 5.5.3). 2964 Upon detection of a transport failure, this message MUST NOT be sent 2965 to an alternate peer. 2967 Message Format 2969 ::= < Diameter Header: 280, REQ > 2970 { Origin-Host } 2971 { Origin-Realm } 2972 [ Origin-State-Id ] 2974 5.5.2. Device-Watchdog-Answer 2976 The Device-Watchdog-Answer (DWA), indicated by the Command-Code set 2977 to 280 and the Command Flags' 'R' bit cleared, is sent as a response 2978 to the Device-Watchdog-Request message. 2980 Message Format 2982 ::= < Diameter Header: 280 > 2983 { Result-Code } 2984 { Origin-Host } 2985 { Origin-Realm } 2986 [ Error-Message ] 2987 [ Failed-AVP ] 2988 [ Origin-State-Id ] 2990 5.5.3. Transport Failure Algorithm 2992 The transport failure algorithm is defined in [RFC3539]. All 2993 Diameter implementations MUST support the algorithm defined in the 2994 specification in order to be compliant to the Diameter base protocol. 2996 5.5.4. Failover and Failback Procedures 2998 In the event that a transport failure is detected with a peer, it is 2999 necessary for all pending request messages to be forwarded to an 3000 alternate agent, if possible. This is commonly referred to as 3001 failover. 3003 In order for a Diameter node to perform failover procedures, it is 3004 necessary for the node to maintain a pending message queue for a 3005 given peer. When an answer message is received, the corresponding 3006 request is removed from the queue. The Hop-by-Hop Identifier field 3007 is used to match the answer with the queued request. 3009 When a transport failure is detected, if possible all messages in the 3010 queue are sent to an alternate agent with the T flag set. On booting 3011 a Diameter client or agent, the T flag is also set on any records 3012 still remaining to be transmitted in non-volatile storage. An 3013 example of a case where it is not possible to forward the message to 3014 an alternate server is when the message has a fixed destination, and 3015 the unavailable peer is the message's final destination (see 3016 Destination-Host AVP). Such an error requires that the agent return 3017 an answer message with the 'E' bit set and the Result-Code AVP set to 3018 DIAMETER_UNABLE_TO_DELIVER. 3020 It is important to note that multiple identical requests or answers 3021 MAY be received as a result of a failover. The End-to-End Identifier 3022 field in the Diameter header along with the Origin-Host AVP MUST be 3023 used to identify duplicate messages. 3025 As described in Section 2.1, a connection request should be 3026 periodically attempted with the failed peer in order to re-establish 3027 the transport connection. Once a connection has been successfully 3028 established, messages can once again be forwarded to the peer. This 3029 is commonly referred to as failback. 3031 5.6. Peer State Machine 3033 This section contains a finite state machine that MUST be observed by 3034 all Diameter implementations. Each Diameter node MUST follow the 3035 state machine described below when communicating with each peer. 3036 Multiple actions are separated by commas, and may continue on 3037 succeeding lines, as space requires. Similarly, state and next state 3038 may also span multiple lines, as space requires. 3040 This state machine is closely coupled with the state machine 3041 described in [RFC3539], which is used to open, close, failover, 3042 probe, and reopen transport connections. Note in particular that 3043 [RFC3539] requires the use of watchdog messages to probe connections. 3044 For Diameter, DWR and DWA messages are to be used. 3046 I- is used to represent the initiator (connecting) connection, while 3047 the R- is used to represent the responder (listening) connection. 3048 The lack of a prefix indicates that the event or action is the same 3049 regardless of the connection on which the event occurred. 3051 The stable states that a state machine may be in are Closed, I-Open 3052 and R-Open; all other states are intermediate. Note that I-Open and 3053 R-Open are equivalent except for whether the initiator or responder 3054 transport connection is used for communication. 3056 A CER message is always sent on the initiating connection immediately 3057 after the connection request is successfully completed. In the case 3058 of an election, one of the two connections will shut down. The 3059 responder connection will survive if the Origin-Host of the local 3060 Diameter entity is higher than that of the peer; the initiator 3061 connection will survive if the peer's Origin-Host is higher. All 3062 subsequent messages are sent on the surviving connection. Note that 3063 the results of an election on one peer are guaranteed to be the 3064 inverse of the results on the other. 3066 For TLS usage, a TLS handshake will begin when both ends are in the 3067 open state. If the TLS handshake is successful, all further messages 3068 will be sent via TLS. If the handshake fails, both ends move to the 3069 closed state. 3071 The state machine constrains only the behavior of a Diameter 3072 implementation as seen by Diameter peers through events on the wire. 3074 Any implementation that produces equivalent results is considered 3075 compliant. 3077 state event action next state 3078 ----------------------------------------------------------------- 3079 Closed Start I-Snd-Conn-Req Wait-Conn-Ack 3080 R-Conn-CER R-Accept, R-Open 3081 Process-CER, 3082 R-Snd-CEA 3084 Wait-Conn-Ack I-Rcv-Conn-Ack I-Snd-CER Wait-I-CEA 3085 I-Rcv-Conn-Nack Cleanup Closed 3086 R-Conn-CER R-Accept, Wait-Conn-Ack/ 3087 Process-CER Elect 3088 Timeout Error Closed 3090 Wait-I-CEA I-Rcv-CEA Process-CEA I-Open 3091 R-Conn-CER R-Accept, Wait-Returns 3092 Process-CER, 3093 Elect 3094 I-Peer-Disc I-Disc Closed 3095 I-Rcv-Non-CEA Error Closed 3096 Timeout Error Closed 3098 Wait-Conn-Ack/ I-Rcv-Conn-Ack I-Snd-CER,Elect Wait-Returns 3099 Elect I-Rcv-Conn-Nack R-Snd-CEA R-Open 3100 R-Peer-Disc R-Disc Wait-Conn-Ack 3101 R-Conn-CER R-Reject Wait-Conn-Ack/ 3102 Elect 3103 Timeout Error Closed 3105 Wait-Returns Win-Election I-Disc,R-Snd-CEA R-Open 3106 I-Peer-Disc I-Disc, R-Open 3107 R-Snd-CEA 3108 I-Rcv-CEA R-Disc I-Open 3109 R-Peer-Disc R-Disc Wait-I-CEA 3110 R-Conn-CER R-Reject Wait-Returns 3111 Timeout Error Closed 3113 R-Open Send-Message R-Snd-Message R-Open 3114 R-Rcv-Message Process R-Open 3115 R-Rcv-DWR Process-DWR, R-Open 3116 R-Snd-DWA 3117 R-Rcv-DWA Process-DWA R-Open 3118 R-Conn-CER R-Reject R-Open 3119 Stop R-Snd-DPR Closing 3120 R-Rcv-DPR R-Snd-DPA, Closed 3121 R-Disc 3123 R-Peer-Disc R-Disc Closed 3124 R-Rcv-CER R-Snd-CEA R-Open 3125 R-Rcv-CEA Process-CEA R-Open 3127 I-Open Send-Message I-Snd-Message I-Open 3128 I-Rcv-Message Process I-Open 3129 I-Rcv-DWR Process-DWR, I-Open 3130 I-Snd-DWA 3131 I-Rcv-DWA Process-DWA I-Open 3132 R-Conn-CER R-Reject I-Open 3133 Stop I-Snd-DPR Closing 3134 I-Rcv-DPR I-Snd-DPA, Closed 3135 I-Disc 3136 I-Peer-Disc I-Disc Closed 3137 I-Rcv-CER I-Snd-CEA I-Open 3138 I-Rcv-CEA Process-CEA I-Open 3140 Closing I-Rcv-DPA I-Disc Closed 3141 R-Rcv-DPA R-Disc Closed 3142 Timeout Error Closed 3143 I-Peer-Disc I-Disc Closed 3144 R-Peer-Disc R-Disc Closed 3146 5.6.1. Incoming connections 3148 When a connection request is received from a Diameter peer, it is 3149 not, in the general case, possible to know the identity of that peer 3150 until a CER is received from it. This is because host and port 3151 determine the identity of a Diameter peer; and the source port of an 3152 incoming connection is arbitrary. Upon receipt of CER, the identity 3153 of the connecting peer can be uniquely determined from Origin-Host. 3155 For this reason, a Diameter peer must employ logic separate from the 3156 state machine to receive connection requests, accept them, and await 3157 CER. Once CER arrives on a new connection, the Origin-Host that 3158 identifies the peer is used to locate the state machine associated 3159 with that peer, and the new connection and CER are passed to the 3160 state machine as an R-Conn-CER event. 3162 The logic that handles incoming connections SHOULD close and discard 3163 the connection if any message other than CER arrives, or if an 3164 implementation-defined timeout occurs prior to receipt of CER. 3166 Because handling of incoming connections up to and including receipt 3167 of CER requires logic, separate from that of any individual state 3168 machine associated with a particular peer, it is described separately 3169 in this section rather than in the state machine above. 3171 5.6.2. Events 3173 Transitions and actions in the automaton are caused by events. In 3174 this section, we will ignore the -I and -R prefix, since the actual 3175 event would be identical, but would occur on one of two possible 3176 connections. 3178 Start The Diameter application has signaled that a 3179 connection should be initiated with the peer. 3181 R-Conn-CER An acknowledgement is received stating that the 3182 transport connection has been established, and the 3183 associated CER has arrived. 3185 Rcv-Conn-Ack A positive acknowledgement is received confirming that 3186 the transport connection is established. 3188 Rcv-Conn-Nack A negative acknowledgement was received stating that 3189 the transport connection was not established. 3191 Timeout An application-defined timer has expired while waiting 3192 for some event. 3194 Rcv-CER A CER message from the peer was received. 3196 Rcv-CEA A CEA message from the peer was received. 3198 Rcv-Non-CEA A message other than CEA from the peer was received. 3200 Peer-Disc A disconnection indication from the peer was received. 3202 Rcv-DPR A DPR message from the peer was received. 3204 Rcv-DPA A DPA message from the peer was received. 3206 Win-Election An election was held, and the local node was the 3207 winner. 3209 Send-Message A message is to be sent. 3211 Rcv-Message A message other than CER, CEA, DPR, DPA, DWR or DWA 3212 was received. 3214 Stop The Diameter application has signaled that a 3215 connection should be terminated (e.g., on system 3216 shutdown). 3218 5.6.3. Actions 3220 Actions in the automaton are caused by events and typically indicate 3221 the transmission of packets and/or an action to be taken on the 3222 connection. In this section we will ignore the I- and R-prefix, 3223 since the actual action would be identical, but would occur on one of 3224 two possible connections. 3226 Snd-Conn-Req A transport connection is initiated with the peer. 3228 Accept The incoming connection associated with the R-Conn-CER 3229 is accepted as the responder connection. 3231 Reject The incoming connection associated with the R-Conn-CER 3232 is disconnected. 3234 Process-CER The CER associated with the R-Conn-CER is processed. 3235 Snd-CER A CER message is sent to the peer. 3237 Snd-CEA A CEA message is sent to the peer. 3239 Cleanup If necessary, the connection is shutdown, and any 3240 local resources are freed. 3242 Error The transport layer connection is disconnected, either 3243 politely or abortively, in response to an error 3244 condition. Local resources are freed. 3246 Process-CEA A received CEA is processed. 3248 Snd-DPR A DPR message is sent to the peer. 3250 Snd-DPA A DPA message is sent to the peer. 3252 Disc The transport layer connection is disconnected, and 3253 local resources are freed. 3255 Elect An election occurs (see Section 5.6.4 for more 3256 information). 3258 Snd-Message A message is sent. 3260 Snd-DWR A DWR message is sent. 3262 Snd-DWA A DWA message is sent. 3264 Process-DWR The DWR message is serviced. 3266 Process-DWA The DWA message is serviced. 3268 Process A message is serviced. 3270 5.6.4. The Election Process 3272 The election is performed on the responder. The responder compares 3273 the Origin-Host received in the CER with its own Origin-Host as two 3274 streams of octets. If the local Origin-Host lexicographically 3275 succeeds the received Origin-Host a Win-Election event is issued 3276 locally. Diameter identities are in ASCII form therefore the lexical 3277 comparison is consistent with DNS case insensitivity where octets 3278 that fall in the ASCII range 'a' through 'z' MUST compare equally to 3279 their upper-case counterparts between 'A' and 'Z'. See Appendix D 3280 for interactions between the Diameter protocol and Internationalized 3281 Domain Name (IDNs). 3283 The winner of the election MUST close the connection it initiated. 3284 Historically, maintaining the responder side of a connection was more 3285 efficient than maintaining the initiator side. However, current 3286 practices makes this distinction irrelevant. 3288 5.6.5. Capabilities Update 3290 A Diameter node MUST initiate peer capabilities update by sending a 3291 Capabilities-Exchange-Req (CER) to all its peers which supports peer 3292 capabilities update and is in OPEN state. The receiver of CER in 3293 open state MUST process and reply to the CER as a described in 3294 Section 5.3. The CEA which the receiver sends MUST contain its 3295 latest capabilities. Note that peers which successfully process the 3296 peer capabilities update SHOULD also update their routing tables to 3297 reflect the change. The receiver of the CEA, with a Result-Code AVP 3298 other than DIAMETER_SUCCESS, initiates the transport disconnect. The 3299 peer may periodically attempt to reconnect, as stated in Section 2.1. 3301 Peer capabilities update in the open state SHOULD be limited to the 3302 advertisement of the new list of supported applications and MUST 3303 preclude re-negotiation of security mechanism or other capabilities. 3304 If any capabilities change happens in the node (e.g. change in 3305 security mechanisms), other than a change in the supported 3306 applications, the node SHOULD gracefully terminate (setting the 3307 Disconnect-Cause AVP value to REBOOTING) and re-establish the 3308 diameter connections to all the peers. 3310 6. Diameter message processing 3312 This section describes how Diameter requests and answers are created 3313 and processed. 3315 6.1. Diameter Request Routing Overview 3317 A request is sent towards its final destination using a combination 3318 of the Destination-Realm and Destination-Host AVPs, in one of these 3319 three combinations: 3321 o a request that is not able to be proxied (such as CER) MUST NOT 3322 contain either Destination-Realm or Destination-Host AVPs. 3324 o a request that needs to be sent to a home server serving a 3325 specific realm, but not to a specific server (such as the first 3326 request of a series of round-trips), MUST contain a Destination- 3327 Realm AVP, but MUST NOT contain a Destination-Host AVP. 3329 o otherwise, a request that needs to be sent to a specific home 3330 server among those serving a given realm, MUST contain both the 3331 Destination-Realm and Destination-Host AVPs. 3333 The Destination-Host AVP is used as described above when the 3334 destination of the request is fixed, which includes: 3336 o Authentication requests that span multiple round trips 3338 o A Diameter message that uses a security mechanism that makes use 3339 of a pre-established session key shared between the source and the 3340 final destination of the message. 3342 o Server initiated messages that MUST be received by a specific 3343 Diameter client (e.g., access device), such as the Abort-Session- 3344 Request message, which is used to request that a particular user's 3345 session be terminated. 3347 Note that an agent can forward a request to a host described in the 3348 Destination-Host AVP only if the host in question is included in its 3349 peer table (see Section 2.7). Otherwise, the request is routed based 3350 on the Destination-Realm only (see Sections 6.1.6). 3352 The Destination-Realm AVP MUST be present if the message is 3353 proxiable. A message that MUST NOT be forwarded by Diameter agents 3354 (proxies, redirects or relays) MUST NOT include the Destination-Realm 3355 in its ABNF. For Diameter clients, the value of the Destination- 3356 Realm AVP MAY be extracted from the User-Name AVP, or other 3357 application-specific methods. 3359 When a message is received, the message is processed in the following 3360 order: 3362 o If the message is destined for the local host, the procedures 3363 listed in Section 6.1.4 are followed. 3365 o If the message is intended for a Diameter peer with whom the local 3366 host is able to directly communicate, the procedures listed in 3367 Section 6.1.5 are followed. This is known as Request Forwarding. 3369 o The procedures listed in Section 6.1.6 are followed, which is 3370 known as Request Routing. 3372 o If none of the above is successful, an answer is returned with the 3373 Result-Code set to DIAMETER_UNABLE_TO_DELIVER, with the E-bit set. 3375 For routing of Diameter messages to work within an administrative 3376 domain, all Diameter nodes within the realm MUST be peers. 3378 Note the processing rules contained in this section are intended to 3379 be used as general guidelines to Diameter developers. Certain 3380 implementations MAY use different methods than the ones described 3381 here, and still comply with the protocol specification. See Section 3382 7 for more detail on error handling. 3384 6.1.1. Originating a Request 3386 When creating a request, in addition to any other procedures 3387 described in the application definition for that specific request, 3388 the following procedures MUST be followed: 3390 o the Command-Code is set to the appropriate value 3392 o the 'R' bit is set 3394 o the End-to-End Identifier is set to a locally unique value 3396 o the Origin-Host and Origin-Realm AVPs MUST be set to the 3397 appropriate values, used to identify the source of the message 3399 o the Destination-Host and Destination-Realm AVPs MUST be set to the 3400 appropriate values as described in Section 6.1. 3402 6.1.2. Sending a Request 3404 When sending a request, originated either locally, or as the result 3405 of a forwarding or routing operation, the following procedures MUST 3406 be followed: 3408 o the Hop-by-Hop Identifier should be set to a locally unique value. 3410 o The message should be saved in the list of pending requests. 3412 Other actions to perform on the message based on the particular role 3413 the agent is playing are described in the following sections. 3415 6.1.3. Receiving Requests 3417 A relay or proxy agent MUST check for forwarding loops when receiving 3418 requests. A loop is detected if the server finds its own identity in 3419 a Route-Record AVP. When such an event occurs, the agent MUST answer 3420 with the Result-Code AVP set to DIAMETER_LOOP_DETECTED. 3422 6.1.4. Processing Local Requests 3424 A request is known to be for local consumption when one of the 3425 following conditions occur: 3427 o The Destination-Host AVP contains the local host's identity, 3429 o The Destination-Host AVP is not present, the Destination-Realm AVP 3430 contains a realm the server is configured to process locally, and 3431 the Diameter application is locally supported, or 3433 o Both the Destination-Host and the Destination-Realm are not 3434 present. 3436 When a request is locally processed, the rules in Section 6.2 should 3437 be used to generate the corresponding answer. 3439 6.1.5. Request Forwarding 3441 Request forwarding is done using the Diameter Peer Table. The 3442 Diameter peer table contains all of the peers that the local node is 3443 able to directly communicate with. 3445 When a request is received, and the host encoded in the Destination- 3446 Host AVP is one that is present in the peer table, the message SHOULD 3447 be forwarded to the peer. 3449 6.1.6. Request Routing 3451 Diameter request message routing is done via realms and applications. 3452 A Diameter message that may be forwarded by Diameter agents (proxies, 3453 redirects or relays) MUST include the target realm in the 3454 Destination-Realm AVP. Request routing SHOULD rely on the 3455 Destination-Realm AVP and the Application Id present in the request 3456 message header to aid in the routing decision. The realm MAY be 3457 retrieved from the User-Name AVP, which is in the form of a Network 3458 Access Identifier (NAI). The realm portion of the NAI is inserted in 3459 the Destination-Realm AVP. 3461 Diameter agents MAY have a list of locally supported realms and 3462 applications, and MAY have a list of externally supported realms and 3463 applications. When a request is received that includes a realm 3464 and/or application that is not locally supported, the message is 3465 routed to the peer configured in the Routing Table (see Section 2.7). 3467 Realm names and Application Ids are the minimum supported routing 3468 criteria, additional routing information maybe needed to support 3469 redirect semantics. 3471 6.1.7. Predictive Loop Avoidance 3473 Before forwarding or routing a request, Diameter agents, in addition 3474 to processing done in Section 6.1.3, SHOULD check for the presence of 3475 candidate route's peer identity in any of the Route-Record AVPs. In 3476 an event of the agent detecting the presence of a candidate route's 3477 peer identity in a Route-Record AVP, the agent MUST ignore such route 3478 for the Diameter request message and attempt alternate routes if any. 3479 In case all the candidate routes are eliminated by the above 3480 criteria, the agent SHOULD return DIAMETER_UNABLE_TO_DELIVER message. 3482 6.1.8. Redirecting requests 3484 When a redirect agent receives a request whose routing entry is set 3485 to REDIRECT, it MUST reply with an answer message with the 'E' bit 3486 set, while maintaining the Hop-by-Hop Identifier in the header, and 3487 include the Result-Code AVP to DIAMETER_REDIRECT_INDICATION. Each of 3488 the servers associated with the routing entry are added in separate 3489 Redirect-Host AVP. 3491 +------------------+ 3492 | Diameter | 3493 | Redirect Agent | 3494 +------------------+ 3495 ^ | 2. command + 'E' bit 3496 1. Request | | Result-Code = 3497 joe@example.com | | DIAMETER_REDIRECT_INDICATION + 3498 | | Redirect-Host AVP(s) 3499 | v 3500 +-------------+ 3. Request +-------------+ 3501 | example.com |------------->| example.net | 3502 | Relay | | Diameter | 3503 | Agent |<-------------| Server | 3504 +-------------+ 4. Answer +-------------+ 3506 Figure 5: Diameter Redirect Agent 3508 The receiver of the answer message with the 'E' bit set, and the 3509 Result-Code AVP set to DIAMETER_REDIRECT_INDICATION uses the hop-by- 3510 hop field in the Diameter header to identify the request in the 3511 pending message queue (see Section 5.3) that is to be redirected. If 3512 no transport connection exists with the new agent, one is created, 3513 and the request is sent directly to it. 3515 Multiple Redirect-Host AVPs are allowed. The receiver of the answer 3516 message with the 'E' bit set selects exactly one of these hosts as 3517 the destination of the redirected message. 3519 When the Redirect-Host-Usage AVP included in the answer message has a 3520 non-zero value, a route entry for the redirect indications is created 3521 and cached by the receiver. The redirect usage for such route entry 3522 is set by the value of Redirect-Host-Usage AVP and the lifetime of 3523 the cached route entry is set by Redirect-Max-Cache-Time AVP value. 3525 It is possible that multiple redirect indications can create multiple 3526 cached route entries differing only in their redirect usage and the 3527 peer to forward messages to. As an example, two(2) route entries 3528 that are created by two(2) redirect indications results in two(2) 3529 cached routes for the same realm and Application Id. However, one 3530 has a redirect usage of ALL_SESSION where matching request will be 3531 forwarded to one peer and the other has a redirect usage of ALL_REALM 3532 where request are forwarded to another peer. Therefore, an incoming 3533 request that matches the realm and Application Id of both routes will 3534 need additional resolution. In such a case, a routing precedence 3535 rule MUST be used againt the redirect usage value to resolve the 3536 contention. The precedence rule can be found in Section 6.13. 3538 6.1.9. Relaying and Proxying Requests 3540 A relay or proxy agent MUST append a Route-Record AVP to all requests 3541 forwarded. The AVP contains the identity of the peer the request was 3542 received from. 3544 The Hop-by-Hop identifier in the request is saved, and replaced with 3545 a locally unique value. The source of the request is also saved, 3546 which includes the IP address, port and protocol. 3548 A relay or proxy agent MAY include the Proxy-Info AVP in requests if 3549 it requires access to any local state information when the 3550 corresponding response is received. Proxy-Info AVP has certain 3551 security implications and SHOULD contain an embedded HMAC with a 3552 node-local key. Alternatively, it MAY simply use local storage to 3553 store state information. 3555 The message is then forwarded to the next hop, as identified in the 3556 Routing Table. 3558 Figure 6 provides an example of message routing using the procedures 3559 listed in these sections. 3561 (Origin-Host=nas.mno.net) (Origin-Host=nas.mno.net) 3562 (Origin-Realm=mno.net) (Origin-Realm=mno.net) 3563 (Destination-Realm=example.com) (Destination- 3564 Realm=example.com) 3565 (Route-Record=nas.example.net) 3566 +------+ ------> +------+ ------> +------+ 3567 | | (Request) | | (Request) | | 3568 | NAS +-------------------+ DRL +-------------------+ HMS | 3569 | | | | | | 3570 +------+ <------ +------+ <------ +------+ 3571 example.net (Answer) example.net (Answer) example.com 3572 (Origin-Host=hms.example.com) (Origin-Host=hms.example.com) 3573 (Origin-Realm=example.com) (Origin-Realm=example.com) 3575 Figure 6: Routing of Diameter messages 3577 Relay agents do not require full validation of incoming messages. At 3578 a minimum, validation of the message header and relevant routing AVPs 3579 has to be done when relaying messages. 3581 6.2. Diameter Answer Processing 3583 When a request is locally processed, the following procedures MUST be 3584 applied to create the associated answer, in addition to any 3585 additional procedures that MAY be discussed in the Diameter 3586 application defining the command: 3588 o The same Hop-by-Hop identifier in the request is used in the 3589 answer. 3591 o The local host's identity is encoded in the Origin-Host AVP. 3593 o The Destination-Host and Destination-Realm AVPs MUST NOT be 3594 present in the answer message. 3596 o The Result-Code AVP is added with its value indicating success or 3597 failure. 3599 o If the Session-Id is present in the request, it MUST be included 3600 in the answer. 3602 o Any Proxy-Info AVPs in the request MUST be added to the answer 3603 message, in the same order they were present in the request. 3605 o The 'P' bit is set to the same value as the one in the request. 3607 o The same End-to-End identifier in the request is used in the 3608 answer. 3610 Note that the error messages (see Section 7.3) are also subjected to 3611 the above processing rules. 3613 6.2.1. Processing received Answers 3615 A Diameter client or proxy MUST match the Hop-by-Hop Identifier in an 3616 answer received against the list of pending requests. The 3617 corresponding message should be removed from the list of pending 3618 requests. It SHOULD ignore answers received that do not match a 3619 known Hop-by-Hop Identifier. 3621 6.2.2. Relaying and Proxying Answers 3623 If the answer is for a request which was proxied or relayed, the 3624 agent MUST restore the original value of the Diameter header's Hop- 3625 by-Hop Identifier field. 3627 If the last Proxy-Info AVP in the message is targeted to the local 3628 Diameter server, the AVP MUST be removed before the answer is 3629 forwarded. 3631 If a relay or proxy agent receives an answer with a Result-Code AVP 3632 indicating a failure, it MUST NOT modify the contents of the AVP. 3633 Any additional local errors detected SHOULD be logged, but not 3634 reflected in the Result-Code AVP. If the agent receives an answer 3635 message with a Result-Code AVP indicating success, and it wishes to 3636 modify the AVP to indicate an error, it MUST modify the Result-Code 3637 AVP to contain the appropriate error in the message destined towards 3638 the access device as well as include the Error-Reporting-Host AVP and 3639 it MUST issue an STR on behalf of the access device. 3641 The agent MUST then send the answer to the host that it received the 3642 original request from. 3644 6.3. Origin-Host AVP 3646 The Origin-Host AVP (AVP Code 264) is of type DiameterIdentity, and 3647 MUST be present in all Diameter messages. This AVP identifies the 3648 endpoint that originated the Diameter message. Relay agents MUST NOT 3649 modify this AVP. 3651 The value of the Origin-Host AVP is guaranteed to be unique within a 3652 single host. 3654 Note that the Origin-Host AVP may resolve to more than one address as 3655 the Diameter peer may support more than one address. 3657 This AVP SHOULD be placed as close to the Diameter header as 3658 possible. 3660 6.4. Origin-Realm AVP 3662 The Origin-Realm AVP (AVP Code 296) is of type DiameterIdentity. 3663 This AVP contains the Realm of the originator of any Diameter message 3664 and MUST be present in all messages. 3666 This AVP SHOULD be placed as close to the Diameter header as 3667 possible. 3669 6.5. Destination-Host AVP 3671 The Destination-Host AVP (AVP Code 293) is of type DiameterIdentity. 3672 This AVP MUST be present in all unsolicited agent initiated messages, 3673 MAY be present in request messages, and MUST NOT be present in Answer 3674 messages. 3676 The absence of the Destination-Host AVP will cause a message to be 3677 sent to any Diameter server supporting the application within the 3678 realm specified in Destination-Realm AVP. 3680 This AVP SHOULD be placed as close to the Diameter header as 3681 possible. 3683 6.6. Destination-Realm AVP 3685 The Destination-Realm AVP (AVP Code 283) is of type DiameterIdentity, 3686 and contains the realm the message is to be routed to. The 3687 Destination-Realm AVP MUST NOT be present in Answer messages. 3688 Diameter Clients insert the realm portion of the User-Name AVP. 3689 Diameter servers initiating a request message use the value of the 3690 Origin-Realm AVP from a previous message received from the intended 3691 target host (unless it is known a priori). When present, the 3692 Destination-Realm AVP is used to perform message routing decisions. 3694 Request messages whose ABNF does not list the Destination-Realm AVP 3695 as a mandatory AVP are inherently non-routable messages. 3697 This AVP SHOULD be placed as close to the Diameter header as 3698 possible. 3700 6.7. Routing AVPs 3702 The AVPs defined in this section are Diameter AVPs used for routing 3703 purposes. These AVPs change as Diameter messages are processed by 3704 agents. 3706 6.7.1. Route-Record AVP 3708 The Route-Record AVP (AVP Code 282) is of type DiameterIdentity. The 3709 identity added in this AVP MUST be the same as the one received in 3710 the Origin-Host of the Capabilities Exchange message. 3712 6.7.2. Proxy-Info AVP 3714 The Proxy-Info AVP (AVP Code 284) is of type Grouped. The Grouped 3715 Data field has the following ABNF grammar: 3717 Proxy-Info ::= < AVP Header: 284 > 3718 { Proxy-Host } 3719 { Proxy-State } 3720 * [ AVP ] 3722 6.7.3. Proxy-Host AVP 3724 The Proxy-Host AVP (AVP Code 280) is of type DiameterIdentity. This 3725 AVP contains the identity of the host that added the Proxy-Info AVP. 3727 6.7.4. Proxy-State AVP 3729 The Proxy-State AVP (AVP Code 33) is of type OctetString, and 3730 contains state local information, and MUST be treated as opaque data. 3732 6.8. Auth-Application-Id AVP 3734 The Auth-Application-Id AVP (AVP Code 258) is of type Unsigned32 and 3735 is used in order to advertise support of the Authentication and 3736 Authorization portion of an application (see Section 2.4). If 3737 present in a message other than CER and CEA, the value of the Auth- 3738 Application-Id AVP MUST match the Application Id present in the 3739 Diameter message header. 3741 6.9. Acct-Application-Id AVP 3743 The Acct-Application-Id AVP (AVP Code 259) is of type Unsigned32 and 3744 is used in order to advertise support of the Accounting portion of an 3745 application (see Section 2.4). If present in a message other than 3746 CER and CEA, the value of the Acct-Application-Id AVP MUST match the 3747 Application Id present in the Diameter message header. 3749 6.10. Inband-Security-Id AVP 3751 The Inband-Security-Id AVP (AVP Code 299) is of type Unsigned32 and 3752 is used in order to advertise support of the Security portion of the 3753 application. 3755 Currently, the following values are supported, but there is ample 3756 room to add new security Ids. 3758 NO_INBAND_SECURITY 0 3760 This peer does not support TLS. This is the default value, if the 3761 AVP is omitted. 3763 TLS 1 3765 This node supports TLS security, as defined by [RFC4346]. 3767 6.11. Vendor-Specific-Application-Id AVP 3769 The Vendor-Specific-Application-Id AVP (AVP Code 260) is of type 3770 Grouped and is used to advertise support of a vendor-specific 3771 Diameter Application. Exactly one instance of either Auth- 3772 Application-Id or Acct-Application-Id AVP MUST be present. The 3773 Application Id carried by either Auth-Application-Id or Acct- 3774 Application-Id AVP MUST comply with vendor specific Application Id 3775 assignment described in Sec 11.3. It MUST also match the Application 3776 Id present in the diameter header except when used in a CER or CEA 3777 messages. 3779 The Vendor-Id AVP is an informational AVP pertaining to the vendor 3780 who may have authorship of the vendor-specific Diameter application. 3781 It MUST NOT be used as a means of defining a completely separate 3782 vendor-specific Application Id space. 3784 This AVP MUST also be present as the first AVP in all experimental 3785 commands defined in the vendor-specific application. 3787 This AVP SHOULD be placed as close to the Diameter header as 3788 possible. 3790 AVP Format 3792 ::= < AVP Header: 260 > 3793 { Vendor-Id } 3794 [ Auth-Application-Id ] 3795 [ Acct-Application-Id ] 3797 A Vendor-Specific-Application-Id AVP MUST contain exactly one of 3798 either Auth-Application-Id or Acct-Application-Id. If a Vendor- 3799 Specific-Application-Id is received without any of these two AVPs, 3800 then the recipient SHOULD issue an answer with a Result-Code set to 3801 DIAMETER_MISSING_AVP. The answer SHOULD also include a Failed-AVP 3802 which MUST contain an example of an Auth-Application-Id AVP and an 3803 Acct-Application-Id AVP. 3805 If a Vendor-Specific-Application-Id is received that contains both 3806 Auth-Application-Id and Acct-Application-Id, then the recipient 3807 SHOULD issue an answer with Result-Code set to 3808 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES. The answer SHOULD also include a 3809 Failed-AVP which MUST contain the received Auth-Application-Id AVP 3810 and Acct-Application-Id AVP. 3812 6.12. Redirect-Host AVP 3814 One or more of instances of this AVP MUST be present if the answer 3815 message's 'E' bit is set and the Result-Code AVP is set to 3816 DIAMETER_REDIRECT_INDICATION. 3818 Upon receiving the above, the receiving Diameter node SHOULD forward 3819 the request directly to one of the hosts identified in these AVPs. 3820 The server contained in the selected Redirect-Host AVP SHOULD be used 3821 for all messages pertaining to this session. 3823 6.13. Redirect-Host-Usage AVP 3825 The Redirect-Host-Usage AVP (AVP Code 261) is of type Enumerated. 3826 This AVP MAY be present in answer messages whose 'E' bit is set and 3827 the Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION. 3829 When present, this AVP dictates how the routing entry resulting from 3830 the Redirect-Host is to be used. The following values are supported: 3832 DONT_CACHE 0 3834 The host specified in the Redirect-Host AVP should not be cached. 3835 This is the default value. 3837 ALL_SESSION 1 3839 All messages within the same session, as defined by the same value 3840 of the Session-ID AVP MAY be sent to the host specified in the 3841 Redirect-Host AVP. 3843 ALL_REALM 2 3845 All messages destined for the realm requested MAY be sent to the 3846 host specified in the Redirect-Host AVP. 3848 REALM_AND_APPLICATION 3 3850 All messages for the application requested to the realm specified 3851 MAY be sent to the host specified in the Redirect-Host AVP. 3853 ALL_APPLICATION 4 3855 All messages for the application requested MAY be sent to the host 3856 specified in the Redirect-Host AVP. 3858 ALL_HOST 5 3860 All messages that would be sent to the host that generated the 3861 Redirect-Host MAY be sent to the host specified in the Redirect- 3862 Host AVP. 3864 ALL_USER 6 3866 All messages for the user requested MAY be sent to the host 3867 specified in the Redirect-Host AVP. 3869 When multiple cached routes are created by redirect indications and 3870 they differ only in redirect usage and peers to forward requests to 3871 (see Section 6.1.8), a precedence rule MUST be applied to the 3872 redirect usage values of the cached routes during normal routing to 3873 resolve contentions that may occur. The precedence rule is the order 3874 that dictate which redirect usage should be considered before any 3875 other as they appear. The order is as follows: 3877 1. ALL_SESSION 3879 2. ALL_USER 3881 3. REALM_AND_APPLICATION 3883 4. ALL_REALM 3885 5. ALL_APPLICATION 3887 6. ALL_HOST 3889 6.14. Redirect-Max-Cache-Time AVP 3891 The Redirect-Max-Cache-Time AVP (AVP Code 262) is of type Unsigned32. 3892 This AVP MUST be present in answer messages whose 'E' bit is set, the 3893 Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION and the 3894 Redirect-Host-Usage AVP set to a non-zero value. 3896 This AVP contains the maximum number of seconds the peer and route 3897 table entries, created as a result of the Redirect-Host, will be 3898 cached. Note that once a host created due to a redirect indication 3899 is no longer reachable, any associated peer and routing table entries 3900 MUST be deleted. 3902 7. Error Handling 3904 There are two different types of errors in Diameter; protocol and 3905 application errors. A protocol error is one that occurs at the base 3906 protocol level, and MAY require per hop attention (e.g., message 3907 routing error). Application errors, on the other hand, generally 3908 occur due to a problem with a function specified in a Diameter 3909 application (e.g., user authentication, Missing AVP). 3911 Result-Code AVP values that are used to report protocol errors MUST 3912 only be present in answer messages whose 'E' bit is set. When a 3913 request message is received that causes a protocol error, an answer 3914 message is returned with the 'E' bit set, and the Result-Code AVP is 3915 set to the appropriate protocol error value. As the answer is sent 3916 back towards the originator of the request, each proxy or relay agent 3917 MAY take action on the message. 3919 1. Request +---------+ Link Broken 3920 +-------------------------->|Diameter |----///----+ 3921 | +---------------------| | v 3922 +------+--+ | 2. answer + 'E' set | Relay 2 | +--------+ 3923 |Diameter |<-+ (Unable to Forward) +---------+ |Diameter| 3924 | | | Home | 3925 | Relay 1 |--+ +---------+ | Server | 3926 +---------+ | 3. Request |Diameter | +--------+ 3927 +-------------------->| | ^ 3928 | Relay 3 |-----------+ 3929 +---------+ 3931 Figure 7: Example of Protocol Error causing answer message 3933 Figure 7 provides an example of a message forwarded upstream by a 3934 Diameter relay. When the message is received by Relay 2, and it 3935 detects that it cannot forward the request to the home server, an 3936 answer message is returned with the 'E' bit set and the Result-Code 3937 AVP set to DIAMETER_UNABLE_TO_DELIVER. Given that this error falls 3938 within the protocol error category, Relay 1 would take special 3939 action, and given the error, attempt to route the message through its 3940 alternate Relay 3. 3942 +---------+ 1. Request +---------+ 2. Request +---------+ 3943 | Access |------------>|Diameter |------------>|Diameter | 3944 | | | | | Home | 3945 | Device |<------------| Relay |<------------| Server | 3946 +---------+ 4. Answer +---------+ 3. Answer +---------+ 3947 (Missing AVP) (Missing AVP) 3949 Figure 8: Example of Application Error Answer message 3951 Figure 8 provides an example of a Diameter message that caused an 3952 application error. When application errors occur, the Diameter 3953 entity reporting the error clears the 'R' bit in the Command Flags, 3954 and adds the Result-Code AVP with the proper value. Application 3955 errors do not require any proxy or relay agent involvement, and 3956 therefore the message would be forwarded back to the originator of 3957 the request. 3959 There are certain Result-Code AVP application errors that require 3960 additional AVPs to be present in the answer. In these cases, the 3961 Diameter node that sets the Result-Code AVP to indicate the error 3962 MUST add the AVPs. Examples are: 3964 o An unrecognized AVP is received with the 'M' bit (Mandatory bit) 3965 set, causes an answer to be sent with the Result-Code AVP set to 3966 DIAMETER_AVP_UNSUPPORTED, and the Failed-AVP AVP containing the 3967 offending AVP. 3969 o An AVP that is received with an unrecognized value causes an 3970 answer to be returned with the Result-Code AVP set to 3971 DIAMETER_INVALID_AVP_VALUE, with the Failed-AVP AVP containing the 3972 AVP causing the error. 3974 o A command is received with an AVP that is omitted, yet is 3975 mandatory according to the command's ABNF. The receiver issues an 3976 answer with the Result-Code set to DIAMETER_MISSING_AVP, and 3977 creates an AVP with the AVP Code and other fields set as expected 3978 in the missing AVP. The created AVP is then added to the Failed- 3979 AVP AVP. 3981 The Result-Code AVP describes the error that the Diameter node 3982 encountered in its processing. In case there are multiple errors, 3983 the Diameter node MUST report only the first error it encountered 3984 (detected possibly in some implementation dependent order). The 3985 specific errors that can be described by this AVP are described in 3986 the following section. 3988 7.1. Result-Code AVP 3990 The Result-Code AVP (AVP Code 268) is of type Unsigned32 and 3991 indicates whether a particular request was completed successfully or 3992 whether an error occurred. All Diameter answer messages defined in 3993 IETF applications MUST include one Result-Code AVP. A non-successful 3994 Result-Code AVP (one containing a non 2xxx value other than 3995 DIAMETER_REDIRECT_INDICATION) MUST include the Error-Reporting-Host 3996 AVP if the host setting the Result-Code AVP is different from the 3997 identity encoded in the Origin-Host AVP. 3999 The Result-Code data field contains an IANA-managed 32-bit address 4000 space representing errors (see Section 11.4). Diameter provides the 4001 following classes of errors, all identified by the thousands digit in 4002 the decimal notation: 4004 o 1xxx (Informational) 4006 o 2xxx (Success) 4008 o 3xxx (Protocol Errors) 4010 o 4xxx (Transient Failures) 4012 o 5xxx (Permanent Failure) 4014 A non-recognized class (one whose first digit is not defined in this 4015 section) MUST be handled as a permanent failure. 4017 7.1.1. Informational 4019 Errors that fall within this category are used to inform the 4020 requester that a request could not be satisfied, and additional 4021 action is required on its part before access is granted. 4023 DIAMETER_MULTI_ROUND_AUTH 1001 4025 This informational error is returned by a Diameter server to 4026 inform the access device that the authentication mechanism being 4027 used requires multiple round trips, and a subsequent request needs 4028 to be issued in order for access to be granted. 4030 7.1.2. Success 4032 Errors that fall within the Success category are used to inform a 4033 peer that a request has been successfully completed. 4035 DIAMETER_SUCCESS 2001 4037 The Request was successfully completed. 4039 DIAMETER_LIMITED_SUCCESS 2002 4041 When returned, the request was successfully completed, but 4042 additional processing is required by the application in order to 4043 provide service to the user. 4045 7.1.3. Protocol Errors 4047 Errors that fall within the Protocol Error category SHOULD be treated 4048 on a per-hop basis, and Diameter proxies MAY attempt to correct the 4049 error, if it is possible. Note that these and only these errors MUST 4050 only be used in answer messages whose 'E' bit is set. To provide 4051 backward compatibility with existing implementations that follow 4052 [RFC3588], some of the error values that have previously been used in 4053 this category by [RFC3588] will not be re-used. Therefore the error 4054 values enumerated here may be non-sequential. 4056 DIAMETER_UNABLE_TO_DELIVER 3002 4058 This error is given when Diameter can not deliver the message to 4059 the destination, either because no host within the realm 4060 supporting the required application was available to process the 4061 request, or because Destination-Host AVP was given without the 4062 associated Destination-Realm AVP. 4064 DIAMETER_REALM_NOT_SERVED 3003 4066 The intended realm of the request is not recognized. 4068 DIAMETER_TOO_BUSY 3004 4070 When returned, a Diameter node SHOULD attempt to send the message 4071 to an alternate peer. This error MUST only be used when a 4072 specific server is requested, and it cannot provide the requested 4073 service. 4075 DIAMETER_LOOP_DETECTED 3005 4077 An agent detected a loop while trying to get the message to the 4078 intended recipient. The message MAY be sent to an alternate peer, 4079 if one is available, but the peer reporting the error has 4080 identified a configuration problem. 4082 DIAMETER_REDIRECT_INDICATION 3006 4084 A redirect agent has determined that the request could not be 4085 satisfied locally and the initiator of the request should direct 4086 the request directly to the server, whose contact information has 4087 been added to the response. When set, the Redirect-Host AVP MUST 4088 be present. 4090 DIAMETER_APPLICATION_UNSUPPORTED 3007 4092 A request was sent for an application that is not supported. 4094 DIAMETER_INVALID_BIT_IN_HEADER 3011 4096 This error is returned when a reserved bit in the Diameter header 4097 is set to one (1) or the bits in the Diameter header defined in 4098 Sec 3 are set incorrectly. 4100 DIAMETER_INVALID_MESSAGE_LENGTH 3012 4102 This error is returned when a request is received with an invalid 4103 message length. 4105 7.1.4. Transient Failures 4107 Errors that fall within the transient failures category are used to 4108 inform a peer that the request could not be satisfied at the time it 4109 was received, but MAY be able to satisfy the request in the future. 4110 Note that these errors MUST be used in answer messages whose 'E' bit 4111 is not set. 4113 DIAMETER_AUTHENTICATION_REJECTED 4001 4115 The authentication process for the user failed, most likely due to 4116 an invalid password used by the user. Further attempts MUST only 4117 be tried after prompting the user for a new password. 4119 DIAMETER_OUT_OF_SPACE 4002 4121 A Diameter node received the accounting request but was unable to 4122 commit it to stable storage due to a temporary lack of space. 4124 ELECTION_LOST 4003 4126 The peer has determined that it has lost the election process and 4127 has therefore disconnected the transport connection. 4129 7.1.5. Permanent Failures 4131 Errors that fall within the permanent failures category are used to 4132 inform the peer that the request failed, and should not be attempted 4133 again. Note that these errors SHOULD be used in answer messages 4134 whose 'E' bit is not set. In error conditions where it is not 4135 possible or efficient to compose application specific answer grammar 4136 then answer messages with E-bit set and complying to the grammar 4137 described in 7.2 MAY also be used for permanent errors. 4139 To provide backward compatibility with existing implementations that 4140 follow [RFC3588], some of the error values that have previously been 4141 used in this category by [RFC3588] will not be re-used. Therefore 4142 the error values enumerated here maybe non-sequential. 4144 DIAMETER_AVP_UNSUPPORTED 5001 4146 The peer received a message that contained an AVP that is not 4147 recognized or supported and was marked with the Mandatory bit. A 4148 Diameter message with this error MUST contain one or more Failed- 4149 AVP AVP containing the AVPs that caused the failure. 4151 DIAMETER_UNKNOWN_SESSION_ID 5002 4153 The request contained an unknown Session-Id. 4155 DIAMETER_AUTHORIZATION_REJECTED 5003 4157 A request was received for which the user could not be authorized. 4158 This error could occur if the service requested is not permitted 4159 to the user. 4161 DIAMETER_INVALID_AVP_VALUE 5004 4163 The request contained an AVP with an invalid value in its data 4164 portion. A Diameter message indicating this error MUST include 4165 the offending AVPs within a Failed-AVP AVP. 4167 DIAMETER_MISSING_AVP 5005 4169 The request did not contain an AVP that is required by the Command 4170 Code definition. If this value is sent in the Result-Code AVP, a 4171 Failed-AVP AVP SHOULD be included in the message. The Failed-AVP 4172 AVP MUST contain an example of the missing AVP complete with the 4173 Vendor-Id if applicable. The value field of the missing AVP 4174 should be of correct minimum length and contain zeroes. 4176 DIAMETER_RESOURCES_EXCEEDED 5006 4178 A request was received that cannot be authorized because the user 4179 has already expended allowed resources. An example of this error 4180 condition is a user that is restricted to one dial-up PPP port, 4181 attempts to establish a second PPP connection. 4183 DIAMETER_CONTRADICTING_AVPS 5007 4185 The Home Diameter server has detected AVPs in the request that 4186 contradicted each other, and is not willing to provide service to 4187 the user. The Failed-AVP AVPs MUST be present which contains the 4188 AVPs that contradicted each other. 4190 DIAMETER_AVP_NOT_ALLOWED 5008 4192 A message was received with an AVP that MUST NOT be present. The 4193 Failed-AVP AVP MUST be included and contain a copy of the 4194 offending AVP. 4196 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES 5009 4198 A message was received that included an AVP that appeared more 4199 often than permitted in the message definition. The Failed-AVP 4200 AVP MUST be included and contain a copy of the first instance of 4201 the offending AVP that exceeded the maximum number of occurrences 4203 DIAMETER_NO_COMMON_APPLICATION 5010 4205 This error is returned by a Diameter node that is not acting as a 4206 relay when it receives a CER which advertises a set of 4207 applications that it does not support. 4209 DIAMETER_UNSUPPORTED_VERSION 5011 4211 This error is returned when a request was received, whose version 4212 number is unsupported. 4214 DIAMETER_UNABLE_TO_COMPLY 5012 4216 This error is returned when a request is rejected for unspecified 4217 reasons. 4219 DIAMETER_INVALID_AVP_LENGTH 5014 4221 The request contained an AVP with an invalid length. A Diameter 4222 message indicating this error MUST include the offending AVPs 4223 within a Failed-AVP AVP. In cases where the erroneous avp length 4224 value exceeds the message length or is less than the minimum AVP 4225 header length, it is sufficient to include the offending AVP 4226 header and a zero filled payload of the minimum required length 4227 for the payloads data type. If the AVP is a grouped AVP, the 4228 grouped AVP header with an empty payload would be sufficient to 4229 indicate the offending AVP. In the case where the offending AVP 4230 header cannot be fully decoded when avp length is less than the 4231 minimum AVP header length, it is sufficient to include an 4232 offending AVP header that is formulated by padding the incomplete 4233 AVP header with zero up to the minimum AVP header length. 4235 DIAMETER_NO_COMMON_SECURITY 5017 4237 This error is returned when a CER message is received, and there 4238 are no common security mechanisms supported between the peers. A 4239 Capabilities-Exchange-Answer (CEA) MUST be returned with the 4240 Result-Code AVP set to DIAMETER_NO_COMMON_SECURITY. 4242 DIAMETER_UNKNOWN_PEER 5018 4244 A CER was received from an unknown peer. 4246 DIAMETER_COMMAND_UNSUPPORTED 5019 4248 The Request contained a Command-Code that the receiver did not 4249 recognize or support. This MUST be used when a Diameter node 4250 receives an experimental command that it does not understand. 4252 DIAMETER_INVALID_HDR_BITS 5020 4254 A request was received whose bits in the Diameter header were 4255 either set to an invalid combination, or to a value that is 4256 inconsistent with the command code's definition. 4258 DIAMETER_INVALID_AVP_BITS 5021 4260 A request was received that included an AVP whose flag bits are 4261 set to an unrecognized value, or that is inconsistent with the 4262 AVP's definition. 4264 7.2. Error Bit 4266 The 'E' (Error Bit) in the Diameter header is set when the request 4267 caused a protocol-related error (see Section 7.1.3). A message with 4268 the 'E' bit MUST NOT be sent as a response to an answer message. 4269 Note that a message with the 'E' bit set is still subjected to the 4270 processing rules defined in Section 6.2. When set, the answer 4271 message will not conform to the ABNF specification for the command, 4272 and will instead conform to the following ABNF: 4274 Message Format 4276 ::= < Diameter Header: code, ERR [PXY] > 4277 0*1< Session-Id > 4278 { Origin-Host } 4279 { Origin-Realm } 4280 { Result-Code } 4281 [ Origin-State-Id ] 4282 [ Error-Message ] 4283 [ Error-Reporting-Host ] 4284 [ Failed-AVP ] 4285 * [ Proxy-Info ] 4286 * [ AVP ] 4288 Note that the code used in the header is the same than the one found 4289 in the request message, but with the 'R' bit cleared and the 'E' bit 4290 set. The 'P' bit in the header is set to the same value as the one 4291 found in the request message. 4293 7.3. Error-Message AVP 4295 The Error-Message AVP (AVP Code 281) is of type UTF8String. It MAY 4296 accompany a Result-Code AVP as a human readable error message. The 4297 Error-Message AVP is not intended to be useful in real-time, and 4298 SHOULD NOT be expected to be parsed by network entities. 4300 7.4. Error-Reporting-Host AVP 4302 The Error-Reporting-Host AVP (AVP Code 294) is of type 4303 DiameterIdentity. This AVP contains the identity of the Diameter 4304 host that sent the Result-Code AVP to a value other than 2001 4305 (Success), only if the host setting the Result-Code is different from 4306 the one encoded in the Origin-Host AVP. This AVP is intended to be 4307 used for troubleshooting purposes, and MUST be set when the Result- 4308 Code AVP indicates a failure. 4310 7.5. Failed-AVP AVP 4312 The Failed-AVP AVP (AVP Code 279) is of type Grouped and provides 4313 debugging information in cases where a request is rejected or not 4314 fully processed due to erroneous information in a specific AVP. The 4315 value of the Result-Code AVP will provide information on the reason 4316 for the Failed-AVP AVP. A Diameter message SHOULD contain only one 4317 Failed-AVP that corresponds to the error indicated by the Result-Code 4318 AVP. For practical purposes, this Failed-AVP would typically refer 4319 to the first AVP processing error that a Diameter node encounters. 4321 The possible reasons for this AVP are the presence of an improperly 4322 constructed AVP, an unsupported or unrecognized AVP, an invalid AVP 4323 value, the omission of a required AVP, the presence of an explicitly 4324 excluded AVP (see tables in Section 10), or the presence of two or 4325 more occurrences of an AVP which is restricted to 0, 1, or 0-1 4326 occurrences. 4328 A Diameter message SHOULD contain one Failed-AVP AVP, containing the 4329 entire AVP that could not be processed successfully. If the failure 4330 reason is omission of a required AVP, an AVP with the missing AVP 4331 code, the missing vendor id, and a zero filled payload of the minimum 4332 required length for the omitted AVP will be added. If the failure 4333 reason is an invalid AVP length where the reported length is less 4334 than the minimum AVP header length or greater than the reported 4335 message length, a copy of the offending AVP header and a zero filled 4336 payload of the minimum required length SHOULD be added. 4338 In the case where the offending AVP is embedded within a grouped AVP, 4339 the Failed-AVP MAY contain the grouped AVP which in turn contains the 4340 single offending AVP. The same method MAY be employed if the grouped 4341 AVP itself is embedded in yet another grouped AVP and so on. In this 4342 case, the Failed-AVP MAY contain the grouped AVP heirarchy up to the 4343 single offending AVP. This enables the recipient to detect the 4344 location of the offending AVP when embedded in a group. 4346 AVP Format 4348 ::= < AVP Header: 279 > 4349 1* {AVP} 4351 7.6. Experimental-Result AVP 4353 The Experimental-Result AVP (AVP Code 297) is of type Grouped, and 4354 indicates whether a particular vendor-specific request was completed 4355 successfully or whether an error occurred. Its Data field has the 4356 following ABNF grammar: 4358 AVP Format 4360 Experimental-Result ::= < AVP Header: 297 > 4361 { Vendor-Id } 4362 { Experimental-Result-Code } 4364 The Vendor-Id AVP (see Section 5.3.3) in this grouped AVP identifies 4365 the vendor responsible for the assignment of the result code which 4366 follows. All Diameter answer messages defined in vendor-specific 4367 applications MUST include either one Result-Code AVP or one 4368 Experimental-Result AVP. 4370 7.7. Experimental-Result-Code AVP 4372 The Experimental-Result-Code AVP (AVP Code 298) is of type Unsigned32 4373 and contains a vendor-assigned value representing the result of 4374 processing the request. 4376 It is recommended that vendor-specific result codes follow the same 4377 conventions given for the Result-Code AVP regarding the different 4378 types of result codes and the handling of errors (for non 2xxx 4379 values). 4381 8. Diameter User Sessions 4383 In general, Diameter can provide two different types of services to 4384 applications. The first involves authentication and authorization, 4385 and can optionally make use of accounting. The second only makes use 4386 of accounting. 4388 When a service makes use of the authentication and/or authorization 4389 portion of an application, and a user requests access to the network, 4390 the Diameter client issues an auth request to its local server. The 4391 auth request is defined in a service specific Diameter application 4392 (e.g., NASREQ). The request contains a Session-Id AVP, which is used 4393 in subsequent messages (e.g., subsequent authorization, accounting, 4394 etc) relating to the user's session. The Session-Id AVP is a means 4395 for the client and servers to correlate a Diameter message with a 4396 user session. 4398 When a Diameter server authorizes a user to use network resources for 4399 a finite amount of time, and it is willing to extend the 4400 authorization via a future request, it MUST add the Authorization- 4401 Lifetime AVP to the answer message. The Authorization-Lifetime AVP 4402 defines the maximum number of seconds a user MAY make use of the 4403 resources before another authorization request is expected by the 4404 server. The Auth-Grace-Period AVP contains the number of seconds 4405 following the expiration of the Authorization-Lifetime, after which 4406 the server will release all state information related to the user's 4407 session. Note that if payment for services is expected by the 4408 serving realm from the user's home realm, the Authorization-Lifetime 4409 AVP, combined with the Auth-Grace-Period AVP, implies the maximum 4410 length of the session the home realm is willing to be fiscally 4411 responsible for. Services provided past the expiration of the 4412 Authorization-Lifetime and Auth-Grace-Period AVPs are the 4413 responsibility of the access device. Of course, the actual cost of 4414 services rendered is clearly outside the scope of the protocol. 4416 An access device that does not expect to send a re-authorization or a 4417 session termination request to the server MAY include the Auth- 4418 Session-State AVP with the value set to NO_STATE_MAINTAINED as a hint 4419 to the server. If the server accepts the hint, it agrees that since 4420 no session termination message will be received once service to the 4421 user is terminated, it cannot maintain state for the session. If the 4422 answer message from the server contains a different value in the 4423 Auth-Session-State AVP (or the default value if the AVP is absent), 4424 the access device MUST follow the server's directives. Note that the 4425 value NO_STATE_MAINTAINED MUST NOT be set in subsequent re- 4426 authorization requests and answers. 4428 The base protocol does not include any authorization request 4429 messages, since these are largely application-specific and are 4430 defined in a Diameter application document. However, the base 4431 protocol does define a set of messages that is used to terminate user 4432 sessions. These are used to allow servers that maintain state 4433 information to free resources. 4435 When a service only makes use of the Accounting portion of the 4436 Diameter protocol, even in combination with an application, the 4437 Session-Id is still used to identify user sessions. However, the 4438 session termination messages are not used, since a session is 4439 signaled as being terminated by issuing an accounting stop message. 4441 Diameter may also be used for services that cannot be easily 4442 categorized as authentication, authorization or accounting (e.g., 4443 certain 3GPP IMS interfaces). In such cases, the finite state 4444 machine defined in subsequent sections may not be applicable. 4445 Therefore, the applications itself MAY need to define its own finite 4446 state machine. However, such application specific state machines 4447 MUST comply with general Diameter user session requirements such co- 4448 relating all message exchanges via Session-Id AVP. 4450 8.1. Authorization Session State Machine 4452 This section contains a set of finite state machines, representing 4453 the life cycle of Diameter sessions, and which MUST be observed by 4454 all Diameter implementations that make use of the authentication 4455 and/or authorization portion of a Diameter application. The term 4456 Service-Specific below refers to a message defined in a Diameter 4457 application (e.g., Mobile IPv4, NASREQ). 4459 There are four different authorization session state machines 4460 supported in the Diameter base protocol. The first two describe a 4461 session in which the server is maintaining session state, indicated 4462 by the value of the Auth-Session-State AVP (or its absence). One 4463 describes the session from a client perspective, the other from a 4464 server perspective. The second two state machines are used when the 4465 server does not maintain session state. Here again, one describes 4466 the session from a client perspective, the other from a server 4467 perspective. 4469 When a session is moved to the Idle state, any resources that were 4470 allocated for the particular session must be released. Any event not 4471 listed in the state machines MUST be considered as an error 4472 condition, and an answer, if applicable, MUST be returned to the 4473 originator of the message. 4475 In the case that an application does not support re-auth, the state 4476 transitions related to server-initiated re-auth when both client and 4477 server sessions maintains state (e.g., Send RAR, Pending, Receive 4478 RAA) MAY be ignored. 4480 In the state table, the event 'Failure to send X' means that the 4481 Diameter agent is unable to send command X to the desired 4482 destination. This could be due to the peer being down, or due to the 4483 peer sending back a transient failure or temporary protocol error 4484 notification DIAMETER_TOO_BUSY or DIAMETER_LOOP_DETECTED in the 4485 Result-Code AVP of the corresponding Answer command. The event 'X 4486 successfully sent' is the complement of 'Failure to send X'. 4488 The following state machine is observed by a client when state is 4489 maintained on the server: 4491 CLIENT, STATEFUL 4492 State Event Action New State 4493 ------------------------------------------------------------- 4494 Idle Client or Device Requests Send Pending 4495 access service 4496 specific 4497 auth req 4499 Idle ASR Received Send ASA Idle 4500 for unknown session with 4501 Result-Code 4502 = UNKNOWN_ 4503 SESSION_ID 4505 Idle RAR Received Send RAA Idle 4506 for unknown session with 4507 Result-Code 4508 = UNKNOWN_ 4509 SESSION_ID 4511 Pending Successful Service-specific Grant Open 4512 authorization answer Access 4513 received with default 4514 Auth-Session-State value 4516 Pending Successful Service-specific Sent STR Discon 4517 authorization answer received 4518 but service not provided 4520 Pending Error processing successful Sent STR Discon 4521 Service-specific authorization 4522 answer 4524 Pending Failed Service-specific Cleanup Idle 4525 authorization answer received 4527 Open User or client device Send Open 4528 requests access to service service 4529 specific 4530 auth req 4532 Open Successful Service-specific Provide Open 4533 authorization answer received Service 4535 Open Failed Service-specific Discon. Idle 4536 authorization answer user/device 4537 received. 4539 Open RAR received and client will Send RAA Open 4540 perform subsequent re-auth with 4541 Result-Code 4542 = SUCCESS 4544 Open RAR received and client will Send RAA Idle 4545 not perform subsequent with 4546 re-auth Result-Code 4547 != SUCCESS, 4548 Discon. 4549 user/device 4551 Open Session-Timeout Expires on Send STR Discon 4552 Access Device 4554 Open ASR Received, Send ASA Discon 4555 client will comply with with 4556 request to end the session Result-Code 4557 = SUCCESS, 4558 Send STR. 4560 Open ASR Received, Send ASA Open 4561 client will not comply with with 4562 request to end the session Result-Code 4563 != SUCCESS 4565 Open Authorization-Lifetime + Send STR Discon 4566 Auth-Grace-Period expires on 4567 access device 4569 Discon ASR Received Send ASA Discon 4571 Discon STA Received Discon. Idle 4572 user/device 4574 The following state machine is observed by a server when it is 4575 maintaining state for the session: 4577 SERVER, STATEFUL 4578 State Event Action New State 4579 ------------------------------------------------------------- 4580 Idle Service-specific authorization Send Open 4581 request received, and successful 4582 user is authorized serv. 4583 specific 4584 answer 4586 Idle Service-specific authorization Send Idle 4587 request received, and failed serv. 4588 user is not authorized specific 4589 answer 4591 Open Service-specific authorization Send Open 4592 request received, and user successful 4593 is authorized serv. specific 4594 answer 4596 Open Service-specific authorization Send Idle 4597 request received, and user failed serv. 4598 is not authorized specific 4599 answer, 4600 Cleanup 4602 Open Home server wants to confirm Send RAR Pending 4603 authentication and/or 4604 authorization of the user 4606 Pending Received RAA with a failed Cleanup Idle 4607 Result-Code 4609 Pending Received RAA with Result-Code Update Open 4610 = SUCCESS session 4612 Open Home server wants to Send ASR Discon 4613 terminate the service 4615 Open Authorization-Lifetime (and Cleanup Idle 4616 Auth-Grace-Period) expires 4617 on home server. 4619 Open Session-Timeout expires on Cleanup Idle 4620 home server 4622 Discon Failure to send ASR Wait, Discon 4623 resend ASR 4625 Discon ASR successfully sent and Cleanup Idle 4626 ASA Received with Result-Code 4628 Not ASA Received None No Change. 4629 Discon 4631 Any STR Received Send STA, Idle 4632 Cleanup. 4634 The following state machine is observed by a client when state is not 4635 maintained on the server: 4637 CLIENT, STATELESS 4638 State Event Action New State 4639 ------------------------------------------------------------- 4640 Idle Client or Device Requests Send Pending 4641 access service 4642 specific 4643 auth req 4645 Pending Successful Service-specific Grant Open 4646 authorization answer Access 4647 received with Auth-Session- 4648 State set to 4649 NO_STATE_MAINTAINED 4651 Pending Failed Service-specific Cleanup Idle 4652 authorization answer 4653 received 4655 Open Session-Timeout Expires on Discon. Idle 4656 Access Device user/device 4658 Open Service to user is terminated Discon. Idle 4659 user/device 4661 The following state machine is observed by a server when it is not 4662 maintaining state for the session: 4664 SERVER, STATELESS 4665 State Event Action New State 4666 ------------------------------------------------------------- 4667 Idle Service-specific authorization Send serv. Idle 4668 request received, and specific 4669 successfully processed answer 4671 8.2. Accounting Session State Machine 4673 The following state machines MUST be supported for applications that 4674 have an accounting portion or that require only accounting services. 4675 The first state machine is to be observed by clients. 4677 See Section 9.7 for Accounting Command Codes and Section 9.8 for 4678 Accounting AVPs. 4680 The server side in the accounting state machine depends in some cases 4681 on the particular application. The Diameter base protocol defines a 4682 default state machine that MUST be followed by all applications that 4683 have not specified other state machines. This is the second state 4684 machine in this section described below. 4686 The default server side state machine requires the reception of 4687 accounting records in any order and at any time, and does not place 4688 any standards requirement on the processing of these records. 4689 Implementations of Diameter MAY perform checking, ordering, 4690 correlation, fraud detection, and other tasks based on these records. 4691 Both base Diameter AVPs as well as application specific AVPs MAY be 4692 inspected as a part of these tasks. The tasks can happen either 4693 immediately after record reception or in a post-processing phase. 4694 However, as these tasks are typically application or even policy 4695 dependent, they are not standardized by the Diameter specifications. 4696 Applications MAY define requirements on when to accept accounting 4697 records based on the used value of Accounting-Realtime-Required AVP, 4698 credit limits checks, and so on. 4700 However, the Diameter base protocol defines one optional server side 4701 state machine that MAY be followed by applications that require 4702 keeping track of the session state at the accounting server. Note 4703 that such tracking is incompatible with the ability to sustain long 4704 duration connectivity problems. Therefore, the use of this state 4705 machine is recommended only in applications where the value of the 4706 Accounting-Realtime-Required AVP is DELIVER_AND_GRANT, and hence 4707 accounting connectivity problems are required to cause the serviced 4708 user to be disconnected. Otherwise, records produced by the client 4709 may be lost by the server which no longer accepts them after the 4710 connectivity is re-established. This state machine is the third 4711 state machine in this section. The state machine is supervised by a 4712 supervision session timer Ts, which the value should be reasonably 4713 higher than the Acct_Interim_Interval value. Ts MAY be set to two 4714 times the value of the Acct_Interim_Interval so as to avoid the 4715 accounting session in the Diameter server to change to Idle state in 4716 case of short transient network failure. 4718 Any event not listed in the state machines MUST be considered as an 4719 error condition, and a corresponding answer, if applicable, MUST be 4720 returned to the originator of the message. 4722 In the state table, the event 'Failure to send' means that the 4723 Diameter client is unable to communicate with the desired 4724 destination. This could be due to the peer being down, or due to the 4725 peer sending back a transient failure or temporary protocol error 4726 notification DIAMETER_OUT_OF_SPACE, DIAMETER_TOO_BUSY, or 4727 DIAMETER_LOOP_DETECTED in the Result-Code AVP of the Accounting 4728 Answer command. 4730 The event 'Failed answer' means that the Diameter client received a 4731 non-transient failure notification in the Accounting Answer command. 4733 Note that the action 'Disconnect user/dev' MUST have an effect also 4734 to the authorization session state table, e.g., cause the STR message 4735 to be sent, if the given application has both authentication/ 4736 authorization and accounting portions. 4738 The states PendingS, PendingI, PendingL, PendingE and PendingB stand 4739 for pending states to wait for an answer to an accounting request 4740 related to a Start, Interim, Stop, Event or buffered record, 4741 respectively. 4743 CLIENT, ACCOUNTING 4744 State Event Action New State 4745 ------------------------------------------------------------- 4746 Idle Client or device requests Send PendingS 4747 access accounting 4748 start req. 4750 Idle Client or device requests Send PendingE 4751 a one-time service accounting 4752 event req 4754 Idle Records in storage Send PendingB 4755 record 4757 PendingS Successful accounting Open 4758 start answer received 4760 PendingS Failure to send and buffer Store Open 4761 space available and realtime Start 4762 not equal to DELIVER_AND_GRANT Record 4764 PendingS Failure to send and no buffer Open 4765 space available and realtime 4766 equal to GRANT_AND_LOSE 4768 PendingS Failure to send and no buffer Disconnect Idle 4769 space available and realtime user/dev 4770 not equal to 4771 GRANT_AND_LOSE 4773 PendingS Failed accounting start answer Open 4774 received and realtime equal 4775 to GRANT_AND_LOSE 4777 PendingS Failed accounting start answer Disconnect Idle 4778 received and realtime not user/dev 4779 equal to GRANT_AND_LOSE 4781 PendingS User service terminated Store PendingS 4782 stop 4783 record 4785 Open Interim interval elapses Send PendingI 4786 accounting 4787 interim 4788 record 4789 Open User service terminated Send PendingL 4790 accounting 4791 stop req. 4793 PendingI Successful accounting interim Open 4794 answer received 4796 PendingI Failure to send and (buffer Store Open 4797 space available or old record interim 4798 can be overwritten) and record 4799 realtime not equal to 4800 DELIVER_AND_GRANT 4802 PendingI Failure to send and no buffer Open 4803 space available and realtime 4804 equal to GRANT_AND_LOSE 4806 PendingI Failure to send and no buffer Disconnect Idle 4807 space available and realtime user/dev 4808 not equal to GRANT_AND_LOSE 4810 PendingI Failed accounting interim Open 4811 answer received and realtime 4812 equal to GRANT_AND_LOSE 4814 PendingI Failed accounting interim Disconnect Idle 4815 answer received and realtime user/dev 4816 not equal to GRANT_AND_LOSE 4818 PendingI User service terminated Store PendingI 4819 stop 4820 record 4821 PendingE Successful accounting Idle 4822 event answer received 4824 PendingE Failure to send and buffer Store Idle 4825 space available event 4826 record 4828 PendingE Failure to send and no buffer Idle 4829 space available 4831 PendingE Failed accounting event answer Idle 4832 received 4834 PendingB Successful accounting answer Delete Idle 4835 received record 4837 PendingB Failure to send Idle 4839 PendingB Failed accounting answer Delete Idle 4840 received record 4842 PendingL Successful accounting Idle 4843 stop answer received 4845 PendingL Failure to send and buffer Store Idle 4846 space available stop 4847 record 4849 PendingL Failure to send and no buffer Idle 4850 space available 4852 PendingL Failed accounting stop answer Idle 4853 received 4855 SERVER, STATELESS ACCOUNTING 4856 State Event Action New State 4857 ------------------------------------------------------------- 4859 Idle Accounting start request Send Idle 4860 received, and successfully accounting 4861 processed. start 4862 answer 4864 Idle Accounting event request Send Idle 4865 received, and successfully accounting 4866 processed. event 4867 answer 4869 Idle Interim record received, Send Idle 4870 and successfully processed. accounting 4871 interim 4872 answer 4874 Idle Accounting stop request Send Idle 4875 received, and successfully accounting 4876 processed stop answer 4878 Idle Accounting request received, Send Idle 4879 no space left to store accounting 4880 records answer, 4881 Result-Code 4882 = OUT_OF_ 4883 SPACE 4885 SERVER, STATEFUL ACCOUNTING 4886 State Event Action New State 4887 ------------------------------------------------------------- 4889 Idle Accounting start request Send Open 4890 received, and successfully accounting 4891 processed. start 4892 answer, 4893 Start Ts 4895 Idle Accounting event request Send Idle 4896 received, and successfully accounting 4897 processed. event 4898 answer 4900 Idle Accounting request received, Send Idle 4901 no space left to store accounting 4902 records answer, 4903 Result-Code 4904 = OUT_OF_ 4905 SPACE 4907 Open Interim record received, Send Open 4908 and successfully processed. accounting 4909 interim 4910 answer, 4911 Restart Ts 4913 Open Accounting stop request Send Idle 4914 received, and successfully accounting 4915 processed stop answer, 4916 Stop Ts 4918 Open Accounting request received, Send Idle 4919 no space left to store accounting 4920 records answer, 4921 Result-Code 4922 = OUT_OF_ 4923 SPACE, 4924 Stop Ts 4926 Open Session supervision timer Ts Stop Ts Idle 4927 expired 4929 8.3. Server-Initiated Re-Auth 4931 A Diameter server may initiate a re-authentication and/or re- 4932 authorization service for a particular session by issuing a Re-Auth- 4933 Request (RAR). 4935 For example, for pre-paid services, the Diameter server that 4936 originally authorized a session may need some confirmation that the 4937 user is still using the services. 4939 An access device that receives a RAR message with Session-Id equal to 4940 a currently active session MUST initiate a re-auth towards the user, 4941 if the service supports this particular feature. Each Diameter 4942 application MUST state whether service-initiated re-auth is 4943 supported, since some applications do not allow access devices to 4944 prompt the user for re-auth. 4946 8.3.1. Re-Auth-Request 4948 The Re-Auth-Request (RAR), indicated by the Command-Code set to 258 4949 and the message flags' 'R' bit set, may be sent by any server to the 4950 access device that is providing session service, to request that the 4951 user be re-authenticated and/or re-authorized. 4953 Message Format 4955 ::= < Diameter Header: 258, REQ, PXY > 4956 < Session-Id > 4957 { Origin-Host } 4958 { Origin-Realm } 4959 { Destination-Realm } 4960 { Destination-Host } 4961 { Auth-Application-Id } 4962 { Re-Auth-Request-Type } 4963 [ User-Name ] 4964 [ Origin-State-Id ] 4965 * [ Proxy-Info ] 4966 * [ Route-Record ] 4967 * [ AVP ] 4969 8.3.2. Re-Auth-Answer 4971 The Re-Auth-Answer (RAA), indicated by the Command-Code set to 258 4972 and the message flags' 'R' bit clear, is sent in response to the RAR. 4973 The Result-Code AVP MUST be present, and indicates the disposition of 4974 the request. 4976 A successful RAA message MUST be followed by an application-specific 4977 authentication and/or authorization message. 4979 Message Format 4981 ::= < Diameter Header: 258, PXY > 4982 < Session-Id > 4983 { Result-Code } 4984 { Origin-Host } 4985 { Origin-Realm } 4986 [ User-Name ] 4987 [ Origin-State-Id ] 4988 [ Error-Message ] 4989 [ Error-Reporting-Host ] 4990 [ Failed-AVP ] 4991 * [ Redirect-Host ] 4992 [ Redirect-Host-Usage ] 4993 [ Redirect-Max-Cache-Time ] 4994 * [ Proxy-Info ] 4995 * [ AVP ] 4997 8.4. Session Termination 4999 It is necessary for a Diameter server that authorized a session, for 5000 which it is maintaining state, to be notified when that session is no 5001 longer active, both for tracking purposes as well as to allow 5002 stateful agents to release any resources that they may have provided 5003 for the user's session. For sessions whose state is not being 5004 maintained, this section is not used. 5006 When a user session that required Diameter authorization terminates, 5007 the access device that provided the service MUST issue a Session- 5008 Termination-Request (STR) message to the Diameter server that 5009 authorized the service, to notify it that the session is no longer 5010 active. An STR MUST be issued when a user session terminates for any 5011 reason, including user logoff, expiration of Session-Timeout, 5012 administrative action, termination upon receipt of an Abort-Session- 5013 Request (see below), orderly shutdown of the access device, etc. 5015 The access device also MUST issue an STR for a session that was 5016 authorized but never actually started. This could occur, for 5017 example, due to a sudden resource shortage in the access device, or 5018 because the access device is unwilling to provide the type of service 5019 requested in the authorization, or because the access device does not 5020 support a mandatory AVP returned in the authorization, etc. 5022 It is also possible that a session that was authorized is never 5023 actually started due to action of a proxy. For example, a proxy may 5024 modify an authorization answer, converting the result from success to 5025 failure, prior to forwarding the message to the access device. If 5026 the answer did not contain an Auth-Session-State AVP with the value 5027 NO_STATE_MAINTAINED, a proxy that causes an authorized session not to 5028 be started MUST issue an STR to the Diameter server that authorized 5029 the session, since the access device has no way of knowing that the 5030 session had been authorized. 5032 A Diameter server that receives an STR message MUST clean up 5033 resources (e.g., session state) associated with the Session-Id 5034 specified in the STR, and return a Session-Termination-Answer. 5036 A Diameter server also MUST clean up resources when the Session- 5037 Timeout expires, or when the Authorization-Lifetime and the Auth- 5038 Grace-Period AVPs expires without receipt of a re-authorization 5039 request, regardless of whether an STR for that session is received. 5040 The access device is not expected to provide service beyond the 5041 expiration of these timers; thus, expiration of either of these 5042 timers implies that the access device may have unexpectedly shut 5043 down. 5045 8.4.1. Session-Termination-Request 5047 The Session-Termination-Request (STR), indicated by the Command-Code 5048 set to 275 and the Command Flags' 'R' bit set, is sent by the access 5049 device to inform the Diameter Server that an authenticated and/or 5050 authorized session is being terminated. 5052 Message Format 5054 ::= < Diameter Header: 275, REQ, PXY > 5055 < Session-Id > 5056 { Origin-Host } 5057 { Origin-Realm } 5058 { Destination-Realm } 5059 { Auth-Application-Id } 5060 { Termination-Cause } 5061 [ User-Name ] 5062 [ Destination-Host ] 5063 * [ Class ] 5064 [ Origin-State-Id ] 5065 * [ Proxy-Info ] 5066 * [ Route-Record ] 5067 * [ AVP ] 5069 8.4.2. Session-Termination-Answer 5071 The Session-Termination-Answer (STA), indicated by the Command-Code 5072 set to 275 and the message flags' 'R' bit clear, is sent by the 5073 Diameter Server to acknowledge the notification that the session has 5074 been terminated. The Result-Code AVP MUST be present, and MAY 5075 contain an indication that an error occurred while servicing the STR. 5077 Upon sending or receipt of the STA, the Diameter Server MUST release 5078 all resources for the session indicated by the Session-Id AVP. Any 5079 intermediate server in the Proxy-Chain MAY also release any 5080 resources, if necessary. 5082 Message Format 5084 ::= < Diameter Header: 275, PXY > 5085 < Session-Id > 5086 { Result-Code } 5087 { Origin-Host } 5088 { Origin-Realm } 5089 [ User-Name ] 5090 * [ Class ] 5091 [ Error-Message ] 5092 [ Error-Reporting-Host ] 5093 [ Failed-AVP ] 5094 [ Origin-State-Id ] 5095 * [ Redirect-Host ] 5096 [ Redirect-Host-Usage ] 5097 [ Redirect-Max-Cache-Time ] 5098 * [ Proxy-Info ] 5099 * [ AVP ] 5101 8.5. Aborting a Session 5103 A Diameter server may request that the access device stop providing 5104 service for a particular session by issuing an Abort-Session-Request 5105 (ASR). 5107 For example, the Diameter server that originally authorized the 5108 session may be required to cause that session to be stopped for 5109 credit or other reasons that were not anticipated when the session 5110 was first authorized. On the other hand, an operator may maintain a 5111 management server for the purpose of issuing ASRs to administratively 5112 remove users from the network. 5114 An access device that receives an ASR with Session-ID equal to a 5115 currently active session MAY stop the session. Whether the access 5116 device stops the session or not is implementation- and/or 5117 configuration-dependent. For example, an access device may honor 5118 ASRs from certain agents only. In any case, the access device MUST 5119 respond with an Abort-Session-Answer, including a Result-Code AVP to 5120 indicate what action it took. 5122 Note that if the access device does stop the session upon receipt of 5123 an ASR, it issues an STR to the authorizing server (which may or may 5124 not be the agent issuing the ASR) just as it would if the session 5125 were terminated for any other reason. 5127 8.5.1. Abort-Session-Request 5129 The Abort-Session-Request (ASR), indicated by the Command-Code set to 5130 274 and the message flags' 'R' bit set, may be sent by any server to 5131 the access device that is providing session service, to request that 5132 the session identified by the Session-Id be stopped. 5134 Message Format 5136 ::= < Diameter Header: 274, REQ, PXY > 5137 < Session-Id > 5138 { Origin-Host } 5139 { Origin-Realm } 5140 { Destination-Realm } 5141 { Destination-Host } 5142 { Auth-Application-Id } 5143 [ User-Name ] 5144 [ Origin-State-Id ] 5145 * [ Proxy-Info ] 5146 * [ Route-Record ] 5147 * [ AVP ] 5149 8.5.2. Abort-Session-Answer 5151 The Abort-Session-Answer (ASA), indicated by the Command-Code set to 5152 274 and the message flags' 'R' bit clear, is sent in response to the 5153 ASR. The Result-Code AVP MUST be present, and indicates the 5154 disposition of the request. 5156 If the session identified by Session-Id in the ASR was successfully 5157 terminated, Result-Code is set to DIAMETER_SUCCESS. If the session 5158 is not currently active, Result-Code is set to 5159 DIAMETER_UNKNOWN_SESSION_ID. If the access device does not stop the 5160 session for any other reason, Result-Code is set to 5161 DIAMETER_UNABLE_TO_COMPLY. 5163 Message Format 5165 ::= < Diameter Header: 274, PXY > 5166 < Session-Id > 5167 { Result-Code } 5168 { Origin-Host } 5169 { Origin-Realm } 5170 [ User-Name ] 5171 [ Origin-State-Id ] 5172 [ Error-Message ] 5173 [ Error-Reporting-Host ] 5174 [ Failed-AVP ] 5175 * [ Redirect-Host ] 5176 [ Redirect-Host-Usage ] 5177 [ Redirect-Max-Cache-Time ] 5178 * [ Proxy-Info ] 5179 * [ AVP ] 5181 8.6. Inferring Session Termination from Origin-State-Id 5183 Origin-State-Id is used to allow rapid detection of terminated 5184 sessions for which no STR would have been issued, due to 5185 unanticipated shutdown of an access device. 5187 By including Origin-State-Id in CER/CEA messages, an access device 5188 allows a next-hop server to determine immediately upon connection 5189 whether the device has lost its sessions since the last connection. 5191 By including Origin-State-Id in request messages, an access device 5192 also allows a server with which it communicates via proxy to make 5193 such a determination. However, a server that is not directly 5194 connected with the access device will not discover that the access 5195 device has been restarted unless and until it receives a new request 5196 from the access device. Thus, use of this mechanism across proxies 5197 is opportunistic rather than reliable, but useful nonetheless. 5199 When a Diameter server receives an Origin-State-Id that is greater 5200 than the Origin-State-Id previously received from the same issuer, it 5201 may assume that the issuer has lost state since the previous message 5202 and that all sessions that were active under the lower Origin-State- 5203 Id have been terminated. The Diameter server MAY clean up all 5204 session state associated with such lost sessions, and MAY also issues 5205 STRs for all such lost sessions that were authorized on upstream 5206 servers, to allow session state to be cleaned up globally. 5208 8.7. Auth-Request-Type AVP 5210 The Auth-Request-Type AVP (AVP Code 274) is of type Enumerated and is 5211 included in application-specific auth requests to inform the peers 5212 whether a user is to be authenticated only, authorized only or both. 5213 Note any value other than both MAY cause RADIUS interoperability 5214 issues. The following values are defined: 5216 AUTHENTICATE_ONLY 1 5218 The request being sent is for authentication only, and MUST 5219 contain the relevant application specific authentication AVPs that 5220 are needed by the Diameter server to authenticate the user. 5222 AUTHORIZE_ONLY 2 5224 The request being sent is for authorization only, and MUST contain 5225 the application specific authorization AVPs that are necessary to 5226 identify the service being requested/offered. 5228 AUTHORIZE_AUTHENTICATE 3 5230 The request contains a request for both authentication and 5231 authorization. The request MUST include both the relevant 5232 application specific authentication information, and authorization 5233 information necessary to identify the service being requested/ 5234 offered. 5236 8.8. Session-Id AVP 5238 The Session-Id AVP (AVP Code 263) is of type UTF8String and is used 5239 to identify a specific session (see Section 8). All messages 5240 pertaining to a specific session MUST include only one Session-Id AVP 5241 and the same value MUST be used throughout the life of a session. 5242 When present, the Session-Id SHOULD appear immediately following the 5243 Diameter Header (see Section 3). 5245 The Session-Id MUST be globally and eternally unique, as it is meant 5246 to uniquely identify a user session without reference to any other 5247 information, and may be needed to correlate historical authentication 5248 information with accounting information. The Session-Id includes a 5249 mandatory portion and an implementation-defined portion; a 5250 recommended format for the implementation-defined portion is outlined 5251 below. 5253 The Session-Id MUST begin with the sender's identity encoded in the 5254 DiameterIdentity type (see Section 4.4). The remainder of the 5255 Session-Id is delimited by a ";" character, and MAY be any sequence 5256 that the client can guarantee to be eternally unique; however, the 5257 following format is recommended, (square brackets [] indicate an 5258 optional element): 5260 ;;[;] 5262 and are decimal representations of the 5263 high and low 32 bits of a monotonically increasing 64-bit value. The 5264 64-bit value is rendered in two part to simplify formatting by 32-bit 5265 processors. At startup, the high 32 bits of the 64-bit value MAY be 5266 initialized to the time in NTP format [RFC4330], and the low 32 bits 5267 MAY be initialized to zero. This will for practical purposes 5268 eliminate the possibility of overlapping Session-Ids after a reboot, 5269 assuming the reboot process takes longer than a second. 5270 Alternatively, an implementation MAY keep track of the increasing 5271 value in non-volatile memory. 5273 is implementation specific but may include a modem's 5274 device Id, a layer 2 address, timestamp, etc. 5276 Example, in which there is no optional value: 5278 accesspoint7.acme.com;1876543210;523 5280 Example, in which there is an optional value: 5282 accesspoint7.acme.com;1876543210;523;mobile@200.1.1.88 5284 The Session-Id is created by the Diameter application initiating the 5285 session, which in most cases is done by the client. Note that a 5286 Session-Id MAY be used for both the authorization and accounting 5287 commands of a given application. 5289 8.9. Authorization-Lifetime AVP 5291 The Authorization-Lifetime AVP (AVP Code 291) is of type Unsigned32 5292 and contains the maximum number of seconds of service to be provided 5293 to the user before the user is to be re-authenticated and/or re- 5294 authorized. Great care should be taken when the Authorization- 5295 Lifetime value is determined, since a low, non-zero, value could 5296 create significant Diameter traffic, which could congest both the 5297 network and the agents. 5299 A value of zero (0) means that immediate re-auth is necessary by the 5300 access device. This is typically used in cases where multiple 5301 authentication methods are used, and a successful auth response with 5302 this AVP set to zero is used to signal that the next authentication 5303 method is to be immediately initiated. The absence of this AVP, or a 5304 value of all ones (meaning all bits in the 32 bit field are set to 5305 one) means no re-auth is expected. 5307 If both this AVP and the Session-Timeout AVP are present in a 5308 message, the value of the latter MUST NOT be smaller than the 5309 Authorization-Lifetime AVP. 5311 An Authorization-Lifetime AVP MAY be present in re-authorization 5312 messages, and contains the number of seconds the user is authorized 5313 to receive service from the time the re-auth answer message is 5314 received by the access device. 5316 This AVP MAY be provided by the client as a hint of the maximum 5317 lifetime that it is willing to accept. However, the server MAY 5318 return a value that is equal to, or smaller, than the one provided by 5319 the client. 5321 8.10. Auth-Grace-Period AVP 5323 The Auth-Grace-Period AVP (AVP Code 276) is of type Unsigned32 and 5324 contains the number of seconds the Diameter server will wait 5325 following the expiration of the Authorization-Lifetime AVP before 5326 cleaning up resources for the session. 5328 8.11. Auth-Session-State AVP 5330 The Auth-Session-State AVP (AVP Code 277) is of type Enumerated and 5331 specifies whether state is maintained for a particular session. The 5332 client MAY include this AVP in requests as a hint to the server, but 5333 the value in the server's answer message is binding. The following 5334 values are supported: 5336 STATE_MAINTAINED 0 5338 This value is used to specify that session state is being 5339 maintained, and the access device MUST issue a session termination 5340 message when service to the user is terminated. This is the 5341 default value. 5343 NO_STATE_MAINTAINED 1 5345 This value is used to specify that no session termination messages 5346 will be sent by the access device upon expiration of the 5347 Authorization-Lifetime. 5349 8.12. Re-Auth-Request-Type AVP 5351 The Re-Auth-Request-Type AVP (AVP Code 285) is of type Enumerated and 5352 is included in application-specific auth answers to inform the client 5353 of the action expected upon expiration of the Authorization-Lifetime. 5354 If the answer message contains an Authorization-Lifetime AVP with a 5355 positive value, the Re-Auth-Request-Type AVP MUST be present in an 5356 answer message. The following values are defined: 5358 AUTHORIZE_ONLY 0 5360 An authorization only re-auth is expected upon expiration of the 5361 Authorization-Lifetime. This is the default value if the AVP is 5362 not present in answer messages that include the Authorization- 5363 Lifetime. 5365 AUTHORIZE_AUTHENTICATE 1 5367 An authentication and authorization re-auth is expected upon 5368 expiration of the Authorization-Lifetime. 5370 8.13. Session-Timeout AVP 5372 The Session-Timeout AVP (AVP Code 27) [RFC2865] is of type Unsigned32 5373 and contains the maximum number of seconds of service to be provided 5374 to the user before termination of the session. When both the 5375 Session-Timeout and the Authorization-Lifetime AVPs are present in an 5376 answer message, the former MUST be equal to or greater than the value 5377 of the latter. 5379 A session that terminates on an access device due to the expiration 5380 of the Session-Timeout MUST cause an STR to be issued, unless both 5381 the access device and the home server had previously agreed that no 5382 session termination messages would be sent (see Section 8.11). 5384 A Session-Timeout AVP MAY be present in a re-authorization answer 5385 message, and contains the remaining number of seconds from the 5386 beginning of the re-auth. 5388 A value of zero, or the absence of this AVP, means that this session 5389 has an unlimited number of seconds before termination. 5391 This AVP MAY be provided by the client as a hint of the maximum 5392 timeout that it is willing to accept. However, the server MAY return 5393 a value that is equal to, or smaller, than the one provided by the 5394 client. 5396 8.14. User-Name AVP 5398 The User-Name AVP (AVP Code 1) [RFC2865] is of type UTF8String, which 5399 contains the User-Name, in a format consistent with the NAI 5400 specification [RFC4282]. 5402 8.15. Termination-Cause AVP 5404 The Termination-Cause AVP (AVP Code 295) is of type Enumerated, and 5405 is used to indicate the reason why a session was terminated on the 5406 access device. The following values are defined: 5408 DIAMETER_LOGOUT 1 5410 The user initiated a disconnect 5412 DIAMETER_SERVICE_NOT_PROVIDED 2 5414 This value is used when the user disconnected prior to the receipt 5415 of the authorization answer message. 5417 DIAMETER_BAD_ANSWER 3 5419 This value indicates that the authorization answer received by the 5420 access device was not processed successfully. 5422 DIAMETER_ADMINISTRATIVE 4 5424 The user was not granted access, or was disconnected, due to 5425 administrative reasons, such as the receipt of a Abort-Session- 5426 Request message. 5428 DIAMETER_LINK_BROKEN 5 5430 The communication to the user was abruptly disconnected. 5432 DIAMETER_AUTH_EXPIRED 6 5434 The user's access was terminated since its authorized session time 5435 has expired. 5437 DIAMETER_USER_MOVED 7 5439 The user is receiving services from another access device. 5441 DIAMETER_SESSION_TIMEOUT 8 5443 The user's session has timed out, and service has been terminated. 5445 8.16. Origin-State-Id AVP 5447 The Origin-State-Id AVP (AVP Code 278), of type Unsigned32, is a 5448 monotonically increasing value that is advanced whenever a Diameter 5449 entity restarts with loss of previous state, for example upon reboot. 5450 Origin-State-Id MAY be included in any Diameter message, including 5451 CER. 5453 A Diameter entity issuing this AVP MUST create a higher value for 5454 this AVP each time its state is reset. A Diameter entity MAY set 5455 Origin-State-Id to the time of startup, or it MAY use an incrementing 5456 counter retained in non-volatile memory across restarts. 5458 The Origin-State-Id, if present, MUST reflect the state of the entity 5459 indicated by Origin-Host. If a proxy modifies Origin-Host, it MUST 5460 either remove Origin-State-Id or modify it appropriately as well. 5461 Typically, Origin-State-Id is used by an access device that always 5462 starts up with no active sessions; that is, any session active prior 5463 to restart will have been lost. By including Origin-State-Id in a 5464 message, it allows other Diameter entities to infer that sessions 5465 associated with a lower Origin-State-Id are no longer active. If an 5466 access device does not intend for such inferences to be made, it MUST 5467 either not include Origin-State-Id in any message, or set its value 5468 to 0. 5470 8.17. Session-Binding AVP 5472 The Session-Binding AVP (AVP Code 270) is of type Unsigned32, and MAY 5473 be present in application-specific authorization answer messages. If 5474 present, this AVP MAY inform the Diameter client that all future 5475 application-specific re-auth messages for this session MUST be sent 5476 to the same authorization server. This AVP MAY also specify that a 5477 Session-Termination-Request message for this session MUST be sent to 5478 the same authorizing server. 5480 This field is a bit mask, and the following bits have been defined: 5482 RE_AUTH 1 5484 When set, future re-auth messages for this session MUST NOT 5485 include the Destination-Host AVP. When cleared, the default 5486 value, the Destination-Host AVP MUST be present in all re-auth 5487 messages for this session. 5489 STR 2 5491 When set, the STR message for this session MUST NOT include the 5492 Destination-Host AVP. When cleared, the default value, the 5493 Destination-Host AVP MUST be present in the STR message for this 5494 session. 5496 ACCOUNTING 4 5498 When set, all accounting messages for this session MUST NOT 5499 include the Destination-Host AVP. When cleared, the default 5500 value, the Destination-Host AVP, if known, MUST be present in all 5501 accounting messages for this session. 5503 8.18. Session-Server-Failover AVP 5505 The Session-Server-Failover AVP (AVP Code 271) is of type Enumerated, 5506 and MAY be present in application-specific authorization answer 5507 messages that either do not include the Session-Binding AVP or 5508 include the Session-Binding AVP with any of the bits set to a zero 5509 value. If present, this AVP MAY inform the Diameter client that if a 5510 re-auth or STR message fails due to a delivery problem, the Diameter 5511 client SHOULD issue a subsequent message without the Destination-Host 5512 AVP. When absent, the default value is REFUSE_SERVICE. 5514 The following values are supported: 5516 REFUSE_SERVICE 0 5518 If either the re-auth or the STR message delivery fails, terminate 5519 service with the user, and do not attempt any subsequent attempts. 5521 TRY_AGAIN 1 5523 If either the re-auth or the STR message delivery fails, resend 5524 the failed message without the Destination-Host AVP present. 5526 ALLOW_SERVICE 2 5528 If re-auth message delivery fails, assume that re-authorization 5529 succeeded. If STR message delivery fails, terminate the session. 5531 TRY_AGAIN_ALLOW_SERVICE 3 5533 If either the re-auth or the STR message delivery fails, resend 5534 the failed message without the Destination-Host AVP present. If 5535 the second delivery fails for re-auth, assume re-authorization 5536 succeeded. If the second delivery fails for STR, terminate the 5537 session. 5539 8.19. Multi-Round-Time-Out AVP 5541 The Multi-Round-Time-Out AVP (AVP Code 272) is of type Unsigned32, 5542 and SHOULD be present in application-specific authorization answer 5543 messages whose Result-Code AVP is set to DIAMETER_MULTI_ROUND_AUTH. 5544 This AVP contains the maximum number of seconds that the access 5545 device MUST provide the user in responding to an authentication 5546 request. 5548 8.20. Class AVP 5550 The Class AVP (AVP Code 25) is of type OctetString and is used to by 5551 Diameter servers to return state information to the access device. 5552 When one or more Class AVPs are present in application-specific 5553 authorization answer messages, they MUST be present in subsequent re- 5554 authorization, session termination and accounting messages. Class 5555 AVPs found in a re-authorization answer message override the ones 5556 found in any previous authorization answer message. Diameter server 5557 implementations SHOULD NOT return Class AVPs that require more than 5558 4096 bytes of storage on the Diameter client. A Diameter client that 5559 receives Class AVPs whose size exceeds local available storage MUST 5560 terminate the session. 5562 8.21. Event-Timestamp AVP 5564 The Event-Timestamp (AVP Code 55) is of type Time, and MAY be 5565 included in an Accounting-Request and Accounting-Answer messages to 5566 record the time that the reported event occurred, in seconds since 5567 January 1, 1900 00:00 UTC. 5569 9. Accounting 5571 This accounting protocol is based on a server directed model with 5572 capabilities for real-time delivery of accounting information. 5573 Several fault resilience methods [RFC2975] have been built in to the 5574 protocol in order minimize loss of accounting data in various fault 5575 situations and under different assumptions about the capabilities of 5576 the used devices. 5578 9.1. Server Directed Model 5580 The server directed model means that the device generating the 5581 accounting data gets information from either the authorization server 5582 (if contacted) or the accounting server regarding the way accounting 5583 data shall be forwarded. This information includes accounting record 5584 timeliness requirements. 5586 As discussed in [RFC2975], real-time transfer of accounting records 5587 is a requirement, such as the need to perform credit limit checks and 5588 fraud detection. Note that batch accounting is not a requirement, 5589 and is therefore not supported by Diameter. Should batched 5590 accounting be required in the future, a new Diameter application will 5591 need to be created, or it could be handled using another protocol. 5592 Note, however, that even if at the Diameter layer accounting requests 5593 are processed one by one, transport protocols used under Diameter 5594 typically batch several requests in the same packet under heavy 5595 traffic conditions. This may be sufficient for many applications. 5597 The authorization server (chain) directs the selection of proper 5598 transfer strategy, based on its knowledge of the user and 5599 relationships of roaming partnerships. The server (or agents) uses 5600 the Acct-Interim-Interval and Accounting-Realtime-Required AVPs to 5601 control the operation of the Diameter peer operating as a client. 5602 The Acct-Interim-Interval AVP, when present, instructs the Diameter 5603 node acting as a client to produce accounting records continuously 5604 even during a session. Accounting-Realtime-Required AVP is used to 5605 control the behavior of the client when the transfer of accounting 5606 records from the Diameter client is delayed or unsuccessful. 5608 The Diameter accounting server MAY override the interim interval or 5609 the realtime requirements by including the Acct-Interim-Interval or 5610 Accounting-Realtime-Required AVP in the Accounting-Answer message. 5611 When one of these AVPs is present, the latest value received SHOULD 5612 be used in further accounting activities for the same session. 5614 9.2. Protocol Messages 5616 A Diameter node that receives a successful authentication and/or 5617 authorization messages from the Home AAA server MUST collect 5618 accounting information for the session. The Accounting-Request 5619 message is used to transmit the accounting information to the Home 5620 AAA server, which MUST reply with the Accounting-Answer message to 5621 confirm reception. The Accounting-Answer message includes the 5622 Result-Code AVP, which MAY indicate that an error was present in the 5623 accounting message. A rejected Accounting-Request message MAY cause 5624 the user's session to be terminated, depending on the value of the 5625 Accounting-Realtime-Required AVP received earlier for the session in 5626 question. 5628 Each Diameter Accounting protocol message MAY be compressed, in order 5629 to reduce network bandwidth usage. If TLS is used to secure the 5630 Diameter session, then TLS compression [RFC4346] MAY be used. 5632 9.3. Accounting Application Extension and Requirements 5634 Each Diameter application (e.g., NASREQ, MobileIP), MUST define their 5635 Service-Specific AVPs that MUST be present in the Accounting-Request 5636 message in a section entitled "Accounting AVPs". The application 5637 MUST assume that the AVPs described in this document will be present 5638 in all Accounting messages, so only their respective service-specific 5639 AVPs need to be defined in this section. 5641 Applications have the option of using one or both of the following 5642 accounting application extension models: 5644 Split Accounting Service 5646 The accounting message will carry the Application Id of the 5647 Diameter base accounting application (see Section 2.4). 5648 Accounting messages maybe routed to Diameter nodes other than the 5649 corresponding Diameter application. These nodes might be 5650 centralized accounting servers that provide accounting service for 5651 multiple different Diameter applications. These nodes MUST 5652 advertise the Diameter base accounting Application Id during 5653 capabilities exchange. 5655 Coupled Accounting Service 5657 The accounting messages will carry the Application Id of the 5658 application that is using it. The application itself will process 5659 the received accounting records or forward them to an accounting 5660 server. There is no accounting application advertisement required 5661 during capabilities exchange and the accounting messages will be 5662 routed the same as any of the other application messages. 5664 In cases where an application does not define its own accounting 5665 service, it is preferred that the split accounting model be used. 5667 9.4. Fault Resilience 5669 Diameter Base protocol mechanisms are used to overcome small message 5670 loss and network faults of temporary nature. 5672 Diameter peers acting as clients MUST implement the use of failover 5673 to guard against server failures and certain network failures. 5674 Diameter peers acting as agents or related off-line processing 5675 systems MUST detect duplicate accounting records caused by the 5676 sending of same record to several servers and duplication of messages 5677 in transit. This detection MUST be based on the inspection of the 5678 Session-Id and Accounting-Record-Number AVP pairs. Appendix C 5679 discusses duplicate detection needs and implementation issues. 5681 Diameter clients MAY have non-volatile memory for the safe storage of 5682 accounting records over reboots or extended network failures, network 5683 partitions, and server failures. If such memory is available, the 5684 client SHOULD store new accounting records there as soon as the 5685 records are created and until a positive acknowledgement of their 5686 reception from the Diameter Server has been received. Upon a reboot, 5687 the client MUST starting sending the records in the non-volatile 5688 memory to the accounting server with appropriate modifications in 5689 termination cause, session length, and other relevant information in 5690 the records. 5692 A further application of this protocol may include AVPs to control 5693 how many accounting records may at most be stored in the Diameter 5694 client without committing them to the non-volatile memory or 5695 transferring them to the Diameter server. 5697 The client SHOULD NOT remove the accounting data from any of its 5698 memory areas before the correct Accounting-Answer has been received. 5699 The client MAY remove oldest, undelivered or yet unacknowledged 5700 accounting data if it runs out of resources such as memory. It is an 5701 implementation dependent matter for the client to accept new sessions 5702 under this condition. 5704 9.5. Accounting Records 5706 In all accounting records, the Session-Id AVP MUST be present; the 5707 User-Name AVP MUST be present if it is available to the Diameter 5708 client. 5710 Different types of accounting records are sent depending on the 5711 actual type of accounted service and the authorization server's 5712 directions for interim accounting. If the accounted service is a 5713 one-time event, meaning that the start and stop of the event are 5714 simultaneous, then the Accounting-Record-Type AVP MUST be present and 5715 set to the value EVENT_RECORD. 5717 If the accounted service is of a measurable length, then the AVP MUST 5718 use the values START_RECORD, STOP_RECORD, and possibly, 5719 INTERIM_RECORD. If the authorization server has not directed interim 5720 accounting to be enabled for the session, two accounting records MUST 5721 be generated for each service of type session. When the initial 5722 Accounting-Request for a given session is sent, the Accounting- 5723 Record-Type AVP MUST be set to the value START_RECORD. When the last 5724 Accounting-Request is sent, the value MUST be STOP_RECORD. 5726 If the authorization server has directed interim accounting to be 5727 enabled, the Diameter client MUST produce additional records between 5728 the START_RECORD and STOP_RECORD, marked INTERIM_RECORD. The 5729 production of these records is directed by Acct-Interim-Interval as 5730 well as any re-authentication or re-authorization of the session. 5731 The Diameter client MUST overwrite any previous interim accounting 5732 records that are locally stored for delivery, if a new record is 5733 being generated for the same session. This ensures that only one 5734 pending interim record can exist on an access device for any given 5735 session. 5737 A particular value of Accounting-Sub-Session-Id MUST appear only in 5738 one sequence of accounting records from a DIAMETER client, except for 5739 the purposes of retransmission. The one sequence that is sent MUST 5740 be either one record with Accounting-Record-Type AVP set to the value 5741 EVENT_RECORD, or several records starting with one having the value 5742 START_RECORD, followed by zero or more INTERIM_RECORD and a single 5743 STOP_RECORD. A particular Diameter application specification MUST 5744 define the type of sequences that MUST be used. 5746 9.6. Correlation of Accounting Records 5748 The Diameter protocol's Session-Id AVP, which is globally unique (see 5749 Section 8.8), is used during the authorization phase to identify a 5750 particular session. Services that do not require any authorization 5751 still use the Session-Id AVP to identify sessions. Accounting 5752 messages MAY use a different Session-Id from that sent in 5753 authorization messages. Specific applications MAY require different 5754 a Session-ID for accounting messages. 5756 However, there are certain applications that require multiple 5757 accounting sub-sessions. Such applications would send messages with 5758 a constant Session-Id AVP, but a different Accounting-Sub-Session-Id 5759 AVP. In these cases, correlation is performed using the Session-Id. 5760 It is important to note that receiving a STOP_RECORD with no 5761 Accounting-Sub-Session-Id AVP when sub-sessions were originally used 5762 in the START_RECORD messages implies that all sub-sessions are 5763 terminated. 5765 Furthermore, there are certain applications where a user receives 5766 service from different access devices (e.g., Mobile IPv4), each with 5767 their own unique Session-Id. In such cases, the Acct-Multi-Session- 5768 Id AVP is used for correlation. During authorization, a server that 5769 determines that a request is for an existing session SHOULD include 5770 the Acct-Multi-Session-Id AVP, which the access device MUST include 5771 in all subsequent accounting messages. 5773 The Acct-Multi-Session-Id AVP MAY include the value of the original 5774 Session-Id. It's contents are implementation specific, but MUST be 5775 globally unique across other Acct-Multi-Session-Id, and MUST NOT 5776 change during the life of a session. 5778 A Diameter application document MUST define the exact concept of a 5779 session that is being accounted, and MAY define the concept of a 5780 multi-session. For instance, the NASREQ DIAMETER application treats 5781 a single PPP connection to a Network Access Server as one session, 5782 and a set of Multilink PPP sessions as one multi-session. 5784 9.7. Accounting Command-Codes 5786 This section defines Command-Code values that MUST be supported by 5787 all Diameter implementations that provide Accounting services. 5789 9.7.1. Accounting-Request 5791 The Accounting-Request (ACR) command, indicated by the Command-Code 5792 field set to 271 and the Command Flags' 'R' bit set, is sent by a 5793 Diameter node, acting as a client, in order to exchange accounting 5794 information with a peer. 5796 One of Acct-Application-Id and Vendor-Specific-Application-Id AVPs 5797 MUST be present. If the Vendor-Specific-Application-Id grouped AVP 5798 is present, it MUST include an Acct-Application-Id AVP. 5800 The AVP listed below SHOULD include service specific accounting AVPs, 5801 as described in Section 9.3. 5803 Message Format 5805 ::= < Diameter Header: 271, REQ, PXY > 5806 < Session-Id > 5807 { Origin-Host } 5808 { Origin-Realm } 5809 { Destination-Realm } 5810 { Accounting-Record-Type } 5811 { Accounting-Record-Number } 5812 [ Acct-Application-Id ] 5813 [ Vendor-Specific-Application-Id ] 5814 [ User-Name ] 5815 [ Destination-Host ] 5816 [ Accounting-Sub-Session-Id ] 5817 [ Acct-Session-Id ] 5818 [ Acct-Multi-Session-Id ] 5819 [ Acct-Interim-Interval ] 5820 [ Accounting-Realtime-Required ] 5821 [ Origin-State-Id ] 5822 [ Event-Timestamp ] 5823 * [ Proxy-Info ] 5824 * [ Route-Record ] 5825 * [ AVP ] 5827 9.7.2. Accounting-Answer 5829 The Accounting-Answer (ACA) command, indicated by the Command-Code 5830 field set to 271 and the Command Flags' 'R' bit cleared, is used to 5831 acknowledge an Accounting-Request command. The Accounting-Answer 5832 command contains the same Session-Id as the corresponding request. 5834 Only the target Diameter Server, known as the home Diameter Server, 5835 SHOULD respond with the Accounting-Answer command. 5837 One of Acct-Application-Id and Vendor-Specific-Application-Id AVPs 5838 MUST be present. If the Vendor-Specific-Application-Id grouped AVP 5839 is present, it MUST contain an Acct-Application-Id AVP. 5841 The AVP listed below SHOULD include service specific accounting AVPs, 5842 as described in Section 9.3. 5844 Message Format 5846 ::= < Diameter Header: 271, PXY > 5847 < Session-Id > 5848 { Result-Code } 5849 { Origin-Host } 5850 { Origin-Realm } 5851 { Accounting-Record-Type } 5852 { Accounting-Record-Number } 5853 [ Acct-Application-Id ] 5854 [ Vendor-Specific-Application-Id ] 5855 [ User-Name ] 5856 [ Accounting-Sub-Session-Id ] 5857 [ Acct-Session-Id ] 5858 [ Acct-Multi-Session-Id ] 5859 [ Error-Message ] 5860 [ Error-Reporting-Host ] 5861 [ Failed-AVP ] 5862 [ Acct-Interim-Interval ] 5863 [ Accounting-Realtime-Required ] 5864 [ Origin-State-Id ] 5865 [ Event-Timestamp ] 5866 * [ Proxy-Info ] 5867 * [ AVP ] 5869 9.8. Accounting AVPs 5871 This section contains AVPs that describe accounting usage information 5872 related to a specific session. 5874 9.8.1. Accounting-Record-Type AVP 5876 The Accounting-Record-Type AVP (AVP Code 480) is of type Enumerated 5877 and contains the type of accounting record being sent. The following 5878 values are currently defined for the Accounting-Record-Type AVP: 5880 EVENT_RECORD 1 5882 An Accounting Event Record is used to indicate that a one-time 5883 event has occurred (meaning that the start and end of the event 5884 are simultaneous). This record contains all information relevant 5885 to the service, and is the only record of the service. 5887 START_RECORD 2 5889 An Accounting Start, Interim, and Stop Records are used to 5890 indicate that a service of a measurable length has been given. An 5891 Accounting Start Record is used to initiate an accounting session, 5892 and contains accounting information that is relevant to the 5893 initiation of the session. 5895 INTERIM_RECORD 3 5897 An Interim Accounting Record contains cumulative accounting 5898 information for an existing accounting session. Interim 5899 Accounting Records SHOULD be sent every time a re-authentication 5900 or re-authorization occurs. Further, additional interim record 5901 triggers MAY be defined by application-specific Diameter 5902 applications. The selection of whether to use INTERIM_RECORD 5903 records is done by the Acct-Interim-Interval AVP. 5905 STOP_RECORD 4 5907 An Accounting Stop Record is sent to terminate an accounting 5908 session and contains cumulative accounting information relevant to 5909 the existing session. 5911 9.8.2. Acct-Interim-Interval AVP 5913 The Acct-Interim-Interval AVP (AVP Code 85) is of type Unsigned32 and 5914 is sent from the Diameter home authorization server to the Diameter 5915 client. The client uses information in this AVP to decide how and 5916 when to produce accounting records. With different values in this 5917 AVP, service sessions can result in one, two, or two+N accounting 5918 records, based on the needs of the home-organization. The following 5919 accounting record production behavior is directed by the inclusion of 5920 this AVP: 5922 1. The omission of the Acct-Interim-Interval AVP or its inclusion 5923 with Value field set to 0 means that EVENT_RECORD, START_RECORD, 5924 and STOP_RECORD are produced, as appropriate for the service. 5926 2. The inclusion of the AVP with Value field set to a non-zero value 5927 means that INTERIM_RECORD records MUST be produced between the 5928 START_RECORD and STOP_RECORD records. The Value field of this 5929 AVP is the nominal interval between these records in seconds. 5931 The Diameter node that originates the accounting information, 5932 known as the client, MUST produce the first INTERIM_RECORD record 5933 roughly at the time when this nominal interval has elapsed from 5934 the START_RECORD, the next one again as the interval has elapsed 5935 once more, and so on until the session ends and a STOP_RECORD 5936 record is produced. 5938 The client MUST ensure that the interim record production times 5939 are randomized so that large accounting message storms are not 5940 created either among records or around a common service start 5941 time. 5943 9.8.3. Accounting-Record-Number AVP 5945 The Accounting-Record-Number AVP (AVP Code 485) is of type Unsigned32 5946 and identifies this record within one session. As Session-Id AVPs 5947 are globally unique, the combination of Session-Id and Accounting- 5948 Record-Number AVPs is also globally unique, and can be used in 5949 matching accounting records with confirmations. An easy way to 5950 produce unique numbers is to set the value to 0 for records of type 5951 EVENT_RECORD and START_RECORD, and set the value to 1 for the first 5952 INTERIM_RECORD, 2 for the second, and so on until the value for 5953 STOP_RECORD is one more than for the last INTERIM_RECORD. 5955 9.8.4. Acct-Session-Id AVP 5957 The Acct-Session-Id AVP (AVP Code 44) is of type OctetString is only 5958 used when RADIUS/Diameter translation occurs. This AVP contains the 5959 contents of the RADIUS Acct-Session-Id attribute. 5961 9.8.5. Acct-Multi-Session-Id AVP 5963 The Acct-Multi-Session-Id AVP (AVP Code 50) is of type UTF8String, 5964 following the format specified in Section 8.8. The Acct-Multi- 5965 Session-Id AVP is used to link together multiple related accounting 5966 sessions, where each session would have a unique Session-Id, but the 5967 same Acct-Multi-Session-Id AVP. This AVP MAY be returned by the 5968 Diameter server in an authorization answer, and MUST be used in all 5969 accounting messages for the given session. 5971 9.8.6. Accounting-Sub-Session-Id AVP 5973 The Accounting-Sub-Session-Id AVP (AVP Code 287) is of type 5974 Unsigned64 and contains the accounting sub-session identifier. The 5975 combination of the Session-Id and this AVP MUST be unique per sub- 5976 session, and the value of this AVP MUST be monotonically increased by 5977 one for all new sub-sessions. The absence of this AVP implies no 5978 sub-sessions are in use, with the exception of an Accounting-Request 5979 whose Accounting-Record-Type is set to STOP_RECORD. A STOP_RECORD 5980 message with no Accounting-Sub-Session-Id AVP present will signal the 5981 termination of all sub-sessions for a given Session-Id. 5983 9.8.7. Accounting-Realtime-Required AVP 5985 The Accounting-Realtime-Required AVP (AVP Code 483) is of type 5986 Enumerated and is sent from the Diameter home authorization server to 5987 the Diameter client or in the Accounting-Answer from the accounting 5988 server. The client uses information in this AVP to decide what to do 5989 if the sending of accounting records to the accounting server has 5990 been temporarily prevented due to, for instance, a network problem. 5992 DELIVER_AND_GRANT 1 5994 The AVP with Value field set to DELIVER_AND_GRANT means that the 5995 service MUST only be granted as long as there is a connection to 5996 an accounting server. Note that the set of alternative accounting 5997 servers are treated as one server in this sense. Having to move 5998 the accounting record stream to a backup server is not a reason to 5999 discontinue the service to the user. 6001 GRANT_AND_STORE 2 6003 The AVP with Value field set to GRANT_AND_STORE means that service 6004 SHOULD be granted if there is a connection, or as long as records 6005 can still be stored as described in Section 9.4. 6007 This is the default behavior if the AVP isn't included in the 6008 reply from the authorization server. 6010 GRANT_AND_LOSE 3 6012 The AVP with Value field set to GRANT_AND_LOSE means that service 6013 SHOULD be granted even if the records can not be delivered or 6014 stored. 6016 10. AVP Occurrence Table 6018 The following tables presents the AVPs defined in this document, and 6019 specifies in which Diameter messages they MAY be present or not. 6020 AVPs that occur only inside a Grouped AVP are not shown in this 6021 table. 6023 The table uses the following symbols: 6025 0 The AVP MUST NOT be present in the message. 6027 0+ Zero or more instances of the AVP MAY be present in the 6028 message. 6030 0-1 Zero or one instance of the AVP MAY be present in the message. 6031 It is considered an error if there are more than one instance of 6032 the AVP. 6034 1 One instance of the AVP MUST be present in the message. 6036 1+ At least one instance of the AVP MUST be present in the 6037 message. 6039 10.1. Base Protocol Command AVP Table 6041 The table in this section is limited to the non-accounting Command 6042 Codes defined in this specification. 6044 +-----------------------------------------------+ 6045 | Command-Code | 6046 +---+---+---+---+---+---+---+---+---+---+---+---+ 6047 Attribute Name |CER|CEA|DPR|DPA|DWR|DWA|RAR|RAA|ASR|ASA|STR|STA| 6048 --------------------+---+---+---+---+---+---+---+---+---+---+---+---+ 6049 Acct-Interim- |0 |0 |0 |0 |0 |0 |0-1|0 |0 |0 |0 |0 | 6050 Interval | | | | | | | | | | | | | 6051 Accounting-Realtime-|0 |0 |0 |0 |0 |0 |0-1|0 |0 |0 |0 |0 | 6052 Required | | | | | | | | | | | | | 6053 Acct-Application-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6054 Auth-Application-Id |0+ |0+ |0 |0 |0 |0 |1 |0 |1 |0 |1 |0 | 6055 Auth-Grace-Period |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6056 Auth-Request-Type |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6057 Auth-Session-State |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6058 Authorization- |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6059 Lifetime | | | | | | | | | | | | | 6060 Class |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0+ |0+ | 6061 Destination-Host |0 |0 |0 |0 |0 |0 |1 |0 |1 |0 |0-1|0 | 6062 Destination-Realm |0 |0 |0 |0 |0 |0 |1 |0 |1 |0 |1 |0 | 6063 Disconnect-Cause |0 |0 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6064 Error-Message |0 |0-1|0 |0-1|0 |0-1|0 |0-1|0 |0-1|0 |0-1| 6065 Error-Reporting-Host|0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6066 Failed-AVP |0 |0+ |0 |0+ |0 |0+ |0 |0+ |0 |0+ |0 |0+ | 6067 Firmware-Revision |0-1|0-1|0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6068 Host-IP-Address |1+ |1+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6069 Inband-Security-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6070 Multi-Round-Time-Out|0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6071 Origin-Host |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 | 6072 Origin-Realm |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 | 6073 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| 6074 Product-Name |1 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6075 Proxy-Info |0 |0 |0 |0 |0 |0 |0+ |0+ |0+ |0+ |0+ |0+ | 6076 Redirect-Host |0 |0 |0 |0 |0 |0 |0 |0+ |0 |0+ |0 |0+ | 6077 Redirect-Host-Usage |0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6078 Redirect-Max-Cache- |0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6079 Time | | | | | | | | | | | | | 6080 Result-Code |0 |1 |0 |1 |0 |1 |0 |1 |0 |1 |0 |1 | 6081 Re-Auth-Request-Type|0 |0 |0 |0 |0 |0 |1 |0 |0 |0 |0 |0 | 6082 Route-Record |0 |0 |0 |0 |0 |0 |0+ |0 |0+ |0 |0+ |0 | 6083 Session-Binding |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6084 Session-Id |0 |0 |0 |0 |0 |0 |1 |1 |1 |1 |1 |1 | 6085 Session-Server- |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6086 Failover | | | | | | | | | | | | | 6087 Session-Timeout |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6088 Supported-Vendor-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6089 Termination-Cause |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |1 |0 | 6090 User-Name |0 |0 |0 |0 |0 |0 |0-1|0-1|0-1|0-1|0-1|0-1| 6091 Vendor-Id |1 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6092 Vendor-Specific- |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6093 Application-Id | | | | | | | | | | | | | 6094 --------------------+---+---+---+---+---+---+---+---+---+---+---+---+ 6096 10.2. Accounting AVP Table 6098 The table in this section is used to represent which AVPs defined in 6099 this document are to be present in the Accounting messages. These 6100 AVP occurrence requirements are guidelines, which may be expanded, 6101 and/or overridden by application-specific requirements in the 6102 Diameter applications documents. 6104 +-----------+ 6105 | Command | 6106 | Code | 6107 +-----+-----+ 6108 Attribute Name | ACR | ACA | 6109 ------------------------------+-----+-----+ 6110 Acct-Interim-Interval | 0-1 | 0-1 | 6111 Acct-Multi-Session-Id | 0-1 | 0-1 | 6112 Accounting-Record-Number | 1 | 1 | 6113 Accounting-Record-Type | 1 | 1 | 6114 Acct-Session-Id | 0-1 | 0-1 | 6115 Accounting-Sub-Session-Id | 0-1 | 0-1 | 6116 Accounting-Realtime-Required | 0-1 | 0-1 | 6117 Acct-Application-Id | 0-1 | 0-1 | 6118 Auth-Application-Id | 0 | 0 | 6119 Class | 0+ | 0+ | 6120 Destination-Host | 0-1 | 0 | 6121 Destination-Realm | 1 | 0 | 6122 Error-Reporting-Host | 0 | 0+ | 6123 Event-Timestamp | 0-1 | 0-1 | 6124 Origin-Host | 1 | 1 | 6125 Origin-Realm | 1 | 1 | 6126 Proxy-Info | 0+ | 0+ | 6127 Route-Record | 0+ | 0 | 6128 Result-Code | 0 | 1 | 6129 Session-Id | 1 | 1 | 6130 Termination-Cause | 0 | 0 | 6131 User-Name | 0-1 | 0-1 | 6132 Vendor-Specific-Application-Id| 0-1 | 0-1 | 6133 ------------------------------+-----+-----+ 6135 11. IANA Considerations 6137 This section provides guidance to the Internet Assigned Numbers 6138 Authority (IANA) regarding registration of values related to the 6139 Diameter protocol, in accordance with BCP 26 [RFC2434]. The 6140 following policies are used here with the meanings defined in BCP 26: 6141 "Private Use", "First Come First Served", "Expert Review", 6142 "Specification Required", "IETF Consensus", "Standards Action". 6144 This section explains the criteria to be used by the IANA for 6145 assignment of numbers within namespaces defined within this document. 6147 Diameter is not intended as a general purpose protocol, and 6148 allocations SHOULD NOT be made for purposes unrelated to 6149 authentication, authorization or accounting. 6151 For registration requests where a Designated Expert should be 6152 consulted, the responsible IESG area director should appoint the 6153 Designated Expert. For Designated Expert with Specification 6154 Required, the request is posted to the DIME WG mailing list (or, if 6155 it has been disbanded, a successor designated by the Area Director) 6156 for comment and review, and MUST include a pointer to a public 6157 specification. Before a period of 30 days has passed, the Designated 6158 Expert will either approve or deny the registration request and 6159 publish a notice of the decision to the DIME WG mailing list or its 6160 successor. A denial notice MUST be justified by an explanation and, 6161 in the cases where it is possible, concrete suggestions on how the 6162 request can be modified so as to become acceptable. 6164 11.1. AVP Header 6166 As defined in Section 4, the AVP header contains three fields that 6167 requires IANA namespace management; the AVP Code, Vendor-ID and Flags 6168 field. 6170 11.1.1. AVP Codes 6172 The AVP Code namespace is used to identify attributes. There are 6173 multiple namespaces. Vendors can have their own AVP Codes namespace 6174 which will be identified by their Vendor-ID (also known as 6175 Enterprise-Number) and they control the assignments of their vendor- 6176 specific AVP codes within their own namespace. The absence of a 6177 Vendor-ID or a Vendor-ID value of zero (0) identifies the IETF IANA 6178 controlled AVP Codes namespace. The AVP Codes and sometimes also 6179 possible values in an AVP are controlled and maintained by IANA. 6181 AVP Code 0 is not used. AVP Codes 1-255 are managed separately as 6182 RADIUS Attribute Types [RADTYPE]. This document defines the AVP 6183 Codes 257-274, 276-285, 287, 291-300, 480, 483 and 485-486. See 6184 Section 4.5 for the assignment of the namespace in this 6185 specification. 6187 AVPs may be allocated following Designated Expert with Specification 6188 Required [RFC2434]. Release of blocks of AVPs (more than 3 at a time 6189 for a given purpose) should require IETF Consensus. 6191 Note that Diameter defines a mechanism for Vendor-Specific AVPs, 6192 where the Vendor-Id field in the AVP header is set to a non-zero 6193 value. Vendor-Specific AVPs codes are for Private Use and should be 6194 encouraged instead of allocation of global attribute types, for 6195 functions specific only to one vendor's implementation of Diameter, 6196 where no interoperability is deemed useful. Where a Vendor-Specific 6197 AVP is implemented by more than one vendor, allocation of global AVPs 6198 should be encouraged instead. 6200 11.1.2. AVP Flags 6202 There are 8 bits in the AVP Flags field of the AVP header, defined in 6203 Section 4. This document assigns bit 0 ('V'endor Specific), bit 1 6204 ('M'andatory) and bit 2 ('P'rotected). The remaining bits should 6205 only be assigned via a Standards Action [RFC2434]. 6207 11.2. Diameter Header 6209 As defined in Section 3, the Diameter header contains two fields that 6210 require IANA namespace management; Command Code and Command Flags. 6212 11.2.1. Command Codes 6214 The Command Code namespace is used to identify Diameter commands. 6215 The values 0-255 (0x00-0xff) are reserved for RADIUS backward 6216 compatibility, and are defined as "RADIUS Packet Type Codes" in 6217 [RADTYPE]. Values 256 - 8,388,607 (0x100 to 0x7fffff) are for 6218 permanent, standard commands, allocated by IETF Consensus [RFC2434]. 6219 This document defines the Command Codes 257, 258, 271, 274-275, 280 6220 and 282. See Section 3.1 for the assignment of the namespace in this 6221 specification. 6223 The values 8,388,608 - 16,777,213 (0x800000 - 0xfffffd) are reserved 6224 for vendor-specific command codes, to be allocated on a First Come, 6225 First Served basis by IANA [RFC2434]. The request to IANA for a 6226 Vendor-Specific Command Code SHOULD include a reference to a publicly 6227 available specification which documents the command in sufficient 6228 detail to aid in interoperability between independent 6229 implementations. If the specification cannot be made publicly 6230 available, the request for a vendor-specific command code MUST 6231 include the contact information of persons and/or entities 6232 responsible for authoring and maintaining the command. 6234 The values 16,777,214 and 16,777,215 (hexadecimal values 0xfffffe - 6235 0xffffff) are reserved for experimental commands. As these codes are 6236 only for experimental and testing purposes, no guarantee is made for 6237 interoperability between Diameter peers using experimental commands, 6238 as outlined in [IANA-EXP]. 6240 11.2.2. Command Flags 6242 There are eight bits in the Command Flags field of the Diameter 6243 header. This document assigns bit 0 ('R'equest), bit 1 ('P'roxy), 6244 bit 2 ('E'rror) and bit 3 ('T'). Bits 4 through 7 MUST only be 6245 assigned via a Standards Action [RFC2434]. 6247 11.3. Application Identifiers 6249 As defined in Section 2.4, the Application Id is used to identify a 6250 specific Diameter Application. There are standards-track Application 6251 Ids and vendor specific Application Ids. 6253 IANA [RFC2434] has assigned the range 0x00000001 to 0x00ffffff for 6254 standards-track applications; and 0x01000000 - 0xfffffffe for vendor 6255 specific applications, on a first-come, first-served basis. The 6256 following values are allocated. 6258 Diameter Common Messages 0 6259 NASREQ 1 [RFC4005] 6260 Mobile-IP 2 [RFC4004] 6261 Diameter Base Accounting 3 6262 Relay 0xffffffff 6264 Assignment of standards-track Application Ids are by Designated 6265 Expert with Specification Required [RFC2434]. 6267 Both Auth-Application-Id and Acct-Application-Id AVPs use the same 6268 Application Id space. A diameter node advertising itself as a relay 6269 agent MUST set either Application-Id or Acct-Application-Id to 6270 0xffffffff. 6272 Vendor-Specific Application Ids, are for Private Use. Vendor-Specific 6273 Application Ids are assigned on a First Come, First Served basis by 6274 IANA. 6276 11.4. AVP Values 6278 Certain AVPs in Diameter define a list of values with various 6279 meanings. For attributes other than those specified in this section, 6280 adding additional values to the list can be done on a First Come, 6281 First Served basis by IANA. 6283 11.4.1. Result-Code AVP Values 6285 As defined in Section 7.1, the Result-Code AVP (AVP Code 268) defines 6286 the values 1001, 2001-2002, 3001-3012, 4001-4003 and 5001-5021. 6288 All remaining values are available for assignment via IETF Consensus 6289 [RFC2434]. 6291 11.4.2. Accounting-Record-Type AVP Values 6293 As defined in Section 9.8.1, the Accounting-Record-Type AVP (AVP Code 6294 480) defines the values 1-4. All remaining values are available for 6295 assignment via IETF Consensus [RFC2434]. 6297 11.4.3. Termination-Cause AVP Values 6299 As defined in Section 8.15, the Termination-Cause AVP (AVP Code 295) 6300 defines the values 1-8. All remaining values are available for 6301 assignment via IETF Consensus [RFC2434]. 6303 11.4.4. Redirect-Host-Usage AVP Values 6305 As defined in Section 6.13, the Redirect-Host-Usage AVP (AVP Code 6306 261) defines the values 0-5. All remaining values are available for 6307 assignment via IETF Consensus [RFC2434]. 6309 11.4.5. Session-Server-Failover AVP Values 6311 As defined in Section 8.18, the Session-Server-Failover AVP (AVP Code 6312 271) defines the values 0-3. All remaining values are available for 6313 assignment via IETF Consensus [RFC2434]. 6315 11.4.6. Session-Binding AVP Values 6317 As defined in Section 8.17, the Session-Binding AVP (AVP Code 270) 6318 defines the bits 1-4. All remaining bits are available for 6319 assignment via IETF Consensus [RFC2434]. 6321 11.4.7. Disconnect-Cause AVP Values 6323 As defined in Section 5.4.3, the Disconnect-Cause AVP (AVP Code 273) 6324 defines the values 0-2. All remaining values are available for 6325 assignment via IETF Consensus [RFC2434]. 6327 11.4.8. Auth-Request-Type AVP Values 6329 As defined in Section 8.7, the Auth-Request-Type AVP (AVP Code 274) 6330 defines the values 1-3. All remaining values are available for 6331 assignment via IETF Consensus [RFC2434]. 6333 11.4.9. Auth-Session-State AVP Values 6335 As defined in Section 8.11, the Auth-Session-State AVP (AVP Code 277) 6336 defines the values 0-1. All remaining values are available for 6337 assignment via IETF Consensus [RFC2434]. 6339 11.4.10. Re-Auth-Request-Type AVP Values 6341 As defined in Section 8.12, the Re-Auth-Request-Type AVP (AVP Code 6342 285) defines the values 0-1. All remaining values are available for 6343 assignment via IETF Consensus [RFC2434]. 6345 11.4.11. Accounting-Realtime-Required AVP Values 6347 As defined in Section 9.8.7, the Accounting-Realtime-Required AVP 6348 (AVP Code 483) defines the values 1-3. All remaining values are 6349 available for assignment via IETF Consensus [RFC2434]. 6351 11.4.12. Inband-Security-Id AVP (code 299) 6353 As defined in Section 6.10, the Inband-Security-Id AVP (AVP Code 299) 6354 defines the values 0-1. All remaining values are available for 6355 assignment via IETF Consensus [RFC2434]. 6357 11.5. Diameter TCP/SCTP Port Numbers 6359 The IANA has assigned TCP and SCTP port number 3868 to Diameter. 6361 11.6. NAPTR Service Fields 6363 The registration in the RFC MUST include the following information: 6365 Service Field: The service field being registered. An example for a 6366 new fictitious transport protocol called NCTP might be "AAA+D2N". 6368 Protocol: The specific transport protocol associated with that 6369 service field. This MUST include the name and acronym for the 6370 protocol, along with reference to a document that describes the 6371 transport protocol. For example - "New Connectionless Transport 6372 Protocol (NCTP), RFC XYZ". 6374 Name and Contact Information: The name, address, email address and 6375 telephone number for the person performing the registration. 6377 The following values have been placed into the registry: 6379 Services Field Protocol 6381 AAA+D2T TCP 6382 AAA+D2S SCTP 6384 12. Diameter protocol related configurable parameters 6386 This section contains the configurable parameters that are found 6387 throughout this document: 6389 Diameter Peer 6391 A Diameter entity MAY communicate with peers that are statically 6392 configured. A statically configured Diameter peer would require 6393 that either the IP address or the fully qualified domain name 6394 (FQDN) be supplied, which would then be used to resolve through 6395 DNS. 6397 Routing Table 6399 A Diameter proxy server routes messages based on the realm portion 6400 of a Network Access Identifier (NAI). The server MUST have a 6401 table of Realm Names, and the address of the peer to which the 6402 message must be forwarded to. The routing table MAY also include 6403 a "default route", which is typically used for all messages that 6404 cannot be locally processed. 6406 Tc timer 6408 The Tc timer controls the frequency that transport connection 6409 attempts are done to a peer with whom no active transport 6410 connection exists. The recommended value is 30 seconds. 6412 13. Security Considerations 6414 The Diameter base protocol messages SHOULD be secured by using TLS 6415 [RFC4346]. Additional security measures that are transparent to and 6416 independent of Diameter, such as IPSec [RFC4301], can also be 6417 deployed to secure connections between peers. 6419 During deployment, connections between Diameter nodes SHOULD be 6420 protected by TLS. All Diameter base protocol implementations MUST 6421 support the use of TLS. The Diameter protocol MUST NOT be used 6422 without any security mechanism. 6424 If a Diameter connection is to be protected via TLS, then the CER/CEA 6425 exchange MUST include an Inband-Security-ID AVP with a value of TLS. 6426 For TLS usage, a TLS handshake will begin when both ends are in the 6427 open state, after completion of the CER/CEA exchange. If the TLS 6428 handshake is successful, all further messages will be sent via TLS. 6429 If the handshake fails, both ends move to the closed state. See 6430 Sections 13.1 for more details. 6432 13.1. TLS Usage 6434 A Diameter node that initiates a connection to another Diameter node 6435 acts as a TLS client according to [RFC4346], and a Diameter node that 6436 accepts a connection acts as a TLS server. Diameter nodes 6437 implementing TLS for security MUST mutually authenticate as part of 6438 TLS session establishment. In order to ensure mutual authentication, 6439 the Diameter node acting as TLS server MUST request a certificate 6440 from the Diameter node acting as TLS client, and the Diameter node 6441 acting as TLS client MUST be prepared to supply a certificate on 6442 request. 6444 Diameter nodes MUST be able to negotiate the following TLS cipher 6445 suites: 6447 TLS_RSA_WITH_RC4_128_MD5 6448 TLS_RSA_WITH_RC4_128_SHA 6449 TLS_RSA_WITH_3DES_EDE_CBC_SHA 6451 Diameter nodes SHOULD be able to negotiate the following TLS cipher 6452 suite: 6454 TLS_RSA_WITH_AES_128_CBC_SHA 6456 Diameter nodes MAY negotiate other TLS cipher suites. 6458 Upon receiving the peers certificate, Diameter nodes SHOULD further 6459 validate the identity of the peer by matching the received Origin- 6460 Host and/or Origin-Realm in the CER and CEA exchange against the 6461 content of the peers certificate. Diameter peer hostname and/or 6462 realm validation can be performed in the following order: 6464 o If one ore more 'Subject Alternate Name (subjectAltName)' 6465 extension of type dNSName is present in the certificate (See 6466 [RFC3280]), then the Origin-Host value can be used to find a 6467 matching extension. 6469 o If there are no matches found, then the Origin-Realm value can be 6470 used to find a matching subjectAltName extension. 6472 o Otherwise, the Origin-Host value should be found within the 6473 'Common Name (CN)' field in the Subject field of the certificate 6474 (See [RFC3280]). 6476 Identity validation MAY be omitted by a Diameter node if the 6477 information contained in the certificate cannot be co-related or 6478 mapped to the Origin-Host and Origin-Realm presented by a peer. 6479 However, the Diameter node SHOULD have external information or other 6480 means to validate the identity of a peer. 6482 13.2. Peer-to-Peer Considerations 6484 As with any peer-to-peer protocol, proper configuration of the trust 6485 model within a Diameter peer is essential to security. When 6486 certificates are used, it is necessary to configure the root 6487 certificate authorities trusted by the Diameter peer. These root CAs 6488 are likely to be unique to Diameter usage and distinct from the root 6489 CAs that might be trusted for other purposes such as Web browsing. 6490 In general, it is expected that those root CAs will be configured so 6491 as to reflect the business relationships between the organization 6492 hosting the Diameter peer and other organizations. As a result, a 6493 Diameter peer will typically not be configured to allow connectivity 6494 with any arbitrary peer. With certificate authentication, Diameter 6495 peers may not be known beforehand and therefore peer discovery may be 6496 required. 6498 14. References 6500 14.1. Normative References 6502 [FLOATPOINT] 6503 Institute of Electrical and Electronics Engineers, "IEEE 6504 Standard for Binary Floating-Point Arithmetic, ANSI/IEEE 6505 Standard 754-1985", August 1985. 6507 [IANAADFAM] 6508 IANA,, "Address Family Numbers", 6509 http://www.iana.org/assignments/address-family-numbers. 6511 [RADTYPE] IANA,, "RADIUS Types", 6512 http://www.iana.org/assignments/radius-types. 6514 [RFC791] Postel, J., "Internet Protocol", RFC 791, September 1981. 6516 [RFC793] Postel, J., "Transmission Control Protocol", RFC 793, 6517 January 1981. 6519 [RFC3539] Aboba, B. and J. Wood, "Authentication, Authorization and 6520 Accounting (AAA) Transport Profile", RFC 3539, June 2003. 6522 [RFC4004] Calhoun, P., Johansson, T., Perkins, C., Hiller, T., and 6523 P. McCann, "Diameter Mobile IPv4 Application", RFC 4004, 6524 August 2005. 6526 [RFC4005] Calhoun, P., Zorn, G., Spence, D., and D. Mitton, 6527 "Diameter Network Access Server Application", RFC 4005, 6528 August 2005. 6530 [RFC4006] Hakala, H., Mattila, L., Koskinen, J-P., Stura, M., and J. 6531 Loughney, "Diameter Credit-Control Application", RFC 4006, 6532 August 2005. 6534 [RFC4072] Eronen, P., Hiller, T., and G. Zorn, "Diameter Extensible 6535 Authentication Protocol (EAP) Application", RFC 4072, 6536 August 2005. 6538 [RFC4740] Garcia-Martin, M., Belinchon, M., Pallares-Lopez, M., 6539 Canales-Valenzuela, C., and K. Tammi, "Diameter Session 6540 Initiation Protocol (SIP) Application", RFC 4740, 6541 November 2006. 6543 [RFC4234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 6544 Specifications: ABNF", RFC 4234, October 2005. 6546 [RFC3588] Calhoun, P., Loughney, J., Guttman, E., Zorn, G., and J. 6547 Arkko, "Diameter Base Protocol", RFC 3588, September 2003. 6549 [RFC3748] Aboba, B., Blunk, L., Vollbrecht, J., Carlson, J., and H. 6550 Levkowetz, "Extensible Authentication Protocol (EAP)", 6551 RFC 3748, June 2004. 6553 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an 6554 IANA Considerations Section in RFCs", BCP 26, RFC 2434, 6555 October 1998. 6557 [RFC4306] Kaufman, C., "Internet Key Exchange (IKEv2) Protocol", 6558 RFC 4306, December 2005. 6560 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing 6561 Architecture", RFC 4291, February 2006. 6563 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6564 Requirement Levels", BCP 14, RFC 2119, March 1997. 6566 [RFC4282] Aboba, B., Beadles, M., Arkko, J., and P. Eronen, "The 6567 Network Access Identifier", RFC 4282, December 2005. 6569 [RFC3403] Mealling, M., "Dynamic Delegation Discovery System (DDDS) 6570 Part Three: The Domain Name System (DNS) Database", 6571 RFC 3403, October 2002. 6573 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 6574 A., Peterson, J., Sparks, R., Handley, M., and E. 6575 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 6576 June 2002. 6578 [RFC2960] Stewart, R., Xie, Q., Morneault, K., Sharp, C., 6579 Schwarzbauer, H., Taylor, T., Rytina, I., Kalla, M., 6580 Zhang, L., and V. Paxson, "Stream Control Transmission 6581 Protocol", RFC 2960, October 2000. 6583 [RFC4346] Dierks, T. and E. Rescorla, "The Transport Layer Security 6584 (TLS) Protocol Version 1.1", RFC 4346, April 2006. 6586 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 6587 Resource Identifier (URI): Generic Syntax", STD 66, 6588 RFC 3986, January 2005. 6590 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 6591 10646", STD 63, RFC 3629, November 2003. 6593 [RFC3280] Housley, R., Polk, W., Ford, W., and D. Solo, "Internet 6594 X.509 Public Key Infrastructure Certificate and 6595 Certificate Revocation List (CRL) Profile", RFC 3280, 6596 April 2002. 6598 [RFC3490] Faltstrom, P., Hoffman, P., and A. Costello, 6599 "Internationalizing Domain Names in Applications (IDNA)", 6600 RFC 3490, March 2003. 6602 [RFC3491] Hoffman, P. and M. Blanchet, "Nameprep: A Stringprep 6603 Profile for Internationalized Domain Names (IDN)", 6604 RFC 3491, March 2003. 6606 [RFC3492] Costello, A., "Punycode: A Bootstring encoding of Unicode 6607 for Internationalized Domain Names in Applications 6608 (IDNA)", RFC 3492, March 2003. 6610 14.2. Informational References 6612 [RFC2989] Aboba, B., Calhoun, P., Glass, S., Hiller, T., McCann, P., 6613 Shiino, H., Zorn, G., Dommety, G., C.Perkins, B.Patil, 6614 D.Mitton, S.Manning, M.Beadles, P.Walsh, X.Chen, 6615 S.Sivalingham, A.Hameed, M.Munson, S.Jacobs, B.Lim, 6616 B.Hirschman, R.Hsu, Y.Xu, E.Campell, S.Baba, and E.Jaques, 6617 "Criteria for Evaluating AAA Protocols for Network 6618 Access", RFC 2989, November 2000. 6620 [RFC2975] Aboba, B., Arkko, J., and D. Harrington, "Introduction to 6621 Accounting Management", RFC 2975, October 2000. 6623 [RFC3232] Reynolds, J., "Assigned Numbers: RFC 1700 is Replaced by 6624 an On-line Database", RFC 3232, January 2002. 6626 [RFC3576] Chiba, M., Dommety, G., Eklund, M., Mitton, D., and B. 6627 Aboba, "Dynamic Authorization Extensions to Remote 6628 Authentication Dial In User Service (RADIUS)", RFC 3576, 6629 July 2003. 6631 [RFC1661] Simpson, W., "The Point-to-Point Protocol (PPP)", STD 51, 6632 RFC 1661, July 1994. 6634 [RFC2866] Rigney, C., "RADIUS Accounting", RFC 2866, June 2000. 6636 [RFC2869] Rigney, C., Willats, W., and P. Calhoun, "RADIUS 6637 Extensions", RFC 2869, June 2000. 6639 [RFC2865] Rigney, C., Willens, S., Rubens, A., and W. Simpson, 6640 "Remote Authentication Dial In User Service (RADIUS)", 6641 RFC 2865, June 2000. 6643 [RFC3162] Aboba, B., Zorn, G., and D. Mitton, "RADIUS and IPv6", 6644 RFC 3162, August 2001. 6646 [RFC4301] Kent, S. and K. Seo, "Security Architecture for the 6647 Internet Protocol", RFC 4301, December 2005. 6649 [RFC4330] Mills, D., "Simple Network Time Protocol (SNTP) Version 4 6650 for IPv4, IPv6 and OSI", RFC 4330, January 2006. 6652 [RFC1492] Finseth, C., "An Access Control Protocol, Sometimes Called 6653 TACACS", RFC 1492, July 1993. 6655 [RFC4690] Klensin, J., Faltstrom, P., Karp, C., and IAB, "Review and 6656 Recommendations for Internationalized Domain Names 6657 (IDNs)", RFC 4690, September 2006. 6659 [IANA-EXP] 6660 Narten, T., "Assigning Experimental and Testing Numbers 6661 Considered Useful, Work in Progress.". 6663 Appendix A. Acknowledgements 6665 The authors would like to thank the following people that have 6666 provided proposals and contributions to this document: 6668 To Vishnu Ram and Satendra Gera for their contributions on 6669 Capabilities Updates, Predictive Loop Avoidance as well as many other 6670 technical proposals. To Tolga Asveren for his insights and 6671 contributions on almost all of the proposed solutions incorporated 6672 into this document. To Timothy Smith for helping on the Capabilities 6673 Updates and other topics. To Tony Zhang for providing fixes to loop 6674 holes on composing Failed-AVPs as well as many other issues and 6675 topics. To Jan Nordqvist for clearly stating the usage of 6676 Application Ids. To Anders Kristensen for providing needed technical 6677 opinions. To David Frascone for providing invaluable review of the 6678 document. To Mark Jones for providing clarifying text on vendor 6679 command codes and other vendor specific indicators. 6681 Special thanks also to people who have provided invaluable comments 6682 and inputs especially in resolving controversial issues: 6684 Glen Zorn, Yoshihiro Ohba, Marco Stura, and Pasi Eronen. 6686 Finally, we would like to thank the original authors of this 6687 document: 6689 Pat Calhoun, John Loughney, Jari Arkko, Erik Guttman and Glen Zorn. 6691 Their invaluable knowledge and experience has given us a robust and 6692 flexible AAA protocol that many people have seen great value in 6693 adopting. We greatly appreciate their support and stewardship for 6694 the continued improvements of Diameter as a protocol. We would also 6695 like to extend our gratitude to folks aside from the authors who have 6696 assisted and contributed to the original version of this document. 6697 Their efforts significantly contributed to the success of Diameter. 6699 Appendix B. NAPTR Example 6701 As an example, consider a client that wishes to resolve aaa:ex.com. 6702 The client performs a NAPTR query for that domain, and the following 6703 NAPTR records are returned: 6705 ;; order pref flags service regexp replacement 6706 IN NAPTR 50 50 "s" "AAA+D2S" "" 6707 _diameter._sctp.example.com IN NAPTR 100 50 "s" "AAA+D2T" 6708 "" _aaa._tcp.example.com 6710 This indicates that the server supports SCTP, and TCP, in that order. 6711 If the client supports over SCTP, SCTP will be used, targeted to a 6712 host determined by an SRV lookup of _diameter._sctp.ex.com. That 6713 lookup would return: 6715 ;; Priority Weight Port Target 6716 IN SRV 0 1 5060 server1.example.com IN SRV 0 6717 2 5060 server2.example.com 6719 Appendix C. Duplicate Detection 6721 As described in Section 9.4, accounting record duplicate detection is 6722 based on session identifiers. Duplicates can appear for various 6723 reasons: 6725 o Failover to an alternate server. Where close to real-time 6726 performance is required, failover thresholds need to be kept low 6727 and this may lead to an increased likelihood of duplicates. 6728 Failover can occur at the client or within Diameter agents. 6730 o Failure of a client or agent after sending of a record from non- 6731 volatile memory, but prior to receipt of an application layer ACK 6732 and deletion of the record. record to be sent. This will result 6733 in retransmission of the record soon after the client or agent has 6734 rebooted. 6736 o Duplicates received from RADIUS gateways. Since the 6737 retransmission behavior of RADIUS is not defined within [RFC2865], 6738 the likelihood of duplication will vary according to the 6739 implementation. 6741 o Implementation problems and misconfiguration. 6743 The T flag is used as an indication of an application layer 6744 retransmission event, e.g., due to failover to an alternate server. 6745 It is defined only for request messages sent by Diameter clients or 6746 agents. For instance, after a reboot, a client may not know whether 6747 it has already tried to send the accounting records in its non- 6748 volatile memory before the reboot occurred. Diameter servers MAY use 6749 the T flag as an aid when processing requests and detecting duplicate 6750 messages. However, servers that do this MUST ensure that duplicates 6751 are found even when the first transmitted request arrives at the 6752 server after the retransmitted request. It can be used only in cases 6753 where no answer has been received from the Server for a request and 6754 the request is sent again, (e.g., due to a failover to an alternate 6755 peer, due to a recovered primary peer or due to a client re-sending a 6756 stored record from non-volatile memory such as after reboot of a 6757 client or agent). 6759 In some cases the Diameter accounting server can delay the duplicate 6760 detection and accounting record processing until a post-processing 6761 phase takes place. At that time records are likely to be sorted 6762 according to the included User-Name and duplicate elimination is easy 6763 in this case. In other situations it may be necessary to perform 6764 real-time duplicate detection, such as when credit limits are imposed 6765 or real-time fraud detection is desired. 6767 In general, only generation of duplicates due to failover or re- 6768 sending of records in non-volatile storage can be reliably detected 6769 by Diameter clients or agents. In such cases the Diameter client or 6770 agents can mark the message as possible duplicate by setting the T 6771 flag. Since the Diameter server is responsible for duplicate 6772 detection, it can choose to make use of the T flag or not, in order 6773 to optimize duplicate detection. Since the T flag does not affect 6774 interoperability, and may not be needed by some servers, generation 6775 of the T flag is REQUIRED for Diameter clients and agents, but MAY be 6776 implemented by Diameter servers. 6778 As an example, it can be usually be assumed that duplicates appear 6779 within a time window of longest recorded network partition or device 6780 fault, perhaps a day. So only records within this time window need 6781 to be looked at in the backward direction. Secondly, hashing 6782 techniques or other schemes, such as the use of the T flag in the 6783 received messages, may be used to eliminate the need to do a full 6784 search even in this set except for rare cases. 6786 The following is an example of how the T flag may be used by the 6787 server to detect duplicate requests. 6789 A Diameter server MAY check the T flag of the received message to 6790 determine if the record is a possible duplicate. If the T flag is 6791 set in the request message, the server searches for a duplicate 6792 within a configurable duplication time window backward and 6793 forward. This limits database searching to those records where 6794 the T flag is set. In a well run network, network partitions and 6795 device faults will presumably be rare events, so this approach 6796 represents a substantial optimization of the duplicate detection 6797 process. During failover, it is possible for the original record 6798 to be received after the T flag marked record, due to differences 6799 in network delays experienced along the path by the original and 6800 duplicate transmissions. The likelihood of this occurring 6801 increases as the failover interval is decreased. In order to be 6802 able to detect out of order duplicates, the Diameter server should 6803 use backward and forward time windows when performing duplicate 6804 checking for the T flag marked request. For example, in order to 6805 allow time for the original record to exit the network and be 6806 recorded by the accounting server, the Diameter server can delay 6807 processing records with the T flag set until a time period 6808 TIME_WAIT + RECORD_PROCESSING_TIME has elapsed after the closing 6809 of the original transport connection. After this time period has 6810 expired, then it may check the T flag marked records against the 6811 database with relative assurance that the original records, if 6812 sent, have been received and recorded. 6814 Appendix D. Internationalized Domain Names 6816 To be compatible with the existing DNS infrastructure and simplify 6817 host and domain name comparison, Diameter identities (FQDNs) are 6818 represented in ASCII form. This allows the Diameter protocol to fall 6819 in-line with the DNS strategy of being transparent from the effects 6820 of Internationalized Domain Names (IDNs) by following the 6821 recommnedations in [RFC4690] and [RFC3490]. Applications that 6822 provide support for IDNs outside of the Diameter protocol but 6823 interacting with it SHOULD use the representation and conversion 6824 framework described in [RFC3490], [RFC3491] and [RFC3492]. 6826 Authors' Addresses 6828 Victor Fajardo (editor) 6829 Toshiba America Research 6830 One Telcordia Drive, 1S-222 6831 Piscataway, NJ 08854 6832 USA 6834 Phone: 1 908-421-1845 6835 Email: vfajardo@tari.toshiba.com 6837 Jari Arkko 6838 Ericsson Research 6839 02420 Jorvas 6840 Finland 6842 Phone: +358 40 5079256 6843 Email: jari.arkko@ericsson.com 6845 John Loughney 6846 Nokia Research Center 6847 955 Page Mill Road 6848 Palo Alto, CA 94304 6849 US 6851 Phone: 1-650-283-8068 6852 Email: john.loughney@nokia.com 6854 Glenn Zorn 6855 NetCube 6856 1310 East Thomas Street, #306 6857 Seattle, WA 98102 6858 US 6860 Phone: 6861 Email: glenzorn@comcast.net 6863 Full Copyright Statement 6865 Copyright (C) The IETF Trust (2008). 6867 This document is subject to the rights, licenses and restrictions 6868 contained in BCP 78, and except as set forth therein, the authors 6869 retain all their rights. 6871 This document and the information contained herein are provided on an 6872 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 6873 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND 6874 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS 6875 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF 6876 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 6877 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 6879 Intellectual Property 6881 The IETF takes no position regarding the validity or scope of any 6882 Intellectual Property Rights or other rights that might be claimed to 6883 pertain to the implementation or use of the technology described in 6884 this document or the extent to which any license under such rights 6885 might or might not be available; nor does it represent that it has 6886 made any independent effort to identify any such rights. Information 6887 on the procedures with respect to rights in RFC documents can be 6888 found in BCP 78 and BCP 79. 6890 Copies of IPR disclosures made to the IETF Secretariat and any 6891 assurances of licenses to be made available, or the result of an 6892 attempt made to obtain a general license or permission for the use of 6893 such proprietary rights by implementers or users of this 6894 specification can be obtained from the IETF on-line IPR repository at 6895 http://www.ietf.org/ipr. 6897 The IETF invites any interested party to bring to its attention any 6898 copyrights, patents or patent applications, or other proprietary 6899 rights that may cover technology that may be required to implement 6900 this standard. Please address the information to the IETF at 6901 ietf-ipr@ietf.org. 6903 Acknowledgment 6905 Funding for the RFC Editor function is provided by the IETF 6906 Administrative Support Activity (IASA).