From ae877423f945fa7b4fb57fed354be51674d8967f Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 14 Nov 2024 15:59:10 +0100 Subject: [PATCH 1/3] Check iana registries for RR types and SvcParamKeys --- scripts/check-RR-types.sh | 40 +++++++++++++++++++++++++++++++++++ scripts/check-SvcParamKeys.sh | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100755 scripts/check-RR-types.sh create mode 100755 scripts/check-SvcParamKeys.sh diff --git a/scripts/check-RR-types.sh b/scripts/check-RR-types.sh new file mode 100755 index 0000000..36cba1f --- /dev/null +++ b/scripts/check-RR-types.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +if [ -e ../include/zone.h ]; then + ZONE_H="../include/zone.h" +elif [ -e include/zone.h ]; then + ZONE_H="include/zone.h" +else + >&2 echo "Could not find zone.h" + exit 1 +fi +TOIMPLEMENT=0 + +TEMPFILE=`mktemp --suffix=.xml` +wget --quiet --output-document $TEMPFILE https://www.iana.org/assignments/dns-parameters/dns-parameters.xml +#TEMPFILE=dns-parameters.xml +RECORDS=`xmlstarlet select --template --match "/_:registry/_:registry[@id='dns-parameters-4']/_:record[((_:value>0 and _:value!=41 and _:value<128) or (_:value>255 and _:value<65535)) and _:type!='Unassigned']" --value-of "_:type" --output "#" --value-of "_:value" --output "#" --value-of "_:xref[last()]/@type" --output "#" --value-of "_:xref[last()]/@data" --output "#" --value-of "_:file[@type='template']" --nl ${TEMPFILE}` +rm ${TEMPFILE} +for RECORD in ${RECORDS} +do + TYPE=`echo ${RECORD} | awk -F# '{ print $1 }'` + VALUE=`echo ${RECORD} | awk -F# '{ print $2 }'` + RECORD_TYPE=`echo ${RECORD} | awk -F# '{ print $3 }'` + RECORD_REF=`echo ${RECORD} | awk -F# '{ print $4 }'` + TEMPLATE=`echo ${RECORD} | awk -F# '{ print $5 }'` + case "${RECORD_TYPE}" in + text) continue;; + rfc) RECORD_REF="https://www.rfc-editor.org/rfc/${RECORD_REF}.html";; + draft) RECORD_REF="https://datatracker.ietf.org/doc/${RECORD_REF}";; + person) RECORD_REF="https://www.iana.org/assignments/dns-parameters/${TEMPLATE}";; + esac + if ! grep -q "^#define ZONE_TYPE_${TYPE} " ${ZONE_H} ; then + echo "${TYPE} ${VALUE} ${RECORD_REF}" + TOIMPLEMENT=`expr ${TOIMPLEMENT} + 1` + fi +done +if [ $TOIMPLEMENT -eq 0 ]; then + echo "All RR types implemented" +fi +exit ${TOIMPLEMENT} + diff --git a/scripts/check-SvcParamKeys.sh b/scripts/check-SvcParamKeys.sh new file mode 100755 index 0000000..1b8b0c0 --- /dev/null +++ b/scripts/check-SvcParamKeys.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +if [ -e ../include/zone.h ]; then + ZONE_H="../include/zone.h" +elif [ -e include/zone.h ]; then + ZONE_H="include/zone.h" +else + >&2 echo "Could not find zone.h" + exit 1 +fi +TOIMPLEMENT=0 + +TEMPFILE=`mktemp --suffix=.xml` +wget --quiet --output-document $TEMPFILE https://www.iana.org/assignments/dns-svcb/dns-svcb.xml +#TEMPFILE=dns-svcb.xml +RECORDS=`xmlstarlet select --template --match "/_:registry/_:registry[@id='dns-svcparamkeys']/_:record[_:value<65280]" --value-of "_:name" --output "#" --value-of "_:value" --output "#" --value-of "_:xref[last()]/@type" --output "#" --value-of "_:xref[last()]/@data" --output "#" --value-of "_:file[@type='template']" --nl ${TEMPFILE}` +rm ${TEMPFILE} +for RECORD in ${RECORDS} +do + NAME=`echo ${RECORD} | awk -F# '{ print $1 }'` + VALUE=`echo ${RECORD} | awk -F# '{ print $2 }'` + RECORD_TYPE=`echo ${RECORD} | awk -F# '{ print $3 }'` + RECORD_REF=`echo ${RECORD} | awk -F# '{ print $4 }'` + case "${RECORD_TYPE}" in + text) continue;; + rfc) RECORD_REF="https://www.rfc-editor.org/rfc/${RECORD_REF}.html";; + draft) RECORD_REF="https://datatracker.ietf.org/doc/${RECORD_REF}";; + esac + MATCH_NAME=`echo $NAME | tr a-z- A-Z_` + if ! grep -q "^#define ZONE_SVC_PARAM_KEY_${MATCH_NAME} " ${ZONE_H} ; then + echo "${NAME} ${VALUE} ${RECORD_REF}" + TOIMPLEMENT=`expr ${TOIMPLEMENT} + 1` + fi +done +if [ $TOIMPLEMENT -eq 0 ]; then + echo "All SvcParamKeys implemented" +fi +exit ${TOIMPLEMENT} + From 69fdf226fe8b10baa579a5605c1ec3f680caabb6 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Fri, 15 Nov 2024 10:05:38 +0100 Subject: [PATCH 2/3] No templates in the SvcParamKeys registry --- scripts/check-SvcParamKeys.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-SvcParamKeys.sh b/scripts/check-SvcParamKeys.sh index 1b8b0c0..1b23117 100755 --- a/scripts/check-SvcParamKeys.sh +++ b/scripts/check-SvcParamKeys.sh @@ -13,7 +13,7 @@ TOIMPLEMENT=0 TEMPFILE=`mktemp --suffix=.xml` wget --quiet --output-document $TEMPFILE https://www.iana.org/assignments/dns-svcb/dns-svcb.xml #TEMPFILE=dns-svcb.xml -RECORDS=`xmlstarlet select --template --match "/_:registry/_:registry[@id='dns-svcparamkeys']/_:record[_:value<65280]" --value-of "_:name" --output "#" --value-of "_:value" --output "#" --value-of "_:xref[last()]/@type" --output "#" --value-of "_:xref[last()]/@data" --output "#" --value-of "_:file[@type='template']" --nl ${TEMPFILE}` +RECORDS=`xmlstarlet select --template --match "/_:registry/_:registry[@id='dns-svcparamkeys']/_:record[_:value<65280]" --value-of "_:name" --output "#" --value-of "_:value" --output "#" --value-of "_:xref[last()]/@type" --output "#" --value-of "_:xref[last()]/@data" --nl ${TEMPFILE}` rm ${TEMPFILE} for RECORD in ${RECORDS} do From 4e84be710a4f3b401efe66587a097dca2e83aa45 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Fri, 15 Nov 2024 10:09:39 +0100 Subject: [PATCH 3/3] Add iana registry checking feature to ChangeLog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 352e84b..1ca66ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - tls-supported-groups SvcParam support +- Check iana registries for unimplemented (new) RR types and SvcParamKeys ## [0.1.1] - 2024-07-19