diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2015-01-05 17:57:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-05 22:55:24 -0500 |
commit | ea697639992d96da98016b8934e68a73876a2264 (patch) | |
tree | c04b2007e7294668f40e16091b1a11647497c86e /net/ipv6/route.c | |
parent | c5c6a8ab45ec0f18733afb4aaade0d4a139d80b3 (diff) |
net: tcp: add RTAX_CC_ALGO fib handling
This patch adds the minimum necessary for the RTAX_CC_ALGO congestion
control metric to be set up and dumped back to user space.
While the internal representation of RTAX_CC_ALGO is handled as a u32
key, we avoided to expose this implementation detail to user space, thus
instead, we chose the netlink attribute that is being exchanged between
user space to be the actual congestion control algorithm name, similarly
as in the setsockopt(2) API in order to allow for maximum flexibility,
even for 3rd party modules.
It is a bit unfortunate that RTAX_QUICKACK used up a whole RTAX slot as
it should have been stored in RTAX_FEATURES instead, we first thought
about reusing it for the congestion control key, but it brings more
complications and/or confusion than worth it.
Joint work with Florian Westphal.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 454771d20b21..34dcbb59df75 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1488,10 +1488,22 @@ static int ip6_convert_metrics(struct mx6_config *mxc, | |||
1488 | int type = nla_type(nla); | 1488 | int type = nla_type(nla); |
1489 | 1489 | ||
1490 | if (type) { | 1490 | if (type) { |
1491 | u32 val; | ||
1492 | |||
1491 | if (unlikely(type > RTAX_MAX)) | 1493 | if (unlikely(type > RTAX_MAX)) |
1492 | goto err; | 1494 | goto err; |
1495 | if (type == RTAX_CC_ALGO) { | ||
1496 | char tmp[TCP_CA_NAME_MAX]; | ||
1497 | |||
1498 | nla_strlcpy(tmp, nla, sizeof(tmp)); | ||
1499 | val = tcp_ca_get_key_by_name(tmp); | ||
1500 | if (val == TCP_CA_UNSPEC) | ||
1501 | goto err; | ||
1502 | } else { | ||
1503 | val = nla_get_u32(nla); | ||
1504 | } | ||
1493 | 1505 | ||
1494 | mp[type - 1] = nla_get_u32(nla); | 1506 | mp[type - 1] = val; |
1495 | __set_bit(type - 1, mxc->mx_valid); | 1507 | __set_bit(type - 1, mxc->mx_valid); |
1496 | } | 1508 | } |
1497 | } | 1509 | } |
@@ -2571,7 +2583,8 @@ static inline size_t rt6_nlmsg_size(void) | |||
2571 | + nla_total_size(4) /* RTA_OIF */ | 2583 | + nla_total_size(4) /* RTA_OIF */ |
2572 | + nla_total_size(4) /* RTA_PRIORITY */ | 2584 | + nla_total_size(4) /* RTA_PRIORITY */ |
2573 | + RTAX_MAX * nla_total_size(4) /* RTA_METRICS */ | 2585 | + RTAX_MAX * nla_total_size(4) /* RTA_METRICS */ |
2574 | + nla_total_size(sizeof(struct rta_cacheinfo)); | 2586 | + nla_total_size(sizeof(struct rta_cacheinfo)) |
2587 | + nla_total_size(TCP_CA_NAME_MAX); /* RTAX_CC_ALGO */ | ||
2575 | } | 2588 | } |
2576 | 2589 | ||
2577 | static int rt6_fill_node(struct net *net, | 2590 | static int rt6_fill_node(struct net *net, |