On Wed, May 31, 2006 at 11:34:14AM -0400, xavier wrote:

> > Without the return you duplicate each packet, one going to the local
> > interface and one is directly forwarded to the destination by tinc. But
> > I guess that with the return it is not sending packets out anymore...
> > I'll see if I can create a working patch.
> 
> thanks, waiting for news from you.

Attached is a patch that adds the option "RouteIncoming". Set it
to "no" in tinc.conf, and tinc will hand packets received from other
nodes directly to the tun device.

-- 
Met vriendelijke groet / with kind regards,
    Guus Sliepen <[EMAIL PROTECTED]>
Index: src/net_setup.c
===================================================================
--- src/net_setup.c     (revision 1453)
+++ src/net_setup.c     (working copy)
@@ -293,6 +293,7 @@
                myself->options |= OPTION_INDIRECT;
 
        get_config_bool(lookup_config(config_tree, "TunnelServer"), 
&tunnelserver);
+       get_config_bool(lookup_config(config_tree, "RouteIncoming"), 
&route_incoming);
 
        if(get_config_string(lookup_config(config_tree, "Mode"), &mode)) {
                if(!strcasecmp(mode, "router"))
Index: src/net_packet.c
===================================================================
--- src/net_packet.c    (revision 1453)
+++ src/net_packet.c    (working copy)
@@ -55,6 +55,7 @@
 int keylifetime = 0;
 int keyexpires = 0;
 EVP_CIPHER_CTX packet_ctx;
+bool route_incoming = true;
 static char lzo_wrkmem[LZO1X_999_MEM_COMPRESS > LZO1X_1_MEM_COMPRESS ? 
LZO1X_999_MEM_COMPRESS : LZO1X_1_MEM_COMPRESS];
 
 static void send_udppacket(node_t *, vpn_packet_t *);
@@ -164,7 +165,10 @@
        ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Received packet of %d bytes from 
%s (%s)"),
                           packet->len, n->name, n->hostname);
 
-       route(n, packet);
+       if(route_incoming)
+               route(n, packet);
+       else
+               write_packet(packet);
 }
 
 static void receive_udppacket(node_t *n, vpn_packet_t *inpkt)
Index: src/net.h
===================================================================
--- src/net.h   (revision 1453)
+++ src/net.h   (working copy)
@@ -117,6 +117,7 @@
 extern int maxoutbufsize;
 extern int seconds_till_retry;
 extern int addressfamily;
+extern bool route_incoming;
 
 extern listen_socket_t listen_socket[MAXSOCKETS];
 extern int listen_sockets;

Attachment: signature.asc
Description: Digital signature

_______________________________________________
tinc mailing list
[email protected]
http://brouwer.uvt.nl/cgi-bin/mailman/listinfo/tinc

Reply via email to