From: James Jones Date: Thu, 7 Apr 2022 20:33:28 +0000 (-0500) Subject: Convert GeoConf-Option (code 123) to struct, with test (#4450) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f29b89a48413f6f66bf17ce02ea823831f1deff2;p=thirdparty%2Ffreeradius-server.git Convert GeoConf-Option (code 123) to struct, with test (#4450) --- diff --git a/share/dictionary/dhcpv4/dictionary b/share/dictionary/dhcpv4/dictionary index 5152f5974a..3c8eeb5e94 100644 --- a/share/dictionary/dhcpv4/dictionary +++ b/share/dictionary/dhcpv4/dictionary @@ -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 diff --git a/share/dictionary/dhcpv4/dictionary.rfc2131 b/share/dictionary/dhcpv4/dictionary.rfc2131 index ea6dabeaab..ffe21ed026 100644 --- a/share/dictionary/dhcpv4/dictionary.rfc2131 +++ b/share/dictionary/dhcpv4/dictionary.rfc2131 @@ -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 index 0000000000..a2dc64c418 --- /dev/null +++ b/share/dictionary/dhcpv4/dictionary.rfc3825 @@ -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 index 0000000000..e193112080 --- /dev/null +++ b/src/tests/unit/protocols/dhcpv4/rfc3825.txt @@ -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