Use event system to re-send query on new route. Tidies module boundaries.
diff --git a/src/dnsmasq.c b/src/dnsmasq.c
index 5560aa9..8b375de 100644
--- a/src/dnsmasq.c
+++ b/src/dnsmasq.c
@@ -30,6 +30,7 @@
 static void async_event(int pipe, time_t now);
 static void fatal_event(struct event_desc *ev, char *msg);
 static int read_event(int fd, struct event_desc *evp, char **msg);
+static void poll_resolv(int force, int do_reload, time_t now);
 
 int main (int argc, char **argv)
 {
@@ -1037,9 +1038,9 @@
     }
 }
 
-void send_newaddr(void)
+void queue_event(int event)
 {
-  send_event(pipewrite, EVENT_NEWADDR, 0, NULL);
+  send_event(pipewrite, event, 0, NULL);
 }
 
 void send_event(int fd, int event, int data, char *msg)
@@ -1239,7 +1240,13 @@
       case EVENT_NEWADDR:
 	newaddress(now);
 	break;
-	
+
+      case EVENT_NEWROUTE:
+	resend_query();
+	/* Force re-reading resolv file right now, for luck. */
+	poll_resolv(0, 1, now);
+	break;
+
       case EVENT_TERM:
 	/* Knock all our children on the head. */
 	for (i = 0; i < MAX_PROCS; i++)
@@ -1272,7 +1279,7 @@
       }
 }
 
-void poll_resolv(int force, int do_reload, time_t now)
+static void poll_resolv(int force, int do_reload, time_t now)
 {
   struct resolvc *res, *latest;
   struct stat statbuf;