iproute2: add support for tcp_metrics
Subsystems (2)
PATCH 1/1 iproute2: add support for tcp_metrics
ip tcp_metrics/tcpmetrics
We support get/del for single entry and dump for
show/flush.
Signed-off-by Julian Anastasov <[email protected]>
--- include/linux/tcp_metrics.h | 54 ++++++ ip/Makefile | 2 +- ip/ip.c | 4 +- ip/ip_common.h | 1 + ip/tcp_metrics.c | 426 +++++++++++++++++++++++++++++++++++++++++++ man/man8/Makefile | 3 +- man/man8/ip-tcp_metrics.8 | 143 +++++++++++++++ man/man8/ip.8 | 7 +- 8 files changed, 636 insertions(+), 4 deletions(-) create mode 100644 include/linux/tcp_metrics.h create mode 100644 ip/tcp_metrics.c create mode 100644 man/man8/ip-tcp_metrics.8
include/linux/tcp_metrics.h new file +54 -0
@@ -0,0 +1,54 @@ +/* tcp_metrics.h - TCP Metrics Interface */ + +#ifndef _LINUX_TCP_METRICS_H +#define _LINUX_TCP_METRICS_H + +#include <linux/types.h> + +/* NETLINK_GENERIC related info +*/ +#define TCP_METRICS_GENL_NAME "tcp_metrics" +#define TCP_METRICS_GENL_VERSION 0x1 + +enum tcp_metric_index { +TCP_METRIC_RTT , +TCP_METRIC_RTTVAR , +TCP_METRIC_SSTHRESH , +TCP_METRIC_CWND , +TCP_METRIC_REORDERING , + +/* Always last. */ + __TCP_METRIC_MAX, +}; + +#define TCP_METRIC_MAX (__TCP_METRIC_MAX - 1) + +enum { +TCP_METRICS_ATTR_UNSPEC , +TCP_METRICS_ATTR_ADDR_IPV4 ,/* u32 */ +TCP_METRICS_ATTR_ADDR_IPV6 ,/* binary */ +TCP_METRICS_ATTR_AGE ,/* msecs */ +TCP_METRICS_ATTR_TW_TSVAL ,/* u32, raw, rcv tsval */ +TCP_METRICS_ATTR_TW_TS_STAMP ,/* s32, sec age */ +TCP_METRICS_ATTR_VALS ,/* nested +1, u32 */ +TCP_METRICS_ATTR_FOPEN_MSS ,/* u16 */ +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_MAX, +}; + +#define TCP_METRICS_ATTR_MAX (__TCP_METRICS_ATTR_MAX - 1) + +enum { +TCP_METRICS_CMD_UNSPEC , +TCP_METRICS_CMD_GET , +TCP_METRICS_CMD_DEL , + + __TCP_METRICS_CMD_MAX, +}; + +#define TCP_METRICS_CMD_MAX (__TCP_METRICS_CMD_MAX - 1) + +#endif /* _LINUX_TCP_METRICS_H */
ip/Makefile +1 -1
@@ -3,7 +3,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \ ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o iptuntap.o \ ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \ iplink_vlan.o link_veth.o link_gre.o iplink_can.o \ - iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_vti.o + iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_vti.o tcp_metrics.o RTMONOBJ=rtmon.o
ip/ip.c +3 -1
@@ -45,7 +45,7 @@ static void usage(void)" ip [ -force ] -batch filename\n" "where OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable |\n" " tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm |\n" -" netns | l2tp }\n" +" netns | l2tp | tcp_metrics }\n" " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n" " -f[amily] { inet | inet6 | ipx | dnet | bridge | link } |\n" " -l[oops] { maximum-addr-flush-attempts } |\n"
@@ -78,6 +78,8 @@ static const struct cmd { { "tunl", do_iptunnel }, { "tuntap", do_iptuntap }, { "tap", do_iptuntap }, + { "tcpmetrics", do_tcp_metrics }, + { "tcp_metrics",do_tcp_metrics }, { "monitor", do_ipmonitor }, { "xfrm", do_xfrm }, { "mroute", do_multiroute },
ip/ip_common.h +1 -0
@@ -42,6 +42,7 @@ extern int do_multirule(int argc, char **argv);extern int do_netns (int argc,char **argv);extern int do_xfrm (int argc,char **argv);extern int do_ipl2tp (int argc,char **argv); +extern int do_tcp_metrics (int argc,char **argv);static inline int rtm_get_table (struct rtmsg *r,struct rtattr **tb) {
ip/tcp_metrics.c new file +426 -0
426 lines not on this page · raw message
man/man8/Makefile +2 -1
@@ -8,7 +8,8 @@ MAN8PAGES = $(TARGETS) ip.8 arpd.8 lnstat.8 routel.8 rtacct.8 rtmon.8 ss.8 \ bridge.8 rtstat.8 ctstat.8 nstat.8 routef.8 \ ip-address.8 ip-addrlabel.8 ip-l2tp.8 ip-link.8 \ ip-maddress.8 ip-monitor.8 ip-mroute.8 ip-neighbour.8 \ - ip-netns.8 ip-ntable.8 ip-route.8 ip-rule.8 ip-tunnel.8 ip-xfrm.8 + ip-netns.8 ip-ntable.8 ip-route.8 ip-rule.8 ip-tunnel.8 ip-xfrm.8 \ + ip-tcp_metrics.8 all: $(TARGETS)
man/man8/ip-tcp_metrics.8 new file +143 -0
143 lines not on this page · raw message
man/man8/ip.8 +6 -1
@@ -15,7 +15,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels .IR OBJECT " := { " .BR link " | " addr " | " addrlabel " | " route " | " rule " | " neigh " | "\ ntable " | " tunnel " | " tuntap " | " maddr " | " mroute " | " mrule " | "\ - monitor " | " xfrm " | " netns " | " l2tp " }" + monitor " | " xfrm " | " netns " | " l2tp " | " tcp_metrics " }" .sp .ti -8
@@ -161,6 +161,10 @@ host addresses. - rule in routing policy database. .TP +.B tcp_metrics/tcpmetrics +- manage TCP Metrics + +.TP .B tunnel - tunnel over IP.
@@ -220,6 +224,7 @@ was written by Alexey N. Kuznetsov and added in Linux 2.2. .BR ip-ntable (8), .BR ip-route (8), .BR ip-rule (8), +.BR ip-tcp_metrics (8), .BR ip-tunnel (8), .BR ip-xfrm (8) .br
Signature · 1 line
1.7.3.4