]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Convert GeoConf-Option (code 123) to struct, with test (#4450)
authorJames Jones <jejones3141@gmail.com>
Thu, 7 Apr 2022 20:33:28 +0000 (15:33 -0500)
committerGitHub <noreply@github.com>
Thu, 7 Apr 2022 20:33:28 +0000 (16:33 -0400)
share/dictionary/dhcpv4/dictionary
share/dictionary/dhcpv4/dictionary.rfc2131
share/dictionary/dhcpv4/dictionary.rfc3825 [new file with mode: 0644]
src/tests/unit/protocols/dhcpv4/rfc3825.txt [new file with mode: 0644]

index 5152f5974a5f2ddae3811d1605cc92bd44cf0913..3c8eeb5e94732b4a0288c2dfb0343e69b01d0009 100644 (file)
@@ -38,6 +38,7 @@ $INCLUDE dictionary.rfc3397
 $INCLUDE dictionary.rfc3442
 $INCLUDE dictionary.rfc3495
 $INCLUDE dictionary.rfc3679
+$INCLUDE dictionary.rfc3825
 $INCLUDE dictionary.rfc3925
 $INCLUDE dictionary.rfc4039
 $INCLUDE dictionary.rfc4280
index ea6dabeaabd516dab1e4db65d21654593a885976..ffe21ed0262582eb137a6dc8fe238046ac67c6d5 100644 (file)
@@ -136,9 +136,6 @@ ATTRIBUTE   IRC-Server-Address                      74      ipaddr array
 ATTRIBUTE      StreetTalk-Server-Address               75      ipaddr array
 ATTRIBUTE      STDA-Server-Address                     76      ipaddr array
 
-# 16 GeoConf Option
-ATTRIBUTE      GeoConf-Option                          123     octets
-
 #ATTRIBUTE     Etherboot                               128     ether
 # (for IP Phone software load)
 
diff --git a/share/dictionary/dhcpv4/dictionary.rfc3825 b/share/dictionary/dhcpv4/dictionary.rfc3825
new file mode 100644 (file)
index 0000000..a2dc64c
--- /dev/null
@@ -0,0 +1,24 @@
+# -*- text -*-
+# Copyright (C) 2022 The FreeRADIUS Server project and contributors
+# This work is licensed under CC-BY version 4.0 https://creativecommons.org/licenses/by/4.0
+# Version $Id$
+##############################################################################
+#
+#  RFC3825 - Dynamic Host Configuration Protocol Option for Coordinate-based
+#            Location Configuration Information
+#  $Id$
+#
+##############################################################################
+
+# 16 GeoConf Option
+ATTRIBUTE       GeoConf-Option                          123     struct
+MEMBER          LaRes                           bit[6]
+MEMBER          Latitude                        bit[34] # 9 bits before, 25 after radix point
+MEMBER          LoRes                           bit[6]
+MEMBER          Longitude                       bit[34] # 9 bits before, 25 after radix point
+MEMBER          AT                              bit[4]
+VALUE           AT                      Meters  1
+VALUE           AT                      Floors  2
+MEMBER          AltRes                          bit[6]
+MEMBER          Altitude                        bit[30] # 22 bits before, 8 after radix point
+MEMBER          Datum                           uint8
diff --git a/src/tests/unit/protocols/dhcpv4/rfc3825.txt b/src/tests/unit/protocols/dhcpv4/rfc3825.txt
new file mode 100644 (file)
index 0000000..e193112
--- /dev/null
@@ -0,0 +1,15 @@
+#
+#  Test vectors for DHCP attributes
+#
+proto dhcpv4
+proto-dictionary dhcpv4
+fuzzer-out dhcpv4
+
+encode-pair GeoConf-Option = { LaRes = 20, Latitude = 1395556352, LoRes = 20, Longitude = 3140812800, AT = Meters, AltRes = 20, Altitude = 384, Datum = 2 }
+match 7b 10 50 53 2e 80 00 50 bb 35 00 00 15 00 00 01 80 02
+
+decode-pair -
+match GeoConf-Option = { LaRes = 20, Latitude = 1395556352, LoRes = 20, Longitude = 3140812800, AT = Meters, AltRes = 20, Altitude = 384, Datum = 2 }
+
+count
+match 7