Changeset 525
- Timestamp:
- 11/13/09 13:11:06 (2 years ago)
- Location:
- branches/garlicat
- Files:
-
- 2 added
- 10 edited
-
configure (modified) (10 diffs)
-
src/Makefile.am (modified) (1 diff)
-
src/Makefile.in (modified) (3 diffs)
-
src/ocat.c (modified) (9 diffs)
-
src/ocat.h (modified) (8 diffs)
-
src/ocat_netdesc.c (added)
-
src/ocat_netdesc.h (added)
-
src/ocatctrl.c (modified) (2 diffs)
-
src/ocatsetup.c (modified) (8 diffs)
-
src/ocatsocks.c (modified) (4 diffs)
-
src/ocattun.c (modified) (5 diffs)
-
src/ocatv6conv.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/garlicat/configure
r514 r525 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.0.r5 14.3 # Generated by GNU Autoconf 2.62 for onioncat 0.2.0.r525. 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.0.r5 14'600 PACKAGE_STRING='onioncat 0.2.0.r5 14'599 PACKAGE_VERSION='0.2.0.r525' 600 PACKAGE_STRING='onioncat 0.2.0.r525' 601 601 PACKAGE_BUGREPORT='rahra@cypherpunk.at' 602 602 … … 1260 1260 # This message is too long to be a string in the A/UX 3.1 sh. 1261 1261 cat <<_ACEOF 1262 \`configure' configures onioncat 0.2.0.r5 14to adapt to many kinds of systems.1262 \`configure' configures onioncat 0.2.0.r525 to adapt to many kinds of systems. 1263 1263 1264 1264 Usage: $0 [OPTION]... [VAR=VALUE]... … … 1330 1330 if test -n "$ac_init_help"; then 1331 1331 case $ac_init_help in 1332 short | recursive ) echo "Configuration of onioncat 0.2.0.r5 14:";;1332 short | recursive ) echo "Configuration of onioncat 0.2.0.r525:";; 1333 1333 esac 1334 1334 cat <<\_ACEOF … … 1422 1422 if $ac_init_version; then 1423 1423 cat <<\_ACEOF 1424 onioncat configure 0.2.0.r5 141424 onioncat configure 0.2.0.r525 1425 1425 generated by GNU Autoconf 2.62 1426 1426 … … 1436 1436 running configure, to aid debugging if configure makes a mistake. 1437 1437 1438 It was created by onioncat $as_me 0.2.0.r5 14, which was1438 It was created by onioncat $as_me 0.2.0.r525, which was 1439 1439 generated by GNU Autoconf 2.62. Invocation command line was 1440 1440 … … 2085 2085 # Define the identity of the package. 2086 2086 PACKAGE='onioncat' 2087 VERSION='0.2.0.r5 14'2087 VERSION='0.2.0.r525' 2088 2088 2089 2089 … … 2236 2236 2237 2237 cat >>confdefs.h <<\_ACEOF 2238 #define SVN_REVISION "5 14"2238 #define SVN_REVISION "525" 2239 2239 _ACEOF 2240 2240 … … 5209 5209 # values after options handling. 5210 5210 ac_log=" 5211 This file was extended by onioncat $as_me 0.2.0.r5 14, which was5211 This file was extended by onioncat $as_me 0.2.0.r525, which was 5212 5212 generated by GNU Autoconf 2.62. Invocation command line was 5213 5213 … … 5262 5262 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 5263 5263 ac_cs_version="\\ 5264 onioncat config.status 0.2.0.r5 145264 onioncat config.status 0.2.0.r525 5265 5265 configured by $0, generated by GNU Autoconf 2.62, 5266 5266 with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -
branches/garlicat/src/Makefile.am
r486 r525 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 -
branches/garlicat/src/Makefile.in
r508 r525 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) … … 168 169 sysconfdir = @sysconfdir@ 169 170 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.c171 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 172 include_HEADERS = ocat.h ocat_netdesc.h strlcpy.c strlcat.c 172 173 all: all-am 173 174 … … 237 238 238 239 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocat.Po@am__quote@ 240 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocat_netdesc.Po@am__quote@ 239 241 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocat_wintuntap.Po@am__quote@ 240 242 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocatcompat.Po@am__quote@ -
branches/garlicat/src/ocat.c
r523 r525 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);241 snprintf(def, 100, "127.0.0.1:%d", NDESC(listen_port)); 240 242 241 243 init_setup(); … … 244 246 usage(argv[0]), exit(1); 245 247 246 while ((c = getopt(argc, argv, "abBCd:f:hrRi opl:t:T:s:u:4L:P:")) != -1)248 while ((c = getopt(argc, argv, "abBCd:f:hrRiIopl:t:T:s:u:4L:P:")) != -1) 247 249 switch (c) 248 250 { … … 274 276 case 'i': 275 277 urlconv = 1; 278 break; 279 280 case 'I': 281 CNF(net_type) = NTYPE_I2P; 276 282 break; 277 283 … … 340 346 exit(1); 341 347 } 348 349 // detect network type by command file name 350 // FIXME: this should be not hardcoded in that way 351 if (!strcmp(argv[0], "gcat") || !strcmp(argv[0], "garlicat")) 352 CNF(net_type) = NTYPE_I2P; 353 354 post_init_setup(); 342 355 343 356 if (!CNF(rand_addr) && !argv[optind]) … … 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 … … 401 414 402 415 log_msg(LOG_INFO, "%s", CNF(version)); 416 log_msg(LOG_INFO, "OC is running in %s mode", CNF(net_type) == NTYPE_I2P ? "GarliCat (I2P)" : "OnionCat (Tor)"); 403 417 404 418 #if 0 -
branches/garlicat/src/ocat.h
r523 r525 102 102 103 103 #define IP6HLEN sizeof(struct ip6_hdr) 104 / /! TOR prefix: FD87:D87E:EB43::/48104 /*//! TOR prefix: FD87:D87E:EB43::/48 105 105 #define TOR_PREFIX {{{0xfd,0x87,0xd8,0x7e,0xeb,0x43,0,0,0,0,0,0,0,0,0,0}}} 106 106 #define TOR_PREFIX_LEN 48 … … 111 111 #define TOR_PREFIX4 {0x0a000000} 112 112 #define TOR_PREFIX4_MASK 0xff000000 113 #endif 113 #endif*/ 114 114 //! Length of an .onion-URL (without ".onion" and '\0') 115 115 #define ONION_URL_LEN 16 116 / /! Total length of .onion-URL116 /*//! Total length of .onion-URL 117 117 #define ONION_NAME_SIZE (ONION_URL_LEN + 7) 118 118 //! Total length of .onion-URL (equal to ONION_NAME_SIZE) 119 #define ONION_NAME_LEN ONION_NAME_SIZE 119 #define ONION_NAME_LEN ONION_NAME_SIZE*/ 120 120 121 121 #define MAXPEERS 1024 122 / /! Local listening port for incoming connections from TOR.122 /*//! Local listening port for incoming connections from TOR. 123 123 #define OCAT_LISTEN_PORT 8060 124 124 //! Local control port for querying status information. … … 127 127 #define OCAT_DEST_PORT 8060 128 128 //! SOCKS port of TOR proxy 129 #define TOR_SOCKS_PORT 9050 129 #define TOR_SOCKS_PORT 9050*/ 130 130 #ifdef __OpenBSD__ 131 131 #define OCAT_UNAME "_tor" … … 235 235 #define VERSION_STRING_LEN 256 236 236 237 typedef enum PeerType {PT_TOR, PT_I2P} PeerType_t; 237 238 #define NTYPE_TOR 0 239 #define NTYPE_I2P 1 240 238 241 239 242 struct OcatSetup … … 256 259 //! user name to change uid to 257 260 char *usrname; 258 char onion_url[ ONION_NAME_SIZE];261 char onion_url[SIZE_256]; 259 262 struct in6_addr ocat_addr; 260 263 //! flag to create connection log … … 308 311 //! communication pipe for socks "selected" connector 309 312 int socksfd[2]; 313 int net_type; 310 314 }; 311 315 … … 359 363 unsigned inm; 360 364 unsigned outm; 361 PeerType_t type;362 365 } OcatPeer_t; 363 366 … … 566 569 void print_setup_struct(FILE *); 567 570 void init_setup(void); 571 void post_init_setup(void); 568 572 void lock_setup(void); 569 573 void unlock_setup(void); -
branches/garlicat/src/ocatctrl.c
r512 r525 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; -
branches/garlicat/src/ocatsetup.c
r514 r525 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__ … … 106 109 , 107 110 // socksfd 108 {-1, -1} 111 {-1, -1}, 112 // net_type 113 NTYPE_TOR 109 114 }; 110 115 … … 137 142 snprintf(setup_.version, VERSION_STRING_LEN, "%s (c) %s", PACKAGE_STRING, OCAT_AUTHOR); 138 143 #endif 144 } 145 146 147 void post_init_setup(void) 148 { 149 setup_.ocat_addr4 = NDESC(prefix4); 150 setup_.ocat_addr4_mask = NDESC(addr4_mask); 151 setup_.ocat_dest_port = NDESC(vdest_port); 152 setup_.ocat_ctrl_port = NDESC(ctrl_port); 139 153 140 154 ctrl_listen_.sin_family = AF_INET; … … 151 165 ctrl_listen6_.sin6_len = sizeof(ctrl_listen6_); 152 166 #endif 153 154 167 } 155 168 … … 212 225 "sizeof_setup = %d\n" 213 226 "term_req = %d\n" 227 "net_type = %d (%s)\n" 214 228 , 215 229 IPV4_KEY, ntohl(setup_.fhd_key[IPV4_KEY]), IPV6_KEY, ntohl(setup_.fhd_key[IPV6_KEY]), … … 244 258 (int) strlen(setup_.version), VERSION_STRING_LEN, setup_.version, 245 259 setup_.sizeof_setup, 246 setup_.term_req 260 setup_.term_req, 261 setup_.net_type, setup_.net_type == NTYPE_TOR ? "NTYPE_TOR" : setup_.net_type == NTYPE_I2P ? "NTYPE_I2P" : "unknown" 247 262 ); 248 263 -
branches/garlicat/src/ocatsocks.c
r508 r525 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 … … 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 -
branches/garlicat/src/ocattun.c
r511 r525 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) -
branches/garlicat/src/ocatv6conv.c
r500 r525 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.
