Think I found it myself.
There seems to be a bug in Synapse when mapping the ICMP response. The bytes are shifted by two, only IPV6 is affected.
This code works:
PingResultEdit.Text := Format('Success, RTT=%dms (%dms)', [PingSend.PingTime SHR 16,ms]);
The result is: "Success, RTT=40ms (31ms)", which makes perfect sense to me.
I'll try to bring this issue to the attention of the Synapse team.
(curiousity took over ... after some research, this is my theory)
The bug lies in pingsend function TPINGSend.InternalPingIpHlp, line 614. (Here: Line 8.)
if pingIp6 then
begin
FillChar(ip6, sizeof(ip6), 0);
r := Icmp6SendEcho2(PingHandle, nil, nil, nil, @ip6, @Fsin,
PAnsichar(FBuffer), length(FBuffer), @ipo, pAnsichar(RBuff), length(RBuff), FTimeout);
if r > 0 then
begin
// --> RBuff := #0 + #0 + RBuff; <--
ip6reply := PICMPV6_ECHO_REPLY(pointer(RBuff));
FPingTime := ip6reply^.RoundTripTime;
ip6reply^.Address.sin6_family := AF_INET6;
FReplyFrom := GetSinIp(TVarSin(ip6reply^.Address));
TranslateErrorIpHlp(ip6reply^.Status);
Result := True;
end;
end
RBuff := #0 + #0 + RBuff; shifts the whole buffer by two bytes. I don't see any reason for this, maybe the author meant to code RBuff := RBuff + #0 + #0; to terminate the string. if I comment out his line, ping works flawlessly with IPV6. Since I don't like to compile my projects with modified libraries, I finally filed a bug in the Synapse Bugtracker (
https://sourceforge.net/p/synalist/bugs/71/), and made this workaround:
procedure TForm1.DoPingSuccess(const aPingSender: TPingSend);
var pt: LongInt;
begin
pt := aPingSender.PingTime;
// Synapse V40 bug? IPV6 PingTime seems to be shifted left by 2 bytes.
// A RTT of more than 65.5 seconds seems impossible
// trying to workaround the bug by reversing the shift
if pt > $FFFF then
pt := pt SHR 16;
PingResultEdit.Text := Format('Success, RTT=%dms', [pt]);
RTTListChartSource.Add(now,pt);
end;
This gives me the results shown in the attachment.
Armin.