Skip to contentSkip to conversation

querying TOS/DSCP at accept() time?

DISCUSSION Jeremy Jackson 1 participant 2 messages Dec 27, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I would like to allow clients connecting to webserver to choose TOS/DSCP value they want in reply packets, based on TOS setting received by webserver in initial SYN-SYN/ACK-ACK exchange. Linux samples the TOS byte of the ACK that moves the state to CONNECTED, presumably to use for later ECN processing, but I cannot find a way to get this from userspace.

net/ipv4/tcp_ipv4.c:1645

    TCP_SKB_CB(skb)->flags   = iph->tos;

Am I missing something in getsockopt(TCP_INFO perhaps?) or accept(), or is this currently not possible?

Signature · 5 lines
Jeremy Jackson
Coplanar Networks
(519)489-4903
http://www.coplanar.net
[email protected]
#1 lore raw

It seems this question was asked before in 2001:

http://www.squid-cache.org/mail-archive/squid-dev/200103/0035.html

http://lkml.indiana.edu/hypermail/linux/kernel/0103.0/1211.html

And apparently Squid developers made a kernel patch

http://zph.bratcheda.org/tos_marking_with_tos_preserving.htm
http://zph.bratcheda.org/

It seems like this is generally useful to a number of applications, perhaps it should be included in mainstream kernel?

I see there's a structure member added, which will likely be frowned upon, but perhaps it could be reworked to use the existing TOS byte captured

net/ipv4/tcp_ipv4.c:1645

     TCP_SKB_CB(skb)->flags   = iph->tos;

Cheers,

Jeremy

The kernel patch adds

Quoted 16 lines · Jeremy Jackson

I would like to allow clients connecting to webserver to choose TOS/DSCP value they want in reply packets, based on TOS setting received by webserver in initial SYN-SYN/ACK-ACK exchange. Linux samples the TOS byte of the ACK that moves the state to CONNECTED, presumably to use for later ECN processing, but I cannot find a way to get this from userspace.

net/ipv4/tcp_ipv4.c:1645

    TCP_SKB_CB(skb)->flags   = iph->tos;

Am I missing something in getsockopt(TCP_INFO perhaps?) or accept(), or is this currently not possible?

Signature · 5 lines
Jeremy Jackson
Coplanar Networks
(519)489-4903
http://www.coplanar.net
[email protected]