diff -rc --new-file mtr-0.42/ChangeLog mtr-0.42+patches/ChangeLog *** mtr-0.42/ChangeLog Wed Dec 31 18:00:00 1969 --- mtr-0.42+patches/ChangeLog Sun Jul 8 17:17:47 2001 *************** *** 0 **** --- 1 ---- + empty file for automake/autoconf diff -rc --new-file mtr-0.42/Makefile.am mtr-0.42+patches/Makefile.am *** mtr-0.42/Makefile.am Sat Mar 4 01:46:55 2000 --- mtr-0.42+patches/Makefile.am Sun Jul 8 17:17:47 2001 *************** *** 3,11 **** sbin_PROGRAMS = mtr man_MANS = mtr.8 install-exec-am: ! chmod u+s $(sbindir)/mtr mtr_SOURCES = mtr.c \ net.c net.h \ dns.c dns.h \ raw.c raw.h \ --- 3,12 ---- sbin_PROGRAMS = mtr man_MANS = mtr.8 install-exec-am: ! chmod u+s $(DESTDIR)$(sbindir)/mtr mtr_SOURCES = mtr.c \ + get_origin.c \ net.c net.h \ dns.c dns.h \ raw.c raw.h \ diff -rc --new-file mtr-0.42/Makefile.in mtr-0.42+patches/Makefile.in *** mtr-0.42/Makefile.in Sat Mar 4 02:07:39 2000 --- mtr-0.42+patches/Makefile.in Sun Jul 8 17:17:48 2001 *************** *** 72,78 **** sbin_PROGRAMS = mtr man_MANS = mtr.8 ! mtr_SOURCES = mtr.c net.c net.h dns.c dns.h raw.c raw.h split.c split.h display.c display.h report.c report.h getopt.c getopt1.c getopt.h select.c select.h mtr-curses.h mtr-gtk.h EXTRA_mtr_SOURCES = curses.c gtk.c --- 72,78 ---- sbin_PROGRAMS = mtr man_MANS = mtr.8 ! mtr_SOURCES = mtr.c get_origin.c net.c net.h dns.c dns.h raw.c raw.h split.c split.h display.c display.h report.c report.h getopt.c getopt1.c getopt.h select.c select.h mtr-curses.h mtr-gtk.h EXTRA_mtr_SOURCES = curses.c gtk.c *************** *** 93,100 **** CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ ! mtr_OBJECTS = mtr.o net.o dns.o raw.o split.o display.o report.o \ ! getopt.o getopt1.o select.o mtr_LDADD = $(LDADD) CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) --- 93,100 ---- CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ ! mtr_OBJECTS = mtr.o get_origin.o net.o dns.o raw.o split.o display.o \ ! report.o getopt.o getopt1.o select.o mtr_LDADD = $(LDADD) CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) *************** *** 104,118 **** MANS = $(man_MANS) NROFF = nroff ! DIST_COMMON = README ./stamp-h.in AUTHORS COPYING INSTALL Makefile.am \ ! Makefile.in NEWS TODO acconfig.h aclocal.m4 config.h.in configure \ ! configure.in install-sh missing mkinstalldirs DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ! TAR = tar GZIP_ENV = --best SOURCES = $(mtr_SOURCES) $(EXTRA_mtr_SOURCES) OBJECTS = $(mtr_OBJECTS) --- 104,122 ---- MANS = $(man_MANS) NROFF = nroff ! DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ ! Makefile.am Makefile.in NEWS TODO acconfig.h aclocal.m4 config.h.in \ ! configure configure.in install-sh missing mkinstalldirs DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ! TAR = gtar GZIP_ENV = --best + DEP_FILES = .deps/curses.P .deps/display.P .deps/dns.P \ + .deps/get_origin.P .deps/getopt.P .deps/getopt1.P .deps/gtk.P \ + .deps/mtr.P .deps/net.P .deps/raw.P .deps/report.P .deps/select.P \ + .deps/split.P SOURCES = $(mtr_SOURCES) $(EXTRA_mtr_SOURCES) OBJECTS = $(mtr_OBJECTS) *************** *** 120,128 **** .SUFFIXES: .SUFFIXES: .S .c .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ! cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps Makefile ! Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status --- 124,132 ---- .SUFFIXES: .SUFFIXES: .S .c .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ! cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile ! Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status *************** *** 187,195 **** rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ done - .c.o: - $(COMPILE) -c $< - .s.o: $(COMPILE) -c $< --- 191,196 ---- *************** *** 376,385 **** -rm -rf $(distdir) mkdir $(distdir) -chmod 777 $(distdir) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ ! cp -pr $$/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ --- 377,391 ---- -rm -rf $(distdir) mkdir $(distdir) -chmod 777 $(distdir) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ ! cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ *************** *** 396,401 **** --- 402,439 ---- || exit 1; \ fi; \ done + + DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + + -include $(DEP_FILES) + + mostlyclean-depend: + + clean-depend: + + distclean-depend: + -rm -rf .deps + + maintainer-clean-depend: + + %.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + + %.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp info-am: info: info-recursive dvi-am: *************** *** 438,463 **** maintainer-clean-generic: mostlyclean-am: mostlyclean-hdr mostlyclean-sbinPROGRAMS \ ! mostlyclean-compile mostlyclean-tags \ mostlyclean-generic mostlyclean: mostlyclean-recursive clean-am: clean-hdr clean-sbinPROGRAMS clean-compile clean-tags \ ! clean-generic mostlyclean-am clean: clean-recursive distclean-am: distclean-hdr distclean-sbinPROGRAMS distclean-compile \ ! distclean-tags distclean-generic clean-am \ ! distclean-local distclean: distclean-recursive -rm -f config.status maintainer-clean-am: maintainer-clean-hdr maintainer-clean-sbinPROGRAMS \ maintainer-clean-compile maintainer-clean-tags \ ! maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." --- 476,502 ---- maintainer-clean-generic: mostlyclean-am: mostlyclean-hdr mostlyclean-sbinPROGRAMS \ ! mostlyclean-compile mostlyclean-tags mostlyclean-depend \ mostlyclean-generic mostlyclean: mostlyclean-recursive clean-am: clean-hdr clean-sbinPROGRAMS clean-compile clean-tags \ ! clean-depend clean-generic mostlyclean-am clean: clean-recursive distclean-am: distclean-hdr distclean-sbinPROGRAMS distclean-compile \ ! distclean-tags distclean-depend distclean-generic \ ! clean-am distclean-local distclean: distclean-recursive -rm -f config.status maintainer-clean-am: maintainer-clean-hdr maintainer-clean-sbinPROGRAMS \ maintainer-clean-compile maintainer-clean-tags \ ! maintainer-clean-depend maintainer-clean-generic \ ! distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." *************** *** 475,489 **** all-recursive check-recursive installcheck-recursive info-recursive \ dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ ! distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ ! dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ ! install-exec-am install-exec install-data-am install-data install-am \ ! install uninstall-am uninstall all-redirect all-am all installdirs-am \ installdirs mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean install-exec-am: ! chmod u+s $(sbindir)/mtr distclean-local: cp Makefile.dist Makefile rm -f *.orig --- 514,530 ---- all-recursive check-recursive installcheck-recursive info-recursive \ dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ ! distclean-tags clean-tags maintainer-clean-tags distdir \ ! mostlyclean-depend distclean-depend clean-depend \ ! maintainer-clean-depend info-am info dvi-am dvi check check-am \ ! installcheck-am installcheck all-recursive-am install-exec-am \ ! install-exec install-data-am install-data install-am install \ ! uninstall-am uninstall all-redirect all-am all installdirs-am \ installdirs mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean install-exec-am: ! chmod u+s $(DESTDIR)$(sbindir)/mtr distclean-local: cp Makefile.dist Makefile rm -f *.orig diff -rc --new-file mtr-0.42/configure mtr-0.42+patches/configure *** mtr-0.42/configure Sat Mar 4 02:07:39 2000 --- mtr-0.42+patches/configure Sun Jul 8 17:17:47 2001 *************** *** 2199,2206 **** : else echo "$ac_t""no" 1>&6 echo $ac_n "checking for res_init in -lbind""... $ac_c" 1>&6 ! echo "configure:2204: checking for res_init in -lbind" >&5 ac_lib_var=`echo bind'_'res_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 --- 2199,2252 ---- : else echo "$ac_t""no" 1>&6 + echo $ac_n "checking for __res_init""... $ac_c" 1>&6 + echo "configure:2204: checking for __res_init" >&5 + if eval "test \"`echo '$''{'ac_cv_func___res_init'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char __res_init(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub___res_init) || defined (__stub_____res_init) + choke me + #else + __res_init(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:2232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func___res_init=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func___res_init=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'__res_init`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : + else + echo "$ac_t""no" 1>&6 echo $ac_n "checking for res_init in -lbind""... $ac_c" 1>&6 ! echo "configure:2250: checking for res_init in -lbind" >&5 ac_lib_var=`echo bind'_'res_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 *************** *** 2208,2214 **** ac_save_LIBS="$LIBS" LIBS="-lbind $LIBS" cat > conftest.$ac_ext < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else --- 2265,2271 ---- res_init() ; return 0; } EOF ! if { (eval echo configure:2269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else *************** *** 2245,2251 **** else echo "$ac_t""no" 1>&6 echo $ac_n "checking for res_init in -lresolv""... $ac_c" 1>&6 ! echo "configure:2249: checking for res_init in -lresolv" >&5 ac_lib_var=`echo resolv'_'res_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 --- 2291,2297 ---- else echo "$ac_t""no" 1>&6 echo $ac_n "checking for res_init in -lresolv""... $ac_c" 1>&6 ! echo "configure:2295: checking for res_init in -lresolv" >&5 ac_lib_var=`echo resolv'_'res_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 *************** *** 2253,2259 **** ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else --- 2310,2316 ---- res_init() ; return 0; } EOF ! if { (eval echo configure:2314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else *************** *** 2296,2311 **** fi for ac_func in seteuid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ! echo "configure:2304: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 ! echo "configure:2352: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else --- 2376,2382 ---- ; return 0; } EOF ! if { (eval echo configure:2380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else *************** *** 2355,2366 **** # AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid)) echo $ac_n "checking for res_mkquery""... $ac_c" 1>&6 ! echo "configure:2359: checking for res_mkquery" >&5 if eval "test \"`echo '$''{'ac_cv_func_res_mkquery'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 ! echo "configure:2407: checking for res_mkquery" >&5 if eval "test \"`echo '$''{'ac_cv_func_res_mkquery'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_res_mkquery=yes" else --- 2431,2437 ---- ; return 0; } EOF ! if { (eval echo configure:2435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_res_mkquery=yes" else *************** *** 2400,2426 **** : else echo "$ac_t""no" 1>&6 ! echo $ac_n "checking for res_init in -lbind""... $ac_c" 1>&6 ! echo "configure:2405: checking for res_init in -lbind" >&5 ! ac_lib_var=`echo bind'_'res_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lbind $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else --- 2448,2474 ---- : else echo "$ac_t""no" 1>&6 ! echo $ac_n "checking for res_mkquery in -lbind""... $ac_c" 1>&6 ! echo "configure:2453: checking for res_mkquery in -lbind" >&5 ! ac_lib_var=`echo bind'_'res_mkquery | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lbind $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else *************** *** 2445,2471 **** else echo "$ac_t""no" 1>&6 ! echo $ac_n "checking for res_init in -lresolv""... $ac_c" 1>&6 ! echo "configure:2450: checking for res_init in -lresolv" >&5 ! ac_lib_var=`echo resolv'_'res_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else --- 2493,2519 ---- else echo "$ac_t""no" 1>&6 ! echo $ac_n "checking for res_mkquery in -lresolv""... $ac_c" 1>&6 ! echo "configure:2498: checking for res_mkquery in -lresolv" >&5 ! ac_lib_var=`echo resolv'_'res_mkquery | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else *************** *** 2499,2510 **** echo $ac_n "checking for herror""... $ac_c" 1>&6 ! echo "configure:2503: checking for herror" >&5 if eval "test \"`echo '$''{'ac_cv_func_herror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 ! echo "configure:2551: checking for herror" >&5 if eval "test \"`echo '$''{'ac_cv_func_herror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_herror=yes" else --- 2575,2581 ---- ; return 0; } EOF ! if { (eval echo configure:2579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_herror=yes" else *************** *** 2551,2562 **** fi echo $ac_n "checking for strerror""... $ac_c" 1>&6 ! echo "configure:2555: checking for strerror" >&5 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 ! echo "configure:2603: checking for strerror" >&5 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strerror=yes" else --- 2627,2633 ---- ; return 0; } EOF ! if { (eval echo configure:2631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strerror=yes" else diff -rc --new-file mtr-0.42/configure.in mtr-0.42+patches/configure.in *** mtr-0.42/configure.in Sat Mar 4 01:47:00 2000 --- mtr-0.42+patches/configure.in Sun Jul 8 17:17:43 2001 *************** *** 52,66 **** AC_CHECK_LIB(nsl, gethostbyname, , AC_MSG_ERROR(No nameservice library found))) AC_CHECK_FUNC(res_init, , ! AC_CHECK_LIB(bind, res_init, , ! AC_CHECK_LIB(resolv, res_init, , AC_MSG_ERROR(No resolver library found)))) AC_CHECK_FUNCS(seteuid) # AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid)) AC_CHECK_FUNC(res_mkquery, , ! AC_CHECK_LIB(bind, res_init, , ! AC_CHECK_LIB(resolv, res_init, , AC_MSG_ERROR(No resolver library found)))) AC_CHECK_FUNC(herror, , AC_DEFINE(NO_HERROR)) AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR)) --- 52,67 ---- AC_CHECK_LIB(nsl, gethostbyname, , AC_MSG_ERROR(No nameservice library found))) AC_CHECK_FUNC(res_init, , ! AC_CHECK_FUNC(__res_init, , ! AC_CHECK_LIB(bind, res_init, , ! AC_CHECK_LIB(resolv, res_init, , AC_MSG_ERROR(No resolver library found))))) AC_CHECK_FUNCS(seteuid) # AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid)) AC_CHECK_FUNC(res_mkquery, , ! AC_CHECK_LIB(bind, res_mkquery, , ! AC_CHECK_LIB(resolv, res_mkquery, , AC_MSG_ERROR(No resolver library found)))) AC_CHECK_FUNC(herror, , AC_DEFINE(NO_HERROR)) AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR)) diff -rc --new-file mtr-0.42/curses.c mtr-0.42+patches/curses.c *** mtr-0.42/curses.c Sat Mar 4 01:46:55 2000 --- mtr-0.42+patches/curses.c Sun Jul 8 17:17:47 2001 *************** *** 17,22 **** --- 17,43 ---- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + + #include #ifndef NO_CURSES *************** *** 59,65 **** #include extern char LocalHostname[]; ! void pwcenter(char *str) { int maxx, maxy; int cx; --- 80,87 ---- #include extern char LocalHostname[]; ! extern int PrintASN; ! extern int PrintOwner; void pwcenter(char *str) { int maxx, maxy; int cx; *************** *** 98,104 **** int addr; int y, x; char *name; ! max = net_max(); for(at = 0; at < max; at++) { --- 120,126 ---- int addr; int y, x; char *name; ! char asn[21]="[?]"; max = net_max(); for(at = 0; at < max; at++) { *************** *** 108,118 **** if(addr != 0) { name = dns_lookup(addr); if(name != NULL) { ! printw("%s", name); } else { ! printw("%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) & 0xff, ! (addr >> 8) & 0xff, addr & 0xff); ! } getyx(stdscr, y, x); move(y, startstat); --- 130,148 ---- if(addr != 0) { name = dns_lookup(addr); if(name != NULL) { ! printw("%s",name); ! if(PrintASN) ! printw(" [%s]",get_origin(name,addr)); ! if (PrintOwner) { ! struct in_addr a; ! a.s_addr = htonl(addr); ! printw(" (%s)",lookup_owner(a,name,addr)); ! } } else { ! printw("%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) & 0xff, ! (addr >> 8) & 0xff, addr & 0xff); ! } ! getyx(stdscr, y, x); move(y, startstat); diff -rc --new-file mtr-0.42/get_origin.c mtr-0.42+patches/get_origin.c *** mtr-0.42/get_origin.c Wed Dec 31 18:00:00 1969 --- mtr-0.42+patches/get_origin.c Sun Jul 8 17:17:47 2001 *************** *** 0 **** --- 1,958 ---- + #define SPRAY + #ifndef lint + static char *rcsid = + "@(#)$Header: trACESroute.c,v 6.0 GOLD 1999/11/15 gavron(gavron@aces.com)"; + #endif + #define TR_VERSION "6.0 GOLD" + + + #include + + #define IP_VERSION 4 /* We can't work with anything else... */ + #define CISCO_ICMP 1 /* We check for loss+unreachables = probes */ + + #ifdef __decc /* DEC C wants strings.h to be called string.h */ + #define STRING + #define NOINDEX + #define NOBZERO + #endif + + #ifdef SOLARIS /* Solaris has UCB stuff gone, and POSIX resolver */ + #define SUN_WO_UCB + #define POSIX + #endif + + #ifdef SUN_WO_UCB + #define STRING + #define NOINDEX + #include + #endif + + #ifdef _AIX /* Aix has its own set of fd_* macros */ + #include + #include + #endif + + #ifdef STRING + #include + #else /* ! STRING */ + #include + #endif /* STRING */ + + #include + + #ifdef NOINDEX + #define index(x,y) strchr(x,y) /* Use ansi strchr() if no index() */ + #endif /* NOINDEX */ + + #ifndef bzero + #ifdef NOBZERO + #define bzero(x,y) memset((void *)x,(int)0,(size_t) y) + #define bcopy(x,y,z) memcpy((void *)y, (const void *)x, (size_t) z) + #endif /* NOBZERO */ + #endif /* bzero*/ + + #include /* For atof(), etc. */ + #include /* For getpid(), etc. */ + + /* The VMS stuff follows */ + #ifdef vms + pid_t decc$getpid(void); /* Just don't ask...*/ + #define getpid decc$getpid /* Really... don't ask.*/ + #define perror socket_perror /* MultiNet wants this */ + #ifdef MULTINET_V3 + #define errno socket_errno /* MultiNet wants this */ + #include "multinet_root:[multinet.include]errno.h" + #else /* MULTINET_V4 */ + #define MULTINET_V4 + #include + #ifdef errno + #undef errno + #include "multinet_root:[multinet.include]errno.h" + #define errno socket_errno /* Multinet 4.1 */ + #endif /* errno defined */ + #endif /* MULTINET_V3 */ + #define write socket_write /* MultiNet wants this */ + #define read socket_read /* MultiNet wants this */ + #define close socket_close /* MultiNet wants this */ + #include + #ifdef __alpha + #define BYTE_ORDER 1234 /* The include files for Alpha are bad. */ + #define LITTLE_ENDIAN 1234 /* They incorrectly swap ip_v and ip_hl */ + #define BIG_ENDIAN 4321 /* Which makes packet_ok fail. New diag */ + #endif /* __alpha */ /* Info says: packet version not 4: 5 */ + #ifdef VMS_CLD /* use separate qualifers instead of options */ + #include "clis.h" + #else /* No CLD */ + int fixargs(int *, char **, char **); + #endif /* VMS_CLD */ + #else /* not VMS */ + #include + #endif /* vms */ + + #include + #include + #include + #include + + #ifndef vms /* Not VMS */ + #ifdef POSIX /* Posix */ + #define BIND_RES_POSIX3 + #include + #ifdef res_mkquery /* __res_mkquery() */ + #undef res_mkquery + #endif /* endif */ + #ifdef res_send + #undef res_send + #endif + #else /* POSIX */ /* else ! Posix */ + #include + #endif /* POSIX */ /* Endif Posix */ + #else /* vms */ /* else VMS */ + #ifdef MULTINET_V4 /* they didn't put the prototypes in the file */ + #include + int res_send(unsigned char *, int, unsigned char *, int); + int res_mkquery(int op, const char *dname, + int class, int type, const char *data, int datalen, + void *, u_char *buf, int buflen); + int gettimeofday(struct timeval *, void *); + #endif /* MULTINET_V4 */ + #endif /* __vms */ /* Endif VMS */ + + #ifdef __linux__ /* Wrapping this may be excessive */ + #define __FAVOR_BSD + #endif + + + #ifndef MAX_DATALEN + #define MAX_DATALEN 32000 /* Maximum size of MTU discovery packet length*/ + #endif + + #include + #include + #include + + + + #include + #include + #ifndef __linux__ + #include + #else /* __linux__ */ + #include + #include + #endif /* __linux__ */ + #include + #include + #include + #include + #include /* After resolv.h for gcc2.7/sun __p redef */ + + #ifndef NO_PROTOTYPES /* By default, have prototypes */ + int send_probe(int, int); + int wait_for_reply(int, struct sockaddr_in *, struct timeval *); + int packet_ok(u_char *, int, struct sockaddr_in *, int); + int tvsub(struct timeval *, struct timeval *); + void print_time(float *); + void print_from(struct sockaddr_in *); + int print(u_char *, int, struct sockaddr_in *); + int reduce_mtu(int); + int doqd(unsigned char *, int); + int dorr(unsigned char *, int, char **); + int doclass(unsigned char *, int); + int dordata(unsigned char *, int, int, int, char *, char **); + int dottl(unsigned char *,int); + int doname(unsigned char *, int, char *); + int dotype(unsigned char *, int); + void AbortIfNull (char *); + void print_ttl(int); + void print_packet(struct ip *, int); + #endif /* NO_PROTOTYPES */ + + #define MAXPACKET 65535 /* max ip packet size */ + #ifndef MAXHOSTNAMELEN + #define MAXHOSTNAMELEN 64 + #endif + + #define SIZEOFstructip sizeof(struct ip) + + #ifndef FD_SET + #define NFDBITS (8*sizeof(fd_set)) + #define FD_SETSIZE NFDBITS + #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) + #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) + #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) + #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) + #endif + + #define Fprintf (void)fprintf + #define Sprintf (void)sprintf + #define Printf (void)printf + + #define NOERR(val,msg) {if (((int)(val)) < 0) {perror(msg);exit(1);}} + + #ifndef NO_SOA_RECORD + #define NO_SOA_RECORD "no SOA record" + #endif + + /* For some reason, IP_HDRINCL and LSRR don't interact well on SGI; + * so turn it off: */ + #ifdef sgi + #undef IP_HDRINCL + #endif + + #ifndef vms + extern int errno; + #endif + + extern char *inet_ntoa(); + extern u_long inet_addr(); + + #ifndef ULTRIX43 + char *index(const char *string, int character); + #endif + + void halt(); /* signal handler */ + + /* + * format of a (udp) probe packet. + */ + struct opacket { + struct ip ip; + struct udphdr udp; + u_char seq; /* sequence number of this packet */ + u_char ttl; /* ttl packet left with */ + struct timeval tv; /* time packet left */ + }; + + #ifdef SPRAY + /* + * format of a spray data cell. + */ + #define SPRAYMAX 256 /* We'll only do up to 256 TTLs at once */ + struct { + u_long dport; /* check for matching dport */ + u_char ttl; /* ttl we sent it to */ + u_char type; /* icmp response type */ + struct timeval out; /* time packet left */ + struct timeval rtn; /* time packet arrived */ + struct sockaddr_in from; /* whom from */ + } spray[SPRAYMAX]; + + + #define ASNMAX 256 + struct { + char name[256]; + char asn[100]; + int addr; + } asns[ASNMAX]; + #define OWNERMAX 256 + struct { + char name[256]; + char address[256]; + int addr; + } owners[OWNERMAX]; + int current_asn = 0; + int current_owner = 0; + int spray_rtn[SPRAYMAX]; /* See which TTLs have responded */ + int spray_target; /* See which TTL the host responds on */ + int spray_max; /* See which is the highest TTL we've seen */ + int spray_min; /* See smallest host-returned TTL */ + int spray_total; /* total of responses seen */ + int spray_mode =0; /* By default, turned off */ + #endif /* SPRAY */ + + u_char packet[512]; /* last inbound (icmp) packet */ + struct opacket *outpacket; /* last output packet */ + char *inetname(); + u_char optlist[MAX_IPOPTLEN]; /* IP options list */ + int _optlen; + struct icmp *icp; /* Pointer to ICMP header in packet */ + + + int s; /* receive (icmp) socket file descriptor */ + int sndsock; /* send (udp) socket file descriptor */ + #if defined(FREEBSD) || defined(__linux__) + struct timezone tz; + #else + unsigned long tz; /* leftover */ + #endif + struct sockaddr whereto; /* Who to try to reach */ + struct sockaddr_in addr_last; /* last printed address */ + int datalen; /* How much data */ + + + char *source = 0; + char *hostname; + char hnamebuf[MAXHOSTNAMELEN]; + + int nprobes = 3; + int min_ttl = 1; + int max_ttl = 30; + u_short ident; + u_short port = 32768+666; /* start udp dest port # for probe packets */ + u_short sport = 1000; /* source port ... */ + + int options; /* socket options */ + int verbose; + int mtudisc=0; /* do MTU discovery in path */ + int pingmode=0; /* replacing ping functionality? */ + #ifndef vms + float waittime = 3.0; /* time to wait for response (in seconds) */ + #else /* vms */ + double waittime = 3.0; + #endif + int nflag; /* print addresses numerically */ + + #define TERM_SIZE 32 /* Size of line terminator... */ + char terminator[TERM_SIZE]; /* Line terminator... */ + int haltf=0; /* signal happened */ + int ppdelay=1; /* we normally want per-packet delay */ + int pploss=0; /* we normally don't want packet loss */ + int lost; /* how many packets did we not get back */ + double throughput; /* percentage packets not lost */ + int consecutive=0; /* the number of consecutive lost packets */ + int automagic=0; /* automatically quit after 10 lost packets? */ + int hurry_mode=0; /* only do one on successful ttls */ + int utimers=0; /* Print timings in microseconds */ + int dns_owner_lookup=0; /* Look up owner email in DNS */ + int as_lookup=0; /* Look up AS path in routing registries */ + int got_there; + int unreachable; + int mtu, new_mtu = 0; + + /* + * Lookup origin of the net in radb. + */ + + char *lookup_as(in) + struct in_addr in; + { + static char query[100]; + static unsigned char *addr_ptr; + static char *sp; + char *get_origin(); + + addr_ptr = (unsigned char *) (&in.s_addr); + + #ifdef FORCE_NATURAL_MASK + if (addr_ptr[0] >= 192) { + sprintf (query, "%d.%d.%d.0",addr_ptr[0],addr_ptr[1],addr_ptr[2]); + } else if (addr_ptr[0] >= 128) { + sprintf (query, "%d.%d.0.0",addr_ptr[0],addr_ptr[1]); + } else { + sprintf (query, "%d.0.0.0",addr_ptr[0]); + } + #else + sprintf (query,"%d.%d.%d.%d",addr_ptr[0],addr_ptr[1],addr_ptr[2],addr_ptr[3]); + #endif /* FORCE_NATURAL_MASK */ + + return(get_origin(query)); + } + + /* + * get_origin - Return origin (ASnnnn) given a network designation + * + * char *get_origin(char *net_designation) + * + * Returns: 0 - Error occurred, unable to get origin + * !0 Pointer to origin string + * + * Define STANDALONE to use this as a client. Also define EXAMPLE_NET for + * an example for the truly clueless... + * + * 20-May-1995 Ehud Gavron gavron@aces.com + */ + + + /* The following are used to determine which service at which host to + connect to. A getenv() of the following elements occurs at run-time, + which may override these values. */ + + #define RA_SERVER "whois.ra.net" + #define RA_SERVICE "whois" + + /* The following determines what fields will be returned for the -A value + (/AS_LOOKUP for VMS). This is the "origin" of the route entry in the + RADB. */ + + #define DATA_DELIMITER "origin:" + + /* Since now the RADB has multiple route objects, we will list only the + origin of the most specific one. To do so we actually have to parse + the route lines and look for the most specific route. To do so we + parse: + net.net.net.net/prefix + + and use the most specific (largest) prefix. The following determine + how we get this. */ + + #define ROUTE_DELIMITER "route:" + #define PREFIX_DELIMITER "/" + + #ifdef STANDALONE + #ifdef __vms + #include "multinet_root:[multinet.include.sys]types.h" + #include "multinet_root:[multinet.include.sys]socket.h" + #include "multinet_root:[multinet.include.netinet]in.h" + #include + #include "multinet_root:[multinet.include]netdb.h" + #define perror socket_perror + #define write socket_write + #define read socket_read + #define close socket_close + #else /* not VMS */ + #include + #include + #include + #include + #include + #endif /* VMS */ + #endif /* STANDALONE */ + + #ifndef boolean + #define boolean int + #endif + + #ifndef TRUE + #define TRUE (1==1) + #endif + + #ifndef FALSE + #define FALSE (!(TRUE)) + #endif + #define MAXREPLYLEN 8192 + + char *get_origin(name, addr) + char *name; + { + char *i,*j,*k; + char tmp[100],tmp2[100],tmp3[100]; /* store string delimiters */ + char tmp4[100]; /* here's where we store the AS */ + static char origin[100]; /* the returned route origin */ + char *rp; /* pointer to route: line */ + char *pp; /* pointer to /prefix part of route */ + int prefix; /* prefix off this line (decimal) */ + int best_prefix; /* best prefix thus far */ + int s, n, count; + int z = 0; + char buf[256]; + boolean done; + static char reply[MAXREPLYLEN]; + struct sockaddr_in sin; + struct hostent *hp; + struct servent *sp; + char *getenv(); + + if (current_asn > 0) { + while (z <= current_asn) { + z++; + if (!strcmp(name,asns[z].name) || addr == asns[z].addr) { + return asns[z].asn; + } + } + } + + /* + * Get the IP address of the host which serves the routing arbiter + * database. We use RA_SERVER. On the offchance that someone wants + * to query another database, we check for the environment variable + * RA_SERVER to have been set. + */ + if ((i = getenv("RA_SERVER")) == 0) { + strcpy(tmp,RA_SERVER); + } else { + strncpy(tmp,i,sizeof(tmp)); + tmp[(sizeof(tmp))-1] = '\0'; /* strncpy may not null term */ + } + + hp = gethostbyname(tmp); + if (hp == NULL) { + Fprintf(stderr, "get_origin: localhost unknown%s",terminator); + return(0); + } + + /* + * Create an IP-family socket on which to make the connection + */ + + s = socket(hp->h_addrtype, SOCK_STREAM, 0); + if (s < 0) { + perror("get_origin: socket"); + return(0); + } + + /* + * Get the TCP port number of the "whois" server. + * Again if this needs to be updated, the environment variable + * RA_SERVICE should be set. + */ + if ((i = getenv("RA_SERVICE")) == 0) { + strcpy(tmp,RA_SERVICE); + } else { + strncpy(tmp,i,sizeof(tmp)); + tmp[(sizeof(tmp))-1] = '\0'; /* strncpy may not null term */ + } + + sp = getservbyname(tmp,"tcp"); + if (sp == NULL) { + Fprintf(stderr, "get_origin: getservbyname: unknown service%s",terminator); + return(0); + } + + /* + * Create a "sockaddr_in" structure which describes the remote + * IP address we want to connect to (from gethostbyname()) and + * the remote TCP port number (from getservbyname()). + */ + + sin.sin_family = hp->h_addrtype; + bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length); + sin.sin_port = sp->s_port; + + /* + * Connect to that address... + */ + + if (connect(s, (struct sockaddr *)&sin, sizeof (sin)) < 0) { + perror("get_origin: connect"); + return(0); + } + + /* + * Now send the request out to the server... + */ + + done = FALSE; + sprintf(buf,"%s\r\n",name); + write(s, buf, strlen(buf)); + + /* + * Now get the entire answer in one long buffer... + */ + count = 0; + while ((n = read(s, buf, sizeof(buf))) > 0) { + strcpy((char *)&reply[count],(char *)buf); + count += n; + } + + if (n < 0) { + perror("get_origin: read"); + return(0); + } + + reply[count] = '\0'; /* Terminate it - thanks Joey! */ + + /* + * So now we have a large string, somewhere in which we can + * find origin:*AS%%%%%%. We parse this into AS%%%%%. + */ + + if ((i = getenv("DATA_DELIMITER")) == 0) { + strcpy(tmp,DATA_DELIMITER); + } else { + strncpy(tmp,i,sizeof(tmp)); + tmp[(sizeof(tmp))-1] = '\0'; /* strncpy may not null term */ + } + + /* TMP2 will have the route delimiter... */ + + if ((i = getenv("ROUTE_DELIMITER")) == 0) { + strcpy(tmp2,ROUTE_DELIMITER); + } else { + strncpy(tmp,i,sizeof(tmp)); + tmp[(sizeof(tmp))-1] = '\0'; /* strncpy may not null term */ + } + + if ((i = getenv("PREFIX_DELIMITER")) == 0) { + strcpy(tmp3,PREFIX_DELIMITER); + } else { + strncpy(tmp3,i,sizeof(tmp3)); + tmp3[(sizeof(tmp3))-1] = '\0'; /* strncpy may not null term */ + } + + /* + * The next while statement was put in because of SPRINTLINK's ingeneous + * Reasonable Default announcement project. They registered nets in the + * RADB of the ilk of 0.0.0.0/1, 128.0.0.0/1, 192..../2, etc... just so + * that ANS wouldn't be such a pain in the butt. + * + * For us this means instead of taking the first origin...we take the best... + */ + + /* + * Initialize it so far as we've seen no prefixes, and are still looking + * for route entries... + */ + best_prefix = 0; /* 0 bits is not very specific */ + done = FALSE; /* not done finding route: entries */ + + rp = (char *)reply; /* initialize main pointer to buffer */ + origin[0]='\0'; /* initialize returned string */ + reply[MAXREPLYLEN-1]='\0'; + + rp = (char *)strstr(rp,tmp2); /* Find route: in the string */ + while (rp != 0) { /* If there is such a thing... */ + /* find it again later */ + pp = (char *)strstr(rp,tmp3); /* Find / in the route entry */ + if (pp == 0) { /* No prefix... */ + prefix = 0; /* So we bias it out of here */ + } else { + prefix = atoi(pp+1); /* convert to decimal*/ + } + + if (prefix >= best_prefix) { /* it's equal to or better */ + i = (char *)strstr(pp,tmp); /* find origin: delimiter */ + if (i != 0) { /* it's nice if there is one */ + i += strlen(DATA_DELIMITER); /* skip delimiter... */ + i++; /* and the colon... */ + while (*i == ' ') i++; /* skip spaces */ + /* i now points to start of origin AS string */ + j = i; /* terminate... */ + while (*j >= '0') j++; + if (prefix > best_prefix) { + strcpy(origin,"/"); /* put a slash in */ + best_prefix = prefix; /* update best */ + } else { + strcat(origin,"/"); /* put a mutiple as separator*/ + } + strncpy(tmp4,i,(j-i)); /* copy new origin */ + tmp4[j-i] = '\0'; /* null terminate it */ + if (!(strstr(origin,tmp4))) { /* if it's not a dup */ + strncat(origin,i,(j-i)); /* stick it in */ + } else { + if (prefix == best_prefix) /* Otherwise remove slash */ + origin[strlen(origin)-1] = '\0'; + } /* end if not a dup */ + } /* end if origin found */ + } /* endif prefix > best_prefix */ + rp = (char *)strstr(rp+1,tmp2); /* Find route: in the string */ + } /* end while */ + /* + * Go home... + */ + close(s); + if (best_prefix != 0) { /* did we get anything? */ + current_asn++; + strcpy(asns[current_asn].asn,(char *)&origin[1]); + strcpy(asns[current_asn].name,name); + asns[current_asn].addr = addr; + return((char *)&origin[1]); /* strip off leading slash */ + } else { + return(0); + } + } + + + + + short getshort(ptr) + char *ptr; + { + union { + short retval; + char ch[2]; + } foo; + + foo.ch[0] = (*ptr & 0xff); + foo.ch[1] = (*(ptr+1) & 0xff); + + return (foo.retval); + } + + char *doresolve (name) + char *name; + { + int query=QUERY; + int qtype=T_SOA; + int qclass=C_IN; + unsigned char buf[256]; + char *ans; + int blen, alen, got; + int anssiz, i; + short shrt; + HEADER *h; + char *contact_ptr; + int ptr; + + anssiz = 512; + ans = (char *)malloc(anssiz); + if (!ans) { + return(0); + } + + blen = res_mkquery(query,name,qclass,qtype,NULL,0,NULL,(u_char *)buf,sizeof(buf)); + if (blen < 0) { + return (0); + } + + alen = res_send((unsigned char *)buf,blen,(unsigned char *)ans,anssiz); + if (alen == -1) { + return (0); + } + + if (alen < 12) { + return (0); + } + + h = (HEADER *)ans; + + h->id = ntohs(h->id); + h->qdcount = ntohs(h->qdcount); + h->ancount = ntohs(h->ancount); + h->nscount = ntohs(h->nscount); + h->arcount = ntohs(h->arcount); + + if (h->ancount == 0) return(0); + + ptr = 12; /* point at first question field */ + for (i=0; i< (int)h->qdcount && ptrancount && ptr 0) { + while (z <= current_owner) { + z++; + if (!strcmp(name,owners[z].name) || addr == owners[z].addr) { + return owners[z].address; + } + } + } + + + addr_ptr = (unsigned char *) (&in.s_addr); + + /* Try /24 */ + sprintf (dns_query, "%d.%d.%d.in-addr.arpa", addr_ptr[2], addr_ptr[1], addr_ptr[0]); + if (!(owner = doresolve(dns_query))) { + /* Failed, try /16 */ + sprintf (dns_query, "%d.%d.in-addr.arpa", addr_ptr[1], addr_ptr[0]); + if (!(owner = doresolve(dns_query))) { + /* Failed. If eligible try /8 */ + if (addr_ptr[0] < 128) { + sprintf (dns_query, "%d.in-addr.arpa", addr_ptr[0]); + owner = doresolve(dns_query); + } /* tried /8 for A's */ + } /* tried /16 */ + } /* tried /24 */ + + /* reformat slightly */ + if (owner == NULL) { + owner = NO_SOA_RECORD; + } else { + dot_ptr = (char *)strchr (owner, (int)'.'); + if (dot_ptr != NULL) + *dot_ptr = '@'; + + if (strlen(owner) > 0) { + dot_ptr=owner + strlen (owner) - 1; + while (*dot_ptr == ' ' || *dot_ptr == '.' ) { + *dot_ptr = 0; + dot_ptr--; + } + } + } + + current_owner++; + strcpy(owners[current_owner].address,owner); + strcpy(owners[current_owner].name,name); + owners[current_owner].addr = addr; + return (owner); + + } + + diff -rc --new-file mtr-0.42/mtr.c mtr-0.42+patches/mtr.c *** mtr-0.42/mtr.c Sat Mar 4 02:22:32 2000 --- mtr-0.42+patches/mtr.c Sun Jul 8 17:36:11 2001 *************** *** 41,46 **** --- 41,48 ---- int Interactive = 1; int PrintVersion = 0; int PrintHelp = 0; + int PrintASN = 0; + int PrintOwner = 0; int MaxPing = 16; float WaitTime = 1.0; char *Hostname = NULL; *************** *** 56,62 **** --- 58,68 ---- { "report", 0, 0, 'r' }, { "report-cycles", 1, 0, 'c' }, { "curses", 0, 0, 't' }, + { "show-asn", 0, 0, 'a' }, + { "owner-email", 0, 0, 'o' }, + #ifndef NO_GTK { "gtk", 0, 0, 'g' }, + #endif { "interval", 1, 0, 'i' }, { "psize", 1, 0, 'p' }, { "no-dns", 0, 0, 'n' }, *************** *** 67,73 **** opt = 0; while(1) { ! opt = getopt_long(argc, argv, "hvrc:tklnsi:p:", long_options, NULL); if(opt == -1) break; --- 73,83 ---- opt = 0; while(1) { ! #ifndef NO_GTK ! opt = getopt_long(argc, argv, "hvrc:tlaonsi:p:", long_options, NULL); ! #else ! opt = getopt_long(argc, argv, "hvrc:gtlaonsi:p:", long_options, NULL); ! #endif if(opt == -1) break; *************** *** 78,83 **** --- 88,99 ---- case 'h': PrintHelp = 1; break; + case 'a': + PrintASN = 1; + break; + case 'o': + PrintOwner = 1; + break; case 'r': DisplayMode = DisplayReport; break; *************** *** 87,98 **** case 'p': packetsize = atoi (optarg); break; - case 't': - DisplayMode = DisplayCurses; - break; case 'g': DisplayMode = DisplayGTK; break; case 's': /* BL */ DisplayMode = DisplaySplit; break; --- 103,114 ---- case 'p': packetsize = atoi (optarg); break; case 'g': DisplayMode = DisplayGTK; break; + case 't': + DisplayMode = DisplayCurses; + break; case 's': /* BL */ DisplayMode = DisplaySplit; break; *************** *** 182,192 **** } if(PrintHelp) { ! printf("usage: %s [-hvrctglsni] [--help] [--version] [--report]\n" ! "\t\t[--report-cycles=COUNT] [--curses] [--gtk]\n" "\t\t[--raw] [--split] [--no-dns]\n" /* BL */ "\t\t[--psize=bytes/-p=bytes]\n" /* ok */ "\t\t[--interval=SECONDS] HOSTNAME [PACKETSIZE]\n", argv[0]); exit(0); } if (Hostname == NULL) Hostname = "localhost"; --- 198,218 ---- } if(PrintHelp) { ! #ifndef NO_GTK ! printf("usage: %s [-hvrcgtloasni] [--help] [--version] [--report]\n" ! "\t\t[--report-cycles=COUNT] [--gtk] [--curses]\n" ! "\t\t[--raw] [--split] [--no-dns]\n" /* BL */ ! "\t\t[--show-asn] [--owner-email]\n" ! "\t\t[--psize=bytes/-p=bytes]\n" /* ok */ ! "\t\t[--interval=SECONDS] HOSTNAME [PACKETSIZE]\n", argv[0]); ! #else ! printf("usage: %s [-hvrctloasni] [--help] [--version] [--report]\n" ! "\t\t[--report-cycles=COUNT] [--curses]\n" "\t\t[--raw] [--split] [--no-dns]\n" /* BL */ + "\t\t[--show-asn] [--owner-email]\n" "\t\t[--psize=bytes/-p=bytes]\n" /* ok */ "\t\t[--interval=SECONDS] HOSTNAME [PACKETSIZE]\n", argv[0]); + #endif exit(0); } if (Hostname == NULL) Hostname = "localhost";