From 863f0cafefd9293451fe4682b02c8186a68ad30a Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 18 Feb 2016 14:19:36 +0100 Subject: [PATCH] ip: route: add congestion control metric Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1291832 Upstream Status: iproute2.git commit 6ef87f9cce213 commit 6ef87f9cce213cae66098d08e0abc36d67b95244 Author: Daniel Borkmann Date: Fri Jan 9 00:13:06 2015 +0100 ip: route: add congestion control metric This patch adds configuration and dumping of congestion control metric for ip route, for example: ip route add dev foo congctl [lock] dctcp Reference: http://thread.gmane.org/gmane.linux.network/344733 Signed-off-by: Daniel Borkmann --- ip/iproute.c | 22 ++++++++++++++++++---- man/man8/ip-route.8.in | 19 ++++++++++++++++++- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/ip/iproute.c b/ip/iproute.c index ea69aa3..d3a5e1c 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -53,6 +53,7 @@ static const char *mx_names[RTAX_MAX+1] = { [RTAX_RTO_MIN] = "rto_min", [RTAX_INITRWND] = "initrwnd", [RTAX_QUICKACK] = "quickack", + [RTAX_CC_ALGO] = "congctl", }; static void usage(void) __attribute__((noreturn)); @@ -80,8 +81,7 @@ static void usage(void) fprintf(stderr, " [ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]\n"); fprintf(stderr, " [ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]\n"); fprintf(stderr, " [ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]\n"); - fprintf(stderr, " [ features FEATURES ]\n"); - fprintf(stderr, " [ quickack BOOL ]\n"); + fprintf(stderr, " [ features FEATURES ] [ quickack BOOL ] [ congctl NAME ]\n"); fprintf(stderr, "TYPE := [ unicast | local | broadcast | multicast | throw |\n"); fprintf(stderr, " unreachable | prohibit | blackhole | nat ]\n"); fprintf(stderr, "TABLE_ID := [ local | main | default | all | NUMBER ]\n"); @@ -539,7 +539,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) mxlock = *(unsigned*)RTA_DATA(mxrta[RTAX_LOCK]); for (i=2; i<= RTAX_MAX; i++) { - unsigned val; + __u32 val; if (mxrta[i] == NULL) continue; @@ -548,10 +548,12 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) fprintf(fp, " %s", mx_names[i]); else fprintf(fp, " metric %d", i); + if (mxlock & (1<