patch for tinc-0.3

Hans Bayle hansb at direct.a2000.nl
Mon Oct 25 20:21:21 CEST 1999


(sorry for using this list, but I cannot reach zarq directly)


Ivo,

Ik zal dat je 0.3.1 al officieel hebt gemaakt. Ik heb een diff -ur
gestuurd, maar
ik kreeg weer gebouncde mail. Zou je nogeens naar flush_queue() kunnen
kijken. Bij
mij loste de patch in flush_queue() het probleem op.

A message that you sent could not be delivered to all of its recipients.
The
following address(es) failed:

  zarq at iname.com:
    SMTP error from remote mailer after RCPT TO:
    <zarq at iname.com>:
    host mail-intake-1.iname.net [165.251.8.94]:
    523 <zarq at iname.com>... The IP address 62.108.1.19 is blacklisted.
contact your administrator for details.

------ This is a copy of the message, including all the headers. ------


Ivo Timmermans wrote:

>
>
> Dan nog een vraagje.. zou je een diff -ur willen sturen? Dat is voor
> mij een stuk leesbaarder. bvd.
>

Ivo,

Hierbij de diff -ur
Het gaat vooral om flush_queue()
Staat hier in de body en als attachment.

Groeten -- hansb


Only in tinc-0.3-patched: Makefile
Only in tinc-0.3-patched/cipher: Makefile
Only in tinc-0.3-patched/cipher/blowfish: Makefile
diff -ur tinc-0.3/cipher/blowfish/bf_cfb64.c
tinc-0.3-patched/cipher/blowfish/bf_cfb64.c
--- tinc-0.3/cipher/blowfish/bf_cfb64.c Thu Jan 23 08:44:52 1997
+++ tinc-0.3-patched/cipher/blowfish/bf_cfb64.c Sun Oct 17 02:39:21 1999
@@ -58,6 +58,7 @@

 #include "blowfish.h"
 #include "bf_locl.h"
+#include <syslog.h>

 /* The input and output encrypted as though 64bit cfb mode is being
  * used.  The extra state information to record how much of the
@@ -73,6 +74,7 @@
 int *num;
 int encrypt;
  {
+
  register BF_LONG v0,v1,t;
  register int n= *num;
  register long l=length;
diff -ur tinc-0.3/cipher/cipher.c tinc-0.3-patched/cipher/cipher.c
--- tinc-0.3/cipher/cipher.c Fri Aug 20 00:53:46 1999
+++ tinc-0.3-patched/cipher/cipher.c Sun Oct 17 22:13:18 1999
@@ -17,6 +17,8 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

+#include <stdio.h>
+
 #include "config.h"

 #include <dlfcn.h>
@@ -30,6 +32,8 @@

 #include "net.h"

+void fdump(FILE *, char *, int);
+
 void (*blowfish_cfb64_encrypt) (unsigned char*, unsigned char*, int,
     BF_KEY*, unsigned char*, int*, int) = NULL;
 void (*blowfish_set_key) (BF_KEY*, int, char*) = NULL;
@@ -43,8 +47,14 @@
   unsigned char ivec[8];

   memcpy(ivec, initvec, 8);
-
+  if (debug_lvl > 3) {
+    syslog(LOG_ERR, "about to blowfish_cfb64");
+    syslog(LOG_ERR, "length in packet: %ld", len);
+  }
   blowfish_cfb64_encrypt(in, out, len, k, &ivec[0], &count, c);
+  if (debug_lvl > 3) {
+    syslog(LOG_ERR, "done blowfish_cfb64");
+  }
 }

 void do_encrypt(vpn_packet_t *in, real_packet_t *out, enc_key_t *key)
@@ -52,6 +62,10 @@
   unsigned char ivec[8];
   int r;

+  if (debug_lvl > 10) {
+fdump(stdout, in, in->len);
+  }
+
   memcpy(ivec, initvec, 8);
   cipher_set_key(&encryption_key, key->length, key->key);
   low_crypt_key((char*)(&in->data), (char*)(&out->data.data),
@@ -74,6 +88,8 @@

   memcpy(ivec, initvec, 8);
   cipher_set_key(&encryption_key, key->length, key->key);
+
+
   low_crypt_key((char*)(&in->data.data), (char*)(&out->data),
      &encryption_key, in->data.len, BF_DECRYPT);
   out->len = in->data.len;
@@ -105,3 +121,31 @@

   return 0;
 }
+
+/*
+ *      fdump.c -- Dump memory in debug format.
+ *
+ *      Compile separately and link to program,
+ *      or just include this file.
+ *
+ */
+void fdump(FILE *stream, char *adr,int bytecount)
+{
+        int i,j, linecount;
+        char asc_str[17];
+        unsigned char c;
+        linecount = (bytecount + 15) / 16;
+        asc_str[16] = '\0';
+        for(j=0; j<linecount; j++) {
+            fprintf(stream, "\n%06d ", adr+16*j);
+            for(i=0; i<16; i++) {
+                c = *(adr+16*j+i);
+                asc_str[i] = (c >= 32 && c < 128) ? c : '.';
+                fprintf(stream, "%c%02X", (i==8) ? '-' : ' ', (int) c);
+            }
+            fprintf(stream, "    %s", asc_str);
+        }
+        fprintf(stream, "\n");
+}
+/* end of fdump.c */
+
Only in tinc-0.3-patched/cipher/idea: Makefile
Only in tinc-0.3-patched: config.cache
Only in tinc-0.3-patched: config.h
Only in tinc-0.3-patched: config.log
Only in tinc-0.3-patched: config.status
Only in tinc-0.3-patched/doc: Makefile
diff -ur tinc-0.3/doc/tincd.8 tinc-0.3-patched/doc/tincd.8
--- tinc-0.3/doc/tincd.8 Thu Aug 19 23:58:08 1999
+++ tinc-0.3-patched/doc/tincd.8 Sat Oct 16 20:51:10 1999
@@ -1,5 +1,5 @@
 ." DO NOT MODIFY THIS FILE!  It was generated by help2man 1.006.
-.TH TINC 1 "August 1999" "tinc version 0.3" "FSF"
+.TH TINC 1 "October 1999" "tinc version 0.3" "FSF"
 .SH NAME
 tinc \- tinc daemon
 .SH SYNOPSIS
Only in tinc-0.3-patched/lib: Makefile
Only in tinc-0.3-patched: libtool
Only in tinc-0.3-patched/m4: Makefile
Only in tinc-0.3-patched: misc
Only in tinc-0.3-patched/src: Makefile
Only in tinc-0.3-patched/src: bla
diff -ur tinc-0.3/src/net.c tinc-0.3-patched/src/net.c
--- tinc-0.3/src/net.c Fri Aug 20 11:25:06 1999
+++ tinc-0.3-patched/src/net.c Mon Oct 18 22:38:43 1999
@@ -127,18 +127,33 @@
   return done;
 }

+/*
+ * decrypt received udp packet, and write into tap device
+ */
 int xrecv(conn_list_t *cl, void *packet)
 {
   vpn_packet_t vp;
+  real_packet_t *rp_ptr;
   int lenin;
+  int rp_lenin;
+
+  rp_lenin = ((real_packet_t *) packet)->data.len;
+
+  /* encryption will crash when packet has unexpected len */
+  if ( ! ((rp_lenin > 20) && (rp_lenin < MAXSIZE))) {
+    syslog(LOG_ERR, "dropping strange packet len: %d", rp_lenin);
+    return 1;
+  }

   do_decrypt((real_packet_t*)packet, &vp, cl->key);
   add_mac_addresses(&vp);

   if((lenin = write_n(tap_fd, &vp, vp.len + 2)) < 0)
     syslog(LOG_ERR, "Can't write to tap device: %m");
-  else
+  else {
     total_tap_out += lenin;
+    if(debug_lvl > 3) syslog(LOG_DEBUG, "writing in tap - %d - %d",
vp.len + 2, lenin);
+  }

   return 0;
 }
@@ -151,12 +166,21 @@
 {
   queue_element_t *e;

-  if(debug_lvl > 3)
-    syslog(LOG_DEBUG, "packet to queue: %d", s);
+  if(debug_lvl > 3) {
+    syslog(LOG_DEBUG, "packet to queue: %d", s - 2);
+dump_pkt_queue(*q);
+    if (*q) {
+  if((*q)->head)
+    syslog(LOG_DEBUG, "head != NULL");
+  if((*q)->tail)
+    syslog(LOG_DEBUG, "tail != NULL");
+    }
+   }

   e = xmalloc(sizeof(queue_element_t));
   e->packet = xmalloc(s);
   memcpy(e->packet, packet, s);
+
   if(!*q)
     {
       *q = xmalloc(sizeof(packet_queue_t));
@@ -165,10 +189,12 @@

   e->prev = (*q)->tail;
   e->next = NULL;
+
   if((*q)->tail)
     (*q)->tail->next = e;

   (*q)->tail = e;
+
   if(!(*q)->head)
     (*q)->head = e;
 }
@@ -181,32 +207,49 @@
 void flush_queue(conn_list_t *cl, packet_queue_t *pq,
    int (*function)(conn_list_t*,void*))
 {
+  int i=0;
+  real_packet_t *vp;
   queue_element_t *p, *prev = NULL, *next = NULL;

+  if(debug_lvl > 3) {
+  dump_conn_list();
+  }
+
   for(p = pq->head; p != NULL; )
     {
+      i++;
+      vp = (real_packet_t *) p->packet;
+      if(debug_lvl > 1) syslog(LOG_DEBUG, "flushing packet %d len: %d",
i, vp->len);
+
       next = p->next;

-cp
       if(!function(cl, p->packet))
-        {
+        { /* returned zero: remove packet and queue elem */
           if(prev)
             prev->next = next;
           else
             pq->head = next;

-cp
+          if(debug_lvl > 1) syslog(LOG_DEBUG, "freeing packet %d ", i);
+
           free(p->packet);
-cp
    free(p);
-cp
         }
       else
+        {
         prev = p;
-cp
+        }

       p = next;
     }
+
+  /* adjust to last element left in queue */
+  if (prev)
+      pq->tail = prev;
+  else {
+      pq->tail = NULL;
+      pq->head = NULL;
+  }

   if(debug_lvl > 3)
     syslog(LOG_DEBUG, "queue flushed");
@@ -219,15 +262,15 @@
 */
 void flush_queues(conn_list_t *cl)
 {
-cp
   if(cl->sq)
     {
       if(debug_lvl > 1)
  syslog(LOG_DEBUG, "Flushing send queue for " IP_ADDR_S,
         IP_ADDR_V(cl->vpn_ip));
       flush_queue(cl, cl->sq, xsend);
+      if(debug_lvl > 1)
+dump_pkt_queue(cl->sq);
     }
-cp

   if(cl->rq)
     {
@@ -235,8 +278,9 @@
  syslog(LOG_DEBUG, "Flushing receive queue for " IP_ADDR_S,
         IP_ADDR_V(cl->vpn_ip));
       flush_queue(cl, cl->rq, xrecv);
+      if(debug_lvl > 1)
+dump_pkt_queue(cl->rq);
     }
-cp
 }

 /*
@@ -265,7 +309,11 @@

   if(!cl->status.validkey)
     {
+      if(debug_lvl > 1)
+dump_pkt_queue(cl->sq);
       add_queue(&(cl->sq), packet, packet->len + 2);
+      if(debug_lvl > 1)
+dump_pkt_queue(cl->sq);
       if(!cl->status.waitingforkey)
  send_key_request(to);
       return 0;
@@ -274,8 +322,12 @@
 cp
   if(!cl->status.active)
     {
+      if(debug_lvl > 1)
+dump_pkt_queue(cl->sq);
       add_queue(&(cl->sq), packet, packet->len + 2);
       if(debug_lvl > 1)
+dump_pkt_queue(cl->sq);
+      if(debug_lvl > 1)
  syslog(LOG_INFO, IP_ADDR_S " is not ready, queueing packet.",
IP_ADDR_V(cl->vpn_ip));
       return 0; /* We don't want to mess up, do we? */
     }
@@ -766,7 +818,9 @@
  xrecv(f, &rp);
       else
  {
+dump_pkt_queue(f->rq);
    add_queue(&(f->rq), &rp, rp.len);
+dump_pkt_queue(f->rq);
    if(!cl->status.waitingforkey)
      send_key_request(rp.from);
  }
Only in tinc-0.3-patched/src: net.c.org
diff -ur tinc-0.3/src/netutl.c tinc-0.3-patched/src/netutl.c
--- tinc-0.3/src/netutl.c Sun Aug 15 14:01:20 1999
+++ tinc-0.3-patched/src/netutl.c Mon Oct 18 20:18:21 1999
@@ -217,6 +217,25 @@
   return ip;
 }

+void dump_pkt_queue(packet_queue_t *pq)
+{
+  int i=0;
+  real_packet_t *vp;
+  queue_element_t *p, *q;
+
+  if(debug_lvl > 1) syslog(LOG_DEBUG, "dumping queue");
+
+  if (!pq) return;
+
+  for(p = pq->head; p != NULL; p = q)
+    {
+      i++;
+      vp = (real_packet_t *) p->packet;
+      if(debug_lvl > 1) syslog(LOG_DEBUG, "queue has packet %d len:
%d", i, vp->len);
+      q = p->next;
+    }
+}
+
 void dump_conn_list(void)
 {
   conn_list_t *p;
diff -ur tinc-0.3/src/netutl.h tinc-0.3-patched/src/netutl.h
--- tinc-0.3/src/netutl.h Thu Aug 12 19:27:17 1999
+++ tinc-0.3-patched/src/netutl.h Sun Oct 17 00:21:57 1999
@@ -31,5 +31,6 @@
 extern char *hostlookup(unsigned long);
 extern ip_mask_t *strtoip(char*);
 extern void dump_conn_list(void);
+extern void dump_pkt_queue(packet_queue_t *);

 #endif /* __TINC_NETUTL_H__ */
diff -ur tinc-0.3/src/tincd.c tinc-0.3-patched/src/tincd.c
--- tinc-0.3/src/tincd.c Thu Aug 19 18:32:19 1999
+++ tinc-0.3-patched/src/tincd.c Sat Oct 16 20:09:29 1999
@@ -427,8 +427,11 @@
     signal(SIGTERM, sigterm_handler);
   if(signal(SIGQUIT, SIG_IGN) != SIG_ERR)
     signal(SIGQUIT, sigquit_handler);
+/* looping sigsegv handler: want a core dump */
+/*
   if(signal(SIGSEGV, SIG_IGN) != SIG_ERR)
     signal(SIGSEGV, sigsegv_handler);
+*/
   if(signal(SIGHUP, SIG_IGN) != SIG_ERR)
     signal(SIGHUP, sighup_handler);
   signal(SIGPIPE, SIG_IGN);
Only in tinc-0.3-patched: stamp-h
-------------- next part --------------
Only in tinc-0.3-patched: Makefile
Only in tinc-0.3-patched/cipher: Makefile
Only in tinc-0.3-patched/cipher/blowfish: Makefile
diff -ur tinc-0.3/cipher/blowfish/bf_cfb64.c tinc-0.3-patched/cipher/blowfish/bf_cfb64.c
--- tinc-0.3/cipher/blowfish/bf_cfb64.c	Thu Jan 23 08:44:52 1997
+++ tinc-0.3-patched/cipher/blowfish/bf_cfb64.c	Sun Oct 17 02:39:21 1999
@@ -58,6 +58,7 @@
 
 #include "blowfish.h"
 #include "bf_locl.h"
+#include <syslog.h>
 
 /* The input and output encrypted as though 64bit cfb mode is being
  * used.  The extra state information to record how much of the
@@ -73,6 +74,7 @@
 int *num;
 int encrypt;
 	{
+
 	register BF_LONG v0,v1,t;
 	register int n= *num;
 	register long l=length;
diff -ur tinc-0.3/cipher/cipher.c tinc-0.3-patched/cipher/cipher.c
--- tinc-0.3/cipher/cipher.c	Fri Aug 20 00:53:46 1999
+++ tinc-0.3-patched/cipher/cipher.c	Sun Oct 17 22:13:18 1999
@@ -17,6 +17,8 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include <stdio.h>
+
 #include "config.h"
 
 #include <dlfcn.h>
@@ -30,6 +32,8 @@
 
 #include "net.h"
 
+void fdump(FILE *, char *, int);
+
 void (*blowfish_cfb64_encrypt) (unsigned char*, unsigned char*, int,
 				BF_KEY*, unsigned char*, int*, int) = NULL;
 void (*blowfish_set_key) (BF_KEY*, int, char*) = NULL;
@@ -43,8 +47,14 @@
   unsigned char ivec[8];
 
   memcpy(ivec, initvec, 8);
-
+  if (debug_lvl > 3) {
+    syslog(LOG_ERR, "about to blowfish_cfb64");
+    syslog(LOG_ERR, "length in packet: %ld", len);
+  }
   blowfish_cfb64_encrypt(in, out, len, k, &ivec[0], &count, c);
+  if (debug_lvl > 3) {
+    syslog(LOG_ERR, "done blowfish_cfb64");
+  }
 }
 
 void do_encrypt(vpn_packet_t *in, real_packet_t *out, enc_key_t *key)
@@ -52,6 +62,10 @@
   unsigned char ivec[8];
   int r;
 
+  if (debug_lvl > 10) {
+fdump(stdout, in, in->len);   
+  }
+
   memcpy(ivec, initvec, 8);
   cipher_set_key(&encryption_key, key->length, key->key);
   low_crypt_key((char*)(&in->data), (char*)(&out->data.data),
@@ -74,6 +88,8 @@
 
   memcpy(ivec, initvec, 8);
   cipher_set_key(&encryption_key, key->length, key->key);
+
+
   low_crypt_key((char*)(&in->data.data), (char*)(&out->data),
 		   &encryption_key, in->data.len, BF_DECRYPT);
   out->len = in->data.len;
@@ -105,3 +121,31 @@
 
   return 0;
 }
+
+/*
+ *      fdump.c -- Dump memory in debug format.
+ *
+ *      Compile separately and link to program,
+ *      or just include this file.
+ *
+ */
+void fdump(FILE *stream, char *adr,int bytecount)
+{
+        int i,j, linecount;
+        char asc_str[17];
+        unsigned char c;
+        linecount = (bytecount + 15) / 16;
+        asc_str[16] = '\0';
+        for(j=0; j<linecount; j++) {
+            fprintf(stream, "\n%06d ", adr+16*j);
+            for(i=0; i<16; i++) {
+                c = *(adr+16*j+i);
+                asc_str[i] = (c >= 32 && c < 128) ? c : '.';
+                fprintf(stream, "%c%02X", (i==8) ? '-' : ' ', (int) c);
+            }
+            fprintf(stream, "    %s", asc_str);
+        }
+        fprintf(stream, "\n");
+}
+/* end of fdump.c */
+
Only in tinc-0.3-patched/cipher/idea: Makefile
Only in tinc-0.3-patched: config.cache
Only in tinc-0.3-patched: config.h
Only in tinc-0.3-patched: config.log
Only in tinc-0.3-patched: config.status
Only in tinc-0.3-patched/doc: Makefile
diff -ur tinc-0.3/doc/tincd.8 tinc-0.3-patched/doc/tincd.8
--- tinc-0.3/doc/tincd.8	Thu Aug 19 23:58:08 1999
+++ tinc-0.3-patched/doc/tincd.8	Sat Oct 16 20:51:10 1999
@@ -1,5 +1,5 @@
 ." DO NOT MODIFY THIS FILE!  It was generated by help2man 1.006.
-.TH TINC 1 "August 1999" "tinc version 0.3" "FSF"
+.TH TINC 1 "October 1999" "tinc version 0.3" "FSF"
 .SH NAME
 tinc \- tinc daemon
 .SH SYNOPSIS
Only in tinc-0.3-patched/lib: Makefile
Only in tinc-0.3-patched: libtool
Only in tinc-0.3-patched/m4: Makefile
Only in tinc-0.3-patched: misc
Only in tinc-0.3-patched/src: Makefile
Only in tinc-0.3-patched/src: bla
diff -ur tinc-0.3/src/net.c tinc-0.3-patched/src/net.c
--- tinc-0.3/src/net.c	Fri Aug 20 11:25:06 1999
+++ tinc-0.3-patched/src/net.c	Mon Oct 18 22:38:43 1999
@@ -127,18 +127,33 @@
   return done;
 }
 
+/*
+ * decrypt received udp packet, and write into tap device
+ */
 int xrecv(conn_list_t *cl, void *packet)
 {
   vpn_packet_t vp;
+  real_packet_t *rp_ptr;
   int lenin;
+  int rp_lenin;
+
+  rp_lenin = ((real_packet_t *) packet)->data.len;
+
+  /* encryption will crash when packet has unexpected len */
+  if ( ! ((rp_lenin > 20) && (rp_lenin < MAXSIZE))) {
+    syslog(LOG_ERR, "dropping strange packet len: %d", rp_lenin);
+    return 1;
+  } 
 
   do_decrypt((real_packet_t*)packet, &vp, cl->key);
   add_mac_addresses(&vp);
 
   if((lenin = write_n(tap_fd, &vp, vp.len + 2)) < 0)
     syslog(LOG_ERR, "Can't write to tap device: %m");
-  else
+  else {
     total_tap_out += lenin;
+    if(debug_lvl > 3) syslog(LOG_DEBUG, "writing in tap - %d - %d", vp.len + 2, lenin);
+  }
 
   return 0;
 }
@@ -151,12 +166,21 @@
 {
   queue_element_t *e;
 
-  if(debug_lvl > 3)
-    syslog(LOG_DEBUG, "packet to queue: %d", s);
+  if(debug_lvl > 3) {
+    syslog(LOG_DEBUG, "packet to queue: %d", s - 2);
+dump_pkt_queue(*q);
+    if (*q) {
+  if((*q)->head)
+    syslog(LOG_DEBUG, "head != NULL");
+  if((*q)->tail)
+    syslog(LOG_DEBUG, "tail != NULL");
+    }
+   }
 
   e = xmalloc(sizeof(queue_element_t));
   e->packet = xmalloc(s);
   memcpy(e->packet, packet, s);
+
   if(!*q)
     {
       *q = xmalloc(sizeof(packet_queue_t));
@@ -165,10 +189,12 @@
 
   e->prev = (*q)->tail;
   e->next = NULL;
+
   if((*q)->tail)
     (*q)->tail->next = e;
 
   (*q)->tail = e;
+
   if(!(*q)->head)
     (*q)->head = e;
 }
@@ -181,32 +207,49 @@
 void flush_queue(conn_list_t *cl, packet_queue_t *pq,
 		 int (*function)(conn_list_t*,void*))
 {
+  int i=0;
+  real_packet_t *vp;
   queue_element_t *p, *prev = NULL, *next = NULL;
 
+  if(debug_lvl > 3) {
+  dump_conn_list();
+  }
+
   for(p = pq->head; p != NULL; )
     {
+      i++;
+      vp = (real_packet_t *) p->packet;
+      if(debug_lvl > 1) syslog(LOG_DEBUG, "flushing packet %d len: %d", i, vp->len);
+
       next = p->next;
 
-cp
       if(!function(cl, p->packet))
-        {
+        { /* returned zero: remove packet and queue elem */
           if(prev)
             prev->next = next;
           else
             pq->head = next;
 
-cp
+          if(debug_lvl > 1) syslog(LOG_DEBUG, "freeing packet %d ", i);
+
           free(p->packet);
-cp
 	  free(p);
-cp
         }
       else
+        {
         prev = p;
-cp
+        }
 
       p = next;
     }
+  
+  /* adjust to last element left in queue */
+  if (prev)
+      pq->tail = prev;
+  else {
+      pq->tail = NULL;
+      pq->head = NULL;
+  }
 
   if(debug_lvl > 3)
     syslog(LOG_DEBUG, "queue flushed");
@@ -219,15 +262,15 @@
 */
 void flush_queues(conn_list_t *cl)
 {
-cp
   if(cl->sq)
     {
       if(debug_lvl > 1)
 	syslog(LOG_DEBUG, "Flushing send queue for " IP_ADDR_S,
 	       IP_ADDR_V(cl->vpn_ip));
       flush_queue(cl, cl->sq, xsend);
+      if(debug_lvl > 1)
+dump_pkt_queue(cl->sq);
     }
-cp
 
   if(cl->rq)
     {
@@ -235,8 +278,9 @@
 	syslog(LOG_DEBUG, "Flushing receive queue for " IP_ADDR_S,
 	       IP_ADDR_V(cl->vpn_ip));
       flush_queue(cl, cl->rq, xrecv);
+      if(debug_lvl > 1)
+dump_pkt_queue(cl->rq);
     }
-cp
 }
 
 /*
@@ -265,7 +309,11 @@
 
   if(!cl->status.validkey)
     {
+      if(debug_lvl > 1)
+dump_pkt_queue(cl->sq);
       add_queue(&(cl->sq), packet, packet->len + 2);
+      if(debug_lvl > 1)
+dump_pkt_queue(cl->sq);
       if(!cl->status.waitingforkey)
 	send_key_request(to);
       return 0;
@@ -274,8 +322,12 @@
 cp
   if(!cl->status.active)
     {
+      if(debug_lvl > 1)
+dump_pkt_queue(cl->sq);
       add_queue(&(cl->sq), packet, packet->len + 2);
       if(debug_lvl > 1)
+dump_pkt_queue(cl->sq);
+      if(debug_lvl > 1)
 	syslog(LOG_INFO, IP_ADDR_S " is not ready, queueing packet.", IP_ADDR_V(cl->vpn_ip));
       return 0; /* We don't want to mess up, do we? */
     }
@@ -766,7 +818,9 @@
 	xrecv(f, &rp);
       else
 	{
+dump_pkt_queue(f->rq);
 	  add_queue(&(f->rq), &rp, rp.len);
+dump_pkt_queue(f->rq);
 	  if(!cl->status.waitingforkey)
 	    send_key_request(rp.from);
 	}
Only in tinc-0.3-patched/src: net.c.org
diff -ur tinc-0.3/src/netutl.c tinc-0.3-patched/src/netutl.c
--- tinc-0.3/src/netutl.c	Sun Aug 15 14:01:20 1999
+++ tinc-0.3-patched/src/netutl.c	Mon Oct 18 20:18:21 1999
@@ -217,6 +217,25 @@
   return ip;
 }
 
+void dump_pkt_queue(packet_queue_t *pq)
+{
+  int i=0;
+  real_packet_t *vp;
+  queue_element_t *p, *q;
+
+  if(debug_lvl > 1) syslog(LOG_DEBUG, "dumping queue");
+
+  if (!pq) return;
+
+  for(p = pq->head; p != NULL; p = q)
+    {
+      i++;
+      vp = (real_packet_t *) p->packet;
+      if(debug_lvl > 1) syslog(LOG_DEBUG, "queue has packet %d len: %d", i, vp->len);
+      q = p->next;
+    }
+}
+
 void dump_conn_list(void)
 {
   conn_list_t *p;
diff -ur tinc-0.3/src/netutl.h tinc-0.3-patched/src/netutl.h
--- tinc-0.3/src/netutl.h	Thu Aug 12 19:27:17 1999
+++ tinc-0.3-patched/src/netutl.h	Sun Oct 17 00:21:57 1999
@@ -31,5 +31,6 @@
 extern char *hostlookup(unsigned long);
 extern ip_mask_t *strtoip(char*);
 extern void dump_conn_list(void);
+extern void dump_pkt_queue(packet_queue_t *);
 
 #endif /* __TINC_NETUTL_H__ */
diff -ur tinc-0.3/src/tincd.c tinc-0.3-patched/src/tincd.c
--- tinc-0.3/src/tincd.c	Thu Aug 19 18:32:19 1999
+++ tinc-0.3-patched/src/tincd.c	Sat Oct 16 20:09:29 1999
@@ -427,8 +427,11 @@
     signal(SIGTERM, sigterm_handler);
   if(signal(SIGQUIT, SIG_IGN) != SIG_ERR)
     signal(SIGQUIT, sigquit_handler);
+/* looping sigsegv handler: want a core dump */
+/*
   if(signal(SIGSEGV, SIG_IGN) != SIG_ERR)
     signal(SIGSEGV, sigsegv_handler);
+*/
   if(signal(SIGHUP, SIG_IGN) != SIG_ERR)
     signal(SIGHUP, sighup_handler);
   signal(SIGPIPE, SIG_IGN);
Only in tinc-0.3-patched: stamp-h




More information about the Tinc mailing list