@@ -812,7 +812,7 @@ static const rdata_t docpath_s4_rdata =
812812
813813// From the draft-ietf-intarea-proxy-config-13 Section-2.1 Discovery via HTTPS/SVCB Records:
814814static const char pvd_s1_text [] =
815- PAD ("pvd-s1. 3600 IN HTTPS 1 . alpn=\"h3,h2\" pvd" );
815+ PAD ("pvd-s1 3600 IN HTTPS 1 . alpn=\"h3,h2\" pvd" );
816816static const rdata_t pvd_s1_rdata =
817817 RDATA (
818818 0x00 , 0x01 , // priority
@@ -822,7 +822,58 @@ static const rdata_t pvd_s1_rdata =
822822 );
823823
824824static const char pvd_f1_text [] =
825- PAD ("pvd-f1. 3600 IN HTTPS 1 . alpn=\"h3,h2\" pvd=\"something\"" );
825+ PAD ("pvd-f1 3600 IN HTTPS 1 . alpn=\"h3,h2\" pvd=\"something\"" );
826+
827+ static const char oots_s1_text [] =
828+ PAD ("oots-s1 300 IN SVCB 1 . oots=\"do53:100,dot:10\"" );
829+
830+ static const rdata_t oots_s1_rdata =
831+ RDATA (
832+ 0x00 , 0x01 , // priority
833+ 0x00 , // target
834+ 0x00 , 0x0c , 0x00 , 0x0b , 0x04 , 'd' , 'o' , '5' , '3' , 100 , 0x03 , 'd' , 'o' , 't' , 10 // outs="do53:100,dot:10"
835+ );
836+
837+ static const char oots_s2_text [] =
838+ PAD ("oots-s2 300 IN SVCB 1 . oots=\"do53:100,dot:5,doq:5\"" );
839+
840+ static const rdata_t oots_s2_rdata =
841+ RDATA (
842+ 0x00 , 0x01 , // priority
843+ 0x00 , // target
844+ 0x00 , 0x0c , 0x00 , 0x10 , 0x04 , 'd' , 'o' , '5' , '3' , 100 , 0x03 , 'd' , 'o' , 't' , 5 , 0x03 , 'd' , 'o' , 'q' , 5 // outs="do53:100,dot:5,doq:5"
845+ );
846+
847+ static const char oots_s3_text [] =
848+ PAD ("oots-s3 300 IN SVCB 1 . oots=\"do53:100,dot:25,doh:10,doq:10\"" );
849+
850+ static const rdata_t oots_s3_rdata =
851+ RDATA (
852+ 0x00 , 0x01 , // priority
853+ 0x00 , // target
854+ 0x00 , 0x0c , 0x00 , 0x15 , 0x04 , 'd' , 'o' , '5' , '3' , 100 , 0x03 , 'd' , 'o' , 't' , 25 , 0x03 , 'd' , 'o' , 'h' , 10 , 0x03 , 'd' , 'o' , 'q' , 10 // outs="do53:100,dot:25,doh:10,doq:10"
855+ );
856+
857+ // Missing percentage
858+ static const char oots_f1_text [] =
859+ PAD ("oots-f1 300 IN SVCB 1 . oots=\"do53:100,dot\"" );
860+
861+ // Missing transport
862+ static const char oots_f2_text [] =
863+ PAD ("oots-f2 300 IN SVCB 1 . oots=\"do53:100,:25\"" );
864+
865+ // Invalid percentage
866+ static const char oots_f3_text [] =
867+ PAD ("oots-f3 300 IN SVCB 1 . oots=\"do53:100,dot:101\"" );
868+
869+ // Invalid percentage
870+ static const char oots_f4_text [] =
871+ PAD ("oots-f4 300 IN SVCB 1 . oots=\"do53:100,dot:25%\"" );
872+
873+ // Duplicate transport
874+ static const char oots_f5_text [] =
875+ PAD ("oots-f5 300 IN SVCB 1 . oots=\"do53:100,dot:25,dot:10\"" );
876+
826877
827878// FIXME: make a test that verifies correct behavior for no-default-alpn="some value"
828879
@@ -924,7 +975,15 @@ static const test_t tests[] = {
924975 { false, ZONE_TYPE_SVCB , 0 , docpath_s3_text , & docpath_s3_rdata },
925976 { false, ZONE_TYPE_SVCB , 0 , docpath_s4_text , & docpath_s4_rdata },
926977 { false, ZONE_TYPE_HTTPS , 0 , pvd_s1_text , & pvd_s1_rdata },
927- { false, ZONE_TYPE_HTTPS , ZONE_SEMANTIC_ERROR , pvd_f1_text , NULL }
978+ { false, ZONE_TYPE_HTTPS , ZONE_SEMANTIC_ERROR , pvd_f1_text , NULL },
979+ { false, ZONE_TYPE_SVCB , 0 , oots_s1_text , & oots_s1_rdata },
980+ { false, ZONE_TYPE_SVCB , 0 , oots_s2_text , & oots_s2_rdata },
981+ { false, ZONE_TYPE_SVCB , 0 , oots_s3_text , & oots_s3_rdata },
982+ { false, ZONE_TYPE_SVCB , ZONE_SYNTAX_ERROR , oots_f1_text , NULL },
983+ { false, ZONE_TYPE_SVCB , ZONE_SYNTAX_ERROR , oots_f2_text , NULL },
984+ { false, ZONE_TYPE_SVCB , ZONE_SYNTAX_ERROR , oots_f3_text , NULL },
985+ { false, ZONE_TYPE_SVCB , ZONE_SYNTAX_ERROR , oots_f4_text , NULL },
986+ { false, ZONE_TYPE_SVCB , ZONE_SEMANTIC_ERROR , oots_f5_text , NULL }
928987};
929988
930989static int32_t add_rr (
@@ -942,15 +1001,30 @@ static int32_t add_rr(
9421001 (void )owner ;
9431002 (void )class ;
9441003 (void )ttl ;
945- if (type != test -> type )
1004+ if (type != test -> type ) {
1005+ fprintf (stderr , "type mismatch\n" );
9461006 return ZONE_SYNTAX_ERROR ;
1007+ }
9471008 if (test -> code != ZONE_SUCCESS )
9481009 return ZONE_SUCCESS ;
9491010 if (rdlength != test -> rdata -> length || !test -> rdata -> octets )
950- return ZONE_SYNTAX_ERROR ;
951- if (memcmp (rdata , test -> rdata -> octets , rdlength ) != 0 )
952- return ZONE_SYNTAX_ERROR ;
953- return ZONE_SUCCESS ;
1011+ fprintf ( stderr , "rdata length did not match %d != %d"
1012+ , (int )rdlength , (int )test -> rdata -> length );
1013+ else if (memcmp (rdata , test -> rdata -> octets , rdlength ) != 0 )
1014+ fprintf (stderr , "rdata bytes did not match" );
1015+ else
1016+ return ZONE_SUCCESS ;
1017+
1018+ size_t i ;
1019+ for (i = 0 ; i < rdlength ; i ++ ) {
1020+ if (i % 16 == 0 )
1021+ fprintf (stderr , "\n" );
1022+ else if (i % 8 == 0 )
1023+ fprintf (stderr , " " );
1024+ fprintf (stderr , " %.2x" , rdata [i ]);
1025+ }
1026+ fprintf (stderr , "\n" );
1027+ return ZONE_SYNTAX_ERROR ;
9541028}
9551029
9561030static uint8_t origin [] =
0 commit comments