diff options
author | Timo Teräs <timo.teras@iki.fi> | 2015-04-29 08:43:03 +0200 |
---|---|---|
committer | Daniel Walton <dwalton@cumulusnetworks.com> | 2016-05-26 17:33:30 +0200 |
commit | cf279b3abcdaf1bbee65d622f17229b8a0cd32d5 (patch) | |
tree | d7659c524a37d8dfc2fa2c202123aa043e63f825 /lib/sockopt.c | |
parent | ospfd: Make ospf_passive_interface_update calls friendly to static analysis (diff) | |
download | frr-cf279b3abcdaf1bbee65d622f17229b8a0cd32d5.tar.xz frr-cf279b3abcdaf1bbee65d622f17229b8a0cd32d5.zip |
sockopt: add support for querying tcp round-trip-time
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 6b2672f3c9493aef3495192e113f95a7db4b65bc)
Diffstat (limited to 'lib/sockopt.c')
-rw-r--r-- | lib/sockopt.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c index be22827f6..257271bc0 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -519,6 +519,22 @@ sockopt_iphdrincl_swab_systoh (struct ip *iph) } int +sockopt_tcp_rtt (int sock) +{ +#ifdef TCP_INFO + struct tcp_info ti; + socklen_t len = sizeof(ti); + + if (getsockopt (sock, IPPROTO_TCP, TCP_INFO, &ti, &len) != 0) + return 0; + + return ti.tcpi_rtt / 1000; +#else + return 0; +#endif +} + +int sockopt_tcp_signature (int sock, union sockunion *su, const char *password) { #if defined(HAVE_TCP_MD5_LINUX24) && defined(GNU_LINUX) |