Changeset 547
- Timestamp:
- 04/26/10 13:29:15 (22 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 18 edited
-
ChangeLog (modified) (1 diff)
-
TODO (modified) (1 diff)
-
config.h.in (modified) (7 diffs)
-
configure (modified) (22 diffs)
-
configure.ac (modified) (3 diffs)
-
src/Makefile.am (modified) (1 diff)
-
src/Makefile.in (modified) (3 diffs)
-
src/ocat.c (modified) (6 diffs)
-
src/ocat.h (modified) (7 diffs)
-
src/ocat_netdesc.h (modified) (1 diff)
-
src/ocatcompat.c (modified) (1 diff)
-
src/ocateth.c (modified) (7 diffs)
-
src/ocatfdbuf.c (modified) (1 diff)
-
src/ocathosts.c (added)
-
src/ocathosts.h (added)
-
src/ocatroute.c (modified) (8 diffs)
-
src/ocatsetup.c (modified) (12 diffs)
-
src/ocatsocks.c (modified) (2 diffs)
-
src/ocattun.c (modified) (10 diffs)
-
src/ocatv6conv.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r540 r547 1 1 * version 0.2.2 2 - configure.ac refined 3 - OC now compiles and runs on Solaris 10 using the Universal TUN/TAP driver 4 version 1.1 (http://vtun.sourceforge.net/tun/index.html) 5 - ocathosts.[ch] added. It reads IPv6 addresses from /etc/hosts 6 - /etc/hosts reverse lookup for I2P .b32 names added 2 7 - debian directory included into source package. 3 8 - freebsd directory included into source package. -
trunk/TODO
r506 r547 1 * Solaris: tunnel device should be unplumbed on program exit 2 * Solaris TAP device untestet 1 3 * OpenBSD TAP device might not work (see OpenBSD man page tun(4)) 2 4 * finish SOCKS5 code for I2P -
trunk/config.h.in
r546 r547 13 13 #undef HAVE_ENDIAN_H 14 14 15 /* Do we have ether_header.ether_dhost.ether_addr_octet */ 16 #undef HAVE_ETHER_ADDR_OCTET 17 15 18 /* Define to 1 if you have the `ether_ntoa' function. */ 16 19 #undef HAVE_ETHER_NTOA … … 19 22 #undef HAVE_ETHER_NTOA_R 20 23 24 /* Define to 1 if you have the <fcntl.h> header file. */ 25 #undef HAVE_FCNTL_H 26 21 27 /* Define to 1 if you have the <linux/if_tun.h> header file. */ 22 28 #undef HAVE_LINUX_IF_TUN_H … … 24 30 /* Define to 1 if you have the <linux/sockios.h> header file. */ 25 31 #undef HAVE_LINUX_SOCKIOS_H 32 33 /* Define to 1 if you have the <netdb.h> header file. */ 34 #undef HAVE_NETDB_H 26 35 27 36 /* Define to 1 if you have the <netinet/ether.h> header file. */ … … 64 73 #undef HAVE_SIN_LEN 65 74 75 /* Do we have stat.st_mtim? */ 76 #undef HAVE_STAT_ST_MTIM 77 78 /* Do we have stat.st_mtimespec? */ 79 #undef HAVE_STAT_ST_MTIMESPEC 80 66 81 /* Define to 1 if you have the `strlcat' function. */ 67 82 #undef HAVE_STRLCAT … … 82 97 #undef HAVE_SYS_ENDIAN_H 83 98 99 /* Define to 1 if you have the <sys/ethernet.h> header file. */ 100 #undef HAVE_SYS_ETHERNET_H 101 84 102 /* Define to 1 if you have the <sys/socket.h> header file. */ 85 103 #undef HAVE_SYS_SOCKET_H 104 105 /* Define to 1 if you have the <sys/stat.h> header file. */ 106 #undef HAVE_SYS_STAT_H 86 107 87 108 /* Define to 1 if you have the <sys/types.h> header file. */ … … 90 111 /* Define to 1 if you have the <sys/wait.h> header file. */ 91 112 #undef HAVE_SYS_WAIT_H 113 114 /* Define to 1 if you have the <time.h> header file. */ 115 #undef HAVE_TIME_H 92 116 93 117 /* enable RTT measurement */ … … 128 152 #undef VERSION 129 153 154 /* exclude tunnel device code */ 155 #undef WITHOUT_TUN 156 130 157 /* Define to empty if `const' does not conform to ANSI C. */ 131 158 #undef const -
trunk/configure
r546 r547 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.r54 6.3 # Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r547. 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.r54 6'600 PACKAGE_STRING='onioncat 0.2.2.r54 6'599 PACKAGE_VERSION='0.2.2.r547' 600 PACKAGE_STRING='onioncat 0.2.2.r547' 601 601 PACKAGE_BUGREPORT='rahra@cypherpunk.at' 602 602 … … 700 700 enable_check_ipsrc 701 701 enable_rtt 702 enable_tundev 702 703 enable_dependency_tracking 703 704 ' … … 1262 1263 # This message is too long to be a string in the A/UX 3.1 sh. 1263 1264 cat <<_ACEOF 1264 \`configure' configures onioncat 0.2.2.r54 6to adapt to many kinds of systems.1265 \`configure' configures onioncat 0.2.2.r547 to adapt to many kinds of systems. 1265 1266 1266 1267 Usage: $0 [OPTION]... [VAR=VALUE]... … … 1332 1333 if test -n "$ac_init_help"; then 1333 1334 case $ac_init_help in 1334 short | recursive ) echo "Configuration of onioncat 0.2.2.r54 6:";;1335 short | recursive ) echo "Configuration of onioncat 0.2.2.r547:";; 1335 1336 esac 1336 1337 cat <<\_ACEOF … … 1346 1347 --disable-check-ipsrc disable source ip checking before forwarding 1347 1348 --enable-rtt enable inband RTT measurement 1349 --disable-tundev compile without tunnel device code 1348 1350 --disable-dependency-tracking speeds up one-time build 1349 1351 --enable-dependency-tracking do not reject slow dependency extractors … … 1424 1426 if $ac_init_version; then 1425 1427 cat <<\_ACEOF 1426 onioncat configure 0.2.2.r54 61428 onioncat configure 0.2.2.r547 1427 1429 generated by GNU Autoconf 2.62 1428 1430 … … 1438 1440 running configure, to aid debugging if configure makes a mistake. 1439 1441 1440 It was created by onioncat $as_me 0.2.2.r54 6, which was1442 It was created by onioncat $as_me 0.2.2.r547, which was 1441 1443 generated by GNU Autoconf 2.62. Invocation command line was 1442 1444 … … 2087 2089 # Define the identity of the package. 2088 2090 PACKAGE='onioncat' 2089 VERSION='0.2.2.r54 6'2091 VERSION='0.2.2.r547' 2090 2092 2091 2093 … … 2238 2240 2239 2241 cat >>confdefs.h <<\_ACEOF 2240 #define SVN_REVISION "546" 2241 _ACEOF 2242 2243 2244 CFLAGS="-Wall -O2" 2242 #define SVN_REVISION "547" 2243 _ACEOF 2244 2245 2245 2246 2246 … … 2249 2249 enableval=$enable_debug; 2250 2250 cat >>confdefs.h <<\_ACEOF 2251 #define DEBUG /**/ 2252 _ACEOF 2253 2254 fi 2251 #define DEBUG 1 2252 _ACEOF 2253 2254 2255 fi 2256 2255 2257 2256 2258 # Check whether --enable-packet-log was given. … … 2263 2265 fi 2264 2266 2267 2265 2268 # Check whether --enable-handle-http was given. 2266 2269 if test "${enable_handle_http+set}" = set; then … … 2272 2275 fi 2273 2276 2277 2274 2278 # Check whether --enable-packet-queue was given. 2275 2279 if test "${enable_packet_queue+set}" = set; then … … 2281 2285 fi 2282 2286 2287 2283 2288 # Check whether --enable-check-ipsrc was given. 2284 2289 if test "${enable_check_ipsrc+set}" = set; then 2285 2290 enableval=$enable_check_ipsrc; 2286 2291 cat >>confdefs.h <<\_ACEOF 2287 #define CHECK_IPSRC /**/ 2288 _ACEOF 2289 2290 fi 2292 #define CHECK_IPSRC 1 2293 _ACEOF 2294 2295 fi 2296 2291 2297 2292 2298 # Check whether --enable-rtt was given. … … 2294 2300 enableval=$enable_rtt; 2295 2301 cat >>confdefs.h <<\_ACEOF 2296 #define MEASURE_RTT /**/ 2297 _ACEOF 2298 2299 fi 2300 2302 #define MEASURE_RTT 1 2303 _ACEOF 2304 2305 fi 2306 2307 2308 # Check whether --enable-tundev was given. 2309 if test "${enable_tundev+set}" = set; then 2310 enableval=$enable_tundev; 2311 cat >>confdefs.h <<\_ACEOF 2312 #define WITHOUT_TUN 1 2313 _ACEOF 2314 2315 fi 2316 2317 2318 2319 if test "${enable_debug+set}" = set ; then 2320 CFLAGS="-Wall -g -D_POSIX_PTHREAD_SEMANTICS" 2321 2322 else 2323 CFLAGS="-Wall -O2 -D_POSIX_PTHREAD_SEMANTICS" 2324 2325 fi 2301 2326 2302 2327 # Checks for programs. … … 4100 4125 #AC_CHECK_LIB([readline], [main]) 4101 4126 4127 { $as_echo "$as_me:$LINENO: checking for library containing bind" >&5 4128 $as_echo_n "checking for library containing bind... " >&6; } 4129 if test "${ac_cv_search_bind+set}" = set; then 4130 $as_echo_n "(cached) " >&6 4131 else 4132 ac_func_search_save_LIBS=$LIBS 4133 cat >conftest.$ac_ext <<_ACEOF 4134 /* confdefs.h. */ 4135 _ACEOF 4136 cat confdefs.h >>conftest.$ac_ext 4137 cat >>conftest.$ac_ext <<_ACEOF 4138 /* end confdefs.h. */ 4139 4140 /* Override any GCC internal prototype to avoid an error. 4141 Use char because int might match the return type of a GCC 4142 builtin and then its argument prototype would still apply. */ 4143 #ifdef __cplusplus 4144 extern "C" 4145 #endif 4146 char bind (); 4147 int 4148 main () 4149 { 4150 return bind (); 4151 ; 4152 return 0; 4153 } 4154 _ACEOF 4155 for ac_lib in '' socket; do 4156 if test -z "$ac_lib"; then 4157 ac_res="none required" 4158 else 4159 ac_res=-l$ac_lib 4160 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 4161 fi 4162 rm -f conftest.$ac_objext conftest$ac_exeext 4163 if { (ac_try="$ac_link" 4164 case "(($ac_try" in 4165 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 4166 *) ac_try_echo=$ac_try;; 4167 esac 4168 eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" 4169 $as_echo "$ac_try_echo") >&5 4170 (eval "$ac_link") 2>conftest.er1 4171 ac_status=$? 4172 grep -v '^ *+' conftest.er1 >conftest.err 4173 rm -f conftest.er1 4174 cat conftest.err >&5 4175 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 4176 (exit $ac_status); } && { 4177 test -z "$ac_c_werror_flag" || 4178 test ! -s conftest.err 4179 } && test -s conftest$ac_exeext && { 4180 test "$cross_compiling" = yes || 4181 $as_test_x conftest$ac_exeext 4182 }; then 4183 ac_cv_search_bind=$ac_res 4184 else 4185 $as_echo "$as_me: failed program was:" >&5 4186 sed 's/^/| /' conftest.$ac_ext >&5 4187 4188 4189 fi 4190 4191 rm -rf conftest.dSYM 4192 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 4193 conftest$ac_exeext 4194 if test "${ac_cv_search_bind+set}" = set; then 4195 break 4196 fi 4197 done 4198 if test "${ac_cv_search_bind+set}" = set; then 4199 : 4200 else 4201 ac_cv_search_bind=no 4202 fi 4203 rm conftest.$ac_ext 4204 LIBS=$ac_func_search_save_LIBS 4205 fi 4206 { $as_echo "$as_me:$LINENO: result: $ac_cv_search_bind" >&5 4207 $as_echo "$ac_cv_search_bind" >&6; } 4208 ac_res=$ac_cv_search_bind 4209 if test "$ac_res" != no; then 4210 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 4211 4212 fi 4213 4214 { $as_echo "$as_me:$LINENO: checking for library containing inet_ntop" >&5 4215 $as_echo_n "checking for library containing inet_ntop... " >&6; } 4216 if test "${ac_cv_search_inet_ntop+set}" = set; then 4217 $as_echo_n "(cached) " >&6 4218 else 4219 ac_func_search_save_LIBS=$LIBS 4220 cat >conftest.$ac_ext <<_ACEOF 4221 /* confdefs.h. */ 4222 _ACEOF 4223 cat confdefs.h >>conftest.$ac_ext 4224 cat >>conftest.$ac_ext <<_ACEOF 4225 /* end confdefs.h. */ 4226 4227 /* Override any GCC internal prototype to avoid an error. 4228 Use char because int might match the return type of a GCC 4229 builtin and then its argument prototype would still apply. */ 4230 #ifdef __cplusplus 4231 extern "C" 4232 #endif 4233 char inet_ntop (); 4234 int 4235 main () 4236 { 4237 return inet_ntop (); 4238 ; 4239 return 0; 4240 } 4241 _ACEOF 4242 for ac_lib in '' nsl; do 4243 if test -z "$ac_lib"; then 4244 ac_res="none required" 4245 else 4246 ac_res=-l$ac_lib 4247 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 4248 fi 4249 rm -f conftest.$ac_objext conftest$ac_exeext 4250 if { (ac_try="$ac_link" 4251 case "(($ac_try" in 4252 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 4253 *) ac_try_echo=$ac_try;; 4254 esac 4255 eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" 4256 $as_echo "$ac_try_echo") >&5 4257 (eval "$ac_link") 2>conftest.er1 4258 ac_status=$? 4259 grep -v '^ *+' conftest.er1 >conftest.err 4260 rm -f conftest.er1 4261 cat conftest.err >&5 4262 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 4263 (exit $ac_status); } && { 4264 test -z "$ac_c_werror_flag" || 4265 test ! -s conftest.err 4266 } && test -s conftest$ac_exeext && { 4267 test "$cross_compiling" = yes || 4268 $as_test_x conftest$ac_exeext 4269 }; then 4270 ac_cv_search_inet_ntop=$ac_res 4271 else 4272 $as_echo "$as_me: failed program was:" >&5 4273 sed 's/^/| /' conftest.$ac_ext >&5 4274 4275 4276 fi 4277 4278 rm -rf conftest.dSYM 4279 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 4280 conftest$ac_exeext 4281 if test "${ac_cv_search_inet_ntop+set}" = set; then 4282 break 4283 fi 4284 done 4285 if test "${ac_cv_search_inet_ntop+set}" = set; then 4286 : 4287 else 4288 ac_cv_search_inet_ntop=no 4289 fi 4290 rm conftest.$ac_ext 4291 LIBS=$ac_func_search_save_LIBS 4292 fi 4293 { $as_echo "$as_me:$LINENO: result: $ac_cv_search_inet_ntop" >&5 4294 $as_echo "$ac_cv_search_inet_ntop" >&6; } 4295 ac_res=$ac_cv_search_inet_ntop 4296 if test "$ac_res" != no; then 4297 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 4298 4299 fi 4300 4301 4102 4302 # Checks for header files. 4103 4303 #AC_HEADER_STDC … … 4120 4320 4121 4321 4122 for ac_header in sys/types.h sys/wait.h sys/socket.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 4322 4323 4324 4325 4326 4327 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 4123 4328 do 4124 4329 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` … … 4717 4922 /* end confdefs.h. */ 4718 4923 4924 #ifdef HAVE_SYS_TYPES_H 4719 4925 #include <sys/types.h> 4926 #endif 4927 #ifdef HAVE_SYS_SOCKET_H 4720 4928 #include <sys/socket.h> 4929 #endif 4721 4930 #ifdef HAVE_NETINET_IN_H 4722 4931 #include <netinet/in.h> … … 4764 4973 /* end confdefs.h. */ 4765 4974 4975 #ifdef HAVE_SYS_TYPES_H 4766 4976 #include <sys/types.h> 4977 #endif 4978 #ifdef HAVE_SYS_SOCKET_H 4767 4979 #include <sys/socket.h> 4980 #endif 4768 4981 #ifdef HAVE_NETINET_IN_H 4769 4982 #include <netinet/in.h> … … 4818 5031 cat >>confdefs.h <<\_ACEOF 4819 5032 #define HAVE_SIN_LEN 1 5033 _ACEOF 5034 5035 fi 5036 5037 5038 { $as_echo "$as_me:$LINENO: checking for struct stat.st_mtim" >&5 5039 $as_echo_n "checking for struct stat.st_mtim... " >&6; } 5040 if test "${ac_cv_member_struct_stat_st_mtim+set}" = set; then 5041 $as_echo_n "(cached) " >&6 5042 else 5043 cat >conftest.$ac_ext <<_ACEOF 5044 /* confdefs.h. */ 5045 _ACEOF 5046 cat confdefs.h >>conftest.$ac_ext 5047 cat >>conftest.$ac_ext <<_ACEOF 5048 /* end confdefs.h. */ 5049 5050 #ifdef HAVE_SYS_TYPES_H 5051 #include <sys/types.h> 5052 #endif 5053 #ifdef HAVE_SYS_STAT_H 5054 #include <sys/stat.h> 5055 #endif 5056 5057 5058 int 5059 main () 5060 { 5061 static struct stat ac_aggr; 5062 if (ac_aggr.st_mtim) 5063 return 0; 5064 ; 5065 return 0; 5066 } 5067 _ACEOF 5068 rm -f conftest.$ac_objext 5069 if { (ac_try="$ac_compile" 5070 case "(($ac_try" in 5071 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 5072 *) ac_try_echo=$ac_try;; 5073 esac 5074 eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" 5075 $as_echo "$ac_try_echo") >&5 5076 (eval "$ac_compile") 2>conftest.er1 5077 ac_status=$? 5078 grep -v '^ *+' conftest.er1 >conftest.err 5079 rm -f conftest.er1 5080 cat conftest.err >&5 5081 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 5082 (exit $ac_status); } && { 5083 test -z "$ac_c_werror_flag" || 5084 test ! -s conftest.err 5085 } && test -s conftest.$ac_objext; then 5086 ac_cv_member_struct_stat_st_mtim=yes 5087 else 5088 $as_echo "$as_me: failed program was:" >&5 5089 sed 's/^/| /' conftest.$ac_ext >&5 5090 5091 cat >conftest.$ac_ext <<_ACEOF 5092 /* confdefs.h. */ 5093 _ACEOF 5094 cat confdefs.h >>conftest.$ac_ext 5095 cat >>conftest.$ac_ext <<_ACEOF 5096 /* end confdefs.h. */ 5097 5098 #ifdef HAVE_SYS_TYPES_H 5099 #include <sys/types.h> 5100 #endif 5101 #ifdef HAVE_SYS_STAT_H 5102 #include <sys/stat.h> 5103 #endif 5104 5105 5106 int 5107 main () 5108 { 5109 static struct stat ac_aggr; 5110 if (sizeof ac_aggr.st_mtim) 5111 return 0; 5112 ; 5113 return 0; 5114 } 5115 _ACEOF 5116 rm -f conftest.$ac_objext 5117 if { (ac_try="$ac_compile" 5118 case "(($ac_try" in 5119 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 5120 *) ac_try_echo=$ac_try;; 5121 esac 5122 eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" 5123 $as_echo "$ac_try_echo") >&5 5124 (eval "$ac_compile") 2>conftest.er1 5125 ac_status=$? 5126 grep -v '^ *+' conftest.er1 >conftest.err 5127 rm -f conftest.er1 5128 cat conftest.err >&5 5129 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 5130 (exit $ac_status); } && { 5131 test -z "$ac_c_werror_flag" || 5132 test ! -s conftest.err 5133 } && test -s conftest.$ac_objext; then 5134 ac_cv_member_struct_stat_st_mtim=yes 5135 else 5136 $as_echo "$as_me: failed program was:" >&5 5137 sed 's/^/| /' conftest.$ac_ext >&5 5138 5139 ac_cv_member_struct_stat_st_mtim=no 5140 fi 5141 5142 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5143 fi 5144 5145 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5146 fi 5147 { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_mtim" >&5 5148 $as_echo "$ac_cv_member_struct_stat_st_mtim" >&6; } 5149 if test $ac_cv_member_struct_stat_st_mtim = yes; then 5150 5151 cat >>confdefs.h <<\_ACEOF 5152 #define HAVE_STAT_ST_MTIM 1 5153 _ACEOF 5154 5155 else 5156 5157 { $as_echo "$as_me:$LINENO: checking for struct stat.st_mtimespec" >&5 5158 $as_echo_n "checking for struct stat.st_mtimespec... " >&6; } 5159 if test "${ac_cv_member_struct_stat_st_mtimespec+set}" = set; then 5160 $as_echo_n "(cached) " >&6 5161 else 5162 cat >conftest.$ac_ext <<_ACEOF 5163 /* confdefs.h. */ 5164 _ACEOF 5165 cat confdefs.h >>conftest.$ac_ext 5166 cat >>conftest.$ac_ext <<_ACEOF 5167 /* end confdefs.h. */ 5168 5169 #ifdef HAVE_SYS_TYPES_H 5170 #include <sys/types.h> 5171 #endif 5172 #ifdef HAVE_SYS_STAT_H 5173 #include <sys/stat.h> 5174 #endif 5175 5176 5177 int 5178 main () 5179 { 5180 static struct stat ac_aggr; 5181 if (ac_aggr.st_mtimespec) 5182 return 0; 5183 ; 5184 return 0; 5185 } 5186 _ACEOF 5187 rm -f conftest.$ac_objext 5188 if { (ac_try="$ac_compile" 5189 case "(($ac_try" in 5190 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 5191 *) ac_try_echo=$ac_try;; 5192 esac 5193 eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" 5194 $as_echo "$ac_try_echo") >&5 5195 (eval "$ac_compile") 2>conftest.er1 5196 ac_status=$? 5197 grep -v '^ *+' conftest.er1 >conftest.err 5198 rm -f conftest.er1 5199 cat conftest.err >&5 5200 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 5201 (exit $ac_status); } && { 5202 test -z "$ac_c_werror_flag" || 5203 test ! -s conftest.err 5204 } && test -s conftest.$ac_objext; then 5205 ac_cv_member_struct_stat_st_mtimespec=yes 5206 else 5207 $as_echo "$as_me: failed program was:" >&5 5208 sed 's/^/| /' conftest.$ac_ext >&5 5209 5210 cat >conftest.$ac_ext <<_ACEOF 5211 /* confdefs.h. */ 5212 _ACEOF 5213 cat confdefs.h >>conftest.$ac_ext 5214 cat >>conftest.$ac_ext <<_ACEOF 5215 /* end confdefs.h. */ 5216 5217 #ifdef HAVE_SYS_TYPES_H 5218 #include <sys/types.h> 5219 #endif 5220 #ifdef HAVE_SYS_STAT_H 5221 #include <sys/stat.h> 5222 #endif 5223 5224 5225 int 5226 main () 5227 { 5228 static struct stat ac_aggr; 5229 if (sizeof ac_aggr.st_mtimespec) 5230 return 0; 5231 ; 5232 return 0; 5233 } 5234 _ACEOF 5235 rm -f conftest.$ac_objext 5236 if { (ac_try="$ac_compile" 5237 case "(($ac_try" in 5238 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 5239 *) ac_try_echo=$ac_try;; 5240 esac 5241 eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" 5242 $as_echo "$ac_try_echo") >&5 5243 (eval "$ac_compile") 2>conftest.er1 5244 ac_status=$? 5245 grep -v '^ *+' conftest.er1 >conftest.err 5246 rm -f conftest.er1 5247 cat conftest.err >&5 5248 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 5249 (exit $ac_status); } && { 5250 test -z "$ac_c_werror_flag" || 5251 test ! -s conftest.err 5252 } && test -s conftest.$ac_objext; then 5253 ac_cv_member_struct_stat_st_mtimespec=yes 5254 else 5255 $as_echo "$as_me: failed program was:" >&5 5256 sed 's/^/| /' conftest.$ac_ext >&5 5257 5258 ac_cv_member_struct_stat_st_mtimespec=no 5259 fi 5260 5261 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5262 fi 5263 5264 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5265 fi 5266 { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_mtimespec" >&5 5267 $as_echo "$ac_cv_member_struct_stat_st_mtimespec" >&6; } 5268 if test $ac_cv_member_struct_stat_st_mtimespec = yes; then 5269 5270 cat >>confdefs.h <<\_ACEOF 5271 #define HAVE_STAT_ST_MTIMESPEC 1 5272 _ACEOF 5273 5274 fi 5275 5276 5277 fi 5278 5279 5280 { $as_echo "$as_me:$LINENO: checking for struct ether_header.ether_dhost.ether_addr_octet" >&5 5281 $as_echo_n "checking for struct ether_header.ether_dhost.ether_addr_octet... " >&6; } 5282 if test "${ac_cv_member_struct_ether_header_ether_dhost_ether_addr_octet+set}" = set; then 5283 $as_echo_n "(cached) " >&6 5284 else 5285 cat >conftest.$ac_ext <<_ACEOF 5286 /* confdefs.h. */ 5287 _ACEOF 5288 cat confdefs.h >>conftest.$ac_ext 5289 cat >>conftest.$ac_ext <<_ACEOF 5290 /* end confdefs.h. */ 5291 5292 #ifdef HAVE_SYS_TYPES_H 5293 #include <sys/types.h> 5294 #endif 5295 #ifdef HAVE_SYS_ETHERNET_H 5296 #include <sys/ethernet.h> 5297 #endif 5298 5299 5300 int 5301 main () 5302 { 5303 static struct ether_header ac_aggr; 5304 if (ac_aggr.ether_dhost.ether_addr_octet) 5305 return 0; 5306 ; 5307 return 0; 5308 } 5309 _ACEOF 5310 rm -f conftest.$ac_objext 5311 if { (ac_try="$ac_compile" 5312 case "(($ac_try" in 5313 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 5314 *) ac_try_echo=$ac_try;; 5315 esac 5316 eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" 5317 $as_echo "$ac_try_echo") >&5 5318 (eval "$ac_compile") 2>conftest.er1 5319 ac_status=$? 5320 grep -v '^ *+' conftest.er1 >conftest.err 5321 rm -f conftest.er1 5322 cat conftest.err >&5 5323 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 5324 (exit $ac_status); } && { 5325 test -z "$ac_c_werror_flag" || 5326 test ! -s conftest.err 5327 } && test -s conftest.$ac_objext; then 5328 ac_cv_member_struct_ether_header_ether_dhost_ether_addr_octet=yes 5329 else 5330 $as_echo "$as_me: failed program was:" >&5 5331 sed 's/^/| /' conftest.$ac_ext >&5 5332 5333 cat >conftest.$ac_ext <<_ACEOF 5334 /* confdefs.h. */ 5335 _ACEOF 5336 cat confdefs.h >>conftest.$ac_ext 5337 cat >>conftest.$ac_ext <<_ACEOF 5338 /* end confdefs.h. */ 5339 5340 #ifdef HAVE_SYS_TYPES_H 5341 #include <sys/types.h> 5342 #endif 5343 #ifdef HAVE_SYS_ETHERNET_H 5344 #include <sys/ethernet.h> 5345 #endif 5346 5347 5348 int 5349 main () 5350 { 5351 static struct ether_header ac_aggr; 5352 if (sizeof ac_aggr.ether_dhost.ether_addr_octet) 5353 return 0; 5354 ; 5355 return 0; 5356 } 5357 _ACEOF 5358 rm -f conftest.$ac_objext 5359 if { (ac_try="$ac_compile" 5360 case "(($ac_try" in 5361 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 5362 *) ac_try_echo=$ac_try;; 5363 esac 5364 eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" 5365 $as_echo "$ac_try_echo") >&5 5366 (eval "$ac_compile") 2>conftest.er1 5367 ac_status=$? 5368 grep -v '^ *+' conftest.er1 >conftest.err 5369 rm -f conftest.er1 5370 cat conftest.err >&5 5371 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 5372 (exit $ac_status); } && { 5373 test -z "$ac_c_werror_flag" || 5374 test ! -s conftest.err 5375 } && test -s conftest.$ac_objext; then 5376 ac_cv_member_struct_ether_header_ether_dhost_ether_addr_octet=yes 5377 else 5378 $as_echo "$as_me: failed program was:" >&5 5379 sed 's/^/| /' conftest.$ac_ext >&5 5380 5381 ac_cv_member_struct_ether_header_ether_dhost_ether_addr_octet=no 5382 fi 5383 5384 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5385 fi 5386 5387 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5388 fi 5389 { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_ether_header_ether_dhost_ether_addr_octet" >&5 5390 $as_echo "$ac_cv_member_struct_ether_header_ether_dhost_ether_addr_octet" >&6; } 5391 if test $ac_cv_member_struct_ether_header_ether_dhost_ether_addr_octet = yes; then 5392 5393 cat >>confdefs.h <<\_ACEOF 5394 #define HAVE_ETHER_ADDR_OCTET 1 4820 5395 _ACEOF 4821 5396 … … 5370 5945 # values after options handling. 5371 5946 ac_log=" 5372 This file was extended by onioncat $as_me 0.2.2.r54 6, which was5947 This file was extended by onioncat $as_me 0.2.2.r547, which was 5373 5948 generated by GNU Autoconf 2.62. Invocation command line was 5374 5949 … … 5423 5998 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 5424 5999 ac_cs_version="\\ 5425 onioncat config.status 0.2.2.r54 66000 onioncat config.status 0.2.2.r547 5426 6001 configured by $0, generated by GNU Autoconf 2.62, 5427 6002 with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -
trunk/configure.ac
r546 r547 8 8 AC_DEFINE(SVN_REVISION, "svnversion", [SVN Revision]) 9 9 10 AC_SUBST([CFLAGS], [["-Wall -O2"]]) 11 12 AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug],[enable debugging]), AC_DEFINE([DEBUG], [], [enable debugging])) 13 AC_ARG_ENABLE([packet-log], AS_HELP_STRING([--enable-packet-log],[enable packet logging]), AC_DEFINE([PACKET_LOG], [], [enable packet logging])) 14 AC_ARG_ENABLE([handle-http], AS_HELP_STRING([--enable-handle-http],[enable handling of accidental HTTP requests]), AC_DEFINE([HANDLE_HTTP], [], [enable handling of accidental HTTP requests])) 15 AC_ARG_ENABLE([packet-queue], AS_HELP_STRING([--enable-packet-queue],[enable queueuing of packets while connecting setup]), AC_DEFINE([PACKET_QUEUE], [], [enable packet queue])) 16 AC_ARG_ENABLE([check-ipsrc], AS_HELP_STRING([--disable-check-ipsrc],[disable source ip checking before forwarding]), AC_DEFINE([CHECK_IPSRC], [], [disable source ip checking])) 17 AC_ARG_ENABLE([rtt], AS_HELP_STRING([--enable-rtt],[enable inband RTT measurement]), AC_DEFINE([MEASURE_RTT], [], [enable RTT measurement])) 10 11 AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug],[enable debugging]), 12 AC_DEFINE([DEBUG], [1], [enable debugging]) 13 ) 14 15 AC_ARG_ENABLE([packet-log], AS_HELP_STRING([--enable-packet-log],[enable packet logging]), 16 AC_DEFINE([PACKET_LOG], [], [enable packet logging])) 17 18 AC_ARG_ENABLE([handle-http], AS_HELP_STRING([--enable-handle-http],[enable handling of accidental HTTP requests]), 19 AC_DEFINE([HANDLE_HTTP], [], [enable handling of accidental HTTP requests])) 20 21 AC_ARG_ENABLE([packet-queue], AS_HELP_STRING([--enable-packet-queue],[enable queueuing of packets while connecting setup]), 22 AC_DEFINE([PACKET_QUEUE], [], [enable packet queue])) 23 24 AC_ARG_ENABLE([check-ipsrc], AS_HELP_STRING([--disable-check-ipsrc],[disable source ip checking before forwarding]), 25 AC_DEFINE([CHECK_IPSRC], [1], [disable source ip checking])) 26 27 AC_ARG_ENABLE([rtt], AS_HELP_STRING([--enable-rtt],[enable inband RTT measurement]), 28 AC_DEFINE([MEASURE_RTT], [1], [enable RTT measurement])) 29 30 AC_ARG_ENABLE([tundev], AS_HELP_STRING([--disable-tundev],[compile without tunnel device code]), 31 AC_DEFINE([WITHOUT_TUN], [1], [exclude tunnel device code])) 32 33 34 if test "${enable_debug+set}" = set ; then 35 AC_SUBST([CFLAGS], [["-Wall -g -D_POSIX_PTHREAD_SEMANTICS"]]) 36 else 37 AC_SUBST([CFLAGS], [["-Wall -O2 -D_POSIX_PTHREAD_SEMANTICS"]]) 38 fi 18 39 19 40 # Checks for programs. … … 35 56 #AC_CHECK_LIB([readline], [main]) 36 57 58 AC_SEARCH_LIBS([bind], [socket]) 59 AC_SEARCH_LIBS([inet_ntop], [nsl]) 60 37 61 # Checks for header files. 38 62 #AC_HEADER_STDC 39 AC_CHECK_HEADERS([sys/types.h sys/wait.h sys/socket.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], [], [],63 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], [], [], 40 64 [[ 41 65 #ifdef HAVE_SYS_TYPES_H … … 117 141 [], 118 142 [ 119 #include <sys/types.h> 143 #ifdef HAVE_SYS_TYPES_H 144 #include <sys/types.h> 145 #endif 146 #ifdef HAVE_SYS_SOCKET_H 120 147 #include <sys/socket.h> 121 #ifdef HAVE_NETINET_IN_H 122 #include <netinet/in.h> 148 #endif 149 #ifdef HAVE_NETINET_IN_H 150 #include <netinet/in.h> 151 #endif 152 ]) 153 154 AC_CHECK_MEMBER([struct stat.st_mtim], 155 [AC_DEFINE(HAVE_STAT_ST_MTIM, 1, [Do we have stat.st_mtim?])], 156 [ 157 AC_CHECK_MEMBER([struct stat.st_mtimespec], 158 [AC_DEFINE(HAVE_STAT_ST_MTIMESPEC, 1, [Do we have stat.st_mtimespec?])], 159 [], 160 [ 161 #ifdef HAVE_SYS_TYPES_H 162 #include <sys/types.h> 163 #endif 164 #ifdef HAVE_SYS_STAT_H 165 #include <sys/stat.h> 166 #endif 167 ]) 168 ], 169 [ 170 #ifdef HAVE_SYS_TYPES_H 171 #include <sys/types.h> 172 #endif 173 #ifdef HAVE_SYS_STAT_H 174 #include <sys/stat.h> 175 #endif 176 ]) 177 178 AC_CHECK_MEMBER([struct ether_header.ether_dhost.ether_addr_octet], 179 [AC_DEFINE(HAVE_ETHER_ADDR_OCTET, 1, [Do we have ether_header.ether_dhost.ether_addr_octet])], 180 [], 181 [ 182 #ifdef HAVE_SYS_TYPES_H 183 #include <sys/types.h> 184 #endif 185 #ifdef HAVE_SYS_ETHERNET_H 186 #include <sys/ethernet.h> 123 187 #endif 124 188 ]) -
trunk/src/Makefile.am
r538 r547 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 ocat_netdesc.c 3 noinst_HEADERS = ocat.h ocat_netdesc.h strlcpy.c strlcat.c 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 ocat_netdesc.c ocathosts.c 3 noinst_HEADERS = ocat.h ocat_netdesc.h strlcpy.c strlcat.c ocathosts.h 4 4 AM_CFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" 5 5 -
trunk/src/Makefile.in
r546 r547 59 59 ocatlibe.$(OBJEXT) ocatctrl.$(OBJEXT) ocatipv6route.$(OBJEXT) \ 60 60 ocaticmp.$(OBJEXT) ocat_wintuntap.$(OBJEXT) \ 61 ocat_netdesc.$(OBJEXT) 61 ocat_netdesc.$(OBJEXT) ocathosts.$(OBJEXT) 62 62 ocat_OBJECTS = $(am_ocat_OBJECTS) 63 63 ocat_LDADD = $(LDADD) … … 164 164 sysconfdir = @sysconfdir@ 165 165 target_alias = @target_alias@ 166 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 167 noinst_HEADERS = ocat.h ocat_netdesc.h strlcpy.c strlcat.c 166 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 167 noinst_HEADERS = ocat.h ocat_netdesc.h strlcpy.c strlcat.c ocathosts.h 168 168 AM_CFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" 169 169 all: all-am … … 239 239 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocatctrl.Po@am__quote@ 240 240 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocateth.Po@am__quote@ 241 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocathosts.Po@am__quote@ 241 242 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocaticmp.Po@am__quote@ 242 243 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocatipv4route.Po@am__quote@ -
trunk/src/ocat.c
r546 r547 30 30 " -B do not daemonize (default = %d)\n" 31 31 " -h display usage message\n" 32 " -H ignore /etc/hosts while in GarliCat mode\n" 32 33 " -C disable local controller interface\n" 33 34 " -d <n> set debug level to n, default = %d\n" … … 102 103 } 103 104 104 fprintf(f, "%d\n", getpid());105 fprintf(f, "%d\n", (int) getpid()); 105 106 fclose(f); 106 107 log_debug("pid_file %s created, pid = %d", CNF(pid_file), getpid()); … … 300 301 while ((c = getopt(argc, argv, "f:I")) != -1) 301 302 { 302 log_debug("getopt(): c = %c, optind = %d, opterr = %d, optarg = \"%s\"", c, optind, opterr, optarg);303 log_debug("getopt(): c = %c, optind = %d, opterr = %d, optarg = \"%s\"", c, optind, opterr, SSTR(optarg)); 303 304 switch (c) 304 305 { … … 326 327 opterr = 1; 327 328 optind = 1; 328 while ((c = getopt(argc, argv, "f:IabBCd:h rRiopl:t:T:s:u:4L:P:")) != -1)329 { 330 log_debug("getopt(): c = %c, optind = %d, opterr = %d, optarg = \"%s\"", c, optind, opterr, optarg);329 while ((c = getopt(argc, argv, "f:IabBCd:hHrRiopl:t:T:s:u:4L:P:")) != -1) 330 { 331 log_debug("getopt(): c = %c, optind = %d, opterr = %d, optarg = \"%s\"", c, optind, opterr, SSTR(optarg)); 331 332 switch (c) 332 333 { … … 363 364 usage(argv[0]); 364 365 exit(1); 366 367 case 'H': 368 CNF(hosts_lookup) = 0; 369 break; 365 370 366 371 case 'l': … … 514 519 515 520 // copy onion-URL from command line 516 log_debug("argv[%d] = \"%s\"", optind, argv[optind]);521 log_debug("argv[%d] = \"%s\"", optind, SSTR(argv[optind])); 517 522 if (!CNF(rand_addr)) 518 523 strncpy(CNF(onion_url), argv[optind], NDESC(name_size)); -
trunk/src/ocat.h
r546 r547 19 19 #define OCAT_H 20 20 21 #ifdef HAVE_CONFIG_H 21 22 #include "config.h" 23 #endif 22 24 23 25 #include <stdio.h> … … 56 58 #include <sys/wait.h> 57 59 #endif 60 #ifdef HAVE_SYS_ETHERNET_H 61 #include <sys/ethernet.h> 62 #endif 58 63 #ifdef HAVE_NETINET_IN_H 59 64 #include <netinet/in.h> … … 102 107 #ifndef ETHERTYPE_IPV6 103 108 #define ETHERTYPE_IPV6 0x86dd 109 #endif 110 111 #ifndef ETHER_ADDR_LEN 112 #ifdef ETHERADDRL 113 #define ETHER_ADDR_LEN ETHERADDRL 114 #endif 115 #endif 116 117 // At least on Solaris the Ethernet addresses are defined as struct containing 118 // an array of bytes. This is different from most other OSes which define the 119 // addresses directly as array. 120 #ifdef HAVE_ETHER_ADDR_OCTET 121 #define ether_dst ether_dhost.ether_addr_octet 122 #define ether_src ether_shost.ether_addr_octet 123 #else 124 #define ether_dst ether_dhost 125 #define ether_src ether_shost 104 126 #endif 105 127 … … 226 248 #define SYSCONFDIR "/etc" 227 249 #endif 250 251 // this macro returns a constains string if a buffer points to NULL. 252 #define SSTR(x) (x != NULL ? x : "(nil)") 253 254 // Solaris and the Windows OpenVPN tunnel driver do not send a 4 byte tunnel 255 // header thus we adjust reads and writes. 256 #if defined(__sun__) || defined(__CYGWIN__) 257 #define BUF_OFF 4 258 #else 259 #define BUF_OFF 0 260 #endif 261 228 262 229 263 struct OcatSetup … … 306 340 int pid_fd[2]; 307 341 int sig_usr1, clear_stats; 342 int hosts_lookup; 308 343 }; 309 344 … … 468 503 469 504 #ifndef WITHOUT_TUN 470 #ifdef __FreeBSD__ 505 #ifdef __sun__ 506 #define TUN_DEV "/dev/tun" 507 #elif __linux__ 508 #define TUN_DEV "/dev/net/tun" 509 #else 471 510 #define TUN_DEV "/dev/tun0" 472 #e lif __OpenBSD__473 #define TUN_DEV "/dev/tun0" 511 #endif 512 extern char *tun_dev_; 474 513 #else 475 #define TUN_DEV "/dev/net/tun" 476 #endif 477 extern char *tun_dev_; 514 #define TUN_DEV "STDIO" 478 515 #endif 479 516 … … 614 651 int win_read_tun(char *, int); 615 652 int win_write_tun(const char *, int); 616 #endif 617 618 #endif 619 653 #define tun_read(x,y,z) win_read_tun(y,z) 654 #define tun_write(x,y,z) win_write_tun(y,z) 655 #else 656 #define tun_read(x,y,z) read(x,y,z) 657 #define tun_write(x,y,z) write(x,y,z) 658 #endif 659 660 661 #endif 662 -
trunk/src/ocat_netdesc.h
r538 r547 53 53 #define TOR_PREFIX_LEN 48 54 54 #if BYTE_ORDER == LITTLE_ENDIAN 55 #ifdef __sun__ 56 #define TOR_PREFIX4 {{{0x0000000a}}} 57 #else 55 58 #define TOR_PREFIX4 {0x0000000a} 59 #endif 56 60 #define TOR_PREFIX4_MASK 0x000000ff 57 61 #else 62 #ifdef __sun__ 63 #define TOR_PREFIX4 {{{0x0a000000}}} 64 #else 58 65 #define TOR_PREFIX4 {0x0a000000} 66 #endif 59 67 #define TOR_PREFIX4_MASK 0xff000000 60 68 #endif -
trunk/src/ocatcompat.c
r221 r547 16 16 */ 17 17 18 #ifdef HAVE_CONFIG_H 18 19 #include "config.h" 20 #endif 19 21 20 22 #ifndef HAVE_STRLCAT -
trunk/src/ocateth.c
r539 r547 253 253 254 254 // ethernet header 255 ndp6->eth.ether_d host[0] = 0x33;256 ndp6->eth.ether_d host[1] = 0x33;257 memcpy(&ndp6->eth.ether_d host[2], ((char*) &mcastd) + 12, 4);258 memcpy(ndp6->eth.ether_s host, CNF(ocat_hwaddr), ETHER_ADDR_LEN);255 ndp6->eth.ether_dst[0] = 0x33; 256 ndp6->eth.ether_dst[1] = 0x33; 257 memcpy(&ndp6->eth.ether_dst[2], ((char*) &mcastd) + 12, 4); 258 memcpy(ndp6->eth.ether_src, CNF(ocat_hwaddr), ETHER_ADDR_LEN); 259 259 ndp6->eth.ether_type = htons(ETHERTYPE_IPV6); 260 260 … … 276 276 ohd->nd_opt_type = ND_OPT_SOURCE_LINKADDR; 277 277 ohd->nd_opt_len = 1; 278 memcpy(ohd + 1, ndp6->eth.ether_s host, ETHER_ADDR_LEN);278 memcpy(ohd + 1, ndp6->eth.ether_src, ETHER_ADDR_LEN); 279 279 280 280 // calculate checksum … … 311 311 #endif 312 312 313 if (ndp6->eth.ether_d host[0] & 1)313 if (ndp6->eth.ether_dst[0] & 1) 314 314 { 315 315 // check for right multicast destination on ethernet 316 if (ndp6->eth.ether_d host[2] != 0xff)317 { 318 log_debug("ethernet multicast destination %s cannot be solicited node address", ether_ntoa_r((struct ether_addr*) ndp6->eth.ether_d host, hw));316 if (ndp6->eth.ether_dst[2] != 0xff) 317 { 318 log_debug("ethernet multicast destination %s cannot be solicited node address", ether_ntoa_r((struct ether_addr*) ndp6->eth.ether_dst, hw)); 319 319 return -1; 320 320 } … … 355 355 log_debug("generating response"); 356 356 // add source MAC to table 357 if (mac_set(&ndp6->ip6.ip6_src, ndp6->eth.ether_s host) == -1)358 if (mac_add_entry(ndp6->eth.ether_s host, &ndp6->ip6.ip6_src) == -1)357 if (mac_set(&ndp6->ip6.ip6_src, ndp6->eth.ether_src) == -1) 358 if (mac_add_entry(ndp6->eth.ether_src, &ndp6->ip6.ip6_src) == -1) 359 359 { 360 360 log_msg(LOG_ERR, "MAC table full"); … … 363 363 364 364 // set MAC addresses for response 365 memcpy(ndp6->eth.ether_d host, ndp6->eth.ether_shost, ETHER_ADDR_LEN);366 memcpy(ndp6->eth.ether_s host, CNF(ocat_hwaddr), ETHER_ADDR_LEN);365 memcpy(ndp6->eth.ether_dst, ndp6->eth.ether_src, ETHER_ADDR_LEN); 366 memcpy(ndp6->eth.ether_src, CNF(ocat_hwaddr), ETHER_ADDR_LEN); 367 367 368 368 // init ip6 header … … 406 406 407 407 // add source MAC to table 408 if (mac_set(&ndp6->ip6.ip6_src, ndp6->eth.ether_s host) == -1)409 if (mac_add_entry(ndp6->eth.ether_s host, &ndp6->ip6.ip6_src) == -1)408 if (mac_set(&ndp6->ip6.ip6_src, ndp6->eth.ether_src) == -1) 409 if (mac_add_entry(ndp6->eth.ether_src, &ndp6->ip6.ip6_src) == -1) 410 410 { 411 411 log_msg(LOG_ERR, "MAC table full"); … … 450 450 451 451 // check ethernet destination 452 if ((ndp6->eth.ether_d host[0] != 0x33) && (ndp6->eth.ether_dhost[1] != 0x33) && memcmp(ndp6->eth.ether_dhost, CNF(ocat_hwaddr), ETHER_ADDR_LEN))452 if ((ndp6->eth.ether_dst[0] != 0x33) && (ndp6->eth.ether_dst[1] != 0x33) && memcmp(ndp6->eth.ether_dst, CNF(ocat_hwaddr), ETHER_ADDR_LEN)) 453 453 { 454 454 log_debug("unknown destination MAC"); -
trunk/src/ocatfdbuf.c
r501 r547 30 30 * @param fd File descriptor if open file. 31 31 * @param delim Delimiting character. 32 * @return Pointer to fdFile_t structure. 33 */ 32 * @return Pointer to fdFile_t structure or NULL in case of error. 33 * In the latter case errno is set appropriately. 34 **/ 34 35 fdFile_t* fdf_init(int fd, char delim) 35 36 { -
trunk/src/ocatroute.c
r539 r547 508 508 if (!CNF(use_tap)) 509 509 { 510 log_debug("writing to tun %d framesize %d + 4", CNF(tunfd[1]), len);511 if ( write(CNF(tunfd[1]), peer->tunhdr, len + 4) != (len + 4))512 log_msg(LOG_ERR, "could not write %d bytes to tunnel %d", len + 4 , CNF(tunfd[1]));510 log_debug("writing to tun %d framesize %d + %d", CNF(tunfd[1]), len, 4 - BUF_OFF); 511 if (tun_write(CNF(tunfd[1]), ((char*) peer->tunhdr) + BUF_OFF, len + 4 - BUF_OFF) != (len + 4 - BUF_OFF)) 512 log_msg(LOG_ERR, "could not write %d bytes to tunnel %d", len + 4 - BUF_OFF, CNF(tunfd[1])); 513 513 } 514 514 // create ethernet header and handle MAC on TAP device … … 518 518 519 519 // FIXME: should differentiate between IPv6 and IP!! 520 memset(eh->ether_d host, 0, ETHER_ADDR_LEN);521 if (mac_set(&((struct ip6_hdr*)peer->fragbuf)->ip6_dst, eh->ether_d host) == -1)520 memset(eh->ether_dst, 0, ETHER_ADDR_LEN); 521 if (mac_set(&((struct ip6_hdr*)peer->fragbuf)->ip6_dst, eh->ether_dst) == -1) 522 522 { 523 523 log_debug("dest MAC unknown, resolving"); … … 528 528 set_tunheader(buf, *peer->tunhdr); 529 529 memcpy(buf + 4 + sizeof(struct ether_header), peer->fragbuf, len); 530 memcpy(eh->ether_s host, CNF(ocat_hwaddr), ETHER_ADDR_LEN);530 memcpy(eh->ether_src, CNF(ocat_hwaddr), ETHER_ADDR_LEN); 531 531 532 532 if (*peer->tunhdr == CNF(fhd_key[IPV6_KEY])) … … 535 535 eh->ether_type = htons(ETHERTYPE_IP); 536 536 537 #ifdef __CYGWIN__ 538 if (win_write_tun(buf + 4, len + sizeof(struct ether_header)) != (len + sizeof(struct ether_header))) 539 log_msg(LOG_ERR, "could not write %d bytes to WinTAP", len + sizeof(struct ether_header)); 540 #else 541 if (write(CNF(tunfd[1]), buf, len + 4 + sizeof(struct ether_header)) != (len + 4 + sizeof(struct ether_header))) 542 log_msg(LOG_ERR, "could not write %d bytes to tunnel %d", len + 4 + sizeof(struct ether_header), CNF(tunfd[1])); 543 #endif 537 if (tun_write(CNF(tunfd[1]), buf + BUF_OFF, len + 4 + sizeof(struct ether_header) - BUF_OFF) != (len + 4 + sizeof(struct ether_header) - BUF_OFF)) 538 log_msg(LOG_ERR, "could not write %d bytes to tunnel %d", len + 4 + sizeof(struct ether_header) - BUF_OFF, CNF(tunfd[1])); 544 539 } 545 540 } … … 812 807 break; 813 808 814 #ifdef __CYGWIN__815 log_debug("reading from WinTAP");816 if ((rlen = win_read_tun(buf + 4, FRAME_SIZE - 4)) == -1)817 {818 log_debug("win_read_tun failed. restarting");819 continue;820 }821 rlen += 4;822 #else823 809 #ifdef __OpenBSD__ 824 810 // workaround for OpenBSD userland threads … … 826 812 #endif 827 813 log_debug("reading from tunfd[0] = %d", CNF(tunfd[0])); 828 if ((rlen = read(CNF(tunfd[0]), buf, FRAME_SIZE)) == -1)814 if ((rlen = tun_read(CNF(tunfd[0]), buf + BUF_OFF, FRAME_SIZE - BUF_OFF)) == -1) 829 815 { 830 816 rlen = errno; … … 850 836 continue; 851 837 } 852 #endif 853 854 log_debug("received on tunfd %d, framesize %d + 4", CNF(tunfd[0]), rlen - 4);838 rlen += BUF_OFF; 839 840 log_debug("received on tunfd %d, framesize %d + %d", CNF(tunfd[0]), rlen - 4, 4 - BUF_OFF); 855 841 856 842 #ifdef PACKET_LOG … … 877 863 memmove(eh, eh + 1, rlen - 4); 878 864 } 865 866 #if defined(__sun__) || defined(__CYGWIN__) 867 // Solaris tunnel driver does not send tunnel 868 // header thus we guess and set it manually 869 if ((buf[BUF_OFF] & 0xf0) == 0x60) 870 set_tunheader(buf, CNF(fhd_key[IPV6_KEY])); 871 else if ((buf[BUF_OFF] & 0xf0) == 0x40) 872 set_tunheader(buf, CNF(fhd_key[IPV4_KEY])); 873 else 874 set_tunheader(buf, -1); 875 #endif 879 876 880 877 if (get_tunheader(buf) == CNF(fhd_key[IPV6_KEY])) -
trunk/src/ocatsetup.c
r538 r547 26 26 #include "ocat.h" 27 27 #include "ocat_netdesc.h" 28 #include "ocathosts.h" 28 29 29 30 … … 32 33 static struct sockaddr_in6 ctrl_listen6_; 33 34 static struct sockaddr *ctrl_listen_ptr_[] = 34 {(struct sockaddr*) &ctrl_listen_, 35 { 36 (struct sockaddr*) &ctrl_listen_, 35 37 #ifndef __CYGWIN__ 36 (struct sockaddr*) &ctrl_listen6_,38 (struct sockaddr*) &ctrl_listen6_, 37 39 #endif 38 40 NULL}; … … 105 107 ctrl_fd_, 106 108 // oc_listen_cnt 107 #if def __CYGWIN__109 #if defined(__CYGWIN__) 108 110 1 109 111 #else … … 120 122 {-1, -1}, 121 123 // sig_usr1, clear_stats 122 0, 0 124 0, 0, 125 // hosts_lookup 126 1 123 127 }; 124 128 … … 130 134 { 131 135 struct timeval tv; 136 const uint32_t loop_ = htonl(INADDR_LOOPBACK); 132 137 133 138 // seeding PRNG rand() … … 140 145 memset(&socks_dst6_, 0, sizeof(socks_dst6_)); 141 146 setup_.socks_dst->sin_family = AF_INET; 142 setup_.socks_dst->sin_addr.s_addr = htonl(INADDR_LOOPBACK); 147 //setup_.socks_dst->sin_addr.s_addr = htonl(INADDR_LOOPBACK); 148 memcpy(&setup_.socks_dst->sin_addr, &loop_, sizeof(setup_.socks_dst->sin_addr)); 143 149 #ifdef HAVE_SIN_LEN 144 150 setup_.socks_dst->sin_len = SOCKADDR_SIZE(setup_.socks_dst); 145 151 #endif 152 153 memset(&ctrl_listen_, 0, sizeof(ctrl_listen_)); 154 memset(&ctrl_listen6_, 0, sizeof(ctrl_listen6_)); 155 156 hosts_init(".b32.i2p"); 157 158 #ifdef __linux__ 159 CNF(fhd_key[IPV6_KEY]) = htonl(ETHERTYPE_IPV6); 160 CNF(fhd_key[IPV4_KEY]) = htonl(ETHERTYPE_IP); 161 #else 162 CNF(fhd_key[IPV6_KEY]) = htonl(AF_INET6); 163 CNF(fhd_key[IPV4_KEY]) = htonl(AF_INET); 164 #endif 146 165 } 147 166 … … 150 169 { 151 170 size_t l; 171 const uint32_t loop_ = htonl(INADDR_LOOPBACK); 172 152 173 setup_.ocat_addr4 = NDESC(prefix4); 153 174 setup_.ocat_addr4_mask = NDESC(addr4_mask); … … 166 187 ctrl_listen_.sin_family = AF_INET; 167 188 ctrl_listen_.sin_port = htons(setup_.ocat_ctrl_port); 168 ctrl_listen_.sin_addr.s_addr = htonl(INADDR_LOOPBACK); 189 //ctrl_listen_.sin_addr.s_addr = htonl(INADDR_LOOPBACK); 190 memcpy(&ctrl_listen_.sin_addr, &loop_, sizeof(ctrl_listen_.sin_addr)); 169 191 #ifdef HAVE_SIN_LEN 170 192 ctrl_listen_.sin_len = sizeof(ctrl_listen_); … … 248 270 "pid_fd[2] = {%d, %d}\n" 249 271 "clear_stats = %d\n" 272 "ctrl_listen_cnt = %d\n" 273 "hosts_lookup = %d\n" 250 274 , 251 275 IPV4_KEY, ntohl(setup_.fhd_key[IPV4_KEY]), IPV6_KEY, ntohl(setup_.fhd_key[IPV6_KEY]), … … 274 298 hw, 275 299 setup_.pid_file, 276 setup_.logfn,300 SSTR(setup_.logfn), 277 301 logf, 278 302 setup_.daemon, … … 284 308 setup_.max_ctrl, setup_.ctrl_active, 285 309 setup_.pid_fd[0], setup_.pid_fd[1], 286 setup_.clear_stats 310 setup_.clear_stats, 311 setup_.ctrl_listen_cnt, 312 setup_.hosts_lookup 287 313 ); 288 314 … … 315 341 fprintf(f, "oc_listen_fd[%d] = %d\n", i, CNF(oc_listen_fd)[i]); 316 342 } 343 344 for (i = 0; i < CNF(ctrl_listen_cnt); i++) 345 { 346 if (inet_ntops(ctrl_listen_ptr_[i], &sas)) 347 fprintf(f, "ctrl_listen_ptr_[%d] = %s:%d (0x%04x)\n", i, sas.sstr_addr, ntohs(sas.sstr_port), sas.sstr_family); 348 else 349 log_msg(LOG_WARNING, "could not convert struct sockaddr: \"%s\"", strerror(errno)); 350 } 317 351 } 318 352 -
trunk/src/ocatsocks.c
r534 r547 27 27 #include "ocat.h" 28 28 #include "ocat_netdesc.h" 29 #include "ocathosts.h" 29 30 30 31 … … 37 38 int socks_send_request(const SocksQueue_t *sq) 38 39 { 39 int len, ret ;40 char buf[SOCKS_BUFLEN], onion[N DESC(name_size)];40 int len, ret = -1; 41 char buf[SOCKS_BUFLEN], onion[NI_MAXHOST]; 41 42 SocksHdr_t *shdr = (SocksHdr_t*) buf; 42 43 43 ipv6tonion(&sq->addr, onion); 44 strlcat(onion, NDESC(domain), sizeof(onion)); 45 log_msg(LOG_INFO, "trying to connect to \"%s\" [%s]", onion, inet_ntop(AF_INET6, &sq->addr, buf, SOCKS_BUFLEN)); 44 // Do a hostname lookup if network type is I2P. 45 // This is done in order to be able to retrieve a 256 bit base32 46 // host from e.g. /etc/hosts. 47 if ((CNF(net_type) == NTYPE_I2P) && CNF(hosts_lookup)) 48 { 49 hosts_check(); 50 ret = hosts_get_name(&sq->addr, onion, sizeof(onion)); 51 } 52 53 // If no hostname was found above or network type is Tor 54 // do usual OnionCat name transformation. 55 if (ret == -1) 56 { 57 ipv6tonion(&sq->addr, onion); 58 strlcat(onion, NDESC(domain), sizeof(onion)); 59 } 60 61 if (inet_ntop(AF_INET6, &sq->addr, buf, sizeof(buf)) == NULL) 62 { 63 log_msg(LOG_WARNING, "inet_ntop failed: \"%s\"", strerror(errno)); 64 buf[0] = '\0'; 65 } 66 log_msg(LOG_INFO, "trying to connect to \"%s\" [%s] on %d", onion, buf, sq->fd); 46 67 47 68 log_debug("doing SOCKS4a handshake"); -
trunk/src/ocattun.c
r534 r547 23 23 */ 24 24 25 #ifndef WITHOUT_TUN26 25 27 26 … … 29 28 #include "ocat_netdesc.h" 30 29 30 #ifndef WITHOUT_TUN 31 31 32 32 char *tun_dev_ = TUN_DEV; 33 33 34 34 #define IFCBUF 1024 35 36 37 void system_w(const char *s) 38 { 39 int e; 40 41 log_debug("running command \"%s\"", s); 42 if ((e = system(s)) == -1) 43 log_msg(LOG_ERR, "could not exec \"%s\": \"%s\"", s, strerror(errno)); 44 log_debug("exit status = %d", WEXITSTATUS(e)); 45 } 46 35 47 36 48 int tun_alloc(char *dev, int dev_s, struct in6_addr addr) … … 39 51 struct ifreq ifr; 40 52 #endif 53 #ifdef __sun__ 54 int ppa = -1; 55 #endif 41 56 int fd; 42 57 char astr[INET6_ADDRSTRLEN]; 43 58 char astr4[INET_ADDRSTRLEN]; 44 59 char buf[IFCBUF]; 45 struct in_addr netmask = {CNF(ocat_addr4_mask)}; 46 60 struct in_addr netmask;// = {CNF(ocat_addr4_mask)}; 61 62 memcpy(&netmask, &CNF(ocat_addr4_mask), sizeof(netmask)); 47 63 inet_ntop(AF_INET6, &addr, astr, INET6_ADDRSTRLEN); 48 64 inet_ntop(AF_INET, &CNF(ocat_addr4), astr4, INET_ADDRSTRLEN); … … 58 74 59 75 snprintf(buf, sizeof(buf), "netsh interface ipv6 add address \"%s\" %s", dev, astr); 60 log_debug("setting IP on tun: \"%s\"", buf); 61 if (system(buf) == -1) 62 log_msg(LOG_ERR, "could not exec \"%s\": \"%s\"", buf, strerror(errno)); 76 system_w(buf); 63 77 64 78 snprintf(buf, sizeof(buf), "netsh interface ipv6 add route %s/%d \"%s\"", astr, NDESC(prefix_len), dev); 65 log_debug("setting IP routing: \"%s\"", buf); 66 if (system(buf) == -1) 67 log_msg(LOG_ERR, "could not exec \"%s\": \"%s\"", buf, strerror(errno)); 79 system_w(buf); 68 80 69 81 return 0; … … 94 106 { 95 107 snprintf(buf, sizeof(buf), "ifconfig %s add %s/%d up", dev, astr, NDESC(prefix_len)); 96 log_msg(LOG_INFO, "configuring tun IP: \"%s\"", buf); 97 if (system(buf) == -1) 98 log_msg(LOG_ERR, "could not exec \"%s\": \"%s\"", buf, strerror(errno)); 108 system_w(buf); 99 109 } 100 110 … … 105 115 */ 106 116 107 // set tun frame header to ethertype IPv6108 CNF(fhd_key[IPV6_KEY]) = htonl(ETHERTYPE_IPV6);109 CNF(fhd_key[IPV4_KEY]) = htonl(ETHERTYPE_IP);110 111 117 #else 112 113 // set tun frame header to address family AF_INET6 (FreeBSD = 0x1c, OpenBSD = 0x18)114 CNF(fhd_key[IPV6_KEY]) = htonl(AF_INET6);115 CNF(fhd_key[IPV4_KEY]) = htonl(AF_INET);116 118 117 119 // get interface name … … 166 168 #endif /* __linux__ */ 167 169 170 #ifdef __sun__ 171 if( (ppa = ioctl(fd, TUNNEWPPA, ppa)) == -1) 172 log_msg(LOG_ERR, "Can't assign new interface"); 173 else 174 snprintf(dev, dev_s, "%s%d", dev, ppa); 175 176 #endif 168 177 169 178 if (!CNF(use_tap)) … … 171 180 #ifdef __OpenBSD__ 172 181 snprintf(buf, sizeof(buf), "ifconfig %s inet6 %s prefixlen %d up", dev, astr, NDESC(prefix_len)); 182 #elif __sun__ 183 snprintf(buf, sizeof(buf), "ifconfig %s inet6 plumb %s/%d %s up", dev, astr, NDESC(prefix_len), astr); 173 184 #else 174 185 snprintf(buf, sizeof(buf), "ifconfig %s inet6 %s/%d up", dev, astr, NDESC(prefix_len)); 175 186 #endif 176 log_debug("setting IP on tun: \"%s\"", buf); 177 if (system(buf) == -1) 178 log_msg(LOG_ERR, "could not exec \"%s\": \"%s\"", buf, strerror(errno)); 179 187 system_w(buf); 188 189 // some OSes require routes to be set manually 180 190 #ifdef __APPLE__ 181 182 191 // MacOSX requires the route to be set up manually 183 192 // FIXME: the prefix shouldn't be hardcoded here 184 193 snprintf(buf, sizeof(buf), "route add -inet6 -net fd87:d87e:eb43:: -prefixlen %d -gateway %s", NDESC(prefix_len), astr); 185 log_msg(LOG_INFO, "setup routing: \"%s\"", buf); 186 if (system(buf) == -1) 187 log_msg(LOG_ERR, "could not exec \"%s\": \"%s\"", buf, strerror(errno)); 188 194 system_w(buf); 195 #elif __sun__ 196 // Solaris requires the route to be set up manually 197 // FIXME: the prefix shouldn't be hardcoded here 198 snprintf(buf, sizeof(buf), "route add -inet6 fd87:d87e:eb43::/%d %s -iface", NDESC(prefix_len), astr); 199 system_w(buf); 189 200 #endif 190 201 … … 197 208 { 198 209 snprintf(buf, sizeof(buf), "ifconfig %s %s netmask %s", dev, astr4, inet_ntoa(netmask)); 199 log_msg(LOG_INFO, "configuring tun IP: \"%s\"", buf); 200 if (system(buf) == -1) 201 log_msg(LOG_ERR, "could not exec \"%s\": \"%s\"", buf, strerror(errno)); 210 system_w(buf); 202 211 } 203 212 … … 206 215 { 207 216 snprintf(buf, sizeof(buf), "ifconfig %s up", dev); 208 log_msg(LOG_INFO, "bringing up TAP device \"%s\"", buf); 209 if (system(buf) == -1) 210 log_msg(LOG_ERR, "could not exec \"%s\": \"%s\"", buf, strerror(errno)); 217 system_w(buf); 211 218 } 212 219 -
trunk/src/ocatv6conv.c
r534 r547 81 81 { 82 82 shl5((char*) ip6); 83 j = toupper( onion[i]);83 j = toupper((int) onion[i]); 84 84 if ((j < '2') || (j > 'Z')) 85 85 return -1;
Note: See TracChangeset
for help on using the changeset viewer.
