Commit f44a1c13 authored by Daniel Salzman's avatar Daniel Salzman

zscanner: add URI and CAA record types support

parent 3eb7278c
This diff is collapsed.
This diff is collapsed.
/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -1307,6 +1307,8 @@
| "LP"i %{ type_num(KNOT_RRTYPE_LP, &rdata_tail); }
| "EUI48"i %{ type_num(KNOT_RRTYPE_EUI48, &rdata_tail); }
| "EUI64"i %{ type_num(KNOT_RRTYPE_EUI64, &rdata_tail); }
| "URI"i %{ type_num(KNOT_RRTYPE_URI, &rdata_tail); }
| "CAA"i %{ type_num(KNOT_RRTYPE_CAA, &rdata_tail); }
| "TYPE"i . num16 # TYPE0-TYPE65535.
) $!_type_error;
# END
......@@ -1365,6 +1367,8 @@
| "LP"i %{ window_add_bit(KNOT_RRTYPE_LP, s); }
| "EUI48"i %{ window_add_bit(KNOT_RRTYPE_EUI48, s); }
| "EUI64"i %{ window_add_bit(KNOT_RRTYPE_EUI64, s); }
| "URI"i %{ window_add_bit(KNOT_RRTYPE_URI, s); }
| "CAA"i %{ window_add_bit(KNOT_RRTYPE_CAA, s); }
| "TYPE"i . type_bitmap # TYPE0-TYPE65535.
);
......@@ -1803,6 +1807,14 @@
(eui64)
$!_r_data_error %_ret . all_wchar;
r_data_uri :=
(num16 . sep . num16 . sep . text)
$!_r_data_error %_ret . all_wchar;
r_data_caa :=
(num8 . sep . text_string . sep . text)
$!_r_data_error %_ret . all_wchar;
action _text_r_data {
fhold;
switch (s->r_type) {
......@@ -1873,6 +1885,10 @@
fcall r_data_eui48;
case KNOT_RRTYPE_EUI64:
fcall r_data_eui64;
case KNOT_RRTYPE_URI:
fcall r_data_uri;
case KNOT_RRTYPE_CAA:
fcall r_data_caa;
default:
WARN(ZS_CANNOT_TEXT_DATA);
fgoto err_line;
......@@ -1920,6 +1936,8 @@
case KNOT_RRTYPE_LP:
case KNOT_RRTYPE_EUI48:
case KNOT_RRTYPE_EUI64:
case KNOT_RRTYPE_URI:
case KNOT_RRTYPE_CAA:
fcall nonempty_hex_r_data;
// Next types can have empty rdata.
case KNOT_RRTYPE_APL:
......@@ -1984,6 +2002,8 @@
| "LP"i %{ s->r_type = KNOT_RRTYPE_LP; }
| "EUI48"i %{ s->r_type = KNOT_RRTYPE_EUI48; }
| "EUI64"i %{ s->r_type = KNOT_RRTYPE_EUI64; }
| "URI"i %{ s->r_type = KNOT_RRTYPE_URI; }
| "CAA"i %{ s->r_type = KNOT_RRTYPE_CAA; }
| "TYPE"i . type_number
) $!_r_type_error;
# END
......
......@@ -71,3 +71,5 @@
48_LP
49_CDS
50_CDNSKEY
51_URI
52_CAA
$ORIGIN .
$TTL 1
; OK
@ URI 0 0 a ; The simplest variant
@ URI 65535 65535 ftp://a ; Maximal priority and weight
@ URI 0 0 "ftp://a" ; Quoted target
@ URI 0 0 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 ; Target longer than 255
@ TYPE256 \# 5 0000000061 ; TYPE + Hexadecimal rdata
@ TYPE256 0 0 a ; TYPE
@ uri 0 0 a ; Type in lower-case
; OK extensions
@ URI 0 0 "" ; Empty target
; KO
@ URI
@ URI ; Empty rdata
@ URI \# 0 ; Hex empty rdata
@ URI 65536 0 a ; Priority overflow
@ URI 0 65536 a ; Weight overflow
@ URI 0 0 a a ; Unexpected item
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0100
RDATA=0000000061
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0100
RDATA=FFFFFFFF6674703A2F2F61
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0100
RDATA=000000006674703A2F2F61
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0100
RDATA=00000000303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0100
RDATA=0000000061
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0100
RDATA=0000000061
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0100
RDATA=0000000061
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0100
RDATA=00000000
------
WARNG=ZS_BAD_NUMBER
------
WARNG=ZS_BAD_NUMBER
------
WARNG=ZS_BAD_HEX_CHAR
------
WARNG=ZS_NUMBER16_OVERFLOW
------
WARNG=ZS_NUMBER16_OVERFLOW
------
WARNG=ZS_BAD_REST
------
$ORIGIN .
$TTL 1
; OK
@ CAA 0 a a ; The simplest variant
@ CAA 255 a a ; Maximal flags
@ CAA 0 a "a ; b" ; Quoted value
@ CAA 0 a 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 ; Value longer than 255
@ TYPE257 \# 4 00016161 ; TYPE + Hexadecimal rdata
@ TYPE257 0 a a ; TYPE
@ caa 0 a a ; Type in lower-case
; OK fallbacks and extensions
@ CAA 0 "" a ; Empty tag
@ CAA 0 "a" a ; Quoted tag
@ CAA 0 abcdefghijklmnopqrstuvwxyz0123456789 a ; All allowed characters, longer than 15
; KO
@ CAA
@ CAA ; Empty rdata
@ CAA \# 0 ; Hex empty rdata
@ CAA 256 a a ; Flags overflow
@ CAA 0 a a a ; Unexpected item
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0101
RDATA=00016161
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0101
RDATA=FF016161
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0101
RDATA=00016161203B2062
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0101
RDATA=000161303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0101
RDATA=00016161
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0101
RDATA=00016161
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0101
RDATA=00016161
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0101
RDATA=000061
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0101
RDATA=00016161
------
OWNER=00
CLASS=0001
RRTTL=00000001
RTYPE=0101
RDATA=00246162636465666768696A6B6C6D6E6F707172737475767778797A3031323334353637383961
------
WARNG=ZS_BAD_NUMBER
------
WARNG=ZS_BAD_NUMBER
------
WARNG=ZS_BAD_HEX_CHAR
------
WARNG=ZS_NUMBER8_OVERFLOW
------
WARNG=ZS_BAD_REST
------
......@@ -11,7 +11,7 @@ TMPDIR=$(test_tmpdir)
TESTS_DIR="$SOURCE"/data
ZSCANNER_TOOL="$BUILD"/zscanner-tool
plan 73
plan 75
mkdir -p "$TMPDIR"/includes/
for a in 1 2 3 4 5 6; do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment