diff -Nur linux-2.6.15.5/include/linux/ip.h linux-2.6.15.5-zph/include/linux/ip.h --- linux-2.6.15.5/include/linux/ip.h 2006-03-02 00:37:27.000000000 +0200 +++ linux-2.6.15.5-zph/include/linux/ip.h 2006-03-03 13:07:35.000000000 +0200 @@ -157,6 +157,7 @@ int mc_index; /* Multicast device index */ __u32 mc_addr; struct ip_mc_socklist *mc_list; /* Group array */ + /* * Following members are used to retain the infomation to build * an ip header on each ip fragmentation while the socket is corked. @@ -170,6 +171,7 @@ u32 addr; struct flowi fl; } cork; + __u8 zph_tos; /* ZPH TOS received on connect */ }; #define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ diff -Nur linux-2.6.15.5/net/ipv4/ip_sockglue.c linux-2.6.15.5-zph/net/ipv4/ip_sockglue.c --- linux-2.6.15.5/net/ipv4/ip_sockglue.c 2006-03-02 00:37:27.000000000 +0200 +++ linux-2.6.15.5-zph/net/ipv4/ip_sockglue.c 2006-03-03 13:07:35.000000000 +0200 @@ -1044,6 +1044,12 @@ int hlim = inet->mc_ttl; put_cmsg(&msg, SOL_IP, IP_TTL, sizeof(hlim), &hlim); } + + if (inet->cmsg_flags&IP_CMSG_TOS) { + int hlim = inet->zph_tos; + put_cmsg(&msg, SOL_IP, IP_TOS, sizeof(hlim), &hlim); + } + len -= msg.msg_controllen; return put_user(len, optlen); } diff -Nur linux-2.6.15.5/net/ipv4/tcp_input.c linux-2.6.15.5-zph/net/ipv4/tcp_input.c --- linux-2.6.15.5/net/ipv4/tcp_input.c 2006-03-02 00:37:27.000000000 +0200 +++ linux-2.6.15.5-zph/net/ipv4/tcp_input.c 2006-03-03 13:11:52.000000000 +0200 @@ -3967,6 +3967,7 @@ struct tcphdr *th, unsigned len) { struct tcp_sock *tp = tcp_sk(sk); + struct inet_sock *inet = inet_sk(sk); int saved_clamp = tp->rx_opt.mss_clamp; tcp_parse_options(skb, &tp->rx_opt, 0); @@ -4028,6 +4029,12 @@ if (tp->ecn_flags&TCP_ECN_OK) sock_set_flag(sk, SOCK_NO_LARGESEND); + /* ZPH: + * Copy TOS field from the SYNACK packet to zph_tos field + * of the af_inet member of sock structure + */ + inet->zph_tos = skb->nh.iph->tos; + tp->snd_wl1 = TCP_SKB_CB(skb)->seq; tcp_ack(sk, skb, FLAG_SLOWPATH);