]> The Tcpdump Group git mirrors - tcpdump/commitdiff
(for 4.9.3) libdnet has bugs, do not use it.
authorDenis Ovsienko <[email protected]>
Mon, 23 Jul 2018 22:28:24 +0000 (23:28 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 27 Aug 2019 09:20:42 +0000 (11:20 +0200)
The only function tcpdump used in libdnet was dnet_htoa(), which tries
to translate a binary DECnet address to a nodename through a lookup in
/etc/decnet.conf. The translation is slow and has a bug, so stop using
the function and remove the dependency on libdnet.

This makes tcpdump always print DECnet addresses in numeric format, if
anybody needs the translation back they are welcome to fix libdnet or
(more realistically) add an implementation of dnet_htoa() to the tcpdump
source code and use it.

.travis.yml
addrtoname.c
config.h.in
configure
configure.ac
netdissect.h
print-decnet.c

index 57ad7fe54c6c6b8712e1638c9aa849ce30d0cfb3..449c1f4a97e77e0ee4f5d0208973f663ab54cb7d 100644 (file)
@@ -47,7 +47,6 @@ addons:
     packages:
       - libssl-dev
       - libssl1.0.0
-      - libdnet-dev
       - libsmi2-dev
       - libcap-ng-dev
       - libpcap-dev
index a30886a7c2ed4f5a9427bff08c63e37907a74b4b..15e57411f52c6be2c1bee49af3d254014c5bd35d 100644 (file)
@@ -1226,10 +1226,7 @@ dnaddr_string(netdissect_options *ndo, u_short dnaddr)
 
        tp->addr = dnaddr;
        tp->nxt = newhnamemem(ndo);
-       if (ndo->ndo_nflag)
-               tp->name = dnnum_string(ndo, dnaddr);
-       else
-               tp->name = dnname_string(ndo, dnaddr);
+       tp->name = dnnum_string(ndo, dnaddr);
 
        return(tp->name);
 }
index 7451c2818dac7466e919fdf01fdadf7880f68bdf..f23a6f8e7f8de7915cf36497e6b2c1bf2c4ad03e 100644 (file)
@@ -28,9 +28,6 @@
    don't. */
 #undef HAVE_DECL_ETHER_NTOHOST
 
-/* define if you have the dnet_htoa function */
-#undef HAVE_DNET_HTOA
-
 /* Define to 1 if you have the `ether_ntohost' function. */
 #undef HAVE_ETHER_NTOHOST
 
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
-/* Define to 1 if you have the <netdnet/dnetdb.h> header file. */
-#undef HAVE_NETDNET_DNETDB_H
-
-/* define if you have a dnet_htoa declaration in <netdnet/dnetdb.h> */
-#undef HAVE_NETDNET_DNETDB_H_DNET_HTOA
-
 /* Define to 1 if you have the <netinet/ether.h> header file. */
 #undef HAVE_NETINET_ETHER_H
 
index 7c1f1df4ccc7c4d088274f66dcd67167e868a112..9a896984d2008a2dc4613980b52f6ce51c805eb0 100755 (executable)
--- a/configure
+++ b/configure
@@ -4193,7 +4193,7 @@ fi
 done
 
 
-for ac_header in fcntl.h rpc/rpc.h rpc/rpcent.h netdnet/dnetdb.h
+for ac_header in fcntl.h rpc/rpc.h rpc/rpcent.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -5057,33 +5057,6 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
        fi
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_htoa declaration in netdnet/dnetdb.h" >&5
-$as_echo_n "checking for dnet_htoa declaration in netdnet/dnetdb.h... " >&6; }
-if ${td_cv_decl_netdnet_dnetdb_h_dnet_htoa+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <netdnet/dnetdb.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "dnet_htoa" >/dev/null 2>&1; then :
-  td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes
-else
-  td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $td_cv_decl_netdnet_dnetdb_h_dnet_htoa" >&5
-$as_echo "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" >&6; }
-if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then
-
-$as_echo "#define HAVE_NETDNET_DNETDB_H_DNET_HTOA 1" >>confdefs.h
-
-fi
-
 ac_fn_c_check_func "$LINENO" "vfprintf" "ac_cv_func_vfprintf"
 if test "x$ac_cv_func_vfprintf" = xyes; then :
   $as_echo "#define HAVE_VFPRINTF 1" >>confdefs.h
@@ -5291,65 +5264,6 @@ done
            ;;
     esac
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dnet_htoa" >&5
-$as_echo_n "checking for library containing dnet_htoa... " >&6; }
-if ${ac_cv_search_dnet_htoa+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dnet_htoa ();
-int
-main ()
-{
-return dnet_htoa ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' dnet; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_dnet_htoa=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_dnet_htoa+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_dnet_htoa+:} false; then :
-
-else
-  ac_cv_search_dnet_htoa=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dnet_htoa" >&5
-$as_echo "$ac_cv_search_dnet_htoa" >&6; }
-ac_res=$ac_cv_search_dnet_htoa
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-$as_echo "#define HAVE_DNET_HTOA 1" >>confdefs.h
-
-fi
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lrpc" >&5
 $as_echo_n "checking for main in -lrpc... " >&6; }
 if ${ac_cv_lib_rpc_main+:} false; then :
index 4b65b75755bfe231606a5f6a06cda45de08ebe3a..3609961101fb2cac2b36c8bfa2814c496c6556aa 100644 (file)
@@ -32,7 +32,7 @@ if test "$ac_cv___attribute__" = "yes"; then
        fi
 fi
 
-AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h netdnet/dnetdb.h)
+AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h)
 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
 #include <sys/socket.h>
 #include <net/if.h>])
@@ -385,16 +385,6 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
        fi
 fi
 
-AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
-[td_cv_decl_netdnet_dnetdb_h_dnet_htoa],
-[AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h,
-       td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes,
-       td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no)])
-if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then
-       AC_DEFINE(HAVE_NETDNET_DNETDB_H_DNET_HTOA, 1,
-           [define if you have a dnet_htoa declaration in <netdnet/dnetdb.h>])
-fi
-
 AC_REPLACE_FUNCS(vfprintf strlcat strlcpy strdup strsep getopt_long)
 AC_CHECK_FUNCS(fork vfork strftime)
 AC_CHECK_FUNCS(setlinebuf alarm)
@@ -408,9 +398,6 @@ fi
 
 AC_LBL_TYPE_SIGNAL
 
-AC_SEARCH_LIBS(dnet_htoa, dnet,
-    AC_DEFINE(HAVE_DNET_HTOA, 1, [define if you have the dnet_htoa function]))
-
 AC_CHECK_LIB(rpc, main)                dnl It's unclear why we might need -lrpc
 
 dnl Some platforms may need -lnsl for getrpcbynumber.
index b2d4ecf962ebaf48072e648d90f85e3f013609c3..02f196cdcb13ba71c02bda247582e61bfead5afd 100644 (file)
@@ -641,7 +641,6 @@ extern int nextproto6_cksum(netdissect_options *, const struct ip6_hdr *, const
 extern int mask2plen(uint32_t);
 extern int mask62plen(const u_char *);
 
-extern const char *dnname_string(netdissect_options *, u_short);
 extern const char *dnnum_string(netdissect_options *, u_short);
 
 extern char *smb_errstr(int, int);
index de7de2758ee73192769a06e9edf64cce3ebca65c..6e2c7913f5ecdda6272881439840587555cca302 100644 (file)
 struct mbuf;
 struct rtentry;
 
-#ifdef HAVE_NETDNET_DNETDB_H
-#include <netdnet/dnetdb.h>
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -75,12 +71,6 @@ typedef union etheraddress etheraddr;        /* Ethernet address */
 #define        AREASHIFT       10              /* bit-offset for area field */
 #define NODEMASK       01777           /* mask for node address field */
 
-#define DN_MAXADDL     20              /* max size of DECnet address */
-struct dn_naddr {
-       uint16_t        a_len;          /* length of address */
-       uint8_t a_addr[DN_MAXADDL]; /* address as bytes */
-};
-
 /*
  * Define long and short header formats.
  */
@@ -492,10 +482,6 @@ static int print_elist(const char *, u_int);
 static int print_nsp(netdissect_options *, const u_char *, u_int);
 static void print_reason(netdissect_options *, int);
 
-#ifndef HAVE_NETDNET_DNETDB_H_DNET_HTOA
-extern char *dnet_htoa(struct dn_naddr *);
-#endif
-
 void
 decnet_print(netdissect_options *ndo,
              register const u_char *ap, register u_int length,
@@ -1252,22 +1238,3 @@ dnnum_string(netdissect_options *ndo, u_short dnaddr)
        snprintf(str, siz, "%d.%d", area, node);
        return(str);
 }
-
-const char *
-dnname_string(netdissect_options *ndo, u_short dnaddr)
-{
-#ifdef HAVE_DNET_HTOA
-       struct dn_naddr dna;
-       char *dnname;
-
-       dna.a_len = sizeof(short);
-       memcpy((char *)dna.a_addr, (char *)&dnaddr, sizeof(short));
-       dnname = dnet_htoa(&dna);
-       if(dnname != NULL)
-               return (strdup(dnname));
-       else
-               return(dnnum_string(ndo, dnaddr));
-#else
-       return(dnnum_string(ndo, dnaddr));      /* punt */
-#endif
-}