From 911b3f478882b97a433425722ca317e6fa1b6e01 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Jul 27 2020 15:06:47 +0000 Subject: Rebase package on top of iproute2-5.7.0 --- diff --git a/.gitignore b/.gitignore index c27dc09..3e487c2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /iproute2-5.4.0.tar.xz /iproute2-5.5.0.tar.xz /iproute2-5.6.0.tar.xz +/iproute2-5.7.0.tar.xz diff --git a/0001-ip-link_gre-Do-not-send-ERSPAN-attributes-to-GRE-tun.patch b/0001-ip-link_gre-Do-not-send-ERSPAN-attributes-to-GRE-tun.patch deleted file mode 100644 index 77211cf..0000000 --- a/0001-ip-link_gre-Do-not-send-ERSPAN-attributes-to-GRE-tun.patch +++ /dev/null @@ -1,121 +0,0 @@ -From ff9daa1f112460f9184aa20e1204604185740326 Mon Sep 17 00:00:00 2001 -From: Petr Machata -Date: Sat, 4 Apr 2020 01:55:34 +0300 -Subject: [PATCH] ip: link_gre: Do not send ERSPAN attributes to GRE tunnels - -In the commit referenced below, ip link started sending ERSPAN-specific -attributes even for GRE and gretap tunnels. Fix by more carefully -distinguishing between the GRE/tap and ERSPAN modes. Do not show -ERSPAN-related help in GRE/tap mode, likewise do not accept ERSPAN -arguments, or send ERSPAN attributes. - -Fixes: 83c543af872e ("erspan: set erspan_ver to 1 by default") -Signed-off-by: Petr Machata -Acked-by: William Tu -Signed-off-by: Stephen Hemminger -(cherry picked from commit 20927e0525e0cca165cd1252ac18da07cb082c4d) -Signed-off-by: Phil Sutter ---- - ip/link_gre.c | 34 ++++++++++++++++++++++------------ - 1 file changed, 22 insertions(+), 12 deletions(-) - -diff --git a/ip/link_gre.c b/ip/link_gre.c -index e42f21ae4556c..d616a970e9a28 100644 ---- a/ip/link_gre.c -+++ b/ip/link_gre.c -@@ -23,8 +23,15 @@ - #include "ip_common.h" - #include "tunnel.h" - -+static bool gre_is_erspan(struct link_util *lu) -+{ -+ return !strcmp(lu->id, "erspan"); -+} -+ - static void gre_print_help(struct link_util *lu, int argc, char **argv, FILE *f) - { -+ bool is_erspan = gre_is_erspan(lu); -+ - fprintf(f, - "Usage: ... %-9s [ remote ADDR ]\n" - " [ local ADDR ]\n" -@@ -44,18 +51,20 @@ static void gre_print_help(struct link_util *lu, int argc, char **argv, FILE *f) - " [ encap-dport PORT ]\n" - " [ [no]encap-csum ]\n" - " [ [no]encap-csum6 ]\n" -- " [ [no]encap-remcsum ]\n" -- " [ erspan_ver version ]\n" -- " [ erspan IDX ]\n" -- " [ erspan_dir { ingress | egress } ]\n" -- " [ erspan_hwid hwid ]\n" -+ " [ [no]encap-remcsum ]\n", lu->id); -+ if (is_erspan) -+ fprintf(f, -+ " [ erspan_ver version ]\n" -+ " [ erspan IDX ]\n" -+ " [ erspan_dir { ingress | egress } ]\n" -+ " [ erspan_hwid hwid ]\n"); -+ fprintf(f, - "\n" - "Where: ADDR := { IP_ADDRESS | any }\n" - " TOS := { NUMBER | inherit }\n" - " TTL := { 1..255 | inherit }\n" - " KEY := { DOTTED_QUAD | NUMBER }\n" -- " MARK := { 0x0..0xffffffff }\n", -- lu->id); -+ " MARK := { 0x0..0xffffffff }\n"); - } - - static int gre_parse_opt(struct link_util *lu, int argc, char **argv, -@@ -93,6 +102,7 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv, - __u16 encapdport = 0; - __u8 metadata = 0; - __u32 fwmark = 0; -+ bool is_erspan = gre_is_erspan(lu); - __u32 erspan_idx = 0; - __u8 erspan_ver = 1; - __u8 erspan_dir = 0; -@@ -334,19 +344,19 @@ get_failed: - NEXT_ARG(); - if (get_u32(&fwmark, *argv, 0)) - invarg("invalid fwmark\n", *argv); -- } else if (strcmp(*argv, "erspan") == 0) { -+ } else if (is_erspan && strcmp(*argv, "erspan") == 0) { - NEXT_ARG(); - if (get_u32(&erspan_idx, *argv, 0)) - invarg("invalid erspan index\n", *argv); - if (erspan_idx & ~((1<<20) - 1) || erspan_idx == 0) - invarg("erspan index must be > 0 and <= 20-bit\n", *argv); -- } else if (strcmp(*argv, "erspan_ver") == 0) { -+ } else if (is_erspan && strcmp(*argv, "erspan_ver") == 0) { - NEXT_ARG(); - if (get_u8(&erspan_ver, *argv, 0)) - invarg("invalid erspan version\n", *argv); - if (erspan_ver != 1 && erspan_ver != 2) - invarg("erspan version must be 1 or 2\n", *argv); -- } else if (strcmp(*argv, "erspan_dir") == 0) { -+ } else if (is_erspan && strcmp(*argv, "erspan_dir") == 0) { - NEXT_ARG(); - if (matches(*argv, "ingress") == 0) - erspan_dir = 0; -@@ -354,7 +364,7 @@ get_failed: - erspan_dir = 1; - else - invarg("Invalid erspan direction.", *argv); -- } else if (strcmp(*argv, "erspan_hwid") == 0) { -+ } else if (is_erspan && strcmp(*argv, "erspan_hwid") == 0) { - NEXT_ARG(); - if (get_u16(&erspan_hwid, *argv, 0)) - invarg("invalid erspan hwid\n", *argv); -@@ -402,7 +412,7 @@ get_failed: - addattr32(n, 1024, IFLA_GRE_LINK, link); - addattr_l(n, 1024, IFLA_GRE_TTL, &ttl, 1); - addattr32(n, 1024, IFLA_GRE_FWMARK, fwmark); -- if (erspan_ver) { -+ if (is_erspan) { - addattr8(n, 1024, IFLA_GRE_ERSPAN_VER, erspan_ver); - if (erspan_ver == 1 && erspan_idx != 0) { - addattr32(n, 1024, IFLA_GRE_ERSPAN_INDEX, erspan_idx); --- -2.27.0 - diff --git a/0002-tc-fq_codel-fix-class-stat-deficit-is-signed-int.patch b/0002-tc-fq_codel-fix-class-stat-deficit-is-signed-int.patch deleted file mode 100644 index cd1ec8e..0000000 --- a/0002-tc-fq_codel-fix-class-stat-deficit-is-signed-int.patch +++ /dev/null @@ -1,33 +0,0 @@ -From fcb1bd5aa4d87e8ed4317dfb6e13e80789bf5954 Mon Sep 17 00:00:00 2001 -From: Benjamin Lee -Date: Tue, 14 Apr 2020 21:11:12 -0700 -Subject: [PATCH] tc: fq_codel: fix class stat deficit is signed int - -The fq_codel class stat deficit is a signed int. This is a regression -from when JSON output was added. - -Fixes: 997f2dc19378 ("tc: Add JSON output of fq_codel stats") -Signed-off-by: Benjamin Lee -Signed-off-by: Stephen Hemminger -(cherry picked from commit f03ad792f3cdef5ade92392db6710441b35b47dd) -Signed-off-by: Phil Sutter ---- - tc/q_fq_codel.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tc/q_fq_codel.c b/tc/q_fq_codel.c -index efed4d28974c3..1c6cf1e0de9ef 100644 ---- a/tc/q_fq_codel.c -+++ b/tc/q_fq_codel.c -@@ -264,7 +264,7 @@ static int fq_codel_print_xstats(struct qdisc_util *qu, FILE *f, - st->qdisc_stats.old_flows_len); - } - if (st->type == TCA_FQ_CODEL_XSTATS_CLASS) { -- print_uint(PRINT_ANY, "deficit", " deficit %u", -+ print_int(PRINT_ANY, "deficit", " deficit %d", - st->class_stats.deficit); - print_uint(PRINT_ANY, "count", " count %u", - st->class_stats.count); --- -2.27.0 - diff --git a/0003-xfrm-also-check-for-ipv6-state-in-xfrm_state_keep.patch b/0003-xfrm-also-check-for-ipv6-state-in-xfrm_state_keep.patch deleted file mode 100644 index 17b70fe..0000000 --- a/0003-xfrm-also-check-for-ipv6-state-in-xfrm_state_keep.patch +++ /dev/null @@ -1,46 +0,0 @@ -From ef1e0a186fd1e44731b9afe3f164f9adc06e811a Mon Sep 17 00:00:00 2001 -From: Xin Long -Date: Mon, 27 Apr 2020 15:14:24 +0800 -Subject: [PATCH] xfrm: also check for ipv6 state in xfrm_state_keep - -As commit f9d696cf414c ("xfrm: not try to delete ipcomp states when using -deleteall") does, this patch is to fix the same issue for ip6 state where -xsinfo->id.proto == IPPROTO_IPV6. - - # ip xfrm state add src 2000::1 dst 2000::2 spi 0x1000 \ - proto comp comp deflate mode tunnel sel src 2000::1 dst \ - 2000::2 proto gre - # ip xfrm sta deleteall - Failed to send delete-all request - : Operation not permitted - -Note that the xsinfo->proto in common states can never be IPPROTO_IPV6. - -Fixes: f9d696cf414c ("xfrm: not try to delete ipcomp states when using deleteall") -Reported-by: Xiumei Mu -Signed-off-by: Xin Long -Acked-by: Andrea Claudi -Signed-off-by: Stephen Hemminger -(cherry picked from commit d27fc6390ce32ecdba6324e22b1c341791c5c63f) -Signed-off-by: Phil Sutter ---- - ip/xfrm_state.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c -index d68f600ae700b..f4bf3356bb01f 100644 ---- a/ip/xfrm_state.c -+++ b/ip/xfrm_state.c -@@ -1131,7 +1131,8 @@ static int xfrm_state_keep(struct nlmsghdr *n, void *arg) - if (!xfrm_state_filter_match(xsinfo)) - return 0; - -- if (xsinfo->id.proto == IPPROTO_IPIP) -+ if (xsinfo->id.proto == IPPROTO_IPIP || -+ xsinfo->id.proto == IPPROTO_IPV6) - return 0; - - if (xb->offset > xb->size) { --- -2.27.0 - diff --git a/0004-bridge-Fix-typo.patch b/0004-bridge-Fix-typo.patch deleted file mode 100644 index fe96b9d..0000000 --- a/0004-bridge-Fix-typo.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 241e43adf7bad5f515207a780599eaddc2174745 Mon Sep 17 00:00:00 2001 -From: Benjamin Poirier -Date: Fri, 1 May 2020 17:47:16 +0900 -Subject: [PATCH] bridge: Fix typo - -Fixes: 7abf5de677e3 ("bridge: vlan: add support to display per-vlan statistics") -Signed-off-by: Benjamin Poirier -Signed-off-by: Stephen Hemminger -(cherry picked from commit 91b1b49ed3934eb423308130bb3365a0afebf5af) -Signed-off-by: Phil Sutter ---- - bridge/vlan.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/bridge/vlan.c b/bridge/vlan.c -index 205851e4f78ec..24dffa1084014 100644 ---- a/bridge/vlan.c -+++ b/bridge/vlan.c -@@ -546,7 +546,7 @@ static int vlan_show(int argc, char **argv, int subject) - - ret = rtnl_dump_filter(&rth, print_vlan, &subject); - if (ret < 0) { -- fprintf(stderr, "Dump ternminated\n"); -+ fprintf(stderr, "Dump terminated\n"); - exit(1); - } - } else { --- -2.27.0 - diff --git a/0005-bridge-Fix-output-with-empty-vlan-lists.patch b/0005-bridge-Fix-output-with-empty-vlan-lists.patch deleted file mode 100644 index 216936f..0000000 --- a/0005-bridge-Fix-output-with-empty-vlan-lists.patch +++ /dev/null @@ -1,210 +0,0 @@ -From a8fe45ee1b17dc493146da4fc0f20cfe5082447b Mon Sep 17 00:00:00 2001 -From: Benjamin Poirier -Date: Fri, 1 May 2020 17:47:17 +0900 -Subject: [PATCH] bridge: Fix output with empty vlan lists - -Consider this configuration: - -ip link add br0 type bridge -ip link add vx0 type vxlan dstport 4789 external -ip link set dev vx0 master br0 -bridge vlan del vid 1 dev vx0 -ip link add vx1 type vxlan dstport 4790 external -ip link set dev vx1 master br0 - - root@vsid:/src/iproute2# ./bridge/bridge vlan - port vlan-id - br0 1 PVID Egress Untagged - - vx0 None - vx1 1 PVID Egress Untagged - - root@vsid:/src/iproute2# - -Note the useless and inconsistent empty lines. - - root@vsid:/src/iproute2# ./bridge/bridge vlan tunnelshow - port vlan-id tunnel-id - br0 - vx0 None - vx1 - -What's the difference between "None" and ""? - - root@vsid:/src/iproute2# ./bridge/bridge -j -p vlan tunnelshow - [ { - "ifname": "br0", - "tunnels": [ ] - },{ - "ifname": "vx1", - "tunnels": [ ] - } ] - -Why does vx0 appear in normal output and not json output? -Why output an empty list for br0 and vx1? - -Fix these inconsistencies and avoid outputting entries with no values. This -makes the behavior consistent with other iproute2 commands, for example -`ip -6 addr`: if an interface doesn't have any ipv6 addresses, it is not -part of the listing. - -Fixes: 8652eeb3ab12 ("bridge: vlan: support for per vlan tunnel info") -Signed-off-by: Benjamin Poirier -Signed-off-by: Stephen Hemminger -(cherry picked from commit b262a9becbcb9d0816b7953fd223dd9a7add8e12) -Signed-off-by: Phil Sutter ---- - bridge/vlan.c | 36 +++++++++++++----------- - testsuite/tests/bridge/vlan/show.t | 30 ++++++++++++++++++++ - testsuite/tests/bridge/vlan/tunnelshow.t | 2 +- - 3 files changed, 50 insertions(+), 18 deletions(-) - create mode 100755 testsuite/tests/bridge/vlan/show.t - -diff --git a/bridge/vlan.c b/bridge/vlan.c -index 24dffa1084014..c1e28ba082b9e 100644 ---- a/bridge/vlan.c -+++ b/bridge/vlan.c -@@ -290,8 +290,7 @@ static void print_vlan_tunnel_info(struct rtattr *tb, int ifindex) - int rem = RTA_PAYLOAD(list); - __u16 last_vid_start = 0; - __u32 last_tunid_start = 0; -- -- open_vlan_port(ifindex, "%s", VLAN_SHOW_TUNNELINFO); -+ bool opened = false; - - for (i = RTA_DATA(list); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) { - struct rtattr *ttb[IFLA_BRIDGE_VLAN_TUNNEL_MAX+1]; -@@ -331,13 +330,20 @@ static void print_vlan_tunnel_info(struct rtattr *tb, int ifindex) - else if (vcheck_ret == 0) - continue; - -+ if (!opened) { -+ open_vlan_port(ifindex, "%s", VLAN_SHOW_TUNNELINFO); -+ opened = true; -+ } -+ - open_json_object(NULL); - print_range("vlan", last_vid_start, tunnel_vid); - print_range("tunid", last_tunid_start, tunnel_id); - close_json_object(); - print_string(PRINT_FP, NULL, "%s", _SL_); - } -- close_vlan_port(); -+ -+ if (opened) -+ close_vlan_port(); - } - - static int print_vlan(struct nlmsghdr *n, void *arg) -@@ -366,16 +372,8 @@ static int print_vlan(struct nlmsghdr *n, void *arg) - return 0; - - parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifm), len); -- -- /* if AF_SPEC isn't there, vlan table is not preset for this port */ -- if (!tb[IFLA_AF_SPEC]) { -- if (!filter_vlan && !is_json_context()) { -- color_fprintf(stdout, COLOR_IFNAME, "%s", -- ll_index_to_name(ifm->ifi_index)); -- fprintf(stdout, "\tNone\n"); -- } -+ if (!tb[IFLA_AF_SPEC]) - return 0; -- } - - switch (*subject) { - case VLAN_SHOW_VLAN: -@@ -385,9 +383,7 @@ static int print_vlan(struct nlmsghdr *n, void *arg) - print_vlan_tunnel_info(tb[IFLA_AF_SPEC], ifm->ifi_index); - break; - } -- print_string(PRINT_FP, NULL, "%s", _SL_); - -- fflush(stdout); - return 0; - } - -@@ -588,8 +584,7 @@ void print_vlan_info(struct rtattr *tb, int ifindex) - struct rtattr *i, *list = tb; - int rem = RTA_PAYLOAD(list); - __u16 last_vid_start = 0; -- -- open_vlan_port(ifindex, "%s", VLAN_SHOW_VLAN); -+ bool opened = false; - - for (i = RTA_DATA(list); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) { - struct bridge_vlan_info *vinfo; -@@ -608,6 +603,11 @@ void print_vlan_info(struct rtattr *tb, int ifindex) - else if (vcheck_ret == 0) - continue; - -+ if (!opened) { -+ open_vlan_port(ifindex, "%s", VLAN_SHOW_VLAN); -+ opened = true; -+ } -+ - open_json_object(NULL); - print_range("vlan", last_vid_start, vinfo->vid); - -@@ -615,7 +615,9 @@ void print_vlan_info(struct rtattr *tb, int ifindex) - close_json_object(); - print_string(PRINT_FP, NULL, "%s", _SL_); - } -- close_vlan_port(); -+ -+ if (opened) -+ close_vlan_port(); - } - - int do_vlan(int argc, char **argv) -diff --git a/testsuite/tests/bridge/vlan/show.t b/testsuite/tests/bridge/vlan/show.t -new file mode 100755 -index 0000000000000..3def202226a47 ---- /dev/null -+++ b/testsuite/tests/bridge/vlan/show.t -@@ -0,0 +1,30 @@ -+#!/bin/sh -+ -+. lib/generic.sh -+ -+ts_log "[Testing vlan show]" -+ -+BR_DEV="$(rand_dev)" -+VX0_DEV="$(rand_dev)" -+VX1_DEV="$(rand_dev)" -+ -+ts_ip "$0" "Add $BR_DEV bridge interface" link add $BR_DEV type bridge -+ -+ts_ip "$0" "Add $VX0_DEV vxlan interface" \ -+ link add $VX0_DEV type vxlan dstport 4789 external -+ts_ip "$0" "Enslave $VX0_DEV under $BR_DEV" \ -+ link set dev $VX0_DEV master $BR_DEV -+ts_bridge "$0" "Delete default vlan from $VX0_DEV" \ -+ vlan del dev $VX0_DEV vid 1 -+ts_ip "$0" "Add $VX1_DEV vxlan interface" \ -+ link add $VX1_DEV type vxlan dstport 4790 external -+ts_ip "$0" "Enslave $VX1_DEV under $BR_DEV" \ -+ link set dev $VX1_DEV master $BR_DEV -+ -+# Test that bridge ports without vlans do not appear in the output -+ts_bridge "$0" "Show vlan" vlan -+test_on_not "$VX0_DEV" -+ -+# Test that bridge ports without tunnels do not appear in the output -+ts_bridge "$0" "Show vlan tunnel info" vlan tunnelshow -+test_lines_count 1 # header only -diff --git a/testsuite/tests/bridge/vlan/tunnelshow.t b/testsuite/tests/bridge/vlan/tunnelshow.t -index fd41bfcb32a2b..3e9c12a21a9cc 100755 ---- a/testsuite/tests/bridge/vlan/tunnelshow.t -+++ b/testsuite/tests/bridge/vlan/tunnelshow.t -@@ -28,6 +28,6 @@ ts_bridge "$0" "Add tunnel with vni > 16k" \ - - ts_bridge "$0" "Show tunnel info" vlan tunnelshow dev $VX_DEV - test_on "1030\s+65556" --test_lines_count 5 -+test_lines_count 4 - - ts_bridge "$0" "Dump tunnel info" -j vlan tunnelshow dev $VX_DEV --- -2.27.0 - diff --git a/0006-tc-fq-fix-two-issues.patch b/0006-tc-fq-fix-two-issues.patch deleted file mode 100644 index 11a2815..0000000 --- a/0006-tc-fq-fix-two-issues.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 9a0a8837b1f13f47dd3977fcedc92d02bfbbf1e3 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Tue, 5 May 2020 08:43:48 -0700 -Subject: [PATCH] tc: fq: fix two issues - -My latest patch missed the fact that this file got JSON support. - -Also fixes a spelling error added during JSON change. - -Fixes: be9ca9d54123 ("tc: fq: add timer_slack parameter") -Fixes: d15e2bfc042b ("tc: fq: add support for JSON output") -Signed-off-by: Eric Dumazet -Signed-off-by: Stephen Hemminger -(cherry picked from commit 0ecb90b33c4f4c20b859b1f1245b65e36e963cff) - -Conflicts: -Dropped the first chunk which doesn't apply since be9ca9d54123 ("tc: fq: -add timer_slack parameter") is not present in v5.6.0 yet. - -Signed-off-by: Phil Sutter ---- - tc/q_fq.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tc/q_fq.c b/tc/q_fq.c -index 44d8a7e03b998..a58bcbef2b2c2 100644 ---- a/tc/q_fq.c -+++ b/tc/q_fq.c -@@ -415,7 +415,7 @@ static int fq_print_xstats(struct qdisc_util *qu, FILE *f, - print_nl(); - print_lluint(PRINT_ANY, "pkts_too_long", - " pkts_too_long %llu", st->pkts_too_long); -- print_lluint(PRINT_ANY, "alloc_errors", " alloc_erros %llu", -+ print_lluint(PRINT_ANY, "alloc_errors", " alloc_errors %llu", - st->allocation_errors); - } - --- -2.27.0 - diff --git a/0007-tc-action-fix-time-values-output-in-JSON-format.patch b/0007-tc-action-fix-time-values-output-in-JSON-format.patch deleted file mode 100644 index 345c823..0000000 --- a/0007-tc-action-fix-time-values-output-in-JSON-format.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 9cf0a735dbf5b12700cdc8daceea6d3c0a3c7cc8 Mon Sep 17 00:00:00 2001 -From: Roman Mashak -Date: Tue, 19 May 2020 20:59:44 -0400 -Subject: [PATCH] tc: action: fix time values output in JSON format - -Report tcf_t values in seconds, not jiffies, in JSON format as it is now -for stdout. - -v2: use PRINT_ANY, drop the useless casts and fix the style (Stephen Hemminger) - -Fixes: 2704bd625583 ("tc: jsonify actions core") -Cc: Jiri Pirko -Signed-off-by: Roman Mashak -Signed-off-by: Stephen Hemminger -(cherry picked from commit db35e411ec17bf9da67f22f995fe1e8d5edcda98) -Signed-off-by: Phil Sutter ---- - tc/tc_util.c | 26 +++++++++++--------------- - 1 file changed, 11 insertions(+), 15 deletions(-) - -diff --git a/tc/tc_util.c b/tc/tc_util.c -index 5f13d729bf52e..ac9b4a8ac642d 100644 ---- a/tc/tc_util.c -+++ b/tc/tc_util.c -@@ -745,21 +745,17 @@ void print_tm(FILE *f, const struct tcf_t *tm) - { - int hz = get_user_hz(); - -- if (tm->install != 0) { -- print_uint(PRINT_JSON, "installed", NULL, tm->install); -- print_uint(PRINT_FP, NULL, " installed %u sec", -- (unsigned int)(tm->install/hz)); -- } -- if (tm->lastuse != 0) { -- print_uint(PRINT_JSON, "last_used", NULL, tm->lastuse); -- print_uint(PRINT_FP, NULL, " used %u sec", -- (unsigned int)(tm->lastuse/hz)); -- } -- if (tm->expires != 0) { -- print_uint(PRINT_JSON, "expires", NULL, tm->expires); -- print_uint(PRINT_FP, NULL, " expires %u sec", -- (unsigned int)(tm->expires/hz)); -- } -+ if (tm->install != 0) -+ print_uint(PRINT_ANY, "installed", " installed %u sec", -+ tm->install / hz); -+ -+ if (tm->lastuse != 0) -+ print_uint(PRINT_ANY, "last_used", " used %u sec", -+ tm->lastuse / hz); -+ -+ if (tm->expires != 0) -+ print_uint(PRINT_ANY, "expires", " expires %u sec", -+ tm->expires / hz); - } - - static void print_tcstats_basic_hw(struct rtattr **tbs, char *prefix) --- -2.27.0 - diff --git a/0008-Revert-bpf-replace-snprintf-with-asprintf-when-deali.patch b/0008-Revert-bpf-replace-snprintf-with-asprintf-when-deali.patch deleted file mode 100644 index d45d079..0000000 --- a/0008-Revert-bpf-replace-snprintf-with-asprintf-when-deali.patch +++ /dev/null @@ -1,337 +0,0 @@ -From 4b8310183b0ad2c53a7885e39934a6460266012a Mon Sep 17 00:00:00 2001 -From: Andrea Claudi -Date: Tue, 26 May 2020 18:04:10 +0200 -Subject: [PATCH] Revert "bpf: replace snprintf with asprintf when dealing with - long buffers" - -This reverts commit c0325b06382cb4f7ebfaf80c29c8800d74666fd9. -It introduces a segfault in bpf_make_custom_path() when custom pinning is used. - -This happens because asprintf allocates exactly the space needed to hold a -string in the buffer passed as its first argument, but if this buffer is later -used in strcat() or similar we have a buffer overrun. - -As the aim of commit c0325b06382c is simply to fix a compiler warning, it -seems safe and reasonable to revert it. - -Fixes: c0325b06382c ("bpf: replace snprintf with asprintf when dealing with long buffers") -Reported-by: Jamal Hadi Salim -Signed-off-by: Andrea Claudi -Signed-off-by: Stephen Hemminger -(cherry picked from commit 358abfe004a30bf3ed353c7f5dbc6afaf4212ecf) -Signed-off-by: Phil Sutter ---- - lib/bpf.c | 155 ++++++++++++++---------------------------------------- - 1 file changed, 39 insertions(+), 116 deletions(-) - -diff --git a/lib/bpf.c b/lib/bpf.c -index 10cf9bf44419a..23cb0d96a85ba 100644 ---- a/lib/bpf.c -+++ b/lib/bpf.c -@@ -406,21 +406,13 @@ static int bpf_derive_elf_map_from_fdinfo(int fd, struct bpf_elf_map *map, - struct bpf_map_ext *ext) - { - unsigned int val, owner_type = 0, owner_jited = 0; -- char *file = NULL; -- char buff[4096]; -+ char file[PATH_MAX], buff[4096]; - FILE *fp; -- int ret; - -- ret = asprintf(&file, "/proc/%d/fdinfo/%d", getpid(), fd); -- if (ret < 0) { -- fprintf(stderr, "asprintf failed: %s\n", strerror(errno)); -- free(file); -- return ret; -- } -+ snprintf(file, sizeof(file), "/proc/%d/fdinfo/%d", getpid(), fd); - memset(map, 0, sizeof(*map)); - - fp = fopen(file, "r"); -- free(file); - if (!fp) { - fprintf(stderr, "No procfs support?!\n"); - return -EIO; -@@ -608,9 +600,8 @@ int bpf_trace_pipe(void) - 0, - }; - int fd_in, fd_out = STDERR_FILENO; -- char *tpipe = NULL; -+ char tpipe[PATH_MAX]; - const char *mnt; -- int ret; - - mnt = bpf_find_mntpt("tracefs", TRACEFS_MAGIC, tracefs_mnt, - sizeof(tracefs_mnt), tracefs_known_mnts); -@@ -619,15 +610,9 @@ int bpf_trace_pipe(void) - return -1; - } - -- ret = asprintf(&tpipe, "%s/trace_pipe", mnt); -- if (ret < 0) { -- fprintf(stderr, "asprintf failed: %s\n", strerror(errno)); -- free(tpipe); -- return ret; -- } -+ snprintf(tpipe, sizeof(tpipe), "%s/trace_pipe", mnt); - - fd_in = open(tpipe, O_RDONLY); -- free(tpipe); - if (fd_in < 0) - return -1; - -@@ -648,50 +633,37 @@ int bpf_trace_pipe(void) - - static int bpf_gen_global(const char *bpf_sub_dir) - { -- char *bpf_glo_dir = NULL; -+ char bpf_glo_dir[PATH_MAX]; - int ret; - -- ret = asprintf(&bpf_glo_dir, "%s/%s/", bpf_sub_dir, BPF_DIR_GLOBALS); -- if (ret < 0) { -- fprintf(stderr, "asprintf failed: %s\n", strerror(errno)); -- goto out; -- } -+ snprintf(bpf_glo_dir, sizeof(bpf_glo_dir), "%s/%s/", -+ bpf_sub_dir, BPF_DIR_GLOBALS); - - ret = mkdir(bpf_glo_dir, S_IRWXU); - if (ret && errno != EEXIST) { - fprintf(stderr, "mkdir %s failed: %s\n", bpf_glo_dir, - strerror(errno)); -- goto out; -+ return ret; - } - -- ret = 0; --out: -- free(bpf_glo_dir); -- return ret; -+ return 0; - } - - static int bpf_gen_master(const char *base, const char *name) - { -- char *bpf_sub_dir = NULL; -+ char bpf_sub_dir[PATH_MAX + NAME_MAX + 1]; - int ret; - -- ret = asprintf(&bpf_sub_dir, "%s%s/", base, name); -- if (ret < 0) { -- fprintf(stderr, "asprintf failed: %s\n", strerror(errno)); -- goto out; -- } -+ snprintf(bpf_sub_dir, sizeof(bpf_sub_dir), "%s%s/", base, name); - - ret = mkdir(bpf_sub_dir, S_IRWXU); - if (ret && errno != EEXIST) { - fprintf(stderr, "mkdir %s failed: %s\n", bpf_sub_dir, - strerror(errno)); -- goto out; -+ return ret; - } - -- ret = bpf_gen_global(bpf_sub_dir); --out: -- free(bpf_sub_dir); -- return ret; -+ return bpf_gen_global(bpf_sub_dir); - } - - static int bpf_slave_via_bind_mnt(const char *full_name, -@@ -720,22 +692,13 @@ static int bpf_slave_via_bind_mnt(const char *full_name, - static int bpf_gen_slave(const char *base, const char *name, - const char *link) - { -- char *bpf_lnk_dir = NULL; -- char *bpf_sub_dir = NULL; -+ char bpf_lnk_dir[PATH_MAX + NAME_MAX + 1]; -+ char bpf_sub_dir[PATH_MAX + NAME_MAX]; - struct stat sb = {}; - int ret; - -- ret = asprintf(&bpf_lnk_dir, "%s%s/", base, link); -- if (ret < 0) { -- fprintf(stderr, "asprintf failed: %s\n", strerror(errno)); -- goto out; -- } -- -- ret = asprintf(&bpf_sub_dir, "%s%s", base, name); -- if (ret < 0) { -- fprintf(stderr, "asprintf failed: %s\n", strerror(errno)); -- goto out; -- } -+ snprintf(bpf_lnk_dir, sizeof(bpf_lnk_dir), "%s%s/", base, link); -+ snprintf(bpf_sub_dir, sizeof(bpf_sub_dir), "%s%s", base, name); - - ret = symlink(bpf_lnk_dir, bpf_sub_dir); - if (ret) { -@@ -743,30 +706,25 @@ static int bpf_gen_slave(const char *base, const char *name, - if (errno != EPERM) { - fprintf(stderr, "symlink %s failed: %s\n", - bpf_sub_dir, strerror(errno)); -- goto out; -+ return ret; - } - -- ret = bpf_slave_via_bind_mnt(bpf_sub_dir, bpf_lnk_dir); -- goto out; -+ return bpf_slave_via_bind_mnt(bpf_sub_dir, -+ bpf_lnk_dir); - } - - ret = lstat(bpf_sub_dir, &sb); - if (ret) { - fprintf(stderr, "lstat %s failed: %s\n", - bpf_sub_dir, strerror(errno)); -- goto out; -+ return ret; - } - -- if ((sb.st_mode & S_IFMT) != S_IFLNK) { -- ret = bpf_gen_global(bpf_sub_dir); -- goto out; -- } -+ if ((sb.st_mode & S_IFMT) != S_IFLNK) -+ return bpf_gen_global(bpf_sub_dir); - } - --out: -- free(bpf_lnk_dir); -- free(bpf_sub_dir); -- return ret; -+ return 0; - } - - static int bpf_gen_hierarchy(const char *base) -@@ -784,7 +742,7 @@ static int bpf_gen_hierarchy(const char *base) - static const char *bpf_get_work_dir(enum bpf_prog_type type) - { - static char bpf_tmp[PATH_MAX] = BPF_DIR_MNT; -- static char *bpf_wrk_dir; -+ static char bpf_wrk_dir[PATH_MAX]; - static const char *mnt; - static bool bpf_mnt_cached; - const char *mnt_env = getenv(BPF_ENV_MNT); -@@ -823,12 +781,7 @@ static const char *bpf_get_work_dir(enum bpf_prog_type type) - } - } - -- ret = asprintf(&bpf_wrk_dir, "%s/", mnt); -- if (ret < 0) { -- fprintf(stderr, "asprintf failed: %s\n", strerror(errno)); -- free(bpf_wrk_dir); -- goto out; -- } -+ snprintf(bpf_wrk_dir, sizeof(bpf_wrk_dir), "%s/", mnt); - - ret = bpf_gen_hierarchy(bpf_wrk_dir); - if (ret) { -@@ -1485,48 +1438,31 @@ static int bpf_probe_pinned(const char *name, const struct bpf_elf_ctx *ctx, - - static int bpf_make_obj_path(const struct bpf_elf_ctx *ctx) - { -- char *tmp = NULL; -+ char tmp[PATH_MAX]; - int ret; - -- ret = asprintf(&tmp, "%s/%s", bpf_get_work_dir(ctx->type), ctx->obj_uid); -- if (ret < 0) { -- fprintf(stderr, "asprintf failed: %s\n", strerror(errno)); -- goto out; -- } -+ snprintf(tmp, sizeof(tmp), "%s/%s", bpf_get_work_dir(ctx->type), -+ ctx->obj_uid); - - ret = mkdir(tmp, S_IRWXU); - if (ret && errno != EEXIST) { - fprintf(stderr, "mkdir %s failed: %s\n", tmp, strerror(errno)); -- goto out; -+ return ret; - } - -- ret = 0; --out: -- free(tmp); -- return ret; -+ return 0; - } - - static int bpf_make_custom_path(const struct bpf_elf_ctx *ctx, - const char *todo) - { -- char *tmp = NULL; -- char *rem = NULL; -- char *sub; -+ char tmp[PATH_MAX], rem[PATH_MAX], *sub; - int ret; - -- ret = asprintf(&tmp, "%s/../", bpf_get_work_dir(ctx->type)); -- if (ret < 0) { -- fprintf(stderr, "asprintf failed: %s\n", strerror(errno)); -- goto out; -- } -- -- ret = asprintf(&rem, "%s/", todo); -- if (ret < 0) { -- fprintf(stderr, "asprintf failed: %s\n", strerror(errno)); -- goto out; -- } -- -+ snprintf(tmp, sizeof(tmp), "%s/../", bpf_get_work_dir(ctx->type)); -+ snprintf(rem, sizeof(rem), "%s/", todo); - sub = strtok(rem, "/"); -+ - while (sub) { - if (strlen(tmp) + strlen(sub) + 2 > PATH_MAX) - return -EINVAL; -@@ -1538,17 +1474,13 @@ static int bpf_make_custom_path(const struct bpf_elf_ctx *ctx, - if (ret && errno != EEXIST) { - fprintf(stderr, "mkdir %s failed: %s\n", tmp, - strerror(errno)); -- goto out; -+ return ret; - } - - sub = strtok(NULL, "/"); - } - -- ret = 0; --out: -- free(rem); -- free(tmp); -- return ret; -+ return 0; - } - - static int bpf_place_pinned(int fd, const char *name, -@@ -2655,23 +2587,14 @@ struct bpf_jited_aux { - - static int bpf_derive_prog_from_fdinfo(int fd, struct bpf_prog_data *prog) - { -- char *file = NULL; -- char buff[4096]; -+ char file[PATH_MAX], buff[4096]; - unsigned int val; - FILE *fp; -- int ret; -- -- ret = asprintf(&file, "/proc/%d/fdinfo/%d", getpid(), fd); -- if (ret < 0) { -- fprintf(stderr, "asprintf failed: %s\n", strerror(errno)); -- free(file); -- return ret; -- } - -+ snprintf(file, sizeof(file), "/proc/%d/fdinfo/%d", getpid(), fd); - memset(prog, 0, sizeof(*prog)); - - fp = fopen(file, "r"); -- free(file); - if (!fp) { - fprintf(stderr, "No procfs support?!\n"); - return -EIO; --- -2.27.0 - diff --git a/0009-bpf-Fixes-a-snprintf-truncation-warning.patch b/0009-bpf-Fixes-a-snprintf-truncation-warning.patch deleted file mode 100644 index 3a4000a..0000000 --- a/0009-bpf-Fixes-a-snprintf-truncation-warning.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 8e9fa64c7e17739a433e08661a8daabfcb300c56 Mon Sep 17 00:00:00 2001 -From: Andrea Claudi -Date: Tue, 26 May 2020 18:04:11 +0200 -Subject: [PATCH] bpf: Fixes a snprintf truncation warning -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -gcc v9.3.1 reports: - -bpf.c: In function ‘bpf_get_work_dir’: -bpf.c:784:49: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=] - 784 | snprintf(bpf_wrk_dir, sizeof(bpf_wrk_dir), "%s/", mnt); - | ^ -bpf.c:784:2: note: ‘snprintf’ output between 2 and 4097 bytes into a destination of size 4096 - 784 | snprintf(bpf_wrk_dir, sizeof(bpf_wrk_dir), "%s/", mnt); - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Fix this simply checking snprintf return code and properly handling the error. - -Fixes: e42256699cac ("bpf: make tc's bpf loader generic and move into lib") -Signed-off-by: Andrea Claudi -Signed-off-by: Stephen Hemminger -(cherry picked from commit 354efaec3895f004382414f2df17e7d820e695f6) -Signed-off-by: Phil Sutter ---- - lib/bpf.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/lib/bpf.c b/lib/bpf.c -index 23cb0d96a85ba..c7d45077c14e5 100644 ---- a/lib/bpf.c -+++ b/lib/bpf.c -@@ -781,7 +781,11 @@ static const char *bpf_get_work_dir(enum bpf_prog_type type) - } - } - -- snprintf(bpf_wrk_dir, sizeof(bpf_wrk_dir), "%s/", mnt); -+ ret = snprintf(bpf_wrk_dir, sizeof(bpf_wrk_dir), "%s/", mnt); -+ if (ret < 0 || ret >= sizeof(bpf_wrk_dir)) { -+ mnt = NULL; -+ goto out; -+ } - - ret = bpf_gen_hierarchy(bpf_wrk_dir); - if (ret) { --- -2.27.0 - diff --git a/iproute.spec b/iproute.spec index 21e3f47..9e85261 100644 --- a/iproute.spec +++ b/iproute.spec @@ -1,21 +1,11 @@ %global cbq_version v0.7.3 Summary: Advanced IP routing and network device configuration tools Name: iproute -Version: 5.6.0 +Version: 5.7.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 -Patch1: 0001-ip-link_gre-Do-not-send-ERSPAN-attributes-to-GRE-tun.patch -Patch2: 0002-tc-fq_codel-fix-class-stat-deficit-is-signed-int.patch -Patch3: 0003-xfrm-also-check-for-ipv6-state-in-xfrm_state_keep.patch -Patch4: 0004-bridge-Fix-typo.patch -Patch5: 0005-bridge-Fix-output-with-empty-vlan-lists.patch -Patch6: 0006-tc-fq-fix-two-issues.patch -Patch7: 0007-tc-action-fix-time-values-output-in-JSON-format.patch -Patch8: 0008-Revert-bpf-replace-snprintf-with-asprintf-when-deali.patch -Patch9: 0009-bpf-Fixes-a-snprintf-truncation-warning.patch - License: GPLv2+ and Public Domain BuildRequires: gcc BuildRequires: bison @@ -97,6 +87,7 @@ install -D -m644 lib/libnetlink.a %{buildroot}%{_libdir}/libnetlink.a %attr(644,root,root) %config(noreplace) %{_sysconfdir}/iproute2/* %{_sbindir}/* %exclude %{_sbindir}/tc +%{_datadir}/bash-completion/completions/devlink %files tc %{!?_licensedir:%global license %%doc} @@ -117,6 +108,9 @@ install -D -m644 lib/libnetlink.a %{buildroot}%{_libdir}/libnetlink.a %{_includedir}/iproute2/bpf_elf.h %changelog +* Mon Jul 27 2020 Phil Sutter - 5.7.0-1 +- New version 5.7.0 + * Thu Jun 04 2020 Phil Sutter - 5.6.0-1 - New version 5.6.0 - Add upstream-suggested backports diff --git a/sources b/sources index c40ce2d..d9b2c5b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (iproute2-5.6.0.tar.xz) = e52c6c8b676ab79401ae815fe3f80268c1edb490c0a00826e0f7181a816e9bf6549df9e77a40b0d56855db8ad312179b3a40002a2dd6f66c807039cff0cdfb6c +SHA512 (iproute2-5.7.0.tar.xz) = d5ef68e0eb8e84fbff68c2e7dd4097b9ceb438c928d17ede4130876802dfeafe8bf08d82b4fd39005314e0679c0b261aaa3d6a0a2ff364074a43a043a855a634