Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/net/ipv4: PacketConn.SetControlMessage reflect.Value.Int on zero Value with go 1.9.2 #23257

Closed
ufm opened this issue Dec 27, 2017 · 4 comments

Comments

@ufm
Copy link

ufm commented Dec 27, 2017

1.9.2
linux/amd64

Simple program:

package main

import (
    "net"
    "fmt"
    "golang.org/x/net/ipv4"
)

func main() {
    conn, err := net.ListenPacket("udp4", "0.0.0.0:5004")
    if err != nil {
        fmt.Printf("ListenError: %s\n", err)
        return
    }
    pconn := ipv4.NewPacketConn(conn)
    if err = pconn.SetControlMessage(ipv4.FlagDst, true); err != nil {
        fmt.Printf("Set control error: %s\n", err)
        return
    }

    fmt.Printf("Complete\n")
}

compiled by 1.9.2 version I'm get:

panic: reflect: call of reflect.Value.Int on zero Value

goroutine 1 [running]:
reflect.Value.Int(0x0, 0x0, 0x0, 0x5240c4)
	/usr/local/go/src/reflect/value.go:914 +0x141
golang.org/x/net/ipv4.sysfd(0x5b9640, 0xc42000e030, 0xc42000e030, 0x5b9640, 0xc42000e030)
	/home/ufm/src/gocode/src/golang.org/x/net/ipv4/helper_unix.go:46 +0x196
golang.org/x/net/ipv4.(*payloadHandler).sysfd(0xc42007e160, 0x5b9640, 0xc42000e030, 0xc42007e140)
	/home/ufm/src/gocode/src/golang.org/x/net/ipv4/helper_unix.go:31 +0x5b
golang.org/x/net/ipv4.(*PacketConn).SetControlMessage(0xc42007e140, 0x4, 0xc42007e101, 0xc, 0x5b93a0)
	/home/ufm/src/gocode/src/golang.org/x/net/ipv4/endpoint.go:55 +0x4c
main.main()
	/home/ufm/src/master/src/2/some.go:16 +0xf3

Compiled by 1.8.5 work as expected:

ufm@vbu2 ~/src/master/src/2 $ ./some185
Complete

@bradfitz bradfitz changed the title call of reflect.Value.Int on zero Value on go 1.9.2 and x/net/ipv4 x/net/ipv4: PacketConn.SetControlMessage reflect.Value.Int on zero Value with go 1.9.2 Dec 27, 2017
@gopherbot gopherbot added this to the Unreleased milestone Dec 27, 2017
@bradfitz
Copy link
Contributor

I can't reproduce this. I see it succeed with Complete on linux/amd64 for Go 1.8, Go 1.9, and Go 1.10.

Please include more information: which git version of x/net do you have? What's your go version? (go version).

You deleted most of the bug template, but we do need all the information.

@bradfitz bradfitz added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 27, 2017
@mvdan
Copy link
Member

mvdan commented Dec 27, 2017

Cannot reproduce on neither tip nor 1.9.2 on linux/amd64. I have x/net version d866cfc389cec985d6fda2859936a575a55a3ab6.

@ianlancetaylor
Copy link
Contributor

You need to update your x/net/ipv4 package. You are using an old version that does not support 1.9.

@mikioh
Copy link
Contributor

mikioh commented Jan 5, 2018

Dup of #19209

@mikioh mikioh removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 5, 2018
@golang golang locked and limited conversation to collaborators Jan 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants