From 4fb98f08956ff4810354d75afa9b04cb6f8011bc Mon Sep 17 00:00:00 2001 From: Andrea Claudi Date: Wed, 4 Sep 2019 19:26:14 +0200 Subject: [PATCH 1/5] devlink: fix segfault on health command devlink segfaults when using grace_period without reporter $ devlink health set pci/0000:00:09.0 grace_period 3500 Segmentation fault devlink is instead supposed to gracefully fail printing a warning message $ devlink health set pci/0000:00:09.0 grace_period 3500 Reporter's name is expected. This happens because DL_OPT_HEALTH_REPORTER_NAME and DL_OPT_HEALTH_REPORTER_GRACEFUL_PERIOD are both defined as BIT(27). When dl_opts_put() parse options and grace_period is set, it erroneously tries to set reporter name to null. This is fixed simply shifting by 1 bit enumeration starting with DL_OPT_HEALTH_REPORTER_GRACEFUL_PERIOD. Fixes: b18d89195b16 ("devlink: Add devlink health set command") Signed-off-by: Andrea Claudi Signed-off-by: Stephen Hemminger --- devlink/devlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index 91c85dc1..02933739 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -231,8 +231,8 @@ static void ifname_map_free(struct ifname_map *ifname_map) #define DL_OPT_FLASH_FILE_NAME BIT(25) #define DL_OPT_FLASH_COMPONENT BIT(26) #define DL_OPT_HEALTH_REPORTER_NAME BIT(27) -#define DL_OPT_HEALTH_REPORTER_GRACEFUL_PERIOD BIT(27) -#define DL_OPT_HEALTH_REPORTER_AUTO_RECOVER BIT(28) +#define DL_OPT_HEALTH_REPORTER_GRACEFUL_PERIOD BIT(28) +#define DL_OPT_HEALTH_REPORTER_AUTO_RECOVER BIT(29) struct dl_opts { uint32_t present; /* flags of present items */ From 2caa8012e844af42d78f4232af5482d8b62b025d Mon Sep 17 00:00:00 2001 From: David Ahern Date: Wed, 4 Sep 2019 08:09:52 -0700 Subject: [PATCH 2/5] nexthop: Add space after blackhole Add a space after 'blackhole' is missing to properly separate the protocol when it is given. Fixes: 63df8e8543b0 ("Add support for nexthop objects") Signed-off-by: David Ahern Signed-off-by: Stephen Hemminger --- ip/ipnexthop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c index f35aab52..8356aca2 100644 --- a/ip/ipnexthop.c +++ b/ip/ipnexthop.c @@ -242,7 +242,7 @@ int print_nexthop(struct nlmsghdr *n, void *arg) } if (tb[NHA_BLACKHOLE]) - print_null(PRINT_ANY, "blackhole", "blackhole", NULL); + print_null(PRINT_ANY, "blackhole", "blackhole ", NULL); if (nhm->nh_protocol != RTPROT_UNSPEC || show_details > 0) { print_string(PRINT_ANY, "protocol", "proto %s ", From 4e2d9fc4d8119fdd536df15cc538002a7d7a0e75 Mon Sep 17 00:00:00 2001 From: Mark Zhang Date: Wed, 11 Sep 2019 11:12:43 +0300 Subject: [PATCH 3/5] rdma: Check comm string before print in print_comm() Broken kernels (not-upstream) can provide wrong empty "comm" field. It causes to segfault while printing in JSON format. Fixes: 8ecac46a60ff ("rdma: Add QP resource tracking information") Signed-off-by: Mark Zhang Signed-off-by: Leon Romanovsky Signed-off-by: Stephen Hemminger --- rdma/res.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rdma/res.c b/rdma/res.c index ef863f14..c5e8ba1d 100644 --- a/rdma/res.c +++ b/rdma/res.c @@ -159,6 +159,9 @@ void print_comm(struct rd *rd, const char *str, struct nlattr **nla_line) { char tmp[18]; + if (!str) + return; + if (rd->json_output) { /* Don't beatify output in JSON format */ jsonw_string_field(rd->jw, "comm", str); From 6296d51825010520522b63d4c51abb7011e8da4b Mon Sep 17 00:00:00 2001 From: Andrea Claudi Date: Wed, 11 Sep 2019 12:19:29 +0200 Subject: [PATCH 4/5] man: ss.8: add documentation for drop counter After commit 6df9c7a06a845 ("ss: add SK_MEMINFO_DROPS display") ss -m displays also a drop counter for each socket. This commit properly document it into the man page. Signed-off-by: Andrea Claudi Signed-off-by: Stephen Hemminger --- man/man8/ss.8 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/man/man8/ss.8 b/man/man8/ss.8 index f428e60c..023d771b 100644 --- a/man/man8/ss.8 +++ b/man/man8/ss.8 @@ -99,13 +99,13 @@ skmem:(r,rb,t,tb, .br .RS .RS -f,w, +f,w,o, .RE .RE .br .RS .RS -o,bl) +bl,d) .RE .RE .P @@ -146,6 +146,10 @@ The memory used for the sk backlog queue. On a process context, if the process is receiving packet, and a new packet is received, it will be put into the sk backlog queue, so it can be received by the process immediately +.P +.TP +.B +the number of packets dropped before they are de-multiplexed into the socket .RE .TP .B \-p, \-\-processes From 80d0e626736e9bdff3075915b358ae7b531ac775 Mon Sep 17 00:00:00 2001 From: Nicolas Dichtel Date: Mon, 16 Sep 2019 17:36:27 +0200 Subject: [PATCH 5/5] link_xfrm: don't force to set phydev Since linux commit 22d6552f827e ("xfrm interface: fix management of phydev"), phydev is not mandatory anymore. Note that it also could be useful before the above commit to not force the user to put a phydev (the kernel was checking it anyway). For example, it was useful to not set it in case of x-netns, because the phydev is not available in the current netns: Before the patch: $ ip netns add foo $ ip link add xfrm1 type xfrm dev eth1 if_id 1 $ ip link set xfrm1 netns foo $ ip -n foo link set xfrm1 type xfrm dev eth1 if_id 2 Cannot find device "eth1" $ ip -n foo link set xfrm1 type xfrm if_id 2 must specify physical device Fixes: 286446c1e8c7 ("ip: support for xfrm interfaces") Signed-off-by: Nicolas Dichtel Acked-by: Matt Ellison Signed-off-by: Stephen Hemminger --- ip/link_xfrm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ip/link_xfrm.c b/ip/link_xfrm.c index 7a3285b4..a28f308d 100644 --- a/ip/link_xfrm.c +++ b/ip/link_xfrm.c @@ -17,7 +17,7 @@ static void xfrm_print_help(struct link_util *lu, int argc, char **argv, FILE *f) { fprintf(f, - "Usage: ... %-4s dev PHYS_DEV [ if_id IF-ID ]\n" + "Usage: ... %-4s dev [ PHYS_DEV ] [ if_id IF-ID ]\n" "\n" "Where: IF-ID := { 0x0..0xffffffff }\n", lu->id); @@ -46,12 +46,8 @@ static int xfrm_parse_opt(struct link_util *lu, int argc, char **argv, argc--; argv++; } - if (link) { + if (link) addattr32(n, 1024, IFLA_XFRM_LINK, link); - } else { - fprintf(stderr, "must specify physical device\n"); - return -1; - } return 0; }