iPXE
dns_test.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2014 Michael Brown <mbrown@fensystems.co.uk>.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301, USA.
00018  *
00019  * You can also choose to distribute this program under the terms of
00020  * the Unmodified Binary Distribution Licence (as given in the file
00021  * COPYING.UBDL), provided that you have satisfied its requirements.
00022  */
00023 
00024 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00025 
00026 /** @file
00027  *
00028  * DNS self-tests
00029  *
00030  */
00031 
00032 /* Forcibly enable assertions */
00033 #undef NDEBUG
00034 
00035 #include <string.h>
00036 #include <assert.h>
00037 #include <ipxe/dns.h>
00038 #include <ipxe/test.h>
00039 
00040 /** Define inline data */
00041 #define DATA(...) { __VA_ARGS__ }
00042 
00043 /** A DNS encoding test */
00044 struct dns_encode_test {
00045         /** String */
00046         const char *string;
00047         /** Encoded string */
00048         const void *data;
00049         /** Length of encoded string */
00050         int len;
00051 };
00052 
00053 /**
00054  * Define a DNS encoding test
00055  *
00056  * @v _name             Test name
00057  * @v _string           Test string
00058  * @v _data             Expected encoded data
00059  * @ret test            DNS encoding test
00060  */
00061 #define DNS_ENCODE( _name, _string, _data )                             \
00062         static const uint8_t _name ## __data[] = _data;                 \
00063         static struct dns_encode_test _name = {                         \
00064                 .string = _string,                                      \
00065                 .data = _name ## __data,                                \
00066                 .len = sizeof ( _name ## __data ),                      \
00067         }
00068 
00069 /**
00070  * Report DNS encoding test result
00071  *
00072  * @v test              DNS encoding test
00073  * @v file              Test code file
00074  * @v line              Test code line
00075  */
00076 static void dns_encode_okx ( struct dns_encode_test *test, const char *file,
00077                              unsigned int line ) {
00078         uint8_t data[ test->len ];
00079         struct dns_name name;
00080         int len;
00081 
00082         /* Check ability to determine length with no buffer */
00083         memset ( &name, 0, sizeof ( name ) );
00084         len = dns_encode ( test->string, &name );
00085         okx ( len >= 0, file, line );
00086         okx ( len == test->len, file, line );
00087 
00088         /* Check encoded name */
00089         name.data = data;
00090         name.len = sizeof ( data );
00091         len = dns_encode ( test->string, &name );
00092         okx ( len >= 0, file, line );
00093         if ( len >= 0 ) {
00094                 okx ( len == test->len, file, line );
00095                 okx ( memcmp ( data, test->data, test->len ) == 0, file, line );
00096                 DBGC ( test, "DNS encoded \"%s\" to:\n", test->string );
00097                 DBGC_HDA ( test, 0, data, len );
00098         }
00099 }
00100 #define dns_encode_ok( test ) dns_encode_okx ( test, __FILE__, __LINE__ )
00101 
00102 /**
00103  * Report DNS encoding failure test result
00104  *
00105  * @v test              DNS encoding test
00106  * @v file              Test code file
00107  * @v line              Test code line
00108  */
00109 static void dns_encode_fail_okx ( struct dns_encode_test *test,
00110                                   const char *file, unsigned int line ) {
00111         struct dns_name name = { .data = NULL, .len = 0 };
00112         int len;
00113 
00114         len = dns_encode ( test->string, &name );
00115         okx ( len < 0, file, line );
00116 }
00117 #define dns_encode_fail_ok( test ) \
00118         dns_encode_fail_okx ( test, __FILE__, __LINE__ )
00119 
00120 /** A DNS decoding test */
00121 struct dns_decode_test {
00122         /** Name */
00123         struct dns_name name;
00124         /** Expected string */
00125         const char *string;
00126 };
00127 
00128 /**
00129  * Define a DNS decoding test
00130  *
00131  * @v _name             Test name
00132  * @v _data             RFC1035-encoded data
00133  * @v _offset           Starting offset within encoded data
00134  * @v _string           Expected decoded string
00135  * @ret test            DNS decoding test
00136  */
00137 #define DNS_DECODE( _name, _data, _offset, _string )                    \
00138         static uint8_t _name ## __data[] = _data;                       \
00139         static struct dns_decode_test _name = {                         \
00140                 .name = {                                               \
00141                         .data = _name ## __data,                        \
00142                         .offset = _offset,                              \
00143                         .len = sizeof ( _name ## __data ),              \
00144                 },                                                      \
00145                 .string = _string,                                      \
00146         }
00147 
00148 /**
00149  * Report DNS decoding test result
00150  *
00151  * @v test              DNS decoding test
00152  * @v file              Test code file
00153  * @v line              Test code line
00154  */
00155 static void dns_decode_okx ( struct dns_decode_test *test, const char *file,
00156                              unsigned int line ) {
00157         char string[ strlen ( test->string ) + 1 /* NUL */ ];
00158         int len;
00159 
00160         /* Check ability to determine length with no buffer */
00161         len = dns_decode ( &test->name, NULL, 0 );
00162         okx ( len >= 0, file, line );
00163         okx ( len == ( ( int ) strlen ( test->string ) ), file, line );
00164 
00165         /* Check decoded string */
00166         len = dns_decode ( &test->name, string, sizeof ( string ) );
00167         okx ( len >= 0, file, line );
00168         if ( len >= 0 ) {
00169                 okx ( strcmp ( string, test->string ) == 0, file, line );
00170                 DBGC ( test, "DNS decoded \"%s\" from offset %#zx in:\n",
00171                        string, test->name.offset );
00172                 DBGC_HDA ( test, 0, test->name.data, test->name.len );
00173         }
00174 }
00175 #define dns_decode_ok( test ) dns_decode_okx ( test, __FILE__, __LINE__ )
00176 
00177 /**
00178  * Report DNS decoding failure test result
00179  *
00180  * @v test              DNS decoding test
00181  * @v file              Test code file
00182  * @v line              Test code line
00183  */
00184 static void dns_decode_fail_okx ( struct dns_decode_test *test,
00185                                   const char *file, unsigned int line ) {
00186         int len;
00187 
00188         len = dns_decode ( &test->name, NULL, 0 );
00189         okx ( len < 0, file, line );
00190 }
00191 #define dns_decode_fail_ok( test ) \
00192         dns_decode_fail_okx ( test, __FILE__, __LINE__ )
00193 
00194 /** A DNS comparison test */
00195 struct dns_compare_test {
00196         /** First name */
00197         struct dns_name first;
00198         /** Second name */
00199         struct dns_name second;
00200 };
00201 
00202 /**
00203  * Define a DNS comparison test
00204  *
00205  * @v _name             Test name
00206  * @v _first_data       First RFC1035-encoded data
00207  * @v _first_offset     Starting offset within first encoded data
00208  * @v _second_data      Second RFC1035-encoded data
00209  * @v _second_offset    Starting offset within second encoded data
00210  * @ret test            DNS comparison test
00211  */
00212 #define DNS_COMPARE( _name, _first_data, _first_offset, _second_data,   \
00213                      _second_offset )                                   \
00214         static uint8_t _name ## __first_data[] = _first_data;           \
00215         static uint8_t _name ## __second_data[] = _second_data;         \
00216         static struct dns_compare_test _name = {                        \
00217                 .first = {                                              \
00218                         .data = _name ## __first_data,                  \
00219                         .offset = _first_offset,                        \
00220                         .len = sizeof ( _name ## __first_data ),        \
00221                 },                                                      \
00222                 .second = {                                             \
00223                         .data = _name ## __second_data,                 \
00224                         .offset = _second_offset,                       \
00225                         .len = sizeof ( _name ## __second_data ),       \
00226                 },                                                      \
00227         }
00228 
00229 /**
00230  * Report DNS comparison test result
00231  *
00232  * @v test              DNS comparison test
00233  * @v file              Test code file
00234  * @v line              Test code line
00235  */
00236 static void dns_compare_okx ( struct dns_compare_test *test, const char *file,
00237                               unsigned int line ) {
00238 
00239         okx ( dns_compare ( &test->first, &test->second ) == 0, file, line );
00240 }
00241 #define dns_compare_ok( test ) dns_compare_okx ( test, __FILE__, __LINE__ )
00242 
00243 /**
00244  * Report DNS comparison test failure result
00245  *
00246  * @v test              DNS comparison test
00247  * @v file              Test code file
00248  * @v line              Test code line
00249  */
00250 static void dns_compare_fail_okx ( struct dns_compare_test *test,
00251                                    const char *file, unsigned int line ) {
00252 
00253         okx ( dns_compare ( &test->first, &test->second ) != 0, file, line );
00254 }
00255 #define dns_compare_fail_ok( test ) \
00256         dns_compare_fail_okx ( test, __FILE__, __LINE__ )
00257 
00258 /** A DNS copying test */
00259 struct dns_copy_test {
00260         /** Source name */
00261         struct dns_name src;
00262         /** Expected copied name */
00263         struct dns_name dst;
00264 };
00265 
00266 /**
00267  * Define a DNS copying test
00268  *
00269  * @v _name             Test name
00270  * @v _src_data         Source RFC1035-encoded data
00271  * @v _src_offset       Starting offset within source encoded data
00272  * @v _dst_data         Expected copied RFC1035-encoded data
00273  * @v _dst_offset       Starting offset withint copied encoded data
00274  * @ret test            DNS copying test
00275  */
00276 #define DNS_COPY( _name, _src_data, _src_offset, _dst_data,             \
00277                   _dst_offset )                                         \
00278         static uint8_t _name ## __src_data[] = _src_data;               \
00279         static uint8_t _name ## __dst_data[] = _dst_data;               \
00280         static struct dns_copy_test _name = {                           \
00281                 .src = {                                                \
00282                         .data = _name ## __src_data,                    \
00283                         .offset = _src_offset,                          \
00284                         .len = sizeof ( _name ## __src_data ),          \
00285                 },                                                      \
00286                 .dst = {                                                \
00287                         .data = _name ## __dst_data,                    \
00288                         .offset = _dst_offset,                          \
00289                         .len = sizeof ( _name ## __dst_data ),          \
00290                 },                                                      \
00291         }
00292 
00293 /**
00294  * Report a DNS copying test result
00295  *
00296  * @v test              DNS copying test
00297  * @v file              Test code file
00298  * @v line              Test code line
00299  */
00300 static void dns_copy_okx ( struct dns_copy_test *test,
00301                            const char *file, unsigned int line ) {
00302         uint8_t data[ test->dst.len ];
00303         struct dns_name dst;
00304         int len;
00305 
00306         /* Check ability to determine length with no buffer */
00307         memset ( &dst, 0, sizeof ( dst ) );
00308         len = dns_copy ( &test->src, &dst );
00309         okx ( len >= 0, file, line );
00310         okx ( len == ( ( int ) ( test->dst.len - test->dst.offset ) ),
00311               file, line );
00312 
00313         /* Check copied name */
00314         dst.data = data;
00315         dst.offset = test->dst.offset;
00316         dst.len = sizeof ( data );
00317         memcpy ( dst.data, test->dst.data, test->dst.offset );
00318         len = dns_copy ( &test->src, &dst );
00319         okx ( len >= 0, file, line );
00320         okx ( len == ( ( int ) ( test->dst.len - test->dst.offset ) ),
00321               file, line );
00322         okx ( memcmp ( data, test->dst.data, sizeof ( data ) ) == 0,
00323               file, line );
00324         DBGC ( test, "DNS copied:\n" );
00325         DBGC_HDA ( test, 0, test->src.data, test->src.len );
00326         DBGC_HDA ( test, 0, data, ( test->dst.offset + len ) );
00327 }
00328 #define dns_copy_ok( test ) dns_copy_okx ( test, __FILE__, __LINE__ )
00329 
00330 /**
00331  * Report a DNS copying failure test result
00332  *
00333  * @v test              DNS copying test
00334  * @v file              Test code file
00335  * @v line              Test code line
00336  */
00337 static void dns_copy_fail_okx ( struct dns_copy_test *test,
00338                                 const char *file, unsigned int line ) {
00339         struct dns_name dst;
00340         int len;
00341 
00342         memset ( &dst, 0, sizeof ( dst ) );
00343         len = dns_copy ( &test->src, &dst );
00344         okx ( len < 0, file, line );
00345 }
00346 #define dns_copy_fail_ok( test ) dns_copy_fail_okx ( test, __FILE__, __LINE__ )
00347 
00348 /** A DNS search list test */
00349 struct dns_list_test {
00350         /** Search list */
00351         struct dns_name list;
00352         /** Expected decoded search list */
00353         const char **strings;
00354         /** Number of expected decoded string */
00355         unsigned int count;
00356 };
00357 
00358 /**
00359  * Define a DNS search list test
00360  *
00361  * @v _name             Test name
00362  * @v _list             RFC1035-encoded data
00363  * @v _strings          Expected decoded strings
00364  * @ret test            DNS search list test
00365  */
00366 #define DNS_LIST( _name, _list, _strings )                              \
00367         static uint8_t _name ## __list[] = _list;                       \
00368         static const char * _name ## __strings[] = _strings;            \
00369         static struct dns_list_test _name = {                           \
00370                 .list = {                                               \
00371                         .data = _name ## __list,                        \
00372                         .offset = 0,                                    \
00373                         .len = sizeof ( _name ## __list ),              \
00374                 },                                                      \
00375                 .strings = _name ## __strings,                          \
00376                 .count = ( sizeof ( _name ## __strings ) /              \
00377                            sizeof ( _name ## __strings[0] ) ),          \
00378         }
00379 
00380 /**
00381  * Report DNS search list test result
00382  *
00383  * @v test              DNS search list test
00384  * @v file              Test code file
00385  * @v line              Test code line
00386  */
00387 static void dns_list_okx ( struct dns_list_test *test, const char *file,
00388                            unsigned int line ) {
00389         struct dns_name name;
00390         unsigned int i;
00391 
00392         DBGC ( test, "DNS search list:\n" );
00393         DBGC_HDA ( test, 0, test->list.data, test->list.len );
00394         memcpy ( &name, &test->list, sizeof ( name ) );
00395         for ( i = 0 ; i < test->count ; i++ ) {
00396                 char buf[ strlen ( test->strings[i] ) + 1 /* NUL */ ];
00397                 int len;
00398                 int offset;
00399 
00400                 /* Decode this name */
00401                 len = dns_decode ( &name, buf, sizeof ( buf ) );
00402                 okx ( len >= 0, file, line );
00403                 if ( len >= 0 ) {
00404                         okx ( len == ( ( int ) strlen ( test->strings[i] ) ),
00405                               file, line );
00406                         okx ( strcmp ( buf, test->strings[i] ) == 0,
00407                               file, line );
00408                         DBGC ( test, "DNS search list found \"%s\" at offset "
00409                                "%#zx\n", buf, name.offset );
00410                 }
00411 
00412                 /* Skip to next name */
00413                 offset = dns_skip ( &name );
00414                 okx ( offset >= 0, file, line );
00415                 name.offset = offset;
00416         }
00417 
00418         /* Check that we have consumed the whole search list */
00419         okx ( name.offset == name.len, file, line );
00420 }
00421 #define dns_list_ok( test ) dns_list_okx ( test, __FILE__, __LINE__ )
00422 
00423 /* Simple encoding test */
00424 DNS_ENCODE ( encode_simple, "ipxe.org",
00425              DATA ( 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g', 0 ) );
00426 
00427 /* Single-word encoding test */
00428 DNS_ENCODE ( encode_single, "foo", DATA ( 3, 'f', 'o', 'o', 0 ) );
00429 
00430 /* Absolute encoding test */
00431 DNS_ENCODE ( encode_absolute, "git.ipxe.org.",
00432              DATA ( 3, 'g', 'i', 't', 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g',
00433                     0 ) );
00434 
00435 /* Empty string encoding test */
00436 DNS_ENCODE ( encode_empty, "", DATA ( 0 ) );
00437 
00438 /* Root domain encoding test */
00439 DNS_ENCODE ( encode_root, ".", DATA ( 0 ) );
00440 
00441 /* Invalid initial dot encoding test */
00442 DNS_ENCODE ( encode_initial_dot, ".foo", DATA() );
00443 
00444 /* Invalid double dot encoding test */
00445 DNS_ENCODE ( encode_double_dot, "ipxe..org", DATA() );
00446 
00447 /* Invalid solo double dot encoding test */
00448 DNS_ENCODE ( encode_solo_double_dot, "..", DATA() );
00449 
00450 /* Invalid trailing double dot encoding test */
00451 DNS_ENCODE ( encode_trailing_double_dot, "ipxe.org..", DATA() );
00452 
00453 /* Invalid overlength label encoding test */
00454 DNS_ENCODE ( encode_overlength,
00455              "this-label-is-maliciously-long-in-an-attempt-to-overflow-the-"
00456              "length-field-and-generate-a-length-which-looks-like-a-"
00457              "compression-pointer", DATA() );
00458 
00459 /* Simple decoding test */
00460 DNS_DECODE ( decode_simple,
00461              DATA ( 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g', 0 ), 0,
00462              "ipxe.org" );
00463 
00464 /* Compression pointer decoding test */
00465 DNS_DECODE ( decode_ptr,
00466              DATA ( 3, 'o', 'r', 'g', 0, 3, 'g', 'i', 't', 4, 'i', 'p', 'x',
00467                     'e', 0xc0, 0x00 ), 5,
00468              "git.ipxe.org" );
00469 
00470 /* Root decoding test */
00471 DNS_DECODE ( decode_root,
00472              DATA ( 0 ), 0, "" );
00473 
00474 /* Incomplete name decoding test */
00475 DNS_DECODE ( decode_incomplete_name,
00476              DATA ( 4, 'i', 'p', 'x', 'e' ), 0, NULL );
00477 
00478 /* Incomplete label decoding test */
00479 DNS_DECODE ( decode_incomplete_label,
00480              DATA ( 4, 'i', 'p', 'x' ), 0, NULL );
00481 
00482 /* Incomplete compression pointer decoding test */
00483 DNS_DECODE ( decode_incomplete_ptr,
00484              DATA ( 3, 'o', 'r', 'g', 0, 4, 'i', 'p', 'x', 'e', 0xc0 ), 5,
00485              NULL );
00486 
00487 /* Forward reference decoding test */
00488 DNS_DECODE ( decode_forward,
00489              DATA ( 0xc0, 0x02, 3, 'f', 'o', 'o', 0 ), 0, NULL );
00490 
00491 /* Infinite loop decoding test */
00492 DNS_DECODE ( decode_infinite,
00493              DATA ( 4, 'i', 'p', 'x', 'e', 0xc0, 0x00 ), 0, NULL );
00494 
00495 /* Empty decoding test */
00496 DNS_DECODE ( decode_empty,
00497              DATA (), 0, NULL );
00498 
00499 /* Simple comparison test */
00500 DNS_COMPARE ( compare_simple,
00501               DATA ( 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g', 0 ), 0,
00502               DATA ( 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g', 0 ), 0 );
00503 
00504 /* Compression pointer comparison test */
00505 DNS_COMPARE ( compare_ptr,
00506               DATA ( 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g', 0 ), 0,
00507               DATA ( 3, 'o', 'r', 'g', 0, 4, 'i', 'p', 'x', 'e',
00508                      0xc0, 0x00 ), 5 );
00509 
00510 /* Case insensitive comparison test */
00511 DNS_COMPARE ( compare_case,
00512               DATA ( 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g', 0 ), 0,
00513               DATA ( 4, 'i', 'p', 'x', 'e', 3, 'O', 'R', 'G', 0 ), 0 );
00514 
00515 /* Mismatch comparison test */
00516 DNS_COMPARE ( compare_mismatch,
00517               DATA ( 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g', 0 ), 0,
00518               DATA ( 4, 'g', 'p', 'x', 'e', 3, 'o', 'r', 'g', 0 ), 0 );
00519 
00520 /* Infinite loop comparison test */
00521 DNS_COMPARE ( compare_infinite,
00522               DATA ( 3, 'f', 'o', 'o', 0xc0, 0x00 ), 0,
00523               DATA ( 3, 'f', 'o', 'o', 0xc0, 0x00 ), 0 );
00524 
00525 /* Simple copying test */
00526 DNS_COPY ( copy_simple,
00527            DATA ( 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g', 0 ), 0,
00528            DATA ( 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g', 0 ), 0 );
00529 
00530 /* Simple copying test with offset */
00531 DNS_COPY ( copy_offset,
00532            DATA ( 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g', 0 ), 0,
00533            DATA ( 'f', 'o', 'o', 0, 4, 'i', 'p', 'x', 'e',
00534                   3, 'o', 'r', 'g', 0 ), 4 );
00535 
00536 /* Compression pointer copying test */
00537 DNS_COPY ( copy_ptr,
00538            DATA ( 3, 'o', 'r', 'g', 0, 3, 'g', 'i', 't', 4, 'i', 'p', 'x', 'e',
00539                   0xc0, 0x00 ), 5,
00540            DATA ( 3, 'g', 'i', 't', 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g',
00541                   0 ), 0 );
00542 
00543 /* Infinite loop copying test */
00544 DNS_COPY ( copy_infinite,
00545            DATA ( 4, 'l', 'o', 'o', 'p', 7, 'f', 'o', 'r', 'e', 'v', 'e', 'r',
00546                   0xc0, 0x05 ), 0,
00547            DATA (), 0 );
00548 
00549 /* DNS search list test */
00550 DNS_LIST ( search,
00551            DATA ( 4, 'i', 'p', 'x', 'e', 3, 'o', 'r', 'g', 0,
00552                   4, 'b', 'o', 'o', 't', 0xc0, 0x00,
00553                   3, 'd', 'e', 'v', 0xc0, 0x0a,
00554                   11, 'n', 'e', 't', 'w', 'o', 'r', 'k', 'b', 'o', 'o', 't',
00555                   0xc0, 0x05 ),
00556            DATA ( "ipxe.org", "boot.ipxe.org", "dev.boot.ipxe.org",
00557                   "networkboot.org" ) );
00558 
00559 /**
00560  * Perform DNS self-test
00561  *
00562  */
00563 static void dns_test_exec ( void ) {
00564 
00565         /* Encoding tests */
00566         dns_encode_ok ( &encode_simple );
00567         dns_encode_ok ( &encode_single );
00568         dns_encode_ok ( &encode_absolute );
00569         dns_encode_ok ( &encode_empty );
00570         dns_encode_ok ( &encode_root );
00571         dns_encode_fail_ok ( &encode_initial_dot );
00572         dns_encode_fail_ok ( &encode_double_dot );
00573         dns_encode_fail_ok ( &encode_solo_double_dot );
00574         dns_encode_fail_ok ( &encode_trailing_double_dot );
00575         dns_encode_fail_ok ( &encode_overlength );
00576 
00577         /* Decoding tests */
00578         dns_decode_ok ( &decode_simple );
00579         dns_decode_ok ( &decode_ptr );
00580         dns_decode_ok ( &decode_root );
00581         dns_decode_fail_ok ( &decode_incomplete_name );
00582         dns_decode_fail_ok ( &decode_incomplete_label );
00583         dns_decode_fail_ok ( &decode_incomplete_ptr );
00584         dns_decode_fail_ok ( &decode_forward );
00585         dns_decode_fail_ok ( &decode_infinite );
00586         dns_decode_fail_ok ( &decode_empty );
00587 
00588         /* Comparison tests */
00589         dns_compare_ok ( &compare_simple );
00590         dns_compare_ok ( &compare_ptr );
00591         dns_compare_ok ( &compare_case );
00592         dns_compare_fail_ok ( &compare_mismatch );
00593         dns_compare_fail_ok ( &compare_infinite );
00594 
00595         /* Copying tests */
00596         dns_copy_ok ( &copy_simple );
00597         dns_copy_ok ( &copy_offset );
00598         dns_copy_ok ( &copy_ptr );
00599         dns_copy_fail_ok ( &copy_infinite );
00600 
00601         /* Search list tets */
00602         dns_list_ok ( &search );
00603 }
00604 
00605 /** DNS self-test */
00606 struct self_test dns_test __self_test = {
00607         .name = "dns",
00608         .exec = dns_test_exec,
00609 };