diff -uNr ntop-3.3.8/acinclude.m4 ntop-3.3.9/acinclude.m4
--- ntop-3.3.8/acinclude.m4	2008-10-02 12:54:15.000000000 +0200
+++ ntop-3.3.9/acinclude.m4	2008-12-03 23:00:22.000000000 +0100
@@ -195,15 +195,15 @@
 ])
 
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
-## Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007,
-## 2008  Free Software Foundation, Inc.
+## Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
+## Free Software Foundation, Inc.
 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 ##
 ## 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 52 Debian 1.5.26-1ubuntu1 AC_PROG_LIBTOOL
+# serial 48 AC_PROG_LIBTOOL
 
 
 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
@@ -291,6 +291,7 @@
 AC_REQUIRE([AC_OBJEXT])dnl
 AC_REQUIRE([AC_EXEEXT])dnl
 dnl
+
 AC_LIBTOOL_SYS_MAX_CMD_LEN
 AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
 AC_LIBTOOL_OBJDIR
@@ -365,7 +366,7 @@
 test -z "$ac_objext" && ac_objext=o
 
 # Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
 old_postinstall_cmds='chmod 644 $oldlib'
 old_postuninstall_cmds=
 
@@ -392,8 +393,6 @@
   ;;
 esac
 
-_LT_REQUIRED_DARWIN_CHECKS
-
 AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
 AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
 enable_win32_dll=yes, enable_win32_dll=no)
@@ -454,9 +453,8 @@
 # Check for compiler boilerplate output or warnings with
 # the simple compiler test code.
 AC_DEFUN([_LT_COMPILER_BOILERPLATE],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
 eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_compiler_boilerplate=`cat conftest.err`
 $rm conftest*
@@ -468,85 +466,13 @@
 # Check for linker boilerplate output or warnings with
 # the simple link test code.
 AC_DEFUN([_LT_LINKER_BOILERPLATE],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_linker_boilerplate=`cat conftest.err`
-$rm -r conftest*
+$rm conftest*
 ])# _LT_LINKER_BOILERPLATE
 
-# _LT_REQUIRED_DARWIN_CHECKS
-# --------------------------
-# Check for some things on darwin
-AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
-  case $host_os in
-    rhapsody* | darwin*)
-    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
-    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
-
-    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
-      [lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
-   # By default we will add the -single_module flag. You can override
-   # by either setting the environment variable LT_MULTI_MODULE
-   # non-empty at configure time, or by adding -multi_module to the
-   # link flags.
-   echo "int foo(void){return 1;}" > conftest.c
-   $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-     -dynamiclib ${wl}-single_module conftest.c
-   if test -f libconftest.dylib; then
-     lt_cv_apple_cc_single_mod=yes
-     rm -rf libconftest.dylib*
-   fi
-   rm conftest.c
-      fi])
-    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
-      [lt_cv_ld_exported_symbols_list],
-      [lt_cv_ld_exported_symbols_list=no
-      save_LDFLAGS=$LDFLAGS
-      echo "_main" > conftest.sym
-      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-   [lt_cv_ld_exported_symbols_list=yes],
-   [lt_cv_ld_exported_symbols_list=no])
-   LDFLAGS="$save_LDFLAGS"
-    ])
-    case $host_os in
-    rhapsody* | darwin1.[[0123]])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
-    darwin1.*)
-     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*)
-      # 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?
-      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' ;;
-   10.[[012]]*)
-     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-   10.*)
-     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-      esac
-    ;;
-  esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
-      _lt_dar_single_mod='$single_module'
-    fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
-    else
-      _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
-    fi
-    if test "$DSYMUTIL" != ":"; then
-      _lt_dsymutil="~$DSYMUTIL \$lib || :"
-    else
-      _lt_dsymutil=
-    fi
-    ;;
-  esac
-])
 
 # _LT_AC_SYS_LIBPATH_AIX
 # ----------------------
@@ -557,20 +483,12 @@
 # If we don't find anything, use the default library path according
 # to the aix ld manual.
 AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_LINK_IFELSE(AC_LANG_PROGRAM,[
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
 # Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi],[])
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi],[])
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 ])# _LT_AC_SYS_LIBPATH_AIX
 
@@ -801,17 +719,13 @@
   rm -rf conftest*
   ;;
 
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-s390*-*linux*|sparc*-*linux*)
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.o` in
     *32-bit*)
       case $host in
-        x86_64-*kfreebsd*-gnu)
-          LD="${LD-ld} -m elf_i386_fbsd"
-          ;;
         x86_64-*linux*)
           LD="${LD-ld} -m elf_i386"
           ;;
@@ -828,9 +742,6 @@
       ;;
     *64-bit*)
       case $host in
-        x86_64-*kfreebsd*-gnu)
-          LD="${LD-ld} -m elf_x86_64_fbsd"
-          ;;
         x86_64-*linux*)
           LD="${LD-ld} -m elf_x86_64"
           ;;
@@ -871,11 +782,7 @@
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
       yes*) LD="${LD-ld} -m elf64_sparc" ;;
-      *)
-        if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-	  LD="${LD-ld} -64"
-	fi
-	;;
+      *)    LD="${LD-ld} -64" ;;
       esac
       ;;
     esac
@@ -906,7 +813,7 @@
 AC_CACHE_CHECK([$1], [$2],
   [$2=no
   ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
    lt_compiler_flag="$3"
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
@@ -947,12 +854,11 @@
 # ------------------------------------------------------------
 # Check whether the given compiler option works
 AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_CACHE_CHECK([$1], [$2],
+[AC_CACHE_CHECK([$1], [$2],
   [$2=no
    save_LDFLAGS="$LDFLAGS"
    LDFLAGS="$LDFLAGS $3"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
      # The linker can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -968,7 +874,7 @@
        $2=yes
      fi
    fi
-   $rm -r conftest*
+   $rm conftest*
    LDFLAGS="$save_LDFLAGS"
 ])
 
@@ -1066,27 +972,24 @@
     fi
     ;;
   *)
-    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len"; then
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    else
-      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-      while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+    while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
 	       = "XX$teststring") >/dev/null 2>&1 &&
-	      new_result=`expr "X$teststring" : ".*" 2>&1` &&
-	      lt_cv_sys_max_cmd_len=$new_result &&
-	      test $i != 17 # 1/2 MB should be enough
-      do
-        i=`expr $i + 1`
-        teststring=$teststring$teststring
-      done
-      teststring=
-      # Add a significant safety factor because C++ compilers can tack on massive
-      # amounts of additional arguments before passing them to the linker.
-      # It appears as though 1/2 is a usable value.
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
-    fi
+	    new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	    lt_cv_sys_max_cmd_len=$new_result &&
+	    test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
     ;;
   esac
 ])
@@ -1239,7 +1142,7 @@
     AC_CHECK_FUNC([shl_load],
 	  [lt_cv_dlopen="shl_load"],
       [AC_CHECK_LIB([dld], [shl_load],
-	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
 	[AC_CHECK_FUNC([dlopen],
 	      [lt_cv_dlopen="dlopen"],
 	  [AC_CHECK_LIB([dl], [dlopen],
@@ -1247,7 +1150,7 @@
 	    [AC_CHECK_LIB([svld], [dlopen],
 		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
 	      [AC_CHECK_LIB([dld], [dld_link],
-		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
 	      ])
 	    ])
 	  ])
@@ -1313,8 +1216,7 @@
 # ---------------------------------
 # Check to see if options -c and -o are simultaneously supported by compiler
 AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
 AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
   [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
   [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
@@ -1322,7 +1224,7 @@
    mkdir conftest
    cd conftest
    mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
 
    lt_compiler_flag="-o out/conftest2.$ac_objext"
    # Insert the option either (1) after the last *FLAGS variable, or
@@ -1462,7 +1364,6 @@
    darwin*)
        if test -n "$STRIP" ; then
          striplib="$STRIP -x"
-         old_striplib="$STRIP -S"
          AC_MSG_RESULT([yes])
        else
   AC_MSG_RESULT([no])
@@ -1480,8 +1381,7 @@
 # -----------------------------
 # PORTME Fill in your ld.so characteristics
 AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_MSG_CHECKING([dynamic linker characteristics])
+[AC_MSG_CHECKING([dynamic linker characteristics])
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -1495,58 +1395,20 @@
 version_type=none
 dynamic_linker="$host_os ld.so"
 sys_lib_dlsearch_path_spec="/lib /usr/lib"
-m4_if($1,[],[
 if test "$GCC" = yes; then
-  case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
   else
-    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
   fi
-  # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
-  lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
-  for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
-      test -d "$lt_sys_path" && \
-	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
-    fi
-  done
-  lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
-  for (lt_i = NF; lt_i > 0; lt_i--) {
-    if ($lt_i != "" && $lt_i != ".") {
-      if ($lt_i == "..") {
-        lt_count++;
-      } else {
-        if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
-        } else {
-          lt_count--;
-        }
-      }
-    }
-  }
-  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
-  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
-}'`
-  sys_lib_search_path_spec=`echo $lt_search_path_spec`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi])
+fi
 need_lib_prefix=unknown
 hardcode_into_libs=no
 
@@ -1564,7 +1426,7 @@
   soname_spec='${libname}${release}${shared_ext}$major'
   ;;
 
-aix[[4-9]]*)
+aix4* | aix5*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -1698,13 +1560,17 @@
   version_type=darwin
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext ${libname}${release}${versuffix}$shared_ext'
   soname_spec='${libname}${release}${major}$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-  m4_if([$1], [],[
-  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) 
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
   sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
   ;;
 
@@ -1721,6 +1587,18 @@
   dynamic_linker=no
   ;;
 
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -1758,7 +1636,7 @@
     shlibpath_overrides_runpath=no
     hardcode_into_libs=yes
     ;;
-  *) # from 4.6 on, and DragonFly
+  freebsd*) # from 4.6 on
     shlibpath_overrides_runpath=yes
     hardcode_into_libs=yes
     ;;
@@ -1821,7 +1699,7 @@
   postinstall_cmds='chmod 555 $lib'
   ;;
 
-interix[[3-9]]*)
+interix3*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -1876,7 +1754,7 @@
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu)
+linux*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -1892,7 +1770,7 @@
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -1905,7 +1783,7 @@
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
-netbsdelf*-gnu)
+knetbsd*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -1914,7 +1792,7 @@
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
-  dynamic_linker='NetBSD ld.elf_so'
+  dynamic_linker='GNU ld.so'
   ;;
 
 netbsd*)
@@ -1998,10 +1876,6 @@
   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
   ;;
 
-rdos*)
-  dynamic_linker=no
-  ;;
-
 solaris*)
   version_type=linux
   need_lib_prefix=no
@@ -2097,13 +1971,6 @@
 AC_MSG_RESULT([$dynamic_linker])
 test "$dynamic_linker" = no && can_build_shared=no
 
-AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec],
-[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"])
-sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec],
-[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"])
-sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-
 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"
@@ -2114,8 +1981,7 @@
 # _LT_AC_TAGCONFIG
 # ----------------
 AC_DEFUN([_LT_AC_TAGCONFIG],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_ARG_WITH([tags],
+[AC_ARG_WITH([tags],
     [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
         [include additional configurations @<:@automatic@:>@])],
     [tagnames="$withval"])
@@ -2376,7 +2242,7 @@
 
 # AC_PATH_TOOL_PREFIX
 # -------------------
-# find a file program which can recognize shared library
+# find a file program which can recognise shared library
 AC_DEFUN([AC_PATH_TOOL_PREFIX],
 [AC_REQUIRE([AC_PROG_EGREP])dnl
 AC_MSG_CHECKING([for $1])
@@ -2439,7 +2305,7 @@
 
 # AC_PATH_MAGIC
 # -------------
-# find a file program which can recognize a shared library
+# find a file program which can recognise a shared library
 AC_DEFUN([AC_PATH_MAGIC],
 [AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
 if test -z "$lt_cv_path_MAGIC_CMD"; then
@@ -2586,7 +2452,7 @@
 # how to check for library dependencies
 #  -- PORTME fill in with the dynamic library characteristics
 AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
-[AC_CACHE_CHECK([how to recognize dependent libraries],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
 lt_cv_deplibs_check_method,
 [lt_cv_file_magic_cmd='$MAGIC_CMD'
 lt_cv_file_magic_test_file=
@@ -2603,7 +2469,7 @@
 # whether `pass_all' will *always* work, you probably want this one.
 
 case $host_os in
-aix[[4-9]]*)
+aix4* | aix5*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -2625,22 +2491,16 @@
 
 mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
-  # func_win32_libid shell function, so use a weaker test based on 'objdump',
-  # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
-    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-    lt_cv_file_magic_cmd='func_win32_libid'
-  else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
-    lt_cv_file_magic_cmd='$OBJDUMP -f'
-  fi
+  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
   ;;
 
 darwin* | rhapsody*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-freebsd* | dragonfly*)
+freebsd* | kfreebsd*-gnu | dragonfly*)
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
     case $host_cpu in
     i*86 )
@@ -2678,7 +2538,7 @@
   esac
   ;;
 
-interix[[3-9]]*)
+interix3*)
   # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
   lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
   ;;
@@ -2694,11 +2554,11 @@
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu)
+linux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-netbsd* | netbsdelf*-gnu)
+netbsd*)
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
   else
@@ -2728,10 +2588,6 @@
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-rdos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
 solaris*)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -2784,7 +2640,7 @@
   lt_cv_path_NM="$NM"
 else
   lt_nm_to_check="${ac_tool_prefix}nm"
-  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then 
     lt_nm_to_check="$lt_nm_to_check nm"
   fi
   for lt_tmp_nm in $lt_nm_to_check; do
@@ -3000,10 +2856,10 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
+lt_simple_compile_test_code="int some_variable = 0;\n"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
+lt_simple_link_test_code='int main(){return(0);}\n'
 
 _LT_AC_SYS_COMPILER
 
@@ -3043,7 +2899,7 @@
   fi
   ;;
 
-aix[[4-9]]*)
+aix4* | aix5*)
   if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
     test "$enable_shared" = yes && enable_static=no
   fi
@@ -3100,7 +2956,6 @@
 _LT_AC_TAGVAR(predeps, $1)=
 _LT_AC_TAGVAR(postdeps, $1)=
 _LT_AC_TAGVAR(compiler_lib_search_path, $1)=
-_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
 
 # Source file extension for C++ test sources.
 ac_ext=cpp
@@ -3110,10 +2965,10 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
+lt_simple_compile_test_code="int some_variable = 0;\n"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n'
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_AC_SYS_COMPILER
@@ -3210,7 +3065,7 @@
     # FIXME: insert proper C++ library support
     _LT_AC_TAGVAR(ld_shlibs, $1)=no
     ;;
-  aix[[4-9]]*)
+  aix4* | aix5*)
     if test "$host_cpu" = ia64; then
       # On IA64, the linker does run time linking by default, so we don't
       # have to do anything special.
@@ -3223,7 +3078,7 @@
       # Test if we are trying to use run time linking or normal
       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
       # need to do runtime linking.
-      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
 	for ld_flag in $LDFLAGS; do
 	  case $ld_flag in
 	  *-brtl*)
@@ -3259,7 +3114,7 @@
 	   strings "$collect2name" | grep resolve_lib_name >/dev/null
 	then
 	  # We have reworked collect2
-	  :
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
 	else
 	  # We have old collect2
 	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
@@ -3369,31 +3224,59 @@
     fi
   ;;
       darwin* | rhapsody*)
+        case $host_os in
+        rhapsody* | darwin1.[[012]])
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[[012]])
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+        esac
       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
       _LT_AC_TAGVAR(hardcode_direct, $1)=no
       _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
-      if test "$GXX" = yes ; then
+
+    if test "$GXX" = yes ; then
+      lt_int_apple_cc_single_mod=no
       output_verbose_link_cmd='echo'
-      _LT_AC_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_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-      _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-      if test "$lt_cv_apple_cc_single_mod" != "yes"; then
-        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
-        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+       lt_int_apple_cc_single_mod=yes
       fi
+      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      else
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+        fi
+        _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          else
+            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          fi
+            _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
       else
       case $cc_basename in
         xlc*)
          output_verbose_link_cmd='echo'
-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
           _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
           # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           ;;
        *)
@@ -3427,7 +3310,7 @@
   freebsd-elf*)
     _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
     ;;
-  freebsd* | dragonfly*)
+  freebsd* | kfreebsd*-gnu | dragonfly*)
     # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
     # conventions
     _LT_AC_TAGVAR(ld_shlibs, $1)=yes
@@ -3476,7 +3359,9 @@
       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
 
       case $host_cpu in
-      hppa*64*|ia64*) ;;
+      hppa*64*|ia64*)
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+        ;;
       *)
 	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
         ;;
@@ -3544,7 +3429,7 @@
 	;;
     esac
     ;;
-  interix[[3-9]]*)
+  interix3*)
     _LT_AC_TAGVAR(hardcode_direct, $1)=no
     _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
@@ -3584,7 +3469,7 @@
     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
     _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
     ;;
-  linux* | k*bsd*-gnu)
+  linux*)
     case $cc_basename in
       KCC*)
 	# Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -3636,7 +3521,7 @@
 	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
 	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
 	;;
-      pgCC* | pgcpp*)
+      pgCC*)
         # Portland Group C++ compiler
 	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
   	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
@@ -3664,29 +3549,6 @@
 	# dependencies.
 	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
 	;;
-      *)
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C++ 5.9
-	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-
-	  # Not sure whether something based on
-	  # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
-	  # would be better.
-	  output_verbose_link_cmd='echo'
-
-	  # Archives containing C++ object files must be created using
-	  # "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	  # necessary to make sure instantiated templates are included
-	  # in the archive.
-	  _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	  ;;
-	esac
-	;;
     esac
     ;;
   lynxos*)
@@ -3709,7 +3571,7 @@
 	;;
     esac
     ;;
-  netbsd* | netbsdelf*-gnu)
+  netbsd*)
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
       wlarc=
@@ -3725,20 +3587,16 @@
     _LT_AC_TAGVAR(ld_shlibs, $1)=no
     ;;
   openbsd*)
-    if test -f /usr/libexec/ld.so; then
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      fi
-      output_verbose_link_cmd='echo'
-    else
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
     fi
+    output_verbose_link_cmd='echo'
     ;;
   osf3*)
     case $cc_basename in
@@ -3900,10 +3758,15 @@
 	case $host_os in
 	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
 	  *)
-	    # The compiler driver will combine and reorder linker options,
-	    # but understands `-z linker_flag'.
+	    # The C++ compiler is used as linker so we must use $wl
+	    # flag to pass the commands to the underlying system
+	    # linker. We must also pass each convience library through
+	    # to the system linker between allextract/defaultextract.
+	    # The C++ compiler will combine linker options so we
+	    # cannot just pass the convience library names through
+	    # without $wl.
 	    # Supported since Solaris 2.6 (maybe 2.5.1?)
-	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
 	    ;;
 	esac
 	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
@@ -3950,12 +3813,6 @@
 	  fi
 
 	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
-	  case $host_os in
-	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-	  *)
-	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	    ;;
-	  esac
 	fi
 	;;
     esac
@@ -4075,8 +3932,7 @@
 # compiler output when linking a shared library.
 # Parse the compiler output and extract the necessary
 # objects, libraries and library flags.
-AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
 dnl we can't use the lt_simple_compile_test_code here,
 dnl because it contains code intended for an executable,
 dnl not a library.  It's possible we should let each
@@ -4201,15 +4057,10 @@
 
 $rm -f confest.$objext
 
-_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
-if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
-  _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
-
 # PORTME: override above test on systems where it is broken
 ifelse([$1],[CXX],
 [case $host_os in
-interix[[3-9]]*)
+interix3*)
   # Interix 3.5 installs completely hosed .la files for C++, so rather than
   # hack all around it, let's just trust "g++" to DTRT.
   _LT_AC_TAGVAR(predep_objects,$1)=
@@ -4217,51 +4068,19 @@
   _LT_AC_TAGVAR(postdeps,$1)=
   ;;
 
-linux*)
-  case `$CC -V 2>&1 | sed 5q` in
-  *Sun\ C*)
-    # Sun C++ 5.9
-    #
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-
 solaris*)
   case $cc_basename in
   CC*)
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
     # Adding this requires a known-good setup of shared libraries for
     # Sun compiler versions before 5.6, else PIC objects from an old
     # archive will be linked into the output, leading to subtle bugs.
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
+    _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun'
     ;;
   esac
   ;;
 esac
 ])
+
 case " $_LT_AC_TAGVAR(postdeps, $1) " in
 *" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
 esac
@@ -4304,17 +4123,10 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
+lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code="\
-      program t
-      end
-"
+lt_simple_link_test_code="      program t\n      end\n"
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_AC_SYS_COMPILER
@@ -4346,7 +4158,7 @@
     postinstall_cmds='$RANLIB $lib'
   fi
   ;;
-aix[[4-9]]*)
+aix4* | aix5*)
   if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
     test "$enable_shared" = yes && enable_static=no
   fi
@@ -4393,10 +4205,10 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}"
+lt_simple_compile_test_code="class foo {}\n"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n'
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_AC_SYS_COMPILER
@@ -4453,7 +4265,7 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
 
 # Code to be used in simple link tests
 lt_simple_link_test_code="$lt_simple_compile_test_code"
@@ -4527,7 +4339,6 @@
     _LT_AC_TAGVAR(predeps, $1) \
     _LT_AC_TAGVAR(postdeps, $1) \
     _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
-    _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \
     _LT_AC_TAGVAR(archive_cmds, $1) \
     _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
     _LT_AC_TAGVAR(postinstall_cmds, $1) \
@@ -4543,7 +4354,6 @@
     _LT_AC_TAGVAR(module_cmds, $1) \
     _LT_AC_TAGVAR(module_expsym_cmds, $1) \
     _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
-    _LT_AC_TAGVAR(fix_srcfile_path, $1) \
     _LT_AC_TAGVAR(exclude_expsyms, $1) \
     _LT_AC_TAGVAR(include_expsyms, $1); do
 
@@ -4590,7 +4400,7 @@
 # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
 # Free Software Foundation, Inc.
 #
 # This file is part of GNU Libtool:
@@ -4827,10 +4637,6 @@
 # shared library.
 postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
 
-# The directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)
-
 # The library search path used internally by the compiler when linking
 # a shared library.
 compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
@@ -4919,7 +4725,7 @@
 sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
 
 # Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
+fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
 
 # Set to yes if exported symbols are required.
 always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
@@ -5002,7 +4808,6 @@
 # ---------------------------------
 AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
 [AC_REQUIRE([AC_CANONICAL_HOST])
-AC_REQUIRE([LT_AC_PROG_SED])
 AC_REQUIRE([AC_PROG_NM])
 AC_REQUIRE([AC_OBJEXT])
 # Check for command to grab the raw symbol name followed by C symbol from nm.
@@ -5039,7 +4844,7 @@
   lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
   lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
   ;;
-linux* | k*bsd*-gnu)
+linux*)
   if test "$host_cpu" = ia64; then
     symcode='[[ABCDGIRSTW]]'
     lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
@@ -5180,7 +4985,7 @@
     echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
     cat conftest.$ac_ext >&5
   fi
-  rm -rf conftest* conftst*
+  rm -f conftest* conftst*
 
   # Do not use the global_symbol_pipe unless it works.
   if test "$pipe_works" = yes; then
@@ -5229,16 +5034,13 @@
       # like `-m68040'.
       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
       ;;
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
-    mingw* | cygwin* | os2* | pw32*)
+    mingw* | os2* | pw32*)
       # 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
-      # (--disable-auto-import) libraries
-      m4_if([$1], [GCJ], [],
-	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
       ;;
     darwin* | rhapsody*)
       # PIC is the default on this platform
@@ -5249,7 +5051,7 @@
       # DJGPP does not support shared libraries at all
       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
       ;;
-    interix[[3-9]]*)
+    interix3*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
       ;;
@@ -5275,7 +5077,7 @@
     esac
   else
     case $host_os in
-      aix[[4-9]]*)
+      aix4* | aix5*)
 	# All AIX code is PIC.
 	if test "$host_cpu" = ia64; then
 	  # AIX 5 now supports IA64 processor
@@ -5315,7 +5117,7 @@
 	    ;;
 	esac
 	;;
-      freebsd* | dragonfly*)
+      freebsd* | kfreebsd*-gnu | dragonfly*)
 	# FreeBSD uses GNU C++
 	;;
       hpux9* | hpux10* | hpux11*)
@@ -5358,7 +5160,7 @@
 	    ;;
 	esac
 	;;
-      linux* | k*bsd*-gnu)
+      linux*)
 	case $cc_basename in
 	  KCC*)
 	    # KAI C++ Compiler
@@ -5371,7 +5173,7 @@
 	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
 	    ;;
-	  pgCC* | pgcpp*)
+	  pgCC*)
 	    # Portland Group C++ compiler.
 	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
@@ -5385,14 +5187,6 @@
 	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
 	    ;;
 	  *)
-	    case `$CC -V 2>&1 | sed 5q` in
-	    *Sun\ C*)
-	      # Sun C++ 5.9
-	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	      ;;
-	    esac
 	    ;;
 	esac
 	;;
@@ -5409,7 +5203,7 @@
 	    ;;
 	esac
 	;;
-      netbsd* | netbsdelf*-gnu)
+      netbsd*)
 	;;
       osf3* | osf4* | osf5*)
 	case $cc_basename in
@@ -5513,17 +5307,14 @@
       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
       ;;
 
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
 
-    mingw* | cygwin* | pw32* | os2*)
+    mingw* | pw32* | os2*)
       # 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
-      # (--disable-auto-import) libraries
-      m4_if([$1], [GCJ], [],
-	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
       ;;
 
     darwin* | rhapsody*)
@@ -5532,7 +5323,7 @@
       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
       ;;
 
-    interix[[3-9]]*)
+    interix3*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
       ;;
@@ -5590,11 +5381,10 @@
        esac
        ;;
 
-    mingw* | cygwin* | pw32* | os2*)
+    mingw* | pw32* | os2*)
       # 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], [],
-	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
       ;;
 
     hpux9* | hpux10* | hpux11*)
@@ -5624,7 +5414,7 @@
       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       ;;
 
-    linux* | k*bsd*-gnu)
+    linux*)
       case $cc_basename in
       icc* | ecc*)
 	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
@@ -5643,22 +5433,6 @@
         # All Alpha code is PIC.
         _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
         ;;
-      *)
-        case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
-	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=''
-	  ;;
-	esac
-	;;
       esac
       ;;
 
@@ -5668,10 +5442,6 @@
       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
       ;;
 
-    rdos*)
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
     solaris*)
       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
@@ -5731,7 +5501,7 @@
 #
 if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
   AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
-    _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1),
+    _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
     [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
     [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
      "" | " "*) ;;
@@ -5755,7 +5525,7 @@
 #
 wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
 AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
-  _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
   $lt_tmp_static_flag,
   [],
   [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
@@ -5766,12 +5536,11 @@
 # ------------------------------------
 # See if the linker supports building shared libraries.
 AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
 ifelse([$1],[CXX],[
   _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   case $host_os in
-  aix[[4-9]]*)
+  aix4* | aix5*)
     # If we're using GNU nm, then we don't want the "-C" option.
     # -C means demangle to AIX nm, but means don't demangle with GNU nm
     if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
@@ -5784,16 +5553,12 @@
     _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
   ;;
   cygwin* | mingw*)
-    _LT_AC_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)
-    _LT_AC_TAGVAR(link_all_deplibs, $1)=no
+    _LT_AC_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'
   ;;
   *)
     _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   ;;
   esac
-  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
 ],[
   runpath_var=
   _LT_AC_TAGVAR(allow_undefined_flag, $1)=
@@ -5824,14 +5589,12 @@
   # it will be wrapped by ` (' and `)$', so one must not match beginning or
   # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
   # as well as any symbol that contains `d'.
-  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
   # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
   # platforms (ab)use it in PIC code, but their linkers get confused if
   # the symbol is explicitly referenced.  Since portable code cannot
   # rely on this symbol name, it's probably fine to never include it in
   # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-dnl Note also adjust exclude_expsyms for C++ above.
   extract_expsyms_cmds=
   # Just being paranoid about ensuring that cc_basename is set.
   _LT_CC_BASENAME([$compiler])
@@ -5881,7 +5644,7 @@
 
     # See if GNU ld supports shared libraries.
     case $host_os in
-    aix[[3-9]]*)
+    aix3* | aix4* | aix5*)
       # On AIX/PPC, the GNU linker is very broken
       if test "$host_cpu" != ia64; then
 	_LT_AC_TAGVAR(ld_shlibs, $1)=no
@@ -5929,7 +5692,7 @@
       _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_AC_TAGVAR(always_export_symbols, $1)=no
       _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
 
       if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -5947,7 +5710,7 @@
       fi
       ;;
 
-    interix[[3-9]]*)
+    interix3*)
       _LT_AC_TAGVAR(hardcode_direct, $1)=no
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
@@ -5962,7 +5725,7 @@
       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    gnu* | linux* | k*bsd*-gnu)
+    linux*)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 	tmp_addflag=
 	case $cc_basename,$host_cpu in
@@ -5980,30 +5743,20 @@
 	ifc* | ifort*)			# Intel Fortran compiler
 	  tmp_addflag=' -nofor_main' ;;
 	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	*)
-	  tmp_sharedflag='-shared' ;;
-	esac
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 
 	if test $supports_anon_versioning = yes; then
 	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
   cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
   $echo "local: *; };" >> $output_objdir/$libname.ver~
-	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
 	fi
-	_LT_AC_TAGVAR(link_all_deplibs, $1)=no
       else
 	_LT_AC_TAGVAR(ld_shlibs, $1)=no
       fi
       ;;
 
-    netbsd* | netbsdelf*-gnu)
+    netbsd*)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
@@ -6036,7 +5789,7 @@
 
     sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
       case `$LD -v 2>&1` in
-        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) 
 	_LT_AC_TAGVAR(ld_shlibs, $1)=no
 	cat <<_LT_EOF 1>&2
 
@@ -6101,7 +5854,7 @@
       fi
       ;;
 
-    aix[[4-9]]*)
+    aix4* | aix5*)
       if test "$host_cpu" = ia64; then
 	# On IA64, the linker does run time linking by default, so we don't
 	# have to do anything special.
@@ -6121,7 +5874,7 @@
 	# Test if we are trying to use run time linking or normal
 	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
 	# need to do runtime linking.
-	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
 	  for ld_flag in $LDFLAGS; do
   	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
   	    aix_use_runtimelinking=yes
@@ -6155,7 +5908,7 @@
   	   strings "$collect2name" | grep resolve_lib_name >/dev/null
 	  then
   	  # We have reworked collect2
-  	  :
+  	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
 	  else
   	  # We have old collect2
   	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
@@ -6248,7 +6001,7 @@
       # The linker will automatically build a .lib file if we build a DLL.
       _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
       # FIXME: Should let the user specify the lib program.
-      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
       _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
       _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
       ;;
@@ -6281,18 +6034,19 @@
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
     if test "$GCC" = yes ; then
     	output_verbose_link_cmd='echo'
-        _LT_AC_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_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-        _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
     else
       case $cc_basename in
         xlc*)
          output_verbose_link_cmd='echo'
-         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
          _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
           # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           ;;
        *)
@@ -6332,7 +6086,7 @@
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
+    freebsd* | kfreebsd*-gnu | dragonfly*)
       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
@@ -6434,7 +6188,7 @@
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
       ;;
 
-    netbsd* | netbsdelf*-gnu)
+    netbsd*)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else
@@ -6454,28 +6208,24 @@
       ;;
 
     openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
-	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
-	     _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	     ;;
-	   *)
-	     _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-        fi
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
       else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+       case $host_os in
+	 openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	   _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	   _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	   ;;
+	 *)
+	   _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	   _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	   ;;
+       esac
       fi
       ;;
 
@@ -6534,16 +6284,17 @@
       case $host_os in
       solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
       *)
-	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
-	# but is careful enough not to reorder.
+ 	# The compiler driver will combine linker options so we
+ 	# cannot just pass the convience library names through
+ 	# without $wl, iff we do not link with $LD.
+ 	# Luckily, gcc supports the same syntax we need for Sun Studio.
  	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	fi
-	;;
+ 	case $wlarc in
+ 	'')
+ 	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
+ 	*)
+ 	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+ 	esac ;;
       esac
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
       ;;
@@ -6600,7 +6351,7 @@
       fi
       ;;
 
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*)
       _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -6675,7 +6426,7 @@
       # to ld, don't add -lc before -lgcc.
       AC_MSG_CHECKING([whether -lc should be explicitly linked in])
       $rm conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
 
       if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
         soname=conftest
@@ -6778,30 +6529,6 @@
 [AC_CHECK_TOOL(RC, windres, no)
 ])
 
-
-# Cheap backport of AS_EXECUTABLE_P and required macros
-# from Autoconf 2.59; we should not use $as_executable_p directly.
-
-# _AS_TEST_PREPARE
-# ----------------
-m4_ifndef([_AS_TEST_PREPARE],
-[m4_defun([_AS_TEST_PREPARE],
-[if test -x / >/dev/null 2>&1; then
-  as_executable_p='test -x'
-else
-  as_executable_p='test -f'
-fi
-])])# _AS_TEST_PREPARE
-
-# AS_EXECUTABLE_P
-# ---------------
-# Check whether a file is executable.
-m4_ifndef([AS_EXECUTABLE_P],
-[m4_defun([AS_EXECUTABLE_P],
-[AS_REQUIRE([_AS_TEST_PREPARE])dnl
-$as_executable_p $1[]dnl
-])])# AS_EXECUTABLE_P
-
 ############################################################
 # NOTE: This macro has been submitted for inclusion into   #
 #  GNU Autoconf as AC_PROG_SED.  When it is available in   #
@@ -6824,13 +6551,12 @@
   test -z "$as_dir" && as_dir=.
   for lt_ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
-      if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
         lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
       fi
     done
   done
 done
-IFS=$as_save_IFS
 lt_ac_max=0
 lt_ac_count=0
 # Add /usr/xpg4/bin/sed as it is typically found on Solaris
@@ -6863,7 +6589,6 @@
 done
 ])
 SED=$lt_cv_path_SED
-AC_SUBST([SED])
 AC_MSG_RESULT([$SED])
 ])
 #
diff -uNr ntop-3.3.8/aclocal.m4 ntop-3.3.9/aclocal.m4
--- ntop-3.3.8/aclocal.m4	2008-10-02 12:54:15.000000000 +0200
+++ ntop-3.3.9/aclocal.m4	2008-12-03 23:00:22.000000000 +0100
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.10 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2005, 2006  Free Software Foundation, Inc.
 # 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.
@@ -11,15 +11,12 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-m4_ifndef([AC_AUTOCONF_VERSION],
-  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(AC_AUTOCONF_VERSION, [2.61],,
-[m4_warning([this file was generated for autoconf 2.61.
-You have another version of autoconf.  It may work, but is not guaranteed to.
-If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
+m4_if(m4_PACKAGE_VERSION, [2.61],,
+[m4_fatal([this file was generated for autoconf 2.61.
+You have another version of autoconf.  If you want to use that,
+you should regenerate the build system entirely.], [63])])
 
-# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -34,7 +31,7 @@
 [am__api_version='1.10'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.10.1], [],
+m4_if([$1], [1.10], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -50,10 +47,8 @@
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.10.1])dnl
-m4_ifndef([AC_AUTOCONF_VERSION],
-  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
+[AM_AUTOMAKE_VERSION([1.10])dnl
+_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
@@ -348,7 +343,7 @@
   # each Makefile.in and add a new line on top of each file to say so.
   # Grep'ing the whole file is not good either: AIX grep has a line
   # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
     dirpart=`AS_DIRNAME("$mf")`
   else
     continue
@@ -408,13 +403,13 @@
 # Do all the work for Automake.                             -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008 Free Software Foundation, Inc.
+# 2005, 2006 Free Software Foundation, Inc.
 #
 # 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 13
+# serial 12
 
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
@@ -519,17 +514,16 @@
 # our stamp files there.
 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
 [# Compute $1's index in $config_headers.
-_am_arg=$1
 _am_stamp_count=1
 for _am_header in $config_headers :; do
   case $_am_header in
-    $_am_arg | $_am_arg:* )
+    $1 | $1:* )
       break ;;
     * )
       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
   esac
 done
-echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
 
 # Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
 #
@@ -801,7 +795,7 @@
 
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
-# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
 # This macro is traced by Automake.
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 
diff -uNr ntop-3.3.8/address.c ntop-3.3.9/address.c
--- ntop-3.3.8/address.c	2008-06-04 09:29:06.000000000 +0200
+++ ntop-3.3.9/address.c	2008-12-09 19:37:20.000000000 +0100
@@ -58,9 +58,9 @@
 
 	if(strlen(symbolic) >= (MAX_LEN_SYM_HOST_NAME-1))
 	  symbolic[MAX_LEN_SYM_HOST_NAME-2] = '\0';
-
-	for(i=0; i<strlen(symbolic); i++)
-	  if(isupper(symbolic[i])) symbolic[i] = tolower(symbolic[i]);
+	
+	/* Really needed ? */
+	for(i=0; i<strlen(symbolic); i++) symbolic[i] = tolower(symbolic[i]);
 
 	/* traceEvent(CONST_TRACE_INFO, "--> %s", symbolic); */
 
@@ -114,7 +114,7 @@
 /* ************************************ */
 
 static void resolveAddress(HostAddr *hostAddr, short keepAddressNumeric) {
-  char symAddr[MAX_LEN_SYM_HOST_NAME];
+  char symAddr[MAX_LEN_SYM_HOST_NAME+1] = { '\0' };
   short symAddrType=FLAG_HOST_SYM_ADDR_TYPE_NONE;
   StoredAddress storedAddress;
   int i, addToCacheFlag=0, updateRecord=0;
@@ -165,15 +165,16 @@
 #endif
 
     /* Sanity check */
-    if(strlen(retrievedAddress->symAddress) > MAX_LEN_SYM_HOST_NAME) {
+    if(strlen(retrievedAddress->symAddress) >= (MAX_LEN_SYM_HOST_NAME-1)) {
       strncpy(symAddr, retrievedAddress->symAddress, MAX_LEN_SYM_HOST_NAME-4);
       symAddr[MAX_LEN_SYM_HOST_NAME-1] = '\0';
       symAddr[MAX_LEN_SYM_HOST_NAME-2] = '.';
       symAddr[MAX_LEN_SYM_HOST_NAME-3] = '.';
       symAddr[MAX_LEN_SYM_HOST_NAME-4] = '.';
     } else
-      strncpy(symAddr, retrievedAddress->symAddress, MAX_LEN_SYM_HOST_NAME-1);
-
+      safe_snprintf(__FILE__, __LINE__, symAddr, sizeof(symAddr), "%s",
+		    retrievedAddress->symAddress);
+    
     symAddrType = retrievedAddress->symAddressType;
 
     myGlobals.numResolvedFromCache++;
@@ -453,7 +454,8 @@
         symAddr[MAX_LEN_SYM_HOST_NAME-3] = '.';
         symAddr[MAX_LEN_SYM_HOST_NAME-4] = '.';
       } else
-        strncpy(symAddr, resolvedAddress, MAX_LEN_SYM_HOST_NAME-1);
+	safe_snprintf(__FILE__, __LINE__, symAddr,
+		      sizeof(symAddr), "%s", resolvedAddress);
 
       for(i=0; symAddr[i] != '\0'; i++)
         symAddr[i] = (char)tolower(symAddr[i]);
diff -uNr ntop-3.3.8/admin.c ntop-3.3.9/admin.c
--- ntop-3.3.8/admin.c	2008-08-05 12:06:31.000000000 +0200
+++ ntop-3.3.9/admin.c	2008-12-07 11:20:48.000000000 +0100
@@ -9,7 +9,6 @@
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
@@ -1131,12 +1130,21 @@
    tmpPrefs.devices = NULL;
 
    while(token != NULL) {
-     char *key, *value;
+     char *key, *value, value_buf[2048];
 
      key = strtok_r(token, "=", &strtokState);
      if(key != NULL) value = strtok_r(NULL, "=", &strtokState); else value = NULL;
 
-     /* traceEvent(CONST_TRACE_INFO, "RRD: key(%s)=%s", key, value); */
+	 if(value != NULL) {
+	  safe_snprintf (__FILE__, __LINE__, value_buf, sizeof(value_buf),
+					 "%s", value);
+  	  unescape_url(value_buf);
+      value = value_buf;
+	 }
+
+#if 0
+     traceEvent(CONST_TRACE_WARNING, "RRD: key(%s)=%s", key, value);
+#endif
 
      if(key) {
        action = processNtopPref(key, value, savePref, &tmpPrefs);
@@ -1461,7 +1469,7 @@
 
 void handleNtopConfig(char* url, UserPrefDisplayPage configScr,
 		      int postLen) {
-  char buf[1024], hostStr[MAXHOSTNAMELEN+16];
+  char buf[4096], token_buf[512], hostStr[MAXHOSTNAMELEN+16];
   bool startCap = FALSE;
   int len;
   UserPref defaults, *pref = &myGlobals.savedPref;
@@ -1488,13 +1496,17 @@
        */
 
       if((buf != NULL) && (buf [0] != '\0')) {
-	unescape_url(buf);
 
 	/* traceEvent (CONST_TRACE_INFO, "BUF='%s'\n", buf); */
 
 	/* locate the last parameter which tells us which button got pressed */
 	if ((token = rindex (buf, '&')) != NULL) {
 	  token++;
+      safe_snprintf(__FILE__, __LINE__, token_buf, sizeof(token_buf),
+					"%s", token);
+  	  unescape_url(token_buf);
+	  token = token_buf;
+
 	  if (strncmp (token, NTOP_SAVE_PREFS,
 		       strlen (NTOP_SAVE_PREFS)) == 0) {
 	    savePref = TRUE;
Dateien ntop-3.3.8/AS-list.txt.gz und ntop-3.3.9/AS-list.txt.gz sind verschieden.
diff -uNr ntop-3.3.8/autogen.sh ntop-3.3.9/autogen.sh
--- ntop-3.3.8/autogen.sh	2007-08-18 00:56:11.000000000 +0200
+++ ntop-3.3.9/autogen.sh	2008-12-03 23:00:22.000000000 +0100
@@ -244,6 +244,16 @@
   GNU_OR_DIE=0
 }
 
+WGET=`find_command 'wget*'`
+($WGET --version) < /dev/null > /dev/null 2>&1 ||
+{
+  echo
+  echo "You must have wget installed to compile $progname."
+  echo "Download the appropriate package for your distribution, or get the"
+  echo "source tarball from ftp://ftp.gnu.org/pub/gnu/wget"
+  GNU_OR_DIE=0
+}
+
 if test "$GNU_OR_DIE" -eq 0; then
   exit 1
 fi
diff -uNr ntop-3.3.8/config.sub ntop-3.3.9/config.sub
--- ntop-3.3.8/config.sub	2008-10-02 12:54:15.000000000 +0200
+++ ntop-3.3.9/config.sub	2008-12-03 23:00:22.000000000 +0100
@@ -1,10 +1,9 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
-timestamp='2007-06-28'
+timestamp='2005-12-11'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -241,16 +240,15 @@
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| fido | fr30 | frv \
+	| fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
-	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore | mep \
+	| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -270,25 +268,26 @@
 	| mn10200 | mn10300 \
 	| mt \
 	| msp430 \
-	| nios | nios2 \
 	| ns16k | ns32k \
 	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| score \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
-	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
-	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-	| spu | strongarm \
+	| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b \
+	| strongarm \
 	| tahoe | thumb | tic4x | tic80 | tron \
 	| v850 | v850e \
 	| we32k \
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
 	| z8k)
 		basic_machine=$basic_machine-unknown
 		;;
+	m32c)
+		basic_machine=$basic_machine-unknown
+		;;
 	m6811 | m68hc11 | m6812 | m68hc12)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
@@ -318,18 +317,18 @@
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-	| avr-* | avr32-* \
+	| avr-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
-	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
-	| m32c-* | m32r-* | m32rle-* \
+	| m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
 	| m88110-* | m88k-* | maxq-* | mcore-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
@@ -351,28 +350,29 @@
 	| mmix-* \
 	| mt-* \
 	| msp430-* \
-	| nios-* | nios2-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
 	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
 	| tahoe-* | thumb-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tron-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
 	| xstormy16-* | xtensa-* \
 	| ymp-* \
 	| z8k-*)
 		;;
+	m32c-*)
+		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
 	386bsd)
@@ -475,8 +475,8 @@
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16)
-		basic_machine=cr16-unknown
+	cr16c)
+		basic_machine=cr16c-unknown
 		os=-elf
 		;;
 	crds | unos)
@@ -683,10 +683,6 @@
 		basic_machine=i386-pc
 		os=-mingw32
 		;;
-	mingw32ce)
-		basic_machine=arm-unknown
-		os=-mingw32ce
-		;;
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
@@ -822,12 +818,6 @@
 	pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
-	pc98)
-		basic_machine=i386-pc
-		;;
-	pc98-*)
-		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
 	pentium | p5 | k5 | k6 | nexgen | viac3)
 		basic_machine=i586-pc
 		;;
@@ -914,10 +904,6 @@
 	sb1el)
 		basic_machine=mipsisa64sb1el-unknown
 		;;
-	sde)
-		basic_machine=mipsisa32-sde
-		os=-elf
-		;;
 	sei)
 		basic_machine=mips-sei
 		os=-seiux
@@ -929,9 +915,6 @@
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
-	sh5el)
-		basic_machine=sh5le-unknown
-		;;
 	sh64)
 		basic_machine=sh64-unknown
 		;;
@@ -1137,7 +1120,7 @@
 	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
-	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+	sparc | sparcv8 | sparcv9 | sparcv9b)
 		basic_machine=sparc-sun
 		;;
 	cydra)
@@ -1210,8 +1193,7 @@
 	      | -aos* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -openbsd* | -solidbsd* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
@@ -1226,7 +1208,7 @@
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+	      | -skyos* | -haiku* | -rdos*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1378,12 +1360,6 @@
 # system, and we'll never get to this point.
 
 case $basic_machine in
-        score-*)
-		os=-elf
-		;;
-        spu-*)
-		os=-elf
-		;;
 	*-acorn)
 		os=-riscix1.2
 		;;
@@ -1393,9 +1369,9 @@
 	arm*-semi)
 		os=-aout
 		;;
-        c4x-* | tic4x-*)
-        	os=-coff
-		;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
 	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20
@@ -1421,9 +1397,6 @@
 	m68*-cisco)
 		os=-aout
 		;;
-        mep-*)
-		os=-elf
-		;;
 	mips*-cisco)
 		os=-elf
 		;;
diff -uNr ntop-3.3.8/configure.in ntop-3.3.9/configure.in
--- ntop-3.3.8/configure.in	2008-10-02 12:54:15.000000000 +0200
+++ ntop-3.3.9/configure.in	2008-12-03 23:00:22.000000000 +0100
@@ -45,12 +45,12 @@
 dnl>   Edit NTOP_VERSION_EXTRA to put something extra (e.g. SourceForge rpm version"
 dnl>       into the stamp.
 dnl>
-AC_INIT([ntop],[3.3.8])
+AC_INIT([ntop],[3.3.9])
 
 dnl> The prereq is really 2.53, i.e. automake 1.6, but Darwin uses 2.52...
 AC_PREREQ([2.52])
 
-SCRIPTVER="v3.3.8-02-10-2008"
+SCRIPTVER="v3.3.9-06-11-2008"
 
 dnl>
 dnl> generate the config header
@@ -509,7 +509,7 @@
 CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/opt/local/include"
 LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/opt/local/lib"
 
-
+PWD=`pwd`
 
 echo
 echo "Test the compiler and setup CFLAGS..."
@@ -1537,6 +1537,7 @@
    AC_DEFINE_UNQUOTED(HAVE_PERL, 1, [PERL is supported])
 else
   AC_MSG_RESULT(no)
+  echo "Please install the perl module ExtUtils::Embed in order to enable perl support in ntop"
 fi
 
 else
@@ -1885,6 +1886,41 @@
     }'`
 fi
 
+dnl> GeoIP (http://www.maxmind.com/)
+if test -f "GeoIP.tar.gz"; then
+   echo "GeoIP already present on this machine"
+else
+   wget http://www.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
+   tar xvfz GeoIP.tar.gz
+   GEO_DIR=`find $PWD -type d -name "GeoIP-*"`
+   cd $GEO_DIR; ./configure; make; cd ..
+   # OSX Fix
+   GEO_DYLIB="$GEO_DIR/libGeoIP/.libs/libGeoIP.dylib"
+   if test -f $GEO_DYLIB; then
+      ln -s $GEO_DYLIB .
+   fi
+fi
+
+if test -f "GeoLiteCity.dat"; then
+   echo "GeoLiteCity.dat already present"
+else
+   wget http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
+   gunzip GeoLiteCity.dat.gz
+fi
+
+if test -f "GeoIPASNum.dat"; then
+   echo "GeoIPASNum.dat already present"
+else
+   wget http://www.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
+   gunzip GeoIPASNum.dat.gz
+fi
+
+
+GEO_DIR=`find $PWD -type d -name "GeoIP-*"`
+GEO_IP="$GEO_DIR/libGeoIP/"
+CFLAGS="$CFLAGS -I$GEO_IP"
+LDFLAGS="$LDFLAGS -L$GEO_IP.libs/ -lGeoIP"
+
 dnl> NTOPCONFIGDEBUG_SETTINGS([precet])
 
 if test -d ./configureextra; then
@@ -2048,6 +2084,7 @@
 AC_SUBST(SO_VERSION_PATCH)
 AC_SUBST(RRD_LIB)
 AC_SUBST(RRD_INC)
+AC_SUBST(GEO_DIR)
 
 AC_CONFIG_FILES([Makefile])
 
diff -uNr ntop-3.3.8/COPYING ntop-3.3.9/COPYING
--- ntop-3.3.8/COPYING	2008-10-02 12:54:15.000000000 +0200
+++ ntop-3.3.9/COPYING	2008-12-03 23:00:22.000000000 +0100
@@ -1,626 +1,285 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
 
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
-                            Preamble
+			    Preamble
 
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
 your programs, too.
 
   When we speak of free software, we are referring to freedom, not
 price.  Our General Public Licenses are designed to make sure that you
 have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
 
   For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
 
   The precise terms and conditions for copying, distribution and
 modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
 this License.
 
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
 otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
 
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
 be similar in spirit to the present version, but may differ in detail to
 address new problems or concerns.
 
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
 
   If you develop a new program, and you want it to be of the greatest
 possible use to the public, the best way to achieve this is to make it
@@ -628,15 +287,15 @@
 
   To do so, attach the following notices to the program.  It is safest
 to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
+convey the exclusion of warranty; and each file should have at least
 the "copyright" line and a pointer to where the full notice is found.
 
     <one line to give the program's name and a brief idea of what it does.>
     Copyright (C) <year>  <name of author>
 
-    This program is free software: you can redistribute it and/or modify
+    This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
+    the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
     This program is distributed in the hope that it will be useful,
@@ -645,30 +304,37 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
 
 Also add information on how to contact you by electronic and paper mail.
 
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
 
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
     This is free software, and you are welcome to redistribute it
     under certain conditions; type `show c' for details.
 
 The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff -uNr ntop-3.3.8/depcomp ntop-3.3.9/depcomp
--- ntop-3.3.8/depcomp	2008-10-02 12:54:15.000000000 +0200
+++ ntop-3.3.9/depcomp	2008-12-03 23:00:22.000000000 +0100
@@ -1,9 +1,9 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2007-03-29.01
+scriptversion=2006-10-15.18
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
 # Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -215,39 +215,34 @@
   # current directory.  Also, the AIX compiler puts `$object:' at the
   # start of each line; $object doesn't have directory information.
   # Version 6 uses the directory in both cases.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
   if test "$libtool" = yes; then
-    tmpdepfile1=$dir$base.u
-    tmpdepfile2=$base.u
-    tmpdepfile3=$dir.libs/$base.u
     "$@" -Wc,-M
   else
-    tmpdepfile1=$dir$base.u
-    tmpdepfile2=$dir$base.u
-    tmpdepfile3=$dir$base.u
     "$@" -M
   fi
   stat=$?
 
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
   if test $stat -eq 0; then :
   else
-    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    rm -f "$tmpdepfile"
     exit $stat
   fi
 
-  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
-  do
-    test -f "$tmpdepfile" && break
-  done
   if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
     # Each line is of the form `foo.o: dependent.h'.
     # Do two passes, one to just change these to
     # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-    # That's a tab and a space in the [].
-    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile
diff -uNr ntop-3.3.8/globals-core.c ntop-3.3.9/globals-core.c
--- ntop-3.3.8/globals-core.c	2008-10-01 23:03:36.000000000 +0200
+++ ntop-3.3.9/globals-core.c	2008-12-03 23:00:22.000000000 +0100
@@ -210,7 +210,6 @@
     exit(-1);
   }
 
-
   /* Databases */
   myGlobals.dnsCacheFile = NULL;
   myGlobals.pwFile = NULL;
@@ -341,6 +340,7 @@
   createMutex(&myGlobals.queueAddressMutex);
 
   createMutex(&myGlobals.gdbmMutex);        /* data to synchronize thread access to db files */
+  createMutex(&myGlobals.portsMutex);       /* Avoid race conditions while handling ports */
 
   for(i=0; i<NUM_SESSION_MUTEXES; i++)
     createMutex(&myGlobals.tcpSessionsMutex[i]); /* data to synchronize TCP sessions access */
@@ -642,6 +642,8 @@
   addNewIpProtocolToHandle("OSPF", 89, 0 /* no proto */);
   addNewIpProtocolToHandle("IPsec", 50, 51);
 
+  init_maps();
+
   if(fetchPrefsValue("globals.displayPolicy", value, sizeof(value)) == -1) {
     myGlobals.hostsDisplayPolicy = showAllHosts /* 0 */;
     storePrefsValue("globals.displayPolicy", "0");
diff -uNr ntop-3.3.8/globals-core.h ntop-3.3.9/globals-core.h
--- ntop-3.3.8/globals-core.h	2008-10-01 23:03:36.000000000 +0200
+++ ntop-3.3.9/globals-core.h	2008-11-07 12:04:30.000000000 +0100
@@ -727,7 +727,6 @@
 extern u_int numActiveVsans(u_int deviceId);
 extern u_int32_t xaton(char *s);
 extern void* addNodeInternal(u_int32_t ip, int prefix, char *country, int as);
-extern char *ip2CountryCode(HostAddr ip);
 extern short addrcmp(HostAddr *addr1, HostAddr *addr2);
 extern HostAddr     * addrcpy(HostAddr *dst, HostAddr *src);
 extern int            addrinit(HostAddr *addr);
@@ -742,7 +741,6 @@
 extern u_int16_t computeTransId(HostAddr *srcAddr, HostAddr *dstAddr,
 				int sport, int dport);
 extern int setSpecifiedUser(void);
-extern u_short ip2AS(HostAddr ip);
 extern u_int16_t getHostAS(HostTraffic *el);
 extern int emptySerial(HostSerial *a);
 extern int cmpSerial(HostSerial *a, HostSerial *b);
diff -uNr ntop-3.3.8/globals-defines.h ntop-3.3.9/globals-defines.h
--- ntop-3.3.8/globals-defines.h	2008-10-02 12:54:15.000000000 +0200
+++ ntop-3.3.9/globals-defines.h	2008-12-09 12:41:47.000000000 +0100
@@ -946,11 +946,6 @@
 #define CONST_ASLIST_FILE                   "AS-list.txt"
 
 /*
- * IP to CountryCode file
- */
-#define CONST_P2C_FILE                      "p2c.opt.table"
-
-/*
  * libgd file name
  */
 #define CONST_LIBGD_SO                      "libgd.so"
@@ -1057,6 +1052,11 @@
 /* #define MAX_NETFLOW_PACKET_BUFFER           16  */
 
 /*
+	http://code.google.com/apis/maps/
+*/
+#define GOOGLE_DEFAULT_MAP_KEY "ABQIAAAAfFZuochHQVROgoyQEe3_SBS6yewdwLQqdZ11GEdkGrSPz1gWRxTmFdYiXZrTS3LFawwiK5Pufj5j1Q"
+
+/*
  * FibreChannel/SCSI constants
  */
 
@@ -1185,6 +1185,7 @@
 #define CONST_PRIVACYFORCE_HTML             "privacyFlagForce.html"
 #define CONST_PRIVACYNOTICE_HTML            "privacyNotice.html"
 #define CONST_PURGE_HOST                    "purgeHost.html"
+#define CONST_HOST_MAP                      "hostMap.html"
 #define CONST_RESET_STATS_HTML              "resetStats.html"
 #define CONST_SCSI_BYTES_HTML               "ScsiBytes.html"
 #define CONST_BAR_LUNSTATS_DIST             "ScsiBytesLunDistribution"
@@ -1610,7 +1611,7 @@
 #define CONST_IMG_FIBRECHANNEL_SWITCH  "<img class=tooltip src=\"/switch.gif\" border=\"0\" alt=\"FibreChannel Switch\" title=\"FibreChannel Switch\">"
 #define CONST_IMG_DHCP_CLIENT          "<img class=tooltip src=\"/bulb.gif\" border=\"0\" alt=\"DHCP Client\" title=\"DHCP Client\">"
 #define CONST_IMG_DHCP_SERVER          "<img class=tooltip src=\"/antenna.gif\" border=\"0\" alt=\"DHCP Server\" title=\"DHCP Server\">"
-#define CONST_IMG_MULTIHOMED           "<img class=tooltip src=\"/multihomed.gif\" border=\"0\" alt=\"Multihomed\" title=\"Multihomed\">"
+#define CONST_IMG_MULTIHOMED           "<img class=tooltip src=\"/multihomed.png\" border=\"0\" alt=\"Multihomed\" title=\"Multihomed\">"
 #define CONST_IMG_MULTIVLANED          "<img class=tooltip src=\"/multivlaned.gif\"\" border=\"0\" alt=\"Multivlaned\" title=\"Multivlaned\">"
 #define CONST_IMG_BRIDGE               "<img class=tooltip src=\"/bridge.gif\" border=\"0\" alt=\"Bridge\" title=\"Bridge\">"
 #define CONST_IMG_ROUTER               "<img class=tooltip src=\"/router.gif\" border=\"0\" alt=\"Router\" title=\"Router\">"
@@ -2104,7 +2105,11 @@
  */
 #define DEFAULT_TRACE_LEVEL                 3
 
+#if 0
 #define DEFAULT_NTOP_MAPPER_URL             "http://www.ntop.org/cgi-bin/mapper.pl" /* -U -*/
+#else
+#define DEFAULT_NTOP_MAPPER_URL             "http://geotool.servehttp.com/" /* -U -*/
+#endif
 
 #ifdef MAKE_WITH_SCHED_YIELD
 #define DEFAULT_NTOP_SCHED_YIELD            TRUE
@@ -2805,6 +2810,10 @@
 #define IP_TCP_PORT_JETDIRECT      9100
 #define IP_TCP_PORT_SKYPE          54045
 
+/* GeoIP - http://www.maxmind.com */
+#define GEO_IP_FILE                "GeoLiteCity.dat"
+#define GEO_IP_ASN_FILE            "GeoIPASNum.dat"
+
 #define NULL_VALUE                 "(null)"
 
 /* NTOP preference names */
diff -uNr ntop-3.3.8/globals-report.h ntop-3.3.9/globals-report.h
--- ntop-3.3.8/globals-report.h	2008-07-21 00:40:06.000000000 +0200
+++ ntop-3.3.9/globals-report.h	2008-11-07 01:56:35.000000000 +0100
@@ -362,3 +362,7 @@
 extern void drawVsanSwilsProtoDistribution(u_short vsanId);
 
 extern int handlePerlHTTPRequest(char *url);
+
+/* map.c */
+extern void init_maps(void);
+extern void create_host_map(void);
diff -uNr ntop-3.3.8/globals-structtypes.h ntop-3.3.9/globals-structtypes.h
--- ntop-3.3.8/globals-structtypes.h	2008-08-11 01:05:06.000000000 +0200
+++ ntop-3.3.9/globals-structtypes.h	2008-12-03 23:00:22.000000000 +0100
@@ -835,6 +835,7 @@
   u_int16_t        vlanId;          /* VLAN Id (-1 if not set) */
   u_int16_t        ifId;            /* Interface Id [e.g. for NetFlow] (-1 if not set) */
   u_int16_t        hostAS;          /* AS to which the host belongs to */
+  char             *hostASDescr;    /* Description of the host AS */
   time_t           firstSeen, lastSeen; /* time when this host has sent/rcvd some data  */
   u_char           ethAddress[LEN_ETHERNET_ADDRESS];
   u_char           lastEthAddress[LEN_ETHERNET_ADDRESS]; /* used for remote addresses */
@@ -842,11 +843,12 @@
   char             hostNumIpAddress[20] /* xxx.xxx.xxx.xxx */, *dnsDomainValue, *dnsTLDValue;
   u_int8_t         network_mask;    /* IPv6 notation e.g. /24 */
   int8_t           known_subnet_id; /* UNKNOWN_SUBNET_ID if the host does not belong to a known subnet */
-  char             *hwModel, *description, *community, *ip2ccValue, *fingerprint;
+  char             *hwModel, *description, *community, *fingerprint;
   char             hostResolvedName[MAX_LEN_SYM_HOST_NAME];
   short            hostResolvedNameType;
   u_short          minTTL, maxTTL; /* IP TTL (Time-To-Live) */
   struct timeval   minLatency, maxLatency;
+  GeoIPRecord      *geo_ip;
 
   TrafficCounter   greSent, greRcvd, greEfficiencySent, greEfficiencyRcvd,
     grePktSent, grePktRcvd, lastGrePktSent, lastGrePktRcvd;
@@ -1999,15 +2001,6 @@
 };
 #endif /* HAVE_GETOPT_H */
 
-/* Courtesy of Andreas Pfaller <apfaller@yahoo.com.au> */
-typedef struct IPNode {
-  struct IPNode *b[2];
-  union {
-    char cc[4]; /* Country */
-    u_short as; /* AS */
-  } node;
-} IPNode;
-
 /* *************************************************************** */
 
 typedef enum {
@@ -2262,7 +2255,7 @@
   /*
    * Control mutexes
    */
-  PthreadMutex gdbmMutex;
+  PthreadMutex gdbmMutex, portsMutex;
   PthreadMutex tcpSessionsMutex[NUM_SESSION_MUTEXES];
   PthreadMutex fcSessionsMutex; /* One mutex should be enough */
   PthreadMutex purgePortsMutex;
@@ -2468,14 +2461,6 @@
     numVendorLookupFoundMulticast,
     numVendorLookupFoundLAA;
 
-  /* Country flags */
-  IPNode *countryFlagHead;
-  int  ipCountryMem, ipCountryCount;
-
-  /* AS */
-  IPNode *asHead;
-  int    asMem, asCount;
-
   /* Memory usage */
   int piMem, ippmtmMem;
 
@@ -2499,8 +2484,7 @@
       queueBufferCount,
       processBufferInit,
       processBufferCount;
-  float qmaxDelay,
-        pmaxDelay;
+  float qmaxDelay, pmaxDelay;
 #endif
 
 #ifdef PARM_ENABLE_EXPERIMENTAL
@@ -2510,5 +2494,9 @@
   u_int8_t  calculateEfficiency;
   /* If the traffic is divided in cells (e.g. ATM, cell payload is 47 bytes) this is the cell lenght */
   u_int16_t cellLength; 
+
+  /* GeoIP */
+  GeoIP *geo_ip_db, *geo_ip_asn_db;
+
 } NtopGlobals;
 
diff -uNr ntop-3.3.8/hash.c ntop-3.3.9/hash.c
--- ntop-3.3.8/hash.c	2008-08-05 12:06:31.000000000 +0200
+++ ntop-3.3.9/hash.c	2008-11-07 12:04:30.000000000 +0100
@@ -472,11 +472,11 @@
   host->dnsDomainValue = NULL;
   if(host->dnsTLDValue != NULL) free(host->dnsTLDValue);
   host->dnsTLDValue = NULL;
+  if(host->hostASDescr != NULL) free(host->hostASDescr);
   if(host->description != NULL) free(host->description);
   if(host->hwModel != NULL) free(host->hwModel);
   if(host->community != NULL) free(host->community);
-  if(host->ip2ccValue != NULL) free(host->ip2ccValue);
-  host->ip2ccValue = NULL;
+  if(host->geo_ip) GeoIPRecord_delete(host->geo_ip);
 
   /* ********** */
   /*
Dateien ntop-3.3.8/html/multihomed.gif und ntop-3.3.9/html/multihomed.gif sind verschieden.
Dateien ntop-3.3.8/html/multihomed.png und ntop-3.3.9/html/multihomed.png sind verschieden.
diff -uNr ntop-3.3.8/http.c ntop-3.3.9/http.c
--- ntop-3.3.8/http.c	2008-10-02 12:54:15.000000000 +0200
+++ ntop-3.3.9/http.c	2008-11-07 01:56:35.000000000 +0100
@@ -546,7 +546,8 @@
 		  "	[null,'Summary',null,null,null,\n"
 		  "		[null,'Traffic','/" CONST_TRAFFIC_STATS_HTML "',null,null],\n"
 		  "		[null,'Hosts','/" CONST_HOSTS_INFO_HTML "',null,null],\n"
-		  "		[null,'Network Load','/" CONST_SORT_DATA_THPT_STATS_HTML "',null,null],\n");
+		  "		[null,'Network Load','/" CONST_SORT_DATA_THPT_STATS_HTML "',null,null],\n"
+		  "		[null,'Hosts World Map','/" CONST_HOST_MAP "',null,null],\n");
   if(myGlobals.haveVLANs == TRUE)
     sendStringWOssi(
 		    "		[null,'VLAN Info','/" CONST_VLAN_LIST_HTML "',null,null],\n");
@@ -2178,8 +2179,11 @@
     storePrefsValue("globals.displayPolicy", tmp);
   }
 
-  if(pageName[0] == '\0')
+  if(pageName[0] == '\0') {
+    /* Default ntop entry page */
     strncpy(pageName, CONST_TRAFFIC_STATS_HTML, sizeof(CONST_TRAFFIC_STATS_HTML));
+    /* strncpy(pageName, CONST_HOST_MAP, sizeof(CONST_HOST_MAP)); */
+  }
 
   /* Generic w3c p3p request? force it to ours... */
   if(strncmp(pageName, CONST_W3C_P3P_XML, strlen(CONST_W3C_P3P_XML)) == 0)
@@ -3245,6 +3249,11 @@
       } else if(strncasecmp(pageName, CONST_PURGE_HOST, strlen(CONST_PURGE_HOST)) == 0) {
 	sendHTTPHeader(FLAG_HTTP_TYPE_HTML, 0, 1);
 	purgeHost(db_key);
+      } else if(strncasecmp(pageName, CONST_HOST_MAP, strlen(CONST_HOST_MAP)) == 0) {
+	sendHTTPHeader(FLAG_HTTP_TYPE_HTML, 0, 1);
+	printHTMLheader("Hosts World Map", NULL, 0);
+	create_host_map();
+	printTrailer = 1;
       } else if(strlen(pageName) > 5) {
 	char hostName[32];
 
diff -uNr ntop-3.3.8/iface.c ntop-3.3.9/iface.c
--- ntop-3.3.8/iface.c	2008-06-13 08:13:26.000000000 +0200
+++ ntop-3.3.9/iface.c	2008-11-05 15:52:33.000000000 +0100
@@ -39,13 +39,15 @@
 /* ************************************************* */
 
 static struct in6_addr *in6_cpy(struct in6_addr *dst, struct in6_addr *src) {
-  return memcpy(dst, src, sizeof(struct in6_addr));
+  memcpy(dst, src, sizeof(struct in6_addr));
+  return(dst);
 }
 
 /* ************************************************* */
 
 static struct in_addr *in4_cpy(struct in_addr *dst, struct in_addr *src) {
-  return memcpy(dst, src, sizeof(struct in_addr));
+  memcpy(dst, src, sizeof(struct in_addr));
+  return(dst);
 }
 
 /* ************************************************* */
diff -uNr ntop-3.3.8/initialize.c ntop-3.3.9/initialize.c
--- ntop-3.3.8/initialize.c	2008-09-15 23:42:02.000000000 +0200
+++ ntop-3.3.9/initialize.c	2008-12-03 23:00:22.000000000 +0100
@@ -25,8 +25,6 @@
 #include "ntop.h"
 #include "globals-report.h"
 
-static void initIPCountryTable(void); /* Forward */
-
 /*
  * calculate the domain name for this host
  */
@@ -209,66 +207,6 @@
 
 /* ******************************* */
 
-static void initIPCountryTable(void) {
-  u_char compressedFormat;
-  char buf[LEN_GENERAL_WORK_BUFFER];
-  FILE* fd;
-
-  myGlobals.ipCountryCount = 0;
-  if((myGlobals.countryFlagHead = malloc(sizeof(IPNode))) == NULL) {
-    traceEvent(CONST_TRACE_FATALERROR, "IP2CC: Unable to allocate table memory. Quitting...");
-    exit(4); /* Just in case */
-  }
-  myGlobals.ipCountryMem += sizeof(IPNode);
-
-  strcpy(myGlobals.countryFlagHead->node.cc, "***");
-
-  myGlobals.countryFlagHead->b[0]=NULL;
-  myGlobals.countryFlagHead->b[1]=NULL;
-
-  if (!myGlobals.runningPref.printFcOnly) {
-    fd=checkForInputFile("IP2CC",
-			 "IP address <-> Country Code mapping",
-			 CONST_P2C_FILE,
-			 NULL,
-			 &compressedFormat);
-      if(fd != NULL) {
-          char *strtokState, *cc, *ip, *prefix;
-          int numRead=0;
-
-          while(readInputFile(fd,
-                              "IP2CC",
-                              FALSE,
-                              compressedFormat,
-			      10000,
-                              buf, sizeof(buf),
-                              &numRead) == 0) {
-              if((cc=strtok_r(buf, ":", &strtokState))       == NULL) continue;
-              if((ip=strtok_r(NULL, "/", &strtokState))      == NULL) continue;
-              if((prefix=strtok_r(NULL, "\n", &strtokState)) == NULL) continue;
-
-              strtolower(cc);
-
-              if(addNodeInternal(xaton(ip), atoi(prefix), cc, 0) == NULL) {
-                traceEvent(CONST_TRACE_FATALERROR,
-                           "IP2CC: Insufficient memory to load table");
-                /* This isn't fatal of an itself, but we'll fail every malloc() from here on ... */
-                exit(5); /* Just in case */
-              }
-          }
-
-          myGlobals.ipCountryCount += numRead;
-      } else {
-          traceEvent(CONST_TRACE_WARNING,
-                     "IP2CC: Unable to read IP address <-> Country code mapping file (non-existant or no data)");
-          traceEvent(CONST_TRACE_INFO,
-                     "IP2CC: ntop will perform correctly but without this minor feature");
-      }
-  }
-}
-
-/* ******************************* */
-
 void createDeviceIpProtosList(int devIdx) {
   size_t len = (size_t)myGlobals.numIpProtosList*sizeof(TrafficCounter);
 
@@ -528,56 +466,40 @@
   myGlobals.sessionsCacheReused = 0;
 #endif
 
-  /*
-   * Process ASN file
-   */
-  numRead=0;
-  myGlobals.haveASN = FALSE;
-  if (!myGlobals.runningPref.printFcOnly) {
-      fd=checkForInputFile("ASN",
-                           "Autonomous System Number table",
-                           CONST_ASLIST_FILE,
-                           NULL,
-                           &compressedFormat);
-      if(fd != NULL) {
-          char *strtokState, *as, *ip, *prefix;
-
-          memset(&buf, 0, sizeof(buf));
-
-          myGlobals.asHead = malloc(sizeof(IPNode));
-          memset(myGlobals.asHead, 0, sizeof(IPNode));
-          myGlobals.asHead->node.as = 0;
-          myGlobals.asMem += sizeof(IPNode);
-
-          while(readInputFile(fd,
-                              "ASN",
-                              FALSE,
-                              compressedFormat,
-                              25000,
-                              buf, sizeof(buf),
-                              &numRead) == 0) {
-
-              if((as = strtok_r(buf, ":", &strtokState)) == NULL)  continue;
-              if((ip = strtok_r(NULL, "/", &strtokState)) == NULL)  continue;
-              if((prefix = strtok_r(NULL, "\n", &strtokState)) == NULL)  continue;
-
-              if(addNodeInternal(xaton(ip), atoi(prefix), NULL, atoi(as)) == NULL) {
-                traceEvent(CONST_TRACE_FATALERROR,
-                           "ASN: Insufficient memory to load table");
-                /* This isn't fatal of an itself, but we'll fail every malloc() from here on ... */
-                exit(6); /* Just in case */
-              }
-
-              myGlobals.asCount++;
-          }
-          traceEvent(CONST_TRACE_INFO, "ASN: ....Used %d KB of memory (%d per entry)",
-                     ((myGlobals.asMem+512)/1024), (int)sizeof(IPNode));
-          myGlobals.haveASN = TRUE;
-      } else
-          traceEvent(CONST_TRACE_NOISY, "ASN: ntop continues ok, but without ASN information.");
+  /* Initialize GeoIP databases */
+  for(i=0; myGlobals.configFileDirs[i] != NULL; i++) {
+    char path[256];
+    
+    safe_snprintf(__FILE__, __LINE__, path, sizeof(path),
+		  "%s%c%s",
+		  myGlobals.configFileDirs[i], CONST_PATH_SEP, GEO_IP_FILE);
+    revertSlashIfWIN32(path, 0);
+    if((myGlobals.geo_ip_db = GeoIP_open(path, GEOIP_CHECK_CACHE)) != NULL) {
+      traceEvent(CONST_TRACE_INFO, "GeoIP: loaded config file %s", path);
+      break;
+    }
   }
+  
+  if(myGlobals.geo_ip_db == NULL)
+    traceEvent(CONST_TRACE_ERROR, "GeoIP: unable to load file %s", GEO_IP_FILE);
+  
+  /* *************************** */
 
-  initIPCountryTable();
+  for(i=0; myGlobals.configFileDirs[i] != NULL; i++) {
+    char path[256];
+    
+    safe_snprintf(__FILE__, __LINE__, path, sizeof(path),
+		  "%s%c%s",
+		  myGlobals.configFileDirs[i], CONST_PATH_SEP, GEO_IP_ASN_FILE);
+    revertSlashIfWIN32(path, 0);
+    if((myGlobals.geo_ip_asn_db = GeoIP_open(path, GEOIP_CHECK_CACHE)) != NULL) {
+      traceEvent(CONST_TRACE_INFO, "GeoIP: loaded ASN config file %s", path);
+      break;
+    }
+  }
+  
+  if(myGlobals.geo_ip_asn_db == NULL)
+    traceEvent(CONST_TRACE_ERROR, "GeoIP: unable to load ASN file %s", GEO_IP_ASN_FILE);  
 }
 
 
@@ -787,6 +709,7 @@
  */
   createMutex(&myGlobals.logViewMutex);
   createMutex(&myGlobals.gdbmMutex);        /* data to synchronize thread access to db files */
+  createMutex(&myGlobals.portsMutex);       /* Avoid race conditions while handling ports */
 
   for(i=0; i<NUM_SESSION_MUTEXES; i++)
     createMutex(&myGlobals.tcpSessionsMutex[i]); /* data to synchronize TCP sessions access */
@@ -1241,15 +1164,14 @@
 
       strncat(workDevices,
               myGlobals.device[i].name,
-              (sizeof(workDevices) - strlen(workDevices) - hasSpace));
+              (mallocLen - strlen(workDevices) - hasSpace));
     }
   }
 
   if(myGlobals.runningPref.devices != NULL)
     free(myGlobals.runningPref.devices);
 
-  myGlobals.runningPref.devices = strdup(workDevices);
-  free(workDevices);
+  myGlobals.runningPref.devices = workDevices;
 
   /* ********************************************** */
 
@@ -1698,6 +1620,7 @@
   u_int mallocLen;
 #endif
   u_int deviceId = myGlobals.numDevices;
+  int i;
 
   traceEvent(CONST_TRACE_INFO, "Creating dummy interface, '%s'", ifName);
 
@@ -1721,7 +1644,7 @@
   myGlobals.device[deviceId].virtualDevice = 0;
   myGlobals.device[deviceId].activeDevice  = 0;
   myGlobals.device[deviceId].samplingRate =  myGlobals.runningPref.samplingRate;
-  calculateUniqueInterfaceName(deviceId);
+  calculateUniqueInterfaceName(deviceId); 
 
   if(myGlobals.otherHostEntry != NULL) {
     myGlobals.device[deviceId].hash_hostTraffic[OTHER_HOSTS_ENTRY] = myGlobals.otherHostEntry;
@@ -1754,5 +1677,14 @@
     memset(myGlobals.device[deviceId].tcpSession, 0, len);
   }
 
+  /* Allocate memory for dhcp stats */
+
+  for(i=0; i<myGlobals.numKnownSubnets; i++) {
+    myGlobals.device[deviceId].networkHost[i].protocolInfo = calloc(1, sizeof(ProtocolInfo));
+    myGlobals.device[deviceId].networkHost[i].protocolInfo->dnsStats = calloc(1, sizeof(ServiceStats));
+    myGlobals.device[deviceId].networkHost[i].protocolInfo->httpStats = calloc(1, sizeof(ServiceStats));
+    myGlobals.device[deviceId].networkHost[i].protocolInfo->dhcpStats = calloc(1, sizeof(DHCPStats));
+  }
+
   return(deviceId);
 }
diff -uNr ntop-3.3.8/INSTALL ntop-3.3.9/INSTALL
--- ntop-3.3.8/INSTALL	2008-10-02 12:54:15.000000000 +0200
+++ ntop-3.3.9/INSTALL	2008-12-03 23:00:22.000000000 +0100
@@ -2,7 +2,7 @@
 *************************
 
 Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007 Free Software Foundation, Inc.
+2006 Free Software Foundation, Inc.
 
 This file is free documentation; the Free Software Foundation gives
 unlimited permission to copy, distribute and modify it.
@@ -67,9 +67,6 @@
      all sorts of other programs in order to regenerate files that came
      with the distribution.
 
-  6. Often, you can also type `make uninstall' to remove the installed
-     files again.
-
 Compilers and Options
 =====================
 
diff -uNr ntop-3.3.8/install-sh ntop-3.3.9/install-sh
--- ntop-3.3.8/install-sh	2008-10-02 12:54:15.000000000 +0200
+++ ntop-3.3.9/install-sh	2008-12-03 23:00:22.000000000 +0100
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2006-12-25.00
+scriptversion=2006-10-14.15
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -48,7 +48,7 @@
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
-doit=${DOITPROG-}
+doit="${DOITPROG-}"
 if test -z "$doit"; then
   doit_exec=exec
 else
@@ -58,49 +58,34 @@
 # Put in absolute file names if you don't have them in your path;
 # or use environment vars.
 
-chgrpprog=${CHGRPPROG-chgrp}
-chmodprog=${CHMODPROG-chmod}
-chownprog=${CHOWNPROG-chown}
-cmpprog=${CMPPROG-cmp}
-cpprog=${CPPROG-cp}
-mkdirprog=${MKDIRPROG-mkdir}
-mvprog=${MVPROG-mv}
-rmprog=${RMPROG-rm}
-stripprog=${STRIPPROG-strip}
-
-posix_glob='?'
-initialize_posix_glob='
-  test "$posix_glob" != "?" || {
-    if (set -f) 2>/dev/null; then
-      posix_glob=
-    else
-      posix_glob=:
-    fi
-  }
-'
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
 
+posix_glob=
 posix_mkdir=
 
 # Desired mode of installed file.
 mode=0755
 
-chgrpcmd=
 chmodcmd=$chmodprog
 chowncmd=
-mvcmd=$mvprog
-rmcmd="$rmprog -f"
+chgrpcmd=
 stripcmd=
-
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
 src=
 dst=
 dir_arg=
-dst_arg=
-
-copy_on_change=false
+dstarg=
 no_target_directory=
 
-usage="\
-Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
    or: $0 [OPTION]... SRCFILES... DIRECTORY
    or: $0 [OPTION]... -t DIRECTORY SRCFILES...
    or: $0 [OPTION]... -d DIRECTORIES...
@@ -110,55 +95,65 @@
 In the 4th, create DIRECTORIES.
 
 Options:
-     --help     display this help and exit.
-     --version  display version info and exit.
-
-  -c            (ignored)
-  -C            install only if different (preserve the last data modification time)
-  -d            create directories instead of installing files.
-  -g GROUP      $chgrpprog installed files to GROUP.
-  -m MODE       $chmodprog installed files to MODE.
-  -o USER       $chownprog installed files to USER.
-  -s            $stripprog installed files.
-  -t DIRECTORY  install into DIRECTORY.
-  -T            report an error if DSTFILE is a directory.
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
 
 Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
-  RMPROG STRIPPROG
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
 "
 
 while test $# -ne 0; do
   case $1 in
-    -c) ;;
-
-    -C) copy_on_change=true;;
+    -c) shift
+        continue;;
 
-    -d) dir_arg=true;;
+    -d) dir_arg=true
+        shift
+        continue;;
 
     -g) chgrpcmd="$chgrpprog $2"
-	shift;;
+        shift
+        shift
+        continue;;
 
     --help) echo "$usage"; exit $?;;
 
     -m) mode=$2
+        shift
+        shift
 	case $mode in
 	  *' '* | *'	'* | *'
 '*	  | *'*'* | *'?'* | *'['*)
 	    echo "$0: invalid mode: $mode" >&2
 	    exit 1;;
 	esac
-	shift;;
+        continue;;
 
     -o) chowncmd="$chownprog $2"
-	shift;;
-
-    -s) stripcmd=$stripprog;;
-
-    -t) dst_arg=$2
-	shift;;
-
-    -T) no_target_directory=true;;
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+	shift
+	shift
+	continue;;
+
+    -T) no_target_directory=true
+	shift
+	continue;;
 
     --version) echo "$0 $scriptversion"; exit $?;;
 
@@ -170,22 +165,21 @@
 
     *)  break;;
   esac
-  shift
 done
 
-if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
   # When -d is used, all remaining arguments are directories to create.
   # When -t is used, the destination is already specified.
   # Otherwise, the last argument is the destination.  Remove it from $@.
   for arg
   do
-    if test -n "$dst_arg"; then
+    if test -n "$dstarg"; then
       # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dst_arg"
+      set fnord "$@" "$dstarg"
       shift # fnord
     fi
     shift # arg
-    dst_arg=$arg
+    dstarg=$arg
   done
 fi
 
@@ -230,7 +224,7 @@
 do
   # Protect names starting with `-'.
   case $src in
-    -*) src=./$src;;
+    -*) src=./$src ;;
   esac
 
   if test -n "$dir_arg"; then
@@ -248,22 +242,22 @@
       exit 1
     fi
 
-    if test -z "$dst_arg"; then
+    if test -z "$dstarg"; then
       echo "$0: no destination specified." >&2
       exit 1
     fi
 
-    dst=$dst_arg
+    dst=$dstarg
     # Protect names starting with `-'.
     case $dst in
-      -*) dst=./$dst;;
+      -*) dst=./$dst ;;
     esac
 
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
     if test -d "$dst"; then
       if test -n "$no_target_directory"; then
-	echo "$0: $dst_arg: Is a directory" >&2
+	echo "$0: $dstarg: Is a directory" >&2
 	exit 1
       fi
       dstdir=$dst
@@ -384,19 +378,26 @@
       # directory the slow way, step by step, checking for races as we go.
 
       case $dstdir in
-	/*) prefix='/';;
-	-*) prefix='./';;
-	*)  prefix='';;
+	/*) prefix=/ ;;
+	-*) prefix=./ ;;
+	*)  prefix= ;;
       esac
 
-      eval "$initialize_posix_glob"
+      case $posix_glob in
+        '')
+	  if (set -f) 2>/dev/null; then
+	    posix_glob=true
+	  else
+	    posix_glob=false
+	  fi ;;
+      esac
 
       oIFS=$IFS
       IFS=/
-      $posix_glob set -f
+      $posix_glob && set -f
       set fnord $dstdir
       shift
-      $posix_glob set +f
+      $posix_glob && set +f
       IFS=$oIFS
 
       prefixes=
@@ -458,54 +459,41 @@
     # ignore errors from any of these, just make sure not to ignore
     # errors from the above "$doit $cpprog $src $dsttmp" command.
     #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
-    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
-    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
-    # If -C, don't bother to copy if it wouldn't change the file.
-    if $copy_on_change &&
-       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
-       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
-
-       eval "$initialize_posix_glob" &&
-       $posix_glob set -f &&
-       set X $old && old=:$2:$4:$5:$6 &&
-       set X $new && new=:$2:$4:$5:$6 &&
-       $posix_glob set +f &&
-
-       test "$old" = "$new" &&
-       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
-    then
-      rm -f "$dsttmp"
-    else
-      # Rename the file to the real destination.
-      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
-
-      # The rename failed, perhaps because mv can't rename something else
-      # to itself, or perhaps because mv is so ancient that it does not
-      # support -f.
-      {
-	# Now remove or move aside any old file at destination location.
-	# We try this two ways since rm can't unlink itself on some
-	# systems and the destination file might be busy for other
-	# reasons.  In this case, the final cleanup might fail but the new
-	# file should still install successfully.
-	{
-	  test ! -f "$dst" ||
-	  $doit $rmcmd -f "$dst" 2>/dev/null ||
-	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
-	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
-	  } ||
-	  { echo "$0: cannot unlink or rename $dst" >&2
-	    (exit 1); exit 1
-	  }
-	} &&
-
-	# Now rename the file to the real destination.
-	$doit $mvcmd "$dsttmp" "$dst"
-      }
-    fi || exit 1
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
+      || {
+	   # The rename failed, perhaps because mv can't rename something else
+	   # to itself, or perhaps because mv is so ancient that it does not
+	   # support -f.
+
+	   # Now remove or move aside any old file at destination location.
+	   # We try this two ways since rm can't unlink itself on some
+	   # systems and the destination file might be busy for other
+	   # reasons.  In this case, the final cleanup might fail but the new
+	   # file should still install successfully.
+	   {
+	     if test -f "$dst"; then
+	       $doit $rmcmd -f "$dst" 2>/dev/null \
+	       || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
+		     && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
+	       || {
+		 echo "$0: cannot unlink or rename $dst" >&2
+		 (exit 1); exit 1
+	       }
+	     else
+	       :
+	     fi
+	   } &&
+
+	   # Now rename the file to the real destination.
+	   $doit $mvcmd "$dsttmp" "$dst"
+	 }
+    } || exit 1
 
     trap '' 0
   fi
diff -uNr ntop-3.3.8/Makefile.am ntop-3.3.9/Makefile.am
--- ntop-3.3.8/Makefile.am	2008-06-26 10:38:58.000000000 +0200
+++ ntop-3.3.9/Makefile.am	2008-12-03 23:00:22.000000000 +0100
@@ -73,13 +73,12 @@
 ETTER_PASSIVE_DOWNLOAD_FROM = "http://ettercap.cvs.sourceforge.net/ettercap/ettercap_ng/share"
 ETTER_PASSIVE_DOWNLOAD_PARMS = "rev=HEAD"
 
-
-
 NTOPDATA = ntop-cert.pem \
-           p2c.opt.table.gz \
            $(ETTER_PASSIVE) \
            oui.txt.gz \
-           specialMAC.txt.gz
+           specialMAC.txt.gz \
+	   GeoIPASNum.dat \
+	   GeoLiteCity.dat
 
 NTOPHTML = html html/*.js html/*.html  html/*.gif html/*.jpg html/*.ico html/*.png \
            html/*.css html/*.dtd \
@@ -148,7 +147,7 @@
 libntopreport_la_SOURCES = emitter.c       globals-report.c  graph.c \
                            fcReport.c      http.c            perl.c  \
                            report.c        reportUtils.c     ssl.c   \
-                           webInterface.c
+                           webInterface.c  map.c
 
 
 libntopreport_la_DEPENDENCIES = libntop.la
@@ -271,6 +270,8 @@
 
 install: install-recursive
 
+	cd @GEO_DIR@; make install
+
 	@mkdir -p $(DESTDIR)/$(CFG_DBFILE_DIR)
 
 	@echo ""
@@ -285,24 +286,6 @@
 	  fi; \
 	done
 
-	@if ! test -f $(DESTDIR)/$(CFG_CONFIGFILE_DIR)/AS-list.txt.gz; then \
-	  echo ""; \
-	  echo ""; \
-	  echo "------------------------------------------------------------"; \
-	  echo ""; \
-	  echo "NOTE: ntop can show traffic by AS (Autonomous System) Number"; \
-	  echo ""; \
-	  echo "      Because this feature consumes a number of MB of memory,"; \
-	  echo "      the datafile is not installed by default."; \
-	  echo ""; \
-	  echo "      Which, if there is no file - from this or a previous"; \
-	  echo "      install - effectively disables the ASN feature."; \
-	  echo ""; \
-	  echo "      To install the AS data, type:"; \
-	  echo ""; \
-	  echo "# make install-data-as"; \
-	fi
-
 	@if test ".$(CLEANLIST)" != "."; then \
 	  echo ""; \
 	  echo ""; \
@@ -352,16 +335,6 @@
 	fi
 
 
-install-data-as:
-	@$(top_srcdir)/mkinstalldirs $(DESTDIR)/$(CFG_CONFIGFILE_DIR);
-	@for file in AS-list.txt.gz; do \
-          if test -d $$file; then \
-             $(top_srcdir)/mkinstalldirs $(DESTDIR)/$(CFG_CONFIGFILE_DIR)/$$file; \
-           else \
-             cp -p $$file $(DESTDIR)/$(CFG_CONFIGFILE_DIR)/$$file; \
-          fi; \
-        done
-
 install-data-local: ntop.txt ntop.html faq.html
 	@$(top_srcdir)/mkinstalldirs $(DESTDIR)/$(libdir)/plugins;
 	@if ! test -d $(DESTDIR)/$(datadir)/ntop; then \
@@ -466,10 +439,6 @@
 	@echo "New file is:"
 	@ls -l $(ETTER_PASSIVE)
 
-# download the data for and make the p2c.opt.table
-p2ctable:
-	@utils/p2c
-
 # ntop census
 census-fail:
 	@echo "This option is no longer available... thanks for trying"
diff -uNr ntop-3.3.8/map.c ntop-3.3.9/map.c
--- ntop-3.3.8/map.c	1970-01-01 01:00:00.000000000 +0100
+++ ntop-3.3.9/map.c	2008-12-09 12:41:47.000000000 +0100
@@ -0,0 +1,90 @@
+/*
+ *  Copyright (C) 2008 Luca Deri <deri@ntop.org>
+ *
+ *  			    http://www.ntop.org/
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ntop.h"
+#include "globals-report.h"
+
+#define MAX_NUM_MAP_HOSTS 512
+
+const char *map_head = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n  <head>\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>\n    <script src=\"http://maps.google.com/maps?file=api&amp;v=2&amp;key=";
+const char *map_head2 = "\"\n      type=\"text/javascript\"></script>\n    <script type=\"text/javascript\">\n\n    //<![CDATA[\n\n    function load() {\n      if (GBrowserIsCompatible()) {\n\n       function createMarker(point,html) {\n        var marker = new GMarker(point);\n        GEvent.addListener(marker, \"click\", function() {\n          marker.openInfoWindowHtml(html);\n        });\n        return marker;\n      }\n\n        var map = new GMap2(document.getElementById(\"map\"));\n\n        map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl());\n        map.addControl(new GMapTypeControl(true));\n        map.setCenter(new GLatLng(43.72, 10.40), 2);\n";
+
+const char *map_tail = "\n      }\n    }\n\n    //]]>\n    </script>\n  </head>\n  <body onload=\"load()\" onunload=\"GUnload()\">\n    <center><div id=\"map\" style=\"width: 800px; height: 600px\"></div></center>\n\n  </body>\n</html>\n";
+
+/* ******************************************** */
+
+static char *googleMapsKey = NULL;
+
+void init_maps() {
+  char value[128];
+
+  if(fetchPrefsValue("google_maps.key", value, sizeof(value)) == -1) {
+    storePrefsValue("google_maps.key", GOOGLE_DEFAULT_MAP_KEY);
+    googleMapsKey = GOOGLE_DEFAULT_MAP_KEY;
+  } else {
+    googleMapsKey = strdup(value);
+  }
+}
+
+void create_host_map() {
+  HostTraffic *el;
+  int num_hosts = 0;
+
+  sendString((char*)map_head);
+  sendString(googleMapsKey);
+  sendString((char*)map_head2);
+  
+  for(el=getFirstHost(myGlobals.actualReportDeviceId);
+      el != NULL; el = getNextHost(myGlobals.actualReportDeviceId, el)) {
+    if(el->geo_ip) {
+      char buf[512];
+      int showSymIp;
+
+      if((el->hostResolvedName[0] != '\0')
+	 && strcmp(el->hostResolvedName, el->hostNumIpAddress)
+	 && (!subnetPseudoLocalHost(el)))
+	showSymIp = 1;
+      else
+	showSymIp = 0;
+
+      safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), 
+		    "map.addOverlay(createMarker(new GLatLng(%.2f, %.2f), '%s%s<A HREF=/%s.html>%s</A><br>%s<br>%s'));\n",
+		    el->geo_ip->latitude, el->geo_ip->longitude,
+		    showSymIp ? el->hostResolvedName : "", 
+		    showSymIp ? "<br>" : "",
+		    el->hostNumIpAddress, el->hostNumIpAddress,
+		    el->geo_ip->city ? el->geo_ip->city : "", 
+		    el->geo_ip->country_name ? el->geo_ip->country_name : "");
+      sendString(buf);
+      num_hosts++;
+      if(num_hosts > MAX_NUM_MAP_HOSTS) break; /* Too many hosts */
+    }
+  }
+
+  sendString((char*)map_tail);
+
+  if(num_hosts > MAX_NUM_MAP_HOSTS)
+    sendString("<p><center><b><font color=red>WARNING:</font></b>You have more hosts to display than the number typically supported by Google maps. Some hosts have not been rendered.</center></p>");
+
+  sendString("<p><center><b><font color=red>NOTE:</font></b>");
+  sendString("make sure you get your key <a href=http://code.google.com/apis/maps/>here</A>"
+	  " for using Google Maps from ntop and register it as \'google_maps.key\' key <A href=/"CONST_EDIT_PREFS"#google_maps.key>here</A>.</center></p>\n"); 
+}
+
diff -uNr ntop-3.3.8/ntop.c ntop-3.3.9/ntop.c
--- ntop-3.3.8/ntop.c	2008-08-05 12:06:31.000000000 +0200
+++ ntop-3.3.9/ntop.c	2008-12-09 12:41:47.000000000 +0100
@@ -448,7 +448,8 @@
 /* **************************************** */
 
 void handleProtocols(void) {
-  char *proto, *buffer=NULL, *strtokState, *bufferCurrent, *bufferWork;
+  char *proto, *buffer=NULL, *strtokState,
+	   *bufferCurrent, *bufferWork, tmpStr[512];
   FILE *fd;
 
   /* myGlobals.protoSpecs is either
@@ -463,25 +464,29 @@
      || (!myGlobals.runningPref.protoSpecs[0]))
     return;
 
-  fd = fopen(myGlobals.runningPref.protoSpecs, "rb");
+   safe_snprintf(__FILE__, __LINE__, tmpStr, sizeof(tmpStr),
+                  "%s", myGlobals.runningPref.protoSpecs);
+
+  revertSlashIfWIN32(tmpStr, 0);
+  fd = fopen(tmpStr, "rb");
 
   if(fd == NULL) {
-    traceEvent(CONST_TRACE_INFO, "PROTO_INIT: Processing protocol list: '%s'", myGlobals.runningPref.protoSpecs);
-    proto = strtok_r(myGlobals.runningPref.protoSpecs, ",", &strtokState);
+    traceEvent(CONST_TRACE_INFO, "PROTO_INIT: Processing protocol list: '%s'", tmpStr);
+    proto = strtok_r(tmpStr, ",", &strtokState);
   } else {
     struct stat buf;
 
-    if(stat(myGlobals.runningPref.protoSpecs, &buf) != 0) {
+    if(stat(tmpStr, &buf) != 0) {
       fclose(fd);
       traceEvent(CONST_TRACE_ERROR, "PROTO_INIT: Unable to get information about file '%s'",
-		 myGlobals.runningPref.protoSpecs);
+		 tmpStr);
       return;
     }
 
     bufferCurrent = buffer = (char*)malloc(buf.st_size+8) /* just to be safe */;
 
     traceEvent(CONST_TRACE_ALWAYSDISPLAY, "PROTO_INIT: Processing protocol file: '%s', size: %ld",
-	       myGlobals.runningPref.protoSpecs, (long)(buf.st_size+8));
+	       tmpStr, (long)(buf.st_size+8));
 
     for (;;) {
       bufferCurrent = fgets(bufferCurrent, buf.st_size, fd);
@@ -512,6 +517,11 @@
 	bufferWork[1] = '\0';
       }
 
+    bufferWork = strchr(bufferCurrent, '\r');
+      if(bufferWork != NULL) {
+	bufferWork[0] = ',';
+	bufferWork[1] = '\0';
+      }
       /* Move pointer to end-of-string for read of next line */
       bufferCurrent = strchr(bufferCurrent, '\0');
     }
@@ -546,8 +556,6 @@
 		   "PROTO_INIT: Unknown protocol '%s'. It has been ignored",
 		   proto);
       else {
-	char tmpStr[255];
-
 	protoName[0] = '\0';
 	memset(tmpStr, 0, sizeof(tmpStr));
 	strncpy(tmpStr, &protoName[1], sizeof(tmpStr));
@@ -1134,6 +1142,16 @@
 
   termGdbm();
   termDB();
+  
+  if(myGlobals.geo_ip_db != NULL) {
+    GeoIP_delete(myGlobals.geo_ip_db);
+    myGlobals.geo_ip_db = NULL;
+  }
+
+  if(myGlobals.geo_ip_asn_db != NULL) {
+    GeoIP_delete(myGlobals.geo_ip_asn_db);
+    myGlobals.geo_ip_asn_db = NULL;
+  }
 
   tryLockMutex(&myGlobals.gdbmMutex, "cleanup");
   deleteMutex(&myGlobals.gdbmMutex);
diff -uNr ntop-3.3.8/ntop.h ntop-3.3.9/ntop.h
--- ntop-3.3.8/ntop.h	2008-10-01 23:03:36.000000000 +0200
+++ ntop-3.3.9/ntop.h	2008-11-24 08:11:31.000000000 +0100
@@ -404,6 +404,19 @@
 
 #endif /* WIN32 */
 
+/* Undef below is a workaround for a silly memcpy definition */
+#ifdef BSD
+#undef BSD
+#define BSD_TEMP
+#endif
+
+#include "GeoIP.h"
+#include "GeoIPCity.h"
+
+#ifdef BSD_TEMP
+#define BSD
+#endif
+
 /*
  * Packet Capture Library by Lawrence Berkeley National Laboratory
  * Network Research Group
Dateien ntop-3.3.8/p2c.opt.table.gz und ntop-3.3.9/p2c.opt.table.gz sind verschieden.
diff -uNr ntop-3.3.8/pbuf.c ntop-3.3.9/pbuf.c
--- ntop-3.3.8/pbuf.c	2008-08-05 12:06:31.000000000 +0200
+++ ntop-3.3.9/pbuf.c	2008-12-09 12:41:47.000000000 +0100
@@ -3300,6 +3300,8 @@
 	  srcHost = lookupHost(NULL, ether_src, vlanId, 0, 0, actualDeviceId);
 	  dstHost = lookupHost(NULL, ether_dst, vlanId, 0, 0, actualDeviceId);
 
+	  if((srcHost == NULL) || (dstHost == NULL)) return;
+
 	  allocHostTrafficCounterMemory(srcHost, nonIPTraffic, sizeof(NonIPTraffic));
 	  allocHostTrafficCounterMemory(dstHost, nonIPTraffic, sizeof(NonIPTraffic));
 	  if((srcHost->nonIPTraffic == NULL) || (dstHost->nonIPTraffic == NULL)) return;
@@ -3351,7 +3353,8 @@
 
 		  switch(element.cdp_type) {
 		  case 0x0001: /* Device Id */
-		    if((srcHost->hostResolvedName[0] == '\0') || (strcmp(srcHost->hostResolvedName, srcHost->hostNumIpAddress))) {
+		    if((srcHost->hostResolvedName[0] == '\0') 
+		       || (strcmp(srcHost->hostResolvedName, srcHost->hostNumIpAddress))) {
 		      u_short tmpStrLen = min(element.cdp_len-4, MAX_LEN_SYM_HOST_NAME-1);
 		      strncpy(srcHost->hostResolvedName, (char*)&cdp[cdp_idx], tmpStrLen);
 		      srcHost->hostResolvedName[tmpStrLen] = '\0';
@@ -3596,7 +3599,8 @@
 		    if(strlen(nodeName) >= (MAX_LEN_SYM_HOST_NAME-1))
 		      nodeName[MAX_LEN_SYM_HOST_NAME-2] = '\0';
 
-		    if(srcHost->nonIPTraffic == NULL) srcHost->nonIPTraffic = (NonIPTraffic*)calloc(1, sizeof(NonIPTraffic));
+		    if(srcHost->nonIPTraffic == NULL) srcHost->nonIPTraffic = (NonIPTraffic*)calloc(1, 
+												    sizeof(NonIPTraffic));
 		    if(srcHost->nonIPTraffic == NULL) return;
 
 		    srcHost->nonIPTraffic->atNodeName = strdup(nodeName);
diff -uNr ntop-3.3.8/perl/test.pl ntop-3.3.9/perl/test.pl
--- ntop-3.3.8/perl/test.pl	2008-07-21 00:40:06.000000000 +0200
+++ ntop-3.3.9/perl/test.pl	2008-12-08 23:24:05.000000000 +0100
@@ -7,16 +7,44 @@
 
 send_http_header(1, "Known ntop hosts");
 
-# --------------------------------------------- 
+# ---------------------------------------------
 
-#loadHosts();
+loadHosts();
 
 #while ( my ($key, $value) = each(%hosts) ) {
 #    print "$key => $value\n";
 #}
 
-#foreach $key (sort(keys %hosts)) {
-#    print "[key=", $key,"][value=", $hosts{$key}"\n";
+#my @sorted_by_hostname      = sort { ${$a}{'ipAddress'}  cmp ${$b}{'ipAddress'} }  values %hosts;
+#my @traffic = sort keys %hosts;
+
+if(0) {
+print "################################################\n";
+
+foreach $key (sort(keys %hosts)) {
+    print "[key=", $key,"][ipAddress=",${$key}{'ipAddress'},"][macAddress=",${$key}{'macAddress'},"][pktSent/pktRcvd=",${$key}{'pktSent'},"/",${$key}{'pktRcvd'},"]\n";
+}
+
+print "################################################\n";
+
+getFirstHost(0);
+loadHost();
+while(($host{'ethAddress'} ne "") || ($host{'ipAddress'} ne ""))  {
+    print "+ [ipAddress=",$host{'ipAddress'},"][macAddress=",$host{'macAddress'},"][pktSent/pktRcvd=",$host{'pktSent'},"/",$host{'pktRcvd'},"]\n";
+    getNextHost(0);
+    loadHost();
+}
+}
+
+#for my $k1 ( sort keys %hosts ) {
+#    print "k1: $k1\n";
+#    for my $k2 ( keys %{$k1} ) {
+#	print "k2: $k2 $hosts{ $k1 }{ $k2 }\n";
+#    }
+#}
+
+#foreach $key (sort(keys %hosts{'a'})) {
+#    print $key,"\n";
 #}
 
 #exit
@@ -30,8 +58,7 @@
 sendString("<tr><th>MAC</th><th colspan=2>IP</th><th>Packets</th><th>Bytes</th></tr>\n");
 
 
-while(($host{'ethAddress'} ne "") 
-      || ($host{'ipAddress'} ne ""))  {
+while(($host{'ethAddress'} ne "") || ($host{'ipAddress'} ne ""))  {
     my $mac_addr;
 
     if($host{'ethAddress'} ne "") {
diff -uNr ntop-3.3.8/perl.c ntop-3.3.9/perl.c
--- ntop-3.3.8/perl.c	2008-08-16 11:32:35.000000000 +0200
+++ ntop-3.3.9/perl.c	2008-12-08 23:24:05.000000000 +0100
@@ -33,8 +33,8 @@
 
 PerlInterpreter *my_perl;  /***    The Perl interpreter    ***/
 
-static HostTraffic *perl_host = NULL;
-static HV * ss = NULL;
+static HostTraffic *ntop_host = NULL;
+static HV * perl_host = NULL;
 static HV * ss_hosts = NULL;
 
 /*
@@ -79,21 +79,21 @@
 
 /* *********************************************************** */
 
-#define PERL_STORE_STRING(s, a, b) hv_store(s, a, strlen(a), newSVpv(b, strlen(b)), 0);
-#define PERL_STORE_NUM(s, a, b)    { safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "%u", b); PERL_STORE_STRING(s, a, buf); }
+#define PERL_STORE_STRING(x, a, b) hv_store(x, a, strlen(a), newSVpv(b, strlen(b)), 0);
+#define PERL_STORE_NUM(x, a, b)    { char buf[64]; safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "%u", b); PERL_STORE_STRING(x, a, buf); }
 
 static void ntop_perl_loadHost_values(HV * my_ss, HostTraffic *host) {
-  char buf[64];
+  traceEvent(CONST_TRACE_INFO, "[perl] loadHost_values()");
 
-  PERL_STORE_STRING(ss, "ethAddress", host->ethAddressString);
-  PERL_STORE_STRING(ss, "ipAddress", host->hostNumIpAddress);
-  PERL_STORE_STRING(ss, "hostResolvedName", host->hostResolvedName);
-  PERL_STORE_NUM(ss, "vlanId", host->vlanId);
-  PERL_STORE_NUM(ss, "hostAS", host->hostAS);
-  PERL_STORE_NUM(ss, "pktSent", host->pktSent.value);
-  PERL_STORE_NUM(ss, "pktRcvd", host->pktRcvd.value);
-  PERL_STORE_NUM(ss, "bytesSent", host->bytesSent.value);
-  PERL_STORE_NUM(ss, "bytesRcvd", host->bytesRcvd.value);
+  PERL_STORE_STRING(my_ss, "ethAddress", host->ethAddressString);
+  PERL_STORE_STRING(my_ss, "ipAddress", host->hostNumIpAddress);
+  PERL_STORE_STRING(my_ss, "hostResolvedName", host->hostResolvedName);
+  PERL_STORE_NUM(my_ss, "vlanId", host->vlanId);
+  PERL_STORE_NUM(my_ss, "hostAS", host->hostAS);
+  PERL_STORE_NUM(my_ss, "pktSent", host->pktSent.value);
+  PERL_STORE_NUM(my_ss, "pktRcvd", host->pktRcvd.value);
+  PERL_STORE_NUM(my_ss, "bytesSent", host->bytesSent.value);
+  PERL_STORE_NUM(my_ss, "bytesRcvd", host->bytesRcvd.value);
 }
 
 /* *********************************************************** */
@@ -101,16 +101,16 @@
 void ntop_perl_loadHost() {
   char buf[64];
 
-  traceEvent(CONST_TRACE_INFO, "[perl] loadHost()");
+  traceEvent(CONST_TRACE_INFO, "[perl] loadHost(%p)", ntop_host);
 
-  if(ss) {
-    hv_undef(ss);
-    ss = NULL;
+  if(perl_host) {
+    hv_undef(perl_host);
+    perl_host = NULL;
   }
 
-  if(perl_host) {
-    ss = perl_get_hv ("main::host", TRUE);
-    ntop_perl_loadHost_values(ss, perl_host);
+  if(ntop_host) {
+    perl_host = perl_get_hv ("main::host", TRUE);
+    ntop_perl_loadHost_values(perl_host, ntop_host);
   }
 }
 
@@ -121,7 +121,7 @@
   char buf[64];
   u_int actualDeviceId = 0;
 
-  traceEvent(CONST_TRACE_INFO, "[perl] loadHost()");
+  traceEvent(CONST_TRACE_INFO, "[perl] loadHosts()");
 
   if(ss_hosts) {
     hv_undef(ss_hosts);
@@ -130,18 +130,27 @@
 
   host = getFirstHost(actualDeviceId);
 
+  /*
+   * create a new variable, the %hosts hash
+   */
   ss_hosts = perl_get_hv ("main::hosts", TRUE);
 
   while(host != NULL) {
-    HV *elem;
+    static HV *elem;
     char *key = (host->ethAddressString[0] != '\0') ? host->ethAddressString : host->hostNumIpAddress;
-    
-    
-    elem = newHV();
+
+    snprintf(buf, sizeof(buf), "main::%s", key);
+    traceEvent(CONST_TRACE_INFO, "[perl] Adding perl hash '%s'", buf);
+    elem = perl_get_hv(buf, TRUE);
+
+    /*
+     * populate the %hosts hash
+     * key   = $key
+     * value = the reference to the newly created hash
+     */
+    hv_store(ss_hosts, key, strlen(key), newRV_inc ((SV *) elem), 0); 
     ntop_perl_loadHost_values(elem, host);
-    hv_store_ent( ss_hosts, newSVpv(key, strlen(key)), elem, 0 );
     traceEvent(CONST_TRACE_INFO, "[perl] Added %s", key);
-
     host = getNextHost(actualDeviceId, host);
   }
 }
@@ -150,22 +159,22 @@
 
 
 void ntop_perl_getFirstHost(int actualDeviceId) {
-  perl_host = getFirstHost(actualDeviceId);
+  ntop_host = getFirstHost(actualDeviceId);
 
   traceEvent(CONST_TRACE_INFO, "[perl] getFirstHost(%d)=%p",
-	     actualDeviceId, perl_host);
+	     actualDeviceId, ntop_host);
 }
 
 /* *********************************************************** */
 
 void ntop_perl_getNextHost(int actualDeviceId) {
-  if(perl_host == NULL) {
+  if(ntop_host == NULL) {
     ntop_perl_getFirstHost(actualDeviceId);
   } else {
-    perl_host = getNextHost(actualDeviceId, perl_host);
+    ntop_host = getNextHost(actualDeviceId, ntop_host);
   }
 
-  traceEvent(CONST_TRACE_INFO, "[perl] getNextHost()=%p", perl_host);
+  traceEvent(CONST_TRACE_INFO, "[perl] getNextHost()=%p", ntop_host);
 }
 
 /* *********************************************************** */
@@ -195,14 +204,33 @@
 /* http://localhost:3000/perl/test.pl */
 
 int handlePerlHTTPRequest(char *url) {
-  int perl_argc = 2;
+  int perl_argc = 2, idx, found = 0;
   char perl_path[256];
   char * perl_argv[] = { "", NULL };
+  struct stat statbuf;
 
   traceEvent(CONST_TRACE_WARNING, "Calling perl... [%s]", url);
 
+  for(idx=0; (!found) && (myGlobals.dataFileDirs[idx] != NULL); idx++) {
   safe_snprintf(__FILE__, __LINE__, perl_path, sizeof(perl_path), 
-	  "%s/perl/%s", myGlobals.spoolPath, url);
+	  "%s/perl/%s", myGlobals.dataFileDirs[idx], url);
+    revertSlashIfWIN32(perl_path, 0);
+
+    if(!stat(perl_path, &statbuf)) {
+      /* Found */
+      /* traceEvent(CONST_TRACE_INFO, "[perl] [%d] Found %s", idx, perl_path); */
+      found = 1;
+      break;
+    } else {
+      /* traceEvent(CONST_TRACE_INFO, "[perl] [%d] Not found %s", idx, perl_path); */
+    }
+  }
+
+  if(!found) {
+    returnHTTPpageNotFound(NULL);
+    return(1);
+  }
+
   perl_argv[1] = perl_path;
 
   PERL_SYS_INIT(&perl_argc, &perl_argv);
diff -uNr ntop-3.3.8/plugin.c ntop-3.3.9/plugin.c
--- ntop-3.3.8/plugin.c	2008-08-17 23:06:33.000000000 +0200
+++ ntop-3.3.9/plugin.c	2008-11-07 01:56:35.000000000 +0100
@@ -22,7 +22,7 @@
 
 #ifdef MAKE_STATIC_PLUGIN
 extern PluginInfo* icmpPluginEntryFctn(void);
-extern PluginInfo* sflowPluginEntryFctn(void)
+extern PluginInfo* sflowPluginEntryFctn(void);
 extern PluginInfo* rrdPluginEntryFctn(void);
 extern PluginInfo* cpacketPluginEntryFctn(void);
 extern PluginInfo* netflowPluginEntryFctn(void);
diff -uNr ntop-3.3.8/plugins/netflowPlugin.c ntop-3.3.9/plugins/netflowPlugin.c
--- ntop-3.3.8/plugins/netflowPlugin.c	2008-08-11 01:05:06.000000000 +0200
+++ ntop-3.3.9/plugins/netflowPlugin.c	2008-12-08 16:53:31.000000000 +0100
@@ -28,7 +28,7 @@
 static void* netflowUtilsLoop(void* _deviceId);
 #endif
 
-/* #define DEBUG_FLOWS */
+#define DEBUG_FLOWS
 
 #define CONST_NETFLOW_STATISTICS_HTML       "statistics.html"
 
@@ -134,7 +134,7 @@
     handleNetflowHTTPrequest,
     NULL, /* no host creation/deletion handle */
 #ifdef DEBUG_FLOWS
-    "udp and (port 2055 or port 1024)",
+    "udp and (port 2055 or port 1024 or port 20000)",
 #else
     NULL, /* no capture */
 #endif
@@ -3035,6 +3035,10 @@
 	safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "Interface&nbsp;Name: %s<br>",
 		      ifStats->interface_name);
 	sendString(buf);
+      } else {
+	safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "Interface&nbsp;Id: %d<br>",
+		      ifStats->interface_id);
+	sendString(buf);
       }
 
       safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "Pkts:&nbsp;%s&nbsp;in/%s&nbsp;out<br>",
@@ -3971,7 +3975,7 @@
   int sampledPacketSize;
   int deviceId, rc;
 
-  if(myGlobals.runningPref.rFileName != NULL) {
+  if(myGlobals.pcap_file_list != NULL) {
     /* ntop is reading packets from a file */
     struct ether_header ehdr;
     u_int caplen = h->caplen;
diff -uNr ntop-3.3.8/plugins/remotePlugin.c ntop-3.3.9/plugins/remotePlugin.c
--- ntop-3.3.8/plugins/remotePlugin.c	2007-05-17 22:26:46.000000000 +0200
+++ ntop-3.3.9/plugins/remotePlugin.c	2008-12-08 16:53:31.000000000 +0100
@@ -76,7 +76,7 @@
   while(myGlobals.ntopRunState < FLAG_NTOPSTATE_SHUTDOWN) {
     fd_set remoteMask;
     int rc, all_right = 1;
-    char buf[1500], rsp[1500];
+    char buf[1500] = { '\0' }, rsp[1500] = { '\0' };
 
     FD_ZERO(&remoteMask);
     FD_SET(sock, &remoteMask);
diff -uNr ntop-3.3.8/plugins/rrdPlugin.c ntop-3.3.9/plugins/rrdPlugin.c
--- ntop-3.3.8/plugins/rrdPlugin.c	2008-08-11 01:05:06.000000000 +0200
+++ ntop-3.3.9/plugins/rrdPlugin.c	2008-11-05 13:14:49.000000000 +0100
@@ -471,7 +471,7 @@
   if(cluster == NULL) {
     if(hasNetFlow
        && ((filterString == NULL) || strcasestr(filterString, "flow"))) {
-      for(i=0; i<=2; i++) {
+      for(i=1; i<=3; i++) {
 	sendString("<TR><TD align=left>");
 
 	safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf),
@@ -530,7 +530,7 @@
       if(strcmp(rsrcName, CONST_RRD_EXTENSION))
 	continue;
 
- #if 0
+#if 0
       if(sumCounter(rrdPath, dp->d_name, "FAILURES", startTime, endTime, &total, &average) >= 0)
 	numFailures += total;
 #endif
@@ -581,7 +581,6 @@
 	    }
 	  }
 
-
 	  if(do_show) {
 	    sendString("<TR><TD align=left>\n");
 
@@ -1020,9 +1019,10 @@
   path[0] = '\0';
 
   switch(graphId) {
-  case 0: rrds = (struct nameLabel*)rrd_summary_new_flows; label = "Flows"; title = "Newly Created Flows: Statistics"; break;
-  case 1: rrds = (struct nameLabel*)rrd_summary_new_nf_flows; label = "Flows"; title = "Newly Created Flows: Protocol Breakdown"; break;
-  case 2: rrds = (struct nameLabel*)rrd_summary_new_nf_flows_size; label = "Bytes"; title = "Newly Created Flows: Average Size"; break;
+  case 0: rrds = (struct nameLabel*)rrd_summary_traffic; label = "Bytes"; title = "Traffic Statistics"; break;
+  case 1: rrds = (struct nameLabel*)rrd_summary_new_flows; label = "Flows"; title = "Newly Created Flows: Statistics"; break;
+  case 2: rrds = (struct nameLabel*)rrd_summary_new_nf_flows; label = "Flows"; title = "Newly Created Flows: Protocol Breakdown"; break;
+  case 3: rrds = (struct nameLabel*)rrd_summary_new_nf_flows_size; label = "Bytes"; title = "Newly Created Flows: Average Size"; break;
   }
 
   /* Check if the output directory has been deleted in the meantime */
@@ -1105,22 +1105,26 @@
     the_time = atol(startTime); the_tm = localtime(&the_time);
     strftime(strbuf, sizeof(strbuf), "%Y-%m-%d %H:%M", the_tm); sendString(strbuf);
 
-    sendString("\">\n<INPUT type=\"image\" src=\"/calendar.gif\" alt=\"Start date selector\" border=\"0\" align=\"absmiddle\" onclick=\"return showCalendar('date1');\">\n");
+    sendString("\">\n<INPUT type=\"image\" src=\"/calendar.gif\" alt=\"Start date selector\" border=\"0\" align=\"absmiddle\" "
+	       "onclick=\"return showCalendar('date1');\">\n");
     sendString("&nbsp;<strong>To:</strong>\n<INPUT type=\"text\" name=\"date2\" id=\"date2\" size=\"16\" value=\"");
 
     the_time = atol(endTime); the_tm = localtime(&the_time);
     strftime(strbuf, sizeof(strbuf), "%Y-%m-%d %H:%M", the_tm); sendString(strbuf);
 
-    sendString("\">\n<INPUT type=\"image\" src=\"/calendar.gif\" alt=\"End date selector\" border=\"0\" align=\"absmiddle\" onclick=\"return showCalendar('date2');\">\n"
+    sendString("\">\n<INPUT type=\"image\" src=\"/calendar.gif\" alt=\"End date selector\" border=\"0\" align=\"absmiddle\" "
+	       "onclick=\"return showCalendar('date2');\">\n"
 	       "<INPUT type=\"submit\" value=\"Update Graph\">\n</FORM>\n</TD></TR></TBODY></TABLE>\n</p>\n");
 
     /* *************************************** */
 
     sendString("<SCRIPT type=\"text/javascript\" src=\"/zoom.js\"></SCRIPT>\n"
 	       "<DIV id=\"zoomBox\" style=\"position: absolute; visibility: visible; background-image: initial; background-repeat: initial; "
-	       "background-attachment: initial; background-position-x: initial; background-position-y: initial; background-color: orange; opacity: 0.5;\"></DIV>\n");
+	       "background-attachment: initial; background-position-x: initial; background-position-y: initial; background-color: orange; "
+	       "opacity: 0.5;\"></DIV>\n");
 
-    sendString("<DIV id=\"zoomSensitiveZone\" style=\"position:absolute; overflow:none; background-repeat: initial; background-attachment: initial;  "
+    sendString("<DIV id=\"zoomSensitiveZone\" style=\"position:absolute; overflow:none; background-repeat: initial; "
+	       "background-attachment: initial;  "
 	       "background-position-x: initial; background-position-y: initial; visibility:visible; cursor:crosshair; background:blue; "
 	       "filter:alpha(opacity=0); -moz-opacity:0; -khtml-opacity:0; opacity:0;\" oncontextmenu=\"return false\"></DIV>\n");
 
@@ -1205,65 +1209,66 @@
 #endif
 #endif
 
-    argv[argc++] = "--title";
-    argv[argc++] = title;
-
-	str = "interfaces/";
-	i = strlen(str);
-	if(!strncmp(rrdPath, str, i))
-		pathIdx = i;
-	else
-		pathIdx = 0;
+  argv[argc++] = "--title";
+  argv[argc++] = title;
 
-	for(i=0, entryId=0; rrds[i].name != NULL; i++) {
-		char metric_name[32];
+  str = "interfaces/";
+  i = strlen(str);
+  if(!strncmp(rrdPath, str, i))
+    pathIdx = i;
+  else
+    pathIdx = 0;
+    
+  for(i=0, entryId=0; rrds[i].name != NULL; i++) {
+    char metric_name[32];
 
-		if(!strcmp(rrds[i].name, "throughput")) {
+    if(!strcmp(rrds[i].name, "throughput")) {
 #ifdef WIN32
-			safe_snprintf(__FILE__, __LINE__, path, sizeof(path), "%s/%u/interfaces/%s/%s.rrd",
-				myGlobals.rrdVolatilePath, driveSerial, &rrdPath[pathIdx], rrds[i].name);
+      safe_snprintf(__FILE__, __LINE__, path, sizeof(path), "%s/%u/interfaces/%s/%s.rrd",
+		    myGlobals.rrdVolatilePath, driveSerial, &rrdPath[pathIdx], rrds[i].name);
 #else
-			safe_snprintf(__FILE__, __LINE__, path, sizeof(path), "%s/interfaces/%s/%s.rrd",
-				myGlobals.rrdVolatilePath, rrdPath, rrds[i].name);
+      safe_snprintf(__FILE__, __LINE__, path, sizeof(path), "%s/interfaces/%s/%s.rrd",
+		    myGlobals.rrdVolatilePath, rrdPath, rrds[i].name);
 #endif
-		} else
-			safe_snprintf(__FILE__, __LINE__, path, sizeof(path), "%s/interfaces/%s/%s.rrd",
-			myGlobals.rrdPath, &rrdPath[pathIdx], rrds[i].name);
-
-		revertSlashIfWIN32(path, 0);
+    } else
+      safe_snprintf(__FILE__, __LINE__, path, sizeof(path), "%s/interfaces/%s/%s.rrd",
+		    myGlobals.rrdPath, &rrdPath[pathIdx], rrds[i].name);
 
-		if(stat(path, &statbuf) == 0) {
-			// traceEvent(CONST_TRACE_WARNING,  "-- 3 --> (%s)", path);
-			revertDoubleColumnIfWIN32(path);
-			safe_snprintf(__FILE__, __LINE__, buf[entryId], MAX_BUF_LEN, "DEF:ctr%d=%s:counter:AVERAGE", entryId, path);
-		argv[argc++] = buf[entryId];
+    revertSlashIfWIN32(path, 0);
 
-		safe_snprintf(__FILE__, __LINE__, buf1[entryId], MAX_BUF_LEN, "%s:ctr%d%s:%s", entryId == 0 ? "AREA" : "STACK",
-			entryId, rrd_colors[entryId], spacer(rrds[i].label, tmpStr, sizeof(tmpStr), metric_name, sizeof(metric_name)));
-		argv[argc++] = buf1[entryId];
+    if(debug_rrd_graph) traceEvent(CONST_TRACE_WARNING,  "-- 3 --> (%s)", path);
 
-		safe_snprintf(__FILE__, __LINE__, buf2[entryId], MAX_BUF_LEN, "GPRINT:ctr%d%s", entryId, ":AVERAGE:Avg\\: %3.1lf%s\\t");
-		argv[argc++] = buf2[entryId];
+    if(stat(path, &statbuf) == 0) {
+      revertDoubleColumnIfWIN32(path);
+      safe_snprintf(__FILE__, __LINE__, buf[entryId], MAX_BUF_LEN, "DEF:ctr%d=%s:counter:AVERAGE", entryId, path);
+      argv[argc++] = buf[entryId];
 
-		safe_snprintf(__FILE__, __LINE__, buf3[entryId], MAX_BUF_LEN, "GPRINT:ctr%d%s", entryId, ":LAST:Last\\: %3.1lf%s\\n");
-		argv[argc++] = buf3[entryId];
+      safe_snprintf(__FILE__, __LINE__, buf1[entryId], MAX_BUF_LEN, "%s:ctr%d%s:%s", entryId == 0 ? "AREA" : "STACK",
+		    entryId, rrd_colors[entryId], spacer(rrds[i].label, tmpStr, sizeof(tmpStr), metric_name, sizeof(metric_name)));
+      argv[argc++] = buf1[entryId];
 
-		entryId++;
+      safe_snprintf(__FILE__, __LINE__, buf2[entryId], MAX_BUF_LEN, "GPRINT:ctr%d%s", entryId, ":AVERAGE:Avg\\: %3.1lf%s\\t");
+      argv[argc++] = buf2[entryId];
 
-	if(entryId >= MAX_NUM_ENTRIES) break;
+      safe_snprintf(__FILE__, __LINE__, buf3[entryId], MAX_BUF_LEN, "GPRINT:ctr%d%s", entryId, ":LAST:Last\\: %3.1lf%s\\n");
+      argv[argc++] = buf3[entryId];
 
-	if(entryId >= CONST_NUM_BAR_COLORS) {
-		if(colorWarn == 0) {
-			traceEvent(CONST_TRACE_WARNING, "RRD: Number of defined bar colors less than max entries. Some graph(s) truncated");
-			colorWarn = 1;
-		}
+      entryId++;
 
-		break;
+      if(entryId >= MAX_NUM_ENTRIES) break;
 
-				} else {
-			// traceEvent(CONST_TRACE_WARNING, "RRD: Unable to find file %s", path);
-		}
+      if(entryId >= CONST_NUM_BAR_COLORS) {
+	if(colorWarn == 0) {
+	  traceEvent(CONST_TRACE_WARNING, "RRD: Number of defined bar colors less than max entries. Some graph(s) truncated");
+	  colorWarn = 1;
 	}
+
+	break;
+
+      } else {
+	// traceEvent(CONST_TRACE_WARNING, "RRD: Unable to find file %s", path);
+      }
+    }
   }
 
   accessMutex(&rrdMutex, "rrd_graph");
@@ -1292,7 +1297,8 @@
     traceEventRRDebugARGV(3);
 
     if(++graphErrCount < 50) {
-      traceEvent(CONST_TRACE_ERROR, "RRD: rrd_graph() call failed, rc %d, %s", rc, rrd_get_error() ? rrd_get_error() : "");
+      traceEvent(CONST_TRACE_ERROR, "RRD: rrd_graph() call failed, rc %d, %s",
+		 rc, rrd_get_error() ? rrd_get_error() : "");
       traceEvent(CONST_TRACE_INFO, "RRD: Failing file in netflowSummary() is %s", path);
     }
 
@@ -4234,7 +4240,10 @@
 	dumpShortInterval = _dumpShortInterval;
 
 	for(devIdx=0; devIdx<myGlobals.numDevices; devIdx++) {
-	  if((myGlobals.device[devIdx].virtualDevice && (!myGlobals.device[devIdx].sflowGlobals))
+	  if((myGlobals.device[devIdx].virtualDevice 
+	      && (!myGlobals.device[devIdx].sflowGlobals)
+	      && (!myGlobals.device[devIdx].netflowGlobals)
+	      )
 	     || (!myGlobals.device[devIdx].activeDevice))
 	    continue;
 
@@ -5026,7 +5035,9 @@
     rrdTime =  time(NULL);
 
     for(devIdx=0; devIdx<myGlobals.numDevices; devIdx++) {
-      if((myGlobals.device[devIdx].virtualDevice && (!myGlobals.device[devIdx].sflowGlobals))
+      if((myGlobals.device[devIdx].virtualDevice 
+	  && (!myGlobals.device[devIdx].sflowGlobals)
+	  && (!myGlobals.device[devIdx].netflowGlobals))
 	 || (!myGlobals.device[devIdx].activeDevice))
 	continue;
 
@@ -5236,7 +5247,6 @@
 	  /* if we didn't get a domain name, bail out */
 	  if ((el->dnsDomainValue == NULL)
 	      || (el->dnsDomainValue[0] == '\0')
-	      || (el->ip2ccValue == NULL)
 	      || (el->hostResolvedName[0] == '\0')
 	      || broadcastHost(el)
 	      ) {
@@ -5261,7 +5271,7 @@
 	    memset(statsEntry, 0, sizeof(DomainStats));
 	    statsEntry->domainHost = el;
 	    stats[keyValue] = statsEntry;
-	    traceEventRRDebug(2, "[%d] %s/%s", numEntries, el->dnsDomainValue, el->ip2ccValue);
+	    traceEventRRDebug(2, "[%d] %s", numEntries, el->dnsDomainValue);
 	  }
 
 	  /* count this host's stats in the domain stats */
@@ -5370,7 +5380,9 @@
     if(dumpInterfaces) {
       for(devIdx=0; devIdx<myGlobals.numDevices; devIdx++) {
 
-	if((myGlobals.device[devIdx].virtualDevice && (!myGlobals.device[devIdx].sflowGlobals))
+	if((myGlobals.device[devIdx].virtualDevice 
+	    && (!myGlobals.device[devIdx].sflowGlobals)
+	    && (!myGlobals.device[devIdx].netflowGlobals))
 	   || (!myGlobals.device[devIdx].activeDevice))
 	  continue;
 
@@ -5390,7 +5402,7 @@
 	updateCounter(rrdPath, "ipLocalToLocalBytes",  myGlobals.device[devIdx].tcpGlobalTrafficStats.local.value +
 		      myGlobals.device[devIdx].udpGlobalTrafficStats.local.value +
 		      myGlobals.device[devIdx].icmpGlobalTrafficStats.local.value, 0);
-	updateCounter(rrdPath, "ipLocalToRemoteBytes",    myGlobals.device[devIdx].tcpGlobalTrafficStats.local2remote.value +
+	updateCounter(rrdPath, "ipLocalToRemoteBytes", myGlobals.device[devIdx].tcpGlobalTrafficStats.local2remote.value +
 		      myGlobals.device[devIdx].udpGlobalTrafficStats.local2remote.value +
 		      myGlobals.device[devIdx].icmpGlobalTrafficStats.local2remote.value, 0);
 	updateCounter(rrdPath, "ipRemoteToLocalBytes", myGlobals.device[devIdx].tcpGlobalTrafficStats.remote2local.value +
diff -uNr ntop-3.3.8/plugins/rrdPlugin.h ntop-3.3.9/plugins/rrdPlugin.h
--- ntop-3.3.8/plugins/rrdPlugin.h	2007-11-11 10:15:49.000000000 +0100
+++ ntop-3.3.9/plugins/rrdPlugin.h	2008-10-14 08:02:59.000000000 +0200
@@ -253,6 +253,12 @@
   char *name, *label;
 };
 
+static const struct nameLabel rrd_summary_traffic[] = { 
+  { "ifInOctets", "Ingress Traffic" },
+  { "ifOutOctets", "Egress Traffic" },
+  { NULL, NULL }
+};
+
 static const struct nameLabel rrd_summary_new_flows[] = { 
   { "NF_numFlows", "Total Flows" },
   { "NF_numDiscardedFlows", "Discarded Flows" },
diff -uNr ntop-3.3.8/prefs.c ntop-3.3.9/prefs.c
--- ntop-3.3.8/prefs.c	2008-10-02 12:54:15.000000000 +0200
+++ ntop-3.3.9/prefs.c	2008-12-07 11:20:48.000000000 +0100
@@ -307,6 +307,10 @@
 }
 
 /* ***************************************************** */
+/*	NOTE
+	In the function below do NOT free myGlobals.runningPref.*
+	as this value is used in myGlobals.savedPref.*
+*/
 
 /*
  * Parse the command line options
@@ -382,7 +386,6 @@
 #ifndef WIN32
       stringSanityCheck(optarg, "-i | --interface");
 #endif
-      if(myGlobals.runningPref.devices != NULL) free(myGlobals.runningPref.devices);
       myGlobals.runningPref.devices = strdup(optarg);
       break;
 
@@ -439,7 +442,6 @@
 #ifndef WIN32
     case 'u':
       stringSanityCheck(optarg, "-u | --user");
-      if(myGlobals.effectiveUserName != NULL) free(myGlobals.effectiveUserName);
       myGlobals.effectiveUserName = strdup(optarg);
       if(strOnlyDigits(optarg))
 	myGlobals.userId = atoi(optarg);
@@ -527,22 +529,17 @@
 
     case 'N':
       pathSanityCheck(optarg, "-N | --wwn-map");
-      if(myGlobals.runningPref.fcNSCacheFile != NULL)
-	   free(myGlobals.runningPref.fcNSCacheFile);
       myGlobals.runningPref.fcNSCacheFile = strdup (optarg);
       break;
 
     case 'O': /* pcap log path - Ola Lundqvist <opal@debian.org> */
       pathSanityCheck(optarg, "-O | --output-packet-path");
-      if(myGlobals.runningPref.pcapLogBasePath != NULL)
-	free(myGlobals.runningPref.pcapLogBasePath);
-      myGlobals.runningPref.pcapLogBasePath = strdup(optarg);
+       myGlobals.runningPref.pcapLogBasePath = strdup(optarg);
       break;
 
     case 'P':
       pathSanityCheck(optarg, "-P | --db-file-path");
-      if(myGlobals.dbPath != NULL)
-	free(myGlobals.dbPath);
+      if(myGlobals.dbPath != NULL) free(myGlobals.dbPath);
 
       if(optarg[strlen(optarg)-1] == '/') optarg[strlen(optarg)-1] = '\0';
       mkdir_p("dbPath", optarg, 0777);
@@ -551,8 +548,7 @@
 
     case 'Q': /* Spool Path (ntop's spool directory) */
       pathSanityCheck(optarg, "-Q | --spool-file-path" );
-      if(myGlobals.spoolPath != NULL)
-	free(myGlobals.spoolPath);
+      if(myGlobals.spoolPath != NULL) free(myGlobals.spoolPath);
       if(optarg[strlen(optarg)-1] == '/') optarg[strlen(optarg)-1] = '\0';
       mkdir_p("spoolPath", optarg, 0777);
       myGlobals.spoolPath = strdup(optarg);
@@ -671,15 +667,11 @@
 
     case 137:
       stringSanityCheck(optarg, "--p3pcp");
-      if(myGlobals.runningPref.P3Pcp != NULL)
-	free(myGlobals.runningPref.P3Pcp);
       myGlobals.runningPref.P3Pcp = strdup(optarg);
       break;
 
     case 138:
       uriSanityCheck(optarg, "--p3puri", FALSE);
-      if(myGlobals.runningPref.P3Puri != NULL)
-	free(myGlobals.runningPref.P3Puri);
       myGlobals.runningPref.P3Puri = strdup(optarg);
       break;
 
@@ -691,8 +683,6 @@
       FILE *fd;
 
       stringSanityCheck(optarg, "--instance");
-      if(myGlobals.runningPref.instance != NULL)
-        free(myGlobals.runningPref.instance);
       myGlobals.runningPref.instance = strdup(optarg);
 
       memset(&tmpStr, 0, sizeof(tmpStr));
@@ -1002,10 +992,10 @@
     if (*globalVar != NULL) {
       free (*globalVar);
       *globalVar = NULL;
-      if (savePref) {
-	delPrefsValue (key);
-      }
     }
+	
+	 *globalVar = strdup(value);
+     if (savePref) delPrefsValue (key);
   }
   else {
     if (savePref) {
diff -uNr ntop-3.3.8/protocols.c ntop-3.3.9/protocols.c
--- ntop-3.3.8/protocols.c	2007-07-15 23:09:16.000000000 +0200
+++ ntop-3.3.9/protocols.c	2008-11-05 13:14:49.000000000 +0100
@@ -169,8 +169,6 @@
 		realDstHost->dnsDomainValue = NULL;
                 if (realDstHost->dnsTLDValue != NULL) free(realDstHost->dnsTLDValue);
 		realDstHost->dnsTLDValue = NULL;
-		if (realDstHost->ip2ccValue != NULL) free(realDstHost->ip2ccValue);
-		realDstHost->ip2ccValue = NULL;
 		if(isBroadcastAddress(&realDstHost->hostIpAddress, NULL, NULL))
 		  FD_SET(FLAG_BROADCAST_HOST, &realDstHost->flags);
 		else
@@ -333,41 +331,59 @@
 #endif
 		  switch((int)bootProto.bp_vend[idx]) {
 		  case FLAG_DHCP_DISCOVER_MSG:
-		    incrementHostTrafficCounter(realDstHost, protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_DISCOVER_MSG], 1);
-		    incrementHostTrafficCounter(srcHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_DISCOVER_MSG], 1);
+		    incrementHostTrafficCounter(realDstHost, 
+						protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_DISCOVER_MSG], 1);
+		    incrementHostTrafficCounter(srcHost,
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_DISCOVER_MSG], 1);
 		    break;
 		  case FLAG_DHCP_OFFER_MSG:
-		    incrementHostTrafficCounter(realDstHost, protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_OFFER_MSG], 1);
-		    incrementHostTrafficCounter(srcHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_OFFER_MSG], 1);
+		    incrementHostTrafficCounter(realDstHost,
+						protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_OFFER_MSG], 1);
+		    incrementHostTrafficCounter(srcHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_OFFER_MSG], 1);
 		    break;
 		  case FLAG_DHCP_REQUEST_MSG:
-		    incrementHostTrafficCounter(realDstHost, protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_REQUEST_MSG], 1);
-		    incrementHostTrafficCounter(srcHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_REQUEST_MSG], 1);
+		    incrementHostTrafficCounter(realDstHost, 
+						protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_REQUEST_MSG], 1);
+		    incrementHostTrafficCounter(srcHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_REQUEST_MSG], 1);
 		    break;
 		  case FLAG_DHCP_DECLINE_MSG:
-		    incrementHostTrafficCounter(realDstHost, protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_DECLINE_MSG], 1);
-		    incrementHostTrafficCounter(srcHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_DECLINE_MSG], 1);
+		    incrementHostTrafficCounter(realDstHost,
+						protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_DECLINE_MSG], 1);
+		    incrementHostTrafficCounter(srcHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_DECLINE_MSG], 1);
 		    break;
 		  case FLAG_DHCP_ACK_MSG:
-		    incrementHostTrafficCounter(realDstHost, protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_ACK_MSG], 1);
-		    incrementHostTrafficCounter(srcHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_ACK_MSG], 1);
+		    incrementHostTrafficCounter(realDstHost, 
+						protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_ACK_MSG], 1);
+		    incrementHostTrafficCounter(srcHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_ACK_MSG], 1);
 		    break;
 		  case FLAG_DHCP_NACK_MSG:
-		    incrementHostTrafficCounter(realDstHost, protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_NACK_MSG], 1);
-		    incrementHostTrafficCounter(srcHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_NACK_MSG], 1);
+		    incrementHostTrafficCounter(realDstHost,
+						protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_NACK_MSG], 1);
+		    incrementHostTrafficCounter(srcHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_NACK_MSG], 1);
 		    break;
 		  case FLAG_DHCP_RELEASE_MSG:
-		    incrementHostTrafficCounter(realDstHost, protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_RELEASE_MSG], 1);
-		    incrementHostTrafficCounter(srcHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_RELEASE_MSG], 1);
+		    incrementHostTrafficCounter(realDstHost,
+						protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_RELEASE_MSG], 1);
+		    incrementHostTrafficCounter(srcHost,
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_RELEASE_MSG], 1);
 		    break;
 		  case FLAG_DHCP_INFORM_MSG:
-		    incrementHostTrafficCounter(realDstHost, protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_INFORM_MSG], 1);
-		    incrementHostTrafficCounter(srcHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_INFORM_MSG], 1);
+		    incrementHostTrafficCounter(realDstHost,
+						protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_INFORM_MSG], 1);
+		    incrementHostTrafficCounter(srcHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_INFORM_MSG], 1);
 		    break;
 		  case FLAG_DHCP_UNKNOWN_MSG:
 		  default:
-		    incrementHostTrafficCounter(realDstHost, protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_UNKNOWN_MSG], 1);
-		    incrementHostTrafficCounter(srcHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_UNKNOWN_MSG], 1);
+		    incrementHostTrafficCounter(realDstHost, 
+						protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_UNKNOWN_MSG], 1);
+		    incrementHostTrafficCounter(srcHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_UNKNOWN_MSG], 1);
 		    break;
 		  }
 		  idx += len;
@@ -482,12 +498,9 @@
 	    }
 
 	    if(realClientHost != NULL) {
-	      if(realClientHost->protocolInfo == NULL) realClientHost->protocolInfo = calloc(1, sizeof(ProtocolInfo));
-
-	      if(realClientHost->protocolInfo->dhcpStats == NULL) {
-		realClientHost->protocolInfo->dhcpStats = (DHCPStats*)malloc(sizeof(DHCPStats));
-		memset(realClientHost->protocolInfo->dhcpStats, 0, sizeof(DHCPStats));
-	      }
+	      /* Fix below courtesy of Massimo Torquati <torquati@ntop.org> */
+	      allocHostTrafficCounterMemory(realClientHost, protocolInfo, sizeof(ProtocolInfo));
+	      allocHostTrafficCounterMemory(realClientHost, protocolInfo->dhcpStats, sizeof(DHCPStats));
 
 	      while(idx < 64 /* Length of the BOOTP vendor-specific area */) {
 		u_char optionId = bootProto.bp_vend[idx++];
@@ -519,32 +532,41 @@
 #endif
 		  switch((int)bootProto.bp_vend[idx]) {
 		  case FLAG_DHCP_DISCOVER_MSG:
-		    incrementHostTrafficCounter(realClientHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_DISCOVER_MSG], 1);
+		    incrementHostTrafficCounter(realClientHost,
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_DISCOVER_MSG], 1);
 		    break;
 		  case FLAG_DHCP_OFFER_MSG:
-		    incrementHostTrafficCounter(realClientHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_OFFER_MSG], 1);
+		    incrementHostTrafficCounter(realClientHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_OFFER_MSG], 1);
 		    break;
 		  case FLAG_DHCP_REQUEST_MSG:
-		    incrementHostTrafficCounter(realClientHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_REQUEST_MSG], 1);
+		    incrementHostTrafficCounter(realClientHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_REQUEST_MSG], 1);
 		    break;
 		  case FLAG_DHCP_DECLINE_MSG:
-		    incrementHostTrafficCounter(realClientHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_DECLINE_MSG], 1);
+		    incrementHostTrafficCounter(realClientHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_DECLINE_MSG], 1);
 		    break;
 		  case FLAG_DHCP_ACK_MSG:
-		    incrementHostTrafficCounter(realClientHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_ACK_MSG], 1);
+		    incrementHostTrafficCounter(realClientHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_ACK_MSG], 1);
 		    break;
 		  case FLAG_DHCP_NACK_MSG:
-		    incrementHostTrafficCounter(realClientHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_NACK_MSG], 1);
+		    incrementHostTrafficCounter(realClientHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_NACK_MSG], 1);
 		    break;
 		  case FLAG_DHCP_RELEASE_MSG:
-		    incrementHostTrafficCounter(realClientHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_RELEASE_MSG], 1);
+		    incrementHostTrafficCounter(realClientHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_RELEASE_MSG], 1);
 		    break;
 		  case FLAG_DHCP_INFORM_MSG:
-		    incrementHostTrafficCounter(realClientHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_INFORM_MSG], 1);
+		    incrementHostTrafficCounter(realClientHost,
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_INFORM_MSG], 1);
 		    break;
 		  case FLAG_DHCP_UNKNOWN_MSG:
 		  default:
-		    incrementHostTrafficCounter(realClientHost, protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_UNKNOWN_MSG], 1);
+		    incrementHostTrafficCounter(realClientHost, 
+						protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_UNKNOWN_MSG], 1);
 		    break;
 		  }
 		  idx += len;
diff -uNr ntop-3.3.8/report.c ntop-3.3.9/report.c
--- ntop-3.3.8/report.c	2008-08-17 23:06:33.000000000 +0200
+++ ntop-3.3.9/report.c	2008-12-09 12:41:47.000000000 +0100
@@ -2194,7 +2194,7 @@
     sendString("<CENTER>\n");
     safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf),
 		  ""TABLE_ON"<TABLE BORDER=1 "TABLE_DEFAULTS"><TR "TR_ON" "DARK_BG"><TH "TH_BG">%s0>Host%s</A></TH>\n"
-		  "<TH "TH_BG">%s1>Domain%s</A></TH>"
+		  "<TH "TH_BG">%s1>Location%s</A></TH>"
 		  "<TH "TH_BG">%s2>Pkts Sent%s</A></TH>"
 		  "<TH "TH_BG">%s3>Data Sent%s</A></TH>"
 		  "<TH "TH_BG">%s4>Pkts Rcvd%s</A></TH>"
@@ -2752,7 +2752,7 @@
 	safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf),
 		      "<CENTER>"TABLE_ON"<TABLE BORDER=1 "TABLE_DEFAULTS">\n<TR "TR_ON" "DARK_BG">"
 		      "<TH "TH_BG">%s1\">Host%s</A></TH>\n"
-		      "<TH "TH_BG">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Domain%s</A></TH>\n"
+		      "<TH "TH_BG">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Location%s</A></TH>\n"
 		      "<TH "TH_BG">%s2\">IP&nbsp;Address%s</A></TH>\n"
 		      "<TH "TH_BG">%s3\">MAC&nbsp;Address%s</A></TH>\n"
 		      "<TH "TH_BG">%s11\">Community%s</A></TH>\n"
@@ -2778,9 +2778,10 @@
 		      theAnchor[10], arrow[10]
 		      );
       } else {
-	safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<CENTER>"TABLE_ON"<TABLE BORDER=1 "TABLE_DEFAULTS">\n<TR "TR_ON" "DARK_BG">"
+	safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), 
+		      "<CENTER>"TABLE_ON"<TABLE BORDER=1 "TABLE_DEFAULTS">\n<TR "TR_ON" "DARK_BG">"
 		      "<TH "TH_BG">%s1\">Host%s</A></TH>\n"
-		      "<TH "TH_BG">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Domain%s</A></TH>\n"
+		      "<TH "TH_BG">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Location%s</A></TH>\n"
 		      "</TH><TH "TH_BG">%s2\">IP&nbsp;Address%s</A></TH>\n"
 		      "<TH "TH_BG">%s11\">Community%s</A></TH>"
 		      "<TH "TH_BG">%s6\">Other&nbsp;Name(s)%s</A></TH>\n"
@@ -3120,6 +3121,35 @@
 
 /* ************************************ */
 
+static void printHostFingerprint(HostTraffic *el) {
+  int idx;
+  char fingerprint[4096] = { '\0' };
+  for(idx=1; idx<MAX_ASSIGNED_IP_PORTS /* 1024 */; idx++) {
+    PortUsage *ports = getPortsUsage(el, idx, 0);
+    int value;
+    
+    value = 0;
+
+    if(ports != NULL) {
+      if((ports->clientUses > 0)  && (ports->serverUses > 0))
+	value = 3;
+      else if(ports->serverUses > 0)
+	value = 2;
+      else if(ports->clientUses > 0)
+	value = 1;
+    }
+
+    if(value > 0)
+      snprintf(&fingerprint[strlen(fingerprint)], 
+	       sizeof(fingerprint)-strlen(fingerprint), 
+	       "%d", value);    
+  }
+  
+  traceEvent (CONST_TRACE_WARNING, "[%s][%s]\n", el->hostNumIpAddress, fingerprint);
+}
+
+/* ************************************ */
+
 void printAllSessionsHTML(char* host, int actualDeviceId, int sortedColumn,
 			  int revertOrder, int pageNum, char *url,
 			  int hostInfoPage) {
@@ -3198,6 +3228,7 @@
     printHostContactedPeers(el, actualDeviceId);
     printHostHTTPVirtualHosts(el, actualDeviceId);
     printHostUsedServices(el, actualDeviceId);
+    printHostFingerprint(el); /* ----- **** ----- */
   } else if(foundFcHost) {
     printHTMLheader("", NULL, 0);
     printFcHostHeader(el, url, revertOrder, sortedColumn, hostInfoPage);
@@ -3466,8 +3497,8 @@
     
     sendString("<P>\n<CENTER>\n");
     sendString(""TABLE_ON"<TABLE BORDER=1 "TABLE_DEFAULTS">\n<TR "TR_ON">");
-    if(el->clientDelay)  sendString("<TH "TH_BG" NOWRAP>Client Mode</TH>");
-    if(el ->serverDelay) sendString("<TH "TH_BG" NOWRAP>Server Mode</TH></TR>\n");
+    if(el->clientDelay)  sendString("<TH "TH_BG" NOWRAP colspan=2>Client Mode</TH>");
+    if(el ->serverDelay) sendString("<TH "TH_BG" NOWRAP colspan=2>Server Mode</TH></TR>\n");
     sendString("<TR>");
 
     if(el->clientDelay) {
@@ -3813,7 +3844,6 @@
     sendString("</CENTER>\n");
 
     printFooterHostLink();
-
   } else
     printNoDataYet();
 
@@ -5853,16 +5883,31 @@
 
     /* Split below courtesy of Andreas Pfaller <apfaller@yahoo.com.au> */
     sendString("<CENTER>\n" TABLE_ON "<TABLE BORDER=1 "TABLE_DEFAULTS">");
-    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf),
-		  "<TR "TR_ON" "DARK_BG">"
-		  "<TH "TH_BG" rowspan=\"3\">%s0>Name%s</A></TH>"
-		  "<TH "TH_BG" rowspan=\"3\">%s1>%s%s</A></TH>"
-		  "<TH "TH_BG" colspan=\"8\">TCP/IP</A></TH>"
-		  "<TH "TH_BG" colspan=\"4\">ICMP</A></TH>"
-		  "<TH "TH_BG">&nbsp;</TH></TR>\n",
-		  theAnchor[0], arrow[0],
-		  theAnchor[1], "Domains",
-		  arrow[1]);
+    
+    if(network_mode == AS_VIEW)
+      safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf),
+		    "<TR "TR_ON" "DARK_BG">"
+		    "<TH "TH_BG" rowspan=\"3\">%s0>Id%s</A></TH>"
+		    "<TH "TH_BG" rowspan=\"3\">Description</TH>"
+		    "<TH "TH_BG" rowspan=\"3\">%s1>%s%s</A></TH>"
+		    "<TH "TH_BG" colspan=\"8\">TCP/IP</A></TH>"
+		    "<TH "TH_BG" colspan=\"4\">ICMP</A></TH>"
+		    "<TH "TH_BG">&nbsp;</TH></TR>\n",
+		    theAnchor[0], arrow[0],
+		    theAnchor[1], "Location",
+		    arrow[1]);
+    else
+      safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf),
+		    "<TR "TR_ON" "DARK_BG">"
+		    "<TH "TH_BG" rowspan=\"3\">%s0>Name%s</A></TH>"
+		    "<TH "TH_BG" rowspan=\"3\">%s1>%s%s</A></TH>"
+		    "<TH "TH_BG" colspan=\"8\">TCP/IP</A></TH>"
+		    "<TH "TH_BG" colspan=\"4\">ICMP</A></TH>"
+		    "<TH "TH_BG">&nbsp;</TH></TR>\n",
+		    theAnchor[0], arrow[0],
+		    theAnchor[1], "Location",
+		    arrow[1]);
+
     sendString(buf);
 
     sendString( "<TR "TR_ON" "DARK_BG">"
@@ -5945,13 +5990,17 @@
 	  safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "as.name.%d",
 			statsEntry->domainHost->hostAS);
 
-	  if(fetchPrefsValue(buf, sym_as_name, sizeof(sym_as_name)) == -1)
-	    snprintf(sym_as_name, sizeof(sym_as_name), "%d", statsEntry->domainHost->hostAS);
+	  if(fetchPrefsValue(buf, sym_as_name, sizeof(sym_as_name)) != -1)
+	    ;	    
+	  else if(statsEntry->domainHost->hostASDescr != NULL)
+	    snprintf(sym_as_name, sizeof(sym_as_name), "%s", statsEntry->domainHost->hostASDescr);
+	  else
+	    snprintf(sym_as_name, sizeof(sym_as_name), "No Info");
 
 	  safe_snprintf(__FILE__, __LINE__, htmlAnchor, sizeof(htmlAnchor),
-			"<A HREF=/%s?dom=%d&netmode=%d>%s</A>",
+			"<A HREF=/%s?dom=%d&netmode=%d>%d</A></TH><TD "TD_BG" ALIGN=RIGHT>%s",
 			CONST_DOMAIN_STATS_HTML, statsEntry->domainHost->hostAS, network_mode,
-			sym_as_name);
+			statsEntry->domainHost->hostAS, sym_as_name);
 	} else
 	  safe_snprintf(__FILE__, __LINE__, htmlAnchor, sizeof(htmlAnchor), "<A HREF=/%s?dom=%s>%s</A>",
 			clusterMode ? CONST_CLUSTER_STATS_HTML : CONST_DOMAIN_STATS_HTML,
@@ -5995,10 +6044,10 @@
       }
 
       safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<TR "TR_ON" %s>"
-		    "<TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=CENTER>%s</TD>"
+		    "<TH "TH_BG" ALIGN=LEFT "DARK_BG">%s%s<TD "TD_BG" ALIGN=CENTER>%s</TD>"
 		    "<TD "TD_BG" ALIGN=RIGHT>%s</TD><TD "TD_BG" ALIGN=RIGHT>%.1f%%</TD>"
 		    "<TD "TD_BG" ALIGN=RIGHT>%s</TD><TD "TD_BG" ALIGN=RIGHT>%.1f%%</TD>",
-		    getRowColor(), htmlAnchor,
+		    getRowColor(), htmlAnchor, (network_mode == AS_VIEW) ? "</TD>" : "</TH>",
 		    ((clusterMode && (!domain_network_name)) || (!statsEntry->domainHost)) ?
 		    "&nbsp;" : getHostCountryIconURL(statsEntry->domainHost),
 		    formatBytes(statsEntry->bytesSent.value, 1, formatBuf, sizeof(formatBuf)),
@@ -6065,7 +6114,7 @@
 
 	sendString("</TD>\n");
       } else {
-	traceEvent(CONST_TRACE_WARNING, "--> hostRRdGraphLink(%d)", network_mode);
+	/* traceEvent(CONST_TRACE_WARNING, "--> hostRRdGraphLink(%d)", network_mode); */
 	sendString("<TD "TD_BG" ALIGN=CENTER>&nbsp;</TD>\n");
       }
 
diff -uNr ntop-3.3.8/reportUtils.c ntop-3.3.9/reportUtils.c
--- ntop-3.3.8/reportUtils.c	2007-12-14 12:29:42.000000000 +0100
+++ ntop-3.3.9/reportUtils.c	2008-11-07 12:04:30.000000000 +0100
@@ -597,7 +597,7 @@
     safe_snprintf(__FILE__, __LINE__, buf, LEN_GENERAL_WORK_BUFFER, 
 		  ""TABLE_ON"<TABLE BORDER=1 "TABLE_DEFAULTS"><TR "TR_ON" "DARK_BG">"
 		  "<TH "TH_BG">%s"FLAG_HOST_DUMMY_IDX_STR"\">Host%s</A></TH>\n"
-		  "<TH "TH_BG">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Domain%s</A></TH>"
+		  "<TH "TH_BG">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Location%s</A></TH>"
 		  "<TH "TH_BG" COLSPAN=2>%s0\">Data%s</A></TH>\n",
 		  theAnchor[0], arrow[0], theAnchor[1], arrow[1],
 		  theAnchor[2], arrow[2]);
@@ -611,7 +611,8 @@
       }
 
     safe_snprintf(__FILE__, __LINE__, buf, LEN_GENERAL_WORK_BUFFER, "<TH "TH_BG">%s1\">TCP%s</A></TH>"
-		  "<TH "TH_BG">%s2\">UDP%s</A></TH><TH "TH_BG">%s3\">ICMP%s</A></TH>""<TH "TH_BG">%s4\">ICMPv6%s</A></TH>"
+		  "<TH "TH_BG">%s2\">UDP%s</A></TH><TH "TH_BG">%s3\">ICMP%s</A></TH>"
+		  "<TH "TH_BG">%s4\">ICMPv6%s</A></TH>"
 		  "<TH "TH_BG">%s5\">DLC%s</A></TH><TH "TH_BG">%s6\">IPX%s</A>"
 		  "</TH><TH "TH_BG">%s7\">IPsec%s</A></TH>"
 		  "<TH "TH_BG">%s8\">(R)ARP%s</A></TH><TH "TH_BG">%s9\">AppleTalk%s</A></TH>",
@@ -664,7 +665,7 @@
     sendString("<CENTER>\n");
     safe_snprintf(__FILE__, __LINE__, buf, LEN_GENERAL_WORK_BUFFER, ""TABLE_ON"<TABLE BORDER=1 "TABLE_DEFAULTS"><TR "TR_ON" "DARK_BG">"
 		"<TH "TH_BG">%s"FLAG_HOST_DUMMY_IDX_STR"\">Host%s</A></TH>\n"
-		"<TH "TH_BG">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Domain%s</A></TH>"
+		"<TH "TH_BG">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Location%s</A></TH>"
 		"<TH "TH_BG" COLSPAN=2>%s0\">Data%s</A></TH>\n",
 		theAnchor[0], arrow[0], theAnchor[1], arrow[1],
 		theAnchor[2], arrow[2]);
@@ -707,7 +708,7 @@
     sendString("<CENTER>\n");
     safe_snprintf(__FILE__, __LINE__, buf, LEN_GENERAL_WORK_BUFFER, ""TABLE_ON"<TABLE BORDER=1 "TABLE_DEFAULTS"><TR "DARK_BG">"
 		"<TH "TH_BG">%s"FLAG_HOST_DUMMY_IDX_STR"\">Host%s</A></TH>"
-		"<TH "TH_BG">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Domain%s</A></TH>\n",
+		"<TH "TH_BG">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Location%s</A></TH>\n",
 		theAnchor[0], arrow[0], theAnchor[1], arrow[1]);
     sendString(buf);
     j = hourId;
@@ -727,10 +728,11 @@
   case SORT_DATA_SENT_THPT:
   case SORT_DATA_THPT:
     sendString("<CENTER>\n");
-    safe_snprintf(__FILE__, __LINE__, buf, LEN_GENERAL_WORK_BUFFER, ""TABLE_ON"<TABLE BORDER=1 "TABLE_DEFAULTS"><TR "TR_ON" "DARK_BG">"
-		"<TH "TH_BG" ROWSPAN=\"2\">%s"FLAG_HOST_DUMMY_IDX_STR"\">Host%s</A></TH>"
-		"<TH "TH_BG" ROWSPAN=\"2\">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Domain%s</A></TH>\n\n",
-		theAnchor[0], arrow[0], theAnchor[1], arrow[1]);
+    safe_snprintf(__FILE__, __LINE__, buf, LEN_GENERAL_WORK_BUFFER, ""TABLE_ON
+		  "<TABLE BORDER=1 "TABLE_DEFAULTS"><TR "TR_ON" "DARK_BG">"
+		  "<TH "TH_BG" ROWSPAN=\"2\">%s"FLAG_HOST_DUMMY_IDX_STR"\">Host%s</A></TH>"
+		  "<TH "TH_BG" ROWSPAN=\"2\">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Location%s</A></TH>\n\n",
+		  theAnchor[0], arrow[0], theAnchor[1], arrow[1]);
     sendString(buf);
 
     updateThpt(0);
@@ -762,10 +764,11 @@
     break;
   case TRAFFIC_STATS:
     sendString("<CENTER>\n");
-    safe_snprintf(__FILE__, __LINE__, buf, LEN_GENERAL_WORK_BUFFER, ""TABLE_ON"<TABLE BORDER=1 "TABLE_DEFAULTS"><TR "TR_ON" "DARK_BG">"
-		"<TH "TH_BG">%s"FLAG_HOST_DUMMY_IDX_STR"\">Host%s</A></TH>"
-		"<TH "TH_BG">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Domain%s</A></TH>\n\n",
-		theAnchor[0], arrow[0], theAnchor[1], arrow[1]);
+    safe_snprintf(__FILE__, __LINE__, buf, LEN_GENERAL_WORK_BUFFER, 
+		  ""TABLE_ON"<TABLE BORDER=1 "TABLE_DEFAULTS"><TR "TR_ON" "DARK_BG">"
+		  "<TH "TH_BG">%s"FLAG_HOST_DUMMY_IDX_STR"\">Host%s</A></TH>"
+		  "<TH "TH_BG">%s"FLAG_DOMAIN_DUMMY_IDX_STR"\">Location%s</A></TH>\n\n",
+		  theAnchor[0], arrow[0], theAnchor[1], arrow[1]);
     sendString(buf);
     break;
   }
@@ -1085,6 +1088,24 @@
 
 /* ******************************* */
 
+int cmpFctnLocationName(const void *_a, const void *_b) {
+  HostTraffic **a = (HostTraffic **)_a;
+  HostTraffic **b = (HostTraffic **)_b;
+  char *c_a = "", *c_b = "";
+
+  if((a != NULL) && (*a != NULL)
+     && (*a)->geo_ip && ((*a)->geo_ip->country_code != NULL))
+    c_a = (*a)->geo_ip->country_code;
+
+  if((b != NULL) && (*b != NULL) 
+     && (*b)->geo_ip && ((*b)->geo_ip->country_code != NULL))
+    c_b = (*b)->geo_ip->country_code;
+  
+  return(strcmp(c_a, c_b));
+}
+
+/* ******************************* */
+
 int cmpFctn(const void *_a, const void *_b) {
   HostTraffic **a = (HostTraffic **)_a;
   HostTraffic **b = (HostTraffic **)_b;
@@ -3493,12 +3514,10 @@
   sendString("<CENTER>\n<P>"TABLE_ON"<TABLE BORDER=1 "TABLE_DEFAULTS" WIDTH=80%%>\n");
 
   if(el->hostNumIpAddress[0] != '\0') {
-    char *countryIcon, *hostType, tmpBuf[64];
+    char *hostType, tmpBuf[64];
 
     accessAddrResMutex("printAllSessions-2");
 
-    countryIcon = getHostCountryIconURL(el);
-
     if(broadcastHost(el)) hostType = "broadcast";
     else if(multicastHost(el)) hostType = "multicast";
     else hostType = "unicast";
@@ -3519,11 +3538,10 @@
       multivlaned = "";
 
     safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH>"
-		"<TD "TD_BG" ALIGN=RIGHT>%s&nbsp;%s&nbsp;[%s%s%s%s]",
-		getRowColor(),
-		"IP&nbsp;Address",
-		el->hostNumIpAddress,
-		countryIcon, hostType, dynIp, multihomed, multivlaned);
+		  "<TD "TD_BG" ALIGN=RIGHT>%s&nbsp;[%s%s%s%s]",
+		  getRowColor(),
+		  "IP&nbsp;Address", el->hostNumIpAddress,
+		  hostType, dynIp, multihomed, multivlaned);
     sendString(buf);
 
     safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), 
@@ -3663,8 +3681,10 @@
       safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH>"
 		  "<TD "TD_BG" ALIGN=RIGHT>%s</TD><TD "TD_BG" ALIGN=RIGHT>%s</TD></TR>\n",
 		  getRowColor(), "DHCP Unknown Msg",
-		  formatPkts(el->protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_UNKNOWN_MSG].value, formatBuf, sizeof(formatBuf)),
-		  formatPkts(el->protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_UNKNOWN_MSG].value, formatBuf1, sizeof(formatBuf1)));
+		  formatPkts(el->protocolInfo->dhcpStats->dhcpMsgSent[FLAG_DHCP_UNKNOWN_MSG].value, 
+			     formatBuf, sizeof(formatBuf)),
+		  formatPkts(el->protocolInfo->dhcpStats->dhcpMsgRcvd[FLAG_DHCP_UNKNOWN_MSG].value,
+			     formatBuf1, sizeof(formatBuf1)));
       sendString(buf);
 
       sendString("</TABLE>"TABLE_OFF"</TD></TR>\n");
@@ -3693,10 +3713,14 @@
 	      formatSeconds(myGlobals.actTime-el->lastSeen, formatBuf2, sizeof(formatBuf2)));
   sendString(buf);
 
+
   if(el->hostAS != 0) {
-    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
-		"<A class=external HREF=\"http://ws.arin.net/cgi-bin/whois.pl?queryinput=AS%d\">%d</A></TD></TR>\n",
-		getRowColor(), "Autonomous System", el->hostAS, el->hostAS);
+    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), 
+		  "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
+		  "<A class=external HREF=\"http://ws.arin.net/cgi-bin/whois.pl?queryinput=AS%d\">%d</A>"
+		  "&nbsp;[%s]</TD></TR>\n",
+		  getRowColor(), "Autonomous System", 
+		  el->hostAS, el->hostAS, (el->hostASDescr != NULL) ? el->hostASDescr : "No AS info");
     sendString(buf);
   }
 
@@ -3706,16 +3730,18 @@
 
     host2networkName(el, subnet_buf, sizeof(subnet_buf));
 
-    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
+    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), 
+		  "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
 		  "<A HREF=\""CONST_DOMAIN_STATS_HTML"?dom=%d&netmode=1\">%s</A></TD></TR>\n", getRowColor(),
 		  "Subnet", el->known_subnet_id, subnet_buf);
     sendString(buf);
   }
 
   if(el->dnsDomainValue && (el->dnsDomainValue[0] != '\0')) {
-    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
-		"%s</TD></TR>\n", getRowColor(),
-		"Domain", el->dnsDomainValue);
+    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), 
+		  "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
+		  "%s</TD></TR>\n", getRowColor(),
+		  "Domain", el->dnsDomainValue);
     sendString(buf);
   }
 
@@ -3924,14 +3950,29 @@
 		    "Host&nbsp;Location", 
 		    "Local (inside specified/local subnet or known network list)");
     } else {
-      safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
-		  "%s</TD></TR>\n", getRowColor(),
-		  "Host&nbsp;Location",
-		  "Remote (outside specified/local subnet)");
+      safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), 
+		    "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
+		    "%s</TD></TR>\n", getRowColor(),
+		    "Host&nbsp;Location",
+		    "Remote (outside specified/local subnet)");
     }
     sendString(buf);
   }
 
+
+  if(el->geo_ip) {
+    char *countryIcon, buf3[512] = { '\0' };
+    
+    if(myGlobals.runningPref.mapperURL) buildMapLink(el, buf3, sizeof(buf3));
+    countryIcon = getHostCountryIconURL(el);
+
+    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), 
+		  "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
+		  "%s, %s %s&nbsp;%s&nbsp;</TD></TR>\n", getRowColor(), "Physical Location", 
+		  el->geo_ip->city ? el->geo_ip->city : "Unknown city", el->geo_ip->country_name, countryIcon, buf3);
+    sendString(buf);
+  }
+
   if(el->community) {
     safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), 
 		  "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
@@ -3972,14 +4013,16 @@
 	      );
   sendString(buf);
 
-  safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
+  safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf),
+		"<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
 	      "%s Pkts</TD></TR>\n",
 	      getRowColor(), "Broadcast&nbsp;Pkts&nbsp;Sent",
 	      formatPkts(el->pktBroadcastSent.value, formatBuf, sizeof(formatBuf)));
   sendString(buf);
 
   if(el->routedTraffic != NULL) {
-    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<TR  "TR_ON"%s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
+    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf),
+		  "<TR  "TR_ON"%s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>"
 		"%s/%s Pkts</TD></TR>\n",
 		getRowColor(), "Routed Traffic",
 		formatBytes(el->routedTraffic->routedBytes.value, 1, formatBuf, sizeof(formatBuf)),
@@ -3988,7 +4031,8 @@
   }
 
   if((el->pktMulticastSent.value > 0) || (el->pktMulticastRcvd.value > 0)) {
-    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>",
+    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), 
+		  "<TR "TR_ON" %s><TH "TH_BG" ALIGN=LEFT "DARK_BG">%s</TH><TD "TD_BG" ALIGN=RIGHT>",
 		getRowColor(), "Multicast&nbsp;Traffic");
     sendString(buf);
 
@@ -4128,14 +4172,7 @@
 		  "[ <A class=external HREF=\"http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s\">Whois</A> ]\n",
 		  getRowColor(), "Further Host Information", el->hostNumIpAddress);
     sendString(buf);
-    
-    if(myGlobals.runningPref.mapperURL) {      
-      sendString(" [");
-      buildMapLink(el, buf, sizeof(buf));
-      sendString(buf);
-      sendString(" ]");
-    }
-    
+        
     sendString("</TD></TR>\n");
   }
 
@@ -5334,14 +5371,27 @@
 void buildMapLink(HostTraffic *el, char *buf, int buf_len) {
   if(privateIPAddress(el))
     buf[0] = '\0';
-  else
+  else {
+#if 0
     safe_snprintf(__FILE__, __LINE__, buf, buf_len,
-		" <A class=external href=\"#\" title=\"Physical Host Location\"onclick=\"window.open(\'%s?host=%s@%s\', "
+		" <A class=external href=\"#\" title=\"Physical Host Location\" "
+		  "onclick=\"window.open(\'%s?host=%s@%s\', "
 		  "\'Host Map\', \'height=210, width=320,toolbar=nodirectories=no,status=no,"
 		  "menubar=no,scrollbars=no,resizable=no\'); return false;\">"
 		  "<IMG SRC=/marker.png border=0></A>\n",
 		  myGlobals.runningPref.mapperURL,
 		  el->hostResolvedName, el->hostNumIpAddress);
+#else
+    safe_snprintf(__FILE__, __LINE__, buf, buf_len,
+		  " <A class=external href=\"#\" title=\"Physical Host Location\" "
+		  "onclick=\"window.open(\'%s?host=%s&ip=%s\', "
+		  "\'Host Map\', \'height=530, width=750,toolbar=nodirectories=no,status=no,"
+		  "menubar=no,scrollbars=no,resizable=no\'); return false;\">"
+		  "<IMG SRC=/marker.png border=0></A>\n",
+		  myGlobals.runningPref.mapperURL,
+		  el->hostResolvedName, el->hostNumIpAddress);
+#endif
+  }
 }
 
 /* ************************************ */
diff -uNr ntop-3.3.8/util.c ntop-3.3.9/util.c
--- ntop-3.3.8/util.c	2008-10-01 23:03:36.000000000 +0200
+++ ntop-3.3.9/util.c	2008-12-09 19:37:20.000000000 +0100
@@ -24,7 +24,10 @@
 
 #include "ntop.h"
 #include <stdarg.h>
+
+#ifndef WIN32
 #include <syslog.h>
+#endif
 
 /* #define ADDRESS_DEBUG */
 /* #define FINGERPRINT_DEBUG */
@@ -207,13 +210,13 @@
 
     for(i=0, j=0; j<sizeof(HostSerial); j++) {
 	  u_int c;
-	  
+
       tmpStr[0] = buf[i++];
       tmpStr[1] = buf[i++];
       tmpStr[2] = '\0';
       sscanf(tmpStr, "%02X", &c);
 	  ptr[j] = c & 0xFF;
-	  
+
 	  /*
 	   ptr[j] = ((u_int8_t)buf[i]) * 16 + ((u_int8_t)buf[i+1]);
 	   i += 2;
@@ -398,10 +401,12 @@
   dst->hostFamily = src->hostFamily;
   switch (src->hostFamily) {
   case AF_INET:
-    return memcpy(&dst->Ip4Address,&src->Ip4Address,sizeof(struct in_addr));
+    memcpy(&dst->Ip4Address,&src->Ip4Address,sizeof(struct in_addr));
+    return(dst);
 #ifdef INET6
   case AF_INET6:
-    return memcpy(&dst->Ip6Address,&src->Ip6Address,sizeof(struct in6_addr));
+    memcpy(&dst->Ip6Address,&src->Ip6Address,sizeof(struct in6_addr));
+    return(dst);
 #endif
 
   default:
@@ -768,11 +773,11 @@
   u_int8_t i, j, bits = 0, fields[4];
 
   memcpy(fields, &addr, 4);
-  
+
   for(i = 8; i <= 8; i--)
     for(j=0; j<4; j++)
-      if ((fields[j] & (1 << i)) != 0) bits++;	
-  
+      if ((fields[j] & (1 << i)) != 0) bits++;
+
     return(bits);
 }
 
@@ -933,7 +938,7 @@
 
 int dotted2bits(char *mask) {
   int fields[4], fields_num;
-  
+
   fields_num = sscanf(mask, "%d.%d.%d.%d",
 		      &fields[0], &fields[1], &fields[2], &fields[3]);
 
@@ -943,9 +948,9 @@
 #endif
     return(atoi(mask));
   } else
-    return(num_network_bits(((fields[0] & 0xff) << 24) 
+    return(num_network_bits(((fields[0] & 0xff) << 24)
 			    + ((fields[1] & 0xff) << 16)
-			    + ((fields[2] & 0xff) << 8) 
+			    + ((fields[2] & 0xff) << 8)
 			    + (fields[3] & 0xff)));
 }
 
@@ -980,14 +985,14 @@
     int bits, a, b, c, d;
     char *mask = strchr(address, '/');
     char *equal = strchr(address, '=');
-    
+
     if(equal != NULL) {
       char key[64];
       equal[0] = '\0';
       safe_snprintf(__FILE__, __LINE__, key, sizeof(key), "subnet.name.%s", address);
       storePrefsValue(key, &equal[1]);
     }
-      
+
     if(mask == NULL) {
       bits = 32;
     } else {
@@ -1144,15 +1149,15 @@
 
 void handleLocalAddresses(char* addresses) {
   char localAddresses[2048];
-  
+
   localAddresses[0] = '\0';
 
   if(addresses != NULL) {
     char *addresses_copy = strdup(addresses);
-    
+
     handleAddressLists(addresses_copy, myGlobals.localNetworks, &myGlobals.numLocalNetworks,
 		       localAddresses, sizeof(localAddresses), CONST_HANDLEADDRESSLISTS_MAIN);
-    
+
     free(addresses_copy);
   }
 
@@ -1174,14 +1179,14 @@
   } else {
     char line[256];
     int idx = 0;
-    
+
     while(!feof(fd) && (fgets(line, sizeof(line), fd) != NULL)) {
       if((line[0] == '#') || (line[0] == '\n')) continue;
       while(strlen(line) && (line[strlen(line)-1] == '\n')) {
 	line[strlen(line)-1] = '\0';
       }
-      
-      safe_snprintf(__FILE__, __LINE__, &buf[idx], buf_len-idx-2, "%s%s", (idx > 0) ? "," : "", line);     
+
+      safe_snprintf(__FILE__, __LINE__, &buf[idx], buf_len-idx-2, "%s%s", (idx > 0) ? "," : "", line);
       idx = strlen(buf);
     }
 
@@ -1208,11 +1213,11 @@
 	addresses_copy = strdup(buf);
     } else
       addresses_copy = strdup(addresses);
-    
+
     if(addresses_copy) {
       handleAddressLists(addresses_copy, myGlobals.subnetStats, &myGlobals.numKnownSubnets,
 			 knownSubnets, sizeof(knownSubnets), CONST_HANDLEADDRESSLISTS_MAIN);
-      
+
       free(addresses_copy);
     }
   }
@@ -2067,7 +2072,7 @@
   if(!mutexId->isLocked) {
     traceEvent(CONST_TRACE_WARNING, "releaseMutex() called with an UN-LOCKED mutex [t%lu m%p @%s:%d] last unlock [t%lu m%u @%s:%d]",
 	       pthread_self(), (void*)&(mutexId->mutex), fileName, fileLine,
-               mutexId->unlock.thread, (int)mutexId->unlock.pid, 
+               mutexId->unlock.thread, (int)mutexId->unlock.pid,
 	       mutexId->unlock.file, mutexId->unlock.line);
 
   }
@@ -2482,8 +2487,6 @@
   el->dnsDomainValue = NULL;
   if (el->dnsTLDValue != NULL)         free(el->dnsTLDValue);
   el->dnsTLDValue = NULL;
-  if (el->ip2ccValue != NULL)          free(el->ip2ccValue);
-  el->ip2ccValue = NULL;
   el->hostResolvedName[0] = '\0';
   el->hostResolvedNameType = FLAG_HOST_SYM_ADDR_TYPE_NONE;
   if (el->fingerprint != NULL)         free(el->fingerprint);
@@ -2493,6 +2496,8 @@
   if (el->routedTraffic != NULL)       free(el->routedTraffic);
   el->routedTraffic = NULL;
   if (el->portsUsage != NULL)          freePortsUsage(el);
+  if (el->geo_ip)                      GeoIPRecord_delete(el->geo_ip);
+
   if (el->protoIPTrafficInfos != NULL) {
     int i;
 
@@ -3174,7 +3179,7 @@
 	revertSlashIfWIN32(string, 0);
 #endif
 
-  
+
   for(i=k, j=1; i<strlen(string)-k; i++) {
     int idx = string[i];
 
@@ -3461,8 +3466,6 @@
   el->dnsDomainValue = NULL;
   if(el->dnsTLDValue != NULL) free(el->dnsTLDValue);
   el->dnsTLDValue = NULL;
-  if(el->ip2ccValue != NULL) free(el->ip2ccValue);
-  el->ip2ccValue = NULL;
 
   if((el->hostResolvedNameType != FLAG_HOST_SYM_ADDR_TYPE_NAME) ||
      (el->hostResolvedName    == NULL) ||
@@ -3472,15 +3475,6 @@
     return;
   }
 
-  ip2cc = ip2CountryCode(el->hostIpAddress);
-
-  if((ip2cc == NULL) || (strcmp(ip2cc, "***") == 0)) {
-    /* We are unable to associate a domain with this IP address. */
-    el->ip2ccValue = NULL;
-  } else {
-    el->ip2ccValue = strdup(ip2cc);
-  }
-
   /* Walk back to the last . */
   i = strlen(el->hostResolvedName)-1;
   while(i > 0)
@@ -3494,7 +3488,7 @@
    */
   if(i > 0)
     el->dnsTLDValue = strdup(&el->hostResolvedName[i+1]);
-  else if((myGlobals.shortDomainName != NULL) 
+  else if((myGlobals.shortDomainName != NULL)
 	  && (myGlobals.shortDomainName[0] != '\0')) {
     /* Walk back to the last . */
     i = strlen(myGlobals.shortDomainName)-1;
@@ -3593,7 +3587,7 @@
 	  int i;
 
 	  for(i=0; i<strlen(nbName); i++) {
-	    if(isupper(nbName[i])) 
+	    if(isupper(nbName[i]))
 	      nbName[i] = tolower(nbName[i]);
 	  }
 
@@ -3811,7 +3805,7 @@
 /* ******************************* */
 
 char* getPortByNum(int port, int type) {
-  char* rsp;
+  char* rsp = NULL;
 
   if(type == IPPROTO_TCP) {
     rsp = getPortByNumber(myGlobals.tcpSvc, port);
@@ -3825,7 +3819,7 @@
 /* ******************************* */
 
 char* getAllPortByNum(int port, char *outBuf, int outBufLen) {
-  char* rsp;
+  char* rsp = NULL;
 
   rsp = getPortByNumber(myGlobals.tcpSvc, port); /* Try TCP first... */
   if(rsp == NULL)
@@ -3842,7 +3836,7 @@
 /* ******************************* */
 
 int getAllPortByName(char* portName) {
-  int rsp;
+  int rsp = 0;
 
   rsp = getPortByName(myGlobals.tcpSvc, portName); /* Try TCP first... */
   if(rsp == -1)
@@ -4155,8 +4149,8 @@
         memset(&remAmount, 0, sizeof(remAmount));
 
         traceEvent(CONST_BEYONDNOISY_TRACE_LEVEL, file, line,
-		   "nanosleep({%d, %d}, )", 
-		   (int)sleepAmount.tv_sec, 
+		   "nanosleep({%d, %d}, )",
+		   (int)sleepAmount.tv_sec,
 		   (int)sleepAmount.tv_nsec);
 
         if((nanosleep(&sleepAmount, &remAmount) != 0) && (errno == EINTR)) {
@@ -4310,7 +4304,7 @@
 
   for(el=getFirstHost(deviceId);
       el != NULL; el = getNextHost(deviceId, el)) {
-    if(broadcastHost(el) 
+    if(broadcastHost(el)
        || ((myGlobals.actTime-el->lastSeen) > PARM_HOST_PURGE_MINIMUM_IDLE_NOACTVSES))
       continue;
     else if (isFcHost (el) && (el->fcCounters->hostFcAddress.domain == FC_ID_SYSTEM_DOMAIN))
@@ -4357,71 +4351,6 @@
   return((a&0xFF)<<24)|((b&0xFF)<<16)|((c&0xFF)<<8)|(d&0xFF);
 }
 
-/* ******************************************************************* */
-
-void* addNodeInternal(u_int32_t ip, int prefix, char *country, int as) {
-  IPNode *p1 = NULL, *p2 = NULL;
-  int i, b;
-
-  if(country)
-    p1 = myGlobals.countryFlagHead;
-  else
-    p1 = myGlobals.asHead;
-
-  for(i=0; i<prefix; i++) {
-    b=(ip>>(31-i)) & 0x1;
-    if(!p1->b[b]) {
-      if(!(p2=malloc(sizeof(IPNode))))
-        return(NULL);
-
-      memset(p2, 0, sizeof(IPNode));
-
-      if(country != NULL)
-	myGlobals.ipCountryMem += sizeof(IPNode);
-      else
-	myGlobals.asMem += sizeof(IPNode);
-      p1->b[b]=p2;
-    }
-    else
-      p2=p1->b[b];
-
-    p1=p2;
-  }
-
-  if(country != NULL) {
-    if(p2->node.cc[0] == 0)
-      strncpy(p2->node.cc, country, sizeof(p2->node.cc));
-  } else {
-    if(p2->node.as == 0)
-      p2->node.as = as;
-  }
-
-  return(p2);
-
-}
-
-/* ******************************************************************* */
-
-char *ip2CountryCode(HostAddr ip) {
-  IPNode *p = myGlobals.countryFlagHead;
-  int i, b;
-  char *cc = "";
-  u_int32_t addr;
-
-  if (ip.hostFamily == AF_INET6)
-    return NULL;
-  addr  = ip.Ip4Address.s_addr;
-  i = 0;
-  while(p != NULL) {
-    if(p->node.cc[0] != 0)
-      cc = p->node.cc;
-    b = (addr >>(31-i)) & 0x1;
-    p = p->b[b];
-    i++;
-  }
-
-  return(cc);
-}
 
 /* *************************************** */
 
@@ -4646,7 +4575,7 @@
     setRunState(FLAG_NTOPSTATE_INITNONROOT);
 
   traceEvent(CONST_TRACE_ALWAYSDISPLAY, "Now running as requested user '%s' (%d:%d)",
-             myGlobals.effectiveUserName ? myGlobals.effectiveUserName : "<unknown>", 
+             myGlobals.effectiveUserName ? myGlobals.effectiveUserName : "<unknown>",
 	     myGlobals.userId, myGlobals.groupId);
 
   if((myGlobals.userId != 0) || (myGlobals.groupId != 0)) {
@@ -4679,38 +4608,9 @@
 #endif
 }
 
-/* ******************************************************************* */
-
-u_short ip2AS(HostAddr ip) {
-  IPNode *p;
-  int i, b;
-  u_short as=0;
-  u_int32_t addr;
-
-  if (ip.hostFamily == AF_INET6)
-    return 0;
-
-  addr = ip.Ip4Address.s_addr;
-
-  p = myGlobals.asHead;
-
-  i=0;
-  while(p!=NULL) {
-    if(p->node.as !=0 )
-      as = p->node.as;
-    b=(addr>>(31-i)) & 0x1;
-    p=p->b[b];
-    i++;
-  }
-
-  return(as);
-}
-
 /* ************************************ */
 
 u_int16_t getHostAS(HostTraffic *el) {
-  if (!el->hostAS)
-    el->hostAS = ip2AS(el->hostIpAddress);
   return (el->hostAS);
 }
 
@@ -4729,7 +4629,8 @@
 /* ********************************** */
 
 int copySerial(HostSerial *a, HostSerial *b) {
-  return(!memcpy(a, b, sizeof(HostSerial)));
+  memcpy(a, b, sizeof(HostSerial));
+  return(!a);
 }
 
 /* ********************************** */
@@ -5928,11 +5829,46 @@
 
 }
 
+/* ************************************ */
+
+static void updateGeoIP(HostTraffic *el) {
+  if(el->hostNumIpAddress[0] != '\0') {
+    if((el->geo_ip == NULL) && (myGlobals.geo_ip_db != NULL)) {
+      el->geo_ip = GeoIP_record_by_addr(myGlobals.geo_ip_db, el->hostNumIpAddress);
+
+      if((el->hostAS == 0) && (myGlobals.geo_ip_asn_db != NULL)) {
+	char *rsp = NULL;
+
+	if(el->hostIpAddress.hostFamily == AF_INET)
+	  rsp = GeoIP_name_by_ipnum(myGlobals.geo_ip_asn_db, el->hostIpAddress.Ip4Address.s_addr);
+	else {
+#ifdef INET6
+#ifndef WIN32
+	  rsp = GeoIP_name_by_ipnum_v6(myGlobals.geo_ip_asn_db, el->hostIpAddress.Ip6Address);
+#endif
+#endif
+	}
+
+	if(rsp != NULL) {
+	  /* Example: AS20959 This AS Number will be used by the Datacom Network. */
+	  char *name;
+
+	  name = strchr(rsp, ' ');
+	  el->hostAS = atoi(&rsp[2]);
+	  if(name) el->hostASDescr = strdup(&name[1]);
+	}
+      }
+    }
+  }
+}
+
 /* ********************************************* */
 
 void _setResolvedName(HostTraffic *el, char *updateValue, short updateType, char* file, int line) {
   int i;
 
+  updateGeoIP(el);
+
   if(updateValue[0] == '\0') return;
 
   /* Do not update 0 -> DNS */
@@ -5956,14 +5892,17 @@
 #endif
 
     if (updateType == FLAG_HOST_SYM_ADDR_TYPE_FC_WWN) {
-      safe_snprintf(__FILE__, __LINE__, el->hostResolvedName, sizeof(el->hostResolvedName),
+      safe_snprintf(__FILE__, __LINE__, el->hostResolvedName,
+		    sizeof(el->hostResolvedName),
 		    fcwwn_to_str ((u_int8_t*)updateValue));
       el->hostResolvedName[LEN_WWN_ADDRESS_DISPLAY] = '\0';
+    } else {
+      safe_snprintf(__FILE__, __LINE__, el->hostResolvedName, 
+		    sizeof(el->hostResolvedName), "%s", updateValue);
     }
-    else {
-      strncpy(el->hostResolvedName, updateValue, MAX_LEN_SYM_HOST_NAME-1);
-    }
+
     // el->hostResolvedName[MAX_LEN_SYM_HOST_NAME-1] = '\0';
+    /* Really needed ? */
     for(i=0; el->hostResolvedName[i] != '\0'; i++)
       el->hostResolvedName[i] = tolower(el->hostResolvedName[i]);
 
@@ -6281,69 +6220,6 @@
 
   return(rc);
 }
-
-/* ********************************************* */
-/* ********************************************* */
-/*       Location code compare function          */
-/* ********************************************* */
-
-int cmpFctnLocationName(const void *_a, const void *_b) {
-  /* This function takes two HostTraffic entries and performs a
-     standardized compare of the location, either the ip2ccValue field
-     or the fallback dnsTLDValue fields, handling unvalued
-     situations to provide a stable comparison.
-
-     We translate 'loc' (rfc1918 addresses) to sort next to last
-     and unvalued items to sort last.
-
-     Equal valued names are sorted based first on full domain name, then
-     on hostResolvedName as the tie breakers.
-  */
-
-  HostTraffic **a = (HostTraffic **)_a;
-  HostTraffic **b = (HostTraffic **)_b;
-  int rc;
-  char *nameA, *nameB;
-
-  rc=0;
-
-  if((*a)->ip2ccValue == NULL) {
-    nameA = "\xFF\xFF";
-  } else if(strcasecmp((*a)->ip2ccValue, "loc") == 0) {
-    nameA = "\xFF\xFE";
-  } else {
-    nameA = (*a)->ip2ccValue;
-  }
-  if((*b)->ip2ccValue == NULL) {
-    nameB = "\xFF\xFF";
-  } else if(strcasecmp((*b)->ip2ccValue, "loc") == 0) {
-    nameB = "\xFF\xFE";
-  } else {
-    nameB = (*b)->ip2ccValue;
-  }
-
-  rc = strcasecmp(nameA, nameB);
-  if(rc == 0) {
-    if((*a)->dnsTLDValue == NULL) {
-      nameA = "\xFF\xFF";
-    } else {
-      nameA = (*a)->dnsTLDValue;
-    }
-    if((*b)->dnsTLDValue == NULL) {
-      nameB = "\xFF\xFF";
-    } else {
-      nameB = (*b)->ip2ccValue;
-    }
-    rc = strcasecmp(nameA != NULL ? nameA : "", nameB != NULL ? nameB : "");
-  }
-
-  if(rc == 0) {
-    rc = cmpFctnResolvedName(a, b);
-  }
-
-  return(rc);
-}
-
 /* ************************************ */
 
 static char x2c(char *what) {
@@ -6465,15 +6341,26 @@
  *    into chain, thus keeping the list sorted.
  */
 PortUsage* getPortsUsage(HostTraffic *el, u_int portIdx, int createIfNecessary) {
-  PortUsage *ports = el->portsUsage, *prev = NULL, *newPort;
+  PortUsage *ports, *prev = NULL, *newPort;
+
+  accessMutex(&myGlobals.portsMutex, "getPortsUsage");
+
+  ports = el->portsUsage;
 
   while((ports != NULL) && (ports->port < portIdx)) {
     prev = ports;
     ports = ports->next;
   }
 
-  if(ports && (ports->port == portIdx)) return(ports); /* Found */
-  if(!createIfNecessary) return(NULL);
+  if(ports && (ports->port == portIdx)) {
+    releaseMutex(&myGlobals.portsMutex);
+    return(ports); /* Found */
+  }
+  
+  if(!createIfNecessary) {
+    releaseMutex(&myGlobals.portsMutex);
+    return(NULL);
+  }
 
   newPort = allocatePortUsage();
   newPort->port = portIdx;
@@ -6491,6 +6378,7 @@
     prev->next = newPort;
   }
 
+  releaseMutex(&myGlobals.portsMutex);
   return(newPort);
 }
 
diff -uNr ntop-3.3.8/utils/p2c ntop-3.3.9/utils/p2c
--- ntop-3.3.8/utils/p2c	2005-05-28 14:36:11.000000000 +0200
+++ ntop-3.3.9/utils/p2c	1970-01-01 01:00:00.000000000 +0100
@@ -1,223 +0,0 @@
-#!/bin/sh
-#  Copyright (c) 2004-2005, Burton M. Strauss III - Burton@ntopsupport.com
-
-# Download the registry data and build an updated p2c table
-
-#  Released under GPL...
-
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#   
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#   
-#    You should have received a copy of the GNU General Public License
-#    along with this program; if not, write to the Free Software Foundation,
-#    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-echo ""
-echo "Making p2c table..."
-echo ""
-
-work="/tmp/p2c"
-dest=`pwd`
-year=`date +%Y`
-month=`date +%m`
-day=`date +%d`
-
-if [ $day -eq 1 ]; then
-    # Fixup for the 1st since some data isn't available until
-    # late in the day
-    echo "Attempting to retrieve data for ${month} ${year}"
-    echo ""
-    echo "**********************************************"
-    echo "*WARNING:                                    *"
-    echo "*                                            *"
-    echo "* Some registry data isn't available until   *"
-    echo "* late on the 1st of the month.              *"
-    echo "*                                            *"
-    echo "* We'll grab last month's data instead       *"
-    echo "*                                            *"
-    echo "**********************************************"
-    month=$(($month - 1))
-    if [ $month -eq 0 ]; then
-        month=12
-        year=$(($year - 1))
-    elif [ $month -lt 10 ]; then
-        month="0${month}"
-    fi
-fi
-
-echo ""
-echo " Retrieving data for ${month} ${year}"
-
-# Temporary - use the official launch day file for April 2005
-if [ "x${year}${month}" = "x200504" ]; then
-  afrinic="ftp://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-20050415"
-else
-  afrinic="ftp://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-${year}${month}01"
-  afrinic02="ftp://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-${year}${month}02"
-  afrinic03="ftp://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-${year}${month}03"
-fi
-apnic="ftp://ftp.apnic.net/pub/stats/apnic/delegated-apnic-${year}${month}01"
-arin="ftp://ftp.arin.net/pub/stats/arin/delegated-arin-${year}${month}01"
-lacnic="ftp://ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-${year}${month}01"
-ripe="ftp://ftp.ripe.net/ripe/stats/${year}/delegated-ripencc-${year}${month}01.bz2"
-
-ripealt="ftp://ftp.ripe.net/ripe/dbase/split/ripe.db.inetnum.gz"
-apnicalt="ftp://ftp.apnic.net/pub/apnic/whois-data/APNIC/split/apnic.db.inetnum.gz"
-
-# We used to get updated data from Cable & Wireless.
-#  They spun this off to SAAVIS, who doesn't appear to be doing it any more...
-# We leave the hook in place, but code is protective...
-extradata=""
-
-echo ""
-echo "  Destination: ${dest}, work directory: ${work}"
-echo ""
-if test -d $work; then
-  echo "  Clean up old work directory..."
-  echo ""
-  rm -rf $work
-fi
-
-echo ""
-echo "  Preparing work directory..."
-echo ""
-mkdir $work
-cp utils/p2clib.* $work
-cp utils/prefixtablegen.c $work
-cp utils/inetnum2countryalloc.c $work
-
-echo ""
-echo "  Checking for a manual override file (manual.something)..."
-echo ""
-manual=`ls -1 -t *manual.* 2>/dev/null | head -n1`
-
-if test "x${manual}" != "x"; then
-    if test -r ${manual}; then
-        echo ""
-        echo "    Copying manual additions to p2c data from ${manual}"
-        echo ""
-        cp ${manual} ${work}/0_p2cmanual.data
-    else
-        echo "    Not found ... continuing ..."
-    fi
-else
-    echo "    Not found ... continuing ..."
-fi
-
-cd $work
-
-echo ""
-echo "  Downloading data..."
-echo ""
-echo "         This will take a while, especially on a slow link"
-echo "                  (the ripe file is over 70MB)."
-echo ""
-echo "                   Time for a cup of coffee..."
-echo ""
-gcc -c -o p2clib.o p2clib.c
-gcc -lm -o prefixtablegen prefixtablegen.c p2clib.o
-gcc -o inetnum2countryalloc inetnum2countryalloc.c p2clib.o
-
-wget -O 1_afrinic.data $afrinic
-rc=$?
-if [ $rc -ne 0 ]; then
-  wget -O 1_afrinic.data $afrinic02
-  rc=$?
-  if [ $rc -ne 0 ]; then
-    wget -O 1_afrinic.data $afrinic03
-  fi
-fi
-wget -O 1_apnic.data $apnic
-wget -O 1_arin.data $arin
-wget -O 1_lacnic.data $lacnic
-wget -O 1_ripe.data.bz2 $ripe
-bunzip2 1_ripe.data.bz2
-
-echo ""
-echo "  Downloading alternate RIPE data..."
-echo ""
-wget -O ripealt.data.gz $ripealt
-
-echo ""
-echo "  Processing alternate RIPE data..."
-echo ""
-zcat ripealt.data.gz | ./inetnum2countryalloc > 2_ripealt.data
-
-echo ""
-echo "  Downloading alternate APNIC data..."
-echo ""
-wget -O apnicalt.data.gz $apnicalt
-
-echo ""
-echo "  Processing alternate APNIC data..."
-echo ""
-zcat apnicalt.data.gz | ./inetnum2countryalloc > 2_apnicalt.data
-
-if [ "x${extradata}" != "x" ]; then
-  echo ""
-  echo "  Downloading Extra data..."
-  echo ""
-  wget -O extradata.data.gz $extradata
-
-  if [ -r extradata.data.gz ]; then
-    echo ""
-    echo "  Processing Extra data..."
-    echo ""
-    zcat extradata.data.gz | ./inetnum2countryalloc > 3_extradata.data
-  else
-    touch 3_extradata.data
-  fi
-else
-  touch 3_extradata.data
-fi
-
-echo ""
-echo "  Checking data..."
-echo ""
-err="N"
-for i in `ls *.data`; do
-    if test ! -r ${i} ; then
-        echo "ERROR: $i is missing..."
-        err="Y"
-    else
-      if test ! -s ${i} ; then
-          echo "WARNING: $i is empty...continuing anyway..."
-      fi
-    fi
-done
-if test "${err}" = "Y"; then
-    echo ""
-    echo "ABORTING - files remain in $work"
-    exit 1
-fi
-
-echo ""
-echo "  Processing downloaded data..."
-echo ""
-./prefixtablegen -v *.data
-
-echo ""
-echo "  Copying file(s) to ntop directory..."
-echo ""
-for i in `ls p2c.*.table`; do
-    echo "Copying ${i}..."
-    cp $i $dest
-done
-
-echo ""
-echo "  Cleanup work directory..."
-echo ""
-cd $pwd
-rm -rf $work
-
-echo ""
-echo "Done!"
-echo ""
diff -uNr ntop-3.3.8/utils/p2clib.c ntop-3.3.9/utils/p2clib.c
--- ntop-3.3.8/utils/p2clib.c	2003-09-07 05:53:20.000000000 +0200
+++ ntop-3.3.9/utils/p2clib.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,69 +0,0 @@
-/*
- *  Copyright (C) 2003 Luca Deri <deri@ntop.org>
- *                     Andreas Pfaller <apfaller@yahoo.com.au>
- *
- *                        http://www.ntop.org/
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include "p2clib.h"
-
-/* ************************************************************************* */
-
-char *strtolower(char *s) {
-  while (*s) {
-    *s=tolower(*s);
-    s++;
-  }
-  
-  return(s);
-}
-
-/* ************************************************************************* */
-
-char *strtoupper(char *s) {
-  while (*s) {
-    *s=toupper(*s);
-    s++;
-  }
-  
-  return(s);
-}
-
-/* ************************************************************************* */
-
-u_int32_t xaton(char *s)
-{
-  u_int32_t a, b, c, d;
-
-  if (4!=sscanf(s, "%d.%d.%d.%d", &a, &b, &c, &d))
-    return 0;
-  return ((a&0xFF)<<24)|((b&0xFF)<<16)|((c&0xFF)<<8)|(d&0xFF);
-}
-
-/* ************************************************************************* */
-
-char *xntoa(u_int32_t ip, char *result, int len)
-{
-  snprintf(result, len, "%d.%d.%d.%d",
-           (ip>>24)&0xFF, (ip>>16)&0xFF, (ip>>8)&0xFF, ip&0xFF);
-  return result;
-}
-
diff -uNr ntop-3.3.8/utils/p2clib.h ntop-3.3.9/utils/p2clib.h
--- ntop-3.3.8/utils/p2clib.h	2003-09-07 05:53:20.000000000 +0200
+++ ntop-3.3.9/utils/p2clib.h	1970-01-01 01:00:00.000000000 +0100
@@ -1,30 +0,0 @@
-/*
- *  Copyright (C) 2003 Luca Deri <deri@ntop.org>
- *                     Andreas Pfaller <apfaller@yahoo.com.au>
- *
- *                        http://www.ntop.org/
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* ************************************************************************* */
-
-#define QUAD2IP(a,b,c,d) ((a)<<24 | (b)<<16 | (c)<<8 | (d))
-#define PREFIX2MASK(n) (~0UL<<(32-(n)))
-
-char *strtolower(char *s);
-char *strtoupper(char *s);
-u_int32_t xaton(char *s);
-char *xntoa(u_int32_t ip, char *result, int len);
diff -uNr ntop-3.3.8/webInterface.c ntop-3.3.9/webInterface.c
--- ntop-3.3.8/webInterface.c	2008-10-02 12:54:15.000000000 +0200
+++ ntop-3.3.9/webInterface.c	2008-11-07 12:04:30.000000000 +0100
@@ -678,75 +678,65 @@
 /* ************************ */
 
 char* getHostCountryIconURL(HostTraffic *el) {
-  char path[256], *img, *source;
+  char path[256], *img = NULL;
   static char flagBuf[384];
   struct stat buf;
   int rc;
 
   fillDomainName(el);
 
-  if((el->ip2ccValue != NULL) && (strcasecmp(el->ip2ccValue, "loc") == 0)) {
+  if(el->geo_ip == NULL) {
+#if 0
+    safe_snprintf(__FILE__, __LINE__, flagBuf, sizeof(flagBuf),
+		  "<img class=tooltip alt=\"Local Host\" title=\"Local Host\" "
+		  "align=\"middle\" src=\"/statsicons/flags/local.gif\" border=\"0\">");
+#endif
+    return("&nbsp;");
+  }
+
+  if(el->geo_ip->country_code[0] == '\0') {
     safe_snprintf(__FILE__, __LINE__, flagBuf, sizeof(flagBuf),
 		  "<img class=tooltip alt=\"Local Host\" title=\"Local Host\" "
 		  "align=\"middle\" src=\"/statsicons/flags/local.gif\" border=\"0\">");
   } else {
-    /* Try all the possible combos of name and path */
-    rc = -1; /* Start bad */
+    char c_buf[16] = { '\0'};
+    int i;
 
-    if(el->ip2ccValue != NULL) {
-      if(rc != 0) {
-	safe_snprintf(__FILE__, __LINE__, path, sizeof(path), "./html/statsicons/flags/%s.gif",
-		      el->ip2ccValue);
-	rc = stat(path, &buf);
-      }
-      if(rc != 0) {
-	safe_snprintf(__FILE__, __LINE__, path, sizeof(path), "%s/html/statsicons/flags/%s.gif",
-		      CFG_DATAFILE_DIR, el->ip2ccValue);
-	rc = stat(path, &buf);
-      }
-      if(rc == 0) {
-	img = el->ip2ccValue;
-	source = "(from p2c file)";
-      }
-    }
+    safe_snprintf(__FILE__, __LINE__, c_buf, sizeof(c_buf)-1, "%s", el->geo_ip->country_code);
 
-    if(rc != 0) {
-      if(el->dnsTLDValue != NULL) {
-	safe_snprintf(__FILE__, __LINE__, path, sizeof(path), "./html/statsicons/flags/%s.gif",
-		      el->dnsTLDValue);
-	rc = stat(path, &buf);
-
-	if(rc != 0) {
-	  safe_snprintf(__FILE__, __LINE__, path, sizeof(path), "%s/html/statsicons/flags/%s.gif",
-			CFG_DATAFILE_DIR, el->dnsTLDValue);
-	  rc = stat(path, &buf);
-	}
-	if(rc == 0) {
-	  img = el->dnsTLDValue;
-	  if(strlen(img) == 2)
-	    source = "(Guessing from ccTLD)";
-	  else
-	    source = "(Guessing from gTLD)";
-	}
-      }
-    }
+    for(i=0; c_buf[i] != '\0'; i++) c_buf[i] = tolower(c_buf[i]);
 
+    safe_snprintf(__FILE__, __LINE__, path, sizeof(path), "./html/statsicons/flags/%s.gif",
+		  c_buf);
+	revertSlashIfWIN32(path, 0);
+    rc = stat(path, &buf);
+    
     if(rc != 0) {
-      /* Nothing worked... */
-      safe_snprintf(__FILE__, __LINE__, flagBuf, sizeof(flagBuf),
-		    "&nbsp;<!-- No flag for %s or %s -->",
-		    el->ip2ccValue != NULL  ? el->ip2ccValue  : "null",
-		    el->dnsTLDValue != NULL ? el->dnsTLDValue : "null");
-    } else {
-      safe_snprintf(__FILE__, __LINE__, flagBuf, sizeof(flagBuf),
-		    "<img class=tooltip alt=\"Flag for %s code %s %s\" title=\"Flag for %s code %s %s\" align=\"middle\" "
-		    "src=\"/statsicons/flags/%s.gif\" border=\"0\">",
-		    strlen(img) == 2 ? "ISO 3166" : "gTLD", img, source,
-		    strlen(img) == 2 ? "ISO 3166" : "gTLD", img, source,
-		    img);
+      safe_snprintf(__FILE__, __LINE__, path, sizeof(path), "%s/html/statsicons/flags/%s.gif",
+		    CFG_DATAFILE_DIR, el->geo_ip->country_code);
+	  revertSlashIfWIN32(path, 0);
+      rc = stat(path, &buf);
+    } 
+
+    if(rc == 0) {
+      img = c_buf;
     }
   }
 
+  if(img == NULL) {
+    /* Nothing worked... */
+    safe_snprintf(__FILE__, __LINE__, flagBuf, sizeof(flagBuf),
+		  "&nbsp;<!-- No flag for %s (%s) -->",
+		  el->geo_ip->country_name, el->geo_ip->country_code);
+  } else {
+    safe_snprintf(__FILE__, __LINE__, flagBuf, sizeof(flagBuf),
+		  "<img class=tooltip alt=\"Flag for %s (%s)\" title=\"Flag for %s (%s)\" align=\"middle\" "
+		  "src=\"/statsicons/flags/%s.gif\" border=\"0\">",
+		  el->geo_ip->country_name, el->geo_ip->country_code,
+		  el->geo_ip->country_name, el->geo_ip->country_code,
+		  img);
+  }  
+
   return(flagBuf);
 }
 
@@ -6152,6 +6142,14 @@
   snprintf(buf, sizeof(buf), "%1.4f", rrd_version());
   printFeatureConfigInfo(textPrintFlag, "<A HREF=http://www.rrdtool.org/>RRD</A> Version", buf);
 
+  if(myGlobals.geo_ip_db != NULL)
+    printFeatureConfigInfo(textPrintFlag, "<A HREF=http://www.maxmind.com/>GeoIP</A> Version", 
+			   GeoIP_database_info(myGlobals.geo_ip_db));
+
+  if(myGlobals.geo_ip_asn_db != NULL)
+    printFeatureConfigInfo(textPrintFlag, "<A HREF=http://www.maxmind.com/>GeoIP</A> AS Version", 
+			   GeoIP_database_info(myGlobals.geo_ip_asn_db));
+
 #ifndef WIN32
   if(getDynamicLoadPaths(mainbuf, sizeof(mainbuf), lib, sizeof(lib), env, sizeof(env)) == 0) {
     printFeatureConfigInfo(textPrintFlag, "Running from", mainbuf);
@@ -6570,9 +6568,6 @@
 
   printFeatureConfigInfo(textPrintFlag, "Domain name (short)", myGlobals.shortDomainName);
 
-  safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "%d", myGlobals.ipCountryCount);
-  printFeatureConfigInfo(textPrintFlag, "IP to country flag table (entries)", buf);
-
   safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "%d", myGlobals.hashCollisionsLookup);
   printFeatureConfigInfo(textPrintFlag, "Total Hash Collisions (Vendor/Special) (lookup)", buf);
 
@@ -6799,17 +6794,6 @@
 
     safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "%d", myGlobals.ipxsapHashLoadSize);
     printFeatureConfigInfo(textPrintFlag, "IPX/SAP Hash Size (bytes)", buf);
-
-    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "%d (%.1f MB)", myGlobals.ipCountryMem, (float)myGlobals.ipCountryMem/(1024.0*1024.0));
-    printFeatureConfigInfo(textPrintFlag, "IP to country flag table (bytes)", buf);
-
-    if(myGlobals.ipCountryCount > 0) {
-      safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "%.1f", (float)myGlobals.ipCountryMem/myGlobals.ipCountryCount);
-      printFeatureConfigInfo(textPrintFlag, "Bytes per entry", buf);
-    }
-
-    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "%d (%.1f MB)", myGlobals.asMem, (float)myGlobals.asMem/(1024.0*1024.0));
-    printFeatureConfigInfo(textPrintFlag, "IP to AS (Autonomous System) number table (bytes)", buf);
   }
 
   printInfoSectionTitle(textPrintFlag, "Host Memory Cache");
@@ -8949,10 +8933,11 @@
       if(fetchPrefsValue(key.dptr, val, sizeof(val)) == 0) {
 	safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf),
 		      "<FORM ACTION="CONST_EDIT_PREFS">"
-		      "<TR><TH ALIGN=LEFT "DARK_BG"><INPUT TYPE=HIDDEN NAME=key VALUE=\"%s\">%s</TH>"
-		      "<TD><INPUT TYPE=TEXT NAME=val VALUE=\"%s\" size=30></TD>"
-		      "<TD ALIGN=CENTER><INPUT TYPE=SUBMIT VALUE=Set></TD></TR></FORM>\n",
-		      key.dptr, key.dptr, val);
+		      "<TR><TH ALIGN=LEFT "DARK_BG"><INPUT TYPE=HIDDEN NAME=key VALUE=\"%s\">"
+			  "<A NAME=\"%s\">%s</A></TH>"
+		      "<TD><INPUT TYPE=TEXT NAME=val VALUE=\"%s\" size=60></TD>"
+		      "<TD ALIGN=CENTER><INPUT TYPE=SUBMIT VALUE=Set></TD></TR></FORM></A>\n",
+		      key.dptr, key.dptr, key.dptr, val);
 	sendString(buf);
       }
     }
