Skip to contentSkip to conversation

Question about IP_TOS and DSCP handling

DISCUSSION Philip Prindeville 1 participant 1 message Nov 20, 2009

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

I'm looking at net/ipv4/ip_sockglue.c circa line 512 (this is in 2.6.27.38):

        case IP_TOS:    /* This sets both TOS and Precedence */
                if (sk->sk_type == SOCK_STREAM) {
                        val &= ~3;
                        val |= inet->tos & 3;
                }
                if (inet->tos != val) {
                        inet->tos = val;
                        sk->sk_priority = rt_tos2priority(val);
                        sk_dst_reset(sk);
                }
                break;

and it doesn't look like the kernel handles DSCP marking. Is that correct? (Also, not clear why SOCK_STREAM gets handled differently...)

Looking at rt_tos2priority(), which uses IPTOS_TOS(x), it doesn't look like that would be the correct thing to do.

Also, include/linux/ip.h no longer meshes with
/usr/include/netinet/in.h. Please see:

http://sourceware.org/bugzilla/show_bug.cgi?id=10789

I'm trying to add DSCP marking to Thunderbird, Firefox, Apache, and a few other applications but I wanted to make sure that my test platforms would handle it correctly first.

Thanks,

-Philip