Author: eelco
Date: Sat Jan 21 19:13:43 2012
New Revision: 31779
URL: https://nixos.org/websvn/nix/?rev=31779&sc=1

Log:
* Invalidate the nscd hosts cache when an "ip-up" event occurs.  This
  event is emitted by dhclient and by the network-interfaces job in
  case of statically configured interfaces.  Invalidating the cache is
  necessary to get rid of negative queries.

Modified:
   nixos/trunk/modules/services/networking/dhclient.nix
   nixos/trunk/modules/services/system/nscd.nix

Modified: nixos/trunk/modules/services/networking/dhclient.nix
==============================================================================
--- nixos/trunk/modules/services/networking/dhclient.nix        Sat Jan 21 
19:08:58 2012        (r31778)
+++ nixos/trunk/modules/services/networking/dhclient.nix        Sat Jan 21 
19:13:43 2012        (r31779)
@@ -20,8 +20,6 @@
       #echo "$exit_status" >> /tmp/dhcp-exit
 
       if test "$reason" = BOUND -o "$reason" = REBOOT; then
-          ${pkgs.glibc}/sbin/nscd --invalidate hosts
-
           # Restart ntpd.  (The "ip-up" event below will trigger the
           # restart.)  We need to restart it to make sure that it will
           # actually do something: if ntpd cannot resolve the server

Modified: nixos/trunk/modules/services/system/nscd.nix
==============================================================================
--- nixos/trunk/modules/services/system/nscd.nix        Sat Jan 21 19:08:58 
2012        (r31778)
+++ nixos/trunk/modules/services/system/nscd.nix        Sat Jan 21 19:13:43 
2012        (r31779)
@@ -57,5 +57,15 @@
         exec = "nscd -f ${./nscd.conf} -d 2> /dev/null";
       };
 
+    # Flush nscd's ‘hosts’ database when the network comes up to get
+    # rid of any negative entries.
+    jobs.invalidate_nscd =
+      { name = "invalidate-nscd";
+        description = "Invalidate NSCD cache";
+        startOn = "ip-up";
+        task = true;
+        exec = "${pkgs.glibc}/sbin/nscd --invalidate hosts";
+      };
+
   };
 }
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to