[Pkg-privacy-commits] [onioncat] 221/340: OC now works on DragonFly BSD. Misleading config file error message removed. DNS interception started (but not in use yet).

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:04:42 UTC 2015


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

infinity0 pushed a commit to branch debian
in repository onioncat.

commit b0fc55aa3dac87cba6f6bfd51f522f8ab8635b00
Author: eagle <eagle at 58e1ccc2-750e-0410-8d0d-f93ca75ab447>
Date:   Mon Jan 3 20:17:38 2011 +0000

    OC now works on DragonFly BSD.
    Misleading config file error message removed.
    DNS interception started (but not in use yet).
    
    
    git-svn-id: http://www.cypherpunk.at/svn/onioncat/trunk@550 58e1ccc2-750e-0410-8d0d-f93ca75ab447
---
 config.h.in      |  9 +++++++
 configure        | 27 +++++++++++---------
 configure.ac     |  2 +-
 src/Makefile.am  |  2 +-
 src/Makefile.in  |  6 +++--
 src/ocat.c       |  3 ++-
 src/ocat.h       | 12 +++++++++
 src/ocateth.c    |  1 +
 src/ocatresolv.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/ocatsetup.c  |  5 ++++
 src/ocattun.c    |  2 +-
 11 files changed, 126 insertions(+), 18 deletions(-)

diff --git a/config.h.in b/config.h.in
index 02f79e8..602b7e2 100644
--- a/config.h.in
+++ b/config.h.in
@@ -9,6 +9,9 @@
 /* enable handling of accidental HTTP requests */
 #undef HANDLE_HTTP
 
+/* Define to 1 if you have the <arpa/nameser.h> header file. */
+#undef HAVE_ARPA_NAMESER_H
+
 /* Define to 1 if you have the <endian.h> header file. */
 #undef HAVE_ENDIAN_H
 
@@ -57,6 +60,9 @@
 /* Define to 1 if you have the <netinet/ip.h> header file. */
 #undef HAVE_NETINET_IP_H
 
+/* Define to 1 if you have the <netinet/udp.h> header file. */
+#undef HAVE_NETINET_UDP_H
+
 /* Define to 1 if you have the <net/ethernet.h> header file. */
 #undef HAVE_NET_ETHERNET_H
 
@@ -66,6 +72,9 @@
 /* Define to 1 if you have the <net/if_tun.h> header file. */
 #undef HAVE_NET_IF_TUN_H
 
+/* Define to 1 if you have the <net/tun/if_tun.h> header file. */
+#undef HAVE_NET_TUN_IF_TUN_H
+
 /* Define if you have POSIX threads libraries and header files. */
 #undef HAVE_PTHREAD
 
diff --git a/configure b/configure
index 3ba81b6..9317dee 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r549.
+# Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r550.
 #
 # Report bugs to <rahra at cypherpunk.at>.
 #
@@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='onioncat'
 PACKAGE_TARNAME='onioncat'
-PACKAGE_VERSION='0.2.2.r549'
-PACKAGE_STRING='onioncat 0.2.2.r549'
+PACKAGE_VERSION='0.2.2.r550'
+PACKAGE_STRING='onioncat 0.2.2.r550'
 PACKAGE_BUGREPORT='rahra at cypherpunk.at'
 
 ac_subst_vars='SHELL
@@ -1262,7 +1262,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures onioncat 0.2.2.r549 to adapt to many kinds of systems.
+\`configure' configures onioncat 0.2.2.r550 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1332,7 +1332,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of onioncat 0.2.2.r549:";;
+     short | recursive ) echo "Configuration of onioncat 0.2.2.r550:";;
    esac
   cat <<\_ACEOF
 
@@ -1425,7 +1425,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-onioncat configure 0.2.2.r549
+onioncat configure 0.2.2.r550
 generated by GNU Autoconf 2.62
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1439,7 +1439,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by onioncat $as_me 0.2.2.r549, which was
+It was created by onioncat $as_me 0.2.2.r550, which was
 generated by GNU Autoconf 2.62.  Invocation command line was
 
   $ $0 $@
@@ -2088,7 +2088,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='onioncat'
- VERSION='0.2.2.r549'
+ VERSION='0.2.2.r550'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2239,7 +2239,7 @@ ac_config_headers="$ac_config_headers config.h"
 
 
 cat >>confdefs.h <<\_ACEOF
-#define SVN_REVISION "549"
+#define SVN_REVISION "550"
 _ACEOF
 
 
@@ -4324,7 +4324,10 @@ fi
 
 
 
-for ac_header in sys/types.h sys/wait.h sys/socket.h sys/stat.h netdb.h netinet/in.h netinet/in_systm.h netinet/ip.h netinet/ip6.h netinet/in6.h net/if.h net/if_tun.h linux/if_tun.h linux/sockios.h endian.h sys/endian.h netinet/icmp6.h net/ethernet.h netinet/if_ether.h netinet/ether.h sys/ethernet.h fcntl.h time.h
+
+
+
+for ac_header in sys/types.h sys/wait.h sys/socket.h sys/stat.h netdb.h arpa/nameser.h netinet/in.h netinet/in_systm.h netinet/ip.h netinet/ip6.h netinet/in6.h net/if.h net/if_tun.h net/tun/if_tun.h linux/if_tun.h linux/sockios.h endian.h sys/endian.h netinet/icmp6.h net/ethernet.h netinet/if_ether.h netinet/ether.h netinet/udp.h sys/ethernet.h fcntl.h time.h
 do
 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
@@ -5944,7 +5947,7 @@ exec 6>&1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by onioncat $as_me 0.2.2.r549, which was
+This file was extended by onioncat $as_me 0.2.2.r550, which was
 generated by GNU Autoconf 2.62.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5997,7 +6000,7 @@ Report bugs to <bug-autoconf at gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-onioncat config.status 0.2.2.r549
+onioncat config.status 0.2.2.r550
 configured by $0, generated by GNU Autoconf 2.62,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/configure.ac b/configure.ac
index 0e9065f..0d201b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,7 +60,7 @@ AC_SEARCH_LIBS([inet_ntop], [nsl])
 
 # Checks for header files.
 #AC_HEADER_STDC
-AC_CHECK_HEADERS([sys/types.h sys/wait.h sys/socket.h sys/stat.h netdb.h netinet/in.h netinet/in_systm.h netinet/ip.h netinet/ip6.h netinet/in6.h net/if.h net/if_tun.h linux/if_tun.h linux/sockios.h endian.h sys/endian.h netinet/icmp6.h net/ethernet.h netinet/if_ether.h netinet/ether.h sys/ethernet.h fcntl.h time.h], [], [],
+AC_CHECK_HEADERS([sys/types.h sys/wait.h sys/socket.h sys/stat.h netdb.h arpa/nameser.h netinet/in.h netinet/in_systm.h netinet/ip.h netinet/ip6.h netinet/in6.h net/if.h net/if_tun.h net/tun/if_tun.h linux/if_tun.h linux/sockios.h endian.h sys/endian.h netinet/icmp6.h net/ethernet.h netinet/if_ether.h netinet/ether.h netinet/udp.h sys/ethernet.h fcntl.h time.h], [], [],
 [[
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
diff --git a/src/Makefile.am b/src/Makefile.am
index 2415d07..de5d307 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,5 @@
 bin_PROGRAMS = ocat
-ocat_SOURCES = ocat.c ocatlog.c ocatroute.c ocatthread.c ocattun.c ocatv6conv.c ocatcompat.c ocatpeer.c ocatsetup.c ocatipv4route.c ocateth.c ocatsocks.c ocatlibe.c ocatctrl.c ocatipv6route.c ocaticmp.c ocat_wintuntap.c ocat_netdesc.c ocathosts.c
+ocat_SOURCES = ocat.c ocatlog.c ocatroute.c ocatthread.c ocattun.c ocatv6conv.c ocatcompat.c ocatpeer.c ocatsetup.c ocatipv4route.c ocateth.c ocatsocks.c ocatlibe.c ocatctrl.c ocatipv6route.c ocaticmp.c ocat_wintuntap.c ocat_netdesc.c ocathosts.c ocatresolv.c
 noinst_HEADERS = ocat.h ocat_netdesc.h strlcpy.c strlcat.c ocathosts.h
 AM_CFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\"
 
diff --git a/src/Makefile.in b/src/Makefile.in
index 8055335..4523e78 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -58,7 +58,8 @@ am_ocat_OBJECTS = ocat.$(OBJEXT) ocatlog.$(OBJEXT) ocatroute.$(OBJEXT) \
 	ocatipv4route.$(OBJEXT) ocateth.$(OBJEXT) ocatsocks.$(OBJEXT) \
 	ocatlibe.$(OBJEXT) ocatctrl.$(OBJEXT) ocatipv6route.$(OBJEXT) \
 	ocaticmp.$(OBJEXT) ocat_wintuntap.$(OBJEXT) \
-	ocat_netdesc.$(OBJEXT) ocathosts.$(OBJEXT)
+	ocat_netdesc.$(OBJEXT) ocathosts.$(OBJEXT) \
+	ocatresolv.$(OBJEXT)
 ocat_OBJECTS = $(am_ocat_OBJECTS)
 ocat_LDADD = $(LDADD)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
@@ -163,7 +164,7 @@ sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
-ocat_SOURCES = ocat.c ocatlog.c ocatroute.c ocatthread.c ocattun.c ocatv6conv.c ocatcompat.c ocatpeer.c ocatsetup.c ocatipv4route.c ocateth.c ocatsocks.c ocatlibe.c ocatctrl.c ocatipv6route.c ocaticmp.c ocat_wintuntap.c ocat_netdesc.c ocathosts.c
+ocat_SOURCES = ocat.c ocatlog.c ocatroute.c ocatthread.c ocattun.c ocatv6conv.c ocatcompat.c ocatpeer.c ocatsetup.c ocatipv4route.c ocateth.c ocatsocks.c ocatlibe.c ocatctrl.c ocatipv6route.c ocaticmp.c ocat_wintuntap.c ocat_netdesc.c ocathosts.c ocatresolv.c
 noinst_HEADERS = ocat.h ocat_netdesc.h strlcpy.c strlcat.c ocathosts.h
 AM_CFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\"
 all: all-am
@@ -245,6 +246,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ocatlibe.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ocatlog.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ocatpeer.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ocatresolv.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ocatroute.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ocatsetup.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ocatsocks.Po at am__quote@
diff --git a/src/ocat.c b/src/ocat.c
index 7578716..dbcc0ac 100644
--- a/src/ocat.c
+++ b/src/ocat.c
@@ -471,6 +471,7 @@ int main(int argc, char *argv[])
    {
       CNF(config_failed) = errno;
       CNF(config_read) = 1;
+      log_debug("opening config file \"%s\" failed: \"%s\"", CNF(config_file), strerror(CNF(config_failed)));
    }
    else
       ctrl_handler((void*) (long) c);
@@ -501,7 +502,7 @@ int main(int argc, char *argv[])
    (void) init_ocat_thread("main");
    detach_thread();
 
-   if (CNF(config_failed))
+   if (CNF(config_failed) && (CNF(config_failed != ENOENT)))
       log_msg(LOG_NOTICE, "could not open config file %s: %s", CNF(config_file), strerror(CNF(config_failed)));
 
    if (urlconv == 2)
diff --git a/src/ocat.h b/src/ocat.h
index 3a097a8..7a95d06 100644
--- a/src/ocat.h
+++ b/src/ocat.h
@@ -84,6 +84,12 @@
 #ifdef HAVE_NETINET_IP6_H
 #include <netinet/ip6.h>
 #endif
+#ifdef HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif
 #ifdef HAVE_NET_ETHERNET_H
 #include <net/ethernet.h>
 #endif
@@ -96,6 +102,9 @@
 #ifdef HAVE_NET_IF_TUN_H
 #include <net/if_tun.h>
 #endif
+#ifdef HAVE_NET_TUN_IF_TUN_H
+#include <net/tun/if_tun.h>
+#endif
 
 #ifdef __CYGWIN__
 #include "cygwin/ocat_cygwin.h"
@@ -340,6 +349,7 @@ struct OcatSetup
    int pid_fd[2];
    int sig_usr1, clear_stats;
    int hosts_lookup;
+   struct in6_addr oc_vdns;
 };
 
 #ifdef PACKET_QUEUE
@@ -657,6 +667,8 @@ int win_write_tun(const char *, int);
 #define tun_write(x,y,z) write(x,y,z)
 #endif
 
+/* ocatresolv.c */
+int check_dns(const struct ip6_hdr *, int);
 
 #endif
 
diff --git a/src/ocateth.c b/src/ocateth.c
index 2c72137..b37725f 100644
--- a/src/ocateth.c
+++ b/src/ocateth.c
@@ -37,6 +37,7 @@ static pthread_mutex_t mac_mutex_ = PTHREAD_MUTEX_INITIALIZER;
  * RFC2373 is obsoleted by RFC3513 addressing ipv6
  * RFC2461 is obsoleted by RFC4861
  * RFC4862 IPv6 Stateless Address Autoconfiguration
+ * RFC4443 ICMP6 (updates 2780, obsoletes 2463) (20101230)
  */
 
 /* IPv6 Ethernet Multicast: (MAC) 33:33:xx:xx:xx:xx, xx -> 4 lowest order bytes of IPv6 destination
diff --git a/src/ocatresolv.c b/src/ocatresolv.c
new file mode 100644
index 0000000..633a607
--- /dev/null
+++ b/src/ocatresolv.c
@@ -0,0 +1,75 @@
+/* Copyright 2008 Bernhard R. Fischer, Daniel Haslinger.
+ *
+ * This file is part of OnionCat.
+ *
+ * OnionCat is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OnionCat is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with OnionCat. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* This files contains DNS interception stuff. This routines are not used, yet.
+ */
+
+#include "ocat.h"
+
+#ifdef USE_DNS_REDIRECT
+
+int check_dns(const struct ip6_hdr *ip6, int len)
+{
+   uint16_t *ckbuf, sum;
+   struct udphdr *udp;
+   HEADER *dns;
+#ifdef DEBUG
+   int i;
+   char tmp[100];
+#endif
+
+   log_debug("check_dns");
+   if (len < sizeof(*ip6))
+      return -1;
+
+#ifdef DEBUG
+   tmp[0] = '\0';
+   for (i = 0; i < 40; i++)
+      snprintf(tmp + strlen(tmp), 100 - strlen(tmp), "%02x", ((char*)ip6)[i]);
+   log_debug("ip6: %s", tmp);
+#endif
+
+   if (ip6->ip6_nxt != IPPROTO_UDP)
+      return -1;
+
+   if (!IN6_ARE_ADDR_EQUAL(&CNF(oc_vdns), &ip6->ip6_dst))
+      return -1;
+
+   log_debug("destination is virtual OC DNS server");
+   udp = (struct udphdr*) (ip6 + 1);
+   ckbuf = malloc_ckbuf(&ip6->ip6_src, &ip6->ip6_dst, ntohs(ip6->ip6_plen), IPPROTO_UDP, udp);
+   sum = checksum(ckbuf, ntohs(ip6->ip6_plen) + sizeof(struct ip6_psh));
+   free_ckbuf(ckbuf);
+
+   if (sum)
+   {
+      log_debug("checksum error");
+      return -1;
+   }
+
+   log_debug("dport = %d", ntohs(udp->uh_dport));
+   if (ntohs(udp->uh_dport) != 53)
+      return -1;
+
+   log_debug("DNS request found");
+   dns = (HEADER*) (udp + 1);
+
+   return 0;
+}
+
+#endif
+
diff --git a/src/ocatsetup.c b/src/ocatsetup.c
index 0719c47..4399ee4 100644
--- a/src/ocatsetup.c
+++ b/src/ocatsetup.c
@@ -204,6 +204,8 @@ void post_init_setup(void)
    snprintf(&setup_.version[strlen(setup_.version)], VERSION_STRING_LEN - strlen(setup_.version), " -- compiled %s %s", __DATE__, __TIME__);
 #endif
    setup_.pid_file = NDESC(pid_file);
+   setup_.oc_vdns = NDESC(prefix);
+   setup_.oc_vdns.s6_addr[15] = 1;
 }
 
 
@@ -348,6 +350,9 @@ void print_setup_struct(FILE *f)
       else
          log_msg(LOG_WARNING, "could not convert struct sockaddr: \"%s\"", strerror(errno));
    }
+
+   inet_ntop(AF_INET6, &setup_.oc_vdns, ip6, SBUF);
+   fprintf(f, "ocat_dir               = %s\n", ip6);
 }
 
 
diff --git a/src/ocattun.c b/src/ocattun.c
index 509c68b..4053347 100644
--- a/src/ocattun.c
+++ b/src/ocattun.c
@@ -143,7 +143,7 @@ int tun_alloc(char *dev, int dev_s, struct in6_addr addr)
    }
    */
 
-#ifdef __FreeBSD__
+#if defined __FreeBSD__ || defined __DragonFly__
 
    int prm = 1;
    if (ioctl(fd, TUNSIFHEAD, &prm) == -1)

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