Control sub-TLV attributes order in rest module

Arran Cudbard-Bell a.cudbardb at freeradius.org
Tue Sep 12 04:44:52 CEST 2017


> On 11 Sep 2017, at 18:02, Avner Elizarov <avnerelizarov at gmail.com> wrote:
> 
> The documentation is quite lacking

That's simply not true.  Every config item is documented other than the TLS ones, which are identical to every other instance to a module acting as a TLS client.

There are big blocks of text with example output and expected responses from the HTTP server (for JSON).

There are tables showing how HTTP codes map to internal rcodes.

> for the rest module, and contains
> features not yet published in version 3 (such as sub attributes).

Where‽ I don't see anything that describes sub-attributes.

In v3.0.x and v4.0.x attributes do not have a nested structure. TLVs are purely for numberspacing, with all attributes sharing a single namespace. If you encode a leaf attribute using the JSON encoder, the JSON won't be structured any differently, you'll just get the name of the attribute.

This may change in two ways in v4.0.x.

1) We're planning on fragmenting the namespace and numberspace of attributes into protocol specific dictionaries.
2) We may add support for structural attributes that can contain other attributes.

> I did try
> many different options but none of them seemed to do the trick.

Post examples of what you tried and debug output.

> When
> sending several instances of the same sub attribute in the json message
> only the last one was parsed by the rest module.

Use the '+=' operator, the documentation clearly says the operator defaults to ':='. Fine... fine that bit isn't super clear. I'll edit the docs to add a note for that.

> Sending each sub attribute
> as a list of values works for parsing them all, but puts them one after the
> other in the radius packet and this is not what I need. I just want a way
> to send the same attribute several times and be able to control their order
> in the resulting radius packet.
> To summarize, I have a tlv with 2 sub attributes (sub1 and sub2). I want to
> send several instances of sub_1 and several instances of sub_2 in a json
> message to the rest module such that the resulting radius packet generated
> from the rest module will contain each instance of sub_attr_2 after its
> matching instance of sub_attr_1.
> 
> I would appreciate a concrete json example :-)

It's not supported.

-Arran
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20170912/a4836e8f/attachment.sig>


More information about the Freeradius-Users mailing list