aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>1998-09-25 23:24:07 +0000
committerGerald Combs <gerald@wireshark.org>1998-09-25 23:24:07 +0000
commit3da04dd983e2c3c66fae3adb5e6e4a57aab63f4e (patch)
tree8d5725d0fe36059aa33286b93b05f4a9f701d193
parenteac9fd94be4f7ff65e0537762b04619a3494b102 (diff)
* Ethernet manufacturer support (Laurent)
* PPP fixes (Gerald) * Null/loopback interface support (Gerald) svn path=/trunk/; revision=25
-rw-r--r--AUTHORS1
-rw-r--r--Makefile.am21
-rw-r--r--Makefile.in86
-rw-r--r--NEWS8
-rw-r--r--README4
-rw-r--r--VERSION2
-rw-r--r--acconfig.h2
-rw-r--r--config.h.in2
-rwxr-xr-xconfigure109
-rw-r--r--configure.in22
-rw-r--r--file.c4
-rw-r--r--manuf185
-rw-r--r--menu.c6
-rw-r--r--packet-eth.c27
-rw-r--r--packet-null.c97
-rw-r--r--packet-ppp.c26
-rw-r--r--packet.c8
-rw-r--r--packet.h102
-rw-r--r--prefs.c109
-rw-r--r--prefs.h33
-rw-r--r--resolv.c555
-rw-r--r--resolv.h36
22 files changed, 1263 insertions, 182 deletions
diff --git a/AUTHORS b/AUTHORS
index 0e29df3ab5..5a8ba59ac6 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -36,6 +36,7 @@ Laurent Deniel <deniel@worldnet.fr> {
http://www.worldnet.fr/~deniel
Name resolution
+ Ethernet/Manufacturer files support
ISO/OSI CLNP/COTP support
Miscellaneous enhancements and fixes
}
diff --git a/Makefile.am b/Makefile.am
index 5f7b73867f..97644a0fcd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,6 +2,8 @@ bin_PROGRAMS = ethereal
man_MANS = ethereal.1
+sysconf_DATA = manuf
+
ethereal_SOURCES = \
capture.c \
ethereal.c \
@@ -22,6 +24,7 @@ ethereal_SOURCES = \
packet-ipv6.c \
packet-ipx.c \
packet-ncp.c \
+ packet-null.c \
packet-osi.c \
packet-ospf.c \
packet-ppp.c \
@@ -32,6 +35,7 @@ ethereal_SOURCES = \
packet-trmac.c \
packet-udp.c \
packet-vines.c \
+ prefs.c \
print.c \
ps.c \
resolv.c \
@@ -46,9 +50,11 @@ ethereal_SOURCES = \
menu.h \
packet.h \
packet-ipv6.h \
+ packet-ipx.h \
packet-ospf.h \
packet-rip.h \
packet-vines.h \
+ prefs.h \
print.h \
ps.h \
resolv.h \
@@ -64,12 +70,17 @@ rdps: rdps.c
EXTRA_ethereal_SOURCES = @SNPRINTF_C@
ethereal_DEPENDENCIES = @SNPRINTF_O@
LDADD = @SNPRINTF_O@
+DISTCLEANFILES = \
+ rdps \
+ ps.c
EXTRA_DIST = \
+ doc/Makefile \
+ doc/ethereal.pod \
ethereal.1 \
- snprintf.c \
- rdps.c \
- print.ps \
image/icon-excl.xpm \
- doc/Makefile \
- doc/ethereal.pod
+ manuf \
+ print.ps \
+ rdps.c \
+ snprintf.c
+
diff --git a/Makefile.in b/Makefile.in
index 6f52347eff..bca521fc2b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -60,6 +60,7 @@ POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
CC = @CC@
+DATAFILE_DIR = @DATAFILE_DIR@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@
@@ -73,6 +74,8 @@ bin_PROGRAMS = ethereal
man_MANS = ethereal.1
+sysconf_DATA = manuf
+
ethereal_SOURCES = \
capture.c \
ethereal.c \
@@ -92,6 +95,8 @@ ethereal_SOURCES = \
packet-ip.c \
packet-ipv6.c \
packet-ipx.c \
+ packet-ncp.c \
+ packet-null.c \
packet-osi.c \
packet-ospf.c \
packet-ppp.c \
@@ -102,6 +107,7 @@ ethereal_SOURCES = \
packet-trmac.c \
packet-udp.c \
packet-vines.c \
+ prefs.c \
print.c \
ps.c \
resolv.c \
@@ -116,9 +122,11 @@ ethereal_SOURCES = \
menu.h \
packet.h \
packet-ipv6.h \
+ packet-ipx.h \
packet-ospf.h \
packet-rip.h \
packet-vines.h \
+ prefs.h \
print.h \
ps.h \
resolv.h \
@@ -128,15 +136,19 @@ ethereal_SOURCES = \
EXTRA_ethereal_SOURCES = @SNPRINTF_C@
ethereal_DEPENDENCIES = @SNPRINTF_O@
LDADD = @SNPRINTF_O@
+DISTCLEANFILES = \
+ rdps \
+ ps.c
EXTRA_DIST = \
+ doc/Makefile \
+ doc/ethereal.pod \
ethereal.1 \
- snprintf.c \
- rdps.c \
- print.ps \
image/icon-excl.xpm \
- doc/Makefile \
- doc/ethereal.pod
+ manuf \
+ print.ps \
+ rdps.c \
+ snprintf.c
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
@@ -151,9 +163,10 @@ LIBS = @LIBS@
ethereal_OBJECTS = capture.o ethereal.o ethertype.o file.o filter.o \
follow.o menu.o packet.o packet-arp.o packet-bootp.o packet-data.o \
packet-dns.o packet-eth.o packet-llc.o packet-lpd.o packet-ip.o \
-packet-ipv6.o packet-ipx.o packet-osi.o packet-ospf.o packet-ppp.o \
-packet-raw.o packet-rip.o packet-tcp.o packet-tr.o packet-trmac.o \
-packet-udp.o packet-vines.o print.o ps.o resolv.o util.o
+packet-ipv6.o packet-ipx.o packet-ncp.o packet-null.o packet-osi.o \
+packet-ospf.o packet-ppp.o packet-raw.o packet-rip.o packet-tcp.o \
+packet-tr.o packet-trmac.o packet-udp.o packet-vines.o prefs.o print.o \
+ps.o resolv.o util.o
ethereal_LDADD = $(LDADD)
ethereal_LDFLAGS =
CFLAGS = @CFLAGS@
@@ -163,9 +176,12 @@ man1dir = $(mandir)/man1
MANS = $(man_MANS)
NROFF = nroff
+DATA = $(sysconf_DATA)
+
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
-Makefile.in NEWS acconfig.h aclocal.m4 config.h.in configure \
-configure.in install-sh missing mkinstalldirs stamp-h.in
+Makefile.in NEWS acconfig.h aclocal.m4 config.guess config.h.in \
+config.sub configure configure.in install-sh missing mkinstalldirs \
+stamp-h.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -177,15 +193,16 @@ DEP_FILES = .deps/capture.P .deps/ethereal.P .deps/ethertype.P \
.deps/packet-arp.P .deps/packet-bootp.P .deps/packet-data.P \
.deps/packet-dns.P .deps/packet-eth.P .deps/packet-ip.P \
.deps/packet-ipv6.P .deps/packet-ipx.P .deps/packet-llc.P \
-.deps/packet-lpd.P .deps/packet-osi.P .deps/packet-ospf.P \
-.deps/packet-ppp.P .deps/packet-raw.P .deps/packet-rip.P \
-.deps/packet-tcp.P .deps/packet-tr.P .deps/packet-trmac.P \
-.deps/packet-udp.P .deps/packet-vines.P .deps/packet.P .deps/print.P \
+.deps/packet-lpd.P .deps/packet-ncp.P .deps/packet-null.P \
+.deps/packet-osi.P .deps/packet-ospf.P .deps/packet-ppp.P \
+.deps/packet-raw.P .deps/packet-rip.P .deps/packet-tcp.P \
+.deps/packet-tr.P .deps/packet-trmac.P .deps/packet-udp.P \
+.deps/packet-vines.P .deps/packet.P .deps/prefs.P .deps/print.P \
.deps/ps.P .deps/resolv.P .deps/util.P
SOURCES = $(ethereal_SOURCES) $(EXTRA_ethereal_SOURCES)
OBJECTS = $(ethereal_OBJECTS)
-all: Makefile $(PROGRAMS) $(MANS) config.h
+all: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h
.SUFFIXES:
.SUFFIXES: .S .c .o .s
@@ -309,6 +326,25 @@ uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) uninstall-man1
+install-sysconfDATA: $(sysconf_DATA)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
+ @list='$(sysconf_DATA)'; for p in $$list; do \
+ if test -f $(srcdir)/$$p; then \
+ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p"; \
+ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p; \
+ else if test -f $$p; then \
+ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(sysconfdir)/$$p"; \
+ $(INSTALL_DATA) $$p $(DESTDIR)$(sysconfdir)/$$p; \
+ fi; fi; \
+ done
+
+uninstall-sysconfDATA:
+ @$(NORMAL_UNINSTALL)
+ list='$(sysconf_DATA)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(sysconfdir)/$$p; \
+ done
+
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
@@ -411,7 +447,7 @@ dvi:
check: all
$(MAKE)
installcheck:
-install-exec: install-binPROGRAMS
+install-exec: install-binPROGRAMS install-sysconfDATA
@$(NORMAL_INSTALL)
install-data: install-man
@@ -420,12 +456,13 @@ install-data: install-man
install: install-exec install-data all
@:
-uninstall: uninstall-binPROGRAMS uninstall-man
+uninstall: uninstall-binPROGRAMS uninstall-man uninstall-sysconfDATA
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
- $(mkinstalldirs) $(DATADIR)$(bindir) $(DESTDIR)$(mandir)/man1
+ $(mkinstalldirs) $(DATADIR)$(bindir) $(DESTDIR)$(mandir)/man1 \
+ $(DATADIR)$(sysconfdir)
mostlyclean-generic:
@@ -466,12 +503,13 @@ mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile install-man1 uninstall-man1 install-man \
-uninstall-man tags mostlyclean-tags distclean-tags clean-tags \
-maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
-clean-depend maintainer-clean-depend info dvi installcheck install-exec \
-install-data install uninstall all installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
+uninstall-man uninstall-sysconfDATA install-sysconfDATA tags \
+mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
+distdir mostlyclean-depend distclean-depend clean-depend \
+maintainer-clean-depend info dvi installcheck install-exec install-data \
+install uninstall all installdirs mostlyclean-generic distclean-generic \
+clean-generic maintainer-clean-generic clean mostlyclean distclean \
+maintainer-clean
ps.c: print.ps rdps
diff --git a/NEWS b/NEWS
index cd391cda3a..4d567509e1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Overview of changes in Ethereal 0.3.17:
+
+* Ethernet manufacturer support (Laurent)
+* Netware SAP support (Gilbert)
+* Misc Netware/token ring fixes and enhancements (Gilbert)
+* PPP fixes (Gerald)
+* Null/loopback interface support (Gerald)
+
Overview of changes in Ethereal 0.3.16:
* Support for ISO/OSI CLNP & COTP (Laurent)
diff --git a/README b/README
index 859859a6e7..3567d49869 100644
--- a/README
+++ b/README
@@ -56,6 +56,10 @@ Installation Checklist (Long):
The file 'INSTALL' contains general instructions for running
'configure'.
+ Ethereal installs a support file (manuf) in /usr/local/etc by
+ default. You can change this location with the --sysconfdir
+ option.
+
[ ] 4. Run 'make'. Hopefully, you won't run into any problems.
[ ] 5. Run './ethereal', and make sure things are working. You must
diff --git a/VERSION b/VERSION
index ec96a6218d..e5a9958c32 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.3.16
+0.3.17
diff --git a/acconfig.h b/acconfig.h
index 789385ab98..adcccec427 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -3,3 +3,5 @@
#undef VERSION
#undef HAVE_SOCKADDR_SA_LEN
+
+#undef DATAFILE_DIR
diff --git a/config.h.in b/config.h.in
index 67cd0c40ae..638c031dd3 100644
--- a/config.h.in
+++ b/config.h.in
@@ -10,6 +10,8 @@
#undef HAVE_SOCKADDR_SA_LEN
+#undef DATAFILE_DIR
+
/* Define if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
diff --git a/configure b/configure
index 8bd9a108eb..590d569fea 100755
--- a/configure
+++ b/configure
@@ -694,7 +694,7 @@ fi
PACKAGE=ethereal
-VERSION=0.3.16
+VERSION=0.3.17
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
{ echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
@@ -976,16 +976,30 @@ else
fi
+# Create DATAFILE_DIR #define for config.h
+DATAFILE_DIR=$sysconfdir
+DATAFILE_DIR=`(
+ test "x$prefix" = xNONE && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
+ eval echo "$DATAFILE_DIR"
+)`
+cat >> confdefs.h <<EOF
+#define DATAFILE_DIR "$DATAFILE_DIR"
+EOF
+
+
+
# If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
# link directory.
case "$host_os" in
solaris*)
- echo "$ac_t""You appear to be running Solaris. Checking for LD_LIBRARY_PATH..." 1>&6
- if test x$LD_LIBRARY_PATH != x -a ; then
+ echo $ac_n "checking for LD_LIBRARY_PATH""... $ac_c" 1>&6
+echo "configure:998: checking for LD_LIBRARY_PATH" >&5
+ if test x$LD_LIBRARY_PATH != x ; then
LIBS="$LIBS -R$LD_LIBRARY_PATH"
- echo "$ac_t""Added LD_LIBRARY_PATH to run-time linker path" 1>&6
+ echo "$ac_t""yes -- added LD_LIBRARY_PATH to run-time linker path" 1>&6
else
- echo "$ac_t""You don't have LD_LIBRARY_PATH defined. This may cause trouble later on." 1>&6
+ echo "$ac_t""no -- this may be a problem in a few seconds" 1>&6
fi
;;
esac
@@ -1032,7 +1046,7 @@ fi
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1036: checking for $ac_word" >&5
+echo "configure:1050: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1063,7 +1077,7 @@ fi
min_gtk_version=1.0.0
echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:1067: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:1081: checking for GTK - version >= $min_gtk_version" >&5
no_gtk=""
if test "$GTK_CONFIG" = "no" ; then
no_gtk=yes
@@ -1086,7 +1100,7 @@ echo "configure:1067: checking for GTK - version >= $min_gtk_version" >&5
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat > conftest.$ac_ext <<EOF
-#line 1090 "configure"
+#line 1104 "configure"
#include "confdefs.h"
#include <gtk/gtk.h>
@@ -1149,7 +1163,7 @@ main ()
}
EOF
-if { (eval echo configure:1153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1183,7 +1197,7 @@ fi
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1187 "configure"
+#line 1201 "configure"
#include "confdefs.h"
#include <gtk/gtk.h>
@@ -1193,7 +1207,7 @@ int main() {
return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version));
; return 0; }
EOF
-if { (eval echo configure:1197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GTK or finding the wrong"
@@ -1234,7 +1248,7 @@ rm -f conftest*
# Pcap checks
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1238: checking how to run the C preprocessor" >&5
+echo "configure:1252: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1249,13 +1263,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1253 "configure"
+#line 1267 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1259: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -1266,13 +1280,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1270 "configure"
+#line 1284 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1276: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1290: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -1296,17 +1310,17 @@ echo "$ac_t""$CPP" 1>&6
ac_safe=`echo "pcap.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for pcap.h""... $ac_c" 1>&6
-echo "configure:1300: checking for pcap.h" >&5
+echo "configure:1314: checking for pcap.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1305 "configure"
+#line 1319 "configure"
#include "confdefs.h"
#include <pcap.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1310: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1324: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1330,17 +1344,17 @@ fi
ac_safe=`echo "net/bpf.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for net/bpf.h""... $ac_c" 1>&6
-echo "configure:1334: checking for net/bpf.h" >&5
+echo "configure:1348: checking for net/bpf.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1339 "configure"
+#line 1353 "configure"
#include "confdefs.h"
#include <net/bpf.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1344: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1358: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1363,7 +1377,7 @@ else
fi
echo $ac_n "checking for pcap_open_offline in -lpcap""... $ac_c" 1>&6
-echo "configure:1367: checking for pcap_open_offline in -lpcap" >&5
+echo "configure:1381: checking for pcap_open_offline in -lpcap" >&5
ac_lib_var=`echo pcap'_'pcap_open_offline | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1371,7 +1385,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpcap $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1375 "configure"
+#line 1389 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1382,7 +1396,7 @@ int main() {
pcap_open_offline()
; return 0; }
EOF
-if { (eval echo configure:1386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1418,17 +1432,17 @@ for ac_hdr in sys/sockio.h sys/types.h netinet/in.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1422: checking for $ac_hdr" >&5
+echo "configure:1436: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1427 "configure"
+#line 1441 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1432: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1446: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1460,12 +1474,12 @@ done
# We need libpcap's AC_LBL_SOCKADDR_SA_LEN test for get_interface_list().
echo $ac_n "checking if sockaddr struct has sa_len member""... $ac_c" 1>&6
-echo "configure:1464: checking if sockaddr struct has sa_len member" >&5
+echo "configure:1478: checking if sockaddr struct has sa_len member" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_sockaddr_has_sa_len'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1469 "configure"
+#line 1483 "configure"
#include "confdefs.h"
# include <sys/types.h>
@@ -1474,7 +1488,7 @@ int main() {
u_int i = sizeof(((struct sockaddr *)0)->sa_len)
; return 0; }
EOF
-if { (eval echo configure:1478: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1492: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_lbl_sockaddr_has_sa_len=yes
else
@@ -1496,14 +1510,14 @@ EOF
# We must know our byte order
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:1500: checking whether byte ordering is bigendian" >&5
+echo "configure:1514: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
-#line 1507 "configure"
+#line 1521 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1514,11 +1528,11 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:1518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1532: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
-#line 1522 "configure"
+#line 1536 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1529,7 +1543,7 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:1533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1547: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@@ -1549,7 +1563,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1553 "configure"
+#line 1567 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@@ -1562,7 +1576,7 @@ main () {
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:1566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
@@ -1588,13 +1602,13 @@ fi
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:1592: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:1606: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 1598 "configure"
+#line 1612 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -1612,7 +1626,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 1616 "configure"
+#line 1630 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -1634,12 +1648,12 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
fi
echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:1638: checking for socket" >&5
+echo "configure:1652: checking for socket" >&5
if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1643 "configure"
+#line 1657 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char socket(); below. */
@@ -1662,7 +1676,7 @@ socket();
; return 0; }
EOF
-if { (eval echo configure:1666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_socket=yes"
else
@@ -1685,12 +1699,12 @@ fi
# If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
# then this won't work.
echo $ac_n "checking for snprintf""... $ac_c" 1>&6
-echo "configure:1689: checking for snprintf" >&5
+echo "configure:1703: checking for snprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_snprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1694 "configure"
+#line 1708 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char snprintf(); below. */
@@ -1713,7 +1727,7 @@ snprintf();
; return 0; }
EOF
-if { (eval echo configure:1717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_snprintf=yes"
else
@@ -1887,6 +1901,7 @@ s%@host_cpu@%$host_cpu%g
s%@host_vendor@%$host_vendor%g
s%@host_os@%$host_os%g
s%@CC@%$CC%g
+s%@DATAFILE_DIR@%$DATAFILE_DIR%g
s%@GTK_CONFIG@%$GTK_CONFIG%g
s%@GTK_CFLAGS@%$GTK_CFLAGS%g
s%@GTK_LIBS@%$GTK_LIBS%g
diff --git a/configure.in b/configure.in
index 8d8f4f5603..abe4aaded7 100644
--- a/configure.in
+++ b/configure.in
@@ -1,8 +1,8 @@
-# $Id: configure.in,v 1.4 1998/09/20 00:21:56 gerald Exp $
+# $Id: configure.in,v 1.5 1998/09/25 23:23:58 gerald Exp $
dnl Process this file with autoconf to produce a configure script.
AC_INIT(etypes.h)
-AM_INIT_AUTOMAKE(ethereal, 0.3.16)
+AM_INIT_AUTOMAKE(ethereal, 0.3.17)
dnl Check for CPU / vendor / OS
AC_CANONICAL_HOST
@@ -10,16 +10,26 @@ AC_CANONICAL_HOST
dnl Checks for programs.
AC_PROG_CC
+# Create DATAFILE_DIR #define for config.h
+DATAFILE_DIR=$sysconfdir
+DATAFILE_DIR=`(
+ test "x$prefix" = xNONE && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
+ eval echo "$DATAFILE_DIR"
+)`
+AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
+AC_SUBST(DATAFILE_DIR)
+
# If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
# link directory.
case "$host_os" in
solaris*)
- AC_MSG_RESULT(You appear to be running Solaris. Checking for LD_LIBRARY_PATH...)
- if test x$LD_LIBRARY_PATH != x -a ; then
+ AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
+ if test x$LD_LIBRARY_PATH != x ; then
LIBS="$LIBS -R$LD_LIBRARY_PATH"
- AC_MSG_RESULT(Added LD_LIBRARY_PATH to run-time linker path)
+ AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
else
- AC_MSG_RESULT(You don't have LD_LIBRARY_PATH defined. This may cause trouble later on.)
+ AC_MSG_RESULT(no -- this may be a problem in a few seconds)
fi
;;
esac
diff --git a/file.c b/file.c
index 84b946cbf8..77c8f5b23e 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.3 1998/09/17 03:12:24 gerald Exp $
+ * $Id: file.c,v 1.4 1998/09/25 23:23:59 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -84,7 +84,7 @@ open_cap_file(char *fname, capture_file *cf) {
cf->fh = NULL;
/* set the file name beacuse we need it to set the follow stream filter */
- cf->filename = strdup( fname );
+ cf->filename = g_strdup( fname );
/* Next, find out what type of file we're dealing with */
diff --git a/manuf b/manuf
new file mode 100644
index 0000000000..32bff8a484
--- /dev/null
+++ b/manuf
@@ -0,0 +1,185 @@
+#
+# /etc/manuf - Ethernet vendor codes
+#
+# $Id: manuf,v 1.1 1998/09/25 23:24:00 gerald Exp $
+#
+# Laurent Deniel <deniel@worldnet.fr>
+#
+# Ethereal - Network traffic analyzer
+# By Gerald Combs <gerald@zing.org>
+# Copyright 1998 Gerald Combs
+#
+# 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.
+#
+#
+# This is a subset of the list mantained by Michael Patton available from:
+# <http://www.cavebear.com/CaveBear/Ethernet/>
+# <ftp://ftp.cavebear.com/pub/Ethernet.txt>
+#
+# This file is in the same format as ethers(4) except that vendor names
+# are truncated to eight characters when used with Ethereal.
+#
+
+00:00:0c Cisco
+00:00:0e Fujitsu
+00:00:0f NeXT
+00:00:10 Hughes
+00:00:11 Tektrnix
+00:00:15 DataPnt # Datapoint Corporation
+00:00:18 Webster
+00:00:1a AMD
+00:00:1b Novell
+00:00:1d Ctron
+00:00:20 DIAB
+00:00:21 SC&C
+00:00:22 VislTech # Visual Technology
+00:00:24 Olicom
+00:00:2a TRW
+00:00:3c Auspex
+00:00:3d AT&T
+00:00:44 Castell
+00:00:46 ISC-BR
+00:00:48 Epson
+00:00:49 Apricot
+00:00:4b APT
+00:00:4c NEC
+00:00:55 AT&T
+00:00:62 Hneywell # Honeywell
+00:00:63 HP
+00:00:65 NetGenrl # Network General
+00:00:69 SGI
+00:00:6b MIPS
+00:00:7a Ardent
+00:00:7d Cray
+00:00:81 Synoptcs # Synoptics
+00:00:87 Hitachi
+00:00:89 Cayman
+00:00:93 Proteon
+00:00:94 Asante
+00:00:95 Sony
+00:00:97 Epoch
+00:00:a0 Sanyo
+00:00:a2 Wellflt # Wellfleet
+00:00:a3 NAT
+00:00:a4 Acorn
+00:00:a5 CSC
+00:00:a7 NCD
+00:00:a8 Stratus
+00:00:a9 NetSys # Network Systems
+00:00:aa Xerox
+00:00:ae Dassault
+00:00:b0 RND
+00:00:dd Gould
+00:00:de Unigraph
+00:00:e1 Hitachi
+00:00:ed April
+00:00:f0 Samsung
+00:00:f8 DEC
+00:01:fa Compaq
+00:02:04 Novell
+00:04:00 Lexmark
+00:04:ac IBM
+00:06:0d HP
+00:06:29 IBM
+00:06:7c Cisco
+00:06:c1 Cisco
+00:07:01 Cisco
+00:07:0d Cisco
+00:08:c7 Compaq
+00:10:11 Cisco
+00:10:1f Cisco
+00:10:2f Cisco
+00:10:4b 3Com
+00:10:79 Cisco
+00:10:f6 Cisco
+00:20:00 Lexmark
+00:20:35 IBM
+00:20:85 3Com
+00:20:af 3Com
+00:40:a6 Cray
+00:40:c8 Milan
+00:60:08 3Com
+00:60:09 Cisco
+00:60:2f Cisco
+00:60:3e Cisco
+00:60:47 Cisco
+00:60:5c Cisco
+00:60:70 Cisco
+00:60:83 Cisco
+00:60:8c 3Com
+00:60:97 3Com
+00:60:b0 HP
+00:80:0f SMC
+00:80:1c Cisco
+00:80:24 Kalpana
+00:80:45 Matshta
+00:80:5a Tulip
+00:80:5f Compaq
+00:80:90 Microtek
+00:80:96 HDS
+00:80:9f Alcatel
+00:a0:24 3Com
+00:aa:00 Intel
+00:c0:4f Dell
+00:e0:14 Cisco
+00:e0:1e Cisco
+00:e0:34 Cisco
+00:e0:4f Cisco
+00:e0:a3 Cisco
+00:e0:f7 Cisco
+00:e0:f9 Cisco
+00:e0:fe Cisco
+02:60:60 3Com
+02:60:8c 3Com
+02:cf:1f CMC
+08:00:02 3Com
+08:00:03 ACC
+08:00:07 Apple
+08:00:08 BBN
+08:00:09 HP
+08:00:0a Nestar
+08:00:0b Unisys
+08:00:0e NCR
+08:00:0f SMC
+08:00:11 Tektrnix # Tektronix
+08:00:1a DataGenl # Data General
+08:00:1b DataGenl
+08:00:1e Apollo
+08:00:1f Sharp
+08:00:20 Sun
+08:00:2b DEC
+08:00:38 Bull
+08:00:3e Motorola
+08:00:46 Sony
+08:00:47 Sequent
+08:00:5a IBM
+08:00:69 SGI
+08:00:74 Casio
+08:00:79 SGI
+08:00:87 Xyplex
+08:00:89 Kinetix
+08:00:8b Pyramid
+08:00:8e Tandem
+08:00:0f Chipcom
+08:00:90 Retix
+09:00:6a AT&T
+10:00:5a IBM
+10:00:90 HP
+10:00:d4 DEC
+3C:00:00 3Com
+44:45:53 Micrsoft
+aa:00:03 DEC
+aa:00:04 DEC
+
diff --git a/menu.c b/menu.c
index 9650b61801..147307cb52 100644
--- a/menu.c
+++ b/menu.c
@@ -1,7 +1,7 @@
/* menu.c
* Menu routines
*
- * $Id: menu.c,v 1.3 1998/09/17 03:12:27 gerald Exp $
+ * $Id: menu.c,v 1.4 1998/09/25 23:24:00 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -41,6 +41,7 @@
#include "packet.h"
#include "print.h"
#include "follow.h"
+#include "prefs.h"
/* Much of this was take from the GTK+ tuturial at http://www.gtk.org */
@@ -72,6 +73,8 @@ static GtkMenuEntry menu_items[] =
{"<Main>/Edit/Find", "<control>F", NULL, NULL},
{"<Main>/Edit/<separator>", NULL, NULL, NULL},
{"<Main>/Edit/Printer Options", NULL, printer_opts_cb, NULL},
+ {"<Main>/Edit/<separator>", NULL, NULL, NULL},
+ {"<Main>/Edit/Preferences", NULL, prefs_cb, NULL},
{"<Main>/Tools/Capture", "<control>K", capture_prep_cb, NULL},
{"<Main>/Tools/Filter", NULL, filter_sel_cb, NULL},
{"<Main>/Tools/Follow TCP Stream", NULL, follow_stream_cb, NULL},
@@ -118,6 +121,7 @@ menus_init(void) {
set_menu_sensitivity("<Main>/Edit/Copy", FALSE);
set_menu_sensitivity("<Main>/Edit/Paste", FALSE);
set_menu_sensitivity("<Main>/Edit/Find", FALSE);
+ set_menu_sensitivity("<Main>/Edit/Preferences", FALSE);
set_menu_sensitivity("<Main>/Tools/Graph", FALSE);
set_menu_sensitivity("<Main>/Help/About Ethereal", FALSE);
if ((mp = gtk_menu_factory_find(factory, "<Main>/Help")) != NULL) {
diff --git a/packet-eth.c b/packet-eth.c
index 4df3e3aef5..a856e13d61 100644
--- a/packet-eth.c
+++ b/packet-eth.c
@@ -1,7 +1,7 @@
/* packet-eth.c
* Routines for ethernet packet disassembly
*
- * $Id: packet-eth.c,v 1.2 1998/09/16 03:22:04 gerald Exp $
+ * $Id: packet-eth.c,v 1.3 1998/09/25 23:24:01 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -36,6 +36,7 @@
#include "packet.h"
#include "ethereal.h"
#include "etypes.h"
+#include "resolv.h"
/* These are the Netware-ish names for the different Ethernet frame types.
EthernetII: The ethernet with a Type field instead of a length field
@@ -59,8 +60,8 @@ dissect_eth(const u_char *pd, frame_data *fd, GtkTree *tree) {
int ethhdr_type; /* the type of ethernet frame */
if (fd->win_info[0]) {
- strcpy(fd->win_info[2], ether_to_str((guint8 *)&pd[0]));
- strcpy(fd->win_info[1], ether_to_str((guint8 *)&pd[6]));
+ strcpy(fd->win_info[2], get_ether_name((u_char *)&pd[0]));
+ strcpy(fd->win_info[1], get_ether_name((u_char *)&pd[6]));
strcpy(fd->win_info[4], "Ethernet II");
}
@@ -92,10 +93,12 @@ dissect_eth(const u_char *pd, frame_data *fd, GtkTree *tree) {
fh_tree = gtk_tree_new();
add_subtree(ti, fh_tree, ETT_IEEE8023);
- add_item_to_tree(fh_tree, 0, 6, "Destination: %s",
- ether_to_str((guint8 *) &pd[0]));
- add_item_to_tree(fh_tree, 6, 6, "Source: %s",
- ether_to_str((guint8 *) &pd[6]));
+ add_item_to_tree(fh_tree, 0, 6, "Destination: %s (%s)",
+ ether_to_str((guint8 *) &pd[0]),
+ get_ether_name((u_char *) &pd[0]));
+ add_item_to_tree(fh_tree, 6, 6, "Source: %s (%s)",
+ ether_to_str((guint8 *) &pd[6]),
+ get_ether_name((u_char *)&pd[6]));
add_item_to_tree(fh_tree, 12, 2, "Length: %d", length);
}
@@ -105,10 +108,12 @@ dissect_eth(const u_char *pd, frame_data *fd, GtkTree *tree) {
"Ethernet II (%d on wire, %d captured)", fd->pkt_len, fd->cap_len);
fh_tree = gtk_tree_new();
add_subtree(ti, fh_tree, ETT_ETHER2);
- add_item_to_tree(fh_tree, 0, 6, "Destination: %s",
- ether_to_str((guint8 *) &pd[0]));
- add_item_to_tree(fh_tree, 6, 6, "Source: %s",
- ether_to_str((guint8 *) &pd[6]));
+ add_item_to_tree(fh_tree, 0, 6, "Destination: %s (%s)",
+ ether_to_str((guint8 *) &pd[0]),
+ get_ether_name((u_char *)&pd[0]));
+ add_item_to_tree(fh_tree, 6, 6, "Source: %s (%s)",
+ ether_to_str((guint8 *) &pd[6]),
+ get_ether_name((u_char *)&pd[6]));
}
/* either ethernet802.3 or ethernet802.2 */
diff --git a/packet-null.c b/packet-null.c
new file mode 100644
index 0000000000..95ae464cf6
--- /dev/null
+++ b/packet-null.c
@@ -0,0 +1,97 @@
+/* packet-null.c
+ * Routines for null packet disassembly
+ *
+ * $Id: packet-null.c,v 1.1 1998/09/25 23:24:02 gerald Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@zing.org>
+ *
+ * This file created and by Mike Hall <mlh@io.com>
+ * Copyright 1998
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <sys/socket.h>
+#include <pcap.h>
+
+#include "packet.h"
+#include "ethereal.h"
+
+void
+dissect_null( const u_char *pd, frame_data *fd, GtkTree *tree ) {
+ e_nullhdr nh;
+ GtkWidget *ti, *fh_tree;
+
+ nh.null_next = pd[0];
+ nh.null_len = pd[1];
+ memcpy((char *)&nh.null_family, (char *)&pd[2], sizeof(nh.null_family));
+
+ /* load the top pane info. This should be overwritten by
+ the next protocol in the stack */
+ if(fd->win_info[0]) {
+ strcpy(fd->win_info[1], "N/A" );
+ strcpy(fd->win_info[2], "N/A" );
+ strcpy(fd->win_info[3], "N/A" );
+ strcpy(fd->win_info[4], "Null/Loopback" );
+ }
+
+ /* populate a tree in the second pane with the status of the link
+ layer (ie none) */
+ if(tree) {
+ ti = add_item_to_tree( GTK_WIDGET(tree), 0, 4,
+ "Null/Loopback (%d on link, %d captured)", fd->pkt_len,
+ fd->cap_len );
+ fh_tree = gtk_tree_new();
+ add_subtree(ti, fh_tree, ETT_NULL);
+ add_item_to_tree(fh_tree, 0, 1, "Next: %02x", nh.null_next);
+ add_item_to_tree(fh_tree, 1, 1, "Length: %02x", nh.null_len);
+ add_item_to_tree(fh_tree, 2, 2, "Family: %04x", nh.null_family);
+ }
+
+ /*
+ From what I've read in various sources, this is supposed to be an
+ address family, e.g. AF_INET. However, a FreeBSD ISDN PPP dump that
+ Andreas Klemm sent to ethereal-dev has a packet type of DLT_NULL, and
+ the family bits look like PPP's protocol field. A dump of the loopback
+ interface on my Linux box also has a link type of DLT_NULL (as it should
+ be), but the family bits look like ethernet's protocol type. To
+ further confuse matters, nobody seems to be paying attention to byte
+ order.
+ - gcc
+ */
+
+ switch (nh.null_family) {
+ case 0x0008:
+ case 0x0800:
+ case 0x0021:
+ case 0x2100:
+ dissect_ip(pd, 4, fd, tree);
+ break;
+ default:
+ dissect_data(pd, 4, fd, tree);
+ break;
+ }
+}
diff --git a/packet-ppp.c b/packet-ppp.c
index 45ee59c315..c0dc47f9b3 100644
--- a/packet-ppp.c
+++ b/packet-ppp.c
@@ -1,7 +1,7 @@
/* packet-ppp.c
* Routines for ppp packet disassembly
*
- * $Id: packet-ppp.c,v 1.2 1998/09/16 03:22:09 gerald Exp $
+ * $Id: packet-ppp.c,v 1.3 1998/09/25 23:24:02 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -40,42 +40,38 @@ dissect_ppp( const u_char *pd, frame_data *fd, GtkTree *tree ) {
e_ppphdr ph;
GtkWidget *ti, *fh_tree;
- guchar flag, addr, control;
- guint protocol;
-
- ph.ppp_flag = pd[0];
- ph.ppp_addr = pd[1];
- ph.ppp_ctl = pd[2];
- ph.ppp_prot = pntohs(&pd[3]);
+ ph.ppp_addr = pd[0];
+ ph.ppp_ctl = pd[1];
+ ph.ppp_prot = pntohs(&pd[2]);
/* load the top pane info. This should be overwritten by
the next protocol in the stack */
if(fd->win_info[0]) {
strcpy(fd->win_info[1], "N/A" );
strcpy(fd->win_info[2], "N/A" );
+ strcpy(fd->win_info[3], "N/A" );
strcpy(fd->win_info[4], "PPP" );
}
/* populate a tree in the second pane with the status of the link
layer (ie none) */
if(tree) {
- ti = add_item_to_tree( GTK_WIDGET(tree), 0, 5,
+ ti = add_item_to_tree( GTK_WIDGET(tree), 0, 4,
"Point-to-Point Protocol (%d on link, %d captured)", fd->pkt_len,
fd->cap_len );
fh_tree = gtk_tree_new();
add_subtree(ti, fh_tree, ETT_PPP);
- add_item_to_tree(fh_tree, 0, 1, "Flag: %02x", ph.ppp_flag);
- add_item_to_tree(fh_tree, 1, 1, "Address: %02x", ph.ppp_addr);
- add_item_to_tree(fh_tree, 2, 1, "Control: %02x", ph.ppp_ctl);
- add_item_to_tree(fh_tree, 3, 2, "Protocol: %04x", ph.ppp_prot);
+ add_item_to_tree(fh_tree, 0, 1, "Address: %02x", ph.ppp_addr);
+ add_item_to_tree(fh_tree, 1, 1, "Control: %02x", ph.ppp_ctl);
+ add_item_to_tree(fh_tree, 2, 2, "Protocol: %04x", ph.ppp_prot);
}
switch (ph.ppp_prot) {
case 0x0021:
- dissect_ip(pd, 5, fd, tree);
+ dissect_ip(pd, 4, fd, tree);
break;
default:
- dissect_data(pd, 5, fd, tree);
+ dissect_data(pd, 4, fd, tree);
break;
}
}
diff --git a/packet.c b/packet.c
index 9dd502fd36..3f0f63e2be 100644
--- a/packet.c
+++ b/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.2 1998/09/16 03:22:13 gerald Exp $
+ * $Id: packet.c,v 1.3 1998/09/25 23:24:03 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -211,6 +211,12 @@ dissect_packet(const u_char *pd, frame_data *fd, GtkTree *tree) {
case DLT_IEEE802 :
dissect_tr(pd, fd, tree);
break;
+ case DLT_NULL :
+ dissect_null(pd, fd, tree);
+ break;
+ case DLT_PPP :
+ dissect_ppp(pd, fd, tree);
+ break;
case DLT_RAW :
dissect_raw(pd, fd, tree);
break;
diff --git a/packet.h b/packet.h
index 3a9b5d7355..48f95e4b77 100644
--- a/packet.h
+++ b/packet.h
@@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.8 1998/09/24 04:22:08 gram Exp $
+ * $Id: packet.h,v 1.9 1998/09/25 23:24:04 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -208,10 +208,17 @@ typedef struct _e_ip {
#define IP_PROTO_UDP 17
#define IP_PROTO_OSPF 89
+/* Null/loopback structs and definitions */
+
+typedef struct _e_nullhdr {
+ guint8 null_next;
+ guint8 null_len;
+ guint16 null_family;
+} e_nullhdr;
+
/* PPP structs and definitions */
typedef struct _e_ppphdr {
- guint8 ppp_flag;
guint8 ppp_addr;
guint8 ppp_ctl;
guint16 ppp_prot;
@@ -254,10 +261,10 @@ typedef struct _e_udphdr {
/* UDP Ports -> should go in packet-udp.h */
-#define UDP_PORT_DNS 53
-#define UDP_PORT_BOOTPS 67
-#define UDP_PORT_IPX 213
-#define UDP_PORT_RIP 520
+#define UDP_PORT_DNS 53
+#define UDP_PORT_BOOTPS 67
+#define UDP_PORT_IPX 213
+#define UDP_PORT_RIP 520
/* TCP Ports */
@@ -266,50 +273,51 @@ typedef struct _e_udphdr {
/* Tree types. Each dissect_* routine should have one for each
add_subtree() call. */
-#define ETT_IEEE8023 0
-#define ETT_ETHER2 1
-#define ETT_LLC 2
-#define ETT_TOKEN_RING 3
-#define ETT_TR_IERR_CNT 4
-#define ETT_TR_NERR_CNT 5
-#define ETT_TR_MAC 6
-#define ETT_PPP 7
-#define ETT_ARP 8
-#define ETT_IP 9
-#define ETT_UDP 10
-#define ETT_TCP 11
-#define ETT_ICMP 12
-#define ETT_IGMP 13
-#define ETT_IPX 14
-#define ETT_SPX 15
-#define ETT_NCP 16
-#define ETT_DNS 17
-#define ETT_DNS_ANS 18
-#define ETT_DNS_QRY 19
-#define ETT_RIP 20
-#define ETT_RIP_VEC 21
-#define ETT_OSPF 22
-#define ETT_OSPF_HDR 23
-#define ETT_OSPF_HELLO 24
-#define ETT_OSPF_DESC 25
-#define ETT_OSPF_LSR 26
-#define ETT_OSPF_LSA_UPD 27
-#define ETT_OSPF_LSA 28
-#define ETT_LPD 29
-#define ETT_RAW 30
-#define ETT_BOOTP 31
-#define ETT_BOOTP_OPTION 32
-#define ETT_IPv6 33
-#define ETT_CLNP 34
-#define ETT_COTP 35
-#define ETT_VINES 36
-#define ETT_VSPP 37
-#define ETT_IPXRIP 38
-#define ETT_IPXSAP 39
+#define ETT_IEEE8023 0
+#define ETT_ETHER2 1
+#define ETT_LLC 2
+#define ETT_TOKEN_RING 3
+#define ETT_TR_IERR_CNT 4
+#define ETT_TR_NERR_CNT 5
+#define ETT_TR_MAC 6
+#define ETT_PPP 7
+#define ETT_ARP 8
+#define ETT_IP 9
+#define ETT_UDP 10
+#define ETT_TCP 11
+#define ETT_ICMP 12
+#define ETT_IGMP 13
+#define ETT_IPX 14
+#define ETT_SPX 15
+#define ETT_NCP 16
+#define ETT_DNS 17
+#define ETT_DNS_ANS 18
+#define ETT_DNS_QRY 19
+#define ETT_RIP 20
+#define ETT_RIP_VEC 21
+#define ETT_OSPF 22
+#define ETT_OSPF_HDR 23
+#define ETT_OSPF_HELLO 24
+#define ETT_OSPF_DESC 25
+#define ETT_OSPF_LSR 26
+#define ETT_OSPF_LSA_UPD 27
+#define ETT_OSPF_LSA 28
+#define ETT_LPD 29
+#define ETT_RAW 30
+#define ETT_BOOTP 31
+#define ETT_BOOTP_OPTION 32
+#define ETT_IPv6 33
+#define ETT_CLNP 34
+#define ETT_COTP 35
+#define ETT_VINES 36
+#define ETT_VSPP 37
+#define ETT_IPXRIP 38
+#define ETT_IPXSAP 39
#define ETT_IPXSAP_SERVER 40
+#define ETT_NULL 41
/* Should be the last item number plus one */
-#define NUM_TREE_TYPES 41
+#define NUM_TREE_TYPES 42
/* The version of pcap.h that comes with some systems is missing these
* #defines.
diff --git a/prefs.c b/prefs.c
new file mode 100644
index 0000000000..6f44579a6e
--- /dev/null
+++ b/prefs.c
@@ -0,0 +1,109 @@
+/* prefs.c
+ * Routines for handling preferences
+ *
+ * $Id: prefs.c,v 1.1 1998/09/25 23:24:04 gerald Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@zing.org>
+ * Copyright 1998 Gerald Combs
+ *
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include <gtk/gtk.h>
+
+#include <packet.h>
+#include <file.h>
+#include <prefs.h>
+
+extern capture_file cf;
+
+void
+prefs_cb() {
+ GtkWidget *prefs_w, *main_vb, *top_hb, *bbox, *prefs_nb,
+ *ok_bt, *cancel_bt;
+ GtkWidget *checkbutton, *label;
+
+ prefs_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title(GTK_WINDOW(prefs_w), "Ethereal: Preferences");
+
+ /* Container for each row of widgets */
+ main_vb = gtk_vbox_new(FALSE, 3);
+/* gtk_container_border_width(GTK_CONTAINER(main_vb), 5); */
+ gtk_container_add(GTK_CONTAINER(prefs_w), main_vb);
+ gtk_widget_show(main_vb);
+
+ /* Top row: Preferences notebook */
+ top_hb = gtk_hbox_new(FALSE, 1);
+ gtk_container_add(GTK_CONTAINER(main_vb), top_hb);
+ gtk_widget_show(top_hb);
+
+ prefs_nb = gtk_notebook_new();
+ gtk_container_add(GTK_CONTAINER(main_vb), prefs_nb);
+ gtk_widget_show(prefs_nb);
+
+ checkbutton = gtk_check_button_new_with_label ("Check me please!");
+ gtk_widget_show (checkbutton);
+
+ label = gtk_label_new ("Add spot");
+ gtk_container_add (GTK_CONTAINER (checkbutton), label);
+ gtk_widget_show (label);
+ label = gtk_label_new ("General");
+ gtk_notebook_append_page (GTK_NOTEBOOK(prefs_nb), checkbutton, label);
+
+ /* Button row: OK and cancel buttons */
+ bbox = gtk_hbutton_box_new();
+ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
+ gtk_container_add(GTK_CONTAINER(main_vb), bbox);
+ gtk_widget_show(bbox);
+
+ ok_bt = gtk_button_new_with_label ("OK");
+ gtk_signal_connect_object(GTK_OBJECT(ok_bt), "clicked",
+ GTK_SIGNAL_FUNC(prefs_main_ok_cb), GTK_OBJECT(prefs_w));
+ gtk_container_add(GTK_CONTAINER(bbox), ok_bt);
+ GTK_WIDGET_SET_FLAGS(ok_bt, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default(ok_bt);
+ gtk_widget_show(ok_bt);
+
+ cancel_bt = gtk_button_new_with_label ("Cancel");
+ gtk_signal_connect_object(GTK_OBJECT(cancel_bt), "clicked",
+ GTK_SIGNAL_FUNC(prefs_main_cancel_cb), GTK_OBJECT(prefs_w));
+ gtk_container_add(GTK_CONTAINER(bbox), cancel_bt);
+ gtk_widget_show(cancel_bt);
+
+ gtk_widget_show(prefs_w);
+}
+
+void
+prefs_main_ok_cb(GtkWidget *w, gpointer win) {
+
+ gtk_widget_destroy(GTK_WIDGET(win));
+}
+
+void
+prefs_main_cancel_cb(GtkWidget *w, gpointer win) {
+
+ gtk_widget_destroy(GTK_WIDGET(win));
+}
+
diff --git a/prefs.h b/prefs.h
new file mode 100644
index 0000000000..fe1597a373
--- /dev/null
+++ b/prefs.h
@@ -0,0 +1,33 @@
+/* prefs.h
+ * Definitions for preference handling routines
+ *
+ * $Id: prefs.h,v 1.1 1998/09/25 23:24:05 gerald Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@zing.org>
+ * Copyright 1998 Gerald Combs
+ *
+ *
+ * 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.
+ */
+
+#ifndef __PREFS_H__
+#define __PREFS_H__
+
+void prefs_cb();
+void prefs_main_ok_cb(GtkWidget *, gpointer);
+void prefs_main_cancel_cb(GtkWidget *, gpointer);
+
+#endif /* prefs.h */
diff --git a/resolv.c b/resolv.c
index e669a862ed..f00f843be4 100644
--- a/resolv.c
+++ b/resolv.c
@@ -1,7 +1,7 @@
/* resolv.c
* Routines for network object lookup
*
- * $Id: resolv.c,v 1.2 1998/09/16 03:22:18 gerald Exp $
+ * $Id: resolv.c,v 1.3 1998/09/25 23:24:06 gerald Exp $
*
* Laurent Deniel <deniel@worldnet.fr>
*
@@ -23,14 +23,6 @@
* 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.
- *
- *
- * To do:
- *
- * - Add ethernet address resolution
- * - In a future live capture and decode mode,
- * add hostname entries in hash table from DNS packet decoding.
- *
*/
#ifdef HAVE_CONFIG_H
@@ -65,8 +57,13 @@
#include "packet.h"
#include "resolv.h"
+#ifndef MAXNAMELEN
#define MAXNAMELEN 64 /* max name length (hostname and port name) */
+#endif
+#define MAXMANUFLEN 9 /* max vendor name length with ending '\0' */
+#define HASHETHSIZE 1024
#define HASHHOSTSIZE 1024
+#define HASHMANUFSIZE 256
#define HASHPORTSIZE 256
/* hash table used for host and port lookup */
@@ -77,15 +74,50 @@ typedef struct hashname {
struct hashname *next;
} hashname_t;
-static hashname_t *host_table[HASHHOSTSIZE];
-static hashname_t *udp_port_table[HASHPORTSIZE];
-static hashname_t *tcp_port_table[HASHPORTSIZE];
+/* hash tables used for ethernet and manufacturer lookup */
+
+typedef struct hashmanuf {
+ u_char addr[3];
+ char name[MAXMANUFLEN];
+ struct hashmanuf *next;
+} hashmanuf_t;
+
+typedef struct hashether {
+ u_char addr[6];
+ char name[MAXNAMELEN];
+ struct hashether *next;
+} hashether_t;
+
+/* internal ethernet type */
-/* global variable that indicates if name resolving is actif */
+typedef struct _ether
+{
+ u_char addr[6];
+ char name[MAXNAMELEN];
+} ether_t;
+
+static hashname_t *host_table[HASHHOSTSIZE];
+static hashname_t *udp_port_table[HASHPORTSIZE];
+static hashname_t *tcp_port_table[HASHPORTSIZE];
+static hashether_t *eth_table[HASHETHSIZE];
+static hashmanuf_t *manuf_table[HASHMANUFSIZE];
+
+static int eth_resolution_initialized = 0;
+
+/*
+ * Global variables (can be changed in GUI sections)
+ */
+
+int g_resolving_actif = 1; /* routines are active by default */
-int g_resolving_actif = 1; /* routines are active by default */
+gchar *g_ethers_path = EPATH_ETHERS;
+gchar *g_pethers_path = NULL; /* "$HOME"/EPATH_PERSONAL_ETHERS */
+gchar *g_manuf_path = EPATH_MANUF; /* may only be changed before the */
+ /* first resolving call */
-/* local function definitions */
+/*
+ * Local function definitions
+ */
static u_char *serv_name_lookup(u_int port, u_int proto)
{
@@ -141,6 +173,7 @@ static u_char *serv_name_lookup(u_int port, u_int proto)
sprintf(tp->name, "%d", port);
} else {
strncpy(tp->name, servp->s_name, MAXNAMELEN);
+ tp->name[MAXNAMELEN-1] = '\0';
}
return (tp->name);
@@ -190,9 +223,9 @@ static u_char *host_name_lookup(u_int addr)
tp->next = NULL;
#ifdef AVOID_DNS_TIMEOUT
-
+
/* Quick hack to avoid DNS/YP timeout */
-
+
if (!setjmp(hostname_env)) {
signal(SIGALRM, abort_network_query);
alarm(DNS_TIMEOUT);
@@ -203,6 +236,7 @@ static u_char *host_name_lookup(u_int addr)
#endif
if (hostp != NULL) {
strncpy(tp->name, hostp->h_name, MAXNAMELEN);
+ tp->name[MAXNAMELEN-1] = '\0';
return tp->name;
}
#ifdef AVOID_DNS_TIMEOUT
@@ -212,11 +246,412 @@ static u_char *host_name_lookup(u_int addr)
/* unknown host or DNS timeout */
sprintf(tp->name, "%s", ip_to_str((guint8 *)&addr));
+
return (tp->name);
} /* host_name_lookup */
-/* external functions */
+/*
+ * Miscellaneous functions
+ */
+
+static int fgetline(char **buf, int *size, FILE *fp)
+{
+ int len;
+ int c;
+
+ if (fp == NULL)
+ return -1;
+
+ if (*buf == NULL) {
+ if (*size == 0)
+ *size = BUFSIZ;
+
+ if ((*buf = g_malloc(*size)) == NULL)
+ return -1;
+ }
+
+ if (feof(fp))
+ return -1;
+
+ len = 0;
+ while ((c = getc(fp)) != EOF && c != '\n') {
+ if (len+1 >= *size) {
+ if ((*buf = g_realloc(*buf, *size += BUFSIZ)) == NULL)
+ return -1;
+ }
+ (*buf)[len++] = c;
+ }
+
+ if (len == 0 && c == EOF)
+ return -1;
+
+ (*buf)[len] = '\0';
+
+ return len;
+
+} /* fgetline */
+
+
+/*
+ * Ethernet / manufacturer resolution
+ *
+ * The following functions implement ethernet address resolution and
+ * ethers files parsing (see ethers(4)).
+ *
+ * /etc/manuf has the same format as ethers(4) except that names are
+ * truncated to MAXMANUFLEN-1 characters and that an address contains
+ * only 3 bytes (instead of 6).
+ *
+ * Notes:
+ *
+ * I decide to not use the existing functions (see ethers(3) on some
+ * operating systems) for the following reasons:
+ * - performance gains (use of hash tables and some other enhancements),
+ * - use of two ethers files (system-wide and per user),
+ * - avoid the use of NIS maps,
+ * - lack of these functions on some systems.
+ *
+ * So the following functions do _not_ behave as the standard ones.
+ *
+ * -- Laurent.
+ */
+
+
+static int parse_ether_line(char *line, ether_t *eth, int six_bytes)
+{
+ /*
+ * See man ethers(4) for /etc/ethers file format
+ * (not available on all systems).
+ * We allow both ethernet address separators (':' and '-').
+ */
+
+ gchar *cp;
+ int a0, a1, a2, a3, a4, a5;
+
+ if ((cp = strchr(line, '#')))
+ *cp = '\0';
+
+ if ((cp = strtok(line, " \t\n")) == NULL)
+ return -1;
+
+ if (six_bytes) {
+ if (sscanf(cp, "%x:%x:%x:%x:%x:%x", &a0, &a1, &a2, &a3, &a4, &a5) != 6) {
+ if (sscanf(cp, "%x-%x-%x-%x-%x-%x", &a0, &a1, &a2, &a3, &a4, &a5) != 6)
+ return -1;
+ }
+ } else {
+ if (sscanf(cp, "%x:%x:%x", &a0, &a1, &a2) != 3) {
+ if (sscanf(cp, "%x-%x-%x", &a0, &a1, &a2) != 3)
+ return -1;
+ }
+ }
+
+ if ((cp = strtok(NULL, " \t\n")) == NULL)
+ return -1;
+
+ eth->addr[0] = a0;
+ eth->addr[1] = a1;
+ eth->addr[2] = a2;
+ if (six_bytes) {
+ eth->addr[3] = a3;
+ eth->addr[4] = a4;
+ eth->addr[5] = a5;
+ } else {
+ eth->addr[3] = 0;
+ eth->addr[4] = 0;
+ eth->addr[5] = 0;
+ }
+
+ strncpy(eth->name, cp, MAXNAMELEN);
+ eth->name[MAXNAMELEN-1] = '\0';
+
+ return 0;
+
+} /* parse_ether_line */
+
+static FILE *eth_p = NULL;
+
+static void set_ethent(char *path)
+{
+ if (eth_p)
+ rewind(eth_p);
+ else
+ eth_p = fopen(path, "r");
+}
+
+static void end_ethent(void)
+{
+ if (eth_p) {
+ fclose(eth_p);
+ eth_p = NULL;
+ }
+}
+
+static ether_t *get_ethent(int six_bytes)
+{
+
+ static ether_t eth;
+ static int size = 0;
+ static char *buf = NULL;
+
+ if (eth_p == NULL)
+ return NULL;
+
+ while (fgetline(&buf, &size, eth_p) >= 0) {
+ if (parse_ether_line(buf, &eth, six_bytes) == 0) {
+ return &eth;
+ }
+ }
+
+ return NULL;
+
+} /* get_ethent */
+
+static ether_t *get_ethbyname(u_char *name)
+{
+ ether_t *eth;
+
+ set_ethent(g_ethers_path);
+
+ while ((eth = get_ethent(1)) && strncmp(name, eth->name, MAXNAMELEN) != 0)
+ ;
+
+ if (eth == NULL) {
+ end_ethent();
+
+ set_ethent(g_pethers_path);
+
+ while ((eth = get_ethent(1)) && strncmp(name, eth->name, MAXNAMELEN) != 0)
+ ;
+
+ end_ethent();
+ }
+
+ return eth;
+
+} /* get_ethbyname */
+
+static ether_t *get_ethbyaddr(u_char *addr)
+{
+
+ ether_t *eth;
+
+ set_ethent(g_ethers_path);
+
+ while ((eth = get_ethent(1)) && memcmp(addr, eth->addr, 6) != 0)
+ ;
+
+ if (eth == NULL) {
+ end_ethent();
+
+ set_ethent(g_pethers_path);
+
+ while ((eth = get_ethent(1)) && memcmp(addr, eth->addr, 6) != 0)
+ ;
+
+ end_ethent();
+ }
+
+ return eth;
+
+} /* get_ethbyaddr */
+
+static void add_manuf_name(u_char *addr, u_char *name)
+{
+
+ hashmanuf_t *tp;
+ hashmanuf_t **table = manuf_table;
+
+ tp = table[ ((int)addr[2]) & (HASHMANUFSIZE - 1)];
+
+ if( tp == NULL ) {
+ tp = table[ ((int)addr[2]) & (HASHMANUFSIZE - 1)] =
+ (hashmanuf_t *)g_malloc(sizeof(hashmanuf_t));
+ } else {
+ while(1) {
+ if (tp->next == NULL) {
+ tp->next = (hashmanuf_t *)g_malloc(sizeof(hashmanuf_t));
+ tp = tp->next;
+ break;
+ }
+ tp = tp->next;
+ }
+ }
+
+ memcpy(tp->addr, addr, sizeof(tp->addr));
+ strncpy(tp->name, name, MAXMANUFLEN);
+ tp->name[MAXMANUFLEN-1] = '\0';
+ tp->next = NULL;
+
+} /* add_manuf_name */
+
+static hashmanuf_t *manuf_name_lookup(u_char *addr)
+{
+
+ hashmanuf_t *tp;
+ hashmanuf_t **table = manuf_table;
+
+ tp = table[ ((int)addr[2]) & (HASHMANUFSIZE - 1)];
+
+ while(tp != NULL) {
+ if (memcmp(tp->addr, addr, sizeof(tp->addr)) == 0) {
+ return tp;
+ }
+ tp = tp->next;
+ }
+
+ return NULL;
+
+} /* manuf_name_lookup */
+
+static hashether_t *add_eth_name(u_char *addr, u_char *name)
+{
+ hashether_t *tp;
+ hashether_t **table = eth_table;
+ int i,j;
+
+ j = (addr[2] << 8) | addr[3];
+ i = (addr[4] << 8) | addr[5];
+
+ tp = table[ (i ^ j) & (HASHETHSIZE - 1)];
+
+ if( tp == NULL ) {
+ tp = table[ (i ^ j) & (HASHETHSIZE - 1)] =
+ (hashether_t *)g_malloc(sizeof(hashether_t));
+ } else {
+ while(1) {
+ if (tp->next == NULL) {
+ tp->next = (hashether_t *)g_malloc(sizeof(hashether_t));
+ tp = tp->next;
+ break;
+ }
+ tp = tp->next;
+ }
+ }
+
+ memcpy(tp->addr, addr, sizeof(tp->addr));
+ strncpy(tp->name, name, MAXNAMELEN);
+ tp->name[MAXNAMELEN-1] = '\0';
+ tp->next = NULL;
+
+ return tp;
+
+} /* add_eth_name */
+
+static u_char *eth_name_lookup(u_char *addr)
+{
+ hashmanuf_t *manufp;
+ hashether_t *tp;
+ hashether_t **table = eth_table;
+ ether_t *eth;
+ int i,j;
+
+ j = (addr[2] << 8) | addr[3];
+ i = (addr[4] << 8) | addr[5];
+
+ tp = table[ (i ^ j) & (HASHETHSIZE - 1)];
+
+ if( tp == NULL ) {
+ tp = table[ (i ^ j) & (HASHETHSIZE - 1)] =
+ (hashether_t *)g_malloc(sizeof(hashether_t));
+ } else {
+ while(1) {
+ if (memcmp(tp->addr, addr, sizeof(tp->addr)) == 0) {
+ return tp->name;
+ }
+ if (tp->next == NULL) {
+ tp->next = (hashether_t *)g_malloc(sizeof(hashether_t));
+ tp = tp->next;
+ break;
+ }
+ tp = tp->next;
+ }
+ }
+
+ /* fill in a new entry */
+
+ memcpy(tp->addr, addr, sizeof(tp->addr));
+ tp->next = NULL;
+
+ if ( (eth = get_ethbyaddr(addr)) == NULL) {
+ /* unknown name */
+
+ if ((manufp = manuf_name_lookup(addr)) == NULL)
+ sprintf(tp->name, "%s", ether_to_str((guint8 *)addr));
+ else
+ sprintf(tp->name, "%s_%02x:%02x:%02x",
+ manufp->name, addr[3], addr[4], addr[5]);
+
+ } else {
+ strncpy(tp->name, eth->name, MAXNAMELEN);
+ tp->name[MAXNAMELEN-1] = '\0';
+ }
+
+ return (tp->name);
+
+} /* eth_name_lookup */
+
+static u_char *eth_addr_lookup(u_char *name)
+{
+ ether_t *eth;
+ hashether_t *tp;
+ hashether_t **table = eth_table;
+ int i;
+
+ /* to be optimized (hash table from name to addr) */
+ for (i = 0; i < HASHETHSIZE; i++) {
+ tp = table[i];
+ while (tp) {
+ if (strcmp(tp->name, name) == 0)
+ return tp->addr;
+ tp = tp->next;
+ }
+ }
+
+ /* not in hash table : performs a file lookup */
+
+ if ((eth = get_ethbyname(name)) == NULL)
+ return NULL;
+
+ /* add new entry in hash table */
+
+ tp = add_eth_name(eth->addr, name);
+
+ return tp->addr;
+
+} /* eth_addr_lookup */
+
+static void initialize_ethers(void)
+{
+ ether_t *eth;
+
+#ifdef DEBUG_RESOLV
+ signal(SIGSEGV, SIG_IGN);
+#endif
+
+ if (g_pethers_path == NULL) {
+ g_pethers_path = g_malloc(strlen(getenv("HOME")) +
+ strlen(EPATH_PERSONAL_ETHERS) + 2);
+ sprintf(g_pethers_path, "%s/%s",
+ (char *)getenv("HOME"), EPATH_PERSONAL_ETHERS);
+ }
+
+ /* manuf hash table initialization */
+
+ set_ethent(g_manuf_path);
+
+ while ((eth = get_ethent(0))) {
+ add_manuf_name(eth->addr, eth->name);
+ }
+
+ end_ethent();
+
+} /* initialize_ethers */
+
+/*
+ * External Functions
+ */
extern u_char *get_hostname(u_int addr)
{
@@ -226,6 +661,35 @@ extern u_char *get_hostname(u_int addr)
return host_name_lookup(addr);
}
+extern void add_host_name(u_int addr, u_char *name)
+{
+
+ hashname_t *tp;
+ hashname_t **table = host_table;
+
+ tp = table[ addr & (HASHHOSTSIZE - 1)];
+
+ if( tp == NULL ) {
+ tp = table[ addr & (HASHHOSTSIZE - 1)] =
+ (hashname_t *)g_malloc(sizeof(hashname_t));
+ } else {
+ while(1) {
+ if (tp->next == NULL) {
+ tp->next = (hashname_t *)g_malloc(sizeof(hashname_t));
+ tp = tp->next;
+ break;
+ }
+ tp = tp->next;
+ }
+ }
+
+ strncpy(tp->name, name, MAXNAMELEN);
+ tp->name[MAXNAMELEN-1] = '\0';
+ tp->addr = addr;
+ tp->next = NULL;
+
+} /* add_host_name */
+
extern u_char *get_udp_port(u_int port)
{
static gchar str[3][MAXNAMELEN];
@@ -247,7 +711,6 @@ extern u_char *get_udp_port(u_int port)
} /* get_udp_port */
-
extern u_char *get_tcp_port(u_int port)
{
static gchar str[3][MAXNAMELEN];
@@ -269,3 +732,57 @@ extern u_char *get_tcp_port(u_int port)
} /* get_tcp_port */
+extern u_char *get_ether_name(u_char *addr)
+{
+ if (!g_resolving_actif)
+ return ether_to_str((guint8 *)addr);
+
+ if (!eth_resolution_initialized) {
+ initialize_ethers();
+ eth_resolution_initialized = 1;
+ }
+
+ return eth_name_lookup(addr);
+
+} /* get_ether_name */
+
+extern u_char *get_ether_addr(u_char *name)
+{
+
+ /* force resolution (do not check g_resolving_actif) */
+
+ if (!eth_resolution_initialized) {
+ initialize_ethers();
+ eth_resolution_initialized = 1;
+ }
+
+ return eth_addr_lookup(name);
+
+} /* get_ether_addr */
+
+extern u_char *get_manuf_name(u_char *addr)
+{
+ static gchar str[3][MAXMANUFLEN];
+ static gchar *cur;
+ hashmanuf_t *manufp;
+
+ if (g_resolving_actif && !eth_resolution_initialized) {
+ initialize_ethers();
+ eth_resolution_initialized = 1;
+ }
+
+ if (!g_resolving_actif || ((manufp = manuf_name_lookup(addr)) == NULL)) {
+ if (cur == &str[0][0]) {
+ cur = &str[1][0];
+ } else if (cur == &str[1][0]) {
+ cur = &str[2][0];
+ } else {
+ cur = &str[0][0];
+ }
+ sprintf(cur, "%02x:%02x:%02x", addr[0], addr[1], addr[2]);
+ return cur;
+ }
+
+ return manufp->name;
+
+} /* get_manuf_name */
diff --git a/resolv.h b/resolv.h
index dd994b70d0..278190a319 100644
--- a/resolv.h
+++ b/resolv.h
@@ -1,7 +1,7 @@
/* resolv.h
* Definitions for network object lookup
*
- * $Id: resolv.h,v 1.2 1998/09/16 03:22:18 gerald Exp $
+ * $Id: resolv.h,v 1.3 1998/09/25 23:24:07 gerald Exp $
*
* Laurent Deniel <deniel@worldnet.fr>
*
@@ -28,14 +28,44 @@
#ifndef __RESOLV_H__
#define __RESOLV_H__
-/* global variable */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
-extern int g_resolving_actif;
+#define EPATH_ETHERS "/etc/ethers"
+#define EPATH_MANUF DATAFILE_DIR "/manuf"
+#define EPATH_PERSONAL_ETHERS ".ethereal/ethers" /* with "$HOME/" prefix */
+
+/* global variables */
+
+extern gchar *g_ethers_path;
+extern gchar *g_manuf_path;
+extern gchar *g_pethers_path;
+extern int g_resolving_actif;
/* Functions in resolv.c */
+/* get_tcp_port returns the UDP port name or "%d" if not found */
extern u_char *get_udp_port(u_int port);
+
+/* get_tcp_port returns the TCP port name or "%d" if not found */
extern u_char *get_tcp_port(u_int port);
+
+/* get_hostname returns the host name or "%d.%d.%d.%d" if not found */
extern u_char *get_hostname(u_int addr);
+/* get_ether_name returns the logical name if found in ethers files else
+ "<vendor>_%02x:%02x:%02x" if the vendor code is known else
+ "%02x:%02x:%02x:%02x:%02x:%02x" */
+extern u_char *get_ether_name(u_char *addr);
+
+/* get_manuf_name returns the vendor name or "%02x:%02x:%02x" if not known */
+extern u_char *get_manuf_name(u_char *addr);
+
+/* returns the ethernet address corresponding to name or NULL if not known */
+extern u_char *get_ether_addr(u_char *name);
+
+/* adds a hostname/IP in the hash table */
+extern void add_host_name(u_int addr, u_char *name);
+
#endif /* __RESOLV_H__ */