diff options
author | Murali Raja <muralira@google.com> | 2011-10-12 05:00:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-12 19:09:18 -0400 |
commit | 3ceca749668a52bd795585e0f71c6f0b04814f7b (patch) | |
tree | b3c3bc8a3312b432757e48674d0415ea6754d863 /net/ipv4/inet_diag.c | |
parent | 56755924100261b8e52dca68ca53ece54b6f64ad (diff) |
net-netlink: Add a new attribute to expose TOS values via netlink
This patch exposes the tos value for the TCP sockets when the TOS flag
is requested in the ext_flags for the inet_diag request. This would mainly be
used to expose TOS values for both for TCP and UDP sockets. Currently it is
supported for TCP. When netlink support for UDP would be added the support
to expose the TOS values would alse be done. For IPV4 tos value is exposed
and for IPV6 tclass value is exposed.
Signed-off-by: Murali Raja <muralira@google.com>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.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 | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 389a2e6a17fd..f5e2bdaef949 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -108,6 +108,9 @@ 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 | |||
111 | r->idiag_family = sk->sk_family; | 114 | r->idiag_family = sk->sk_family; |
112 | r->idiag_state = sk->sk_state; | 115 | r->idiag_state = sk->sk_state; |
113 | r->idiag_timer = 0; | 116 | r->idiag_timer = 0; |
@@ -130,6 +133,8 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
130 | &np->rcv_saddr); | 133 | &np->rcv_saddr); |
131 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, | 134 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, |
132 | &np->daddr); | 135 | &np->daddr); |
136 | if (ext & (1 << (INET_DIAG_TOS - 1))) | ||
137 | RTA_PUT_U8(skb, INET_DIAG_TOS, np->tclass); | ||
133 | } | 138 | } |
134 | #endif | 139 | #endif |
135 | 140 | ||