return -1;
}
-#ifdef __clang_analyzer__
- if (!packet_ctx || !packet_ctx->tmp_ctx) return -1;
-#endif
-
FR_PROTO_HEX_DUMP(data, attr_len, "%s", __FUNCTION__ );
FR_PROTO_TRACE("Parent %s len %zu ... %zu", parent->name, attr_len, packet_len);
}
p = buffer;
- }
+
+ } /* else the field is >=0x20, so it's not a tag */
}
if (tag) {
+ /*
+ * The EAP chbind code calls us with a NULL
+ * packet ctx. Which means that we can't decode
+ * tags. Which is OK, because the channel
+ * binding attributes used there don't have tags.
+ */
+ if (!packet_ctx) goto raw;
+
if (!packet_ctx->tags) {
- packet_ctx->tags = talloc_zero_array(packet_ctx->tmp_ctx, fr_radius_tag_ctx_t *, 32);
+ /*
+ * This should NOT be packet_ctx.tmp_ctx,
+ * as that is freed after decoding every
+ * packet. We wish to aggregate the tags
+ * across multiple attributes.
+ */
+ packet_ctx->tags = talloc_zero_array(NULL, fr_radius_tag_ctx_t *, 32);
if (!packet_ctx->tags) {
fr_pair_list_free(&vp);
fr_strerror_printf("%s: Internal sanity check %d", __FUNCTION__, __LINE__);
{
fr_dict_attr_t *raw;
+ if (!packet_ctx) goto raw;
+
/*
* Create an unknown attribute, and decode it as
* "octets". Note that we have to account for
if (!child) goto raw;
raw->flags.is_raw = 1;
+
/*
* "long" extended. Decode the value.
*/
if (!tag) {
vp = fr_pair_afrom_da(ctx, parent);
} else {
+ fr_assert(packet_ctx != NULL);
fr_assert(packet_ctx->tags != NULL);
fr_assert(packet_ctx->tags[tag] != NULL);
vp = fr_pair_afrom_da(packet_ctx->tags[tag]->parent, parent);
return attr_len;
}
+ fr_assert(packet_ctx != NULL);
fr_assert(packet_ctx->tags != NULL);
fr_assert(packet_ctx->tags[tag] != NULL);
fr_cursor_append(&packet_ctx->tags[tag]->cursor, vp);
encode-pair -
match 40 06 01 00 00 01 41 06 01 00 00 01 40 06 02 00 00 01
+#
+# Tags are aggregated across the entire packet, too.
+#
+decode-proto 01 01 00 26 00000000000000000000000000000000 40 06 01 00 00 01 40 06 02 00 00 01 41 06 01 00 00 01
+match Packet-Type = Access-Request, Packet-Authentication-Vector = 0x00000000000000000000000000000000, Tag-1 = { Tunnel-Type = PPTP, Tunnel-Medium-Type = IPv4 }, Tag-2 = { Tunnel-Type = PPTP }
+
+#
+# This currently fails. :(
+#
+#encode-proto -
+#match 01 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+
# Invalid tag on decoding
decode-pair 40 06 20 00 00 01
match raw.Tunnel-Type = 0x20000001
match Tunnel-Client-Endpoint = "\001\002\003"
count
-match 40
+match 42