This commit is contained in:
crusader 2018-09-17 20:45:49 +09:00
parent 79fc4eaac4
commit 2423d92777

View File

@ -49,6 +49,7 @@ func (o *PingOptions) Validate() {
// 64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.344 ms // 64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.344 ms
// 64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.163 ms // 64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.163 ms
// 64 bytes from 192.168.1.1: icmp_seq=7 ttl=64 time=0.180 ms // 64 bytes from 192.168.1.1: icmp_seq=7 ttl=64 time=0.180 ms
// From 192.168.1.101 icmp_seq=1 Destination Host Unreachable
// --- 192.168.1.1 ping statistics --- // --- 192.168.1.1 ping statistics ---
// 7 packets transmitted, 4 received, 42% packet loss, time 6010ms // 7 packets transmitted, 4 received, 42% packet loss, time 6010ms
@ -93,6 +94,10 @@ LOOP:
result.Summary.AvgTime = float32(avgTime) result.Summary.AvgTime = float32(avgTime)
case 8: case 8:
if "bytes" != fields[1] || "from" != fields[2] {
continue LOOP
}
seqs := strings.Split(fields[4], "=") seqs := strings.Split(fields[4], "=")
ttls := strings.Split(fields[5], "=") ttls := strings.Split(fields[5], "=")
times := strings.Split(fields[6], "=") times := strings.Split(fields[6], "=")
@ -189,7 +194,7 @@ LOOP:
if "Request timed out." != line { if "Request timed out." != line {
continue LOOP continue LOOP
} }
result.Responses[seq] = nil // result.Responses[seq] = nil
seq = seq + 1 seq = seq + 1
case 6: case 6:
if "Reply" != fields[0] || "from" != fields[1] { if "Reply" != fields[0] || "from" != fields[1] {
@ -332,6 +337,10 @@ LOOP:
result.Summary.AvgTime = float32(avgTime) result.Summary.AvgTime = float32(avgTime)
case 8: case 8:
if "bytes" != fields[1] || "from" != fields[2] {
continue LOOP
}
seqs := strings.Split(fields[4], "=") seqs := strings.Split(fields[4], "=")
ttls := strings.Split(fields[5], "=") ttls := strings.Split(fields[5], "=")
times := strings.Split(fields[6], "=") times := strings.Split(fields[6], "=")