Last active
August 21, 2020 02:40
-
-
Save Rand01ph/b507aa543970362abaee95113667d9fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test/images/regression-issue-74839/main.go b/test/images/regression-issue-74839/main.go | |
index 2d46da95493..516abae09dc 100644 | |
--- a/test/images/regression-issue-74839/main.go | |
+++ b/test/images/regression-issue-74839/main.go | |
@@ -51,12 +51,12 @@ func main() { | |
func probe(ip string) { | |
log.Printf("probing %v", ip) | |
- ipAddr, err := net.ResolveIPAddr("ip4:tcp", ip) | |
+ ipAddr, err := net.ResolveIPAddr("ip:tcp", ip) | |
if err != nil { | |
panic(err) | |
} | |
- conn, err := net.ListenIP("ip4:tcp", ipAddr) | |
+ conn, err := net.ListenIP("ip:tcp", ipAddr) | |
if err != nil { | |
panic(err) | |
} | |
@@ -118,12 +118,18 @@ func probe(ip string) { | |
} | |
func getIP() net.IP { | |
- conn, err := net.Dial("udp", "8.8.8.8:53") | |
+ var err error | |
+ var conn net.Conn | |
+ for _, publicIP := range[]string{"[2001:4860:4860::8888]:53", "8.8.8.8:53"} { | |
+ conn, err = net.Dial("udp", publicIP) | |
+ if err != nil { | |
+ continue | |
+ } | |
+ conn.Close() | |
+ } | |
if err != nil { | |
log.Fatal(err) | |
} | |
- defer conn.Close() | |
- | |
localAddr := conn.LocalAddr().(*net.UDPAddr) | |
return localAddr.IP | |
diff --git a/test/images/regression-issue-74839/tcp.go b/test/images/regression-issue-74839/tcp.go | |
index c0ca067a47e..aac51b5f31e 100644 | |
--- a/test/images/regression-issue-74839/tcp.go | |
+++ b/test/images/regression-issue-74839/tcp.go | |
@@ -136,8 +136,13 @@ func checksumTCP(src, dest net.IP, tcpHeader, data []byte) uint16 { | |
chk := &tcpChecksumer{} | |
// Encode pseudoheader. | |
- chk.add(src.To4()) | |
- chk.add(dest.To4()) | |
+ if src.To4() == nil{ | |
+ chk.add(src) | |
+ chk.add(dest) | |
+ } else { | |
+ chk.add(src.To4()) | |
+ chk.add(dest.To4()) | |
+ } | |
var pseudoHeader [4]byte | |
pseudoHeader[1] = tcpProtoNum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment