commit
1fbb9894e5
@ -1,41 +0,0 @@
|
||||
From 8cfac8f16a88bac7453da91aeca9e2c4244ca92a Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Claudi <aclaudi@redhat.com>
|
||||
Date: Tue, 9 Jul 2019 15:16:50 +0200
|
||||
Subject: [PATCH] Revert "ip6tunnel: fix 'ip -6 {show|change} dev <name>' 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 <jiji@redhat.com>
|
||||
Reviewed-by: Matteo Croce <mcroce@redhat.com>
|
||||
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
|
||||
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
||||
(cherry picked from commit ad04dbc5b41df509cd6925eab36af73000632fd2)
|
||||
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
From 141c6e6397d373126bba14982678dd6f1e9fbfd7 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Claudi <aclaudi@redhat.com>
|
||||
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 <mcroce@redhat.com>
|
||||
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
|
||||
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
||||
(cherry picked from commit d035cc1b4e83e2589ea2115cdc2fa7c6d3693a5a)
|
||||
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,78 +0,0 @@
|
||||
From 9da7fb1dd27624ed6ab62f5595451f43c3a07d2d Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Claudi <aclaudi@redhat.com>
|
||||
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 <aclaudi@redhat.com>
|
||||
Reported-by: Frank Hofmann <fhofmann@cloudflare.com>
|
||||
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
||||
(cherry picked from commit 89ce8012d71f5689074dc4cbe3db102cbdf76460)
|
||||
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,113 +0,0 @@
|
||||
From 5b17171ce7363e597009e07fb143522a2d79c77b Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Claudi <aclaudi@redhat.com>
|
||||
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 <aclaudi@redhat.com>
|
||||
Signed-off-by: David Ahern <dsahern@gmail.com>
|
||||
(cherry picked from commit 1e5746d5e13d895b63da954f0290cffbb076cefa)
|
||||
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,97 +0,0 @@
|
||||
From 29a5b8d072d06b685c428f15125ff62b8b470064 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Claudi <aclaudi@redhat.com>
|
||||
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 <aclaudi@redhat.com>
|
||||
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
||||
(cherry picked from commit 6bc13e4a20f50e9c37d5a504c78222913c433fd3)
|
||||
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,64 +0,0 @@
|
||||
From f12ee1269f04a5f4ab5c18326004af32da4061ae Mon Sep 17 00:00:00 2001
|
||||
From: Aya Levin <ayal@mellanox.com>
|
||||
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 <ayal@mellanox.com>
|
||||
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
|
||||
Acked-by: Jiri Pirko <jiri@mellanox.com>
|
||||
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
||||
(cherry picked from commit b4d97ef57fd4b7669971ed209065a72d115dffc2)
|
||||
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,83 +0,0 @@
|
||||
From 4aaf5d7099e7b985973b49f59ceef9b1fd6f6810 Mon Sep 17 00:00:00 2001
|
||||
From: Aya Levin <ayal@mellanox.com>
|
||||
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 <ayal@mellanox.com>
|
||||
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
|
||||
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
||||
(cherry picked from commit 1d05cca2fd70a5bc8a9f4e978aa5629dbc99a973)
|
||||
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,47 +0,0 @@
|
||||
From a5d73c80107321aafd1e2007a059a7eb950412d7 Mon Sep 17 00:00:00 2001
|
||||
From: Aya Levin <ayal@mellanox.com>
|
||||
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 <ayal@mellanox.com>
|
||||
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
|
||||
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
||||
(cherry picked from commit f359942a25d368ccf2e47b79f95db2798e09f7a4)
|
||||
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
From 742a2436d344ac15330c56a2326c03c8c56686a5 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Delalande <colona@arista.com>
|
||||
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 <colona@arista.com>
|
||||
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
||||
(cherry picked from commit ed54f76484b5ee47b190a202ecf29fce60d0d878)
|
||||
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,124 +0,0 @@
|
||||
From 85bfad96a5562a5b57575a7eed35e63a63ae7288 Mon Sep 17 00:00:00 2001
|
||||
From: Minhua Chen <chenminhua1@huawei.com>
|
||||
Date: Fri, 18 Oct 2019 11:29:00 +0800
|
||||
Subject: [PATCH] iproute2: change proc to ipnetnsproc which is private system
|
||||
proc is mounted shared, if use this, it will cause the list size of mnt_share
|
||||
become too large to loop, and will casue kernel softlockup.
|
||||
|
||||
so we need a private mounted proc which is /ipnetnsproc to avoid
|
||||
the large list in kernel.
|
||||
|
||||
use /etc/iproute_private.conf to switch on or off this patch.
|
||||
if file exist and file content equals use_ipnetnsproc=1 then
|
||||
switch on, or else switch off.
|
||||
|
||||
Signed-off-by: Minhua Chen <chenminhua1@huawei.com>
|
||||
---
|
||||
ip/ipnetns.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 67 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/ip/ipnetns.c b/ip/ipnetns.c
|
||||
index 7e6cfe8..14c3b19 100644
|
||||
--- a/ip/ipnetns.c
|
||||
+++ b/ip/ipnetns.c
|
||||
@@ -24,6 +24,63 @@
|
||||
#include "namespace.h"
|
||||
#include "json_print.h"
|
||||
|
||||
+const char *conf_file = "/etc/iproute2/iproute_private.conf";
|
||||
+static int conf_file_parsed = 0;
|
||||
+static int should_use_ipnetnsproc = 0;
|
||||
+
|
||||
+static void parse_config()
|
||||
+{
|
||||
+ FILE *fp = NULL;
|
||||
+ char buffer[256] = {0};
|
||||
+ char *str = NULL;
|
||||
+ char *p = NULL;
|
||||
+
|
||||
+ fp = fopen(conf_file, "r");
|
||||
+ if(fp){
|
||||
+ while (fgets(buffer, sizeof(buffer), fp)) {
|
||||
+ str = buffer;
|
||||
+ /* skip the space */
|
||||
+ while (isspace(*str))
|
||||
+ str++;
|
||||
+ /* skip the comment line */
|
||||
+ if (strncmp(str, "#", 1) == 0)
|
||||
+ continue;
|
||||
+ /* skip line feed */
|
||||
+ if((p = strchr(str, '\n')) != NULL)
|
||||
+ *p = '\0';
|
||||
+ if (strstr(str, "use_ipnetnsproc") != NULL && (p = strstr(str, "=")) != NULL){
|
||||
+ str = p + 1;
|
||||
+ /* skip the space */
|
||||
+ while (isspace(*str))
|
||||
+ str++;
|
||||
+ if (strcmp(str, "1") == 0){
|
||||
+ should_use_ipnetnsproc = 1;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ fclose(fp);
|
||||
+ fp = NULL;
|
||||
+ }
|
||||
+ conf_file_parsed = 1;
|
||||
+}
|
||||
+static int get_should_use_ipnetnsproc()
|
||||
+{
|
||||
+ if (!conf_file_parsed)
|
||||
+ parse_config();
|
||||
+ return should_use_ipnetnsproc;
|
||||
+}
|
||||
+
|
||||
+static char* get_proc_string()
|
||||
+{
|
||||
+ if(get_should_use_ipnetnsproc()){
|
||||
+ return "/ipnetnsproc";
|
||||
+ }else{
|
||||
+ return "/proc";
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int usage(void)
|
||||
{
|
||||
fprintf(stderr, "Usage: ip netns list\n");
|
||||
@@ -483,10 +540,10 @@ static int netns_pids(int argc, char **argv)
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- dir = opendir("/proc/");
|
||||
+ dir = opendir(get_proc_string());
|
||||
if (!dir) {
|
||||
- fprintf(stderr, "Open of /proc failed: %s\n",
|
||||
- strerror(errno));
|
||||
+ fprintf(stderr, "Open of %s failed: %s\n",
|
||||
+ get_proc_string(), strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
while ((entry = readdir(dir))) {
|
||||
@@ -495,8 +552,8 @@ static int netns_pids(int argc, char **argv)
|
||||
|
||||
if (!is_pid(entry->d_name))
|
||||
continue;
|
||||
- snprintf(pid_net_path, sizeof(pid_net_path), "/proc/%s/ns/net",
|
||||
- entry->d_name);
|
||||
+ snprintf(pid_net_path, sizeof(pid_net_path), "%s/%s/ns/net",
|
||||
+ get_proc_string(), entry->d_name);
|
||||
if (stat(pid_net_path, &st) != 0)
|
||||
continue;
|
||||
if ((st.st_dev == netst.st_dev) &&
|
||||
@@ -519,7 +576,7 @@ int netns_identify_pid(const char *pidstr, char *name, int len)
|
||||
|
||||
name[0] = '\0';
|
||||
|
||||
- snprintf(net_path, sizeof(net_path), "/proc/%s/ns/net", pidstr);
|
||||
+ snprintf(net_path, sizeof(net_path), "%s/%s/ns/net", get_proc_string(), pidstr);
|
||||
netns = open(net_path, O_RDONLY);
|
||||
if (netns < 0) {
|
||||
fprintf(stderr, "Cannot open network namespace: %s\n",
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
From 1d9bf6b69e4bdeecf23d00a1d083912ad479269e Mon Sep 17 00:00:00 2001
|
||||
From: Li Shang <shangli1@huawei.com>
|
||||
Date: Tue, 13 Nov 2018 22:43:48 +0800
|
||||
Subject: [PATCH] huawei bugfix support ip route add vai
|
||||
|
||||
---
|
||||
ip/iproute.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/ip/iproute.c b/ip/iproute.c
|
||||
index f252df4..2560b27 100644
|
||||
--- a/ip/iproute.c
|
||||
+++ b/ip/iproute.c
|
||||
@@ -1467,9 +1467,6 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
|
||||
argc--; argv++;
|
||||
}
|
||||
|
||||
- if (!dst_ok)
|
||||
- usage();
|
||||
-
|
||||
if (d) {
|
||||
int idx = ll_name_to_index(d);
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
From c246386b595a2e2f88c5cf5e293a23824c2ba2c6 Mon Sep 17 00:00:00 2001
|
||||
From: Feilong Lin <linfeilong@huawei.com>
|
||||
Date: Tue, 16 Oct 2018 18:15:34 +0800
|
||||
Subject: [PATCH] fix maddr show
|
||||
|
||||
---
|
||||
ip/ipmaddr.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c
|
||||
index 4f726fd..1434093 100644
|
||||
--- a/ip/ipmaddr.c
|
||||
+++ b/ip/ipmaddr.c
|
||||
@@ -137,9 +137,11 @@ static void read_igmp(struct ma_info **result_p)
|
||||
while (fgets(buf, sizeof(buf), fp)) {
|
||||
struct ma_info *ma;
|
||||
|
||||
+ int index;
|
||||
if (buf[0] != '\t') {
|
||||
size_t len;
|
||||
|
||||
+ memset(&m.name, 0, sizeof(m.name));
|
||||
sscanf(buf, "%d%s", &m.index, m.name);
|
||||
len = strlen(m.name);
|
||||
if (m.name[len - 1] == ':')
|
||||
@@ -147,6 +149,11 @@ static void read_igmp(struct ma_info **result_p)
|
||||
continue;
|
||||
}
|
||||
|
||||
+ index = strlen(m.name) - 1;
|
||||
+ if (index > 0 && m.name[index] == ':') {
|
||||
+ m.name[index] = 0;
|
||||
+ }
|
||||
+
|
||||
if (filter.dev && strcmp(filter.dev, m.name))
|
||||
continue;
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
27
iproute.spec
27
iproute.spec
@ -1,6 +1,6 @@
|
||||
Name: iproute
|
||||
Version: 5.2.0
|
||||
Release: 2
|
||||
Version: 5.4.0
|
||||
Release: 1
|
||||
Summary: Linux network configuration utilities
|
||||
License: GPLv2+ and Public Domain
|
||||
URL: https://kernel.org/pub/linux/utils/net/iproute2/
|
||||
@ -9,21 +9,6 @@ Source0: https://mirrors.edge.kernel.org/pub/linux/utils/net/iproute2/iproute2-%
|
||||
BuildRequires: gcc bison elfutils-libelf-devel flex iptables-devel libcap-devel
|
||||
BuildRequires: libdb-devel libmnl-devel libselinux-devel pkgconfig git
|
||||
|
||||
Patch9001: bugfix-iproute2-3.10.0-fix-maddr-show.patch
|
||||
Patch9002: bugfix-iproute-support-assume-default-route.patch
|
||||
|
||||
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
|
||||
|
||||
Patch9003: bugfix-1001-iproute-change-proc-to-ipnetnsproc-which-is-private.patch
|
||||
|
||||
Provides: /sbin/ip iproute-tc tc
|
||||
Obsoletes: iproute-tc
|
||||
|
||||
@ -67,7 +52,7 @@ install -m 0644 lib/libnetlink.a %{buildroot}%{_libdir}/libnetlink.a
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%license COPYING
|
||||
%doc README.lnstat
|
||||
%doc README
|
||||
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/iproute2/*
|
||||
%{_sbindir}/*
|
||||
%{_libdir}/tc/*
|
||||
@ -78,14 +63,16 @@ install -m 0644 lib/libnetlink.a %{buildroot}%{_libdir}/libnetlink.a
|
||||
%license COPYING
|
||||
%{_libdir}/libnetlink.a
|
||||
%{_includedir}/*
|
||||
%{_datadir}/doc/examples
|
||||
|
||||
%files help
|
||||
%defattr(-,root,root)
|
||||
%doc README README.distribution README.iproute2+tc
|
||||
%doc README
|
||||
%{_mandir}/*
|
||||
|
||||
%changelog
|
||||
* Tue Jan 14 2020 openEuler Buildteam <buildteam@openeuler.org> - 5.4.0-1
|
||||
- update to 5.4.0
|
||||
|
||||
* Fri Oct 18 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.2.0-2
|
||||
- Type:bugfix
|
||||
- Id:NA
|
||||
|
||||
Binary file not shown.
BIN
iproute2-5.4.0.tar.xz
Normal file
BIN
iproute2-5.4.0.tar.xz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user