[Pkg-privacy-commits] [onioncat] 64/241: prompt added at controller interface and route parser enhanced

Intrigeri intrigeri at moszumanska.debian.org
Wed Aug 26 16:16:28 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 1b8e4b1e307621a0a41bc6462f2f2aa2e3b1e367
Author: eagle <eagle at 58e1ccc2-750e-0410-8d0d-f93ca75ab447>
Date:   Mon Sep 15 09:58:58 2008 +0000

    prompt added at controller interface and route parser enhanced
    
    git-svn-id: https://www.cypherpunk.at/svn/onioncat/trunk@280 58e1ccc2-750e-0410-8d0d-f93ca75ab447
---
 src/ocat.h          |  2 ++
 src/ocatipv4route.c |  6 ++++++
 src/ocatroute.c     | 20 +++++++++++++++++---
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/ocat.h b/src/ocat.h
index a045324..9311d48 100644
--- a/src/ocat.h
+++ b/src/ocat.h
@@ -115,6 +115,8 @@
 #define E_RT_ILLNM -3
 #define E_RT_SYNTAX -4
 #define E_RT_NULLPTR -5
+#define E_RT_NOTORGW -6
+#define E_RT_GWSELF -7
 
 
 #define IPV4_KEY 0
diff --git a/src/ocatipv4route.c b/src/ocatipv4route.c
index 154d605..77ba99f 100644
--- a/src/ocatipv4route.c
+++ b/src/ocatipv4route.c
@@ -191,6 +191,12 @@ int parse_route(const char *rs)
    if (inet_pton(AF_INET6, s, &route.gw) != 1)
       return E_RT_SYNTAX;
 
+   if (!has_tor_prefix(&route.gw))
+      return E_RT_NOTORGW;
+
+   if (!memcmp(&route.gw, &setup.ocat_addr, sizeof(setup.ocat_addr)))
+      return E_RT_GWSELF;
+
    route.netmask = ntohl(route.netmask);
    route.dest = ntohl(route.dest);
 
diff --git a/src/ocatroute.c b/src/ocatroute.c
index d5d5e9f..ac701c6 100644
--- a/src/ocatroute.c
+++ b/src/ocatroute.c
@@ -1023,7 +1023,7 @@ void *ctrl_handler(void *p)
    for (;;)
    {
       if (setup.config_read)
-         fprintf(fo, "> ");
+         fprintf(fo, "%s> ", setup.onion_url);
 
       c = getc(ff);
       if (c == EOF)
@@ -1119,8 +1119,22 @@ void *ctrl_handler(void *p)
       {
          if (rlen > 6)
          {
-            if ((c = parse_route(&buf[6])))
-               fprintf(ff, "ERR %d\n", c);
+            c = parse_route(&buf[6]);
+            switch (c)
+            {
+               case E_RT_NOTORGW:
+                  s = "gateway has not TOR prefix";
+                  break;
+
+               case E_RT_GWSELF:
+                  s = "gateway points to me";
+                  break;
+
+               default:
+                  s = "";
+            }
+            if (c)
+               fprintf(ff, "ERR %d %s\n", c, s);
          }
          else
             print_routes(fo);

-- 
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