idnits 2.17.1 draft-ietf-dime-rfc3588bis-04.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 18. -- Found old boilerplate from RFC 3978, Section 5.5, updated by RFC 4748 on line 6798. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 6809. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 6816. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 6822. 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 4542 has weird spacing: '...ly with wit...' == Line 4750 has weird spacing: '...ealtime user...' == Line 4778 has weird spacing: '... record inter...' == Line 4788 has weird spacing: '...ealtime user...' == Line 4796 has weird spacing: '...ealtime user...' == (1 more instance...) -- The exact meaning of the all-uppercase expression 'MAY NOT' is not defined in RFC 2119. If it is intended as a requirements expression, it should be rewritten using one of the combinations defined in RFC 2119; otherwise it should not be all-uppercase. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: The receiver of the Capabilities-Exchange-Request (CER) MUST determine common applications by computing the intersection of its own set of supported application identifiers against all of the application indentifier AVPs (Auth-Application-Id, Acct-Application-Id and Vendor-Specific-Application-Id) present in the CER. The value of the Vendor-Id AVP in the Vendor-Specific-Application-Id MUST not be used during computation. The sender of the Capabilities-Exchange-Answer (CEA) SHOULD include all of its supported applications as a hint to the receiver regarding all of its application capabilities. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: The Destination-Realm AVP MUST be present if the message is proxiable. Request messages that may be forwarded by Diameter agents (proxies, redirects or relays) MUST also contain an Acct-Application-Id AVP, an Auth-Application-Id AVP or a Vendor-Specific-Application-Id AVP. A message that MUST NOT be forwarded by Diameter agents (proxies, redirects or relays) MUST not include the Destination-Realm in its ABNF. The value of the Destination-Realm AVP MAY be extracted from the User-Name AVP, or other application-specific methods. == The expression 'MAY NOT', while looking like RFC 2119 requirements text, is not defined in RFC 2119, and should not be used. Consider using 'MUST NOT' instead (if that is what you mean). Found 'MAY NOT' in this paragraph: The following tables presents the AVPs defined in this document, and specifies in which Diameter messages they MAY, or MAY NOT be present. Note that AVPs that can only be present within a Grouped AVP are not represented in this table. -- 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 (June 5, 2007) is 6163 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 4267, 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 (ref. 'TCP') (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 2234 (Obsoleted by RFC 4234) ** Downref: Normative reference to an Informational RFC: RFC 3232 ** Obsolete normative reference: RFC 3588 (Obsoleted by RFC 6733) ** Obsolete normative reference: RFC 2284 (Obsoleted by RFC 3748) ** Obsolete normative reference: RFC 2434 (Obsoleted by RFC 5226) ** Obsolete normative reference: RFC 2409 (Obsoleted by RFC 4306) ** Obsolete normative reference: RFC 2373 (Obsoleted by RFC 3513) ** Obsolete normative reference: RFC 4282 (Obsoleted by RFC 7542) ** Obsolete normative reference: RFC 2915 (Obsoleted by RFC 3401, RFC 3402, RFC 3403, RFC 3404) ** Obsolete normative reference: RFC 2960 (Obsoleted by RFC 4960) ** Obsolete normative reference: RFC 2030 (Obsoleted by RFC 4330) ** Obsolete normative reference: RFC 2246 (Obsoleted by RFC 4346) ** Obsolete normative reference: RFC 2396 (Obsoleted by RFC 3986) ** Obsolete normative reference: RFC 2279 (Obsoleted by RFC 3629) -- Obsolete informational reference (is this intentional?): RFC 3576 (Obsoleted by RFC 5176) -- Obsolete informational reference (is this intentional?): RFC 2401 (Obsoleted by RFC 4301) Summary: 18 errors (**), 0 flaws (~~), 13 warnings (==), 13 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: December 7, 2007 Ericsson Research 6 J. Loughney 7 Nokia Research Center 8 June 5, 2007 10 Diameter Base Protocol 11 draft-ietf-dime-rfc3588bis-04.txt 13 Status of this Memo 15 By submitting this Internet-Draft, each author represents that any 16 applicable patent or other IPR claims of which he or she is aware 17 have been or will be disclosed, and any of which he or she becomes 18 aware will be disclosed, in accordance with Section 6 of BCP 79. 20 Internet-Drafts are working documents of the Internet Engineering 21 Task Force (IETF), its areas, and its working groups. Note that 22 other groups may also distribute working documents as Internet- 23 Drafts. 25 Internet-Drafts are draft documents valid for a maximum of six months 26 and may be updated, replaced, or obsoleted by other documents at any 27 time. It is inappropriate to use Internet-Drafts as reference 28 material or to cite them other than as "work in progress." 30 The list of current Internet-Drafts can be accessed at 31 http://www.ietf.org/ietf/1id-abstracts.txt. 33 The list of Internet-Draft Shadow Directories can be accessed at 34 http://www.ietf.org/shadow.html. 36 This Internet-Draft will expire on December 7, 2007. 38 Copyright Notice 40 Copyright (C) The IETF Trust (2007). 42 Abstract 44 The Diameter base protocol is intended to provide an Authentication, 45 Authorization and Accounting (AAA) framework for applications such as 46 network access or IP mobility. Diameter is also intended to work in 47 both local Authentication, Authorization & Accounting and roaming 48 situations. This document specifies the message format, transport, 49 error reporting, accounting and security services to be used by all 50 Diameter applications. The Diameter base application needs to be 51 supported by all Diameter implementations. 53 Table of Contents 55 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 7 56 1.1. Diameter Protocol . . . . . . . . . . . . . . . . . . . . 10 57 1.1.1. Description of the Document Set . . . . . . . . . . 11 58 1.1.2. Conventions Used in This Document . . . . . . . . . 12 59 1.2. Approach to Extensibility . . . . . . . . . . . . . . . . 12 60 1.2.1. Defining New AVP Values . . . . . . . . . . . . . . 13 61 1.2.2. Creating New AVPs . . . . . . . . . . . . . . . . . 13 62 1.2.3. Creating New Authentication Applications . . . . . . 13 63 1.2.4. Creating New Accounting Applications . . . . . . . . 14 64 1.2.5. Application Authentication Procedures . . . . . . . 15 65 1.3. Terminology . . . . . . . . . . . . . . . . . . . . . . . 15 66 2. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 22 67 2.1. Transport . . . . . . . . . . . . . . . . . . . . . . . . 23 68 2.1.1. SCTP Guidelines . . . . . . . . . . . . . . . . . . 24 69 2.2. Securing Diameter Messages . . . . . . . . . . . . . . . 24 70 2.3. Diameter Application Compliance . . . . . . . . . . . . . 24 71 2.4. Application Identifiers . . . . . . . . . . . . . . . . . 24 72 2.5. Connections vs. Sessions . . . . . . . . . . . . . . . . 25 73 2.6. Peer Table . . . . . . . . . . . . . . . . . . . . . . . 26 74 2.7. Routing Table . . . . . . . . . . . . . . . . . . . . . . 27 75 2.8. Role of Diameter Agents . . . . . . . . . . . . . . . . . 28 76 2.8.1. Relay Agents . . . . . . . . . . . . . . . . . . . . 30 77 2.8.2. Proxy Agents . . . . . . . . . . . . . . . . . . . . 31 78 2.8.3. Redirect Agents . . . . . . . . . . . . . . . . . . 31 79 2.8.4. Translation Agents . . . . . . . . . . . . . . . . . 32 80 2.9. Diameter Path Authorization . . . . . . . . . . . . . . . 33 81 3. Diameter Header . . . . . . . . . . . . . . . . . . . . . . . 35 82 3.1. Command Codes . . . . . . . . . . . . . . . . . . . . . . 38 83 3.2. Command Code ABNF specification . . . . . . . . . . . . . 38 84 3.3. Diameter Command Naming Conventions . . . . . . . . . . . 40 85 4. Diameter AVPs . . . . . . . . . . . . . . . . . . . . . . . . 42 86 4.1. AVP Header . . . . . . . . . . . . . . . . . . . . . . . 42 87 4.1.1. Optional Header Elements . . . . . . . . . . . . . . 44 88 4.2. Basic AVP Data Formats . . . . . . . . . . . . . . . . . 44 89 4.3. Derived AVP Data Formats . . . . . . . . . . . . . . . . 46 90 4.4. Grouped AVP Values . . . . . . . . . . . . . . . . . . . 53 91 4.4.1. Example AVP with a Grouped Data type . . . . . . . . 54 92 4.5. Diameter Base Protocol AVPs . . . . . . . . . . . . . . . 56 93 5. Diameter Peers . . . . . . . . . . . . . . . . . . . . . . . 60 94 5.1. Peer Connections . . . . . . . . . . . . . . . . . . . . 60 95 5.2. Diameter Peer Discovery . . . . . . . . . . . . . . . . . 60 96 5.3. Capabilities Exchange . . . . . . . . . . . . . . . . . . 63 97 5.3.1. Capabilities-Exchange-Request . . . . . . . . . . . 64 98 5.3.2. Capabilities-Exchange-Answer . . . . . . . . . . . . 65 99 5.3.3. Vendor-Id AVP . . . . . . . . . . . . . . . . . . . 65 100 5.3.4. Firmware-Revision AVP . . . . . . . . . . . . . . . 66 101 5.3.5. Host-IP-Address AVP . . . . . . . . . . . . . . . . 66 102 5.3.6. Supported-Vendor-Id AVP . . . . . . . . . . . . . . 66 103 5.3.7. Product-Name AVP . . . . . . . . . . . . . . . . . . 66 104 5.4. Disconnecting Peer connections . . . . . . . . . . . . . 66 105 5.4.1. Disconnect-Peer-Request . . . . . . . . . . . . . . 67 106 5.4.2. Disconnect-Peer-Answer . . . . . . . . . . . . . . . 67 107 5.4.3. Disconnect-Cause AVP . . . . . . . . . . . . . . . . 68 108 5.5. Transport Failure Detection . . . . . . . . . . . . . . . 68 109 5.5.1. Device-Watchdog-Request . . . . . . . . . . . . . . 68 110 5.5.2. Device-Watchdog-Answer . . . . . . . . . . . . . . . 69 111 5.5.3. Transport Failure Algorithm . . . . . . . . . . . . 69 112 5.5.4. Failover and Failback Procedures . . . . . . . . . . 69 113 5.6. Peer State Machine . . . . . . . . . . . . . . . . . . . 70 114 5.6.1. Incoming connections . . . . . . . . . . . . . . . . 72 115 5.6.2. Events . . . . . . . . . . . . . . . . . . . . . . . 73 116 5.6.3. Actions . . . . . . . . . . . . . . . . . . . . . . 74 117 5.6.4. The Election Process . . . . . . . . . . . . . . . . 76 118 5.6.5. Capabilities Update . . . . . . . . . . . . . . . . 76 119 6. Diameter message processing . . . . . . . . . . . . . . . . . 77 120 6.1. Diameter Request Routing Overview . . . . . . . . . . . . 77 121 6.1.1. Originating a Request . . . . . . . . . . . . . . . 78 122 6.1.2. Sending a Request . . . . . . . . . . . . . . . . . 79 123 6.1.3. Receiving Requests . . . . . . . . . . . . . . . . . 79 124 6.1.4. Processing Local Requests . . . . . . . . . . . . . 79 125 6.1.5. Request Forwarding . . . . . . . . . . . . . . . . . 79 126 6.1.6. Request Routing . . . . . . . . . . . . . . . . . . 80 127 6.1.7. Predictive Loop Avoidance . . . . . . . . . . . . . 80 128 6.1.8. Redirecting requests . . . . . . . . . . . . . . . . 80 129 6.1.9. Relaying and Proxying Requests . . . . . . . . . . . 82 130 6.2. Diameter Answer Processing . . . . . . . . . . . . . . . 82 131 6.2.1. Processing received Answers . . . . . . . . . . . . 83 132 6.2.2. Relaying and Proxying Answers . . . . . . . . . . . 83 133 6.3. Origin-Host AVP . . . . . . . . . . . . . . . . . . . . . 84 134 6.4. Origin-Realm AVP . . . . . . . . . . . . . . . . . . . . 84 135 6.5. Destination-Host AVP . . . . . . . . . . . . . . . . . . 84 136 6.6. Destination-Realm AVP . . . . . . . . . . . . . . . . . . 85 137 6.7. Routing AVPs . . . . . . . . . . . . . . . . . . . . . . 85 138 6.7.1. Route-Record AVP . . . . . . . . . . . . . . . . . . 85 139 6.7.2. Proxy-Info AVP . . . . . . . . . . . . . . . . . . . 85 140 6.7.3. Proxy-Host AVP . . . . . . . . . . . . . . . . . . . 85 141 6.7.4. Proxy-State AVP . . . . . . . . . . . . . . . . . . 85 142 6.8. Auth-Application-Id AVP . . . . . . . . . . . . . . . . . 86 143 6.9. Acct-Application-Id AVP . . . . . . . . . . . . . . . . . 86 144 6.10. Inband-Security-Id AVP . . . . . . . . . . . . . . . . . 86 145 6.11. Vendor-Specific-Application-Id AVP . . . . . . . . . . . 86 146 6.12. Redirect-Host AVP . . . . . . . . . . . . . . . . . . . . 87 147 6.13. Redirect-Host-Usage AVP . . . . . . . . . . . . . . . . . 87 148 6.14. Redirect-Max-Cache-Time AVP . . . . . . . . . . . . . . . 89 149 6.15. E2E-Sequence AVP . . . . . . . . . . . . . . . . . . . . 89 150 7. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 90 151 7.1. Result-Code AVP . . . . . . . . . . . . . . . . . . . . . 91 152 7.1.1. Informational . . . . . . . . . . . . . . . . . . . 92 153 7.1.2. Success . . . . . . . . . . . . . . . . . . . . . . 92 154 7.1.3. Protocol Errors . . . . . . . . . . . . . . . . . . 93 155 7.1.4. Transient Failures . . . . . . . . . . . . . . . . . 94 156 7.1.5. Permanent Failures . . . . . . . . . . . . . . . . . 95 157 7.2. Error Bit . . . . . . . . . . . . . . . . . . . . . . . . 98 158 7.3. Error-Message AVP . . . . . . . . . . . . . . . . . . . . 98 159 7.4. Error-Reporting-Host AVP . . . . . . . . . . . . . . . . 98 160 7.5. Failed-AVP AVP . . . . . . . . . . . . . . . . . . . . . 98 161 7.6. Experimental-Result AVP . . . . . . . . . . . . . . . . . 99 162 7.7. Experimental-Result-Code AVP . . . . . . . . . . . . . . 100 163 8. Diameter User Sessions . . . . . . . . . . . . . . . . . . . 101 164 8.1. Authorization Session State Machine . . . . . . . . . . . 102 165 8.2. Accounting Session State Machine . . . . . . . . . . . . 107 166 8.3. Server-Initiated Re-Auth . . . . . . . . . . . . . . . . 112 167 8.3.1. Re-Auth-Request . . . . . . . . . . . . . . . . . . 112 168 8.3.2. Re-Auth-Answer . . . . . . . . . . . . . . . . . . . 113 169 8.4. Session Termination . . . . . . . . . . . . . . . . . . . 114 170 8.4.1. Session-Termination-Request . . . . . . . . . . . . 115 171 8.4.2. Session-Termination-Answer . . . . . . . . . . . . . 115 172 8.5. Aborting a Session . . . . . . . . . . . . . . . . . . . 116 173 8.5.1. Abort-Session-Request . . . . . . . . . . . . . . . 117 174 8.5.2. Abort-Session-Answer . . . . . . . . . . . . . . . . 117 175 8.6. Inferring Session Termination from Origin-State-Id . . . 118 176 8.7. Auth-Request-Type AVP . . . . . . . . . . . . . . . . . . 119 177 8.8. Session-Id AVP . . . . . . . . . . . . . . . . . . . . . 119 178 8.9. Authorization-Lifetime AVP . . . . . . . . . . . . . . . 120 179 8.10. Auth-Grace-Period AVP . . . . . . . . . . . . . . . . . . 121 180 8.11. Auth-Session-State AVP . . . . . . . . . . . . . . . . . 121 181 8.12. Re-Auth-Request-Type AVP . . . . . . . . . . . . . . . . 122 182 8.13. Session-Timeout AVP . . . . . . . . . . . . . . . . . . . 122 183 8.14. User-Name AVP . . . . . . . . . . . . . . . . . . . . . . 123 184 8.15. Termination-Cause AVP . . . . . . . . . . . . . . . . . . 123 185 8.16. Origin-State-Id AVP . . . . . . . . . . . . . . . . . . . 124 186 8.17. Session-Binding AVP . . . . . . . . . . . . . . . . . . . 124 187 8.18. Session-Server-Failover AVP . . . . . . . . . . . . . . . 125 188 8.19. Multi-Round-Time-Out AVP . . . . . . . . . . . . . . . . 126 189 8.20. Class AVP . . . . . . . . . . . . . . . . . . . . . . . . 126 190 8.21. Event-Timestamp AVP . . . . . . . . . . . . . . . . . . . 126 191 9. Accounting . . . . . . . . . . . . . . . . . . . . . . . . . 128 192 9.1. Server Directed Model . . . . . . . . . . . . . . . . . . 128 193 9.2. Protocol Messages . . . . . . . . . . . . . . . . . . . . 129 194 9.3. Accounting Application Extension and Requirements . . . . 129 195 9.4. Fault Resilience . . . . . . . . . . . . . . . . . . . . 130 196 9.5. Accounting Records . . . . . . . . . . . . . . . . . . . 131 197 9.6. Correlation of Accounting Records . . . . . . . . . . . . 131 198 9.7. Accounting Command-Codes . . . . . . . . . . . . . . . . 132 199 9.7.1. Accounting-Request . . . . . . . . . . . . . . . . . 132 200 9.7.2. Accounting-Answer . . . . . . . . . . . . . . . . . 133 201 9.8. Accounting AVPs . . . . . . . . . . . . . . . . . . . . . 134 202 9.8.1. Accounting-Record-Type AVP . . . . . . . . . . . . . 134 203 9.8.2. Acct-Interim-Interval . . . . . . . . . . . . . . . 135 204 9.8.3. Accounting-Record-Number AVP . . . . . . . . . . . . 136 205 9.8.4. Acct-Session-Id AVP . . . . . . . . . . . . . . . . 136 206 9.8.5. Acct-Multi-Session-Id AVP . . . . . . . . . . . . . 136 207 9.8.6. Accounting-Sub-Session-Id AVP . . . . . . . . . . . 136 208 9.8.7. Accounting-Realtime-Required AVP . . . . . . . . . . 137 209 10. AVP Occurrence Table . . . . . . . . . . . . . . . . . . . . 138 210 10.1. Base Protocol Command AVP Table . . . . . . . . . . . . . 138 211 10.2. Accounting AVP Table . . . . . . . . . . . . . . . . . . 139 212 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 141 213 11.1. AVP Header . . . . . . . . . . . . . . . . . . . . . . . 141 214 11.1.1. AVP Codes . . . . . . . . . . . . . . . . . . . . . 141 215 11.1.2. AVP Flags . . . . . . . . . . . . . . . . . . . . . 142 216 11.2. Diameter Header . . . . . . . . . . . . . . . . . . . . . 142 217 11.2.1. Command Codes . . . . . . . . . . . . . . . . . . . 142 218 11.2.2. Command Flags . . . . . . . . . . . . . . . . . . . 143 219 11.3. Application Identifiers . . . . . . . . . . . . . . . . . 143 220 11.4. AVP Values . . . . . . . . . . . . . . . . . . . . . . . 143 221 11.4.1. Result-Code AVP Values . . . . . . . . . . . . . . . 143 222 11.4.2. Accounting-Record-Type AVP Values . . . . . . . . . 144 223 11.4.3. Termination-Cause AVP Values . . . . . . . . . . . . 144 224 11.4.4. Redirect-Host-Usage AVP Values . . . . . . . . . . . 144 225 11.4.5. Session-Server-Failover AVP Values . . . . . . . . . 144 226 11.4.6. Session-Binding AVP Values . . . . . . . . . . . . . 144 227 11.4.7. Disconnect-Cause AVP Values . . . . . . . . . . . . 144 228 11.4.8. Auth-Request-Type AVP Values . . . . . . . . . . . . 144 229 11.4.9. Auth-Session-State AVP Values . . . . . . . . . . . 145 230 11.4.10. Re-Auth-Request-Type AVP Values . . . . . . . . . . 145 231 11.4.11. Accounting-Realtime-Required AVP Values . . . . . . 145 232 11.4.12. Inband-Security-Id AVP (code 299) . . . . . . . . . 145 234 11.5. Diameter TCP/SCTP Port Numbers . . . . . . . . . . . . . 145 235 11.6. NAPTR Service Fields . . . . . . . . . . . . . . . . . . 145 236 12. Diameter protocol related configurable parameters . . . . . . 147 237 13. Security Considerations . . . . . . . . . . . . . . . . . . . 148 238 13.1. TLS Usage . . . . . . . . . . . . . . . . . . . . . . . . 148 239 13.2. Peer-to-Peer Considerations . . . . . . . . . . . . . . . 149 240 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 150 241 14.1. Normative References . . . . . . . . . . . . . . . . . . 150 242 14.2. Informational References . . . . . . . . . . . . . . . . 152 243 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 154 244 Appendix B. NAPTR Example . . . . . . . . . . . . . . . . . . . 155 245 Appendix C. Duplicate Detection . . . . . . . . . . . . . . . . 156 246 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 158 247 Intellectual Property and Copyright Statements . . . . . . . . . 159 249 1. Introduction 251 Authentication, Authorization and Accounting (AAA) protocols such as 252 TACACS [RFC1492] and RADIUS [RFC2865] were initially deployed to 253 provide dial-up PPP [RFC1661] and terminal server access. Over time, 254 with the growth of the Internet and the introduction of new access 255 technologies, including wireless, DSL, Mobile IP and Ethernet, 256 routers and network access servers (NAS) have increased in complexity 257 and density, putting new demands on AAA protocols. 259 Network access requirements for AAA protocols are summarized in 260 [RFC2989]. These include: 262 Failover 264 [RFC2865] does not define failover mechanisms, and as a result, 265 failover behavior differs between implementations. In order to 266 provide well defined failover behavior, Diameter supports 267 application-layer acknowledgements, and defines failover 268 algorithms and the associated state machine. This is described in 269 Section 5.5 and [RFC3539]. 271 Transmission-level security 273 [RFC2865] defines an application-layer authentication and 274 integrity scheme that is required only for use with Response 275 packets. While [RFC2869] defines an additional authentication and 276 integrity mechanism, use is only required during Extensible 277 Authentication Protocol (EAP) sessions. While attribute-hiding is 278 supported, [RFC2865] does not provide support for per-packet 279 confidentiality. In accounting, [RFC2866] assumes that replay 280 protection is provided by the backend billing server, rather than 281 within the protocol itself. 283 While [RFC3162] defines the use of IPsec with RADIUS, support for 284 IPsec is not required. Since within [RFC2409] authentication 285 occurs only within Phase 1 prior to the establishment of IPsec SAs 286 in Phase 2, it is typically not possible to define separate trust 287 or authorization schemes for each application. This limits the 288 usefulness of IPsec in inter-domain AAA applications (such as 289 roaming) where it may be desirable to define a distinct 290 certificate hierarchy for use in a AAA deployment. In order to 291 provide universal support for transmission-level security, and 292 enable both intra- and inter-domain AAA deployments, Diameter also 293 provides support for TLS. Security is discussed in Section 13. 295 Reliable transport 297 RADIUS runs over UDP, and does not define retransmission behavior; 298 as a result, reliability varies between implementations. As 299 described in [RFC2975], this is a major issue in accounting, where 300 packet loss may translate directly into revenue loss. In order to 301 provide well defined transport behavior, Diameter runs over 302 reliable transport mechanisms (TCP, SCTP) as defined in [RFC3539]. 304 Agent support 306 [RFC2865] does not provide for explicit support for agents, 307 including Proxies, Redirects and Relays. Since the expected 308 behavior is not defined, it varies between implementations. 309 Diameter defines agent behavior explicitly; this is described in 310 Section 2.8. 312 Server-initiated messages 314 While RADIUS server-initiated messages are defined in [RFC3576], 315 support is optional. This makes it difficult to implement 316 features such as unsolicited disconnect or reauthentication/ 317 reauthorization on demand across a heterogeneous deployment. 318 Support for server-initiated messages is mandatory in Diameter, 319 and is described in Section 8. 321 Auditability 323 RADIUS does not define data-object security mechanisms, and as a 324 result, untrusted proxies may modify attributes or even packet 325 headers without being detected. Combined with lack of support for 326 capabilities negotiation, this makes it very difficult to 327 determine what occurred in the event of a dispute. 329 Transition support 331 While Diameter does not share a common protocol data unit (PDU) 332 with RADIUS, considerable effort has been expended in enabling 333 backward compatibility with RADIUS, so that the two protocols may 334 be deployed in the same network. Initially, it is expected that 335 Diameter will be deployed within new network devices, as well as 336 within gateways enabling communication between legacy RADIUS 337 devices and Diameter agents. This capability, described in 339 [RFC4005], enables Diameter support to be added to legacy 340 networks, by addition of a gateway or server speaking both RADIUS 341 and Diameter. 343 In addition to addressing the above requirements, Diameter also 344 provides support for the following: 346 Capability negotiation 348 RADIUS does not support error messages, capability negotiation, or 349 a mandatory/non-mandatory flag for attributes. Since RADIUS 350 clients and servers are not aware of each other's capabilities, 351 they may not be able to successfully negotiate a mutually 352 acceptable service, or in some cases, even be aware of what 353 service has been implemented. Diameter includes support for error 354 handling (Section 7), capability negotiation (Section 5.3), and 355 mandatory/non-mandatory attribute-value pairs (AVPs) (Section 356 4.1). 358 Peer discovery and configuration 360 RADIUS implementations typically require that the name or address 361 of servers or clients be manually configured, along with the 362 corresponding shared secrets. This results in a large 363 administrative burden, and creates the temptation to reuse the 364 RADIUS shared secret, which can result in major security 365 vulnerabilities if the Request Authenticator is not globally and 366 temporally unique as required in [RFC2865]. Through DNS, Diameter 367 enables dynamic discovery of peers. Derivation of dynamic session 368 keys is enabled via transmission-level security. 370 Roaming support 372 The ROAMOPS WG provided a survey of roaming implementations 373 [RFC2194], detailed roaming requirements [RFC2477], defined the 374 Network Access Identifier (NAI)[RFC4282], and documented existing 375 implementations (and imitations) of RADIUS-based roaming 376 [RFC2607]. In order to improve scalability, [RFC2607] introduced 377 the concept of proxy chaining via an intermediate server, 378 facilitating roaming between providers. However, since RADIUS 379 does not provide explicit support for proxies, and lacks 380 auditability and transmission-level security features, RADIUS- 381 based roaming is vulnerable to attack from external parties as 382 well as susceptible to fraud perpetrated by the roaming partners 383 themselves. As a result, it is not suitable for wide-scale 384 deployment on the Internet [RFC2607]. By providing explicit 385 support for inter-domain roaming and message routing (Sections 2.7 386 and 6), and transmission-layer security (Section 13) features, 387 Diameter addresses these limitations and provides for secure and 388 scalable roaming. 390 In the decade since AAA protocols were first introduced, the 391 capabilities of Network Access Server (NAS) devices have increased 392 substantially. As a result, while Diameter is a considerably more 393 sophisticated protocol than RADIUS, it remains feasible to implement 394 within embedded devices, given improvements in processor speeds and 395 the widespread availability of embedded TLS implementations. 397 1.1. Diameter Protocol 399 The Diameter base protocol provides the following facilities: 401 o Delivery of AVPs (attribute value pairs) 403 o Capabilities negotiation 405 o Error notification 407 o Extensibility, through addition of new commands and AVPs (required 408 in [RFC2989]). 410 o Basic services necessary for applications, such as handling of 411 user sessions or accounting 413 All data delivered by the protocol is in the form of an AVP. Some of 414 these AVP values are used by the Diameter protocol itself, while 415 others deliver data associated with particular applications that 416 employ Diameter. AVPs may be added arbitrarily to Diameter messages, 417 so long as the required AVPs are included and AVPs that are 418 explicitly excluded are not included. AVPs are used by the base 419 Diameter protocol to support the following required features: 421 o Transporting of user authentication information, for the purposes 422 of enabling the Diameter server to authenticate the user. 424 o Transporting of service specific authorization information, 425 between client and servers, allowing the peers to decide whether a 426 user's access request should be granted. 428 o Exchanging resource usage information, which MAY be used for 429 accounting purposes, capacity planning, etc. 431 o Relaying, proxying and redirecting of Diameter messages through a 432 server hierarchy. 434 The Diameter base protocol provides the minimum requirements needed 435 for a AAA protocol, as required by [RFC2989]. The base protocol may 436 be used by itself for accounting purposes only, or it may be used 437 with a Diameter application, such as Mobile IPv4 [RFC4004], or 438 network access [RFC4005]. It is also possible for the base protocol 439 to be extended for use in new applications, via the addition of new 440 commands or AVPs. At this time the focus of Diameter is network 441 access and accounting applications. A truly generic AAA protocol 442 used by many applications might provide functionality not provided by 443 Diameter. Therefore, it is imperative that the designers of new 444 applications understand their requirements before using Diameter. 445 See Section 2.4 for more information on Diameter applications. 447 Any node can initiate a request. In that sense, Diameter is a peer- 448 to-peer protocol. In this document, a Diameter Client is a device at 449 the edge of the network that performs access control, such as a 450 Network Access Server (NAS) or a Foreign Agent (FA). A Diameter 451 client generates Diameter messages to request authentication, 452 authorization, and accounting services for the user. A Diameter 453 agent is a node that does not authenticate and/or authorize messages 454 locally; agents include proxies, redirects and relay agents. A 455 Diameter server performs authentication and/or authorization of the 456 user. A Diameter node MAY act as an agent for certain requests while 457 acting as a server for others. 459 The Diameter protocol also supports server-initiated messages, such 460 as a request to abort service to a particular user. 462 1.1.1. Description of the Document Set 464 Currently, the Diameter specification consists of a base 465 specification (this document), Transport Profile [RFC3539] and 466 applications: Mobile IPv4 [RFC4004], NASREQ [RFC4005], Credit Control 467 [RFC4006], EAP [RFC4072] and SIP [RFC4740]. 469 The Transport Profile document [RFC3539] discusses transport layer 470 issues that arise with AAA protocols and recommendations on how to 471 overcome these issues. This document also defines the Diameter 472 failover algorithm and state machine. 474 The Mobile IPv4 [RFC4004] application defines a Diameter application 475 that allows a Diameter server to perform AAA functions for Mobile 476 IPv4 services to a mobile node. 478 The NASREQ [RFC4005] application defines a Diameter Application that 479 allows a Diameter server to be used in a PPP/SLIP Dial-Up and 480 Terminal Server Access environment. Consideration was given for 481 servers that need to perform protocol conversion between Diameter and 482 RADIUS. 484 The Credit Control [RFC4006] application defines a Diameter 485 Application that can be used to implement real-time credit-control 486 for a variety of end user services such as network access, SIP 487 services, messaging services, and download services. It provides a 488 general solution to real-time cost and credit-control. 490 The EAP [RFC4072] application defines a Diameter Application that can 491 be used to carry EAP packets between the Network Access Server (NAS) 492 working as an EAP authenticator and a back-end authentication server. 493 The Diameter EAP application is based on NASREQ and intended for a 494 similar environment. 496 The SIP [RFC4740] application defines a Diameter Application that 497 allows a Diameter client to request authentication and authorization 498 information to a Diameter server for SIP-based IP multimedia services 499 (see SIP [RFC3261]). 501 In summary, this document defines the base protocol specification for 502 AAA, which includes support for accounting. The applications 503 documents describe applications that use this base specification for 504 Authentication, Authorization and Accounting. 506 1.1.2. Conventions Used in This Document 508 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 509 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 510 document are to be interpreted as described in [RFC2119]. 512 1.2. Approach to Extensibility 514 The Diameter protocol is designed to be extensible, using several 515 mechanisms, including: 517 o Defining new AVP values 519 o Creating new AVPs 521 o Creating new authentication/authorization applications 523 o Creating new accounting applications 525 o Application authentication procedures 526 Reuse of existing AVP values, AVPs and Diameter applications are 527 strongly recommended. Reuse simplifies standardization and 528 implementation and avoids potential interoperability issues. It is 529 expected that command codes are reused; new command codes can only be 530 created by IETF Consensus (see Section 11.2.1). 532 1.2.1. Defining New AVP Values 534 New applications should attempt to reuse AVPs defined in existing 535 applications when possible, as opposed to creating new AVPs. For 536 AVPs of type Enumerated, an application may require a new value to 537 communicate some service-specific information. 539 In order to allocate a new AVP value, a request MUST be sent to IANA 540 [RFC2434], along with an explanation of the new AVP value. IANA 541 considerations for Diameter are discussed in Section 11. 543 1.2.2. Creating New AVPs 545 When no existing AVP can be used, a new AVP should be created. The 546 new AVP being defined MUST use one of the data types listed in 547 Section 4.2. 549 In the event that a logical grouping of AVPs is necessary, and 550 multiple "groups" are possible in a given command, it is recommended 551 that a Grouped AVP be used (see Section 4.4). 553 In order to create a new AVP, a request MUST be sent to IANA, with a 554 specification for the AVP. The request MUST include the commands 555 that would make use of the AVP. 557 1.2.3. Creating New Authentication Applications 559 Every Diameter application specification MUST have an IANA assigned 560 Application Identifier (see Section 2.4 and Section 11.3). 562 Should a new Diameter usage scenario find itself unable to fit within 563 an existing application without requiring major changes to the 564 specification, it may be desirable to create a new Diameter 565 application. Major changes to an application include: 567 o Adding new AVPs to the command, which have the "M" bit set. 569 o Requiring a command that has a different number of round trips to 570 satisfy a request (e.g., application foo has a command that 571 requires one round trip, but new application bar has a command 572 that requires two round trips to complete). 574 o Adding support for an authentication method requiring definition 575 of new AVPs for use with the application. Since a new EAP 576 authentication method can be supported within Diameter without 577 requiring new AVPs, addition of EAP methods does not require the 578 creation of a new authentication application. 580 Creation of a new application should be viewed as a last resort. An 581 implementation MAY add arbitrary non-mandatory AVPs to any command 582 defined in an application, including vendor-specific AVPs without 583 needing to define a new application. Please refer to Section 11.1.1 584 for details. 586 In order to justify allocation of a new application identifier, 587 Diameter applications MUST define one Command Code, add new mandatory 588 AVPs to the ABNF or significantly change the state machine or 589 processing rules of an existing application. 591 The expected AVPs MUST be defined in an ABNF [RFC2234] grammar (see 592 Section 3.2). If the Diameter application has accounting 593 requirements, it MUST also specify the AVPs that are to be present in 594 the Diameter Accounting messages (see Section 9.3). However, just 595 because a new authentication application id is required, does not 596 imply that a new accounting application id is required. 598 When possible, a new Diameter application SHOULD reuse existing 599 Diameter AVPs, in order to avoid defining multiple AVPs that carry 600 similar information. 602 1.2.4. Creating New Accounting Applications 604 There are services that only require Diameter accounting. Such 605 services need to define the AVPs carried in the Accounting-Request 606 (ACR)/ Accounting-Answer (ACA) messages, but do not need to define 607 new command codes. An implementation MAY add arbitrary non-mandatory 608 AVPs (AVPs with the "M" bit not set) to any command defined in an 609 application, including vendor-specific AVPs, without needing to 610 define a new accounting application. Please refer to Section 11.1.1 611 for details. 613 Application Identifiers are still required for Diameter capability 614 exchange. Every Diameter accounting application specification MUST 615 have an IANA assigned Application Identifier (see Section 2.4) or a 616 vendor specific Application Identifier. 618 Every Diameter implementation MUST support accounting. Basic 619 accounting support is sufficient to handle any application that uses 620 the ACR/ACA commands defined in this document, as long as no new 621 mandatory AVPs are added. A mandatory AVP is defined as one which 622 has the "M" bit set when sent within an accounting command, 623 regardless of whether it is required or optional within the ABNF for 624 the accounting application. 626 The creation of a new accounting application should be viewed as a 627 last resort and MUST NOT be used unless a new command or additional 628 mechanisms (e.g., application defined state machine) is defined 629 within the application, or new mandatory AVPs are added to the ABNF. 631 Within an accounting command, setting the "M" bit implies that a 632 backend server (e.g., billing server) or the accounting server itself 633 MUST understand the AVP in order to compute a correct bill. If the 634 AVP is not relevant to the billing process, when the AVP is included 635 within an accounting command, it MUST NOT have the "M" bit set, even 636 if the "M" bit is set when the same AVP is used within other Diameter 637 commands (i.e., authentication/authorization commands). 639 A DIAMETER base accounting implementation MUST be configurable to 640 advertise supported accounting applications in order to prevent the 641 accounting server from accepting accounting requests for unbillable 642 services. The combination of the home domain and the accounting 643 application Id can be used in order to route the request to the 644 appropriate accounting server. 646 When possible, a new Diameter accounting application SHOULD attempt 647 to reuse existing AVPs, in order to avoid defining multiple AVPs that 648 carry similar information. 650 If the base accounting is used without any mandatory AVPs, new 651 commands or additional mechanisms (e.g., application defined state 652 machine), then the base protocol defined standard accounting 653 application Id (Section 2.4) MUST be used in ACR/ACA commands. 655 1.2.5. Application Authentication Procedures 657 When possible, applications SHOULD be designed such that new 658 authentication methods MAY be added without requiring changes to the 659 application. This MAY require that new AVP values be assigned to 660 represent the new authentication transform, or any other scheme that 661 produces similar results. When possible, authentication frameworks, 662 such as Extensible Authentication Protocol [RFC2284], SHOULD be used. 664 1.3. Terminology 665 AAA 667 Authentication, Authorization and Accounting. 669 Accounting 671 The act of collecting information on resource usage for the 672 purpose of capacity planning, auditing, billing or cost 673 allocation. 675 Accounting Record 677 An accounting record represents a summary of the resource 678 consumption of a user over the entire session. Accounting servers 679 creating the accounting record may do so by processing interim 680 accounting events or accounting events from several devices 681 serving the same user. 683 Authentication 685 The act of verifying the identity of an entity (subject). 687 Authorization 689 The act of determining whether a requesting entity (subject) will 690 be allowed access to a resource (object). 692 AVP 694 The Diameter protocol consists of a header followed by one or more 695 Attribute-Value-Pairs (AVPs). An AVP includes a header and is 696 used to encapsulate protocol-specific data (e.g., routing 697 information) as well as authentication, authorization or 698 accounting information. 700 Broker 702 A broker is a business term commonly used in AAA infrastructures. 703 A broker is either a relay, proxy or redirect agent, and MAY be 704 operated by roaming consortiums. Depending on the business model, 705 a broker may either choose to deploy relay agents or proxy agents. 707 Diameter Agent 709 A Diameter Agent is a Diameter node that provides either relay, 710 proxy, redirect or translation services. 712 Diameter Client 714 A Diameter Client is a device at the edge of the network that 715 performs access control. An example of a Diameter client is a 716 Network Access Server (NAS) or a Foreign Agent (FA). 718 Diameter Node 720 A Diameter node is a host process that implements the Diameter 721 protocol, and acts either as a Client, Agent or Server. 723 Diameter Peer 725 A Diameter Peer is a Diameter Node to which a given Diameter Node 726 has a direct transport connection. 728 Diameter Server 730 A Diameter Server is one that handles authentication, 731 authorization and accounting requests for a particular realm. By 732 its very nature, a Diameter Server MUST support Diameter 733 applications in addition to the base protocol. 735 Downstream 737 Downstream is used to identify the direction of a particular 738 Diameter message from the home server towards the access device. 740 Home Realm 742 A Home Realm is the administrative domain with which the user 743 maintains an account relationship. 745 Home Server 747 See Diameter Server. 749 Interim accounting 751 An interim accounting message provides a snapshot of usage during 752 a user's session. It is typically implemented in order to provide 753 for partial accounting of a user's session in the case of a device 754 reboot or other network problem prevents the reception of a 755 session summary message or session record. 757 Local Realm 759 A local realm is the administrative domain providing services to a 760 user. An administrative domain MAY act as a local realm for 761 certain users, while being a home realm for others. 763 Multi-session 765 A multi-session represents a logical linking of several sessions. 766 Multi-sessions are tracked by using the Acct-Multi-Session-Id. An 767 example of a multi-session would be a Multi-link PPP bundle. Each 768 leg of the bundle would be a session while the entire bundle would 769 be a multi-session. 771 Network Access Identifier 773 The Network Access Identifier, or NAI [RFC4282], is used in the 774 Diameter protocol to extract a user's identity and realm. The 775 identity is used to identify the user during authentication and/or 776 authorization, while the realm is used for message routing 777 purposes. 779 Proxy Agent or Proxy 781 In addition to forwarding requests and responses, proxies make 782 policy decisions relating to resource usage and provisioning. 783 This is typically accomplished by tracking the state of NAS 784 devices. While proxies typically do not respond to client 785 Requests prior to receiving a Response from the server, they may 786 originate Reject messages in cases where policies are violated. 787 As a result, proxies need to understand the semantics of the 788 messages passing through them, and may not support all Diameter 789 applications. 791 Realm 793 The string in the NAI that immediately follows the '@' character. 794 NAI realm names are required to be unique, and are piggybacked on 795 the administration of the DNS namespace. Diameter makes use of 796 the realm, also loosely referred to as domain, to determine 797 whether messages can be satisfied locally, or whether they must be 798 routed or redirected. In RADIUS, realm names are not necessarily 799 piggybacked on the DNS namespace but may be independent of it. 801 Real-time Accounting 803 Real-time accounting involves the processing of information on 804 resource usage within a defined time window. Time constraints are 805 typically imposed in order to limit financial risk. 807 Relay Agent or Relay 809 Relays forward requests and responses based on routing-related 810 AVPs and routing table entries. Since relays do not make policy 811 decisions, they do not examine or alter non-routing AVPs. As a 812 result, relays never originate messages, do not need to understand 813 the semantics of messages or non-routing AVPs, and are capable of 814 handling any Diameter application or message type. Since relays 815 make decisions based on information in routing AVPs and realm 816 forwarding tables they do not keep state on NAS resource usage or 817 sessions in progress. 819 Redirect Agent 821 Rather than forwarding requests and responses between clients and 822 servers, redirect agents refer clients to servers and allow them 823 to communicate directly. Since redirect agents do not sit in the 824 forwarding path, they do not alter any AVPs transiting between 825 client and server. Redirect agents do not originate messages and 826 are capable of handling any message type, although they may be 827 configured only to redirect messages of certain types, while 828 acting as relay or proxy agents for other types. As with proxy 829 agents, redirect agents do not keep state with respect to sessions 830 or NAS resources. 832 Roaming Relationships 834 Roaming relationships include relationships between companies and 835 ISPs, relationships among peer ISPs within a roaming consortium, 836 and relationships between an ISP and a roaming consortium. 838 Session 840 A session is a related progression of events devoted to a 841 particular activity. Each application SHOULD provide guidelines 842 as to when a session begins and ends. All Diameter packets with 843 the same Session-Identifier are considered to be part of the same 844 session. 846 Session state 848 A stateful agent is one that maintains session state information, 849 by keeping track of all authorized active sessions. Each 850 authorized session is bound to a particular service, and its state 851 is considered active either until it is notified otherwise, or by 852 expiration. 854 Sub-session 856 A sub-session represents a distinct service (e.g., QoS or data 857 characteristics) provided to a given session. These services may 858 happen concurrently (e.g., simultaneous voice and data transfer 859 during the same session) or serially. These changes in sessions 860 are tracked with the Accounting-Sub-Session-Id. 862 Transaction state 864 The Diameter protocol requires that agents maintain transaction 865 state, which is used for failover purposes. Transaction state 866 implies that upon forwarding a request, the Hop-by-Hop identifier 867 is saved; the field is replaced with a locally unique identifier, 868 which is restored to its original value when the corresponding 869 answer is received. The request's state is released upon receipt 870 of the answer. A stateless agent is one that only maintains 871 transaction state. 873 Translation Agent 875 A translation agent is a stateful Diameter node that performs 876 protocol translation between Diameter and another AAA protocol, 877 such as RADIUS. 879 Transport Connection 881 A transport connection is a TCP or SCTP connection existing 882 directly between two Diameter peers, otherwise known as a Peer- 883 to-Peer Connection. 885 Upstream 887 Upstream is used to identify the direction of a particular 888 Diameter message from the access device towards the home server. 890 User 892 The entity requesting or using some resource, in support of which 893 a Diameter client has generated a request. 895 2. Protocol Overview 897 The base Diameter protocol may be used by itself for accounting 898 applications, but for use in authentication and authorization it is 899 always extended for a particular application. Two Diameter 900 applications are defined by companion documents: NASREQ [RFC4005], 901 Mobile IPv4 [RFC4004]. These applications are introduced in this 902 document but specified elsewhere. Additional Diameter applications 903 MAY be defined in the future (see Section 11.3). 905 Diameter Clients MUST support the base protocol, which includes 906 accounting. In addition, they MUST fully support each Diameter 907 application that is needed to implement the client's service, e.g., 908 NASREQ and/or Mobile IPv4. A Diameter Client that does not support 909 both NASREQ and Mobile IPv4, MUST be referred to as "Diameter X 910 Client" where X is the application which it supports, and not a 911 "Diameter Client". 913 Diameter Servers MUST support the base protocol, which includes 914 accounting. In addition, they MUST fully support each Diameter 915 application that is needed to implement the intended service, e.g., 916 NASREQ and/or Mobile IPv4. A Diameter Server that does not support 917 both NASREQ and Mobile IPv4, MUST be referred to as "Diameter X 918 Server" where X is the application which it supports, and not a 919 "Diameter Server". 921 Diameter Relays and redirect agents are, by definition, protocol 922 transparent, and MUST transparently support the Diameter base 923 protocol, which includes accounting, and all Diameter applications. 925 Diameter proxies MUST support the base protocol, which includes 926 accounting. In addition, they MUST fully support each Diameter 927 application that is needed to implement proxied services, e.g., 928 NASREQ and/or Mobile IPv4. A Diameter proxy which does not support 929 also both NASREQ and Mobile IPv4, MUST be referred to as "Diameter X 930 Proxy" where X is the application which it supports, and not a 931 "Diameter Proxy". 933 The base Diameter protocol concerns itself with capabilities 934 negotiation, how messages are sent and how peers may eventually be 935 abandoned. The base protocol also defines certain rules that apply 936 to all exchanges of messages between Diameter nodes. 938 Communication between Diameter peers begins with one peer sending a 939 message to another Diameter peer. The set of AVPs included in the 940 message is determined by a particular Diameter application. One AVP 941 that is included to reference a user's session is the Session-Id. 943 The initial request for authentication and/or authorization of a user 944 would include the Session-Id. The Session-Id is then used in all 945 subsequent messages to identify the user's session (see Section 8 for 946 more information). The communicating party may accept the request, 947 or reject it by returning an answer message with the Result-Code AVP 948 set to indicate an error occurred. The specific behavior of the 949 Diameter server or client receiving a request depends on the Diameter 950 application employed. 952 Session state (associated with a Session-Id) MUST be freed upon 953 receipt of the Session-Termination-Request, Session-Termination- 954 Answer, expiration of authorized service time in the Session-Timeout 955 AVP, and according to rules established in a particular Diameter 956 application. 958 2.1. Transport 960 Transport profile is defined in [RFC3539]. 962 The base Diameter protocol is run on port 3868 of both TCP [TCP] and 963 SCTP [RFC2960] transport protocols. 965 Diameter clients MUST support either TCP or SCTP, while agents and 966 servers MUST support both. Future versions of this specification MAY 967 mandate that clients support SCTP. 969 A Diameter node MAY initiate connections from a source port other 970 than the one that it declares it accepts incoming connections on, and 971 MUST be prepared to receive connections on port 3868. A given 972 Diameter instance of the peer state machine MUST NOT use more than 973 one transport connection to communicate with a given peer, unless 974 multiple instances exist on the peer in which case a separate 975 connection per process is allowed. 977 When no transport connection exists with a peer, an attempt to 978 connect SHOULD be periodically made. This behavior is handled via 979 the Tc timer, whose recommended value is 30 seconds. There are 980 certain exceptions to this rule, such as when a peer has terminated 981 the transport connection stating that it does not wish to 982 communicate. 984 When connecting to a peer and either zero or more transports are 985 specified, SCTP SHOULD be tried first, followed by TCP. See Section 986 5.2 for more information on peer discovery. 988 Diameter implementations SHOULD be able to interpret ICMP protocol 989 port unreachable messages as explicit indications that the server is 990 not reachable, subject to security policy on trusting such messages. 992 Diameter implementations SHOULD also be able to interpret a reset 993 from the transport and timed-out connection attempts. If Diameter 994 receives data up from TCP that cannot be parsed or identified as a 995 Diameter error made by the peer, the stream is compromised and cannot 996 be recovered. The transport connection MUST be closed using a RESET 997 call (send a TCP RST bit) or an SCTP ABORT message (graceful closure 998 is compromised). 1000 2.1.1. SCTP Guidelines 1002 The following are guidelines for Diameter implementations that 1003 support SCTP: 1005 1. For interoperability: All Diameter nodes MUST be prepared to 1006 receive Diameter messages on any SCTP stream in the association. 1008 2. To prevent blocking: All Diameter nodes SHOULD utilize all SCTP 1009 streams available to the association to prevent head-of-the-line 1010 blocking. 1012 2.2. Securing Diameter Messages 1014 Diameter clients, such as Network Access Servers (NASes) and Mobility 1015 Agents MAY support TLS [RFC2246]. Diameter servers MUST support TLS. 1016 IPSec [RFC2401] can be deployed between Diameter peers as an 1017 additional security measure independent of the Diameter protocol. 1018 The Diameter protocol SHOULD NOT be used without any security 1019 mechanism. 1021 2.3. Diameter Application Compliance 1023 Application Identifiers are advertised during the capabilities 1024 exchange phase (see Section 5.3). For a given application, 1025 advertising support of an application implies that the sender 1026 supports all command codes, and the AVPs specified in the associated 1027 ABNFs, described in the specification. 1029 An implementation MAY add arbitrary non-mandatory AVPs to any command 1030 defined in an application, including vendor-specific AVPs. Please 1031 refer to Section 11.1.1 for details. 1033 2.4. Application Identifiers 1035 Each Diameter application MUST have an IANA assigned Application 1036 Identifier (see Section 11.3). The base protocol does not require an 1037 Application Identifier since its support is mandatory. During the 1038 capabilities exchange, Diameter nodes inform their peers of locally 1039 supported applications. Furthermore, all Diameter messages contain 1040 an Application Identifier, which is used in the message forwarding 1041 process. 1043 The following Application Identifier values are defined: 1045 Diameter Common Messages 0 1046 NASREQ 1 [RFC4005] 1047 Mobile-IP 2 [RFC4004] 1048 Diameter Base Accounting 3 1049 Relay 0xffffffff 1051 Relay and redirect agents MUST advertise the Relay Application 1052 Identifier, while all other Diameter nodes MUST advertise locally 1053 supported applications. The receiver of a Capabilities Exchange 1054 message advertising Relay service MUST assume that the sender 1055 supports all current and future applications. 1057 Diameter relay and proxy agents are responsible for finding an 1058 upstream server that supports the application of a particular 1059 message. If none can be found, an error message is returned with the 1060 Result-Code AVP set to DIAMETER_UNABLE_TO_DELIVER. 1062 2.5. Connections vs. Sessions 1064 This section attempts to provide the reader with an understanding of 1065 the difference between connection and session, which are terms used 1066 extensively throughout this document. 1068 A connection is a transport level connection between two peers, used 1069 to send and receive Diameter messages. A session is a logical 1070 concept at the application layer, and is shared between an access 1071 device and a server, and is identified via the Session-Id AVP. 1073 +--------+ +-------+ +--------+ 1074 | Client | | Relay | | Server | 1075 +--------+ +-------+ +--------+ 1076 <----------> <----------> 1077 peer connection A peer connection B 1079 <-----------------------------> 1080 User session x 1082 Figure 1: Diameter connections and sessions 1084 In the example provided in Figure 1, peer connection A is established 1085 between the Client and its local Relay. Peer connection B is 1086 established between the Relay and the Server. User session X spans 1087 from the Client via the Relay to the Server. Each "user" of a 1088 service causes an auth request to be sent, with a unique session 1089 identifier. Once accepted by the server, both the client and the 1090 server are aware of the session. 1092 It is important to note that there is no relationship between a 1093 connection and a session, and that Diameter messages for multiple 1094 sessions are all multiplexed through a single connection. Also note 1095 that Diameter messages pertaining to the session, both application 1096 specific and those that are defined in this document such as ASR/ASA, 1097 RAR/RAA and STR/STA MUST carry the application identifier of the 1098 application. Diameter messages pertaining to peer connection 1099 establishment and maintenance such as CER/CEA, DWR/DWA and DPR/DPA 1100 MUST carry an application id of zero (0). 1102 2.6. Peer Table 1104 The Diameter Peer Table is used in message forwarding, and referenced 1105 by the Routing Table. A Peer Table entry contains the following 1106 fields: 1108 Host identity 1110 Following the conventions described for the DiameterIdentity 1111 derived AVP data format in Section 4.4. This field contains the 1112 contents of the Origin-Host (Section 6.3) AVP found in the CER or 1113 CEA message. 1115 StatusT 1117 This is the state of the peer entry, and MUST match one of the 1118 values listed in Section 5.6. 1120 Static or Dynamic 1122 Specifies whether a peer entry was statically configured, or 1123 dynamically discovered. 1125 Expiration time 1127 Specifies the time at which dynamically discovered peer table 1128 entries are to be either refreshed, or expired. 1130 TLS Enabled 1132 Specifies whether TLS is to be used when communicating with the 1133 peer. 1135 Additional security information, when needed (e.g., keys, 1136 certificates) 1138 2.7. Routing Table 1140 All Realm-Based routing lookups are performed against what is 1141 commonly known as the Routing Table (see Section 12). A Routing 1142 Table Entry contains the following fields: 1144 Realm Name 1146 This is the field that is typically used as a primary key in the 1147 routing table lookups. Note that some implementations perform 1148 their lookups based on longest-match-from-the-right on the realm 1149 rather than requiring an exact match. 1151 Application Identifier 1153 An application is identified by an application id. A route entry 1154 can have a different destination based on the application 1155 identification in the message header. This field MUST be used as 1156 a secondary key field in routing table lookups. 1158 Local Action 1160 The Local Action field is used to identify how a message should be 1161 treated. The following actions are supported: 1163 1. LOCAL - Diameter messages that resolve to a route entry with 1164 the Local Action set to Local can be satisfied locally, and do 1165 not need to be routed to another server. 1167 2. RELAY - All Diameter messages that fall within this category 1168 MUST be routed to a next hop server, without modifying any 1169 non-routing AVPs. See Section 6.1.9 for relaying guidelines 1171 3. PROXY - All Diameter messages that fall within this category 1172 MUST be routed to a next hop server. The local server MAY 1173 apply its local policies to the message by including new AVPs 1174 to the message prior to routing. See Section 6.1.9 for 1175 proxying guidelines. 1177 4. REDIRECT - Diameter messages that fall within this category 1178 MUST have the identity of the home Diameter server(s) 1179 appended, and returned to the sender of the message. See 1180 Section 6.1.9 for redirect guidelines. 1182 Server Identifier 1184 One or more servers the message is to be routed to. These servers 1185 MUST also be present in the Peer table. When the Local Action is 1186 set to RELAY or PROXY, this field contains the identity of the 1187 server(s) the message must be routed to. When the Local Action 1188 field is set to REDIRECT, this field contains the identity of one 1189 or more servers the message should be redirected to. 1191 Static or Dynamic 1193 Specifies whether a route entry was statically configured, or 1194 dynamically discovered. 1196 Expiration time 1198 Specifies the time which a dynamically discovered route table 1199 entry expires. 1201 It is important to note that Diameter agents MUST support at least 1202 one of the LOCAL, RELAY, PROXY or REDIRECT modes of operation. 1203 Agents do not need to support all modes of operation in order to 1204 conform with the protocol specification, but MUST follow the protocol 1205 compliance guidelines in Section 2. Relay agents MUST NOT reorder 1206 AVPs, and proxies MUST NOT reorder AVPs. 1208 The routing table MAY include a default entry that MUST be used for 1209 any requests not matching any of the other entries. The routing 1210 table MAY consist of only such an entry. 1212 When a request is routed, the target server MUST have advertised the 1213 Application Identifier (see Section 2.4) for the given message, or 1214 have advertised itself as a relay or proxy agent. Otherwise, an 1215 error is returned with the Result-Code AVP set to 1216 DIAMETER_UNABLE_TO_DELIVER. 1218 2.8. Role of Diameter Agents 1220 In addition to client and servers, the Diameter protocol introduces 1221 relay, proxy, redirect, and translation agents, each of which is 1222 defined in Section 1.3. These Diameter agents are useful for several 1223 reasons: 1225 o They can distribute administration of systems to a configurable 1226 grouping, including the maintenance of security associations. 1228 o They can be used for concentration of requests from an number of 1229 co-located or distributed NAS equipment sets to a set of like user 1230 groups. 1232 o They can do value-added processing to the requests or responses. 1234 o They can be used for load balancing. 1236 o A complex network will have multiple authentication sources, they 1237 can sort requests and forward towards the correct target. 1239 The Diameter protocol requires that agents maintain transaction 1240 state, which is used for failover purposes. Transaction state 1241 implies that upon forwarding a request, its Hop-by-Hop identifier is 1242 saved; the field is replaced with a locally unique identifier, which 1243 is restored to its original value when the corresponding answer is 1244 received. The request's state is released upon receipt of the 1245 answer. A stateless agent is one that only maintains transaction 1246 state. 1248 The Proxy-Info AVP allows stateless agents to add local state to a 1249 Diameter request, with the guarantee that the same state will be 1250 present in the answer. However, the protocol's failover procedures 1251 require that agents maintain a copy of pending requests. 1253 A stateful agent is one that maintains session state information; by 1254 keeping track of all authorized active sessions. Each authorized 1255 session is bound to a particular service, and its state is considered 1256 active either until it is notified otherwise, or by expiration. Each 1257 authorized session has an expiration, which is communicated by 1258 Diameter servers via the Session-Timeout AVP. 1260 Maintaining session state MAY be useful in certain applications, such 1261 as: 1263 o Protocol translation (e.g., RADIUS <-> Diameter) 1265 o Limiting resources authorized to a particular user 1267 o Per user or transaction auditing 1269 A Diameter agent MAY act in a stateful manner for some requests and 1270 be stateless for others. A Diameter implementation MAY act as one 1271 type of agent for some requests, and as another type of agent for 1272 others. 1274 2.8.1. Relay Agents 1276 Relay Agents are Diameter agents that accept requests and route 1277 messages to other Diameter nodes based on information found in the 1278 messages (e.g., Destination-Realm). This routing decision is 1279 performed using a list of supported realms, and known peers. This is 1280 known as the Routing Table, as is defined further in Section 2.7. 1282 Relays MAY be used to aggregate requests from multiple Network Access 1283 Servers (NASes) within a common geographical area (POP). The use of 1284 Relays is advantageous since it eliminates the need for NASes to be 1285 configured with the necessary security information they would 1286 otherwise require to communicate with Diameter servers in other 1287 realms. Likewise, this reduces the configuration load on Diameter 1288 servers that would otherwise be necessary when NASes are added, 1289 changed or deleted. 1291 Relays modify Diameter messages by inserting and removing routing 1292 information, but do not modify any other portion of a message. 1293 Relays SHOULD NOT maintain session state but MUST maintain 1294 transaction state. 1296 +------+ ---------> +------+ ---------> +------+ 1297 | | 1. Request | | 2. Request | | 1298 | NAS | | DRL | | HMS | 1299 | | 4. Answer | | 3. Answer | | 1300 +------+ <--------- +------+ <--------- +------+ 1301 example.net example.net example.com 1303 Figure 2: Relaying of Diameter messages 1305 The example provided in Figure 2 depicts a request issued from NAS, 1306 which is an access device, for the user bob@example.com. Prior to 1307 issuing the request, NAS performs a Diameter route lookup, using 1308 "example.com" as the key, and determines that the message is to be 1309 relayed to DRL, which is a Diameter Relay. DRL performs the same 1310 route lookup as NAS, and relays the message to HMS, which is 1311 example.com's Home Diameter Server. HMS identifies that the request 1312 can be locally supported (via the realm), processes the 1313 authentication and/or authorization request, and replies with an 1314 answer, which is routed back to NAS using saved transaction state. 1316 Since Relays do not perform any application level processing, they 1317 provide relaying services for all Diameter applications, and 1318 therefore MUST advertise the Relay Application Identifier. 1320 2.8.2. Proxy Agents 1322 Similarly to relays, proxy agents route Diameter messages using the 1323 Diameter Routing Table. However, they differ since they modify 1324 messages to implement policy enforcement. This requires that proxies 1325 maintain the state of their downstream peers (e.g., access devices) 1326 to enforce resource usage, provide admission control, and 1327 provisioning. 1329 Proxies MAY be used in call control centers or access ISPs that 1330 provide outsourced connections, they can monitor the number and types 1331 of ports in use, and make allocation and admission decisions 1332 according to their configuration. 1334 Proxies that wish to limit resources MUST maintain session state. 1335 All proxies MUST maintain transaction state. 1337 Since enforcing policies requires an understanding of the service 1338 being provided, Proxies MUST only advertise the Diameter applications 1339 they support. 1341 2.8.3. Redirect Agents 1343 Redirect agents are useful in scenarios where the Diameter routing 1344 configuration needs to be centralized. An example is a redirect 1345 agent that provides services to all members of a consortium, but does 1346 not wish to be burdened with relaying all messages between realms. 1347 This scenario is advantageous since it does not require that the 1348 consortium provide routing updates to its members when changes are 1349 made to a member's infrastructure. 1351 Since redirect agents do not relay messages, and only return an 1352 answer with the information necessary for Diameter agents to 1353 communicate directly, they do not modify messages. Since redirect 1354 agents do not receive answer messages, they cannot maintain session 1355 state. Further, since redirect agents never relay requests, they are 1356 not required to maintain transaction state. 1358 The example provided in Figure 3 depicts a request issued from the 1359 access device, NAS, for the user bob@example.com. The message is 1360 forwarded by the NAS to its relay, DRL, which does not have a routing 1361 entry in its Diameter Routing Table for example.com. DRL has a 1362 default route configured to DRD, which is a redirect agent that 1363 returns a redirect notification to DRL, as well as HMS' contact 1364 information. Upon receipt of the redirect notification, DRL 1365 establishes a transport connection with HMS, if one doesn't already 1366 exist, and forwards the request to it. 1368 +------+ 1369 | | 1370 | DRD | 1371 | | 1372 +------+ 1373 ^ | 1374 2. Request | | 3. Redirection 1375 | | Notification 1376 | v 1377 +------+ ---------> +------+ ---------> +------+ 1378 | | 1. Request | | 4. Request | | 1379 | NAS | | DRL | | HMS | 1380 | | 6. Answer | | 5. Answer | | 1381 +------+ <--------- +------+ <--------- +------+ 1382 example.net example.net example.com 1384 Figure 3: Redirecting a Diameter Message 1386 Since redirect agents do not perform any application level 1387 processing, they provide relaying services for all Diameter 1388 applications, and therefore MUST advertise the Relay Application 1389 Identifier. 1391 2.8.4. Translation Agents 1393 A translation agent is a device that provides translation between two 1394 protocols (e.g., RADIUS<->Diameter, TACACS+<->Diameter). Translation 1395 agents are likely to be used as aggregation servers to communicate 1396 with a Diameter infrastructure, while allowing for the embedded 1397 systems to be migrated at a slower pace. 1399 Given that the Diameter protocol introduces the concept of long-lived 1400 authorized sessions, translation agents MUST be session stateful and 1401 MUST maintain transaction state. 1403 Translation of messages can only occur if the agent recognizes the 1404 application of a particular request, and therefore translation agents 1405 MUST only advertise their locally supported applications. 1407 +------+ ---------> +------+ ---------> +------+ 1408 | | RADIUS Request | | Diameter Request | | 1409 | NAS | | TLA | | HMS | 1410 | | RADIUS Answer | | Diameter Answer | | 1411 +------+ <--------- +------+ <--------- +------+ 1412 example.net example.net example.com 1413 Figure 4: Translation of RADIUS to Diameter 1415 2.9. Diameter Path Authorization 1417 As noted in Section 2.2, Diameter provides transmission level 1418 security for each connection using TLS. Therefore, each connection 1419 can be authenticated, replay and integrity protected. 1421 In addition to authenticating each connection, each connection as 1422 well as the entire session MUST also be authorized. Before 1423 initiating a connection, a Diameter Peer MUST check that its peers 1424 are authorized to act in their roles. For example, a Diameter peer 1425 may be authentic, but that does not mean that it is authorized to act 1426 as a Diameter Server advertising a set of Diameter applications. 1428 Prior to bringing up a connection, authorization checks are performed 1429 at each connection along the path. Diameter capabilities negotiation 1430 (CER/CEA) also MUST be carried out, in order to determine what 1431 Diameter applications are supported by each peer. Diameter sessions 1432 MUST be routed only through authorized nodes that have advertised 1433 support for the Diameter application required by the session. 1435 As noted in Section 6.1.9, a relay or proxy agent MUST append a 1436 Route-Record AVP to all requests forwarded. The AVP contains the 1437 identity of the peer the request was received from. 1439 The home Diameter server, prior to authorizing a session, MUST check 1440 the Route-Record AVPs to make sure that the route traversed by the 1441 request is acceptable. For example, administrators within the home 1442 realm may not wish to honor requests that have been routed through an 1443 untrusted realm. By authorizing a request, the home Diameter server 1444 is implicitly indicating its willingness to engage in the business 1445 transaction as specified by the contractual relationship between the 1446 server and the previous hop. A DIAMETER_AUTHORIZATION_REJECTED error 1447 message (see Section 7.1.5) is sent if the route traversed by the 1448 request is unacceptable. 1450 A home realm may also wish to check that each accounting request 1451 message corresponds to a Diameter response authorizing the session. 1452 Accounting requests without corresponding authorization responses 1453 SHOULD be subjected to further scrutiny, as should accounting 1454 requests indicating a difference between the requested and provided 1455 service. 1457 Similarly, the local Diameter agent, on receiving a Diameter response 1458 authorizing a session, MUST check the Route-Record AVPs to make sure 1459 that the route traversed by the response is acceptable. At each 1460 step, forwarding of an authorization response is considered evidence 1461 of a willingness to take on financial risk relative to the session. 1462 A local realm may wish to limit this exposure, for example, by 1463 establishing credit limits for intermediate realms and refusing to 1464 accept responses which would violate those limits. By issuing an 1465 accounting request corresponding to the authorization response, the 1466 local realm implicitly indicates its agreement to provide the service 1467 indicated in the authorization response. If the service cannot be 1468 provided by the local realm, then a DIAMETER_UNABLE_TO_COMPLY error 1469 message MUST be sent within the accounting request; a Diameter client 1470 receiving an authorization response for a service that it cannot 1471 perform MUST NOT substitute an alternate service, and then send 1472 accounting requests for the alternate service instead. 1474 3. Diameter Header 1476 A summary of the Diameter header format is shown below. The fields 1477 are transmitted in network byte order. 1479 0 1 2 3 1480 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 1481 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1482 | Version | Message Length | 1483 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1484 | command flags | Command-Code | 1485 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1486 | Application-ID | 1487 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1488 | Hop-by-Hop Identifier | 1489 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1490 | End-to-End Identifier | 1491 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1492 | AVPs ... 1493 +-+-+-+-+-+-+-+-+-+-+-+-+- 1495 Version 1497 This Version field MUST be set to 1 to indicate Diameter Version 1498 1. 1500 Message Length 1502 The Message Length field is three octets and indicates the length 1503 of the Diameter message including the header fields. 1505 Command Flags 1507 The Command Flags field is eight bits. The following bits are 1508 assigned: 1510 0 1 2 3 4 5 6 7 1511 +-+-+-+-+-+-+-+-+ 1512 |R P E T r r r r| 1513 +-+-+-+-+-+-+-+-+ 1515 R(equest) 1517 If set, the message is a request. If cleared, the message is 1518 an answer. 1520 P(roxiable) 1522 If set, the message MAY be proxied, relayed or redirected. If 1523 cleared, the message MUST be locally processed. 1525 E(rror) 1527 If set, the message contains a protocol error, and the message 1528 will not conform to the ABNF described for this command. 1529 Messages with the 'E' bit set are commonly referred to as error 1530 messages. This bit MUST NOT be set in request messages. See 1531 Section 7.2. 1533 T(Potentially re-transmitted message) 1535 This flag is set after a link failover procedure, to aid the 1536 removal of duplicate requests. It is set when resending 1537 requests not yet acknowledged, as an indication of a possible 1538 duplicate due to a link failure. This bit MUST be cleared when 1539 sending a request for the first time, otherwise the sender MUST 1540 set this flag. Diameter agents only need to be concerned about 1541 the number of requests they send based on a single received 1542 request; retransmissions by other entities need not be tracked. 1543 Diameter agents that receive a request with the T flag set, 1544 MUST keep the T flag set in the forwarded request. This flag 1545 MUST NOT be set if an error answer message (e.g., a protocol 1546 error) has been received for the earlier message. It can be 1547 set only in cases where no answer has been received from the 1548 server for a request and the request is sent again. This flag 1549 MUST NOT be set in answer messages. 1551 r(eserved) 1553 These flag bits are reserved for future use, and MUST be set to 1554 zero, and ignored by the receiver. 1556 Command-Code 1558 The Command-Code field is three octets, and is used in order to 1559 communicate the command associated with the message. The 24-bit 1560 address space is managed by IANA (see Section 11.2.1). 1562 Command-Code values 16,777,214 and 16,777,215 (hexadecimal values 1563 FFFFFE -FFFFFF) are reserved for experimental use (See Section 1564 11.3). 1566 Application-ID 1568 Application-ID is four octets and is used to identify to which 1569 application the message is applicable for. The application can be 1570 an authentication application, an accounting application or a 1571 vendor specific application. See Section 11.3 for the possible 1572 values that the application-id may use. 1574 The application-id in the header MUST be the same as what is 1575 contained in any relevant application-id AVPs contained in the 1576 message. 1578 Hop-by-Hop Identifier 1580 The Hop-by-Hop Identifier is an unsigned 32-bit integer field (in 1581 network byte order) and aids in matching requests and replies. 1582 The sender MUST ensure that the Hop-by-Hop identifier in a request 1583 is unique on a given connection at any given time, and MAY attempt 1584 to ensure that the number is unique across reboots. The sender of 1585 an Answer message MUST ensure that the Hop-by-Hop Identifier field 1586 contains the same value that was found in the corresponding 1587 request. The Hop-by-Hop identifier is normally a monotonically 1588 increasing number, whose start value was randomly generated. An 1589 answer message that is received with an unknown Hop-by-Hop 1590 Identifier MUST be discarded. 1592 End-to-End Identifier 1594 The End-to-End Identifier is an unsigned 32-bit integer field (in 1595 network byte order) and is used to detect duplicate messages. 1596 Upon reboot implementations MAY set the high order 12 bits to 1597 contain the low order 12 bits of current time, and the low order 1598 20 bits to a random value. Senders of request messages MUST 1599 insert a unique identifier on each message. The identifier MUST 1600 remain locally unique for a period of at least 4 minutes, even 1601 across reboots. The originator of an Answer message MUST ensure 1602 that the End-to-End Identifier field contains the same value that 1603 was found in the corresponding request. The End-to-End Identifier 1604 MUST NOT be modified by Diameter agents of any kind. The 1605 combination of the Origin-Host (see Section 6.3) and this field is 1606 used to detect duplicates. Duplicate requests SHOULD cause the 1607 same answer to be transmitted (modulo the hop-by-hop Identifier 1608 field and any routing AVPs that may be present), and MUST NOT 1609 affect any state that was set when the original request was 1610 processed. Duplicate answer messages that are to be locally 1611 consumed (see Section 6.2) SHOULD be silently discarded. 1613 AVPs 1615 AVPs are a method of encapsulating information relevant to the 1616 Diameter message. See Section 4 for more information on AVPs. 1618 3.1. Command Codes 1620 Each command Request/Answer pair is assigned a command code, and the 1621 sub-type (i.e., request or answer) is identified via the 'R' bit in 1622 the Command Flags field of the Diameter header. 1624 Every Diameter message MUST contain a command code in its header's 1625 Command-Code field, which is used to determine the action that is to 1626 be taken for a particular message. The following Command Codes are 1627 defined in the Diameter base protocol: 1629 Command-Name Abbrev. Code Reference 1630 -------------------------------------------------------- 1631 Abort-Session-Request ASR 274 8.5.1 1632 Abort-Session-Answer ASA 274 8.5.2 1633 Accounting-Request ACR 271 9.7.1 1634 Accounting-Answer ACA 271 9.7.2 1635 Capabilities-Exchange- CER 257 5.3.1 1636 Request 1637 Capabilities-Exchange- CEA 257 5.3.2 1638 Answer 1639 Device-Watchdog-Request DWR 280 5.5.1 1640 Device-Watchdog-Answer DWA 280 5.5.2 1641 Disconnect-Peer-Request DPR 282 5.4.1 1642 Disconnect-Peer-Answer DPA 282 5.4.2 1643 Re-Auth-Request RAR 258 8.3.1 1644 Re-Auth-Answer RAA 258 8.3.2 1645 Session-Termination- STR 275 8.4.1 1646 Request 1647 Session-Termination- STA 275 8.4.2 1648 Answer 1650 3.2. Command Code ABNF specification 1652 Every Command Code defined MUST include a corresponding ABNF 1653 specification, which is used to define the AVPs that MUST or MAY be 1654 present. The following format is used in the definition: 1656 command-def = command-name "::=" diameter-message 1658 command-name = diameter-name 1659 diameter-name = ALPHA *(ALPHA / DIGIT / "-") 1661 diameter-message = header [ *fixed] [ *required] [ *optional] 1663 header = "<" "Diameter Header:" command-id 1664 [r-bit] [p-bit] [e-bit] [application-id] ">" 1666 application-id = 1*DIGIT 1668 command-id = 1*DIGIT 1669 ; The Command Code assigned to the command 1671 r-bit = ", REQ" 1672 ; If present, the 'R' bit in the Command 1673 ; Flags is set, indicating that the message 1674 ; is a request, as opposed to an answer. 1676 p-bit = ", PXY" 1677 ; If present, the 'P' bit in the Command 1678 ; Flags is set, indicating that the message 1679 ; is proxiable. 1681 e-bit = ", ERR" 1682 ; If present, the 'E' bit in the Command 1683 ; Flags is set, indicating that the answer 1684 ; message contains a Result-Code AVP in 1685 ; the "protocol error" class. 1687 fixed = [qual] "<" avp-spec ">" 1688 ; Defines the fixed position of an AVP 1690 required = [qual] "{" avp-spec "}" 1691 ; The AVP MUST be present and can appear 1692 ; anywhere in the message. 1694 optional = [qual] "[" avp-name "]" 1695 ; The avp-name in the 'optional' rule cannot 1696 ; evaluate to any AVP Name which is included 1697 ; in a fixed or required rule. The AVP can 1698 ; appear anywhere in the message. 1700 qual = [min] "*" [max] 1701 ; See ABNF conventions, RFC 2234 Section 6.6. 1702 ; The absence of any qualifiers depends on 1703 ; whether it precedes a fixed, required, or 1704 ; optional rule. If a fixed or required rule has 1705 ; no qualifier, then exactly one such AVP MUST 1706 ; be present. If an optional rule has no 1707 ; qualifier, then 0 or 1 such AVP may be 1708 ; present. 1709 ; 1710 ; NOTE: "[" and "]" have a different meaning 1711 ; than in ABNF (see the optional rule, above). 1712 ; These braces cannot be used to express 1713 ; optional fixed rules (such as an optional 1714 ; ICV at the end). To do this, the convention 1715 ; is '0*1fixed'. 1717 min = 1*DIGIT 1718 ; The minimum number of times the element may 1719 ; be present. The default value is zero. 1721 max = 1*DIGIT 1722 ; The maximum number of times the element may 1723 ; be present. The default value is infinity. A 1724 ; value of zero implies the AVP MUST NOT be 1725 ; present. 1727 avp-spec = diameter-name 1728 ; The avp-spec has to be an AVP Name, defined 1729 ; in the base or extended Diameter 1730 ; specifications. 1732 avp-name = avp-spec / "AVP" 1733 ; The string "AVP" stands for *any* arbitrary 1734 ; AVP Name, which does not conflict with the 1735 ; required or fixed position AVPs defined in 1736 ; the command code definition. 1738 The following is a definition of a fictitious command code: 1740 Example-Request ::= < Diameter Header: 9999999, REQ, PXY > 1741 { User-Name } 1742 * { Origin-Host } 1743 * [ AVP 1745 3.3. Diameter Command Naming Conventions 1747 Diameter command names typically includes one or more English words 1748 followed by the verb Request or Answer. Each English word is 1749 delimited by a hyphen. A three-letter acronym for both the request 1750 and answer is also normally provided. 1752 An example is a message set used to terminate a session. The command 1753 name is Session-Terminate-Request and Session-Terminate-Answer, while 1754 the acronyms are STR and STA, respectively. 1756 Both the request and the answer for a given command share the same 1757 command code. The request is identified by the R(equest) bit in the 1758 Diameter header set to one (1), to ask that a particular action be 1759 performed, such as authorizing a user or terminating a session. Once 1760 the receiver has completed the request it issues the corresponding 1761 answer, which includes a result code that communicates one of the 1762 following: 1764 o The request was successful 1766 o The request failed 1768 o An additional request must be sent to provide information the peer 1769 requires prior to returning a successful or failed answer. 1771 o The receiver could not process the request, but provides 1772 information about a Diameter peer that is able to satisfy the 1773 request, known as redirect. 1775 Additional information, encoded within AVPs, MAY also be included in 1776 answer messages. 1778 4. Diameter AVPs 1780 Diameter AVPs carry specific authentication, accounting, 1781 authorization and routing information as well as configuration 1782 details for the request and reply. 1784 Some AVPs MAY be listed more than once. The effect of such an AVP is 1785 specific, and is specified in each case by the AVP description. 1787 Each AVP of type OctetString MUST be padded to align on a 32-bit 1788 boundary, while other AVP types align naturally. A number of zero- 1789 valued bytes are added to the end of the AVP Data field till a word 1790 boundary is reached. The length of the padding is not reflected in 1791 the AVP Length field. 1793 4.1. AVP Header 1795 The fields in the AVP header MUST be sent in network byte order. The 1796 format of the header is: 1798 0 1 2 3 1799 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 1800 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1801 | AVP Code | 1802 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1803 |V M r r r r r r| AVP Length | 1804 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1805 | Vendor-ID (opt) | 1806 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1807 | Data ... 1808 +-+-+-+-+-+-+-+-+ 1810 AVP Code 1812 The AVP Code, combined with the Vendor-Id field, identifies the 1813 attribute uniquely. AVP numbers 1 through 255 are reserved for 1814 backward compatibility with RADIUS, without setting the Vendor-Id 1815 field. AVP numbers 256 and above are used for Diameter, which are 1816 allocated by IANA (see Section 11.1). 1818 AVP Flags 1820 The AVP Flags field informs the receiver how each attribute must 1821 be handled. The 'r' (reserved) bits are unused and SHOULD be set 1822 to 0. Note that subsequent Diameter applications MAY define 1823 additional bits within the AVP Header, and an unrecognized bit 1824 SHOULD be considered an error. 1826 The 'M' Bit, known as the Mandatory bit, indicates whether support 1827 of the AVP is required. If an AVP with the 'M' bit set is 1828 received by a Diameter client, server, proxy, or translation agent 1829 and either the AVP or its value is unrecognized, the message MUST 1830 be rejected. Diameter Relay and redirect agents MUST NOT reject 1831 messages with unrecognized AVPs. 1833 The 'M' bit MUST be set according to the rules defined for the AVP 1834 containing it. In order to preserve interoperability, a Diameter 1835 implementation MUST be able to exclude from a Diameter message any 1836 Mandatory AVP which is neither defined in the base Diameter 1837 protocol nor in any of the Diameter Application specifications 1838 governing the message in which it appears. It MAY do this in one 1839 of the following ways: 1841 1. If a message is rejected because it contains a Mandatory AVP 1842 which is neither defined in the base Diameter standard nor in 1843 any of the Diameter Application specifications governing the 1844 message in which it appears, the implementation may resend the 1845 message without the AVP, possibly inserting additional 1846 standard AVPs instead. 1848 2. A configuration option may be provided on a system wide, per 1849 peer, or per realm basis that would allow/prevent particular 1850 Mandatory AVPs to be sent. Thus an administrator could change 1851 the configuration to avoid interoperability problems. 1853 Diameter implementations are required to support all Mandatory 1854 AVPs which are allowed by the message's formal syntax and defined 1855 either in the base Diameter standard or in one of the Diameter 1856 Application specifications governing the message. 1858 AVPs with the 'M' bit cleared are informational only and a 1859 receiver that receives a message with such an AVP that is not 1860 supported, or whose value is not supported, MAY simply ignore the 1861 AVP. 1863 The 'V' bit, known as the Vendor-Specific bit, indicates whether 1864 the optional Vendor-ID field is present in the AVP header. When 1865 set the AVP Code belongs to the specific vendor code address 1866 space. 1868 Unless otherwise noted, AVPs will have the following default AVP 1869 Flags field settings: 1871 The 'M' bit MUST be set. The 'V' bit MUST NOT be set. 1873 AVP Length 1875 The AVP Length field is three octets, and indicates the number of 1876 octets in this AVP including the AVP Code, AVP Length, AVP Flags, 1877 Vendor-ID field (if present) and the AVP data. If a message is 1878 received with an invalid attribute length, the message SHOULD be 1879 rejected. 1881 4.1.1. Optional Header Elements 1883 The AVP Header contains one optional field. This field is only 1884 present if the respective bit-flag is enabled. 1886 Vendor-ID 1888 The Vendor-ID field is present if the 'V' bit is set in the AVP 1889 Flags field. The optional four-octet Vendor-ID field contains the 1890 IANA assigned "SMI Network Management Private Enterprise Codes" 1891 [RFC3232] value, encoded in network byte order. Any vendor 1892 wishing to implement a vendor-specific Diameter AVP MUST use their 1893 own Vendor-ID along with their privately managed AVP address 1894 space, guaranteeing that they will not collide with any other 1895 vendor's vendor-specific AVP(s), nor with future IETF 1896 applications. 1898 A vendor ID value of zero (0) corresponds to the IETF adopted AVP 1899 values, as managed by the IANA. Since the absence of the vendor 1900 ID field implies that the AVP in question is not vendor specific, 1901 implementations MUST NOT use the zero (0) vendor ID. 1903 4.2. Basic AVP Data Formats 1905 The Data field is zero or more octets and contains information 1906 specific to the Attribute. The format and length of the Data field 1907 is determined by the AVP Code and AVP Length fields. The format of 1908 the Data field MUST be one of the following base data types or a data 1909 type derived from the base data types. In the event that a new Basic 1910 AVP Data Format is needed, a new version of this RFC must be created. 1912 OctetString 1914 The data contains arbitrary data of variable length. Unless 1915 otherwise noted, the AVP Length field MUST be set to at least 8 1916 (12 if the 'V' bit is enabled). AVP Values of this type that are 1917 not a multiple of four-octets in length is followed by the 1918 necessary padding so that the next AVP (if any) will start on a 1919 32-bit boundary. 1921 Integer32 1923 32 bit signed value, in network byte order. The AVP Length field 1924 MUST be set to 12 (16 if the 'V' bit is enabled). 1926 Integer64 1928 64 bit signed value, in network byte order. The AVP Length field 1929 MUST be set to 16 (20 if the 'V' bit is enabled). 1931 Unsigned32 1933 32 bit unsigned value, in network byte order. The AVP Length 1934 field MUST be set to 12 (16 if the 'V' bit is enabled). 1936 Unsigned64 1938 64 bit unsigned value, in network byte order. The AVP Length 1939 field MUST be set to 16 (20 if the 'V' bit is enabled). 1941 Float32 1943 This represents floating point values of single precision as 1944 described by [FLOATPOINT]. The 32-bit value is transmitted in 1945 network byte order. The AVP Length field MUST be set to 12 (16 if 1946 the 'V' bit is enabled). 1948 Float64 1950 This represents floating point values of double precision as 1951 described by [FLOATPOINT]. The 64-bit value is transmitted in 1952 network byte order. The AVP Length field MUST be set to 16 (20 if 1953 the 'V' bit is enabled). 1955 Grouped 1957 The Data field is specified as a sequence of AVPs. Each of these 1958 AVPs follows - in the order in which they are specified - 1959 including their headers and padding. The AVP Length field is set 1960 to 8 (12 if the 'V' bit is enabled) plus the total length of all 1961 included AVPs, including their headers and padding. Thus the AVP 1962 length field of an AVP of type Grouped is always a multiple of 4. 1964 4.3. Derived AVP Data Formats 1966 In addition to using the Basic AVP Data Formats, applications may 1967 define data formats derived from the Basic AVP Data Formats. An 1968 application that defines new AVP Derived Data Formats MUST include 1969 them in a section entitled "AVP Derived Data Formats", using the same 1970 format as the definitions below. Each new definition must be either 1971 defined or listed with a reference to the RFC that defines the 1972 format. 1974 The below AVP Derived Data Formats are commonly used by applications. 1976 Address 1978 The Address format is derived from the OctetString AVP Base 1979 Format. It is a discriminated union, representing, for example a 1980 32-bit (IPv4) [IPV4] or 128-bit (IPv6) [RFC2373] address, most 1981 significant octet first. The first two octets of the Address AVP 1982 represents the AddressType, which contains an Address Family 1983 defined in [IANAADFAM]. The AddressType is used to discriminate 1984 the content and format of the remaining octets. 1986 Time 1988 The Time format is derived from the OctetString AVP Base Format. 1989 The string MUST contain four octets, in the same format as the 1990 first four bytes are in the NTP timestamp format. The NTP 1991 Timestamp format is defined in chapter 3 of [RFC2030]. 1993 This represents the number of seconds since 0h on 1 January 1900 1994 with respect to the Coordinated Universal Time (UTC). 1996 On 6h 28m 16s UTC, 7 February 2036 the time value will overflow. 1997 SNTP [RFC2030] describes a procedure to extend the time to 2104. 1998 This procedure MUST be supported by all DIAMETER nodes. 2000 UTF8String 2002 The UTF8String format is derived from the OctetString AVP Base 2003 Format. This is a human readable string represented using the 2004 ISO/IEC IS 10646-1 character set, encoded as an OctetString using 2005 the UTF-8 [RFC2279] transformation format described in RFC 2279. 2007 Since additional code points are added by amendments to the 10646 2008 standard from time to time, implementations MUST be prepared to 2009 encounter any code point from 0x00000001 to 0x7fffffff. Byte 2010 sequences that do not correspond to the valid encoding of a code 2011 point into UTF-8 charset or are outside this range are prohibited. 2013 The use of control codes SHOULD be avoided. When it is necessary 2014 to represent a new line, the control code sequence CR LF SHOULD be 2015 used. 2017 The use of leading or trailing white space SHOULD be avoided. 2019 For code points not directly supported by user interface hardware 2020 or software, an alternative means of entry and display, such as 2021 hexadecimal, MAY be provided. 2023 For information encoded in 7-bit US-ASCII, the UTF-8 charset is 2024 identical to the US-ASCII charset. 2026 UTF-8 may require multiple bytes to represent a single character / 2027 code point; thus the length of an UTF8String in octets may be 2028 different from the number of characters encoded. 2030 Note that the AVP Length field of an UTF8String is measured in 2031 octets, not characters. 2033 DiameterIdentity 2035 The DiameterIdentity format is derived from the OctetString AVP 2036 Base Format. 2038 DiameterIdentity = FQDN 2040 DiameterIdentity value is used to uniquely identify a Diameter 2041 node for purposes of duplicate connection and routing loop 2042 detection. 2044 The contents of the string MUST be the FQDN of the Diameter node. 2045 If multiple Diameter nodes run on the same host, each Diameter 2046 node MUST be assigned a unique DiameterIdentity. If a Diameter 2047 node can be identified by several FQDNs, a single FQDN should be 2048 picked at startup, and used as the only DiameterIdentity for that 2049 node, whatever the connection it is sent on. 2051 DiameterURI 2053 The DiameterURI MUST follow the Uniform Resource Identifiers (URI) 2054 syntax [RFC2396] rules specified below: 2056 "aaa://" FQDN [ port ] [ transport ] [ protocol ] 2058 ; No transport security 2060 "aaas://" FQDN [ port ] [ transport ] [ protocol ] 2062 ; Transport security used 2064 FQDN = Fully Qualified Host Name 2066 port = ":" 1*DIGIT 2068 ; One of the ports used to listen for 2069 ; incoming connections. 2070 ; If absent, 2071 ; the default Diameter port (3868) is 2072 ; assumed. 2074 transport = ";transport=" transport-protocol 2076 ; One of the transports used to listen 2077 ; for incoming connections. If absent, 2078 ; the default SCTP [RFC2960] protocol is 2079 ; assumed. UDP MUST NOT be used when 2080 ; the aaa-protocol field is set to 2081 ; diameter. 2083 transport-protocol = ( "tcp" / "sctp" / "udp" ) 2085 protocol = ";protocol=" aaa-protocol 2087 ; If absent, the default AAA protocol 2088 ; is diameter. 2090 aaa-protocol = ( "diameter" / "radius" / "tacacs+" ) 2092 The following are examples of valid Diameter host identities: 2094 aaa://host.example.com;transport=tcp 2095 aaa://host.example.com:6666;transport=tcp 2096 aaa://host.example.com;protocol=diameter 2097 aaa://host.example.com:6666;protocol=diameter 2098 aaa://host.example.com:6666;transport=tcp;protocol=diameter 2099 aaa://host.example.com:1813;transport=udp;protocol=radius 2101 Enumerated 2103 Enumerated is derived from the Integer32 AVP Base Format. The 2104 definition contains a list of valid values and their 2105 interpretation and is described in the Diameter application 2106 introducing the AVP. 2108 IPFilterRule 2110 The IPFilterRule format is derived from the OctetString AVP Base 2111 Format. It uses the ASCII charset. Packets may be filtered based 2112 on the following information that is associated with it: 2114 Direction (in or out) 2115 Source and destination IP address (possibly masked) 2116 Protocol 2117 Source and destination port (lists or ranges) 2118 TCP flags 2119 IP fragment flag 2120 IP options 2121 ICMP types 2123 Rules for the appropriate direction are evaluated in order, with 2124 the first matched rule terminating the evaluation. Each packet is 2125 evaluated once. If no rule matches, the packet is dropped if the 2126 last rule evaluated was a permit, and passed if the last rule was 2127 a deny. 2129 IPFilterRule filters MUST follow the format: 2131 action dir proto from src to dst [options] 2133 action permit - Allow packets that match the rule. 2134 deny - Drop packets that match the rule. 2136 dir "in" is from the terminal, "out" is to the 2137 terminal. 2139 proto An IP protocol specified by number. The "ip" 2140 keyword means any protocol will match. 2142 src and dst
[ports] 2144 The
may be specified as: 2145 ipno An IPv4 or IPv6 number in dotted- 2146 quad or canonical IPv6 form. Only 2147 this exact IP number will match the 2148 rule. 2149 ipno/bits An IP number as above with a mask 2150 width of the form 1.2.3.4/24. In 2151 this case, all IP numbers from 2152 1.2.3.0 to 1.2.3.255 will match. 2153 The bit width MUST be valid for the 2154 IP version and the IP number MUST 2155 NOT have bits set beyond the mask. 2156 For a match to occur, the same IP 2157 version must be present in the 2158 packet that was used in describing 2159 the IP address. To test for a 2160 particular IP version, the bits part 2161 can be set to zero. The keyword 2162 "any" is 0.0.0.0/0 or the IPv6 2163 equivalent. The keyword "assigned" 2164 is the address or set of addresses 2165 assigned to the terminal. For IPv4, 2166 a typical first rule is often "deny 2167 in ip! assigned" 2169 The sense of the match can be inverted by 2170 preceding an address with the not modifier (!), 2171 causing all other addresses to be matched 2172 instead. This does not affect the selection of 2173 port numbers. 2175 With the TCP, UDP and SCTP protocols, optional 2176 ports may be specified as: 2178 {port/port-port}[,ports[,...]] 2180 The '-' notation specifies a range of ports 2181 (including boundaries). 2183 Fragmented packets that have a non-zero offset 2184 (i.e., not the first fragment) will never match 2185 a rule that has one or more port 2186 specifications. See the frag option for 2187 details on matching fragmented packets. 2189 options: 2190 frag Match if the packet is a fragment and this is not 2191 the first fragment of the datagram. frag may not 2192 be used in conjunction with either tcpflags or 2193 TCP/UDP port specifications. 2195 ipoptions spec 2196 Match if the IP header contains the comma 2197 separated list of options specified in spec. The 2198 supported IP options are: 2200 ssrr (strict source route), lsrr (loose source 2201 route), rr (record packet route) and ts 2202 (timestamp). The absence of a particular option 2203 may be denoted with a '!'. 2205 tcpoptions spec 2206 Match if the TCP header contains the comma 2207 separated list of options specified in spec. The 2208 supported TCP options are: 2210 mss (maximum segment size), window (tcp window 2211 advertisement), sack (selective ack), ts (rfc1323 2212 timestamp) and cc (rfc1644 t/tcp connection 2213 count). The absence of a particular option may 2214 be denoted with a '!'. 2216 established 2217 TCP packets only. Match packets that have the RST 2218 or ACK bits set. 2220 setup TCP packets only. Match packets that have the SYN 2221 bit set but no ACK bit. 2223 tcpflags spec 2224 TCP packets only. Match if the TCP header 2225 contains the comma separated list of flags 2226 specified in spec. The supported TCP flags are: 2228 fin, syn, rst, psh, ack and urg. The absence of a 2229 particular flag may be denoted with a '!'. A rule 2230 that contains a tcpflags specification can never 2231 match a fragmented packet that has a non-zero 2232 offset. See the frag option for details on 2233 matching fragmented packets. 2235 icmptypes types 2236 ICMP packets only. Match if the ICMP type is in 2237 the list types. The list may be specified as any 2238 combination of ranges or individual types 2239 separated by commas. Both the numeric values and 2240 the symbolic values listed below can be used. The 2241 supported ICMP types are: 2243 echo reply (0), destination unreachable (3), 2244 source quench (4), redirect (5), echo request 2245 (8), router advertisement (9), router 2246 solicitation (10), time-to-live exceeded (11), IP 2247 header bad (12), timestamp request (13), 2248 timestamp reply (14), information request (15), 2249 information reply (16), address mask request (17) 2250 and address mask reply (18). 2252 There is one kind of packet that the access device MUST always 2253 discard, that is an IP fragment with a fragment offset of one. 2254 This is a valid packet, but it only has one use, to try to 2255 circumvent firewalls. 2257 An access device that is unable to interpret or apply a deny rule 2258 MUST terminate the session. An access device that is unable to 2259 interpret or apply a permit rule MAY apply a more restrictive 2260 rule. An access device MAY apply deny rules of its own before the 2261 supplied rules, for example to protect the access device owner's 2262 infrastructure. 2264 The rule syntax is a modified subset of ipfw(8) from FreeBSD, and 2265 the ipfw.c code may provide a useful base for implementations. 2267 QoSFilterRule 2269 The QosFilterRule format is derived from the OctetString AVP Base 2270 Format. It uses the ASCII charset. Packets may be marked or 2271 metered based on the following information that is associated with 2272 it: 2274 Direction (in or out) 2275 Source and destination IP address (possibly masked) 2276 Protocol 2277 Source and destination port (lists or ranges) 2278 DSCP values (no mask or range) 2280 Rules for the appropriate direction are evaluated in order, with 2281 the first matched rule terminating the evaluation. Each packet is 2282 evaluated once. If no rule matches, the packet is treated as best 2283 effort. An access device that is unable to interpret or apply a 2284 QoS rule SHOULD NOT terminate the session. 2286 QoSFilterRule filters MUST follow the format: 2288 action dir proto from src to dst [options] 2290 tag - Mark packet with a specific DSCP 2291 [RFC2474]. The DSCP option MUST be 2292 included. 2293 meter - Meter traffic. The metering options 2294 MUST be included. 2296 dir The format is as described under IPFilterRule. 2298 proto The format is as described under 2299 IPFilterRule. 2301 src and dst The format is as described under 2302 IPFilterRule. 2304 4.4. Grouped AVP Values 2306 The Diameter protocol allows AVP values of type 'Grouped.' This 2307 implies that the Data field is actually a sequence of AVPs. It is 2308 possible to include an AVP with a Grouped type within a Grouped type, 2309 that is, to nest them. AVPs within an AVP of type Grouped have the 2310 same padding requirements as non-Grouped AVPs, as defined in Section 2311 4. 2313 The AVP Code numbering space of all AVPs included in a Grouped AVP is 2314 the same as for non-grouped AVPs. Further, if any of the AVPs 2315 encapsulated within a Grouped AVP has the 'M' (mandatory) bit set, 2316 the Grouped AVP itself MUST also include the 'M' bit set. 2318 Every Grouped AVP defined MUST include a corresponding grammar, using 2319 ABNF [RFC2234] (with modifications), as defined below. 2321 grouped-avp-def = name "::=" avp 2323 name-fmt = ALPHA *(ALPHA / DIGIT / "-") 2325 name = name-fmt 2326 ; The name has to be the name of an AVP, 2327 ; defined in the base or extended Diameter 2328 ; specifications. 2330 avp = header [ *fixed] [ *required] [ *optional] 2331 [ *fixed] 2333 header = "<" "AVP-Header:" avpcode [vendor] ">" 2335 avpcode = 1*DIGIT 2336 ; The AVP Code assigned to the Grouped AVP 2338 vendor = 1*DIGIT 2339 ; The Vendor-ID assigned to the Grouped AVP. 2340 ; If absent, the default value of zero is 2341 ; used. 2343 4.4.1. Example AVP with a Grouped Data type 2345 The Example-AVP (AVP Code 999999) is of type Grouped and is used to 2346 clarify how Grouped AVP values work. The Grouped Data field has the 2347 following ABNF grammar: 2349 Example-AVP ::= < AVP Header: 999999 > 2350 { Origin-Host } 2351 1*{ Session-Id } 2352 *[ AVP ] 2354 An Example-AVP with Grouped Data follows. 2356 The Origin-Host AVP is required (Section 6.3). In this case: 2358 Origin-Host = "example.com". 2360 One or more Session-Ids must follow. Here there are two: 2362 Session-Id = 2363 "grump.example.com:33041;23432;893;0AF3B81" 2365 Session-Id = 2366 "grump.example.com:33054;23561;2358;0AF3B82" 2368 optional AVPs included are 2370 Recovery-Policy = 2371 2163bc1d0ad82371f6bc09484133c3f09ad74a0dd5346d54195a7cf0b35 2372 2cabc881839a4fdcfbc1769e2677a4c1fb499284c5f70b48f58503a45c5 2373 c2d6943f82d5930f2b7c1da640f476f0e9c9572a50db8ea6e51e1c2c7bd 2374 f8bb43dc995144b8dbe297ac739493946803e1cee3e15d9b765008a1b2a 2375 cf4ac777c80041d72c01e691cf751dbf86e85f509f3988e5875dc905119 2376 26841f00f0e29a6d1ddc1a842289d440268681e052b30fb638045f7779c 2377 1d873c784f054f688f5001559ecff64865ef975f3e60d2fd7966b8c7f92 2379 Futuristic-Acct-Record = 2380 fe19da5802acd98b07a5b86cb4d5d03f0314ab9ef1ad0b67111ff3b90a0 2381 57fe29620bf3585fd2dd9fcc38ce62f6cc208c6163c008f4258d1bc88b8 2382 17694a74ccad3ec69269461b14b2e7a4c111fb239e33714da207983f58c 2383 41d018d56fe938f3cbf089aac12a912a2f0d1923a9390e5f789cb2e5067 2384 d3427475e49968f841 2386 The data for the optional AVPs is represented in hex since the format 2387 of these AVPs is neither known at the time of definition of the 2388 Example-AVP group, nor (likely) at the time when the example instance 2389 of this AVP is interpreted - except by Diameter implementations which 2390 support the same set of AVPs. The encoding example illustrates how 2391 padding is used and how length fields are calculated. Also note that 2392 AVPs may be present in the Grouped AVP value which the receiver 2393 cannot interpret (here, the Recover-Policy and Futuristic-Acct-Record 2394 AVPs). 2396 This AVP would be encoded as follows: 2398 0 1 2 3 4 5 6 7 2399 +-------+-------+-------+-------+-------+-------+-------+-------+ 2400 0 | Example AVP Header (AVP Code = 999999), Length = 468 | 2401 +-------+-------+-------+-------+-------+-------+-------+-------+ 2402 8 | Origin-Host AVP Header (AVP Code = 264), Length = 19 | 2403 +-------+-------+-------+-------+-------+-------+-------+-------+ 2404 16 | 'e' | 'x' | 'a' | 'm' | 'p' | 'l' | 'e' | '.' | 2405 +-------+-------+-------+-------+-------+-------+-------+-------+ 2406 24 | 'c' | 'o' | 'm' |Padding| Session-Id AVP Header | 2407 +-------+-------+-------+-------+-------+-------+-------+-------+ 2408 32 | (AVP Code = 263), Length = 50 | 'g' | 'r' | 'u' | 'm' | 2409 +-------+-------+-------+-------+-------+-------+-------+-------+ 2410 . . . 2411 +-------+-------+-------+-------+-------+-------+-------+-------+ 2412 64 | 'A' | 'F' | '3' | 'B' | '8' | '1' |Padding|Padding| 2413 +-------+-------+-------+-------+-------+-------+-------+-------+ 2414 72 | Session-Id AVP Header (AVP Code = 263), Length = 51 | 2415 +-------+-------+-------+-------+-------+-------+-------+-------+ 2416 80 | 'g' | 'r' | 'u' | 'm' | 'p' | '.' | 'e' | 'x' | 2417 +-------+-------+-------+-------+-------+-------+-------+-------+ 2418 . . . 2419 +-------+-------+-------+-------+-------+-------+-------+-------+ 2420 104| '0' | 'A' | 'F' | '3' | 'B' | '8' | '2' |Padding| 2421 +-------+-------+-------+-------+-------+-------+-------+-------+ 2422 112| Recovery-Policy Header (AVP Code = 8341), Length = 223 | 2423 +-------+-------+-------+-------+-------+-------+-------+-------+ 2424 120| 0x21 | 0x63 | 0xbc | 0x1d | 0x0a | 0xd8 | 0x23 | 0x71 | 2425 +-------+-------+-------+-------+-------+-------+-------+-------+ 2426 . . . 2427 +-------+-------+-------+-------+-------+-------+-------+-------+ 2428 320| 0x2f | 0xd7 | 0x96 | 0x6b | 0x8c | 0x7f | 0x92 |Padding| 2429 +-------+-------+-------+-------+-------+-------+-------+-------+ 2430 328| Futuristic-Acct-Record Header (AVP Code = 15930), Length = 137| 2431 +-------+-------+-------+-------+-------+-------+-------+-------+ 2432 336| 0xfe | 0x19 | 0xda | 0x58 | 0x02 | 0xac | 0xd9 | 0x8b | 2433 +-------+-------+-------+-------+-------+-------+-------+-------+ 2434 . . . 2435 +-------+-------+-------+-------+-------+-------+-------+-------+ 2436 464| 0x41 |Padding|Padding|Padding| 2437 +-------+-------+-------+-------+ 2439 4.5. Diameter Base Protocol AVPs 2441 The following table describes the Diameter AVPs defined in the base 2442 protocol, their AVP Code values, types, possible flag values. 2444 Due to space constraints, the short form DiamIdent is used to 2445 represent DiameterIdentity. 2447 +---------------------+ 2448 | AVP Flag rules | 2449 |----+-----+----+-----| 2450 AVP Section | | |SHLD| MUST| 2451 Attribute Name Code Defined Data Type |MUST| MAY | NOT| NOT| 2452 -----------------------------------------|----+-----+----+-----| 2453 Acct- 85 9.8.2 Unsigned32 | M | P | | V | 2454 Interim-Interval | | | | | 2455 Accounting- 483 9.8.7 Enumerated | M | P | | V | 2456 Realtime-Required | | | | | 2457 Acct- 50 9.8.5 UTF8String | M | P | | V | 2458 Multi-Session-Id | | | | | 2459 Accounting- 485 9.8.3 Unsigned32 | M | P | | V | 2460 Record-Number | | | | | 2461 Accounting- 480 9.8.1 Enumerated | M | P | | V | 2462 Record-Type | | | | | 2463 Accounting- 44 9.8.4 OctetString| M | P | | V | 2464 Session-Id | | | | | 2465 Accounting- 287 9.8.6 Unsigned64 | M | P | | V | 2466 Sub-Session-Id | | | | | 2467 Acct- 259 6.9 Unsigned32 | M | P | | V | 2468 Application-Id | | | | | 2469 Auth- 258 6.8 Unsigned32 | M | P | | V | 2470 Application-Id | | | | | 2471 Auth-Request- 274 8.7 Enumerated | M | P | | V | 2472 Type | | | | | 2473 Authorization- 291 8.9 Unsigned32 | M | P | | V | 2474 Lifetime | | | | | 2475 Auth-Grace- 276 8.10 Unsigned32 | M | P | | V | 2476 Period | | | | | 2477 Auth-Session- 277 8.11 Enumerated | M | P | | V | 2478 State | | | | | 2479 Re-Auth-Request- 285 8.12 Enumerated | M | P | | V | 2480 Type | | | | | 2481 Class 25 8.20 OctetString| M | P | | V | 2482 Destination-Host 293 6.5 DiamIdent | M | P | | V | 2483 Destination- 283 6.6 DiamIdent | M | P | | V | 2484 Realm | | | | | 2485 Disconnect-Cause 273 5.4.3 Enumerated | M | P | | V | 2486 E2E-Sequence AVP 300 6.15 Grouped | M | P | | V | 2487 Error-Message 281 7.3 UTF8String | | P | | V,M | 2488 Error-Reporting- 294 7.4 DiamIdent | | P | | V,M | 2489 Host | | | | | 2490 Event-Timestamp 55 8.21 Time | M | P | | V | 2491 Experimental- 297 7.6 Grouped | M | P | | V | 2492 Result | | | | | 2493 -----------------------------------------|----+-----+----+-----| 2494 +---------------------+ 2495 | AVP Flag rules | 2496 |----+-----+----+-----| 2497 AVP Section | | |SHLD| MUST| 2498 Attribute Name Code Defined Data Type |MUST| MAY | NOT| NOT| 2499 -----------------------------------------|----+-----+----+-----| 2500 Experimental- 298 7.7 Unsigned32 | M | P | | V | 2501 Result-Code | | | | | 2502 Failed-AVP 279 7.5 Grouped | M | P | | V | 2503 Firmware- 267 5.3.4 Unsigned32 | | | |P,V,M| 2504 Revision | | | | | 2505 Host-IP-Address 257 5.3.5 Address | M | P | | V | 2506 Inband-Security | M | P | | V | 2507 -Id 299 6.10 Unsigned32 | | | | | 2508 Multi-Round- 272 8.19 Unsigned32 | M | P | | V | 2509 Time-Out | | | | | 2510 Origin-Host 264 6.3 DiamIdent | M | P | | V | 2511 Origin-Realm 296 6.4 DiamIdent | M | P | | V | 2512 Origin-State-Id 278 8.16 Unsigned32 | M | P | | V | 2513 Product-Name 269 5.3.7 UTF8String | | | |P,V,M| 2514 Proxy-Host 280 6.7.3 DiamIdent | M | | | P,V | 2515 Proxy-Info 284 6.7.2 Grouped | M | | | P,V | 2516 Proxy-State 33 6.7.4 OctetString| M | | | P,V | 2517 Redirect-Host 292 6.12 DiamURI | M | P | | V | 2518 Redirect-Host- 261 6.13 Enumerated | M | P | | V | 2519 Usage | | | | | 2520 Redirect-Max- 262 6.14 Unsigned32 | M | P | | V | 2521 Cache-Time | | | | | 2522 Result-Code 268 7.1 Unsigned32 | M | P | | V | 2523 Route-Record 282 6.7.1 DiamIdent | M | | | P,V | 2524 Session-Id 263 8.8 UTF8String | M | P | | V | 2525 Session-Timeout 27 8.13 Unsigned32 | M | P | | V | 2526 Session-Binding 270 8.17 Unsigned32 | M | P | | V | 2527 Session-Server- 271 8.18 Enumerated | M | P | | V | 2528 Failover | | | | | 2529 Supported- 265 5.3.6 Unsigned32 | M | P | | V | 2530 Vendor-Id | | | | | 2531 Termination- 295 8.15 Enumerated | M | P | | V | 2532 Cause | | | | | 2533 User-Name 1 8.14 UTF8String | M | P | | V | 2534 Vendor-Id 266 5.3.3 Unsigned32 | M | P | | V | 2535 Vendor-Specific- 260 6.11 Grouped | M | P | | V | 2536 Application-Id | | | | | 2537 -----------------------------------------|----+-----+----+-----| 2539 5. Diameter Peers 2541 This section describes how Diameter nodes establish connections and 2542 communicate with peers. 2544 5.1. Peer Connections 2546 Although a Diameter node may have many possible peers that it is able 2547 to communicate with, it may not be economical to have an established 2548 connection to all of them. At a minimum, a Diameter node SHOULD have 2549 an established connection with two peers per realm, known as the 2550 primary and secondary peers. Of course, a node MAY have additional 2551 connections, if it is deemed necessary. Typically, all messages for 2552 a realm are sent to the primary peer, but in the event that failover 2553 procedures are invoked, any pending requests are sent to the 2554 secondary peer. However, implementations are free to load balance 2555 requests between a set of peers. 2557 Note that a given peer MAY act as a primary for a given realm, while 2558 acting as a secondary for another realm. 2560 When a peer is deemed suspect, which could occur for various reasons, 2561 including not receiving a DWA within an allotted timeframe, no new 2562 requests should be forwarded to the peer, but failover procedures are 2563 invoked. When an active peer is moved to this mode, additional 2564 connections SHOULD be established to ensure that the necessary number 2565 of active connections exists. 2567 There are two ways that a peer is removed from the suspect peer list: 2569 1. The peer is no longer reachable, causing the transport connection 2570 to be shutdown. The peer is moved to the closed state. 2572 2. Three watchdog messages are exchanged with accepted round trip 2573 times, and the connection to the peer is considered stabilized. 2575 In the event the peer being removed is either the primary or 2576 secondary, an alternate peer SHOULD replace the deleted peer, and 2577 assume the role of either primary or secondary. 2579 5.2. Diameter Peer Discovery 2581 Allowing for dynamic Diameter agent discovery will make it possible 2582 for simpler and more robust deployment of Diameter services. In 2583 order to promote interoperable implementations of Diameter peer 2584 discovery, the following mechanisms are described. These are based 2585 on existing IETF standards. The first option (manual configuration) 2586 MUST be supported by all DIAMETER nodes, while the latter option 2587 (DNS) MAY be supported. 2589 There are two cases where Diameter peer discovery may be performed. 2590 The first is when a Diameter client needs to discover a first-hop 2591 Diameter agent. The second case is when a Diameter agent needs to 2592 discover another agent - for further handling of a Diameter 2593 operation. In both cases, the following 'search order' is 2594 recommended: 2596 1. The Diameter implementation consults its list of static 2597 (manually) configured Diameter agent locations. These will be 2598 used if they exist and respond. 2600 2. The Diameter implementation performs a NAPTR query for a server 2601 in a particular realm. The Diameter implementation has to know 2602 in advance which realm to look for a Diameter agent in. This 2603 could be deduced, for example, from the 'realm' in a NAI that a 2604 Diameter implementation needed to perform a Diameter operation 2605 on. 2607 * The services relevant for the task of transport protocol 2608 selection are those with NAPTR service fields with values 2609 "AAA+D2x", where x is a letter that corresponds to a transport 2610 protocol supported by the domain. This specification defines 2611 D2T for TCP and D2S for SCTP. We also establish an IANA 2612 registry for NAPTR service name to transport protocol 2613 mappings. 2615 These NAPTR records provide a mapping from a domain, to the 2616 SRV record for contacting a server with the specific transport 2617 protocol in the NAPTR services field. The resource record 2618 will contain an empty regular expression and a replacement 2619 value, which is the SRV record for that particular transport 2620 protocol. If the server supports multiple transport 2621 protocols, there will be multiple NAPTR records, each with a 2622 different service value. As per RFC 2915 [RFC2915], the 2623 client discards any records whose services fields are not 2624 applicable. For the purposes of this specification, several 2625 rules are defined. 2627 * A client MUST discard any service fields that identify a 2628 resolution service whose value is not "D2X", for values of X 2629 that indicate transport protocols supported by the client. 2630 The NAPTR processing as described in RFC 2915 will result in 2631 discovery of the most preferred transport protocol of the 2632 server that is supported by the client, as well as an SRV 2633 record for the server. 2635 The domain suffixes in the NAPTR replacement field SHOULD 2636 match the domain of the original query. 2638 3. If no NAPTR records are found, the requester queries for those 2639 address records for the destination address, 2640 '_diameter._sctp'.realm or '_diameter._tcp'.realm. Address 2641 records include A RR's, AAAA RR's or other similar records, 2642 chosen according to the requestor's network protocol 2643 capabilities. If the DNS server returns no address records, the 2644 requestor gives up. 2646 If the server is using a site certificate, the domain name in the 2647 query and the domain name in the replacement field MUST both be 2648 valid based on the site certificate handed out by the server in 2649 the TLS or IKE exchange. Similarly, the domain name in the SRV 2650 query and the domain name in the target in the SRV record MUST 2651 both be valid based on the same site certificate. Otherwise, an 2652 attacker could modify the DNS records to contain replacement 2653 values in a different domain, and the client could not validate 2654 that this was the desired behavior, or the result of an attack 2656 Also, the Diameter Peer MUST check to make sure that the 2657 discovered peers are authorized to act in its role. 2658 Authentication via IKE or TLS, or validation of DNS RRs via 2659 DNSSEC is not sufficient to conclude this. For example, a web 2660 server may have obtained a valid TLS certificate, and secured RRs 2661 may be included in the DNS, but this does not imply that it is 2662 authorized to act as a Diameter Server. 2664 Authorization can be achieved for example, by configuration of a 2665 Diameter Server CA. Alternatively this can be achieved by 2666 definition of OIDs within TLS or IKE certificates so as to 2667 signify Diameter Server authorization. 2669 A dynamically discovered peer causes an entry in the Peer Table (see 2670 Section 2.6) to be created. Note that entries created via DNS MUST 2671 expire (or be refreshed) within the DNS TTL. If a peer is discovered 2672 outside of the local realm, a routing table entry (see Section 2.7) 2673 for the peer's realm is created. The routing table entry's 2674 expiration MUST match the peer's expiration value. 2676 5.3. Capabilities Exchange 2678 When two Diameter peers establish a transport connection, they MUST 2679 exchange the Capabilities Exchange messages, as specified in the peer 2680 state machine (see Section 5.6). This message allows the discovery 2681 of a peer's identity and its capabilities (protocol version number, 2682 supported Diameter applications, security mechanisms, etc.) 2684 The receiver only issues commands to its peers that have advertised 2685 support for the Diameter application that defines the command. A 2686 Diameter node MUST cache the supported applications in order to 2687 ensure that unrecognized commands and/or AVPs are not unnecessarily 2688 sent to a peer. 2690 A receiver of a Capabilities-Exchange-Req (CER) message that does not 2691 have any applications in common with the sender MUST return a 2692 Capabilities-Exchange-Answer (CEA) with the Result-Code AVP set to 2693 DIAMETER_NO_COMMON_APPLICATION, and SHOULD disconnect the transport 2694 layer connection. Note that receiving a CER or CEA from a peer 2695 advertising itself as a Relay (see Section 2.4) MUST be interpreted 2696 as having common applications with the peer. 2698 The receiver of the Capabilities-Exchange-Request (CER) MUST 2699 determine common applications by computing the intersection of its 2700 own set of supported application identifiers against all of the 2701 application indentifier AVPs (Auth-Application-Id, 2702 Acct-Application-Id and Vendor-Specific-Application-Id) present in 2703 the CER. The value of the Vendor-Id AVP in the Vendor-Specific- 2704 Application-Id MUST not be used during computation. The sender of 2705 the Capabilities-Exchange-Answer (CEA) SHOULD include all of its 2706 supported applications as a hint to the receiver regarding all of its 2707 application capabilities. 2709 Similarly, a receiver of a Capabilities-Exchange-Req (CER) message 2710 that does not have any security mechanisms in common with the sender 2711 MUST return a Capabilities-Exchange-Answer (CEA) with the Result-Code 2712 AVP set to DIAMETER_NO_COMMON_SECURITY, and SHOULD disconnect the 2713 transport layer connection. 2715 CERs received from unknown peers MAY be silently discarded, or a CEA 2716 MAY be issued with the Result-Code AVP set to DIAMETER_UNKNOWN_PEER. 2717 In both cases, the transport connection is closed. If the local 2718 policy permits receiving CERs from unknown hosts, a successful CEA 2719 MAY be returned. If a CER from an unknown peer is answered with a 2720 successful CEA, the lifetime of the peer entry is equal to the 2721 lifetime of the transport connection. In case of a transport 2722 failure, all the pending transactions destined to the unknown peer 2723 can be discarded. 2725 The CER and CEA messages MUST NOT be proxied, redirected or relayed. 2727 Since the CER/CEA messages cannot be proxied, it is still possible 2728 that an upstream agent receives a message for which it has no 2729 available peers to handle the application that corresponds to the 2730 Command-Code. In such instances, the 'E' bit is set in the answer 2731 message (see Section 7.) with the Result-Code AVP set to 2732 DIAMETER_UNABLE_TO_DELIVER to inform the downstream to take action 2733 (e.g., re-routing request to an alternate peer). 2735 With the exception of the Capabilities-Exchange-Request message, a 2736 message of type Request that includes the Auth-Application-Id or 2737 Acct-Application-Id AVPs, or a message with an application-specific 2738 command code, MAY only be forwarded to a host that has explicitly 2739 advertised support for the application (or has advertised the Relay 2740 Application Identifier). 2742 5.3.1. Capabilities-Exchange-Request 2744 The Capabilities-Exchange-Request (CER), indicated by the Command- 2745 Code set to 257 and the Command Flags' 'R' bit set, is sent to 2746 exchange local capabilities. Upon detection of a transport failure, 2747 this message MUST NOT be sent to an alternate peer. 2749 When Diameter is run over SCTP [RFC2960], which allows for 2750 connections to span multiple interfaces and multiple IP addresses, 2751 the Capabilities-Exchange-Request message MUST contain one Host-IP- 2752 Address AVP for each potential IP address that MAY be locally used 2753 when transmitting Diameter messages. 2755 Message Format 2757 ::= < Diameter Header: 257, REQ > 2758 { Origin-Host } 2759 { Origin-Realm } 2760 1* { Host-IP-Address } 2761 { Vendor-Id } 2762 { Product-Name } 2763 [ Origin-State-Id ] 2764 * [ Supported-Vendor-Id ] 2765 * [ Auth-Application-Id ] 2766 * [ Inband-Security-Id ] 2767 * [ Acct-Application-Id ] 2768 * [ Vendor-Specific-Application-Id ] 2769 [ Firmware-Revision ] 2770 * [ AVP ] 2772 5.3.2. Capabilities-Exchange-Answer 2774 The Capabilities-Exchange-Answer (CEA), indicated by the Command-Code 2775 set to 257 and the Command Flags' 'R' bit cleared, is sent in 2776 response to a CER message. 2778 When Diameter is run over SCTP [RFC2960], which allows connections to 2779 span multiple interfaces, hence, multiple IP addresses, the 2780 Capabilities-Exchange-Answer message MUST contain one Host-IP-Address 2781 AVP for each potential IP address that MAY be locally used when 2782 transmitting Diameter messages. 2784 Message Format 2786 ::= < Diameter Header: 257 > 2787 { Result-Code } 2788 { Origin-Host } 2789 { Origin-Realm } 2790 1* { Host-IP-Address } 2791 { Vendor-Id } 2792 { Product-Name } 2793 [ Origin-State-Id ] 2794 [ Error-Message ] 2795 * [ Failed-AVP ] 2796 * [ Supported-Vendor-Id ] 2797 * [ Auth-Application-Id ] 2798 * [ Inband-Security-Id ] 2799 * [ Acct-Application-Id ] 2800 * [ Vendor-Specific-Application-Id ] 2801 [ Firmware-Revision ] 2802 * [ AVP ] 2804 5.3.3. Vendor-Id AVP 2806 The Vendor-Id AVP (AVP Code 266) is of type Unsigned32 and contains 2807 the IANA "SMI Network Management Private Enterprise Codes" [RFC3232] 2808 value assigned to the vendor of the Diameter application. In 2809 combination with the Supported-Vendor-Id AVP (Section 5.3.6), this 2810 MAY be used in order to know which vendor specific attributes may be 2811 sent to the peer. It is also envisioned that the combination of the 2812 Vendor-Id, Product-Name (Section 5.3.7) and the Firmware-Revision 2813 (Section 5.3.4) AVPs MAY provide very useful debugging information. 2815 A Vendor-Id value of zero in the CER or CEA messages is reserved and 2816 indicates that this field is ignored. 2818 5.3.4. Firmware-Revision AVP 2820 The Firmware-Revision AVP (AVP Code 267) is of type Unsigned32 and is 2821 used to inform a Diameter peer of the firmware revision of the 2822 issuing device. 2824 For devices that do not have a firmware revision (general purpose 2825 computers running Diameter software modules, for instance), the 2826 revision of the Diameter software module may be reported instead. 2828 5.3.5. Host-IP-Address AVP 2830 The Host-IP-Address AVP (AVP Code 257) is of type Address and is used 2831 to inform a Diameter peer of the sender's IP address. All source 2832 addresses that a Diameter node expects to use with SCTP [RFC2960] 2833 MUST be advertised in the CER and CEA messages by including a 2834 Host-IP- Address AVP for each address. This AVP MUST ONLY be used in 2835 the CER and CEA messages. 2837 5.3.6. Supported-Vendor-Id AVP 2839 The Supported-Vendor-Id AVP (AVP Code 265) is of type Unsigned32 and 2840 contains the IANA "SMI Network Management Private Enterprise Codes" 2841 [RFC3232] value assigned to a vendor other than the device vendor. 2842 This is used in the CER and CEA messages in order to inform the peer 2843 that the sender supports (a subset of) the vendor-specific AVPs 2844 defined by the vendor identified in this AVP. The value of this AVP 2845 SHOULD NOT be set to zero. Multiple instances of this AVP containing 2846 the same value SHOULD NOT be sent. 2848 5.3.7. Product-Name AVP 2850 The Product-Name AVP (AVP Code 269) is of type UTF8String, and 2851 contains the vendor assigned name for the product. The Product-Name 2852 AVP SHOULD remain constant across firmware revisions for the same 2853 product. 2855 5.4. Disconnecting Peer connections 2857 When a Diameter node disconnects one of its transport connections, 2858 its peer cannot know the reason for the disconnect, and will most 2859 likely assume that a connectivity problem occurred, or that the peer 2860 has rebooted. In these cases, the peer may periodically attempt to 2861 reconnect, as stated in Section 2.1. In the event that the 2862 disconnect was a result of either a shortage of internal resources, 2863 or simply that the node in question has no intentions of forwarding 2864 any Diameter messages to the peer in the foreseeable future, a 2865 periodic connection request would not be welcomed. The 2866 Disconnection-Reason AVP contains the reason the Diameter node issued 2867 the Disconnect-Peer-Request message. 2869 The Disconnect-Peer-Request message is used by a Diameter node to 2870 inform its peer of its intent to disconnect the transport layer, and 2871 that the peer shouldn't reconnect unless it has a valid reason to do 2872 so (e.g., message to be forwarded). Upon receipt of the message, the 2873 Disconnect-Peer-Answer is returned, which SHOULD contain an error if 2874 messages have recently been forwarded, and are likely in flight, 2875 which would otherwise cause a race condition. 2877 The receiver of the Disconnect-Peer-Answer initiates the transport 2878 disconnect. The sender of the Disconnect-Peer-Answer should be able 2879 to detect the transport closure and cleanup the connection. 2881 5.4.1. Disconnect-Peer-Request 2883 The Disconnect-Peer-Request (DPR), indicated by the Command-Code set 2884 to 282 and the Command Flags' 'R' bit set, is sent to a peer to 2885 inform its intentions to shutdown the transport connection. Upon 2886 detection of a transport failure, this message MUST NOT be sent to an 2887 alternate peer. 2889 Message Format 2891 ::= < Diameter Header: 282, REQ > 2892 { Origin-Host } 2893 { Origin-Realm } 2894 { Disconnect-Cause } 2896 5.4.2. Disconnect-Peer-Answer 2898 The Disconnect-Peer-Answer (DPA), indicated by the Command-Code set 2899 to 282 and the Command Flags' 'R' bit cleared, is sent as a response 2900 to the Disconnect-Peer-Request message. Upon receipt of this 2901 message, the transport connection is shutdown. 2903 Message Format 2905 ::= < Diameter Header: 282 > 2906 { Result-Code } 2907 { Origin-Host } 2908 { Origin-Realm } 2909 [ Error-Message ] 2910 * [ Failed-AVP ] 2912 5.4.3. Disconnect-Cause AVP 2914 The Disconnect-Cause AVP (AVP Code 273) is of type Enumerated. A 2915 Diameter node MUST include this AVP in the Disconnect-Peer-Request 2916 message to inform the peer of the reason for its intention to 2917 shutdown the transport connection. The following values are 2918 supported: 2920 REBOOTING 0 2921 A scheduled reboot is imminent. Receiver of DPR with above result 2922 code MAY attempt reconnection. 2924 BUSY 1 2925 The peer's internal resources are constrained, and it has 2926 determined that the transport connection needs to be closed. 2927 Receiver of DPR with above result code SHOULD NOT attempt 2928 reconnection. 2930 DO_NOT_WANT_TO_TALK_TO_YOU 2 2931 The peer has determined that it does not see a need for the 2932 transport connection to exist, since it does not expect any 2933 messages to be exchanged in the near future. Receiver of DPR 2934 with above result code SHOULD NOT attempt reconnection. 2936 5.5. Transport Failure Detection 2938 Given the nature of the Diameter protocol, it is recommended that 2939 transport failures be detected as soon as possible. Detecting such 2940 failures will minimize the occurrence of messages sent to unavailable 2941 agents, resulting in unnecessary delays, and will provide better 2942 failover performance. The Device-Watchdog-Request and Device- 2943 Watchdog-Answer messages, defined in this section, are used to pro- 2944 actively detect transport failures. 2946 5.5.1. Device-Watchdog-Request 2948 The Device-Watchdog-Request (DWR), indicated by the Command-Code set 2949 to 280 and the Command Flags' 'R' bit set, is sent to a peer when no 2950 traffic has been exchanged between two peers (see Section 5.5.3). 2951 Upon detection of a transport failure, this message MUST NOT be sent 2952 to an alternate peer. 2954 Message Format 2956 ::= < Diameter Header: 280, REQ > 2957 { Origin-Host } 2958 { Origin-Realm } 2959 [ Origin-State-Id ] 2961 5.5.2. Device-Watchdog-Answer 2963 The Device-Watchdog-Answer (DWA), indicated by the Command-Code set 2964 to 280 and the Command Flags' 'R' bit cleared, is sent as a response 2965 to the Device-Watchdog-Request message. 2967 Message Format 2969 ::= < Diameter Header: 280 > 2970 { Result-Code } 2971 { Origin-Host } 2972 { Origin-Realm } 2973 [ Error-Message ] 2974 * [ Failed-AVP ] 2975 [ Origin-State-Id ] 2977 5.5.3. Transport Failure Algorithm 2979 The transport failure algorithm is defined in [RFC3539]. All 2980 Diameter implementations MUST support the algorithm defined in the 2981 specification in order to be compliant to the Diameter base protocol. 2983 5.5.4. Failover and Failback Procedures 2985 In the event that a transport failure is detected with a peer, it is 2986 necessary for all pending request messages to be forwarded to an 2987 alternate agent, if possible. This is commonly referred to as 2988 failover. 2990 In order for a Diameter node to perform failover procedures, it is 2991 necessary for the node to maintain a pending message queue for a 2992 given peer. When an answer message is received, the corresponding 2993 request is removed from the queue. The Hop-by-Hop Identifier field 2994 is used to match the answer with the queued request. 2996 When a transport failure is detected, if possible all messages in the 2997 queue are sent to an alternate agent with the T flag set. On booting 2998 a Diameter client or agent, the T flag is also set on any records 2999 still remaining to be transmitted in non-volatile storage. An 3000 example of a case where it is not possible to forward the message to 3001 an alternate server is when the message has a fixed destination, and 3002 the unavailable peer is the message's final destination (see 3003 Destination-Host AVP). Such an error requires that the agent return 3004 an answer message with the 'E' bit set and the Result-Code AVP set to 3005 DIAMETER_UNABLE_TO_DELIVER. 3007 It is important to note that multiple identical requests or answers 3008 MAY be received as a result of a failover. The End-to-End Identifier 3009 field in the Diameter header along with the Origin-Host AVP MUST be 3010 used to identify duplicate messages. 3012 As described in Section 2.1, a connection request should be 3013 periodically attempted with the failed peer in order to re-establish 3014 the transport connection. Once a connection has been successfully 3015 established, messages can once again be forwarded to the peer. This 3016 is commonly referred to as failback. 3018 5.6. Peer State Machine 3020 This section contains a finite state machine that MUST be observed by 3021 all Diameter implementations. Each Diameter node MUST follow the 3022 state machine described below when communicating with each peer. 3023 Multiple actions are separated by commas, and may continue on 3024 succeeding lines, as space requires. Similarly, state and next state 3025 may also span multiple lines, as space requires. 3027 This state machine is closely coupled with the state machine 3028 described in [RFC3539], which is used to open, close, failover, 3029 probe, and reopen transport connections. Note in particular that 3030 [RFC3539] requires the use of watchdog messages to probe connections. 3031 For Diameter, DWR and DWA messages are to be used. 3033 I- is used to represent the initiator (connecting) connection, while 3034 the R- is used to represent the responder (listening) connection. 3035 The lack of a prefix indicates that the event or action is the same 3036 regardless of the connection on which the event occurred. 3038 The stable states that a state machine may be in are Closed, I-Open 3039 and R-Open; all other states are intermediate. Note that I-Open and 3040 R-Open are equivalent except for whether the initiator or responder 3041 transport connection is used for communication. 3043 A CER message is always sent on the initiating connection immediately 3044 after the connection request is successfully completed. In the case 3045 of an election, one of the two connections will shut down. The 3046 responder connection will survive if the Origin-Host of the local 3047 Diameter entity is higher than that of the peer; the initiator 3048 connection will survive if the peer's Origin-Host is higher. All 3049 subsequent messages are sent on the surviving connection. Note that 3050 the results of an election on one peer are guaranteed to be the 3051 inverse of the results on the other. 3053 For TLS usage, a TLS handshake will begin when both ends are in the 3054 open state. If the TLS handshake is successful, all further messages 3055 will be sent via TLS. If the handshake fails, both ends move to the 3056 closed state. 3058 The state machine constrains only the behavior of a Diameter 3059 implementation as seen by Diameter peers through events on the wire. 3061 Any implementation that produces equivalent results is considered 3062 compliant. 3064 state event action next state 3065 ----------------------------------------------------------------- 3066 Closed Start I-Snd-Conn-Req Wait-Conn-Ack 3067 R-Conn-CER R-Accept, R-Open 3068 Process-CER, 3069 R-Snd-CEA 3071 Wait-Conn-Ack I-Rcv-Conn-Ack I-Snd-CER Wait-I-CEA 3072 I-Rcv-Conn-Nack Cleanup Closed 3073 R-Conn-CER R-Accept, Wait-Conn-Ack/ 3074 Process-CER Elect 3075 Timeout Error Closed 3077 Wait-I-CEA I-Rcv-CEA Process-CEA I-Open 3078 R-Conn-CER R-Accept, Wait-Returns 3079 Process-CER, 3080 Elect 3081 I-Peer-Disc I-Disc Closed 3082 I-Rcv-Non-CEA Error Closed 3083 Timeout Error Closed 3085 Wait-Conn-Ack/ I-Rcv-Conn-Ack I-Snd-CER,Elect Wait-Returns 3086 Elect I-Rcv-Conn-Nack R-Snd-CEA R-Open 3087 R-Peer-Disc R-Disc Wait-Conn-Ack 3088 R-Conn-CER R-Reject Wait-Conn-Ack/ 3089 Elect 3090 Timeout Error Closed 3092 Wait-Returns Win-Election I-Disc,R-Snd-CEA R-Open 3093 I-Peer-Disc I-Disc, R-Open 3094 R-Snd-CEA 3095 I-Rcv-CEA R-Disc I-Open 3096 R-Peer-Disc R-Disc Wait-I-CEA 3097 R-Conn-CER R-Reject Wait-Returns 3098 Timeout Error Closed 3100 R-Open Send-Message R-Snd-Message R-Open 3101 R-Rcv-Message Process R-Open 3102 R-Rcv-DWR Process-DWR, R-Open 3103 R-Snd-DWA 3104 R-Rcv-DWA Process-DWA R-Open 3105 R-Conn-CER R-Reject R-Open 3106 Stop R-Snd-DPR Closing 3107 R-Rcv-DPR R-Snd-DPA, Closed 3108 R-Disc 3110 R-Peer-Disc R-Disc Closed 3111 R-Rcv-CER R-Snd-CEA R-Open 3112 R-Rcv-CEA Process-CEA R-Open 3114 I-Open Send-Message I-Snd-Message I-Open 3115 I-Rcv-Message Process I-Open 3116 I-Rcv-DWR Process-DWR, I-Open 3117 I-Snd-DWA 3118 I-Rcv-DWA Process-DWA I-Open 3119 R-Conn-CER R-Reject I-Open 3120 Stop I-Snd-DPR Closing 3121 I-Rcv-DPR I-Snd-DPA, Closed 3122 I-Disc 3123 I-Peer-Disc I-Disc Closed 3124 I-Rcv-CER I-Snd-CEA I-Open 3125 I-Rcv-CEA Process-CEA I-Open 3127 Closing I-Rcv-DPA I-Disc Closed 3128 R-Rcv-DPA R-Disc Closed 3129 Timeout Error Closed 3130 I-Peer-Disc I-Disc Closed 3131 R-Peer-Disc R-Disc Closed 3133 5.6.1. Incoming connections 3135 When a connection request is received from a Diameter peer, it is 3136 not, in the general case, possible to know the identity of that peer 3137 until a CER is received from it. This is because host and port 3138 determine the identity of a Diameter peer; and the source port of an 3139 incoming connection is arbitrary. Upon receipt of CER, the identity 3140 of the connecting peer can be uniquely determined from Origin-Host. 3142 For this reason, a Diameter peer must employ logic separate from the 3143 state machine to receive connection requests, accept them, and await 3144 CER. Once CER arrives on a new connection, the Origin-Host that 3145 identifies the peer is used to locate the state machine associated 3146 with that peer, and the new connection and CER are passed to the 3147 state machine as an R-Conn-CER event. 3149 The logic that handles incoming connections SHOULD close and discard 3150 the connection if any message other than CER arrives, or if an 3151 implementation-defined timeout occurs prior to receipt of CER. 3153 Because handling of incoming connections up to and including receipt 3154 of CER requires logic, separate from that of any individual state 3155 machine associated with a particular peer, it is described separately 3156 in this section rather than in the state machine above. 3158 5.6.2. Events 3160 Transitions and actions in the automaton are caused by events. In 3161 this section, we will ignore the -I and -R prefix, since the actual 3162 event would be identical, but would occur on one of two possible 3163 connections. 3165 Start The Diameter application has signaled that a 3166 connection should be initiated with the peer. 3168 R-Conn-CER An acknowledgement is received stating that the 3169 transport connection has been established, and the 3170 associated CER has arrived. 3172 Rcv-Conn-Ack A positive acknowledgement is received confirming that 3173 the transport connection is established. 3175 Rcv-Conn-Nack A negative acknowledgement was received stating that 3176 the transport connection was not established. 3178 Timeout An application-defined timer has expired while waiting 3179 for some event. 3181 Rcv-CER A CER message from the peer was received. 3183 Rcv-CEA A CEA message from the peer was received. 3185 Rcv-Non-CEA A message other than CEA from the peer was received. 3187 Peer-Disc A disconnection indication from the peer was received. 3189 Rcv-DPR A DPR message from the peer was received. 3191 Rcv-DPA A DPA message from the peer was received. 3193 Win-Election An election was held, and the local node was the 3194 winner. 3196 Send-Message A message is to be sent. 3198 Rcv-Message A message other than CER, CEA, DPR, DPA, DWR or DWA 3199 was received. 3201 Stop The Diameter application has signaled that a 3202 connection should be terminated (e.g., on system 3203 shutdown). 3205 5.6.3. Actions 3207 Actions in the automaton are caused by events and typically indicate 3208 the transmission of packets and/or an action to be taken on the 3209 connection. In this section we will ignore the I- and R-prefix, 3210 since the actual action would be identical, but would occur on one of 3211 two possible connections. 3213 Snd-Conn-Req A transport connection is initiated with the peer. 3215 Accept The incoming connection associated with the R-Conn-CER 3216 is accepted as the responder connection. 3218 Reject The incoming connection associated with the R-Conn-CER 3219 is disconnected. 3221 Process-CER The CER associated with the R-Conn-CER is processed. 3222 Snd-CER A CER message is sent to the peer. 3224 Snd-CEA A CEA message is sent to the peer. 3226 Cleanup If necessary, the connection is shutdown, and any 3227 local resources are freed. 3229 Error The transport layer connection is disconnected, either 3230 politely or abortively, in response to an error 3231 condition. Local resources are freed. 3233 Process-CEA A received CEA is processed. 3235 Snd-DPR A DPR message is sent to the peer. 3237 Snd-DPA A DPA message is sent to the peer. 3239 Disc The transport layer connection is disconnected, and 3240 local resources are freed. 3242 Elect An election occurs (see Section 5.6.4 for more 3243 information). 3245 Snd-Message A message is sent. 3247 Snd-DWR A DWR message is sent. 3249 Snd-DWA A DWA message is sent. 3251 Process-DWR The DWR message is serviced. 3253 Process-DWA The DWA message is serviced. 3255 Process A message is serviced. 3257 5.6.4. The Election Process 3259 The election is performed on the responder. The responder compares 3260 the Origin-Host received in the CER with its own Origin-Host as two 3261 streams of octets. If the local Origin-Host lexicographically 3262 succeeds the received Origin-Host a Win-Election event is issued 3263 locally. 3265 To be consistent with DNS case insensitivity, octets that fall in the 3266 ASCII range 'a' through 'z' MUST compare equally to their upper-case 3267 counterparts between 'A' and 'Z', i.e. value 0x41 compares equal to 3268 0x61, 0x42 to 0x62 and so forth up to and including 0x5a and 0x7a. 3270 The winner of the election MUST close the connection it initiated. 3271 Historically, maintaining the responder side of a connection was more 3272 efficient than maintaining the initiator side. However, current 3273 practices makes this distinction irrelevant. 3275 5.6.5. Capabilities Update 3277 A Diameter node MUST initiate peer capabilities update by sending a 3278 Capabilities-Exchange-Req (CER) to all its peers which supports peer 3279 capabilities update and is in OPEN state. The receiver of CER in 3280 open state MUST process and reply to the CER as a described in 3281 Section 5.3. The CEA which the receiver sends MUST contain its 3282 latest capabilities. Note that peers which successfully process the 3283 peer capabilities update SHOULD also update their routing tables to 3284 reflect the change. The receiver of the CEA, with a Result-Code AVP 3285 other than DIAMETER_SUCCESS, initiates the transport disconnect. The 3286 peer may periodically attempt to reconnect, as stated in Section 2.1. 3288 Peer capabilities update in the open state SHOULD be limited to the 3289 advertisement of the new list of supported applications and MUST 3290 preclude re-negotiation of security mechanism or other capabilities. 3291 If any capabilities change happens in the node (e.g. change in 3292 security mechanisms), other than a change in the supported 3293 applications, the node SHOULD gracefully terminate (setting the 3294 Disconnect-Cause AVP value to REBOOTING) and re-establish the 3295 diameter connections to all the peers. 3297 6. Diameter message processing 3299 This section describes how Diameter requests and answers are created 3300 and processed. 3302 6.1. Diameter Request Routing Overview 3304 A request is sent towards its final destination using a combination 3305 of the Destination-Realm and Destination-Host AVPs, in one of these 3306 three combinations: 3308 o a request that is not able to be proxied (such as CER) MUST NOT 3309 contain either Destination-Realm or Destination-Host AVPs. 3311 o a request that needs to be sent to a home server serving a 3312 specific realm, but not to a specific server (such as the first 3313 request of a series of round-trips), MUST contain a Destination- 3314 Realm AVP, but MUST NOT contain a Destination-Host AVP. 3316 o otherwise, a request that needs to be sent to a specific home 3317 server among those serving a given realm, MUST contain both the 3318 Destination-Realm and Destination-Host AVPs. 3320 The Destination-Host AVP is used as described above when the 3321 destination of the request is fixed, which includes: 3323 o Authentication requests that span multiple round trips 3325 o A Diameter message that uses a security mechanism that makes use 3326 of a pre-established session key shared between the source and the 3327 final destination of the message. 3329 o Server initiated messages that MUST be received by a specific 3330 Diameter client (e.g., access device), such as the Abort-Session- 3331 Request message, which is used to request that a particular user's 3332 session be terminated. 3334 Note that an agent can forward a request to a host described in the 3335 Destination-Host AVP only if the host in question is included in its 3336 peer table (see Section 2.7). Otherwise, the request is routed based 3337 on the Destination-Realm only (see Sections 6.1.6). 3339 The Destination-Realm AVP MUST be present if the message is 3340 proxiable. Request messages that may be forwarded by Diameter agents 3341 (proxies, redirects or relays) MUST also contain an Acct- 3342 Application-Id AVP, an Auth-Application-Id AVP or a Vendor-Specific- 3343 Application-Id AVP. A message that MUST NOT be forwarded by Diameter 3344 agents (proxies, redirects or relays) MUST not include the 3345 Destination-Realm in its ABNF. The value of the Destination-Realm 3346 AVP MAY be extracted from the User-Name AVP, or other application- 3347 specific methods. 3349 When a message is received, the message is processed in the following 3350 order: 3352 o If the message is destined for the local host, the procedures 3353 listed in Section 6.1.4 are followed. 3355 o If the message is intended for a Diameter peer with whom the local 3356 host is able to directly communicate, the procedures listed in 3357 Section 6.1.5 are followed. This is known as Request Forwarding. 3359 o The procedures listed in Section 6.1.6 are followed, which is 3360 known as Request Routing. 3362 o If none of the above is successful, an answer is returned with the 3363 Result-Code set to DIAMETER_UNABLE_TO_DELIVER, with the E-bit set. 3365 For routing of Diameter messages to work within an administrative 3366 domain, all Diameter nodes within the realm MUST be peers. 3368 Note the processing rules contained in this section are intended to 3369 be used as general guidelines to Diameter developers. Certain 3370 implementations MAY use different methods than the ones described 3371 here, and still comply with the protocol specification. See Section 3372 7 for more detail on error handling. 3374 6.1.1. Originating a Request 3376 When creating a request, in addition to any other procedures 3377 described in the application definition for that specific request, 3378 the following procedures MUST be followed: 3380 o the Command-Code is set to the appropriate value 3382 o the 'R' bit is set 3384 o the End-to-End Identifier is set to a locally unique value 3386 o the Origin-Host and Origin-Realm AVPs MUST be set to the 3387 appropriate values, used to identify the source of the message 3389 o the Destination-Host and Destination-Realm AVPs MUST be set to the 3390 appropriate values as described in Section 6.1. 3392 o an Acct-Application-Id AVP, an Auth-Application-Id or a Vendor- 3393 Specific-Application-Id AVP must be included if the request is 3394 proxiable. The application id present in one of these relevant 3395 AVPs must match the application id present in the diameter message 3396 header. 3398 6.1.2. Sending a Request 3400 When sending a request, originated either locally, or as the result 3401 of a forwarding or routing operation, the following procedures MUST 3402 be followed: 3404 o the Hop-by-Hop Identifier should be set to a locally unique value. 3406 o The message should be saved in the list of pending requests. 3408 Other actions to perform on the message based on the particular role 3409 the agent is playing are described in the following sections. 3411 6.1.3. Receiving Requests 3413 A relay or proxy agent MUST check for forwarding loops when receiving 3414 requests. A loop is detected if the server finds its own identity in 3415 a Route-Record AVP. When such an event occurs, the agent MUST answer 3416 with the Result-Code AVP set to DIAMETER_LOOP_DETECTED. 3418 6.1.4. Processing Local Requests 3420 A request is known to be for local consumption when one of the 3421 following conditions occur: 3423 o The Destination-Host AVP contains the local host's identity, 3425 o The Destination-Host AVP is not present, the Destination-Realm AVP 3426 contains a realm the server is configured to process locally, and 3427 the Diameter application is locally supported, or 3429 o Both the Destination-Host and the Destination-Realm are not 3430 present. 3432 When a request is locally processed, the rules in Section 6.2 should 3433 be used to generate the corresponding answer. 3435 6.1.5. Request Forwarding 3437 Request forwarding is done using the Diameter Peer Table. The 3438 Diameter peer table contains all of the peers that the local node is 3439 able to directly communicate with. 3441 When a request is received, and the host encoded in the Destination- 3442 Host AVP is one that is present in the peer table, the message SHOULD 3443 be forwarded to the peer. 3445 6.1.6. Request Routing 3447 Diameter request message routing is done via realms and applications. 3448 A Diameter message that may be forwarded by Diameter agents (proxies, 3449 redirects or relays) MUST include the target realm in the 3450 Destination-Realm AVP. Request routing SHOULD rely on the 3451 Destination-Realm AVP and the application id present in the request 3452 message header to aid in the routing decision. It MAY also rely on 3453 the application identification AVPs Auth-Application-Id, Acct- 3454 Application-Id or Vendor-Specific-Application-Id instead of the 3455 application id in the message header as a secondary measure. The 3456 realm MAY be retrieved from the User-Name AVP, which is in the form 3457 of a Network Access Identifier (NAI). The realm portion of the NAI 3458 is inserted in the Destination-Realm AVP. 3460 Diameter agents MAY have a list of locally supported realms and 3461 applications, and MAY have a list of externally supported realms and 3462 applications. When a request is received that includes a realm 3463 and/or application that is not locally supported, the message is 3464 routed to the peer configured in the Routing Table (see Section 2.7). 3466 Realm names and application identifiers are the minimum supported 3467 routing criteria, additional routing information maybe needed to 3468 support redirect semantics. 3470 6.1.7. Predictive Loop Avoidance 3472 Before forwarding or routing a request, Diameter agents, in addition 3473 to processing done in Section 6.1.3, SHOULD check for the presence of 3474 candidate route's peer identity in any of the Route-Record AVPs. In 3475 an event of the agent detecting the presence of a candidate route's 3476 peer identity in a Route-Record AVP, the agent MUST ignore such route 3477 for the Diameter request message and attempt alternate routes if any. 3478 In case all the candidate routes are eliminated by the above 3479 criteria, the agent SHOULD return DIAMETER_UNABLE_TO_DELIVER message. 3481 6.1.8. Redirecting requests 3483 When a redirect agent receives a request whose routing entry is set 3484 to REDIRECT, it MUST reply with an answer message with the 'E' bit 3485 set, while maintaining the Hop-by-Hop Identifier in the header, and 3486 include the Result-Code AVP to DIAMETER_REDIRECT_INDICATION. Each of 3487 the servers associated with the routing entry are added in separate 3488 Redirect-Host AVP. 3490 +------------------+ 3491 | Diameter | 3492 | Redirect Agent | 3493 +------------------+ 3494 ^ | 2. command + 'E' bit 3495 1. Request | | Result-Code = 3496 joe@example.com | | DIAMETER_REDIRECT_INDICATION + 3497 | | Redirect-Host AVP(s) 3498 | v 3499 +-------------+ 3. Request +-------------+ 3500 | example.com |------------->| example.net | 3501 | Relay | | Diameter | 3502 | Agent |<-------------| Server | 3503 +-------------+ 4. Answer +-------------+ 3505 Figure 5: Diameter Redirect Agent 3507 The receiver of the answer message with the 'E' bit set, and the 3508 Result-Code AVP set to DIAMETER_REDIRECT_INDICATION uses the hop-by- 3509 hop field in the Diameter header to identify the request in the 3510 pending message queue (see Section 5.3) that is to be redirected. If 3511 no transport connection exists with the new agent, one is created, 3512 and the request is sent directly to it. 3514 Multiple Redirect-Host AVPs are allowed. The receiver of the answer 3515 message with the 'E' bit set selects exactly one of these hosts as 3516 the destination of the redirected message. 3518 When the Redirect-Host-Usage AVP included in the answer message has a 3519 non-zero value, a route entry for the redirect indications is created 3520 and cached by the receiver. The redirect usage for such route entry 3521 is set by the value of Redirect-Host-Usage AVP and the lifetime of 3522 the cached route entry is set by Redirect-Max-Cache-Time AVP value. 3524 It is possible that multiple redirect indications can create multiple 3525 cached route entries differing only in their redirect usage and the 3526 peer to forward messages to. As an example, two(2) route entries 3527 that are created by two(2) redirect indications results in two(2) 3528 cached routes for the same realm and application Id. However, one 3529 has a redirect usage of ALL_SESSION where matching request will be 3530 forwarded to one peer and the other has a redirect usage of ALL_REALM 3531 where request are forwarded to another peer. Therefore, an incoming 3532 request that matches the realm and application Id of both routes will 3533 need additional resolution. In such a case, a routing precedence 3534 rule MUST be used againts the redirect usage value to resolve the 3535 contention. The precedence rule can be found in Section 6.13. 3537 6.1.9. Relaying and Proxying Requests 3539 A relay or proxy agent MUST append a Route-Record AVP to all requests 3540 forwarded. The AVP contains the identity of the peer the request was 3541 received from. 3543 The Hop-by-Hop identifier in the request is saved, and replaced with 3544 a locally unique value. The source of the request is also saved, 3545 which includes the IP address, port and protocol. 3547 A relay or proxy agent MAY include the Proxy-Info AVP in requests if 3548 it requires access to any local state information when the 3549 corresponding response is received. Proxy-Info AVP has certain 3550 security implications and SHOULD contain an embedded HMAC with a 3551 node-local key. Alternatively, it MAY simply use local storage to 3552 store state information. 3554 The message is then forwarded to the next hop, as identified in the 3555 Routing Table. 3557 Figure 6 provides an example of message routing using the procedures 3558 listed in these sections. 3560 (Origin-Host=nas.mno.net) (Origin-Host=nas.mno.net) 3561 (Origin-Realm=mno.net) (Origin-Realm=mno.net) 3562 (Destination-Realm=example.com) (Destination- 3563 Realm=example.com) 3564 (Route-Record=nas.example.net) 3565 +------+ ------> +------+ ------> +------+ 3566 | | (Request) | | (Request) | | 3567 | NAS +-------------------+ DRL +-------------------+ HMS | 3568 | | | | | | 3569 +------+ <------ +------+ <------ +------+ 3570 example.net (Answer) example.net (Answer) example.com 3571 (Origin-Host=hms.example.com) (Origin-Host=hms.example.com) 3572 (Origin-Realm=example.com) (Origin-Realm=example.com) 3574 Figure 6: Routing of Diameter messages 3576 Relay agents do not require full validation of incoming messages. At 3577 a minimum, validation of the message header and relevant routing AVPs 3578 has to be done when relaying messages. 3580 6.2. Diameter Answer Processing 3582 When a request is locally processed, the following procedures MUST be 3583 applied to create the associated answer, in addition to any 3584 additional procedures that MAY be discussed in the Diameter 3585 application defining the command: 3587 o The same Hop-by-Hop identifier in the request is used in the 3588 answer. 3590 o The local host's identity is encoded in the Origin-Host AVP. 3592 o The Destination-Host and Destination-Realm AVPs MUST NOT be 3593 present in the answer message. 3595 o The Result-Code AVP is added with its value indicating success or 3596 failure. 3598 o If the Session-Id is present in the request, it MUST be included 3599 in the answer. 3601 o Any Proxy-Info AVPs in the request MUST be added to the answer 3602 message, in the same order they were present in the request. 3604 o The 'P' bit is set to the same value as the one in the request. 3606 o The same End-to-End identifier in the request is used in the 3607 answer. 3609 Note that the error messages (see Section 7.3) are also subjected to 3610 the above processing rules. 3612 6.2.1. Processing received Answers 3614 A Diameter client or proxy MUST match the Hop-by-Hop Identifier in an 3615 answer received against the list of pending requests. The 3616 corresponding message should be removed from the list of pending 3617 requests. It SHOULD ignore answers received that do not match a 3618 known Hop-by-Hop Identifier. 3620 6.2.2. Relaying and Proxying Answers 3622 If the answer is for a request which was proxied or relayed, the 3623 agent MUST restore the original value of the Diameter header's Hop- 3624 by-Hop Identifier field. 3626 If the last Proxy-Info AVP in the message is targeted to the local 3627 Diameter server, the AVP MUST be removed before the answer is 3628 forwarded. 3630 If a relay or proxy agent receives an answer with a Result-Code AVP 3631 indicating a failure, it MUST NOT modify the contents of the AVP. 3632 Any additional local errors detected SHOULD be logged, but not 3633 reflected in the Result-Code AVP. If the agent receives an answer 3634 message with a Result-Code AVP indicating success, and it wishes to 3635 modify the AVP to indicate an error, it MUST modify the Result-Code 3636 AVP to contain the appropriate error in the message destined towards 3637 the access device as well as include the Error-Reporting-Host AVP and 3638 it MUST issue an STR on behalf of the access device. 3640 The agent MUST then send the answer to the host that it received the 3641 original request from. 3643 6.3. Origin-Host AVP 3645 The Origin-Host AVP (AVP Code 264) is of type DiameterIdentity, and 3646 MUST be present in all Diameter messages. This AVP identifies the 3647 endpoint that originated the Diameter message. Relay agents MUST NOT 3648 modify this AVP. 3650 The value of the Origin-Host AVP is guaranteed to be unique within a 3651 single host. 3653 Note that the Origin-Host AVP may resolve to more than one address as 3654 the Diameter peer may support more than one address. 3656 This AVP SHOULD be placed as close to the Diameter header as 3657 possible. 6.10 3659 6.4. Origin-Realm AVP 3661 The Origin-Realm AVP (AVP Code 296) is of type DiameterIdentity. 3662 This AVP contains the Realm of the originator of any Diameter message 3663 and MUST be present in all messages. 3665 This AVP SHOULD be placed as close to the Diameter header as 3666 possible. 3668 6.5. Destination-Host AVP 3670 The Destination-Host AVP (AVP Code 293) is of type DiameterIdentity. 3671 This AVP MUST be present in all unsolicited agent initiated messages, 3672 MAY be present in request messages, and MUST NOT be present in Answer 3673 messages. 3675 The absence of the Destination-Host AVP will cause a message to be 3676 sent to any Diameter server supporting the application within the 3677 realm specified in Destination-Realm AVP. 3679 This AVP SHOULD be placed as close to the Diameter header as 3680 possible. 3682 6.6. Destination-Realm AVP 3684 The Destination-Realm AVP (AVP Code 283) is of type DiameterIdentity, 3685 and contains the realm the message is to be routed to. The 3686 Destination-Realm AVP MUST NOT be present in Answer messages. 3687 Diameter Clients insert the realm portion of the User-Name AVP. 3688 Diameter servers initiating a request message use the value of the 3689 Origin-Realm AVP from a previous message received from the intended 3690 target host (unless it is known a priori). When present, the 3691 Destination-Realm AVP is used to perform message routing decisions. 3693 Request messages whose ABNF does not list the Destination-Realm AVP 3694 as a mandatory AVP are inherently non-routable messages. 3696 This AVP SHOULD be placed as close to the Diameter header as 3697 possible. 3699 6.7. Routing AVPs 3701 The AVPs defined in this section are Diameter AVPs used for routing 3702 purposes. These AVPs change as Diameter messages are processed by 3703 agents. 3705 6.7.1. Route-Record AVP 3707 The Route-Record AVP (AVP Code 282) is of type DiameterIdentity. The 3708 identity added in this AVP MUST be the same as the one received in 3709 the Origin-Host of the Capabilities Exchange message. 3711 6.7.2. Proxy-Info AVP 3713 The Proxy-Info AVP (AVP Code 284) is of type Grouped. The Grouped 3714 Data field has the following ABNF grammar: 3716 Proxy-Info ::= < AVP Header: 284 > 3717 { Proxy-Host } 3718 { Proxy-State } 3719 * [ AVP ] 3721 6.7.3. Proxy-Host AVP 3723 The Proxy-Host AVP (AVP Code 280) is of type DiameterIdentity. This 3724 AVP contains the identity of the host that added the Proxy-Info AVP. 3726 6.7.4. Proxy-State AVP 3728 The Proxy-State AVP (AVP Code 33) is of type OctetString, and 3729 contains state local information, and MUST be treated as opaque data. 3731 6.8. Auth-Application-Id AVP 3733 The Auth-Application-Id AVP (AVP Code 258) is of type Unsigned32 and 3734 is used in order to advertise support of the Authentication and 3735 Authorization portion of an application (see Section 2.4). The Auth- 3736 Application-Id MUST also be present in all Authentication and/or 3737 Authorization messages that are defined in a separate Diameter 3738 specification and have an Application ID assigned. If present in a 3739 message, the value of the Auth-Application-Id AVP MUST match the 3740 application id present in the diameter message header except when 3741 used in a CER or CEA messages. 3743 6.9. Acct-Application-Id AVP 3745 The Acct-Application-Id AVP (AVP Code 259) is of type Unsigned32 and 3746 is used in order to advertise support of the Accounting portion of an 3747 application (see Section 2.4). The Acct-Application-Id MUST also be 3748 present in all Accounting messages. Exactly one of the Auth- 3749 Application-Id and Acct-Application-Id AVPs MAY be present. If 3750 present in a message, the value of the Acct-Application-Id AVP MUST 3751 match the application id present in the diameter message header 3752 except when used in a CER or CEA messages. 3754 6.10. Inband-Security-Id AVP 3756 The Inband-Security-Id AVP (AVP Code 299) is of type Unsigned32 and 3757 is used in order to advertise support of the Security portion of the 3758 application. 3760 Currently, the following values are supported, but there is ample 3761 room to add new security Ids. 3763 NO_INBAND_SECURITY 0 3765 This peer does not support TLS. This is the default value, if the 3766 AVP is omitted. 3768 TLS 1 3770 This node supports TLS security, as defined by [RFC2246]. 3772 6.11. Vendor-Specific-Application-Id AVP 3774 The Vendor-Specific-Application-Id AVP (AVP Code 260) is of type 3775 Grouped and is used to advertise support of a vendor-specific 3776 Diameter Application. Exactly one instance of Auth-Application-Id or 3777 Acct-Application-Id AVP MAY be present. The application identifier 3778 carried by either Auth-Application-Id or Acct-Application-Id AVP MUST 3779 comply with vendor specific application identifier assignment 3780 described in Sec 11.3. It MUST also match the application id present 3781 in the diameter header except when used in a CER or CEA messages. 3783 The Vendor-Id AVP is an informational AVP pertaining to the vendor 3784 who may have authorship of the vendor-specific diameter application. 3785 It should not be used as a means of defining a completely separate 3786 vendor-specific application identifier space. 3788 This AVP MUST also be present as the first AVP in all experimental 3789 commands defined in the vendor-specific application. 3791 This AVP SHOULD be placed as close to the Diameter header as 3792 possible. 3794 AVP Format 3796 ::= < AVP Header: 260 > 3797 { Vendor-Id } 3798 { Auth-Application-Id } / 3799 { Acct-Application-Id } 3801 6.12. Redirect-Host AVP 3803 One or more of instances of this AVP MUST be present if the answer 3804 message's 'E' bit is set and the Result-Code AVP is set to 3805 DIAMETER_REDIRECT_INDICATION. 3807 Upon receiving the above, the receiving Diameter node SHOULD forward 3808 the request directly to one of the hosts identified in these AVPs. 3809 The server contained in the selected Redirect-Host AVP SHOULD be used 3810 for all messages pertaining to this session. 3812 6.13. Redirect-Host-Usage AVP 3814 The Redirect-Host-Usage AVP (AVP Code 261) is of type Enumerated. 3815 This AVP MAY be present in answer messages whose 'E' bit is set and 3816 the Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION. 3818 When present, this AVP dictates how the routing entry resulting from 3819 the Redirect-Host is to be used. The following values are supported: 3821 DONT_CACHE 0 3823 The host specified in the Redirect-Host AVP should not be cached. 3824 This is the default value. 3826 ALL_SESSION 1 3828 All messages within the same session, as defined by the same value 3829 of the Session-ID AVP MAY be sent to the host specified in the 3830 Redirect-Host AVP. 3832 ALL_REALM 2 3834 All messages destined for the realm requested MAY be sent to the 3835 host specified in the Redirect-Host AVP. 3837 REALM_AND_APPLICATION 3 3839 All messages for the application requested to the realm specified 3840 MAY be sent to the host specified in the Redirect-Host AVP. 3842 ALL_APPLICATION 4 3844 All messages for the application requested MAY be sent to the host 3845 specified in the Redirect-Host AVP. 3847 ALL_HOST 5 3849 All messages that would be sent to the host that generated the 3850 Redirect-Host MAY be sent to the host specified in the Redirect- 3851 Host AVP. 3853 ALL_USER 6 3855 All messages for the user requested MAY be sent to the host 3856 specified in the Redirect-Host AVP. 3858 When multiple cached routes are created by redirect indications and 3859 they differs only in redirect usage and peers to forward requests to 3860 (see Section 6.1.8), a precedence rule MUST be applied to the 3861 redirect usage values of the cached routes during normal routing to 3862 resolve contentions that may occur. The precedence rule is the order 3863 that dictate which redirect usage should be considered before any 3864 other as they appear. The order is as follows: 3866 1. ALL_SESSION 3868 2. ALL_USER 3870 3. REALM_AND_APPLICATION 3872 4. ALL_REALM 3874 5. ALL_APPLICATION 3876 6. ALL_HOST 3878 6.14. Redirect-Max-Cache-Time AVP 3880 The Redirect-Max-Cache-Time AVP (AVP Code 262) is of type Unsigned32. 3881 This AVP MUST be present in answer messages whose 'E' bit is set, the 3882 Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION and the 3883 Redirect-Host-Usage AVP set to a non-zero value. 3885 This AVP contains the maximum number of seconds the peer and route 3886 table entries, created as a result of the Redirect-Host, will be 3887 cached. Note that once a host created due to a redirect indication 3888 is no longer reachable, any associated peer and routing table entries 3889 MUST be deleted. 3891 6.15. E2E-Sequence AVP 3893 The E2E-Sequence AVP (AVP Code 300) provides anti-replay protection 3894 for end to end messages and is of type grouped. It contains a random 3895 value (an OctetString with a nonce) and counter (an Integer). For 3896 each end-to-end peer with which a node communicates (or remembers 3897 communicating) a different nonce value MUST be used and the counter 3898 is initiated at zero and increases by one each time this AVP is 3899 emitted to that peer. 3901 7. Error Handling 3903 There are two different types of errors in Diameter; protocol and 3904 application errors. A protocol error is one that occurs at the base 3905 protocol level, and MAY require per hop attention (e.g., message 3906 routing error). Application errors, on the other hand, generally 3907 occur due to a problem with a function specified in a Diameter 3908 application (e.g., user authentication, Missing AVP). 3910 Result-Code AVP values that are used to report protocol errors MUST 3911 only be present in answer messages whose 'E' bit is set. When a 3912 request message is received that causes a protocol error, an answer 3913 message is returned with the 'E' bit set, and the Result-Code AVP is 3914 set to the appropriate protocol error value. As the answer is sent 3915 back towards the originator of the request, each proxy or relay agent 3916 MAY take action on the message. 3918 1. Request +---------+ Link Broken 3919 +-------------------------->|Diameter |----///----+ 3920 | +---------------------| | v 3921 +------+--+ | 2. answer + 'E' set | Relay 2 | +--------+ 3922 |Diameter |<-+ (Unable to Forward) +---------+ |Diameter| 3923 | | | Home | 3924 | Relay 1 |--+ +---------+ | Server | 3925 +---------+ | 3. Request |Diameter | +--------+ 3926 +-------------------->| | ^ 3927 | Relay 3 |-----------+ 3928 +---------+ 3930 Figure 7: Example of Protocol Error causing answer message 3932 Figure 7 provides an example of a message forwarded upstream by a 3933 Diameter relay. When the message is received by Relay 2, and it 3934 detects that it cannot forward the request to the home server, an 3935 answer message is returned with the 'E' bit set and the Result-Code 3936 AVP set to DIAMETER_UNABLE_TO_DELIVER. Given that this error falls 3937 within the protocol error category, Relay 1 would take special 3938 action, and given the error, attempt to route the message through its 3939 alternate Relay 3. 3941 +---------+ 1. Request +---------+ 2. Request +---------+ 3942 | Access |------------>|Diameter |------------>|Diameter | 3943 | | | | | Home | 3944 | Device |<------------| Relay |<------------| Server | 3945 +---------+ 4. Answer +---------+ 3. Answer +---------+ 3946 (Missing AVP) (Missing AVP) 3948 Figure 8: Example of Application Error Answer message 3950 Figure 8 provides an example of a Diameter message that caused an 3951 application error. When application errors occur, the Diameter 3952 entity reporting the error clears the 'R' bit in the Command Flags, 3953 and adds the Result-Code AVP with the proper value. Application 3954 errors do not require any proxy or relay agent involvement, and 3955 therefore the message would be forwarded back to the originator of 3956 the request. 3958 There are certain Result-Code AVP application errors that require 3959 additional AVPs to be present in the answer. In these cases, the 3960 Diameter node that sets the Result-Code AVP to indicate the error 3961 MUST add the AVPs. Examples are: 3963 o An unrecognized AVP is received with the 'M' bit (Mandatory bit) 3964 set, causes an answer to be sent with the Result-Code AVP set to 3965 DIAMETER_AVP_UNSUPPORTED, and the Failed-AVP AVP containing the 3966 offending AVP. 3968 o An AVP that is received with an unrecognized value causes an 3969 answer to be returned with the Result-Code AVP set to 3970 DIAMETER_INVALID_AVP_VALUE, with the Failed-AVP AVP containing the 3971 AVP causing the error. 3973 o A command is received with an AVP that is omitted, yet is 3974 mandatory according to the command's ABNF. The receiver issues an 3975 answer with the Result-Code set to DIAMETER_MISSING_AVP, and 3976 creates an AVP with the AVP Code and other fields set as expected 3977 in the missing AVP. The created AVP is then added to the Failed- 3978 AVP AVP. 3980 The Result-Code AVP describes the error that the Diameter node 3981 encountered in its processing. In case there are multiple errors, 3982 the Diameter node MUST report only the first error it encountered 3983 (detected possibly in some implementation dependent order). The 3984 specific errors that can be described by this AVP are described in 3985 the following section. 3987 7.1. Result-Code AVP 3989 The Result-Code AVP (AVP Code 268) is of type Unsigned32 and 3990 indicates whether a particular request was completed successfully or 3991 whether an error occurred. All Diameter answer messages defined in 3992 IETF applications MUST include one Result-Code AVP. A non-successful 3993 Result-Code AVP (one containing a non 2xxx value other than 3994 DIAMETER_REDIRECT_INDICATION) MUST include the Error-Reporting-Host 3995 AVP if the host setting the Result-Code AVP is different from the 3996 identity encoded in the Origin-Host AVP. 3998 The Result-Code data field contains an IANA-managed 32-bit address 3999 space representing errors (see Section 11.4). Diameter provides the 4000 following classes of errors, all identified by the thousands digit in 4001 the decimal notation: 4003 o 1xxx (Informational) 4005 o 2xxx (Success) 4007 o 3xxx (Protocol Errors) 4009 o 4xxx (Transient Failures) 4011 o 5xxx (Permanent Failure) 4013 A non-recognized class (one whose first digit is not defined in this 4014 section) MUST be handled as a permanent failure. 4016 7.1.1. Informational 4018 Errors that fall within this category are used to inform the 4019 requester that a request could not be satisfied, and additional 4020 action is required on its part before access is granted. 4022 DIAMETER_MULTI_ROUND_AUTH 1001 4024 This informational error is returned by a Diameter server to 4025 inform the access device that the authentication mechanism being 4026 used requires multiple round trips, and a subsequent request needs 4027 to be issued in order for access to be granted. 4029 7.1.2. Success 4031 Errors that fall within the Success category are used to inform a 4032 peer that a request has been successfully completed. 4034 DIAMETER_SUCCESS 2001 4036 The Request was successfully completed. 4038 DIAMETER_LIMITED_SUCCESS 2002 4040 When returned, the request was successfully completed, but 4041 additional processing is required by the application in order to 4042 provide service to the user. 4044 7.1.3. Protocol Errors 4046 Errors that fall within the Protocol Error category SHOULD be treated 4047 on a per-hop basis, and Diameter proxies MAY attempt to correct the 4048 error, if it is possible. Note that these and only these errors MUST 4049 only be used in answer messages whose 'E' bit is set. To provide 4050 backward compatibility with existing implementations that follow 4051 [RFC3588], some of the error values that have previously been used in 4052 this category by [RFC3588] will not be re-used. Therefore the error 4053 values enumerated here maybe non-sequential. 4055 DIAMETER_UNABLE_TO_DELIVER 3002 4057 This error is given when Diameter can not deliver the message to 4058 the destination, either because no host within the realm 4059 supporting the required application was available to process the 4060 request, or because Destination-Host AVP was given without the 4061 associated Destination-Realm AVP. 4063 DIAMETER_REALM_NOT_SERVED 3003 4065 The intended realm of the request is not recognized. 4067 DIAMETER_TOO_BUSY 3004 4069 When returned, a Diameter node SHOULD attempt to send the message 4070 to an alternate peer. This error MUST only be used when a 4071 specific server is requested, and it cannot provide the requested 4072 service. 4074 DIAMETER_LOOP_DETECTED 3005 4076 An agent detected a loop while trying to get the message to the 4077 intended recipient. The message MAY be sent to an alternate peer, 4078 if one is available, but the peer reporting the error has 4079 identified a configuration problem. 4081 DIAMETER_REDIRECT_INDICATION 3006 4083 A redirect agent has determined that the request could not be 4084 satisfied locally and the initiator of the request should direct 4085 the request directly to the server, whose contact information has 4086 been added to the response. When set, the Redirect-Host AVP MUST 4087 be present. 4089 DIAMETER_APPLICATION_UNSUPPORTED 3007 4091 A request was sent for an application that is not supported. 4093 DIAMETER_INVALID_BIT_IN_HEADER 3011 4095 This error is returned when an unrecognized bit in the Diameter 4096 header is set to one (1). 4098 DIAMETER_INVALID_MESSAGE_LENGTH 3012 4100 This error is returned when a request is received with an invalid 4101 message length. 4103 7.1.4. Transient Failures 4105 Errors that fall within the transient failures category are used to 4106 inform a peer that the request could not be satisfied at the time it 4107 was received, but MAY be able to satisfy the request in the future. 4108 Note that these errors MUST be used in answer messages whose 'E' bit 4109 is not set. 4111 DIAMETER_AUTHENTICATION_REJECTED 4001 4113 The authentication process for the user failed, most likely due to 4114 an invalid password used by the user. Further attempts MUST only 4115 be tried after prompting the user for a new password. 4117 DIAMETER_OUT_OF_SPACE 4002 4119 A Diameter node received the accounting request but was unable to 4120 commit it to stable storage due to a temporary lack of space. 4122 ELECTION_LOST 4003 4124 The peer has determined that it has lost the election process and 4125 has therefore disconnected the transport connection. 4127 7.1.5. Permanent Failures 4129 Errors that fall within the permanent failures category are used to 4130 inform the peer that the request failed, and should not be attempted 4131 again. Note that these errors SHOULD be used in answer messages 4132 whose 'E' bit is not set. In error conditions where it is not 4133 possible or efficient to compose application specific answer grammar 4134 then answer messages with E-bit set and complying to the grammar 4135 described in 7.2 MAY also be used for permanent errors. 4137 To provide backward compatibility with existing implementations that 4138 follow [RFC3588], some of the error values that have previously been 4139 used in this category by [RFC3588] will not be re-used. Therefore 4140 the error values enumerated here maybe non-sequential. 4142 DIAMETER_AVP_UNSUPPORTED 5001 4144 The peer received a message that contained an AVP that is not 4145 recognized or supported and was marked with the Mandatory bit. A 4146 Diameter message with this error MUST contain one or more Failed- 4147 AVP AVP containing the AVPs that caused the failure. 4149 DIAMETER_UNKNOWN_SESSION_ID 5002 4151 The request contained an unknown Session-Id. 4153 DIAMETER_AUTHORIZATION_REJECTED 5003 4155 A request was received for which the user could not be authorized. 4156 This error could occur if the service requested is not permitted 4157 to the user. 4159 DIAMETER_INVALID_AVP_VALUE 5004 4161 The request contained an AVP with an invalid value in its data 4162 portion. A Diameter message indicating this error MUST include 4163 the offending AVPs within a Failed-AVP AVP. 4165 DIAMETER_MISSING_AVP 5005 4167 The request did not contain an AVP that is required by the Command 4168 Code definition. If this value is sent in the Result-Code AVP, a 4169 Failed-AVP AVP SHOULD be included in the message. The Failed-AVP 4170 AVP MUST contain an example of the missing AVP complete with the 4171 Vendor-Id if applicable. The value field of the missing AVP 4172 should be of correct minimum length and contain zeroes. 4174 DIAMETER_RESOURCES_EXCEEDED 5006 4176 A request was received that cannot be authorized because the user 4177 has already expended allowed resources. An example of this error 4178 condition is a user that is restricted to one dial-up PPP port, 4179 attempts to establish a second PPP connection. 4181 DIAMETER_CONTRADICTING_AVPS 5007 4183 The Home Diameter server has detected AVPs in the request that 4184 contradicted each other, and is not willing to provide service to 4185 the user. One or more Failed-AVP AVPs MUST be present, containing 4186 the AVPs that contradicted each other. 4188 DIAMETER_AVP_NOT_ALLOWED 5008 4190 A message was received with an AVP that MUST NOT be present. The 4191 Failed-AVP AVP MUST be included and contain a copy of the 4192 offending AVP. 4194 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES 5009 4196 A message was received that included an AVP that appeared more 4197 often than permitted in the message definition. The Failed-AVP 4198 AVP MUST be included and contain a copy of the first instance of 4199 the offending AVP that exceeded the maximum number of occurrences 4201 DIAMETER_NO_COMMON_APPLICATION 5010 4203 This error is returned by a Diameter node that is not acting as a 4204 relay when it receives a CER which advertises a set of 4205 applications that it does not support. 4207 DIAMETER_UNSUPPORTED_VERSION 5011 4209 This error is returned when a request was received, whose version 4210 number is unsupported. 4212 DIAMETER_UNABLE_TO_COMPLY 5012 4214 This error is returned when a request is rejected for unspecified 4215 reasons. 4217 DIAMETER_INVALID_AVP_LENGTH 5014 4219 The request contained an AVP with an invalid length. A Diameter 4220 message indicating this error MUST include the offending AVPs 4221 within a Failed-AVP AVP. In cases where the erroneous avp length 4222 value exceeds the message length or is less than the minimum AVP 4223 header length, it is sufficient to include the offending AVP 4224 header and a zero filled payload of the minimum required length. 4226 DIAMETER_NO_COMMON_SECURITY 5017 4228 This error is returned when a CER message is received, and there 4229 are no common security mechanisms supported between the peers. A 4230 Capabilities-Exchange-Answer (CEA) MUST be returned with the 4231 Result-Code AVP set to DIAMETER_NO_COMMON_SECURITY. 4233 DIAMETER_UNKNOWN_PEER 5018 4235 A CER was received from an unknown peer. 4237 DIAMETER_COMMAND_UNSUPPORTED 5019 4239 The Request contained a Command-Code that the receiver did not 4240 recognize or support. This MUST be used when a Diameter node 4241 receives an experimental command that it does not understand. 4243 DIAMETER_INVALID_HDR_BITS 5020 4245 A request was received whose bits in the Diameter header were 4246 either set to an invalid combination, or to a value that is 4247 inconsistent with the command code's definition. 4249 DIAMETER_INVALID_AVP_BITS 5021 4251 A request was received that included an AVP whose flag bits are 4252 set to an unrecognized value, or that is inconsistent with the 4253 AVP's definition. 4255 7.2. Error Bit 4257 The 'E' (Error Bit) in the Diameter header is set when the request 4258 caused a protocol-related error (see Section 7.1.3). A message with 4259 the 'E' bit MUST NOT be sent as a response to an answer message. 4260 Note that a message with the 'E' bit set is still subjected to the 4261 processing rules defined in Section 6.2. When set, the answer 4262 message will not conform to the ABNF specification for the command, 4263 and will instead conform to the following ABNF: 4265 Message Format 4267 ::= < Diameter Header: code, ERR [PXY] > 4268 0*1< Session-Id > 4269 { Origin-Host } 4270 { Origin-Realm } 4271 { Result-Code } 4272 [ Origin-State-Id ] 4273 [ Error-Reporting-Host ] 4274 [ Proxy-Info ] 4275 * [ AVP ] 4277 Note that the code used in the header is the same than the one found 4278 in the request message, but with the 'R' bit cleared and the 'E' bit 4279 set. The 'P' bit in the header is set to the same value as the one 4280 found in the request message. 4282 7.3. Error-Message AVP 4284 The Error-Message AVP (AVP Code 281) is of type UTF8String. It MAY 4285 accompany a Result-Code AVP as a human readable error message. The 4286 Error-Message AVP is not intended to be useful in real-time, and 4287 SHOULD NOT be expected to be parsed by network entities. 4289 7.4. Error-Reporting-Host AVP 4291 The Error-Reporting-Host AVP (AVP Code 294) is of type 4292 DiameterIdentity. This AVP contains the identity of the Diameter 4293 host that sent the Result-Code AVP to a value other than 2001 4294 (Success), only if the host setting the Result-Code is different from 4295 the one encoded in the Origin-Host AVP. This AVP is intended to be 4296 used for troubleshooting purposes, and MUST be set when the Result- 4297 Code AVP indicates a failure. 4299 7.5. Failed-AVP AVP 4301 The Failed-AVP AVP (AVP Code 279) is of type Grouped and provides 4302 debugging information in cases where a request is rejected or not 4303 fully processed due to erroneous information in a specific AVP. The 4304 value of the Result-Code AVP will provide information on the reason 4305 for the Failed-AVP AVP. A Diameter message SHOULD contain only one 4306 Failed-AVP that corresponds to the error indicated by the Result-Code 4307 AVP. For practical purposes, this Failed-AVP would typically refer 4308 to the first AVP processing error that a Diameter node encounters. 4310 The possible reasons for this AVP are the presence of an improperly 4311 constructed AVP, an unsupported or unrecognized AVP, an invalid AVP 4312 value, the omission of a required AVP, the presence of an explicitly 4313 excluded AVP (see tables in Section 10), or the presence of two or 4314 more occurrences of an AVP which is restricted to 0, 1, or 0-1 4315 occurrences. 4317 A Diameter message SHOULD contain one Failed-AVP AVP, containing the 4318 entire AVP that could not be processed successfully. If the failure 4319 reason is omission of a required AVP, an AVP with the missing AVP 4320 code, the missing vendor id, and a zero filled payload of the minimum 4321 required length for the omitted AVP will be added. If the failure 4322 reason is an invalid AVP length where the reported length is less 4323 than the minimum AVP header length or greater than the reported 4324 message length, a copy of the offending AVP header and a zero filled 4325 payload of the minimum required length SHOULD be added. 4327 AVP Format 4329 ::= < AVP Header: 279 > 4330 1* {AVP} 4332 7.6. Experimental-Result AVP 4334 The Experimental-Result AVP (AVP Code 297) is of type Grouped, and 4335 indicates whether a particular vendor-specific request was completed 4336 successfully or whether an error occurred. Its Data field has the 4337 following ABNF grammar: 4339 AVP Format 4341 Experimental-Result ::= < AVP Header: 297 > 4342 { Vendor-Id } 4343 { Experimental-Result-Code } 4345 The Vendor-Id AVP (see Section 5.3.3) in this grouped AVP identifies 4346 the vendor responsible for the assignment of the result code which 4347 follows. All Diameter answer messages defined in vendor-specific 4348 applications MUST include either one Result-Code AVP or one 4349 Experimental-Result AVP. 4351 7.7. Experimental-Result-Code AVP 4353 The Experimental-Result-Code AVP (AVP Code 298) is of type Unsigned32 4354 and contains a vendor-assigned value representing the result of 4355 processing the request. 4357 It is recommended that vendor-specific result codes follow the same 4358 conventions given for the Result-Code AVP regarding the different 4359 types of result codes and the handling of errors (for non 2xxx 4360 values). 4362 8. Diameter User Sessions 4364 In general, Diameter can provide two different types of services to 4365 applications. The first involves authentication and authorization, 4366 and can optionally make use of accounting. The second only makes use 4367 of accounting. 4369 When a service makes use of the authentication and/or authorization 4370 portion of an application, and a user requests access to the network, 4371 the Diameter client issues an auth request to its local server. The 4372 auth request is defined in a service specific Diameter application 4373 (e.g., NASREQ). The request contains a Session-Id AVP, which is used 4374 in subsequent messages (e.g., subsequent authorization, accounting, 4375 etc) relating to the user's session. The Session-Id AVP is a means 4376 for the client and servers to correlate a Diameter message with a 4377 user session. 4379 When a Diameter server authorizes a user to use network resources for 4380 a finite amount of time, and it is willing to extend the 4381 authorization via a future request, it MUST add the Authorization- 4382 Lifetime AVP to the answer message. The Authorization-Lifetime AVP 4383 defines the maximum number of seconds a user MAY make use of the 4384 resources before another authorization request is expected by the 4385 server. The Auth-Grace-Period AVP contains the number of seconds 4386 following the expiration of the Authorization-Lifetime, after which 4387 the server will release all state information related to the user's 4388 session. Note that if payment for services is expected by the 4389 serving realm from the user's home realm, the Authorization-Lifetime 4390 AVP, combined with the Auth-Grace-Period AVP, implies the maximum 4391 length of the session the home realm is willing to be fiscally 4392 responsible for. Services provided past the expiration of the 4393 Authorization-Lifetime and Auth-Grace-Period AVPs are the 4394 responsibility of the access device. Of course, the actual cost of 4395 services rendered is clearly outside the scope of the protocol. 4397 An access device that does not expect to send a re-authorization or a 4398 session termination request to the server MAY include the Auth- 4399 Session-State AVP with the value set to NO_STATE_MAINTAINED as a hint 4400 to the server. If the server accepts the hint, it agrees that since 4401 no session termination message will be received once service to the 4402 user is terminated, it cannot maintain state for the session. If the 4403 answer message from the server contains a different value in the 4404 Auth-Session-State AVP (or the default value if the AVP is absent), 4405 the access device MUST follow the server's directives. Note that the 4406 value NO_STATE_MAINTAINED MUST NOT be set in subsequent re- 4407 authorization requests and answers. 4409 The base protocol does not include any authorization request 4410 messages, since these are largely application-specific and are 4411 defined in a Diameter application document. However, the base 4412 protocol does define a set of messages that is used to terminate user 4413 sessions. These are used to allow servers that maintain state 4414 information to free resources. 4416 When a service only makes use of the Accounting portion of the 4417 Diameter protocol, even in combination with an application, the 4418 Session-Id is still used to identify user sessions. However, the 4419 session termination messages are not used, since a session is 4420 signaled as being terminated by issuing an accounting stop message. 4422 Diameter may also be used for services that cannot be easily 4423 categorized as authentication, authorization or accounting (e.g., 4424 certain 3GPP IMS interfaces). In such cases, the finite state 4425 machine defined in subsequent sections may not be applicable. 4426 Therefore, the applications itself MAY need to define its own finite 4427 state machine. However, such application specific statemachines MUST 4428 comply with general Diameter user session requirements such co- 4429 relating all message exchanges via Session-Id AVP. 4431 8.1. Authorization Session State Machine 4433 This section contains a set of finite state machines, representing 4434 the life cycle of Diameter sessions, and which MUST be observed by 4435 all Diameter implementations that make use of the authentication 4436 and/or authorization portion of a Diameter application. The term 4437 Service-Specific below refers to a message defined in a Diameter 4438 application (e.g., Mobile IPv4, NASREQ). 4440 There are four different authorization session state machines 4441 supported in the Diameter base protocol. The first two describe a 4442 session in which the server is maintaining session state, indicated 4443 by the value of the Auth-Session-State AVP (or its absence). One 4444 describes the session from a client perspective, the other from a 4445 server perspective. The second two state machines are used when the 4446 server does not maintain session state. Here again, one describes 4447 the session from a client perspective, the other from a server 4448 perspective. 4450 When a session is moved to the Idle state, any resources that were 4451 allocated for the particular session must be released. Any event not 4452 listed in the state machines MUST be considered as an error 4453 condition, and an answer, if applicable, MUST be returned to the 4454 originator of the message. 4456 In the case that an application does not support re-auth, the state 4457 transitions related to server-initiated re-auth when both client and 4458 server sessions maintains state (e.g., Send RAR, Pending, Receive 4459 RAA) MAY be ignored. 4461 In the state table, the event 'Failure to send X' means that the 4462 Diameter agent is unable to send command X to the desired 4463 destination. This could be due to the peer being down, or due to the 4464 peer sending back a transient failure or temporary protocol error 4465 notification DIAMETER_TOO_BUSY or DIAMETER_LOOP_DETECTED in the 4466 Result-Code AVP of the corresponding Answer command. The event 'X 4467 successfully sent' is the complement of 'Failure to send X'. 4469 The following state machine is observed by a client when state is 4470 maintained on the server: 4472 CLIENT, STATEFUL 4473 State Event Action New State 4474 ------------------------------------------------------------- 4475 Idle Client or Device Requests Send Pending 4476 access service 4477 specific 4478 auth req 4480 Idle ASR Received Send ASA Idle 4481 for unknown session with 4482 Result-Code 4483 = UNKNOWN_ 4484 SESSION_ID 4486 Idle RAR Received Send RAA Idle 4487 for unknown session with 4488 Result-Code 4489 = UNKNOWN_ 4490 SESSION_ID 4492 Pending Successful Service-specific Grant Open 4493 authorization answer Access 4494 received with default 4495 Auth-Session-State value 4497 Pending Successful Service-specific Sent STR Discon 4498 authorization answer received 4499 but service not provided 4501 Pending Error processing successful Sent STR Discon 4502 Service-specific authorization 4503 answer 4505 Pending Failed Service-specific Cleanup Idle 4506 authorization answer received 4508 Open User or client device Send Open 4509 requests access to service service 4510 specific 4511 auth req 4513 Open Successful Service-specific Provide Open 4514 authorization answer received Service 4516 Open Failed Service-specific Discon. Idle 4517 authorization answer user/device 4518 received. 4520 Open RAR received and client will Send RAA Open 4521 perform subsequent re-auth with 4522 Result-Code 4523 = SUCCESS 4525 Open RAR received and client will Send RAA Idle 4526 not perform subsequent with 4527 re-auth Result-Code 4528 != SUCCESS, 4529 Discon. 4530 user/device 4532 Open Session-Timeout Expires on Send STR Discon 4533 Access Device 4535 Open ASR Received, Send ASA Discon 4536 client will comply with with 4537 request to end the session Result-Code 4538 = SUCCESS, 4539 Send STR. 4541 Open ASR Received, Send ASA Open 4542 client will not comply with with 4543 request to end the session Result-Code 4544 != SUCCESS 4546 Open Authorization-Lifetime + Send STR Discon 4547 Auth-Grace-Period expires on 4548 access device 4550 Discon ASR Received Send ASA Discon 4552 Discon STA Received Discon. Idle 4553 user/device 4555 The following state machine is observed by a server when it is 4556 maintaining state for the session: 4558 SERVER, STATEFUL 4559 State Event Action New State 4560 ------------------------------------------------------------- 4561 Idle Service-specific authorization Send Open 4562 request received, and successful 4563 user is authorized serv. 4564 specific 4565 answer 4567 Idle Service-specific authorization Send Idle 4568 request received, and failed serv. 4569 user is not authorized specific 4570 answer 4572 Open Service-specific authorization Send Open 4573 request received, and user successful 4574 is authorized serv. specific 4575 answer 4577 Open Service-specific authorization Send Idle 4578 request received, and user failed serv. 4579 is not authorized specific 4580 answer, 4581 Cleanup 4583 Open Home server wants to confirm Send RAR Pending 4584 authentication and/or 4585 authorization of the user 4587 Pending Received RAA with a failed Cleanup Idle 4588 Result-Code 4590 Pending Received RAA with Result-Code Update Open 4591 = SUCCESS session 4593 Open Home server wants to Send ASR Discon 4594 terminate the service 4596 Open Authorization-Lifetime (and Cleanup Idle 4597 Auth-Grace-Period) expires 4598 on home server. 4600 Open Session-Timeout expires on Cleanup Idle 4601 home server 4603 Discon Failure to send ASR Wait, Discon 4604 resend ASR 4606 Discon ASR successfully sent and Cleanup Idle 4607 ASA Received with Result-Code 4609 Not ASA Received None No Change. 4610 Discon 4612 Any STR Received Send STA, Idle 4613 Cleanup. 4615 The following state machine is observed by a client when state is not 4616 maintained on the server: 4618 CLIENT, STATELESS 4619 State Event Action New State 4620 ------------------------------------------------------------- 4621 Idle Client or Device Requests Send Pending 4622 access service 4623 specific 4624 auth req 4626 Pending Successful Service-specific Grant Open 4627 authorization answer Access 4628 received with Auth-Session- 4629 State set to 4630 NO_STATE_MAINTAINED 4632 Pending Failed Service-specific Cleanup Idle 4633 authorization answer 4634 received 4636 Open Session-Timeout Expires on Discon. Idle 4637 Access Device user/device 4639 Open Service to user is terminated Discon. Idle 4640 user/device 4642 The following state machine is observed by a server when it is not 4643 maintaining state for the session: 4645 SERVER, STATELESS 4646 State Event Action New State 4647 ------------------------------------------------------------- 4648 Idle Service-specific authorization Send serv. Idle 4649 request received, and specific 4650 successfully processed answer 4652 8.2. Accounting Session State Machine 4654 The following state machines MUST be supported for applications that 4655 have an accounting portion or that require only accounting services. 4656 The first state machine is to be observed by clients. 4658 See Section 9.7 for Accounting Command Codes and Section 9.8 for 4659 Accounting AVPs. 4661 The server side in the accounting state machine depends in some cases 4662 on the particular application. The Diameter base protocol defines a 4663 default state machine that MUST be followed by all applications that 4664 have not specified other state machines. This is the second state 4665 machine in this section described below. 4667 The default server side state machine requires the reception of 4668 accounting records in any order and at any time, and does not place 4669 any standards requirement on the processing of these records. 4670 Implementations of Diameter MAY perform checking, ordering, 4671 correlation, fraud detection, and other tasks based on these records. 4672 Both base Diameter AVPs as well as application specific AVPs MAY be 4673 inspected as a part of these tasks. The tasks can happen either 4674 immediately after record reception or in a post-processing phase. 4675 However, as these tasks are typically application or even policy 4676 dependent, they are not standardized by the Diameter specifications. 4677 Applications MAY define requirements on when to accept accounting 4678 records based on the used value of Accounting-Realtime-Required AVP, 4679 credit limits checks, and so on. 4681 However, the Diameter base protocol defines one optional server side 4682 state machine that MAY be followed by applications that require 4683 keeping track of the session state at the accounting server. Note 4684 that such tracking is incompatible with the ability to sustain long 4685 duration connectivity problems. Therefore, the use of this state 4686 machine is recommended only in applications where the value of the 4687 Accounting-Realtime-Required AVP is DELIVER_AND_GRANT, and hence 4688 accounting connectivity problems are required to cause the serviced 4689 user to be disconnected. Otherwise, records produced by the client 4690 may be lost by the server which no longer accepts them after the 4691 connectivity is re-established. This state machine is the third 4692 state machine in this section. The state machine is supervised by a 4693 supervision session timer Ts, which the value should be reasonably 4694 higher than the Acct_Interim_Interval value. Ts MAY be set to two 4695 times the value of the Acct_Interim_Interval so as to avoid the 4696 accounting session in the Diameter server to change to Idle state in 4697 case of short transient network failure. 4699 Any event not listed in the state machines MUST be considered as an 4700 error condition, and a corresponding answer, if applicable, MUST be 4701 returned to the originator of the message. 4703 In the state table, the event 'Failure to send' means that the 4704 Diameter client is unable to communicate with the desired 4705 destination. This could be due to the peer being down, or due to the 4706 peer sending back a transient failure or temporary protocol error 4707 notification DIAMETER_OUT_OF_SPACE, DIAMETER_TOO_BUSY, or 4708 DIAMETER_LOOP_DETECTED in the Result-Code AVP of the Accounting 4709 Answer command. 4711 The event 'Failed answer' means that the Diameter client received a 4712 non-transient failure notification in the Accounting Answer command. 4714 Note that the action 'Disconnect user/dev' MUST have an effect also 4715 to the authorization session state table, e.g., cause the STR message 4716 to be sent, if the given application has both authentication/ 4717 authorization and accounting portions. 4719 The states PendingS, PendingI, PendingL, PendingE and PendingB stand 4720 for pending states to wait for an answer to an accounting request 4721 related to a Start, Interim, Stop, Event or buffered record, 4722 respectively. 4724 CLIENT, ACCOUNTING 4725 State Event Action New State 4726 ------------------------------------------------------------- 4727 Idle Client or device requests Send PendingS 4728 access accounting 4729 start req. 4731 Idle Client or device requests Send PendingE 4732 a one-time service accounting 4733 event req 4735 Idle Records in storage Send PendingB 4736 record 4738 PendingS Successful accounting Open 4739 start answer received 4741 PendingS Failure to send and buffer Store Open 4742 space available and realtime Start 4743 not equal to DELIVER_AND_GRANT Record 4745 PendingS Failure to send and no buffer Open 4746 space available and realtime 4747 equal to GRANT_AND_LOSE 4749 PendingS Failure to send and no buffer Disconnect Idle 4750 space available and realtime user/dev 4751 not equal to 4752 GRANT_AND_LOSE 4754 PendingS Failed accounting start answer Open 4755 received and realtime equal 4756 to GRANT_AND_LOSE 4758 PendingS Failed accounting start answer Disconnect Idle 4759 received and realtime not user/dev 4760 equal to GRANT_AND_LOSE 4762 PendingS User service terminated Store PendingS 4763 stop 4764 record 4766 Open Interim interval elapses Send PendingI 4767 accounting 4768 interim 4769 record 4770 Open User service terminated Send PendingL 4771 accounting 4772 stop req. 4774 PendingI Successful accounting interim Open 4775 answer received 4777 PendingI Failure to send and (buffer Store Open 4778 space available or old record interim 4779 can be overwritten) and record 4780 realtime not equal to 4781 DELIVER_AND_GRANT 4783 PendingI Failure to send and no buffer Open 4784 space available and realtime 4785 equal to GRANT_AND_LOSE 4787 PendingI Failure to send and no buffer Disconnect Idle 4788 space available and realtime user/dev 4789 not equal to GRANT_AND_LOSE 4791 PendingI Failed accounting interim Open 4792 answer received and realtime 4793 equal to GRANT_AND_LOSE 4795 PendingI Failed accounting interim Disconnect Idle 4796 answer received and realtime user/dev 4797 not equal to GRANT_AND_LOSE 4799 PendingI User service terminated Store PendingI 4800 stop 4801 record 4802 PendingE Successful accounting Idle 4803 event answer received 4805 PendingE Failure to send and buffer Store Idle 4806 space available event 4807 record 4809 PendingE Failure to send and no buffer Idle 4810 space available 4812 PendingE Failed accounting event answer Idle 4813 received 4815 PendingB Successful accounting answer Delete Idle 4816 received record 4818 PendingB Failure to send Idle 4820 PendingB Failed accounting answer Delete Idle 4821 received record 4823 PendingL Successful accounting Idle 4824 stop answer received 4826 PendingL Failure to send and buffer Store Idle 4827 space available stop 4828 record 4830 PendingL Failure to send and no buffer Idle 4831 space available 4833 PendingL Failed accounting stop answer Idle 4834 received 4836 SERVER, STATELESS ACCOUNTING 4837 State Event Action New State 4838 ------------------------------------------------------------- 4840 Idle Accounting start request Send Idle 4841 received, and successfully accounting 4842 processed. start 4843 answer 4845 Idle Accounting event request Send Idle 4846 received, and successfully accounting 4847 processed. event 4848 answer 4850 Idle Interim record received, Send Idle 4851 and successfully processed. accounting 4852 interim 4853 answer 4855 Idle Accounting stop request Send Idle 4856 received, and successfully accounting 4857 processed stop answer 4859 Idle Accounting request received, Send Idle 4860 no space left to store accounting 4861 records answer, 4862 Result-Code 4863 = OUT_OF_ 4864 SPACE 4866 SERVER, STATEFUL ACCOUNTING 4867 State Event Action New State 4868 ------------------------------------------------------------- 4870 Idle Accounting start request Send Open 4871 received, and successfully accounting 4872 processed. start 4873 answer, 4874 Start Ts 4876 Idle Accounting event request Send Idle 4877 received, and successfully accounting 4878 processed. event 4879 answer 4881 Idle Accounting request received, Send Idle 4882 no space left to store accounting 4883 records answer, 4884 Result-Code 4885 = OUT_OF_ 4886 SPACE 4888 Open Interim record received, Send Open 4889 and successfully processed. accounting 4890 interim 4891 answer, 4892 Restart Ts 4894 Open Accounting stop request Send Idle 4895 received, and successfully accounting 4896 processed stop answer, 4897 Stop Ts 4899 Open Accounting request received, Send Idle 4900 no space left to store accounting 4901 records answer, 4902 Result-Code 4903 = OUT_OF_ 4904 SPACE, 4905 Stop Ts 4907 Open Session supervision timer Ts Stop Ts Idle 4908 expired 4910 8.3. Server-Initiated Re-Auth 4912 A Diameter server may initiate a re-authentication and/or re- 4913 authorization service for a particular session by issuing a Re-Auth- 4914 Request (RAR). 4916 For example, for pre-paid services, the Diameter server that 4917 originally authorized a session may need some confirmation that the 4918 user is still using the services. 4920 An access device that receives a RAR message with Session-Id equal to 4921 a currently active session MUST initiate a re-auth towards the user, 4922 if the service supports this particular feature. Each Diameter 4923 application MUST state whether service-initiated re-auth is 4924 supported, since some applications do not allow access devices to 4925 prompt the user for re-auth. 4927 8.3.1. Re-Auth-Request 4929 The Re-Auth-Request (RAR), indicated by the Command-Code set to 258 4930 and the message flags' 'R' bit set, may be sent by any server to the 4931 access device that is providing session service, to request that the 4932 user be re-authenticated and/or re-authorized. 4934 Message Format 4936 ::= < Diameter Header: 258, REQ, PXY > 4937 < Session-Id > 4938 { Origin-Host } 4939 { Origin-Realm } 4940 { Destination-Realm } 4941 { Destination-Host } 4942 { Auth-Application-Id } 4943 { Re-Auth-Request-Type } 4944 [ User-Name ] 4945 [ Origin-State-Id ] 4946 * [ Proxy-Info ] 4947 * [ Route-Record ] 4948 * [ AVP ] 4950 8.3.2. Re-Auth-Answer 4952 The Re-Auth-Answer (RAA), indicated by the Command-Code set to 258 4953 and the message flags' 'R' bit clear, is sent in response to the RAR. 4954 The Result-Code AVP MUST be present, and indicates the disposition of 4955 the request. 4957 A successful RAA message MUST be followed by an application-specific 4958 authentication and/or authorization message. 4960 Message Format 4962 ::= < Diameter Header: 258, PXY > 4963 < Session-Id > 4964 { Result-Code } 4965 { Origin-Host } 4966 { Origin-Realm } 4967 [ User-Name ] 4968 [ Origin-State-Id ] 4969 [ Error-Message ] 4970 [ Error-Reporting-Host ] 4971 * [ Failed-AVP ] 4972 * [ Redirect-Host ] 4973 [ Redirect-Host-Usage ] 4974 [ Redirect-Host-Cache-Time ] 4975 * [ Proxy-Info ] 4976 * [ AVP ] 4978 8.4. Session Termination 4980 It is necessary for a Diameter server that authorized a session, for 4981 which it is maintaining state, to be notified when that session is no 4982 longer active, both for tracking purposes as well as to allow 4983 stateful agents to release any resources that they may have provided 4984 for the user's session. For sessions whose state is not being 4985 maintained, this section is not used. 4987 When a user session that required Diameter authorization terminates, 4988 the access device that provided the service MUST issue a Session- 4989 Termination-Request (STR) message to the Diameter server that 4990 authorized the service, to notify it that the session is no longer 4991 active. An STR MUST be issued when a user session terminates for any 4992 reason, including user logoff, expiration of Session-Timeout, 4993 administrative action, termination upon receipt of an Abort-Session- 4994 Request (see below), orderly shutdown of the access device, etc. 4996 The access device also MUST issue an STR for a session that was 4997 authorized but never actually started. This could occur, for 4998 example, due to a sudden resource shortage in the access device, or 4999 because the access device is unwilling to provide the type of service 5000 requested in the authorization, or because the access device does not 5001 support a mandatory AVP returned in the authorization, etc. 5003 It is also possible that a session that was authorized is never 5004 actually started due to action of a proxy. For example, a proxy may 5005 modify an authorization answer, converting the result from success to 5006 failure, prior to forwarding the message to the access device. If 5007 the answer did not contain an Auth-Session-State AVP with the value 5008 NO_STATE_MAINTAINED, a proxy that causes an authorized session not to 5009 be started MUST issue an STR to the Diameter server that authorized 5010 the session, since the access device has no way of knowing that the 5011 session had been authorized. 5013 A Diameter server that receives an STR message MUST clean up 5014 resources (e.g., session state) associated with the Session-Id 5015 specified in the STR, and return a Session-Termination-Answer. 5017 A Diameter server also MUST clean up resources when the Session- 5018 Timeout expires, or when the Authorization-Lifetime and the Auth- 5019 Grace-Period AVPs expires without receipt of a re-authorization 5020 request, regardless of whether an STR for that session is received. 5021 The access device is not expected to provide service beyond the 5022 expiration of these timers; thus, expiration of either of these 5023 timers implies that the access device may have unexpectedly shut 5024 down. 5026 8.4.1. Session-Termination-Request 5028 The Session-Termination-Request (STR), indicated by the Command-Code 5029 set to 275 and the Command Flags' 'R' bit set, is sent by the access 5030 device to inform the Diameter Server that an authenticated and/or 5031 authorized session is being terminated. 5033 Message Format 5035 ::= < Diameter Header: 275, REQ, PXY > 5036 < Session-Id > 5037 { Origin-Host } 5038 { Origin-Realm } 5039 { Destination-Realm } 5040 { Auth-Application-Id } 5041 { Termination-Cause } 5042 [ User-Name ] 5043 [ Destination-Host ] 5044 * [ Class ] 5045 [ Origin-State-Id ] 5046 * [ Proxy-Info ] 5047 * [ Route-Record ] 5048 * [ AVP ] 5050 8.4.2. Session-Termination-Answer 5052 The Session-Termination-Answer (STA), indicated by the Command-Code 5053 set to 275 and the message flags' 'R' bit clear, is sent by the 5054 Diameter Server to acknowledge the notification that the session has 5055 been terminated. The Result-Code AVP MUST be present, and MAY 5056 contain an indication that an error occurred while servicing the STR. 5058 Upon sending or receipt of the STA, the Diameter Server MUST release 5059 all resources for the session indicated by the Session-Id AVP. Any 5060 intermediate server in the Proxy-Chain MAY also release any 5061 resources, if necessary. 5063 Message Format 5065 ::= < Diameter Header: 275, PXY > 5066 < Session-Id > 5067 { Result-Code } 5068 { Origin-Host } 5069 { Origin-Realm } 5070 [ User-Name ] 5071 * [ Class ] 5072 [ Error-Message ] 5073 [ Error-Reporting-Host ] 5074 * [ Failed-AVP ] 5075 [ Origin-State-Id ] 5076 * [ Redirect-Host ] 5077 [ Redirect-Host-Usage ] 5078 ^ 5079 [ Redirect-Max-Cache-Time ] 5080 * [ Proxy-Info ] 5081 * [ AVP ] 5083 8.5. Aborting a Session 5085 A Diameter server may request that the access device stop providing 5086 service for a particular session by issuing an Abort-Session-Request 5087 (ASR). 5089 For example, the Diameter server that originally authorized the 5090 session may be required to cause that session to be stopped for 5091 credit or other reasons that were not anticipated when the session 5092 was first authorized. On the other hand, an operator may maintain a 5093 management server for the purpose of issuing ASRs to administratively 5094 remove users from the network. 5096 An access device that receives an ASR with Session-ID equal to a 5097 currently active session MAY stop the session. Whether the access 5098 device stops the session or not is implementation- and/or 5099 configuration-dependent. For example, an access device may honor 5100 ASRs from certain agents only. In any case, the access device MUST 5101 respond with an Abort-Session-Answer, including a Result-Code AVP to 5102 indicate what action it took. 5104 Note that if the access device does stop the session upon receipt of 5105 an ASR, it issues an STR to the authorizing server (which may or may 5106 not be the agent issuing the ASR) just as it would if the session 5107 were terminated for any other reason. 5109 8.5.1. Abort-Session-Request 5111 The Abort-Session-Request (ASR), indicated by the Command-Code set to 5112 274 and the message flags' 'R' bit set, may be sent by any server to 5113 the access device that is providing session service, to request that 5114 the session identified by the Session-Id be stopped. 5116 Message Format 5118 ::= < Diameter Header: 274, REQ, PXY > 5119 < Session-Id > 5120 { Origin-Host } 5121 { Origin-Realm } 5122 { Destination-Realm } 5123 { Destination-Host } 5124 { Auth-Application-Id } 5125 [ User-Name ] 5126 [ Origin-State-Id ] 5127 * [ Proxy-Info ] 5128 * [ Route-Record ] 5129 * [ AVP ] 5131 8.5.2. Abort-Session-Answer 5133 The Abort-Session-Answer (ASA), indicated by the Command-Code set to 5134 274 and the message flags' 'R' bit clear, is sent in response to the 5135 ASR. The Result-Code AVP MUST be present, and indicates the 5136 disposition of the request. 5138 If the session identified by Session-Id in the ASR was successfully 5139 terminated, Result-Code is set to DIAMETER_SUCCESS. If the session 5140 is not currently active, Result-Code is set to 5141 DIAMETER_UNKNOWN_SESSION_ID. If the access device does not stop the 5142 session for any other reason, Result-Code is set to 5143 DIAMETER_UNABLE_TO_COMPLY. 5145 Message Format 5147 ::= < Diameter Header: 274, PXY > 5148 < Session-Id > 5149 { Result-Code } 5150 { Origin-Host } 5151 { Origin-Realm } 5152 [ User-Name ] 5153 [ Origin-State-Id ] 5154 [ Error-Message ] 5155 [ Error-Reporting-Host ] 5156 * [ Failed-AVP ] 5157 * [ Redirect-Host ] 5158 [ Redirect-Host-Usage ] 5159 [ Redirect-Max-Cache-Time ] 5160 * [ Proxy-Info ] 5161 * [ AVP ] 5163 8.6. Inferring Session Termination from Origin-State-Id 5165 Origin-State-Id is used to allow rapid detection of terminated 5166 sessions for which no STR would have been issued, due to 5167 unanticipated shutdown of an access device. 5169 By including Origin-State-Id in CER/CEA messages, an access device 5170 allows a next-hop server to determine immediately upon connection 5171 whether the device has lost its sessions since the last connection. 5173 By including Origin-State-Id in request messages, an access device 5174 also allows a server with which it communicates via proxy to make 5175 such a determination. However, a server that is not directly 5176 connected with the access device will not discover that the access 5177 device has been restarted unless and until it receives a new request 5178 from the access device. Thus, use of this mechanism across proxies 5179 is opportunistic rather than reliable, but useful nonetheless. 5181 When a Diameter server receives an Origin-State-Id that is greater 5182 than the Origin-State-Id previously received from the same issuer, it 5183 may assume that the issuer has lost state since the previous message 5184 and that all sessions that were active under the lower Origin-State- 5185 Id have been terminated. The Diameter server MAY clean up all 5186 session state associated with such lost sessions, and MAY also issues 5187 STRs for all such lost sessions that were authorized on upstream 5188 servers, to allow session state to be cleaned up globally. 5190 8.7. Auth-Request-Type AVP 5192 The Auth-Request-Type AVP (AVP Code 274) is of type Enumerated and is 5193 included in application-specific auth requests to inform the peers 5194 whether a user is to be authenticated only, authorized only or both. 5195 Note any value other than both MAY cause RADIUS interoperability 5196 issues. The following values are defined: 5198 AUTHENTICATE_ONLY 1 5200 The request being sent is for authentication only, and MUST 5201 contain the relevant application specific authentication AVPs that 5202 are needed by the Diameter server to authenticate the user. 5204 AUTHORIZE_ONLY 2 5206 The request being sent is for authorization only, and MUST contain 5207 the application specific authorization AVPs that are necessary to 5208 identify the service being requested/offered. 5210 AUTHORIZE_AUTHENTICATE 3 5212 The request contains a request for both authentication and 5213 authorization. The request MUST include both the relevant 5214 application specific authentication information, and authorization 5215 information necessary to identify the service being requested/ 5216 offered. 5218 8.8. Session-Id AVP 5220 The Session-Id AVP (AVP Code 263) is of type UTF8String and is used 5221 to identify a specific session (see Section 8). All messages 5222 pertaining to a specific session MUST include only one Session-Id AVP 5223 and the same value MUST be used throughout the life of a session. 5224 When present, the Session-Id SHOULD appear immediately following the 5225 Diameter Header (see Section 3). 5227 The Session-Id MUST be globally and eternally unique, as it is meant 5228 to uniquely identify a user session without reference to any other 5229 information, and may be needed to correlate historical authentication 5230 information with accounting information. The Session-Id includes a 5231 mandatory portion and an implementation-defined portion; a 5232 recommended format for the implementation-defined portion is outlined 5233 below. 5235 The Session-Id MUST begin with the sender's identity encoded in the 5236 DiameterIdentity type (see Section 4.4). The remainder of the 5237 Session-Id is delimited by a ";" character, and MAY be any sequence 5238 that the client can guarantee to be eternally unique; however, the 5239 following format is recommended, (square brackets [] indicate an 5240 optional element): 5242 ;;[;] 5244 and are decimal representations of the 5245 high and low 32 bits of a monotonically increasing 64-bit value. The 5246 64-bit value is rendered in two part to simplify formatting by 32-bit 5247 processors. At startup, the high 32 bits of the 64-bit value MAY be 5248 initialized to the time, and the low 32 bits MAY be initialized to 5249 zero. This will for practical purposes eliminate the possibility of 5250 overlapping Session-Ids after a reboot, assuming the reboot process 5251 takes longer than a second. Alternatively, an implementation MAY 5252 keep track of the increasing value in non-volatile memory. 5254 is implementation specific but may include a modem's 5255 device Id, a layer 2 address, timestamp, etc. 5257 Example, in which there is no optional value: 5259 accesspoint7.acme.com;1876543210;523 5261 Example, in which there is an optional value: 5263 accesspoint7.acme.com;1876543210;523;mobile@200.1.1.88 5265 The Session-Id is created by the Diameter application initiating the 5266 session, which in most cases is done by the client. Note that a 5267 Session-Id MAY be used for both the authorization and accounting 5268 commands of a given application. 5270 8.9. Authorization-Lifetime AVP 5272 The Authorization-Lifetime AVP (AVP Code 291) is of type Unsigned32 5273 and contains the maximum number of seconds of service to be provided 5274 to the user before the user is to be re-authenticated and/or re- 5275 authorized. Great care should be taken when the Authorization- 5276 Lifetime value is determined, since a low, non-zero, value could 5277 create significant Diameter traffic, which could congest both the 5278 network and the agents. 5280 A value of zero (0) means that immediate re-auth is necessary by the 5281 access device. This is typically used in cases where multiple 5282 authentication methods are used, and a successful auth response with 5283 this AVP set to zero is used to signal that the next authentication 5284 method is to be immediately initiated. The absence of this AVP, or a 5285 value of all ones (meaning all bits in the 32 bit field are set to 5286 one) means no re-auth is expected. 5288 If both this AVP and the Session-Timeout AVP are present in a 5289 message, the value of the latter MUST NOT be smaller than the 5290 Authorization-Lifetime AVP. 5292 An Authorization-Lifetime AVP MAY be present in re-authorization 5293 messages, and contains the number of seconds the user is authorized 5294 to receive service from the time the re-auth answer message is 5295 received by the access device. 5297 This AVP MAY be provided by the client as a hint of the maximum 5298 lifetime that it is willing to accept. However, the server MAY 5299 return a value that is equal to, or smaller, than the one provided by 5300 the client. 5302 8.10. Auth-Grace-Period AVP 5304 The Auth-Grace-Period AVP (AVP Code 276) is of type Unsigned32 and 5305 contains the number of seconds the Diameter server will wait 5306 following the expiration of the Authorization-Lifetime AVP before 5307 cleaning up resources for the session. 5309 8.11. Auth-Session-State AVP 5311 The Auth-Session-State AVP (AVP Code 277) is of type Enumerated and 5312 specifies whether state is maintained for a particular session. The 5313 client MAY include this AVP in requests as a hint to the server, but 5314 the value in the server's answer message is binding. The following 5315 values are supported: 5317 STATE_MAINTAINED 0 5319 This value is used to specify that session state is being 5320 maintained, and the access device MUST issue a session termination 5321 message when service to the user is terminated. This is the 5322 default value. 5324 NO_STATE_MAINTAINED 1 5326 This value is used to specify that no session termination messages 5327 will be sent by the access device upon expiration of the 5328 Authorization-Lifetime. 5330 8.12. Re-Auth-Request-Type AVP 5332 The Re-Auth-Request-Type AVP (AVP Code 285) is of type Enumerated and 5333 is included in application-specific auth answers to inform the client 5334 of the action expected upon expiration of the Authorization-Lifetime. 5335 If the answer message contains an Authorization-Lifetime AVP with a 5336 positive value, the Re-Auth-Request-Type AVP MUST be present in an 5337 answer message. The following values are defined: 5339 AUTHORIZE_ONLY 0 5341 An authorization only re-auth is expected upon expiration of the 5342 Authorization-Lifetime. This is the default value if the AVP is 5343 not present in answer messages that include the Authorization- 5344 Lifetime. 5346 AUTHORIZE_AUTHENTICATE 1 5348 An authentication and authorization re-auth is expected upon 5349 expiration of the Authorization-Lifetime. 5351 8.13. Session-Timeout AVP 5353 The Session-Timeout AVP (AVP Code 27) [RFC2865] is of type Unsigned32 5354 and contains the maximum number of seconds of service to be provided 5355 to the user before termination of the session. When both the 5356 Session-Timeout and the Authorization-Lifetime AVPs are present in an 5357 answer message, the former MUST be equal to or greater than the value 5358 of the latter. 5360 A session that terminates on an access device due to the expiration 5361 of the Session-Timeout MUST cause an STR to be issued, unless both 5362 the access device and the home server had previously agreed that no 5363 session termination messages would be sent (see Section 8.9). 5365 A Session-Timeout AVP MAY be present in a re-authorization answer 5366 message, and contains the remaining number of seconds from the 5367 beginning of the re-auth. 5369 A value of zero, or the absence of this AVP, means that this session 5370 has an unlimited number of seconds before termination. 5372 This AVP MAY be provided by the client as a hint of the maximum 5373 timeout that it is willing to accept. However, the server MAY return 5374 a value that is equal to, or smaller, than the one provided by the 5375 client. 5377 8.14. User-Name AVP 5379 The User-Name AVP (AVP Code 1) [RFC2865] is of type UTF8String, which 5380 contains the User-Name, in a format consistent with the NAI 5381 specification [RFC4282]. 5383 8.15. Termination-Cause AVP 5385 The Termination-Cause AVP (AVP Code 295) is of type Enumerated, and 5386 is used to indicate the reason why a session was terminated on the 5387 access device. The following values are defined: 5389 DIAMETER_LOGOUT 1 5391 The user initiated a disconnect 5393 DIAMETER_SERVICE_NOT_PROVIDED 2 5395 This value is used when the user disconnected prior to the receipt 5396 of the authorization answer message. 5398 DIAMETER_BAD_ANSWER 3 5400 This value indicates that the authorization answer received by the 5401 access device was not processed successfully. 5403 DIAMETER_ADMINISTRATIVE 4 5405 The user was not granted access, or was disconnected, due to 5406 administrative reasons, such as the receipt of a Abort-Session- 5407 Request message. 5409 DIAMETER_LINK_BROKEN 5 5411 The communication to the user was abruptly disconnected. 5413 DIAMETER_AUTH_EXPIRED 6 5415 The user's access was terminated since its authorized session time 5416 has expired. 5418 DIAMETER_USER_MOVED 7 5420 The user is receiving services from another access device. 5422 DIAMETER_SESSION_TIMEOUT 8 5424 The user's session has timed out, and service has been terminated. 5426 8.16. Origin-State-Id AVP 5428 The Origin-State-Id AVP (AVP Code 278), of type Unsigned32, is a 5429 monotonically increasing value that is advanced whenever a Diameter 5430 entity restarts with loss of previous state, for example upon reboot. 5431 Origin-State-Id MAY be included in any Diameter message, including 5432 CER. 5434 A Diameter entity issuing this AVP MUST create a higher value for 5435 this AVP each time its state is reset. A Diameter entity MAY set 5436 Origin-State-Id to the time of startup, or it MAY use an incrementing 5437 counter retained in non-volatile memory across restarts. 5439 The Origin-State-Id, if present, MUST reflect the state of the entity 5440 indicated by Origin-Host. If a proxy modifies Origin-Host, it MUST 5441 either remove Origin-State-Id or modify it appropriately as well. 5442 Typically, Origin-State-Id is used by an access device that always 5443 starts up with no active sessions; that is, any session active prior 5444 to restart will have been lost. By including Origin-State-Id in a 5445 message, it allows other Diameter entities to infer that sessions 5446 associated with a lower Origin-State-Id are no longer active. If an 5447 access device does not intend for such inferences to be made, it MUST 5448 either not include Origin-State-Id in any message, or set its value 5449 to 0. 5451 8.17. Session-Binding AVP 5453 The Session-Binding AVP (AVP Code 270) is of type Unsigned32, and MAY 5454 be present in application-specific authorization answer messages. If 5455 present, this AVP MAY inform the Diameter client that all future 5456 application-specific re-auth messages for this session MUST be sent 5457 to the same authorization server. This AVP MAY also specify that a 5458 Session-Termination-Request message for this session MUST be sent to 5459 the same authorizing server. 5461 This field is a bit mask, and the following bits have been defined: 5463 RE_AUTH 1 5465 When set, future re-auth messages for this session MUST NOT 5466 include the Destination-Host AVP. When cleared, the default 5467 value, the Destination-Host AVP MUST be present in all re-auth 5468 messages for this session. 5470 STR 2 5472 When set, the STR message for this session MUST NOT include the 5473 Destination-Host AVP. When cleared, the default value, the 5474 Destination-Host AVP MUST be present in the STR message for this 5475 session. 5477 ACCOUNTING 4 5479 When set, all accounting messages for this session MUST NOT 5480 include the Destination-Host AVP. When cleared, the default 5481 value, the Destination-Host AVP, if known, MUST be present in all 5482 accounting messages for this session. 5484 8.18. Session-Server-Failover AVP 5486 The Session-Server-Failover AVP (AVP Code 271) is of type Enumerated, 5487 and MAY be present in application-specific authorization answer 5488 messages that either do not include the Session-Binding AVP or 5489 include the Session-Binding AVP with any of the bits set to a zero 5490 value. If present, this AVP MAY inform the Diameter client that if a 5491 re-auth or STR message fails due to a delivery problem, the Diameter 5492 client SHOULD issue a subsequent message without the Destination-Host 5493 AVP. When absent, the default value is REFUSE_SERVICE. 5495 The following values are supported: 5497 REFUSE_SERVICE 0 5499 If either the re-auth or the STR message delivery fails, terminate 5500 service with the user, and do not attempt any subsequent attempts. 5502 TRY_AGAIN 1 5504 If either the re-auth or the STR message delivery fails, resend 5505 the failed message without the Destination-Host AVP present. 5507 ALLOW_SERVICE 2 5509 If re-auth message delivery fails, assume that re-authorization 5510 succeeded. If STR message delivery fails, terminate the session. 5512 TRY_AGAIN_ALLOW_SERVICE 3 5514 If either the re-auth or the STR message delivery fails, resend 5515 the failed message without the Destination-Host AVP present. If 5516 the second delivery fails for re-auth, assume re-authorization 5517 succeeded. If the second delivery fails for STR, terminate the 5518 session. 5520 8.19. Multi-Round-Time-Out AVP 5522 The Multi-Round-Time-Out AVP (AVP Code 272) is of type Unsigned32, 5523 and SHOULD be present in application-specific authorization answer 5524 messages whose Result-Code AVP is set to DIAMETER_MULTI_ROUND_AUTH. 5525 This AVP contains the maximum number of seconds that the access 5526 device MUST provide the user in responding to an authentication 5527 request. 5529 8.20. Class AVP 5531 The Class AVP (AVP Code 25) is of type OctetString and is used to by 5532 Diameter servers to return state information to the access device. 5533 When one or more Class AVPs are present in application-specific 5534 authorization answer messages, they MUST be present in subsequent re- 5535 authorization, session termination and accounting messages. Class 5536 AVPs found in a re-authorization answer message override the ones 5537 found in any previous authorization answer message. Diameter server 5538 implementations SHOULD NOT return Class AVPs that require more than 5539 4096 bytes of storage on the Diameter client. A Diameter client that 5540 receives Class AVPs whose size exceeds local available storage MUST 5541 terminate the session. 5543 8.21. Event-Timestamp AVP 5545 The Event-Timestamp (AVP Code 55) is of type Time, and MAY be 5546 included in an Accounting-Request and Accounting-Answer messages to 5547 record the time that the reported event occurred, in seconds since 5548 January 1, 1900 00:00 UTC. 5550 9. Accounting 5552 This accounting protocol is based on a server directed model with 5553 capabilities for real-time delivery of accounting information. 5554 Several fault resilience methods [RFC2975] have been built in to the 5555 protocol in order minimize loss of accounting data in various fault 5556 situations and under different assumptions about the capabilities of 5557 the used devices. 5559 9.1. Server Directed Model 5561 The server directed model means that the device generating the 5562 accounting data gets information from either the authorization server 5563 (if contacted) or the accounting server regarding the way accounting 5564 data shall be forwarded. This information includes accounting record 5565 timeliness requirements. 5567 As discussed in [RFC2975], real-time transfer of accounting records 5568 is a requirement, such as the need to perform credit limit checks and 5569 fraud detection. Note that batch accounting is not a requirement, 5570 and is therefore not supported by Diameter. Should batched 5571 accounting be required in the future, a new Diameter application will 5572 need to be created, or it could be handled using another protocol. 5573 Note, however, that even if at the Diameter layer accounting requests 5574 are processed one by one, transport protocols used under Diameter 5575 typically batch several requests in the same packet under heavy 5576 traffic conditions. This may be sufficient for many applications. 5578 The authorization server (chain) directs the selection of proper 5579 transfer strategy, based on its knowledge of the user and 5580 relationships of roaming partnerships. The server (or agents) uses 5581 the Acct-Interim-Interval and Accounting-Realtime-Required AVPs to 5582 control the operation of the Diameter peer operating as a client. 5583 The Acct-Interim-Interval AVP, when present, instructs the Diameter 5584 node acting as a client to produce accounting records continuously 5585 even during a session. Accounting-Realtime-Required AVP is used to 5586 control the behavior of the client when the transfer of accounting 5587 records from the Diameter client is delayed or unsuccessful. 5589 The Diameter accounting server MAY override the interim interval or 5590 the realtime requirements by including the Acct-Interim-Interval or 5591 Accounting-Realtime-Required AVP in the Accounting-Answer message. 5592 When one of these AVPs is present, the latest value received SHOULD 5593 be used in further accounting activities for the same session. 5595 9.2. Protocol Messages 5597 A Diameter node that receives a successful authentication and/or 5598 authorization messages from the Home AAA server MUST collect 5599 accounting information for the session. The Accounting-Request 5600 message is used to transmit the accounting information to the Home 5601 AAA server, which MUST reply with the Accounting-Answer message to 5602 confirm reception. The Accounting-Answer message includes the 5603 Result-Code AVP, which MAY indicate that an error was present in the 5604 accounting message. A rejected Accounting-Request message MAY cause 5605 the user's session to be terminated, depending on the value of the 5606 Accounting-Realtime-Required AVP received earlier for the session in 5607 question. 5609 Each Diameter Accounting protocol message MAY be compressed, in order 5610 to reduce network bandwidth usage. If TLS is used to secure the 5611 Diameter session, then TLS compression [RFC2246] MAY be used. 5613 9.3. Accounting Application Extension and Requirements 5615 Each Diameter application (e.g., NASREQ, MobileIP), MUST define their 5616 Service-Specific AVPs that MUST be present in the Accounting-Request 5617 message in a section entitled "Accounting AVPs". The application 5618 MUST assume that the AVPs described in this document will be present 5619 in all Accounting messages, so only their respective service-specific 5620 AVPs need to be defined in this section. 5622 Applications have the option of using one or both of the following 5623 accounting application extension models: 5625 Split Accounting Service 5627 The accounting message will carry the application identifier of 5628 the Diameter base accounting application (see Section 2.4). 5629 Accounting messages maybe routed to Diameter nodes other than the 5630 corresponding Diameter application. These nodes might be 5631 centralized accounting servers that provide accounting service for 5632 multiple different Diameter applications. These nodes MUST 5633 advertise the Diameter base accounting application identifier 5634 during capabilities exchange. 5636 Accounting messages which uses the Diameter base accounting 5637 application identifier in its header MUST include the application 5638 identifier of the Diameter application it is providing service for 5639 in the Acct-Application-Id AVP. This allows the accounting server 5640 to determine which Diameter application the accounting records are 5641 for. 5643 Coupled Accounting Service 5645 The accounting messages will carry the application identifier of 5646 the application that is using it. The application itself will 5647 process the received accounting records or forward them to an 5648 accounting server. There is no accounting application 5649 advertisement required during capabilities exchange and the 5650 accounting messages will be routed the same as any of the other 5651 application messages. 5653 In cases where an application does not define its own accounting 5654 service, it is preferred that the split accounting model be used. 5656 9.4. Fault Resilience 5658 Diameter Base protocol mechanisms are used to overcome small message 5659 loss and network faults of temporary nature. 5661 Diameter peers acting as clients MUST implement the use of failover 5662 to guard against server failures and certain network failures. 5663 Diameter peers acting as agents or related off-line processing 5664 systems MUST detect duplicate accounting records caused by the 5665 sending of same record to several servers and duplication of messages 5666 in transit. This detection MUST be based on the inspection of the 5667 Session-Id and Accounting-Record-Number AVP pairs. Appendix C 5668 discusses duplicate detection needs and implementation issues. 5670 Diameter clients MAY have non-volatile memory for the safe storage of 5671 accounting records over reboots or extended network failures, network 5672 partitions, and server failures. If such memory is available, the 5673 client SHOULD store new accounting records there as soon as the 5674 records are created and until a positive acknowledgement of their 5675 reception from the Diameter Server has been received. Upon a reboot, 5676 the client MUST starting sending the records in the non-volatile 5677 memory to the accounting server with appropriate modifications in 5678 termination cause, session length, and other relevant information in 5679 the records. 5681 A further application of this protocol may include AVPs to control 5682 how many accounting records may at most be stored in the Diameter 5683 client without committing them to the non-volatile memory or 5684 transferring them to the Diameter server. 5686 The client SHOULD NOT remove the accounting data from any of its 5687 memory areas before the correct Accounting-Answer has been received. 5688 The client MAY remove oldest, undelivered or yet unacknowledged 5689 accounting data if it runs out of resources such as memory. It is an 5690 implementation dependent matter for the client to accept new sessions 5691 under this condition. 5693 9.5. Accounting Records 5695 In all accounting records, the Session-Id AVP MUST be present; the 5696 User-Name AVP MUST be present if it is available to the Diameter 5697 client. 5699 Different types of accounting records are sent depending on the 5700 actual type of accounted service and the authorization server's 5701 directions for interim accounting. If the accounted service is a 5702 one-time event, meaning that the start and stop of the event are 5703 simultaneous, then the Accounting-Record-Type AVP MUST be present and 5704 set to the value EVENT_RECORD. 5706 If the accounted service is of a measurable length, then the AVP MUST 5707 use the values START_RECORD, STOP_RECORD, and possibly, 5708 INTERIM_RECORD. If the authorization server has not directed interim 5709 accounting to be enabled for the session, two accounting records MUST 5710 be generated for each service of type session. When the initial 5711 Accounting-Request for a given session is sent, the Accounting- 5712 Record-Type AVP MUST be set to the value START_RECORD. When the last 5713 Accounting-Request is sent, the value MUST be STOP_RECORD. 5715 If the authorization server has directed interim accounting to be 5716 enabled, the Diameter client MUST produce additional records between 5717 the START_RECORD and STOP_RECORD, marked INTERIM_RECORD. The 5718 production of these records is directed by Acct-Interim-Interval as 5719 well as any re-authentication or re-authorization of the session. 5720 The Diameter client MUST overwrite any previous interim accounting 5721 records that are locally stored for delivery, if a new record is 5722 being generated for the same session. This ensures that only one 5723 pending interim record can exist on an access device for any given 5724 session. 5726 A particular value of Accounting-Sub-Session-Id MUST appear only in 5727 one sequence of accounting records from a DIAMETER client, except for 5728 the purposes of retransmission. The one sequence that is sent MUST 5729 be either one record with Accounting-Record-Type AVP set to the value 5730 EVENT_RECORD, or several records starting with one having the value 5731 START_RECORD, followed by zero or more INTERIM_RECORD and a single 5732 STOP_RECORD. A particular Diameter application specification MUST 5733 define the type of sequences that MUST be used. 5735 9.6. Correlation of Accounting Records 5737 The Diameter protocol's Session-Id AVP, which is globally unique (see 5738 Section 8.8), is used during the authorization phase to identify a 5739 particular session. Services that do not require any authorization 5740 still use the Session-Id AVP to identify sessions. Accounting 5741 messages MAY use a different Session-Id from that sent in 5742 authorization messages. Specific applications MAY require different 5743 a Session-ID for accounting messages. 5745 However, there are certain applications that require multiple 5746 accounting sub-sessions. Such applications would send messages with 5747 a constant Session-Id AVP, but a different Accounting-Sub-Session-Id 5748 AVP. In these cases, correlation is performed using the Session-Id. 5749 It is important to note that receiving a STOP_RECORD with no 5750 Accounting-Sub-Session-Id AVP when sub-sessions were originally used 5751 in the START_RECORD messages implies that all sub-sessions are 5752 terminated. 5754 Furthermore, there are certain applications where a user receives 5755 service from different access devices (e.g., Mobile IPv4), each with 5756 their own unique Session-Id. In such cases, the Acct-Multi-Session- 5757 Id AVP is used for correlation. During authorization, a server that 5758 determines that a request is for an existing session SHOULD include 5759 the Acct-Multi-Session-Id AVP, which the access device MUST include 5760 in all subsequent accounting messages. 5762 The Acct-Multi-Session-Id AVP MAY include the value of the original 5763 Session-Id. It's contents are implementation specific, but MUST be 5764 globally unique across other Acct-Multi-Session-Id, and MUST NOT 5765 change during the life of a session. 5767 A Diameter application document MUST define the exact concept of a 5768 session that is being accounted, and MAY define the concept of a 5769 multi-session. For instance, the NASREQ DIAMETER application treats 5770 a single PPP connection to a Network Access Server as one session, 5771 and a set of Multilink PPP sessions as one multi-session. 5773 9.7. Accounting Command-Codes 5775 This section defines Command-Code values that MUST be supported by 5776 all Diameter implementations that provide Accounting services. 5778 9.7.1. Accounting-Request 5780 The Accounting-Request (ACR) command, indicated by the Command-Code 5781 field set to 271 and the Command Flags' 'R' bit set, is sent by a 5782 Diameter node, acting as a client, in order to exchange accounting 5783 information with a peer. 5785 One of Acct-Application-Id and Vendor-Specific-Application-Id AVPs 5786 MUST be present. If the Vendor-Specific-Application-Id grouped AVP 5787 is present, it must have an Acct-Application-Id inside. 5789 The AVP listed below SHOULD include service specific accounting AVPs, 5790 as described in Section 9.3. 5792 Message Format 5794 ::= < Diameter Header: 271, REQ, PXY > 5795 < Session-Id > 5796 { Origin-Host } 5797 { Origin-Realm } 5798 { Destination-Realm } 5799 { Accounting-Record-Type } 5800 { Accounting-Record-Number } 5801 [ Acct-Application-Id ] 5802 [ Vendor-Specific-Application-Id ] 5803 [ User-Name ] 5804 [ Accounting-Sub-Session-Id ] 5805 [ Acct-Session-Id ] 5806 [ Acct-Multi-Session-Id ] 5807 [ Acct-Interim-Interval ] 5808 [ Accounting-Realtime-Required ] 5809 [ Origin-State-Id ] 5810 [ Event-Timestamp ] 5811 * [ Proxy-Info ] 5812 * [ Route-Record ] 5813 * [ AVP ] 5815 9.7.2. Accounting-Answer 5817 The Accounting-Answer (ACA) command, indicated by the Command-Code 5818 field set to 271 and the Command Flags' 'R' bit cleared, is used to 5819 acknowledge an Accounting-Request command. The Accounting-Answer 5820 command contains the same Session-Id as the corresponding request. 5822 Only the target Diameter Server, known as the home Diameter Server, 5823 SHOULD respond with the Accounting-Answer command. 5825 One of Acct-Application-Id and Vendor-Specific-Application-Id AVPs 5826 MUST be present. If the Vendor-Specific-Application-Id grouped AVP 5827 is present, it must have an Acct-Application-Id inside. 5829 The AVP listed below SHOULD include service specific accounting AVPs, 5830 as described in Section 9.3. 5832 Message Format 5834 ::= < Diameter Header: 271, PXY > 5835 < Session-Id > 5836 { Result-Code } 5837 { Origin-Host } 5838 { Origin-Realm } 5839 { Accounting-Record-Type } 5840 { Accounting-Record-Number } 5841 [ Acct-Application-Id ] 5842 [ Vendor-Specific-Application-Id ] 5843 [ User-Name ] 5844 [ Accounting-Sub-Session-Id ] 5845 [ Acct-Session-Id ] 5846 [ Acct-Multi-Session-Id ] 5847 [ Error-Reporting-Host ] 5848 [ Acct-Interim-Interval ] 5849 [ Accounting-Realtime-Required ] 5850 [ Origin-State-Id ] 5851 [ Event-Timestamp ] 5852 * [ Proxy-Info ] 5853 * [ AVP ] 5855 9.8. Accounting AVPs 5857 This section contains AVPs that describe accounting usage information 5858 related to a specific session. 5860 9.8.1. Accounting-Record-Type AVP 5862 The Accounting-Record-Type AVP (AVP Code 480) is of type Enumerated 5863 and contains the type of accounting record being sent. The following 5864 values are currently defined for the Accounting-Record-Type AVP: 5866 EVENT_RECORD 1 5868 An Accounting Event Record is used to indicate that a one-time 5869 event has occurred (meaning that the start and end of the event 5870 are simultaneous). This record contains all information relevant 5871 to the service, and is the only record of the service. 5873 START_RECORD 2 5875 An Accounting Start, Interim, and Stop Records are used to 5876 indicate that a service of a measurable length has been given. An 5877 Accounting Start Record is used to initiate an accounting session, 5878 and contains accounting information that is relevant to the 5879 initiation of the session. 5881 INTERIM_RECORD 3 5883 An Interim Accounting Record contains cumulative accounting 5884 information for an existing accounting session. Interim 5885 Accounting Records SHOULD be sent every time a re-authentication 5886 or re-authorization occurs. Further, additional interim record 5887 triggers MAY be defined by application-specific Diameter 5888 applications. The selection of whether to use INTERIM_RECORD 5889 records is done by the Acct-Interim-Interval AVP. 5891 STOP_RECORD 4 5893 An Accounting Stop Record is sent to terminate an accounting 5894 session and contains cumulative accounting information relevant to 5895 the existing session. 5897 9.8.2. Acct-Interim-Interval 5899 The Acct-Interim-Interval AVP (AVP Code 85) is of type Unsigned32 and 5900 is sent from the Diameter home authorization server to the Diameter 5901 client. The client uses information in this AVP to decide how and 5902 when to produce accounting records. With different values in this 5903 AVP, service sessions can result in one, two, or two+N accounting 5904 records, based on the needs of the home-organization. The following 5905 accounting record production behavior is directed by the inclusion of 5906 this AVP: 5908 1. The omission of the Acct-Interim-Interval AVP or its inclusion 5909 with Value field set to 0 means that EVENT_RECORD, START_RECORD, 5910 and STOP_RECORD are produced, as appropriate for the service. 5912 2. The inclusion of the AVP with Value field set to a non-zero value 5913 means that INTERIM_RECORD records MUST be produced between the 5914 START_RECORD and STOP_RECORD records. The Value field of this 5915 AVP is the nominal interval between these records in seconds. 5916 The Diameter node that originates the accounting information, 5917 known as the client, MUST produce the first INTERIM_RECORD record 5918 roughly at the time when this nominal interval has elapsed from 5919 the START_RECORD, the next one again as the interval has elapsed 5920 once more, and so on until the session ends and a STOP_RECORD 5921 record is produced. 5923 The client MUST ensure that the interim record production times 5924 are randomized so that large accounting message storms are not 5925 created either among records or around a common service start 5926 time. 5928 9.8.3. Accounting-Record-Number AVP 5930 The Accounting-Record-Number AVP (AVP Code 485) is of type Unsigned32 5931 and identifies this record within one session. As Session-Id AVPs 5932 are globally unique, the combination of Session-Id and Accounting- 5933 Record-Number AVPs is also globally unique, and can be used in 5934 matching accounting records with confirmations. An easy way to 5935 produce unique numbers is to set the value to 0 for records of type 5936 EVENT_RECORD and START_RECORD, and set the value to 1 for the first 5937 INTERIM_RECORD, 2 for the second, and so on until the value for 5938 STOP_RECORD is one more than for the last INTERIM_RECORD. 5940 9.8.4. Acct-Session-Id AVP 5942 The Acct-Session-Id AVP (AVP Code 44) is of type OctetString is only 5943 used when RADIUS/Diameter translation occurs. This AVP contains the 5944 contents of the RADIUS Acct-Session-Id attribute. 5946 9.8.5. Acct-Multi-Session-Id AVP 5948 The Acct-Multi-Session-Id AVP (AVP Code 50) is of type UTF8String, 5949 following the format specified in Section 8.8. The Acct-Multi- 5950 Session-Id AVP is used to link together multiple related accounting 5951 sessions, where each session would have a unique Session-Id, but the 5952 same Acct-Multi-Session-Id AVP. This AVP MAY be returned by the 5953 Diameter server in an authorization answer, and MUST be used in all 5954 accounting messages for the given session. 5956 9.8.6. Accounting-Sub-Session-Id AVP 5958 The Accounting-Sub-Session-Id AVP (AVP Code 287) is of type 5959 Unsigned64 and contains the accounting sub-session identifier. The 5960 combination of the Session-Id and this AVP MUST be unique per sub- 5961 session, and the value of this AVP MUST be monotonically increased by 5962 one for all new sub-sessions. The absence of this AVP implies no 5963 sub-sessions are in use, with the exception of an Accounting-Request 5964 whose Accounting-Record-Type is set to STOP_RECORD. A STOP_RECORD 5965 message with no Accounting-Sub-Session-Id AVP present will signal the 5966 termination of all sub-sessions for a given Session-Id. 5968 9.8.7. Accounting-Realtime-Required AVP 5970 The Accounting-Realtime-Required AVP (AVP Code 483) is of type 5971 Enumerated and is sent from the Diameter home authorization server to 5972 the Diameter client or in the Accounting-Answer from the accounting 5973 server. The client uses information in this AVP to decide what to do 5974 if the sending of accounting records to the accounting server has 5975 been temporarily prevented due to, for instance, a network problem. 5977 DELIVER_AND_GRANT 1 5979 The AVP with Value field set to DELIVER_AND_GRANT means that the 5980 service MUST only be granted as long as there is a connection to 5981 an accounting server. Note that the set of alternative accounting 5982 servers are treated as one server in this sense. Having to move 5983 the accounting record stream to a backup server is not a reason to 5984 discontinue the service to the user. 5986 GRANT_AND_STORE 2 5988 The AVP with Value field set to GRANT_AND_STORE means that service 5989 SHOULD be granted if there is a connection, or as long as records 5990 can still be stored as described in Section 9.4. 5992 This is the default behavior if the AVP isn't included in the 5993 reply from the authorization server. 5995 GRANT_AND_LOSE 3 5997 The AVP with Value field set to GRANT_AND_LOSE means that service 5998 SHOULD be granted even if the records can not be delivered or 5999 stored. 6001 10. AVP Occurrence Table 6003 The following tables presents the AVPs defined in this document, and 6004 specifies in which Diameter messages they MAY, or MAY NOT be present. 6005 Note that AVPs that can only be present within a Grouped AVP are not 6006 represented in this table. 6008 The table uses the following symbols: 6010 0 The AVP MUST NOT be present in the message. 6012 0+ Zero or more instances of the AVP MAY be present in the 6013 message. 6015 0-1 Zero or one instance of the AVP MAY be present in the message. 6016 It is considered an error if there are more than one instance of 6017 the AVP. 6019 1 One instance of the AVP MUST be present in the message. 6021 1+ At least one instance of the AVP MUST be present in the 6022 message. 6024 10.1. Base Protocol Command AVP Table 6026 The table in this section is limited to the non-accounting Command 6027 Codes defined in this specification. 6029 +-----------------------------------------------+ 6030 | Command-Code | 6031 +---+---+---+---+---+---+---+---+---+---+---+---+ 6032 Attribute Name |CER|CEA|DPR|DPA|DWR|DWA|RAR|RAA|ASR|ASA|STR|STA| 6033 --------------------+---+---+---+---+---+---+---+---+---+---+---+---+ 6034 Acct-Interim- |0 |0 |0 |0 |0 |0 |0-1|0 |0 |0 |0 |0 | 6035 Interval | | | | | | | | | | | | | 6036 Accounting-Realtime-|0 |0 |0 |0 |0 |0 |0-1|0 |0 |0 |0 |0 | 6037 Required | | | | | | | | | | | | | 6038 Acct-Application-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6039 Auth-Application-Id |0+ |0+ |0 |0 |0 |0 |1 |0 |1 |0 |1 |0 | 6040 Auth-Grace-Period |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6041 Auth-Request-Type |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6042 Auth-Session-State |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6043 Authorization- |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6044 Lifetime | | | | | | | | | | | | | 6045 Class |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0+ |0+ | 6046 Destination-Host |0 |0 |0 |0 |0 |0 |1 |0 |1 |0 |0-1|0 | 6047 Destination-Realm |0 |0 |0 |0 |0 |0 |1 |0 |1 |0 |1 |0 | 6048 Disconnect-Cause |0 |0 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6049 Error-Message |0 |0-1|0 |0-1|0 |0-1|0 |0-1|0 |0-1|0 |0-1| 6050 Error-Reporting-Host|0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6051 Failed-AVP |0 |0+ |0 |0+ |0 |0+ |0 |0+ |0 |0+ |0 |0+ | 6052 Firmware-Revision |0-1|0-1|0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6053 Host-IP-Address |1+ |1+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6054 Inband-Security-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6055 Multi-Round-Time-Out|0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6056 Origin-Host |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 | 6057 Origin-Realm |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 | 6058 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| 6059 Product-Name |1 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6060 Proxy-Info |0 |0 |0 |0 |0 |0 |0+ |0+ |0+ |0+ |0+ |0+ | 6061 Redirect-Host |0 |0 |0 |0 |0 |0 |0 |0+ |0 |0+ |0 |0+ | 6062 Redirect-Host-Usage |0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6063 Redirect-Max-Cache- |0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6064 Time | | | | | | | | | | | | | 6065 Result-Code |0 |1 |0 |1 |0 |1 |0 |1 |0 |0 |0 |1 | 6066 Re-Auth-Request-Type|0 |0 |0 |0 |0 |0 |1 |0 |0 |0 |0 |0 | 6067 Route-Record |0 |0 |0 |0 |0 |0 |0+ |0 |0+ |0 |0+ |0 | 6068 Session-Binding |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6069 Session-Id |0 |0 |0 |0 |0 |0 |1 |1 |1 |1 |1 |1 | 6070 Session-Server- |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6071 Failover | | | | | | | | | | | | | 6072 Session-Timeout |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6073 Supported-Vendor-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6074 Termination-Cause |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |1 |0 | 6075 User-Name |0 |0 |0 |0 |0 |0 |0-1|0-1|0-1|0-1|0-1|0-1| 6076 Vendor-Id |1 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6077 Vendor-Specific- |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6078 Application-Id | | | | | | | | | | | | | 6079 --------------------+---+---+---+---+---+---+---+---+---+---+---+---+ 6081 10.2. Accounting AVP Table 6083 The table in this section is used to represent which AVPs defined in 6084 this document are to be present in the Accounting messages. These 6085 AVP occurrence requirements are guidelines, which may be expanded, 6086 and/or overridden by application-specific requirements in the 6087 Diameter applications documents. 6089 +-----------+ 6090 | Command | 6091 | Code | 6092 +-----+-----+ 6093 Attribute Name | ACR | ACA | 6094 ------------------------------+-----+-----+ 6095 Acct-Interim-Interval | 0-1 | 0-1 | 6096 Acct-Multi-Session-Id | 0-1 | 0-1 | 6097 Accounting-Record-Number | 1 | 1 | 6098 Accounting-Record-Type | 1 | 1 | 6099 Acct-Session-Id | 0-1 | 0-1 | 6100 Accounting-Sub-Session-Id | 0-1 | 0-1 | 6101 Accounting-Realtime-Required | 0-1 | 0-1 | 6102 Acct-Application-Id | 0-1 | 0-1 | 6103 Auth-Application-Id | 0 | 0 | 6104 Class | 0+ | 0+ | 6105 Destination-Host | 0-1 | 0 | 6106 Destination-Realm | 1 | 0 | 6107 Error-Reporting-Host | 0 | 0+ | 6108 Event-Timestamp | 0-1 | 0-1 | 6109 Origin-Host | 1 | 1 | 6110 Origin-Realm | 1 | 1 | 6111 Proxy-Info | 0+ | 0+ | 6112 Route-Record | 0+ | 0+ | 6113 Result-Code | 0 | 1 | 6114 Session-Id | 1 | 1 | 6115 Termination-Cause | 0-1 | 0-1 | 6116 User-Name | 0-1 | 0-1 | 6117 Vendor-Specific-Application-Id| 0-1 | 0-1 | 6118 ------------------------------+-----+-----+ 6120 11. IANA Considerations 6122 This section provides guidance to the Internet Assigned Numbers 6123 Authority (IANA) regarding registration of values related to the 6124 Diameter protocol, in accordance with BCP 26 [RFC2434]. The 6125 following policies are used here with the meanings defined in BCP 26: 6126 "Private Use", "First Come First Served", "Expert Review", 6127 "Specification Required", "IETF Consensus", "Standards Action". 6129 This section explains the criteria to be used by the IANA for 6130 assignment of numbers within namespaces defined within this document. 6132 Diameter is not intended as a general purpose protocol, and 6133 allocations SHOULD NOT be made for purposes unrelated to 6134 authentication, authorization or accounting. 6136 For registration requests where a Designated Expert should be 6137 consulted, the responsible IESG area director should appoint the 6138 Designated Expert. For Designated Expert with Specification 6139 Required, the request is posted to the AAA WG mailing list (or, if it 6140 has been disbanded, a successor designated by the Area Director) for 6141 comment and review, and MUST include a pointer to a public 6142 specification. Before a period of 30 days has passed, the Designated 6143 Expert will either approve or deny the registration request and 6144 publish a notice of the decision to the AAA WG mailing list or its 6145 successor. A denial notice must be justified by an explanation and, 6146 in the cases where it is possible, concrete suggestions on how the 6147 request can be modified so as to become acceptable. 6149 11.1. AVP Header 6151 As defined in Section 4, the AVP header contains three fields that 6152 requires IANA namespace management; the AVP Code, Vendor-ID and Flags 6153 field. 6155 11.1.1. AVP Codes 6157 The AVP Code namespace is used to identify attributes. There are 6158 multiple namespaces. Vendors can have their own AVP Codes namespace 6159 which will be identified by their Vendor-ID (also known as 6160 Enterprise-Number) and they control the assignments of their vendor- 6161 specific AVP codes within their own namespace. The absence of a 6162 Vendor-ID or a Vendor-ID value of zero (0) identifies the IETF IANA 6163 controlled AVP Codes namespace. The AVP Codes and sometimes also 6164 possible values in an AVP are controlled and maintained by IANA. 6166 AVP Code 0 is not used. AVP Codes 1-255 are managed separately as 6167 RADIUS Attribute Types [RADTYPE]. This document defines the AVP 6168 Codes 257-274, 276-285, 287, 291-300, 480, 483 and 485-486. See 6169 Section 4.5 for the assignment of the namespace in this 6170 specification. 6172 AVPs may be allocated following Designated Expert with Specification 6173 Required [RFC2434]. Release of blocks of AVPs (more than 3 at a time 6174 for a given purpose) should require IETF Consensus. 6176 Note that Diameter defines a mechanism for Vendor-Specific AVPs, 6177 where the Vendor-Id field in the AVP header is set to a non-zero 6178 value. Vendor-Specific AVPs codes are for Private Use and should be 6179 encouraged instead of allocation of global attribute types, for 6180 functions specific only to one vendor's implementation of Diameter, 6181 where no interoperability is deemed useful. Where a Vendor-Specific 6182 AVP is implemented by more than one vendor, allocation of global AVPs 6183 should be encouraged instead. 6185 11.1.2. AVP Flags 6187 There are 8 bits in the AVP Flags field of the AVP header, defined in 6188 Section 4. This document assigns bit 0 ('V'endor Specific), bit 1 6189 ('M'andatory) and bit 2 ('P'rotected). The remaining bits should 6190 only be assigned via a Standards Action [RFC2434]. 6192 11.2. Diameter Header 6194 As defined in Section 3, the Diameter header contains two fields that 6195 require IANA namespace management; Command Code and Command Flags. 6197 11.2.1. Command Codes 6199 The Command Code namespace is used to identify Diameter commands. 6200 The values 0-255 are reserved for RADIUS backward compatibility, and 6201 are defined as "RADIUS Packet Type Codes" in [RADTYPE]. Values 256- 6202 16,777,213 are for permanent, standard commands, allocated by IETF 6203 Consensus [RFC2434]. This document defines the Command Codes 257, 6204 258, 271, 274-275, 280 and 282. See Section 3.1 for the assignment 6205 of the namespace in this specification. 6207 The values 16,777,214 and 16,777,215 (hexadecimal values 0xfffffe - 6208 0xffffff) are reserved for experimental commands. As these codes are 6209 only for experimental and testing purposes, no guarantee is made for 6210 interoperability between Diameter peers using experimental commands, 6211 as outlined in [IANA-EXP]. 6213 11.2.2. Command Flags 6215 There are eight bits in the Command Flags field of the Diameter 6216 header. This document assigns bit 0 ('R'equest), bit 1 ('P'roxy), 6217 bit 2 ('E'rror) and bit 3 ('T'). Bits 4 through 7 MUST only be 6218 assigned via a Standards Action [RFC2434]. 6220 11.3. Application Identifiers 6222 As defined in Section 2.4, the Application Identifier is used to 6223 identify a specific Diameter Application. There are standards-track 6224 application ids and vendor specific application ids. 6226 IANA [RFC2434] has assigned the range 0x00000001 to 0x00ffffff for 6227 standards-track applications; and 0x01000000 - 0xfffffffe for vendor 6228 specific applications, on a first-come, first-served basis. The 6229 following values are allocated. 6231 Diameter Common Messages 0 6232 NASREQ 1 [RFC4005] 6233 Mobile-IP 2 [RFC4004] 6234 Diameter Base Accounting 3 6235 Relay 0xffffffff 6237 Assignment of standards-track application IDs are by Designated 6238 Expert with Specification Required [RFC2434]. 6240 Both Auth-Application-Id and Acct-Application-Id AVPs use the same 6241 Application Identifier space. A diameter node advertising itself as 6242 a relay agent MUST set either Application-Id or Acct-Application-Id 6243 to 0xffffffff. 6245 Vendor-Specific Application Identifiers, are for Private Use. Vendor- 6246 Specific Application Identifiers are assigned on a First Come, First 6247 Served basis by IANA. 6249 11.4. AVP Values 6251 Certain AVPs in Diameter define a list of values with various 6252 meanings. For attributes other than those specified in this section, 6253 adding additional values to the list can be done on a First Come, 6254 First Served basis by IANA. 6256 11.4.1. Result-Code AVP Values 6258 As defined in Section 7.1, the Result-Code AVP (AVP Code 268) defines 6259 the values 1001, 2001-2002, 3001-3012, 4001-4003 and 5001-5021. 6261 All remaining values are available for assignment via IETF Consensus 6262 [RFC2434]. 6264 11.4.2. Accounting-Record-Type AVP Values 6266 As defined in Section 9.8.1, the Accounting-Record-Type AVP (AVP Code 6267 480) defines the values 1-4. All remaining values are available for 6268 assignment via IETF Consensus [RFC2434]. 6270 11.4.3. Termination-Cause AVP Values 6272 As defined in Section 8.15, the Termination-Cause AVP (AVP Code 295) 6273 defines the values 1-8. All remaining values are available for 6274 assignment via IETF Consensus [RFC2434]. 6276 11.4.4. Redirect-Host-Usage AVP Values 6278 As defined in Section 6.13, the Redirect-Host-Usage AVP (AVP Code 6279 261) defines the values 0-5. All remaining values are available for 6280 assignment via IETF Consensus [RFC2434]. 6282 11.4.5. Session-Server-Failover AVP Values 6284 As defined in Section 8.18, the Session-Server-Failover AVP (AVP Code 6285 271) defines the values 0-3. All remaining values are available for 6286 assignment via IETF Consensus [RFC2434]. 6288 11.4.6. Session-Binding AVP Values 6290 As defined in Section 8.17, the Session-Binding AVP (AVP Code 270) 6291 defines the bits 1-4. All remaining bits are available for 6292 assignment via IETF Consensus [RFC2434]. 6294 11.4.7. Disconnect-Cause AVP Values 6296 As defined in Section 5.4.3, the Disconnect-Cause AVP (AVP Code 273) 6297 defines the values 0-2. All remaining values are available for 6298 assignment via IETF Consensus [RFC2434]. 6300 11.4.8. Auth-Request-Type AVP Values 6302 As defined in Section 8.7, the Auth-Request-Type AVP (AVP Code 274) 6303 defines the values 1-3. All remaining values are available for 6304 assignment via IETF Consensus [RFC2434]. 6306 11.4.9. Auth-Session-State AVP Values 6308 As defined in Section 8.11, the Auth-Session-State AVP (AVP Code 277) 6309 defines the values 0-1. All remaining values are available for 6310 assignment via IETF Consensus [RFC2434]. 6312 11.4.10. Re-Auth-Request-Type AVP Values 6314 As defined in Section 8.12, the Re-Auth-Request-Type AVP (AVP Code 6315 285) defines the values 0-1. All remaining values are available for 6316 assignment via IETF Consensus [RFC2434]. 6318 11.4.11. Accounting-Realtime-Required AVP Values 6320 As defined in Section 9.8.7, the Accounting-Realtime-Required AVP 6321 (AVP Code 483) defines the values 1-3. All remaining values are 6322 available for assignment via IETF Consensus [RFC2434]. 6324 11.4.12. Inband-Security-Id AVP (code 299) 6326 As defined in Section 6.10, the Inband-Security-Id AVP (AVP Code 299) 6327 defines the values 0-1. All remaining values are available for 6328 assignment via IETF Consensus [RFC2434]. 6330 11.5. Diameter TCP/SCTP Port Numbers 6332 The IANA has assigned TCP and SCTP port number 3868 to Diameter. 6334 11.6. NAPTR Service Fields 6336 The registration in the RFC MUST include the following information: 6338 Service Field: The service field being registered. An example for a 6339 new fictitious transport protocol called NCTP might be "AAA+D2N". 6341 Protocol: The specific transport protocol associated with that 6342 service field. This MUST include the name and acronym for the 6343 protocol, along with reference to a document that describes the 6344 transport protocol. For example - "New Connectionless Transport 6345 Protocol (NCTP), RFC 5766". 6347 Name and Contact Information: The name, address, email address and 6348 telephone number for the person performing the registration. 6350 The following values have been placed into the registry: 6352 Services Field Protocol 6354 AAA+D2T TCP 6355 AAA+D2S SCTP 6357 12. Diameter protocol related configurable parameters 6359 This section contains the configurable parameters that are found 6360 throughout this document: 6362 Diameter Peer 6364 A Diameter entity MAY communicate with peers that are statically 6365 configured. A statically configured Diameter peer would require 6366 that either the IP address or the fully qualified domain name 6367 (FQDN) be supplied, which would then be used to resolve through 6368 DNS. 6370 Routing Table 6372 A Diameter proxy server routes messages based on the realm portion 6373 of a Network Access Identifier (NAI). The server MUST have a 6374 table of Realm Names, and the address of the peer to which the 6375 message must be forwarded to. The routing table MAY also include 6376 a "default route", which is typically used for all messages that 6377 cannot be locally processed. 6379 Tc timer 6381 The Tc timer controls the frequency that transport connection 6382 attempts are done to a peer with whom no active transport 6383 connection exists. The recommended value is 30 seconds. 6385 13. Security Considerations 6387 The Diameter base protocol assumes that messages maybe secured by 6388 using TLS. As an alternative, IPSec can be also be used to secure 6389 Diameter peer connections but its usage is transparent from the 6390 Diameter node and Diameter protocol perspective. These security 6391 mechanism is acceptable in environments where there is no untrusted 6392 third party agent. 6394 Diameter clients, such as Network Access Servers (NASes) and Mobility 6395 Agents MAY support TLS [RFC2246]. Diameter servers MUST support TLS. 6396 Diameter implementations SHOULD use transmission-level security of 6397 some kind (IPsec or TLS) on each connection. 6399 If a Diameter connection is to be protected via TLS, then the CER/CEA 6400 exchange MUST include an Inband-Security-ID AVP with a value of TLS. 6401 For TLS usage, a TLS handshake will begin when both ends are in the 6402 open state, after completion of the CER/CEA exchange. If the TLS 6403 handshake is successful, all further messages will be sent via TLS. 6404 If the handshake fails, both ends move to the closed state. See 6405 Sections 13.1 for more details. 6407 13.1. TLS Usage 6409 A Diameter node that initiates a connection to another Diameter node 6410 acts as a TLS client according to [RFC2246], and a Diameter node that 6411 accepts a connection acts as a TLS server. Diameter nodes 6412 implementing TLS for security MUST mutually authenticate as part of 6413 TLS session establishment. In order to ensure mutual authentication, 6414 the Diameter node acting as TLS server must request a certificate 6415 from the Diameter node acting as TLS client, and the Diameter node 6416 acting as TLS client MUST be prepared to supply a certificate on 6417 request. 6419 Diameter nodes MUST be able to negotiate the following TLS cipher 6420 suites: 6422 TLS_RSA_WITH_RC4_128_MD5 6423 TLS_RSA_WITH_RC4_128_SHA 6424 TLS_RSA_WITH_3DES_EDE_CBC_SHA 6426 Diameter nodes SHOULD be able to negotiate the following TLS cipher 6427 suite: 6429 TLS_RSA_WITH_AES_128_CBC_SHA 6431 Diameter nodes MAY negotiate other TLS cipher suites. 6433 13.2. Peer-to-Peer Considerations 6435 As with any peer-to-peer protocol, proper configuration of the trust 6436 model within a Diameter peer is essential to security. When 6437 certificates are used, it is necessary to configure the root 6438 certificate authorities trusted by the Diameter peer. These root CAs 6439 are likely to be unique to Diameter usage and distinct from the root 6440 CAs that might be trusted for other purposes such as Web browsing. 6441 In general, it is expected that those root CAs will be configured so 6442 as to reflect the business relationships between the organization 6443 hosting the Diameter peer and other organizations. As a result, a 6444 Diameter peer will typically not be configured to allow connectivity 6445 with any arbitrary peer. With certificate authentication, Diameter 6446 peers may not be known beforehand and therefore peer discovery may be 6447 required. 6449 14. References 6451 14.1. Normative References 6453 [FLOATPOINT] 6454 Institute of Electrical and Electronics Engineers, "IEEE 6455 Standard for Binary Floating-Point Arithmetic, ANSI/IEEE 6456 Standard 754-1985", August 1985. 6458 [IANAADFAM] 6459 IANA,, "Address Family Numbers", 6460 http://www.iana.org/assignments/address-family-numbers. 6462 [RADTYPE] IANA,, "RADIUS Types", 6463 http://www.iana.org/assignments/radius-types. 6465 [IPV4] Postel, J., "Internet Protocol", RFC 791, September 1981. 6467 [TCP] Postel, J., "Transmission Control Protocol", RFC 793, 6468 January 1981. 6470 [RFC3539] Aboba, B. and J. Wood, "Authentication, Authorization and 6471 Accounting (AAA) Transport Profile", RFC 3539, June 2003. 6473 [RFC4004] Calhoun, P., Johansson, T., Perkins, C., Hiller, T., and 6474 P. McCann, "Diameter Mobile IPv4 Application", RFC 4004, 6475 August 2005. 6477 [RFC4005] Calhoun, P., Zorn, G., Spence, D., and D. Mitton, 6478 "Diameter Network Access Server Application", RFC 4005, 6479 August 2005. 6481 [RFC4006] Hakala, H., Mattila, L., Koskinen, J-P., Stura, M., and J. 6482 Loughney, "Diameter Credit-Control Application", RFC 4006, 6483 August 2005. 6485 [RFC4072] Eronen, P., Hiller, T., and G. Zorn, "Diameter Extensible 6486 Authentication Protocol (EAP) Application", RFC 4072, 6487 August 2005. 6489 [RFC4740] Garcia-Martin, M., Belinchon, M., Pallares-Lopez, M., 6490 Canales-Valenzuela, C., and K. Tammi, "Diameter Session 6491 Initiation Protocol (SIP) Application", RFC 4740, 6492 November 2006. 6494 [RFC2234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 6495 Specifications: ABNF", RFC 2234, November 1997. 6497 [RFC3232] Reynolds, J., "Assigned Numbers: RFC 1700 is Replaced by 6498 an On-line Database", RFC 3232, January 2002. 6500 [RFC3588] Calhoun, P., Loughney, J., Guttman, E., Zorn, G., and J. 6501 Arkko, "Diameter Base Protocol", RFC 3588, September 2003. 6503 [RFC2474] Nichols, K., Blake, S., Baker, F., and D. Black, 6504 "Definition of the Differentiated Services Field (DS 6505 Field) in the IPv4 and IPv6 Headers", RFC 2474, 6506 December 1998. 6508 [RFC2284] Blunk, L. and J. Vollbrecht, "PPP Extensible 6509 Authentication Protocol (EAP)", RFC 2284, March 1998. 6511 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an 6512 IANA Considerations Section in RFCs", BCP 26, RFC 2434, 6513 October 1998. 6515 [RFC2409] Harkins, D. and D. Carrel, "The Internet Key Exchange 6516 (IKE)", RFC 2409, November 1998. 6518 [RFC2373] Hinden, R. and S. Deering, "IP Version 6 Addressing 6519 Architecture", RFC 2373, July 1998. 6521 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6522 Requirement Levels", BCP 14, RFC 2119, March 1997. 6524 [RFC4282] Aboba, B., Beadles, M., Arkko, J., and P. Eronen, "The 6525 Network Access Identifier", RFC 4282, December 2005. 6527 [RFC2915] Mealling, M. and R. Daniel, "The Naming Authority Pointer 6528 (NAPTR) DNS Resource Record", RFC 2915, September 2000. 6530 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 6531 A., Peterson, J., Sparks, R., Handley, M., and E. 6532 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 6533 June 2002. 6535 [RFC2960] Stewart, R., Xie, Q., Morneault, K., Sharp, C., 6536 Schwarzbauer, H., Taylor, T., Rytina, I., Kalla, M., 6537 Zhang, L., and V. Paxson, "Stream Control Transmission 6538 Protocol", RFC 2960, October 2000. 6540 [RFC2030] Mills, D., "Simple Network Time Protocol (SNTP) Version 4 6541 for IPv4, IPv6 and OSI", RFC 2030, October 1996. 6543 [RFC2246] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0", 6544 RFC 2246, January 1999. 6546 [RFC2396] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 6547 Resource Identifiers (URI): Generic Syntax", RFC 2396, 6548 August 1998. 6550 [RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO 6551 10646", RFC 2279, January 1998. 6553 14.2. Informational References 6555 [RFC2989] Aboba, B., Calhoun, P., Glass, S., Hiller, T., McCann, P., 6556 Shiino, H., Zorn, G., Dommety, G., C.Perkins, B.Patil, 6557 D.Mitton, S.Manning, M.Beadles, P.Walsh, X.Chen, 6558 S.Sivalingham, A.Hameed, M.Munson, S.Jacobs, B.Lim, 6559 B.Hirschman, R.Hsu, Y.Xu, E.Campell, S.Baba, and E.Jaques, 6560 "Criteria for Evaluating AAA Protocols for Network 6561 Access", RFC 2989, November 2000. 6563 [RFC2975] Aboba, B., Arkko, J., and D. Harrington, "Introduction to 6564 Accounting Management", RFC 2975, October 2000. 6566 [RFC3576] Chiba, M., Dommety, G., Eklund, M., Mitton, D., and B. 6567 Aboba, "Dynamic Authorization Extensions to Remote 6568 Authentication Dial In User Service (RADIUS)", RFC 3576, 6569 July 2003. 6571 [RFC1661] Simpson, W., "The Point-to-Point Protocol (PPP)", STD 51, 6572 RFC 1661, July 1994. 6574 [RFC2607] Aboba, B. and J. Vollbrecht, "Proxy Chaining and Policy 6575 Implementation in Roaming", RFC 2607, June 1999. 6577 [RFC2866] Rigney, C., "RADIUS Accounting", RFC 2866, June 2000. 6579 [RFC2869] Rigney, C., Willats, W., and P. Calhoun, "RADIUS 6580 Extensions", RFC 2869, June 2000. 6582 [RFC2865] Rigney, C., Willens, S., Rubens, A., and W. Simpson, 6583 "Remote Authentication Dial In User Service (RADIUS)", 6584 RFC 2865, June 2000. 6586 [RFC3162] Aboba, B., Zorn, G., and D. Mitton, "RADIUS and IPv6", 6587 RFC 3162, August 2001. 6589 [RFC2194] Aboba, B., Lu, J., Alsop, J., Ding, J., and W. Wang, 6590 "Review of Roaming Implementations", RFC 2194, 6591 September 1997. 6593 [RFC2477] Aboba, B. and G. Zorn, "Criteria for Evaluating Roaming 6594 Protocols", RFC 2477, January 1999. 6596 [RFC2401] Kent, S. and R. Atkinson, "Security Architecture for the 6597 Internet Protocol", RFC 2401, November 1998. 6599 [RFC1492] Finseth, C., "An Access Control Protocol, Sometimes Called 6600 TACACS", RFC 1492, July 1993. 6602 [IANA-EXP] 6603 Narten, T., "Assigning Experimental and Testing Numbers 6604 Considered Useful, Work in Progress.". 6606 Appendix A. Acknowledgements 6608 The authors would like to thank the following people that have 6609 provided proposals and contributions to this document: 6611 To Vishnu Ram and Satendra Gera for their contributions on 6612 Capabilities Updates, Predictive Loop Avoidance as well as many other 6613 technical proposals. To Tolga Asveren for his insights and 6614 contributions on almost all of the proposed solutions incorporated 6615 into this document. To Timothy Smith for helping on the Capabilities 6616 Updates and other topics. To Tony Zhang for providing fixes to loop 6617 holes on composing Failed-AVPs as well as many other issues and 6618 topics. To Jan Nordqvist for clearly stating the usage of 6619 application ids. To Anders Kristensen for providing needed technical 6620 opinions. To David Frascone for providing invaluable review of the 6621 document. 6623 Special thanks also to people who have provided invaluable comments 6624 and inputs especially in resolving controversial issues: 6626 Glen Zorn, Yoshihiro Ohba, Marco Stura, and Pasi Eronen. 6628 Finally, we would like to thank the original authors of this 6629 document: 6631 Pat Calhoun, John Loughney, Jari Arkko, Erik Guttman and Glen Zorn. 6633 Their invaluable knowledge and experience has given us a robust and 6634 flexible AAA protocol that many people have seen great value in 6635 adopting. We greatly appreciate their support and stewardship for 6636 the continued improvements of Diameter as a protocol. We would also 6637 like to extend our gratitude to folks aside from the authors who have 6638 assisted and contributed to the original version of this document. 6639 Their efforts significantly contributed to the success of Diameter. 6641 Appendix B. NAPTR Example 6643 As an example, consider a client that wishes to resolve aaa:ex.com. 6644 The client performs a NAPTR query for that domain, and the following 6645 NAPTR records are returned: 6647 ;; order pref flags service regexp replacement 6648 IN NAPTR 50 50 "s" "AAA+D2S" "" 6649 _diameter._sctp.example.com IN NAPTR 100 50 "s" "AAA+D2T" 6650 "" _aaa._tcp.example.com 6652 This indicates that the server supports SCTP, and TCP, in that order. 6653 If the client supports over SCTP, SCTP will be used, targeted to a 6654 host determined by an SRV lookup of _diameter._sctp.ex.com. That 6655 lookup would return: 6657 ;; Priority Weight Port Target 6658 IN SRV 0 1 5060 server1.example.com IN SRV 0 6659 2 5060 server2.example.com 6661 Appendix C. Duplicate Detection 6663 As described in Section 9.4, accounting record duplicate detection is 6664 based on session identifiers. Duplicates can appear for various 6665 reasons: 6667 o Failover to an alternate server. Where close to real-time 6668 performance is required, failover thresholds need to be kept low 6669 and this may lead to an increased likelihood of duplicates. 6670 Failover can occur at the client or within Diameter agents. 6672 o Failure of a client or agent after sending of a record from non- 6673 volatile memory, but prior to receipt of an application layer ACK 6674 and deletion of the record. record to be sent. This will result 6675 in retransmission of the record soon after the client or agent has 6676 rebooted. 6678 o Duplicates received from RADIUS gateways. Since the 6679 retransmission behavior of RADIUS is not defined within [RFC2865], 6680 the likelihood of duplication will vary according to the 6681 implementation. 6683 o Implementation problems and misconfiguration. 6685 The T flag is used as an indication of an application layer 6686 retransmission event, e.g., due to failover to an alternate server. 6687 It is defined only for request messages sent by Diameter clients or 6688 agents. For instance, after a reboot, a client may not know whether 6689 it has already tried to send the accounting records in its non- 6690 volatile memory before the reboot occurred. Diameter servers MAY use 6691 the T flag as an aid when processing requests and detecting duplicate 6692 messages. However, servers that do this MUST ensure that duplicates 6693 are found even when the first transmitted request arrives at the 6694 server after the retransmitted request. It can be used only in cases 6695 where no answer has been received from the Server for a request and 6696 the request is sent again, (e.g., due to a failover to an alternate 6697 peer, due to a recovered primary peer or due to a client re-sending a 6698 stored record from non-volatile memory such as after reboot of a 6699 client or agent). 6701 In some cases the Diameter accounting server can delay the duplicate 6702 detection and accounting record processing until a post-processing 6703 phase takes place. At that time records are likely to be sorted 6704 according to the included User-Name and duplicate elimination is easy 6705 in this case. In other situations it may be necessary to perform 6706 real-time duplicate detection, such as when credit limits are imposed 6707 or real-time fraud detection is desired. 6709 In general, only generation of duplicates due to failover or re- 6710 sending of records in non-volatile storage can be reliably detected 6711 by Diameter clients or agents. In such cases the Diameter client or 6712 agents can mark the message as possible duplicate by setting the T 6713 flag. Since the Diameter server is responsible for duplicate 6714 detection, it can choose to make use of the T flag or not, in order 6715 to optimize duplicate detection. Since the T flag does not affect 6716 interoperability, and may not be needed by some servers, generation 6717 of the T flag is REQUIRED for Diameter clients and agents, but MAY be 6718 implemented by Diameter servers. 6720 As an example, it can be usually be assumed that duplicates appear 6721 within a time window of longest recorded network partition or device 6722 fault, perhaps a day. So only records within this time window need 6723 to be looked at in the backward direction. Secondly, hashing 6724 techniques or other schemes, such as the use of the T flag in the 6725 received messages, may be used to eliminate the need to do a full 6726 search even in this set except for rare cases. 6728 The following is an example of how the T flag may be used by the 6729 server to detect duplicate requests. 6731 A Diameter server MAY check the T flag of the received message to 6732 determine if the record is a possible duplicate. If the T flag is 6733 set in the request message, the server searches for a duplicate 6734 within a configurable duplication time window backward and 6735 forward. This limits database searching to those records where 6736 the T flag is set. In a well run network, network partitions and 6737 device faults will presumably be rare events, so this approach 6738 represents a substantial optimization of the duplicate detection 6739 process. During failover, it is possible for the original record 6740 to be received after the T flag marked record, due to differences 6741 in network delays experienced along the path by the original and 6742 duplicate transmissions. The likelihood of this occurring 6743 increases as the failover interval is decreased. In order to be 6744 able to detect out of order duplicates, the Diameter server should 6745 use backward and forward time windows when performing duplicate 6746 checking for the T flag marked request. For example, in order to 6747 allow time for the original record to exit the network and be 6748 recorded by the accounting server, the Diameter server can delay 6749 processing records with the T flag set until a time period 6750 TIME_WAIT + RECORD_PROCESSING_TIME has elapsed after the closing 6751 of the original transport connection. After this time period has 6752 expired, then it may check the T flag marked records against the 6753 database with relative assurance that the original records, if 6754 sent, have been received and recorded. 6756 Authors' Addresses 6758 Victor Fajardo (editor) 6759 Toshiba America Research 6760 One Telcordia Drive, 1S-222 6761 Piscataway, NJ 08854 6762 USA 6764 Phone: 1 908-421-1845 6765 Email: vfajardo@tari.toshiba.com 6767 Jari Arkko 6768 Ericsson Research 6769 02420 Jorvas 6770 Finland 6772 Phone: +358 40 5079256 6773 Email: jari.arkko@ericsson.com 6775 John Loughney 6776 Nokia Research Center 6777 Itamerenkatu 11-13 6778 Helsinki, 00180 6779 Finland 6781 Phone: +358 50 483 6242 6782 Email: john.loughney@nokia.com 6784 Full Copyright Statement 6786 Copyright (C) The IETF Trust (2007). 6788 This document is subject to the rights, licenses and restrictions 6789 contained in BCP 78, and except as set forth therein, the authors 6790 retain all their rights. 6792 This document and the information contained herein are provided on an 6793 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 6794 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND 6795 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS 6796 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF 6797 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 6798 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 6800 Intellectual Property 6802 The IETF takes no position regarding the validity or scope of any 6803 Intellectual Property Rights or other rights that might be claimed to 6804 pertain to the implementation or use of the technology described in 6805 this document or the extent to which any license under such rights 6806 might or might not be available; nor does it represent that it has 6807 made any independent effort to identify any such rights. Information 6808 on the procedures with respect to rights in RFC documents can be 6809 found in BCP 78 and BCP 79. 6811 Copies of IPR disclosures made to the IETF Secretariat and any 6812 assurances of licenses to be made available, or the result of an 6813 attempt made to obtain a general license or permission for the use of 6814 such proprietary rights by implementers or users of this 6815 specification can be obtained from the IETF on-line IPR repository at 6816 http://www.ietf.org/ipr. 6818 The IETF invites any interested party to bring to its attention any 6819 copyrights, patents or patent applications, or other proprietary 6820 rights that may cover technology that may be required to implement 6821 this standard. Please address the information to the IETF at 6822 ietf-ipr@ietf.org. 6824 Acknowledgment 6826 Funding for the RFC Editor function is provided by the IETF 6827 Administrative Support Activity (IASA).