From: Nick Porter Date: Fri, 19 Dec 2025 15:58:28 +0000 (+0000) Subject: Document %ip.v4.netmask() and %ip.v4.broadcast() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a70f018aad0b1ecfbb576147d7a4e2f2e8c850a9;p=thirdparty%2Ffreeradius-server.git Document %ip.v4.netmask() and %ip.v4.broadcast() --- diff --git a/doc/antora/modules/reference/nav.adoc b/doc/antora/modules/reference/nav.adoc index a934a9a767c..1c59aa3d5c9 100644 --- a/doc/antora/modules/reference/nav.adoc +++ b/doc/antora/modules/reference/nav.adoc @@ -119,6 +119,10 @@ **** xref:xlat/time/offset.adoc[UTC Offset] **** xref:xlat/time/request.adoc[Request Time] +*** xref:xlat/ipv4/index.adoc[IPv4 Handling] +**** xref:xlat/ipv4/broadcast.adoc[Broadcast Address] +**** xref:xlat/ipv4/netmask.adoc[Subnet Mask] + ** xref:dictionary/index.adoc[Dictionaries] *** xref:dictionary/alias.adoc[ALIAS] *** xref:dictionary/attribute.adoc[ATTRIBUTE] diff --git a/doc/antora/modules/reference/pages/xlat/all.adoc b/doc/antora/modules/reference/pages/xlat/all.adoc index c8132352389..af9e67359ce 100644 --- a/doc/antora/modules/reference/pages/xlat/all.adoc +++ b/doc/antora/modules/reference/pages/xlat/all.adoc @@ -66,3 +66,13 @@ | xref:xlat/time/offset.adoc[offset] | Return UTC offset. | xref:xlat/time/request.adoc[request] | Return the time when the request was received. |===== + +== IPv4 Handling +.IPv4 handling +[options="header"] +[cols="30%,70%"] +|===== +| *Function* | *Description* +| xref:xlat/ipv4/broadcast.adoc[broadcast] | Get the broadcast address from an IPv4 prefix +| xref:xlat/ipv4/netmask.adoc[netmask] | Get the netmask from an IPv4 prefix +|===== diff --git a/doc/antora/modules/reference/pages/xlat/ipv4/broadcast.adoc b/doc/antora/modules/reference/pages/xlat/ipv4/broadcast.adoc new file mode 100644 index 00000000000..8982a5e75a7 --- /dev/null +++ b/doc/antora/modules/reference/pages/xlat/ipv4/broadcast.adoc @@ -0,0 +1,26 @@ += %ip.v4.broadcast( ) + +Get the broadcast address from an IPv4 prefix. + +.Return: _ipv4_ + +Particularly useful for use when handling DHCPv4 requests, where +`Broadcast-Address` is required in the reply, and the subnet the client is +being placed in is known. + +.Example + +[source,unlang] +---- +Network-Subnet := 192.168.1.0/24 +reply.Broadcast-Address := %ip.v4.broadcast(Network-Subnet) +---- + +.Output + +``` +192.168.1.255 +``` + +// Copyright (C) 2025 Network RADIUS SAS. Licenced under CC-by-NC 4.0. +// This documentation was developed by Network RADIUS SAS. diff --git a/doc/antora/modules/reference/pages/xlat/ipv4/index.adoc b/doc/antora/modules/reference/pages/xlat/ipv4/index.adoc new file mode 100644 index 00000000000..0a4a2bd4b84 --- /dev/null +++ b/doc/antora/modules/reference/pages/xlat/ipv4/index.adoc @@ -0,0 +1,15 @@ += IPv4 handling + +The following functions perform manipulation of IPv4 addresses / subnets. + +.IPv4 handling +[options="header"] +[cols="30%,70%"] +|===== +| *Function* | *Description* +| xref:xlat/ipv4/broadcast.adoc[broadcast] | Get the broadcast address from an IPv4 prefix +| xref:xlat/ipv4/netmask.adoc[netmask] | Get the netmask from an IPv4 prefix +|===== + +// Copyright (C) 2025 Network RADIUS SAS. Licenced under CC-by-NC 4.0. +// This documentation was developed by Network RADIUS SAS. diff --git a/doc/antora/modules/reference/pages/xlat/ipv4/netmask.adoc b/doc/antora/modules/reference/pages/xlat/ipv4/netmask.adoc new file mode 100644 index 00000000000..c9d3d72dce1 --- /dev/null +++ b/doc/antora/modules/reference/pages/xlat/ipv4/netmask.adoc @@ -0,0 +1,26 @@ += %ip.v4.netmask( ) + +Get the netmask from an IPv4 prefix + +.Return: _ipv4_ + +Particularly useful for use when handling DHCPv4 requests, where +`Subnet-Mask` is required in the reply, and the subnet the client is +being placed in is known. + +.Example + +[source,unlang] +---- +Network-Subnet := 192.168.1.0/24 +reply.Subnet-Mask := %ip.v4.netmask(Network-Subnet) +---- + +.Output + +``` +255.255.255.0 +``` + +// Copyright (C) 2025 Network RADIUS SAS. Licenced under CC-by-NC 4.0. +// This documentation was developed by Network RADIUS SAS.