-
Notifications
You must be signed in to change notification settings - Fork 18k
x/net/ipv6: missing Header.Marshal method #18633
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
Comments
I think that the method is unnecessary for ipv6 package. Unlike system calls and primitives for IPv4 facilities, tweaking IPv6 headers on outgoing packets from userspace must use per-packet basis ancillary data and a very few sticky socket options, and that's the reason why ipv6.RawConn doesn't exist; see RFC 3542. FWIW, I added the ipv6.Header type and ipv6.ParseHeader for parsing IPv6 header in ICMP error message bodies. |
I'd like to second the addition of marshaling an When working with IPv6 headers directly (in particular, when reading/writing packets from a TUN/TAP device or from packet capture interfaces) it is possible to parse the read To generate a response packet to write back to TUN/TAP, we would expect to modify or create an |
Fro TUN/TAP case, https://godoc.org/github.com/google/gopacket looks promising. |
It does look promising, but it also looks like a very heavy solution to a very simple problem. The IPv4 package has marshalling, it makes sense that the IPv6 package should too. |
The purpose of IPv4 header marshaling and unmarshaling in the ipv4 package is just to avoid a few pitfalls for non-experienced users. For some historical reason, classical IPv4 host stack implementations (mostly on BSD variants) may tweak host reception and transmission IPv4 packets. Therefore the existing API surface in the ipv4, ipv6 and icmp packages recalculates data from/to the kernel and provides native-endian access for the exposed types as the host-stack friendly API surface. I think that your use case, a bundle of light-weight wire-format friendly marshalers and unmarshalers, makes sense but it's better to put such functionality in another package, not to mix host-stack friendly API and wire-format friendly API. |
Closing this out as I no longer have a need for this. |
In
x/net/ipv4
,Header.Marshal
can be used to marshal the IPv4 header into binary form.There is no such method in
x/net/ipv6
.I'd be happy to implement it, unless there is a specific reason it wasn't implemented in the first place.
/cc @mikioh
The text was updated successfully, but these errors were encountered: