Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check iana registries for RR types and SvcParamKeys #238

Merged
merged 3 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions scripts/check-RR-types.sh
Original file line number Diff line number Diff line change
@@ -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}

39 changes: 39 additions & 0 deletions scripts/check-SvcParamKeys.sh
Original file line number Diff line number Diff line change
@@ -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}`
wtoorop marked this conversation as resolved.
Show resolved Hide resolved
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}

Loading