summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-06-08 20:13:04 +0000
committerChristian Grothoff <christian@grothoff.org>2009-06-08 20:13:04 +0000
commit9c4a3cd49e5bcf2ba9995c0e344498060ac0a466 (patch)
tree987c88a0e849b7f7eca2e863f2194475ebb51f3d
parent231af2b9e9f19d407cd174eeca2013d1363bf553 (diff)
debug code
-rw-r--r--m4/argz.m44
-rw-r--r--m4/libtool.m4131
-rw-r--r--m4/ltdl.m432
-rw-r--r--m4/ltoptions.m42
-rw-r--r--m4/ltsugar.m420
-rw-r--r--m4/ltversion.m410
-rw-r--r--src/core/core.h2
-rw-r--r--src/core/gnunet-service-core.c7
-rw-r--r--src/core/test_core_api.c2
-rw-r--r--src/core/test_core_api_peer1.conf8
-rw-r--r--src/core/test_core_api_peer2.conf8
-rw-r--r--src/include/gnunet_common.h14
-rw-r--r--src/resolver/test_resolver_api.c23
-rw-r--r--src/transport/gnunet-service-transport.c40
-rw-r--r--src/transport/plugin_transport_tcp.c55
-rw-r--r--src/transport/transport.h2
-rw-r--r--src/transport/transport_api.c9
-rw-r--r--src/util/common_logging.c46
-rw-r--r--src/util/network.c38
-rw-r--r--src/util/service.c12
20 files changed, 271 insertions, 194 deletions
diff --git a/m4/argz.m4 b/m4/argz.m4
index edc99bbce..37c1b11e4 100644
--- a/m4/argz.m4
+++ b/m4/argz.m4
@@ -28,14 +28,14 @@ ARGZ_H=
AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \
argz_next argz_stringify], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])])
-dnl if have system argz functions, allow forced use of
+dnl if have system argz functions, allow forced use of
dnl libltdl-supplied implementation (and default to do so
dnl on "known bad" systems). Could use a runtime check, but
dnl (a) detecting malloc issues is notoriously unreliable
dnl (b) only known system that declares argz functions,
dnl provides them, yet they are broken, is cygwin
dnl releases prior to 16-Mar-2007 (1.5.24 and earlier)
-dnl So, it's more straightforward simply to special case
+dnl So, it's more straightforward simply to special case
dnl this for known bad systems.
AS_IF([test -z "$ARGZ_H"],
[AC_CACHE_CHECK(
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 6e86e5b43..1e7ea47c0 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -380,12 +380,12 @@ m4_define([lt_decl_dquote_varnames],
# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
# ---------------------------------------------------
m4_define([lt_decl_varnames_tagged],
-[_$0(m4_quote(m4_default([$1], [[, ]])),
- m4_quote(m4_if([$2], [],
- m4_quote(lt_decl_tag_varnames),
- m4_quote(m4_shift($@)))),
- m4_split(m4_normalize(m4_quote(_LT_TAGS))))])
-m4_define([_lt_decl_varnames_tagged], [lt_combine([$1], [$2], [_], $3)])
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+ m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
@@ -945,10 +945,10 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
_lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
darwin1.*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- darwin*) # darwin 5.x on
+ darwin*) # darwin 5.x on
# if running on 10.5 or later, the deployment target defaults
# to the OS version, if on x86, and 10.4, the deployment
- # target defaults to 10.4. Don't you love it?
+ # target defaults to 10.4. Don't you love it?
case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
@@ -990,7 +990,11 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
_LT_TAGVAR(whole_archive_flag_spec, $1)=''
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
- if test "$GCC" = "yes"; then
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=echo
_LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
_LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
@@ -1512,7 +1516,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
lt_cv_sys_max_cmd_len=-1;
;;
- cygwin* | mingw*)
+ cygwin* | mingw* | cegcc*)
# On Win9x/ME, this test blows up -- it succeeds, but takes
# about 5 minutes as the teststring grows exponentially.
# Worse, since 9x/ME are not pre-emptively multitasking,
@@ -1680,10 +1684,6 @@ else
# endif
#endif
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
-
void fnord() { int i=42;}
int main ()
{
@@ -1699,7 +1699,7 @@ int main ()
else
puts (dlerror ());
- exit (status);
+ return status;
}]
_LT_EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
@@ -1738,7 +1738,7 @@ else
lt_cv_dlopen_self=yes
;;
- mingw* | pw32*)
+ mingw* | pw32* | cegcc*)
lt_cv_dlopen="LoadLibrary"
lt_cv_dlopen_libs=
;;
@@ -2035,6 +2035,7 @@ m4_defun([_LT_SYS_DYNAMIC_LINKER],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
m4_require([_LT_DECL_SED])dnl
AC_MSG_CHECKING([dynamic linker characteristics])
m4_if([$1],
@@ -2199,14 +2200,14 @@ bsdi[[45]]*)
# libtool to hard-code these into programs
;;
-cygwin* | mingw* | pw32*)
+cygwin* | mingw* | pw32* | cegcc*)
version_type=windows
shrext_cmds=".dll"
need_version=no
need_lib_prefix=no
case $GCC,$host_os in
- yes,cygwin* | yes,mingw* | yes,pw32*)
+ yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
library_names_spec='$libname.dll.a'
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \${file}`~
@@ -2229,7 +2230,7 @@ cygwin* | mingw* | pw32*)
soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
;;
- mingw*)
+ mingw* | cegcc*)
# MinGW DLLs use traditional 'lib' prefix
soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
@@ -2667,7 +2668,7 @@ tpf*)
version_type=linux
need_lib_prefix=no
need_version=no
- library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
@@ -2691,7 +2692,7 @@ variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
if test "$GCC" = yes; then
variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
fi
-
+
if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
fi
@@ -2968,6 +2969,7 @@ _LT_DECL([], [reload_cmds], [2])dnl
# -- PORTME fill in with the dynamic library characteristics
m4_defun([_LT_CHECK_MAGIC_METHOD],
[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
AC_CACHE_CHECK([how to recognize dependent libraries],
lt_cv_deplibs_check_method,
[lt_cv_file_magic_cmd='$MAGIC_CMD'
@@ -3018,6 +3020,12 @@ mingw* | pw32*)
fi
;;
+cegcc)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
darwin* | rhapsody*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -3329,7 +3337,7 @@ case $host_os in
aix*)
symcode='[[BCDT]]'
;;
-cygwin* | mingw* | pw32*)
+cygwin* | mingw* | pw32* | cegcc*)
symcode='[[ABCDGISTW]]'
;;
hpux*)
@@ -3575,7 +3583,7 @@ m4_if([$1], [CXX], [
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
- mingw* | cygwin* | os2* | pw32*)
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -3602,10 +3610,11 @@ m4_if([$1], [CXX], [
fi
;;
hpux*)
- # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
- # not for PA HP-UX.
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
case $host_cpu in
- hppa*64*|ia64*)
+ hppa*64*)
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
@@ -3703,12 +3712,19 @@ m4_if([$1], [CXX], [
_LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
- icpc* | ecpc* )
- # Intel C++
+ ecpc* )
+ # old Intel C++ for x86_64 which still supported -KPIC.
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
+ icpc* )
+ # Intel C++, used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
pgCC* | pgcpp*)
# Portland Group C++ compiler
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
@@ -3874,7 +3890,7 @@ m4_if([$1], [CXX], [
# PIC is the default for these OSes.
;;
- mingw* | cygwin* | pw32* | os2*)
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -3890,10 +3906,11 @@ m4_if([$1], [CXX], [
;;
hpux*)
- # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
- # not for PA HP-UX.
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
case $host_cpu in
- hppa*64*|ia64*)
+ hppa*64*)
# +Z the default
;;
*)
@@ -3943,7 +3960,7 @@ m4_if([$1], [CXX], [
fi
;;
- mingw* | cygwin* | pw32* | os2*)
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
m4_if([$1], [GCJ], [],
@@ -3974,11 +3991,25 @@ m4_if([$1], [CXX], [
linux* | k*bsd*-gnu)
case $cc_basename in
- icc* | ecc* | ifort*)
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+ ;;
pgcc* | pgf77* | pgf90* | pgf95*)
# Portland Group compilers (*not* the Pentium gcc compiler,
# which looks to be a dead project)
@@ -4160,7 +4191,7 @@ m4_if([$1], [CXX], [
pw32*)
_LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
;;
- cygwin* | mingw*)
+ cygwin* | mingw* | cegcc*)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
;;
linux* | k*bsd*-gnu)
@@ -4215,7 +4246,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
extract_expsyms_cmds=
case $host_os in
- cygwin* | mingw* | pw32*)
+ cygwin* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
@@ -4230,6 +4261,9 @@ dnl Note also adjust exclude_expsyms for C++ above.
openbsd*)
with_gnu_ld=no
;;
+ linux* | k*bsd*-gnu)
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ ;;
esac
_LT_TAGVAR(ld_shlibs, $1)=yes
@@ -4302,7 +4336,7 @@ _LT_EOF
fi
;;
- cygwin* | mingw* | pw32*)
+ cygwin* | mingw* | pw32* | cegcc*)
# _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
@@ -4368,6 +4402,9 @@ _LT_EOF
tmp_addflag=' -i_dynamic -nofor_main' ;;
ifc* | ifort*) # Intel Fortran compiler
tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ tmp_sharedflag='--shared' ;;
xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
tmp_sharedflag='-qmkshrobj'
tmp_addflag= ;;
@@ -4600,6 +4637,7 @@ _LT_EOF
fi
fi
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
# It seems that -bexpall does not export symbols beginning with
# underscore (_), so it is better to generate a list of symbols to export.
_LT_TAGVAR(always_export_symbols, $1)=yes
@@ -4654,7 +4692,7 @@ _LT_EOF
_LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
;;
- cygwin* | mingw* | pw32*)
+ cygwin* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -4758,7 +4796,7 @@ _LT_EOF
_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
@@ -5543,6 +5581,7 @@ if test "$_lt_caught_CXX_error" != yes; then
fi
fi
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
# It seems that -bexpall does not export symbols beginning with
# underscore (_), so it is better to generate a list of symbols to
# export.
@@ -5601,7 +5640,7 @@ if test "$_lt_caught_CXX_error" != yes; then
esac
;;
- cygwin* | mingw* | pw32*)
+ cygwin* | mingw* | pw32* | cegcc*)
# _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
@@ -6986,6 +7025,18 @@ AC_SUBST([GREP])
])
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+
# _LT_DECL_SED
# ------------
# Check for a fully-functional sed program, that truncates
diff --git a/m4/ltdl.m4 b/m4/ltdl.m4
index eb8db0cd1..46535e2e1 100644
--- a/m4/ltdl.m4
+++ b/m4/ltdl.m4
@@ -7,7 +7,7 @@
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
-# serial 15 LTDL_INIT
+# serial 17 LTDL_INIT
# LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE])
# ------------------------------------------
@@ -212,26 +212,10 @@ m4_define([$0], [])
# of into LIBOBJS.
AC_DEFUN([_LT_LIBOBJ], [
m4_pattern_allow([^_LT_LIBOBJS$])
- AS_LITERAL_IF([$1], [_LT_LIBSOURCES([$1.c])])dnl
_LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext"
])# _LT_LIBOBJS
-# _LT_LIBSOURCES(MODULE_NAMES)
-# ----------------------------
-# Like AC_LIBSOURCES, except the directory where the libltdl source files
-# are expected is distinct from the user LIBOBJ directory.
-AC_DEFUN([_LT_LIBSOURCES], [
- m4_foreach([_LTNAME], [$1], [
- m4_syscmd([test -r "$lt_libobj_prefix]_LTNAME[" ||
- test -z "$lt_libobj_prefix" ||
- test ! -d "$lt_libobj_prefix"])dnl
- m4_if(m4_sysval, [0], [],
- [AC_FATAL([missing $lt_libobj_prefix/]_LTNAME)])
- ])
-])# _LT_LIBSOURCES
-
-
# LTDL_INIT([OPTIONS])
# --------------------
# Clients of libltdl can use this macro to allow the installer to
@@ -245,9 +229,9 @@ _LT_SET_OPTIONS([$0], [$1])
dnl We need to keep our own list of libobjs separate from our parent project,
dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while
-dnl we look for our own LIBOBJs. Definitions in ltdl-libobj.m4.
+dnl we look for our own LIBOBJs.
m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ]))
-m4_pushdef([AC_LIBSOURCES], m4_defn([_LT_LIBSOURCES]))
+m4_pushdef([AC_LIBSOURCES])
dnl If not otherwise defined, default to the 1.5.x compatible subproject mode:
m4_if(_LTDL_MODE, [],
@@ -264,7 +248,7 @@ if test "x$with_included_ltdl" != xyes; then
# decide whether there is a useful installed version we can use.
AC_CHECK_HEADER([ltdl.h],
[AC_CHECK_DECL([lt_dlinterface_register],
- [AC_CHECK_LIB([ltdl], [lt_dlinterface_register],
+ [AC_CHECK_LIB([ltdl], [lt_dladvise_preload],
[with_included_ltdl=no],
[with_included_ltdl=yes])],
[with_included_ltdl=yes],
@@ -396,12 +380,6 @@ m4_require([_LT_HEADER_DLFCN])dnl
m4_require([_LT_CHECK_DLPREOPEN])dnl
m4_require([_LT_DECL_SED])dnl
-# lt_cv_dlopen_self gets defined by LT_SYS_DLOPEN_SELF, called by LT_INIT
-if test "$lt_cv_dlopen_self" = yes; then
- AC_DEFINE([LTDL_DLOPEN_SELF_WORKS], [1],
- [Define if dlopen(NULL) is able to resolve symbols from the main program.])
-fi
-
dnl Don't require this, or it will be expanded earlier than the code
dnl that sets the variables it relies on:
_LT_ENABLE_INSTALL
@@ -429,6 +407,8 @@ AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h],
AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])])
AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])])
+AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension])
+
name=ltdl
LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""`
AC_SUBST([LTDLOPEN])
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
index e97011948..34151a3ba 100644
--- a/m4/ltoptions.m4
+++ b/m4/ltoptions.m4
@@ -125,7 +125,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4
index 0d258e070..9000a057d 100644
--- a/m4/ltsugar.m4
+++ b/m4/ltsugar.m4
@@ -1,13 +1,13 @@
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
#
-# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
-# Written by Gary V. Vaughan, 2004
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
-# serial 5 ltsugar.m4
+# serial 6 ltsugar.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
@@ -63,14 +63,14 @@ m4_define([lt_append],
# Produce a SEP delimited list of all paired combinations of elements of
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
m4_define([lt_combine],
-[m4_if([$2], [], [],
- [m4_if([$4], [], [],
- [lt_join(m4_quote(m4_default([$1], [[, ]])),
- lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2],
- [m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]),
- [_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl
-])
+[m4_if(m4_eval([$# > 3]), [1],
+ [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+ [m4_foreach([_Lt_suffix],
+ ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+ [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4
index 45cb1557c..b8e154fe6 100644
--- a/m4/ltversion.m4
+++ b/m4/ltversion.m4
@@ -9,15 +9,15 @@
# Generated from ltversion.in.
-# serial 2976 ltversion.m4
+# serial 3012 ltversion.m4
# This file is part of GNU Libtool
-m4_define([LT_PACKAGE_VERSION], [2.2.4])
-m4_define([LT_PACKAGE_REVISION], [1.2976])
+m4_define([LT_PACKAGE_VERSION], [2.2.6])
+m4_define([LT_PACKAGE_REVISION], [1.3012])
AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.4'
-macro_revision='1.2976'
+[macro_version='2.2.6'
+macro_revision='1.3012'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])
diff --git a/src/core/core.h b/src/core/core.h
index 840c7e143..9f520bf40 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -26,7 +26,7 @@
#include "gnunet_crypto_lib.h"
#include "gnunet_time_lib.h"
-#define DEBUG_CORE GNUNET_NO
+#define DEBUG_CORE GNUNET_YES
/**
* Definition of bits in the InitMessage's options field that specify
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c
index 2fbb4ca05..44df8a867 100644
--- a/src/core/gnunet-service-core.c
+++ b/src/core/gnunet-service-core.c
@@ -1606,6 +1606,8 @@ send_connect_continuation (void *cls, size_t size, void *buf)
"Asked to send message to disconnected peer `%4s' and connection failed. Discarding message.\n",
GNUNET_i2s (&sm->peer));
GNUNET_free (sm);
+ /* FIXME: do we need to do something here to let the
+ client know about the failure!? */
return 0;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1659,8 +1661,9 @@ handle_client_send (void *cls,
if (n == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Not yet connected to `%4s', will try to establish connection\n",
- GNUNET_i2s (&sm->peer));
+ "Not yet connected to `%4s', will try to establish connection within %llu ms\n",
+ GNUNET_i2s (&sm->peer),
+ sm->deadline.value);
msize += sizeof (struct SendMessage);
/* ask transport to connect to the peer */
/* FIXME: this code does not handle the
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c
index e1b3dcd0d..1151f3ebb 100644
--- a/src/core/test_core_api.c
+++ b/src/core/test_core_api.c
@@ -34,7 +34,7 @@
#include "gnunet_scheduler_lib.h"
#include "gnunet_transport_service.h"
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_YES
#define START_ARM GNUNET_YES
diff --git a/src/core/test_core_api_peer1.conf b/src/core/test_core_api_peer1.conf
index fb060e3e6..3c7020688 100644
--- a/src/core/test_core_api_peer1.conf
+++ b/src/core/test_core_api_peer1.conf
@@ -9,9 +9,9 @@ PORT = 12464
[transport]
PORT = 12465
PLUGINS = tcp
-#PREFIX = xterm -T transport1 -e
+PREFIX = xterm -T transport1 -e
#PREFIX = xterm -T transport1 -e valgrind --tool=memcheck
-#DEBUG = YES
+DEBUG = YES
[arm]
PORT = 12466
@@ -33,8 +33,8 @@ PORT = 12469
PORT = 12470
#PREFIX = xterm -T core1 -e valgrind --tool=memcheck
#PREFIX = xterm -T core1 -e gdb -x cmd --args
-#PREFIX = xterm -T core1 -e
-#DEBUG = YES
+PREFIX = xterm -T core1 -e
+DEBUG = YES
[testing]
WEAKRANDOM = YES
diff --git a/src/core/test_core_api_peer2.conf b/src/core/test_core_api_peer2.conf
index e3862da0f..2e994d27a 100644
--- a/src/core/test_core_api_peer2.conf
+++ b/src/core/test_core_api_peer2.conf
@@ -9,9 +9,9 @@ PORT = 22464
[transport]
PORT = 22465
PLUGINS = tcp
-#PREFIX = xterm -T transport2 -e
+PREFIX = xterm -T transport2 -e
#PREFIX = xterm -T transport2 -e valgrind --tool=memcheck
-#DEBUG = YES
+DEBUG = YES
[arm]
PORT = 22466
@@ -31,9 +31,9 @@ PORT = 22469
[core]
PORT = 22470
-#PREFIX = xterm -T core2 -e
+PREFIX = xterm -T core2 -e
#PREFIX = xterm -T core2 -e valgrind --tool=memcheck
-#DEBUG = YES
+DEBUG = YES
[testing]
WEAKRANDOM = YES
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 61b572eb8..afc9b0bcb 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -217,6 +217,20 @@ void GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls);
*/
const char *GNUNET_i2s (const struct GNUNET_PeerIdentity *pid);
+
+/**
+ * Convert a "struct sockaddr*" (IPv4 or IPv6 address) to a string
+ * (for printing debug messages). This is one of the very few calls
+ * in the entire API that is NOT reentrant!
+ *
+ * @param addr the address
+ * @param addrlen the length of the address
+ * @return nicely formatted string for the address
+ * will be overwritten by next call to GNUNET_a2s.
+ */
+const char *GNUNET_a2s (const struct sockaddr *addr,
+ socklen_t addrlen);
+
/**
* Convert error type to string.
*
diff --git a/src/resolver/test_resolver_api.c b/src/resolver/test_resolver_api.c
index 240879d73..cadd52e0c 100644
--- a/src/resolver/test_resolver_api.c
+++ b/src/resolver/test_resolver_api.c
@@ -44,26 +44,9 @@ check_hostname (void *cls, const struct sockaddr *sa, socklen_t salen)
(*ok) &= ~8;
return;
}
- if (salen == sizeof (struct sockaddr_in))
- {
- struct sockaddr_in *in = (struct sockaddr_in *) sa;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Got IP address `%s' for our host.\n"),
- inet_ntop (AF_INET, &in->sin_addr, buf, sizeof (buf)));
- }
- else if (salen == sizeof (struct sockaddr_in6))
- {
- struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) sa;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Got IP address `%s' for our host.\n"),
- inet_ntop (AF_INET6, &in6->sin6_addr, buf, sizeof (buf)));
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Got address of bogus length %u\n"), salen);
- GNUNET_assert (0);
- }
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ _("Got IP address `%s' for our host.\n"),
+ GNUNET_a2s (sa, salen));
}
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index c44d5ef04..18b50b38a 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -753,6 +753,8 @@ transmit_to_client_callback (void *cls, size_t size, void *buf)
if (buf == NULL)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transmission to client failed, closing connection.\n");
/* fatal error with client, free message queue! */
while (NULL != (q = client->message_queue_head))
{
@@ -927,9 +929,15 @@ transmit_send_continuation (void *cls,
GNUNET_assert (rl != NULL);
}
if (result == GNUNET_OK)
- rl->timeout = GNUNET_TIME_relative_to_absolute (IDLE_CONNECTION_TIMEOUT);
+ {
+ rl->timeout = GNUNET_TIME_relative_to_absolute (IDLE_CONNECTION_TIMEOUT);
+ }
else
- rl->connected = GNUNET_NO;
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transmission failed, marking connection as down.\n");
+ rl->connected = GNUNET_NO;
+ }
if (!mq->internal_msg)
rl->transmit_ready = GNUNET_YES;
if (mq->client != NULL)
@@ -1389,7 +1397,8 @@ plugin_env_notify_address (void *cls,
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Plugin `%s' informs us about a new address\n", name);
+ "Plugin `%s' informs us about a new address `%s'\n", name,
+ GNUNET_a2s(addr, addrlen));
#endif
abex = GNUNET_TIME_relative_to_absolute (expires);
GNUNET_assert (p == find_transport (name));
@@ -1618,7 +1627,7 @@ cleanup_validation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
else
pos = prev->next;
continue;
- }
+ }
prev = pos;
pos = pos->next;
}
@@ -1654,6 +1663,7 @@ struct CheckHelloValidatedContext
* Validation list being build.
*/
struct ValidationList *e;
+
};
@@ -1671,6 +1681,7 @@ run_validation (void *cls,
struct TransportPlugin *tp;
struct ValidationAddress *va;
struct ValidationChallengeMessage *vcm;
+ struct GNUNET_PeerIdentity id;
tp = find_transport (tname);
if (tp == NULL)
@@ -1682,6 +1693,16 @@ run_validation (void *cls,
tname);
return GNUNET_OK;
}
+ GNUNET_CRYPTO_hash (&e->publicKey,
+ sizeof (struct
+ GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
+ &id.hashPubKey);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Scheduling validation of address `%s' via `%s' for `%4s'\n",
+ GNUNET_a2s(addr, addrlen),
+ tname,
+ GNUNET_i2s(&id));
+
va = GNUNET_malloc (sizeof (struct ValidationAddress) +
sizeof (struct ValidationChallengeMessage) + addrlen);
va->next = e->addresses;
@@ -1699,7 +1720,7 @@ run_validation (void *cls,
vcm->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_HELLO);
vcm->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
(unsigned int) -1);
- /* Note: vcm->target is set in check_hello_validated */
+ vcm->target = id;
memcpy (&vcm[1], addr, addrlen);
return GNUNET_OK;
}
@@ -1752,10 +1773,6 @@ check_hello_validated (void *cls,
va = chvc->e->addresses;
while (va != NULL)
{
- GNUNET_CRYPTO_hash (&chvc->e->publicKey,
- sizeof (struct
- GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
- &va->msg->target.hashPubKey);
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Establishing `%s' connection to validate `%s' of `%4s' (sending our `%s')\n",
@@ -1841,6 +1858,11 @@ process_hello (struct TransportPlugin *plugin,
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)))
{
/* TODO: call to stats? */
+#if DEBUG_TRANSPORT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "`%s' message for peer `%4s' is already pending; ignoring new message\n",
+ "HELLO", GNUNET_i2s (&target));
+#endif
return GNUNET_OK;
}
e = e->next;
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 6ebb257a1..4ab555ad6 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -38,7 +38,7 @@
#include "plugin_transport.h"
#include "transport.h"
-#define DEBUG_TCP GNUNET_NO
+#define DEBUG_TCP GNUNET_YES
/**
* After how long do we expire an address that we
@@ -440,8 +440,6 @@ connect_and_create_session (struct Plugin *plugin,
struct GNUNET_NETWORK_SocketHandle *conn;
struct Session *session;
int af;
- char buf[INET6_ADDRSTRLEN];
- uint16_t port;
session = plugin->sessions;
while (session != NULL)
@@ -456,20 +454,9 @@ connect_and_create_session (struct Plugin *plugin,
}
if (addrlen == sizeof (struct sockaddr_in))
- {
- af = AF_INET;
- inet_ntop (af,
- &((struct sockaddr_in *) addr)->sin_addr, buf, sizeof (buf));
- port = ntohs (((struct sockaddr_in *) addr)->sin_port);
- }
+ af = AF_INET;
else if (addrlen == sizeof (struct sockaddr_in6))
- {
- af = AF_INET6;
- inet_ntop (af,
- &((struct sockaddr_in6 *) addr)->sin6_addr,
- buf, sizeof (buf));
- port = ntohs (((struct sockaddr_in6 *) addr)->sin6_port);
- }
+ af = AF_INET6;
else
{
GNUNET_break_op (0);
@@ -485,8 +472,8 @@ connect_and_create_session (struct Plugin *plugin,
#if DEBUG_TCP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"tcp",
- "Failed to create connection to peer at `%s:%u'.\n",
- buf, port);
+ "Failed to create connection to peer at `%s'.\n",
+ GNUNET_a2s(addr, addrlen));
#endif
return NULL;
}
@@ -499,8 +486,10 @@ connect_and_create_session (struct Plugin *plugin,
#if DEBUG_TCP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"tcp",
- "Creating new session %p with `%s:%u' based on `%s' request.\n",
- session, buf, port, "send_to");
+ "Creating new session %p with `%s' based on `%s' request.\n",
+ session,
+ GNUNET_a2s(addr, addrlen),
+ "send_to");
#endif
return session;
}
@@ -541,7 +530,9 @@ do_transmit (void *cls, size_t size, void *buf)
{
#if DEBUG_TCP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
- "tcp", "Timeout trying to transmit\n");
+ "tcp",
+ "Timeout trying to transmit to peer `%4s', discarding message queue.\n",
+ GNUNET_i2s(&session->target));
#endif
/* timeout */
while (NULL != (pm = session->pending_messages))
@@ -1095,7 +1086,11 @@ tcp_plugin_cancel (void *cls,
struct PendingMessage *pm;
struct Session *session;
struct Session *next;
-
+
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "tcp",
+ "Asked to close session with `%4s'\n",
+ GNUNET_i2s(target));
session = plugin->sessions;
while (session != NULL)
{
@@ -1315,8 +1310,6 @@ tcp_plugin_address_suggested (void *cls, const void *addr, size_t addrlen)
char buf[sizeof (struct sockaddr_in6)];
struct sockaddr_in *v4;
struct sockaddr_in6 *v6;
- char dst[INET6_ADDRSTRLEN];
- uint16_t port;
if ((addrlen != sizeof (struct sockaddr_in)) &&
(addrlen != sizeof (struct sockaddr_in6)))
@@ -1329,21 +1322,17 @@ tcp_plugin_address_suggested (void *cls, const void *addr, size_t addrlen)
{
v4 = (struct sockaddr_in *) buf;
v4->sin_port = htons (check_port (plugin, ntohs (v4->sin_port)));
- inet_ntop (AF_INET, &v4->sin_addr, dst, sizeof (dst));
- port = ntohs (v4->sin_port);
}
else
{
v6 = (struct sockaddr_in6 *) buf;
v6->sin6_port = htons (check_port (plugin, ntohs (v6->sin6_port)));
- inet_ntop (AF_INET6, &v6->sin6_addr, dst, sizeof (dst));
- port = ntohs (v6->sin6_port);
}
#if DEBUG_TCP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"tcp",
- "Informing transport service about my address `%s:%u'.\n",
- dst, port);
+ "Informing transport service about my address `%s'.\n",
+ GNUNET_a2s(addr, addrlen));
#endif
plugin->env->notify_address (plugin->env->cls,
"tcp",
@@ -1627,7 +1616,6 @@ process_interfaces (void *cls,
const struct sockaddr *addr, socklen_t addrlen)
{
struct Plugin *plugin = cls;
- char dst[INET6_ADDRSTRLEN];
int af;
struct sockaddr_in *v4;
struct sockaddr_in6 *v6;
@@ -1636,19 +1624,18 @@ process_interfaces (void *cls,
if (af == AF_INET)
{
v4 = (struct sockaddr_in *) addr;
- inet_ntop (AF_INET, &v4->sin_addr, dst, sizeof (dst));
v4->sin_port = htons (plugin->adv_port);
}
else
{
GNUNET_assert (af == AF_INET6);
v6 = (struct sockaddr_in6 *) addr;
- inet_ntop (AF_INET6, &v6->sin6_addr, dst, sizeof (dst));
v6->sin6_port = htons (plugin->adv_port);
}
GNUNET_log_from (GNUNET_ERROR_TYPE_INFO |
GNUNET_ERROR_TYPE_BULK,
- "tcp", _("Found address `%s' (%s)\n"), dst, name);
+ "tcp", _("Found address `%s' (%s)\n"),
+ GNUNET_a2s(addr, addrlen), name);
plugin->env->notify_address (plugin->env->cls,
"tcp",
addr, addrlen, GNUNET_TIME_UNIT_FOREVER_REL);
diff --git a/src/transport/transport.h b/src/transport/transport.h
index 8e1291005..8ad26f2c1 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -27,7 +27,7 @@
#include "gnunet_time_lib.h"
#include "gnunet_transport_service.h"
-#define DEBUG_TRANSPORT GNUNET_NO
+#define DEBUG_TRANSPORT GNUNET_YES
/**
* For how long do we allow unused bandwidth
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index 8bca5084d..f7ce56afc 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -1564,16 +1564,17 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
remove_neighbour (h, &dim->peer);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK:
-#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Receiving `%s' message.\n", "SEND_OK");
-#endif
if (size != sizeof (struct SendOkMessage))
{
GNUNET_break (0);
break;
}
okm = (const struct SendOkMessage *) msg;
+#if DEBUG_TRANSPORT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Receiving `%s' message, transmission %s.\n", "SEND_OK",
+ ntohl(okm->success) == GNUNET_OK ? "succeeded" : "failed");
+#endif
n = find_neighbour (h, &okm->peer);
GNUNET_assert (n != NULL);
n->transmit_ok = GNUNET_YES;
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 2fdd17ca7..8ea099122 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -398,6 +398,52 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid)
return (const char *) ret.encoding;
}
+
+
+/**
+ * Convert a "struct sockaddr*" (IPv4 or IPv6 address) to a string
+ * (for printing debug messages). This is one of the very few calls
+ * in the entire API that is NOT reentrant!
+ *
+ * @param addr the address
+ * @param addrlen the length of the address
+ * @return nicely formatted string for the address
+ * will be overwritten by next call to GNUNET_a2s.
+ */
+const char *GNUNET_a2s (const struct sockaddr *addr,
+ socklen_t addrlen)
+{
+ static char buf[INET6_ADDRSTRLEN+8];
+ static char b2[6];
+ const struct sockaddr_in * v4;
+ const struct sockaddr_in6 *v6;
+ switch (addr->sa_family)
+ {
+ case AF_INET:
+ v4 = (const struct sockaddr_in*)addr;
+ inet_ntop(AF_INET, &v4->sin_addr, buf, INET_ADDRSTRLEN);
+ if (0 == ntohs(v4->sin_port))
+ return buf;
+ strcat (buf, ":");
+ sprintf (b2, "%u", ntohs(v4->sin_port));
+ strcat (buf, b2);
+ return buf;
+ case AF_INET6:
+ v6 = (const struct sockaddr_in6*)addr;
+ buf[0] = '[';
+ inet_ntop(AF_INET6, &v6->sin6_addr, &buf[1], INET6_ADDRSTRLEN);
+ if (0 == ntohs(v6->sin6_port))
+ return &buf[1];
+ strcat (buf, "]:");
+ sprintf (b2, "%u", ntohs(v6->sin6_port));
+ strcat (buf, b2);
+ return buf;
+ default:
+ return _("invalid address");
+ }
+}
+
+
/**
* Initializer
*/
diff --git a/src/util/network.c b/src/util/network.c
index 7fd6f6c47..0526bc844 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -40,7 +40,7 @@
#include "gnunet_network_lib.h"
#include "gnunet_scheduler_lib.h"
-#define DEBUG_NETWORK GNUNET_NO
+#define DEBUG_NETWORK GNUNET_YES
struct GNUNET_NETWORK_TransmitHandle
{
@@ -234,9 +234,7 @@ GNUNET_NETWORK_socket_create_from_accept (struct GNUNET_SCHEDULER_Handle
{
struct GNUNET_NETWORK_SocketHandle *ret;
char addr[32];
- char msg[INET6_ADDRSTRLEN];
socklen_t addrlen;
- int fam;
int fd;
int aret;
struct sockaddr_in *v4;
@@ -287,19 +285,9 @@ GNUNET_NETWORK_socket_create_from_accept (struct GNUNET_SCHEDULER_Handle
(GNUNET_YES != (aret = access (access_cls, uaddr, addrlen))))
{
if (aret == GNUNET_NO)
- {
- fam = ((struct sockaddr *) addr)->sa_family;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Access denied to `%s'\n"),
- inet_ntop (fam,
- (fam == AF_INET6)
- ? (const void *) &((struct sockaddr_in6 *)
- &addr)->sin6_addr : (const
- void
- *)
- &((struct sockaddr_in *) &addr)->sin_addr,
- msg, sizeof (msg)));
- }
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ _("Access denied to `%s'\n"),
+ GNUNET_a2s(uaddr, addrlen));
GNUNET_break (0 == SHUTDOWN (fd, SHUT_RDWR));
GNUNET_break (0 == CLOSE (fd));
GNUNET_free (uaddr);
@@ -493,12 +481,22 @@ connect_continuation (void *cls,
(0 != getsockopt (sock->sock, SOL_SOCKET, SO_ERROR, &error, &len)) ||
(error != 0) || (errno != 0))
{
+#if DEBUG_NETWORK
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Failed to establish TCP connection to `%s'\n",
+ GNUNET_a2s(sock->addr, sock->addrlen));
+#endif
/* connect failed / timed out */
GNUNET_break (0 == CLOSE (sock->sock));
sock->sock = -1;
if (GNUNET_SYSERR == try_connect (sock))
{
/* failed for good */
+#if DEBUG_NETWORK
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Failed to establish TCP connection, no further addresses to try.\n");
+#endif
+ /* connect failed / timed out */
GNUNET_break (sock->ai_pos == NULL);
freeaddrinfo (sock->ai);
sock->ai = NULL;
@@ -1052,10 +1050,6 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
ssize_t ret;
size_t have;
-#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmit ready called --- will try to send\n");
-#endif
GNUNET_assert (sock->write_task != GNUNET_SCHEDULER_NO_PREREQUISITE_TASK);
sock->write_task = GNUNET_SCHEDULER_NO_PREREQUISITE_TASK;
if (sock->connect_task != GNUNET_SCHEDULER_NO_PREREQUISITE_TASK)
@@ -1091,6 +1085,10 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
#endif
goto SCHEDULE_WRITE;
}
+#if DEBUG_NETWORK
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transmit ready called --- will try to send\n");
+#endif
GNUNET_assert (sock->write_buffer_off >= sock->write_buffer_pos);
process_notify (sock);
have = sock->write_buffer_off - sock->write_buffer_pos;
diff --git a/src/util/service.c b/src/util/service.c
index cf9703235..8d72a749a 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -620,34 +620,26 @@ check_access (void *cls, const struct sockaddr *addr, socklen_t addrlen)
const struct sockaddr_in *i4;
const struct sockaddr_in6 *i6;
int ret;
- char buf[INET6_ADDRSTRLEN];
- uint16_t port;
switch (addr->sa_family)
{
case AF_INET:
GNUNET_assert (addrlen == sizeof (struct sockaddr_in));
i4 = (const struct sockaddr_in *) addr;
- port = ntohs (i4->sin_port);
ret = ((sctx->v4_allowed == NULL) ||
(check_ipv4_listed (sctx->v4_allowed,
&i4->sin_addr)))
&& ((sctx->v4_denied == NULL) ||
(!check_ipv4_listed (sctx->v4_denied, &i4->sin_addr)));
- if (ret != GNUNET_OK)
- inet_ntop (AF_INET, &i4->sin_addr, buf, sizeof (buf));
break;
case AF_INET6:
GNUNET_assert (addrlen == sizeof (struct sockaddr_in6));
i6 = (const struct sockaddr_in6 *) addr;
- port = ntohs (i6->sin6_port);
ret = ((sctx->v6_allowed == NULL) ||
(check_ipv6_listed (sctx->v6_allowed,
&i6->sin6_addr)))
&& ((sctx->v6_denied == NULL) ||
(!check_ipv6_listed (sctx->v6_denied, &i6->sin6_addr)));
- if (ret != GNUNET_OK)
- inet_ntop (AF_INET6, &i6->sin6_addr, buf, sizeof (buf));
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -657,8 +649,8 @@ check_access (void *cls, const struct sockaddr *addr, socklen_t addrlen)
if (ret != GNUNET_OK)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Access from `%s:%u' denied to service `%s'\n"),
- buf, port, sctx->serviceName);
+ _("Access from `%s' denied to service `%s'\n"),
+ GNUNET_a2s(addr, addrlen), sctx->serviceName);
}
return ret;
}