diff options
author | Christoph Paasch <christoph.paasch@uclouvain.be> | 2014-01-08 10:05:57 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-10 17:38:18 -0500 |
commit | 8a59359cb80f448923a7bc9f555d477e74547d7a (patch) | |
tree | ad1477b1f569f43152869858ce17de3f8e15f33f | |
parent | a544302820db12660b15de185b9e67c781a6b74e (diff) |
tcp: metrics: New netlink attribute for src IP and dumped in netlink reply
This patch adds a new netlink attribute for the source-IP and appends it
to the netlink reply. Now, iproute2 can have access to the source-IP.
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/uapi/linux/tcp_metrics.h | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_metrics.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/include/uapi/linux/tcp_metrics.h b/include/uapi/linux/tcp_metrics.h index cb5157b55f32..54a37b13f2c4 100644 --- a/include/uapi/linux/tcp_metrics.h +++ b/include/uapi/linux/tcp_metrics.h | |||
@@ -35,6 +35,8 @@ enum { | |||
35 | TCP_METRICS_ATTR_FOPEN_SYN_DROPS, /* u16, count of drops */ | 35 | TCP_METRICS_ATTR_FOPEN_SYN_DROPS, /* u16, count of drops */ |
36 | TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS, /* msecs age */ | 36 | TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS, /* msecs age */ |
37 | TCP_METRICS_ATTR_FOPEN_COOKIE, /* binary */ | 37 | TCP_METRICS_ATTR_FOPEN_COOKIE, /* binary */ |
38 | TCP_METRICS_ATTR_SADDR_IPV4, /* u32 */ | ||
39 | TCP_METRICS_ATTR_SADDR_IPV6, /* binary */ | ||
38 | 40 | ||
39 | __TCP_METRICS_ATTR_MAX, | 41 | __TCP_METRICS_ATTR_MAX, |
40 | }; | 42 | }; |
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c index de32aa41a846..199659f7a871 100644 --- a/net/ipv4/tcp_metrics.c +++ b/net/ipv4/tcp_metrics.c | |||
@@ -745,11 +745,17 @@ static int tcp_metrics_fill_info(struct sk_buff *msg, | |||
745 | if (nla_put_be32(msg, TCP_METRICS_ATTR_ADDR_IPV4, | 745 | if (nla_put_be32(msg, TCP_METRICS_ATTR_ADDR_IPV4, |
746 | tm->tcpm_daddr.addr.a4) < 0) | 746 | tm->tcpm_daddr.addr.a4) < 0) |
747 | goto nla_put_failure; | 747 | goto nla_put_failure; |
748 | if (nla_put_be32(msg, TCP_METRICS_ATTR_SADDR_IPV4, | ||
749 | tm->tcpm_saddr.addr.a4) < 0) | ||
750 | goto nla_put_failure; | ||
748 | break; | 751 | break; |
749 | case AF_INET6: | 752 | case AF_INET6: |
750 | if (nla_put(msg, TCP_METRICS_ATTR_ADDR_IPV6, 16, | 753 | if (nla_put(msg, TCP_METRICS_ATTR_ADDR_IPV6, 16, |
751 | tm->tcpm_daddr.addr.a6) < 0) | 754 | tm->tcpm_daddr.addr.a6) < 0) |
752 | goto nla_put_failure; | 755 | goto nla_put_failure; |
756 | if (nla_put(msg, TCP_METRICS_ATTR_SADDR_IPV6, 16, | ||
757 | tm->tcpm_saddr.addr.a6) < 0) | ||
758 | goto nla_put_failure; | ||
753 | break; | 759 | break; |
754 | default: | 760 | default: |
755 | return -EAFNOSUPPORT; | 761 | return -EAFNOSUPPORT; |