#define fr_dict_attr_is_key_field(_da) ((_da)->flags.extra && ((_da)->flags.subtype == FLAG_KEY_FIELD))
#define da_is_bit_field(_da) ((_da)->flags.extra && ((_da)->flags.subtype == FLAG_BIT_FIELD))
#define da_is_length_field(_da) ((_da)->flags.extra && (((_da)->flags.subtype == FLAG_LENGTH_UINT8) || ((_da)->flags.subtype == FLAG_LENGTH_UINT16)))
+#define da_length_offset(_da) ((_da)->flags.type_size)
/** Extension identifier
struct_len |= p[1];
}
- if (struct_len < parent->flags.type_size) {
+ if (struct_len < da_length_offset(parent)) {
FR_PROTO_TRACE("Length header (%zu) is smaller than minimum value (%u)",
struct_len, parent->flags.type_size);
goto unknown;
}
- if ((p + struct_len + need - parent->flags.type_size) > end) {
+ if ((p + struct_len + need - da_length_offset(parent)) > end) {
FR_PROTO_TRACE("Length header (%zu) is larger than remaining data (%zu)",
struct_len + need, (end - p));
goto unknown;
if (parent->flags.subtype == FLAG_LENGTH_UINT8) {
length -= 1;
- length += parent->flags.type_size;
+ length += da_length_offset(parent);
if (length > UINT8_MAX) return -1;
} else {
length -= 2;
- length += parent->flags.type_size;
+ length += da_length_offset(parent);
if (length > UINT16_MAX) return -1;