Index: chilli.c
===================================================================
--- chilli.c	(revision 208)
+++ chilli.c	(working copy)
@@ -325,7 +325,7 @@
 			  hismac[4] * 0x100 + 
 			  hismac[5]);
   }
-
+  
   if (ippool_newip(ippool, ipm, hisip, 1)) {
     if (ippool_newip(ippool, ipm, hisip, 0)) {
       log_err(0, "Failed to allocate either static or dynamic IP address");
@@ -1060,7 +1060,7 @@
 
   log_dbg("Request SNAT ip for client ip: %s",
 	  inet_ntoa(appconn->hisip));
-
+  log_err(0, "assign_snat: trying to allocate newip");
   if (ippool_newip(ippool, &newipm, &appconn->natip, 0)) {
     log_err(0, "Failed to allocate SNAT IP address");
     return -1;
@@ -1414,6 +1414,7 @@
   dst.s_addr = ipph->daddr;
 
   if (ippool_getip(ippool, &ipm, &dst)) {
+    log_err(0, "cb_tun_ind: trying to allocate newip");
     if (ippool_newip(ippool, &ipm, &dst, 1)) {
       if (options()->debug) 
 	log_dbg("dropping packet with unknown destination: %s", inet_ntoa(dst));
@@ -1424,7 +1425,7 @@
   
   if ((appconn = (struct app_conn_t *)ipm->peer) == NULL ||
       (appconn->dnlink) == NULL) {
-    log_err(0, "No %s protocol defined for %s", appconn ? "dnlink" : "peer", inet_ntoa(dst));
+    log_dbg(0, "No %s protocol defined for %s", appconn ? "dnlink" : "peer", inet_ntoa(dst));
     return 0;
   }
 
@@ -2956,6 +2957,8 @@
     
     /* Allocate dynamic IP address */
     /*XXX    if (ippool_newip(ippool, &ipm, &appconn->reqip, 0)) {*/
+
+    log_err(0, "cb_dhcp_request: trying to allocate newip");
     if (newip(&ipm, &appconn->reqip, conn->hismac)) {
       log_err(0, "Failed allocate dynamic IP address");
       return -1;
Index: ippool.c
===================================================================
--- ippool.c	(revision 208)
+++ ippool.c	(working copy)
@@ -26,21 +26,20 @@
 
 int ippool_printaddr(struct ippool_t *this) {
   int n;
-  printf("ippool_printaddr\n");
-  printf("Firstdyn %d\n", this->firstdyn - this->member);
-  printf("Lastdyn %d\n",  this->lastdyn - this->member);
-  printf("Firststat %d\n", this->firststat - this->member);
-  printf("Laststat %d\n",  this->laststat - this->member);
-  printf("Listsize %d\n",  this->listsize);
+  log_err(0, "Listsize %d, Firstdyn %d, Lastdyn %d, Firststat %d, Laststat %d",
+	this->listsize,
+	this->firstdyn - this->member,
+	this->lastdyn - this->member,
+	this->firststat - this->member,
+	this->laststat - this->member);
 
-  for (n=0; n<this->listsize; n++) {
-    printf("Unit %d inuse %d prev %d next %d addr %s %x\n", 
+  for (n=0; n < 4; n++) {
+    log_err(0, "Unit %d inuse %d prev %d next %d addr %s", 
 	   n,
 	   this->member[n].inuse,
 	   this->member[n].prev - this->member,
 	   this->member[n].next - this->member,
-	   inet_ntoa(this->member[n].addr),	
-	   this->member[n].addr.s_addr
+	   inet_ntoa(this->member[n].addr)
 	   );
   }
   return 0;
@@ -285,7 +284,8 @@
     (*this)->member[i].next = NULL; /* Redundant */
   }
   
-  if (0) ippool_printaddr(*this);
+  /*log_err(0, "In ippool_new:");
+  ippool_printaddr(*this);*/
   return 0;
 }
 
@@ -331,7 +331,7 @@
   struct ippoolm_t *p2 = NULL;
   uint32_t hash;
 
-  log_dbg("Requesting new %s ip: %s", statip ? "static" : "dynamic", inet_ntoa(*addr));
+  log_err(0, "Requesting new %s ip: %s", statip ? "static" : "dynamic", inet_ntoa(*addr));
 
   /* If static:
    *   Look in dynaddr. 
@@ -345,7 +345,8 @@
    *
    */
 
-  /*if(0)(void)ippool_printaddr(this);*/
+  /*log_err(0, "In ippool_newip beginning:");
+  ippool_printaddr(this);*/
 
   /* First check to see if this type of address is allowed */
   if ((addr) && (addr->s_addr) && statip) { /* IP address given */
@@ -423,7 +424,8 @@
     p2->inuse = 1; /* Dynamic address in use */
     
     *member = p2;
-    if (0) (void)ippool_printaddr(this);
+    log_err(0, "In ippool_newip just allocated dynamic address from pool:");
+    ippool_printaddr(this);
     return 0; /* Success */
   }
 
@@ -459,7 +461,8 @@
 
     ippool_hashadd(this, *member);
 
-    if (0) (void)ippool_printaddr(this);
+    log_err(0, "In ippool_newip just allocated ip from static address space:");
+    ippool_printaddr(this);
     return 0; /* Success */
   }
 
@@ -468,8 +471,9 @@
 
 
 int ippool_freeip(struct ippool_t *this, struct ippoolm_t *member) {
-  
-  if (0) ippool_printaddr(this);
+ 
+  /*log_err(0, "In ippool_freeip beginning:"); 
+  ippool_printaddr(this);*/
 
   if (!member->inuse) {
     log_err(0, "Address not in use");
@@ -497,7 +501,8 @@
     
     member->inuse = 0;
     member->peer = NULL;
-    if (0) (void)ippool_printaddr(this);
+    log_err(0, "In ippool_freeip just reinserted ip into list of unused dynamic ips:");
+    ippool_printaddr(this);
     return 0;
 
   case 2: /* Allocated from static address space */
@@ -520,7 +525,8 @@
     member->addr.s_addr = 0;
     member->peer = NULL;
     member->nexthash = NULL;
-    if (0) (void)ippool_printaddr(this);
+    log_err(0, "In ippool_freeip just reinserted ip into list of unused static ips:");
+    ippool_printaddr(this);
     return 0;
 
   default: /* Should not happen */

