- Reinstated a queue for outgoing packets.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 7 Jan 2001 15:25:49 +0000 (15:25 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 7 Jan 2001 15:25:49 +0000 (15:25 +0000)
src/connection.c
src/connection.h
src/net.c
src/net.h
src/netutl.c
src/process.c
src/process.h
src/protocol.c
src/route.c

index 59ff120..08c165e 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: connection.c,v 1.1.2.7 2001/01/05 23:53:49 guus Exp $
+    $Id: connection.c,v 1.1.2.8 2001/01/07 15:25:40 guus Exp $
 */
 
 #include "config.h"
 */
 
 #include "config.h"
@@ -26,6 +26,7 @@
 #include <syslog.h>
 
 #include <avl_tree.h>
 #include <syslog.h>
 
 #include <avl_tree.h>
+#include <list.h>
 
 #include "net.h"       /* Don't ask. */
 #include "netutl.h"
 
 #include "net.h"       /* Don't ask. */
 #include "netutl.h"
@@ -77,6 +78,7 @@ connection_t *new_connection(void)
   connection_t *p = (connection_t *)xmalloc_and_zero(sizeof(*p));
 cp
   p->subnet_tree = avl_alloc_tree((avl_compare_t)subnet_compare, NULL);
   connection_t *p = (connection_t *)xmalloc_and_zero(sizeof(*p));
 cp
   p->subnet_tree = avl_alloc_tree((avl_compare_t)subnet_compare, NULL);
+  p->queue = list_alloc((list_action_t)free);
 cp
   return p;
 }
 cp
   return p;
 }
@@ -84,10 +86,8 @@ cp
 void free_connection(connection_t *p)
 {
 cp
 void free_connection(connection_t *p)
 {
 cp
-  if(p->sq)
-    destroy_queue(p->sq);
-  if(p->rq)
-    destroy_queue(p->rq);
+  if(p->queue)
+    list_delete_list(p->queue);
   if(p->name && p->name!=unknown)
     free(p->name);
   if(p->hostname)
   if(p->name && p->name!=unknown)
     free(p->name);
   if(p->hostname)
index 195cb1b..7f742e1 100644 (file)
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: connection.h,v 1.1.2.4 2001/01/05 23:53:49 guus Exp $
+    $Id: connection.h,v 1.1.2.5 2001/01/07 15:25:41 guus Exp $
 */
 
 #ifndef __TINC_CONNECTION_H__
 #define __TINC_CONNECTION_H__
 
 #include <avl_tree.h>
 */
 
 #ifndef __TINC_CONNECTION_H__
 #define __TINC_CONNECTION_H__
 
 #include <avl_tree.h>
+#include <list.h>
 
 #include "config.h"
 
 
 #include "config.h"
 
@@ -74,16 +75,12 @@ typedef struct connection_t {
   int socket;                      /* our udp vpn socket */
   int meta_socket;                 /* our tcp meta socket */
   status_bits_t status;            /* status info */
   int socket;                      /* our udp vpn socket */
   int meta_socket;                 /* our tcp meta socket */
   status_bits_t status;            /* status info */
-  packet_queue_t *sq;              /* pending outgoing packets */
-  packet_queue_t *rq;              /* pending incoming packets (they have no
-                                     valid key to be decrypted with) */
-  RSA *rsa_key;                    /* the public/private key */
 
 
+  RSA *rsa_key;                    /* the public/private key */
   EVP_CIPHER_CTX *cipher_inctx;    /* Context of encrypted meta data that will come from him to us */
   EVP_CIPHER_CTX *cipher_outctx;   /* Context of encrypted meta data that will be sent from us to him */
   char *cipher_inkey;              /* His symmetric meta key */
   char *cipher_outkey;             /* Our symmetric meta key */
   EVP_CIPHER_CTX *cipher_inctx;    /* Context of encrypted meta data that will come from him to us */
   EVP_CIPHER_CTX *cipher_outctx;   /* Context of encrypted meta data that will be sent from us to him */
   char *cipher_inkey;              /* His symmetric meta key */
   char *cipher_outkey;             /* Our symmetric meta key */
-
   EVP_CIPHER *cipher_pkttype;      /* Cipher type for encrypted vpn packets */ 
   char *cipher_pktkey;             /* Cipher key and iv */
   int cipher_pktkeylength;         /* Cipher key and iv length*/
   EVP_CIPHER *cipher_pkttype;      /* Cipher type for encrypted vpn packets */ 
   char *cipher_pktkey;             /* Cipher key and iv */
   int cipher_pktkeylength;         /* Cipher key and iv length*/
@@ -95,6 +92,8 @@ typedef struct connection_t {
 
   time_t last_ping_time;           /* last time we saw some activity from the other end */  
 
 
   time_t last_ping_time;           /* last time we saw some activity from the other end */  
 
+  list_t *queue;                   /* Queue for packets awaiting to be encrypted */
+
   char *mychallenge;               /* challenge we received from him */
   char *hischallenge;              /* challenge we sent to him */
 
   char *mychallenge;               /* challenge we received from him */
   char *hischallenge;              /* challenge we sent to him */
 
index a42ebce..f22fd72 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: net.c,v 1.35.4.89 2001/01/05 23:53:49 guus Exp $
+    $Id: net.c,v 1.35.4.90 2001/01/07 15:25:41 guus Exp $
 */
 
 #include "config.h"
 */
 
 #include "config.h"
 #include <utils.h>
 #include <xalloc.h>
 #include <avl_tree.h>
 #include <utils.h>
 #include <xalloc.h>
 #include <avl_tree.h>
+#include <list.h>
 
 #include "conf.h"
 #include "connection.h"
 
 #include "conf.h"
 #include "connection.h"
-#include "list.h"
 #include "meta.h"
 #include "net.h"
 #include "netutl.h"
 #include "meta.h"
 #include "net.h"
 #include "netutl.h"
@@ -190,129 +190,6 @@ cp
   return 0;
 }
 
   return 0;
 }
 
-/*
-  add the given packet of size s to the
-  queue q, be it the send or receive queue
-*/
-void add_queue(packet_queue_t **q, void *packet, size_t s)
-{
-  queue_element_t *e;
-cp
-  e = xmalloc(sizeof(*e));
-  e->packet = xmalloc(s);
-  memcpy(e->packet, packet, s);
-
-  if(!*q)
-    {
-      *q = xmalloc(sizeof(**q));
-      (*q)->head = (*q)->tail = NULL;
-    }
-
-  e->next = NULL;                      /* We insert at the tail */
-
-  if((*q)->tail)                       /* Do we have a tail? */
-    {
-      (*q)->tail->next = e;
-      e->prev = (*q)->tail;
-    }
-  else                                 /* No tail -> no head too */
-    {
-      (*q)->head = e;
-      e->prev = NULL;
-    }
-
-  (*q)->tail = e;
-cp
-}
-
-/* Remove a queue element */
-void del_queue(packet_queue_t **q, queue_element_t *e)
-{
-cp
-  free(e->packet);
-
-  if(e->next)                          /* There is a successor, so we are not tail */
-    {
-      if(e->prev)                      /* There is a predecessor, so we are not head */
-        {
-          e->next->prev = e->prev;
-          e->prev->next = e->next;
-        }
-      else                             /* We are head */
-        {
-          e->next->prev = NULL;
-          (*q)->head = e->next;
-        }
-    }
-  else                                 /* We are tail (or all alone!) */
-    {          
-      if(e->prev)                      /* We are not alone :) */
-        {
-          e->prev->next = NULL;
-          (*q)->tail = e->prev;
-        }
-      else                             /* Adieu */
-        {
-          free(*q);
-          *q = NULL;
-        }
-    }
-    
-  free(e);
-cp
-}
-
-/*
-  flush a queue by calling function for
-  each packet, and removing it when that
-  returned a zero exit code
-*/
-void flush_queue(connection_t *cl, packet_queue_t **pq,
-                int (*function)(connection_t*,vpn_packet_t*))
-{
-  queue_element_t *p, *next = NULL;
-cp
-  for(p = (*pq)->head; p != NULL; )
-    {
-      next = p->next;
-
-      if(!function(cl, p->packet))
-        del_queue(pq, p);
-        
-      p = next;
-    }
-
-  if(debug_lvl >= DEBUG_TRAFFIC)
-    syslog(LOG_DEBUG, _("Queue flushed"));
-cp
-}
-
-/*
-  flush the send&recv queues
-  void because nothing goes wrong here, packets
-  remain in the queue if something goes wrong
-*/
-void flush_queues(connection_t *cl)
-{
-cp
-  if(cl->sq)
-    {
-      if(debug_lvl >= DEBUG_TRAFFIC)
-       syslog(LOG_DEBUG, _("Flushing send queue for %s (%s)"),
-              cl->name, cl->hostname);
-      flush_queue(cl, &(cl->sq), xsend);
-    }
-
-  if(cl->rq)
-    {
-      if(debug_lvl >=  DEBUG_TRAFFIC)
-       syslog(LOG_DEBUG, _("Flushing receive queue for %s (%s)"),
-              cl->name, cl->hostname);
-      flush_queue(cl, &(cl->rq), xrecv);
-    }
-cp
-}
-
 /*
   send a packet to the given vpn ip.
 */
 /*
   send a packet to the given vpn ip.
 */
@@ -345,39 +222,52 @@ cp
       return -1;
     }
 
       return -1;
     }
 
+  if(!cl->status.active)
+    {
+      if(debug_lvl >= DEBUG_TRAFFIC)
+       syslog(LOG_INFO, _("%s (%s) is not active, dropping packet"),
+              cl->name, cl->hostname);
+
+      return 0;
+    }
+
   /* If we ourselves have indirectdata flag set, we should send only to our uplink! */
 
   /* FIXME - check for indirection and reprogram it The Right Way(tm) this time. */
   
   if(!cl->status.validkey)
     {
   /* If we ourselves have indirectdata flag set, we should send only to our uplink! */
 
   /* FIXME - check for indirection and reprogram it The Right Way(tm) this time. */
   
   if(!cl->status.validkey)
     {
-/* FIXME: Don't queue until everything else is fixed.
       if(debug_lvl >= DEBUG_TRAFFIC)
        syslog(LOG_INFO, _("No valid key known yet for %s (%s), queueing packet"),
               cl->name, cl->hostname);
       if(debug_lvl >= DEBUG_TRAFFIC)
        syslog(LOG_INFO, _("No valid key known yet for %s (%s), queueing packet"),
               cl->name, cl->hostname);
-      add_queue(&(cl->sq), packet, packet->len + 2);
-*/
+
+      list_insert_tail(cl->queue, packet);
+
       if(!cl->status.waitingforkey)
        send_req_key(myself, cl);                       /* Keys should be sent to the host running the tincd */
       return 0;
     }
 
       if(!cl->status.waitingforkey)
        send_req_key(myself, cl);                       /* Keys should be sent to the host running the tincd */
       return 0;
     }
 
-  if(!cl->status.active)
-    {
-/* FIXME: Don't queue until everything else is fixed.
-      if(debug_lvl >= DEBUG_TRAFFIC)
-       syslog(LOG_INFO, _("%s (%s) is not ready, queueing packet"),
-              cl->name, cl->hostname);
-      add_queue(&(cl->sq), packet, packet->len + 2);
-*/
-      return 0; /* We don't want to mess up, do we? */
-    }
-
   /* can we send it? can we? can we? huh? */
 cp
   return xsend(cl, packet);
 }
 
   /* can we send it? can we? can we? huh? */
 cp
   return xsend(cl, packet);
 }
 
+void flush_queue(connection_t *cl)
+{
+  list_node_t *node, *next;
+
+  if(debug_lvl >= DEBUG_TRAFFIC)
+    syslog(LOG_INFO, _("Flushing queue for %s (%s)"), cl->name, cl->hostname);
+  
+  for(node = cl->queue->head; node; node = next)
+    {
+      next = node->next;
+      xsend(cl, (vpn_packet_t *)node->data);
+      list_delete_node(cl->queue, node);
+    }
+}
+
 /*
   open the local ethertap device
 */
 /*
   open the local ethertap device
 */
index 27ba87c..5a1609c 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -16,7 +16,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: net.h,v 1.9.4.24 2000/12/22 21:34:23 guus Exp $
+    $Id: net.h,v 1.9.4.25 2001/01/07 15:25:44 guus Exp $
 */
 
 #ifndef __TINC_NET_H__
 */
 
 #ifndef __TINC_NET_H__
@@ -117,9 +117,7 @@ extern void close_network_connections(void);
 extern void main_loop(void);
 extern int setup_vpn_connection(connection_t *);
 extern void terminate_connection(connection_t *);
 extern void main_loop(void);
 extern int setup_vpn_connection(connection_t *);
 extern void terminate_connection(connection_t *);
-extern void flush_queues(connection_t *);
-extern void add_queue(packet_queue_t **, void *, size_t);
-
+extern void flush_queue(connection_t *);
 
 #include <config.h>
 #ifdef HAVE_OPENSSL_RSA_H
 
 #include <config.h>
 #ifdef HAVE_OPENSSL_RSA_H
index 7e02ad0..200f776 100644 (file)
@@ -1,6 +1,7 @@
 /*
     netutl.c -- some supporting network utility code
     Copyright (C) 1998,1999,2000 Ivo Timmermans <itimmermans@bigfoot.com>
 /*
     netutl.c -- some supporting network utility code
     Copyright (C) 1998,1999,2000 Ivo Timmermans <itimmermans@bigfoot.com>
+                            2000 Guus Sliepen <guus@sliepen.warande.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -16,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: netutl.c,v 1.12.4.16 2000/11/22 18:54:08 guus Exp $
+    $Id: netutl.c,v 1.12.4.17 2001/01/07 15:25:44 guus Exp $
 */
 
 #include "config.h"
 */
 
 #include "config.h"
 
 #include "system.h"
 
 
 #include "system.h"
 
-
-/*
-  free a queue and all of its elements
-*/
-void destroy_queue(packet_queue_t *pq)
-{
-  queue_element_t *p, *q;
-cp
-  for(p = pq->head; p != NULL; p = q)
-    {
-      q = p->next;
-      if(p->packet)
-       free(p->packet);
-      free(p);
-    }
-
-  free(pq);
-cp
-}
-
-
 char *hostlookup(unsigned long addr)
 {
   char *name;
 char *hostlookup(unsigned long addr)
 {
   char *name;
index 01ca31e..22943c2 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: process.c,v 1.1.2.18 2001/01/05 23:53:51 guus Exp $
+    $Id: process.c,v 1.1.2.19 2001/01/07 15:25:45 guus Exp $
 */
 
 #include "config.h"
 */
 
 #include "config.h"
@@ -35,7 +35,6 @@
 #include <unistd.h>
 #include <termios.h>
 
 #include <unistd.h>
 #include <termios.h>
 
-#include <list.h>
 #include <pidfile.h>
 #include <utils.h>
 #include <xalloc.h>
 #include <pidfile.h>
 #include <utils.h>
 #include <xalloc.h>
index 751c101..1f3675d 100644 (file)
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: process.h,v 1.1.2.5 2000/11/24 23:13:06 guus Exp $
+    $Id: process.h,v 1.1.2.6 2001/01/07 15:25:45 guus Exp $
 */
 
 #ifndef __TINC_PROCESS_H__
 #define __TINC_PROCESS_H__
 
 #include "config.h"
 */
 
 #ifndef __TINC_PROCESS_H__
 #define __TINC_PROCESS_H__
 
 #include "config.h"
-#include <list.h>
 
 extern void setup_signals(void);
 extern int execute_script(const char *);
 
 extern void setup_signals(void);
 extern int execute_script(const char *);
index 72f8c3d..12d279a 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: protocol.c,v 1.28.4.72 2001/01/06 18:03:40 guus Exp $
+    $Id: protocol.c,v 1.28.4.73 2001/01/07 15:25:45 guus Exp $
 */
 
 #include "config.h"
 */
 
 #include "config.h"
@@ -35,6 +35,7 @@
 #include <utils.h>
 #include <xalloc.h>
 #include <avl_tree.h>
 #include <utils.h>
 #include <xalloc.h>
 #include <avl_tree.h>
+#include <list.h>
 
 #include <netinet/in.h>
 
 
 #include <netinet/in.h>
 
@@ -1258,6 +1259,8 @@ cp
 
   from->status.validkey = 1;
   from->status.waitingforkey = 0;
 
   from->status.validkey = 1;
   from->status.waitingforkey = 0;
+  
+  flush_queue(from);
 cp
   return 0;
 }
 cp
   return 0;
 }
index 8ff2e39..a11c55a 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: route.c,v 1.1.2.4 2001/01/05 23:53:53 guus Exp $
+    $Id: route.c,v 1.1.2.5 2001/01/07 15:25:49 guus Exp $
 */
 
 #include "config.h"
 */
 
 #include "config.h"
 
 #include "system.h"
 
 
 #include "system.h"
 
-int routing_mode = RMODE_ROUTER;       /* Will be used to determine if we route by MAC or by payload's protocol */
+int routing_mode = RMODE_ROUTER;
 
 
-connection_t *route_mac(connection_t *source, vpn_packet_t *packet)
+void learn_mac(connection_t *source, mac_t *address)
 {
 {
-  connection_t *oldsrc, *dst;
+  connection_t *old;
   subnet_t *subnet;
 cp
   subnet_t *subnet;
 cp
-  /* Learn source address */
-
-  oldsrc = lookup_subnet_mac((mac_t *)(&packet->data[0]))->owner;
+  old = lookup_subnet_mac(address)->owner;
   
   
-  if(!oldsrc)
+  if(!old)
     {
       subnet = new_subnet();
       subnet->type = SUBNET_MAC;
     {
       subnet = new_subnet();
       subnet->type = SUBNET_MAC;
-      memcpy(&subnet->net.mac.address, (mac_t *)(&packet->data[0]), sizeof(mac_t));
+//      subnet->lasttime = gettimeofday();
+      memcpy(&subnet->net.mac.address, address, sizeof(mac_t));
       subnet_add(source, subnet);
       subnet_add(source, subnet);
+
+      if(DEBUG_LVL >= DEBUG_TRAFFIC)
+        {
+          syslog(LOG_DEBUG, _("Learned new MAC address %x:%x:%x:%x:%x:%x from %s (%s)"),
+               address->address.x[0],
+               address->address.x[1],
+               address->address.x[2],
+               address->address.x[3],
+               address->address.x[4],
+               address->address.x[5],
+               cl->name, cl->hostname);
+        }
     }
     }
+}
+
+connection_t *route_mac(connection_t *source, vpn_packet_t *packet)
+{
+  connection_t *oldsrc, *dst;
+  subnet_t *subnet;
+cp
+  /* Learn source address */
 
 
-  /* FIXME: do ageing and roaming */
+  learn_mac(source, (mac_t *)(&packet->data[0]));
   
   /* Lookup destination address */
     
   
   /* Lookup destination address */
     
@@ -96,46 +115,67 @@ connection_t *route_ipv6(vpn_packet_t *packet)
 cp
   if(debug_lvl > DEBUG_NOTHING)
     {
 cp
   if(debug_lvl > DEBUG_NOTHING)
     {
-      syslog(LOG_WARNING, _("Cannot route packet: IPv6 routing not implemented yet"));
+      syslog(LOG_WARNING, _("Cannot route packet: IPv6 routing not yet implemented"));
     } 
 cp
   return NULL;
 }
 
     } 
 cp
   return NULL;
 }
 
-connection_t *route_packet(connection_t *source, vpn_packet_t *packet)
+void route_outgoing(vpn_packet_t *packet)
 {
   unsigned short int type;
 {
   unsigned short int type;
+  avl_tree_t *node;
+  connection_t *cl;
 cp
   /* FIXME: multicast? */
 
   switch(routing_mode)
     {
 cp
   /* FIXME: multicast? */
 
   switch(routing_mode)
     {
-      case RMODE_HUB:
-        return broadcast;
-        
-      case RMODE_SWITCH:
-        return route_mac(source, packet);
-        
       case RMODE_ROUTER:
         type = ntohs(*((unsigned short*)(&packet->data[12])));
         switch(type)
           {
             case 0x0800:
       case RMODE_ROUTER:
         type = ntohs(*((unsigned short*)(&packet->data[12])));
         switch(type)
           {
             case 0x0800:
-              return route_ipv4(packet);
+              cl = route_ipv4(packet);
+              break;
             case 0x86DD:
             case 0x86DD:
-              return route_ipv6(packet);
-      /*
-            case 0x8137:
-              return route_ipx(packet);
-            case 0x0806:
-              return route_arp(packet);
-      */
+              cl = route_ipv6(packet);
+              break;
             default:
               if(debug_lvl >= DEBUG_TRAFFIC)
                 {
                   syslog(LOG_WARNING, _("Cannot route packet: unknown type %hx"), type);
                 }
             default:
               if(debug_lvl >= DEBUG_TRAFFIC)
                 {
                   syslog(LOG_WARNING, _("Cannot route packet: unknown type %hx"), type);
                 }
-              return NULL;
+              return;
            }
            }
+         send_packet(cl, packet);
+         break;
+        
+      case RMODE_SWITCH:
+        cl = route_mac(packet);
+        if(cl)
+          send_packet(cl, packet);
+        break;
+        
+      case RMODE_HUB:
+        for(node = connection_tree->head; node; node = node->next)
+          {
+            cl = (connection_t *)node->data;
+            if(cl->status.active)
+              send_packet(cl, packet);
+          }
+        break;
     }
 }
     }
 }
+
+void route_incoming(connection_t *source, vpn_packet_t *packet)
+{
+  switch(routing_mode)
+    {
+      case RMODE_SWITCH:
+        learn_mac(source, &packet->data[0]);
+        break;
+    }
+  
+  accept_packet(packet);
+}