diff options
author | Maciej Żenczykowski <maze@google.com> | 2011-11-22 16:03:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-22 16:03:10 -0500 |
commit | 717b6d83664646963c71d014c71babaa802333b9 (patch) | |
tree | 8ede0e3551530387282e517fbe6f5d647a4f848f /net/ipv4/inet_diag.c | |
parent | f23aa62545c18728eb2b9434aa258be27e07dd49 (diff) |
net-netlink: fix diag to export IPv4 tos for dual-stack IPv6 sockets
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_diag.c')
-rw-r--r-- | net/ipv4/inet_diag.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 68e8ac514383..ccee270a9b65 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -108,9 +108,6 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
108 | icsk->icsk_ca_ops->name); | 108 | icsk->icsk_ca_ops->name); |
109 | } | 109 | } |
110 | 110 | ||
111 | if ((ext & (1 << (INET_DIAG_TOS - 1))) && (sk->sk_family != AF_INET6)) | ||
112 | RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos); | ||
113 | |||
114 | r->idiag_family = sk->sk_family; | 111 | r->idiag_family = sk->sk_family; |
115 | r->idiag_state = sk->sk_state; | 112 | r->idiag_state = sk->sk_state; |
116 | r->idiag_timer = 0; | 113 | r->idiag_timer = 0; |
@@ -125,16 +122,23 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
125 | r->id.idiag_src[0] = inet->inet_rcv_saddr; | 122 | r->id.idiag_src[0] = inet->inet_rcv_saddr; |
126 | r->id.idiag_dst[0] = inet->inet_daddr; | 123 | r->id.idiag_dst[0] = inet->inet_daddr; |
127 | 124 | ||
125 | /* IPv6 dual-stack sockets use inet->tos for IPv4 connections, | ||
126 | * hence this needs to be included regardless of socket family. | ||
127 | */ | ||
128 | if (ext & (1 << (INET_DIAG_TOS - 1))) | ||
129 | RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos); | ||
130 | |||
128 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 131 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
129 | if (r->idiag_family == AF_INET6) { | 132 | if (r->idiag_family == AF_INET6) { |
130 | const struct ipv6_pinfo *np = inet6_sk(sk); | 133 | const struct ipv6_pinfo *np = inet6_sk(sk); |
131 | 134 | ||
135 | if (ext & (1 << (INET_DIAG_TCLASS - 1))) | ||
136 | RTA_PUT_U8(skb, INET_DIAG_TCLASS, np->tclass); | ||
137 | |||
132 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, | 138 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, |
133 | &np->rcv_saddr); | 139 | &np->rcv_saddr); |
134 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, | 140 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, |
135 | &np->daddr); | 141 | &np->daddr); |
136 | if (ext & (1 << (INET_DIAG_TCLASS - 1))) | ||
137 | RTA_PUT_U8(skb, INET_DIAG_TCLASS, np->tclass); | ||
138 | } | 142 | } |
139 | #endif | 143 | #endif |
140 | 144 | ||