diff options
Diffstat (limited to 'contrib/bind/bin/named/db_dump.c')
-rw-r--r-- | contrib/bind/bin/named/db_dump.c | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/contrib/bind/bin/named/db_dump.c b/contrib/bind/bin/named/db_dump.c index 10acb8c..5bb9456 100644 --- a/contrib/bind/bin/named/db_dump.c +++ b/contrib/bind/bin/named/db_dump.c @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)db_dump.c 4.33 (Berkeley) 3/3/91"; -static const char rcsid[] = "$Id: db_dump.c,v 8.43 2000/04/21 06:54:01 vixie Exp $"; +static const char rcsid[] = "$Id: db_dump.c,v 8.48 2000/12/23 08:14:34 vixie Exp $"; #endif /* not lint */ /* @@ -125,15 +125,20 @@ static const char rcsid[] = "$Id: db_dump.c,v 8.43 2000/04/21 06:54:01 vixie Exp #include "named.h" +#ifdef HITCOUNTS +u_int32_t db_total_hits; +#endif /* HITCOUNTS */ + static const char *MkCredStr(int); +static int fwd_dump(FILE *fp); + /* * Dump current data base in a format similar to RFC 883. */ void -doadump() -{ +doadump(void) { FILE *fp; ns_notice(ns_log_db, "dumping nameserver data"); @@ -141,6 +146,10 @@ doadump() if ((fp = write_open(server_options->dump_filename)) == NULL) return; gettime(&tt); +#ifdef HITCOUNTS + if (NS_OPTION_P(OPTION_HITCOUNT)) + fprintf(fp, "; Total hits: %d\n",db_total_hits); +#endif /* HITCOUNTS */ fprintf(fp, "; Dumped at %s", ctimel(tt.tv_sec)); if (zones != NULL && nzones != 0) zt_dump(fp); @@ -204,7 +213,8 @@ zt_dump(FILE *fp) { fprintf(fp, ";; --zone table--\n"); return (0); } -int + +static int fwd_dump(FILE *fp) { int i; fprintf(fp, ";; ++forwarders table++\n"); @@ -471,18 +481,18 @@ db_dump(struct hashbuf *htp, FILE *fp, int zone, char *origin) { NS_GET16(preference, cp); fprintf(fp, "%u", preference); - if ((n = *cp++) != 0) { - fprintf(fp, "\"%.*s\"", (int)n, cp); - cp += n; - } - if ((n = *cp++) != 0) { - fprintf(fp, "\"%.*s\"", (int)n, cp); - cp += n; - } - if ((n = *cp++) != 0) { - fprintf(fp, " \"%.*s\"", (int)n, cp); - cp += n; - } + n = *cp++; + fprintf(fp, "\"%.*s\"", (int)n, cp); + cp += n; + + n = *cp++; + fprintf(fp, "\"%.*s\"", (int)n, cp); + cp += n; + + n = *cp++; + fprintf(fp, " \"%.*s\"", (int)n, cp); + cp += n; + fprintf(fp, " %s.", cp); break; @@ -627,18 +637,24 @@ db_dump(struct hashbuf *htp, FILE *fp, int zone, char *origin) { getname(np, dname, sizeof(dname)); when = db_lame_find(dname, dp); if (when != 0 && when > tt.tv_sec) { - fprintf(fp, "%sLAME=%d", + fprintf(fp, "%sLAME=%ld", sep, when - tt.tv_sec); sep = " "; } } eoln: - if (dp->d_ns != NULL){ + if (dp->d_addr.s_addr != htonl(0)) { fprintf(fp, "%s[%s]", - sep, inet_ntoa(dp->d_ns->addr)); + sep, inet_ntoa(dp->d_addr)); sep = " "; } +#ifdef HITCOUNTS + if (NS_OPTION_P(OPTION_HITCOUNT)) { + fprintf(fp, "%shits=%d", sep, dp->d_hitcnt); + sep=" "; + } +#endif /* HITCOUNTS */ putc('\n', fp); } } |