提交 3ceca749 编写于 作者: M Murali Raja 提交者: David S. Miller

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: NMurali Raja <muralira@google.com>
Acked-by: NStephen Hemminger <shemminger@vyatta.com>
Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 56755924
...@@ -97,9 +97,10 @@ enum { ...@@ -97,9 +97,10 @@ enum {
INET_DIAG_INFO, INET_DIAG_INFO,
INET_DIAG_VEGASINFO, INET_DIAG_VEGASINFO,
INET_DIAG_CONG, INET_DIAG_CONG,
INET_DIAG_TOS,
}; };
#define INET_DIAG_MAX INET_DIAG_CONG #define INET_DIAG_MAX INET_DIAG_TOS
/* INET_DIAG_MEM */ /* INET_DIAG_MEM */
......
...@@ -108,6 +108,9 @@ static int inet_csk_diag_fill(struct sock *sk, ...@@ -108,6 +108,9 @@ static int inet_csk_diag_fill(struct sock *sk,
icsk->icsk_ca_ops->name); icsk->icsk_ca_ops->name);
} }
if ((ext & (1 << (INET_DIAG_TOS - 1))) && (sk->sk_family != AF_INET6))
RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos);
r->idiag_family = sk->sk_family; r->idiag_family = sk->sk_family;
r->idiag_state = sk->sk_state; r->idiag_state = sk->sk_state;
r->idiag_timer = 0; r->idiag_timer = 0;
...@@ -130,6 +133,8 @@ static int inet_csk_diag_fill(struct sock *sk, ...@@ -130,6 +133,8 @@ static int inet_csk_diag_fill(struct sock *sk,
&np->rcv_saddr); &np->rcv_saddr);
ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst,
&np->daddr); &np->daddr);
if (ext & (1 << (INET_DIAG_TOS - 1)))
RTA_PUT_U8(skb, INET_DIAG_TOS, np->tclass);
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册