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

use generic Go facilities to get a socket #16

Merged
merged 1 commit into from
Mar 8, 2018

Conversation

satta
Copy link
Contributor

@satta satta commented Mar 7, 2018

This PR uses syscall.Socket instead of the more low-level RawSyscall interface to obtain a socket descriptor. The former approach also works on i386, while the latter does not. See #15.
Closes #15.

fd, _, err := syscall.RawSyscall(syscall.SYS_SOCKET, syscall.AF_INET, syscall.SOCK_DGRAM, syscall.IPPROTO_IP)
if err != 0 {
return nil, syscall.Errno(err)
fd, err := syscall.Socket(syscall.AF_INET, syscall.SOCK_DGRAM, syscall.IPPROTO_IP)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I used low level syscall in order to limit the impact of the Go bug with namespaces see golang/go#20676

As it is fixed in 1.10 I think that OK now.

@safchain safchain merged commit 66d9c0a into safchain:master Mar 8, 2018
@satta satta deleted the netsocket branch March 8, 2018 07:50
algitbot pushed a commit to alpinelinux/aports that referenced this pull request May 13, 2019
Fail build on x86:
github.com/safchain/ethtool/ethtool.go:205:35: undefined: syscall.SYS_SOCKET

Applied patch as described here:
safchain/ethtool#16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants