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

proposal: x/net/icmp: allow setting socket options on PacketConn #64382

Open
BarbarossaTM opened this issue Nov 25, 2023 · 0 comments
Open

proposal: x/net/icmp: allow setting socket options on PacketConn #64382

BarbarossaTM opened this issue Nov 25, 2023 · 0 comments
Labels
Milestone

Comments

@BarbarossaTM
Copy link

BarbarossaTM commented Nov 25, 2023

Proposal Details

Hi fellow Gophers,

I didn't find any open (or closed) issues for this, so

on a journey to add "VRF support" to ping_exporter, I followed the bread crumbs through go-ping and go/x/net/icmp.ListenPacket() to go/net.PacketConn.

It looks like currently there is no way - at least none I could find - to do a SETSOCKOPT(SO_BINDTODEV) on the underlying fd of this connection, or more specifically, to get access to the underlying fd to do so.

After a bit of further digging I found change 72810: net: add ListenConfig, Dialer.Control to permit socket opts before listen/dial from 2018 (related to #9661), which adds some methods to create a net.PacketConn based on a ListenConfig which seems to be close what I'm looking for, however doesn't yield a icmp.PacketConn.

So I guess my proposal is to add something like

pkg icmp, method (*ListenConfig) ListenPacket(string, string) (*PacketConn, error)

to add feature parity to the net package.

@gopherbot gopherbot added this to the Proposal milestone Nov 25, 2023
@seankhliao seankhliao changed the title proposal: icmp.PacketConn: Allow setting socket options proposal: x/net/icmp: allow setting socket options on PacketConn Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Incoming
Development

No branches or pull requests

2 participants