skip to content

Attribute-Value Pairs

How attribute-value pairs carry User-Name, Framed-IP-Address, Session-Timeout and the rest, and how vendor-specific attributes extend the set. Asked because authorization policy lives in attributes.

on this pageshow

questions

6

How is a single RADIUS attribute-value pair encoded, and how long can its value be?

level: middleimportance: must knowfreq 58%

answer

  1. three fields, always the same three
  2. the length counts itself
  3. one octet caps the whole attribute
  4. 255 minus the two header octets
  5. no generic fragmentation in the base format

basics

~20 s

A RADIUS attribute is a type-length-value triple: a one-octet Type, a one-octet Length counting the whole attribute, then the value. Length maxes out at 255, so one attribute carries at most 253 octets of value.

solid answer

~40 s

Every RADIUS attribute has the same three fields: a one-octet `Type`, a one-octet `Length`, then the value. `Length` counts all three parts, so an attribute holding a four-octet integer such as `Session-Timeout` (27) has `Length` 6. Because `Length` is one octet its maximum is 255, which leaves at most **253 octets of value**. There is no general fragmentation in the base format: whether repeating an attribute means concatenation, a list, or an error is defined attribute by attribute, and RFC 6929's long extended types were added precisely to give the protocol a generic way to carry more. The packet as a whole is capped at 4096 octets, which is the other ceiling on how much can be said in one exchange.

code

pseudocode · 17 lines
pseudocode
attribute layout:
  Type   : 1 octet
  Length : 1 octet     # counts Type + Length + Value
  Value  : Length - 2 octets

Session-Timeout (27) carrying 3600 seconds:
  Type   = 27
  Length = 6           # 2 header octets + 4 value octets
  Value  = 00 00 0E 10

walking the attribute list:
  offset = start of attributes
  while offset < end of packet:
      type   = octet at offset
      length = octet at offset + 1
      value  = octets at offset + 2 .. offset + length - 1
      offset = offset + length

go deeper

for a junior

Remember the three fields and that the length includes its own two header octets. Being able to say why a four-octet integer produces a length of 6 is the check most interviewers use here.

for a middle

Derive the 253-octet ceiling rather than reciting it, and explain what the encoding does not provide: no generic fragmentation, no self-describing value type, no continuation bit in the base format.

for a senior

Demonstrate the failure mode: a misread length steps a parser to the wrong offset and corrupts every later attribute, and a value silently truncated at 253 octets produces a session that looks configured but behaves wrongly.

for a principal

The judgment call is whether to carry long or structured values in a protocol whose value field is bounded by a one-octet length at all, versus keeping replies to short references the access device resolves locally.

## Three fields, always the same three RADIUS is an unusually plain protocol on the wire. After the header, a packet is nothing but a sequence of attributes laid end to end, and every attribute — standard, vendor-defined, one octet long or two hundred — has the same shape: 1. **`Type`** — one octet. The number that says which attribute this is. `User-Name` is 1, `Filter-Id` is 11, `Vendor-Specific` is 26, `Session-Timeout` is 27. 2. **`Length`** — one octet. The size of the **whole attribute**, including the `Type` and `Length` octets themselves. 3. **`Value`** — `Length` minus 2 octets, interpreted according to what that attribute is defined to hold. Because `Length` is self-inclusive, the arithmetic goes the other way from what people expect. An attribute carrying a four-octet integer has `Length` 6, not 4. An attribute whose value is the ten characters `tier-basic` has `Length` 12. Reading `Length` as "how much value follows" is the single most common decoding error, and it desynchronises the parse of every attribute after it, because the reader steps to the wrong offset for the next `Type`. ## Where 253 comes from A one-octet `Length` can express at most 255. Two of those octets are the header, so: | | Octets | |---|---| | Maximum `Length` value | 255 | | `Type` + `Length` overhead | 2 | | **Maximum value in one attribute** | **253** | That number is worth committing to memory, because it is the boundary every interesting encoding decision on this protocol runs into. It is also *per attribute*: the packet has its own ceiling of 4096 octets, so a reply full of long attributes meets the packet limit long before it runs out of attribute slots. The value itself is typed by the attribute's definition rather than by anything on the wire. Integers such as `Session-Timeout` (27) are four octets; an address such as `NAS-IP-Address` (4) is four octets; text such as `Filter-Id` (11) is a run of characters with no terminator, its extent given entirely by `Length`. RFC 8044 later wrote these data types down formally, but nothing in the encoding announces them — a receiver knows a value is an integer because it knows what type 27 is. ## What happens when a value does not fit Here the honest answer is narrower than the intuitive one. **The base format has no general fragmentation.** There is no continuation bit, no sequence number, and no rule that a receiver may glue two instances of an attribute together. What the specification does say is that when an attribute may appear more than once, the **order of like attributes must be preserved**; what those repeated instances *mean* is left to the attribute's own definition. Some are defined so that repeated instances concatenate; some are defined as a list of independent values; for some, a second instance is simply an error. So a value longer than 253 octets has three honest answers, and "RADIUS splits it automatically" is not one of them: - The attribute's own definition provides a multi-instance rule, and both ends implement exactly that rule. - The value is carried under `Vendor-Specific` (26) in a private shape both ends already agree on. - The deployment uses RFC 6929's **long extended types**, which add a `Flags` octet with a *More* bit and so give the protocol a generic, attribute-independent way to spread one value across several attributes. ## Why the shape is worth knowing On a ship's passenger wireless network, the reply that turns an accepted login into a usable session is a handful of these triples: an address, a filter name, a time limit. Each one is three fields, and the whole session profile is often under fifty octets. The shape only becomes visible when something outgrows it — a filter name longer than 253 characters, a vendor payload that must be chunked — and at that point the difference between "the protocol will handle it" and "the attribute definition must handle it" is the difference between a working deployment and a truncated value nobody notices until a session behaves oddly.

  • A RADIUS attribute carries a four-octet integer. Why is its Length field 6 rather than 4?
    Because `Length` measures the whole attribute, not just the value. Two octets go on `Type` and `Length` themselves, so four octets of integer make six in total. A receiver uses that number to step to the next attribute, which is why misreading it as the value size derails the parse of everything after it.
  • Two instances of the same RADIUS attribute arrive in one packet — what may a receiver assume?
    Only what that attribute's own definition says. RADIUS requires the order of like attributes to be preserved, but it defines no generic meaning for repetition: some attributes are defined to concatenate, some to form a list, and for others a second instance is an error. Assuming automatic reassembly is the classic mistake.

saying these in an interview costs you the question

  • Says the Length field counts only the value octets.
  • Claims a single attribute can carry 255 octets of value.
  • Believes RADIUS reassembles any long value split across attributes.
  • Confuses the 4096-octet packet cap with the per-attribute limit.
  • Thinks the wire announces whether a value is text or an integer.
open as a page

How does Vendor-Specific (26) let a RADIUS deployment carry an attribute the standard set lacks?

level: middleimportance: must knowfreq 52%

basics

~20 s

Vendor-Specific (26) is the standard's escape hatch: its value opens with a four-octet Vendor-Id holding an SMI Network Management Private Enterprise Code, followed by an opaque String the vendor defines. A receiver that cannot interpret it must ignore it.

open as a page

In a RADIUS Access-Request, which attributes tell the server where and how a user is connecting?

level: juniorimportance: should knowfreq 42%

basics

~20 s

A RADIUS Access-Request carries the attempt's circumstances as attributes: User-Name (1) claims the account, Calling-Station-Id (31) names the connecting device, Called-Station-Id (30) the end it reached, and NAS-IP-Address (4), NAS-Port (5) and NAS-Port-Type (61) the access device and its medium.

open as a page

In a RADIUS Access-Accept, which attribute caps total session time and which caps idle time?

level: middleimportance: should knowfreq 45%

basics

~10 s

Session-Timeout (27) caps the total seconds of service; Idle-Timeout (28) caps consecutive idle seconds. Both are four-octet integers in an Access-Accept, and the network access server enforces them, not the RADIUS server.

open as a page

Why did RFC 6929 add Extended-Type-1 (241) and Long-Extended-Type-1 (245) to RADIUS attribute encoding?

level: seniorimportance: should knowfreq 30%

basics

~20 s

The one-octet Type field ran out of numbers. RFC 6929 spends a type on a second level: Extended-Type-1 (241) adds an Extended-Type octet opening a fresh value space, and Long-Extended-Type-1 (245) adds a Flags octet whose More bit lets one value span several attributes.

open as a page

In a tagged RADIUS attribute such as Tunnel-Private-Group-ID (81), how does a receiver tell a Tag from the value?

level: seniorimportance: nice to knowfreq 26%

basics

~20 s

Tagged tunnel attributes reserve the value's first octet as a Tag grouping attributes that describe the same tunnel. In a text value an octet of 0x01 to 0x1F is read as the Tag; anything larger is the first character of the text.

open as a page