Skip to content
Snippets Groups Projects
Commit b2c7ebfa authored by Daniel Salzman's avatar Daniel Salzman Committed by Gerrit Code Review
Browse files

zone-dump: don't dump master information if not available

Change-Id: I606de5b7c80ddc34048a64f157b96f734c5591df
parent 2de61fb9
No related branches found
No related tags found
No related merge requests found
......@@ -156,19 +156,23 @@ int zone_dump_text(knot_zone_contents_t *zone, FILE *file)
char date[64];
strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S %Z", &tm);
// Dump trailing statistics.
fprintf(file, ";; Written %"PRIu64" records\n"
";; On %s\n",
params.rr_count, date);
// Get master information.
sockaddr_t *master = &((zonedata_t *)zone->zone->data)->xfr_in.master;
int port = sockaddr_portnum(master);
char addr[INET6_ADDRSTRLEN] = "NULL";
int port = sockaddr_portnum(master);
sockaddr_tostr(master, addr, sizeof(addr));
// If a master server is configured, dump info about it.
if (port >= 0) {
char addr[INET6_ADDRSTRLEN] = "NULL";
sockaddr_tostr(master, addr, sizeof(addr));
// Dump trailing statistics.
fprintf(file, ";; Written %"PRIu64" records\n"
";; Transfered from %s#%i\n"
";; On %s\n",
params.rr_count, addr, port, date);
fprintf(file, ";; Transfered from %s#%i\n", addr, port);
}
free(buf);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment