mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net: fix dial to raw IP networks on Windows
Also avoids platform-dependent datagram truncation in raw IP tests. At least it's different between Windows and others. Fixes #6122. R=alex.brainman CC=golang-dev https://golang.org/cl/12843043
This commit is contained in:
parent
910a6faa93
commit
180da80e90
3 changed files with 51 additions and 23 deletions
|
|
@ -176,9 +176,11 @@ func TestIPConnSpecificMethods(t *testing.T) {
|
|||
switch runtime.GOOS {
|
||||
case "plan9":
|
||||
t.Skipf("skipping test on %q", runtime.GOOS)
|
||||
}
|
||||
if os.Getuid() != 0 {
|
||||
t.Skipf("skipping test; must be root")
|
||||
case "windows":
|
||||
default:
|
||||
if os.Getuid() != 0 {
|
||||
t.Skipf("skipping test; must be root")
|
||||
}
|
||||
}
|
||||
|
||||
la, err := ResolveIPAddr("ip4", "127.0.0.1")
|
||||
|
|
@ -208,7 +210,7 @@ func TestIPConnSpecificMethods(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("icmpMessage.Marshal failed: %v", err)
|
||||
}
|
||||
rb := make([]byte, 20+128)
|
||||
rb := make([]byte, 20+len(wb))
|
||||
if _, err := c.WriteToIP(wb, c.LocalAddr().(*IPAddr)); err != nil {
|
||||
t.Fatalf("IPConn.WriteToIP failed: %v", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue