File l2tpd-log.patch of Package l2tpd

diff -Nur l2tpd-0.69-orig/aaa.c l2tpd-0.69/aaa.c
--- l2tpd-0.69-orig/aaa.c	2002-04-23 21:50:49.000000000 +0200
+++ l2tpd-0.69/aaa.c	2011-12-10 11:50:59.000000000 +0100
@@ -142,7 +142,7 @@
     f = fopen (gconfig.authfile, "r");
     if (!f)
     {
-        log (LOG_WARN, "%s : Unable to open '%s' for authentication\n",
+        l2tplog (LOG_WARN, "%s : Unable to open '%s' for authentication\n",
              __FUNCTION__, gconfig.authfile);
         return 0;
     }
@@ -166,7 +166,7 @@
         /* us */
         if (!*u)
         {
-            log (LOG_WARN,
+            l2tplog (LOG_WARN,
                  "%s: Invalid authentication info (no us), line %d\n",
                  __FUNCTION__, num);
             continue;
@@ -180,7 +180,7 @@
         /* them */
         if (!*t)
         {
-            log (LOG_WARN,
+            l2tplog (LOG_WARN,
                  "%s: Invalid authentication info (nothem), line %d\n",
                  __FUNCTION__, num);
             continue;
@@ -193,7 +193,7 @@
             s++;
         if (!*s)
         {
-            log (LOG_WARN,
+            l2tplog (LOG_WARN,
                  "%s: Invalid authentication info (no secret), line %d\n",
                  __FUNCTION__, num);
             continue;
@@ -202,7 +202,7 @@
             (!strcasecmp (t, them) || !strcasecmp (t, "*")))
         {
 #ifdef DEBUG_AUTH
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: we are '%s', they are '%s', secret is '%s'\n",
                  __FUNCTION__, u, t, s);
 #endif
@@ -219,12 +219,12 @@
     char *them;
     if (!t->lns && !t->lac)
     {
-        log (LOG_DEBUG, "%s: No LNS or LAC to handle challenge!\n",
+        l2tplog (LOG_DEBUG, "%s: No LNS or LAC to handle challenge!\n",
              __FUNCTION__);
         return -1;
     }
 #ifdef DEBUG_AUTH
-    log (LOG_DEBUG, "%s: making response for tunnel: %d\n", __FUNCTION__,
+    l2tplog (LOG_DEBUG, "%s: making response for tunnel: %d\n", __FUNCTION__,
          t->ourtid);
 #endif
     if (t->lns)
@@ -251,19 +251,19 @@
     }
     if (!get_secret (us, them, chal->secret, sizeof (chal->secret)))
     {
-        log (LOG_DEBUG, "%s: no secret found for us='%s' and them='%s'\n",
+        l2tplog (LOG_DEBUG, "%s: no secret found for us='%s' and them='%s'\n",
              __FUNCTION__, us, them);
         return -1;
     }
 
 #if DEBUG_AUTH
-    log (LOG_DEBUG, "*%s: Here comes the chal->ss:\n", __FUNCTION__);
+    l2tplog (LOG_DEBUG, "*%s: Here comes the chal->ss:\n", __FUNCTION__);
     bufferDump (&chal->ss, 1);
 
-    log (LOG_DEBUG, "%s: Here comes the secret\n", __FUNCTION__);
+    l2tplog (LOG_DEBUG, "%s: Here comes the secret\n", __FUNCTION__);
     bufferDump (chal->secret, strlen (chal->secret));
 
-    log (LOG_DEBUG, "%s: Here comes the challenge\n", __FUNCTION__);
+    l2tplog (LOG_DEBUG, "%s: Here comes the challenge\n", __FUNCTION__);
     bufferDump (chal->challenge, strlen (chal->challenge));
 #endif
 
@@ -274,7 +274,7 @@
     MD5Update (&chal->md5, chal->challenge, strlen(chal->challenge));
     MD5Final (chal->response, &chal->md5);
 #ifdef DEBUG_AUTH
-    log (LOG_DEBUG, "response is %X%X%X%X to '%s' and %X%X%X%X, %d\n",
+    l2tplog (LOG_DEBUG, "response is %X%X%X%X to '%s' and %X%X%X%X, %d\n",
          *((int *) &chal->response[0]),
          *((int *) &chal->response[4]),
          *((int *) &chal->response[8]),
@@ -317,7 +317,7 @@
                 (ntohl (t->peer.sin_addr.s_addr) <= ntohl (ipr->end)))
             {
 #ifdef DEBUG_AAA
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "get_lns: Rule %s to %s, sense %s matched %s\n",
                      IPADDY (ipr->start), IPADDY (ipr->end),
                      (ipr->sense ? "allow" : "deny"), IPADDY (t->addr));
@@ -345,14 +345,14 @@
 void print_md5 (void *md5)
 {
     int *i = (int *) md5;
-    log (LOG_DEBUG, "%X%X%X%X\n", i[0], i[1], i[2], i[3], i[4]);
+    l2tplog (LOG_DEBUG, "%X%X%X%X\n", i[0], i[1], i[2], i[3], i[4]);
 }
 
 inline void print_challenge (struct challenge *chal)
 {
-    log (LOG_DEBUG, "vector: ");
+    l2tplog (LOG_DEBUG, "vector: ");
     print_md5 (chal->vector);
-    log (LOG_DEBUG, "secret: %s\n", chal->secret);
+    l2tplog (LOG_DEBUG, "secret: %s\n", chal->secret);
 }
 #endif
 void encrypt_avp (struct buffer *buf, _u16 len, struct tunnel *t)
@@ -401,9 +401,9 @@
     while (ptr < end)
     {
 #if DEBUG_HIDDEN
-        log (LOG_DEBUG, "%s: The digest to be XOR'ed\n", __FUNCTION__);
+        l2tplog (LOG_DEBUG, "%s: The digest to be XOR'ed\n", __FUNCTION__);
         bufferDump (digest, MD_SIG_SIZE);
-        log (LOG_DEBUG, "%s: The plaintext to be XOR'ed\n", __FUNCTION__);
+        l2tplog (LOG_DEBUG, "%s: The plaintext to be XOR'ed\n", __FUNCTION__);
         bufferDump (ptr, MD_SIG_SIZE);
 #endif
         for (cnt = 0; cnt < MD_SIG_SIZE; cnt++, ptr++)
@@ -411,7 +411,7 @@
             *ptr = *ptr ^ digest[cnt];
         }
 #if DEBUG_HIDDEN
-        log (LOG_DEBUG, "%s: The result of XOR\n", __FUNCTION__);
+        l2tplog (LOG_DEBUG, "%s: The result of XOR\n", __FUNCTION__);
         bufferDump (previous_segment, MD_SIG_SIZE);
 #endif
         if (ptr < end)
@@ -445,7 +445,7 @@
     end = buf + olen;
     if (!t->chal_us.vector)
     {
-        log (LOG_DEBUG,
+        l2tplog (LOG_DEBUG,
              "decrypt_avp: Hidden bit set, but no random vector specified!\n");
         return -EINVAL;
     }
@@ -460,9 +460,9 @@
     MD5Update (&t->chal_us.md5, t->chal_us.vector, t->chal_us.vector_len);
     MD5Final (digest, &t->chal_us.md5);
 #ifdef DEBUG_HIDDEN
-    log (LOG_DEBUG, "attribute is %d and challenge is: ", attr);
+    l2tplog (LOG_DEBUG, "attribute is %d and challenge is: ", attr);
     print_challenge (&t->chal_us);
-    log (LOG_DEBUG, "md5 is: ");
+    l2tplog (LOG_DEBUG, "md5 is: ");
     print_md5 (digest);
 #endif
     while (ptr < end)
@@ -494,7 +494,7 @@
     len = ntohs (new_hdr->attr) + sizeof (struct avp_hdr);
     if (len > olen - 2)
     {
-        log (LOG_DEBUG,
+        l2tplog (LOG_DEBUG,
              "decrypt_avp: Decrypted length is too long (%d > %d)\n", len,
              olen - 2);
         return -EINVAL;
diff -Nur l2tpd-0.69-orig/aaa.h l2tpd-0.69/aaa.h
--- l2tpd-0.69-orig/aaa.h	2002-04-10 22:09:33.000000000 +0200
+++ l2tpd-0.69/aaa.h	2011-12-10 11:50:59.000000000 +0100
@@ -46,7 +46,7 @@
 };
 
 extern struct lns *get_lns (struct tunnel *);
-extern struct addr_ent *uaddr[];
+/* extern struct addr_ent *uaddr[]; */
 extern unsigned int get_addr (struct iprange *);
 extern void reserve_addr (unsigned int);
 extern void unreserve_addr (unsigned int);
diff -Nur l2tpd-0.69-orig/avp.c l2tpd-0.69/avp.c
--- l2tpd-0.69-orig/avp.c	2011-12-10 11:50:33.000000000 +0100
+++ l2tpd-0.69/avp.c	2011-12-10 11:50:59.000000000 +0100
@@ -142,7 +142,7 @@
     if (datalen != 8)
     {
         if (DEBUG)
-            log (LOG_DEBUG, "%s: wrong size (%d != 8)\n", __FUNCTION__,
+            l2tplog (LOG_DEBUG, "%s: wrong size (%d != 8)\n", __FUNCTION__,
                  datalen);
         wrong_length (c, "Message Type", 8, datalen, 0);
         return -EINVAL;
@@ -150,13 +150,13 @@
     if ((c->msgtype > MAX_MSG) || (!msgtypes[c->msgtype]))
     {
         if (DEBUG)
-            log (LOG_DEBUG, "%s: unknown message type %d\n", __FUNCTION__,
+            l2tplog (LOG_DEBUG, "%s: unknown message type %d\n", __FUNCTION__,
                  c->msgtype);
         return -EINVAL;
     }
     if (debug_avp)
         if (DEBUG)
-            log (LOG_DEBUG, "%s: message type %d (%s)\n", __FUNCTION__,
+            l2tplog (LOG_DEBUG, "%s: message type %d (%s)\n", __FUNCTION__,
                  c->msgtype, msgtypes[c->msgtype]);
 #ifdef SANITY
     if (t->sanity)
@@ -168,7 +168,7 @@
         if ((c != t->self) && (c->msgtype < Hello))
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: attempting to negotiate tunnel inside a call!\n",
                      __FUNCTION__);
             return -EINVAL;
@@ -185,7 +185,7 @@
                  */
 
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: attempting to negotiate SCCRQ with state != 0\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -195,7 +195,7 @@
             if (t->state != SCCRQ)
             {
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: attempting to negotiate SCCRP with state != SCCRQ!\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -205,7 +205,7 @@
             if (t->state != SCCRP)
             {
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: attempting to negotiate SCCCN with state != SCCRP!\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -215,7 +215,7 @@
             if (t->state != SCCCN)
             {
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: attempting to negotiate ICRQ when state != SCCCN\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -223,7 +223,7 @@
             if (c != t->self)
             {
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: attempting to negotiate ICRQ on a call!\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -233,7 +233,7 @@
             if (t->state != SCCCN)
             {
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: attempting to negotiate ICRP on tunnel!=SCCCN\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -241,7 +241,7 @@
             if (c->state != ICRQ)
             {
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: attempting to negotiate ICRP when state != ICRQ\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -251,7 +251,7 @@
             if (c->state != ICRP)
             {
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: attempting to negotiate ICCN when state != ICRP\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -261,7 +261,7 @@
             if (c->state != ICCN)
             {
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: attempting to negotiate SLI when state != ICCN\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -271,7 +271,7 @@
             if (t->state != SCCCN)
             {
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: attempting to negotiate OCRP on tunnel!=SCCCN\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -279,7 +279,7 @@
             if (c->state != OCRQ)
             {
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: attempting to negotiate OCRP when state != OCRQ\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -290,7 +290,7 @@
             if (c->state != OCRQ)
             {
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: attempting to negotiate OCCN when state != OCRQ\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -301,7 +301,7 @@
         case Hello:
             break;
         default:
-            log (LOG_WARN, "%s: i don't know how to handle %s messages\n",
+            l2tplog (LOG_WARN, "%s: i don't know how to handle %s messages\n",
                  __FUNCTION__, msgtypes[c->msgtype]);
             return -EINVAL;
         }
@@ -313,12 +313,12 @@
         if (debug_avp)
         {
             if (DEBUG)
-                log (LOG_DEBUG, "%s: new incoming call\n", __FUNCTION__);
+                l2tplog (LOG_DEBUG, "%s: new incoming call\n", __FUNCTION__);
         }
         tmp = new_call (t);
         if (!tmp)
         {
-            log (LOG_WARN, "%s: unable to create new call\n", __FUNCTION__);
+            l2tplog (LOG_WARN, "%s: unable to create new call\n", __FUNCTION__);
             return -EINVAL;
         }
         tmp->next = t->call_head;
@@ -345,7 +345,7 @@
         if (size < 0)
         {
             if (DEBUG)
-                log (LOG_DEBUG, "%s: Random vector too small (%d < 0)\n",
+                l2tplog (LOG_DEBUG, "%s: Random vector too small (%d < 0)\n",
                      __FUNCTION__, size);
             wrong_length (c, "Random Vector", 6, datalen, 1);
             return -EINVAL;
@@ -353,14 +353,14 @@
         if (size > MAX_VECTOR_SIZE)
         {
             if (DEBUG)
-                log (LOG_DEBUG, "%s: Random vector too large (%d > %d)\n",
+                l2tplog (LOG_DEBUG, "%s: Random vector too large (%d > %d)\n",
                      __FUNCTION__, datalen, MAX_VECTOR_SIZE);
             wrong_length (c, "Random Vector", 6, datalen, 1);
             return -EINVAL;
         }
     }
     if (debug_avp)
-        log (LOG_DEBUG, "%s: Random Vector of %d octets\n", __FUNCTION__,
+        l2tplog (LOG_DEBUG, "%s: Random Vector of %d octets\n", __FUNCTION__,
              size);
     t->chal_us.vector = (unsigned char *) &raw[3];
     t->chal_us.vector_len = size;
@@ -383,7 +383,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG, "%s : Ignoring AVP\n", __FUNCTION__);
+            l2tplog (LOG_DEBUG, "%s : Ignoring AVP\n", __FUNCTION__);
     }
     return 0;
 }
@@ -396,7 +396,7 @@
         if (datalen != 6)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is incorrect size.  %d != 6\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Sequencing Required", 6, datalen, 1);
@@ -408,7 +408,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: sequencing required not appropriate for %s!\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return -EINVAL;
@@ -418,7 +418,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG, "%s: peer requires sequencing.\n", __FUNCTION__);
+            l2tplog (LOG_DEBUG, "%s: peer requires sequencing.\n", __FUNCTION__);
     }
     c->seq_reqd = -1;
     return 0;
@@ -441,7 +441,7 @@
         if (datalen < 10)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is incorrect size.  %d < 10\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Result Code", 10, datalen, 1);
@@ -454,7 +454,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: result code not appropriate for %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -466,7 +466,7 @@
     if ((c->msgtype == StopCCN) && ((result > 7) || (result < 1)))
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: result code out of range (%d %d %d).  Ignoring.\n",
                  __FUNCTION__, result, error, datalen);
         return 0;
@@ -475,7 +475,7 @@
     if ((c->msgtype == CDN) && ((result > 11) || (result < 1)))
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: result code out of range (%d %d %d).  Ignoring.\n",
                  __FUNCTION__, result, error, datalen);
         return 0;
@@ -488,14 +488,14 @@
     {
         if (DEBUG && (c->msgtype == StopCCN))
         {
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer closing for reason %d (%s), error = %d (%s)\n",
                  __FUNCTION__, result, stopccn_result_codes[result], error,
                  c->errormsg);
         }
         else
         {
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer closing for reason %d (%s), error = %d (%s)\n",
                  __FUNCTION__, result, cdn_result_codes[result], error,
                  c->errormsg);
@@ -520,7 +520,7 @@
         if (datalen != 8)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is incorrect size.  %d != 8\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Protocol Version", 8, datalen, 1);
@@ -533,7 +533,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: protocol version not appropriate for %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -544,7 +544,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer is using version %d, revision %d.\n", __FUNCTION__,
                  (ver >> 8), ver & 0xFF);
     }
@@ -572,7 +572,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: framing capabilities not appropriate for %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -580,7 +580,7 @@
         if (datalen != 10)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is incorrect size.  %d != 10\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Framming Capabilities", 10, datalen, 0);
@@ -591,7 +591,7 @@
     caps = ntohs (raw[4]);
     if (debug_avp)
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: supported peer frames:%s%s\n", __FUNCTION__,
                  caps & ASYNC_FRAMING ? " async" : "",
                  caps & SYNC_FRAMING ? " sync" : "");
@@ -618,7 +618,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: bearer capabilities not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -626,7 +626,7 @@
         if (datalen != 10)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is incorrect size.  %d != 10\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Bearer Capabilities", 10, datalen, 0);
@@ -639,7 +639,7 @@
     {
         if (DEBUG)
         {
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: supported peer bearers:%s%s\n",
                  __FUNCTION__,
                  caps & ANALOG_BEARER ? " analog" : "",
@@ -673,7 +673,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: firmware revision not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -681,7 +681,7 @@
         if (datalen != 8)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is incorrect size.  %d != 8\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Firmware Revision", 8, datalen, 0);
@@ -693,7 +693,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer reports firmware version %d (0x%.4x)\n",
                  __FUNCTION__, ver, ver);
     }
@@ -720,7 +720,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: bearer type not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -728,7 +728,7 @@
         if (datalen != 10)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is incorrect size.  %d != 10\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Bearer Type", 10, datalen, 0);
@@ -740,7 +740,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer bears:%s\n", __FUNCTION__,
                  b & ANALOG_BEARER ? " analog" : "digital");
     }
@@ -767,7 +767,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: frame type not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -775,7 +775,7 @@
         if (datalen != 10)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is incorrect size.  %d != 10\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Frame Type", 10, datalen, 0);
@@ -787,7 +787,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer uses:%s frames\n", __FUNCTION__,
                  b & ASYNC_FRAMING ? " async" : "sync");
     }
@@ -813,7 +813,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: hostname not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -821,7 +821,7 @@
         if (datalen < 6)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is too small.  %d < 6\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Hostname", 6, datalen, 1);
@@ -833,7 +833,7 @@
     if (size > MAXSTRLEN - 1)
     {
         if (DEBUG)
-            log (LOG_DEBUG, "%s: truncating reported hostname (size is %d)\n",
+            l2tplog (LOG_DEBUG, "%s: truncating reported hostname (size is %d)\n",
                  __FUNCTION__, size);
         size = MAXSTRLEN - 1;
     }
@@ -841,7 +841,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer reports hostname '%s'\n", __FUNCTION__,
                  t->hostname);
     }
@@ -866,7 +866,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: dialing number not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -874,7 +874,7 @@
         if (datalen < 6)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is too small.  %d < 6\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Dialing Number", 6, datalen, 1);
@@ -886,7 +886,7 @@
     if (size > MAXSTRLEN - 1)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: truncating reported dialing number (size is %d)\n",
                  __FUNCTION__, size);
         size = MAXSTRLEN - 1;
@@ -895,7 +895,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer reports dialing number '%s'\n", __FUNCTION__,
                  t->call_head->dialing);
     }
@@ -921,7 +921,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: dialed number not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -929,7 +929,7 @@
         if (datalen < 6)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is too small.  %d < 6\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Dialed Number", 6, datalen, 1);
@@ -941,7 +941,7 @@
     if (size > MAXSTRLEN - 1)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: truncating reported dialed number (size is %d)\n",
                  __FUNCTION__, size);
         size = MAXSTRLEN - 1;
@@ -950,7 +950,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer reports dialed number '%s'\n", __FUNCTION__,
                  t->call_head->dialed);
     }
@@ -976,7 +976,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: sub_address not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -984,7 +984,7 @@
         if (datalen < 6)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is too small.  %d < 6\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Sub-address", 6, datalen, 1);
@@ -996,7 +996,7 @@
     if (size > MAXSTRLEN - 1)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: truncating reported sub address (size is %d)\n",
                  __FUNCTION__, size);
         size = MAXSTRLEN - 1;
@@ -1005,7 +1005,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer reports subaddress '%s'\n", __FUNCTION__,
                  t->call_head->subaddy);
     }
@@ -1030,7 +1030,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: vendor not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -1038,7 +1038,7 @@
         if (datalen < 6)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is too small.  %d < 6\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Vendor", 6, datalen, 1);
@@ -1050,7 +1050,7 @@
     if (size > MAXSTRLEN - 1)
     {
         if (DEBUG)
-            log (LOG_DEBUG, "%s: truncating reported vendor (size is %d)\n",
+            l2tplog (LOG_DEBUG, "%s: truncating reported vendor (size is %d)\n",
                  __FUNCTION__, size);
         size = MAXSTRLEN - 1;
     }
@@ -1058,7 +1058,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer reports vendor '%s'\n", __FUNCTION__, t->vendor);
     }
     return 0;
@@ -1081,7 +1081,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: challenge not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -1089,7 +1089,7 @@
         if (datalen < 6)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is too small.  %d < 6\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "challenge", 6, datalen, 1);
@@ -1103,7 +1103,7 @@
     size -= sizeof (struct avp_hdr);
     /* if (size != MD_SIG_SIZE)
     {
-        log (LOG_DEBUG, "%s: Challenge is not the right length (%d != %d)\n",
+        l2tplog (LOG_DEBUG, "%s: Challenge is not the right length (%d != %d)\n",
              __FUNCTION__, size, MD_SIG_SIZE);
         return -EINVAL;
     } */
@@ -1117,7 +1117,7 @@
     t->chal_us.state = STATE_CHALLENGED;
     if (debug_avp)
     {
-        log (LOG_DEBUG, "%s: challenge avp found\n", __FUNCTION__);
+        l2tplog (LOG_DEBUG, "%s: challenge avp found\n", __FUNCTION__);
     }
     return 0;
 }
@@ -1139,7 +1139,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: challenge response not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -1147,7 +1147,7 @@
         if (datalen < 6)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is too small.  %d < 6\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "challenge", 6, datalen, 1);
@@ -1159,7 +1159,7 @@
     size -= sizeof (struct avp_hdr);
     if (size != MD_SIG_SIZE)
     {
-        log (LOG_DEBUG, "%s: Challenge is not the right length (%d != %d)\n",
+        l2tplog (LOG_DEBUG, "%s: Challenge is not the right length (%d != %d)\n",
              __FUNCTION__, size, MD_SIG_SIZE);
         return -EINVAL;
     }
@@ -1167,7 +1167,7 @@
     bcopy (&raw[3], t->chal_them.reply, MD_SIG_SIZE);
     if (debug_avp)
     {
-        log (LOG_DEBUG, "%s: Challenge reply found\n", __FUNCTION__);
+        l2tplog (LOG_DEBUG, "%s: Challenge reply found\n", __FUNCTION__);
     }
     return 0;
 }
@@ -1191,7 +1191,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: tunnel ID not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -1199,7 +1199,7 @@
         if (datalen != 8)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is wrong size.  %d != 8\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Assigned Tunnel ID", 8, datalen, 0);
@@ -1218,7 +1218,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: using peer's tunnel %d\n", __FUNCTION__,
                  ntohs (raw[3]));
     }
@@ -1246,7 +1246,7 @@
         case OCRQ:
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: call ID not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -1254,7 +1254,7 @@
         if (datalen != 8)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is wrong size.  %d != 8\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Assigned Call ID", 8, datalen, 0);
@@ -1280,13 +1280,13 @@
     }
     else
     {
-        log (LOG_DEBUG, "%s:  Dunno what to do when it's state %s!\n",
+        l2tplog (LOG_DEBUG, "%s:  Dunno what to do when it's state %s!\n",
              __FUNCTION__, msgtypes[c->msgtype]);
     }
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: using peer's call %d\n", __FUNCTION__, ntohs (raw[3]));
     }
     return 0;
@@ -1313,7 +1313,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: packet delay not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -1321,7 +1321,7 @@
         if (datalen != 8)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is wrong size.  %d != 8\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Assigned Call ID", 8, datalen, 0);
@@ -1333,7 +1333,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer's delay is %d 1/10's of a second\n", __FUNCTION__,
                  ntohs (raw[3]));
     }
@@ -1357,7 +1357,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: call ID not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -1366,13 +1366,13 @@
         {
 #ifdef STRICT
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is wrong size.  %d != 10\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Serial Number", 10, datalen, 0);
             return -EINVAL;
 #else
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer is using old style serial number.  Will be invalid.\n",
                  __FUNCTION__);
 #endif
@@ -1385,7 +1385,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: serial number is %d\n", __FUNCTION__,
                  t->call_head->serno);
     }
@@ -1410,7 +1410,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: rx connect speed not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -1418,7 +1418,7 @@
         if (datalen != 10)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is wrong size.  %d != 10\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Connect Speed (RX)", 10, datalen, 0);
@@ -1431,7 +1431,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: receive baud rate is %d\n", __FUNCTION__, c->rxspeed);
     }
     return 0;
@@ -1455,7 +1455,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: tx connect speed not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -1463,7 +1463,7 @@
         if (datalen != 10)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is wrong size.  %d != 10\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Connect Speed (tx)", 10, datalen, 0);
@@ -1476,7 +1476,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: transmit baud rate is %d\n", __FUNCTION__, c->txspeed);
     }
     return 0;
@@ -1501,7 +1501,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: physical channel not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -1509,7 +1509,7 @@
         if (datalen != 10)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is wrong size.  %d != 10\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Physical Channel", 10, datalen, 0);
@@ -1522,7 +1522,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: physical channel is %d\n", __FUNCTION__,
                  t->call_head->physchan);
     }
@@ -1552,7 +1552,7 @@
             break;
         default:
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: RWS not appropriate for message %s.  Ignoring.\n",
                      __FUNCTION__, msgtypes[c->msgtype]);
             return 0;
@@ -1560,7 +1560,7 @@
         if (datalen != 8)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: avp is wrong size.  %d != 8\n", __FUNCTION__,
                      datalen);
             wrong_length (c, "Receive Window Size", 8, datalen, 0);
@@ -1574,7 +1574,7 @@
     if (debug_avp)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: peer wants RWS of %d.  Will use flow control.\n",
                  __FUNCTION__, t->rws);
     }
@@ -1597,7 +1597,7 @@
     char *data = buf->start + sizeof (struct control_hdr);
     avp = (struct avp_hdr *) data;
     if (debug_avp)
-        log (LOG_DEBUG, "%s: handling avp's for tunnel %d, call %d\n",
+        l2tplog (LOG_DEBUG, "%s: handling avp's for tunnel %d, call %d\n",
              __FUNCTION__, t->ourtid, c->ourcid);
     while (len > 0)
     {
@@ -1607,7 +1607,7 @@
         {
             if (AMBIT (avp->length))
             {
-                log (LOG_WARN,
+                l2tplog (LOG_WARN,
                      "%s:  dont know how to handle mandatory attribute %d.  Closing %s.\n",
                      __FUNCTION__, avp->attr,
                      (c != t->self) ? "call" : "tunnel");
@@ -1620,7 +1620,7 @@
             else
             {
                 if (DEBUG)
-                    log (LOG_WARN,
+                    l2tplog (LOG_WARN,
                          "%s:  dont know how to handle atribute %d.\n",
                          __FUNCTION__, avp->attr);
                 goto next;
@@ -1628,7 +1628,7 @@
         }
         if (ALENGTH (avp->length) > len)
         {
-            log (LOG_WARN,
+            l2tplog (LOG_WARN,
                  "%s: AVP received with length > remaining packet length!\n",
                  __FUNCTION__);
             set_error (c, ERROR_LENGTH, "Invalid AVP length");
@@ -1637,7 +1637,7 @@
         }
         if (avp->attr && firstavp)
         {
-            log (LOG_WARN, "%s: First AVP was not message type.\n",
+            l2tplog (LOG_WARN, "%s: First AVP was not message type.\n",
                  __FUNCTION__);
             set_error (c, VENDOR_ERROR, "First AVP must be message type");
             c->needclose = -1;
@@ -1645,7 +1645,7 @@
         }
         if (ALENGTH (avp->length) < sizeof (struct avp_hdr))
         {
-            log (LOG_WARN, "%s: AVP with too small of size (%d).\n",
+            l2tplog (LOG_WARN, "%s: AVP with too small of size (%d).\n",
                  __FUNCTION__, ALENGTH (avp->length));
             set_error (c, ERROR_LENGTH, "AVP too small");
             c->needclose = -1;
@@ -1653,7 +1653,7 @@
         }
         if (AZBITS (avp->length))
         {
-            log (LOG_WARN, "%s: %sAVP has reserved bits set.\n", __FUNCTION__,
+            l2tplog (LOG_WARN, "%s: %sAVP has reserved bits set.\n", __FUNCTION__,
                  AMBIT (avp->length) ? "Mandatory " : "");
             if (AMBIT (avp->length))
             {
@@ -1666,7 +1666,7 @@
         if (AHBIT (avp->length))
         {
 #ifdef DEBUG_HIDDEN
-            log (LOG_DEBUG, "%s: Hidden bit set on AVP.\n", __FUNCTION__);
+            l2tplog (LOG_DEBUG, "%s: Hidden bit set on AVP.\n", __FUNCTION__);
 #endif
             /* We want to rewrite the AVP as an unhidden AVP
                and then pass it along as normal.  Remeber how
@@ -1675,7 +1675,7 @@
             if (decrypt_avp (data, t))
             {
                 if (debug_avp)
-                    log (LOG_WARN, "%s: Unable to handle hidden %sAVP\n:",
+                    l2tplog (LOG_WARN, "%s: Unable to handle hidden %sAVP\n:",
                          __FUNCTION__,
                          (AMBIT (avp->length) ? "mandatory " : ""));
                 if (AMBIT (avp->length))
@@ -1700,7 +1700,7 @@
             {
                 if (AMBIT (avp->length))
                 {
-                    log (LOG_WARN,
+                    l2tplog (LOG_WARN,
                          "%s: Bad exit status handling attribute %d (%s) on mandatory packet.\n",
                          __FUNCTION__, avp->attr,
                          avps[avp->attr].description);
@@ -1710,7 +1710,7 @@
                 else
                 {
                     if (DEBUG)
-                        log (LOG_DEBUG,
+                        l2tplog (LOG_DEBUG,
                              "%s: Bad exit status handling attribute %d (%s).\n",
                              __FUNCTION__, avp->attr,
                              avps[avp->attr].description);
@@ -1721,7 +1721,7 @@
         {
             if (AMBIT (avp->length))
             {
-                log (LOG_WARN,
+                l2tplog (LOG_WARN,
                      "%s:  No handler for mandatory attribute %d (%s).  Closing %s.\n",
                      __FUNCTION__, avp->attr, avps[avp->attr].description,
                      (c != t->self) ? "call" : "tunnel");
@@ -1732,7 +1732,7 @@
             else
             {
                 if (DEBUG)
-                    log (LOG_WARN, "%s:  no handler for atribute %d (%s).\n",
+                    l2tplog (LOG_WARN, "%s:  no handler for atribute %d (%s).\n",
                          __FUNCTION__, avp->attr,
                          avps[avp->attr].description);
             }
@@ -1754,7 +1754,7 @@
     }
     if (len != 0)
     {
-        log (LOG_WARN, "%s: negative overall packet length\n", __FUNCTION__);
+        l2tplog (LOG_WARN, "%s: negative overall packet length\n", __FUNCTION__);
         return -EINVAL;
     }
     return 0;
diff -Nur l2tpd-0.69-orig/call.c l2tpd-0.69/call.c
--- l2tpd-0.69-orig/call.c	2011-12-10 11:50:33.000000000 +0100
+++ l2tpd-0.69/call.c	2011-12-10 11:50:59.000000000 +0100
@@ -136,11 +136,11 @@
                 return 0;
             }
             errors++;
-            log (LOG_DEBUG, "%s: Error %d (%s)\n", __FUNCTION__, errno,
+            l2tplog (LOG_DEBUG, "%s: Error %d (%s)\n", __FUNCTION__, errno,
                  strerror (errno));
             if (errors > 10)
             {
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Too many errors.  Declaring call dead.\n",
                      __FUNCTION__);
                 return -errno;
@@ -152,7 +152,7 @@
         case PPP_FLAG:
             if (escape)
             {
-                log (LOG_DEBUG, "%s: got an escaped PPP_FLAG\n",
+                l2tplog (LOG_DEBUG, "%s: got an escaped PPP_FLAG\n",
                      __FUNCTION__);
                 return -EINVAL;
             }
@@ -188,12 +188,12 @@
                 buf->len++;
                 break;
             };
-            log (LOG_WARN, "%s: read overrun\n", __FUNCTION__);
+            l2tplog (LOG_WARN, "%s: read overrun\n", __FUNCTION__);
             return -EINVAL;
         }
     }
     /* I should never get here */
-    log (LOG_WARN, "%s: You should not see this message.  If you do, please " \
+    l2tplog (LOG_WARN, "%s: You should not see this message.  If you do, please " \
 		       "enter a bug report at http://www.l2tpd.org", __FUNCTION__);
     return -EINVAL;
 }
@@ -205,7 +205,7 @@
     struct call *tmp, *tmp2;
     if (!c || !c->container)
     {
-        log (LOG_DEBUG, "%s: called on null call or containerless call\n",
+        l2tplog (LOG_DEBUG, "%s: called on null call or containerless call\n",
              __FUNCTION__);
         return;
     }
@@ -229,7 +229,7 @@
                 || ((struct tunnel *) se->data == c->container))
             {
 #ifdef DEBUG_CLOSE
-                log (LOG_DEBUG, "%s: Descheduling event\n", __FUNCTION__);
+                l2tplog (LOG_DEBUG, "%s: Descheduling event\n", __FUNCTION__);
 #endif
                 if (ose)
                 {
@@ -260,7 +260,7 @@
             /* Really close this tunnel, as our
                StopCCN has been ack'd */
 #ifdef DEBUG_CLOSE
-            log (LOG_DEBUG, "%s: Actually closing tunnel %d\n", __FUNCTION__,
+            l2tplog (LOG_DEBUG, "%s: Actually closing tunnel %d\n", __FUNCTION__,
                  c->container->ourtid);
 #endif
 #ifdef USE_KERNEL
@@ -296,7 +296,7 @@
         if (packet_dump)
             do_packet_dump (buf);
 #ifdef DEBUG_CLOSE
-        log (LOG_DEBUG, "%s: enqueing close message for tunnel\n",
+        l2tplog (LOG_DEBUG, "%s: enqueing close message for tunnel\n",
              __FUNCTION__);
 #endif
         control_xmit (buf);
@@ -313,7 +313,7 @@
             call_close (tmp);
             tmp = tmp2;
         }
-        log (LOG_LOG,
+        l2tplog (LOG_LOG,
              "%s : Connection %d closed to %s, port %d (%s)\n", __FUNCTION__,
              c->container->tid,
              IPADDY (c->container->peer.sin_addr),
@@ -333,7 +333,7 @@
         if (c->closing)
         {
 #ifdef DEBUG_CLOSE
-            log (LOG_DEBUG, "%s: Actually closing call %d\n", __FUNCTION__,
+            l2tplog (LOG_DEBUG, "%s: Actually closing call %d\n", __FUNCTION__,
                  c->ourcid);
 #endif
             destroy_call (c);
@@ -373,11 +373,11 @@
         if (packet_dump)
             do_packet_dump (buf);
 #ifdef DEBUG_CLOSE
-        log (LOG_DEBUG, "%s: enqueuing close message for call %d\n",
+        l2tplog (LOG_DEBUG, "%s: enqueuing close message for call %d\n",
              __FUNCTION__, c->ourcid);
 #endif
         control_xmit (buf);
-        log (LOG_LOG, "%s: Call %d to %s disconnected\n", __FUNCTION__,
+        l2tplog (LOG_LOG, "%s: Call %d to %s disconnected\n", __FUNCTION__,
              c->ourcid, IPADDY (c->container->peer.sin_addr));
     }
     /*
@@ -461,7 +461,7 @@
             c->lac->active)
         {
 #ifdef DEBUG_MAGIC
-            log (LOG_LOG, "%s: Will redial in %d seconds\n", __FUNCTION__,
+            l2tplog (LOG_LOG, "%s: Will redial in %d seconds\n", __FUNCTION__,
                  c->lac->rtimeout);
 #endif
             tv.tv_sec = c->lac->rtimeout;
@@ -517,7 +517,7 @@
             temp = (int *)entropy_buf;
             tmp->ourcid = *temp & 0xFFFF;
 #ifdef DEBUG_ENTROPY
-            log(LOG_DEBUG, "ourcid = %u, entropy_buf = %hx\n", tmp->ourcid, *temp);
+            l2tplog(LOG_DEBUG, "ourcid = %u, entropy_buf = %hx\n", tmp->ourcid, *temp);
 #endif
         }
 #else
@@ -606,7 +606,7 @@
                             return sc;
                         sc = sc->next;
                     }
-                    log (LOG_DEBUG, "%s: can't find call %d in tunnel %d\n",
+                    l2tplog (LOG_DEBUG, "%s: can't find call %d in tunnel %d\n",
                          __FUNCTION__, call, tunnel);
                     return NULL;
                 }
@@ -617,7 +617,7 @@
             }
             st = st->next;
         }
-        log (LOG_DEBUG, "%s:can't find tunnel %d\n", __FUNCTION__, tunnel);
+        l2tplog (LOG_DEBUG, "%s:can't find tunnel %d\n", __FUNCTION__, tunnel);
         return NULL;
     }
     else
@@ -630,7 +630,7 @@
 
         if (call)
         {
-            log (LOG_WARN,
+            l2tplog (LOG_WARN,
                  "%s: call ID specified, but no tunnel ID specified.  tossing.\n",
                  __FUNCTION__);
             return NULL;
@@ -641,13 +641,13 @@
          */
         if (debug_tunnel)
         {
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: allocating new tunnel for host %s, port %d.\n",
                  __FUNCTION__, IPADDY (addr), ntohs (port));
         }
         if (!(st = new_tunnel ()))
         {
-            log (LOG_WARN,
+            l2tplog (LOG_WARN,
                  "%s: unable to allocate new tunnel for host %s, port %d.\n",
                  __FUNCTION__, IPADDY (addr), ntohs (port));
             return NULL;
diff -Nur l2tpd-0.69-orig/control.c l2tpd-0.69/control.c
--- l2tpd-0.69-orig/control.c	2011-12-10 11:50:33.000000000 +0100
+++ l2tpd-0.69/control.c	2011-12-10 11:50:59.000000000 +0100
@@ -136,14 +136,14 @@
     if (packet_dump)
         do_packet_dump (buf);
 #ifdef DEBUG_HELLO
-    log (LOG_DEBUG, "%s: sending Hello on %d\n", __FUNCTION__, t->ourtid);
+    l2tplog (LOG_DEBUG, "%s: sending Hello on %d\n", __FUNCTION__, t->ourtid);
 #endif
     control_xmit (buf);
     /*
      * Schedule another Hello in a little bit.
      */
 #ifdef DEBUG_HELLO
-    log (LOG_DEBUG, "%s: scheduling another Hello on %d\n", __FUNCTION__,
+    l2tplog (LOG_DEBUG, "%s: scheduling another Hello on %d\n", __FUNCTION__,
          t->ourtid);
 #endif
     t->hello = schedule (tv, hello, (void *) t);
@@ -155,7 +155,7 @@
     add_control_hdr (t, c, buf);
     t->control_seq_num--;
 #ifdef DEBUG_ZLB
-    log (LOG_DEBUG, "%s: sending control ZLB on tunnel %d\n", __FUNCTION__,
+    l2tplog (LOG_DEBUG, "%s: sending control ZLB on tunnel %d\n", __FUNCTION__,
          t->tid);
 #endif
     udp_xmit (buf);
@@ -185,12 +185,12 @@
     char dummy_buf[128] = "/var/l2tp/"; /* jz: needed to read /etc/ppp/var.options - just kick it if you dont like */
     if (c->msgtype < 0)
     {
-        log (LOG_DEBUG, "%s: Whoa...  non-ZLB with no message type!\n",
+        l2tplog (LOG_DEBUG, "%s: Whoa...  non-ZLB with no message type!\n",
              __FUNCTION__);
         return -EINVAL;
     }
     if (debug_state)
-        log (LOG_DEBUG,
+        l2tplog (LOG_DEBUG,
              "%s: message type is %s(%d).  Tunnel is %d, call is %d.\n",
              __FUNCTION__, msgtypes[c->msgtype], c->msgtype, t->tid, c->cid);
     switch (c->msgtype)
@@ -245,7 +245,7 @@
             if (packet_dump)
                 do_packet_dump (buf);
             if (debug_state)
-                log (LOG_DEBUG, "%s: control_finish: sending SCCRQ\n",
+                l2tplog (LOG_DEBUG, "%s: control_finish: sending SCCRQ\n",
                      __FUNCTION__);
             control_xmit (buf);
         }
@@ -287,7 +287,7 @@
                 if (packet_dump)
                     do_packet_dump (buf);
                 if (debug_state)
-                    log (LOG_DEBUG, "%s: sending ICRQ\n", __FUNCTION__);
+                    l2tplog (LOG_DEBUG, "%s: sending ICRQ\n", __FUNCTION__);
                 control_xmit (buf);
             }
             else
@@ -340,7 +340,7 @@
         if (t->tid <= 0)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer did not specify assigned tunnel ID.  Closing.\n",
                      __FUNCTION__);
             set_error (c, VENDOR_ERROR, "Specify your assigned tunnel ID");
@@ -350,7 +350,7 @@
         if (!(t->lns = get_lns (t)))
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Denied connection to unauthorized peer %s\n",
                      __FUNCTION__, IPADDY (t->peer.sin_addr));
             set_error (c, VENDOR_ERROR, "No Authorization");
@@ -362,7 +362,7 @@
         if (t->fc < 0)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer did not specify framing capability.  Closing.\n",
                      __FUNCTION__);
             set_error (c, VENDOR_ERROR, "Specify framing capability");
@@ -375,7 +375,7 @@
          * We shouldn't be requiring a bearer capabilities avp to be present in 
          * SCCRQ and SCCRP as they aren't required
          if (t->bc < 0 ) {
-         if (DEBUG) log(LOG_DEBUG,
+         if (DEBUG) l2tplog(LOG_DEBUG,
          "%s: Peer did not specify bearer capability.  Closing.\n",__FUNCTION__);
          set_error(c, VENDOR_ERROR, "Specify bearer capability");
          c->needclose = -1;
@@ -384,7 +384,7 @@
         if ((!strlen (t->hostname)) && ((t->chal_us.state) || ((t->lns->challenge))))
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer did not specify hostname.  Closing.\n",
                      __FUNCTION__);
             set_error (c, VENDOR_ERROR, "Specify your hostname");
@@ -404,7 +404,7 @@
                  * But it is legitimate for two different remote systems
                  * to use the same tid
                  */
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer requested tunnel %d twice, ignoring second one.\n",
                      __FUNCTION__, t->tid);
                 c->needclose = 0;
@@ -441,7 +441,7 @@
             t->chal_them.challenge = malloc(MD_SIG_SIZE);
             if (!(t->chal_them.challenge))
             {
-                log (LOG_WARN, "%s: malloc failed\n", __FUNCTION__);
+                l2tplog (LOG_WARN, "%s: malloc failed\n", __FUNCTION__);
                 set_error (c, VENDOR_ERROR, "malloc failed");
                 toss (buf);
                 return -EINVAL;
@@ -451,7 +451,7 @@
             if (handle_challenge (t, &t->chal_them))
             {
                 /* We already know what to expect back */
-                log (LOG_WARN, "%s: No secret for '%s'\n", __FUNCTION__,
+                l2tplog (LOG_WARN, "%s: No secret for '%s'\n", __FUNCTION__,
                      t->hostname);
                 set_error (c, VENDOR_ERROR, "No secret on our side");
                 toss (buf);
@@ -464,7 +464,7 @@
             do_packet_dump (buf);
         c->cnu = 0;
         if (debug_state)
-            log (LOG_DEBUG, "%s: sending SCCRP\n", __FUNCTION__);
+            l2tplog (LOG_DEBUG, "%s: sending SCCRP\n", __FUNCTION__);
         control_xmit (buf);
         break;
     case SCCRP:
@@ -475,7 +475,7 @@
         if (t->fc < 0)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer did not specify framing capability.  Closing.\n",
                      __FUNCTION__);
             set_error (c, VENDOR_ERROR, "Specify framing capability");
@@ -488,7 +488,7 @@
          * We shouldn't be requiring a bearer capabilities avp to be present in 
          * SCCRQ and SCCRP as they aren't required
          if (t->bc < 0 ) {
-         if (DEBUG) log(LOG_DEBUG,
+         if (DEBUG) l2tplog(LOG_DEBUG,
          "%s: Peer did not specify bearer capability.  Closing.\n",__FUNCTION__);
          set_error(c, VENDOR_ERROR, "Specify bearer capability");
          c->needclose = -1;
@@ -497,7 +497,7 @@
         if ((!strlen (t->hostname)) && ((t->chal_them.state) || ((t->chal_us.state))))
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer did not specify hostname.  Closing.\n",
                      __FUNCTION__);
             set_error (c, VENDOR_ERROR, "Specify your hostname");
@@ -507,7 +507,7 @@
         if (t->tid <= 0)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer did not specify assigned tunnel ID.  Closing.\n",
                      __FUNCTION__);
             set_error (c, VENDOR_ERROR, "Specify your assigned tunnel ID");
@@ -520,7 +520,7 @@
             if (handle_challenge (t, &t->chal_them))
             {
                 set_error (c, VENDOR_ERROR, "No secret key on our side");
-                log (LOG_WARN, "%s: No secret key for authenticating '%s'\n",
+                l2tplog (LOG_WARN, "%s: No secret key for authenticating '%s'\n",
                      __FUNCTION__, t->hostname);
                 c->needclose = -1;
                 return -EINVAL;
@@ -530,7 +530,7 @@
             {
                 set_error (c, VENDOR_ERROR,
                            "Invalid challenge authentication");
-                log (LOG_DEBUG, "%s: Invalid authentication for host '%s'\n",
+                l2tplog (LOG_DEBUG, "%s: Invalid authentication for host '%s'\n",
                      __FUNCTION__, t->hostname);
                 c->needclose = -1;
                 return -EINVAL;
@@ -541,7 +541,7 @@
             t->chal_us.ss = SCCCN;
             if (handle_challenge (t, &t->chal_us))
             {
-                log (LOG_WARN, "%s: No secret for authenticating to '%s'\n",
+                l2tplog (LOG_WARN, "%s: No secret for authenticating to '%s'\n",
                      __FUNCTION__, t->hostname);
                 set_error (c, VENDOR_ERROR, "No secret key on our end");
                 c->needclose = -1;
@@ -573,17 +573,17 @@
             do_packet_dump (buf);
         c->cnu = 0;
         if (debug_state)
-            log (LOG_DEBUG, "%s: sending SCCCN\n", __FUNCTION__);
+            l2tplog (LOG_DEBUG, "%s: sending SCCCN\n", __FUNCTION__);
         control_xmit (buf);
         /* Schedule a HELLO */
         tv.tv_sec = HELLO_DELAY;
         tv.tv_usec = 0;
 #ifdef DEBUG_HELLO
-        log (LOG_DEBUG, "%s: scheduling initial HELLO on %d\n", __FUNCTION__,
+        l2tplog (LOG_DEBUG, "%s: scheduling initial HELLO on %d\n", __FUNCTION__,
              t->ourtid);
 #endif
         t->hello = schedule (tv, hello, (void *) t);
-        log (LOG_LOG,
+        l2tplog (LOG_LOG,
              "%s: Connection established to %s, %d.  Local: %d, Remote: %d.\n",
              __FUNCTION__, IPADDY (t->peer.sin_addr),
              ntohs (t->peer.sin_port), t->ourtid, t->tid);
@@ -602,7 +602,7 @@
             {
                 set_error (c, VENDOR_ERROR,
                            "Invalid challenge authentication");
-                log (LOG_DEBUG, "%s: Invalid authentication for host '%s'\n",
+                l2tplog (LOG_DEBUG, "%s: Invalid authentication for host '%s'\n",
                      __FUNCTION__, t->hostname);
                 c->needclose = -1;
                 return -EINVAL;
@@ -619,7 +619,7 @@
         }
 #endif
         t->state = SCCCN;
-        log (LOG_LOG,
+        l2tplog (LOG_LOG,
              "%s: Connection established to %s, %d.  Local: %d, Remote: %d.  LNS session is '%s'\n",
              __FUNCTION__, IPADDY (t->peer.sin_addr),
              ntohs (t->peer.sin_port), t->ourtid, t->tid, t->lns->entname);
@@ -627,7 +627,7 @@
         tv.tv_sec = HELLO_DELAY;
         tv.tv_usec = 0;
 #ifdef DEBUG_HELLO
-        log (LOG_DEBUG, "%s: scheduling initial HELLO on %d\n", __FUNCTION__,
+        l2tplog (LOG_DEBUG, "%s: scheduling initial HELLO on %d\n", __FUNCTION__,
              t->ourtid);
 #endif
         t->hello = schedule (tv, hello, (void *) t);
@@ -636,7 +636,7 @@
         if (t->qtid < 0)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer tried to disconnect without specifying tunnel ID\n",
                      __FUNCTION__);
             return -EINVAL;
@@ -644,7 +644,7 @@
         if ((t->qtid != t->ourtid) && (t->ourtid > 0))
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer tried to disconnect with invalid TID (%d != %d)\n",
                      __FUNCTION__, t->qtid, t->ourtid);
             return -EINVAL;
@@ -655,12 +655,12 @@
         if (t->self->result < 0)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer tried to disconnect without specifying result code.\n",
                      __FUNCTION__);
             return -EINVAL;
         }
-        log (LOG_LOG,
+        l2tplog (LOG_LOG,
              "%s: Connection closed to %s, port %d (%s), Local: %d, Remote: %d\n",
              __FUNCTION__, IPADDY (t->peer.sin_addr),
              ntohs (t->peer.sin_port), t->self->errormsg, t->ourtid, t->tid);
@@ -681,7 +681,7 @@
         if (p->cid < 0)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer tried to initiate call without call ID\n",
                      __FUNCTION__);
             /* Here it doesn't make sense to use the needclose flag because 
@@ -696,7 +696,7 @@
             {
                 /* This can happen if we get a duplicate
                    ICRQ or if they don't get our ack packet */
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer requested call %d twice, ignoring second one.\n",
                      __FUNCTION__, p->cid);
                 p->needclose = 0;
@@ -712,7 +712,7 @@
          * isn't a big deal, but it would be nice to have *some* sort of check
          * for it and perhaps just log it and go on.  */
 /*    JLM	if (p->serno<1) {
-			if (DEBUG) log(LOG_DEBUG,
+			if (DEBUG) l2tplog(LOG_DEBUG,
 			"%s: Peer did not specify serial number when initiating call\n", __FUNCTION__);
 			call_close(p);
 			return -EINVAL;
@@ -724,7 +724,7 @@
         {
             set_error (p, ERROR_NORES, "No available IP address");
             call_close (p);
-            log (LOG_DEBUG, "%s: Out of IP addresses on tunnel %d!\n",
+            l2tplog (LOG_DEBUG, "%s: Out of IP addresses on tunnel %d!\n",
                  __FUNCTION__, t->tid);
             return -EINVAL;
         }
@@ -756,14 +756,14 @@
             do_packet_dump (buf);
         p->cnu = 0;
         if (debug_state)
-            log (LOG_DEBUG, "%s: Sending ICRP\n", __FUNCTION__);
+            l2tplog (LOG_DEBUG, "%s: Sending ICRP\n", __FUNCTION__);
         control_xmit (buf);
         break;
     case ICRP:
         if (c->cid < 0)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer tried to negotiate ICRP without specifying call ID\n",
                      __FUNCTION__);
             c->needclose = -1;
@@ -811,8 +811,8 @@
         }
 #endif
         if (debug_state)
-            log (LOG_DEBUG, "%s: Sending ICCN\n", __FUNCTION__);
-        log (LOG_LOG,
+            l2tplog (LOG_DEBUG, "%s: Sending ICCN\n", __FUNCTION__);
+        l2tplog (LOG_LOG,
              "%s: Call established with %s, Local: %d, Remote: %d, Serial: %d\n",
              __FUNCTION__, IPADDY (t->peer.sin_addr), c->ourcid, c->cid,
              c->serno);
@@ -871,21 +871,21 @@
     case ICCN:
         if (c == t->self)
         {
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: Peer attempted ICCN on the actual tunnel, not the call",
                  __FUNCTION__);
             return -EINVAL;
         }
         if (c->txspeed < 1)
         {
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: Peer did not specify transmit speed\n", __FUNCTION__);
             c->needclose = -1;
             return -EINVAL;
         };
         if (c->frame < 1)
         {
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: Peer did not specify framing type\n", __FUNCTION__);
             c->needclose = -1;
             return -EINVAL;
@@ -949,7 +949,7 @@
         }
         start_pppd (c, po);
         opt_destroy (po);
-        log (LOG_LOG,
+        l2tplog (LOG_LOG,
              "%s: Call established with %s, Local: %d, Remote: %d, Serial: %d\n",
              __FUNCTION__, IPADDY (t->peer.sin_addr), c->ourcid, c->cid,
              c->serno);
@@ -1007,7 +1007,7 @@
         };
         start_pppd (c, po);
 
-        log (LOG_LOG, "parameters: Local: %d , Remote: %d , Serial: %d , Pid: %d , Tunnelid: %d , Phoneid: %s\n", c->ourcid, c->cid, c->serno, c->pppd, t->ourtid, c->dial_no); /*  jz: just show some information */
+        l2tplog (LOG_LOG, "parameters: Local: %d , Remote: %d , Serial: %d , Pid: %d , Tunnelid: %d , Phoneid: %s\n", c->ourcid, c->cid, c->serno, c->pppd, t->ourtid, c->dial_no); /*  jz: just show some information */
 
         opt_destroy (po);
         if (c->lac)
@@ -1019,7 +1019,7 @@
         if (c->qcid < 0)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer tried to disconnect without specifying call ID\n",
                      __FUNCTION__);
             return -EINVAL;
@@ -1032,7 +1032,7 @@
             if (!p)
             {
                 if (DEBUG)
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: Unable to determine call to be disconnected.\n",
                          __FUNCTION__);
                 return -EINVAL;
@@ -1043,7 +1043,7 @@
         if ((c->qcid != p->ourcid) && p->ourcid > 0)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer tried to disconnect with invalid CID (%d != %d)\n",
                      __FUNCTION__, c->qcid, p->ourcid);
             return -EINVAL;
@@ -1052,12 +1052,12 @@
         if (c->result < 0)
         {
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Peer tried to disconnect without specifying result code.\n",
                      __FUNCTION__);
             return -EINVAL;
         }
-        log (LOG_LOG,
+        l2tplog (LOG_LOG,
              "%s: Connection closed to %s, serial %d (%s)\n", __FUNCTION__,
              IPADDY (t->peer.sin_addr), c->serno, c->errormsg);
         c->needclose = 0;
@@ -1068,7 +1068,7 @@
     case SLI:
         break;
     default:
-        log (LOG_DEBUG,
+        l2tplog (LOG_DEBUG,
              "%s: Don't know how to finish a message of type %d\n",
              __FUNCTION__, c->msgtype);
         set_error (c, VENDOR_ERROR, "Unimplemented message %d\n", c->msgtype);
@@ -1089,7 +1089,7 @@
     {
         if (DEBUG)
         {
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: Received too small of packet\n", __FUNCTION__);
         }
         return -EINVAL;
@@ -1099,7 +1099,7 @@
     {
         if (DEBUG)
         {
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: Reported and actual sizes differ (%d != %d)\n",
                  __FUNCTION__, h->length, buf->len);
         }
@@ -1109,13 +1109,13 @@
      * FIXME: H-bit handling goes here
      */
 #ifdef DEBUG_CONTROL
-    log (LOG_DEBUG, "%s: control, cid = %d, Ns = %d, Nr = %d\n", __FUNCTION__,
+    l2tplog (LOG_DEBUG, "%s: control, cid = %d, Ns = %d, Nr = %d\n", __FUNCTION__,
          c->cid, h->Ns, h->Nr);
 #endif
     if (h->Ns != t->control_rec_seq_num)
     {
         if (DEBUG)
-            log (LOG_DEBUG,
+            l2tplog (LOG_DEBUG,
                  "%s: Received out of order control packet on tunnel %d (%d != %d)\n",
                  __FUNCTION__, t->tid, h->Ns, t->control_rec_seq_num);
         if (((h->Ns < t->control_rec_seq_num) && 
@@ -1130,7 +1130,7 @@
              */
 #ifdef DEBUG_ZLB
             if (DEBUG)
-                log (LOG_DEBUG, "%s: Sending an updated ZLB in reponse\n",
+                l2tplog (LOG_DEBUG, "%s: Sending an updated ZLB in reponse\n",
                      __FUNCTION__);
 #endif
             zlb = new_outgoing (t);
@@ -1164,7 +1164,7 @@
         {
             if (DEBUG)
             {
-                log (LOG_DEBUG, "%s: Control bit not set\n", __FUNCTION__);
+                l2tplog (LOG_DEBUG, "%s: Control bit not set\n", __FUNCTION__);
             }
             return -EINVAL;
         }
@@ -1172,7 +1172,7 @@
         {
             if (DEBUG)
             {
-                log (LOG_DEBUG, "%s: Length bit not set\n", __FUNCTION__);
+                l2tplog (LOG_DEBUG, "%s: Length bit not set\n", __FUNCTION__);
             }
             return -EINVAL;
         }
@@ -1180,7 +1180,7 @@
         {
             if (DEBUG)
             {
-                log (LOG_DEBUG, "%s: Flow bit not set\n", __FUNCTION__);
+                l2tplog (LOG_DEBUG, "%s: Flow bit not set\n", __FUNCTION__);
             }
             return -EINVAL;
         }
@@ -1190,17 +1190,17 @@
             {
                 if (CVER (h->ver) == VER_PPTP)
                 {
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: PPTP packet received\n", __FUNCTION__);
                 }
                 else if (CVER (h->ver) < VER_L2TP)
                 {
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: L2F packet received\n", __FUNCTION__);
                 }
                 else
                 {
-                    log (LOG_DEBUG,
+                    l2tplog (LOG_DEBUG,
                          "%s: Unknown version received\n", __FUNCTION__);
                 }
             }
@@ -1226,7 +1226,7 @@
     {
         if (DEBUG)
         {
-            log (LOG_DEBUG, "%s: Aempted to send payload on tunnel\n",
+            l2tplog (LOG_DEBUG, "%s: Aempted to send payload on tunnel\n",
                  __FUNCTION__);
         }
         return -EINVAL;
@@ -1237,7 +1237,7 @@
            no matter what.  we'll look more later */
         if (DEBUG)
         {
-            log (LOG_DEBUG, "%s:Recieved to small of packet\n", __FUNCTION__);
+            l2tplog (LOG_DEBUG, "%s:Recieved to small of packet\n", __FUNCTION__);
         }
         return -EINVAL;
     }
@@ -1248,7 +1248,7 @@
         {
             if (DEBUG)
             {
-                log (LOG_DEBUG, "%s Control bit set\n", __FUNCTION__);
+                l2tplog (LOG_DEBUG, "%s Control bit set\n", __FUNCTION__);
             }
             return -EINVAL;
         }
@@ -1258,7 +1258,7 @@
         {
 /*			if (!c->fbit && !c->ourfbit) {
 				if (DEBUG)
-					log(LOG_DEBUG,"%s: flow bit set, but no RWS negotiated.\n",__FUNCTION__);
+					l2tplog(LOG_DEBUG,"%s: flow bit set, but no RWS negotiated.\n",__FUNCTION__);
 				return -EINVAL;
 			} */
             ehlen += 4;         /* Should have Ns and Nr too */
@@ -1266,7 +1266,7 @@
 /*		if (!PFBIT(h->ver)) {
 			if (c->fbit || c->ourfbit) {
 				if (DEBUG)
-					log(LOG_DEBUG, "%s: no flow bit, but RWS was negotiated.\n",__FUNCTION__);
+					l2tplog(LOG_DEBUG, "%s: no flow bit, but RWS was negotiated.\n",__FUNCTION__);
 				return -EINVAL;;
 			}
 		} */
@@ -1280,17 +1280,17 @@
             {
                 if (PVER (h->ver) == VER_PPTP)
                 {
-                    log (LOG_DEBUG, "%s: PPTP packet received\n",
+                    l2tplog (LOG_DEBUG, "%s: PPTP packet received\n",
                          __FUNCTION__);
                 }
                 else if (CVER (h->ver) < VER_L2TP)
                 {
-                    log (LOG_DEBUG, "%s: L2F packet received\n",
+                    l2tplog (LOG_DEBUG, "%s: L2F packet received\n",
                          __FUNCTION__);
                 }
                 else
                 {
-                    log (LOG_DEBUG, "%s: Unknown version received\n",
+                    l2tplog (LOG_DEBUG, "%s: Unknown version received\n",
                          __FUNCTION__);
                 }
             }
@@ -1300,7 +1300,7 @@
         {
             if (DEBUG)
             {
-                log (LOG_DEBUG, "%s payload too small (%d < %d)\n",
+                l2tplog (LOG_DEBUG, "%s payload too small (%d < %d)\n",
                      __FUNCTION__, buf->len, ehlen);
             }
             return -EINVAL;
@@ -1309,7 +1309,7 @@
         {
             if (DEBUG)
             {
-                log (LOG_DEBUG, "%s: size mismatch (%d != %d)\n",
+                l2tplog (LOG_DEBUG, "%s: size mismatch (%d != %d)\n",
                      __FUNCTION__, buf->len, h->length);
             }
             return -EINVAL;
@@ -1347,7 +1347,7 @@
         new_hdr = (struct payload_hdr *) (buf->start - ehlen);
         if ((void *) new_hdr < (void *) buf->rstart)
         {
-            log (LOG_WARN, "%s: not enough space to decompress frame\n",
+            l2tplog (LOG_WARN, "%s: not enough space to decompress frame\n",
                  __FUNCTION__);
             return -EINVAL;
 
@@ -1399,16 +1399,16 @@
      */
 /*  JLM	if (PRBIT(new_hdr->ver)) {
 		if (c->pSr > new_hdr->Ns) {
-			log(LOG_DEBUG, "%s: R-bit set with Ns < pSr!\n",__FUNCTION__);
+			l2tplog(LOG_DEBUG, "%s: R-bit set with Ns < pSr!\n",__FUNCTION__);
 			return -EINVAL;
 		}
 #ifdef DEBUG_FLOW
-		log(LOG_DEBUG, "%s: R-bit set on packet %d\n",__FUNCTION__,new_hdr->Ns);
+		l2tplog(LOG_DEBUG, "%s: R-bit set on packet %d\n",__FUNCTION__,new_hdr->Ns);
 #endif
 		c->pSr=new_hdr->Ns;
 	} */
 #ifdef DEBUG_PAYLOAD
-    log (LOG_DEBUG, "%s: payload, cid = %d, Ns = %d, Nr = %d\n", __FUNCTION__,
+    l2tplog (LOG_DEBUG, "%s: payload, cid = %d, Ns = %d, Nr = %d\n", __FUNCTION__,
          c->cid, new_hdr->Ns, new_hdr->Nr);
 #endif
     if (new_hdr->Ns != c->data_seq_num)
@@ -1421,7 +1421,7 @@
         {
 #ifdef DEBUG_FLOW
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Already seen this packet before (%d < %d)\n",
                      __FUNCTION__, new_hdr->Ns, c->pSr);
 #endif
@@ -1432,7 +1432,7 @@
             /* FIXME: I should buffer for out of order packets */
 #ifdef DEBUG_FLOW
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Oops, lost a packet or two (%d != %d).  continuing...\n",
                      __FUNCTION__, new_hdr->Ns, c->pSr);
 #endif
@@ -1442,7 +1442,7 @@
         {
 #ifdef DEBUG_FLOW
             if (DEBUG)
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Received out of order payload packet (%d != %d)\n",
                      __FUNCTION__, new_hdr->Ns, c->pSr);
 #endif
@@ -1475,13 +1475,13 @@
     c = (struct call *) data;
     if (!c)
     {
-        log (LOG_WARN, "%s: called on NULL call\n", __FUNCTION__);
+        l2tplog (LOG_WARN, "%s: called on NULL call\n", __FUNCTION__);
         return;
     }
     t = c->container;
     if (!t)
     {
-        log (LOG_WARN, "%s: called on call with NULL container\n",
+        l2tplog (LOG_WARN, "%s: called on call with NULL container\n",
              __FUNCTION__);
         return;
     }
@@ -1492,7 +1492,7 @@
     c->data_seq_num--;                   /* We don't increment on ZLB's */
     c->zlb_xmit = NULL;
 #ifdef DEBUG_ZLB
-    log (LOG_DEBUG, "%s: sending payload ZLB\n", __FUNCTION__);
+    l2tplog (LOG_DEBUG, "%s: sending payload ZLB\n", __FUNCTION__);
 #endif
     udp_xmit (buf);
     toss (buf);
@@ -1514,7 +1514,7 @@
     if (c->fd < 0)
     {
         if (DEBUG)
-            log (LOG_DEBUG, "%s: tty is not open yet.\n", __FUNCTION__);
+            l2tplog (LOG_DEBUG, "%s: tty is not open yet.\n", __FUNCTION__);
         return -EIO;
     }
     /*
@@ -1541,7 +1541,7 @@
         }
         else if (err == 0)
         {
-            log (LOG_WARN, "%s: wrote no bytes of async packet\n",
+            l2tplog (LOG_WARN, "%s: wrote no bytes of async packet\n",
                  __FUNCTION__);
             return -EINVAL;
         }
@@ -1553,19 +1553,19 @@
             }
             else
             {
-                log (LOG_WARN, "%s: async write failed: %s\n", __FUNCTION__,
+                l2tplog (LOG_WARN, "%s: async write failed: %s\n", __FUNCTION__,
                      strerror (errno));
             }
         }
         else if (err < buf->len)
         {
-            log (LOG_WARN, "%s: short write (%d of %d bytes)\n", __FUNCTION__,
+            l2tplog (LOG_WARN, "%s: short write (%d of %d bytes)\n", __FUNCTION__,
                  err, buf->len);
             return -EINVAL;
         }
         else if (err > buf->len)
         {
-            log (LOG_WARN, "%s: write returned LONGER than buffer length?\n",
+            l2tplog (LOG_WARN, "%s: write returned LONGER than buffer length?\n",
                  __FUNCTION__);
             return -EINVAL;
         }
@@ -1586,7 +1586,7 @@
        // 1 for a possible escape, 1 for the value and 1 to end the PPP stream.
         if (pos >= (sizeof(wbuf) - 4)) {
 	    if (DEBUG)
-                log(LOG_CRIT, "%s: rx packet is too big after PPP encoding (size %u, max is %u)\n", \
+                l2tplog(LOG_CRIT, "%s: rx packet is too big after PPP encoding (size %u, max is %u)\n", \
                 __FUNCTION__, buf->len, MAX_RECV_SIZE);
             return -EINVAL;
         }
@@ -1612,7 +1612,7 @@
                * everything ended normally
              */
             if (DEBUG)
-                log (LOG_WARN, "%s: %s(%d)\n", __FUNCTION__, strerror (errno),
+                l2tplog (LOG_WARN, "%s: %s(%d)\n", __FUNCTION__, strerror (errno),
                      errno);
             c->needclose = -1;
             c->fd = -1;
@@ -1646,7 +1646,7 @@
         {
             /* If it's a ZLB, we ignore it */
             if (debug_tunnel)
-                log (LOG_DEBUG, "%s: ZLB for closed call\n", __FUNCTION__);
+                l2tplog (LOG_DEBUG, "%s: ZLB for closed call\n", __FUNCTION__);
             c->cid = 0;
             return;
         }
@@ -1662,7 +1662,7 @@
     {
         c->cid = 0;
         if (debug_tunnel)
-            log (LOG_DEBUG, "%s: invalid control packet\n", __FUNCTION__);
+            l2tplog (LOG_DEBUG, "%s: invalid control packet\n", __FUNCTION__);
     }
 }
 
@@ -1682,7 +1682,7 @@
             if (buf->len == sizeof (struct control_hdr))
             {
 #ifdef DEBUG_ZLB
-                log (LOG_DEBUG, "%s: control ZLB received\n", __FUNCTION__);
+                l2tplog (LOG_DEBUG, "%s: control ZLB received\n", __FUNCTION__);
 #endif
                 t->control_rec_seq_num--;
                 c->cnu = 0;
@@ -1691,7 +1691,7 @@
                     if (c->container->cLr >= c->closeSs)
                     {
 #ifdef DEBUG_ZLB
-                        log (LOG_DEBUG, "%s: ZLB for closing message found\n",
+                        l2tplog (LOG_DEBUG, "%s: ZLB for closing message found\n",
                              __FUNCTION__);
 #endif
                         c->needclose = 0;
@@ -1707,13 +1707,13 @@
             else
             {
                 if (debug_tunnel)
-                    log (LOG_DEBUG, "%s: bad AVP handling!\n", __FUNCTION__);
+                    l2tplog (LOG_DEBUG, "%s: bad AVP handling!\n", __FUNCTION__);
                 return -EINVAL;
             }
         }
         else
         {
-            log (LOG_DEBUG, "%s: bad control packet!\n", __FUNCTION__);
+            l2tplog (LOG_DEBUG, "%s: bad control packet!\n", __FUNCTION__);
             return -EINVAL;
         }
     }
@@ -1728,11 +1728,11 @@
 /*					if (c->throttle) {
 						if (c->pSs > c->pLr + c->rws) {
 #ifdef DEBUG_FLOW
-							log(LOG_DEBUG, "%s: not yet dethrottling call\n",__FUNCTION__);
+							l2tplog(LOG_DEBUG, "%s: not yet dethrottling call\n",__FUNCTION__);
 #endif
 						} else {
 #ifdef DEBUG_FLOW
-							log(LOG_DEBUG, "%s: dethrottling call\n",__FUNCTION__);
+							l2tplog(LOG_DEBUG, "%s: dethrottling call\n",__FUNCTION__);
 #endif
 							if (c->dethrottle) deschedule(c->dethrottle);
 							c->dethrottle=NULL;
@@ -1754,7 +1754,7 @@
 						We've received enough to fill our receive window.  At
 						this point, we should immediately send a ZLB!
 #ifdef DEBUG_ZLB
-							log(LOG_DEBUG, "%s: Sending immediate ZLB!\n",__FUNCTION__);
+							l2tplog(LOG_DEBUG, "%s: Sending immediate ZLB!\n",__FUNCTION__);
 #endif
 							if (c->zlb_xmit) {
 							Deschedule any existing zlb_xmit's
@@ -1771,7 +1771,7 @@
 							if (c->zlb_xmit)
 								deschedule(c->zlb_xmit);
 #ifdef DEBUG_ZLB
-							log(LOG_DEBUG, "%s: scheduling ZLB\n",__FUNCTION__);
+							l2tplog(LOG_DEBUG, "%s: scheduling ZLB\n",__FUNCTION__);
 #endif
 							c->zlb_xmit = schedule(tv, &send_zlb, (void *)c);
 						}
@@ -1781,17 +1781,17 @@
                 else if (buf->len == sizeof (struct payload_hdr))
                 {
 #ifdef DEBUG_ZLB
-                    log (LOG_DEBUG, "%s: payload ZLB received\n",
+                    l2tplog (LOG_DEBUG, "%s: payload ZLB received\n",
                          __FUNCTION__);
 #endif
 /*					if (c->throttle) {
 						if (c->pSs > c->pLr + c->rws) {
 #ifdef DEBUG_FLOW
-							log(LOG_DEBUG, "%s: not yet dethrottling call\n",__FUNCTION__);
+							l2tplog(LOG_DEBUG, "%s: not yet dethrottling call\n",__FUNCTION__);
 #endif
 						} else {
 #ifdef DEBUG_FLOW
-							log(LOG_DEBUG, "%s: dethrottling call\n",__FUNCTION__);
+							l2tplog(LOG_DEBUG, "%s: dethrottling call\n",__FUNCTION__);
 #endif
 							if (c->dethrottle)
 								deschedule(c->dethrottle);
@@ -1804,21 +1804,21 @@
                 }
                 else
                 {
-                    log (LOG_DEBUG, "%s: payload too small!\n", __FUNCTION__);
+                    l2tplog (LOG_DEBUG, "%s: payload too small!\n", __FUNCTION__);
                     return -EINVAL;
                 }
             }
             else
             {
                 if (debug_tunnel)
-                    log (LOG_DEBUG, "%s: unable to expand payload!\n",
+                    l2tplog (LOG_DEBUG, "%s: unable to expand payload!\n",
                          __FUNCTION__);
                 return -EINVAL;
             }
         }
         else
         {
-            log (LOG_DEBUG, "%s: invalid payload packet!\n", __FUNCTION__);
+            l2tplog (LOG_DEBUG, "%s: invalid payload packet!\n", __FUNCTION__);
             return -EINVAL;
         }
     }
diff -Nur l2tpd-0.69-orig/file.c l2tpd-0.69/file.c
--- l2tpd-0.69-orig/file.c	2011-12-10 11:50:33.000000000 +0100
+++ l2tpd-0.69/file.c	2011-12-10 11:50:59.000000000 +0100
@@ -57,7 +57,7 @@
         }
         else
         {
-            log (LOG_CRIT, "%s: Unable to open config file %s or %s\n",
+            l2tplog (LOG_CRIT, "%s: Unable to open config file %s or %s\n",
                  __FUNCTION__, gconfig.configfile, gconfig.altconfigfile);
             return -1;
         }
@@ -75,7 +75,7 @@
     tmp = (struct lns *) malloc (sizeof (struct lns));
     if (!tmp)
     {
-        log (LOG_CRIT, "%s: Unable to allocate memory for new LNS\n",
+        l2tplog (LOG_CRIT, "%s: Unable to allocate memory for new LNS\n",
              __FUNCTION__);
         return NULL;
     }
@@ -119,7 +119,7 @@
     tmp = (struct lac *) malloc (sizeof (struct lac));
     if (!tmp)
     {
-        log (LOG_CRIT, "%s: Unable to allocate memory for lac entry!\n",
+        l2tplog (LOG_CRIT, "%s: Unable to allocate memory for lac entry!\n",
              __FUNCTION__);
         return NULL;
     }
@@ -172,7 +172,7 @@
 {
     int val;
 #ifdef DEBUG_FILE
-    log (LOG_DEBUG, "set_%s: %s  flag to '%s'\n", word, word, value);
+    l2tplog (LOG_DEBUG, "set_%s: %s  flag to '%s'\n", word, word, value);
 #endif /* ; */
     if ((val = yesno (value)) < 0)
     {
@@ -188,7 +188,7 @@
 {
     int val;
 #ifdef DEBUG_FILE
-    log (LOG_DEBUG, "set_%s: %s  flag to '%s'\n", word, word, value);
+    l2tplog (LOG_DEBUG, "set_%s: %s  flag to '%s'\n", word, word, value);
 #endif /* ; */
     if ((val = atoi (value)) < 0)
     {
@@ -202,7 +202,7 @@
 int set_string (char *word, char *value, char *ptr, int len)
 {
 #ifdef DEBUG_FILE
-    log (LOG_DEBUG, "set_%s: %s  flag to '%s'\n", word, word, value);
+    l2tplog (LOG_DEBUG, "set_%s: %s  flag to '%s'\n", word, word, value);
 #endif /* ; */
     strncpy (ptr, value, len);
     return 0;
@@ -214,7 +214,7 @@
     {
     case CONTEXT_GLOBAL:
 #ifdef DEBUG_FILE
-        log (LOG_DEBUG, "set_port: Setting global port number to %s\n",
+        l2tplog (LOG_DEBUG, "set_port: Setting global port number to %s\n",
              value);
 #endif
         set_int (word, value, &(((struct global *) item)->port));
@@ -239,7 +239,7 @@
     {
     case CONTEXT_LAC:
 #ifdef DEBUG_FILE
-        log (LOG_DEBUG, "set_rtimeout: Setting redial timeout to %s\n",
+        l2tplog (LOG_DEBUG, "set_rtimeout: Setting redial timeout to %s\n",
              value);
 #endif
         set_int (word, value, &(((struct lac *) item)->rtimeout));
@@ -309,7 +309,7 @@
     {
     case CONTEXT_LAC:
 #ifdef DEBUG_FILE
-        log (LOG_DEBUG, "set_rmax: Setting max redials to %s\n", value);
+        l2tplog (LOG_DEBUG, "set_rmax: Setting max redials to %s\n", value);
 #endif
         set_int (word, value, &(((struct lac *) item)->rmax));
         break;
@@ -333,7 +333,7 @@
     {
     case CONTEXT_GLOBAL:
 #ifdef DEBUG_FILE
-        log (LOG_DEBUG, "set_authfile: Setting global auth file to '%s'\n",
+        l2tplog (LOG_DEBUG, "set_authfile: Setting global auth file to '%s'\n",
              value);
 #endif /* ; */
         strncpy (((struct global *) item)->authfile, value,
@@ -764,7 +764,7 @@
     if (!lns->range)
         return -1;
 #ifdef DEBUG_FILE
-    log (LOG_DEBUG, "range start = %x, end = %x, sense=%ud\n",
+    l2tplog (LOG_DEBUG, "range start = %x, end = %x, sense=%ud\n",
          ntohl (ipr->start), ntohl (ipr->end), ipr->sense);
 #endif
     return 0;
@@ -786,7 +786,7 @@
     if (!lns->lacs)
         return -1;
 #ifdef DEBUG_FILE
-    log (LOG_DEBUG, "lac start = %x, end = %x, sense=%ud\n",
+    l2tplog (LOG_DEBUG, "lac start = %x, end = %x, sense=%ud\n",
          ntohl (ipr->start), ntohl (ipr->end), ipr->sense);
 #endif
     return 0;
@@ -828,7 +828,7 @@
     {
     case CONTEXT_GLOBAL:
 #ifdef DEBUG_FILE
-        log (LOG_DEBUG, "set_listenaddr: Setting listen address to %s\n",
+        l2tplog (LOG_DEBUG, "set_listenaddr: Setting listen address to %s\n",
              value);
 #endif
         if (set_ip (word, value, &(((struct global *) item)->listenaddr)))
@@ -888,7 +888,7 @@
     {
     case CONTEXT_LAC:
 #ifdef DEBUG_FILE
-        log (LOG_DEBUG, "set_lns: setting LNS to '%s'\n", value);
+        l2tplog (LOG_DEBUG, "set_lns: setting LNS to '%s'\n", value);
 #endif
         l = (struct lac *) item;
         d = strchr (value, ':');
@@ -932,7 +932,7 @@
 
 int set_rand_sys ()
 {
-    log(LOG_WARN, "The \"rand()\" function call is not a very good source"
+    l2tplog(LOG_WARN, "The \"rand()\" function call is not a very good source"
             "of randomness\n");
    rand_source = RAND_SYS;
     return 0;
@@ -946,7 +946,7 @@
 
 int set_rand_egd (char *value)
 {
-    log(LOG_WARN, "%s: not yet implemented!\n", __FUNCTION__);
+    l2tplog(LOG_WARN, "%s: not yet implemented!\n", __FUNCTION__);
     rand_source = RAND_EGD;
     return -1;
 }
@@ -974,7 +974,7 @@
  
     if (context != CONTEXT_GLOBAL)
     {
-        log(LOG_WARN, "%s: %s not valid in context %d\n",
+        l2tplog(LOG_WARN, "%s: %s not valid in context %d\n",
                 __FUNCTION__, word, context);
         return -1;
     }
@@ -998,7 +998,7 @@
     }
     else
     {
-        log(LOG_WARN, "%s: %s is not a valid randomness source\n",
+        l2tplog(LOG_WARN, "%s: %s is not a valid randomness source\n",
                 __FUNCTION__, value);
         return -1;
 
@@ -1044,7 +1044,7 @@
             /* We've got a context description */
             if (!(t = strchr (s, ']')))
             {
-                log (LOG_CRIT, "parse_config: line %d: No closing bracket\n",
+                l2tplog (LOG_CRIT, "parse_config: line %d: No closing bracket\n",
                      linenum);
                 return -1;
             }
@@ -1064,7 +1064,7 @@
             {
                 context = CONTEXT_GLOBAL;
 #ifdef DEBUG_FILE
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "parse_config: global context descriptor %s\n",
                      d ? d : "");
 #endif
@@ -1109,7 +1109,7 @@
                     strncpy (((struct lns *) data)->entname,
                              d, sizeof (((struct lns *) data)->entname));
 #ifdef DEBUG_FILE
-                log (LOG_DEBUG, "parse_config: lns context descriptor %s\n",
+                l2tplog (LOG_DEBUG, "parse_config: lns context descriptor %s\n",
                      d ? d : "");
 #endif
             }
@@ -1152,13 +1152,13 @@
                     strncpy (((struct lac *) data)->entname,
                              d, sizeof (((struct lac *) data)->entname));
 #ifdef DEBUG_FILE
-                log (LOG_DEBUG, "parse_config: lac context descriptor %s\n",
+                l2tplog (LOG_DEBUG, "parse_config: lac context descriptor %s\n",
                      d ? d : "");
 #endif
             }
             else
             {
-                log (LOG_WARN,
+                l2tplog (LOG_WARN,
                      "parse_config: line %d: unknown context '%s'\n", linenum,
                      s);
                 return -1;
@@ -1168,14 +1168,14 @@
         {
             if (!context)
             {
-                log (LOG_WARN,
+                l2tplog (LOG_WARN,
                      "parse_config: line %d: data '%s' occurs with no context\n",
                      linenum, s);
                 return -1;
             }
             if (!(t = strchr (s, '=')))
             {
-                log (LOG_WARN, "parse_config: line %d: no '=' in data\n",
+                l2tplog (LOG_WARN, "parse_config: line %d: no '=' in data\n",
                      linenum);
                 return -1;
             }
@@ -1189,7 +1189,7 @@
             while (*t && (*t < 33))
                 t++;
 #ifdef DEBUG_FILE
-            log (LOG_DEBUG, "parse_config: field is %s, value is %s\n", s, t);
+            l2tplog (LOG_DEBUG, "parse_config: field is %s, value is %s\n", s, t);
 #endif
             /* Okay, bit twidling is done.  Let's handle this */
             for (kw = words; kw->keyword; kw++)
@@ -1198,7 +1198,7 @@
                 {
                     if (kw->handler (s, t, context | def, data))
                     {
-                        log (LOG_WARN, "parse_config: line %d: %s", linenum,
+                        l2tplog (LOG_WARN, "parse_config: line %d: %s", linenum,
                              filerr);
                         return -1;
                     }
@@ -1207,7 +1207,7 @@
             }
             if (!kw->keyword)
             {
-                log (LOG_CRIT, "parse_config: line %d: Unknown field '%s'\n",
+                l2tplog (LOG_CRIT, "parse_config: line %d: Unknown field '%s'\n",
                      linenum, s);
                 return -1;
             }
diff -Nur l2tpd-0.69-orig/l2tpd.c l2tpd-0.69/l2tpd.c
--- l2tpd-0.69-orig/l2tpd.c	2011-12-10 11:50:33.000000000 +0100
+++ l2tpd-0.69/l2tpd.c	2011-12-10 11:50:59.000000000 +0100
@@ -71,7 +71,7 @@
     FILE *f = fdopen (fd2, "a");
     if (!f)
     {
-        log (LOG_WARN, "show_status: fdopen() failed on fd %d\n", fd);
+        l2tplog (LOG_WARN, "show_status: fdopen() failed on fd %d\n", fd);
         return;
     }
     fprintf (f, "====== l2tpd statistics ========\n");
@@ -207,7 +207,7 @@
         {
             if (c->pppd == pid)
             {
-                log (LOG_DEBUG, "%s : pppd died for call %d\n", __FUNCTION__,
+                l2tplog (LOG_DEBUG, "%s : pppd died for call %d\n", __FUNCTION__,
                      c->cid);
                 c->needclose = -1;
                 /* 
@@ -233,7 +233,7 @@
      */
     struct tunnel *st, *st2;
     int sec;
-    log (LOG_CRIT, "%s: Fatal signal %d received\n", __FUNCTION__, signal);
+    l2tplog (LOG_CRIT, "%s: Fatal signal %d received\n", __FUNCTION__, signal);
     st = tunnels.head;
     while (st)
     {
@@ -285,12 +285,12 @@
     stropt[pos] = NULL;
     if (c->pppd > 0)
     {
-        log (LOG_WARN, "%s: PPP already started on call!\n", __FUNCTION__);
+        l2tplog (LOG_WARN, "%s: PPP already started on call!\n", __FUNCTION__);
         return -EINVAL;
     }
     if (c->fd > -1)
     {
-        log (LOG_WARN, "%s: file descriptor already assigned!\n",
+        l2tplog (LOG_WARN, "%s: file descriptor already assigned!\n",
              __FUNCTION__);
         return -EINVAL;
     }
@@ -311,7 +311,7 @@
 #endif
         if ((c->fd = getPtyMaster (&a, &b)) < 0)
         {
-            log (LOG_WARN, "%s: unable to allocate pty, abandoning!\n",
+            l2tplog (LOG_WARN, "%s: unable to allocate pty, abandoning!\n",
                  __FUNCTION__);
             return -EINVAL;
         }
@@ -334,17 +334,17 @@
 #endif
     str = stropt[0];
 #ifdef DEBUG_PPPD
-    log (LOG_DEBUG, "%s: I'm running:  ", __FUNCTION__);
+    l2tplog (LOG_DEBUG, "%s: I'm running:  ", __FUNCTION__);
     for (x = 0; stropt[x]; x++)
     {
-        log (LOG_DEBUG, "\"%s\" ", stropt[x]);
+        l2tplog (LOG_DEBUG, "\"%s\" ", stropt[x]);
     };
-    log (LOG_DEBUG, "\n");
+    l2tplog (LOG_DEBUG, "\n");
 #endif
     c->pppd = fork ();
     if (c->pppd < 0)
     {
-        log (LOG_WARN, "%s: unable to fork(), abandoning!\n", __FUNCTION__);
+        l2tplog (LOG_WARN, "%s: unable to fork(), abandoning!\n", __FUNCTION__);
         return -EINVAL;
     }
     else if (!c->pppd)
@@ -361,7 +361,7 @@
         if (fd2 < 0)
 #endif
         {
-            log (LOG_WARN, "%s: Unable to open %s to launch pppd!\n",
+            l2tplog (LOG_WARN, "%s: Unable to open %s to launch pppd!\n",
                  __FUNCTION__, tty);
             exit (1);
         }
@@ -389,7 +389,7 @@
         close (control_fd);
 
         execv (PPPD, stropt);
-        log (LOG_WARN, "%s: Exec of %s failed!\n", __FUNCTION__, PPPD);
+        l2tplog (LOG_WARN, "%s: Exec of %s failed!\n", __FUNCTION__, PPPD);
         exit (1);
     };
     close (fd2);
@@ -458,14 +458,14 @@
             }
             else
             {
-                log (LOG_WARN,
+                l2tplog (LOG_WARN,
                      "%s: unable to locate tunnel in tunnel list\n",
                      __FUNCTION__);
             }
         }
         else
         {
-            log (LOG_WARN, "%s: tunnel list is empty!\n", __FUNCTION__);
+            l2tplog (LOG_WARN, "%s: tunnel list is empty!\n", __FUNCTION__);
         }
     }
     if (t->lac)
@@ -474,7 +474,7 @@
         if (t->lac->redial && (t->lac->rtimeout > 0) && !t->lac->rsched &&
             t->lac->active)
         {
-            log (LOG_LOG, "%s: Will redial in %d seconds\n", __FUNCTION__,
+            l2tplog (LOG_LOG, "%s: Will redial in %d seconds\n", __FUNCTION__,
                  t->lac->rtimeout);
             tv.tv_sec = t->lac->rtimeout;
             tv.tv_usec = 0;
@@ -504,7 +504,7 @@
     hp = gethostbyname (host);
     if (!hp)
     {
-        log (LOG_WARN, "%s: gethostbyname() failed for %s.\n", __FUNCTION__,
+        l2tplog (LOG_WARN, "%s: gethostbyname() failed for %s.\n", __FUNCTION__,
              host);
         return NULL;
     }
@@ -517,7 +517,7 @@
     tmp = get_call (0, 0, addr, port);
     if (!tmp)
     {
-        log (LOG_WARN, "%s: Unable to create tunnel to %s.\n", __FUNCTION__,
+        l2tplog (LOG_WARN, "%s: Unable to create tunnel to %s.\n", __FUNCTION__,
              host);
         return NULL;
     }
@@ -533,7 +533,7 @@
     /*
      * Since our state is 0, we will establish a tunnel now
      */
-    log (LOG_LOG, "%s:Connecting to host %s, port %d\n", __FUNCTION__, host,
+    l2tplog (LOG_LOG, "%s:Connecting to host %s, port %d\n", __FUNCTION__, host,
          ntohs (port));
     control_finish (tmp->container, tmp);
     return tmp->container;
@@ -545,7 +545,7 @@
     lac = (struct lac *) data;
     if (!lac)
     {
-        log (LOG_WARN, "%s: magic_lac_tunnel: called on NULL lac!\n",
+        l2tplog (LOG_WARN, "%s: magic_lac_tunnel: called on NULL lac!\n",
              __FUNCTION__);
         return;
     }
@@ -562,7 +562,7 @@
     }
     else
     {
-        log (LOG_WARN, "%s: Unable to find hostname to dial for '%s'\n",
+        l2tplog (LOG_WARN, "%s: Unable to find hostname to dial for '%s'\n",
              __FUNCTION__, lac->entname);
         return;
     }
@@ -579,7 +579,7 @@
             tmp = new_call (t);
             if (!tmp)
             {
-                log (LOG_WARN, "%s: unable to create new call\n",
+                l2tplog (LOG_WARN, "%s: unable to create new call\n",
                      __FUNCTION__);
                 return NULL;
             }
@@ -591,14 +591,14 @@
             tmp->lns = lns;
             if (lac)
                 lac->c = tmp;
-            log (LOG_LOG, "%s: Calling on tunnel %d\n", __FUNCTION__, tid);
+            l2tplog (LOG_LOG, "%s: Calling on tunnel %d\n", __FUNCTION__, tid);
             strcpy (tmp->dial_no, dial_no_tmp); /*  jz: copy dialnumber to tmp->dial_no  */
             control_finish (t, tmp);
             return tmp;
         }
         t = t->next;
     };
-    log (LOG_DEBUG, "%s: No such tunnel %d to generate call.\n", __FUNCTION__,
+    l2tplog (LOG_DEBUG, "%s: No such tunnel %d to generate call.\n", __FUNCTION__,
          tid);
     return NULL;
 }
@@ -609,25 +609,25 @@
     lac = (struct lac *) data;
     if (!lac->active)
     {
-        log (LOG_DEBUG, "%s: LAC %s not active", __FUNCTION__, lac->entname);
+        l2tplog (LOG_DEBUG, "%s: LAC %s not active", __FUNCTION__, lac->entname);
         return;
     }
     lac->rsched = NULL;
     lac->rtries++;
     if (lac->rmax && (lac->rtries > lac->rmax))
     {
-        log (LOG_LOG, "%s: maximum retries exceeded.\n", __FUNCTION__);
+        l2tplog (LOG_LOG, "%s: maximum retries exceeded.\n", __FUNCTION__);
         return;
     }
     if (!lac)
     {
-        log (LOG_WARN, "%s : called on NULL lac!\n", __FUNCTION__);
+        l2tplog (LOG_WARN, "%s : called on NULL lac!\n", __FUNCTION__);
         return;
     }
     if (!lac->t)
     {
 #ifdef DEGUG_MAGIC
-        log (LOG_DEBUG, "%s : tunnel not up!  Connecting!\n", __FUNCTION__);
+        l2tplog (LOG_DEBUG, "%s : tunnel not up!  Connecting!\n", __FUNCTION__);
 #endif
         magic_lac_tunnel (lac);
         return;
@@ -646,7 +646,7 @@
         {
             if (tmp->ourcid == cid)
             {
-                log (LOG_LOG,
+                l2tplog (LOG_LOG,
                      "%s :Hanging up call %d, Local: %d, Remote: %d\n",
                      __FUNCTION__, tmp->serno, tmp->ourcid, tmp->cid);
                 strcpy (tmp->errormsg, "Goodbye!");
@@ -658,7 +658,7 @@
         }
         t = t->next;
     };
-    log (LOG_DEBUG, "%s : No such call %d to hang up.\n", __FUNCTION__, cid);
+    l2tplog (LOG_DEBUG, "%s : No such call %d to hang up.\n", __FUNCTION__, cid);
     return;
 }
 
@@ -669,7 +669,7 @@
     {
         if (t->ourtid == tid)
         {
-            log (LOG_LOG,
+            l2tplog (LOG_LOG,
                  "%s: Disconnecting from %s, Local: %d, Remote: %d\n",
                  __FUNCTION__, IPADDY (t->peer.sin_addr), t->ourtid, t->tid);
             t->self->needclose = -1;
@@ -679,7 +679,7 @@
         }
         t = t->next;
     };
-    log (LOG_DEBUG, "%s: No such tunnel %d to hang up.\n", __FUNCTION__, tid);
+    l2tplog (LOG_DEBUG, "%s: No such tunnel %d to hang up.\n", __FUNCTION__, tid);
     return;
 }
 
@@ -712,7 +712,7 @@
             temp = (int *)entropy_buf;
             tmp->ourtid = *temp & 0xFFFF;
 #ifdef DEBUG_ENTROPY
-            log(LOG_DEBUG, "ourtid = %u, entropy_buf = %hx\n", tmp->ourtid, *temp);
+            l2tplog(LOG_DEBUG, "ourtid = %u, entropy_buf = %hx\n", tmp->ourtid, *temp);
 #endif
         }
 #else
@@ -776,7 +776,7 @@
             if (buf[cnt - 1] == '\n')
                 buf[--cnt] = 0;
 #ifdef DEBUG_CONTROL
-            log (LOG_DEBUG, "%s: Got message %s (%d bytes long)\n",
+            l2tplog (LOG_DEBUG, "%s: Got message %s (%d bytes long)\n",
                  __FUNCTION__, buf, cnt);
 #endif
             switch (buf[0])
@@ -784,7 +784,7 @@
             case 't':
                 host = strchr (buf, ' ') + 1;
 #ifdef DEBUG_CONTROL
-                log (LOG_DEBUG, "%s: Attempting to tunnel to %s\n",
+                l2tplog (LOG_DEBUG, "%s: Attempting to tunnel to %s\n",
                      __FUNCTION__, host);
 #endif
                 l2tp_call (host, UDP_LISTEN_PORT, NULL, NULL);
@@ -804,7 +804,7 @@
                         if (!lac->c)
                             magic_lac_dial (lac);
                         else
-                            log (LOG_DEBUG,
+                            l2tplog (LOG_DEBUG,
                                  "%s: Session '%s' already active!\n",
                                  __FUNCTION__, lac->entname);
                         break;
@@ -816,12 +816,12 @@
                 tunl = atoi (tunstr);
                 if (!tunl)
                 {
-                    log (LOG_DEBUG, "%s: No such tunnel '%s'\n", __FUNCTION__,
+                    l2tplog (LOG_DEBUG, "%s: No such tunnel '%s'\n", __FUNCTION__,
                          tunstr);
                     break;
                 }
 #ifdef DEBUG_CONTROL
-                log (LOG_DEBUG, "%s: Attempting to call on tunnel %d\n",
+                l2tplog (LOG_DEBUG, "%s: Attempting to call on tunnel %d\n",
                      __FUNCTION__, tunl);
 #endif
                 lac_call (tunl, NULL, NULL);
@@ -847,7 +847,7 @@
                         if (!lac->c)
                             magic_lac_dial (lac);
                         else
-                            log (LOG_DEBUG,
+                            l2tplog (LOG_DEBUG,
                                  "%s: Session '%s' already active!\n",
                                  __FUNCTION__, lac->entname);
                         break;
@@ -859,12 +859,12 @@
                 tunl = atoi (tunstr);
                 if (!tunl)
                 {
-                    log (LOG_DEBUG, "%s: No such tunnel '%s'\n", __FUNCTION__,
+                    l2tplog (LOG_DEBUG, "%s: No such tunnel '%s'\n", __FUNCTION__,
                          tunstr);
                     break;
                 }
 #ifdef DEBUG_CONTROL
-                log (LOG_DEBUG, "%s: Attempting to call on tunnel %d\n",
+                l2tplog (LOG_DEBUG, "%s: Attempting to call on tunnel %d\n",
                      __FUNCTION__, tunl);
 #endif
                 lac_call (tunl, NULL, NULL);
@@ -874,7 +874,7 @@
                 callstr = strchr (buf, ' ') + 1;
                 call = atoi (callstr);
 #ifdef DEBUG_CONTROL
-                log (LOG_DEBUG, "%s: Attempting to call %d\n", __FUNCTION__,
+                l2tplog (LOG_DEBUG, "%s: Attempting to call %d\n", __FUNCTION__,
                      call);
 #endif
                 lac_hangup (call);
@@ -891,7 +891,7 @@
                         if (lac->t)
                             lac_disconnect (lac->t->ourtid);
                         else
-                            log (LOG_DEBUG, "%s: Session '%s' not up\n",
+                            l2tplog (LOG_DEBUG, "%s: Session '%s' not up\n",
                                  __FUNCTION__, lac->entname);
                         break;
                     }
@@ -902,12 +902,12 @@
                 tunl = atoi (tunstr);
                 if (!tunl)
                 {
-                    log (LOG_DEBUG, "%s: No such tunnel '%s'\n", __FUNCTION__,
+                    l2tplog (LOG_DEBUG, "%s: No such tunnel '%s'\n", __FUNCTION__,
                          tunstr);
                     break;
                 }
 #ifdef DEBUG_CONTROL
-                log (LOG_DEBUG, "%s: Attempting to disconnect tunnel %d\n",
+                l2tplog (LOG_DEBUG, "%s: Attempting to disconnect tunnel %d\n",
                      __FUNCTION__, tunl);
 #endif
                 lac_disconnect (tunl);
@@ -916,7 +916,7 @@
                 show_status (1);
                 break;
             default:
-                log (LOG_DEBUG, "%s: Unknown command %c\n", __FUNCTION__,
+                l2tplog (LOG_DEBUG, "%s: Unknown command %c\n", __FUNCTION__,
                      buf[0]);
             }
         }
@@ -989,7 +989,7 @@
     int pidfilewritten=0;
 
     if((pid = fork()) < 0) {
-        log(LOG_LOG, "%s: Unable to fork ()\n",__FUNCTION__);
+        l2tplog(LOG_LOG, "%s: Unable to fork ()\n",__FUNCTION__);
         close(server_socket);
         exit(1);
     }
@@ -1004,7 +1004,7 @@
     if ((i = open(gconfig.pidfile,O_RDONLY)) > 0) {
         l=read(i,buf,sizeof(buf)-1);
         if (i < 0) {
-            log(LOG_LOG, "%s: Unable to read pid file [%s]\n",
+            l2tplog(LOG_LOG, "%s: Unable to read pid file [%s]\n",
                     __FUNCTION__, gconfig.pidfile);
         }
         buf[l] = '\0';
@@ -1024,7 +1024,7 @@
         }
         else
         {
-            log(LOG_LOG, "%s: There's already a l2tpd server running.\n",
+            l2tplog(LOG_LOG, "%s: There's already a l2tpd server running.\n",
                     __FUNCTION__);
             close(server_socket);
             exit(1);
@@ -1056,12 +1056,12 @@
     init_addr ();
     if (init_config ())
     {
-        log (LOG_CRIT, "%s: Unable to load config file\n", __FUNCTION__);
+        l2tplog (LOG_CRIT, "%s: Unable to load config file\n", __FUNCTION__);
         exit (1);
     }
     if (uname (&uts))
     {
-        log (LOG_CRIT, "%s : Unable to determine host system\n",
+        l2tplog (LOG_CRIT, "%s : Unable to determine host system\n",
              __FUNCTION__);
         exit (1);
     }
@@ -1080,18 +1080,18 @@
     control_fd = open (CONTROL_PIPE, O_RDONLY | O_NONBLOCK, 0600);
     if (control_fd < 0)
     {
-        log (LOG_CRIT, "%s: Unable to open " CONTROL_PIPE " for reading.",
+        l2tplog (LOG_CRIT, "%s: Unable to open " CONTROL_PIPE " for reading.",
              __FUNCTION__);
         exit (1);
     }
-    log (LOG_LOG, "l2tpd version " SERVER_VERSION " started on %s PID:%d\n",
+    l2tplog (LOG_LOG, "l2tpd version " SERVER_VERSION " started on %s PID:%d\n",
          hostname, getpid ());
-    log (LOG_LOG,
+    l2tplog (LOG_LOG,
          "Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.\n");
-    log (LOG_LOG, "Forked by Scott Balmos and David Stipp, (C) 2001\n");
-    log (LOG_LOG, "Inhereted by Jeff McAdams, (C) 2002\n");
+    l2tplog (LOG_LOG, "Forked by Scott Balmos and David Stipp, (C) 2001\n");
+    l2tplog (LOG_LOG, "Inhereted by Jeff McAdams, (C) 2002\n");
     listenaddr.s_addr = gconfig.listenaddr;
-    log (LOG_LOG, "%s version %s on a %s, listening on IP address %s, port %d\n", uts.sysname,
+    l2tplog (LOG_LOG, "%s version %s on a %s, listening on IP address %s, port %d\n", uts.sysname,
        uts.release, uts.machine, inet_ntoa(listenaddr), gconfig.port);
     lac = laclist;
     while (lac)
@@ -1099,7 +1099,7 @@
         if (lac->autodial)
         {
 #ifdef DEBUG_MAGIC
-            log (LOG_DEBUG, "%s: Autodialing '%s'\n", __FUNCTION__,
+            l2tplog (LOG_DEBUG, "%s: Autodialing '%s'\n", __FUNCTION__,
                  lac->entname[0] ? lac->entname : "(unnamed)");
 #endif
             lac->active = -1;
diff -Nur l2tpd-0.69-orig/misc.c l2tpd-0.69/misc.c
--- l2tpd-0.69-orig/misc.c	2002-08-10 02:42:22.000000000 +0200
+++ l2tpd-0.69/misc.c	2011-12-10 11:50:59.000000000 +0100
@@ -30,7 +30,7 @@
 #include "l2tp.h"
 
 
-void log (int level, const char *fmt, ...)
+void l2tplog (int level, const char *fmt, ...)
 {
     char buf[256];
     va_list args;
@@ -99,7 +99,7 @@
             c++;                /* again two characters to display ONE byte */
         }
         *c = '\0';
-        log (LOG_WARN, "%s: buflen=%d, buffer[%d]: *%s*\n", __FUNCTION__,
+        l2tplog (LOG_WARN, "%s: buflen=%d, buffer[%d]: *%s*\n", __FUNCTION__,
              buflen, i, line);
     }
 
@@ -115,7 +115,7 @@
     if (c != line)
     {
         *c = '\0';
-        log (LOG_WARN, "%s:             buffer[%d]: *%s*\n", __FUNCTION__, i,
+        l2tplog (LOG_WARN, "%s:             buffer[%d]: *%s*\n", __FUNCTION__, i,
              line);
     }
 }
@@ -199,7 +199,7 @@
     new = (struct ppp_opts *) malloc (sizeof (struct ppp_opts));
     if (!new)
     {
-        log (LOG_WARN,
+        l2tplog (LOG_WARN,
              "%s : Unable to allocate ppp option memory.  Expect a crash\n",
              __FUNCTION__);
         return NULL;
@@ -265,7 +265,7 @@
     if (devrandom == -1)
     {
 #ifdef DEBUG_ENTROPY
-        log(LOG_WARN, "%s: couldn't open /dev/urandom,"
+        l2tplog(LOG_WARN, "%s: couldn't open /dev/urandom,"
                       "falling back to rand()\n",
                       __FUNCTION__);
 #endif
@@ -288,13 +288,13 @@
     }
     else if (rand_source == RAND_EGD)
     {
-        log(LOG_WARN, "%s: EGD Randomness source not yet implemented\n",
+        l2tplog(LOG_WARN, "%s: EGD Randomness source not yet implemented\n",
                 __FUNCTION__);
         return -1;
     }
     else
     {
-        log(LOG_WARN, "%s: Invalid Randomness source specified (%d)\n",
+        l2tplog(LOG_WARN, "%s: Invalid Randomness source specified (%d)\n",
                 __FUNCTION__, rand_source);
         return -1;
     }
diff -Nur l2tpd-0.69-orig/misc.h l2tpd-0.69/misc.h
--- l2tpd-0.69-orig/misc.h	2002-04-10 22:09:33.000000000 +0200
+++ l2tpd-0.69/misc.h	2011-12-10 11:50:59.000000000 +0100
@@ -64,7 +64,7 @@
 #define halt() printf("Halted.\n") ; for(;;)
 
 extern char hostname[];
-extern void log (int level, const char *fmt, ...);
+extern void l2tplog (int level, const char *fmt, ...);
 extern struct buffer *new_buf (int);
 extern void udppush_handler (int);
 extern int addfcs (struct buffer *buf);
diff -Nur l2tpd-0.69-orig/network.c l2tpd-0.69/network.c
--- l2tpd-0.69-orig/network.c	2011-12-10 11:50:33.000000000 +0100
+++ l2tpd-0.69/network.c	2011-12-10 11:50:59.000000000 +0100
@@ -50,7 +50,7 @@
     server.sin_port = htons (gconfig.port);
     if ((server_socket = socket (PF_INET, SOCK_DGRAM, 0)) < 0)
     {
-        log (LOG_CRIT, "%s: Unable to allocate socket. Terminating.\n",
+        l2tplog (LOG_CRIT, "%s: Unable to allocate socket. Terminating.\n",
              __FUNCTION__);
         return -EINVAL;
     };
@@ -59,37 +59,37 @@
     if (bind (server_socket, (struct sockaddr *) &server, sizeof (server)))
     {
         close (server_socket);
-        log (LOG_CRIT, "%s: Unable to bind socket. Terminating.\n",
+        l2tplog (LOG_CRIT, "%s: Unable to bind socket. Terminating.\n",
              __FUNCTION__);
         return -EINVAL;
     };
     if (getsockname (server_socket, (struct sockaddr *) &server, &length))
     {
-        log (LOG_CRIT, "%s: Unable to read socket name.Terminating.\n",
+        l2tplog (LOG_CRIT, "%s: Unable to read socket name.Terminating.\n",
              __FUNCTION__);
         return -EINVAL;
     }
 #ifdef USE_KERNEL
     if (gconfig.forceuserspace)
     {
-        log (LOG_LOG, "Not looking for kernel support.\n");
+        l2tplog (LOG_LOG, "Not looking for kernel support.\n");
         kernel_support = 0;
     }
     else
     {
         if (ioctl (server_socket, SIOCSETL2TP, NULL) < 0)
         {
-            log (LOG_LOG, "L2TP kernel support not detected.\n");
+            l2tplog (LOG_LOG, "L2TP kernel support not detected.\n");
             kernel_support = 0;
         }
         else
         {
-            log (LOG_LOG, "Using l2tp kernel support.\n");
+            l2tplog (LOG_LOG, "Using l2tp kernel support.\n");
             kernel_support = -1;
         }
     }
 #else
-    log (LOG_LOG, "This binary does not support kernel L2TP.\n");
+    l2tplog (LOG_LOG, "This binary does not support kernel L2TP.\n");
 #endif
     arg = fcntl (server_socket, F_GETFL);
     arg |= O_NONBLOCK;
@@ -152,11 +152,11 @@
 /*	struct call *c = (struct call *)call; */
 /*	if (c->throttle) {
 #ifdef DEBUG_FLOW
-		log(LOG_DEBUG, "%s: dethrottling call %d, and setting R-bit\n",__FUNCTION__,c->ourcid); 
+		l2tplog(LOG_DEBUG, "%s: dethrottling call %d, and setting R-bit\n",__FUNCTION__,c->ourcid); 
 #endif 		c->rbit = RBIT;
 		c->throttle = 0;
 	} else {
-		log(LOG_DEBUG, "%s:  call %d already dethrottled?\n",__FUNCTION__,c->ourcid); 	
+		l2tplog(LOG_DEBUG, "%s:  call %d already dethrottled?\n",__FUNCTION__,c->ourcid); 	
 	} */
 }
 
@@ -168,7 +168,7 @@
     int ns;
     if (!buf)
     {
-        log (LOG_WARN, "%s: called on NULL buffer!\n", __FUNCTION__);
+        l2tplog (LOG_WARN, "%s: called on NULL buffer!\n", __FUNCTION__);
         return;
     }
 
@@ -180,7 +180,7 @@
         if (ns < t->cLr)
         {
 #ifdef DEBUG_CONTROL_XMIT
-            log (LOG_DEBUG, "%s: Tossing packet %d\n", __FUNCTION__, ns);
+            l2tplog (LOG_DEBUG, "%s: Tossing packet %d\n", __FUNCTION__, ns);
 #endif
             /* Okay, it's been received.  Let's toss it now */
             toss (buf);
@@ -197,7 +197,7 @@
         {
             if (t->self->needclose)
             {
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Unable to deliver closing message for tunnel %d. Destroying anyway.\n",
                      __FUNCTION__, t->ourtid);
                 t->self->needclose = 0;
@@ -205,7 +205,7 @@
             }
             else
             {
-                log (LOG_DEBUG,
+                l2tplog (LOG_DEBUG,
                      "%s: Maximum retries exceeded for tunnel %d.  Closing.\n",
                      __FUNCTION__, t->ourtid);
                 strcpy (t->self->errormsg, "Timeout");
@@ -222,7 +222,7 @@
         tv.tv_usec = 0;
         schedule (tv, control_xmit, buf);
 #ifdef DEBUG_CONTROL_XMIT
-        log (LOG_DEBUG, "%s: Scheduling and transmitting packet %d\n",
+        l2tplog (LOG_DEBUG, "%s: Scheduling and transmitting packet %d\n",
              __FUNCTION__, ns);
 #endif
         udp_xmit (buf);
@@ -278,7 +278,7 @@
             if (st->self->needclose ^ st->self->closing)
             {
                 if (debug_tunnel)
-                    log (LOG_DEBUG, "%S: closing down tunnel %d\n",
+                    l2tplog (LOG_DEBUG, "%S: closing down tunnel %d\n",
                          __FUNCTION__, st->ourtid);
                 call_close (st->self);
                 /* Reset the while loop
@@ -346,13 +346,13 @@
                 if (recvsize < 0)
                 {
                     if (errno != EAGAIN)
-                        log (LOG_WARN,
+                        l2tplog (LOG_WARN,
                              "%s: recvfrom returned error %d (%s)\n",
                              __FUNCTION__, errno, strerror (errno));
                 }
                 else
                 {
-                    log (LOG_WARN, "%s: received too small a packet\n",
+                    l2tplog (LOG_WARN, "%s: received too small a packet\n",
                          __FUNCTION__);
                 }
             }
@@ -363,7 +363,7 @@
                 extract (buf->start, &tunnel, &call);
                 if (debug_network)
                 {
-                    log (LOG_DEBUG, "%s: recv packet from %s, size = %d," \
+                    l2tplog (LOG_DEBUG, "%s: recv packet from %s, size = %d," \
 "tunnel = %d, call = %d\n", __FUNCTION__, inet_ntoa (from.sin_addr), recvsize, tunnel, call);
                 }
                 if (packet_dump)
@@ -388,13 +388,13 @@
                          * to ack receiving the packet.
                          */
                         if (debug_tunnel)
-                            log (LOG_DEBUG,
+                            l2tplog (LOG_DEBUG,
                                  "%s: no such call %d on tunnel %d.  Sending special ZLB\n",
                                  __FUNCTION__);
                         handle_special (buf, c, call);
                     }
                     else
-                        log (LOG_DEBUG,
+                        l2tplog (LOG_DEBUG,
                              "%s: unable to find call or tunnel to handle packet.  call = %d, tunnel = %d Dumping.\n",
                              __FUNCTION__, call, tunnel);
 
@@ -407,7 +407,7 @@
                     if (handle_packet (buf, c->container, c))
                     {
                         if (debug_tunnel)
-                            log (LOG_DEBUG, "%s: bad packet\n", __FUNCTION__);
+                            l2tplog (LOG_DEBUG, "%s: bad packet\n", __FUNCTION__);
                     };
                     if (c->cnu)
                     {
@@ -431,12 +431,12 @@
                     int result;
                     recycle_payload (buf, sc->container->peer);
 #ifdef DEBUG_FLOW_MORE
-                    log (LOG_DEBUG, "%s: rws = %d, pSs = %d, pLr = %d\n",
+                    l2tplog (LOG_DEBUG, "%s: rws = %d, pSs = %d, pLr = %d\n",
                          __FUNCTION__, sc->rws, sc->pSs, sc->pLr);
 #endif
 /*					if ((sc->rws>0) && (sc->pSs > sc->pLr + sc->rws) && !sc->rbit) {
 #ifdef DEBUG_FLOW
-						log(LOG_DEBUG, "%s: throttling payload (call = %d, tunnel = %d, Lr = %d, Ss = %d, rws = %d)!\n",__FUNCTION__,
+						l2tplog(LOG_DEBUG, "%s: throttling payload (call = %d, tunnel = %d, Lr = %d, Ss = %d, rws = %d)!\n",__FUNCTION__,
 								 sc->cid, sc->container->tid, sc->pLr, sc->pSs, sc->rws); 
 #endif
 						sc->throttle = -1;
@@ -472,7 +472,7 @@
                     }
                     if (result != 0)
                     {
-                        log (LOG_WARN,
+                        l2tplog (LOG_WARN,
                              "%s: tossing read packet, error = %s (%d).  Closing call.\n",
                              __FUNCTION__, strerror (-result), -result);
                         strcpy (sc->errormsg, strerror (-result));
diff -Nur l2tpd-0.69-orig/scheduler.c l2tpd-0.69/scheduler.c
--- l2tpd-0.69-orig/scheduler.c	2002-04-10 22:09:33.000000000 +0200
+++ l2tpd-0.69/scheduler.c	2011-12-10 11:50:59.000000000 +0100
@@ -56,7 +56,7 @@
     if (cnt != 1)
     {
         /* Whoa, we got called from within ourselves! */
-        log (LOG_DEBUG, "%s : Whoa... cnt = %d\n", __FUNCTION__, cnt);
+        l2tplog (LOG_DEBUG, "%s : Whoa... cnt = %d\n", __FUNCTION__, cnt);
         return;
     }
     while (events)
@@ -89,7 +89,7 @@
         }
         if ((then.tv_sec <= 0) && (then.tv_usec <= 0))
         {
-            log (LOG_WARN, "%s: Whoa...  Scheduling for <=0 time???\n",
+            l2tplog (LOG_WARN, "%s: Whoa...  Scheduling for <=0 time???\n",
                  __FUNCTION__);
         }
         else