idnits 2.17.1 draft-ietf-dime-rfc3588bis-02.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 16. -- Found old boilerplate from RFC 3978, Section 5.5, updated by RFC 4748 on line 7054. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 7065. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 7072. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 7078. 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 4566 has weird spacing: '...ly with wit...' == Line 4762 has weird spacing: '...ealtime user...' == Line 4790 has weird spacing: '... record inter...' == Line 4800 has weird spacing: '...ealtime user...' == Line 4808 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 (March 3, 2007) is 6264 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. 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: 'DIFFSERV' is mentioned on line 2367, but not defined == Missing Reference: 'PXY' is mentioned on line 4326, but not defined == Unused Reference: 'IANAWEB' is defined on line 6591, but no explicit reference was found in the text == Unused Reference: 'RFC2474' is defined on line 6634, but no explicit reference was found in the text == Unused Reference: 'RFC2597' is defined on line 6639, but no explicit reference was found in the text == Unused Reference: 'RFC3246' is defined on line 6642, but no explicit reference was found in the text == Unused Reference: 'RFC2782' is defined on line 6647, but no explicit reference was found in the text == Unused Reference: 'RFC3436' is defined on line 6702, but no explicit reference was found in the text == Unused Reference: 'RFC3141' is defined on line 6723, but no explicit reference was found in the text == Unused Reference: 'RFC3344' is defined on line 6738, but no explicit reference was found in the text == Unused Reference: 'RFC2977' is defined on line 6741, but no explicit reference was found in the text == Unused Reference: 'RFC2881' is defined on line 6745, but no explicit reference was found in the text == Unused Reference: 'RFC3169' is defined on line 6749, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'FLOATPOINT' -- Possible downref: Non-RFC (?) normative reference: ref. 'IANAADFAM' -- Possible downref: Non-RFC (?) normative reference: ref. 'IANAWEB' -- 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 2407 (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 3344 (Obsoleted by RFC 5944) -- Obsolete informational reference (is this intentional?): RFC 2401 (Obsoleted by RFC 4301) Summary: 19 errors (**), 0 flaws (~~), 25 warnings (==), 16 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. Loughney 5 Expires: September 4, 2007 Nokia Research Center 6 March 3, 2007 8 Diameter Base Protocol 9 draft-ietf-dime-rfc3588bis-02.txt 11 Status of this Memo 13 By submitting this Internet-Draft, each author represents that any 14 applicable patent or other IPR claims of which he or she is aware 15 have been or will be disclosed, and any of which he or she becomes 16 aware will be disclosed, in accordance with Section 6 of BCP 79. 18 Internet-Drafts are working documents of the Internet Engineering 19 Task Force (IETF), its areas, and its working groups. Note that 20 other groups may also distribute working documents as Internet- 21 Drafts. 23 Internet-Drafts are draft documents valid for a maximum of six months 24 and may be updated, replaced, or obsoleted by other documents at any 25 time. It is inappropriate to use Internet-Drafts as reference 26 material or to cite them other than as "work in progress." 28 The list of current Internet-Drafts can be accessed at 29 http://www.ietf.org/ietf/1id-abstracts.txt. 31 The list of Internet-Draft Shadow Directories can be accessed at 32 http://www.ietf.org/shadow.html. 34 This Internet-Draft will expire on September 4, 2007. 36 Copyright Notice 38 Copyright (C) The IETF Trust (2007). 40 Abstract 42 The Diameter base protocol is intended to provide an Authentication, 43 Authorization and Accounting (AAA) framework for applications such as 44 network access or IP mobility. Diameter is also intended to work in 45 both local Authentication, Authorization & Accounting and roaming 46 situations. This document specifies the message format, transport, 47 error reporting, accounting and security services to be used by all 48 Diameter applications. The Diameter base application needs to be 49 supported by all Diameter implementations. 51 Table of Contents 53 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 7 54 1.1. Diameter Protocol . . . . . . . . . . . . . . . . . . . . 10 55 1.1.1. Description of the Document Set . . . . . . . . . . 11 56 1.1.2. Conventions Used in This Document . . . . . . . . . 12 57 1.2. Approach to Extensibility . . . . . . . . . . . . . . . . 12 58 1.2.1. Defining New AVP Values . . . . . . . . . . . . . . 13 59 1.2.2. Creating New AVPs . . . . . . . . . . . . . . . . . 13 60 1.2.3. Creating New Authentication Applications . . . . . . 13 61 1.2.4. Creating New Accounting Applications . . . . . . . . 14 62 1.2.5. Application Authentication Procedures . . . . . . . 15 63 1.3. Terminology . . . . . . . . . . . . . . . . . . . . . . . 16 64 2. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 23 65 2.1. Transport . . . . . . . . . . . . . . . . . . . . . . . . 24 66 2.1.1. SCTP Guidelines . . . . . . . . . . . . . . . . . . 25 67 2.2. Securing Diameter Messages . . . . . . . . . . . . . . . 25 68 2.3. Diameter Application Compliance . . . . . . . . . . . . . 25 69 2.4. Application Identifiers . . . . . . . . . . . . . . . . . 26 70 2.5. Connections vs. Sessions . . . . . . . . . . . . . . . . 26 71 2.6. Peer Table . . . . . . . . . . . . . . . . . . . . . . . 27 72 2.7. Routing Table . . . . . . . . . . . . . . . . . . . . . . 28 73 2.8. Role of Diameter Agents . . . . . . . . . . . . . . . . . 30 74 2.8.1. Relay Agents . . . . . . . . . . . . . . . . . . . . 31 75 2.8.2. Proxy Agents . . . . . . . . . . . . . . . . . . . . 32 76 2.8.3. Redirect Agents . . . . . . . . . . . . . . . . . . 32 77 2.8.4. Translation Agents . . . . . . . . . . . . . . . . . 33 78 2.9. End-to-End Security Framework . . . . . . . . . . . . . . 34 79 2.10. Diameter Path Authorization . . . . . . . . . . . . . . . 35 80 3. Diameter Header . . . . . . . . . . . . . . . . . . . . . . . 37 81 3.1. Command Codes . . . . . . . . . . . . . . . . . . . . . . 40 82 3.2. Command Code ABNF specification . . . . . . . . . . . . . 41 83 3.3. Diameter Command Naming Conventions . . . . . . . . . . . 43 84 4. Diameter AVPs . . . . . . . . . . . . . . . . . . . . . . . . 44 85 4.1. AVP Header . . . . . . . . . . . . . . . . . . . . . . . 44 86 4.1.1. Optional Header Elements . . . . . . . . . . . . . . 46 88 4.2. Basic AVP Data Formats . . . . . . . . . . . . . . . . . 46 89 4.3. Derived AVP Data Formats . . . . . . . . . . . . . . . . 48 90 4.4. Grouped AVP Values . . . . . . . . . . . . . . . . . . . 56 91 4.4.1. Example AVP with a Grouped Data type . . . . . . . . 57 92 4.5. Diameter Base Protocol AVPs . . . . . . . . . . . . . . . 60 93 5. Diameter Peers . . . . . . . . . . . . . . . . . . . . . . . 63 94 5.1. Peer Connections . . . . . . . . . . . . . . . . . . . . 63 95 5.2. Diameter Peer Discovery . . . . . . . . . . . . . . . . . 63 96 5.3. Capabilities Exchange . . . . . . . . . . . . . . . . . . 66 97 5.3.1. Capabilities-Exchange-Request . . . . . . . . . . . 67 98 5.3.2. Capabilities-Exchange-Answer . . . . . . . . . . . . 68 99 5.3.3. Vendor-Id AVP . . . . . . . . . . . . . . . . . . . 69 100 5.3.4. Firmware-Revision AVP . . . . . . . . . . . . . . . 69 101 5.3.5. Host-IP-Address AVP . . . . . . . . . . . . . . . . 69 102 5.3.6. Supported-Vendor-Id AVP . . . . . . . . . . . . . . 69 103 5.3.7. Product-Name AVP . . . . . . . . . . . . . . . . . . 70 104 5.4. Disconnecting Peer connections . . . . . . . . . . . . . 70 105 5.4.1. Disconnect-Peer-Request . . . . . . . . . . . . . . 70 106 5.4.2. Disconnect-Peer-Answer . . . . . . . . . . . . . . . 71 107 5.4.3. Disconnect-Cause AVP . . . . . . . . . . . . . . . . 71 108 5.5. Transport Failure Detection . . . . . . . . . . . . . . . 72 109 5.5.1. Device-Watchdog-Request . . . . . . . . . . . . . . 72 110 5.5.2. Device-Watchdog-Answer . . . . . . . . . . . . . . . 72 111 5.5.3. Transport Failure Algorithm . . . . . . . . . . . . 73 112 5.5.4. Failover and Failback Procedures . . . . . . . . . . 73 113 5.6. Peer State Machine . . . . . . . . . . . . . . . . . . . 73 114 5.6.1. Incoming connections . . . . . . . . . . . . . . . . 76 115 5.6.2. Events . . . . . . . . . . . . . . . . . . . . . . . 76 116 5.6.3. Actions . . . . . . . . . . . . . . . . . . . . . . 77 117 5.6.4. The Election Process . . . . . . . . . . . . . . . . 79 118 5.6.5. Capabilities Update . . . . . . . . . . . . . . . . 79 119 6. Diameter message processing . . . . . . . . . . . . . . . . . 80 120 6.1. Diameter Request Routing Overview . . . . . . . . . . . . 80 121 6.1.1. Originating a Request . . . . . . . . . . . . . . . 81 122 6.1.2. Sending a Request . . . . . . . . . . . . . . . . . 82 123 6.1.3. Receiving Requests . . . . . . . . . . . . . . . . . 82 124 6.1.4. Processing Local Requests . . . . . . . . . . . . . 82 125 6.1.5. Request Forwarding . . . . . . . . . . . . . . . . . 82 126 6.1.6. Request Routing . . . . . . . . . . . . . . . . . . 83 127 6.1.7. Predictive Loop Avoidance . . . . . . . . . . . . . 83 128 6.1.8. Redirecting requests . . . . . . . . . . . . . . . . 83 129 6.1.9. Relaying and Proxying Requests . . . . . . . . . . . 84 130 6.2. Diameter Answer Processing . . . . . . . . . . . . . . . 85 131 6.2.1. Processing received Answers . . . . . . . . . . . . 86 132 6.2.2. Relaying and Proxying Answers . . . . . . . . . . . 86 133 6.3. Origin-Host AVP . . . . . . . . . . . . . . . . . . . . . 86 134 6.4. Origin-Realm AVP . . . . . . . . . . . . . . . . . . . . 87 135 6.5. Destination-Host AVP . . . . . . . . . . . . . . . . . . 87 136 6.6. Destination-Realm AVP . . . . . . . . . . . . . . . . . . 87 137 6.7. Routing AVPs . . . . . . . . . . . . . . . . . . . . . . 88 138 6.7.1. Route-Record AVP . . . . . . . . . . . . . . . . . . 88 139 6.7.2. Proxy-Info AVP . . . . . . . . . . . . . . . . . . . 88 140 6.7.3. Proxy-Host AVP . . . . . . . . . . . . . . . . . . . 88 141 6.7.4. Proxy-State AVP . . . . . . . . . . . . . . . . . . 88 142 6.8. Auth-Application-Id AVP . . . . . . . . . . . . . . . . . 88 143 6.9. Acct-Application-Id AVP . . . . . . . . . . . . . . . . . 89 144 6.10. Inband-Security-Id AVP . . . . . . . . . . . . . . . . . 89 145 6.11. Vendor-Specific-Application-Id AVP . . . . . . . . . . . 89 146 6.12. Redirect-Host AVP . . . . . . . . . . . . . . . . . . . . 90 147 6.13. Redirect-Host-Usage AVP . . . . . . . . . . . . . . . . . 90 148 6.14. Redirect-Max-Cache-Time AVP . . . . . . . . . . . . . . . 91 149 6.15. E2E-Sequence AVP . . . . . . . . . . . . . . . . . . . . 91 150 7. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 93 151 7.1. Result-Code AVP . . . . . . . . . . . . . . . . . . . . . 95 152 7.1.1. Informational . . . . . . . . . . . . . . . . . . . 95 153 7.1.2. Success . . . . . . . . . . . . . . . . . . . . . . 96 154 7.1.3. Protocol Errors . . . . . . . . . . . . . . . . . . 96 155 7.1.4. Transient Failures . . . . . . . . . . . . . . . . . 97 156 7.1.5. Permanent Failures . . . . . . . . . . . . . . . . . 98 157 7.2. Error Bit . . . . . . . . . . . . . . . . . . . . . . . . 101 158 7.3. Error-Message AVP . . . . . . . . . . . . . . . . . . . . 101 159 7.4. Error-Reporting-Host AVP . . . . . . . . . . . . . . . . 102 160 7.5. Failed-AVP AVP . . . . . . . . . . . . . . . . . . . . . 102 161 7.6. Experimental-Result AVP . . . . . . . . . . . . . . . . . 103 162 7.7. Experimental-Result-Code AVP . . . . . . . . . . . . . . 103 163 8. Diameter User Sessions . . . . . . . . . . . . . . . . . . . 104 164 8.1. Authorization Session State Machine . . . . . . . . . . . 105 165 8.2. Accounting Session State Machine . . . . . . . . . . . . 109 166 8.3. Server-Initiated Re-Auth . . . . . . . . . . . . . . . . 115 167 8.3.1. Re-Auth-Request . . . . . . . . . . . . . . . . . . 115 168 8.3.2. Re-Auth-Answer . . . . . . . . . . . . . . . . . . . 116 169 8.4. Session Termination . . . . . . . . . . . . . . . . . . . 117 170 8.4.1. Session-Termination-Request . . . . . . . . . . . . 118 171 8.4.2. Session-Termination-Answer . . . . . . . . . . . . . 118 172 8.5. Aborting a Session . . . . . . . . . . . . . . . . . . . 119 173 8.5.1. Abort-Session-Request . . . . . . . . . . . . . . . 120 174 8.5.2. Abort-Session-Answer . . . . . . . . . . . . . . . . 120 175 8.6. Inferring Session Termination from Origin-State-Id . . . 121 176 8.7. Auth-Request-Type AVP . . . . . . . . . . . . . . . . . . 122 177 8.8. Session-Id AVP . . . . . . . . . . . . . . . . . . . . . 122 178 8.9. Authorization-Lifetime AVP . . . . . . . . . . . . . . . 123 179 8.10. Auth-Grace-Period AVP . . . . . . . . . . . . . . . . . . 124 180 8.11. Auth-Session-State AVP . . . . . . . . . . . . . . . . . 124 181 8.12. Re-Auth-Request-Type AVP . . . . . . . . . . . . . . . . 125 182 8.13. Session-Timeout AVP . . . . . . . . . . . . . . . . . . . 125 183 8.14. User-Name AVP . . . . . . . . . . . . . . . . . . . . . . 126 184 8.15. Termination-Cause AVP . . . . . . . . . . . . . . . . . . 126 185 8.16. Origin-State-Id AVP . . . . . . . . . . . . . . . . . . . 127 186 8.17. Session-Binding AVP . . . . . . . . . . . . . . . . . . . 128 187 8.18. Session-Server-Failover AVP . . . . . . . . . . . . . . . 128 188 8.19. Multi-Round-Time-Out AVP . . . . . . . . . . . . . . . . 129 189 8.20. Class AVP . . . . . . . . . . . . . . . . . . . . . . . . 129 190 8.21. Event-Timestamp AVP . . . . . . . . . . . . . . . . . . . 130 191 9. Accounting . . . . . . . . . . . . . . . . . . . . . . . . . 131 192 9.1. Server Directed Model . . . . . . . . . . . . . . . . . . 131 193 9.2. Protocol Messages . . . . . . . . . . . . . . . . . . . . 132 194 9.3. Accounting Application Extension and Requirements . . . . 132 195 9.4. Fault Resilience . . . . . . . . . . . . . . . . . . . . 133 196 9.5. Accounting Records . . . . . . . . . . . . . . . . . . . 134 197 9.6. Correlation of Accounting Records . . . . . . . . . . . . 135 198 9.7. Accounting Command-Codes . . . . . . . . . . . . . . . . 135 199 9.7.1. Accounting-Request . . . . . . . . . . . . . . . . . 135 200 9.7.2. Accounting-Answer . . . . . . . . . . . . . . . . . 136 201 9.8. Accounting AVPs . . . . . . . . . . . . . . . . . . . . . 137 202 9.8.1. Accounting-Record-Type AVP . . . . . . . . . . . . . 137 203 9.8.2. Acct-Interim-Interval . . . . . . . . . . . . . . . 138 204 9.8.3. Accounting-Record-Number AVP . . . . . . . . . . . . 139 205 9.8.4. Acct-Session-Id AVP . . . . . . . . . . . . . . . . 139 206 9.8.5. Acct-Multi-Session-Id AVP . . . . . . . . . . . . . 139 207 9.8.6. Accounting-Sub-Session-Id AVP . . . . . . . . . . . 140 208 9.8.7. Accounting-Realtime-Required AVP . . . . . . . . . . 140 209 10. AVP Occurrence Table . . . . . . . . . . . . . . . . . . . . 141 210 10.1. Base Protocol Command AVP Table . . . . . . . . . . . . . 141 211 10.2. Accounting AVP Table . . . . . . . . . . . . . . . . . . 142 212 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 144 213 11.1. AVP Header . . . . . . . . . . . . . . . . . . . . . . . 144 214 11.1.1. AVP Codes . . . . . . . . . . . . . . . . . . . . . 144 215 11.1.2. AVP Flags . . . . . . . . . . . . . . . . . . . . . 145 216 11.2. Diameter Header . . . . . . . . . . . . . . . . . . . . . 145 217 11.2.1. Command Codes . . . . . . . . . . . . . . . . . . . 145 218 11.2.2. Command Flags . . . . . . . . . . . . . . . . . . . 146 219 11.3. Application Identifiers . . . . . . . . . . . . . . . . . 146 220 11.4. AVP Values . . . . . . . . . . . . . . . . . . . . . . . 146 221 11.4.1. Result-Code AVP Values . . . . . . . . . . . . . . . 147 222 11.4.2. Accounting-Record-Type AVP Values . . . . . . . . . 147 223 11.4.3. Termination-Cause AVP Values . . . . . . . . . . . . 147 224 11.4.4. Redirect-Host-Usage AVP Values . . . . . . . . . . . 147 225 11.4.5. Session-Server-Failover AVP Values . . . . . . . . . 147 226 11.4.6. Session-Binding AVP Values . . . . . . . . . . . . . 147 227 11.4.7. Disconnect-Cause AVP Values . . . . . . . . . . . . 147 228 11.4.8. Auth-Request-Type AVP Values . . . . . . . . . . . . 147 229 11.4.9. Auth-Session-State AVP Values . . . . . . . . . . . 148 230 11.4.10. Re-Auth-Request-Type AVP Values . . . . . . . . . . 148 231 11.4.11. Accounting-Realtime-Required AVP Values . . . . . . 148 232 11.4.12. Inband-Security-Id AVP (code 299) . . . . . . . . . 148 233 11.5. Diameter TCP/SCTP Port Numbers . . . . . . . . . . . . . 148 234 11.6. NAPTR Service Fields . . . . . . . . . . . . . . . . . . 148 235 12. Diameter protocol related configurable parameters . . . . . . 150 236 13. Security Considerations . . . . . . . . . . . . . . . . . . . 151 237 13.1. IPsec Usage . . . . . . . . . . . . . . . . . . . . . . . 151 238 13.2. TLS Usage . . . . . . . . . . . . . . . . . . . . . . . . 152 239 13.3. Peer-to-Peer Considerations . . . . . . . . . . . . . . . 153 240 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 155 241 14.1. Normative References . . . . . . . . . . . . . . . . . . 155 242 14.2. Informational References . . . . . . . . . . . . . . . . 157 243 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 160 244 Appendix B. Diameter Service Template . . . . . . . . . . . . . 161 245 Appendix C. NAPTR Example . . . . . . . . . . . . . . . . . . . 163 246 Appendix D. Duplicate Detection . . . . . . . . . . . . . . . . 164 247 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 166 248 Intellectual Property and Copyright Statements . . . . . . . . . 167 250 1. Introduction 252 Authentication, Authorization and Accounting (AAA) protocols such as 253 TACACS [RFC1492] and RADIUS [RFC2865] were initially deployed to 254 provide dial-up PPP [RFC1661] and terminal server access. Over time, 255 with the growth of the Internet and the introduction of new access 256 technologies, including wireless, DSL, Mobile IP and Ethernet, 257 routers and network access servers (NAS) have increased in complexity 258 and density, putting new demands on AAA protocols. 260 Network access requirements for AAA protocols are summarized in 261 [RFC2989]. These include: 263 Failover 265 [RFC2865] does not define failover mechanisms, and as a result, 266 failover behavior differs between implementations. In order to 267 provide well defined failover behavior, Diameter supports 268 application-layer acknowledgements, and defines failover 269 algorithms and the associated state machine. This is described in 270 Section 5.5 and [RFC3539]. 272 Transmission-level security 274 [RFC2865] defines an application-layer authentication and 275 integrity scheme that is required only for use with Response 276 packets. While [RFC2869] defines an additional authentication and 277 integrity mechanism, use is only required during Extensible 278 Authentication Protocol (EAP) sessions. While attribute-hiding is 279 supported, [RFC2865] does not provide support for per-packet 280 confidentiality. In accounting, [RFC2866] assumes that replay 281 protection is provided by the backend billing server, rather than 282 within the protocol itself. 284 While [RFC3162] defines the use of IPsec with RADIUS, support for 285 IPsec is not required. Since within [RFC2409] authentication 286 occurs only within Phase 1 prior to the establishment of IPsec SAs 287 in Phase 2, it is typically not possible to define separate trust 288 or authorization schemes for each application. This limits the 289 usefulness of IPsec in inter-domain AAA applications (such as 290 roaming) where it may be desirable to define a distinct 291 certificate hierarchy for use in a AAA deployment. In order to 292 provide universal support for transmission-level security, and 293 enable both intra- and inter-domain AAA deployments, IPsec support 294 is mandatory in Diameter, and TLS support is optional. Security 295 is discussed in Section 13. 297 Reliable transport 299 RADIUS runs over UDP, and does not define retransmission behavior; 300 as a result, reliability varies between implementations. As 301 described in [RFC2975], this is a major issue in accounting, where 302 packet loss may translate directly into revenue loss. In order to 303 provide well defined transport behavior, Diameter runs over 304 reliable transport mechanisms (TCP, SCTP) as defined in [RFC3539]. 306 Agent support 308 [RFC2865] does not provide for explicit support for agents, 309 including Proxies, Redirects and Relays. Since the expected 310 behavior is not defined, it varies between implementations. 311 Diameter defines agent behavior explicitly; this is described in 312 Section 2.8. 314 Server-initiated messages 316 While RADIUS server-initiated messages are defined in [RFC3576], 317 support is optional. This makes it difficult to implement 318 features such as unsolicited disconnect or reauthentication/ 319 reauthorization on demand across a heterogeneous deployment. 320 Support for server-initiated messages is mandatory in Diameter, 321 and is described in Section 8. 323 Auditability 325 RADIUS does not define data-object security mechanisms, and as a 326 result, untrusted proxies may modify attributes or even packet 327 headers without being detected. Combined with lack of support for 328 capabilities negotiation, this makes it very difficult to 329 determine what occurred in the event of a dispute. While 330 implementation of data object security is not mandatory within 331 Diameter, these capabilities are supported, and are described in 332 [AAACMS]. 334 Transition support 336 While Diameter does not share a common protocol data unit (PDU) 337 with RADIUS, considerable effort has been expended in enabling 338 backward compatibility with RADIUS, so that the two protocols may 339 be deployed in the same network. Initially, it is expected that 340 Diameter will be deployed within new network devices, as well as 341 within gateways enabling communication between legacy RADIUS 342 devices and Diameter agents. This capability, described in 343 [RFC4005], enables Diameter support to be added to legacy 344 networks, by addition of a gateway or server speaking both RADIUS 345 and Diameter. 347 In addition to addressing the above requirements, Diameter also 348 provides support for the following: 350 Capability negotiation 352 RADIUS does not support error messages, capability negotiation, or 353 a mandatory/non-mandatory flag for attributes. Since RADIUS 354 clients and servers are not aware of each other's capabilities, 355 they may not be able to successfully negotiate a mutually 356 acceptable service, or in some cases, even be aware of what 357 service has been implemented. Diameter includes support for error 358 handling (Section 7), capability negotiation (Section 5.3), and 359 mandatory/non-mandatory attribute-value pairs (AVPs) (Section 360 4.1). 362 Peer discovery and configuration 364 RADIUS implementations typically require that the name or address 365 of servers or clients be manually configured, along with the 366 corresponding shared secrets. This results in a large 367 administrative burden, and creates the temptation to reuse the 368 RADIUS shared secret, which can result in major security 369 vulnerabilities if the Request Authenticator is not globally and 370 temporally unique as required in [RFC2865]. Through DNS, Diameter 371 enables dynamic discovery of peers. Derivation of dynamic session 372 keys is enabled via transmission-level security. 374 Roaming support 376 The ROAMOPS WG provided a survey of roaming implementations 377 [RFC2194], detailed roaming requirements [RFC2477], defined the 378 Network Access Identifier (NAI)[RFC4282], and documented existing 379 implementations (and imitations) of RADIUS-based roaming 380 [RFC2607]. In order to improve scalability, [RFC2607] introduced 381 the concept of proxy chaining via an intermediate server, 382 facilitating roaming between providers. However, since RADIUS 383 does not provide explicit support for proxies, and lacks 384 auditability and transmission-level security features, RADIUS- 385 based roaming is vulnerable to attack from external parties as 386 well as susceptible to fraud perpetrated by the roaming partners 387 themselves. As a result, it is not suitable for wide-scale 388 deployment on the Internet [RFC2607]. By providing explicit 389 support for inter-domain roaming and message routing (Sections 2.7 390 and 6), auditability [AAACMS], and transmission-layer security 391 (Section 13) features, Diameter addresses these limitations and 392 provides for secure and scalable roaming. 394 In the decade since AAA protocols were first introduced, the 395 capabilities of Network Access Server (NAS) devices have increased 396 substantially. As a result, while Diameter is a considerably more 397 sophisticated protocol than RADIUS, it remains feasible to implement 398 within embedded devices, given improvements in processor speeds and 399 the widespread availability of embedded IPsec and TLS 400 implementations. 402 1.1. Diameter Protocol 404 The Diameter base protocol provides the following facilities: 406 o Delivery of AVPs (attribute value pairs) 408 o Capabilities negotiation 410 o Error notification 412 o Extensibility, through addition of new commands and AVPs (required 413 in [RFC2989]). 415 o Basic services necessary for applications, such as handling of 416 user sessions or accounting 418 All data delivered by the protocol is in the form of an AVP. Some of 419 these AVP values are used by the Diameter protocol itself, while 420 others deliver data associated with particular applications that 421 employ Diameter. AVPs may be added arbitrarily to Diameter messages, 422 so long as the required AVPs are included and AVPs that are 423 explicitly excluded are not included. AVPs are used by the base 424 Diameter protocol to support the following required features: 426 o Transporting of user authentication information, for the purposes 427 of enabling the Diameter server to authenticate the user. 429 o Transporting of service specific authorization information, 430 between client and servers, allowing the peers to decide whether a 431 user's access request should be granted. 433 o Exchanging resource usage information, which MAY be used for 434 accounting purposes, capacity planning, etc. 436 o Relaying, proxying and redirecting of Diameter messages through a 437 server hierarchy. 439 The Diameter base protocol provides the minimum requirements needed 440 for a AAA protocol, as required by [RFC2989]. The base protocol may 441 be used by itself for accounting purposes only, or it may be used 442 with a Diameter application, such as Mobile IPv4 [RFC4004], or 443 network access [RFC4005]. It is also possible for the base protocol 444 to be extended for use in new applications, via the addition of new 445 commands or AVPs. At this time the focus of Diameter is network 446 access and accounting applications. A truly generic AAA protocol 447 used by many applications might provide functionality not provided by 448 Diameter. Therefore, it is imperative that the designers of new 449 applications understand their requirements before using Diameter. 450 See Section 2.4 for more information on Diameter applications. 452 Any node can initiate a request. In that sense, Diameter is a peer- 453 to-peer protocol. In this document, a Diameter Client is a device at 454 the edge of the network that performs access control, such as a 455 Network Access Server (NAS) or a Foreign Agent (FA). A Diameter 456 client generates Diameter messages to request authentication, 457 authorization, and accounting services for the user. A Diameter 458 agent is a node that does not authenticate and/or authorize messages 459 locally; agents include proxies, redirects and relay agents. A 460 Diameter server performs authentication and/or authorization of the 461 user. A Diameter node MAY act as an agent for certain requests while 462 acting as a server for others. 464 The Diameter protocol also supports server-initiated messages, such 465 as a request to abort service to a particular user. 467 1.1.1. Description of the Document Set 469 Currently, the Diameter specification consists of a base 470 specification (this document), Transport Profile [RFC3539] and 471 applications: Mobile IPv4 [RFC4004], NASREQ [RFC4005], Credit Control 472 [RFC4006], EAP [RFC4072] and SIP [RFC4740]. 474 The Transport Profile document [RFC3539] discusses transport layer 475 issues that arise with AAA protocols and recommendations on how to 476 overcome these issues. This document also defines the Diameter 477 failover algorithm and state machine. 479 The Mobile IPv4 [RFC4004] application defines a Diameter application 480 that allows a Diameter server to perform AAA functions for Mobile 481 IPv4 services to a mobile node. 483 The NASREQ [RFC4005] application defines a Diameter Application that 484 allows a Diameter server to be used in a PPP/SLIP Dial-Up and 485 Terminal Server Access environment. Consideration was given for 486 servers that need to perform protocol conversion between Diameter and 487 RADIUS. 489 The Credit Control [RFC4006] application defines a Diameter 490 Application that can be used to implement real-time credit-control 491 for a variety of end user services such as network access, SIP 492 services, messaging services, and download services. It provides a 493 general solution to real-time cost and credit-control. 495 The EAP [RFC4072] application defines a Diameter Application that can 496 be used to carry EAP packets between the Network Access Server (NAS) 497 working as an EAP authenticator and a back-end authentication server. 498 The Diameter EAP application is based on NASREQ and intended for a 499 similar environment. 501 The SIP [RFC4740] application defines a Diameter Application that 502 allows a Diameter client to request authentication and authorization 503 information to a Diameter server for SIP-based IP multimedia services 504 (see SIP [RFC3261]). 506 In summary, this document defines the base protocol specification for 507 AAA, which includes support for accounting. The applications 508 documents describe applications that use this base specification for 509 Authentication, Authorization and Accounting. 511 1.1.2. Conventions Used in This Document 513 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 514 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 515 document are to be interpreted as described in [RFC2119]. 517 1.2. Approach to Extensibility 519 The Diameter protocol is designed to be extensible, using several 520 mechanisms, including: 522 o Defining new AVP values 524 o Creating new AVPs 526 o Creating new authentication/authorization applications 527 o Creating new accounting applications 529 o Application authentication procedures 531 Reuse of existing AVP values, AVPs and Diameter applications are 532 strongly recommended. Reuse simplifies standardization and 533 implementation and avoids potential interoperability issues. It is 534 expected that command codes are reused; new command codes can only be 535 created by IETF Consensus (see Section 11.2.1). 537 1.2.1. Defining New AVP Values 539 New applications should attempt to reuse AVPs defined in existing 540 applications when possible, as opposed to creating new AVPs. For 541 AVPs of type Enumerated, an application may require a new value to 542 communicate some service-specific information. 544 In order to allocate a new AVP value, a request MUST be sent to IANA 545 [RFC2434], along with an explanation of the new AVP value. IANA 546 considerations for Diameter are discussed in Section 11. 548 1.2.2. Creating New AVPs 550 When no existing AVP can be used, a new AVP should be created. The 551 new AVP being defined MUST use one of the data types listed in 552 Section 4.2. 554 In the event that a logical grouping of AVPs is necessary, and 555 multiple "groups" are possible in a given command, it is recommended 556 that a Grouped AVP be used (see Section 4.4). 558 In order to create a new AVP, a request MUST be sent to IANA, with a 559 specification for the AVP. The request MUST include the commands 560 that would make use of the AVP. 562 1.2.3. Creating New Authentication Applications 564 Every Diameter application specification MUST have an IANA assigned 565 Application Identifier (see Section 2.4 and Section 11.3). 567 Should a new Diameter usage scenario find itself unable to fit within 568 an existing application without requiring major changes to the 569 specification, it may be desirable to create a new Diameter 570 application. Major changes to an application include: 572 o Adding new AVPs to the command, which have the "M" bit set. 574 o Requiring a command that has a different number of round trips to 575 satisfy a request (e.g., application foo has a command that 576 requires one round trip, but new application bar has a command 577 that requires two round trips to complete). 579 o Adding support for an authentication method requiring definition 580 of new AVPs for use with the application. Since a new EAP 581 authentication method can be supported within Diameter without 582 requiring new AVPs, addition of EAP methods does not require the 583 creation of a new authentication application. 585 Creation of a new application should be viewed as a last resort. An 586 implementation MAY add arbitrary non-mandatory AVPs to any command 587 defined in an application, including vendor-specific AVPs without 588 needing to define a new application. Please refer to Section 11.1.1 589 for details. 591 In order to justify allocation of a new application identifier, 592 Diameter applications MUST define one Command Code, add new mandatory 593 AVPs to the ABNF or significantly change the state machine or 594 processing rules of an existing application. 596 The expected AVPs MUST be defined in an ABNF [RFC2234] grammar (see 597 Section 3.2). If the Diameter application has accounting 598 requirements, it MUST also specify the AVPs that are to be present in 599 the Diameter Accounting messages (see Section 9.3). However, just 600 because a new authentication application id is required, does not 601 imply that a new accounting application id is required. 603 When possible, a new Diameter application SHOULD reuse existing 604 Diameter AVPs, in order to avoid defining multiple AVPs that carry 605 similar information. 607 1.2.4. Creating New Accounting Applications 609 There are services that only require Diameter accounting. Such 610 services need to define the AVPs carried in the Accounting-Request 611 (ACR)/ Accounting-Answer (ACA) messages, but do not need to define 612 new command codes. An implementation MAY add arbitrary non-mandatory 613 AVPs (AVPs with the "M" bit not set) to any command defined in an 614 application, including vendor-specific AVPs, without needing to 615 define a new accounting application. Please refer to Section 11.1.1 616 for details. 618 Application Identifiers are still required for Diameter capability 619 exchange. Every Diameter accounting application specification MUST 620 have an IANA assigned Application Identifier (see Section 2.4) or a 621 vendor specific Application Identifier. 623 Every Diameter implementation MUST support accounting. Basic 624 accounting support is sufficient to handle any application that uses 625 the ACR/ACA commands defined in this document, as long as no new 626 mandatory AVPs are added. A mandatory AVP is defined as one which 627 has the "M" bit set when sent within an accounting command, 628 regardless of whether it is required or optional within the ABNF for 629 the accounting application. 631 The creation of a new accounting application should be viewed as a 632 last resort and MUST NOT be used unless a new command or additional 633 mechanisms (e.g., application defined state machine) is defined 634 within the application, or new mandatory AVPs are added to the ABNF. 636 Within an accounting command, setting the "M" bit implies that a 637 backend server (e.g., billing server) or the accounting server itself 638 MUST understand the AVP in order to compute a correct bill. If the 639 AVP is not relevant to the billing process, when the AVP is included 640 within an accounting command, it MUST NOT have the "M" bit set, even 641 if the "M" bit is set when the same AVP is used within other Diameter 642 commands (i.e., authentication/authorization commands). 644 A DIAMETER base accounting implementation MUST be configurable to 645 advertise supported accounting applications in order to prevent the 646 accounting server from accepting accounting requests for unbillable 647 services. The combination of the home domain and the accounting 648 application Id can be used in order to route the request to the 649 appropriate accounting server. 651 When possible, a new Diameter accounting application SHOULD attempt 652 to reuse existing AVPs, in order to avoid defining multiple AVPs that 653 carry similar information. 655 If the base accounting is used without any mandatory AVPs, new 656 commands or additional mechanisms (e.g., application defined state 657 machine), then the base protocol defined standard accounting 658 application Id (Section 2.4) MUST be used in ACR/ACA commands. 660 1.2.5. Application Authentication Procedures 662 When possible, applications SHOULD be designed such that new 663 authentication methods MAY be added without requiring changes to the 664 application. This MAY require that new AVP values be assigned to 665 represent the new authentication transform, or any other scheme that 666 produces similar results. When possible, authentication frameworks, 667 such as Extensible Authentication Protocol [RFC2284], SHOULD be used. 669 1.3. Terminology 671 AAA 673 Authentication, Authorization and Accounting. 675 Accounting 677 The act of collecting information on resource usage for the 678 purpose of capacity planning, auditing, billing or cost 679 allocation. 681 Accounting Record 683 An accounting record represents a summary of the resource 684 consumption of a user over the entire session. Accounting servers 685 creating the accounting record may do so by processing interim 686 accounting events or accounting events from several devices 687 serving the same user. 689 Authentication 691 The act of verifying the identity of an entity (subject). 693 Authorization 695 The act of determining whether a requesting entity (subject) will 696 be allowed access to a resource (object). 698 AVP 700 The Diameter protocol consists of a header followed by one or more 701 Attribute-Value-Pairs (AVPs). An AVP includes a header and is 702 used to encapsulate protocol-specific data (e.g., routing 703 information) as well as authentication, authorization or 704 accounting information. 706 Broker 708 A broker is a business term commonly used in AAA infrastructures. 709 A broker is either a relay, proxy or redirect agent, and MAY be 710 operated by roaming consortiums. Depending on the business model, 711 a broker may either choose to deploy relay agents or proxy agents. 713 Diameter Agent 715 A Diameter Agent is a Diameter node that provides either relay, 716 proxy, redirect or translation services. 718 Diameter Client 720 A Diameter Client is a device at the edge of the network that 721 performs access control. An example of a Diameter client is a 722 Network Access Server (NAS) or a Foreign Agent (FA). 724 Diameter Node 726 A Diameter node is a host process that implements the Diameter 727 protocol, and acts either as a Client, Agent or Server. 729 Diameter Peer 731 A Diameter Peer is a Diameter Node to which a given Diameter Node 732 has a direct transport connection. 734 Diameter Security Exchange 736 A Diameter Security Exchange is a process through which two 737 Diameter nodes establish end-to-end security. 739 Diameter Server 741 A Diameter Server is one that handles authentication, 742 authorization and accounting requests for a particular realm. By 743 its very nature, a Diameter Server MUST support Diameter 744 applications in addition to the base protocol. 746 Downstream 748 Downstream is used to identify the direction of a particular 749 Diameter message from the home server towards the access device. 751 End-to-End Security 753 TLS and IPsec provide hop-by-hop security, or security across a 754 transport connection. When relays or proxy are involved, this 755 hop-by-hop security does not protect the entire Diameter user 756 session. End-to-end security is security between two Diameter 757 nodes, possibly communicating through Diameter Agents. This 758 security protects the entire Diameter communications path from the 759 originating Diameter node to the terminating Diameter node. 761 Home Realm 763 A Home Realm is the administrative domain with which the user 764 maintains an account relationship. 766 Home Server 768 See Diameter Server. 770 Interim accounting 772 An interim accounting message provides a snapshot of usage during 773 a user's session. It is typically implemented in order to provide 774 for partial accounting of a user's session in the case of a device 775 reboot or other network problem prevents the reception of a 776 session summary message or session record. 778 Local Realm 780 A local realm is the administrative domain providing services to a 781 user. An administrative domain MAY act as a local realm for 782 certain users, while being a home realm for others. 784 Multi-session 786 A multi-session represents a logical linking of several sessions. 787 Multi-sessions are tracked by using the Acct-Multi-Session-Id. An 788 example of a multi-session would be a Multi-link PPP bundle. Each 789 leg of the bundle would be a session while the entire bundle would 790 be a multi-session. 792 Network Access Identifier 794 The Network Access Identifier, or NAI [RFC4282], is used in the 795 Diameter protocol to extract a user's identity and realm. The 796 identity is used to identify the user during authentication and/or 797 authorization, while the realm is used for message routing 798 purposes. 800 Proxy Agent or Proxy 802 In addition to forwarding requests and responses, proxies make 803 policy decisions relating to resource usage and provisioning. 804 This is typically accomplished by tracking the state of NAS 805 devices. While proxies typically do not respond to client 806 Requests prior to receiving a Response from the server, they may 807 originate Reject messages in cases where policies are violated. 808 As a result, proxies need to understand the semantics of the 809 messages passing through them, and may not support all Diameter 810 applications. 812 Realm 814 The string in the NAI that immediately follows the '@' character. 815 NAI realm names are required to be unique, and are piggybacked on 816 the administration of the DNS namespace. Diameter makes use of 817 the realm, also loosely referred to as domain, to determine 818 whether messages can be satisfied locally, or whether they must be 819 routed or redirected. In RADIUS, realm names are not necessarily 820 piggybacked on the DNS namespace but may be independent of it. 822 Real-time Accounting 824 Real-time accounting involves the processing of information on 825 resource usage within a defined time window. Time constraints are 826 typically imposed in order to limit financial risk. 828 Relay Agent or Relay 830 Relays forward requests and responses based on routing-related 831 AVPs and routing table entries. Since relays do not make policy 832 decisions, they do not examine or alter non-routing AVPs. As a 833 result, relays never originate messages, do not need to understand 834 the semantics of messages or non-routing AVPs, and are capable of 835 handling any Diameter application or message type. Since relays 836 make decisions based on information in routing AVPs and realm 837 forwarding tables they do not keep state on NAS resource usage or 838 sessions in progress. 840 Redirect Agent 842 Rather than forwarding requests and responses between clients and 843 servers, redirect agents refer clients to servers and allow them 844 to communicate directly. Since redirect agents do not sit in the 845 forwarding path, they do not alter any AVPs transiting between 846 client and server. Redirect agents do not originate messages and 847 are capable of handling any message type, although they may be 848 configured only to redirect messages of certain types, while 849 acting as relay or proxy agents for other types. As with proxy 850 agents, redirect agents do not keep state with respect to sessions 851 or NAS resources. 853 Roaming Relationships 855 Roaming relationships include relationships between companies and 856 ISPs, relationships among peer ISPs within a roaming consortium, 857 and relationships between an ISP and a roaming consortium. 859 Security Association 861 A security association is an association between two endpoints in 862 a Diameter session which allows the endpoints to communicate with 863 integrity and confidentially, even in the presence of relays 864 and/or proxies. 866 Session 868 A session is a related progression of events devoted to a 869 particular activity. Each application SHOULD provide guidelines 870 as to when a session begins and ends. All Diameter packets with 871 the same Session-Identifier are considered to be part of the same 872 session. 874 Session state 876 A stateful agent is one that maintains session state information, 877 by keeping track of all authorized active sessions. Each 878 authorized session is bound to a particular service, and its state 879 is considered active either until it is notified otherwise, or by 880 expiration. 882 Sub-session 884 A sub-session represents a distinct service (e.g., QoS or data 885 characteristics) provided to a given session. These services may 886 happen concurrently (e.g., simultaneous voice and data transfer 887 during the same session) or serially. These changes in sessions 888 are tracked with the Accounting-Sub-Session-Id. 890 Transaction state 892 The Diameter protocol requires that agents maintain transaction 893 state, which is used for failover purposes. Transaction state 894 implies that upon forwarding a request, the Hop-by-Hop identifier 895 is saved; the field is replaced with a locally unique identifier, 896 which is restored to its original value when the corresponding 897 answer is received. The request's state is released upon receipt 898 of the answer. A stateless agent is one that only maintains 899 transaction state. 901 Translation Agent 903 A translation agent is a stateful Diameter node that performs 904 protocol translation between Diameter and another AAA protocol, 905 such as RADIUS. 907 Transport Connection 909 A transport connection is a TCP or SCTP connection existing 910 directly between two Diameter peers, otherwise known as a Peer- 911 to-Peer Connection. 913 Upstream 915 Upstream is used to identify the direction of a particular 916 Diameter message from the access device towards the home server. 918 User 920 The entity requesting or using some resource, in support of which 921 a Diameter client has generated a request. 923 2. Protocol Overview 925 The base Diameter protocol may be used by itself for accounting 926 applications, but for use in authentication and authorization it is 927 always extended for a particular application. Two Diameter 928 applications are defined by companion documents: NASREQ [RFC4005], 929 Mobile IPv4 [RFC4004]. These applications are introduced in this 930 document but specified elsewhere. Additional Diameter applications 931 MAY be defined in the future (see Section 11.3). 933 Diameter Clients MUST support the base protocol, which includes 934 accounting. In addition, they MUST fully support each Diameter 935 application that is needed to implement the client's service, e.g., 936 NASREQ and/or Mobile IPv4. A Diameter Client that does not support 937 both NASREQ and Mobile IPv4, MUST be referred to as "Diameter X 938 Client" where X is the application which it supports, and not a 939 "Diameter Client". 941 Diameter Servers MUST support the base protocol, which includes 942 accounting. In addition, they MUST fully support each Diameter 943 application that is needed to implement the intended service, e.g., 944 NASREQ and/or Mobile IPv4. A Diameter Server that does not support 945 both NASREQ and Mobile IPv4, MUST be referred to as "Diameter X 946 Server" where X is the application which it supports, and not a 947 "Diameter Server". 949 Diameter Relays and redirect agents are, by definition, protocol 950 transparent, and MUST transparently support the Diameter base 951 protocol, which includes accounting, and all Diameter applications. 953 Diameter proxies MUST support the base protocol, which includes 954 accounting. In addition, they MUST fully support each Diameter 955 application that is needed to implement proxied services, e.g., 956 NASREQ and/or Mobile IPv4. A Diameter proxy which does not support 957 also both NASREQ and Mobile IPv4, MUST be referred to as "Diameter X 958 Proxy" where X is the application which it supports, and not a 959 "Diameter Proxy". 961 The base Diameter protocol concerns itself with capabilities 962 negotiation, how messages are sent and how peers may eventually be 963 abandoned. The base protocol also defines certain rules that apply 964 to all exchanges of messages between Diameter nodes. 966 Communication between Diameter peers begins with one peer sending a 967 message to another Diameter peer. The set of AVPs included in the 968 message is determined by a particular Diameter application. One AVP 969 that is included to reference a user's session is the Session-Id. 971 The initial request for authentication and/or authorization of a user 972 would include the Session-Id. The Session-Id is then used in all 973 subsequent messages to identify the user's session (see Section 8 for 974 more information). The communicating party may accept the request, 975 or reject it by returning an answer message with the Result-Code AVP 976 set to indicate an error occurred. The specific behavior of the 977 Diameter server or client receiving a request depends on the Diameter 978 application employed. 980 Session state (associated with a Session-Id) MUST be freed upon 981 receipt of the Session-Termination-Request, Session-Termination- 982 Answer, expiration of authorized service time in the Session-Timeout 983 AVP, and according to rules established in a particular Diameter 984 application. 986 2.1. Transport 988 Transport profile is defined in [RFC3539]. 990 The base Diameter protocol is run on port 3868 of both TCP [TCP] and 991 SCTP [RFC2960] transport protocols. 993 Diameter clients MUST support either TCP or SCTP, while agents and 994 servers MUST support both. Future versions of this specification MAY 995 mandate that clients support SCTP. 997 A Diameter node MAY initiate connections from a source port other 998 than the one that it declares it accepts incoming connections on, and 999 MUST be prepared to receive connections on port 3868. A given 1000 Diameter instance of the peer state machine MUST NOT use more than 1001 one transport connection to communicate with a given peer, unless 1002 multiple instances exist on the peer in which case a separate 1003 connection per process is allowed. 1005 When no transport connection exists with a peer, an attempt to 1006 connect SHOULD be periodically made. This behavior is handled via 1007 the Tc timer, whose recommended value is 30 seconds. There are 1008 certain exceptions to this rule, such as when a peer has terminated 1009 the transport connection stating that it does not wish to 1010 communicate. 1012 When connecting to a peer and either zero or more transports are 1013 specified, SCTP SHOULD be tried first, followed by TCP. See Section 1014 5.2 for more information on peer discovery. 1016 Diameter implementations SHOULD be able to interpret ICMP protocol 1017 port unreachable messages as explicit indications that the server is 1018 not reachable, subject to security policy on trusting such messages. 1020 Diameter implementations SHOULD also be able to interpret a reset 1021 from the transport and timed-out connection attempts. If Diameter 1022 receives data up from TCP that cannot be parsed or identified as a 1023 Diameter error made by the peer, the stream is compromised and cannot 1024 be recovered. The transport connection MUST be closed using a RESET 1025 call (send a TCP RST bit) or an SCTP ABORT message (graceful closure 1026 is compromised). 1028 2.1.1. SCTP Guidelines 1030 The following are guidelines for Diameter implementations that 1031 support SCTP: 1033 1. For interoperability: All Diameter nodes MUST be prepared to 1034 receive Diameter messages on any SCTP stream in the association. 1036 2. To prevent blocking: All Diameter nodes SHOULD utilize all SCTP 1037 streams available to the association to prevent head-of-the-line 1038 blocking. 1040 2.2. Securing Diameter Messages 1042 Diameter clients, such as Network Access Servers (NASes) and Mobility 1043 Agents MUST support IP Security [RFC2401], and MAY support TLS 1044 [RFC2246]. Diameter servers MUST support TLS and IPsec. The 1045 Diameter protocol MUST NOT be used without any security mechanism 1046 (TLS or IPsec). 1048 It is suggested that IPsec can be used primarily at the edges and in 1049 intra-domain traffic, such as using pre-shared keys between a NAS a 1050 local AAA proxy. This also eases the requirements on the NAS to 1051 support certificates. It is also suggested that inter-domain traffic 1052 would primarily use TLS. See Sections 13.1 and 13.2 for more details 1053 on IPsec and TLS usage. 1055 2.3. Diameter Application Compliance 1057 Application Identifiers are advertised during the capabilities 1058 exchange phase (see Section 5.3). For a given application, 1059 advertising support of an application implies that the sender 1060 supports all command codes, and the AVPs specified in the associated 1061 ABNFs, described in the specification. 1063 An implementation MAY add arbitrary non-mandatory AVPs to any command 1064 defined in an application, including vendor-specific AVPs. Please 1065 refer to Section 11.1.1 for details. 1067 2.4. Application Identifiers 1069 Each Diameter application MUST have an IANA assigned Application 1070 Identifier (see Section 11.3). The base protocol does not require an 1071 Application Identifier since its support is mandatory. During the 1072 capabilities exchange, Diameter nodes inform their peers of locally 1073 supported applications. Furthermore, all Diameter messages contain 1074 an Application Identifier, which is used in the message forwarding 1075 process. 1077 The following Application Identifier values are defined: 1079 Diameter Common Messages 0 1080 NASREQ 1 [RFC4005] 1081 Mobile-IP 2 [RFC4004] 1082 Diameter Base Accounting 3 1083 Relay 0xffffffff 1085 Relay and redirect agents MUST advertise the Relay Application 1086 Identifier, while all other Diameter nodes MUST advertise locally 1087 supported applications. The receiver of a Capabilities Exchange 1088 message advertising Relay service MUST assume that the sender 1089 supports all current and future applications. 1091 Diameter relay and proxy agents are responsible for finding an 1092 upstream server that supports the application of a particular 1093 message. If none can be found, an error message is returned with the 1094 Result-Code AVP set to DIAMETER_UNABLE_TO_DELIVER. 1096 2.5. Connections vs. Sessions 1098 This section attempts to provide the reader with an understanding of 1099 the difference between connection and session, which are terms used 1100 extensively throughout this document. 1102 A connection is a transport level connection between two peers, used 1103 to send and receive Diameter messages. A session is a logical 1104 concept at the application layer, and is shared between an access 1105 device and a server, and is identified via the Session-Id AVP. 1107 +--------+ +-------+ +--------+ 1108 | Client | | Relay | | Server | 1109 +--------+ +-------+ +--------+ 1110 <----------> <----------> 1111 peer connection A peer connection B 1113 <-----------------------------> 1114 User session x 1116 Figure 1: Diameter connections and sessions 1118 In the example provided in Figure 1, peer connection A is established 1119 between the Client and its local Relay. Peer connection B is 1120 established between the Relay and the Server. User session X spans 1121 from the Client via the Relay to the Server. Each "user" of a 1122 service causes an auth request to be sent, with a unique session 1123 identifier. Once accepted by the server, both the client and the 1124 server are aware of the session. 1126 It is important to note that there is no relationship between a 1127 connection and a session, and that Diameter messages for multiple 1128 sessions are all multiplexed through a single connection. Also note 1129 that Diameter messages pertaining to the session, both application 1130 specific and those that are defined in this document such as ASR/ASA, 1131 RAR/RAA and STR/STA MUST carry the application identifier of the 1132 application. Diameter messages pertaining to peer connection 1133 establishment and maintenance such as CER/CEA, DWR/DWA and DPR/DPA 1134 MUST carry an application id of zero (0). 1136 2.6. Peer Table 1138 The Diameter Peer Table is used in message forwarding, and referenced 1139 by the Routing Table. A Peer Table entry contains the following 1140 fields: 1142 Host identity 1144 Following the conventions described for the DiameterIdentity 1145 derived AVP data format in Section 4.4. This field contains the 1146 contents of the Origin-Host (Section 6.3) AVP found in the CER or 1147 CEA message. 1149 StatusT 1151 This is the state of the peer entry, and MUST match one of the 1152 values listed in Section 5.6. 1154 Static or Dynamic 1156 Specifies whether a peer entry was statically configured, or 1157 dynamically discovered. 1159 Expiration time 1161 Specifies the time at which dynamically discovered peer table 1162 entries are to be either refreshed, or expired. 1164 TLS Enabled 1166 Specifies whether TLS is to be used when communicating with the 1167 peer. 1169 Additional security information, when needed (e.g., keys, 1170 certificates) 1172 2.7. Routing Table 1174 All Realm-Based routing lookups are performed against what is 1175 commonly known as the Routing Table (see Section 12). A Routing 1176 Table Entry contains the following fields: 1178 Realm Name 1180 This is the field that is typically used as a primary key in the 1181 routing table lookups. Note that some implementations perform 1182 their lookups based on longest-match-from-the-right on the realm 1183 rather than requiring an exact match. 1185 Application Identifier 1187 An application is identified by an application id. A route entry 1188 can have a different destination based on the application 1189 identification in the message header. This field MUST be used as 1190 a secondary key field in routing table lookups. 1192 Local Action 1194 The Local Action field is used to identify how a message should be 1195 treated. The following actions are supported: 1197 1. LOCAL - Diameter messages that resolve to a route entry with 1198 the Local Action set to Local can be satisfied locally, and do 1199 not need to be routed to another server. 1201 2. RELAY - All Diameter messages that fall within this category 1202 MUST be routed to a next hop server, without modifying any 1203 non-routing AVPs. See Section 6.1.9 for relaying guidelines 1205 3. PROXY - All Diameter messages that fall within this category 1206 MUST be routed to a next hop server. The local server MAY 1207 apply its local policies to the message by including new AVPs 1208 to the message prior to routing. See Section 6.1.9 for 1209 proxying guidelines. 1211 4. REDIRECT - Diameter messages that fall within this category 1212 MUST have the identity of the home Diameter server(s) 1213 appended, and returned to the sender of the message. See 1214 Section 6.1.9 for redirect guidelines. 1216 Server Identifier 1218 One or more servers the message is to be routed to. These servers 1219 MUST also be present in the Peer table. When the Local Action is 1220 set to RELAY or PROXY, this field contains the identity of the 1221 server(s) the message must be routed to. When the Local Action 1222 field is set to REDIRECT, this field contains the identity of one 1223 or more servers the message should be redirected to. 1225 Static or Dynamic 1227 Specifies whether a route entry was statically configured, or 1228 dynamically discovered. 1230 Expiration time 1232 Specifies the time which a dynamically discovered route table 1233 entry expires. 1235 It is important to note that Diameter agents MUST support at least 1236 one of the LOCAL, RELAY, PROXY or REDIRECT modes of operation. 1237 Agents do not need to support all modes of operation in order to 1238 conform with the protocol specification, but MUST follow the protocol 1239 compliance guidelines in Section 2. Relay agents MUST NOT reorder 1240 AVPs, and proxies MUST NOT reorder AVPs. 1242 The routing table MAY include a default entry that MUST be used for 1243 any requests not matching any of the other entries. The routing 1244 table MAY consist of only such an entry. 1246 When a request is routed, the target server MUST have advertised the 1247 Application Identifier (see Section 2.4) for the given message, or 1248 have advertised itself as a relay or proxy agent. Otherwise, an 1249 error is returned with the Result-Code AVP set to 1250 DIAMETER_UNABLE_TO_DELIVER. 1252 2.8. Role of Diameter Agents 1254 In addition to client and servers, the Diameter protocol introduces 1255 relay, proxy, redirect, and translation agents, each of which is 1256 defined in Section 1.3. These Diameter agents are useful for several 1257 reasons: 1259 o They can distribute administration of systems to a configurable 1260 grouping, including the maintenance of security associations. 1262 o They can be used for concentration of requests from an number of 1263 co-located or distributed NAS equipment sets to a set of like user 1264 groups. 1266 o They can do value-added processing to the requests or responses. 1268 o They can be used for load balancing. 1270 o A complex network will have multiple authentication sources, they 1271 can sort requests and forward towards the correct target. 1273 The Diameter protocol requires that agents maintain transaction 1274 state, which is used for failover purposes. Transaction state 1275 implies that upon forwarding a request, its Hop-by-Hop identifier is 1276 saved; the field is replaced with a locally unique identifier, which 1277 is restored to its original value when the corresponding answer is 1278 received. The request's state is released upon receipt of the 1279 answer. A stateless agent is one that only maintains transaction 1280 state. 1282 The Proxy-Info AVP allows stateless agents to add local state to a 1283 Diameter request, with the guarantee that the same state will be 1284 present in the answer. However, the protocol's failover procedures 1285 require that agents maintain a copy of pending requests. 1287 A stateful agent is one that maintains session state information; by 1288 keeping track of all authorized active sessions. Each authorized 1289 session is bound to a particular service, and its state is considered 1290 active either until it is notified otherwise, or by expiration. Each 1291 authorized session has an expiration, which is communicated by 1292 Diameter servers via the Session-Timeout AVP. 1294 Maintaining session state MAY be useful in certain applications, such 1295 as: 1297 o Protocol translation (e.g., RADIUS <-> Diameter) 1299 o Limiting resources authorized to a particular user 1301 o Per user or transaction auditing 1303 A Diameter agent MAY act in a stateful manner for some requests and 1304 be stateless for others. A Diameter implementation MAY act as one 1305 type of agent for some requests, and as another type of agent for 1306 others. 1308 2.8.1. Relay Agents 1310 Relay Agents are Diameter agents that accept requests and route 1311 messages to other Diameter nodes based on information found in the 1312 messages (e.g., Destination-Realm). This routing decision is 1313 performed using a list of supported realms, and known peers. This is 1314 known as the Routing Table, as is defined further in Section 2.7. 1316 Relays MAY be used to aggregate requests from multiple Network Access 1317 Servers (NASes) within a common geographical area (POP). The use of 1318 Relays is advantageous since it eliminates the need for NASes to be 1319 configured with the necessary security information they would 1320 otherwise require to communicate with Diameter servers in other 1321 realms. Likewise, this reduces the configuration load on Diameter 1322 servers that would otherwise be necessary when NASes are added, 1323 changed or deleted. 1325 Relays modify Diameter messages by inserting and removing routing 1326 information, but do not modify any other portion of a message. 1327 Relays SHOULD NOT maintain session state but MUST maintain 1328 transaction state. 1330 +------+ ---------> +------+ ---------> +------+ 1331 | | 1. Request | | 2. Request | | 1332 | NAS | | DRL | | HMS | 1333 | | 4. Answer | | 3. Answer | | 1334 +------+ <--------- +------+ <--------- +------+ 1335 example.net example.net example.com 1337 Figure 2: Relaying of Diameter messages 1339 The example provided in Figure 2 depicts a request issued from NAS, 1340 which is an access device, for the user bob@example.com. Prior to 1341 issuing the request, NAS performs a Diameter route lookup, using 1342 "example.com" as the key, and determines that the message is to be 1343 relayed to DRL, which is a Diameter Relay. DRL performs the same 1344 route lookup as NAS, and relays the message to HMS, which is 1345 example.com's Home Diameter Server. HMS identifies that the request 1346 can be locally supported (via the realm), processes the 1347 authentication and/or authorization request, and replies with an 1348 answer, which is routed back to NAS using saved transaction state. 1350 Since Relays do not perform any application level processing, they 1351 provide relaying services for all Diameter applications, and 1352 therefore MUST advertise the Relay Application Identifier. 1354 2.8.2. Proxy Agents 1356 Similarly to relays, proxy agents route Diameter messages using the 1357 Diameter Routing Table. However, they differ since they modify 1358 messages to implement policy enforcement. This requires that proxies 1359 maintain the state of their downstream peers (e.g., access devices) 1360 to enforce resource usage, provide admission control, and 1361 provisioning. 1363 It is important to note that although proxies MAY provide a value-add 1364 function for NASes, they do not allow access devices to use end-to- 1365 end security, since modifying messages breaks authentication. 1367 Proxies MAY be used in call control centers or access ISPs that 1368 provide outsourced connections, they can monitor the number and types 1369 of ports in use, and make allocation and admission decisions 1370 according to their configuration. 1372 Proxies that wish to limit resources MUST maintain session state. 1373 All proxies MUST maintain transaction state. 1375 Since enforcing policies requires an understanding of the service 1376 being provided, Proxies MUST only advertise the Diameter applications 1377 they support. 1379 2.8.3. Redirect Agents 1381 Redirect agents are useful in scenarios where the Diameter routing 1382 configuration needs to be centralized. An example is a redirect 1383 agent that provides services to all members of a consortium, but does 1384 not wish to be burdened with relaying all messages between realms. 1385 This scenario is advantageous since it does not require that the 1386 consortium provide routing updates to its members when changes are 1387 made to a member's infrastructure. 1389 Since redirect agents do not relay messages, and only return an 1390 answer with the information necessary for Diameter agents to 1391 communicate directly, they do not modify messages. Since redirect 1392 agents do not receive answer messages, they cannot maintain session 1393 state. Further, since redirect agents never relay requests, they are 1394 not required to maintain transaction state. 1396 The example provided in Figure 3 depicts a request issued from the 1397 access device, NAS, for the user bob@example.com. The message is 1398 forwarded by the NAS to its relay, DRL, which does not have a routing 1399 entry in its Diameter Routing Table for example.com. DRL has a 1400 default route configured to DRD, which is a redirect agent that 1401 returns a redirect notification to DRL, as well as HMS' contact 1402 information. Upon receipt of the redirect notification, DRL 1403 establishes a transport connection with HMS, if one doesn't already 1404 exist, and forwards the request to it. 1406 +------+ 1407 | | 1408 | DRD | 1409 | | 1410 +------+ 1411 ^ | 1412 2. Request | | 3. Redirection 1413 | | Notification 1414 | v 1415 +------+ ---------> +------+ ---------> +------+ 1416 | | 1. Request | | 4. Request | | 1417 | NAS | | DRL | | HMS | 1418 | | 6. Answer | | 5. Answer | | 1419 +------+ <--------- +------+ <--------- +------+ 1420 example.net example.net example.com 1422 Figure 3: Redirecting a Diameter Message 1424 Since redirect agents do not perform any application level 1425 processing, they provide relaying services for all Diameter 1426 applications, and therefore MUST advertise the Relay Application 1427 Identifier. 1429 2.8.4. Translation Agents 1431 A translation agent is a device that provides translation between two 1432 protocols (e.g., RADIUS<->Diameter, TACACS+<->Diameter). Translation 1433 agents are likely to be used as aggregation servers to communicate 1434 with a Diameter infrastructure, while allowing for the embedded 1435 systems to be migrated at a slower pace. 1437 Given that the Diameter protocol introduces the concept of long-lived 1438 authorized sessions, translation agents MUST be session stateful and 1439 MUST maintain transaction state. 1441 Translation of messages can only occur if the agent recognizes the 1442 application of a particular request, and therefore translation agents 1443 MUST only advertise their locally supported applications. 1445 +------+ ---------> +------+ ---------> +------+ 1446 | | RADIUS Request | | Diameter Request | | 1447 | NAS | | TLA | | HMS | 1448 | | RADIUS Answer | | Diameter Answer | | 1449 +------+ <--------- +------+ <--------- +------+ 1450 example.net example.net example.com 1452 Figure 4: Translation of RADIUS to Diameter 1454 2.9. End-to-End Security Framework 1456 End-to-end security services include confidentiality and message 1457 origin authentication. These services are provided by supporting AVP 1458 integrity and confidentiality between two peers, communicating 1459 through agents. 1461 End-to-end security is provided via the End-to-End security 1462 extension, described in [AAACMS]. The circumstances requiring the 1463 use of end-to-end security are determined by policy on each of the 1464 peers. Security policies, which are not the subject of 1465 standardization, may be applied by next hop Diameter peer or by 1466 destination realm. For example, where TLS or IPsec transmission- 1467 level security is sufficient, there may be no need for end-to-end 1468 security. 1470 End-to-end security policies include: 1472 o Never use end-to-end security. 1474 o Use end-to-end security on messages containing sensitive AVPs. 1475 Which AVPs are sensitive is determined by service provider policy. 1476 AVPs containing keys and passwords should be considered sensitive. 1477 Accounting AVPs may be considered sensitive. Any AVP for which 1478 the P bit may be set or which may be encrypted may be considered 1479 sensitive. 1481 o Always use end-to-end security. 1483 It is strongly RECOMMENDED that all Diameter implementations support 1484 end-to-end security. 1486 2.10. Diameter Path Authorization 1488 As noted in Section 2.2, Diameter requires transmission level 1489 security to be used on each connection (TLS or IPsec). Therefore, 1490 each connection is authenticated, replay and integrity protected and 1491 confidential on a per-packet basis. 1493 In addition to authenticating each connection, each connection as 1494 well as the entire session MUST also be authorized. Before 1495 initiating a connection, a Diameter Peer MUST check that its peers 1496 are authorized to act in their roles. For example, a Diameter peer 1497 may be authentic, but that does not mean that it is authorized to act 1498 as a Diameter Server advertising a set of Diameter applications. 1500 Prior to bringing up a connection, authorization checks are performed 1501 at each connection along the path. Diameter capabilities negotiation 1502 (CER/CEA) also MUST be carried out, in order to determine what 1503 Diameter applications are supported by each peer. Diameter sessions 1504 MUST be routed only through authorized nodes that have advertised 1505 support for the Diameter application required by the session. 1507 As noted in Section 6.1.9, a relay or proxy agent MUST append a 1508 Route-Record AVP to all requests forwarded. The AVP contains the 1509 identity of the peer the request was received from. 1511 The home Diameter server, prior to authorizing a session, MUST check 1512 the Route-Record AVPs to make sure that the route traversed by the 1513 request is acceptable. For example, administrators within the home 1514 realm may not wish to honor requests that have been routed through an 1515 untrusted realm. By authorizing a request, the home Diameter server 1516 is implicitly indicating its willingness to engage in the business 1517 transaction as specified by the contractual relationship between the 1518 server and the previous hop. A DIAMETER_AUTHORIZATION_REJECTED error 1519 message (see Section 7.1.5) is sent if the route traversed by the 1520 request is unacceptable. 1522 A home realm may also wish to check that each accounting request 1523 message corresponds to a Diameter response authorizing the session. 1524 Accounting requests without corresponding authorization responses 1525 SHOULD be subjected to further scrutiny, as should accounting 1526 requests indicating a difference between the requested and provided 1527 service. 1529 Similarly, the local Diameter agent, on receiving a Diameter response 1530 authorizing a session, MUST check the Route-Record AVPs to make sure 1531 that the route traversed by the response is acceptable. At each 1532 step, forwarding of an authorization response is considered evidence 1533 of a willingness to take on financial risk relative to the session. 1534 A local realm may wish to limit this exposure, for example, by 1535 establishing credit limits for intermediate realms and refusing to 1536 accept responses which would violate those limits. By issuing an 1537 accounting request corresponding to the authorization response, the 1538 local realm implicitly indicates its agreement to provide the service 1539 indicated in the authorization response. If the service cannot be 1540 provided by the local realm, then a DIAMETER_UNABLE_TO_COMPLY error 1541 message MUST be sent within the accounting request; a Diameter client 1542 receiving an authorization response for a service that it cannot 1543 perform MUST NOT substitute an alternate service, and then send 1544 accounting requests for the alternate service instead. 1546 3. Diameter Header 1548 A summary of the Diameter header format is shown below. The fields 1549 are transmitted in network byte order. 1551 0 1 2 3 1552 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 1553 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1554 | Version | Message Length | 1555 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1556 | command flags | Command-Code | 1557 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1558 | Application-ID | 1559 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1560 | Hop-by-Hop Identifier | 1561 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1562 | End-to-End Identifier | 1563 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1564 | AVPs ... 1565 +-+-+-+-+-+-+-+-+-+-+-+-+- 1567 Version 1569 This Version field MUST be set to 1 to indicate Diameter Version 1570 1. 1572 Message Length 1574 The Message Length field is three octets and indicates the length 1575 of the Diameter message including the header fields. 1577 Command Flags 1579 The Command Flags field is eight bits. The following bits are 1580 assigned: 1582 0 1 2 3 4 5 6 7 1583 +-+-+-+-+-+-+-+-+ 1584 |R P E T r r r r| 1585 +-+-+-+-+-+-+-+-+ 1587 R(equest) 1589 If set, the message is a request. If cleared, the message is 1590 an answer. 1592 P(roxiable) 1594 If set, the message MAY be proxied, relayed or redirected. If 1595 cleared, the message MUST be locally processed. 1597 E(rror) 1599 If set, the message contains a protocol error, and the message 1600 will not conform to the ABNF described for this command. 1601 Messages with the 'E' bit set are commonly referred to as error 1602 messages. This bit MUST NOT be set in request messages. See 1603 Section 7.2. 1605 T(Potentially re-transmitted message) 1607 This flag is set after a link failover procedure, to aid the 1608 removal of duplicate requests. It is set when resending 1609 requests not yet acknowledged, as an indication of a possible 1610 duplicate due to a link failure. This bit MUST be cleared when 1611 sending a request for the first time, otherwise the sender MUST 1612 set this flag. Diameter agents only need to be concerned about 1613 the number of requests they send based on a single received 1614 request; retransmissions by other entities need not be tracked. 1615 Diameter agents that receive a request with the T flag set, 1616 MUST keep the T flag set in the forwarded request. This flag 1617 MUST NOT be set if an error answer message (e.g., a protocol 1618 error) has been received for the earlier message. It can be 1619 set only in cases where no answer has been received from the 1620 server for a request and the request is sent again. This flag 1621 MUST NOT be set in answer messages. 1623 r(eserved) 1625 These flag bits are reserved for future use, and MUST be set to 1626 zero, and ignored by the receiver. 1628 Command-Code 1630 The Command-Code field is three octets, and is used in order to 1631 communicate the command associated with the message. The 24-bit 1632 address space is managed by IANA (see Section 11.2.1). 1634 Command-Code values 16,777,214 and 16,777,215 (hexadecimal values 1635 FFFFFE -FFFFFF) are reserved for experimental use (See Section 1636 11.3). 1638 Application-ID 1640 Application-ID is four octets and is used to identify to which 1641 application the message is applicable for. The application can be 1642 an authentication application, an accounting application or a 1643 vendor specific application. See Section 11.3 for the possible 1644 values that the application-id may use. 1646 The application-id in the header MUST be the same as what is 1647 contained in any relevant application-id AVPs contained in the 1648 message. 1650 Hop-by-Hop Identifier 1652 The Hop-by-Hop Identifier is an unsigned 32-bit integer field (in 1653 network byte order) and aids in matching requests and replies. 1654 The sender MUST ensure that the Hop-by-Hop identifier in a request 1655 is unique on a given connection at any given time, and MAY attempt 1656 to ensure that the number is unique across reboots. The sender of 1657 an Answer message MUST ensure that the Hop-by-Hop Identifier field 1658 contains the same value that was found in the corresponding 1659 request. The Hop-by-Hop identifier is normally a monotonically 1660 increasing number, whose start value was randomly generated. An 1661 answer message that is received with an unknown Hop-by-Hop 1662 Identifier MUST be discarded. 1664 End-to-End Identifier 1666 The End-to-End Identifier is an unsigned 32-bit integer field (in 1667 network byte order) and is used to detect duplicate messages. 1668 Upon reboot implementations MAY set the high order 12 bits to 1669 contain the low order 12 bits of current time, and the low order 1670 20 bits to a random value. Senders of request messages MUST 1671 insert a unique identifier on each message. The identifier MUST 1672 remain locally unique for a period of at least 4 minutes, even 1673 across reboots. The originator of an Answer message MUST ensure 1674 that the End-to-End Identifier field contains the same value that 1675 was found in the corresponding request. The End-to-End Identifier 1676 MUST NOT be modified by Diameter agents of any kind. The 1677 combination of the Origin-Host (see Section 6.3) and this field is 1678 used to detect duplicates. Duplicate requests SHOULD cause the 1679 same answer to be transmitted (modulo the hop-by-hop Identifier 1680 field and any routing AVPs that may be present), and MUST NOT 1681 affect any state that was set when the original request was 1682 processed. Duplicate answer messages that are to be locally 1683 consumed (see Section 6.2) SHOULD be silently discarded. 1685 AVPs 1687 AVPs are a method of encapsulating information relevant to the 1688 Diameter message. See Section 4 for more information on AVPs. 1690 3.1. Command Codes 1692 Each command Request/Answer pair is assigned a command code, and the 1693 sub-type (i.e., request or answer) is identified via the 'R' bit in 1694 the Command Flags field of the Diameter header. 1696 Every Diameter message MUST contain a command code in its header's 1697 Command-Code field, which is used to determine the action that is to 1698 be taken for a particular message. The following Command Codes are 1699 defined in the Diameter base protocol: 1701 Command-Name Abbrev. Code Reference 1702 -------------------------------------------------------- 1703 Abort-Session-Request ASR 274 8.5.1 1704 Abort-Session-Answer ASA 274 8.5.2 1705 Accounting-Request ACR 271 9.7.1 1706 Accounting-Answer ACA 271 9.7.2 1707 Capabilities-Exchange- CER 257 5.3.1 1708 Request 1709 Capabilities-Exchange- CEA 257 5.3.2 1710 Answer 1711 Device-Watchdog-Request DWR 280 5.5.1 1712 Device-Watchdog-Answer DWA 280 5.5.2 1713 Disconnect-Peer-Request DPR 282 5.4.1 1714 Disconnect-Peer-Answer DPA 282 5.4.2 1715 Re-Auth-Request RAR 258 8.3.1 1716 Re-Auth-Answer RAA 258 8.3.2 1717 Session-Termination- STR 275 8.4.1 1718 Request 1719 Session-Termination- STA 275 8.4.2 1720 Answer 1722 3.2. Command Code ABNF specification 1724 Every Command Code defined MUST include a corresponding ABNF 1725 specification, which is used to define the AVPs that MUST or MAY be 1726 present. The following format is used in the definition: 1728 command-def = command-name "::=" diameter-message 1730 command-name = diameter-name 1732 diameter-name = ALPHA *(ALPHA / DIGIT / "-") 1734 diameter-message = header [ *fixed] [ *required] [ *optional] 1736 header = "<" "Diameter Header:" command-id 1737 [r-bit] [p-bit] [e-bit] [application-id] ">" 1739 application-id = 1*DIGIT 1741 command-id = 1*DIGIT 1742 ; The Command Code assigned to the command 1744 r-bit = ", REQ" 1745 ; If present, the 'R' bit in the Command 1746 ; Flags is set, indicating that the message 1747 ; is a request, as opposed to an answer. 1749 p-bit = ", PXY" 1750 ; If present, the 'P' bit in the Command 1751 ; Flags is set, indicating that the message 1752 ; is proxiable. 1754 e-bit = ", ERR" 1755 ; If present, the 'E' bit in the Command 1756 ; Flags is set, indicating that the answer 1757 ; message contains a Result-Code AVP in 1758 ; the "protocol error" class. 1760 fixed = [qual] "<" avp-spec ">" 1761 ; Defines the fixed position of an AVP 1763 required = [qual] "{" avp-spec "}" 1764 ; The AVP MUST be present and can appear 1765 ; anywhere in the message. 1767 optional = [qual] "[" avp-name "]" 1768 ; The avp-name in the 'optional' rule cannot 1769 ; evaluate to any AVP Name which is included 1770 ; in a fixed or required rule. The AVP can 1771 ; appear anywhere in the message. 1773 qual = [min] "*" [max] 1774 ; See ABNF conventions, RFC 2234 Section 6.6. 1775 ; The absence of any qualifiers depends on 1776 ; whether it precedes a fixed, required, or 1777 ; optional rule. If a fixed or required rule has 1778 ; no qualifier, then exactly one such AVP MUST 1779 ; be present. If an optional rule has no 1780 ; qualifier, then 0 or 1 such AVP may be 1781 ; present. 1782 ; 1783 ; NOTE: "[" and "]" have a different meaning 1784 ; than in ABNF (see the optional rule, above). 1785 ; These braces cannot be used to express 1786 ; optional fixed rules (such as an optional 1787 ; ICV at the end). To do this, the convention 1788 ; is '0*1fixed'. 1790 min = 1*DIGIT 1791 ; The minimum number of times the element may 1792 ; be present. The default value is zero. 1794 max = 1*DIGIT 1795 ; The maximum number of times the element may 1796 ; be present. The default value is infinity. A 1797 ; value of zero implies the AVP MUST NOT be 1798 ; present. 1800 avp-spec = diameter-name 1801 ; The avp-spec has to be an AVP Name, defined 1802 ; in the base or extended Diameter 1803 ; specifications. 1805 avp-name = avp-spec / "AVP" 1806 ; The string "AVP" stands for *any* arbitrary 1807 ; AVP Name, which does not conflict with the 1808 ; required or fixed position AVPs defined in 1809 ; the command code definition. 1811 The following is a definition of a fictitious command code: 1813 Example-Request ::= < Diameter Header: 9999999, REQ, PXY > 1814 { User-Name } 1815 * { Origin-Host } 1816 * [ AVP 1818 3.3. Diameter Command Naming Conventions 1820 Diameter command names typically includes one or more English words 1821 followed by the verb Request or Answer. Each English word is 1822 delimited by a hyphen. A three-letter acronym for both the request 1823 and answer is also normally provided. 1825 An example is a message set used to terminate a session. The command 1826 name is Session-Terminate-Request and Session-Terminate-Answer, while 1827 the acronyms are STR and STA, respectively. 1829 Both the request and the answer for a given command share the same 1830 command code. The request is identified by the R(equest) bit in the 1831 Diameter header set to one (1), to ask that a particular action be 1832 performed, such as authorizing a user or terminating a session. Once 1833 the receiver has completed the request it issues the corresponding 1834 answer, which includes a result code that communicates one of the 1835 following: 1837 o The request was successful 1839 o The request failed 1841 o An additional request must be sent to provide information the peer 1842 requires prior to returning a successful or failed answer. 1844 o The receiver could not process the request, but provides 1845 information about a Diameter peer that is able to satisfy the 1846 request, known as redirect. 1848 Additional information, encoded within AVPs, MAY also be included in 1849 answer messages. 1851 4. Diameter AVPs 1853 Diameter AVPs carry specific authentication, accounting, 1854 authorization, routing and security information as well as 1855 configuration details for the request and reply. 1857 Some AVPs MAY be listed more than once. The effect of such an AVP is 1858 specific, and is specified in each case by the AVP description. 1860 Each AVP of type OctetString MUST be padded to align on a 32-bit 1861 boundary, while other AVP types align naturally. A number of zero- 1862 valued bytes are added to the end of the AVP Data field till a word 1863 boundary is reached. The length of the padding is not reflected in 1864 the AVP Length field. 1866 4.1. AVP Header 1868 The fields in the AVP header MUST be sent in network byte order. The 1869 format of the header is: 1871 0 1 2 3 1872 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 1873 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1874 | AVP Code | 1875 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1876 |V M P r r r r r| AVP Length | 1877 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1878 | Vendor-ID (opt) | 1879 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1880 | Data ... 1881 +-+-+-+-+-+-+-+-+ 1883 AVP Code 1885 The AVP Code, combined with the Vendor-Id field, identifies the 1886 attribute uniquely. AVP numbers 1 through 255 are reserved for 1887 backward compatibility with RADIUS, without setting the Vendor-Id 1888 field. AVP numbers 256 and above are used for Diameter, which are 1889 allocated by IANA (see Section 11.1). 1891 AVP Flags 1893 The AVP Flags field informs the receiver how each attribute must 1894 be handled. The 'r' (reserved) bits are unused and SHOULD be set 1895 to 0. Note that subsequent Diameter applications MAY define 1896 additional bits within the AVP Header, and an unrecognized bit 1897 SHOULD be considered an error. The 'P' bit indicates the need for 1898 encryption for end-to-end security. 1900 The 'M' Bit, known as the Mandatory bit, indicates whether support 1901 of the AVP is required. If an AVP with the 'M' bit set is 1902 received by a Diameter client, server, proxy, or translation agent 1903 and either the AVP or its value is unrecognized, the message MUST 1904 be rejected. Diameter Relay and redirect agents MUST NOT reject 1905 messages with unrecognized AVPs. 1907 The 'M' bit MUST be set according to the rules defined for the AVP 1908 containing it. In order to preserve interoperability, a Diameter 1909 implementation MUST be able to exclude from a Diameter message any 1910 Mandatory AVP which is neither defined in the base Diameter 1911 protocol nor in any of the Diameter Application specifications 1912 governing the message in which it appears. It MAY do this in one 1913 of the following ways: 1915 1. If a message is rejected because it contains a Mandatory AVP 1916 which is neither defined in the base Diameter standard nor in 1917 any of the Diameter Application specifications governing the 1918 message in which it appears, the implementation may resend the 1919 message without the AVP, possibly inserting additional 1920 standard AVPs instead. 1922 2. A configuration option may be provided on a system wide, per 1923 peer, or per realm basis that would allow/prevent particular 1924 Mandatory AVPs to be sent. Thus an administrator could change 1925 the configuration to avoid interoperability problems. 1927 Diameter implementations are required to support all Mandatory 1928 AVPs which are allowed by the message's formal syntax and defined 1929 either in the base Diameter standard or in one of the Diameter 1930 Application specifications governing the message. 1932 AVPs with the 'M' bit cleared are informational only and a 1933 receiver that receives a message with such an AVP that is not 1934 supported, or whose value is not supported, MAY simply ignore the 1935 AVP. 1937 The 'V' bit, known as the Vendor-Specific bit, indicates whether 1938 the optional Vendor-ID field is present in the AVP header. When 1939 set the AVP Code belongs to the specific vendor code address 1940 space. 1942 Unless otherwise noted, AVPs will have the following default AVP 1943 Flags field settings: 1945 The 'M' bit MUST be set. The 'V' bit MUST NOT be set. 1947 AVP Length 1949 The AVP Length field is three octets, and indicates the number of 1950 octets in this AVP including the AVP Code, AVP Length, AVP Flags, 1951 Vendor-ID field (if present) and the AVP data. If a message is 1952 received with an invalid attribute length, the message SHOULD be 1953 rejected. 1955 4.1.1. Optional Header Elements 1957 The AVP Header contains one optional field. This field is only 1958 present if the respective bit-flag is enabled. 1960 Vendor-ID 1962 The Vendor-ID field is present if the 'V' bit is set in the AVP 1963 Flags field. The optional four-octet Vendor-ID field contains the 1964 IANA assigned "SMI Network Management Private Enterprise Codes" 1965 [RFC3232] value, encoded in network byte order. Any vendor 1966 wishing to implement a vendor-specific Diameter AVP MUST use their 1967 own Vendor-ID along with their privately managed AVP address 1968 space, guaranteeing that they will not collide with any other 1969 vendor's vendor-specific AVP(s), nor with future IETF 1970 applications. 1972 A vendor ID value of zero (0) corresponds to the IETF adopted AVP 1973 values, as managed by the IANA. Since the absence of the vendor 1974 ID field implies that the AVP in question is not vendor specific, 1975 implementations MUST NOT use the zero (0) vendor ID. 1977 4.2. Basic AVP Data Formats 1979 The Data field is zero or more octets and contains information 1980 specific to the Attribute. The format and length of the Data field 1981 is determined by the AVP Code and AVP Length fields. The format of 1982 the Data field MUST be one of the following base data types or a data 1983 type derived from the base data types. In the event that a new Basic 1984 AVP Data Format is needed, a new version of this RFC must be created. 1986 OctetString 1988 The data contains arbitrary data of variable length. Unless 1989 otherwise noted, the AVP Length field MUST be set to at least 8 1990 (12 if the 'V' bit is enabled). AVP Values of this type that are 1991 not a multiple of four-octets in length is followed by the 1992 necessary padding so that the next AVP (if any) will start on a 1993 32-bit boundary. 1995 Integer32 1997 32 bit signed value, in network byte order. The AVP Length field 1998 MUST be set to 12 (16 if the 'V' bit is enabled). 2000 Integer64 2002 64 bit signed value, in network byte order. The AVP Length field 2003 MUST be set to 16 (20 if the 'V' bit is enabled). 2005 Unsigned32 2007 32 bit unsigned value, in network byte order. The AVP Length 2008 field MUST be set to 12 (16 if the 'V' bit is enabled). 2010 Unsigned64 2012 64 bit unsigned value, in network byte order. The AVP Length 2013 field MUST be set to 16 (20 if the 'V' bit is enabled). 2015 Float32 2017 This represents floating point values of single precision as 2018 described by [FLOATPOINT]. The 32-bit value is transmitted in 2019 network byte order. The AVP Length field MUST be set to 12 (16 if 2020 the 'V' bit is enabled). 2022 Float64 2024 This represents floating point values of double precision as 2025 described by [FLOATPOINT]. The 64-bit value is transmitted in 2026 network byte order. The AVP Length field MUST be set to 16 (20 if 2027 the 'V' bit is enabled). 2029 Grouped 2031 The Data field is specified as a sequence of AVPs. Each of these 2032 AVPs follows - in the order in which they are specified - 2033 including their headers and padding. The AVP Length field is set 2034 to 8 (12 if the 'V' bit is enabled) plus the total length of all 2035 included AVPs, including their headers and padding. Thus the AVP 2036 length field of an AVP of type Grouped is always a multiple of 4. 2038 4.3. Derived AVP Data Formats 2040 In addition to using the Basic AVP Data Formats, applications may 2041 define data formats derived from the Basic AVP Data Formats. An 2042 application that defines new AVP Derived Data Formats MUST include 2043 them in a section entitled "AVP Derived Data Formats", using the same 2044 format as the definitions below. Each new definition must be either 2045 defined or listed with a reference to the RFC that defines the 2046 format. 2048 The below AVP Derived Data Formats are commonly used by applications. 2050 Address 2052 The Address format is derived from the OctetString AVP Base 2053 Format. It is a discriminated union, representing, for example a 2054 32-bit (IPv4) [IPV4] or 128-bit (IPv6) [RFC2373] address, most 2055 significant octet first. The first two octets of the Address AVP 2056 represents the AddressType, which contains an Address Family 2057 defined in [IANAADFAM]. The AddressType is used to discriminate 2058 the content and format of the remaining octets. 2060 Time 2062 The Time format is derived from the OctetString AVP Base Format. 2063 The string MUST contain four octets, in the same format as the 2064 first four bytes are in the NTP timestamp format. The NTP 2065 Timestamp format is defined in chapter 3 of [RFC2030]. 2067 This represents the number of seconds since 0h on 1 January 1900 2068 with respect to the Coordinated Universal Time (UTC). 2070 On 6h 28m 16s UTC, 7 February 2036 the time value will overflow. 2071 SNTP [RFC2030] describes a procedure to extend the time to 2104. 2072 This procedure MUST be supported by all DIAMETER nodes. 2074 UTF8String 2076 The UTF8String format is derived from the OctetString AVP Base 2077 Format. This is a human readable string represented using the 2078 ISO/IEC IS 10646-1 character set, encoded as an OctetString using 2079 the UTF-8 [RFC2279] transformation format described in RFC 2279. 2081 Since additional code points are added by amendments to the 10646 2082 standard from time to time, implementations MUST be prepared to 2083 encounter any code point from 0x00000001 to 0x7fffffff. Byte 2084 sequences that do not correspond to the valid encoding of a code 2085 point into UTF-8 charset or are outside this range are prohibited. 2087 The use of control codes SHOULD be avoided. When it is necessary 2088 to represent a new line, the control code sequence CR LF SHOULD be 2089 used. 2091 The use of leading or trailing white space SHOULD be avoided. 2093 For code points not directly supported by user interface hardware 2094 or software, an alternative means of entry and display, such as 2095 hexadecimal, MAY be provided. 2097 For information encoded in 7-bit US-ASCII, the UTF-8 charset is 2098 identical to the US-ASCII charset. 2100 UTF-8 may require multiple bytes to represent a single character / 2101 code point; thus the length of an UTF8String in octets may be 2102 different from the number of characters encoded. 2104 Note that the AVP Length field of an UTF8String is measured in 2105 octets, not characters. 2107 DiameterIdentity 2109 The DiameterIdentity format is derived from the OctetString AVP 2110 Base Format. 2112 DiameterIdentity = FQDN 2114 DiameterIdentity value is used to uniquely identify a Diameter 2115 node for purposes of duplicate connection and routing loop 2116 detection. 2118 The contents of the string MUST be the FQDN of the Diameter node. 2120 If multiple Diameter nodes run on the same host, each Diameter 2121 node MUST be assigned a unique DiameterIdentity. If a Diameter 2122 node can be identified by several FQDNs, a single FQDN should be 2123 picked at startup, and used as the only DiameterIdentity for that 2124 node, whatever the connection it is sent on. 2126 DiameterURI 2128 The DiameterURI MUST follow the Uniform Resource Identifiers (URI) 2129 syntax [RFC2396] rules specified below: 2131 "aaa://" FQDN [ port ] [ transport ] [ protocol ] 2133 ; No transport security 2135 "aaas://" FQDN [ port ] [ transport ] [ protocol ] 2137 ; Transport security used 2139 FQDN = Fully Qualified Host Name 2141 port = ":" 1*DIGIT 2143 ; One of the ports used to listen for 2144 ; incoming connections. 2145 ; If absent, 2146 ; the default Diameter port (3868) is 2147 ; assumed. 2149 transport = ";transport=" transport-protocol 2151 ; One of the transports used to listen 2152 ; for incoming connections. If absent, 2153 ; the default SCTP [RFC2960] protocol is 2154 ; assumed. UDP MUST NOT be used when 2155 ; the aaa-protocol field is set to 2156 ; diameter. 2158 transport-protocol = ( "tcp" / "sctp" / "udp" ) 2160 protocol = ";protocol=" aaa-protocol 2162 ; If absent, the default AAA protocol 2163 ; is diameter. 2165 aaa-protocol = ( "diameter" / "radius" / "tacacs+" ) 2167 The following are examples of valid Diameter host identities: 2169 aaa://host.example.com;transport=tcp 2170 aaa://host.example.com:6666;transport=tcp 2171 aaa://host.example.com;protocol=diameter 2172 aaa://host.example.com:6666;protocol=diameter 2173 aaa://host.example.com:6666;transport=tcp;protocol=diameter 2174 aaa://host.example.com:1813;transport=udp;protocol=radius 2176 Enumerated 2178 Enumerated is derived from the Integer32 AVP Base Format. The 2179 definition contains a list of valid values and their 2180 interpretation and is described in the Diameter application 2181 introducing the AVP. 2183 IPFilterRule 2185 The IPFilterRule format is derived from the OctetString AVP Base 2186 Format. It uses the ASCII charset. Packets may be filtered based 2187 on the following information that is associated with it: 2189 Direction (in or out) 2190 Source and destination IP address (possibly masked) 2191 Protocol 2192 Source and destination port (lists or ranges) 2193 TCP flags 2194 IP fragment flag 2195 IP options 2196 ICMP types 2198 Rules for the appropriate direction are evaluated in order, with 2199 the first matched rule terminating the evaluation. Each packet is 2200 evaluated once. If no rule matches, the packet is dropped if the 2201 last rule evaluated was a permit, and passed if the last rule was 2202 a deny. 2204 IPFilterRule filters MUST follow the format: 2206 action dir proto from src to dst [options] 2208 action permit - Allow packets that match the rule. 2209 deny - Drop packets that match the rule. 2211 dir "in" is from the terminal, "out" is to the 2212 terminal. 2214 proto An IP protocol specified by number. The "ip" 2215 keyword means any protocol will match. 2217 src and dst
[ports] 2219 The
may be specified as: 2221 ipno An IPv4 or IPv6 number in dotted- 2222 quad or canonical IPv6 form. Only 2223 this exact IP number will match the 2224 rule. 2225 ipno/bits An IP number as above with a mask 2226 width of the form 1.2.3.4/24. In 2227 this case, all IP numbers from 2228 1.2.3.0 to 1.2.3.255 will match. 2229 The bit width MUST be valid for the 2230 IP version and the IP number MUST 2231 NOT have bits set beyond the mask. 2232 For a match to occur, the same IP 2233 version must be present in the 2234 packet that was used in describing 2235 the IP address. To test for a 2236 particular IP version, the bits part 2237 can be set to zero. The keyword 2238 "any" is 0.0.0.0/0 or the IPv6 2239 equivalent. The keyword "assigned" 2240 is the address or set of addresses 2241 assigned to the terminal. For IPv4, 2242 a typical first rule is often "deny 2243 in ip! assigned" 2245 The sense of the match can be inverted by 2246 preceding an address with the not modifier (!), 2247 causing all other addresses to be matched 2248 instead. This does not affect the selection of 2249 port numbers. 2251 With the TCP, UDP and SCTP protocols, optional 2252 ports may be specified as: 2254 {port/port-port}[,ports[,...]] 2256 The '-' notation specifies a range of ports 2257 (including boundaries). 2259 Fragmented packets that have a non-zero offset 2260 (i.e., not the first fragment) will never match 2261 a rule that has one or more port 2262 specifications. See the frag option for 2263 details on matching fragmented packets. 2265 options: 2266 frag Match if the packet is a fragment and this is not 2267 the first fragment of the datagram. frag may not 2268 be used in conjunction with either tcpflags or 2269 TCP/UDP port specifications. 2271 ipoptions spec 2272 Match if the IP header contains the comma 2273 separated list of options specified in spec. The 2274 supported IP options are: 2276 ssrr (strict source route), lsrr (loose source 2277 route), rr (record packet route) and ts 2278 (timestamp). The absence of a particular option 2279 may be denoted with a '!'. 2281 tcpoptions spec 2282 Match if the TCP header contains the comma 2283 separated list of options specified in spec. The 2284 supported TCP options are: 2286 mss (maximum segment size), window (tcp window 2287 advertisement), sack (selective ack), ts (rfc1323 2288 timestamp) and cc (rfc1644 t/tcp connection 2289 count). The absence of a particular option may 2290 be denoted with a '!'. 2292 established 2293 TCP packets only. Match packets that have the RST 2294 or ACK bits set. 2296 setup TCP packets only. Match packets that have the SYN 2297 bit set but no ACK bit. 2299 tcpflags spec 2300 TCP packets only. Match if the TCP header 2301 contains the comma separated list of flags 2302 specified in spec. The supported TCP flags are: 2304 fin, syn, rst, psh, ack and urg. The absence of a 2305 particular flag may be denoted with a '!'. A rule 2306 that contains a tcpflags specification can never 2307 match a fragmented packet that has a non-zero 2308 offset. See the frag option for details on 2309 matching fragmented packets. 2311 icmptypes types 2312 ICMP packets only. Match if the ICMP type is in 2313 the list types. The list may be specified as any 2314 combination of ranges or individual types 2315 separated by commas. Both the numeric values and 2316 the symbolic values listed below can be used. The 2317 supported ICMP types are: 2319 echo reply (0), destination unreachable (3), 2320 source quench (4), redirect (5), echo request 2321 (8), router advertisement (9), router 2322 solicitation (10), time-to-live exceeded (11), IP 2323 header bad (12), timestamp request (13), 2324 timestamp reply (14), information request (15), 2325 information reply (16), address mask request (17) 2326 and address mask reply (18). 2328 There is one kind of packet that the access device MUST always 2329 discard, that is an IP fragment with a fragment offset of one. 2330 This is a valid packet, but it only has one use, to try to 2331 circumvent firewalls. 2333 An access device that is unable to interpret or apply a deny rule 2334 MUST terminate the session. An access device that is unable to 2335 interpret or apply a permit rule MAY apply a more restrictive 2336 rule. An access device MAY apply deny rules of its own before the 2337 supplied rules, for example to protect the access device owner's 2338 infrastructure. 2340 The rule syntax is a modified subset of ipfw(8) from FreeBSD, and 2341 the ipfw.c code may provide a useful base for implementations. 2343 QoSFilterRule 2345 The QosFilterRule format is derived from the OctetString AVP Base 2346 Format. It uses the ASCII charset. Packets may be marked or 2347 metered based on the following information that is associated with 2348 it: 2350 Direction (in or out) 2351 Source and destination IP address (possibly masked) 2352 Protocol 2353 Source and destination port (lists or ranges) 2354 DSCP values (no mask or range) 2356 Rules for the appropriate direction are evaluated in order, with 2357 the first matched rule terminating the evaluation. Each packet is 2358 evaluated once. If no rule matches, the packet is treated as best 2359 effort. An access device that is unable to interpret or apply a 2360 QoS rule SHOULD NOT terminate the session. 2362 QoSFilterRule filters MUST follow the format: 2364 action dir proto from src to dst [options] 2366 tag - Mark packet with a specific DSCP 2367 [DIFFSERV]. The DSCP option MUST be 2368 included. 2369 meter - Meter traffic. The metering options 2370 MUST be included. 2372 dir The format is as described under IPFilterRule. 2374 proto The format is as described under 2375 IPFilterRule. 2377 src and dst The format is as described under 2378 IPFilterRule. 2380 4.4. Grouped AVP Values 2382 The Diameter protocol allows AVP values of type 'Grouped.' This 2383 implies that the Data field is actually a sequence of AVPs. It is 2384 possible to include an AVP with a Grouped type within a Grouped type, 2385 that is, to nest them. AVPs within an AVP of type Grouped have the 2386 same padding requirements as non-Grouped AVPs, as defined in Section 2387 4. 2389 The AVP Code numbering space of all AVPs included in a Grouped AVP is 2390 the same as for non-grouped AVPs. Further, if any of the AVPs 2391 encapsulated within a Grouped AVP has the 'M' (mandatory) bit set, 2392 the Grouped AVP itself MUST also include the 'M' bit set. 2394 Every Grouped AVP defined MUST include a corresponding grammar, using 2395 ABNF [RFC2234] (with modifications), as defined below. 2397 grouped-avp-def = name "::=" avp 2399 name-fmt = ALPHA *(ALPHA / DIGIT / "-") 2401 name = name-fmt 2402 ; The name has to be the name of an AVP, 2403 ; defined in the base or extended Diameter 2404 ; specifications. 2406 avp = header [ *fixed] [ *required] [ *optional] 2407 [ *fixed] 2409 header = "<" "AVP-Header:" avpcode [vendor] ">" 2411 avpcode = 1*DIGIT 2412 ; The AVP Code assigned to the Grouped AVP 2414 vendor = 1*DIGIT 2415 ; The Vendor-ID assigned to the Grouped AVP. 2416 ; If absent, the default value of zero is 2417 ; used. 2419 4.4.1. Example AVP with a Grouped Data type 2421 The Example-AVP (AVP Code 999999) is of type Grouped and is used to 2422 clarify how Grouped AVP values work. The Grouped Data field has the 2423 following ABNF grammar: 2425 Example-AVP ::= < AVP Header: 999999 > 2426 { Origin-Host } 2427 1*{ Session-Id } 2428 *[ AVP ] 2430 An Example-AVP with Grouped Data follows. 2432 The Origin-Host AVP is required (Section 6.3). In this case: 2434 Origin-Host = "example.com". 2436 One or more Session-Ids must follow. Here there are two: 2438 Session-Id = 2439 "grump.example.com:33041;23432;893;0AF3B81" 2441 Session-Id = 2442 "grump.example.com:33054;23561;2358;0AF3B82" 2444 optional AVPs included are 2446 Recovery-Policy = 2447 2163bc1d0ad82371f6bc09484133c3f09ad74a0dd5346d54195a7cf0b35 2448 2cabc881839a4fdcfbc1769e2677a4c1fb499284c5f70b48f58503a45c5 2449 c2d6943f82d5930f2b7c1da640f476f0e9c9572a50db8ea6e51e1c2c7bd 2450 f8bb43dc995144b8dbe297ac739493946803e1cee3e15d9b765008a1b2a 2451 cf4ac777c80041d72c01e691cf751dbf86e85f509f3988e5875dc905119 2452 26841f00f0e29a6d1ddc1a842289d440268681e052b30fb638045f7779c 2453 1d873c784f054f688f5001559ecff64865ef975f3e60d2fd7966b8c7f92 2455 Futuristic-Acct-Record = 2456 fe19da5802acd98b07a5b86cb4d5d03f0314ab9ef1ad0b67111ff3b90a0 2457 57fe29620bf3585fd2dd9fcc38ce62f6cc208c6163c008f4258d1bc88b8 2458 17694a74ccad3ec69269461b14b2e7a4c111fb239e33714da207983f58c 2459 41d018d56fe938f3cbf089aac12a912a2f0d1923a9390e5f789cb2e5067 2460 d3427475e49968f841 2462 The data for the optional AVPs is represented in hex since the format 2463 of these AVPs is neither known at the time of definition of the 2464 Example-AVP group, nor (likely) at the time when the example instance 2465 of this AVP is interpreted - except by Diameter implementations which 2466 support the same set of AVPs. The encoding example illustrates how 2467 padding is used and how length fields are calculated. Also note that 2468 AVPs may be present in the Grouped AVP value which the receiver 2469 cannot interpret (here, the Recover-Policy and Futuristic-Acct-Record 2470 AVPs). 2472 This AVP would be encoded as follows: 2474 0 1 2 3 4 5 6 7 2475 +-------+-------+-------+-------+-------+-------+-------+-------+ 2476 0 | Example AVP Header (AVP Code = 999999), Length = 468 | 2477 +-------+-------+-------+-------+-------+-------+-------+-------+ 2478 8 | Origin-Host AVP Header (AVP Code = 264), Length = 19 | 2479 +-------+-------+-------+-------+-------+-------+-------+-------+ 2480 16 | 'e' | 'x' | 'a' | 'm' | 'p' | 'l' | 'e' | '.' | 2481 +-------+-------+-------+-------+-------+-------+-------+-------+ 2482 24 | 'c' | 'o' | 'm' |Padding| Session-Id AVP Header | 2483 +-------+-------+-------+-------+-------+-------+-------+-------+ 2484 32 | (AVP Code = 263), Length = 50 | 'g' | 'r' | 'u' | 'm' | 2485 +-------+-------+-------+-------+-------+-------+-------+-------+ 2486 . . . 2487 +-------+-------+-------+-------+-------+-------+-------+-------+ 2488 64 | 'A' | 'F' | '3' | 'B' | '8' | '1' |Padding|Padding| 2489 +-------+-------+-------+-------+-------+-------+-------+-------+ 2490 72 | Session-Id AVP Header (AVP Code = 263), Length = 51 | 2491 +-------+-------+-------+-------+-------+-------+-------+-------+ 2492 80 | 'g' | 'r' | 'u' | 'm' | 'p' | '.' | 'e' | 'x' | 2493 +-------+-------+-------+-------+-------+-------+-------+-------+ 2494 . . . 2495 +-------+-------+-------+-------+-------+-------+-------+-------+ 2496 104| '0' | 'A' | 'F' | '3' | 'B' | '8' | '2' |Padding| 2497 +-------+-------+-------+-------+-------+-------+-------+-------+ 2498 112| Recovery-Policy Header (AVP Code = 8341), Length = 223 | 2499 +-------+-------+-------+-------+-------+-------+-------+-------+ 2500 120| 0x21 | 0x63 | 0xbc | 0x1d | 0x0a | 0xd8 | 0x23 | 0x71 | 2501 +-------+-------+-------+-------+-------+-------+-------+-------+ 2502 . . . 2503 +-------+-------+-------+-------+-------+-------+-------+-------+ 2504 320| 0x2f | 0xd7 | 0x96 | 0x6b | 0x8c | 0x7f | 0x92 |Padding| 2505 +-------+-------+-------+-------+-------+-------+-------+-------+ 2506 328| Futuristic-Acct-Record Header (AVP Code = 15930), Length = 137| 2507 +-------+-------+-------+-------+-------+-------+-------+-------+ 2508 336| 0xfe | 0x19 | 0xda | 0x58 | 0x02 | 0xac | 0xd9 | 0x8b | 2509 +-------+-------+-------+-------+-------+-------+-------+-------+ 2510 . . . 2511 +-------+-------+-------+-------+-------+-------+-------+-------+ 2512 464| 0x41 |Padding|Padding|Padding| 2513 +-------+-------+-------+-------+ 2515 4.5. Diameter Base Protocol AVPs 2517 The following table describes the Diameter AVPs defined in the base 2518 protocol, their AVP Code values, types, possible flag values and 2519 whether the AVP MAY be encrypted. For the originator of a Diameter 2520 message, "Encr" (Encryption) means that if a message containing that 2521 AVP is to be sent via a Diameter agent (proxy, redirect or relay) 2522 then the message MUST NOT be sent unless there is end-to-end security 2523 between the originator and the recipient and integrity / 2524 confidentiality protection is offered for this AVP OR the originator 2525 has locally trusted configuration that indicates that end-to-end 2526 security is not needed. Similarly, for the originator of a Diameter 2527 message, a "P" in the "MAY" column means that if a message containing 2528 that AVP is to be sent via a Diameter agent (proxy, redirect or 2529 relay) then the message MUST NOT be sent unless there is end-to-end 2530 security between the originator and the recipient or the originator 2531 has locally trusted configuration that indicates that end-to-end 2532 security is not needed. 2534 Due to space constraints, the short form DiamIdent is used to 2535 represent DiameterIdentity. 2537 +---------------------+ 2538 | AVP Flag rules | 2539 |----+-----+----+-----|----+ 2540 AVP Section | | |SHLD| MUST| | 2541 Attribute Name Code Defined Data Type |MUST| MAY | NOT| NOT|Encr| 2542 -----------------------------------------|----+-----+----+-----|----| 2543 Acct- 85 9.8.2 Unsigned32 | M | P | | V | Y | 2544 Interim-Interval | | | | | | 2545 Accounting- 483 9.8.7 Enumerated | M | P | | V | Y | 2546 Realtime-Required | | | | | | 2547 Acct- 50 9.8.5 UTF8String | M | P | | V | Y | 2548 Multi-Session-Id | | | | | | 2549 Accounting- 485 9.8.3 Unsigned32 | M | P | | V | Y | 2550 Record-Number | | | | | | 2551 Accounting- 480 9.8.1 Enumerated | M | P | | V | Y | 2552 Record-Type | | | | | | 2553 Accounting- 44 9.8.4 OctetString| M | P | | V | Y | 2554 Session-Id | | | | | | 2555 Accounting- 287 9.8.6 Unsigned64 | M | P | | V | Y | 2556 Sub-Session-Id | | | | | | 2557 Acct- 259 6.9 Unsigned32 | M | P | | V | N | 2558 Application-Id | | | | | | 2559 Auth- 258 6.8 Unsigned32 | M | P | | V | N | 2560 Application-Id | | | | | | 2561 Auth-Request- 274 8.7 Enumerated | M | P | | V | N | 2562 Type | | | | | | 2563 Authorization- 291 8.9 Unsigned32 | M | P | | V | N | 2564 Lifetime | | | | | | 2565 Auth-Grace- 276 8.10 Unsigned32 | M | P | | V | N | 2566 Period | | | | | | 2567 Auth-Session- 277 8.11 Enumerated | M | P | | V | N | 2568 State | | | | | | 2569 Re-Auth-Request- 285 8.12 Enumerated | M | P | | V | N | 2570 Type | | | | | | 2571 Class 25 8.20 OctetString| M | P | | V | Y | 2572 Destination-Host 293 6.5 DiamIdent | M | P | | V | N | 2573 Destination- 283 6.6 DiamIdent | M | P | | V | N | 2574 Realm | | | | | | 2575 Disconnect-Cause 273 5.4.3 Enumerated | M | P | | V | N | 2576 E2E-Sequence AVP 300 6.15 Grouped | M | P | | V | Y | 2577 Error-Message 281 7.3 UTF8String | | P | | V,M | N | 2578 Error-Reporting- 294 7.4 DiamIdent | | P | | V,M | N | 2579 Host | | | | | | 2580 Event-Timestamp 55 8.21 Time | M | P | | V | N | 2581 Experimental- 297 7.6 Grouped | M | P | | V | N | 2582 Result | | | | | | 2583 -----------------------------------------|----+-----+----+-----|----| 2584 +---------------------+ 2585 | AVP Flag rules | 2586 |----+-----+----+-----|----+ 2587 AVP Section | | |SHLD| MUST|MAY | 2588 Attribute Name Code Defined Data Type |MUST| MAY | NOT| NOT|Encr| 2589 -----------------------------------------|----+-----+----+-----|----| 2590 Experimental- 298 7.7 Unsigned32 | M | P | | V | N | 2591 Result-Code | | | | | | 2592 Failed-AVP 279 7.5 Grouped | M | P | | V | N | 2593 Firmware- 267 5.3.4 Unsigned32 | | | |P,V,M| N | 2594 Revision | | | | | | 2595 Host-IP-Address 257 5.3.5 Address | M | P | | V | N | 2596 Inband-Security | M | P | | V | N | 2597 -Id 299 6.10 Unsigned32 | | | | | | 2598 Multi-Round- 272 8.19 Unsigned32 | M | P | | V | Y | 2599 Time-Out | | | | | | 2600 Origin-Host 264 6.3 DiamIdent | M | P | | V | N | 2601 Origin-Realm 296 6.4 DiamIdent | M | P | | V | N | 2602 Origin-State-Id 278 8.16 Unsigned32 | M | P | | V | N | 2603 Product-Name 269 5.3.7 UTF8String | | | |P,V,M| N | 2604 Proxy-Host 280 6.7.3 DiamIdent | M | | | P,V | N | 2605 Proxy-Info 284 6.7.2 Grouped | M | | | P,V | N | 2606 Proxy-State 33 6.7.4 OctetString| M | | | P,V | N | 2607 Redirect-Host 292 6.12 DiamURI | M | P | | V | N | 2608 Redirect-Host- 261 6.13 Enumerated | M | P | | V | N | 2609 Usage | | | | | | 2610 Redirect-Max- 262 6.14 Unsigned32 | M | P | | V | N | 2611 Cache-Time | | | | | | 2612 Result-Code 268 7.1 Unsigned32 | M | P | | V | N | 2613 Route-Record 282 6.7.1 DiamIdent | M | | | P,V | N | 2614 Session-Id 263 8.8 UTF8String | M | P | | V | Y | 2615 Session-Timeout 27 8.13 Unsigned32 | M | P | | V | N | 2616 Session-Binding 270 8.17 Unsigned32 | M | P | | V | Y | 2617 Session-Server- 271 8.18 Enumerated | M | P | | V | Y | 2618 Failover | | | | | | 2619 Supported- 265 5.3.6 Unsigned32 | M | P | | V | N | 2620 Vendor-Id | | | | | | 2621 Termination- 295 8.15 Enumerated | M | P | | V | N | 2622 Cause | | | | | | 2623 User-Name 1 8.14 UTF8String | M | P | | V | Y | 2624 Vendor-Id 266 5.3.3 Unsigned32 | M | P | | V | N | 2625 Vendor-Specific- 260 6.11 Grouped | M | P | | V | N | 2626 Application-Id | | | | | | 2627 -----------------------------------------|----+-----+----+-----|----| 2629 5. Diameter Peers 2631 This section describes how Diameter nodes establish connections and 2632 communicate with peers. 2634 5.1. Peer Connections 2636 Although a Diameter node may have many possible peers that it is able 2637 to communicate with, it may not be economical to have an established 2638 connection to all of them. At a minimum, a Diameter node SHOULD have 2639 an established connection with two peers per realm, known as the 2640 primary and secondary peers. Of course, a node MAY have additional 2641 connections, if it is deemed necessary. Typically, all messages for 2642 a realm are sent to the primary peer, but in the event that failover 2643 procedures are invoked, any pending requests are sent to the 2644 secondary peer. However, implementations are free to load balance 2645 requests between a set of peers. 2647 Note that a given peer MAY act as a primary for a given realm, while 2648 acting as a secondary for another realm. 2650 When a peer is deemed suspect, which could occur for various reasons, 2651 including not receiving a DWA within an allotted timeframe, no new 2652 requests should be forwarded to the peer, but failover procedures are 2653 invoked. When an active peer is moved to this mode, additional 2654 connections SHOULD be established to ensure that the necessary number 2655 of active connections exists. 2657 There are two ways that a peer is removed from the suspect peer list: 2659 1. The peer is no longer reachable, causing the transport connection 2660 to be shutdown. The peer is moved to the closed state. 2662 2. Three watchdog messages are exchanged with accepted round trip 2663 times, and the connection to the peer is considered stabilized. 2665 In the event the peer being removed is either the primary or 2666 secondary, an alternate peer SHOULD replace the deleted peer, and 2667 assume the role of either primary or secondary. 2669 5.2. Diameter Peer Discovery 2671 Allowing for dynamic Diameter agent discovery will make it possible 2672 for simpler and more robust deployment of Diameter services. In 2673 order to promote interoperable implementations of Diameter peer 2674 discovery, the following mechanisms are described. These are based 2675 on existing IETF standards. The first option (manual configuration) 2676 MUST be supported by all DIAMETER nodes, while the latter two options 2677 (SRVLOC and DNS) MAY be supported. 2679 There are two cases where Diameter peer discovery may be performed. 2680 The first is when a Diameter client needs to discover a first-hop 2681 Diameter agent. The second case is when a Diameter agent needs to 2682 discover another agent - for further handling of a Diameter 2683 operation. In both cases, the following 'search order' is 2684 recommended: 2686 1. The Diameter implementation consults its list of static 2687 (manually) configured Diameter agent locations. These will be 2688 used if they exist and respond. 2690 2. The Diameter implementation uses SLPv2 [RFC2165] to discover 2691 Diameter services. The Diameter service template [RFC2609] is 2692 included in Appendix B. 2694 It is recommended that SLPv2 security be deployed (this requires 2695 distributing keys to SLPv2 agents). This is discussed further in 2696 Appendix B. SLPv2 security SHOULD be used (requiring 2697 distribution of keys to SLPv2 agents) in order to ensure that 2698 discovered peers are authorized for their roles. SLPv2 is 2699 discussed further in Appendix B. 2701 3. The Diameter implementation performs a NAPTR query for a server 2702 in a particular realm. The Diameter implementation has to know 2703 in advance which realm to look for a Diameter agent in. This 2704 could be deduced, for example, from the 'realm' in a NAI that a 2705 Diameter implementation needed to perform a Diameter operation 2706 on. 2708 * The services relevant for the task of transport protocol 2709 selection are those with NAPTR service fields with values 2710 "AAA+D2x", where x is a letter that corresponds to a transport 2711 protocol supported by the domain. This specification defines 2712 D2T for TCP and D2S for SCTP. We also establish an IANA 2713 registry for NAPTR service name to transport protocol 2714 mappings. 2716 These NAPTR records provide a mapping from a domain, to the 2717 SRV record for contacting a server with the specific transport 2718 protocol in the NAPTR services field. The resource record 2719 will contain an empty regular expression and a replacement 2720 value, which is the SRV record for that particular transport 2721 protocol. If the server supports multiple transport 2722 protocols, there will be multiple NAPTR records, each with a 2723 different service value. As per RFC 2915 [RFC2915], the 2724 client discards any records whose services fields are not 2725 applicable. For the purposes of this specification, several 2726 rules are defined. 2728 * A client MUST discard any service fields that identify a 2729 resolution service whose value is not "D2X", for values of X 2730 that indicate transport protocols supported by the client. 2731 The NAPTR processing as described in RFC 2915 will result in 2732 discovery of the most preferred transport protocol of the 2733 server that is supported by the client, as well as an SRV 2734 record for the server. 2736 The domain suffixes in the NAPTR replacement field SHOULD 2737 match the domain of the original query. 2739 4. If no NAPTR records are found, the requester queries for those 2740 address records for the destination address, 2741 '_diameter._sctp'.realm or '_diameter._tcp'.realm. Address 2742 records include A RR's, AAAA RR's or other similar records, 2743 chosen according to the requestor's network protocol 2744 capabilities. If the DNS server returns no address records, the 2745 requestor gives up. 2747 If the server is using a site certificate, the domain name in the 2748 query and the domain name in the replacement field MUST both be 2749 valid based on the site certificate handed out by the server in 2750 the TLS or IKE exchange. Similarly, the domain name in the SRV 2751 query and the domain name in the target in the SRV record MUST 2752 both be valid based on the same site certificate. Otherwise, an 2753 attacker could modify the DNS records to contain replacement 2754 values in a different domain, and the client could not validate 2755 that this was the desired behavior, or the result of an attack 2757 Also, the Diameter Peer MUST check to make sure that the 2758 discovered peers are authorized to act in its role. 2759 Authentication via IKE or TLS, or validation of DNS RRs via 2760 DNSSEC is not sufficient to conclude this. For example, a web 2761 server may have obtained a valid TLS certificate, and secured RRs 2762 may be included in the DNS, but this does not imply that it is 2763 authorized to act as a Diameter Server. 2765 Authorization can be achieved for example, by configuration of a 2766 Diameter Server CA. Alternatively this can be achieved by 2767 definition of OIDs within TLS or IKE certificates so as to 2768 signify Diameter Server authorization. 2770 A dynamically discovered peer causes an entry in the Peer Table (see 2771 Section 2.6) to be created. Note that entries created via DNS MUST 2772 expire (or be refreshed) within the DNS TTL. If a peer is discovered 2773 outside of the local realm, a routing table entry (see Section 2.7) 2774 for the peer's realm is created. The routing table entry's 2775 expiration MUST match the peer's expiration value. 2777 5.3. Capabilities Exchange 2779 When two Diameter peers establish a transport connection, they MUST 2780 exchange the Capabilities Exchange messages, as specified in the peer 2781 state machine (see Section 5.6). This message allows the discovery 2782 of a peer's identity and its capabilities (protocol version number, 2783 supported Diameter applications, security mechanisms, etc.) 2785 The receiver only issues commands to its peers that have advertised 2786 support for the Diameter application that defines the command. A 2787 Diameter node MUST cache the supported applications in order to 2788 ensure that unrecognized commands and/or AVPs are not unnecessarily 2789 sent to a peer. 2791 A receiver of a Capabilities-Exchange-Req (CER) message that does not 2792 have any applications in common with the sender MUST return a 2793 Capabilities-Exchange-Answer (CEA) with the Result-Code AVP set to 2794 DIAMETER_NO_COMMON_APPLICATION, and SHOULD disconnect the transport 2795 layer connection. Note that receiving a CER or CEA from a peer 2796 advertising itself as a Relay (see Section 2.4) MUST be interpreted 2797 as having common applications with the peer. 2799 The receiver of the Capabilities-Exchange-Request (CER) MUST 2800 determine common applications by computing the intersection of its 2801 own set of supported application identifiers against all of the 2802 application indentifier AVPs (Auth-Application-Id, 2803 Acct-Application-Id and Vendor-Specific-Application-Id) present in 2804 the CER. The value of the Vendor-Id AVP in the Vendor-Specific- 2805 Application-Id MUST not be used during computation. The sender of 2806 the Capabilities-Exchange-Answer (CEA) SHOULD include all of its 2807 supported applications as a hint to the receiver regarding all of its 2808 application capabilities. 2810 Similarly, a receiver of a Capabilities-Exchange-Req (CER) message 2811 that does not have any security mechanisms in common with the sender 2812 MUST return a Capabilities-Exchange-Answer (CEA) with the Result-Code 2813 AVP set to DIAMETER_NO_COMMON_SECURITY, and SHOULD disconnect the 2814 transport layer connection. 2816 CERs received from unknown peers MAY be silently discarded, or a CEA 2817 MAY be issued with the Result-Code AVP set to DIAMETER_UNKNOWN_PEER. 2818 In both cases, the transport connection is closed. If the local 2819 policy permits receiving CERs from unknown hosts, a successful CEA 2820 MAY be returned. If a CER from an unknown peer is answered with a 2821 successful CEA, the lifetime of the peer entry is equal to the 2822 lifetime of the transport connection. In case of a transport 2823 failure, all the pending transactions destined to the unknown peer 2824 can be discarded. 2826 The CER and CEA messages MUST NOT be proxied, redirected or relayed. 2828 Since the CER/CEA messages cannot be proxied, it is still possible 2829 that an upstream agent receives a message for which it has no 2830 available peers to handle the application that corresponds to the 2831 Command-Code. In such instances, the 'E' bit is set in the answer 2832 message (see Section 7.) with the Result-Code AVP set to 2833 DIAMETER_UNABLE_TO_DELIVER to inform the downstream to take action 2834 (e.g., re-routing request to an alternate peer). 2836 With the exception of the Capabilities-Exchange-Request message, a 2837 message of type Request that includes the Auth-Application-Id or 2838 Acct-Application-Id AVPs, or a message with an application-specific 2839 command code, MAY only be forwarded to a host that has explicitly 2840 advertised support for the application (or has advertised the Relay 2841 Application Identifier). 2843 5.3.1. Capabilities-Exchange-Request 2845 The Capabilities-Exchange-Request (CER), indicated by the Command- 2846 Code set to 257 and the Command Flags' 'R' bit set, is sent to 2847 exchange local capabilities. Upon detection of a transport failure, 2848 this message MUST NOT be sent to an alternate peer. 2850 When Diameter is run over SCTP [RFC2960], which allows for 2851 connections to span multiple interfaces and multiple IP addresses, 2852 the Capabilities-Exchange-Request message MUST contain one Host-IP- 2853 Address AVP for each potential IP address that MAY be locally used 2854 when transmitting Diameter messages. 2856 Message Format 2858 ::= < Diameter Header: 257, REQ > 2859 { Origin-Host } 2860 { Origin-Realm } 2861 1* { Host-IP-Address } 2862 { Vendor-Id } 2863 { Product-Name } 2864 [ Origin-State-Id ] 2865 * [ Supported-Vendor-Id ] 2866 * [ Auth-Application-Id ] 2867 * [ Inband-Security-Id ] 2868 * [ Acct-Application-Id ] 2869 * [ Vendor-Specific-Application-Id ] 2870 [ Firmware-Revision ] 2871 * [ AVP ] 2873 5.3.2. Capabilities-Exchange-Answer 2875 The Capabilities-Exchange-Answer (CEA), indicated by the Command-Code 2876 set to 257 and the Command Flags' 'R' bit cleared, is sent in 2877 response to a CER message. 2879 When Diameter is run over SCTP [RFC2960], which allows connections to 2880 span multiple interfaces, hence, multiple IP addresses, the 2881 Capabilities-Exchange-Answer message MUST contain one Host-IP-Address 2882 AVP for each potential IP address that MAY be locally used when 2883 transmitting Diameter messages. 2885 Message Format 2887 ::= < Diameter Header: 257 > 2888 { Result-Code } 2889 { Origin-Host } 2890 { Origin-Realm } 2891 1* { Host-IP-Address } 2892 { Vendor-Id } 2893 { Product-Name } 2894 [ Origin-State-Id ] 2895 [ Error-Message ] 2896 * [ Failed-AVP ] 2897 * [ Supported-Vendor-Id ] 2898 * [ Auth-Application-Id ] 2899 * [ Inband-Security-Id ] 2900 * [ Acct-Application-Id ] 2901 * [ Vendor-Specific-Application-Id ] 2903 [ Firmware-Revision ] 2904 * [ AVP ] 2906 5.3.3. Vendor-Id AVP 2908 The Vendor-Id AVP (AVP Code 266) is of type Unsigned32 and contains 2909 the IANA "SMI Network Management Private Enterprise Codes" [RFC3232] 2910 value assigned to the vendor of the Diameter application. In 2911 combination with the Supported-Vendor-Id AVP (Section 5.3.6), this 2912 MAY be used in order to know which vendor specific attributes may be 2913 sent to the peer. It is also envisioned that the combination of the 2914 Vendor-Id, Product-Name (Section 5.3.7) and the Firmware-Revision 2915 (Section 5.3.4) AVPs MAY provide very useful debugging information. 2917 A Vendor-Id value of zero in the CER or CEA messages is reserved and 2918 indicates that this field is ignored. 2920 5.3.4. Firmware-Revision AVP 2922 The Firmware-Revision AVP (AVP Code 267) is of type Unsigned32 and is 2923 used to inform a Diameter peer of the firmware revision of the 2924 issuing device. 2926 For devices that do not have a firmware revision (general purpose 2927 computers running Diameter software modules, for instance), the 2928 revision of the Diameter software module may be reported instead. 2930 5.3.5. Host-IP-Address AVP 2932 The Host-IP-Address AVP (AVP Code 257) is of type Address and is used 2933 to inform a Diameter peer of the sender's IP address. All source 2934 addresses that a Diameter node expects to use with SCTP [RFC2960] 2935 MUST be advertised in the CER and CEA messages by including a 2936 Host-IP- Address AVP for each address. This AVP MUST ONLY be used in 2937 the CER and CEA messages. 2939 5.3.6. Supported-Vendor-Id AVP 2941 The Supported-Vendor-Id AVP (AVP Code 265) is of type Unsigned32 and 2942 contains the IANA "SMI Network Management Private Enterprise Codes" 2943 [RFC3232] value assigned to a vendor other than the device vendor. 2944 This is used in the CER and CEA messages in order to inform the peer 2945 that the sender supports (a subset of) the vendor-specific AVPs 2946 defined by the vendor identified in this AVP. The value of this AVP 2947 SHOULD NOT be set to zero. Multiple instances of this AVP containing 2948 the same value SHOULD NOT be sent. 2950 5.3.7. Product-Name AVP 2952 The Product-Name AVP (AVP Code 269) is of type UTF8String, and 2953 contains the vendor assigned name for the product. The Product-Name 2954 AVP SHOULD remain constant across firmware revisions for the same 2955 product. 2957 5.4. Disconnecting Peer connections 2959 When a Diameter node disconnects one of its transport connections, 2960 its peer cannot know the reason for the disconnect, and will most 2961 likely assume that a connectivity problem occurred, or that the peer 2962 has rebooted. In these cases, the peer may periodically attempt to 2963 reconnect, as stated in Section 2.1. In the event that the 2964 disconnect was a result of either a shortage of internal resources, 2965 or simply that the node in question has no intentions of forwarding 2966 any Diameter messages to the peer in the foreseeable future, a 2967 periodic connection request would not be welcomed. The 2968 Disconnection-Reason AVP contains the reason the Diameter node issued 2969 the Disconnect-Peer-Request message. 2971 The Disconnect-Peer-Request message is used by a Diameter node to 2972 inform its peer of its intent to disconnect the transport layer, and 2973 that the peer shouldn't reconnect unless it has a valid reason to do 2974 so (e.g., message to be forwarded). Upon receipt of the message, the 2975 Disconnect-Peer-Answer is returned, which SHOULD contain an error if 2976 messages have recently been forwarded, and are likely in flight, 2977 which would otherwise cause a race condition. 2979 The receiver of the Disconnect-Peer-Answer initiates the transport 2980 disconnect. The sender of the Disconnect-Peer-Answer should be able 2981 to detect the transport closure and cleanup the connection. 2983 5.4.1. Disconnect-Peer-Request 2985 The Disconnect-Peer-Request (DPR), indicated by the Command-Code set 2986 to 282 and the Command Flags' 'R' bit set, is sent to a peer to 2987 inform its intentions to shutdown the transport connection. Upon 2988 detection of a transport failure, this message MUST NOT be sent to an 2989 alternate peer. 2991 Message Format 2993 ::= < Diameter Header: 282, REQ > 2994 { Origin-Host } 2995 { Origin-Realm } 2996 { Disconnect-Cause } 2998 5.4.2. Disconnect-Peer-Answer 3000 The Disconnect-Peer-Answer (DPA), indicated by the Command-Code set 3001 to 282 and the Command Flags' 'R' bit cleared, is sent as a response 3002 to the Disconnect-Peer-Request message. Upon receipt of this 3003 message, the transport connection is shutdown. 3005 Message Format 3007 ::= < Diameter Header: 282 > 3008 { Result-Code } 3009 { Origin-Host } 3010 { Origin-Realm } 3011 [ Error-Message ] 3012 * [ Failed-AVP ] 3014 5.4.3. Disconnect-Cause AVP 3016 The Disconnect-Cause AVP (AVP Code 273) is of type Enumerated. A 3017 Diameter node MUST include this AVP in the Disconnect-Peer-Request 3018 message to inform the peer of the reason for its intention to 3019 shutdown the transport connection. The following values are 3020 supported: 3022 REBOOTING 0 3023 A scheduled reboot is imminent. Receiver of DPR with above result 3024 code MAY attempt reconnection. 3026 BUSY 1 3027 The peer's internal resources are constrained, and it has 3028 determined that the transport connection needs to be closed. 3029 Receiver of DPR with above result code SHOULD NOT attempt 3030 reconnection. 3032 DO_NOT_WANT_TO_TALK_TO_YOU 2 3033 The peer has determined that it does not see a need for the 3034 transport connection to exist, since it does not expect any 3035 messages to be exchanged in the near future. Receiver of DPR 3036 with above result code SHOULD NOT attempt reconnection. 3038 5.5. Transport Failure Detection 3040 Given the nature of the Diameter protocol, it is recommended that 3041 transport failures be detected as soon as possible. Detecting such 3042 failures will minimize the occurrence of messages sent to unavailable 3043 agents, resulting in unnecessary delays, and will provide better 3044 failover performance. The Device-Watchdog-Request and Device- 3045 Watchdog-Answer messages, defined in this section, are used to pro- 3046 actively detect transport failures. 3048 5.5.1. Device-Watchdog-Request 3050 The Device-Watchdog-Request (DWR), indicated by the Command-Code set 3051 to 280 and the Command Flags' 'R' bit set, is sent to a peer when no 3052 traffic has been exchanged between two peers (see Section 5.5.3). 3053 Upon detection of a transport failure, this message MUST NOT be sent 3054 to an alternate peer. 3056 Message Format 3058 ::= < Diameter Header: 280, REQ > 3059 { Origin-Host } 3060 { Origin-Realm } 3061 [ Origin-State-Id ] 3063 5.5.2. Device-Watchdog-Answer 3065 The Device-Watchdog-Answer (DWA), indicated by the Command-Code set 3066 to 280 and the Command Flags' 'R' bit cleared, is sent as a response 3067 to the Device-Watchdog-Request message. 3069 Message Format 3071 ::= < Diameter Header: 280 > 3072 { Result-Code } 3073 { Origin-Host } 3074 { Origin-Realm } 3075 [ Error-Message ] 3076 * [ Failed-AVP ] 3077 [ Origin-State-Id ] 3079 5.5.3. Transport Failure Algorithm 3081 The transport failure algorithm is defined in [RFC3539]. All 3082 Diameter implementations MUST support the algorithm defined in the 3083 specification in order to be compliant to the Diameter base protocol. 3085 5.5.4. Failover and Failback Procedures 3087 In the event that a transport failure is detected with a peer, it is 3088 necessary for all pending request messages to be forwarded to an 3089 alternate agent, if possible. This is commonly referred to as 3090 failover. 3092 In order for a Diameter node to perform failover procedures, it is 3093 necessary for the node to maintain a pending message queue for a 3094 given peer. When an answer message is received, the corresponding 3095 request is removed from the queue. The Hop-by-Hop Identifier field 3096 is used to match the answer with the queued request. 3098 When a transport failure is detected, if possible all messages in the 3099 queue are sent to an alternate agent with the T flag set. On booting 3100 a Diameter client or agent, the T flag is also set on any records 3101 still remaining to be transmitted in non-volatile storage. An 3102 example of a case where it is not possible to forward the message to 3103 an alternate server is when the message has a fixed destination, and 3104 the unavailable peer is the message's final destination (see 3105 Destination-Host AVP). Such an error requires that the agent return 3106 an answer message with the 'E' bit set and the Result-Code AVP set to 3107 DIAMETER_UNABLE_TO_DELIVER. 3109 It is important to note that multiple identical requests or answers 3110 MAY be received as a result of a failover. The End-to-End Identifier 3111 field in the Diameter header along with the Origin-Host AVP MUST be 3112 used to identify duplicate messages. 3114 As described in Section 2.1, a connection request should be 3115 periodically attempted with the failed peer in order to re-establish 3116 the transport connection. Once a connection has been successfully 3117 established, messages can once again be forwarded to the peer. This 3118 is commonly referred to as failback. 3120 5.6. Peer State Machine 3122 This section contains a finite state machine that MUST be observed by 3123 all Diameter implementations. Each Diameter node MUST follow the 3124 state machine described below when communicating with each peer. 3125 Multiple actions are separated by commas, and may continue on 3126 succeeding lines, as space requires. Similarly, state and next state 3127 may also span multiple lines, as space requires. 3129 This state machine is closely coupled with the state machine 3130 described in [RFC3539], which is used to open, close, failover, 3131 probe, and reopen transport connections. Note in particular that 3132 [RFC3539] requires the use of watchdog messages to probe connections. 3133 For Diameter, DWR and DWA messages are to be used. 3135 I- is used to represent the initiator (connecting) connection, while 3136 the R- is used to represent the responder (listening) connection. 3137 The lack of a prefix indicates that the event or action is the same 3138 regardless of the connection on which the event occurred. 3140 The stable states that a state machine may be in are Closed, I-Open 3141 and R-Open; all other states are intermediate. Note that I-Open and 3142 R-Open are equivalent except for whether the initiator or responder 3143 transport connection is used for communication. 3145 A CER message is always sent on the initiating connection immediately 3146 after the connection request is successfully completed. In the case 3147 of an election, one of the two connections will shut down. The 3148 responder connection will survive if the Origin-Host of the local 3149 Diameter entity is higher than that of the peer; the initiator 3150 connection will survive if the peer's Origin-Host is higher. All 3151 subsequent messages are sent on the surviving connection. Note that 3152 the results of an election on one peer are guaranteed to be the 3153 inverse of the results on the other. 3155 For TLS usage, a TLS handshake will begin when both ends are in the 3156 open state. If the TLS handshake is successful, all further messages 3157 will be sent via TLS. If the handshake fails, both ends move to the 3158 closed state. 3160 The state machine constrains only the behavior of a Diameter 3161 implementation as seen by Diameter peers through events on the wire. 3163 Any implementation that produces equivalent results is considered 3164 compliant. 3166 state event action next state 3167 ----------------------------------------------------------------- 3168 Closed Start I-Snd-Conn-Req Wait-Conn-Ack 3169 R-Conn-CER R-Accept, R-Open 3170 Process-CER, 3171 R-Snd-CEA 3173 Wait-Conn-Ack I-Rcv-Conn-Ack I-Snd-CER Wait-I-CEA 3174 I-Rcv-Conn-Nack Cleanup Closed 3175 R-Conn-CER R-Accept, Wait-Conn-Ack/ 3176 Process-CER Elect 3177 Timeout Error Closed 3179 Wait-I-CEA I-Rcv-CEA Process-CEA I-Open 3180 R-Conn-CER R-Accept, Wait-Returns 3181 Process-CER, 3182 Elect 3183 I-Peer-Disc I-Disc Closed 3184 I-Rcv-Non-CEA Error Closed 3185 Timeout Error Closed 3187 Wait-Conn-Ack/ I-Rcv-Conn-Ack I-Snd-CER,Elect Wait-Returns 3188 Elect I-Rcv-Conn-Nack R-Snd-CEA R-Open 3189 R-Peer-Disc R-Disc Wait-Conn-Ack 3190 R-Conn-CER R-Reject Wait-Conn-Ack/ 3191 Elect 3192 Timeout Error Closed 3194 Wait-Returns Win-Election I-Disc,R-Snd-CEA R-Open 3195 I-Peer-Disc I-Disc, R-Open 3196 R-Snd-CEA 3197 I-Rcv-CEA R-Disc I-Open 3198 R-Peer-Disc R-Disc Wait-I-CEA 3199 R-Conn-CER R-Reject Wait-Returns 3200 Timeout Error Closed 3202 R-Open Send-Message R-Snd-Message R-Open 3203 R-Rcv-Message Process R-Open 3204 R-Rcv-DWR Process-DWR, R-Open 3205 R-Snd-DWA 3206 R-Rcv-DWA Process-DWA R-Open 3207 R-Conn-CER R-Reject R-Open 3208 Stop R-Snd-DPR Closing 3209 R-Rcv-DPR R-Snd-DPA, Closed 3210 R-Disc 3212 R-Peer-Disc R-Disc Closed 3213 R-Rcv-CER R-Snd-CEA R-Open 3214 R-Rcv-CEA Process-CEA R-Open 3216 I-Open Send-Message I-Snd-Message I-Open 3217 I-Rcv-Message Process I-Open 3218 I-Rcv-DWR Process-DWR, I-Open 3219 I-Snd-DWA 3220 I-Rcv-DWA Process-DWA I-Open 3221 R-Conn-CER R-Reject I-Open 3222 Stop I-Snd-DPR Closing 3223 I-Rcv-DPR I-Snd-DPA, Closed 3224 I-Disc 3225 I-Peer-Disc I-Disc Closed 3226 I-Rcv-CER I-Snd-CEA I-Open 3227 I-Rcv-CEA Process-CEA I-Open 3229 Closing I-Rcv-DPA I-Disc Closed 3230 R-Rcv-DPA R-Disc Closed 3231 Timeout Error Closed 3232 I-Peer-Disc I-Disc Closed 3233 R-Peer-Disc R-Disc Closed 3235 5.6.1. Incoming connections 3237 When a connection request is received from a Diameter peer, it is 3238 not, in the general case, possible to know the identity of that peer 3239 until a CER is received from it. This is because host and port 3240 determine the identity of a Diameter peer; and the source port of an 3241 incoming connection is arbitrary. Upon receipt of CER, the identity 3242 of the connecting peer can be uniquely determined from Origin-Host. 3244 For this reason, a Diameter peer must employ logic separate from the 3245 state machine to receive connection requests, accept them, and await 3246 CER. Once CER arrives on a new connection, the Origin-Host that 3247 identifies the peer is used to locate the state machine associated 3248 with that peer, and the new connection and CER are passed to the 3249 state machine as an R-Conn-CER event. 3251 The logic that handles incoming connections SHOULD close and discard 3252 the connection if any message other than CER arrives, or if an 3253 implementation-defined timeout occurs prior to receipt of CER. 3255 Because handling of incoming connections up to and including receipt 3256 of CER requires logic, separate from that of any individual state 3257 machine associated with a particular peer, it is described separately 3258 in this section rather than in the state machine above. 3260 5.6.2. Events 3262 Transitions and actions in the automaton are caused by events. In 3263 this section, we will ignore the -I and -R prefix, since the actual 3264 event would be identical, but would occur on one of two possible 3265 connections. 3267 Start The Diameter application has signaled that a 3268 connection should be initiated with the peer. 3270 R-Conn-CER An acknowledgement is received stating that the 3271 transport connection has been established, and the 3272 associated CER has arrived. 3274 Rcv-Conn-Ack A positive acknowledgement is received confirming that 3275 the transport connection is established. 3277 Rcv-Conn-Nack A negative acknowledgement was received stating that 3278 the transport connection was not established. 3280 Timeout An application-defined timer has expired while waiting 3281 for some event. 3283 Rcv-CER A CER message from the peer was received. 3285 Rcv-CEA A CEA message from the peer was received. 3287 Rcv-Non-CEA A message other than CEA from the peer was received. 3289 Peer-Disc A disconnection indication from the peer was received. 3291 Rcv-DPR A DPR message from the peer was received. 3293 Rcv-DPA A DPA message from the peer was received. 3295 Win-Election An election was held, and the local node was the 3296 winner. 3298 Send-Message A message is to be sent. 3300 Rcv-Message A message other than CER, CEA, DPR, DPA, DWR or DWA 3301 was received. 3303 Stop The Diameter application has signaled that a 3304 connection should be terminated (e.g., on system 3305 shutdown). 3307 5.6.3. Actions 3309 Actions in the automaton are caused by events and typically indicate 3310 the transmission of packets and/or an action to be taken on the 3311 connection. In this section we will ignore the I- and R-prefix, 3312 since the actual action would be identical, but would occur on one of 3313 two possible connections. 3315 Snd-Conn-Req A transport connection is initiated with the peer. 3317 Accept The incoming connection associated with the R-Conn-CER 3318 is accepted as the responder connection. 3320 Reject The incoming connection associated with the R-Conn-CER 3321 is disconnected. 3323 Process-CER The CER associated with the R-Conn-CER is processed. 3324 Snd-CER A CER message is sent to the peer. 3326 Snd-CEA A CEA message is sent to the peer. 3328 Cleanup If necessary, the connection is shutdown, and any 3329 local resources are freed. 3331 Error The transport layer connection is disconnected, either 3332 politely or abortively, in response to an error 3333 condition. Local resources are freed. 3335 Process-CEA A received CEA is processed. 3337 Snd-DPR A DPR message is sent to the peer. 3339 Snd-DPA A DPA message is sent to the peer. 3341 Disc The transport layer connection is disconnected, and 3342 local resources are freed. 3344 Elect An election occurs (see Section 5.6.4 for more 3345 information). 3347 Snd-Message A message is sent. 3349 Snd-DWR A DWR message is sent. 3351 Snd-DWA A DWA message is sent. 3353 Process-DWR The DWR message is serviced. 3355 Process-DWA The DWA message is serviced. 3357 Process A message is serviced. 3359 5.6.4. The Election Process 3361 The election is performed on the responder. The responder compares 3362 the Origin-Host received in the CER with its own Origin-Host as two 3363 streams of octets. If the local Origin-Host lexicographically 3364 succeeds the received Origin-Host a Win-Election event is issued 3365 locally. 3367 To be consistent with DNS case insensitivity, octets that fall in the 3368 ASCII range 'a' through 'z' MUST compare equally to their upper-case 3369 counterparts between 'A' and 'Z', i.e. value 0x41 compares equal to 3370 0x61, 0x42 to 0x62 and so forth up to and including 0x5a and 0x7a. 3372 5.6.5. Capabilities Update 3374 A Diameter node MUST initiate peer capabilities update by sending a 3375 Capabilities-Exchange-Req (CER) to all its peers which supports peer 3376 capabilities update and is in OPEN state. The receiver of CER in 3377 open state MUST process and reply to the CER as a described in 3378 Section 5.3. The CEA which the receiver sends MUST contain its 3379 latest capabilities. Note that peers which successfully process the 3380 peer capabilities update SHOULD also update their routing tables to 3381 reflect the change. The receiver of the CEA, with a Result-Code AVP 3382 other than DIAMETER_SUCCESS, initiates the transport disconnect. The 3383 peer may periodically attempt to reconnect, as stated in Section 2.1. 3385 Peer capabilities update in the open state SHOULD be limited to the 3386 advertisement of the new list of supported applications and MUST 3387 preclude re-negotiation of security mechanism or other capabilities. 3388 If any capabilities change happens in the node (e.g. change in 3389 security mechanisms), other than a change in the supported 3390 applications, the node SHOULD gracefully terminate (setting the 3391 Disconnect-Cause AVP value to REBOOTING) and re-establish the 3392 diameter connections to all the peers. 3394 6. Diameter message processing 3396 This section describes how Diameter requests and answers are created 3397 and processed. 3399 6.1. Diameter Request Routing Overview 3401 A request is sent towards its final destination using a combination 3402 of the Destination-Realm and Destination-Host AVPs, in one of these 3403 three combinations: 3405 o a request that is not able to be proxied (such as CER) MUST NOT 3406 contain either Destination-Realm or Destination-Host AVPs. 3408 o a request that needs to be sent to a home server serving a 3409 specific realm, but not to a specific server (such as the first 3410 request of a series of round-trips), MUST contain a Destination- 3411 Realm AVP, but MUST NOT contain a Destination-Host AVP. 3413 o otherwise, a request that needs to be sent to a specific home 3414 server among those serving a given realm, MUST contain both the 3415 Destination-Realm and Destination-Host AVPs. 3417 The Destination-Host AVP is used as described above when the 3418 destination of the request is fixed, which includes: 3420 o Authentication requests that span multiple round trips 3422 o A Diameter message that uses a security mechanism that makes use 3423 of a pre-established session key shared between the source and the 3424 final destination of the message. 3426 o Server initiated messages that MUST be received by a specific 3427 Diameter client (e.g., access device), such as the Abort-Session- 3428 Request message, which is used to request that a particular user's 3429 session be terminated. 3431 Note that an agent can forward a request to a host described in the 3432 Destination-Host AVP only if the host in question is included in its 3433 peer table (see Section 2.7). Otherwise, the request is routed based 3434 on the Destination-Realm only (see Sections 6.1.6). 3436 The Destination-Realm AVP MUST be present if the message is 3437 proxiable. Request messages that may be forwarded by Diameter agents 3438 (proxies, redirects or relays) MUST also contain an Acct- 3439 Application-Id AVP, an Auth-Application-Id AVP or a Vendor-Specific- 3440 Application-Id AVP. A message that MUST NOT be forwarded by Diameter 3441 agents (proxies, redirects or relays) MUST not include the 3442 Destination-Realm in its ABNF. The value of the Destination-Realm 3443 AVP MAY be extracted from the User-Name AVP, or other application- 3444 specific methods. 3446 When a message is received, the message is processed in the following 3447 order: 3449 o If the message is destined for the local host, the procedures 3450 listed in Section 6.1.4 are followed. 3452 o If the message is intended for a Diameter peer with whom the local 3453 host is able to directly communicate, the procedures listed in 3454 Section 6.1.5 are followed. This is known as Request Forwarding. 3456 o The procedures listed in Section 6.1.6 are followed, which is 3457 known as Request Routing. 3459 o If none of the above is successful, an answer is returned with the 3460 Result-Code set to DIAMETER_UNABLE_TO_DELIVER, with the E-bit set. 3462 For routing of Diameter messages to work within an administrative 3463 domain, all Diameter nodes within the realm MUST be peers. 3465 Note the processing rules contained in this section are intended to 3466 be used as general guidelines to Diameter developers. Certain 3467 implementations MAY use different methods than the ones described 3468 here, and still comply with the protocol specification. See Section 3469 7 for more detail on error handling. 3471 6.1.1. Originating a Request 3473 When creating a request, in addition to any other procedures 3474 described in the application definition for that specific request, 3475 the following procedures MUST be followed: 3477 o the Command-Code is set to the appropriate value 3479 o the 'R' bit is set 3481 o the End-to-End Identifier is set to a locally unique value 3483 o the Origin-Host and Origin-Realm AVPs MUST be set to the 3484 appropriate values, used to identify the source of the message 3486 o the Destination-Host and Destination-Realm AVPs MUST be set to the 3487 appropriate values as described in Section 6.1. 3489 o an Acct-Application-Id AVP, an Auth-Application-Id or a Vendor- 3490 Specific-Application-Id AVP must be included if the request is 3491 proxiable. The application id present in one of these relevant 3492 AVPs must match the application id present in the diameter message 3493 header. 3495 6.1.2. Sending a Request 3497 When sending a request, originated either locally, or as the result 3498 of a forwarding or routing operation, the following procedures MUST 3499 be followed: 3501 o the Hop-by-Hop Identifier should be set to a locally unique value. 3503 o The message should be saved in the list of pending requests. 3505 Other actions to perform on the message based on the particular role 3506 the agent is playing are described in the following sections. 3508 6.1.3. Receiving Requests 3510 A relay or proxy agent MUST check for forwarding loops when receiving 3511 requests. A loop is detected if the server finds its own identity in 3512 a Route-Record AVP. When such an event occurs, the agent MUST answer 3513 with the Result-Code AVP set to DIAMETER_LOOP_DETECTED. 3515 6.1.4. Processing Local Requests 3517 A request is known to be for local consumption when one of the 3518 following conditions occur: 3520 o The Destination-Host AVP contains the local host's identity, 3522 o The Destination-Host AVP is not present, the Destination-Realm AVP 3523 contains a realm the server is configured to process locally, and 3524 the Diameter application is locally supported, or 3526 o Both the Destination-Host and the Destination-Realm are not 3527 present. 3529 When a request is locally processed, the rules in Section 6.2 should 3530 be used to generate the corresponding answer. 3532 6.1.5. Request Forwarding 3534 Request forwarding is done using the Diameter Peer Table. The 3535 Diameter peer table contains all of the peers that the local node is 3536 able to directly communicate with. 3538 When a request is received, and the host encoded in the Destination- 3539 Host AVP is one that is present in the peer table, the message SHOULD 3540 be forwarded to the peer. 3542 6.1.6. Request Routing 3544 Diameter request message routing is done via realms and applications. 3545 A Diameter message that may be forwarded by Diameter agents (proxies, 3546 redirects or relays) MUST include the target realm in the 3547 Destination-Realm AVP. Request routing SHOULD rely on the 3548 Destination-Realm AVP and the application id present in the request 3549 message header to aid in the routing decision. It MAY also rely on 3550 the application identification AVPs Auth-Application-Id, Acct- 3551 Application-Id or Vendor-Specific-Application-Id instead of the 3552 application id in the message header as a secondary measure. The 3553 realm MAY be retrieved from the User-Name AVP, which is in the form 3554 of a Network Access Identifier (NAI). The realm portion of the NAI 3555 is inserted in the Destination-Realm AVP. 3557 Diameter agents MAY have a list of locally supported realms and 3558 applications, and MAY have a list of externally supported realms and 3559 applications. When a request is received that includes a realm 3560 and/or application that is not locally supported, the message is 3561 routed to the peer configured in the Routing Table (see Section 2.7). 3563 Realm names and application identifiers are the minimum supported 3564 routing criteria, additional routing information maybe needed to 3565 support redirect semantics. 3567 6.1.7. Predictive Loop Avoidance 3569 Before forwarding or routing a request, Diameter agents, in addition 3570 to processing done in Section 6.1.3, SHOULD check for the presence of 3571 candidate route's peer identity in any of the Route-Record AVPs. In 3572 an event of the agent detecting the presence of a candidate route's 3573 peer identity in a Route-Record AVP, the agent MUST ignore such route 3574 for the Diameter request message and attempt alternate routes if any. 3575 In case all the candidate routes are eliminated by the above 3576 criteria, the agent SHOULD return DIAMETER_UNABLE_TO_DELIVER message. 3578 6.1.8. Redirecting requests 3580 When a redirect agent receives a request whose routing entry is set 3581 to REDIRECT, it MUST reply with an answer message with the 'E' bit 3582 set, while maintaining the Hop-by-Hop Identifier in the header, and 3583 include the Result-Code AVP to DIAMETER_REDIRECT_INDICATION. Each of 3584 the servers associated with the routing entry are added in separate 3585 Redirect-Host AVP. 3587 +------------------+ 3588 | Diameter | 3589 | Redirect Agent | 3590 +------------------+ 3591 ^ | 2. command + 'E' bit 3592 1. Request | | Result-Code = 3593 joe@example.com | | DIAMETER_REDIRECT_INDICATION + 3594 | | Redirect-Host AVP(s) 3595 | v 3596 +-------------+ 3. Request +-------------+ 3597 | example.com |------------->| example.net | 3598 | Relay | | Diameter | 3599 | Agent |<-------------| Server | 3600 +-------------+ 4. Answer +-------------+ 3602 Figure 5: Diameter Redirect Agent 3604 The receiver of the answer message with the 'E' bit set, and the 3605 Result-Code AVP set to DIAMETER_REDIRECT_INDICATION uses the hop-by- 3606 hop field in the Diameter header to identify the request in the 3607 pending message queue (see Section 5.3) that is to be redirected. If 3608 no transport connection exists with the new agent, one is created, 3609 and the request is sent directly to it. 3611 Multiple Redirect-Host AVPs are allowed. The receiver of the answer 3612 message with the 'E' bit set selects exactly one of these hosts as 3613 the destination of the redirected message. 3615 6.1.9. Relaying and Proxying Requests 3617 A relay or proxy agent MUST append a Route-Record AVP to all requests 3618 forwarded. The AVP contains the identity of the peer the request was 3619 received from. 3621 The Hop-by-Hop identifier in the request is saved, and replaced with 3622 a locally unique value. The source of the request is also saved, 3623 which includes the IP address, port and protocol. 3625 A relay or proxy agent MAY include the Proxy-Info AVP in requests if 3626 it requires access to any local state information when the 3627 corresponding response is received. Proxy-Info AVP has certain 3628 security implications and SHOULD contain an embedded HMAC with a 3629 node-local key. Alternatively, it MAY simply use local storage to 3630 store state information. 3632 The message is then forwarded to the next hop, as identified in the 3633 Routing Table. 3635 Figure 6 provides an example of message routing using the procedures 3636 listed in these sections. 3638 (Origin-Host=nas.mno.net) (Origin-Host=nas.mno.net) 3639 (Origin-Realm=mno.net) (Origin-Realm=mno.net) 3640 (Destination-Realm=example.com) (Destination- 3641 Realm=example.com) 3642 (Route-Record=nas.example.net) 3643 +------+ ------> +------+ ------> +------+ 3644 | | (Request) | | (Request) | | 3645 | NAS +-------------------+ DRL +-------------------+ HMS | 3646 | | | | | | 3647 +------+ <------ +------+ <------ +------+ 3648 example.net (Answer) example.net (Answer) example.com 3649 (Origin-Host=hms.example.com) (Origin-Host=hms.example.com) 3650 (Origin-Realm=example.com) (Origin-Realm=example.com) 3652 Figure 6: Routing of Diameter messages 3654 Relay agents does not require full validation of incoming messages. 3655 At the minimum, validation of the message header and relevant routing 3656 AVPs has to be done when relaying messages. 3658 6.2. Diameter Answer Processing 3660 When a request is locally processed, the following procedures MUST be 3661 applied to create the associated answer, in addition to any 3662 additional procedures that MAY be discussed in the Diameter 3663 application defining the command: 3665 o The same Hop-by-Hop identifier in the request is used in the 3666 answer. 3668 o The local host's identity is encoded in the Origin-Host AVP. 3670 o The Destination-Host and Destination-Realm AVPs MUST NOT be 3671 present in the answer message. 3673 o The Result-Code AVP is added with its value indicating success or 3674 failure. 3676 o If the Session-Id is present in the request, it MUST be included 3677 in the answer. 3679 o Any Proxy-Info AVPs in the request MUST be added to the answer 3680 message, in the same order they were present in the request. 3682 o The 'P' bit is set to the same value as the one in the request. 3684 o The same End-to-End identifier in the request is used in the 3685 answer. 3687 Note that the error messages (see Section 7.3) are also subjected to 3688 the above processing rules. 3690 6.2.1. Processing received Answers 3692 A Diameter client or proxy MUST match the Hop-by-Hop Identifier in an 3693 answer received against the list of pending requests. The 3694 corresponding message should be removed from the list of pending 3695 requests. It SHOULD ignore answers received that do not match a 3696 known Hop-by-Hop Identifier. 3698 6.2.2. Relaying and Proxying Answers 3700 If the answer is for a request which was proxied or relayed, the 3701 agent MUST restore the original value of the Diameter header's Hop- 3702 by-Hop Identifier field. 3704 If the last Proxy-Info AVP in the message is targeted to the local 3705 Diameter server, the AVP MUST be removed before the answer is 3706 forwarded. 3708 If a relay or proxy agent receives an answer with a Result-Code AVP 3709 indicating a failure, it MUST NOT modify the contents of the AVP. 3710 Any additional local errors detected SHOULD be logged, but not 3711 reflected in the Result-Code AVP. If the agent receives an answer 3712 message with a Result-Code AVP indicating success, and it wishes to 3713 modify the AVP to indicate an error, it MUST modify the Result-Code 3714 AVP to contain the appropriate error in the message destined towards 3715 the access device as well as include the Error-Reporting-Host AVP and 3716 it MUST issue an STR on behalf of the access device. 3718 The agent MUST then send the answer to the host that it received the 3719 original request from. 3721 6.3. Origin-Host AVP 3723 The Origin-Host AVP (AVP Code 264) is of type DiameterIdentity, and 3724 MUST be present in all Diameter messages. This AVP identifies the 3725 endpoint that originated the Diameter message. Relay agents MUST NOT 3726 modify this AVP. 3728 The value of the Origin-Host AVP is guaranteed to be unique within a 3729 single host. 3731 Note that the Origin-Host AVP may resolve to more than one address as 3732 the Diameter peer may support more than one address. 3734 This AVP SHOULD be placed as close to the Diameter header as 3735 possible. 6.10 3737 6.4. Origin-Realm AVP 3739 The Origin-Realm AVP (AVP Code 296) is of type DiameterIdentity. 3740 This AVP contains the Realm of the originator of any Diameter message 3741 and MUST be present in all messages. 3743 This AVP SHOULD be placed as close to the Diameter header as 3744 possible. 3746 6.5. Destination-Host AVP 3748 The Destination-Host AVP (AVP Code 293) is of type DiameterIdentity. 3749 This AVP MUST be present in all unsolicited agent initiated messages, 3750 MAY be present in request messages, and MUST NOT be present in Answer 3751 messages. 3753 The absence of the Destination-Host AVP will cause a message to be 3754 sent to any Diameter server supporting the application within the 3755 realm specified in Destination-Realm AVP. 3757 This AVP SHOULD be placed as close to the Diameter header as 3758 possible. 3760 6.6. Destination-Realm AVP 3762 The Destination-Realm AVP (AVP Code 283) is of type DiameterIdentity, 3763 and contains the realm the message is to be routed to. The 3764 Destination-Realm AVP MUST NOT be present in Answer messages. 3765 Diameter Clients insert the realm portion of the User-Name AVP. 3766 Diameter servers initiating a request message use the value of the 3767 Origin-Realm AVP from a previous message received from the intended 3768 target host (unless it is known a priori). When present, the 3769 Destination-Realm AVP is used to perform message routing decisions. 3771 Request messages whose ABNF does not list the Destination-Realm AVP 3772 as a mandatory AVP are inherently non-routable messages. 3774 This AVP SHOULD be placed as close to the Diameter header as 3775 possible. 3777 6.7. Routing AVPs 3779 The AVPs defined in this section are Diameter AVPs used for routing 3780 purposes. These AVPs change as Diameter messages are processed by 3781 agents, and therefore MUST NOT be protected by end-to-end security. 3783 6.7.1. Route-Record AVP 3785 The Route-Record AVP (AVP Code 282) is of type DiameterIdentity. The 3786 identity added in this AVP MUST be the same as the one received in 3787 the Origin-Host of the Capabilities Exchange message. 3789 6.7.2. Proxy-Info AVP 3791 The Proxy-Info AVP (AVP Code 284) is of type Grouped. The Grouped 3792 Data field has the following ABNF grammar: 3794 Proxy-Info ::= < AVP Header: 284 > 3795 { Proxy-Host } 3796 { Proxy-State } 3797 * [ AVP ] 3799 6.7.3. Proxy-Host AVP 3801 The Proxy-Host AVP (AVP Code 280) is of type DiameterIdentity. This 3802 AVP contains the identity of the host that added the Proxy-Info AVP. 3804 6.7.4. Proxy-State AVP 3806 The Proxy-State AVP (AVP Code 33) is of type OctetString, and 3807 contains state local information, and MUST be treated as opaque data. 3809 6.8. Auth-Application-Id AVP 3811 The Auth-Application-Id AVP (AVP Code 258) is of type Unsigned32 and 3812 is used in order to advertise support of the Authentication and 3813 Authorization portion of an application (see Section 2.4). The Auth- 3814 Application-Id MUST also be present in all Authentication and/or 3815 Authorization messages that are defined in a separate Diameter 3816 specification and have an Application ID assigned. If present in a 3817 message, the value of the Auth-Application-Id AVP MUST match the 3818 application id present in the diameter message header except when 3819 used in a CER or CEA messages. 3821 6.9. Acct-Application-Id AVP 3823 The Acct-Application-Id AVP (AVP Code 259) is of type Unsigned32 and 3824 is used in order to advertise support of the Accounting portion of an 3825 application (see Section 2.4). The Acct-Application-Id MUST also be 3826 present in all Accounting messages. Exactly one of the Auth- 3827 Application-Id and Acct-Application-Id AVPs MAY be present. If 3828 present in a message, the value of the Acct-Application-Id AVP MUST 3829 match the application id present in the diameter message header 3830 except when used in a CER or CEA messages. 3832 6.10. Inband-Security-Id AVP 3834 The Inband-Security-Id AVP (AVP Code 299) is of type Unsigned32 and 3835 is used in order to advertise support of the Security portion of the 3836 application. 3838 Currently, the following values are supported, but there is ample 3839 room to add new security Ids. 3841 NO_INBAND_SECURITY 0 3843 This peer does not support TLS. This is the default value, if the 3844 AVP is omitted. 3846 TLS 1 3848 This node supports TLS security, as defined by [RFC2246]. 3850 6.11. Vendor-Specific-Application-Id AVP 3852 The Vendor-Specific-Application-Id AVP (AVP Code 260) is of type 3853 Grouped and is used to advertise support of a vendor-specific 3854 Diameter Application. Exactly one instance of Auth-Application-Id or 3855 Acct-Application-Id AVP MAY be present. The application identifier 3856 carried by either Auth-Application-Id or Acct-Application-Id AVP MUST 3857 comply with vendor specific application identifier assignment 3858 described in Sec 11.3. It MUST also match the application id present 3859 in the diameter header except when used in a CER or CEA messages. 3861 The Vendor-Id AVP is an informational AVP pertaining to the vendor 3862 who may have authorship of the vendor-specific diameter application. 3863 It should not be used as a means of defining a vendor-specific 3864 application identifiers space. 3866 This AVP MUST also be present as the first AVP in all experimental 3867 commands defined in the vendor-specific application. 3869 This AVP SHOULD be placed as close to the Diameter header as 3870 possible. 3872 AVP Format 3874 ::= < AVP Header: 260 > 3875 { Vendor-Id } 3876 { Auth-Application-Id } / 3877 { Acct-Application-Id } 3879 6.12. Redirect-Host AVP 3881 One or more of instances of this AVP MUST be present if the answer 3882 message's 'E' bit is set and the Result-Code AVP is set to 3883 DIAMETER_REDIRECT_INDICATION. 3885 Upon receiving the above, the receiving Diameter node SHOULD forward 3886 the request directly to one of the hosts identified in these AVPs. 3887 The server contained in the selected Redirect-Host AVP SHOULD be used 3888 for all messages pertaining to this session. 3890 6.13. Redirect-Host-Usage AVP 3892 The Redirect-Host-Usage AVP (AVP Code 261) is of type Enumerated. 3893 This AVP MAY be present in answer messages whose 'E' bit is set and 3894 the Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION. 3896 When present, this AVP dictates how the routing entry resulting from 3897 the Redirect-Host is to be used. The following values are supported: 3899 DONT_CACHE 0 3901 The host specified in the Redirect-Host AVP should not be cached. 3902 This is the default value. 3904 ALL_SESSION 1 3906 All messages within the same session, as defined by the same value 3907 of the Session-ID AVP MAY be sent to the host specified in the 3908 Redirect-Host AVP. 3910 ALL_REALM 2 3912 All messages destined for the realm requested MAY be sent to the 3913 host specified in the Redirect-Host AVP. 3915 REALM_AND_APPLICATION 3 3917 All messages for the application requested to the realm specified 3918 MAY be sent to the host specified in the Redirect-Host AVP. 3920 ALL_APPLICATION 4 3922 All messages for the application requested MAY be sent to the host 3923 specified in the Redirect-Host AVP. 3925 ALL_HOST 5 3927 All messages that would be sent to the host that generated the 3928 Redirect-Host MAY be sent to the host specified in the Redirect- 3929 Host AVP. 3931 ALL_USER 6 3933 All messages for the user requested MAY be sent to the host 3934 specified in the Redirect-Host AVP. 3936 6.14. Redirect-Max-Cache-Time AVP 3938 The Redirect-Max-Cache-Time AVP (AVP Code 262) is of type Unsigned32. 3939 This AVP MUST be present in answer messages whose 'E' bit is set, the 3940 Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION and the 3941 Redirect-Host-Usage AVP set to a non-zero value. 3943 This AVP contains the maximum number of seconds the peer and route 3944 table entries, created as a result of the Redirect-Host, will be 3945 cached. Note that once a host created due to a redirect indication 3946 is no longer reachable, any associated peer and routing table entries 3947 MUST be deleted. 3949 6.15. E2E-Sequence AVP 3951 The E2E-Sequence AVP (AVP Code 300) provides anti-replay protection 3952 for end to end messages and is of type grouped. It contains a random 3953 value (an OctetString with a nonce) and counter (an Integer). For 3954 each end-to-end peer with which a node communicates (or remembers 3955 communicating) a different nonce value MUST be used and the counter 3956 is initiated at zero and increases by one each time this AVP is 3957 emitted to that peer. This AVP MUST be included in all messages 3958 which use end-to-end protection (e.g., CMS signing or encryption). 3960 7. Error Handling 3962 There are two different types of errors in Diameter; protocol and 3963 application errors. A protocol error is one that occurs at the base 3964 protocol level, and MAY require per hop attention (e.g., message 3965 routing error). Application errors, on the other hand, generally 3966 occur due to a problem with a function specified in a Diameter 3967 application (e.g., user authentication, Missing AVP). 3969 Result-Code AVP values that are used to report protocol errors MUST 3970 only be present in answer messages whose 'E' bit is set. When a 3971 request message is received that causes a protocol error, an answer 3972 message is returned with the 'E' bit set, and the Result-Code AVP is 3973 set to the appropriate protocol error value. As the answer is sent 3974 back towards the originator of the request, each proxy or relay agent 3975 MAY take action on the message. 3977 1. Request +---------+ Link Broken 3978 +-------------------------->|Diameter |----///----+ 3979 | +---------------------| | v 3980 +------+--+ | 2. answer + 'E' set | Relay 2 | +--------+ 3981 |Diameter |<-+ (Unable to Forward) +---------+ |Diameter| 3982 | | | Home | 3983 | Relay 1 |--+ +---------+ | Server | 3984 +---------+ | 3. Request |Diameter | +--------+ 3985 +-------------------->| | ^ 3986 | Relay 3 |-----------+ 3987 +---------+ 3989 Figure 7: Example of Protocol Error causing answer message 3991 Figure 7 provides an example of a message forwarded upstream by a 3992 Diameter relay. When the message is received by Relay 2, and it 3993 detects that it cannot forward the request to the home server, an 3994 answer message is returned with the 'E' bit set and the Result-Code 3995 AVP set to DIAMETER_UNABLE_TO_DELIVER. Given that this error falls 3996 within the protocol error category, Relay 1 would take special 3997 action, and given the error, attempt to route the message through its 3998 alternate Relay 3. 4000 +---------+ 1. Request +---------+ 2. Request +---------+ 4001 | Access |------------>|Diameter |------------>|Diameter | 4002 | | | | | Home | 4003 | Device |<------------| Relay |<------------| Server | 4004 +---------+ 4. Answer +---------+ 3. Answer +---------+ 4005 (Missing AVP) (Missing AVP) 4007 Figure 8: Example of Application Error Answer message 4009 Figure 8 provides an example of a Diameter message that caused an 4010 application error. When application errors occur, the Diameter 4011 entity reporting the error clears the 'R' bit in the Command Flags, 4012 and adds the Result-Code AVP with the proper value. Application 4013 errors do not require any proxy or relay agent involvement, and 4014 therefore the message would be forwarded back to the originator of 4015 the request. 4017 There are certain Result-Code AVP application errors that require 4018 additional AVPs to be present in the answer. In these cases, the 4019 Diameter node that sets the Result-Code AVP to indicate the error 4020 MUST add the AVPs. Examples are: 4022 o An unrecognized AVP is received with the 'M' bit (Mandatory bit) 4023 set, causes an answer to be sent with the Result-Code AVP set to 4024 DIAMETER_AVP_UNSUPPORTED, and the Failed-AVP AVP containing the 4025 offending AVP. 4027 o An AVP that is received with an unrecognized value causes an 4028 answer to be returned with the Result-Code AVP set to 4029 DIAMETER_INVALID_AVP_VALUE, with the Failed-AVP AVP containing the 4030 AVP causing the error. 4032 o A command is received with an AVP that is omitted, yet is 4033 mandatory according to the command's ABNF. The receiver issues an 4034 answer with the Result-Code set to DIAMETER_MISSING_AVP, and 4035 creates an AVP with the AVP Code and other fields set as expected 4036 in the missing AVP. The created AVP is then added to the Failed- 4037 AVP AVP. 4039 The Result-Code AVP describes the error that the Diameter node 4040 encountered in its processing. In case there are multiple errors, 4041 the Diameter node MUST report only the first error it encountered 4042 (detected possibly in some implementation dependent order). The 4043 specific errors that can be described by this AVP are described in 4044 the following section. 4046 7.1. Result-Code AVP 4048 The Result-Code AVP (AVP Code 268) is of type Unsigned32 and 4049 indicates whether a particular request was completed successfully or 4050 whether an error occurred. All Diameter answer messages defined in 4051 IETF applications MUST include one Result-Code AVP. A non-successful 4052 Result-Code AVP (one containing a non 2xxx value other than 4053 DIAMETER_REDIRECT_INDICATION) MUST include the Error-Reporting-Host 4054 AVP if the host setting the Result-Code AVP is different from the 4055 identity encoded in the Origin-Host AVP. 4057 The Result-Code data field contains an IANA-managed 32-bit address 4058 space representing errors (see Section 11.4). Diameter provides the 4059 following classes of errors, all identified by the thousands digit in 4060 the decimal notation: 4062 o 1xxx (Informational) 4064 o 2xxx (Success) 4066 o 3xxx (Protocol Errors) 4068 o 4xxx (Transient Failures) 4070 o 5xxx (Permanent Failure) 4072 A non-recognized class (one whose first digit is not defined in this 4073 section) MUST be handled as a permanent failure. 4075 7.1.1. Informational 4077 Errors that fall within this category are used to inform the 4078 requester that a request could not be satisfied, and additional 4079 action is required on its part before access is granted. 4081 DIAMETER_MULTI_ROUND_AUTH 1001 4083 This informational error is returned by a Diameter server to 4084 inform the access device that the authentication mechanism being 4085 used requires multiple round trips, and a subsequent request needs 4086 to be issued in order for access to be granted. 4088 7.1.2. Success 4090 Errors that fall within the Success category are used to inform a 4091 peer that a request has been successfully completed. 4093 DIAMETER_SUCCESS 2001 4095 The Request was successfully completed. 4097 DIAMETER_LIMITED_SUCCESS 2002 4099 When returned, the request was successfully completed, but 4100 additional processing is required by the application in order to 4101 provide service to the user. 4103 7.1.3. Protocol Errors 4105 Errors that fall within the Protocol Error category SHOULD be treated 4106 on a per-hop basis, and Diameter proxies MAY attempt to correct the 4107 error, if it is possible. Note that these and only these errors MUST 4108 only be used in answer messages whose 'E' bit is set. To provide 4109 backward compatibility with existing implementations that follows 4110 [RFC3588], some of the error values that have previously been used in 4111 this category by [RFC3588] will not be re-used. Therefore the error 4112 values enumerated here maybe non-sequential. 4114 DIAMETER_UNABLE_TO_DELIVER 3002 4116 This error is given when Diameter can not deliver the message to 4117 the destination, either because no host within the realm 4118 supporting the required application was available to process the 4119 request, or because Destination-Host AVP was given without the 4120 associated Destination-Realm AVP. 4122 DIAMETER_REALM_NOT_SERVED 3003 4124 The intended realm of the request is not recognized. 4126 DIAMETER_TOO_BUSY 3004 4128 When returned, a Diameter node SHOULD attempt to send the message 4129 to an alternate peer. This error MUST only be used when a 4130 specific server is requested, and it cannot provide the requested 4131 service. 4133 DIAMETER_LOOP_DETECTED 3005 4135 An agent detected a loop while trying to get the message to the 4136 intended recipient. The message MAY be sent to an alternate peer, 4137 if one is available, but the peer reporting the error has 4138 identified a configuration problem. 4140 DIAMETER_REDIRECT_INDICATION 3006 4142 A redirect agent has determined that the request could not be 4143 satisfied locally and the initiator of the request should direct 4144 the request directly to the server, whose contact information has 4145 been added to the response. When set, the Redirect-Host AVP MUST 4146 be present. 4148 DIAMETER_APPLICATION_UNSUPPORTED 3007 4150 A request was sent for an application that is not supported. 4152 DIAMETER_INVALID_BIT_IN_HEADER 3011 4154 This error is returned when an unrecognized bit in the Diameter 4155 header is set to one (1). 4157 DIAMETER_INVALID_MESSAGE_LENGTH 3012 4159 This error is returned when a request is received with an invalid 4160 message length. 4162 7.1.4. Transient Failures 4164 Errors that fall within the transient failures category are used to 4165 inform a peer that the request could not be satisfied at the time it 4166 was received, but MAY be able to satisfy the request in the future. 4167 Note that these errors MUST be used in answer messages whose 'E' bit 4168 not is set. 4170 DIAMETER_AUTHENTICATION_REJECTED 4001 4172 The authentication process for the user failed, most likely due to 4173 an invalid password used by the user. Further attempts MUST only 4174 be tried after prompting the user for a new password. 4176 DIAMETER_OUT_OF_SPACE 4002 4178 A Diameter node received the accounting request but was unable to 4179 commit it to stable storage due to a temporary lack of space. 4181 ELECTION_LOST 4003 4183 The peer has determined that it has lost the election process and 4184 has therefore disconnected the transport connection. 4186 7.1.5. Permanent Failures 4188 Errors that fall within the permanent failures category are used to 4189 inform the peer that the request failed, and should not be attempted 4190 again. Note that these errors SHOULD be used in answer messages 4191 whose 'E' bit is not set. In error conditions where it is not 4192 possible or efficient to compose application specific answer grammar 4193 then answer messages with E-bit set and complying to the grammar 4194 described in 7.2 MAY also be used for permanent errors. 4196 To provide backward compatibility with existing implementations that 4197 follows [RFC3588], some of the error values that have previously been 4198 used in this category by [RFC3588] will not be re-used. Therefore 4199 the error values enumerated here maybe non-sequential. 4201 DIAMETER_AVP_UNSUPPORTED 5001 4203 The peer received a message that contained an AVP that is not 4204 recognized or supported and was marked with the Mandatory bit. A 4205 Diameter message with this error MUST contain one or more Failed- 4206 AVP AVP containing the AVPs that caused the failure. 4208 DIAMETER_UNKNOWN_SESSION_ID 5002 4210 The request contained an unknown Session-Id. 4212 DIAMETER_AUTHORIZATION_REJECTED 5003 4214 A request was received for which the user could not be authorized. 4215 This error could occur if the service requested is not permitted 4216 to the user. 4218 DIAMETER_INVALID_AVP_VALUE 5004 4220 The request contained an AVP with an invalid value in its data 4221 portion. A Diameter message indicating this error MUST include 4222 the offending AVPs within a Failed-AVP AVP. 4224 DIAMETER_MISSING_AVP 5005 4226 The request did not contain an AVP that is required by the Command 4227 Code definition. If this value is sent in the Result-Code AVP, a 4228 Failed-AVP AVP SHOULD be included in the message. The Failed-AVP 4229 AVP MUST contain an example of the missing AVP complete with the 4230 Vendor-Id if applicable. The value field of the missing AVP 4231 should be of correct minimum length and contain zeroes. 4233 DIAMETER_RESOURCES_EXCEEDED 5006 4235 A request was received that cannot be authorized because the user 4236 has already expended allowed resources. An example of this error 4237 condition is a user that is restricted to one dial-up PPP port, 4238 attempts to establish a second PPP connection. 4240 DIAMETER_CONTRADICTING_AVPS 5007 4242 The Home Diameter server has detected AVPs in the request that 4243 contradicted each other, and is not willing to provide service to 4244 the user. One or more Failed-AVP AVPs MUST be present, containing 4245 the AVPs that contradicted each other. 4247 DIAMETER_AVP_NOT_ALLOWED 5008 4249 A message was received with an AVP that MUST NOT be present. The 4250 Failed-AVP AVP MUST be included and contain a copy of the 4251 offending AVP. 4253 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES 5009 4255 A message was received that included an AVP that appeared more 4256 often than permitted in the message definition. The Failed-AVP 4257 AVP MUST be included and contain a copy of the first instance of 4258 the offending AVP that exceeded the maximum number of occurrences 4260 DIAMETER_NO_COMMON_APPLICATION 5010 4262 This error is returned when a node that is not acting as a relay 4263 and supporting a specific set of application has an empty 4264 intersection with the set of application advertised by its peer. 4266 DIAMETER_UNSUPPORTED_VERSION 5011 4268 This error is returned when a request was received, whose version 4269 number is unsupported. 4271 DIAMETER_UNABLE_TO_COMPLY 5012 4273 This error is returned when a request is rejected for unspecified 4274 reasons. 4276 DIAMETER_INVALID_AVP_LENGTH 5014 4278 The request contained an AVP with an invalid length. A Diameter 4279 message indicating this error MUST include the offending AVPs 4280 within a Failed-AVP AVP. In cases where the erroneous avp length 4281 value exceeds the message length or is less than the minimum AVP 4282 header length, it is sufficient to include the offending AVP 4283 header and a zero filled payload of the minimum required length. 4285 DIAMETER_NO_COMMON_SECURITY 5017 4287 This error is returned when a CER message is received, and there 4288 are no common security mechanisms supported between the peers. A 4289 Capabilities-Exchange-Answer (CEA) MUST be returned with the 4290 Result-Code AVP set to DIAMETER_NO_COMMON_SECURITY. 4292 DIAMETER_UNKNOWN_PEER 5018 4294 A CER was received from an unknown peer. 4296 DIAMETER_COMMAND_UNSUPPORTED 5019 4298 The Request contained a Command-Code that the receiver did not 4299 recognize or support. This MUST be used when a Diameter node 4300 receives an experimental command that it does not understand. 4302 DIAMETER_INVALID_HDR_BITS 5020 4304 A request was received whose bits in the Diameter header were 4305 either set to an invalid combination, or to a value that is 4306 inconsistent with the command code's definition. 4308 DIAMETER_INVALID_AVP_BITS 5021 4310 A request was received that included an AVP whose flag bits are 4311 set to an unrecognized value, or that is inconsistent with the 4312 AVP's definition. 4314 7.2. Error Bit 4316 The 'E' (Error Bit) in the Diameter header is set when the request 4317 caused a protocol-related error (see Section 7.1.3). A message with 4318 the 'E' bit MUST NOT be sent as a response to an answer message. 4319 Note that a message with the 'E' bit set is still subjected to the 4320 processing rules defined in Section 6.2. When set, the answer 4321 message will not conform to the ABNF specification for the command, 4322 and will instead conform to the following ABNF: 4324 Message Format 4326 ::= < Diameter Header: code, ERR [PXY] > 4327 0*1< Session-Id > 4328 { Origin-Host } 4329 { Origin-Realm } 4330 { Result-Code } 4331 [ Origin-State-Id ] 4332 [ Error-Reporting-Host ] 4333 [ Proxy-Info ] 4334 * [ AVP ] 4336 Note that the code used in the header is the same than the one found 4337 in the request message, but with the 'R' bit cleared and the 'E' bit 4338 set. The 'P' bit in the header is set to the same value as the one 4339 found in the request message. 4341 7.3. Error-Message AVP 4343 The Error-Message AVP (AVP Code 281) is of type UTF8String. It MAY 4344 accompany a Result-Code AVP as a human readable error message. The 4345 Error-Message AVP is not intended to be useful in real-time, and 4346 SHOULD NOT be expected to be parsed by network entities. 4348 7.4. Error-Reporting-Host AVP 4350 The Error-Reporting-Host AVP (AVP Code 294) is of type 4351 DiameterIdentity. This AVP contains the identity of the Diameter 4352 host that sent the Result-Code AVP to a value other than 2001 4353 (Success), only if the host setting the Result-Code is different from 4354 the one encoded in the Origin-Host AVP. This AVP is intended to be 4355 used for troubleshooting purposes, and MUST be set when the Result- 4356 Code AVP indicates a failure. 4358 7.5. Failed-AVP AVP 4360 The Failed-AVP AVP (AVP Code 279) is of type Grouped and provides 4361 debugging information in cases where a request is rejected or not 4362 fully processed due to erroneous information in a specific AVP. The 4363 value of the Result-Code AVP will provide information on the reason 4364 for the Failed-AVP AVP. 4366 The possible reasons for this AVP are the presence of an improperly 4367 constructed AVP, an unsupported or unrecognized AVP, an invalid AVP 4368 value, the omission of a required AVP, the presence of an explicitly 4369 excluded AVP (see tables in Section 10), or the presence of two or 4370 more occurrences of an AVP which is restricted to 0, 1, or 0-1 4371 occurrences. 4373 A Diameter message MAY contain one Failed-AVP AVP, containing the 4374 entire AVP that could not be processed successfully. If the failure 4375 reason is omission of a required AVP, an AVP with the missing AVP 4376 code, the missing vendor id, and a zero filled payload of the minimum 4377 required length for the omitted AVP will be added. If the failure 4378 reason is an invalid AVP length where the reported length is less 4379 than the minimum AVP header length or greater than the reported 4380 message length, a copy of the offending AVP header and a zero filled 4381 payload of the minimum required length SHOULD be added. 4383 AVP Format 4385 ::= < AVP Header: 279 > 4386 1* {AVP} 4388 7.6. Experimental-Result AVP 4390 The Experimental-Result AVP (AVP Code 297) is of type Grouped, and 4391 indicates whether a particular vendor-specific request was completed 4392 successfully or whether an error occurred. Its Data field has the 4393 following ABNF grammar: 4395 AVP Format 4397 Experimental-Result ::= < AVP Header: 297 > 4398 { Vendor-Id } 4399 { Experimental-Result-Code } 4401 The Vendor-Id AVP (see Section 5.3.3) in this grouped AVP identifies 4402 the vendor responsible for the assignment of the result code which 4403 follows. All Diameter answer messages defined in vendor-specific 4404 applications MUST include either one Result-Code AVP or one 4405 Experimental-Result AVP. 4407 7.7. Experimental-Result-Code AVP 4409 The Experimental-Result-Code AVP (AVP Code 298) is of type Unsigned32 4410 and contains a vendor-assigned value representing the result of 4411 processing the request. 4413 It is recommended that vendor-specific result codes follow the same 4414 conventions given for the Result-Code AVP regarding the different 4415 types of result codes and the handling of errors (for non 2xxx 4416 values). 4418 8. Diameter User Sessions 4420 Diameter can provide two different types of services to applications. 4421 The first involves authentication and authorization, and can 4422 optionally make use of accounting. The second only makes use of 4423 accounting. 4425 When a service makes use of the authentication and/or authorization 4426 portion of an application, and a user requests access to the network, 4427 the Diameter client issues an auth request to its local server. The 4428 auth request is defined in a service specific Diameter application 4429 (e.g., NASREQ). The request contains a Session-Id AVP, which is used 4430 in subsequent messages (e.g., subsequent authorization, accounting, 4431 etc) relating to the user's session. The Session-Id AVP is a means 4432 for the client and servers to correlate a Diameter message with a 4433 user session. 4435 When a Diameter server authorizes a user to use network resources for 4436 a finite amount of time, and it is willing to extend the 4437 authorization via a future request, it MUST add the Authorization- 4438 Lifetime AVP to the answer message. The Authorization-Lifetime AVP 4439 defines the maximum number of seconds a user MAY make use of the 4440 resources before another authorization request is expected by the 4441 server. The Auth-Grace-Period AVP contains the number of seconds 4442 following the expiration of the Authorization-Lifetime, after which 4443 the server will release all state information related to the user's 4444 session. Note that if payment for services is expected by the 4445 serving realm from the user's home realm, the Authorization-Lifetime 4446 AVP, combined with the Auth-Grace-Period AVP, implies the maximum 4447 length of the session the home realm is willing to be fiscally 4448 responsible for. Services provided past the expiration of the 4449 Authorization-Lifetime and Auth-Grace-Period AVPs are the 4450 responsibility of the access device. Of course, the actual cost of 4451 services rendered is clearly outside the scope of the protocol. 4453 An access device that does not expect to send a re-authorization or a 4454 session termination request to the server MAY include the Auth- 4455 Session-State AVP with the value set to NO_STATE_MAINTAINED as a hint 4456 to the server. If the server accepts the hint, it agrees that since 4457 no session termination message will be received once service to the 4458 user is terminated, it cannot maintain state for the session. If the 4459 answer message from the server contains a different value in the 4460 Auth-Session-State AVP (or the default value if the AVP is absent), 4461 the access device MUST follow the server's directives. Note that the 4462 value NO_STATE_MAINTAINED MUST NOT be set in subsequent re- 4463 authorization requests and answers. 4465 The base protocol does not include any authorization request 4466 messages, since these are largely application-specific and are 4467 defined in a Diameter application document. However, the base 4468 protocol does define a set of messages that is used to terminate user 4469 sessions. These are used to allow servers that maintain state 4470 information to free resources. 4472 When a service only makes use of the Accounting portion of the 4473 Diameter protocol, even in combination with an application, the 4474 Session-Id is still used to identify user sessions. However, the 4475 session termination messages are not used, since a session is 4476 signaled as being terminated by issuing an accounting stop message. 4478 8.1. Authorization Session State Machine 4480 This section contains a set of finite state machines, representing 4481 the life cycle of Diameter sessions, and which MUST be observed by 4482 all Diameter implementations that make use of the authentication 4483 and/or authorization portion of a Diameter application. The term 4484 Service-Specific below refers to a message defined in a Diameter 4485 application (e.g., Mobile IPv4, NASREQ). 4487 There are four different authorization session state machines 4488 supported in the Diameter base protocol. The first two describe a 4489 session in which the server is maintaining session state, indicated 4490 by the value of the Auth-Session-State AVP (or its absence). One 4491 describes the session from a client perspective, the other from a 4492 server perspective. The second two state machines are used when the 4493 server does not maintain session state. Here again, one describes 4494 the session from a client perspective, the other from a server 4495 perspective. 4497 When a session is moved to the Idle state, any resources that were 4498 allocated for the particular session must be released. Any event not 4499 listed in the state machines MUST be considered as an error 4500 condition, and an answer, if applicable, MUST be returned to the 4501 originator of the message. 4503 In the state table, the event 'Failure to send X' means that the 4504 Diameter agent is unable to send command X to the desired 4505 destination. This could be due to the peer being down, or due to the 4506 peer sending back a transient failure or temporary protocol error 4507 notification DIAMETER_TOO_BUSY or DIAMETER_LOOP_DETECTED in the 4508 Result-Code AVP of the corresponding Answer command. The event 'X 4509 successfully sent' is the complement of 'Failure to send X'. 4511 The following state machine is observed by a client when state is 4512 maintained on the server: 4514 CLIENT, STATEFUL 4515 State Event Action New State 4516 ------------------------------------------------------------- 4517 Idle Client or Device Requests Send Pending 4518 access service 4519 specific 4520 auth req 4522 Idle ASR Received Send ASA Idle 4523 for unknown session with 4524 Result-Code 4525 = UNKNOWN_ 4526 SESSION_ID 4528 Pending Successful Service-specific Grant Open 4529 authorization answer Access 4530 received with default 4531 Auth-Session-State value 4533 Pending Successful Service-specific Sent STR Discon 4534 authorization answer received 4535 but service not provided 4537 Pending Error processing successful Sent STR Discon 4538 Service-specific authorization 4539 answer 4541 Pending Failed Service-specific Cleanup Idle 4542 authorization answer received 4544 Open User or client device Send Open 4545 requests access to service service 4546 specific 4547 auth req 4549 Open Successful Service-specific Provide Open 4550 authorization answer received Service 4552 Open Failed Service-specific Discon. Idle 4553 authorization answer user/device 4554 received. 4556 Open Session-Timeout Expires on Send STR Discon 4557 Access Device 4559 Open ASR Received, Send ASA Discon 4560 client will comply with with 4561 request to end the session Result-Code 4562 = SUCCESS, 4563 Send STR. 4565 Open ASR Received, Send ASA Open 4566 client will not comply with with 4567 request to end the session Result-Code 4568 != SUCCESS 4570 Open Authorization-Lifetime + Send STR Discon 4571 Auth-Grace-Period expires on 4572 access device 4574 Discon ASR Received Send ASA Discon 4576 Discon STA Received Discon. Idle 4577 user/device 4579 The following state machine is observed by a server when it is 4580 maintaining state for the session: 4582 SERVER, STATEFUL 4583 State Event Action New State 4584 ------------------------------------------------------------- 4585 Idle Service-specific authorization Send Open 4586 request received, and successful 4587 user is authorized serv. 4588 specific answer 4590 Idle Service-specific authorization Send Idle 4591 request received, and failed serv. 4592 user is not authorized specific answer 4594 Open Service-specific authorization Send Open 4595 request received, and user successful 4596 is authorized serv. specific 4597 answer 4599 Open Service-specific authorization Send Idle 4600 request received, and user failed serv. 4601 is not authorized specific 4602 answer, 4603 Cleanup 4605 Open Home server wants to Send ASR Discon 4606 terminate the service 4608 Open Authorization-Lifetime (and Cleanup Idle 4609 Auth-Grace-Period) expires 4610 on home server. 4612 Open Session-Timeout expires on Cleanup Idle 4613 home server 4615 Discon Failure to send ASR Wait, Discon 4616 resend ASR 4618 Discon ASR successfully sent and Cleanup Idle 4619 ASA Received with Result-Code 4621 Not ASA Received None No Change. 4622 Discon 4624 Any STR Received Send STA, Idle 4625 Cleanup. 4627 The following state machine is observed by a client when state is not 4628 maintained on the server: 4630 CLIENT, STATELESS 4631 State Event Action New State 4632 ------------------------------------------------------------- 4633 Idle Client or Device Requests Send Pending 4634 access service 4635 specific 4636 auth req 4638 Pending Successful Service-specific Grant Open 4639 authorization answer Access 4640 received with Auth-Session- 4641 State set to 4642 NO_STATE_MAINTAINED 4644 Pending Failed Service-specific Cleanup Idle 4645 authorization answer 4646 received 4648 Open Session-Timeout Expires on Discon. Idle 4649 Access Device user/device 4651 Open Service to user is terminated Discon. Idle 4652 user/device 4654 The following state machine is observed by a server when it is not 4655 maintaining state for the session: 4657 SERVER, STATELESS 4658 State Event Action New State 4659 ------------------------------------------------------------- 4660 Idle Service-specific authorization Send serv. Idle 4661 request received, and specific 4662 successfully processed answer 4664 8.2. Accounting Session State Machine 4666 The following state machines MUST be supported for applications that 4667 have an accounting portion or that require only accounting services. 4668 The first state machine is to be observed by clients. 4670 See Section 9.7 for Accounting Command Codes and Section 9.8 for 4671 Accounting AVPs. 4673 The server side in the accounting state machine depends in some cases 4674 on the particular application. The Diameter base protocol defines a 4675 default state machine that MUST be followed by all applications that 4676 have not specified other state machines. This is the second state 4677 machine in this section described below. 4679 The default server side state machine requires the reception of 4680 accounting records in any order and at any time, and does not place 4681 any standards requirement on the processing of these records. 4682 Implementations of Diameter MAY perform checking, ordering, 4683 correlation, fraud detection, and other tasks based on these records. 4684 Both base Diameter AVPs as well as application specific AVPs MAY be 4685 inspected as a part of these tasks. The tasks can happen either 4686 immediately after record reception or in a post-processing phase. 4687 However, as these tasks are typically application or even policy 4688 dependent, they are not standardized by the Diameter specifications. 4689 Applications MAY define requirements on when to accept accounting 4690 records based on the used value of Accounting-Realtime-Required AVP, 4691 credit limits checks, and so on. 4693 However, the Diameter base protocol defines one optional server side 4694 state machine that MAY be followed by applications that require 4695 keeping track of the session state at the accounting server. Note 4696 that such tracking is incompatible with the ability to sustain long 4697 duration connectivity problems. Therefore, the use of this state 4698 machine is recommended only in applications where the value of the 4699 Accounting-Realtime-Required AVP is DELIVER_AND_GRANT, and hence 4700 accounting connectivity problems are required to cause the serviced 4701 user to be disconnected. Otherwise, records produced by the client 4702 may be lost by the server which no longer accepts them after the 4703 connectivity is re-established. This state machine is the third 4704 state machine in this section. The state machine is supervised by a 4705 supervision session timer Ts, which the value should be reasonably 4706 higher than the Acct_Interim_Interval value. Ts MAY be set to two 4707 times the value of the Acct_Interim_Interval so as to avoid the 4708 accounting session in the Diameter server to change to Idle state in 4709 case of short transient network failure. 4711 Any event not listed in the state machines MUST be considered as an 4712 error condition, and a corresponding answer, if applicable, MUST be 4713 returned to the originator of the message. 4715 In the state table, the event 'Failure to send' means that the 4716 Diameter client is unable to communicate with the desired 4717 destination. This could be due to the peer being down, or due to the 4718 peer sending back a transient failure or temporary protocol error 4719 notification DIAMETER_OUT_OF_SPACE, DIAMETER_TOO_BUSY, or 4720 DIAMETER_LOOP_DETECTED in the Result-Code AVP of the Accounting 4721 Answer command. 4723 The event 'Failed answer' means that the Diameter client received a 4724 non-transient failure notification in the Accounting Answer command. 4726 Note that the action 'Disconnect user/dev' MUST have an effect also 4727 to the authorization session state table, e.g., cause the STR message 4728 to be sent, if the given application has both authentication/ 4729 authorization and accounting portions. 4731 The states PendingS, PendingI, PendingL, PendingE and PendingB stand 4732 for pending states to wait for an answer to an accounting request 4733 related to a Start, Interim, Stop, Event or buffered record, 4734 respectively. 4736 CLIENT, ACCOUNTING 4737 State Event Action New State 4738 ------------------------------------------------------------- 4739 Idle Client or device requests Send PendingS 4740 access accounting 4741 start req. 4743 Idle Client or device requests Send PendingE 4744 a one-time service accounting 4745 event req 4747 Idle Records in storage Send PendingB 4748 record 4750 PendingS Successful accounting Open 4751 start answer received 4753 PendingS Failure to send and buffer Store Open 4754 space available and realtime Start 4755 not equal to DELIVER_AND_GRANT Record 4757 PendingS Failure to send and no buffer Open 4758 space available and realtime 4759 equal to GRANT_AND_LOSE 4761 PendingS Failure to send and no buffer Disconnect Idle 4762 space available and realtime user/dev 4763 not equal to 4764 GRANT_AND_LOSE 4766 PendingS Failed accounting start answer Open 4767 received and realtime equal 4768 to GRANT_AND_LOSE 4770 PendingS Failed accounting start answer Disconnect Idle 4771 received and realtime not user/dev 4772 equal to GRANT_AND_LOSE 4774 PendingS User service terminated Store PendingS 4775 stop 4776 record 4778 Open Interim interval elapses Send PendingI 4779 accounting 4780 interim 4781 record 4782 Open User service terminated Send PendingL 4783 accounting 4784 stop req. 4786 PendingI Successful accounting interim Open 4787 answer received 4789 PendingI Failure to send and (buffer Store Open 4790 space available or old record interim 4791 can be overwritten) and record 4792 realtime not equal to 4793 DELIVER_AND_GRANT 4795 PendingI Failure to send and no buffer Open 4796 space available and realtime 4797 equal to GRANT_AND_LOSE 4799 PendingI Failure to send and no buffer Disconnect Idle 4800 space available and realtime user/dev 4801 not equal to GRANT_AND_LOSE 4803 PendingI Failed accounting interim Open 4804 answer received and realtime 4805 equal to GRANT_AND_LOSE 4807 PendingI Failed accounting interim Disconnect Idle 4808 answer received and realtime user/dev 4809 not equal to GRANT_AND_LOSE 4811 PendingI User service terminated Store PendingI 4812 stop 4813 record 4815 PendingE Successful accounting Idle 4816 event answer received 4818 PendingE Failure to send and buffer Store Idle 4819 space available event 4820 record 4822 PendingE Failure to send and no buffer Idle 4823 space available 4825 PendingE Failed accounting event answer Idle 4826 received 4828 PendingB Successful accounting answer Delete Idle 4829 received record 4831 PendingB Failure to send Idle 4833 PendingB Failed accounting answer Delete Idle 4834 received record 4836 PendingL Successful accounting Idle 4837 stop answer received 4839 PendingL Failure to send and buffer Store Idle 4840 space available stop 4841 record 4843 PendingL Failure to send and no buffer Idle 4844 space available 4846 PendingL Failed accounting stop answer Idle 4847 received 4849 SERVER, STATELESS ACCOUNTING 4850 State Event Action New State 4851 ------------------------------------------------------------- 4853 Idle Accounting start request Send Idle 4854 received, and successfully accounting 4855 processed. start 4856 answer 4858 Idle Accounting event request Send Idle 4859 received, and successfully accounting 4860 processed. event 4861 answer 4863 Idle Interim record received, Send Idle 4864 and successfully processed. accounting 4865 interim 4866 answer 4868 Idle Accounting stop request Send Idle 4869 received, and successfully accounting 4870 processed stop answer 4872 Idle Accounting request received, Send Idle 4873 no space left to store accounting 4874 records answer, 4875 Result-Code 4876 = OUT_OF_ 4877 SPACE 4879 SERVER, STATEFUL ACCOUNTING 4880 State Event Action New State 4881 ------------------------------------------------------------- 4883 Idle Accounting start request Send Open 4884 received, and successfully accounting 4885 processed. start 4886 answer, 4887 Start Ts 4889 Idle Accounting event request Send Idle 4890 received, and successfully accounting 4891 processed. event 4892 answer 4894 Idle Accounting request received, Send Idle 4895 no space left to store accounting 4896 records answer, 4897 Result-Code 4898 = OUT_OF_ 4899 SPACE 4901 Open Interim record received, Send Open 4902 and successfully processed. accounting 4903 interim 4904 answer, 4905 Restart Ts 4907 Open Accounting stop request Send Idle 4908 received, and successfully accounting 4909 processed stop answer, 4910 Stop Ts 4912 Open Accounting request received, Send Idle 4913 no space left to store accounting 4914 records answer, 4915 Result-Code 4916 = OUT_OF_ 4917 SPACE, 4918 Stop Ts 4920 Open Session supervision timer Ts Stop Ts Idle 4921 expired 4923 8.3. Server-Initiated Re-Auth 4925 A Diameter server may initiate a re-authentication and/or re- 4926 authorization service for a particular session by issuing a Re-Auth- 4927 Request (RAR). 4929 For example, for pre-paid services, the Diameter server that 4930 originally authorized a session may need some confirmation that the 4931 user is still using the services. 4933 An access device that receives a RAR message with Session-Id equal to 4934 a currently active session MUST initiate a re-auth towards the user, 4935 if the service supports this particular feature. Each Diameter 4936 application MUST state whether service-initiated re-auth is 4937 supported, since some applications do not allow access devices to 4938 prompt the user for re-auth. 4940 8.3.1. Re-Auth-Request 4942 The Re-Auth-Request (RAR), indicated by the Command-Code set to 258 4943 and the message flags' 'R' bit set, may be sent by any server to the 4944 access device that is providing session service, to request that the 4945 user be re-authenticated and/or re-authorized. 4947 Message Format 4949 ::= < Diameter Header: 258, REQ, PXY > 4950 < Session-Id > 4951 { Origin-Host } 4952 { Origin-Realm } 4953 { Destination-Realm } 4954 { Destination-Host } 4955 { Auth-Application-Id } 4956 { Re-Auth-Request-Type } 4957 [ User-Name ] 4958 [ Origin-State-Id ] 4959 * [ Proxy-Info ] 4960 * [ Route-Record ] 4961 * [ AVP ] 4963 8.3.2. Re-Auth-Answer 4965 The Re-Auth-Answer (RAA), indicated by the Command-Code set to 258 4966 and the message flags' 'R' bit clear, is sent in response to the RAR. 4967 The Result-Code AVP MUST be present, and indicates the disposition of 4968 the request. 4970 A successful RAA message MUST be followed by an application-specific 4971 authentication and/or authorization message. 4973 Message Format 4975 ::= < Diameter Header: 258, PXY > 4976 < Session-Id > 4977 { Result-Code } 4978 { Origin-Host } 4979 { Origin-Realm } 4980 [ User-Name ] 4981 [ Origin-State-Id ] 4982 [ Error-Message ] 4983 [ Error-Reporting-Host ] 4984 * [ Failed-AVP ] 4985 * [ Redirect-Host ] 4986 [ Redirect-Host-Usage ] 4987 [ Redirect-Host-Cache-Time ] 4988 * [ Proxy-Info ] 4989 * [ AVP ] 4991 8.4. Session Termination 4993 It is necessary for a Diameter server that authorized a session, for 4994 which it is maintaining state, to be notified when that session is no 4995 longer active, both for tracking purposes as well as to allow 4996 stateful agents to release any resources that they may have provided 4997 for the user's session. For sessions whose state is not being 4998 maintained, this section is not used. 5000 When a user session that required Diameter authorization terminates, 5001 the access device that provided the service MUST issue a Session- 5002 Termination-Request (STR) message to the Diameter server that 5003 authorized the service, to notify it that the session is no longer 5004 active. An STR MUST be issued when a user session terminates for any 5005 reason, including user logoff, expiration of Session-Timeout, 5006 administrative action, termination upon receipt of an Abort-Session- 5007 Request (see below), orderly shutdown of the access device, etc. 5009 The access device also MUST issue an STR for a session that was 5010 authorized but never actually started. This could occur, for 5011 example, due to a sudden resource shortage in the access device, or 5012 because the access device is unwilling to provide the type of service 5013 requested in the authorization, or because the access device does not 5014 support a mandatory AVP returned in the authorization, etc. 5016 It is also possible that a session that was authorized is never 5017 actually started due to action of a proxy. For example, a proxy may 5018 modify an authorization answer, converting the result from success to 5019 failure, prior to forwarding the message to the access device. If 5020 the answer did not contain an Auth-Session-State AVP with the value 5021 NO_STATE_MAINTAINED, a proxy that causes an authorized session not to 5022 be started MUST issue an STR to the Diameter server that authorized 5023 the session, since the access device has no way of knowing that the 5024 session had been authorized. 5026 A Diameter server that receives an STR message MUST clean up 5027 resources (e.g., session state) associated with the Session-Id 5028 specified in the STR, and return a Session-Termination-Answer. 5030 A Diameter server also MUST clean up resources when the Session- 5031 Timeout expires, or when the Authorization-Lifetime and the Auth- 5032 Grace-Period AVPs expires without receipt of a re-authorization 5033 request, regardless of whether an STR for that session is received. 5034 The access device is not expected to provide service beyond the 5035 expiration of these timers; thus, expiration of either of these 5036 timers implies that the access device may have unexpectedly shut 5037 down. 5039 8.4.1. Session-Termination-Request 5041 The Session-Termination-Request (STR), indicated by the Command-Code 5042 set to 275 and the Command Flags' 'R' bit set, is sent by the access 5043 device to inform the Diameter Server that an authenticated and/or 5044 authorized session is being terminated. 5046 Message Format 5048 ::= < Diameter Header: 275, REQ, PXY > 5049 < Session-Id > 5050 { Origin-Host } 5051 { Origin-Realm } 5052 { Destination-Realm } 5053 { Auth-Application-Id } 5054 { Termination-Cause } 5055 [ User-Name ] 5056 [ Destination-Host ] 5057 * [ Class ] 5058 [ Origin-State-Id ] 5059 * [ Proxy-Info ] 5060 * [ Route-Record ] 5061 * [ AVP ] 5063 8.4.2. Session-Termination-Answer 5065 The Session-Termination-Answer (STA), indicated by the Command-Code 5066 set to 275 and the message flags' 'R' bit clear, is sent by the 5067 Diameter Server to acknowledge the notification that the session has 5068 been terminated. The Result-Code AVP MUST be present, and MAY 5069 contain an indication that an error occurred while servicing the STR. 5071 Upon sending or receipt of the STA, the Diameter Server MUST release 5072 all resources for the session indicated by the Session-Id AVP. Any 5073 intermediate server in the Proxy-Chain MAY also release any 5074 resources, if necessary. 5076 Message Format 5078 ::= < Diameter Header: 275, PXY > 5079 < Session-Id > 5080 { Result-Code } 5081 { Origin-Host } 5082 { Origin-Realm } 5083 [ User-Name ] 5084 * [ Class ] 5085 [ Error-Message ] 5086 [ Error-Reporting-Host ] 5087 * [ Failed-AVP ] 5088 [ Origin-State-Id ] 5089 * [ Redirect-Host ] 5090 [ Redirect-Host-Usage ] 5091 ^ 5092 [ Redirect-Max-Cache-Time ] 5093 * [ Proxy-Info ] 5094 * [ AVP ] 5096 8.5. Aborting a Session 5098 A Diameter server may request that the access device stop providing 5099 service for a particular session by issuing an Abort-Session-Request 5100 (ASR). 5102 For example, the Diameter server that originally authorized the 5103 session may be required to cause that session to be stopped for 5104 credit or other reasons that were not anticipated when the session 5105 was first authorized. On the other hand, an operator may maintain a 5106 management server for the purpose of issuing ASRs to administratively 5107 remove users from the network. 5109 An access device that receives an ASR with Session-ID equal to a 5110 currently active session MAY stop the session. Whether the access 5111 device stops the session or not is implementation- and/or 5112 configuration-dependent. For example, an access device may honor 5113 ASRs from certain agents only. In any case, the access device MUST 5114 respond with an Abort-Session-Answer, including a Result-Code AVP to 5115 indicate what action it took. 5117 Note that if the access device does stop the session upon receipt of 5118 an ASR, it issues an STR to the authorizing server (which may or may 5119 not be the agent issuing the ASR) just as it would if the session 5120 were terminated for any other reason. 5122 8.5.1. Abort-Session-Request 5124 The Abort-Session-Request (ASR), indicated by the Command-Code set to 5125 274 and the message flags' 'R' bit set, may be sent by any server to 5126 the access device that is providing session service, to request that 5127 the session identified by the Session-Id be stopped. 5129 Message Format 5131 ::= < Diameter Header: 274, REQ, PXY > 5132 < Session-Id > 5133 { Origin-Host } 5134 { Origin-Realm } 5135 { Destination-Realm } 5136 { Destination-Host } 5137 { Auth-Application-Id } 5138 [ User-Name ] 5139 [ Origin-State-Id ] 5140 * [ Proxy-Info ] 5141 * [ Route-Record ] 5142 * [ AVP ] 5144 8.5.2. Abort-Session-Answer 5146 The Abort-Session-Answer (ASA), indicated by the Command-Code set to 5147 274 and the message flags' 'R' bit clear, is sent in response to the 5148 ASR. The Result-Code AVP MUST be present, and indicates the 5149 disposition of the request. 5151 If the session identified by Session-Id in the ASR was successfully 5152 terminated, Result-Code is set to DIAMETER_SUCCESS. If the session 5153 is not currently active, Result-Code is set to 5154 DIAMETER_UNKNOWN_SESSION_ID. If the access device does not stop the 5155 session for any other reason, Result-Code is set to 5156 DIAMETER_UNABLE_TO_COMPLY. 5158 Message Format 5160 ::= < Diameter Header: 274, PXY > 5161 < Session-Id > 5162 { Result-Code } 5163 { Origin-Host } 5164 { Origin-Realm } 5165 [ User-Name ] 5166 [ Origin-State-Id ] 5167 [ Error-Message ] 5168 [ Error-Reporting-Host ] 5169 * [ Failed-AVP ] 5170 * [ Redirect-Host ] 5171 [ Redirect-Host-Usage ] 5172 [ Redirect-Max-Cache-Time ] 5173 * [ Proxy-Info ] 5174 * [ AVP ] 5176 8.6. Inferring Session Termination from Origin-State-Id 5178 Origin-State-Id is used to allow rapid detection of terminated 5179 sessions for which no STR would have been issued, due to 5180 unanticipated shutdown of an access device. 5182 By including Origin-State-Id in CER/CEA messages, an access device 5183 allows a next-hop server to determine immediately upon connection 5184 whether the device has lost its sessions since the last connection. 5186 By including Origin-State-Id in request messages, an access device 5187 also allows a server with which it communicates via proxy to make 5188 such a determination. However, a server that is not directly 5189 connected with the access device will not discover that the access 5190 device has been restarted unless and until it receives a new request 5191 from the access device. Thus, use of this mechanism across proxies 5192 is opportunistic rather than reliable, but useful nonetheless. 5194 When a Diameter server receives an Origin-State-Id that is greater 5195 than the Origin-State-Id previously received from the same issuer, it 5196 may assume that the issuer has lost state since the previous message 5197 and that all sessions that were active under the lower Origin-State- 5198 Id have been terminated. The Diameter server MAY clean up all 5199 session state associated with such lost sessions, and MAY also issues 5200 STRs for all such lost sessions that were authorized on upstream 5201 servers, to allow session state to be cleaned up globally. 5203 8.7. Auth-Request-Type AVP 5205 The Auth-Request-Type AVP (AVP Code 274) is of type Enumerated and is 5206 included in application-specific auth requests to inform the peers 5207 whether a user is to be authenticated only, authorized only or both. 5208 Note any value other than both MAY cause RADIUS interoperability 5209 issues. The following values are defined: 5211 AUTHENTICATE_ONLY 1 5213 The request being sent is for authentication only, and MUST 5214 contain the relevant application specific authentication AVPs that 5215 are needed by the Diameter server to authenticate the user. 5217 AUTHORIZE_ONLY 2 5219 The request being sent is for authorization only, and MUST contain 5220 the application specific authorization AVPs that are necessary to 5221 identify the service being requested/offered. 5223 AUTHORIZE_AUTHENTICATE 3 5225 The request contains a request for both authentication and 5226 authorization. The request MUST include both the relevant 5227 application specific authentication information, and authorization 5228 information necessary to identify the service being requested/ 5229 offered. 5231 8.8. Session-Id AVP 5233 The Session-Id AVP (AVP Code 263) is of type UTF8String and is used 5234 to identify a specific session (see Section 8). All messages 5235 pertaining to a specific session MUST include only one Session-Id AVP 5236 and the same value MUST be used throughout the life of a session. 5237 When present, the Session-Id SHOULD appear immediately following the 5238 Diameter Header (see Section 3). 5240 The Session-Id MUST be globally and eternally unique, as it is meant 5241 to uniquely identify a user session without reference to any other 5242 information, and may be needed to correlate historical authentication 5243 information with accounting information. The Session-Id includes a 5244 mandatory portion and an implementation-defined portion; a 5245 recommended format for the implementation-defined portion is outlined 5246 below. 5248 The Session-Id MUST begin with the sender's identity encoded in the 5249 DiameterIdentity type (see Section 4.4). The remainder of the 5250 Session-Id is delimited by a ";" character, and MAY be any sequence 5251 that the client can guarantee to be eternally unique; however, the 5252 following format is recommended, (square brackets [] indicate an 5253 optional element): 5255 ;;[;] 5257 and are decimal representations of the 5258 high and low 32 bits of a monotonically increasing 64-bit value. The 5259 64-bit value is rendered in two part to simplify formatting by 32-bit 5260 processors. At startup, the high 32 bits of the 64-bit value MAY be 5261 initialized to the time, and the low 32 bits MAY be initialized to 5262 zero. This will for practical purposes eliminate the possibility of 5263 overlapping Session-Ids after a reboot, assuming the reboot process 5264 takes longer than a second. Alternatively, an implementation MAY 5265 keep track of the increasing value in non-volatile memory. 5267 is implementation specific but may include a modem's 5268 device Id, a layer 2 address, timestamp, etc. 5270 Example, in which there is no optional value: 5271 accesspoint7.acme.com;1876543210;523 5273 Example, in which there is an optional value: 5274 accesspoint7.acme.com;1876543210;523;mobile@200.1.1.88 5276 The Session-Id is created by the Diameter application initiating the 5277 session, which in most cases is done by the client. Note that a 5278 Session-Id MAY be used for both the authorization and accounting 5279 commands of a given application. 5281 8.9. Authorization-Lifetime AVP 5283 The Authorization-Lifetime AVP (AVP Code 291) is of type Unsigned32 5284 and contains the maximum number of seconds of service to be provided 5285 to the user before the user is to be re-authenticated and/or re- 5286 authorized. Great care should be taken when the Authorization- 5287 Lifetime value is determined, since a low, non-zero, value could 5288 create significant Diameter traffic, which could congest both the 5289 network and the agents. 5291 A value of zero (0) means that immediate re-auth is necessary by the 5292 access device. This is typically used in cases where multiple 5293 authentication methods are used, and a successful auth response with 5294 this AVP set to zero is used to signal that the next authentication 5295 method is to be immediately initiated. The absence of this AVP, or a 5296 value of all ones (meaning all bits in the 32 bit field are set to 5297 one) means no re-auth is expected. 5299 If both this AVP and the Session-Timeout AVP are present in a 5300 message, the value of the latter MUST NOT be smaller than the 5301 Authorization-Lifetime AVP. 5303 An Authorization-Lifetime AVP MAY be present in re-authorization 5304 messages, and contains the number of seconds the user is authorized 5305 to receive service from the time the re-auth answer message is 5306 received by the access device. 5308 This AVP MAY be provided by the client as a hint of the maximum 5309 lifetime that it is willing to accept. However, the server MAY 5310 return a value that is equal to, or smaller, than the one provided by 5311 the client. 5313 8.10. Auth-Grace-Period AVP 5315 The Auth-Grace-Period AVP (AVP Code 276) is of type Unsigned32 and 5316 contains the number of seconds the Diameter server will wait 5317 following the expiration of the Authorization-Lifetime AVP before 5318 cleaning up resources for the session. 5320 8.11. Auth-Session-State AVP 5322 The Auth-Session-State AVP (AVP Code 277) is of type Enumerated and 5323 specifies whether state is maintained for a particular session. The 5324 client MAY include this AVP in requests as a hint to the server, but 5325 the value in the server's answer message is binding. The following 5326 values are supported: 5328 STATE_MAINTAINED 0 5330 This value is used to specify that session state is being 5331 maintained, and the access device MUST issue a session termination 5332 message when service to the user is terminated. This is the 5333 default value. 5335 NO_STATE_MAINTAINED 1 5337 This value is used to specify that no session termination messages 5338 will be sent by the access device upon expiration of the 5339 Authorization-Lifetime. 5341 8.12. Re-Auth-Request-Type AVP 5343 The Re-Auth-Request-Type AVP (AVP Code 285) is of type Enumerated and 5344 is included in application-specific auth answers to inform the client 5345 of the action expected upon expiration of the Authorization-Lifetime. 5346 If the answer message contains an Authorization-Lifetime AVP with a 5347 positive value, the Re-Auth-Request-Type AVP MUST be present in an 5348 answer message. The following values are defined: 5350 AUTHORIZE_ONLY 0 5352 An authorization only re-auth is expected upon expiration of the 5353 Authorization-Lifetime. This is the default value if the AVP is 5354 not present in answer messages that include the Authorization- 5355 Lifetime. 5357 AUTHORIZE_AUTHENTICATE 1 5359 An authentication and authorization re-auth is expected upon 5360 expiration of the Authorization-Lifetime. 5362 8.13. Session-Timeout AVP 5364 The Session-Timeout AVP (AVP Code 27) [RFC2865] is of type Unsigned32 5365 and contains the maximum number of seconds of service to be provided 5366 to the user before termination of the session. When both the 5367 Session-Timeout and the Authorization-Lifetime AVPs are present in an 5368 answer message, the former MUST be equal to or greater than the value 5369 of the latter. 5371 A session that terminates on an access device due to the expiration 5372 of the Session-Timeout MUST cause an STR to be issued, unless both 5373 the access device and the home server had previously agreed that no 5374 session termination messages would be sent (see Section 8.9). 5376 A Session-Timeout AVP MAY be present in a re-authorization answer 5377 message, and contains the remaining number of seconds from the 5378 beginning of the re-auth. 5380 A value of zero, or the absence of this AVP, means that this session 5381 has an unlimited number of seconds before termination. 5383 This AVP MAY be provided by the client as a hint of the maximum 5384 timeout that it is willing to accept. However, the server MAY return 5385 a value that is equal to, or smaller, than the one provided by the 5386 client. 5388 8.14. User-Name AVP 5390 The User-Name AVP (AVP Code 1) [RFC2865] is of type UTF8String, which 5391 contains the User-Name, in a format consistent with the NAI 5392 specification [RFC4282]. 5394 8.15. Termination-Cause AVP 5396 The Termination-Cause AVP (AVP Code 295) is of type Enumerated, and 5397 is used to indicate the reason why a session was terminated on the 5398 access device. The following values are defined: 5400 DIAMETER_LOGOUT 1 5402 The user initiated a disconnect 5404 DIAMETER_SERVICE_NOT_PROVIDED 2 5406 This value is used when the user disconnected prior to the receipt 5407 of the authorization answer message. 5409 DIAMETER_BAD_ANSWER 3 5411 This value indicates that the authorization answer received by the 5412 access device was not processed successfully. 5414 DIAMETER_ADMINISTRATIVE 4 5416 The user was not granted access, or was disconnected, due to 5417 administrative reasons, such as the receipt of a Abort-Session- 5418 Request message. 5420 DIAMETER_LINK_BROKEN 5 5422 The communication to the user was abruptly disconnected. 5424 DIAMETER_AUTH_EXPIRED 6 5426 The user's access was terminated since its authorized session time 5427 has expired. 5429 DIAMETER_USER_MOVED 7 5431 The user is receiving services from another access device. 5433 DIAMETER_SESSION_TIMEOUT 8 5435 The user's session has timed out, and service has been terminated. 5437 8.16. Origin-State-Id AVP 5439 The Origin-State-Id AVP (AVP Code 278), of type Unsigned32, is a 5440 monotonically increasing value that is advanced whenever a Diameter 5441 entity restarts with loss of previous state, for example upon reboot. 5442 Origin-State-Id MAY be included in any Diameter message, including 5443 CER. 5445 A Diameter entity issuing this AVP MUST create a higher value for 5446 this AVP each time its state is reset. A Diameter entity MAY set 5447 Origin-State-Id to the time of startup, or it MAY use an incrementing 5448 counter retained in non-volatile memory across restarts. 5450 The Origin-State-Id, if present, MUST reflect the state of the entity 5451 indicated by Origin-Host. If a proxy modifies Origin-Host, it MUST 5452 either remove Origin-State-Id or modify it appropriately as well. 5453 Typically, Origin-State-Id is used by an access device that always 5454 starts up with no active sessions; that is, any session active prior 5455 to restart will have been lost. By including Origin-State-Id in a 5456 message, it allows other Diameter entities to infer that sessions 5457 associated with a lower Origin-State-Id are no longer active. If an 5458 access device does not intend for such inferences to be made, it MUST 5459 either not include Origin-State-Id in any message, or set its value 5460 to 0. 5462 8.17. Session-Binding AVP 5464 The Session-Binding AVP (AVP Code 270) is of type Unsigned32, and MAY 5465 be present in application-specific authorization answer messages. If 5466 present, this AVP MAY inform the Diameter client that all future 5467 application-specific re-auth messages for this session MUST be sent 5468 to the same authorization server. This AVP MAY also specify that a 5469 Session-Termination-Request message for this session MUST be sent to 5470 the same authorizing server. 5472 This field is a bit mask, and the following bits have been defined: 5474 RE_AUTH 1 5476 When set, future re-auth messages for this session MUST NOT 5477 include the Destination-Host AVP. When cleared, the default 5478 value, the Destination-Host AVP MUST be present in all re-auth 5479 messages for this session. 5481 STR 2 5483 When set, the STR message for this session MUST NOT include the 5484 Destination-Host AVP. When cleared, the default value, the 5485 Destination-Host AVP MUST be present in the STR message for this 5486 session. 5488 ACCOUNTING 4 5490 When set, all accounting messages for this session MUST NOT 5491 include the Destination-Host AVP. When cleared, the default 5492 value, the Destination-Host AVP, if known, MUST be present in all 5493 accounting messages for this session. 5495 8.18. Session-Server-Failover AVP 5497 The Session-Server-Failover AVP (AVP Code 271) is of type Enumerated, 5498 and MAY be present in application-specific authorization answer 5499 messages that either do not include the Session-Binding AVP or 5500 include the Session-Binding AVP with any of the bits set to a zero 5501 value. If present, this AVP MAY inform the Diameter client that if a 5502 re-auth or STR message fails due to a delivery problem, the Diameter 5503 client SHOULD issue a subsequent message without the Destination-Host 5504 AVP. When absent, the default value is REFUSE_SERVICE. 5506 The following values are supported: 5508 REFUSE_SERVICE 0 5510 If either the re-auth or the STR message delivery fails, terminate 5511 service with the user, and do not attempt any subsequent attempts. 5513 TRY_AGAIN 1 5515 If either the re-auth or the STR message delivery fails, resend 5516 the failed message without the Destination-Host AVP present. 5518 ALLOW_SERVICE 2 5520 If re-auth message delivery fails, assume that re-authorization 5521 succeeded. If STR message delivery fails, terminate the session. 5523 TRY_AGAIN_ALLOW_SERVICE 3 5525 If either the re-auth or the STR message delivery fails, resend 5526 the failed message without the Destination-Host AVP present. If 5527 the second delivery fails for re-auth, assume re-authorization 5528 succeeded. If the second delivery fails for STR, terminate the 5529 session. 5531 8.19. Multi-Round-Time-Out AVP 5533 The Multi-Round-Time-Out AVP (AVP Code 272) is of type Unsigned32, 5534 and SHOULD be present in application-specific authorization answer 5535 messages whose Result-Code AVP is set to DIAMETER_MULTI_ROUND_AUTH. 5536 This AVP contains the maximum number of seconds that the access 5537 device MUST provide the user in responding to an authentication 5538 request. 5540 8.20. Class AVP 5542 The Class AVP (AVP Code 25) is of type OctetString and is used to by 5543 Diameter servers to return state information to the access device. 5544 When one or more Class AVPs are present in application-specific 5545 authorization answer messages, they MUST be present in subsequent re- 5546 authorization, session termination and accounting messages. Class 5547 AVPs found in a re-authorization answer message override the ones 5548 found in any previous authorization answer message. Diameter server 5549 implementations SHOULD NOT return Class AVPs that require more than 5550 4096 bytes of storage on the Diameter client. A Diameter client that 5551 receives Class AVPs whose size exceeds local available storage MUST 5552 terminate the session. 5554 8.21. Event-Timestamp AVP 5556 The Event-Timestamp (AVP Code 55) is of type Time, and MAY be 5557 included in an Accounting-Request and Accounting-Answer messages to 5558 record the time that the reported event occurred, in seconds since 5559 January 1, 1900 00:00 UTC. 5561 9. Accounting 5563 This accounting protocol is based on a server directed model with 5564 capabilities for real-time delivery of accounting information. 5565 Several fault resilience methods [RFC2975] have been built in to the 5566 protocol in order minimize loss of accounting data in various fault 5567 situations and under different assumptions about the capabilities of 5568 the used devices. 5570 9.1. Server Directed Model 5572 The server directed model means that the device generating the 5573 accounting data gets information from either the authorization server 5574 (if contacted) or the accounting server regarding the way accounting 5575 data shall be forwarded. This information includes accounting record 5576 timeliness requirements. 5578 As discussed in [RFC2975], real-time transfer of accounting records 5579 is a requirement, such as the need to perform credit limit checks and 5580 fraud detection. Note that batch accounting is not a requirement, 5581 and is therefore not supported by Diameter. Should batched 5582 accounting be required in the future, a new Diameter application will 5583 need to be created, or it could be handled using another protocol. 5584 Note, however, that even if at the Diameter layer accounting requests 5585 are processed one by one, transport protocols used under Diameter 5586 typically batch several requests in the same packet under heavy 5587 traffic conditions. This may be sufficient for many applications. 5589 The authorization server (chain) directs the selection of proper 5590 transfer strategy, based on its knowledge of the user and 5591 relationships of roaming partnerships. The server (or agents) uses 5592 the Acct-Interim-Interval and Accounting-Realtime-Required AVPs to 5593 control the operation of the Diameter peer operating as a client. 5594 The Acct-Interim-Interval AVP, when present, instructs the Diameter 5595 node acting as a client to produce accounting records continuously 5596 even during a session. Accounting-Realtime-Required AVP is used to 5597 control the behavior of the client when the transfer of accounting 5598 records from the Diameter client is delayed or unsuccessful. 5600 The Diameter accounting server MAY override the interim interval or 5601 the realtime requirements by including the Acct-Interim-Interval or 5602 Accounting-Realtime-Required AVP in the Accounting-Answer message. 5603 When one of these AVPs is present, the latest value received SHOULD 5604 be used in further accounting activities for the same session. 5606 9.2. Protocol Messages 5608 A Diameter node that receives a successful authentication and/or 5609 authorization messages from the Home AAA server MUST collect 5610 accounting information for the session. The Accounting-Request 5611 message is used to transmit the accounting information to the Home 5612 AAA server, which MUST reply with the Accounting-Answer message to 5613 confirm reception. The Accounting-Answer message includes the 5614 Result-Code AVP, which MAY indicate that an error was present in the 5615 accounting message. A rejected Accounting-Request message MAY cause 5616 the user's session to be terminated, depending on the value of the 5617 Accounting-Realtime-Required AVP received earlier for the session in 5618 question. 5620 Each Diameter Accounting protocol message MAY be compressed, in order 5621 to reduce network bandwidth usage. If IPsec and IKE are used to 5622 secure the Diameter session, then IP compression [RFC3173] MAY be 5623 used and IKE [RFC2409] MAY be used to negotiate the compression 5624 parameters. If TLS is used to secure the Diameter session, then TLS 5625 compression [RFC2246] MAY be used. 5627 9.3. Accounting Application Extension and Requirements 5629 Each Diameter application (e.g., NASREQ, MobileIP), MUST define their 5630 Service-Specific AVPs that MUST be present in the Accounting-Request 5631 message in a section entitled "Accounting AVPs". The application 5632 MUST assume that the AVPs described in this document will be present 5633 in all Accounting messages, so only their respective service-specific 5634 AVPs need to be defined in this section. 5636 Applications have the option of using one or both of the following 5637 accounting application extension models: 5639 Coupled Accounting Service 5641 The accounting messages will carry the application identifier of 5642 the application that is using it. The application itself will 5643 process the received accounting records or forward them to an 5644 accounting server. There is no accounting application 5645 advertisement required during capabilities exchange and the 5646 accounting messages will be routed the same as any of the other 5647 application messages. 5649 Split Accounting Service 5651 The accounting message will carry the application identifier of 5652 the Diameter base accounting application (see Section 2.4). 5653 Accounting messages maybe routed to Diameter nodes other than the 5654 corresponding Diameter application. These nodes might be 5655 centralized accounting servers that provide accounting service for 5656 multiple different Diameter applications. These nodes MUST 5657 advertise the Diameter base accounting application identifier 5658 during capabilities exchange. 5660 Accounting messages which uses the Diameter base accounting 5661 application identifier in its header MUST include the application 5662 identifier of the Diameter application it is providing service for 5663 in the Acct-Application-Id AVP. This allows the accounting server 5664 to determine which Diameter application the accounting records are 5665 for. 5667 9.4. Fault Resilience 5669 Diameter Base protocol mechanisms are used to overcome small message 5670 loss and network faults of temporary nature. 5672 Diameter peers acting as clients MUST implement the use of failover 5673 to guard against server failures and certain network failures. 5674 Diameter peers acting as agents or related off-line processing 5675 systems MUST detect duplicate accounting records caused by the 5676 sending of same record to several servers and duplication of messages 5677 in transit. This detection MUST be based on the inspection of the 5678 Session-Id and Accounting-Record-Number AVP pairs. Appendix D 5679 discusses duplicate detection needs and implementation issues. 5681 Diameter clients MAY have non-volatile memory for the safe storage of 5682 accounting records over reboots or extended network failures, network 5683 partitions, and server failures. If such memory is available, the 5684 client SHOULD store new accounting records there as soon as the 5685 records are created and until a positive acknowledgement of their 5686 reception from the Diameter Server has been received. Upon a reboot, 5687 the client MUST starting sending the records in the non-volatile 5688 memory to the accounting server with appropriate modifications in 5689 termination cause, session length, and other relevant information in 5690 the records. 5692 A further application of this protocol may include AVPs to control 5693 how many accounting records may at most be stored in the Diameter 5694 client without committing them to the non-volatile memory or 5695 transferring them to the Diameter server. 5697 The client SHOULD NOT remove the accounting data from any of its 5698 memory areas before the correct Accounting-Answer has been received. 5699 The client MAY remove oldest, undelivered or yet unacknowledged 5700 accounting data if it runs out of resources such as memory. It is an 5701 implementation dependent matter for the client to accept new sessions 5702 under this condition. 5704 9.5. Accounting Records 5706 In all accounting records, the Session-Id AVP MUST be present; the 5707 User-Name AVP MUST be present if it is available to the Diameter 5708 client. If strong authentication across agents is required, end-to- 5709 end security may be used for authentication purposes. 5711 Different types of accounting records are sent depending on the 5712 actual type of accounted service and the authorization server's 5713 directions for interim accounting. If the accounted service is a 5714 one-time event, meaning that the start and stop of the event are 5715 simultaneous, then the Accounting-Record-Type AVP MUST be present and 5716 set to the value EVENT_RECORD. 5718 If the accounted service is of a measurable length, then the AVP MUST 5719 use the values START_RECORD, STOP_RECORD, and possibly, 5720 INTERIM_RECORD. If the authorization server has not directed interim 5721 accounting to be enabled for the session, two accounting records MUST 5722 be generated for each service of type session. When the initial 5723 Accounting-Request for a given session is sent, the Accounting- 5724 Record-Type AVP MUST be set to the value START_RECORD. When the last 5725 Accounting-Request is sent, the value MUST be STOP_RECORD. 5727 If the authorization server has directed interim accounting to be 5728 enabled, the Diameter client MUST produce additional records between 5729 the START_RECORD and STOP_RECORD, marked INTERIM_RECORD. The 5730 production of these records is directed by Acct-Interim-Interval as 5731 well as any re-authentication or re-authorization of the session. 5732 The Diameter client MUST overwrite any previous interim accounting 5733 records that are locally stored for delivery, if a new record is 5734 being generated for the same session. This ensures that only one 5735 pending interim record can exist on an access device for any given 5736 session. 5738 A particular value of Accounting-Sub-Session-Id MUST appear only in 5739 one sequence of accounting records from a DIAMETER client, except for 5740 the purposes of retransmission. The one sequence that is sent MUST 5741 be either one record with Accounting-Record-Type AVP set to the value 5742 EVENT_RECORD, or several records starting with one having the value 5743 START_RECORD, followed by zero or more INTERIM_RECORD and a single 5744 STOP_RECORD. A particular Diameter application specification MUST 5745 define the type of sequences that MUST be used. 5747 9.6. Correlation of Accounting Records 5749 The Diameter protocol's Session-Id AVP, which is globally unique (see 5750 Section 8.8), is used during the authorization phase to identify a 5751 particular session. Services that do not require any authorization 5752 still use the Session-Id AVP to identify sessions. Accounting 5753 messages MAY use a different Session-Id from that sent in 5754 authorization messages. Specific applications MAY require different 5755 a Session-ID for accounting messages. 5757 However, there are certain applications that require multiple 5758 accounting sub-sessions. Such applications would send messages with 5759 a constant Session-Id AVP, but a different Accounting-Sub-Session-Id 5760 AVP. In these cases, correlation is performed using the Session-Id. 5761 It is important to note that receiving a STOP_RECORD with no 5762 Accounting-Sub-Session-Id AVP when sub-sessions were originally used 5763 in the START_RECORD messages implies that all sub-sessions are 5764 terminated. 5766 Furthermore, there are certain applications where a user receives 5767 service from different access devices (e.g., Mobile IPv4), each with 5768 their own unique Session-Id. In such cases, the Acct-Multi-Session- 5769 Id AVP is used for correlation. During authorization, a server that 5770 determines that a request is for an existing session SHOULD include 5771 the Acct-Multi-Session-Id AVP, which the access device MUST include 5772 in all subsequent accounting messages. 5774 The Acct-Multi-Session-Id AVP MAY include the value of the original 5775 Session-Id. It's contents are implementation specific, but MUST be 5776 globally unique across other Acct-Multi-Session-Id, and MUST NOT 5777 change during the life of a session. 5779 A Diameter application document MUST define the exact concept of a 5780 session that is being accounted, and MAY define the concept of a 5781 multi-session. For instance, the NASREQ DIAMETER application treats 5782 a single PPP connection to a Network Access Server as one session, 5783 and a set of Multilink PPP sessions as one multi-session. 5785 9.7. Accounting Command-Codes 5787 This section defines Command-Code values that MUST be supported by 5788 all Diameter implementations that provide Accounting services. 5790 9.7.1. Accounting-Request 5792 The Accounting-Request (ACR) command, indicated by the Command-Code 5793 field set to 271 and the Command Flags' 'R' bit set, is sent by a 5794 Diameter node, acting as a client, in order to exchange accounting 5795 information with a peer. 5797 One of Acct-Application-Id and Vendor-Specific-Application-Id AVPs 5798 MUST be present. If the Vendor-Specific-Application-Id grouped AVP 5799 is present, it must have an Acct-Application-Id inside. 5801 The AVP listed below SHOULD include service specific accounting AVPs, 5802 as described in Section 9.3. 5804 Message Format 5806 ::= < Diameter Header: 271, REQ, PXY > 5807 < Session-Id > 5808 { Origin-Host } 5809 { Origin-Realm } 5810 { Destination-Realm } 5811 { Accounting-Record-Type } 5812 { Accounting-Record-Number } 5813 [ Acct-Application-Id ] 5814 [ Vendor-Specific-Application-Id ] 5815 [ User-Name ] 5816 [ Accounting-Sub-Session-Id ] 5817 [ Acct-Session-Id ] 5818 [ Acct-Multi-Session-Id ] 5819 [ Acct-Interim-Interval ] 5820 [ Accounting-Realtime-Required ] 5821 [ Origin-State-Id ] 5822 [ Event-Timestamp ] 5823 * [ Proxy-Info ] 5824 * [ Route-Record ] 5825 * [ AVP ] 5827 9.7.2. Accounting-Answer 5829 The Accounting-Answer (ACA) command, indicated by the Command-Code 5830 field set to 271 and the Command Flags' 'R' bit cleared, is used to 5831 acknowledge an Accounting-Request command. The Accounting-Answer 5832 command contains the same Session-Id and includes the usage AVPs only 5833 if CMS is in use when sending this command. Note that the inclusion 5834 of the usage AVPs when CMS is not being used leads to unnecessarily 5835 large answer messages, and can not be used as a server's proof of the 5836 receipt of these AVPs in an end-to-end fashion. If the Accounting- 5837 Request was protected by end-to-end security, then the corresponding 5838 ACA message MUST be protected by end-to-end security. 5840 Only the target Diameter Server, known as the home Diameter Server, 5841 SHOULD respond with the Accounting-Answer command. 5843 One of Acct-Application-Id and Vendor-Specific-Application-Id AVPs 5844 MUST be present. If the Vendor-Specific-Application-Id grouped AVP 5845 is present, it must have an Acct-Application-Id inside. 5847 The AVP listed below SHOULD include service specific accounting AVPs, 5848 as described in Section 9.3. 5850 Message Format 5852 ::= < Diameter Header: 271, PXY > 5853 < Session-Id > 5854 { Result-Code } 5855 { Origin-Host } 5856 { Origin-Realm } 5857 { Accounting-Record-Type } 5858 { Accounting-Record-Number } 5859 [ Acct-Application-Id ] 5860 [ Vendor-Specific-Application-Id ] 5861 [ User-Name ] 5862 [ Accounting-Sub-Session-Id ] 5863 [ Acct-Session-Id ] 5864 [ Acct-Multi-Session-Id ] 5865 [ Error-Reporting-Host ] 5866 [ Acct-Interim-Interval ] 5867 [ Accounting-Realtime-Required ] 5868 [ Origin-State-Id ] 5869 [ Event-Timestamp ] 5870 * [ Proxy-Info ] 5871 * [ AVP ] 5873 9.8. Accounting AVPs 5875 This section contains AVPs that describe accounting usage information 5876 related to a specific session. 5878 9.8.1. Accounting-Record-Type AVP 5880 The Accounting-Record-Type AVP (AVP Code 480) is of type Enumerated 5881 and contains the type of accounting record being sent. The following 5882 values are currently defined for the Accounting-Record-Type AVP: 5884 EVENT_RECORD 1 5886 An Accounting Event Record is used to indicate that a one-time 5887 event has occurred (meaning that the start and end of the event 5888 are simultaneous). This record contains all information relevant 5889 to the service, and is the only record of the service. 5891 START_RECORD 2 5893 An Accounting Start, Interim, and Stop Records are used to 5894 indicate that a service of a measurable length has been given. An 5895 Accounting Start Record is used to initiate an accounting session, 5896 and contains accounting information that is relevant to the 5897 initiation of the session. 5899 INTERIM_RECORD 3 5901 An Interim Accounting Record contains cumulative accounting 5902 information for an existing accounting session. Interim 5903 Accounting Records SHOULD be sent every time a re-authentication 5904 or re-authorization occurs. Further, additional interim record 5905 triggers MAY be defined by application-specific Diameter 5906 applications. The selection of whether to use INTERIM_RECORD 5907 records is done by the Acct-Interim-Interval AVP. 5909 STOP_RECORD 4 5911 An Accounting Stop Record is sent to terminate an accounting 5912 session and contains cumulative accounting information relevant to 5913 the existing session. 5915 9.8.2. Acct-Interim-Interval 5917 The Acct-Interim-Interval AVP (AVP Code 85) is of type Unsigned32 and 5918 is sent from the Diameter home authorization server to the Diameter 5919 client. The client uses information in this AVP to decide how and 5920 when to produce accounting records. With different values in this 5921 AVP, service sessions can result in one, two, or two+N accounting 5922 records, based on the needs of the home-organization. The following 5923 accounting record production behavior is directed by the inclusion of 5924 this AVP: 5926 1. The omission of the Acct-Interim-Interval AVP or its inclusion 5927 with Value field set to 0 means that EVENT_RECORD, START_RECORD, 5928 and STOP_RECORD are produced, as appropriate for the service. 5930 2. The inclusion of the AVP with Value field set to a non-zero value 5931 means that INTERIM_RECORD records MUST be produced between the 5932 START_RECORD and STOP_RECORD records. The Value field of this 5933 AVP is the nominal interval between these records in seconds. 5934 The Diameter node that originates the accounting information, 5935 known as the client, MUST produce the first INTERIM_RECORD record 5936 roughly at the time when this nominal interval has elapsed from 5937 the START_RECORD, the next one again as the interval has elapsed 5938 once more, and so on until the session ends and a STOP_RECORD 5939 record is produced. 5941 The client MUST ensure that the interim record production times 5942 are randomized so that large accounting message storms are not 5943 created either among records or around a common service start 5944 time. 5946 9.8.3. Accounting-Record-Number AVP 5948 The Accounting-Record-Number AVP (AVP Code 485) is of type Unsigned32 5949 and identifies this record within one session. As Session-Id AVPs 5950 are globally unique, the combination of Session-Id and Accounting- 5951 Record-Number AVPs is also globally unique, and can be used in 5952 matching accounting records with confirmations. An easy way to 5953 produce unique numbers is to set the value to 0 for records of type 5954 EVENT_RECORD and START_RECORD, and set the value to 1 for the first 5955 INTERIM_RECORD, 2 for the second, and so on until the value for 5956 STOP_RECORD is one more than for the last INTERIM_RECORD. 5958 9.8.4. Acct-Session-Id AVP 5960 The Acct-Session-Id AVP (AVP Code 44) is of type OctetString is only 5961 used when RADIUS/Diameter translation occurs. This AVP contains the 5962 contents of the RADIUS Acct-Session-Id attribute. 5964 9.8.5. Acct-Multi-Session-Id AVP 5966 The Acct-Multi-Session-Id AVP (AVP Code 50) is of type UTF8String, 5967 following the format specified in Section 8.8. The Acct-Multi- 5968 Session-Id AVP is used to link together multiple related accounting 5969 sessions, where each session would have a unique Session-Id, but the 5970 same Acct-Multi-Session-Id AVP. This AVP MAY be returned by the 5971 Diameter server in an authorization answer, and MUST be used in all 5972 accounting messages for the given session. 5974 9.8.6. Accounting-Sub-Session-Id AVP 5976 The Accounting-Sub-Session-Id AVP (AVP Code 287) is of type 5977 Unsigned64 and contains the accounting sub-session identifier. The 5978 combination of the Session-Id and this AVP MUST be unique per sub- 5979 session, and the value of this AVP MUST be monotonically increased by 5980 one for all new sub-sessions. The absence of this AVP implies no 5981 sub-sessions are in use, with the exception of an Accounting-Request 5982 whose Accounting-Record-Type is set to STOP_RECORD. A STOP_RECORD 5983 message with no Accounting-Sub-Session-Id AVP present will signal the 5984 termination of all sub-sessions for a given Session-Id. 5986 9.8.7. Accounting-Realtime-Required AVP 5988 The Accounting-Realtime-Required AVP (AVP Code 483) is of type 5989 Enumerated and is sent from the Diameter home authorization server to 5990 the Diameter client or in the Accounting-Answer from the accounting 5991 server. The client uses information in this AVP to decide what to do 5992 if the sending of accounting records to the accounting server has 5993 been temporarily prevented due to, for instance, a network problem. 5995 DELIVER_AND_GRANT 1 5997 The AVP with Value field set to DELIVER_AND_GRANT means that the 5998 service MUST only be granted as long as there is a connection to 5999 an accounting server. Note that the set of alternative accounting 6000 servers are treated as one server in this sense. Having to move 6001 the accounting record stream to a backup server is not a reason to 6002 discontinue the service to the user. 6004 GRANT_AND_STORE 2 6006 The AVP with Value field set to GRANT_AND_STORE means that service 6007 SHOULD be granted if there is a connection, or as long as records 6008 can still be stored as described in Section 9.4. 6010 This is the default behavior if the AVP isn't included in the 6011 reply from the authorization server. 6013 GRANT_AND_LOSE 3 6015 The AVP with Value field set to GRANT_AND_LOSE means that service 6016 SHOULD be granted even if the records can not be delivered or 6017 stored. 6019 10. AVP Occurrence Table 6021 The following tables presents the AVPs defined in this document, and 6022 specifies in which Diameter messages they MAY, or MAY NOT be present. 6023 Note that AVPs that can only be present within a Grouped AVP are not 6024 represented in this table. 6026 The table uses the following symbols: 6028 0 The AVP MUST NOT be present in the message. 6030 0+ Zero or more instances of the AVP MAY be present in the 6031 message. 6033 0-1 Zero or one instance of the AVP MAY be present in the message. 6034 It is considered an error if there are more than one instance of 6035 the AVP. 6037 1 One instance of the AVP MUST be present in the message. 6039 1+ At least one instance of the AVP MUST be present in the 6040 message. 6042 10.1. Base Protocol Command AVP Table 6044 The table in this section is limited to the non-accounting Command 6045 Codes defined in this specification. 6047 +-----------------------------------------------+ 6048 | Command-Code | 6049 +---+---+---+---+---+---+---+---+---+---+---+---+ 6050 Attribute Name |CER|CEA|DPR|DPA|DWR|DWA|RAR|RAA|ASR|ASA|STR|STA| 6051 --------------------+---+---+---+---+---+---+---+---+---+---+---+---+ 6052 Acct-Interim- |0 |0 |0 |0 |0 |0 |0-1|0 |0 |0 |0 |0 | 6053 Interval | | | | | | | | | | | | | 6054 Accounting-Realtime-|0 |0 |0 |0 |0 |0 |0-1|0 |0 |0 |0 |0 | 6055 Required | | | | | | | | | | | | | 6056 Acct-Application-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6057 Auth-Application-Id |0+ |0+ |0 |0 |0 |0 |1 |0 |1 |0 |1 |0 | 6058 Auth-Grace-Period |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6059 Auth-Request-Type |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6060 Auth-Session-State |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6061 Authorization- |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6062 Lifetime | | | | | | | | | | | | | 6063 Class |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0+ |0+ | 6064 Destination-Host |0 |0 |0 |0 |0 |0 |1 |0 |1 |0 |0-1|0 | 6065 Destination-Realm |0 |0 |0 |0 |0 |0 |1 |0 |1 |0 |1 |0 | 6066 Disconnect-Cause |0 |0 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6067 Error-Message |0 |0-1|0 |0-1|0 |0-1|0 |0-1|0 |0-1|0 |0-1| 6068 Error-Reporting-Host|0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6069 Failed-AVP |0 |0+ |0 |0+ |0 |0+ |0 |0+ |0 |0+ |0 |0+ | 6070 Firmware-Revision |0-1|0-1|0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6071 Host-IP-Address |1+ |1+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6072 Inband-Security-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6073 Multi-Round-Time-Out|0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6074 Origin-Host |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 | 6075 Origin-Realm |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 |1 | 6076 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| 6077 Product-Name |1 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6078 Proxy-Info |0 |0 |0 |0 |0 |0 |0+ |0+ |0+ |0+ |0+ |0+ | 6079 Redirect-Host |0 |0 |0 |0 |0 |0 |0 |0+ |0 |0+ |0 |0+ | 6080 Redirect-Host-Usage |0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6081 Redirect-Max-Cache- |0 |0 |0 |0 |0 |0 |0 |0-1|0 |0-1|0 |0-1| 6082 Time | | | | | | | | | | | | | 6083 Result-Code |0 |1 |0 |1 |0 |1 |0 |1 |0 |0 |0 |1 | 6084 Re-Auth-Request-Type|0 |0 |0 |0 |0 |0 |1 |0 |0 |0 |0 |0 | 6085 Route-Record |0 |0 |0 |0 |0 |0 |0+ |0 |0+ |0 |0+ |0 | 6086 Session-Binding |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6087 Session-Id |0 |0 |0 |0 |0 |0 |1 |1 |1 |1 |1 |1 | 6088 Session-Server- |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6089 Failover | | | | | | | | | | | | | 6090 Session-Timeout |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6091 Supported-Vendor-Id |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6092 Termination-Cause |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |1 |0 | 6093 User-Name |0 |0 |0 |0 |0 |0 |0-1|0-1|0-1|0-1|0-1|0-1| 6094 Vendor-Id |1 |1 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6095 Vendor-Specific- |0+ |0+ |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | 6096 Application-Id | | | | | | | | | | | | | 6097 --------------------+---+---+---+---+---+---+---+---+---+---+---+---+ 6099 10.2. Accounting AVP Table 6101 The table in this section is used to represent which AVPs defined in 6102 this document are to be present in the Accounting messages. These 6103 AVP occurrence requirements are guidelines, which may be expanded, 6104 and/or overridden by application-specific requirements in the 6105 Diameter applications documents. 6107 +-----------+ 6108 | Command | 6109 | Code | 6110 +-----+-----+ 6111 Attribute Name | ACR | ACA | 6112 ------------------------------+-----+-----+ 6113 Acct-Interim-Interval | 0-1 | 0-1 | 6114 Acct-Multi-Session-Id | 0-1 | 0-1 | 6115 Accounting-Record-Number | 1 | 1 | 6116 Accounting-Record-Type | 1 | 1 | 6117 Acct-Session-Id | 0-1 | 0-1 | 6118 Accounting-Sub-Session-Id | 0-1 | 0-1 | 6119 Accounting-Realtime-Required | 0-1 | 0-1 | 6120 Acct-Application-Id | 0-1 | 0-1 | 6121 Auth-Application-Id | 0 | 0 | 6122 Class | 0+ | 0+ | 6123 Destination-Host | 0-1 | 0 | 6124 Destination-Realm | 1 | 0 | 6125 Error-Reporting-Host | 0 | 0+ | 6126 Event-Timestamp | 0-1 | 0-1 | 6127 Origin-Host | 1 | 1 | 6128 Origin-Realm | 1 | 1 | 6129 Proxy-Info | 0+ | 0+ | 6130 Route-Record | 0+ | 0+ | 6131 Result-Code | 0 | 1 | 6132 Session-Id | 1 | 1 | 6133 Termination-Cause | 0-1 | 0-1 | 6134 User-Name | 0-1 | 0-1 | 6135 Vendor-Specific-Application-Id| 0-1 | 0-1 | 6136 ------------------------------+-----+-----+ 6138 11. IANA Considerations 6140 This section provides guidance to the Internet Assigned Numbers 6141 Authority (IANA) regarding registration of values related to the 6142 Diameter protocol, in accordance with BCP 26 [RFC2434]. The 6143 following policies are used here with the meanings defined in BCP 26: 6144 "Private Use", "First Come First Served", "Expert Review", 6145 "Specification Required", "IETF Consensus", "Standards Action". 6147 This section explains the criteria to be used by the IANA for 6148 assignment of numbers within namespaces defined within this document. 6150 Diameter is not intended as a general purpose protocol, and 6151 allocations SHOULD NOT be made for purposes unrelated to 6152 authentication, authorization or accounting. 6154 For registration requests where a Designated Expert should be 6155 consulted, the responsible IESG area director should appoint the 6156 Designated Expert. For Designated Expert with Specification 6157 Required, the request is posted to the AAA WG mailing list (or, if it 6158 has been disbanded, a successor designated by the Area Director) for 6159 comment and review, and MUST include a pointer to a public 6160 specification. Before a period of 30 days has passed, the Designated 6161 Expert will either approve or deny the registration request and 6162 publish a notice of the decision to the AAA WG mailing list or its 6163 successor. A denial notice must be justified by an explanation and, 6164 in the cases where it is possible, concrete suggestions on how the 6165 request can be modified so as to become acceptable. 6167 11.1. AVP Header 6169 As defined in Section 4, the AVP header contains three fields that 6170 requires IANA namespace management; the AVP Code, Vendor-ID and Flags 6171 field. 6173 11.1.1. AVP Codes 6175 The AVP Code namespace is used to identify attributes. There are 6176 multiple namespaces. Vendors can have their own AVP Codes namespace 6177 which will be identified by their Vendor-ID (also known as 6178 Enterprise-Number) and they control the assignments of their vendor- 6179 specific AVP codes within their own namespace. The absence of a 6180 Vendor-ID or a Vendor-ID value of zero (0) identifies the IETF IANA 6181 controlled AVP Codes namespace. The AVP Codes and sometimes also 6182 possible values in an AVP are controlled and maintained by IANA. 6184 AVP Code 0 is not used. AVP Codes 1-255 are managed separately as 6185 RADIUS Attribute Types [RADTYPE]. This document defines the AVP 6186 Codes 257-274, 276-285, 287, 291-300, 480, 483 and 485-486. See 6187 Section 4.5 for the assignment of the namespace in this 6188 specification. 6190 AVPs may be allocated following Designated Expert with Specification 6191 Required [RFC2434]. Release of blocks of AVPs (more than 3 at a time 6192 for a given purpose) should require IETF Consensus. 6194 Note that Diameter defines a mechanism for Vendor-Specific AVPs, 6195 where the Vendor-Id field in the AVP header is set to a non-zero 6196 value. Vendor-Specific AVPs codes are for Private Use and should be 6197 encouraged instead of allocation of global attribute types, for 6198 functions specific only to one vendor's implementation of Diameter, 6199 where no interoperability is deemed useful. Where a Vendor-Specific 6200 AVP is implemented by more than one vendor, allocation of global AVPs 6201 should be encouraged instead. 6203 11.1.2. AVP Flags 6205 There are 8 bits in the AVP Flags field of the AVP header, defined in 6206 Section 4. This document assigns bit 0 ('V'endor Specific), bit 1 6207 ('M'andatory) and bit 2 ('P'rotected). The remaining bits should 6208 only be assigned via a Standards Action [RFC2434]. 6210 11.2. Diameter Header 6212 As defined in Section 3, the Diameter header contains two fields that 6213 require IANA namespace management; Command Code and Command Flags. 6215 11.2.1. Command Codes 6217 The Command Code namespace is used to identify Diameter commands. 6218 The values 0-255 are reserved for RADIUS backward compatibility, and 6219 are defined as "RADIUS Packet Type Codes" in [RADTYPE]. Values 256- 6220 16,777,213 are for permanent, standard commands, allocated by IETF 6221 Consensus [RFC2434]. This document defines the Command Codes 257, 6222 258, 271, 274-275, 280 and 282. See Section 3.1 for the assignment 6223 of the namespace in this specification. 6225 The values 16,777,214 and 16,777,215 (hexadecimal values 0xfffffe - 6226 0xffffff) are reserved for experimental commands. As these codes are 6227 only for experimental and testing purposes, no guarantee is made for 6228 interoperability between Diameter peers using experimental commands, 6229 as outlined in [IANA-EXP]. 6231 11.2.2. Command Flags 6233 There are eight bits in the Command Flags field of the Diameter 6234 header. This document assigns bit 0 ('R'equest), bit 1 ('P'roxy), 6235 bit 2 ('E'rror) and bit 3 ('T'). Bits 4 through 7 MUST only be 6236 assigned via a Standards Action [RFC2434]. 6238 11.3. Application Identifiers 6240 As defined in Section 2.4, the Application Identifier is used to 6241 identify a specific Diameter Application. There are standards-track 6242 application ids and vendor specific application ids. 6244 IANA [RFC2434] has assigned the range 0x00000001 to 0x00ffffff for 6245 standards-track applications; and 0x01000000 - 0xfffffffe for vendor 6246 specific applications, on a first-come, first-served basis. The 6247 following values are allocated. 6249 Diameter Common Messages 0 6250 NASREQ 1 [RFC4005] 6251 Mobile-IP 2 [RFC4004] 6252 Diameter Base Accounting 3 6253 Relay 0xffffffff 6255 Assignment of standards-track application IDs are by Designated 6256 Expert with Specification Required [RFC2434]. 6258 Both Auth-Application-Id and Acct-Application-Id AVPs use the same 6259 Application Identifier space. A diameter node advertising itself as 6260 a relay agent MUST set either Application-Id or Acct-Application-Id 6261 to 0xffffffff. 6263 Vendor-Specific Application Identifiers, are for Private Use. Vendor- 6264 Specific Application Identifiers are assigned on a First Come, First 6265 Served basis by IANA. 6267 11.4. AVP Values 6269 Certain AVPs in Diameter define a list of values with various 6270 meanings. For attributes other than those specified in this section, 6271 adding additional values to the list can be done on a First Come, 6272 First Served basis by IANA. 6274 11.4.1. Result-Code AVP Values 6276 As defined in Section 7.1, the Result-Code AVP (AVP Code 268) defines 6277 the values 1001, 2001-2002, 3001-3012, 4001-4003 and 5001-5021. 6279 All remaining values are available for assignment via IETF Consensus 6280 [RFC2434]. 6282 11.4.2. Accounting-Record-Type AVP Values 6284 As defined in Section 9.8.1, the Accounting-Record-Type AVP (AVP Code 6285 480) defines the values 1-4. All remaining values are available for 6286 assignment via IETF Consensus [RFC2434]. 6288 11.4.3. Termination-Cause AVP Values 6290 As defined in Section 8.15, the Termination-Cause AVP (AVP Code 295) 6291 defines the values 1-8. All remaining values are available for 6292 assignment via IETF Consensus [RFC2434]. 6294 11.4.4. Redirect-Host-Usage AVP Values 6296 As defined in Section 6.13, the Redirect-Host-Usage AVP (AVP Code 6297 261) defines the values 0-5. All remaining values are available for 6298 assignment via IETF Consensus [RFC2434]. 6300 11.4.5. Session-Server-Failover AVP Values 6302 As defined in Section 8.18, the Session-Server-Failover AVP (AVP Code 6303 271) defines the values 0-3. All remaining values are available for 6304 assignment via IETF Consensus [RFC2434]. 6306 11.4.6. Session-Binding AVP Values 6308 As defined in Section 8.17, the Session-Binding AVP (AVP Code 270) 6309 defines the bits 1-4. All remaining bits are available for 6310 assignment via IETF Consensus [RFC2434]. 6312 11.4.7. Disconnect-Cause AVP Values 6314 As defined in Section 5.4.3, the Disconnect-Cause AVP (AVP Code 273) 6315 defines the values 0-2. All remaining values are available for 6316 assignment via IETF Consensus [RFC2434]. 6318 11.4.8. Auth-Request-Type AVP Values 6320 As defined in Section 8.7, the Auth-Request-Type AVP (AVP Code 274) 6321 defines the values 1-3. All remaining values are available for 6322 assignment via IETF Consensus [RFC2434]. 6324 11.4.9. Auth-Session-State AVP Values 6326 As defined in Section 8.11, the Auth-Session-State AVP (AVP Code 277) 6327 defines the values 0-1. All remaining values are available for 6328 assignment via IETF Consensus [RFC2434]. 6330 11.4.10. Re-Auth-Request-Type AVP Values 6332 As defined in Section 8.12, the Re-Auth-Request-Type AVP (AVP Code 6333 285) defines the values 0-1. All remaining values are available for 6334 assignment via IETF Consensus [RFC2434]. 6336 11.4.11. Accounting-Realtime-Required AVP Values 6338 As defined in Section 9.8.7, the Accounting-Realtime-Required AVP 6339 (AVP Code 483) defines the values 1-3. All remaining values are 6340 available for assignment via IETF Consensus [RFC2434]. 6342 11.4.12. Inband-Security-Id AVP (code 299) 6344 As defined in Section 6.10, the Inband-Security-Id AVP (AVP Code 299) 6345 defines the values 0-1. All remaining values are available for 6346 assignment via IETF Consensus [RFC2434]. 6348 11.5. Diameter TCP/SCTP Port Numbers 6350 The IANA has assigned TCP and SCTP port number 3868 to Diameter. 6352 11.6. NAPTR Service Fields 6354 The registration in the RFC MUST include the following information: 6356 Service Field: The service field being registered. An example for a 6357 new fictitious transport protocol called NCTP might be "AAA+D2N". 6359 Protocol: The specific transport protocol associated with that 6360 service field. This MUST include the name and acronym for the 6361 protocol, along with reference to a document that describes the 6362 transport protocol. For example - "New Connectionless Transport 6363 Protocol (NCTP), RFC 5766". 6365 Name and Contact Information: The name, address, email address and 6366 telephone number for the person performing the registration. 6368 The following values have been placed into the registry: 6370 Services Field Protocol 6372 AAA+D2T TCP 6373 AAA+D2S SCTP 6375 12. Diameter protocol related configurable parameters 6377 This section contains the configurable parameters that are found 6378 throughout this document: 6380 Diameter Peer 6382 A Diameter entity MAY communicate with peers that are statically 6383 configured. A statically configured Diameter peer would require 6384 that either the IP address or the fully qualified domain name 6385 (FQDN) be supplied, which would then be used to resolve through 6386 DNS. 6388 Routing Table 6390 A Diameter proxy server routes messages based on the realm portion 6391 of a Network Access Identifier (NAI). The server MUST have a 6392 table of Realm Names, and the address of the peer to which the 6393 message must be forwarded to. The routing table MAY also include 6394 a "default route", which is typically used for all messages that 6395 cannot be locally processed. 6397 Tc timer 6399 The Tc timer controls the frequency that transport connection 6400 attempts are done to a peer with whom no active transport 6401 connection exists. The recommended value is 30 seconds. 6403 13. Security Considerations 6405 The Diameter base protocol assumes that messages are secured by using 6406 either IPSec or TLS. This security mechanism is acceptable in 6407 environments where there is no untrusted third party agent. In other 6408 situations, end-to-end security is needed. 6410 Diameter clients, such as Network Access Servers (NASes) and Mobility 6411 Agents MUST support IP Security [RFC2401] and MAY support TLS 6412 [RFC2246]. Diameter servers MUST support TLS and IPsec. Diameter 6413 implementations MUST use transmission-level security of some kind 6414 (IPsec or TLS) on each connection. 6416 If a Diameter connection is not protected by IPsec, then the CER/CEA 6417 exchange MUST include an Inband-Security-ID AVP with a value of TLS. 6418 For TLS usage, a TLS handshake will begin when both ends are in the 6419 open state, after completion of the CER/CEA exchange. If the TLS 6420 handshake is successful, all further messages will be sent via TLS. 6421 If the handshake fails, both ends move to the closed state. 6423 It is suggested that IPsec be used primarily at the edges for intra- 6424 domain exchanges. For NAS devices without certificate support, pre- 6425 shared keys can be used between the NAS and a local AAA proxy. 6427 For protection of inter-domain exchanges, TLS is recommended. See 6428 Sections 13.1 and 13.2 for more details on IPsec and TLS usage. 6430 13.1. IPsec Usage 6432 All Diameter implementations MUST support IPsec ESP [RFC2401] in 6433 transport mode with non-null encryption and authentication algorithms 6434 to provide per-packet authentication, integrity protection and 6435 confidentiality, and MUST support the replay protection mechanisms of 6436 IPsec. 6438 Diameter implementations MUST support IKE for peer authentication, 6439 negotiation of security associations, and key management, using the 6440 IPsec DOI [RFC2407]. Diameter implementations MUST support peer 6441 authentication using a pre-shared key, and MAY support certificate- 6442 based peer authentication using digital signatures. Peer 6443 authentication using the public key encryption methods outlined in 6444 IKE's Sections 5.2 and 5.3 [RFC2409] SHOULD NOT be used. 6446 Conformant implementations MUST support both IKE Main Mode and 6447 Aggressive Mode. When pre-shared keys are used for authentication, 6448 IKE Aggressive Mode SHOULD be used, and IKE Main Mode SHOULD NOT be 6449 used. When digital signatures are used for authentication, either 6450 IKE Main Mode or IKE Aggressive Mode MAY be used. 6452 When digital signatures are used to achieve authentication, an IKE 6453 negotiator SHOULD use IKE Certificate Request Payload(s) to specify 6454 the certificate authority (or authorities) that are trusted in 6455 accordance with its local policy. IKE negotiators SHOULD use 6456 pertinent certificate revocation checks before accepting a PKI 6457 certificate for use in IKE's authentication procedures. 6459 The Phase 2 Quick Mode exchanges used to negotiate protection for 6460 Diameter connections MUST explicitly carry the Identity Payload 6461 fields (IDci and IDcr). The DOI provides for several types of 6462 identification data. However, when used in conformant 6463 implementations, each ID Payload MUST carry a single IP address and a 6464 single non-zero port number, and MUST NOT use the IP Subnet or IP 6465 Address Range formats. This allows the Phase 2 security association 6466 to correspond to specific TCP and SCTP connections. 6468 Since IPsec acceleration hardware may only be able to handle a 6469 limited number of active IKE Phase 2 SAs, Phase 2 delete messages may 6470 be sent for idle SAs, as a means of keeping the number of active 6471 Phase 2 SAs to a minimum. The receipt of an IKE Phase 2 delete 6472 message SHOULD NOT be interpreted as a reason for tearing down a 6473 Diameter connection. Rather, it is preferable to leave the 6474 connection up, and if additional traffic is sent on it, to bring up 6475 another IKE Phase 2 SA to protect it. This avoids the potential for 6476 continually bringing connections up and down. 6478 13.2. TLS Usage 6480 A Diameter node that initiates a connection to another Diameter node 6481 acts as a TLS client according to [RFC2246], and a Diameter node that 6482 accepts a connection acts as a TLS server. Diameter nodes 6483 implementing TLS for security MUST mutually authenticate as part of 6484 TLS session establishment. In order to ensure mutual authentication, 6485 the Diameter node acting as TLS server must request a certificate 6486 from the Diameter node acting as TLS client, and the Diameter node 6487 acting as TLS client MUST be prepared to supply a certificate on 6488 request. 6490 Diameter nodes MUST be able to negotiate the following TLS cipher 6491 suites: 6493 TLS_RSA_WITH_RC4_128_MD5 6494 TLS_RSA_WITH_RC4_128_SHA 6495 TLS_RSA_WITH_3DES_EDE_CBC_SHA 6497 Diameter nodes SHOULD be able to negotiate the following TLS cipher 6498 suite: 6500 TLS_RSA_WITH_AES_128_CBC_SHA 6502 Diameter nodes MAY negotiate other TLS cipher suites. 6504 13.3. Peer-to-Peer Considerations 6506 As with any peer-to-peer protocol, proper configuration of the trust 6507 model within a Diameter peer is essential to security. When 6508 certificates are used, it is necessary to configure the root 6509 certificate authorities trusted by the Diameter peer. These root CAs 6510 are likely to be unique to Diameter usage and distinct from the root 6511 CAs that might be trusted for other purposes such as Web browsing. 6512 In general, it is expected that those root CAs will be configured so 6513 as to reflect the business relationships between the organization 6514 hosting the Diameter peer and other organizations. As a result, a 6515 Diameter peer will typically not be configured to allow connectivity 6516 with any arbitrary peer. When certificate authentication Diameter 6517 peers may not be known beforehand, and therefore peer discovery may 6518 be required. 6520 Note that IPsec is considerably less flexible than TLS when it comes 6521 to configuring root CAs. Since use of Port identifiers is prohibited 6522 within IKE Phase 1, within IPsec it is not possible to uniquely 6523 configure trusted root CAs for each application individually; the 6524 same policy must be used for all applications. This implies, for 6525 example, that a root CA trusted for use with Diameter must also be 6526 trusted to protect SNMP. These restrictions can be awkward at best. 6527 Since TLS supports application-level granularity in certificate 6528 policy, TLS SHOULD be used to protect Diameter connections between 6529 administrative domains. IPsec is most appropriate for intra-domain 6530 usage when pre-shared keys are used as a security mechanism. 6532 When pre-shared key authentication is used with IPsec to protect 6533 Diameter, unique pre-shared keys are configured with Diameter peers, 6534 who are identified by their IP address (Main Mode), or possibly their 6535 FQDN (Aggressive Mode). As a result, it is necessary for the set of 6536 Diameter peers to be known beforehand. Therefore, peer discovery is 6537 typically not necessary. 6539 The following is intended to provide some guidance on the issue. 6541 It is recommended that a Diameter peer implement the same security 6542 mechanism (IPsec or TLS) across all its peer-to-peer connections. 6543 Inconsistent use of security mechanisms can result in redundant 6544 security mechanisms being used (e.g., TLS over IPsec) or worse, 6545 potential security vulnerabilities. When IPsec is used with 6546 Diameter, a typical security policy for outbound traffic is "Initiate 6547 IPsec, from me to any, destination port Diameter"; for inbound 6548 traffic, the policy would be "Require IPsec, from any to me, 6549 destination port Diameter". 6551 This policy causes IPsec to be used whenever a Diameter peer 6552 initiates a connection to another Diameter peer, and to be required 6553 whenever an inbound Diameter connection occurs. This policy is 6554 attractive, since it does not require policy to be set for each peer 6555 or dynamically modified each time a new Diameter connection is 6556 created; an IPsec SA is automatically created based on a simple 6557 static policy. Since IPsec extensions are typically not available to 6558 the sockets API on most platforms, and IPsec policy functionality is 6559 implementation dependent, use of a simple static policy is the often 6560 the simplest route to IPsec-enabling a Diameter implementation. 6562 One implication of the recommended policy is that if a node is using 6563 both TLS and IPsec, there is not a convenient way in which to use 6564 either TLS or IPsec, but not both, without reserving an additional 6565 port for TLS usage. Since Diameter uses the same port for TLS and 6566 non-TLS usage, where the recommended IPsec policy is put in place, a 6567 TLS-protected connection will match the IPsec policy, and both IPsec 6568 and TLS will be used to protect the Diameter connection. To avoid 6569 this, it would be necessary to plumb peer-specific policies either 6570 statically or dynamically. 6572 If IPsec is used to secure Diameter peer-to-peer connections, IPsec 6573 policy SHOULD be set so as to require IPsec protection for inbound 6574 connections, and to initiate IPsec protection for outbound 6575 connections. This can be accomplished via use of inbound and 6576 outbound filter policy. 6578 14. References 6580 14.1. Normative References 6582 [FLOATPOINT] 6583 Institute of Electrical and Electronics Engineers, "IEEE 6584 Standard for Binary Floating-Point Arithmetic, ANSI/IEEE 6585 Standard 754-1985", August 1985. 6587 [IANAADFAM] 6588 IANA,, "Address Family Numbers", 6589 http://www.iana.org/assignments/address-family-numbers. 6591 [IANAWEB] IANA,, "Number assignment", http://www.iana.org. 6593 [RADTYPE] IANA,, "RADIUS Types", 6594 http://www.iana.org/assignments/radius-types. 6596 [IPV4] Postel, J., "Internet Protocol", RFC 791, September 1981. 6598 [TCP] Postel, J., "Transmission Control Protocol", RFC 793, 6599 January 1981. 6601 [RFC3539] Aboba, B. and J. Wood, "Authentication, Authorization and 6602 Accounting (AAA) Transport Profile", RFC 3539, June 2003. 6604 [RFC4004] Calhoun, P., Johansson, T., Perkins, C., Hiller, T., and 6605 P. McCann, "Diameter Mobile IPv4 Application", RFC 4004, 6606 August 2005. 6608 [RFC4005] Calhoun, P., Zorn, G., Spence, D., and D. Mitton, 6609 "Diameter Network Access Server Application", RFC 4005, 6610 August 2005. 6612 [RFC4006] Hakala, H., Mattila, L., Koskinen, J-P., Stura, M., and J. 6613 Loughney, "Diameter Credit-Control Application", RFC 4006, 6614 August 2005. 6616 [RFC4072] Eronen, P., Hiller, T., and G. Zorn, "Diameter Extensible 6617 Authentication Protocol (EAP) Application", RFC 4072, 6618 August 2005. 6620 [RFC4740] Garcia-Martin, M., Belinchon, M., Pallares-Lopez, M., 6621 Canales-Valenzuela, C., and K. Tammi, "Diameter Session 6622 Initiation Protocol (SIP) Application", RFC 4740, 6623 November 2006. 6625 [RFC2234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 6626 Specifications: ABNF", RFC 2234, November 1997. 6628 [RFC3232] Reynolds, J., "Assigned Numbers: RFC 1700 is Replaced by 6629 an On-line Database", RFC 3232, January 2002. 6631 [RFC3588] Calhoun, P., Loughney, J., Guttman, E., Zorn, G., and J. 6632 Arkko, "Diameter Base Protocol", RFC 3588, September 2003. 6634 [RFC2474] Nichols, K., Blake, S., Baker, F., and D. Black, 6635 "Definition of the Differentiated Services Field (DS 6636 Field) in the IPv4 and IPv6 Headers", RFC 2474, 6637 December 1998. 6639 [RFC2597] Heinanen, J., Baker, F., Weiss, W., and J. Wroclawski, 6640 "Assured Forwarding PHB Group", RFC 2597, June 1999. 6642 [RFC3246] Davie, B., Charny, A., Bennet, J., Benson, K., Le Boudec, 6643 J., Courtney, W., Davari, S., Firoiu, V., and D. 6644 Stiliadis, "An Expedited Forwarding PHB (Per-Hop 6645 Behavior)", RFC 3246, March 2002. 6647 [RFC2782] Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for 6648 specifying the location of services (DNS SRV)", RFC 2782, 6649 February 2000. 6651 [RFC2284] Blunk, L. and J. Vollbrecht, "PPP Extensible 6652 Authentication Protocol (EAP)", RFC 2284, March 1998. 6654 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an 6655 IANA Considerations Section in RFCs", BCP 26, RFC 2434, 6656 October 1998. 6658 [RFC2409] Harkins, D. and D. Carrel, "The Internet Key Exchange 6659 (IKE)", RFC 2409, November 1998. 6661 [RFC3173] Shacham, A., Monsour, B., Pereira, R., and M. Thomas, "IP 6662 Payload Compression Protocol (IPComp)", RFC 3173, 6663 September 2001. 6665 [RFC2407] Piper, D., "The Internet IP Security Domain of 6666 Interpretation for ISAKMP", RFC 2407, November 1998. 6668 [RFC2373] Hinden, R. and S. Deering, "IP Version 6 Addressing 6669 Architecture", RFC 2373, July 1998. 6671 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6672 Requirement Levels", BCP 14, RFC 2119, March 1997. 6674 [RFC4282] Aboba, B., Beadles, M., Arkko, J., and P. Eronen, "The 6675 Network Access Identifier", RFC 4282, December 2005. 6677 [RFC2915] Mealling, M. and R. Daniel, "The Naming Authority Pointer 6678 (NAPTR) DNS Resource Record", RFC 2915, September 2000. 6680 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 6681 A., Peterson, J., Sparks, R., Handley, M., and E. 6682 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 6683 June 2002. 6685 [RFC2960] Stewart, R., Xie, Q., Morneault, K., Sharp, C., 6686 Schwarzbauer, H., Taylor, T., Rytina, I., Kalla, M., 6687 Zhang, L., and V. Paxson, "Stream Control Transmission 6688 Protocol", RFC 2960, October 2000. 6690 [RFC2165] Veizades, J., Guttman, E., Perkins, C., and S. Kaplan, 6691 "Service Location Protocol", RFC 2165, June 1997. 6693 [RFC2030] Mills, D., "Simple Network Time Protocol (SNTP) Version 4 6694 for IPv4, IPv6 and OSI", RFC 2030, October 1996. 6696 [RFC2246] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0", 6697 RFC 2246, January 1999. 6699 [RFC2609] Guttman, E., Perkins, C., and J. Kempf, "Service Templates 6700 and Service: Schemes", RFC 2609, June 1999. 6702 [RFC3436] Jungmaier, A., Rescorla, E., and M. Tuexen, "Transport 6703 Layer Security over Stream Control Transmission Protocol", 6704 RFC 3436, December 2002. 6706 [RFC2396] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 6707 Resource Identifiers (URI): Generic Syntax", RFC 2396, 6708 August 1998. 6710 [RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO 6711 10646", RFC 2279, January 1998. 6713 14.2. Informational References 6715 [RFC2989] Aboba, B., Calhoun, P., Glass, S., Hiller, T., McCann, P., 6716 Shiino, H., Zorn, G., Dommety, G., C.Perkins, B.Patil, 6717 D.Mitton, S.Manning, M.Beadles, P.Walsh, X.Chen, 6718 S.Sivalingham, A.Hameed, M.Munson, S.Jacobs, B.Lim, 6719 B.Hirschman, R.Hsu, Y.Xu, E.Campell, S.Baba, and E.Jaques, 6720 "Criteria for Evaluating AAA Protocols for Network 6721 Access", RFC 2989, November 2000. 6723 [RFC3141] Hiller, T., Walsh, P., Chen, X., Munson, M., Dommety, G., 6724 Sivalingham, S., Lim, B., McCann, P., Shiino, H., 6725 Hirschman, B., Manning, S., Hsu, R., Koo, H., Lipford, M., 6726 Calhoun, P., Lo, C., Jaques, E., Campbell, E., Y.Xu, 6727 S.Baba, T.Ayaki, T.Seki, and A.Hameed, "CDMA2000 Wireless 6728 Data Requirements for AAA", RFC 3141, June 2001. 6730 [RFC2975] Aboba, B., Arkko, J., and D. Harrington, "Introduction to 6731 Accounting Management", RFC 2975, October 2000. 6733 [RFC3576] Chiba, M., Dommety, G., Eklund, M., Mitton, D., and B. 6734 Aboba, "Dynamic Authorization Extensions to Remote 6735 Authentication Dial In User Service (RADIUS)", RFC 3576, 6736 July 2003. 6738 [RFC3344] Perkins, C., "IP Mobility Support for IPv4", RFC 3344, 6739 August 2002. 6741 [RFC2977] Glass, S., Hiller, T., Jacobs, S., and C. Perkins, "Mobile 6742 IP Authentication, Authorization, and Accounting 6743 Requirements", RFC 2977, October 2000. 6745 [RFC2881] Mitton, D. and M. Beadles, "Network Access Server 6746 Requirements Next Generation (NASREQNG) NAS Model", 6747 RFC 2881, July 2000. 6749 [RFC3169] Beadles, M. and D. Mitton, "Criteria for Evaluating 6750 Network Access Server Protocols", RFC 3169, 6751 September 2001. 6753 [RFC1661] Simpson, W., "The Point-to-Point Protocol (PPP)", STD 51, 6754 RFC 1661, July 1994. 6756 [RFC2607] Aboba, B. and J. Vollbrecht, "Proxy Chaining and Policy 6757 Implementation in Roaming", RFC 2607, June 1999. 6759 [RFC2866] Rigney, C., "RADIUS Accounting", RFC 2866, June 2000. 6761 [RFC2869] Rigney, C., Willats, W., and P. Calhoun, "RADIUS 6762 Extensions", RFC 2869, June 2000. 6764 [RFC2865] Rigney, C., Willens, S., Rubens, A., and W. Simpson, 6765 "Remote Authentication Dial In User Service (RADIUS)", 6766 RFC 2865, June 2000. 6768 [RFC3162] Aboba, B., Zorn, G., and D. Mitton, "RADIUS and IPv6", 6769 RFC 3162, August 2001. 6771 [RFC2194] Aboba, B., Lu, J., Alsop, J., Ding, J., and W. Wang, 6772 "Review of Roaming Implementations", RFC 2194, 6773 September 1997. 6775 [RFC2477] Aboba, B. and G. Zorn, "Criteria for Evaluating Roaming 6776 Protocols", RFC 2477, January 1999. 6778 [RFC2401] Kent, S. and R. Atkinson, "Security Architecture for the 6779 Internet Protocol", RFC 2401, November 1998. 6781 [RFC1492] Finseth, C., "An Access Control Protocol, Sometimes Called 6782 TACACS", RFC 1492, July 1993. 6784 [AAACMS] Calhoun, P., Bulley, W., and S. Farrell, "Diameter CMS 6785 Security Application", Work in Progress. 6787 [IANA-EXP] 6788 Narten, T., "Assigning Experimental and Testing Numbers 6789 Considered Useful, Work in Progress.". 6791 Appendix A. Acknowledgements 6793 The authors would like to thank the following people that have 6794 provided proposals and contributions to this document: 6796 To Vishnu Ram and Satendra Gera for their contributions on 6797 Capabilities Updates, Predictive Loop Avoidance as well as many other 6798 technical proposals. To Tolga Asveren for his insights and 6799 contributions on almost all of the proposed solutions incorporated 6800 into this document. To Timothy Smith for helping on the Capabilities 6801 Updates and other topics. To Tony Zhang for providing fixes to loop 6802 holes on composing Failed-AVPs as well as many other issues and 6803 topics. To Jan Nordqvist for clearly stating the usage of 6804 application ids. To Anders Kristensen for providing needed technical 6805 opinions. 6807 Special thanks also to people who have provided invaluable comments 6808 and inputs especially in resolving controversial issues: 6810 Glen Zorn, Yoshihiro Ohba, Marco Stura, and Pasi Eronen. 6812 Finally, we would like to thank the original authors of this 6813 document: 6815 Pat Calhoun, John Loughney, Jari Arkko, Erik Guttman and Glen Zorn. 6817 Their invaluable knowledge and experience has given us a robust and 6818 flexible AAA protocol that many people have seen great value in 6819 adopting. We greatly appreciate their support and stewardship for 6820 the continued improvements of Diameter as a protocol. We would also 6821 like to extend our gratitude to folks aside from the authors who have 6822 assisted and contributed to the original version of this document. 6823 Their efforts significantly contributed to the success of Diameter. 6825 Appendix B. Diameter Service Template 6827 The following service template describes the attributes used by 6828 Diameter servers to advertise themselves. This simplifies the 6829 process of selecting an appropriate server to communicate with. A 6830 Diameter client can request specific Diameter servers based on 6831 characteristics of the Diameter service desired (for example, an AAA 6832 server to use for accounting.) 6834 Name of submitter: "Erik Guttman" Language of 6835 service template: en 6837 Security Considerations: 6839 Diameter clients and servers use various cryptographic mechanisms 6840 to protect communication integrity, confidentiality as well as 6841 perform end-point authentication. It would thus be difficult if 6842 not impossible for an attacker to advertise itself using SLPv2 and 6843 pose as a legitimate Diameter peer without proper preconfigured 6844 secrets or cryptographic keys. Still, as Diameter services are 6845 vital for network operation it is important to use SLPv2 6846 authentication to prevent an attacker from modifying or 6847 eliminating service advertisements for legitimate Diameter 6848 servers. 6850 Template text: 6851 -------------------------template begins here----------------------- 6852 template-type=service:diameter 6854 template-version=0.0 6856 template-description= 6857 The Diameter protocol is defined by RFC 3588. 6859 template-url-syntax= 6860 url-path= ; The Diameter URL format is described in Section 2.9. 6861 ; Example: 'aaa://aaa.example.com:1812;transport=tcp 6862 supported-auth-applications= string L M 6864 # This attribute lists the Diameter applications supported by the 6865 # AAA implementation. The applications currently defined are: 6866 # 6867 # Application Name Defined by 6868 # ---------------- ----------------------------------- 6869 # NASREQ Diameter Network Access Server Application 6870 # MobileIP Diameter Mobile IP Application 6871 # 6872 # Notes: 6873 # . Diameter implementations support one or more applications. 6874 # . Additional applications may be defined in the future. 6875 # An updated service template will be created at that time. 6876 # 6878 NASREQ,MobileIP 6879 supported-acct-applications= string L M 6881 # This attribute lists the Diameter applications supported by the 6882 # AAA implementation. The applications currently defined are: 6883 # Application Name Defined by 6884 # ---------------- ----------------------------------- 6885 # NASREQ Diameter Network Access Server Application 6886 # MobileIP Diameter Mobile IP Application 6887 # 6888 # Notes: 6889 # . Diameter implementations support one or more applications. 6890 # . Additional applications may be defined in the future. 6891 # An updated service template will be created at that time. 6892 # 6893 NASREQ,MobileIP 6894 supported-transports= string L M 6896 SCTP 6897 # This attribute lists the supported transports that the Diameter 6898 # implementation accepts. Note that a compliant Diameter 6899 # implementation MUST support SCTP, though it MAY support other 6900 # transports, too. 6901 SCTP,TCP 6903 -------------------------template ends here----------------------- 6905 Appendix C. NAPTR Example 6907 As an example, consider a client that wishes to resolve aaa:ex.com. 6908 The client performs a NAPTR query for that domain, and the following 6909 NAPTR records are returned: 6911 ;; order pref flags service regexp replacement 6912 IN NAPTR 50 50 "s" "AAA+D2S" "" 6913 _diameter._sctp.example.com IN NAPTR 100 50 "s" "AAA+D2T" 6914 "" _aaa._tcp.example.com 6916 This indicates that the server supports SCTP, and TCP, in that order. 6917 If the client supports over SCTP, SCTP will be used, targeted to a 6918 host determined by an SRV lookup of _diameter._sctp.ex.com. That 6919 lookup would return: 6921 ;; Priority Weight Port Target 6922 IN SRV 0 1 5060 server1.example.com IN SRV 0 6923 2 5060 server2.example.com 6925 Appendix D. Duplicate Detection 6927 As described in Section 9.4, accounting record duplicate detection is 6928 based on session identifiers. Duplicates can appear for various 6929 reasons: 6931 o Failover to an alternate server. Where close to real-time 6932 performance is required, failover thresholds need to be kept low 6933 and this may lead to an increased likelihood of duplicates. 6934 Failover can occur at the client or within Diameter agents. 6936 o Failure of a client or agent after sending of a record from non- 6937 volatile memory, but prior to receipt of an application layer ACK 6938 and deletion of the record. record to be sent. This will result 6939 in retransmission of the record soon after the client or agent has 6940 rebooted. 6942 o Duplicates received from RADIUS gateways. Since the 6943 retransmission behavior of RADIUS is not defined within [RFC2865], 6944 the likelihood of duplication will vary according to the 6945 implementation. 6947 o Implementation problems and misconfiguration. 6949 The T flag is used as an indication of an application layer 6950 retransmission event, e.g., due to failover to an alternate server. 6951 It is defined only for request messages sent by Diameter clients or 6952 agents. For instance, after a reboot, a client may not know whether 6953 it has already tried to send the accounting records in its non- 6954 volatile memory before the reboot occurred. Diameter servers MAY use 6955 the T flag as an aid when processing requests and detecting duplicate 6956 messages. However, servers that do this MUST ensure that duplicates 6957 are found even when the first transmitted request arrives at the 6958 server after the retransmitted request. It can be used only in cases 6959 where no answer has been received from the Server for a request and 6960 the request is sent again, (e.g., due to a failover to an alternate 6961 peer, due to a recovered primary peer or due to a client re-sending a 6962 stored record from non-volatile memory such as after reboot of a 6963 client or agent). 6965 In some cases the Diameter accounting server can delay the duplicate 6966 detection and accounting record processing until a post-processing 6967 phase takes place. At that time records are likely to be sorted 6968 according to the included User-Name and duplicate elimination is easy 6969 in this case. In other situations it may be necessary to perform 6970 real-time duplicate detection, such as when credit limits are imposed 6971 or real-time fraud detection is desired. 6973 In general, only generation of duplicates due to failover or re- 6974 sending of records in non-volatile storage can be reliably detected 6975 by Diameter clients or agents. In such cases the Diameter client or 6976 agents can mark the message as possible duplicate by setting the T 6977 flag. Since the Diameter server is responsible for duplicate 6978 detection, it can choose to make use of the T flag or not, in order 6979 to optimize duplicate detection. Since the T flag does not affect 6980 interoperability, and may not be needed by some servers, generation 6981 of the T flag is REQUIRED for Diameter clients and agents, but MAY be 6982 implemented by Diameter servers. 6984 As an example, it can be usually be assumed that duplicates appear 6985 within a time window of longest recorded network partition or device 6986 fault, perhaps a day. So only records within this time window need 6987 to be looked at in the backward direction. Secondly, hashing 6988 techniques or other schemes, such as the use of the T flag in the 6989 received messages, may be used to eliminate the need to do a full 6990 search even in this set except for rare cases. 6992 The following is an example of how the T flag may be used by the 6993 server to detect duplicate requests. 6995 A Diameter server MAY check the T flag of the received message to 6996 determine if the record is a possible duplicate. If the T flag is 6997 set in the request message, the server searches for a duplicate 6998 within a configurable duplication time window backward and 6999 forward. This limits database searching to those records where 7000 the T flag is set. In a well run network, network partitions and 7001 device faults will presumably be rare events, so this approach 7002 represents a substantial optimization of the duplicate detection 7003 process. During failover, it is possible for the original record 7004 to be received after the T flag marked record, due to differences 7005 in network delays experienced along the path by the original and 7006 duplicate transmissions. The likelihood of this occurring 7007 increases as the failover interval is decreased. In order to be 7008 able to detect out of order duplicates, the Diameter server should 7009 use backward and forward time windows when performing duplicate 7010 checking for the T flag marked request. For example, in order to 7011 allow time for the original record to exit the network and be 7012 recorded by the accounting server, the Diameter server can delay 7013 processing records with the T flag set until a time period 7014 TIME_WAIT + RECORD_PROCESSING_TIME has elapsed after the closing 7015 of the original transport connection. After this time period has 7016 expired, then it may check the T flag marked records against the 7017 database with relative assurance that the original records, if 7018 sent, have been received and recorded. 7020 Authors' Addresses 7022 Victor Fajardo (editor) 7023 Toshiba America Research 7024 One Telcordia Drive, 1S-222 7025 Piscataway, NJ 08854 7026 USA 7028 Phone: 1 908-421-1845 7029 Email: vfajardo@tari.toshiba.com 7031 John Loughney 7032 Nokia Research Center 7033 Itamerenkatu 11-13 7034 Helsinki, 00180 7035 Finland 7037 Phone: +358 50 483 6242 7038 Email: john.loughney@nokia.com 7040 Full Copyright Statement 7042 Copyright (C) The IETF Trust (2007). 7044 This document is subject to the rights, licenses and restrictions 7045 contained in BCP 78, and except as set forth therein, the authors 7046 retain all their rights. 7048 This document and the information contained herein are provided on an 7049 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 7050 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND 7051 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS 7052 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF 7053 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 7054 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 7056 Intellectual Property 7058 The IETF takes no position regarding the validity or scope of any 7059 Intellectual Property Rights or other rights that might be claimed to 7060 pertain to the implementation or use of the technology described in 7061 this document or the extent to which any license under such rights 7062 might or might not be available; nor does it represent that it has 7063 made any independent effort to identify any such rights. Information 7064 on the procedures with respect to rights in RFC documents can be 7065 found in BCP 78 and BCP 79. 7067 Copies of IPR disclosures made to the IETF Secretariat and any 7068 assurances of licenses to be made available, or the result of an 7069 attempt made to obtain a general license or permission for the use of 7070 such proprietary rights by implementers or users of this 7071 specification can be obtained from the IETF on-line IPR repository at 7072 http://www.ietf.org/ipr. 7074 The IETF invites any interested party to bring to its attention any 7075 copyrights, patents or patent applications, or other proprietary 7076 rights that may cover technology that may be required to implement 7077 this standard. Please address the information to the IETF at 7078 ietf-ipr@ietf.org. 7080 Acknowledgment 7082 Funding for the RFC Editor function is provided by the IETF 7083 Administrative Support Activity (IASA).