mirror of
https://gitlab.nic.cz/knot/knot-dns.git
synced 2026-05-28 04:02:31 -04:00
Multiple zones support.
Changed cute_start() to take more file names + passing these filenames from command line.
This commit is contained in:
parent
6624521522
commit
80c534cdc2
5 changed files with 24 additions and 24 deletions
|
|
@ -1,17 +1,16 @@
|
|||
$TTL 86400
|
||||
|
||||
$TTL 3600
|
||||
bogus25.com. IN SOA ns1.bogus25.com. support.bogus25.com. (
|
||||
20010923; Serial
|
||||
10800 ; Refresh after 3hrs
|
||||
3600 ; Retry after 1 hr
|
||||
604800 ; Expire in 1 week
|
||||
86400 ) ; Minimum ttl 1 day
|
||||
IN NS ns1.bogus25.com.
|
||||
IN NS ns2.bogus25.com.
|
||||
bogus25.com. IN A 72.96.52.127
|
||||
www IN CNAME bogus25.com.
|
||||
ftp IN CNAME bogus25.com.
|
||||
mail IN A 72.96.52.127
|
||||
IN MX 10 mail
|
||||
bogus25.com. IN MX 10 mail.bogus25.com.
|
||||
|
||||
@ IN NS ns1.bogus25.com.
|
||||
@ IN NS ns2.bogus25.com.
|
||||
@ IN MX 10 mail
|
||||
bogus25.com. IN A 72.96.52.127
|
||||
www IN CNAME bogus25.com.
|
||||
ftp IN CNAME bogus25.com.
|
||||
mail IN A 72.96.52.127
|
||||
|
||||
|
|
|
|||
10
src/main.c
10
src/main.c
|
|
@ -32,7 +32,8 @@ void interrupt_handle(int s)
|
|||
int main( int argc, char **argv )
|
||||
{
|
||||
if (argc < 2) {
|
||||
print_msg(LOG_ERR, "Usage: %s <filename>.\n", argv[0]);
|
||||
print_msg(LOG_ERR, "Usage: %s <filename1> [<filename2> ...] .\n",
|
||||
argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -40,11 +41,6 @@ int main( int argc, char **argv )
|
|||
log_open(LOG_UPTO(LOG_ERR), LOG_MASK(LOG_ERR)|LOG_MASK(LOG_WARNING));
|
||||
|
||||
int res = 0;
|
||||
// res = test_skip_list();
|
||||
|
||||
// if (res != 0) {
|
||||
// printf("\n!!!! Skip list test unsuccessful !!!!\n");
|
||||
// }
|
||||
|
||||
// Start server
|
||||
|
||||
|
|
@ -59,7 +55,7 @@ int main( int argc, char **argv )
|
|||
sigaction(SIGINT, &sa, NULL);
|
||||
|
||||
// Run server
|
||||
if ((res = cute_start(s_server, argv[1])) != 0) {
|
||||
if ((res = cute_start(s_server, argv + 1, argc - 1)) != 0) {
|
||||
fprintf (stderr, "Problem starting the server, exiting..\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,12 +69,16 @@ cute_server *cute_create()
|
|||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
int cute_start( cute_server *server, const char *filename )
|
||||
int cute_start( cute_server *server, char **filenames, uint zones )
|
||||
{
|
||||
debug_server("Parsing zone file %s..\n", filename);
|
||||
if (zp_parse_zone(filename, server->zone_db) != 0) {
|
||||
return -1;
|
||||
}
|
||||
debug_server("Starting server with %u zone files.\n", zones);
|
||||
|
||||
for (uint i = 0; i < zones; ++i) {
|
||||
debug_server("Parsing zone file %s..\n", filenames[i]);
|
||||
if (zp_parse_zone(filenames[i], server->zone_db) != 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
debug_server("Opening sockets (port %d)..\n", DEFAULT_PORT);
|
||||
if (sm_open(server->manager[UDP], DEFAULT_PORT, UDP) != 0) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "socket-manager.h"
|
||||
#include "zone-database.h"
|
||||
#include "name-server.h"
|
||||
#include "common.h"
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*!
|
||||
|
|
@ -54,7 +55,7 @@ cute_server *cute_create();
|
|||
* @todo When a module for configuration is added, the filename parameter will
|
||||
* be removed.
|
||||
*/
|
||||
int cute_start( cute_server *server, const char *filename );
|
||||
int cute_start( cute_server *server, char **filenames, uint zones );
|
||||
|
||||
/*!
|
||||
* @brief Requests server to stop.
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ int zp_parse_zonefile_bind( const char *filename, zdb_database *database )
|
|||
ldns_zone *zone;
|
||||
int line = 0;
|
||||
ldns_status s;
|
||||
log_info("Parsing zone file %s...\n", filename);
|
||||
log_info("\nParsing zone file %s...\n", filename);
|
||||
s = ldns_zone_new_frm_fp_l(&zone, file, NULL, 0, LDNS_RR_CLASS_IN, &line);
|
||||
log_info("Done.\n");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue