Subject: Re: [Ecn-in-quic] Darwin issue with setting ECN/DCSP via sendmsg

From: Ingemar Johansson S <[email-masked]>
Date: Wed, 6 Dec 2017 07:46:34 +0000

A followup.

I have never tried out Darwin, read however that it is sort of the basis for Mac OSX. Are the issues with outbound packets in Darwin solved in MaxOSX ?

/Ingemar

> -----Original Message-----
> From: Ecn-in-quic [mailto:[email-masked]] On Behalf Of
> Eggert, Lars
> Sent: den 29 november 2017 15:35
> To: [email-masked]; Stuart Cheshire <[email-masked]>
> Subject: [Ecn-in-quic] Darwin issue with setting ECN/DCSP via sendmsg
> 
> Hi,
> 
> sorry for abusing this list. In order to play with ECN and QUIC, I've added
> support for being able to set ECN (and DSCP) fields on the UDP packets I
> generate.
> 
> The good news is that the socket option calls to set the default for a socket
> are exactly the same on Linux, FreeBSD and Darwin, and it works on all
> platforms.
> 
> The other good news is that receiving per-packet ECN (and DSCP)
> information on inbound packets received via recvmsg/recvmmsg is almost
> identical on all three platforms (Linux uses a slightly different option name
> than the other two), and it also works everywhere.
> 
> Sending packets with per-packet ECN (and DCSP) information by initializing
> "struct cmsghdr" information for sendmsg/sendmmsg also uses the same
> API on all three platforms. However, it only seems to work on Linux and
> FreeBSD.
> 
> On Darwin, there is no error, but the outbound packets are *not* marked as
> indicated in the accompanying "struct cmsghdr".
> 
> In case this is of interest to anyone.
> 
> Lars

---

From: "Eggert, Lars" <[email-masked]>
Date: Wed, 6 Dec 2017 09:28:15 +0000

> I have never tried out Darwin, read however that it is sort of the basis for Mac OSX. Are the issues with outbound packets in Darwin solved in MaxOSX ?

These issues also exist in MacOSX. I use "Darwin" to mean "the MacOSX kernel", which may not be 100% accurate.

Also, there was an issue on Linux kernels before 4.9 where you needed to pass in an "int" to set the TOS byte (while at the same time you read the TOS byte as a byte). That caused my code to fail on older Linux kernels and took some time to diagnose. See https://github.com/torvalds/linux/commit/e895cdce683161081e3626c4f5a5c55cb72089f8 <https://github.com/torvalds/linux/commit/e895cdce683161081e3626c4f5a5c55cb72089f8> On newer kernels, you can set and read the TOS byte as a byte, which obviously makes a lot more sense.

Lars