refreshing the dns cache

David Botham dns at botham.net
Fri Aug 23 16:30:45 UTC 2002


 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> -----Original Message-----
> From: bind-users-bounce at isc.org [mailto:bind-users-bounce at isc.org]
> On Behalf Of Jonathan Tse
> Sent: Friday, August 23, 2002 12:25 AM
> To: comp-protocols-dns-bind at isc.org
> Subject: Re: refreshing the dns cache
> 
> That is great! I have just tried that out, seems it can only flush
> host by host but not domain but domain. Sometimes I need to clear
> the whole domain to make sure all records under it are correct.

Script:  flush-domain.pl
1.  dump cache
2.  grep for domain
3.  grab names containing domain
4.  flush each name

Seems like this would be a piece of cake if you digging in the bind
source... :)

Dave...



> 
> <Mark_Andrews at isc.org> wrote in message
> news:ak0iuk$2f4c$1 at isrv4.isc.org...
> >
> > > Hi all,
> > >
> > > I am a loyal user of BIND8 for over two years and I handled
> > > about 
> hundred of
> > > cases regarding our DNS cache servers cached wrong information.
> Usually
> they
> > > were due to 3rd party DNS administers mistake but I know my
> > > customers 
> are
> > > the victims and I can't tell them just to wait.
> > >
> > > To make the story short, my point is I usually erase the part
> > > of the 
> cache
> > > that is outdated if I got wrong caching complain. The way I did
> > > it in 
> BIND8
> > > is to create the zone which is exactly the same as the cached
> zone/domain.
> > > After I reload the named, I remove the zone from the config
> > > file and 
> reload
> > > it again. It is ugly but my customers are happy.
> > >
> > > Things do not go well in BIND9 and I found out it is because
> > > the cache 
> and
> > > the local zones are stored in two (or more if there are more
> > > than one 
> view)
> > > databases. I am in the midst of creating a new rndc command
> > > such that 
> it
> > > will check all the cache database and remove the cached domain.
> > >
> > > However, I am stuck at trying to convert the domain name into
> > > the 
> object
> > > dns_name_t. Unfortunately I have little clue after reading
> > > quite a lot 
> of
> > > the source code.
> > >
> > > Appended is my code so far, would appreciate if anyone can
> > > enlighten 
> me
> > > on it? Hope I can contribute to the BIND community. :) BTW,
> > > does ISC has a plan to put this feature into the release?
> > >
> > > isc_result_t
> > > ns_server_rmcache(ns_server_t *server, char *args) {
> > >         isc_result_t result;
> > >         dns_zone_t *zone = NULL;
> > >         dns_zonetype_t type;
> > >         char *input, *ptr;
> > >         const char *zonetxt;
> > >         FILE *fp = NULL;
> > >         dns_view_t *view;
> > >
> > >         input = args;
> > >
> > >         /* Skip the command name and extract the zone name. */
> > >         ptr = next_token(&input, " \t");
> > >         if (ptr == NULL)
> > >                 result = ISC_R_UNEXPECTEDEND;
> > >
> > >         /* Look for the zone name. */
> > >         zonetxt = next_token(&input, " \t");
> > >         result = ISC_R_SUCCESS;
> > >
> > >         if (result != ISC_R_SUCCESS)
> > >                 return (result);
> > >         if (zonetxt == NULL) {
> > >                 isc_log_write(ns_g_lctx,
> > > NS_LOGCATEGORY_GENERAL, 
> > >                               NS_LOGMODULE_SERVER,
> > > ISC_LOG_ERROR, 
> > >                               "rmcache zones failed: %s",
> > > zonetxt); 
> > >         } else {
> > >                 for (view = ISC_LIST_HEAD(server->viewlist);
> > >                      view != NULL;
> > >                      view = ISC_LIST_NEXT(view, link))
> > >                 {
> > >                         if (view->cachedb != NULL) {
> > > /*********************************
> > > /* here is the part I have problem
> > > /*********************************
> > >
> > >                                 dns_db_findnode(view->cachedb,
> > > name, ISC_FALSE,
> > > &node);
> > >
> > >                                 dns_db_detachnode(db, node);
> > >                         }
> > >                         /* else, it is not cachedb, next */
> > >                 }
> > >                 isc_log_write(ns_g_lctx,
> > > NS_LOGCATEGORY_GENERAL, 
> > >                               NS_LOGMODULE_SERVER,
> > > ISC_LOG_ERROR, 
> > >                               "rmcache zones succeed: %s",
> > > args); 
> > >         }
> > >         return (ISC_R_SUCCESS);
> > >  cleanup:
> > >         if (fp != NULL)
> > >                 (void)isc_stdio_close(fp);
> > >         return (result);
> > > }
> > >
> > >
> > >
> > >
> > >
> > >
> >
> > It's already available in the 9.3 snapshot.
> >
> > Mark
> >
> > Usage: rndc [-c config] [-s server] [-p port]
> >         [-k key-file ] [-y key] [-V] command
> >
> > command is one of the following:
> >
> >   reload Reload configuration file and zones.
> >   reload zone [class [view]]
> > Reload a single zone.
> >   refresh zone [class [view]]
> > Schedule immediate maintenance for a zone.
> >   retransfer zone [class [view]]
> > Retransfer a single zone without checking serial number.
> >   freeze zone [class [view]]
> >   Suspend updates to a dynamic zone.
> >   unfreeze zone [class [view]]
> >   Enable updates to a frozen dynamic zone and reload it.
> >   reconfig Reload configuration file and new zones only.
> >   stats Write server statistics to the statistics file.
> >   querylog Toggle query logging.
> >   dumpdb Dump cache(s) to the dump file (named_dump.db).
> >   stop Save pending updates to master files and stop the server.
> >   stop -p Save pending updates to master files and stop the
> > server reporting process id.
> >   halt Stop the server without saving pending updates.
> >   halt -p Stop the server without saving pending updates
> > reporting process id.
> >   trace Increment debugging level by one.
> >   trace level Change the debugging level.
> >   notrace Set debugging level to 0.
> >   flush Flushes all of the server's caches.
> >   flush [view] Flushes the server's cache for a view.
> >   flushname name [view]
> > Flush the give name from the server's cache(s)
> >   status Display status of the server.
> >   *restart Restart the server.
> >
> > * == not yet implemented
> > Version: 9.3.0a0
> > --
> > Mark Andrews, Internet Software Consortium
> > 1 Seymour St., Dundas Valley, NSW 2117, Australia
> > PHONE: +61 2 9871 4742                 INTERNET:
> > Mark.Andrews at isc.org 
> >
> 


-----BEGIN PGP SIGNATURE-----
Version: PGP 7.0.4

iQA/AwUBPWZjNVq85iiiMQ4EEQIfJwCfUWizttFzHuOzxz1XX9R16INz59UAoKRQ
FVjwePfZKjSySo8pJVE0DZ9X
=Gv+b
-----END PGP SIGNATURE-----



More information about the bind-users mailing list