1When adding a new configuration option to NSD, several files need to be 2touched. This file is an enumeration of files that need to be edited. 3Suppose we are going to add a configuration option 'dummy:' that can take 4a string. We need to update the following files: 5 6 1. configlexer.lex 7 2. configparser.y 8 3. options.h 9 4. options.c 10 5. nsd.conf.sample.in 11 6. nsd.conf.5.in 12 7. nsd-checkconf.c 13 8. tpkg/checkconf.tpkg 14 151. Update configlexer.lex 16 17Make sure that zonec understands the new option by adding the following 18line into configlexer.lex 19 20 dummy{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_DUMMY;} 21 222. Update configparser.y 23 24Make sure that zonec can parse the new option by adding VAR_DUMMY to the set 25of tokens: 26 27 %token VAR_DUMMY 28 29Update the grammar. For example, if it a server option, extend content_server: 30 31 content_server: server_ip_address | ... 32 server_hide_version | server_dummy; 33 34And write down the dummy rule: 35 36 server_dummy: VAR_DUMMY STRING 37 { 38 OUTYY(("P(server_dummy:%s)\n", $2)); 39 cfg_parser->opt->dummy = 40 region_strdup(cfg_parser->opt->region, $2); 41 } 42 ; 43 443. Update options.h 45 46Make sure that there is storage for the dummy option. In struct nsd_options, 47add: 48 49 const char* dummy; 50 514. Update options.c 52 53Set a default dummy string. In the function nsd_options_create(), add: 54 55 opt->dummy = "dummy"; 56 575. Update nsd.conf.sample.in 58 59Add a reference in the sample configuration file: 60 61 # This option does nothing. 62 # dummy: "dummy" 63 646. Update nsd.conf.5.in 65 66Update the nsd.conf manpage: 67 68 .TP 69 .B dummy:\fR <filename> 70 Does nothing. 71 727. Update nsd-checkconf.c 73 74Make the checkconf tool aware of the new option. In config_print_zone(), add: 75 76 SERV_GET_STR(dummy, o); 77 78and in config_test_print_server(), add: 79 80 print_string_var("dummy:", opt->dummy); 81 828. Update tpkg/checkconf.tpkg 83 84Make the test aware of the new option. Extract checkconf.tpkg: 85 86 $ cd tpkg; 87 $ tpkg extract checkconf.tpkg 88 $ cd checkconf.dir 89 90And add to the various checkconf.check[1-9] files: 91 92 dummy: "dummy" 93 94Go back to the tpkg directory and create the new test: 95 96 $ cd .. 97 $ tpkg create checkconf.tpkg 98 999. Update other files 100 101You might need to edit other files too: 102 103- If the new option requires to be enabled at build time, you need to add 104 stuff to configure.ac and Makefile.in. 105 106- Update documentation files, like doc/README, doc/RELNOTES, doc/Changelog. 107 108- Obviously, the source code files need to be edited to implement the new 109 functionality. 110 111 112