metrics.c (58e16d792a6a8c6b750f637a4649967fcac853dc) metrics.c (872f690341948b502c93318f806d821c56772c42)
1// SPDX-License-Identifier: GPL-2.0-only
2#include <linux/netlink.h>
3#include <linux/rtnetlink.h>
4#include <linux/types.h>
5#include <net/ip.h>
6#include <net/net_namespace.h>
7#include <net/tcp.h>
8

--- 17 unchanged lines hidden (view full) ---

26 if (type > RTAX_MAX) {
27 NL_SET_ERR_MSG(extack, "Invalid metric type");
28 return -EINVAL;
29 }
30
31 if (type == RTAX_CC_ALGO) {
32 char tmp[TCP_CA_NAME_MAX];
33
1// SPDX-License-Identifier: GPL-2.0-only
2#include <linux/netlink.h>
3#include <linux/rtnetlink.h>
4#include <linux/types.h>
5#include <net/ip.h>
6#include <net/net_namespace.h>
7#include <net/tcp.h>
8

--- 17 unchanged lines hidden (view full) ---

26 if (type > RTAX_MAX) {
27 NL_SET_ERR_MSG(extack, "Invalid metric type");
28 return -EINVAL;
29 }
30
31 if (type == RTAX_CC_ALGO) {
32 char tmp[TCP_CA_NAME_MAX];
33
34 nla_strlcpy(tmp, nla, sizeof(tmp));
34 nla_strscpy(tmp, nla, sizeof(tmp));
35 val = tcp_ca_get_key_by_name(net, tmp, &ecn_ca);
36 if (val == TCP_CA_UNSPEC) {
37 NL_SET_ERR_MSG(extack, "Unknown tcp congestion algorithm");
38 return -EINVAL;
39 }
40 } else {
41 if (nla_len(nla) != sizeof(u32)) {
42 NL_SET_ERR_MSG_ATTR(extack, nla,

--- 50 unchanged lines hidden ---
35 val = tcp_ca_get_key_by_name(net, tmp, &ecn_ca);
36 if (val == TCP_CA_UNSPEC) {
37 NL_SET_ERR_MSG(extack, "Unknown tcp congestion algorithm");
38 return -EINVAL;
39 }
40 } else {
41 if (nla_len(nla) != sizeof(u32)) {
42 NL_SET_ERR_MSG_ATTR(extack, nla,

--- 50 unchanged lines hidden ---