|« Nov||May »|
The part of the socket(7) man page about setsockopt(.., SOL_SOCKET, SO_PRIORITY…) says:
“For ip(7), this also sets the IP type-of- service (TOS) field for outgoing packets.”
I wanted to know how exactly it mapped the socket priority to the ToS field, so I looked in the kernel code for a while, and it turns out that in recent Linux 2.6 kernel, this is a lie. The ToS field is never set when the application selects the socket priority, only the internal priority of the packet is set. That said, the reverse is true, setting setsockopt(.., IPPROTO_IP, IP_TOS…) sets both the ToS header field and the internal priority of the packet.
So the question here is: Who is wrong, is the kernel buggy? Or is the man page incorrect?
Also, dear lazyweb, is there any support for applications to set the DiffServ field? Or are they only settable through iptables?