diff --git a/.gitignore b/.gitignore index fe00b2f..1af7f79 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /iproute2-4.20.0.tar.xz /iproute2-5.0.0.tar.xz /iproute2-5.1.0.tar.xz +/iproute2-5.2.0.tar.xz diff --git a/0001-Revert-ip6tunnel-fix-ip-6-show-change-dev-name-cmds.patch b/0001-Revert-ip6tunnel-fix-ip-6-show-change-dev-name-cmds.patch new file mode 100644 index 0000000..5964cb0 --- /dev/null +++ b/0001-Revert-ip6tunnel-fix-ip-6-show-change-dev-name-cmds.patch @@ -0,0 +1,41 @@ +From 8cfac8f16a88bac7453da91aeca9e2c4244ca92a Mon Sep 17 00:00:00 2001 +From: Andrea Claudi +Date: Tue, 9 Jul 2019 15:16:50 +0200 +Subject: [PATCH] Revert "ip6tunnel: fix 'ip -6 {show|change} dev ' cmds" + +This reverts commit ba126dcad20e6d0e472586541d78bdd1ac4f1123. +It breaks tunnel creation when using 'dev' parameter: + +$ ip link add type dummy +$ ip -6 tunnel add ip6tnl1 mode ip6ip6 remote 2001:db8:ffff:100::2 local 2001:db8:ffff:100::1 hoplimit 1 tclass 0x0 dev dummy0 +add tunnel "ip6tnl0" failed: File exists + +dev parameter must be used to specify the device to which +the tunnel is binded, and not the tunnel itself. + +Reported-by: Jianwen Ji +Reviewed-by: Matteo Croce +Signed-off-by: Andrea Claudi +Signed-off-by: Stephen Hemminger +(cherry picked from commit ad04dbc5b41df509cd6925eab36af73000632fd2) +Signed-off-by: Phil Sutter +--- + ip/ip6tunnel.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c +index 56fd3466ed062..999408ed801b1 100644 +--- a/ip/ip6tunnel.c ++++ b/ip/ip6tunnel.c +@@ -298,8 +298,6 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p) + p->link = ll_name_to_index(medium); + if (!p->link) + return nodev(medium); +- else +- strlcpy(p->name, medium, sizeof(p->name)); + } + return 0; + } +-- +2.22.0 + diff --git a/0001-m_mirred-don-t-bail-if-the-control-action-is-missing.patch b/0001-m_mirred-don-t-bail-if-the-control-action-is-missing.patch deleted file mode 100644 index 8acd9fb..0000000 --- a/0001-m_mirred-don-t-bail-if-the-control-action-is-missing.patch +++ /dev/null @@ -1,39 +0,0 @@ -From bdda9ba541aac9f840af8554e60fcede68c6e8a1 Mon Sep 17 00:00:00 2001 -From: Paolo Abeni -Date: Mon, 20 May 2019 11:56:52 +0200 -Subject: [PATCH] m_mirred: don't bail if the control action is missing - -The mirred act admits an optional control action, defaulting -to TC_ACT_PIPE. The parsing code currently emits an error message -if the control action is not provided on the command line, even -if the command itself completes with no error. - -This change shuts down the error message, using the appropriate -parsing helper. - -Fixes: e67aba559581 ("tc: actions: add helpers to parse and print control actions") -Signed-off-by: Paolo Abeni -Signed-off-by: Stephen Hemminger -(cherry picked from commit 6eccf7ecdb010a90e5271942748ef4338ddb61ae) -Signed-off-by: Phil Sutter ---- - tc/m_mirred.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/tc/m_mirred.c b/tc/m_mirred.c -index c7f7318b8413f..23ba638a234d1 100644 ---- a/tc/m_mirred.c -+++ b/tc/m_mirred.c -@@ -202,7 +202,8 @@ parse_direction(struct action_util *a, int *argc_p, char ***argv_p, - - - if (p.eaction == TCA_EGRESS_MIRROR || p.eaction == TCA_INGRESS_MIRROR) -- parse_action_control(&argc, &argv, &p.action, false); -+ parse_action_control_dflt(&argc, &argv, &p.action, false, -+ TC_ACT_PIPE); - - if (argc) { - if (iok && matches(*argv, "index") == 0) { --- -2.21.0 - diff --git a/0002-ip-tunnel-warn-when-changing-IPv6-tunnel-without-tun.patch b/0002-ip-tunnel-warn-when-changing-IPv6-tunnel-without-tun.patch new file mode 100644 index 0000000..acf0c21 --- /dev/null +++ b/0002-ip-tunnel-warn-when-changing-IPv6-tunnel-without-tun.patch @@ -0,0 +1,52 @@ +From 141c6e6397d373126bba14982678dd6f1e9fbfd7 Mon Sep 17 00:00:00 2001 +From: Andrea Claudi +Date: Tue, 9 Jul 2019 15:16:51 +0200 +Subject: [PATCH] ip tunnel: warn when changing IPv6 tunnel without tunnel name + +Tunnel change fails if a tunnel name is not specified while using +'ip -6 tunnel change'. However, no warning message is printed and +no error code is returned. + +$ ip -6 tunnel add ip6tnl1 mode ip6gre local fd::1 remote fd::2 tos inherit ttl 127 encaplimit none dev dummy0 +$ ip -6 tunnel change dev dummy0 local 2001:1234::1 remote 2001:1234::2 +$ ip -6 tunnel show ip6tnl1 +ip6tnl1: gre/ipv6 remote fd::2 local fd::1 dev dummy0 encaplimit none hoplimit 127 tclass inherit flowlabel 0x00000 (flowinfo 0x00000000) + +This commit checks if tunnel interface name is equal to an empty +string: in this case, it prints a warning message to the user. +It intentionally avoids to return an error to not break existing +script setup. + +This is the output after this commit: +$ ip -6 tunnel add ip6tnl1 mode ip6gre local fd::1 remote fd::2 tos inherit ttl 127 encaplimit none dev dummy0 +$ ip -6 tunnel change dev dummy0 local 2001:1234::1 remote 2001:1234::2 +Tunnel interface name not specified +$ ip -6 tunnel show ip6tnl1 +ip6tnl1: gre/ipv6 remote fd::2 local fd::1 dev dummy0 encaplimit none hoplimit 127 tclass inherit flowlabel 0x00000 (flowinfo 0x00000000) + +Reviewed-by: Matteo Croce +Signed-off-by: Andrea Claudi +Signed-off-by: Stephen Hemminger +(cherry picked from commit d035cc1b4e83e2589ea2115cdc2fa7c6d3693a5a) +Signed-off-by: Phil Sutter +--- + ip/ip6tunnel.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c +index 999408ed801b1..e3da11eb4518e 100644 +--- a/ip/ip6tunnel.c ++++ b/ip/ip6tunnel.c +@@ -386,6 +386,9 @@ static int do_add(int cmd, int argc, char **argv) + if (parse_args(argc, argv, cmd, &p) < 0) + return -1; + ++ if (!*p.name) ++ fprintf(stderr, "Tunnel interface name not specified\n"); ++ + if (p.proto == IPPROTO_GRE) + basedev = "ip6gre0"; + else if (p.i_flags & VTI_ISVTI) +-- +2.22.0 + diff --git a/0002-lib-suppress-error-msg-when-filling-the-cache.patch b/0002-lib-suppress-error-msg-when-filling-the-cache.patch deleted file mode 100644 index 3f5a1cb..0000000 --- a/0002-lib-suppress-error-msg-when-filling-the-cache.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 179024901d8760312d153ff843306eec66863a4f Mon Sep 17 00:00:00 2001 -From: Nicolas Dichtel -Date: Fri, 24 May 2019 10:59:10 +0200 -Subject: [PATCH] lib: suppress error msg when filling the cache - -Before the patch: -$ ip netns add foo -$ ip link add name veth1 address 2a:a5:5c:b9:52:89 type veth peer name veth2 address 2a:a5:5c:b9:53:90 netns foo -RTNETLINK answers: No such device -RTNETLINK answers: No such device - -But the command was successful. This may break script. Let's remove those -error messages. - -Fixes: 55870dfe7f8b ("Improve batch and dump times by caching link lookups") -Reported-by: Philippe Guibert -Signed-off-by: Nicolas Dichtel -Signed-off-by: Stephen Hemminger -(cherry picked from commit 757837230a654d39623d0b90882b695a2facd107) -Signed-off-by: Phil Sutter ---- - lib/ll_map.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/ll_map.c b/lib/ll_map.c -index 2d7b65dcb8f7e..e0ed54bf77c98 100644 ---- a/lib/ll_map.c -+++ b/lib/ll_map.c -@@ -177,7 +177,7 @@ static int ll_link_get(const char *name, int index) - addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name, - strlen(name) + 1); - -- if (rtnl_talk(&rth, &req.n, &answer) < 0) -+ if (rtnl_talk_suppress_rtnl_errmsg(&rth, &req.n, &answer) < 0) - goto out; - - /* add entry to cache */ --- -2.21.0 - diff --git a/0003-ip-route-fix-json-formatting-for-metrics.patch b/0003-ip-route-fix-json-formatting-for-metrics.patch new file mode 100644 index 0000000..092ba3e --- /dev/null +++ b/0003-ip-route-fix-json-formatting-for-metrics.patch @@ -0,0 +1,78 @@ +From 9da7fb1dd27624ed6ab62f5595451f43c3a07d2d Mon Sep 17 00:00:00 2001 +From: Andrea Claudi +Date: Mon, 8 Jul 2019 11:36:42 +0200 +Subject: [PATCH] ip-route: fix json formatting for metrics + +Setting metrics for routes currently lead to non-parsable +json output. For example: + +$ ip link add type dummy +$ ip route add 192.168.2.0 dev dummy0 metric 100 mtu 1000 rto_min 3 +$ ip -j route | jq +parse error: ':' not as part of an object at line 1, column 319 + +Fixing this opening a json object in the metrics array and using +print_string() instead of fprintf(). + +This is the output for the above commands applying this patch: + +$ ip -j route | jq +[ + { + "dst": "192.168.2.0", + "dev": "dummy0", + "scope": "link", + "metric": 100, + "flags": [], + "metrics": [ + { + "mtu": 1000, + "rto_min": 3 + } + ] + } +] + +Fixes: 663c3cb23103f ("iproute: implement JSON and color output") +Fixes: 968272e791710 ("iproute: refactor metrics print") +Signed-off-by: Andrea Claudi +Reported-by: Frank Hofmann +Signed-off-by: Stephen Hemminger +(cherry picked from commit 89ce8012d71f5689074dc4cbe3db102cbdf76460) +Signed-off-by: Phil Sutter +--- + ip/iproute.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/ip/iproute.c b/ip/iproute.c +index 1669e0138259e..2f9b612b0b506 100644 +--- a/ip/iproute.c ++++ b/ip/iproute.c +@@ -578,6 +578,7 @@ static void print_rta_metrics(FILE *fp, const struct rtattr *rta) + int i; + + open_json_array(PRINT_JSON, "metrics"); ++ open_json_object(NULL); + + parse_rtattr(mxrta, RTAX_MAX, RTA_DATA(rta), RTA_PAYLOAD(rta)); + +@@ -611,7 +612,7 @@ static void print_rta_metrics(FILE *fp, const struct rtattr *rta) + print_rtax_features(fp, val); + break; + default: +- fprintf(fp, "%u ", val); ++ print_uint(PRINT_ANY, mx_names[i], "%u ", val); + break; + + case RTAX_RTT: +@@ -639,6 +640,7 @@ static void print_rta_metrics(FILE *fp, const struct rtattr *rta) + } + } + ++ close_json_object(); + close_json_array(PRINT_JSON, NULL); + } + +-- +2.22.0 + diff --git a/0003-tc-flower-fix-port-value-truncation.patch b/0003-tc-flower-fix-port-value-truncation.patch deleted file mode 100644 index 63b1dec..0000000 --- a/0003-tc-flower-fix-port-value-truncation.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 9cfbfd6b5b3aa49b3966853d06fb3ddae82e207e Mon Sep 17 00:00:00 2001 -From: Lukasz Czapnik -Date: Mon, 27 May 2019 23:03:49 +0200 -Subject: [PATCH] tc: flower: fix port value truncation - -sscanf truncates read port values silently without any error. As sscanf -man says: -(...) sscanf() conform to C89 and C99 and POSIX.1-2001. These standards -do not specify the ERANGE error. - -Replace sscanf with safer get_be16 that returns error when value is out -of range. - -Example: -tc filter add dev eth0 protocol ip parent ffff: prio 1 flower ip_proto -tcp dst_port 70000 hw_tc 1 - -Would result in filter for port 4464 without any warning. - -Fixes: 8930840e678b ("tc: flower: Classify packets based port ranges") -Signed-off-by: Lukasz Czapnik -Signed-off-by: Stephen Hemminger -(cherry picked from commit 767b6fd620ddc4319a121595f953313b2e9789ff) -Signed-off-by: Phil Sutter ---- - tc/f_flower.c | 48 ++++++++++++++++++++++++++++++++++++------------ - 1 file changed, 36 insertions(+), 12 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 9659e894dd1f9..e2420d924248d 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -493,23 +493,40 @@ static int flower_port_range_attr_type(__u8 ip_proto, enum flower_endpoint type, - return 0; - } - -+/* parse range args in format 10-20 */ -+static int parse_range(char *str, __be16 *min, __be16 *max) -+{ -+ char *sep; -+ -+ sep = strchr(str, '-'); -+ if (sep) { -+ *sep = '\0'; -+ -+ if (get_be16(min, str, 10)) -+ return -1; -+ -+ if (get_be16(max, sep + 1, 10)) -+ return -1; -+ } else { -+ if (get_be16(min, str, 10)) -+ return -1; -+ } -+ return 0; -+} -+ - static int flower_parse_port(char *str, __u8 ip_proto, - enum flower_endpoint endpoint, - struct nlmsghdr *n) - { -- __u16 min, max; -+ __be16 min = 0; -+ __be16 max = 0; - int ret; - -- ret = sscanf(str, "%hu-%hu", &min, &max); -- -- if (ret == 1) { -- int type; -+ ret = parse_range(str, &min, &max); -+ if (ret) -+ return -1; - -- type = flower_port_attr_type(ip_proto, endpoint); -- if (type < 0) -- return -1; -- addattr16(n, MAX_MSG, type, htons(min)); -- } else if (ret == 2) { -+ if (min && max) { - __be16 min_port_type, max_port_type; - - if (max <= min) { -@@ -520,8 +537,15 @@ static int flower_parse_port(char *str, __u8 ip_proto, - &min_port_type, &max_port_type)) - return -1; - -- addattr16(n, MAX_MSG, min_port_type, htons(min)); -- addattr16(n, MAX_MSG, max_port_type, htons(max)); -+ addattr16(n, MAX_MSG, min_port_type, min); -+ addattr16(n, MAX_MSG, max_port_type, max); -+ } else if (min && !max) { -+ int type; -+ -+ type = flower_port_attr_type(ip_proto, endpoint); -+ if (type < 0) -+ return -1; -+ addattr16(n, MAX_MSG, type, min); - } else { - return -1; - } --- -2.21.0 - diff --git a/0004-utils-move-parse_percent-to-tc_util.patch b/0004-utils-move-parse_percent-to-tc_util.patch new file mode 100644 index 0000000..fe3ce46 --- /dev/null +++ b/0004-utils-move-parse_percent-to-tc_util.patch @@ -0,0 +1,113 @@ +From 5b17171ce7363e597009e07fb143522a2d79c77b Mon Sep 17 00:00:00 2001 +From: Andrea Claudi +Date: Fri, 28 Jun 2019 18:03:45 +0200 +Subject: [PATCH] utils: move parse_percent() to tc_util + +As parse_percent() is used only in tc. + +This reduces ip, bridge and genl binaries size: + +$ bloat-o-meter -t bridge/bridge bridge/bridge.new +add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-109 (-109) +Total: Before=50973, After=50864, chg -0.21% + +$ bloat-o-meter -t genl/genl genl/genl.new +add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-109 (-109) +Total: Before=30298, After=30189, chg -0.36% + +$ bloat-o-meter ip/ip ip/ip.new +add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-109 (-109) +Total: Before=674164, After=674055, chg -0.02% + +Signed-off-by: Andrea Claudi +Signed-off-by: David Ahern +(cherry picked from commit 1e5746d5e13d895b63da954f0290cffbb076cefa) +Signed-off-by: Phil Sutter +--- + include/utils.h | 1 - + lib/utils.c | 16 ---------------- + tc/tc_util.c | 16 ++++++++++++++++ + tc/tc_util.h | 1 + + 4 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/include/utils.h b/include/utils.h +index 927fdc17e09dd..f9a4916b517ab 100644 +--- a/include/utils.h ++++ b/include/utils.h +@@ -145,7 +145,6 @@ int get_addr_rta(inet_prefix *dst, const struct rtattr *rta, int family); + int get_addr_ila(__u64 *val, const char *arg); + + int read_prop(const char *dev, char *prop, long *value); +-int parse_percent(double *val, const char *str); + int get_hex(char c); + int get_integer(int *val, const char *arg, int base); + int get_unsigned(unsigned *val, const char *arg, int base); +diff --git a/lib/utils.c b/lib/utils.c +index be0f11b00280d..5da9a47848966 100644 +--- a/lib/utils.c ++++ b/lib/utils.c +@@ -101,22 +101,6 @@ out: + return -1; + } + +-/* Parse a percent e.g: '30%' +- * return: 0 = ok, -1 = error, 1 = out of range +- */ +-int parse_percent(double *val, const char *str) +-{ +- char *p; +- +- *val = strtod(str, &p) / 100.; +- if (*val == HUGE_VALF || *val == HUGE_VALL) +- return 1; +- if (*p && strcmp(p, "%")) +- return -1; +- +- return 0; +-} +- + int get_hex(char c) + { + if (c >= 'A' && c <= 'F') +diff --git a/tc/tc_util.c b/tc/tc_util.c +index e5d15281581df..53d15e08e9734 100644 +--- a/tc/tc_util.c ++++ b/tc/tc_util.c +@@ -190,6 +190,22 @@ static const struct rate_suffix { + { NULL } + }; + ++/* Parse a percent e.g: '30%' ++ * return: 0 = ok, -1 = error, 1 = out of range ++ */ ++int parse_percent(double *val, const char *str) ++{ ++ char *p; ++ ++ *val = strtod(str, &p) / 100.; ++ if (*val == HUGE_VALF || *val == HUGE_VALL) ++ return 1; ++ if (*p && strcmp(p, "%")) ++ return -1; ++ ++ return 0; ++} ++ + static int parse_percent_rate(char *rate, size_t len, + const char *str, const char *dev) + { +diff --git a/tc/tc_util.h b/tc/tc_util.h +index 825fea36a0809..eb4b60db3fdd7 100644 +--- a/tc/tc_util.h ++++ b/tc/tc_util.h +@@ -101,6 +101,7 @@ int print_tc_classid(char *buf, int len, __u32 h); + char *sprint_tc_classid(__u32 h, char *buf); + + int tc_print_police(FILE *f, struct rtattr *tb); ++int parse_percent(double *val, const char *str); + int parse_police(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n); + + int parse_action_control(int *argc_p, char ***argv_p, +-- +2.22.0 + diff --git a/0005-tc-util-constrain-percentage-in-0-100-interval.patch b/0005-tc-util-constrain-percentage-in-0-100-interval.patch new file mode 100644 index 0000000..d5928f5 --- /dev/null +++ b/0005-tc-util-constrain-percentage-in-0-100-interval.patch @@ -0,0 +1,97 @@ +From 29a5b8d072d06b685c428f15125ff62b8b470064 Mon Sep 17 00:00:00 2001 +From: Andrea Claudi +Date: Sat, 13 Jul 2019 11:44:07 +0200 +Subject: [PATCH] tc: util: constrain percentage in 0-100 interval + +parse_percent() currently allows to specify negative percentages +or value above 100%. However this does not seems to make sense, +as the function is used for probabilities or bandiwidth rates. + +Moreover, using negative values leads to erroneous results +(using Bernoulli loss model as example): + +$ ip link add test type dummy +$ ip link set test up +$ tc qdisc add dev test root netem loss gemodel -10% limit 10 +$ tc qdisc show dev test +qdisc netem 800c: root refcnt 2 limit 10 loss gemodel p 90% r 10% 1-h 100% 1-k 0% + +Using values above 100% we have instead: + +$ ip link add test type dummy +$ ip link set test up +$ tc qdisc add dev test root netem loss gemodel 140% limit 10 +$ tc qdisc show dev test +qdisc netem 800f: root refcnt 2 limit 10 loss gemodel p 40% r 60% 1-h 100% 1-k 0% + +This commit changes parse_percent() with a check to ensure +percentage values stay between 1.0 and 0.0. +parse_percent_rate() function, which already employs a similar +check, is adjusted accordingly. + +With this check in place, we have: + +$ ip link add test type dummy +$ ip link set test up +$ tc qdisc add dev test root netem loss gemodel -10% limit 10 +Illegal "loss gemodel p" + +Fixes: 927e3cfb52b58 ("tc: B.W limits can now be specified in %.") +Signed-off-by: Andrea Claudi +Signed-off-by: Stephen Hemminger +(cherry picked from commit 6bc13e4a20f50e9c37d5a504c78222913c433fd3) +Signed-off-by: Phil Sutter +--- + tc/tc_util.c | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +diff --git a/tc/tc_util.c b/tc/tc_util.c +index 53d15e08e9734..b90d256c33a4a 100644 +--- a/tc/tc_util.c ++++ b/tc/tc_util.c +@@ -198,7 +198,7 @@ int parse_percent(double *val, const char *str) + char *p; + + *val = strtod(str, &p) / 100.; +- if (*val == HUGE_VALF || *val == HUGE_VALL) ++ if (*val > 1.0 || *val < 0.0) + return 1; + if (*p && strcmp(p, "%")) + return -1; +@@ -226,16 +226,16 @@ static int parse_percent_rate(char *rate, size_t len, + if (ret != 1) + goto malf; + +- if (parse_percent(&perc, str_perc)) ++ ret = parse_percent(&perc, str_perc); ++ if (ret == 1) { ++ fprintf(stderr, "Invalid rate specified; should be between [0,100]%% but is %s\n", str); ++ goto err; ++ } else if (ret == -1) { + goto malf; ++ } + + free(str_perc); + +- if (perc > 1.0 || perc < 0.0) { +- fprintf(stderr, "Invalid rate specified; should be between [0,100]%% but is %s\n", str); +- return -1; +- } +- + rate_bit = perc * dev_mbit * 1000 * 1000; + + ret = snprintf(rate, len, "%lf", rate_bit); +@@ -247,8 +247,9 @@ static int parse_percent_rate(char *rate, size_t len, + return 0; + + malf: +- free(str_perc); + fprintf(stderr, "Specified rate value could not be read or is malformed\n"); ++err: ++ free(str_perc); + return -1; + } + +-- +2.22.0 + diff --git a/0006-devlink-Change-devlink-health-dump-show-command-to-d.patch b/0006-devlink-Change-devlink-health-dump-show-command-to-d.patch new file mode 100644 index 0000000..a0688e3 --- /dev/null +++ b/0006-devlink-Change-devlink-health-dump-show-command-to-d.patch @@ -0,0 +1,64 @@ +From f12ee1269f04a5f4ab5c18326004af32da4061ae Mon Sep 17 00:00:00 2001 +From: Aya Levin +Date: Wed, 10 Jul 2019 14:03:19 +0300 +Subject: [PATCH] devlink: Change devlink health dump show command to dumpit + +Although devlink health dump show command is given per reporter, it +returns large amounts of data. Trying to use the doit cb results in +OUT-OF-BUFFER error. This complementary patch raises the DUMP flag in +order to invoke the dumpit cb. We're safe as no existing drivers +implement the dump health reporter option yet. + +Fixes: 041e6e651a8e ("devlink: Add devlink health dump show command") +Signed-off-by: Aya Levin +Signed-off-by: Tariq Toukan +Acked-by: Jiri Pirko +Signed-off-by: Stephen Hemminger +(cherry picked from commit b4d97ef57fd4b7669971ed209065a72d115dffc2) +Signed-off-by: Phil Sutter +--- + devlink/devlink.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/devlink/devlink.c b/devlink/devlink.c +index 5618ba26d6fb3..9c338cb4ccc84 100644 +--- a/devlink/devlink.c ++++ b/devlink/devlink.c +@@ -6072,13 +6072,13 @@ static int cmd_fmsg_object_cb(const struct nlmsghdr *nlh, void *data) + return MNL_CB_OK; + } + +-static int cmd_health_object_common(struct dl *dl, uint8_t cmd) ++static int cmd_health_object_common(struct dl *dl, uint8_t cmd, uint16_t flags) + { + struct fmsg_cb_data data; + struct nlmsghdr *nlh; + int err; + +- nlh = mnlg_msg_prepare(dl->nlg, cmd, NLM_F_REQUEST | NLM_F_ACK); ++ nlh = mnlg_msg_prepare(dl->nlg, cmd, flags | NLM_F_REQUEST | NLM_F_ACK); + + err = dl_argv_parse_put(nlh, dl, + DL_OPT_HANDLE | DL_OPT_HEALTH_REPORTER_NAME, 0); +@@ -6093,12 +6093,16 @@ static int cmd_health_object_common(struct dl *dl, uint8_t cmd) + + static int cmd_health_dump_show(struct dl *dl) + { +- return cmd_health_object_common(dl, DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET); ++ return cmd_health_object_common(dl, ++ DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET, ++ NLM_F_DUMP); + } + + static int cmd_health_diagnose(struct dl *dl) + { +- return cmd_health_object_common(dl, DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE); ++ return cmd_health_object_common(dl, ++ DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE, ++ 0); + } + + static int cmd_health_recover(struct dl *dl) +-- +2.22.0 + diff --git a/0007-devlink-Fix-binary-values-print.patch b/0007-devlink-Fix-binary-values-print.patch new file mode 100644 index 0000000..a91296f --- /dev/null +++ b/0007-devlink-Fix-binary-values-print.patch @@ -0,0 +1,83 @@ +From 4aaf5d7099e7b985973b49f59ceef9b1fd6f6810 Mon Sep 17 00:00:00 2001 +From: Aya Levin +Date: Wed, 10 Jul 2019 14:03:20 +0300 +Subject: [PATCH] devlink: Fix binary values print + +Fix function pr_out_binary_value() to start printing the binary buffer +from offset 0 instead of offset 1. Remove redundant new line at the +beginning of the output + +Example: +With patch: + mlx5e_txqsq: + 05 00 00 00 05 00 00 00 01 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 8e 6e 3a 13 07 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + c0 +Without patch + mlx5e_txqsq: + + 00 00 00 05 00 00 00 01 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 8e 6e 3a 13 07 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 c0 + +Fixes: 844a61764c6f ("devlink: Add helper functions for name and value separately") +Signed-off-by: Aya Levin +Signed-off-by: Tariq Toukan +Signed-off-by: Stephen Hemminger +(cherry picked from commit 1d05cca2fd70a5bc8a9f4e978aa5629dbc99a973) +Signed-off-by: Phil Sutter +--- + devlink/devlink.c | 24 +++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +diff --git a/devlink/devlink.c b/devlink/devlink.c +index 9c338cb4ccc84..5dff974c93c93 100644 +--- a/devlink/devlink.c ++++ b/devlink/devlink.c +@@ -1779,29 +1779,31 @@ static void pr_out_uint64_value(struct dl *dl, uint64_t value) + pr_out(" %"PRIu64, value); + } + ++static bool is_binary_eol(int i) ++{ ++ return !(i%16); ++} ++ + static void pr_out_binary_value(struct dl *dl, uint8_t *data, uint32_t len) + { +- int i = 1; ++ int i = 0; + + if (dl->json_output) + jsonw_start_array(dl->jw); +- else +- pr_out("\n"); + + while (i < len) { +- if (dl->json_output) { ++ if (dl->json_output) + jsonw_printf(dl->jw, "%d", data[i]); +- } else { +- pr_out(" %02x", data[i]); +- if (!(i % 16)) +- pr_out("\n"); +- } ++ else ++ pr_out("%02x ", data[i]); + i++; ++ if (!dl->json_output && is_binary_eol(i)) ++ __pr_out_newline(); + } + if (dl->json_output) + jsonw_end_array(dl->jw); +- else if ((i - 1) % 16) +- pr_out("\n"); ++ else if (!is_binary_eol(i)) ++ __pr_out_newline(); + } + + static void pr_out_str_value(struct dl *dl, const char *value) +-- +2.22.0 + diff --git a/0008-devlink-Remove-enclosing-array-brackets-binary-print.patch b/0008-devlink-Remove-enclosing-array-brackets-binary-print.patch new file mode 100644 index 0000000..b9d6096 --- /dev/null +++ b/0008-devlink-Remove-enclosing-array-brackets-binary-print.patch @@ -0,0 +1,47 @@ +From a5d73c80107321aafd1e2007a059a7eb950412d7 Mon Sep 17 00:00:00 2001 +From: Aya Levin +Date: Wed, 10 Jul 2019 14:03:21 +0300 +Subject: [PATCH] devlink: Remove enclosing array brackets binary print with + json format + +Keep pr_out_binary_value function only for printing. Inner relations +like array grouping should be done outside the function. + +Fixes: 844a61764c6f ("devlink: Add helper functions for name and value separately") +Signed-off-by: Aya Levin +Signed-off-by: Tariq Toukan +Signed-off-by: Stephen Hemminger +(cherry picked from commit f359942a25d368ccf2e47b79f95db2798e09f7a4) +Signed-off-by: Phil Sutter +--- + devlink/devlink.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/devlink/devlink.c b/devlink/devlink.c +index 5dff974c93c93..ebb1de3eb2eaa 100644 +--- a/devlink/devlink.c ++++ b/devlink/devlink.c +@@ -1788,9 +1788,6 @@ static void pr_out_binary_value(struct dl *dl, uint8_t *data, uint32_t len) + { + int i = 0; + +- if (dl->json_output) +- jsonw_start_array(dl->jw); +- + while (i < len) { + if (dl->json_output) + jsonw_printf(dl->jw, "%d", data[i]); +@@ -1800,9 +1797,7 @@ static void pr_out_binary_value(struct dl *dl, uint8_t *data, uint32_t len) + if (!dl->json_output && is_binary_eol(i)) + __pr_out_newline(); + } +- if (dl->json_output) +- jsonw_end_array(dl->jw); +- else if (!is_binary_eol(i)) ++ if (!dl->json_output && !is_binary_eol(i)) + __pr_out_newline(); + } + +-- +2.22.0 + diff --git a/0009-json-fix-backslash-escape-typo-in-jsonw_puts.patch b/0009-json-fix-backslash-escape-typo-in-jsonw_puts.patch new file mode 100644 index 0000000..52d01b1 --- /dev/null +++ b/0009-json-fix-backslash-escape-typo-in-jsonw_puts.patch @@ -0,0 +1,30 @@ +From 742a2436d344ac15330c56a2326c03c8c56686a5 Mon Sep 17 00:00:00 2001 +From: Ivan Delalande +Date: Wed, 17 Jul 2019 18:15:31 -0700 +Subject: [PATCH] json: fix backslash escape typo in jsonw_puts + +Fixes: fcc16c22 ("provide common json output formatter") +Signed-off-by: Ivan Delalande +Signed-off-by: Stephen Hemminger +(cherry picked from commit ed54f76484b5ee47b190a202ecf29fce60d0d878) +Signed-off-by: Phil Sutter +--- + lib/json_writer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/json_writer.c b/lib/json_writer.c +index 5004c181e6225..88c5eb8882254 100644 +--- a/lib/json_writer.c ++++ b/lib/json_writer.c +@@ -75,7 +75,7 @@ static void jsonw_puts(json_writer_t *self, const char *str) + fputs("\\b", self->out); + break; + case '\\': +- fputs("\\n", self->out); ++ fputs("\\\\", self->out); + break; + case '"': + fputs("\\\"", self->out); +-- +2.22.0 + diff --git a/iproute.spec b/iproute.spec index 095b2c6..07fc76b 100644 --- a/iproute.spec +++ b/iproute.spec @@ -1,14 +1,20 @@ %global cbq_version v0.7.3 Summary: Advanced IP routing and network device configuration tools Name: iproute -Version: 5.1.0 +Version: 5.2.0 Release: 1%{?dist} URL: http://kernel.org/pub/linux/utils/net/%{name}2/ Source0: http://kernel.org/pub/linux/utils/net/%{name}2/%{name}2-%{version}.tar.xz -Patch0: 0001-m_mirred-don-t-bail-if-the-control-action-is-missing.patch -Patch1: 0002-lib-suppress-error-msg-when-filling-the-cache.patch -Patch2: 0003-tc-flower-fix-port-value-truncation.patch +Patch1: 0001-Revert-ip6tunnel-fix-ip-6-show-change-dev-name-cmds.patch +Patch2: 0002-ip-tunnel-warn-when-changing-IPv6-tunnel-without-tun.patch +Patch3: 0003-ip-route-fix-json-formatting-for-metrics.patch +Patch4: 0004-utils-move-parse_percent-to-tc_util.patch +Patch5: 0005-tc-util-constrain-percentage-in-0-100-interval.patch +Patch6: 0006-devlink-Change-devlink-health-dump-show-command-to-d.patch +Patch7: 0007-devlink-Fix-binary-values-print.patch +Patch8: 0008-devlink-Remove-enclosing-array-brackets-binary-print.patch +Patch9: 0009-json-fix-backslash-escape-typo-in-jsonw_puts.patch License: GPLv2+ and Public Domain BuildRequires: gcc @@ -126,6 +132,11 @@ install -D -m644 lib/libnetlink.a %{buildroot}%{_libdir}/libnetlink.a %{_includedir}/iproute2/bpf_elf.h %changelog +* Tue Jul 23 2019 Phil Sutter - 5.2.0-1 +- New version 5.2.0 +- Add upstream-suggested backports +- Fix for tunnel creation when using 'dev' parameter + * Wed May 29 2019 Phil Sutter - 5.1.0-1 - New version 5.1.0 diff --git a/sources b/sources index 3ebf39c..108351d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (iproute2-5.1.0.tar.xz) = 5c8319b040bd0ba98cf1225b2a77efafc662741344c53877ee38cf108ca01906b03328e4f9b00b7557e301c6e64bca4e42e92af477b4d657bcbff5120c0c4e87 +SHA512 (iproute2-5.2.0.tar.xz) = 82bbeae29d98129d822c95ff7523186569e32c66132b8d781d501d61f396b04d122e3d13057dd4236455264008e5bfac7cb63c325908fc1c46d416cbde6ac7e1