Skip to content

Commit 6ae6b6e

Browse files
noladealandekok
authored andcommitted
docs-v4: Intergrity check on condition.adoc - fix syntax, added truth table, wordsmithing
1 parent dad8258 commit 6ae6b6e

7 files changed

Lines changed: 24 additions & 13 deletions

File tree

doc/antora/modules/reference/pages/raddb/mods-config/files/users.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ In general, intermediate relative structural attributes should use `= {}`, as wi
280280

281281
=== Item Operators
282282

283-
The list of comparison operators for check items is given in the xref:reference:unlang/condition/cmp.adoc[conditional comparisons] page. However, the `users` file format does not support casting in a comparison.
283+
The list of comparison operators for check items is given in the xref:reference:unlang/condition/[conditional comparisons] page. However, the `users` file format does not support casting in a comparison.
284284

285285
As a special case for compatibility with previous versions, the `users` file also supports two additional comparison operators:
286286

@@ -346,5 +346,5 @@ bob NAS-IP-Address == 192.0.2.1, Password.Cleartext := "hello"
346346
Framed-IP-Address := request.Framed-IP-Address
347347
----
348348

349-
// Copyright (C) 2023 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
349+
// Copyright (C) 2026 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
350350
// This documentation was developed by Network RADIUS SAS.

doc/antora/modules/reference/pages/unlang/condition/and.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ returns `true` is _condition-2_ evaluated and its result returned.
1717
if (User-Name && EAP-Message) { ...
1818
----
1919

20-
// Copyright (C) 2021 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
20+
// Copyright (C) 2026 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
2121
// This documentation was developed by Network RADIUS SAS.

doc/antora/modules/reference/pages/unlang/condition/cmp.adoc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ The comparison operators are given below.
3232
|=====
3333

3434
The comparison operators perform _type-specific_ comparisons. The
35-
only exceptions are the xref:unlang/condition/regex.adoc[regular expression] operators,
36-
which interpret the `lhs` as a printable string, and the `rhs` as a
35+
only exceptions are the xref:unlang/condition/regex.adoc[regular expression] operators, which interpret the `lhs` as a printable string, and the `rhs` as a
3736
regular expression.
3837

3938
Comparisons can be done across differing data types. Comparng a `uint8` value to an `uint16` value will "just work", as the data types will be automatically converted before any comparison is done.
@@ -108,5 +107,5 @@ strings `00` and `0` are different.
108107

109108
The `<cast>` syntax of version 3 is no longer supported.
110109

111-
// Copyright (C) 2021 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
110+
// Copyright (C) 2026 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
112111
// This documentation was developed by Network RADIUS SAS.

doc/antora/modules/reference/pages/unlang/condition/index.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,5 @@ In general, the following rules apply:
115115

116116
* There is no longer a need to use `%{expr:..}` to do math in conditions. Using the math in-place will work, as with `if (1 + 2 == 3)`. See xref:unlang/condition/expression.adoc[expressions].
117117

118-
// Copyright (C) 2023 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
118+
// Copyright (C) 2026 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
119119
// This documentation was developed by Network RADIUS SAS.

doc/antora/modules/reference/pages/unlang/condition/operands.adoc

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ integer
1111
----
1212

1313
Any text not matching xref:unlang/attr.adoc[Attribute-Name] or a
14-
xref:unlang/condition/return_codes.adoc[return code] is interpreted as a value for a
15-
particular xref:type/index.adoc[data type].
14+
xref:unlang/condition/return_codes.adoc[return code] is interpreted as a value for a particular xref:type/index.adoc[data type].
1615

1716
Double-quoted strings and back-quoted strings are dynamically expanded
1817
before the condition is evaluated. Single-quoted strings are static
@@ -26,12 +25,25 @@ For integer existence checks, `0` is `false`; all other values are `true`.
2625
For string existence checks, an empty string is `false`. All other
2726
strings are `true`.
2827

28+
.Data Types Truthiness
29+
[options=header, cols=autowidth]
30+
|===
31+
| *Type* | *True When*
32+
| Bool | Value is true
33+
| String, octets | Length > 0
34+
| Group | Has at least one element
35+
| Ipv4addr, ipv6addr | Not INADDR_ANY (not 0.0.0.0 / ::)
36+
| Ipv4prefix, ipv6prefix| Not 0.0.0.0/0 or ::/0
37+
| Integers, float32, float64 | Cast to bool is true (non-zero)
38+
| Ifid, ethernet | Cast to bool is true (non-zero)
39+
|===
40+
2941
All other data types are disallowed in existence checks.
3042

3143
.Examples
3244

3345
`"hello there"` +
3446
`5`
3547

36-
// Copyright (C) 2021 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
48+
// Copyright (C) 2026 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
3749
// This documentation was developed by Network RADIUS SAS.

doc/antora/modules/reference/pages/unlang/condition/or.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ is _condition-2_ evaluated and its result returned.
1414
.Examples
1515
[source,unlang]
1616
----
17-
if (User-Name || NAS-IP-Address) { ...
17+
if (User-Name || NAS-IP-Address) { ... }
1818
----
1919

20-
// Copyright (C) 2021 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
20+
// Copyright (C) 2026 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
2121
// This documentation was developed by Network RADIUS SAS.

doc/antora/modules/reference/pages/unlang/condition/regex.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,6 @@ multiple expressions operating on the same subject into a single expression
220220
using the PCRE alternation '|' operator.
221221

222222
// Licenced under CC-by-NC 4.0.
223-
// Copyright (C) 2021 Network RADIUS SAS.
223+
// Copyright (C) 2026 Network RADIUS SAS.
224224
// Copyright (C) 2019 Arran Cudbard-Bell <a.cudbardb@freeradius.org>
225225
// This documentation was developed by Network RADIUS SAS.

0 commit comments

Comments
 (0)