commit 10a9d5323696d8c4d05da0cd050220e46843d992 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 10:53:19 2019 -0400 Package init 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/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/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/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 new file mode 100644 index 0000000..98b3626 --- /dev/null +++ b/iproute.spec @@ -0,0 +1,86 @@ +Name: iproute +Version: 5.2.0 +Release: 1 +Summary: Linux network configuration utilities +License: GPLv2+ and Public Domain +URL: https://kernel.org/pub/linux/utils/net/iproute2/ +Source0: https://mirrors.edge.kernel.org/pub/linux/utils/net/iproute2/iproute2-%{version}.tar.xz + +BuildRequires: gcc bison elfutils-libelf-devel flex iptables-devel libcap-devel +BuildRequires: libdb-devel libmnl-devel libselinux-devel pkgconfig git + +#Pacth1-Patch9 comes from fedora +Patch0001: 0001-Revert-ip6tunnel-fix-ip-6-show-change-dev-name-cmds.patch +Patch0002: 0002-ip-tunnel-warn-when-changing-IPv6-tunnel-without-tun.patch +Patch0003: 0003-ip-route-fix-json-formatting-for-metrics.patch +Patch0004: 0004-utils-move-parse_percent-to-tc_util.patch +Patch0005: 0005-tc-util-constrain-percentage-in-0-100-interval.patch +Patch0006: 0006-devlink-Change-devlink-health-dump-show-command-to-d.patch +Patch0007: 0007-devlink-Fix-binary-values-print.patch +Patch0008: 0008-devlink-Remove-enclosing-array-brackets-binary-print.patch +Patch0009: 0009-json-fix-backslash-escape-typo-in-jsonw_puts.patch + +Provides: /sbin/ip iproute-tc tc +Obsoletes: iproute-tc + +%description +Iproute2 is a collection of user-space utilities to set up networking +under Linux from the command-line. It can inspect and configure, +among other things: interface paramters, IP addresses, routing, +tunnels, bridges, packet transformations (IPsec, etc.), and Quality +of Service. + +%package devel +Summary: Header files for iprout2 +License: GPLv2+ +Provides: iproute-static = %{version}-%{release} +Obsoletes: iproute-static < %{version}-%{release} + +%description devel +Header files for iprout2 + +%package_help + +%prep +%autosetup -n %{name}2-%{version} -p1 -S git + +%build +%configure +%make_build + +%install +export CONFDIR='%{_sysconfdir}/iproute2' +export SBINDIR='%{_sbindir}' +export LIBDIR='%{_libdir}' +export DOCDIR='%{_docdir}' + +%make_install + +install -m 0755 -d %{buildroot}%{_includedir} +install -m 0644 include/libnetlink.h %{buildroot}%{_includedir}/libnetlink.h +install -m 0644 lib/libnetlink.a %{buildroot}%{_libdir}/libnetlink.a + +%files +%defattr(-,root,root) +%license COPYING +%doc README.lnstat +%attr(644,root,root) %config(noreplace) %{_sysconfdir}/iproute2/* +%{_sbindir}/* +%{_libdir}/tc/* +%{_datadir}/bash-completion/completions/tc + +%files devel +%defattr(-,root,root) +%license COPYING +%{_libdir}/libnetlink.a +%{_includedir}/* +%{_datadir}/doc/examples + +%files help +%defattr(-,root,root) +%doc README README.distribution README.iproute2+tc +%{_mandir}/* + +%changelog +* Thu Sep 19 2019 openEuler Buildteam - 5.2.0-1 +- Package init diff --git a/iproute2-5.2.0.tar.xz b/iproute2-5.2.0.tar.xz new file mode 100644 index 0000000..6535bf3 Binary files /dev/null and b/iproute2-5.2.0.tar.xz differ