]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
tcp: metrics: New netlink attribute for src IP and dumped in netlink reply
authorChristoph Paasch <christoph.paasch@uclouvain.be>
Wed, 8 Jan 2014 15:05:57 +0000 (16:05 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 10 Jan 2014 22:38:18 +0000 (17:38 -0500)
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>
include/uapi/linux/tcp_metrics.h
net/ipv4/tcp_metrics.c

index cb5157b55f324bfbca68417f0a266b10cafa5e13..54a37b13f2c4d77202d35d42e852689ddc9fcdd0 100644 (file)
@@ -35,6 +35,8 @@ enum {
        TCP_METRICS_ATTR_FOPEN_SYN_DROPS,       /* u16, count of drops */
        TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS,     /* msecs age */
        TCP_METRICS_ATTR_FOPEN_COOKIE,          /* binary */
+       TCP_METRICS_ATTR_SADDR_IPV4,            /* u32 */
+       TCP_METRICS_ATTR_SADDR_IPV6,            /* binary */
 
        __TCP_METRICS_ATTR_MAX,
 };
index de32aa41a846883b0cba92b7eed00fe235c5532e..199659f7a8711e4d5530e5984b427f3d4afc2a7c 100644 (file)
@@ -745,11 +745,17 @@ static int tcp_metrics_fill_info(struct sk_buff *msg,
                if (nla_put_be32(msg, TCP_METRICS_ATTR_ADDR_IPV4,
                                tm->tcpm_daddr.addr.a4) < 0)
                        goto nla_put_failure;
+               if (nla_put_be32(msg, TCP_METRICS_ATTR_SADDR_IPV4,
+                               tm->tcpm_saddr.addr.a4) < 0)
+                       goto nla_put_failure;
                break;
        case AF_INET6:
                if (nla_put(msg, TCP_METRICS_ATTR_ADDR_IPV6, 16,
                            tm->tcpm_daddr.addr.a6) < 0)
                        goto nla_put_failure;
+               if (nla_put(msg, TCP_METRICS_ATTR_SADDR_IPV6, 16,
+                           tm->tcpm_saddr.addr.a6) < 0)
+                       goto nla_put_failure;
                break;
        default:
                return -EAFNOSUPPORT;