aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/ipv6.h2
-rw-r--r--include/net/inet_sock.h1
-rw-r--r--net/ipv4/af_inet.c1
-rw-r--r--net/ipv4/ip_sockglue.c4
-rw-r--r--net/ipv4/tcp_ipv4.c1
-rw-r--r--net/ipv6/af_inet6.c1
-rw-r--r--net/ipv6/ipv6_sockglue.c4
-rw-r--r--net/ipv6/tcp_ipv6.c4
8 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 4847a64d3c0a..8260ef779762 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -366,7 +366,7 @@ struct ipv6_pinfo {
366 dontfrag:1; 366 dontfrag:1;
367 __u8 min_hopcount; 367 __u8 min_hopcount;
368 __u8 tclass; 368 __u8 tclass;
369 __u8 padding; 369 __u8 rcv_tclass;
370 370
371 __u32 dst_cookie; 371 __u32 dst_cookie;
372 372
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 022f772c0ebe..ae17e1352d7e 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -168,6 +168,7 @@ struct inet_sock {
168 transparent:1, 168 transparent:1,
169 mc_all:1, 169 mc_all:1,
170 nodefrag:1; 170 nodefrag:1;
171 __u8 rcv_tos;
171 int uc_index; 172 int uc_index;
172 int mc_index; 173 int mc_index;
173 __be32 mc_addr; 174 __be32 mc_addr;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index f7b5670744f0..e588a34e85c2 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -381,6 +381,7 @@ lookup_protocol:
381 inet->mc_all = 1; 381 inet->mc_all = 1;
382 inet->mc_index = 0; 382 inet->mc_index = 0;
383 inet->mc_list = NULL; 383 inet->mc_list = NULL;
384 inet->rcv_tos = 0;
384 385
385 sk_refcnt_debug_inc(sk); 386 sk_refcnt_debug_inc(sk);
386 387
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 9125529dab95..ca50d9f9f8c1 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -1289,6 +1289,10 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
1289 int hlim = inet->mc_ttl; 1289 int hlim = inet->mc_ttl;
1290 put_cmsg(&msg, SOL_IP, IP_TTL, sizeof(hlim), &hlim); 1290 put_cmsg(&msg, SOL_IP, IP_TTL, sizeof(hlim), &hlim);
1291 } 1291 }
1292 if (inet->cmsg_flags & IP_CMSG_TOS) {
1293 int tos = inet->rcv_tos;
1294 put_cmsg(&msg, SOL_IP, IP_TOS, sizeof(tos), &tos);
1295 }
1292 len -= msg.msg_controllen; 1296 len -= msg.msg_controllen;
1293 return put_user(len, optlen); 1297 return put_user(len, optlen);
1294 } 1298 }
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 4d6f81c818dc..94abee8cf563 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1463,6 +1463,7 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1463 ireq->opt = NULL; 1463 ireq->opt = NULL;
1464 newinet->mc_index = inet_iif(skb); 1464 newinet->mc_index = inet_iif(skb);
1465 newinet->mc_ttl = ip_hdr(skb)->ttl; 1465 newinet->mc_ttl = ip_hdr(skb)->ttl;
1466 newinet->rcv_tos = ip_hdr(skb)->tos;
1466 inet_csk(newsk)->icsk_ext_hdr_len = 0; 1467 inet_csk(newsk)->icsk_ext_hdr_len = 0;
1467 if (inet_opt) 1468 if (inet_opt)
1468 inet_csk(newsk)->icsk_ext_hdr_len = inet_opt->opt.optlen; 1469 inet_csk(newsk)->icsk_ext_hdr_len = inet_opt->opt.optlen;
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 273f48d1df2e..5605f9dca87e 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -214,6 +214,7 @@ lookup_protocol:
214 inet->mc_ttl = 1; 214 inet->mc_ttl = 1;
215 inet->mc_index = 0; 215 inet->mc_index = 0;
216 inet->mc_list = NULL; 216 inet->mc_list = NULL;
217 inet->rcv_tos = 0;
217 218
218 if (ipv4_config.no_pmtu_disc) 219 if (ipv4_config.no_pmtu_disc)
219 inet->pmtudisc = IP_PMTUDISC_DONT; 220 inet->pmtudisc = IP_PMTUDISC_DONT;
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 6d6b65fdaa1a..63dd1f89ed7d 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -1017,6 +1017,10 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
1017 int hlim = np->mcast_hops; 1017 int hlim = np->mcast_hops;
1018 put_cmsg(&msg, SOL_IPV6, IPV6_HOPLIMIT, sizeof(hlim), &hlim); 1018 put_cmsg(&msg, SOL_IPV6, IPV6_HOPLIMIT, sizeof(hlim), &hlim);
1019 } 1019 }
1020 if (np->rxopt.bits.rxtclass) {
1021 int tclass = np->rcv_tclass;
1022 put_cmsg(&msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass);
1023 }
1020 if (np->rxopt.bits.rxoinfo) { 1024 if (np->rxopt.bits.rxoinfo) {
1021 struct in6_pktinfo src_info; 1025 struct in6_pktinfo src_info;
1022 src_info.ipi6_ifindex = np->mcast_oif ? np->mcast_oif : 1026 src_info.ipi6_ifindex = np->mcast_oif ? np->mcast_oif :
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);