aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
authorJiri Benc <jbenc@redhat.com>2012-02-09 04:35:49 -0500
committerDavid S. Miller <davem@davemloft.net>2012-02-13 00:46:41 -0500
commit4c507d2897bd9be810b3403ade73b04cf6fdfd4a (patch)
treedfd808407a0f800195e994bb2cfc401fae23295e /net/ipv6/tcp_ipv6.c
parent7a3198a89722ad9521d22b05938d357eac7460fa (diff)
net: implement IP_RECVTOS for IP_PKTOPTIONS
Currently, it is not easily possible to get TOS/DSCP value of packets from an incoming TCP stream. The mechanism is there, IP_PKTOPTIONS getsockopt with IP_RECVTOS set, the same way as incoming TTL can be queried. This is not actually implemented for TOS, though. This patch adds this functionality, both for IPv4 (IP_PKTOPTIONS) and IPv6 (IPV6_2292PKTOPTIONS). For IPv4, like in the IP_RECVTTL case, the value of the TOS field is stored from the other party's ACK. This is needed for proxies which require DSCP transparency. One such example is at http://zph.bratcheda.org/. Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r--net/ipv6/tcp_ipv6.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index d16414cb3421..12c6ece67f39 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1282,6 +1282,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1282 newnp->opt = NULL; 1282 newnp->opt = NULL;
1283 newnp->mcast_oif = inet6_iif(skb); 1283 newnp->mcast_oif = inet6_iif(skb);
1284 newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; 1284 newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
1285 newnp->rcv_tclass = ipv6_tclass(ipv6_hdr(skb));
1285 1286
1286 /* 1287 /*
1287 * No need to charge this sock to the relevant IPv6 refcnt debug socks count 1288 * No need to charge this sock to the relevant IPv6 refcnt debug socks count
@@ -1360,6 +1361,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1360 newnp->opt = NULL; 1361 newnp->opt = NULL;
1361 newnp->mcast_oif = inet6_iif(skb); 1362 newnp->mcast_oif = inet6_iif(skb);
1362 newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; 1363 newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
1364 newnp->rcv_tclass = ipv6_tclass(ipv6_hdr(skb));
1363 1365
1364 /* Clone native IPv6 options from listening socket (if any) 1366 /* Clone native IPv6 options from listening socket (if any)
1365 1367
@@ -1562,6 +1564,8 @@ ipv6_pktoptions:
1562 np->mcast_oif = inet6_iif(opt_skb); 1564 np->mcast_oif = inet6_iif(opt_skb);
1563 if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) 1565 if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim)
1564 np->mcast_hops = ipv6_hdr(opt_skb)->hop_limit; 1566 np->mcast_hops = ipv6_hdr(opt_skb)->hop_limit;
1567 if (np->rxopt.bits.rxtclass)
1568 np->rcv_tclass = ipv6_tclass(ipv6_hdr(skb));
1565 if (ipv6_opt_accepted(sk, opt_skb)) { 1569 if (ipv6_opt_accepted(sk, opt_skb)) {
1566 skb_set_owner_r(opt_skb, sk); 1570 skb_set_owner_r(opt_skb, sk);
1567 opt_skb = xchg(&np->pktoptions, opt_skb); 1571 opt_skb = xchg(&np->pktoptions, opt_skb);