- Timestamp:
- 11/29/09 22:37:56 (2 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 19 edited
- 3 copied
-
. (modified) (1 prop)
-
ChangeLog (modified) (1 diff)
-
Makefile.in (modified) (1 diff)
-
configure (modified) (12 diffs)
-
configure.ac (modified) (1 diff)
-
i2p (added)
-
i2p/Garlicat-HOWTO (copied) (copied from branches/garlicat/Garlicat-HOWTO)
-
i2p/onioncat-privatehosts.pl (added)
-
man/Makefile.in (modified) (1 diff)
-
man/ocat.1 (modified) (6 diffs, 1 prop)
-
src (modified) (1 prop)
-
src/Makefile.am (modified) (1 diff)
-
src/Makefile.in (modified) (6 diffs)
-
src/cygwin/Makefile.in (modified) (1 diff)
-
src/ocat.c (modified) (11 diffs)
-
src/ocat.h (modified) (8 diffs)
-
src/ocat_netdesc.c (copied) (copied from branches/garlicat/src/ocat_netdesc.c)
-
src/ocat_netdesc.h (copied) (copied from branches/garlicat/src/ocat_netdesc.h)
-
src/ocatctrl.c (modified) (2 diffs)
-
src/ocatlibe.c (modified) (2 diffs)
-
src/ocatsetup.c (modified) (11 diffs)
-
src/ocatsocks.c (modified) (5 diffs)
-
src/ocattun.c (modified) (5 diffs)
-
src/ocatv6conv.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/garlicat (added) merged: 524-531
- Property svn:mergeinfo changed
-
trunk/ChangeLog
r533 r534 1 1 * version 0.2.2 2 - GarliCat branch merged back into trunk 3 - added onioncat-privatehosts.pl to trunk (written by zzz) 2 4 3 5 * version 0.2.1 -
trunk/Makefile.in
r508 r534 109 109 LIBOBJS = @LIBOBJS@ 110 110 LIBS = @LIBS@ 111 LN_S = @LN_S@ 111 112 LTLIBOBJS = @LTLIBOBJS@ 112 113 MAKEINFO = @MAKEINFO@ -
trunk/configure
r533 r534 1 1 #! /bin/sh 2 2 # Guess values for system-dependent variables and create Makefiles. 3 # Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r53 3.3 # Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r534. 4 4 # 5 5 # Report bugs to <rahra@cypherpunk.at>. … … 597 597 PACKAGE_NAME='onioncat' 598 598 PACKAGE_TARNAME='onioncat' 599 PACKAGE_VERSION='0.2.2.r53 3'600 PACKAGE_STRING='onioncat 0.2.2.r53 3'599 PACKAGE_VERSION='0.2.2.r534' 600 PACKAGE_STRING='onioncat 0.2.2.r534' 601 601 PACKAGE_BUGREPORT='rahra@cypherpunk.at' 602 602 … … 675 675 am__fastdepCC_TRUE 676 676 am__fastdepCC_FALSE 677 LN_S 677 678 build 678 679 build_cpu … … 1260 1261 # This message is too long to be a string in the A/UX 3.1 sh. 1261 1262 cat <<_ACEOF 1262 \`configure' configures onioncat 0.2.2.r53 3to adapt to many kinds of systems.1263 \`configure' configures onioncat 0.2.2.r534 to adapt to many kinds of systems. 1263 1264 1264 1265 Usage: $0 [OPTION]... [VAR=VALUE]... … … 1330 1331 if test -n "$ac_init_help"; then 1331 1332 case $ac_init_help in 1332 short | recursive ) echo "Configuration of onioncat 0.2.2.r53 3:";;1333 short | recursive ) echo "Configuration of onioncat 0.2.2.r534:";; 1333 1334 esac 1334 1335 cat <<\_ACEOF … … 1422 1423 if $ac_init_version; then 1423 1424 cat <<\_ACEOF 1424 onioncat configure 0.2.2.r53 31425 onioncat configure 0.2.2.r534 1425 1426 generated by GNU Autoconf 2.62 1426 1427 … … 1436 1437 running configure, to aid debugging if configure makes a mistake. 1437 1438 1438 It was created by onioncat $as_me 0.2.2.r53 3, which was1439 It was created by onioncat $as_me 0.2.2.r534, which was 1439 1440 generated by GNU Autoconf 2.62. Invocation command line was 1440 1441 … … 2085 2086 # Define the identity of the package. 2086 2087 PACKAGE='onioncat' 2087 VERSION='0.2.2.r53 3'2088 VERSION='0.2.2.r534' 2088 2089 2089 2090 … … 2236 2237 2237 2238 cat >>confdefs.h <<\_ACEOF 2238 #define SVN_REVISION "53 3"2239 #define SVN_REVISION "534" 2239 2240 _ACEOF 2240 2241 … … 3405 3406 3406 3407 #AC_PROG_INSTALL 3408 { $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5 3409 $as_echo_n "checking whether ln -s works... " >&6; } 3410 LN_S=$as_ln_s 3411 if test "$LN_S" = "ln -s"; then 3412 { $as_echo "$as_me:$LINENO: result: yes" >&5 3413 $as_echo "yes" >&6; } 3414 else 3415 { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 3416 $as_echo "no, using $LN_S" >&6; } 3417 fi 3418 3407 3419 # Make sure we can run config.sub. 3408 3420 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || … … 5209 5221 # values after options handling. 5210 5222 ac_log=" 5211 This file was extended by onioncat $as_me 0.2.2.r53 3, which was5223 This file was extended by onioncat $as_me 0.2.2.r534, which was 5212 5224 generated by GNU Autoconf 2.62. Invocation command line was 5213 5225 … … 5262 5274 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 5263 5275 ac_cs_version="\\ 5264 onioncat config.status 0.2.2.r53 35276 onioncat config.status 0.2.2.r534 5265 5277 configured by $0, generated by GNU Autoconf 2.62, 5266 5278 with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -
trunk/configure.ac
r533 r534 20 20 AC_PROG_CC 21 21 #AC_PROG_INSTALL 22 AC_PROG_LN_S 22 23 ACX_PTHREAD 23 24 -
trunk/man/Makefile.in
r508 r534 79 79 LIBOBJS = @LIBOBJS@ 80 80 LIBS = @LIBS@ 81 LN_S = @LN_S@ 81 82 LTLIBOBJS = @LTLIBOBJS@ 82 83 MAKEINFO = @MAKEINFO@ -
trunk/man/ocat.1
- Property svn:mergeinfo changed
/branches/garlicat/man/ocat.1 (added) merged: 529
r514 r534 15 15 .\" along with OnionCat. If not, see <http://www.gnu.org/licenses/>. 16 16 .\" 17 .TH OCAT 1 200 8-12-07"ocat" "OnionCat User's Manual"17 .TH OCAT 1 2009-11-15 "ocat" "OnionCat User's Manual" 18 18 .SH NAME 19 19 ocat \- OnionCat creates a transparent IPv6 layer on top of Tor's hidden services. 20 .br 21 gcat \- GarliCat is like OnionCat but it works with I2P instead of Tor. 20 22 .SH SYNOPSIS 21 23 .B ocat … … 31 33 -R [\fIOPTION\fP]\fI (4th form)\fP 32 34 .br 35 .B gcat 36 [\fIOPTION\fP] \fIi2p_id (5th form)\fP 37 .br 33 38 .SH DESCRIPTION 34 OnionCat creates a transparent IPv6 layer on top of Tor's hidden services . It35 transmits any kind of IP-based data transparently through the Tor network on a 36 location hidden basis. You can think of it as a point-to-multipoint VPN 37 between hidden services.39 OnionCat creates a transparent IPv6 layer on top of Tor's hidden services or 40 I2P's tunnels. It transmits any kind of IP-based data transparently through the 41 Tor/I2P network on a location hidden basis. You can think of it as a 42 peer-to-peer VPN between hidden services. 38 43 39 44 OnionCat is a stand-alone application which runs in userland and is a connector 40 between Tor and the local OS. Any protocol which is based on IP can be45 between Tor/I2P and the local OS. Any protocol which is based on IP can be 41 46 transmitted. Of course, UDP and TCP (and probably ICMP) are the most important 42 47 ones but all other protocols can also be forwarded through it. … … 44 49 OnionCat opens a TUN device and assigns an IPv6 address to it. All packets 45 50 forwarded to the TUN device by the kernel are forwarded by OnionCat to other 46 OnionCats listening on Tor's hidden service ports. The IPv6 address depends on 47 the \fIonion_id\fP of the locally configured hidden service (see \fBtor(8)\fP). 48 Depending on the configuration of Tor the \fIonion_id\fP usually can be found 49 at \fI/var/lib/tor/hidden_service/hostname\fP or similar location. 51 OnionCats listening on Tor's hidden service ports or I2P's server tunnels. The 52 IPv6 address depends on the \fIonion_id\fP or the i2p_id, respectively. The 53 \fIonion_id\fP is the hostname of the locally configured hidden service (see 54 \fBtor(8)\fP). Depending on the configuration of Tor the \fIonion_id\fP usually 55 can be found at \fI/var/lib/tor/hidden_service/hostname\fP or similar location. 56 The \fIi2p_id\fP is the 80 bit long Base32 encoded hostname of the I2P server 57 tunnel. 50 58 51 59 .SS OPTIONS … … 54 62 Enable IPv4 forwarding. See http://www.cypherpunk.at/onioncat/wiki/IPv4 for further 55 63 information on IPv4. 64 .br 65 Native IPv4 forwarding is deprecated. The recommended solution for IPv4 66 forwarding is to build a IPv4-through-IPv6 tunnel through OnionCat. 56 67 .TP 57 68 \fB\-a\fP … … 87 98 \fB\-i\fP 88 99 Convert \fIonion_id\fP to IPv6 address and exit. 100 .TP 101 \fB\-I\fP 102 Run OnionCat in GarliCat mode. Using this option is identical to running OnionCat 103 with the command name \fBgcat\fP. 89 104 .TP 90 105 \fB\-l\fP \fI[ip:]port\fP … … 164 179 Tor project homepage http://www.torproject.org/ 165 180 181 I2P project homepage http://www.i2p2.de/ 182 166 183 .SH COPYRIGHT 167 184 Copyright 2008-2009 Bernhard R. Fischer. - Property svn:mergeinfo changed
-
trunk/src
- Property svn:mergeinfo changed
/branches/garlicat/src (added) merged: 525-529
- Property svn:mergeinfo changed
-
trunk/src/Makefile.am
r486 r534 1 1 bin_PROGRAMS = ocat 2 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 3 include_HEADERS = ocat.h strlcpy.c strlcat.c2 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 3 include_HEADERS = ocat.h ocat_netdesc.h strlcpy.c strlcat.c 4 4 5 install-exec-hook: 6 $(LN_S) -f $(DESTDIR)$(bindir)/ocat$(EXEEXT) \ 7 $(DESTDIR)$(bindir)/gcat$(EXEEXT) 8 -
trunk/src/Makefile.in
r508 r534 58 58 ocatipv4route.$(OBJEXT) ocateth.$(OBJEXT) ocatsocks.$(OBJEXT) \ 59 59 ocatlibe.$(OBJEXT) ocatctrl.$(OBJEXT) ocatipv6route.$(OBJEXT) \ 60 ocaticmp.$(OBJEXT) ocat_wintuntap.$(OBJEXT) 60 ocaticmp.$(OBJEXT) ocat_wintuntap.$(OBJEXT) \ 61 ocat_netdesc.$(OBJEXT) 61 62 ocat_OBJECTS = $(am_ocat_OBJECTS) 62 63 ocat_LDADD = $(LDADD) … … 107 108 LIBOBJS = @LIBOBJS@ 108 109 LIBS = @LIBS@ 110 LN_S = @LN_S@ 109 111 LTLIBOBJS = @LTLIBOBJS@ 110 112 MAKEINFO = @MAKEINFO@ … … 168 170 sysconfdir = @sysconfdir@ 169 171 target_alias = @target_alias@ 170 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 171 include_HEADERS = ocat.h strlcpy.c strlcat.c172 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 173 include_HEADERS = ocat.h ocat_netdesc.h strlcpy.c strlcat.c 172 174 all: all-am 173 175 … … 237 239 238 240 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocat.Po@am__quote@ 241 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocat_netdesc.Po@am__quote@ 239 242 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocat_wintuntap.Po@am__quote@ 240 243 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocatcompat.Po@am__quote@ … … 415 418 416 419 install-exec-am: install-binPROGRAMS 420 @$(NORMAL_INSTALL) 421 $(MAKE) $(AM_MAKEFLAGS) install-exec-hook 417 422 418 423 install-info: install-info-am … … 447 452 html-am info info-am install install-am install-binPROGRAMS \ 448 453 install-data install-data-am install-exec install-exec-am \ 449 install-includeHEADERS install-info install-info-am \ 450 install-man install-strip installcheck installcheck-am \ 451 installdirs maintainer-clean maintainer-clean-generic \ 452 mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ 453 ps ps-am tags uninstall uninstall-am uninstall-binPROGRAMS \ 454 uninstall-includeHEADERS uninstall-info-am 455 454 install-exec-hook install-includeHEADERS install-info \ 455 install-info-am install-man install-strip installcheck \ 456 installcheck-am installdirs maintainer-clean \ 457 maintainer-clean-generic mostlyclean mostlyclean-compile \ 458 mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ 459 uninstall-am uninstall-binPROGRAMS uninstall-includeHEADERS \ 460 uninstall-info-am 461 462 463 install-exec-hook: 464 $(LN_S) -f $(DESTDIR)$(bindir)/ocat$(EXEEXT) \ 465 $(DESTDIR)$(bindir)/gcat$(EXEEXT) 456 466 # Tell versions [3.59,3.63) of GNU make to not export all variables. 457 467 # Otherwise a system limit (for SysV at least) may be exceeded. -
trunk/src/cygwin/Makefile.in
r508 r534 88 88 LIBOBJS = @LIBOBJS@ 89 89 LIBS = @LIBS@ 90 LN_S = @LN_S@ 90 91 LTLIBOBJS = @LTLIBOBJS@ 91 92 MAKEINFO = @MAKEINFO@ -
trunk/src/ocat.c
r523 r534 18 18 19 19 #include "ocat.h" 20 #include "ocat_netdesc.h" 20 21 21 22 … … 33 34 " -f <config_file> read config from config_file\n" 34 35 " -i convert onion hostname to IPv6 and exit\n" 36 " -I GarliCat mode, use I2P instead of Tor\n" 35 37 " -l [<ip>:]<port> set ocat listen address and port, default = 127.0.0.1:%d\n" 36 38 " -L <log_file> log output to <log_file> (default = stderr)\n" … … 51 53 OCAT_DIR, OCAT_CONNECT_LOG, CNF(create_clog), 52 54 CNF(daemon), CNF(daemon) ^ 1, 53 CNF(debug_level), OCAT_LISTEN_PORT,55 CNF(debug_level), NDESC(listen_port), 54 56 CNF(pid_file), 55 57 CNF(ocat_dest_port), ntohs(CNF(socks_dst)->sin_port), … … 237 239 int urlconv = 0; 238 240 239 snprintf(def, 100, "127.0.0.1:%d", OCAT_LISTEN_PORT);240 241 241 init_setup(); 242 242 243 if (argc < 2) 244 usage(argv[0]), exit(1); 245 246 while ((c = getopt(argc, argv, "abBCd:f:hrRiopl:t:T:s:u:4L:P:")) != -1) 243 while ((c = getopt(argc, argv, "abBCd:f:hrRiIopl:t:T:s:u:4L:P:")) != -1) 247 244 switch (c) 248 245 { … … 276 273 break; 277 274 275 case 'I': 276 CNF(net_type) = NTYPE_I2P; 277 break; 278 278 279 case 'l': 279 add_listener(optarg , def);280 add_listener(optarg); 280 281 break; 281 282 … … 340 341 exit(1); 341 342 } 343 344 // detect network type by command file name 345 // FIXME: this should be not hardcoded in that way 346 if (!strcmp(argv[0], "gcat") || !strcmp(argv[0], "garlicat")) 347 CNF(net_type) = NTYPE_I2P; 348 349 snprintf(def, 100, "127.0.0.1:%d", NDESC(listen_port)); 350 post_init_setup(); 351 352 // usage output must be after mode detection (Tor/I2P) 353 if (argc < 2) 354 usage(argv[0]), exit(1); 342 355 343 356 if (!CNF(rand_addr) && !argv[optind]) … … 367 380 log_msg(LOG_ERR, "address does not have TOR prefix"), exit(1); 368 381 ipv6tonion(&CNF(ocat_addr), CNF(onion_url)); 369 printf("%s .onion\n", CNF(onion_url));382 printf("%s%s\n", CNF(onion_url), NDESC(domain)); 370 383 exit(0); 371 384 } … … 373 386 // copy onion-URL from command line 374 387 if (!CNF(rand_addr)) 375 strncpy(CNF(onion_url), argv[optind], ONION_NAME_SIZE);388 strncpy(CNF(onion_url), argv[optind], NDESC(name_size)); 376 389 // ...or generate a random one 377 390 else … … 437 450 438 451 if (!CNF(oc_listen)) 439 add_listener(def , def);452 add_listener(def); 440 453 441 454 // start socket receiver thread … … 494 507 run_ocat_thread("controller", ocat_controller, NULL); 495 508 509 #ifdef CONNECT_ROOT_PEERS 496 510 // initiate connections to permanent root peers 497 511 log_debug("connecting root peers"); … … 499 513 if (!IN6_ARE_ADDR_EQUAL(&CNF(root_peer[c]), &CNF(ocat_addr))) 500 514 socks_queue(CNF(root_peer[c]), 1); 515 #endif 501 516 502 517 // reading config file -
trunk/src/ocat.h
r523 r534 102 102 103 103 #define IP6HLEN sizeof(struct ip6_hdr) 104 //! TOR prefix: FD87:D87E:EB43::/48105 #define TOR_PREFIX {{{0xfd,0x87,0xd8,0x7e,0xeb,0x43,0,0,0,0,0,0,0,0,0,0}}}106 #define TOR_PREFIX_LEN 48107 #if BYTE_ORDER == LITTLE_ENDIAN108 #define TOR_PREFIX4 {0x0000000a}109 #define TOR_PREFIX4_MASK 0x000000ff110 #else111 #define TOR_PREFIX4 {0x0a000000}112 #define TOR_PREFIX4_MASK 0xff000000113 #endif114 104 //! Length of an .onion-URL (without ".onion" and '\0') 115 105 #define ONION_URL_LEN 16 116 //! Total length of .onion-URL117 #define ONION_NAME_SIZE (ONION_URL_LEN + 7)118 //! Total length of .onion-URL (equal to ONION_NAME_SIZE)119 #define ONION_NAME_LEN ONION_NAME_SIZE120 106 121 107 #define MAXPEERS 1024 122 //! Local listening port for incoming connections from TOR.123 #define OCAT_LISTEN_PORT 8060124 //! Local control port for querying status information.125 #define OCAT_CTRL_PORT 8066126 //! Virtual destination port for hidden services127 #define OCAT_DEST_PORT 8060128 //! SOCKS port of TOR proxy129 #define TOR_SOCKS_PORT 9050130 108 #ifdef __OpenBSD__ 131 109 #define OCAT_UNAME "_tor" … … 235 213 #define VERSION_STRING_LEN 256 236 214 237 typedef enum PeerType {PT_TOR, PT_I2P} PeerType_t; 215 216 #define NTYPE_TOR 0 217 #define NTYPE_I2P 1 218 238 219 239 220 struct OcatSetup … … 256 237 //! user name to change uid to 257 238 char *usrname; 258 char onion_url[ ONION_NAME_SIZE];239 char onion_url[SIZE_256]; 259 240 struct in6_addr ocat_addr; 260 241 //! flag to create connection log … … 282 263 int use_syslog; 283 264 int daemon; 265 #ifdef CONNECT_ROOT_PEERS 284 266 //! hardcoded permanent peers 285 267 #define ROOT_PEERS 1 286 268 struct in6_addr root_peer[ROOT_PEERS]; 269 #endif 287 270 time_t uptime; 288 271 char *frandn; … … 308 291 //! communication pipe for socks "selected" connector 309 292 int socksfd[2]; 293 int net_type; 310 294 }; 311 295 … … 359 343 unsigned inm; 360 344 unsigned outm; 361 PeerType_t type;362 345 } OcatPeer_t; 363 346 … … 566 549 void print_setup_struct(FILE *); 567 550 void init_setup(void); 551 void post_init_setup(void); 568 552 void lock_setup(void); 569 553 void unlock_setup(void); … … 599 583 int strsockaddr(const char *, struct sockaddr *); 600 584 void add_local_listeners(void); 601 void add_listener(const char * , const char *);585 void add_listener(const char *); 602 586 void delete_listeners(struct sockaddr **, int *, int); 603 587 int fdprintf(int, const char *, va_list); -
trunk/src/ocatctrl.c
r512 r534 25 25 26 26 #include "ocat.h" 27 #include "ocat_netdesc.h" 27 28 28 29 … … 37 38 int fd, c; 38 39 FILE *ff, *fo; 39 char buf[FRAME_SIZE], addrstr[INET6_ADDRSTRLEN], onionstr[ ONION_NAME_SIZE], timestr[32], *s, *tokbuf;40 char buf[FRAME_SIZE], addrstr[INET6_ADDRSTRLEN], onionstr[NDESC(name_size)], timestr[32], *s, *tokbuf; 40 41 int rlen, cfd; 41 42 struct tm *tm; -
trunk/src/ocatlibe.c
r500 r534 138 138 139 139 140 void add_listener(const char *buf, const char *def) 141 { 140 void add_listener(const char *buf) 141 { 142 struct sockaddr_in6 saddr; 143 144 if (strsockaddr(buf, &saddr) == -1) 145 log_msg(LOG_EMERG, "could not convert address string '%s'", buf), exit(1); 146 142 147 CNF(oc_listen_cnt)++; 143 148 log_debug("reallocating sockaddr list to %d elements", CNF(oc_listen_cnt)); … … 147 152 log_msg(LOG_ERR, "could not get memory for listener fds: \"%s\"", strerror(errno)), exit(1); 148 153 149 log_debug("allocating sockaddr mem for \"%s\"", def);154 log_debug("allocating sockaddr mem for \"%s\"", buf); 150 155 if (!(CNF(oc_listen)[CNF(oc_listen_cnt) - 1] = calloc(1, sizeof(struct sockaddr_in6)))) 151 156 log_msg(LOG_ERR, "could not get memory for listener : \"%s\"", strerror(errno)), exit(1); 152 157 153 158 CNF(oc_listen_fd)[CNF(oc_listen_cnt) - 1] = -1; 154 155 if (def) 156 if (strsockaddr(def, CNF(oc_listen)[CNF(oc_listen_cnt) - 1]) == -1) 157 log_msg(LOG_EMERG, "illegal default string '%s'", def), exit(1); 158 159 if (strsockaddr(buf, CNF(oc_listen)[CNF(oc_listen_cnt) - 1]) == -1) 160 log_msg(LOG_EMERG, "could not convert address string '%s'", buf), exit(1); 159 memcpy(CNF(oc_listen)[CNF(oc_listen_cnt) - 1], &saddr, sizeof(saddr)); 161 160 } 162 161 -
trunk/src/ocatsetup.c
r514 r534 25 25 26 26 #include "ocat.h" 27 #include "ocat_netdesc.h" 27 28 28 29 … … 46 47 //TOR_SOCKS_PORT, 47 48 //OCAT_LISTEN_PORT, 48 OCAT_DEST_PORT, OCAT_CTRL_PORT,49 0, 0, 49 50 //! default tunfd is stdin/stdout 50 51 {0, 1}, … … 53 54 OCAT_UNAME, {0}, {{{0}}}, 0, 0, 1, OCAT_DIR, TUN_DEV, 54 55 {'\0'}, // tunname 55 0, TOR_PREFIX4, TOR_PREFIX4_MASK, 56 0, 57 //ADDR4_PREFIX, ADDR4_MASK 58 {0}, 0, 56 59 NULL, 1, 57 60 #ifdef __CYGWIN__ … … 70 73 1, // daemon 71 74 #endif 75 #ifdef CONNECT_ROOT_PEERS 72 76 { 73 77 /* … … 78 82 0xf6, 0x83, 0x64, 0xac, 0x73, 0xf9, 0x61, 0xac, 0x9a, 0x00}}} // initial permanent peer "62bwjldt7fq2zgqa" (dot.cat) 79 83 }, 84 #endif 80 85 0, 81 86 "/dev/urandom", … … 106 111 , 107 112 // socksfd 108 {-1, -1} 113 {-1, -1}, 114 // net_type 115 NTYPE_TOR 109 116 }; 110 117 … … 124 131 //setup_.logf = stderr; 125 132 setup_.uptime = time(NULL); 133 } 134 135 136 void post_init_setup(void) 137 { 138 setup_.ocat_addr4 = NDESC(prefix4); 139 setup_.ocat_addr4_mask = NDESC(addr4_mask); 140 setup_.ocat_dest_port = NDESC(vdest_port); 141 setup_.ocat_ctrl_port = NDESC(ctrl_port); 126 142 127 143 setup_.socks_dst->sin_family = AF_INET; 128 setup_.socks_dst->sin_port = htons( TOR_SOCKS_PORT);144 setup_.socks_dst->sin_port = htons(NDESC(socks_port)); 129 145 setup_.socks_dst->sin_addr.s_addr = htonl(INADDR_LOOPBACK); 130 146 #ifdef HAVE_SIN_LEN 131 147 setup_.socks_dst->sin_len = SOCKADDR_SIZE(setup_.socks_dst); 132 #endif133 134 #ifdef DEBUG135 snprintf(setup_.version, VERSION_STRING_LEN, "%s (c) %s -- compiled %s %s", PACKAGE_STRING, OCAT_AUTHOR, __DATE__, __TIME__);136 #else137 snprintf(setup_.version, VERSION_STRING_LEN, "%s (c) %s", PACKAGE_STRING, OCAT_AUTHOR);138 148 #endif 139 149 … … 152 162 #endif 153 163 164 snprintf(setup_.version, VERSION_STRING_LEN, "%s (c) %s (%s mode)", PACKAGE_STRING, OCAT_AUTHOR, setup_.net_type == NTYPE_TOR ? "OnionCat" : setup_.net_type == NTYPE_I2P ? "GarliCat" : "unknown"); 165 #ifdef DEBUG 166 snprintf(&setup_.version[strlen(setup_.version)], VERSION_STRING_LEN - strlen(setup_.version), " -- compiled %s %s", __DATE__, __TIME__); 167 #endif 154 168 } 155 169 … … 160 174 void print_setup_struct(FILE *f) 161 175 { 162 char *c, ip[SBUF], nm[SBUF], ip6[SBUF], logf[SBUF], hw[SBUF] , rp[SBUF];176 char *c, ip[SBUF], nm[SBUF], ip6[SBUF], logf[SBUF], hw[SBUF]; 163 177 int i, t; 164 178 struct sockaddr_str sas; … … 212 226 "sizeof_setup = %d\n" 213 227 "term_req = %d\n" 228 "net_type = %d (%s)\n" 214 229 , 215 230 IPV4_KEY, ntohl(setup_.fhd_key[IPV4_KEY]), IPV6_KEY, ntohl(setup_.fhd_key[IPV6_KEY]), … … 244 259 (int) strlen(setup_.version), VERSION_STRING_LEN, setup_.version, 245 260 setup_.sizeof_setup, 246 setup_.term_req 261 setup_.term_req, 262 setup_.net_type, setup_.net_type == NTYPE_TOR ? "NTYPE_TOR" : setup_.net_type == NTYPE_I2P ? "NTYPE_I2P" : "unknown" 247 263 ); 248 264 265 #ifdef CONNECT_ROOT_PEERS 249 266 for (i = 0; i < ROOT_PEERS; i++) 250 if (inet_ntop(AF_INET6, &setup_.root_peer[i], rp, SBUF)) 251 fprintf(f, "root_peer[%d] = %s\n", i, rp); 267 if (inet_ntop(AF_INET6, &setup_.root_peer[i], ip6, SBUF)) 268 fprintf(f, "root_peer[%d] = %s\n", i, ip6); 269 #endif 252 270 253 271 if (inet_ntops((struct sockaddr*) setup_.socks_dst, &sas)) -
trunk/src/ocatsocks.c
r508 r534 26 26 27 27 #include "ocat.h" 28 #include "ocat_netdesc.h" 28 29 29 30 … … 31 32 static SocksQueue_t *socks_queue_ = NULL; 32 33 33 #define SOCKS_BUFLEN (sizeof(SocksHdr_t) + ONION_NAME_SIZE+ strlen(CNF(usrname)) + 2)34 #define SOCKS_BUFLEN (sizeof(SocksHdr_t) + NDESC(name_size) + strlen(CNF(usrname)) + 2) 34 35 35 36 … … 37 38 { 38 39 int len, ret; 39 char buf[SOCKS_BUFLEN], onion[ ONION_NAME_SIZE];40 char buf[SOCKS_BUFLEN], onion[NDESC(name_size)]; 40 41 SocksHdr_t *shdr = (SocksHdr_t*) buf; 41 42 42 43 ipv6tonion(&sq->addr, onion); 43 strlcat(onion, ".onion", sizeof(onion));44 strlcat(onion, NDESC(domain), sizeof(onion)); 44 45 log_msg(LOG_INFO, "trying to connect to \"%s\" [%s]", onion, inet_ntop(AF_INET6, &sq->addr, buf, SOCKS_BUFLEN)); 45 46 … … 246 247 { 247 248 int i; 248 char addrstr[INET6_ADDRSTRLEN], onstr[ ONION_NAME_LEN], buf[SIZE_1K];249 char addrstr[INET6_ADDRSTRLEN], onstr[NDESC(name_size)], buf[SIZE_1K]; 249 250 SocksQueue_t *squeue; 250 251 … … 257 258 } 258 259 259 snprintf(buf, SIZE_1K, "%d: %39s, %s .onion, state = %d, %s(%d), retry = %d, connect_time = %d, restart_time = %d",260 snprintf(buf, SIZE_1K, "%d: %39s, %s%s, state = %d, %s(%d), retry = %d, connect_time = %d, restart_time = %d", 260 261 i, 261 262 addrstr, 262 263 ipv6tonion(&squeue->addr, onstr), 264 NDESC(domain), 263 265 squeue->state, 264 266 squeue->perm ? "PERMANENT" : "TEMPORARY", -
trunk/src/ocattun.c
r511 r534 27 27 28 28 #include "ocat.h" 29 #include "ocat_netdesc.h" 29 30 30 31 … … 61 62 log_msg(LOG_ERR, "could not exec \"%s\": \"%s\"", buf, strerror(errno)); 62 63 63 snprintf(buf, sizeof(buf), "netsh interface ipv6 add route %s/%d \"%s\"", astr, TOR_PREFIX_LEN, dev);64 snprintf(buf, sizeof(buf), "netsh interface ipv6 add route %s/%d \"%s\"", astr, NDESC(prefix_len), dev); 64 65 log_debug("setting IP routing: \"%s\"", buf); 65 66 if (system(buf) == -1) … … 92 93 if (!CNF(use_tap)) 93 94 { 94 snprintf(buf, sizeof(buf), "ifconfig %s add %s/%d up", dev, astr, TOR_PREFIX_LEN);95 snprintf(buf, sizeof(buf), "ifconfig %s add %s/%d up", dev, astr, NDESC(prefix_len)); 95 96 log_msg(LOG_INFO, "configuring tun IP: \"%s\"", buf); 96 97 if (system(buf) == -1) … … 169 170 { 170 171 #ifdef __OpenBSD__ 171 snprintf(buf, sizeof(buf), "ifconfig %s inet6 %s prefixlen %d up", dev, astr, TOR_PREFIX_LEN);172 snprintf(buf, sizeof(buf), "ifconfig %s inet6 %s prefixlen %d up", dev, astr, NDESC(prefix_len)); 172 173 #else 173 snprintf(buf, sizeof(buf), "ifconfig %s inet6 %s/%d up", dev, astr, TOR_PREFIX_LEN);174 snprintf(buf, sizeof(buf), "ifconfig %s inet6 %s/%d up", dev, astr, NDESC(prefix_len)); 174 175 #endif 175 176 log_debug("setting IP on tun: \"%s\"", buf); … … 181 182 // MacOSX requires the route to be set up manually 182 183 // FIXME: the prefix shouldn't be hardcoded here 183 snprintf(buf, sizeof(buf), "route add -inet6 -net fd87:d87e:eb43:: -prefixlen %d -gateway %s", TOR_PREFIX_LEN, astr);184 snprintf(buf, sizeof(buf), "route add -inet6 -net fd87:d87e:eb43:: -prefixlen %d -gateway %s", NDESC(prefix_len), astr); 184 185 log_msg(LOG_INFO, "setup routing: \"%s\"", buf); 185 186 if (system(buf) == -1) -
trunk/src/ocatv6conv.c
r500 r534 27 27 28 28 #include "ocat.h" 29 #include "ocat_netdesc.h" 29 30 30 31 static const char BASE32[] = "abcdefghijklmnopqrstuvwxyz234567"; … … 40 41 50 51 52 53 54 55 56 57 58 59 5a */ 41 42 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; 42 static const struct in6_addr tor_prefix_ = TOR_PREFIX;43 43 44 44 45 45 int has_tor_prefix(const struct in6_addr *addr) 46 46 { 47 return memcmp(addr, & tor_prefix_, 6) == 0;47 return memcmp(addr, &NDESC(prefix), 6) == 0; 48 48 } 49 49 … … 51 51 void set_tor_prefix(struct in6_addr *addr) 52 52 { 53 memcpy(addr, & tor_prefix_, 6);53 memcpy(addr, &NDESC(prefix), 6); 54 54 } 55 55
Note: See TracChangeset
for help on using the changeset viewer.
