aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2015-01-05 17:57:47 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-05 22:55:24 -0500
commitea697639992d96da98016b8934e68a73876a2264 (patch)
treec04b2007e7294668f40e16091b1a11647497c86e /net/ipv4
parentc5c6a8ab45ec0f18733afb4aaade0d4a139d80b3 (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/ipv4')
-rw-r--r--net/ipv4/fib_semantics.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index f99f41bd15b8..d2b7b5521b1b 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -360,7 +360,8 @@ static inline size_t fib_nlmsg_size(struct fib_info *fi)
360 + nla_total_size(4) /* RTA_TABLE */ 360 + nla_total_size(4) /* RTA_TABLE */
361 + nla_total_size(4) /* RTA_DST */ 361 + nla_total_size(4) /* RTA_DST */
362 + nla_total_size(4) /* RTA_PRIORITY */ 362 + nla_total_size(4) /* RTA_PRIORITY */
363 + nla_total_size(4); /* RTA_PREFSRC */ 363 + nla_total_size(4) /* RTA_PREFSRC */
364 + nla_total_size(TCP_CA_NAME_MAX); /* RTAX_CC_ALGO */
364 365
365 /* space for nested metrics */ 366 /* space for nested metrics */
366 payload += nla_total_size((RTAX_MAX * nla_total_size(4))); 367 payload += nla_total_size((RTAX_MAX * nla_total_size(4)));
@@ -859,7 +860,16 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
859 860
860 if (type > RTAX_MAX) 861 if (type > RTAX_MAX)
861 goto err_inval; 862 goto err_inval;
862 val = nla_get_u32(nla); 863 if (type == RTAX_CC_ALGO) {
864 char tmp[TCP_CA_NAME_MAX];
865
866 nla_strlcpy(tmp, nla, sizeof(tmp));
867 val = tcp_ca_get_key_by_name(tmp);
868 if (val == TCP_CA_UNSPEC)
869 goto err_inval;
870 } else {
871 val = nla_get_u32(nla);
872 }
863 if (type == RTAX_ADVMSS && val > 65535 - 40) 873 if (type == RTAX_ADVMSS && val > 65535 - 40)
864 val = 65535 - 40; 874 val = 65535 - 40;
865 if (type == RTAX_MTU && val > 65535 - 15) 875 if (type == RTAX_MTU && val > 65535 - 15)