[Pkg-privacy-commits] [onioncat] 32/241: stripped tun frameheader on TOR end

Intrigeri intrigeri at moszumanska.debian.org
Wed Aug 26 16:16:19 UTC 2015


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch upstream-master
in repository onioncat.

commit c3881f2fb790debaa37721f647bb64251c6874dd
Author: eagle <eagle at 58e1ccc2-750e-0410-8d0d-f93ca75ab447>
Date:   Fri Mar 21 18:32:08 2008 +0000

    stripped tun frameheader on TOR end
    
    git-svn-id: https://www.cypherpunk.at/svn/onioncat/trunk@173 58e1ccc2-750e-0410-8d0d-f93ca75ab447
---
 ocatroute.c | 18 +++++++++++-------
 ocattun.c   |  1 +
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/ocatroute.c b/ocatroute.c
index 19b8bad..2298344 100644
--- a/ocatroute.c
+++ b/ocatroute.c
@@ -96,7 +96,7 @@ void delete_peer(OcatPeer_t *peer)
       }
 }
 
-
+/*
 void rewrite_framehdr(char *buf, int len)
 {
    uint32_t *fhd = (uint32_t*) buf;
@@ -131,6 +131,7 @@ void rewrite_framehdr(char *buf, int len)
       fhd = (uint32_t*) (buf + ofs);
    }
 }
+*/
 
 
 /*const*/ OcatPeer_t *forward_packet(const struct in6_addr *addr, const char *buf, int buflen)
@@ -298,6 +299,8 @@ void *socket_receiver(void *p)
    if (pipe(lpfd_) < 0)
       log_msg(L_FATAL, "[init_socket_receiver] could not create pipe for socket_receiver: \"%s\"", strerror(errno)), exit(1);
 
+   *((uint32_t*) buf) = fhd_key_;
+
    for (;;)
    {
       FD_ZERO(&rset);
@@ -329,7 +332,7 @@ void *socket_receiver(void *p)
       // thread woke up because of internal pipe read => restart selection
       if (FD_ISSET(lpfd_[0], &rset))
       {
-         read(lpfd_[0], buf, FRAME_SIZE);
+         read(lpfd_[0], ihd, FRAME_SIZE - 4);
          continue;
       }
 
@@ -351,7 +354,7 @@ void *socket_receiver(void *p)
             // *** unframed receiver
             // write reordered after IP validation
             // this might happen on linux, see SELECT(2)
-            if ((len = read(fd, buf, FRAME_SIZE)) == -1)
+            if ((len = read(fd, ihd, FRAME_SIZE - 4)) == -1)
             {
                log_msg(L_DEBUG, "[socket_receiver] spurious wakup of %d: \"%s\"", fd, strerror(errno));
                continue;
@@ -387,8 +390,9 @@ void *socket_receiver(void *p)
             }
             pthread_mutex_unlock(&peer_mutex_);
             
-            log_msg(L_DEBUG, "[socket_receiver] trying fhdr rewriting");
-            rewrite_framehdr(buf, len);
+/*            log_msg(L_DEBUG, "[socket_receiver] trying fhdr rewriting");
+            rewrite_framehdr(buf, len);*/
+            len += 4;
             log_msg(L_DEBUG, "[socket_receiver] writing to tun %d framesize %d", tunfd_[1], len);
             if (write(tunfd_[1], buf, len) != len)
                log_msg(L_ERROR, "could not write %d bytes to tunnel %d", len, tunfd_[1]);
@@ -683,12 +687,12 @@ void packet_forwarder(void)
       }
 
       // now forward either directly or to the queue
-      if (!forward_packet(&ihd->ip6_dst, buf, rlen))
+      if (!forward_packet(&ihd->ip6_dst, buf + 4, rlen - 4))
       {
          log_msg(L_NOTICE, "[packet_forwarder] establishing new socks peer");
          socks_queue(&ihd->ip6_dst);
          log_msg(L_DEBUG, "[packet_forwarder] queuing packet");
-         queue_packet(&ihd->ip6_dst, buf, rlen);
+         queue_packet(&ihd->ip6_dst, buf + 4, rlen - 4);
       }
    }
 }
diff --git a/ocattun.c b/ocattun.c
index 0ad8065..3d29049 100644
--- a/ocattun.c
+++ b/ocattun.c
@@ -68,6 +68,7 @@ int tun_alloc(char *dev, struct in6_addr addr)
       perror("TUNSETIFF"), exit(1);
    strcpy(dev, ifr.ifr_name);
    sprintf(buf, "ifconfig tun0 add %s/%d up", astr, TOR_PREFIX_LEN);
+   log_msg(L_NOTICE, "configuring tun IP: \"%s\"", buf);
    if (system(buf) == -1)
       log_msg(L_ERROR, "could not exec \"%s\": \"%s\"", buf, strerror(errno));
    // set tun frame header to ethertype IPv6

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onioncat.git



More information about the Pkg-privacy-commits mailing list