Hi!

I just found that xtraceroute gets the resolve info from a shell script
/usr/share/xtraceroute/xtraceroute-resolve-location.sh
I attached a modified version which can use correctly the bind9-host and the
host package's
host binaries.

It is working now, but I think it should be rewrited completly, because a not
"C" locale can brake things, the original author tought it is a good idea to
determine which host is on the system with greping some message from the
command's help, brrr....

Harka Gyozo

On Thu, 26 Jul 2007 14:16:07 +0200, Ola Lundqvist wrote
> tags 434705 + patch
> thanks
> 
> Hi
> 
> 
> Ok, good to know. It should probably conflict the host9 instead of
> depend on it. :)
> 
> Regards,
> 
> // Ola
>

#!/bin/sh

#HOST=/home/august/ew-host/host
#HOST=/usr/bin/host
#HOST=/usr/pd/bin/host

HOST=/usr/bin/host

TARGET=$1


# Check to see if it's host from BIND or Erik Wassenaar's host.

if [ `$HOST 2>&1 | grep "Extended usage" | wc -l` = 1 ]
then
	HOSTVER=EW
elif [ `$HOST 2>&1 | grep "enables TCP/IP mode" | wc -l` = 1 ]
then
	HOSTVER=BIND
else
	HOSTVER=unknown
fi

#echo "host variant is: $HOSTVER"



case $HOSTVER in

BIND)
	#while target contains a dot.
	while [ `echo $TARGET | cut -s -f1- -d.` ]
	do
		# echo $TARGET
		RESPONSE=`$HOST -t LOC $TARGET`

		if [ $? = 0 ] && [ -n "$RESPONSE" ]
		then
			NF=`echo $RESPONSE |egrep "has no LOC" | wc -l`
			if [ $NF = 0 ]
			then
				echo "$(echo $RESPONSE|cut -d" " -f1) LOC $(echo $RESPONSE|cut -d" " -f3,4,5,6,7,8,9,10,11,12,13,14)"
				exit
			else
			:
			fi
		fi
		TARGET=`echo $TARGET  | cut -s -f2- -d.`
	done
	echo "Nothing"
	;;

EW)
	while [ `echo $TARGET | cut -s -f1- -d.` ]
	do
		STRING="$STRING $TARGET"

                TARGET=`echo $TARGET  | cut -s -f2- -d.`
	done
	#echo $STRING

        if test -z "$STRING" ;
        then
            STRING=$TARGET
        fi

	echo `$HOST -t LOC -x $STRING`
	;;
esac

Reply via email to