1 diff -Nur linux-2.6.26.3/include/net/inet_sock.h linux-2.6.26.3-zph/include/net/inet_sock.h
2 --- linux-2.6.26.3/include/net/inet_sock.h 2008-08-20 21:11:37.000000000 +0300
3 +++ linux-2.6.26.3-zph/include/net/inet_sock.h 2008-08-21 16:51:59.000000000 +0300
6 struct ip_mc_socklist __rcu *mc_list;
7 struct inet_cork_full cork;
8 + __u16 zph_tos; /* ZPH TOS received on connect */
11 #define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */
12 diff -Nur linux-2.6.26.3/net/ipv4/ip_sockglue.c linux-2.6.26.3-zph/net/ipv4/ip_sockglue.c
13 --- linux-2.6.26.3/net/ipv4/ip_sockglue.c 2008-08-20 21:11:37.000000000 +0300
14 +++ linux-2.6.26.3-zph/net/ipv4/ip_sockglue.c 2008-08-21 16:54:21.000000000 +0300
15 @@ -1126,6 +1126,10 @@
16 int hlim = inet->mc_ttl;
17 put_cmsg(&msg, SOL_IP, IP_TTL, sizeof(hlim), &hlim);
19 + if (inet->cmsg_flags&IP_CMSG_TOS) {
20 + int hlim = inet->zph_tos & 0xFF;
21 + put_cmsg(&msg, SOL_IP, IP_TOS, sizeof(hlim), &hlim);
23 len -= msg.msg_controllen;
24 return put_user(len, optlen);
26 diff -Nur linux-2.6.26.3/net/ipv4/tcp_input.c linux-2.6.26.3-zph/net/ipv4/tcp_input.c
27 --- linux-2.6.26.3/net/ipv4/tcp_input.c 2008-08-20 21:11:37.000000000 +0300
28 +++ linux-2.6.26.3-zph/net/ipv4/tcp_input.c 2008-08-21 17:06:55.000000000 +0300
30 struct tcp_sock *tp = tcp_sk(sk);
32 bool fragstolen = false;
33 + struct inet_sock *inet = inet_sk(sk);
34 + struct iphdr *iph = ip_hdr(skb);
36 if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq)
38 @@ -3914,6 +3916,12 @@
39 4 - tp->rx_opt.tstamp_ok);
42 + // ZPH: Copy the TOS value of the first data ACK segment
43 + // received from the remote peer.
44 + if (0==(inet->zph_tos & 0x8000)) {
45 + inet->zph_tos = 0x8000 | iph->tos;
48 /* Queue data for delivery to the user.
49 * Packets in sequence go to the receive queue.
50 * Out of sequence packets to the out_of_order_queue.
52 struct inet_connection_sock *icsk = inet_csk(sk);
53 struct tcp_sock *tp = tcp_sk(sk);
54 + struct inet_sock *inet = inet_sk(sk);
55 + struct iphdr *iph = ip_hdr(skb);
56 struct tcp_fastopen_cookie foc = { .len = -1 };
57 int saved_clamp = tp->rx_opt.mss_clamp;
59 @@ -4973,6 +4983,15 @@
61 TCP_ECN_rcv_synack(tp, th);
64 + * Copy TOS field from the SYNACK packet to zph_tos field of the af_inet
65 + * member of sock structure. This value shall be overwritten when the first
66 + * data segment is received from the peer. However, for completeness in
67 + * case the socket TOS is being asked befor that, we copy the TOS value from
68 + * the SYNACK packet.
70 + inet->zph_tos = iph->tos;
72 tcp_init_wl(tp, TCP_SKB_CB(skb)->seq);
73 tcp_ack(sk, skb, FLAG_SLOWPATH);