# Weird ping result

## Herring42

I'm a bit worried about my desktop computer. running ping on my server address resolves to a different IP than running dig:

```

%% ping beth.wright-family.me.uk.

PING wright-family.me.uk (42.1.3.72) 56(84) bytes of data.

^C

--- wright-family.me.uk ping statistics ---

3 packets transmitted, 0 received, 100% packet loss, time 1999ms

```

```

%% dig beth.wright-family.me.uk

; <<>> DiG 9.7.3 <<>> beth.wright-family.me.uk

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57425

;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 4

;; QUESTION SECTION:

;beth.wright-family.me.uk.      IN      A                                                                                                               

                                                                                                                                                        

;; ANSWER SECTION:                                                                                                                                      

beth.wright-family.me.uk. 907   IN      CNAME   wright-family.me.uk.                                                                                    

wright-family.me.uk.    2124    IN      A       93.89.130.2

;; AUTHORITY SECTION:

wright-family.me.uk.    907     IN      NS      ns1.silverfish-design.co.uk.

wright-family.me.uk.    907     IN      NS      ns2.silverfish-design.co.uk.

;; ADDITIONAL SECTION:

ns1.silverfish-design.co.uk. 907 IN     A       178.79.141.144

ns1.silverfish-design.co.uk. 907 IN     AAAA    2a01:348:6:45e::2

ns2.silverfish-design.co.uk. 907 IN     A       93.89.130.2

ns2.silverfish-design.co.uk. 907 IN     AAAA    2a02:390:674c:aa::1

;; Query time: 1 msec

;; SERVER: 2a01:348:2ff:aa::1#53(2a01:348:2ff:aa::1)

;; WHEN: Tue Sep  6 11:22:35 2011

;; MSG SIZE  rcvd: 217

```

ping6 resolves correctly, and the reason ping has 100% traffic loss is that I'm completely blocking all access to 42.0.0.0/8

Anyone got any idea what's going on?

----------

## chiefbag

You have an extra "." at the end of "uk" in your ping test, perhaps this is your issue.

```
ping beth.wright-family.me.uk. 
```

----------

## Herring42

 *chiefbag wrote:*   

> You have an extra "." at the end of "uk" in your ping test, perhaps this is your issue.
> 
> ```
> ping beth.wright-family.me.uk. 
> ```
> ...

 

Nope! It shouldn't make a difference, (nor does it), as a trailing dot indicates it is a fully qualified domain name, rather than something that can have a domain path added.

----------

## m0p

The first thing that comes to mind when something is mysteriously resolving to China is there is a compromise somewhere. Wouldn't really be sure where to start. Do ping and dig use the same method of resolving? Is 42.0.0.0/8 blocked on your router as well, perhaps somebody nasty could have gotten into that?

Here's what I get:

```
PING wright-family.me.uk (93.89.130.2) 56(84) bytes of data.

64 bytes from cust2-dsl93-89-130.idnet.net (93.89.130.2): icmp_req=1 ttl=51 time=26.7 ms
```

...and so on.

----------

## darkphader

A possible stale record for beth.wright-family.me.uk in your hosts file?

----------

## Herring42

 *m0p wrote:*   

> The first thing that comes to mind when something is mysteriously resolving to China is there is a compromise somewhere. Wouldn't really be sure where to start. Do ping and dig use the same method of resolving? Is 42.0.0.0/8 blocked on your router as well, perhaps somebody nasty could have gotten into that?
> 
> 

 

Its my router where I'm blocking it!

Weirdly, firefox, ssh etc all connect to the correct box.

 *m0p wrote:*   

> 
> 
> Here's what I get:
> 
> ```
> ...

 

That's correct, and what I get from various servers I control.

----------

## Herring42

 *darkphader wrote:*   

> A possible stale record for beth.wright-family.me.uk in your hosts file?

 

Thank you, but no. I haven't modified /etc/hosts

----------

## Herring42

And /etc/nsswitch.conf looks ok...

----------

## m0p

Do you get that result when you ping any other hosts? Maybe some kind of attempted MITM? It can't just be something innocent.

----------

## Herring42

 *m0p wrote:*   

> Do you get that result when you ping any other hosts? Maybe some kind of attempted MITM? It can't just be something innocent.

 

As follows:

```

ping www.bbc.co.uk

PING www.bbc.net.uk (212.58.244.66) 56(84) bytes of data.

64 bytes from bbc-vip111.telhc.bbc.co.uk (212.58.244.66): icmp_req=1 ttl=57 time=7.46 ms

ping www.xkcd.net

PING xkcd.net (72.26.203.99) 56(84) bytes of data.

64 bytes from 72.26.203.99: icmp_req=1 ttl=54 time=82.7 ms

ping www.theregister.co.uk

PING www.theregister.co.uk (127.0.0.1) 56(84) bytes of data.

64 bytes from localhost.localdomain (127.0.0.1): icmp_req=1 ttl=64 time=0.066 ms

```

*WRONG*

The weird thing is that firefox works ok...

----------

## Herring42

Ok, now this is very odd!

I think it is a bug in ping.

I used wireshark to capture the lan traffic, and I saw a DNS request for an AAAA record for beth.wright-family.me.uk

The first four bytes of its ipv6 address are: 2a 01 03 48 (hex) that translates to: 42.1.3.72

Are you surprised, because I was!!

So why is ping (the non ipv6 version) requesting the ipv6 address, and then mistakenly treating it as an ipv4 address?

Is it some resolver library, or ping itself? Does anyone know any way of telling?

----------

## darkphader

Have you tried rebuilding net-misc/iputils?

Is your system and toolchain in sync (toolchain has built itself and then the system)?

----------

## Hu

DNS resolution is usually handled by sys-libs/glibc.  Could you post the output of emerge --info sys-libs/glibc net-misc/iputils?

----------

## Herring42

I've just run emerge -e @system , but the problem is still there...

# emerge --info sys-libs/glibc net-misc/iputils

```

Portage 2.2.0_alpha53 (default/linux/amd64/10.0/desktop/kde, gcc-4.5.3, glibc-2.12.2-r0, 3.0.3-gentoo x86_64)

=================================================================

                        System Settings

=================================================================

System uname: Linux-3.0.3-gentoo-x86_64-AMD_Athlon-tm-_II_X4_620_Processor-with-gentoo-2.0.3

Timestamp of tree: Tue, 06 Sep 2011 01:15:01 +0000

distcc 3.1 x86_64-pc-linux-gnu [disabled]

app-shells/bash:          4.1_p9

dev-java/java-config:     2.1.11-r3

dev-lang/python:          2.6.6-r2, 2.7.1-r1, 3.1.3-r1, 3.2

dev-util/cmake:           2.8.4-r1

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.0.3

sys-apps/openrc:          0.8.3-r1

sys-apps/sandbox:         2.4

sys-devel/autoconf:       2.13, 2.68

sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1

sys-devel/binutils:       2.21.1-r1

sys-devel/gcc:            4.4.5, 4.5.3-r1

sys-devel/gcc-config:     1.4.1-r1

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82-r1

sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)

sys-libs/glibc:           2.12.2

Repositories:

gentoo

    location: /usr/portage

    sync: rsync://beth.wright-family.me.uk/gentoo-portage

    priority: -1000

sunrise

    location: /usr/local/portage/layman/sunrise

    masters: gentoo

    priority: 0

xwing

    location: /usr/local/portage/layman/xwing

    masters: gentoo                                                                                                                                     

    priority: 1                                                                                                                                         

                                                                                                                                                        

pentoo                                                                                                                                                  

    location: /usr/local/portage/layman/pentoo

    masters: gentoo

    priority: 2

x11

    location: /usr/local/portage/layman/x11

    masters: gentoo

    priority: 3

qting-edge

    location: /usr/local/portage/layman/qting-edge

    masters: gentoo

    priority: 4

kde

    location: /usr/local/portage/layman/kde

    masters: gentoo

    priority: 5

mozilla

    location: /usr/local/portage/layman/mozilla

    masters: gentoo

    priority: 6

c1pher

    location: /usr/local/portage/layman/c1pher

    masters: gentoo

    priority: 7

bazaar

    location: /usr/local/portage/layman/bazaar

    masters: gentoo

    priority: 8

zugaina

    location: /usr/local/portage/layman/zugaina

    masters: gentoo

    priority: 9

betagarden

    location: /usr/local/portage/layman/betagarden

    masters: gentoo

    priority: 10

Alexander

    location: /usr/local/portage/alexander

    masters: gentoo

    priority: 11

Installed sets: 

ABI="amd64"

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="*"

ACCEPT_PROPERTIES="*"

ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci"

ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol"

ANDROID_SWT="/usr/share/swt-3.5/lib"

ANT_HOME="/usr/share/ant"

APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias"

ARCH="amd64"

ASFLAGS_x86="--32"

AUTOCLEAN="yes"

CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump"

CAMERAS="ptp2"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=athlon64 -O2 -pipe"

CFLAGS_x86="-m32"

CHOST="x86_64-pc-linux-gnu"

CHOST_amd64="x86_64-pc-linux-gnu"

CHOST_x86="i686-pc-linux-gnu"

CLEAN_DELAY="5"

COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"

COLLISION_IGNORE="/lib/modules"

CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/maven-bin-2.2/conf /usr/share/maven-bin-3.0/conf /var/lib/hsqldb"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=athlon64 -O2 -pipe"

DCCC_PATH="/usr/lib64/distcc/bin"

DEFAULT_ABI="amd64"

DISPLAY=":0"

DISTCC_LOG=""

DISTCC_VERBOSE=""

DISTDIR="/usr/portage/distfiles"

ELIBC="glibc"

EMERGE_DEFAULT_OPTS="--verbose --keep-going --accept-properties=-interactive --jobs=4 --load-average=8  --with-bdeps y --autounmask=n"

EMERGE_WARNING_DELAY="10"

EPREFIX=""

EROOT="/"

FCFLAGS=""

FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FETCHCOMMAND="/usr/bin/wget --prefer-family=IPv6 -t 5 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""

FETCHCOMMAND_RSYNC="rsync -avP "${URI}" "${DISTDIR}/${FILE}""

FETCHCOMMAND_SFTP="bash -c "x=\${2#sftp://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port=22 ; exec sftp -P \${port} \"\${host}:/\${x#*/}\" \"\$1\"" sftp "${DISTDIR}/${FILE}" "${URI}""

FETCHCOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port=22 ; exec rsync --rsh=\"ssh -p\${port}\" -avP \"\${host}:/\${x#*/}\" \"\$1\"" rsync "${DISTDIR}/${FILE}" "${URI}""

FFLAGS=""

FRACTDIR="/usr/share/xfractint"

GCC_SPECS=""

GDK_USE_XFT="1"

GENTOO_MIRRORS="http://www.wright-family.me.uk/ http://gentoo.mneisen.org/ http://gentoo.tiscali.nl/ http://de-mirror.org/distro/gentoo/ http://gentoo.prz.rzeszow.pl"

GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx"

GRUB_PLATFORMS=""

GSETTINGS_BACKEND="gconf"

HG="/usr/bin/hg"

HOME="/root"

INFOPATH="/usr/share/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.21.1/info:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.3/info"

INPUT_DEVICES="evdev"

JAVACC_HOME="/usr/share/javacc/"

KERNEL="linux"

LANG="en_GB.UTF-8"

LANGUAGE=""

LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LDFLAGS_x86="-m elf_i386"

LESS="-R -M --shift 5"

LESSOPEN="|lesspipe %s"

LIBDIR_amd64="lib64"

LIBDIR_amd64_fbsd="lib64"

LIBDIR_ppc="lib32"

LIBDIR_ppc64="lib64"

LIBDIR_s390="lib32"

LIBDIR_s390x="lib64"

LIBDIR_sparc32="lib32"

LIBDIR_sparc64="lib64"

LIBDIR_x86="lib32"

LIBDIR_x86_fbsd="lib32"

LINGUAS="en_GB en"

LOGNAME="root"

LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.patch=00;32:*.diff=00;32:*.log=00;32:*.tex=00;32:*.doc=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:"

MAIL="/var/mail/root"

MAKEOPTS="-j5"

MANPATH="/usr/local/share/man:/usr/share/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.21.1/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.3/man:/etc/java-config/system-vm/man/"

MULTILIB_ABIS="amd64 x86"

MULTILIB_STRICT_DENY="64-bit.*shared object"

MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib"

MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage|udev)"

NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml"

NETBEANS_MODULES="apisupport php mobility ide websvccommon enterprise harness java profiler nb"

OPENGL_PROFILE="xorg-x11"

PATH="/sbin:/bin:/usr/sbin:/usr/bin"

PHP_TARGETS="php5-3"

PKGDIR="/usr/portage/packages"

PORTAGE_ARCHLIST="ppc sparc64-freebsd ppc-openbsd x86-openbsd ppc64 x86-winnt x86-fbsd ppc-aix alpha arm x86-freebsd s390 amd64 arm-linux x86-macos x64-openbsd ia64-hpux hppa x86-netbsd x86-cygwin amd64-linux ia64-linux x86 sparc-solaris x64-freebsd sparc64-solaris x86-linux x64-macos sparc m68k-mint ia64 mips ppc-macos x86-interix hppa-hpux amd64-fbsd x64-solaris mips-irix m68k sh x86-solaris sparc-fbsd"

PORTAGE_BINHOST_CHUNKSIZE="3000"

PORTAGE_BIN_PATH="/usr/lib64/portage/bin"

PORTAGE_COMPRESS_EXCLUDE_SUFFIXES="css gif htm[l]? jp[e]?g js pdf png"

PORTAGE_CONFIGROOT="/"

PORTAGE_DEBUG="0"

PORTAGE_DEPCACHEDIR="/var/cache/edb/dep"

PORTAGE_ELOG_CLASSES="log warn error"

PORTAGE_ELOG_MAILFROM="portage@path.wright-family.me.uk"

PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for ${PACKAGE} on ${HOST}"

PORTAGE_ELOG_MAILURI="root@wright-family.me.uk mail.wright-family.me.uk"

PORTAGE_ELOG_SYSTEM="save_summary mail_summary"

PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS="5"

PORTAGE_FETCH_RESUME_MIN_SIZE="350K"

PORTAGE_GID="250"

PORTAGE_GPG_SIGNING_COMMAND="gpg --sign --clearsign --yes --default-key "${PORTAGE_GPG_KEY}" --homedir "${PORTAGE_GPG_DIR}" "${FILE}""

PORTAGE_INST_GID="0"

PORTAGE_INST_UID="0"

PORTAGE_IONICE_COMMAND="ionice -c 3 -p ${PID}"

PORTAGE_NICENESS="15"

PORTAGE_PYM_PATH="/usr/lib64/portage/pym"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_RSYNC_RETRIES="-1"

PORTAGE_SANDBOX_COMPAT_LEVEL="22"

PORTAGE_SYNC_STALE="30"

PORTAGE_TMPDIR="/var/tmp"

PORTAGE_VERBOSE="1"

PORTAGE_WORKDIR_MODE="0700"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage/layman/sunrise /usr/local/portage/layman/xwing /usr/local/portage/layman/pentoo /usr/local/portage/layman/x11 /usr/local/portage/layman/qting-edge /usr/local/portage/layman/kde /usr/local/portage/layman/mozilla /usr/local/portage/layman/c1pher /usr/local/portage/layman/bazaar /usr/local/portage/layman/zugaina /usr/local/portage/layman/betagarden /usr/local/portage/alexander"

PORT_LOGDIR="/var/log/portage"

PORT_LOGDIR_CLEAN="find "${PORT_LOGDIR}" -type f ! -name "summary.log*" -mtime +7 -delete"

PRELINK_PATH_MASK="/usr/lib64/libfreebl3.so:/usr/lib64/libnssdbm3.so:/usr/lib64/libsoftokn3.so"

PROFILE_ONLY_VARIABLES="ARCH ELIBC KERNEL USERLAND"

PWD="/home/alexander"

PYTHONDONTWRITEBYTECODE="1"

QEMU_SOFTMMU_TARGETS="i386 x86_64"

QEMU_USER_TARGETS="x86_64 i386"

QT_PLUGIN_PATH="/usr/lib64/kde4/plugins"

RESUMECOMMAND="/usr/bin/wget --prefer-family=IPv6 -c -t 5 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""

RESUMECOMMAND_RSYNC="rsync -avP "${URI}" "${DISTDIR}/${FILE}""

RESUMECOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port=22 ; exec rsync --rsh=\"ssh -p\${port}\" -avP \"\${host}:/\${x#*/}\" \"\$1\"" rsync "${DISTDIR}/${FILE}" "${URI}""

ROOT="/"

ROOTPATH="/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3"

RPMDIR="/usr/portage/rpm"

RUBY_TARGETS="ruby18"

R_HOME="/usr/lib64/R"

SANE_CONFIG_DIR="/etc/sane.d"

SHELL="/bin/bash"

SHLVL="1"

STAGE1_USE="multilib nptl nptlonly unicode"

SUDO_COMMAND="/bin/su"

SUDO_GID="1111"

SUDO_UID="1100"

SUDO_USER="alexander"

SYMLINK_LIB="yes"

SYNC="rsync://beth.wright-family.me.uk/gentoo-portage"

TERM="xterm"

USB_DEVFS_PATH="/dev/bus/usb"

USE="3dnow 3dnowext X a52 aac acl acpi addressbook aim akonadi alsa amd64 apm audiofile autoipd avahi bash-completion berkdb bluetooth bonjour branding bzip2 cairo calendar caps captury cdaudio cdb cdda cddax cddb cdio cdparanoia cdr chroot clamav clamd cleartype cli clucene consolekit corefonts cpudetection cracklib crypt cups cxx dbus declarative device-mapper dri dts dvb dvd dvdr emboss enca encode exif fam ffmpeg firefox flac fontconfig fortran gallium gcrypt gdbm gdu geoip geolocation gif git gnutls google-gadgets gphoto2 gpm gstreamer gtk hdri ical icons iconv id3 id3tag ieee1394 imagemagick imap inkjar innodb inotify ipv6 java java5 java6 jpeg jpeg2k kde kipi lame lcms ldap lensfun libnotify mad mdnsresponder-compat mmx mng modules mp3 mp4 mpeg mudflap multilib ncurses networkmanager nls nptl nptl-only nptlonly nsplugin ogg openal openexr opengl openmp optimization pam pango pcap pch pcre pdf perl phonon plasma png policykit ppds pppd python qt-dbus qt-webkit qt3support qt4 quicktime raw readline rss rtsp scanner sdl semantic-desktop sensord session sha512 smp spell sqlite sqlite3 sse sse2 sse3 ssl ssse3 startup-notification strong-optimization subversion svg sysfs syslog system-sqlite tcpd threads threadsafe thumbnail tidy tiff truetype type1 udev unicode urandom usb v4l v4l2 vorbis webkit x264 xcb xcomposite xinerama xml xorg xscreensaver xulrunner xv xvid zeroconf zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB en" NETBEANS_MODULES="apisupport php mobility ide websvccommon enterprise harness java profiler nb" PHP_TARGETS="php5-3" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="x86_64 i386" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="r600 radeon vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

USER="root"

USERLAND="GNU"

USERNAME="root"

USE_EXPAND="ALSA_CARDS ALSA_PCM_PLUGINS APACHE2_MODULES APACHE2_MPMS CALLIGRA_FEATURES CAMERAS COLLECTD_PLUGINS CROSSCOMPILE_OPTS DRACUT_MODULES DVB_CARDS ELIBC FCDSL_CARDS FOO2ZJS_DEVICES FRITZCAPI_CARDS GPSD_PROTOCOLS GRUB_PLATFORMS INPUT_DEVICES KERNEL LCD_DEVICES LINGUAS LIRC_DEVICES MISDN_CARDS NETBEANS_MODULES NGINX_MODULES_HTTP NGINX_MODULES_MAIL OFED_DRIVERS PHP_TARGETS QEMU_SOFTMMU_TARGETS QEMU_USER_TARGETS RUBY_TARGETS SANE_BACKENDS USERLAND VIDEO_CARDS XFCE_PLUGINS XTABLES_ADDONS"

USE_EXPAND_HIDDEN="CROSSCOMPILE_OPTS ELIBC KERNEL USERLAND"

USE_ORDER="env:pkg:conf:defaults:pkginternal:repo:env.d"

VBOX_APP_HOME="/opt/VirtualBox"

VIDEO_CARDS="r600 radeon vesa"

XDG_CONFIG_DIRS="/etc/xdg"

XDG_DATA_DIRS="/usr/local/share:/usr/share"

XSESSION="KDM-4"

XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

_="/usr/bin/emerge"

=================================================================

                        Package Settings

=================================================================

sys-libs/glibc-2.12.2 was built with the following:

USE="(consolekit) (multilib) nls (policykit) -debug -gd -glibc-omitfp (-hardened) -profile (-selinux) -vanilla"

CFLAGS="-march=athlon64 -pipe -O2 -fno-strict-aliasing"

CXXFLAGS="-march=athlon64 -pipe -O2 -fno-strict-aliasing"

net-misc/iputils-20101006-r1 was built with the following:

USE="(consolekit) ipv6 (multilib) (policykit) ssl -SECURITY_HAZARD -doc -idn -static"

```

----------

## krinn

Might just be because your DNS resolver is an IPV6 IP and when you're running ping in IPV4 version that DNS server cannot be reach and the packets lost you are seeing are not as you are thinking because they are block from your router, but real answer from ping that is telling you it cannot reach it.

```
;; SERVER: 2a01:348:2ff:aa::1#53(2a01:348:2ff:aa::1)
```

And if you notice your DNS IPV6 address is .... 2a010348 --> 42.1.3.72

----------

## Herring42

As I've mentioned above, I've run a packet capture and analysis using wireshark.

The question is, why is ping interpreting it as an ipv4 address? There is a bug somewhere...

----------

## krinn

because ping is using ipv4 version and ping6 is the one for ipv6 you'll have a bug if they would have done ping with an --ipv4/6 option in it, or no option but handling 4&6 within ping with some autofinding of the IPv

But they have done 2 versions, one for 4 and one for 6, as long as 6 is working with ipv6 and 4 with ipv4 you can't really tell there's a bug, and having ping failing with an ipv6 server isn't then a bug, just a missuse of the tool  :Razz: 

----------

## Hu

 *krinn wrote:*   

> because ping is using ipv4 version and ping6 is the one for ipv6 you'll have a bug if they would have done ping with an --ipv4/6 option in it, or no option but handling 4&6 within ping with some autofinding of the IPv
> 
> But they have done 2 versions, one for 4 and one for 6, as long as 6 is working with ipv6 and 4 with ipv4 you can't really tell there's a bug, and having ping failing with an ipv6 server isn't then a bug, just a missuse of the tool 

 The user cannot know in advance whether a hostname given to ping will have an A record, a AAAA record, or both.  It is a bug if giving a name which has both A and AAAA causes ping to take part of the AAAA and treat it as an A.  The only question is whether the bug is in sys-libs/glibc, net-misc/iputils, or an interaction of the two.

----------

## krinn

i don't know, wget was doing that too, and this appears in wget/ping after a glibc update, so i suppose it's glibc to blame.

The difference is that i think they fix wget because it have a switch to still force ipv6/4 (the -6 -4) but could be run per default without telling it the mode and should detect the version.

It's not the case for ping and ping6 that are separate and design to work for ipv4 and the other ipv6.

And this could also appears because of the system when ipv6 is encapsulate in ipv4 some routers gets mad

----------

## Hu

After checking the source of ping, I believe ping has the bug:

```
   253                          hp = gethostbyname(target);

   254                          if (!hp) {

   255                                  fprintf(stderr, "ping: unknown host %s\n", target);

   256                                  exit(2);

   257                          }

   258                          memcpy(&whereto.sin_addr, hp->h_addr, 4);

```

The code assumes that a successful host lookup returns an A record as the first field.  It ought to check that h_addrtype is AF_INET, but it does not.  If it cares about obtaining only A records, it ought to use getaddrinfo, which is more flexible and allows you to specify that via hints.

----------

## Herring42

Thanks for finding that, its put my mind at rest.

Would you like to submit a bug report, or shall I?

 :Smile: 

----------

## Hu

Go ahead.  You have the test case for it.

----------

