[go-nuts] Imp.ListenPacket fail for IPv6 address

2019-10-09 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
Hello, Here is the part of code where I attempt to listen for icmp packet in a namespace. The same code is used for IPv4 and IPv6, only proto and scr are differ depending on ipv4 or ipv6 mode. For IPv4 address code work as expected but for IPv6 ListenPacket fails. org, err :=

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-26 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
Hi Jake, Ioctl implementation in unix package seems a bit limited, how do you pass for example a required struct if “func IoctlSetInt(fd int, req uint, value int)” allows only to accept int?? If this package had a func accepting uintptr as a parameter, then I guess that could work. Thank you

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
I copied the whole thing to https://github.com/sbezverk/vfio Running it without actual vfio/iommu might be problematic though. Before this specific ioctl can be run 2 open calls must succeed. See func main. Thank you for looking into this problem Serguei Sent from my iPhone > On Aug 23, 2018,

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
Hello Jake, Apologies about formatting, here is correctly formatted code: // GetGroupFD gets File descriptor for a specified by PCI address device func GetGroupFD(group int, pciDevice string) (int, error) { buffer := make([]byte, len(pciDevice)+1) for i, c :=

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
I changed code a little bit to be able to examine variables: func GetGroupFD(group int, pciDevice *string) (int, error) { ioctlId := 0x3b6a var buffer uintptr buffer = uintptr(unsafe.Pointer(pciDevice)) device, _, errno := syscall.Syscall( syscall.SYS_IOCTL,

[go-nuts] Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
Hello, I am converting some C code to Go and hit an issue with one particular Syscall: In C: device = ioctl(group, 0x3b6a, path); where path is char[N] In Go: ioctlId := 0x3b6a device, _, errno := syscall.Syscall( syscall.SYS_IOCTL, uintptr(group),