Re: [go-nuts] How to read (and write) the ECN bits?

2020-08-07 Thread Marten Seemann
Thank you guys, your tips were really helpful! Here's the solution I came up with for reading the ECN bits: After setting the IP_RECVTOS options syscall.SetsockoptInt(int(fd), syscall.IPPROTO_IP, syscall.IP_RECVTOS, 1) one can read packets from the socket using n, oobn, flags, addr, err :=

Re: [go-nuts] How to read (and write) the ECN bits?

2020-08-06 Thread David Finkel
On Thu, Aug 6, 2020 at 10:02 AM Uli Kunitz wrote: > Reading is possible with IP_RECVTOS on Linux but requires the use of > recvmsg, because the TOS field is provided as ancillary data. This wouldn't > be very portable though. Raw sockets with IP_HDRINCL are a better option if > portability is a

Re: [go-nuts] How to read (and write) the ECN bits?

2020-08-06 Thread Uli Kunitz
Reading is possible with IP_RECVTOS on Linux but requires the use of recvmsg, because the TOS field is provided as ancillary data. This wouldn't be very portable though. Raw sockets with IP_HDRINCL are a better option if portability is a concern. On Wednesday, August 5, 2020 at 11:33:41 PM

Re: [go-nuts] How to read (and write) the ECN bits?

2020-08-05 Thread Andrei Tudor Călin
ECN bits are represented in the TOS field. I think you can use setsockopt with the IP_TOS option to set the TOS field on a socket. See ip(7). On the Go side, use the SyscallConn method on your UDPConn, then call setsockopt using the Control method. Something like this (untested):

[go-nuts] How to read (and write) the ECN bits?

2020-08-05 Thread martenseemann
I'm working on a Go implementation of the QUIC protocol ( https://github.com/lucas-clemente/quic-go). QUIC specifies how to use ECN (Explicit Congestion Notification) to detect and respond to congestion in the network (see https://tools.ietf.org/html/draft-ietf-quic-transport-29#section-13.4