Changeset 547


Ignore:
Timestamp:
04/26/10 13:29:15 (22 months ago)
Author:
eagle
Message:
  • configure.ac refined
  • OC now compiles and runs on Solaris 10 using the Universal TUN/TAP driver version 1.1 ( http://vtun.sourceforge.net/tun/index.html)
  • ocathosts.[ch] added. It reads IPv6 addresses from /etc/hosts
  • /etc/hosts reverse lookup for I2P .b32 names added
Location:
trunk
Files:
2 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r540 r547  
    11* 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 
    27 - debian directory included into source package. 
    38 - 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 
    13* OpenBSD TAP device might not work (see OpenBSD man page tun(4)) 
    24* finish SOCKS5 code for I2P 
  • trunk/config.h.in

    r546 r547  
    1313#undef HAVE_ENDIAN_H 
    1414 
     15/* Do we have ether_header.ether_dhost.ether_addr_octet */ 
     16#undef HAVE_ETHER_ADDR_OCTET 
     17 
    1518/* Define to 1 if you have the `ether_ntoa' function. */ 
    1619#undef HAVE_ETHER_NTOA 
     
    1922#undef HAVE_ETHER_NTOA_R 
    2023 
     24/* Define to 1 if you have the <fcntl.h> header file. */ 
     25#undef HAVE_FCNTL_H 
     26 
    2127/* Define to 1 if you have the <linux/if_tun.h> header file. */ 
    2228#undef HAVE_LINUX_IF_TUN_H 
     
    2430/* Define to 1 if you have the <linux/sockios.h> header file. */ 
    2531#undef HAVE_LINUX_SOCKIOS_H 
     32 
     33/* Define to 1 if you have the <netdb.h> header file. */ 
     34#undef HAVE_NETDB_H 
    2635 
    2736/* Define to 1 if you have the <netinet/ether.h> header file. */ 
     
    6473#undef HAVE_SIN_LEN 
    6574 
     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 
    6681/* Define to 1 if you have the `strlcat' function. */ 
    6782#undef HAVE_STRLCAT 
     
    8297#undef HAVE_SYS_ENDIAN_H 
    8398 
     99/* Define to 1 if you have the <sys/ethernet.h> header file. */ 
     100#undef HAVE_SYS_ETHERNET_H 
     101 
    84102/* Define to 1 if you have the <sys/socket.h> header file. */ 
    85103#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 
    86107 
    87108/* Define to 1 if you have the <sys/types.h> header file. */ 
     
    90111/* Define to 1 if you have the <sys/wait.h> header file. */ 
    91112#undef HAVE_SYS_WAIT_H 
     113 
     114/* Define to 1 if you have the <time.h> header file. */ 
     115#undef HAVE_TIME_H 
    92116 
    93117/* enable RTT measurement */ 
     
    128152#undef VERSION 
    129153 
     154/* exclude tunnel device code */ 
     155#undef WITHOUT_TUN 
     156 
    130157/* Define to empty if `const' does not conform to ANSI C. */ 
    131158#undef const 
  • trunk/configure

    r546 r547  
    11#! /bin/sh 
    22# Guess values for system-dependent variables and create Makefiles. 
    3 # Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r546. 
     3# Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r547. 
    44# 
    55# Report bugs to <rahra@cypherpunk.at>. 
     
    597597PACKAGE_NAME='onioncat' 
    598598PACKAGE_TARNAME='onioncat' 
    599 PACKAGE_VERSION='0.2.2.r546' 
    600 PACKAGE_STRING='onioncat 0.2.2.r546' 
     599PACKAGE_VERSION='0.2.2.r547' 
     600PACKAGE_STRING='onioncat 0.2.2.r547' 
    601601PACKAGE_BUGREPORT='rahra@cypherpunk.at' 
    602602 
     
    700700enable_check_ipsrc 
    701701enable_rtt 
     702enable_tundev 
    702703enable_dependency_tracking 
    703704' 
     
    12621263  # This message is too long to be a string in the A/UX 3.1 sh. 
    12631264  cat <<_ACEOF 
    1264 \`configure' configures onioncat 0.2.2.r546 to adapt to many kinds of systems. 
     1265\`configure' configures onioncat 0.2.2.r547 to adapt to many kinds of systems. 
    12651266 
    12661267Usage: $0 [OPTION]... [VAR=VALUE]... 
     
    13321333if test -n "$ac_init_help"; then 
    13331334  case $ac_init_help in 
    1334      short | recursive ) echo "Configuration of onioncat 0.2.2.r546:";; 
     1335     short | recursive ) echo "Configuration of onioncat 0.2.2.r547:";; 
    13351336   esac 
    13361337  cat <<\_ACEOF 
     
    13461347  --disable-check-ipsrc   disable source ip checking before forwarding 
    13471348  --enable-rtt            enable inband RTT measurement 
     1349  --disable-tundev        compile without tunnel device code 
    13481350  --disable-dependency-tracking  speeds up one-time build 
    13491351  --enable-dependency-tracking   do not reject slow dependency extractors 
     
    14241426if $ac_init_version; then 
    14251427  cat <<\_ACEOF 
    1426 onioncat configure 0.2.2.r546 
     1428onioncat configure 0.2.2.r547 
    14271429generated by GNU Autoconf 2.62 
    14281430 
     
    14381440running configure, to aid debugging if configure makes a mistake. 
    14391441 
    1440 It was created by onioncat $as_me 0.2.2.r546, which was 
     1442It was created by onioncat $as_me 0.2.2.r547, which was 
    14411443generated by GNU Autoconf 2.62.  Invocation command line was 
    14421444 
     
    20872089# Define the identity of the package. 
    20882090 PACKAGE='onioncat' 
    2089  VERSION='0.2.2.r546' 
     2091 VERSION='0.2.2.r547' 
    20902092 
    20912093 
     
    22382240 
    22392241cat >>confdefs.h <<\_ACEOF 
    2240 #define SVN_REVISION "546" 
    2241 _ACEOF 
    2242  
    2243  
    2244 CFLAGS="-Wall -O2" 
     2242#define SVN_REVISION "547" 
     2243_ACEOF 
     2244 
    22452245 
    22462246 
     
    22492249  enableval=$enable_debug; 
    22502250cat >>confdefs.h <<\_ACEOF 
    2251 #define DEBUG /**/ 
    2252 _ACEOF 
    2253  
    2254 fi 
     2251#define DEBUG 1 
     2252_ACEOF 
     2253 
     2254 
     2255fi 
     2256 
    22552257 
    22562258# Check whether --enable-packet-log was given. 
     
    22632265fi 
    22642266 
     2267 
    22652268# Check whether --enable-handle-http was given. 
    22662269if test "${enable_handle_http+set}" = set; then 
     
    22722275fi 
    22732276 
     2277 
    22742278# Check whether --enable-packet-queue was given. 
    22752279if test "${enable_packet_queue+set}" = set; then 
     
    22812285fi 
    22822286 
     2287 
    22832288# Check whether --enable-check-ipsrc was given. 
    22842289if test "${enable_check_ipsrc+set}" = set; then 
    22852290  enableval=$enable_check_ipsrc; 
    22862291cat >>confdefs.h <<\_ACEOF 
    2287 #define CHECK_IPSRC /**/ 
    2288 _ACEOF 
    2289  
    2290 fi 
     2292#define CHECK_IPSRC 1 
     2293_ACEOF 
     2294 
     2295fi 
     2296 
    22912297 
    22922298# Check whether --enable-rtt was given. 
     
    22942300  enableval=$enable_rtt; 
    22952301cat >>confdefs.h <<\_ACEOF 
    2296 #define MEASURE_RTT /**/ 
    2297 _ACEOF 
    2298  
    2299 fi 
    2300  
     2302#define MEASURE_RTT 1 
     2303_ACEOF 
     2304 
     2305fi 
     2306 
     2307 
     2308# Check whether --enable-tundev was given. 
     2309if test "${enable_tundev+set}" = set; then 
     2310  enableval=$enable_tundev; 
     2311cat >>confdefs.h <<\_ACEOF 
     2312#define WITHOUT_TUN 1 
     2313_ACEOF 
     2314 
     2315fi 
     2316 
     2317 
     2318 
     2319if test "${enable_debug+set}" = set ; then 
     2320   CFLAGS="-Wall -g -D_POSIX_PTHREAD_SEMANTICS" 
     2321 
     2322else 
     2323   CFLAGS="-Wall -O2 -D_POSIX_PTHREAD_SEMANTICS" 
     2324 
     2325fi 
    23012326 
    23022327# Checks for programs. 
     
    41004125#AC_CHECK_LIB([readline], [main]) 
    41014126 
     4127{ $as_echo "$as_me:$LINENO: checking for library containing bind" >&5 
     4128$as_echo_n "checking for library containing bind... " >&6; } 
     4129if test "${ac_cv_search_bind+set}" = set; then 
     4130  $as_echo_n "(cached) " >&6 
     4131else 
     4132  ac_func_search_save_LIBS=$LIBS 
     4133cat >conftest.$ac_ext <<_ACEOF 
     4134/* confdefs.h.  */ 
     4135_ACEOF 
     4136cat confdefs.h >>conftest.$ac_ext 
     4137cat >>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 
     4144extern "C" 
     4145#endif 
     4146char bind (); 
     4147int 
     4148main () 
     4149{ 
     4150return bind (); 
     4151  ; 
     4152  return 0; 
     4153} 
     4154_ACEOF 
     4155for 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 
     4163if { (ac_try="$ac_link" 
     4164case "(($ac_try" in 
     4165  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     4166  *) ac_try_echo=$ac_try;; 
     4167esac 
     4168eval 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 
     4184else 
     4185  $as_echo "$as_me: failed program was:" >&5 
     4186sed 's/^/| /' conftest.$ac_ext >&5 
     4187 
     4188 
     4189fi 
     4190 
     4191rm -rf conftest.dSYM 
     4192rm -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 
     4196fi 
     4197done 
     4198if test "${ac_cv_search_bind+set}" = set; then 
     4199  : 
     4200else 
     4201  ac_cv_search_bind=no 
     4202fi 
     4203rm conftest.$ac_ext 
     4204LIBS=$ac_func_search_save_LIBS 
     4205fi 
     4206{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_bind" >&5 
     4207$as_echo "$ac_cv_search_bind" >&6; } 
     4208ac_res=$ac_cv_search_bind 
     4209if test "$ac_res" != no; then 
     4210  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 
     4211 
     4212fi 
     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; } 
     4216if test "${ac_cv_search_inet_ntop+set}" = set; then 
     4217  $as_echo_n "(cached) " >&6 
     4218else 
     4219  ac_func_search_save_LIBS=$LIBS 
     4220cat >conftest.$ac_ext <<_ACEOF 
     4221/* confdefs.h.  */ 
     4222_ACEOF 
     4223cat confdefs.h >>conftest.$ac_ext 
     4224cat >>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 
     4231extern "C" 
     4232#endif 
     4233char inet_ntop (); 
     4234int 
     4235main () 
     4236{ 
     4237return inet_ntop (); 
     4238  ; 
     4239  return 0; 
     4240} 
     4241_ACEOF 
     4242for 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 
     4250if { (ac_try="$ac_link" 
     4251case "(($ac_try" in 
     4252  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     4253  *) ac_try_echo=$ac_try;; 
     4254esac 
     4255eval 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 
     4271else 
     4272  $as_echo "$as_me: failed program was:" >&5 
     4273sed 's/^/| /' conftest.$ac_ext >&5 
     4274 
     4275 
     4276fi 
     4277 
     4278rm -rf conftest.dSYM 
     4279rm -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 
     4283fi 
     4284done 
     4285if test "${ac_cv_search_inet_ntop+set}" = set; then 
     4286  : 
     4287else 
     4288  ac_cv_search_inet_ntop=no 
     4289fi 
     4290rm conftest.$ac_ext 
     4291LIBS=$ac_func_search_save_LIBS 
     4292fi 
     4293{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_inet_ntop" >&5 
     4294$as_echo "$ac_cv_search_inet_ntop" >&6; } 
     4295ac_res=$ac_cv_search_inet_ntop 
     4296if test "$ac_res" != no; then 
     4297  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 
     4298 
     4299fi 
     4300 
     4301 
    41024302# Checks for header files. 
    41034303#AC_HEADER_STDC 
     
    41204320 
    41214321 
    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 
     4327for 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 
    41234328do 
    41244329as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 
     
    47174922/* end confdefs.h.  */ 
    47184923 
     4924#ifdef HAVE_SYS_TYPES_H 
    47194925#include <sys/types.h> 
     4926#endif 
     4927#ifdef HAVE_SYS_SOCKET_H 
    47204928#include <sys/socket.h> 
     4929#endif 
    47214930#ifdef HAVE_NETINET_IN_H 
    47224931#include <netinet/in.h> 
     
    47644973/* end confdefs.h.  */ 
    47654974 
     4975#ifdef HAVE_SYS_TYPES_H 
    47664976#include <sys/types.h> 
     4977#endif 
     4978#ifdef HAVE_SYS_SOCKET_H 
    47674979#include <sys/socket.h> 
     4980#endif 
    47684981#ifdef HAVE_NETINET_IN_H 
    47694982#include <netinet/in.h> 
     
    48185031cat >>confdefs.h <<\_ACEOF 
    48195032#define HAVE_SIN_LEN 1 
     5033_ACEOF 
     5034 
     5035fi 
     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; } 
     5040if test "${ac_cv_member_struct_stat_st_mtim+set}" = set; then 
     5041  $as_echo_n "(cached) " >&6 
     5042else 
     5043  cat >conftest.$ac_ext <<_ACEOF 
     5044/* confdefs.h.  */ 
     5045_ACEOF 
     5046cat confdefs.h >>conftest.$ac_ext 
     5047cat >>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 
     5058int 
     5059main () 
     5060{ 
     5061static struct stat ac_aggr; 
     5062if (ac_aggr.st_mtim) 
     5063return 0; 
     5064  ; 
     5065  return 0; 
     5066} 
     5067_ACEOF 
     5068rm -f conftest.$ac_objext 
     5069if { (ac_try="$ac_compile" 
     5070case "(($ac_try" in 
     5071  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     5072  *) ac_try_echo=$ac_try;; 
     5073esac 
     5074eval 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 
     5087else 
     5088  $as_echo "$as_me: failed program was:" >&5 
     5089sed 's/^/| /' conftest.$ac_ext >&5 
     5090 
     5091        cat >conftest.$ac_ext <<_ACEOF 
     5092/* confdefs.h.  */ 
     5093_ACEOF 
     5094cat confdefs.h >>conftest.$ac_ext 
     5095cat >>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 
     5106int 
     5107main () 
     5108{ 
     5109static struct stat ac_aggr; 
     5110if (sizeof ac_aggr.st_mtim) 
     5111return 0; 
     5112  ; 
     5113  return 0; 
     5114} 
     5115_ACEOF 
     5116rm -f conftest.$ac_objext 
     5117if { (ac_try="$ac_compile" 
     5118case "(($ac_try" in 
     5119  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     5120  *) ac_try_echo=$ac_try;; 
     5121esac 
     5122eval 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 
     5135else 
     5136  $as_echo "$as_me: failed program was:" >&5 
     5137sed 's/^/| /' conftest.$ac_ext >&5 
     5138 
     5139        ac_cv_member_struct_stat_st_mtim=no 
     5140fi 
     5141 
     5142rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     5143fi 
     5144 
     5145rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     5146fi 
     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; } 
     5149if test $ac_cv_member_struct_stat_st_mtim = yes; then 
     5150 
     5151cat >>confdefs.h <<\_ACEOF 
     5152#define HAVE_STAT_ST_MTIM 1 
     5153_ACEOF 
     5154 
     5155else 
     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; } 
     5159if test "${ac_cv_member_struct_stat_st_mtimespec+set}" = set; then 
     5160  $as_echo_n "(cached) " >&6 
     5161else 
     5162  cat >conftest.$ac_ext <<_ACEOF 
     5163/* confdefs.h.  */ 
     5164_ACEOF 
     5165cat confdefs.h >>conftest.$ac_ext 
     5166cat >>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 
     5177int 
     5178main () 
     5179{ 
     5180static struct stat ac_aggr; 
     5181if (ac_aggr.st_mtimespec) 
     5182return 0; 
     5183  ; 
     5184  return 0; 
     5185} 
     5186_ACEOF 
     5187rm -f conftest.$ac_objext 
     5188if { (ac_try="$ac_compile" 
     5189case "(($ac_try" in 
     5190  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     5191  *) ac_try_echo=$ac_try;; 
     5192esac 
     5193eval 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 
     5206else 
     5207  $as_echo "$as_me: failed program was:" >&5 
     5208sed 's/^/| /' conftest.$ac_ext >&5 
     5209 
     5210        cat >conftest.$ac_ext <<_ACEOF 
     5211/* confdefs.h.  */ 
     5212_ACEOF 
     5213cat confdefs.h >>conftest.$ac_ext 
     5214cat >>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 
     5225int 
     5226main () 
     5227{ 
     5228static struct stat ac_aggr; 
     5229if (sizeof ac_aggr.st_mtimespec) 
     5230return 0; 
     5231  ; 
     5232  return 0; 
     5233} 
     5234_ACEOF 
     5235rm -f conftest.$ac_objext 
     5236if { (ac_try="$ac_compile" 
     5237case "(($ac_try" in 
     5238  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     5239  *) ac_try_echo=$ac_try;; 
     5240esac 
     5241eval 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 
     5254else 
     5255  $as_echo "$as_me: failed program was:" >&5 
     5256sed 's/^/| /' conftest.$ac_ext >&5 
     5257 
     5258        ac_cv_member_struct_stat_st_mtimespec=no 
     5259fi 
     5260 
     5261rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     5262fi 
     5263 
     5264rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     5265fi 
     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; } 
     5268if test $ac_cv_member_struct_stat_st_mtimespec = yes; then 
     5269 
     5270cat >>confdefs.h <<\_ACEOF 
     5271#define HAVE_STAT_ST_MTIMESPEC 1 
     5272_ACEOF 
     5273 
     5274fi 
     5275 
     5276 
     5277fi 
     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; } 
     5282if test "${ac_cv_member_struct_ether_header_ether_dhost_ether_addr_octet+set}" = set; then 
     5283  $as_echo_n "(cached) " >&6 
     5284else 
     5285  cat >conftest.$ac_ext <<_ACEOF 
     5286/* confdefs.h.  */ 
     5287_ACEOF 
     5288cat confdefs.h >>conftest.$ac_ext 
     5289cat >>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 
     5300int 
     5301main () 
     5302{ 
     5303static struct ether_header ac_aggr; 
     5304if (ac_aggr.ether_dhost.ether_addr_octet) 
     5305return 0; 
     5306  ; 
     5307  return 0; 
     5308} 
     5309_ACEOF 
     5310rm -f conftest.$ac_objext 
     5311if { (ac_try="$ac_compile" 
     5312case "(($ac_try" in 
     5313  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     5314  *) ac_try_echo=$ac_try;; 
     5315esac 
     5316eval 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 
     5329else 
     5330  $as_echo "$as_me: failed program was:" >&5 
     5331sed 's/^/| /' conftest.$ac_ext >&5 
     5332 
     5333        cat >conftest.$ac_ext <<_ACEOF 
     5334/* confdefs.h.  */ 
     5335_ACEOF 
     5336cat confdefs.h >>conftest.$ac_ext 
     5337cat >>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 
     5348int 
     5349main () 
     5350{ 
     5351static struct ether_header ac_aggr; 
     5352if (sizeof ac_aggr.ether_dhost.ether_addr_octet) 
     5353return 0; 
     5354  ; 
     5355  return 0; 
     5356} 
     5357_ACEOF 
     5358rm -f conftest.$ac_objext 
     5359if { (ac_try="$ac_compile" 
     5360case "(($ac_try" in 
     5361  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     5362  *) ac_try_echo=$ac_try;; 
     5363esac 
     5364eval 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 
     5377else 
     5378  $as_echo "$as_me: failed program was:" >&5 
     5379sed 's/^/| /' conftest.$ac_ext >&5 
     5380 
     5381        ac_cv_member_struct_ether_header_ether_dhost_ether_addr_octet=no 
     5382fi 
     5383 
     5384rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     5385fi 
     5386 
     5387rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     5388fi 
     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; } 
     5391if test $ac_cv_member_struct_ether_header_ether_dhost_ether_addr_octet = yes; then 
     5392 
     5393cat >>confdefs.h <<\_ACEOF 
     5394#define HAVE_ETHER_ADDR_OCTET 1 
    48205395_ACEOF 
    48215396 
     
    53705945# values after options handling. 
    53715946ac_log=" 
    5372 This file was extended by onioncat $as_me 0.2.2.r546, which was 
     5947This file was extended by onioncat $as_me 0.2.2.r547, which was 
    53735948generated by GNU Autoconf 2.62.  Invocation command line was 
    53745949 
     
    54235998cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 
    54245999ac_cs_version="\\ 
    5425 onioncat config.status 0.2.2.r546 
     6000onioncat config.status 0.2.2.r547 
    54266001configured by $0, generated by GNU Autoconf 2.62, 
    54276002  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" 
  • trunk/configure.ac

    r546 r547  
    88AC_DEFINE(SVN_REVISION, "svnversion", [SVN Revision]) 
    99 
    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 
     11AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug],[enable debugging]),  
     12   AC_DEFINE([DEBUG], [1], [enable debugging]) 
     13   ) 
     14 
     15AC_ARG_ENABLE([packet-log], AS_HELP_STRING([--enable-packet-log],[enable packet logging]),  
     16   AC_DEFINE([PACKET_LOG], [], [enable packet logging])) 
     17 
     18AC_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 
     21AC_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 
     24AC_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 
     27AC_ARG_ENABLE([rtt], AS_HELP_STRING([--enable-rtt],[enable inband RTT measurement]),  
     28   AC_DEFINE([MEASURE_RTT], [1], [enable RTT measurement])) 
     29 
     30AC_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 
     34if test "${enable_debug+set}" = set ; then 
     35   AC_SUBST([CFLAGS], [["-Wall -g -D_POSIX_PTHREAD_SEMANTICS"]]) 
     36else 
     37   AC_SUBST([CFLAGS], [["-Wall -O2 -D_POSIX_PTHREAD_SEMANTICS"]]) 
     38fi 
    1839 
    1940# Checks for programs. 
     
    3556#AC_CHECK_LIB([readline], [main]) 
    3657 
     58AC_SEARCH_LIBS([bind], [socket]) 
     59AC_SEARCH_LIBS([inet_ntop], [nsl]) 
     60 
    3761# Checks for header files. 
    3862#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], [], [], 
     63AC_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], [], [], 
    4064[[ 
    4165#ifdef HAVE_SYS_TYPES_H 
     
    117141      [], 
    118142      [ 
    119 #include <sys/types.h> 
     143#ifdef HAVE_SYS_TYPES_H 
     144#include <sys/types.h> 
     145#endif 
     146#ifdef HAVE_SYS_SOCKET_H 
    120147#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 
     154AC_CHECK_MEMBER([struct stat.st_mtim], 
     155                [AC_DEFINE(HAVE_STAT_ST_MTIM, 1, [Do we have stat.st_mtim?])], 
     156                [ 
     157AC_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 
     178AC_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> 
    123187#endif 
    124188]) 
  • trunk/src/Makefile.am

    r538 r547  
    11bin_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 
     2ocat_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 
     3noinst_HEADERS = ocat.h ocat_netdesc.h strlcpy.c strlcat.c ocathosts.h 
    44AM_CFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" 
    55 
  • trunk/src/Makefile.in

    r546 r547  
    5959        ocatlibe.$(OBJEXT) ocatctrl.$(OBJEXT) ocatipv6route.$(OBJEXT) \ 
    6060        ocaticmp.$(OBJEXT) ocat_wintuntap.$(OBJEXT) \ 
    61         ocat_netdesc.$(OBJEXT) 
     61        ocat_netdesc.$(OBJEXT) ocathosts.$(OBJEXT) 
    6262ocat_OBJECTS = $(am_ocat_OBJECTS) 
    6363ocat_LDADD = $(LDADD) 
     
    164164sysconfdir = @sysconfdir@ 
    165165target_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 
     166ocat_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 
     167noinst_HEADERS = ocat.h ocat_netdesc.h strlcpy.c strlcat.c ocathosts.h 
    168168AM_CFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" 
    169169all: all-am 
     
    239239@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocatctrl.Po@am__quote@ 
    240240@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocateth.Po@am__quote@ 
     241@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocathosts.Po@am__quote@ 
    241242@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocaticmp.Po@am__quote@ 
    242243@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocatipv4route.Po@am__quote@ 
  • trunk/src/ocat.c

    r546 r547  
    3030         "   -B                    do not daemonize (default = %d)\n" 
    3131         "   -h                    display usage message\n" 
     32         "   -H                    ignore /etc/hosts while in GarliCat mode\n" 
    3233         "   -C                    disable local controller interface\n" 
    3334         "   -d <n>                set debug level to n, default = %d\n" 
     
    102103   } 
    103104 
    104    fprintf(f, "%d\n", getpid()); 
     105   fprintf(f, "%d\n", (int) getpid()); 
    105106   fclose(f); 
    106107   log_debug("pid_file %s created, pid = %d", CNF(pid_file), getpid()); 
     
    300301   while ((c = getopt(argc, argv, "f:I")) != -1) 
    301302   { 
    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)); 
    303304      switch (c) 
    304305      { 
     
    326327   opterr = 1; 
    327328   optind = 1; 
    328    while ((c = getopt(argc, argv, "f:IabBCd:hrRiopl: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)); 
    331332      switch (c) 
    332333      { 
     
    363364            usage(argv[0]); 
    364365            exit(1); 
     366 
     367         case 'H': 
     368            CNF(hosts_lookup) = 0; 
     369            break; 
    365370 
    366371         case 'l': 
     
    514519 
    515520   // 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])); 
    517522   if (!CNF(rand_addr)) 
    518523      strncpy(CNF(onion_url), argv[optind], NDESC(name_size)); 
  • trunk/src/ocat.h

    r546 r547  
    1919#define OCAT_H 
    2020 
     21#ifdef HAVE_CONFIG_H 
    2122#include "config.h" 
     23#endif 
    2224 
    2325#include <stdio.h> 
     
    5658#include <sys/wait.h> 
    5759#endif 
     60#ifdef HAVE_SYS_ETHERNET_H 
     61#include <sys/ethernet.h> 
     62#endif 
    5863#ifdef HAVE_NETINET_IN_H 
    5964#include <netinet/in.h> 
     
    102107#ifndef ETHERTYPE_IPV6 
    103108#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 
    104126#endif 
    105127 
     
    226248#define SYSCONFDIR "/etc" 
    227249#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 
    228262 
    229263struct OcatSetup 
     
    306340   int pid_fd[2]; 
    307341   int sig_usr1, clear_stats; 
     342   int hosts_lookup; 
    308343}; 
    309344 
     
    468503 
    469504#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 
    471510#define TUN_DEV "/dev/tun0" 
    472 #elif __OpenBSD__ 
    473 #define TUN_DEV "/dev/tun0" 
     511#endif 
     512extern char *tun_dev_; 
    474513#else 
    475 #define TUN_DEV "/dev/net/tun" 
    476 #endif 
    477 extern char *tun_dev_; 
     514#define TUN_DEV "STDIO" 
    478515#endif 
    479516 
     
    614651int win_read_tun(char *, int); 
    615652int 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  
    5353#define TOR_PREFIX_LEN 48 
    5454#if BYTE_ORDER == LITTLE_ENDIAN 
     55#ifdef __sun__ 
     56#define TOR_PREFIX4 {{{0x0000000a}}} 
     57#else 
    5558#define TOR_PREFIX4 {0x0000000a} 
     59#endif 
    5660#define TOR_PREFIX4_MASK 0x000000ff 
    5761#else 
     62#ifdef __sun__ 
     63#define TOR_PREFIX4 {{{0x0a000000}}} 
     64#else 
    5865#define TOR_PREFIX4 {0x0a000000} 
     66#endif 
    5967#define TOR_PREFIX4_MASK 0xff000000 
    6068#endif 
  • trunk/src/ocatcompat.c

    r221 r547  
    1616 */ 
    1717 
     18#ifdef HAVE_CONFIG_H 
    1819#include "config.h" 
     20#endif 
    1921 
    2022#ifndef HAVE_STRLCAT 
  • trunk/src/ocateth.c

    r539 r547  
    253253 
    254254   // ethernet header 
    255    ndp6->eth.ether_dhost[0] = 0x33; 
    256    ndp6->eth.ether_dhost[1] = 0x33; 
    257    memcpy(&ndp6->eth.ether_dhost[2], ((char*) &mcastd) + 12, 4); 
    258    memcpy(ndp6->eth.ether_shost, 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); 
    259259   ndp6->eth.ether_type = htons(ETHERTYPE_IPV6); 
    260260 
     
    276276   ohd->nd_opt_type = ND_OPT_SOURCE_LINKADDR; 
    277277   ohd->nd_opt_len = 1; 
    278    memcpy(ohd + 1, ndp6->eth.ether_shost, ETHER_ADDR_LEN); 
     278   memcpy(ohd + 1, ndp6->eth.ether_src, ETHER_ADDR_LEN); 
    279279 
    280280   // calculate checksum 
     
    311311#endif 
    312312 
    313    if (ndp6->eth.ether_dhost[0] & 1) 
     313   if (ndp6->eth.ether_dst[0] & 1) 
    314314   { 
    315315      // check for right multicast destination on ethernet 
    316       if (ndp6->eth.ether_dhost[2] != 0xff) 
    317       { 
    318          log_debug("ethernet multicast destination %s cannot be solicited node address", ether_ntoa_r((struct ether_addr*) ndp6->eth.ether_dhost, 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)); 
    319319         return -1; 
    320320      } 
     
    355355   log_debug("generating response"); 
    356356   // add source MAC to table 
    357    if (mac_set(&ndp6->ip6.ip6_src, ndp6->eth.ether_shost) == -1) 
    358       if (mac_add_entry(ndp6->eth.ether_shost, &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) 
    359359      { 
    360360         log_msg(LOG_ERR, "MAC table full"); 
     
    363363 
    364364   // set MAC addresses for response 
    365    memcpy(ndp6->eth.ether_dhost, ndp6->eth.ether_shost, ETHER_ADDR_LEN); 
    366    memcpy(ndp6->eth.ether_shost, 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); 
    367367 
    368368   // init ip6 header 
     
    406406 
    407407   // add source MAC to table 
    408    if (mac_set(&ndp6->ip6.ip6_src, ndp6->eth.ether_shost) == -1) 
    409       if (mac_add_entry(ndp6->eth.ether_shost, &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) 
    410410      { 
    411411         log_msg(LOG_ERR, "MAC table full"); 
     
    450450 
    451451   // check ethernet destination 
    452    if ((ndp6->eth.ether_dhost[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)) 
    453453   { 
    454454      log_debug("unknown destination MAC"); 
  • trunk/src/ocatfdbuf.c

    r501 r547  
    3030 *  @param fd File descriptor if open file. 
    3131 *  @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 **/ 
    3435fdFile_t* fdf_init(int fd, char delim) 
    3536{ 
  • trunk/src/ocatroute.c

    r539 r547  
    508508               if (!CNF(use_tap)) 
    509509               { 
    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])); 
    513513               } 
    514514               // create ethernet header and handle MAC on TAP device 
     
    518518 
    519519                  // FIXME: should differentiate between IPv6 and IP!! 
    520                   memset(eh->ether_dhost, 0, ETHER_ADDR_LEN); 
    521                   if (mac_set(&((struct ip6_hdr*)peer->fragbuf)->ip6_dst, eh->ether_dhost) == -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) 
    522522                  { 
    523523                     log_debug("dest MAC unknown, resolving"); 
     
    528528                     set_tunheader(buf, *peer->tunhdr); 
    529529                     memcpy(buf + 4 + sizeof(struct ether_header), peer->fragbuf, len); 
    530                      memcpy(eh->ether_shost, CNF(ocat_hwaddr), ETHER_ADDR_LEN); 
     530                     memcpy(eh->ether_src, CNF(ocat_hwaddr), ETHER_ADDR_LEN); 
    531531 
    532532                     if (*peer->tunhdr == CNF(fhd_key[IPV6_KEY])) 
     
    535535                        eh->ether_type = htons(ETHERTYPE_IP); 
    536536 
    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])); 
    544539                  } 
    545540               } 
     
    812807         break; 
    813808 
    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 #else 
    823809#ifdef __OpenBSD__ 
    824810      // workaround for OpenBSD userland threads 
     
    826812#endif 
    827813      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) 
    829815      { 
    830816         rlen = errno; 
     
    850836         continue; 
    851837      } 
    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); 
    855841 
    856842#ifdef PACKET_LOG 
     
    877863         memmove(eh, eh + 1, rlen - 4); 
    878864      } 
     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 
    879876 
    880877      if (get_tunheader(buf) == CNF(fhd_key[IPV6_KEY])) 
  • trunk/src/ocatsetup.c

    r538 r547  
    2626#include "ocat.h" 
    2727#include "ocat_netdesc.h" 
     28#include "ocathosts.h" 
    2829 
    2930 
     
    3233static struct sockaddr_in6 ctrl_listen6_; 
    3334static struct sockaddr *ctrl_listen_ptr_[] =  
    34    {(struct sockaddr*) &ctrl_listen_,  
     35{ 
     36   (struct sockaddr*) &ctrl_listen_,  
    3537#ifndef __CYGWIN__ 
    36       (struct sockaddr*) &ctrl_listen6_,  
     38   (struct sockaddr*) &ctrl_listen6_,  
    3739#endif 
    3840      NULL}; 
     
    105107   ctrl_fd_, 
    106108   // oc_listen_cnt 
    107 #ifdef __CYGWIN__ 
     109#if defined(__CYGWIN__) 
    108110   1 
    109111#else 
     
    120122   {-1, -1}, 
    121123   // sig_usr1, clear_stats 
    122    0, 0 
     124   0, 0, 
     125   // hosts_lookup 
     126   1 
    123127}; 
    124128 
     
    130134{ 
    131135   struct timeval tv; 
     136   const uint32_t loop_ = htonl(INADDR_LOOPBACK); 
    132137 
    133138   // seeding PRNG rand() 
     
    140145   memset(&socks_dst6_, 0, sizeof(socks_dst6_)); 
    141146   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)); 
    143149#ifdef HAVE_SIN_LEN 
    144150   setup_.socks_dst->sin_len = SOCKADDR_SIZE(setup_.socks_dst); 
    145151#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 
    146165} 
    147166 
     
    150169{ 
    151170   size_t l; 
     171   const uint32_t loop_ = htonl(INADDR_LOOPBACK); 
     172 
    152173   setup_.ocat_addr4 = NDESC(prefix4); 
    153174   setup_.ocat_addr4_mask = NDESC(addr4_mask); 
     
    166187   ctrl_listen_.sin_family = AF_INET; 
    167188   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)); 
    169191#ifdef HAVE_SIN_LEN 
    170192   ctrl_listen_.sin_len = sizeof(ctrl_listen_); 
     
    248270         "pid_fd[2]              = {%d, %d}\n" 
    249271         "clear_stats            = %d\n" 
     272         "ctrl_listen_cnt        = %d\n" 
     273         "hosts_lookup           = %d\n" 
    250274         , 
    251275         IPV4_KEY, ntohl(setup_.fhd_key[IPV4_KEY]), IPV6_KEY, ntohl(setup_.fhd_key[IPV6_KEY]), 
     
    274298         hw, 
    275299         setup_.pid_file, 
    276          setup_.logfn, 
     300         SSTR(setup_.logfn), 
    277301         logf, 
    278302         setup_.daemon, 
     
    284308         setup_.max_ctrl, setup_.ctrl_active, 
    285309         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 
    287313         ); 
    288314 
     
    315341      fprintf(f, "oc_listen_fd[%d]        = %d\n", i, CNF(oc_listen_fd)[i]); 
    316342   } 
     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   } 
    317351} 
    318352 
  • trunk/src/ocatsocks.c

    r534 r547  
    2727#include "ocat.h" 
    2828#include "ocat_netdesc.h" 
     29#include "ocathosts.h" 
    2930 
    3031 
     
    3738int socks_send_request(const SocksQueue_t *sq) 
    3839{ 
    39    int len, ret; 
    40    char buf[SOCKS_BUFLEN], onion[NDESC(name_size)]; 
     40   int len, ret = -1; 
     41   char buf[SOCKS_BUFLEN], onion[NI_MAXHOST]; 
    4142   SocksHdr_t *shdr = (SocksHdr_t*) buf; 
    4243 
    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); 
    4667 
    4768   log_debug("doing SOCKS4a handshake"); 
  • trunk/src/ocattun.c

    r534 r547  
    2323 */ 
    2424 
    25 #ifndef WITHOUT_TUN 
    2625 
    2726 
     
    2928#include "ocat_netdesc.h" 
    3029 
     30#ifndef WITHOUT_TUN 
    3131 
    3232char *tun_dev_ = TUN_DEV; 
    3333 
    3434#define IFCBUF 1024 
     35 
     36 
     37void 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 
    3547 
    3648int tun_alloc(char *dev, int dev_s, struct in6_addr addr) 
     
    3951   struct ifreq ifr; 
    4052#endif 
     53#ifdef __sun__ 
     54   int ppa = -1; 
     55#endif 
    4156   int fd; 
    4257   char astr[INET6_ADDRSTRLEN]; 
    4358   char astr4[INET_ADDRSTRLEN]; 
    4459   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)); 
    4763   inet_ntop(AF_INET6, &addr, astr, INET6_ADDRSTRLEN); 
    4864   inet_ntop(AF_INET, &CNF(ocat_addr4), astr4, INET_ADDRSTRLEN); 
     
    5874 
    5975   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); 
    6377 
    6478   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); 
    6880 
    6981   return 0; 
     
    94106   { 
    95107      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); 
    99109   } 
    100110 
     
    105115      */ 
    106116 
    107    // set tun frame header to ethertype IPv6 
    108    CNF(fhd_key[IPV6_KEY]) = htonl(ETHERTYPE_IPV6); 
    109    CNF(fhd_key[IPV4_KEY]) = htonl(ETHERTYPE_IP); 
    110  
    111117#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); 
    116118 
    117119   // get interface name 
     
    166168#endif /* __linux__ */ 
    167169 
     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 
    168177 
    169178   if (!CNF(use_tap)) 
     
    171180#ifdef __OpenBSD__ 
    172181      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); 
    173184#else 
    174185      snprintf(buf, sizeof(buf), "ifconfig %s inet6 %s/%d up", dev, astr, NDESC(prefix_len)); 
    175186#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 
    180190#ifdef __APPLE__ 
    181  
    182191      // MacOSX requires the route to be set up manually 
    183192      // FIXME: the prefix shouldn't be hardcoded here 
    184193      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); 
    189200#endif 
    190201 
     
    197208   { 
    198209      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); 
    202211   } 
    203212 
     
    206215   { 
    207216      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); 
    211218   } 
    212219 
  • trunk/src/ocatv6conv.c

    r534 r547  
    8181   { 
    8282      shl5((char*) ip6); 
    83       j = toupper(onion[i]); 
     83      j = toupper((int) onion[i]); 
    8484      if ((j < '2') || (j > 'Z')) 
    8585         return -1; 
Note: See TracChangeset for help on using the changeset viewer.