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

net: ListenIP doesn't support Linux-specific ICMP echo-only socket #9166

Closed
fxkr opened this issue Nov 25, 2014 · 7 comments
Closed

net: ListenIP doesn't support Linux-specific ICMP echo-only socket #9166

fxkr opened this issue Nov 25, 2014 · 7 comments

Comments

@fxkr
Copy link

fxkr commented Nov 25, 2014

I want to open a ping socket, but I can't because
`net.ListenIP("ip4:icmp", ...)`[1] always uses type=SOCK_RAW. However,
for "ip4:icmp" / "ip6:ipv6-icmp" it should use type=SOCK_DGRAM.

I also can't work around it by using `net.ListenUDP` because that
always uses proto=0 (= default = UDP for SOCK_DGRAM). 

[1] https://code.google.com/p/go/source/browse/src/net/iprawsock_posix.go
@mikioh
Copy link
Contributor

mikioh commented Nov 26, 2014

Comment 1:

Thanks but no thanks. it's a protocol stack inside Linux kernel specific feature, also
it cannot receive/send other ICMP type messages. You can make your Linux+ICMP
echo-specific socket using syscall.Socket and make it run with runtime-integrated
network poller by using net.FilePacketConn.

Labels changed: added repo-main.

Status changed to Unfortunate.

@mikioh
Copy link
Contributor

mikioh commented Nov 26, 2014

Comment 2:

> You can make your Linux+ICMP echo-specific socket...
if it doesn't work well, please open a new issue.

@mikioh
Copy link
Contributor

mikioh commented Nov 26, 2014

Comment 3:

> if it doesn't work well, please open a new issue.
fyi: it works well. see attached.

Attachments:

  1. pingsock.go (1664 bytes)

@fxkr
Copy link
Author

fxkr commented Nov 26, 2014

Comment 4:

Ok, thanks!

@gopherbot
Copy link

Comment 5:

CL https://golang.org/cl/182110043 mentions this issue.

@mikioh
Copy link
Contributor

mikioh commented Dec 3, 2014

Comment 6:

This issue was updated by revision golang/net@fc168c3.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/182110043

@mikioh
Copy link
Contributor

mikioh commented Dec 3, 2014

Comment 7:

fwiw, now golang.org/x/net/icmp supports non-privileged datagram-oriented icmp socket.
see http://godoc.org/golang.org/x/net/icmp for further information.

@mikioh mikioh removed the Unfortunate label May 2, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
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

3 participants