Skip to content

Commit

Permalink
- Fix #310: NSD stats contain the terms "master" and "slave".
Browse files Browse the repository at this point in the history
  • Loading branch information
wcawijngaards committed Dec 8, 2023
1 parent 3691e06 commit bc26a20
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 32 deletions.
12 changes: 6 additions & 6 deletions contrib/nsd_munin_
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ if test "$1" = "config" ; then
echo "graph_vlabel zone count"
echo "graph_category DNS"
p_config "zone.total" "total zones" "GAUGE"
p_config "zone.master" "master zones" "GAUGE"
p_config "zone.slave" "slave zones" "GAUGE"
p_config "zone.primary" "primary zones" "GAUGE"
p_config "zone.secondary" "secondary zones" "GAUGE"
echo "graph_info number of zones served by NSD."
;;
esac
Expand Down Expand Up @@ -418,11 +418,11 @@ by_rcode)
done
;;
zones)
get_value "zone.master"
get_value "zone.primary"
nummas="$value"
get_value "zone.slave"
get_value "zone.secondary"
numsla="$value"
echo "zone_total.value" `expr $nummas + $numsla`
echo "zone_master.value" "$nummas"
echo "zone_slave.value" "$numsla"
echo "zone_primary.value" "$nummas"
echo "zone_secondary.value" "$numsla"
esac
2 changes: 1 addition & 1 deletion difffile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ apply_ixfr_for_zone(nsd_type* nsd, zone_type* zone, FILE* in,
if(softfail && taskudb && !is_axfr) {
log_msg(LOG_ERR, "Failed to apply IXFR cleanly "
"(deletes nonexistent RRs, adds existing RRs). "
"Zone %s contents is different from master, "
"Zone %s contents is different from primary, "
"starting AXFR. Transfer %s", zone_buf, log_buf);
/* add/del failures in IXFR, get an AXFR */
diff_update_commit(
Expand Down
1 change: 1 addition & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
8 December 2023: Wouter
- Merge #309: More RFC 8499 compliance.
- Fix #310: NSD stats contain the terms "master" and "slave".

7 December 2023: Wouter
- Merge #307 from anandb-ripencc: Many improvements to the nsd.conf
Expand Down
2 changes: 1 addition & 1 deletion nsd-checkconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ additional_checks(nsd_options_type* opt, const char* filename)
}
if(!zone_is_slave(zone) && (!zone->pattern->zonefile ||
zone->pattern->zonefile[0] == 0)) {
fprintf(stderr, "%s: zone %s is a master zone but has "
fprintf(stderr, "%s: zone %s is a primary zone but has "
"no zonefile. Where can the data come from?\n",
filename, zone->name);
errors ++;
Expand Down
10 changes: 5 additions & 5 deletions nsd-control.8.in
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ transferred, without argument, all zones are transferred.
Print state of the zone, the serial numbers and since when they have
been acquired. Also prints the notify action (to which server), and
zone transfer (and from which primary) if there is activity right now.
The state of the zone is printed as: 'master' (primary zones), 'ok' (secondary
The state of the zone is printed as: 'primary' (primary zones), 'ok' (secondary
zone is up\-to\-date), 'expired' (secondary zone has expired), 'refreshing' (secondary
zone has transfers active). The serial numbers printed are
the 'served\-serial' (currently active), the 'commit\-serial' (is in reload),
Expand Down Expand Up @@ -323,13 +323,13 @@ number of answers with TC flag set.
.I num.dropped
number of queries that were dropped because they failed sanity check.
.TP
.I zone.master
.I zone.primary
number of primary zones served. These are zones with no 'request\-xfr:'
entries.
entries. Also output as 'zone.master' for backwards compatibility.
.TP
.I zone.slave
.I zone.secondary
number of secondary zones served. These are zones with 'request\-xfr'
entries.
entries. Also output as 'zone.slave' for backwards compatibility.
.SH "FILES"
.TP
.I @nsdconfigfile@
Expand Down
12 changes: 6 additions & 6 deletions nsd.conf.sample.in
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,12 @@ remote-control:
# which is only offered for transfer to secondaries over TLS.
#allow-query: 192.0.2.0/24 NOKEY

# If no master and slave access control elements are provided,
# If no primary and secondary access control elements are provided,
# this zone will not be served to/from other servers.

# A master zone needs notify: and provide-xfr: lists. A slave
# A primary zone needs notify: and provide-xfr: lists. A secondary
# may also allow zone transfer (for debug or other secondaries).
# notify these slaves when the master zone changes, address TSIG|NOKEY
# notify these secondaries when the primary zone changes, address TSIG|NOKEY
# IP can be ipv4 and ipv6, with @port for a nondefault port number.
#notify: 192.0.2.1 NOKEY
# allow these IPs and TSIG to transfer zones, addr TSIG|NOKEY|BLOCKED
Expand All @@ -425,9 +425,9 @@ remote-control:
# provide-xfr: 0.0.0.0/0 NOKEY
# provide-xfr: ::0/0 NOKEY

# A slave zone needs allow-notify: and request-xfr: lists.
# A secondary zone needs allow-notify: and request-xfr: lists.
#allow-notify: 2001:db8::0/64 my_tsig_key_name
# By default, a slave will request a zone transfer with IXFR/TCP.
# By default, a secondary will request a zone transfer with IXFR/TCP.
# If you want to make use of IXFR/UDP use: UDP addr tsigkey
# for a master that only speaks AXFR (like NSD) use AXFR addr tsigkey
# If you want to require use of XFR-over-TLS use: addr tsigkey tlsauthname
Expand Down Expand Up @@ -467,7 +467,7 @@ remote-control:
# from that pattern are inserted into this one (as if it were a
# macro). The statement can be given in between other statements,
# because the order of access control elements can make a difference
# (which master to request from first, which slave to notify first).
# (which master to request from first, which secondary to notify first).
#include-pattern: "common-masters"

# Verify zone before publishing.
Expand Down
11 changes: 8 additions & 3 deletions remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ do_transfer(RES* ssl, xfrd_state_type* xfrd, char* arg)
xfrd_handle_notify_and_start_xfr(zone, NULL);
send_ok(ssl);
} else {
(void)ssl_printf(ssl, "error zone not slave\n");
(void)ssl_printf(ssl, "error zone not secondary\n");
}
} else {
RBTREE_FOR(zone, xfrd_zone_type*, xfrd->zones) {
Expand Down Expand Up @@ -999,7 +999,7 @@ do_force_transfer(RES* ssl, xfrd_state_type* xfrd, char* arg)
force_transfer_zone(zone);
send_ok(ssl);
} else {
(void)ssl_printf(ssl, "error zone not slave\n");
(void)ssl_printf(ssl, "error zone not secondary\n");
}
} else {
RBTREE_FOR(zone, xfrd_zone_type*, xfrd->zones) {
Expand Down Expand Up @@ -1057,7 +1057,7 @@ print_zonestatus(RES* ssl, xfrd_state_type* xfrd, struct zone_options* zo)
}
}
if(!xz) {
if(!ssl_printf(ssl, " state: master\n"))
if(!ssl_printf(ssl, " state: primary\n"))
return 0;
return 1;
}
Expand Down Expand Up @@ -2799,6 +2799,11 @@ print_stats(RES* ssl, xfrd_state_type* xfrd, struct timeval* now, int clear,
print_stat_block(ssl, "", "", st);

/* zone statistics */
if(!ssl_printf(ssl, "zone.primary=%lu\n",
(unsigned long)(xfrd->notify_zones->count - xfrd->zones->count)))
return;
if(!ssl_printf(ssl, "zone.secondary=%lu\n", (unsigned long)xfrd->zones->count))
return;
if(!ssl_printf(ssl, "zone.master=%lu\n",
(unsigned long)(xfrd->notify_zones->count - xfrd->zones->count)))
return;
Expand Down
8 changes: 4 additions & 4 deletions xfrd-disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ xfrd_read_state(struct xfrd_state* xfrd)
zone->master = acl_find_num(zone->zone_options->pattern->
request_xfr, zone->master_num);
if(!zone->master) {
DEBUG(DEBUG_XFRD,1, (LOG_INFO, "xfrd: masters changed for zone %s",
DEBUG(DEBUG_XFRD,1, (LOG_INFO, "xfrd: primaries changed for zone %s",
zone->apex_str));
zone->master = zone->zone_options->pattern->request_xfr;
zone->master_num = 0;
Expand Down Expand Up @@ -464,18 +464,18 @@ xfrd_write_state(struct xfrd_state* xfrd)

fprintf(out, "%s\n", XFRD_FILE_MAGIC);
fprintf(out, "# This file is written on exit by nsd xfr daemon.\n");
fprintf(out, "# This file contains slave zone information:\n");
fprintf(out, "# This file contains secondary zone information:\n");
fprintf(out, "# * timeouts (when was zone data acquired)\n");
fprintf(out, "# * state (OK, refreshing, expired)\n");
fprintf(out, "# * which master transfer to attempt next\n");
fprintf(out, "# * which primary transfer to attempt next\n");
fprintf(out, "# The file is read on start (but not on reload) by nsd xfr daemon.\n");
fprintf(out, "# You can edit; but do not change statement order\n");
fprintf(out, "# and no fancy stuff (like quoted \"strings\").\n");
fprintf(out, "#\n");
fprintf(out, "# If you remove a zone entry, it will be refreshed.\n");
fprintf(out, "# This can be useful for an expired zone; it revives\n");
fprintf(out, "# the zone temporarily, from refresh-expiry time.\n");
fprintf(out, "# If you delete the file all slave zones are updated.\n");
fprintf(out, "# If you delete the file all secondary zones are updated.\n");
fprintf(out, "#\n");
fprintf(out, "# Note: if you edit this file while nsd is running,\n");
fprintf(out, "# it will be overwritten on exit by nsd.\n");
Expand Down
12 changes: 6 additions & 6 deletions xfrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ xfrd_process_soa_info_task(struct task_list_d* task)
}

if(!zone) {
DEBUG(DEBUG_IPC,1, (LOG_INFO, "xfrd: zone %s master zone updated",
DEBUG(DEBUG_IPC,1, (LOG_INFO, "xfrd: zone %s primary zone updated",
dname_to_string(task->zname,0)));
notify_handle_master_zone_soainfo(xfrd->notify_zones,
task->zname, soa_ptr);
Expand Down Expand Up @@ -1023,7 +1023,7 @@ xfrd_make_request(xfrd_zone_type* zone)
if(zone->next_master != -1) {
/* we are told to use this next master */
DEBUG(DEBUG_XFRD,1, (LOG_INFO,
"xfrd zone %s use master %i",
"xfrd zone %s use primary %i",
zone->apex_str, zone->next_master));
zone->master_num = zone->next_master;
zone->master = acl_find_num(zone->zone_options->pattern->
Expand Down Expand Up @@ -1069,7 +1069,7 @@ xfrd_make_request(xfrd_zone_type* zone)
zone->state != xfrd_zone_expired) {
/* tried all servers and update zone */
if(zone->multi_master_update_check >= 0) {
VERBOSITY(2, (LOG_INFO, "xfrd: multi master "
VERBOSITY(2, (LOG_INFO, "xfrd: multi primary "
"check: zone %s completed transfers",
zone->apex_str));
}
Expand All @@ -1088,7 +1088,7 @@ xfrd_make_request(xfrd_zone_type* zone)
if (zone->master->ixfr_disabled &&
(zone->master->ixfr_disabled + XFRD_NO_IXFR_CACHE) <= time(NULL)) {
DEBUG(DEBUG_XFRD,1, (LOG_INFO, "clear negative caching ixfr "
"disabled for master %s num "
"disabled for primary %s num "
"%d ",
zone->master->ip_address_spec, zone->master_num));
zone->master->ixfr_disabled = 0;
Expand Down Expand Up @@ -1119,7 +1119,7 @@ xfrd_make_request(xfrd_zone_type* zone)
xfrd_tcp_obtain(xfrd->tcp_set, zone);
} else {
DEBUG(DEBUG_XFRD,1, (LOG_INFO, "xfrd zone %s axfr "
"fallback not allowed, skipping master %s.",
"fallback not allowed, skipping primary %s.",
zone->apex_str, zone->master->ip_address_spec));
}
}
Expand Down Expand Up @@ -2514,7 +2514,7 @@ xfrd_handle_passed_packet(buffer_type* packet,
if(next != -1) {
zone->next_master = next;
DEBUG(DEBUG_XFRD,1, (LOG_INFO,
"xfrd: notify set next master to query %d",
"xfrd: notify set next primary to query %d",
next));
}
}
Expand Down

0 comments on commit bc26a20

Please sign in to comment.