ipv6: remove rcv_tclass of ipv6_pinfo
authorFlorent Fourcot <florent.fourcot@enst-bretagne.fr>
Sun, 8 Dec 2013 14:46:59 +0000 (15:46 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Dec 2013 02:03:49 +0000 (21:03 -0500)
tclass information in now already stored in rcv_flowinfo
We do not need to store the same information twice.

Signed-off-by: Florent Fourcot <florent.fourcot@enst-bretagne.fr>
Reviewed-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/ipv6.h
net/ipv6/ipv6_sockglue.c
net/ipv6/tcp_ipv6.c

index 0b2ebfbbe0f42c5b3206c3f7752a31506bbe222d..3fde066455535ca98044c8548660e5e6a2279a9d 100644 (file)
@@ -200,7 +200,6 @@ struct ipv6_pinfo {
                                dontfrag:1;
        __u8                    min_hopcount;
        __u8                    tclass;
-       __u8                    rcv_tclass;
        __be32                  rcv_flowinfo;
 
        __u32                   dst_cookie;
index c2db1df46385600f7125eed1270d7b0685376078..7d93915068565c2a56149a8de363956253e6411b 100644 (file)
@@ -1019,7 +1019,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
                                put_cmsg(&msg, SOL_IPV6, IPV6_HOPLIMIT, sizeof(hlim), &hlim);
                        }
                        if (np->rxopt.bits.rxtclass) {
-                               int tclass = np->rcv_tclass;
+                               int tclass = ntohl(np->rcv_flowinfo & IPV6_TCLASS_MASK) >> 20;
                                put_cmsg(&msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass);
                        }
                        if (np->rxopt.bits.rxoinfo) {
index 79a1963695582c248edd189e944abc4f62933bf0..bd91e7ff482bf5b189e358d58069c8f15f9e6847 100644 (file)
@@ -1135,7 +1135,6 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
                newnp->opt         = NULL;
                newnp->mcast_oif   = inet6_iif(skb);
                newnp->mcast_hops  = ipv6_hdr(skb)->hop_limit;
-               newnp->rcv_tclass  = ipv6_get_dsfield(ipv6_hdr(skb));
                newnp->rcv_flowinfo = ip6_flowinfo(ipv6_hdr(skb));
 
                /*
@@ -1216,7 +1215,6 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
        newnp->opt        = NULL;
        newnp->mcast_oif  = inet6_iif(skb);
        newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
-       newnp->rcv_tclass = ipv6_get_dsfield(ipv6_hdr(skb));
        newnp->rcv_flowinfo = ip6_flowinfo(ipv6_hdr(skb));
 
        /* Clone native IPv6 options from listening socket (if any)
@@ -1427,9 +1425,7 @@ ipv6_pktoptions:
                        np->mcast_oif = inet6_iif(opt_skb);
                if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim)
                        np->mcast_hops = ipv6_hdr(opt_skb)->hop_limit;
-               if (np->rxopt.bits.rxtclass)
-                       np->rcv_tclass = ipv6_get_dsfield(ipv6_hdr(opt_skb));
-               if (np->rxopt.bits.rxflow)
+               if (np->rxopt.bits.rxflow || np->rxopt.bits.rxtclass)
                        np->rcv_flowinfo = ip6_flowinfo(ipv6_hdr(opt_skb));
                if (ipv6_opt_accepted(sk, opt_skb)) {
                        skb_set_owner_r(opt_skb, sk);