Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
52b9f2c021
!214 sync some patches from upstream
From: @yangl777 
Reviewed-by: @zhongxuan2 
Signed-off-by: @zhongxuan2
2025-04-18 01:46:54 +00:00
yangl777
2a029d7567 sync some patches from upstream 2025-04-17 11:24:23 +00:00
openeuler-ci-bot
b5ff8f30e4
!208 [sync] PR-203: sync some patches from upstream and remove redundant patches
From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
2025-02-13 08:03:29 +00:00
xh
08296d0a97 sync some patches from upstream
(cherry picked from commit b3a280a991abd1b11a548b0c17585380af394eca)
2025-02-13 14:34:26 +08:00
openeuler-ci-bot
4d9613f3fa
!187 Exit exec in child process if setup fails
From: @jamesblunt 
Reviewed-by: @zengwefeng 
Signed-off-by: @zengwefeng
2024-05-23 03:38:35 +00:00
zhangyaqi
b8f04d568f Exit exec in child process if setup fails 2024-05-22 16:05:57 +08:00
openeuler-ci-bot
c8f6f13e1f
!180 Backport from community
From: @zzry 
Reviewed-by: @robertxw 
Signed-off-by: @robertxw
2024-02-27 01:27:09 +00:00
Ran Zhou
1673447902 Add support to dump rdma SRQ resource
Signed-off-by: Ran Zhou <zhouran10@h-partners.com>
2024-02-26 14:27:35 +08:00
openeuler-ci-bot
44a2f93582
!176 update to 6.6.0
From: @tmacbb 
Reviewed-by: @robertxw 
Signed-off-by: @robertxw
2024-02-18 08:48:44 +00:00
tmacbb
119b431d2f update to 6.6.0 2024-02-07 14:31:20 +08:00
12 changed files with 709 additions and 42 deletions

View File

@ -0,0 +1,58 @@
From 70ba338cd8314410380b8bdae9e5f302e8e98039 Mon Sep 17 00:00:00 2001
From: Yedaya Katsman <yedaya.ka@gmail.com>
Date: Tue, 23 Apr 2024 21:38:20 +0300
Subject: ip: Exit exec in child process if setup fails
Reference: https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=70ba338cd8314410380b8bdae9e5f302e8e98039
If we forked, returning from the function will make the calling code to
continue in both the child and parent process. Make cmd_exec exit if
setup failed and it forked already.
An example of issues this causes, where a failure in setup causes
multiple unnecessary tries:
```
$ ip netns
ef
ab
$ ip -all netns exec ls
netns: ef
setting the network namespace "ef" failed: Operation not permitted
netns: ab
setting the network namespace "ab" failed: Operation not permitted
netns: ab
setting the network namespace "ab" failed: Operation not permitted
```
Signed-off-by: Yedaya Katsman <yedaya.ka@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/exec.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/exec.c b/lib/exec.c
index 9b1c8f4..5bd3e2d 100644
--- a/lib/exec.c
+++ b/lib/exec.c
@@ -36,8 +36,13 @@ int cmd_exec(const char *cmd, char **argv, bool do_fork,
}
}
- if (setup && setup(arg))
+ if (setup && setup(arg)) {
+ if (do_fork) {
+ /* In child, nothing to do */
+ _exit(1);
+ }
return -1;
+ }
if (execvp(cmd, argv) < 0)
fprintf(stderr, "exec of \"%s\" failed: %s\n",
--
2.27.0

View File

@ -0,0 +1,110 @@
From 57daf8ff8c6c357a5a083657e5b03d2883cbc4f9 Mon Sep 17 00:00:00 2001
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Wed, 18 Sep 2024 18:49:41 +0200
Subject: [PATCH] iplink: fix fd leak when playing with netns
The command 'ip link set foo netns mynetns' opens a file descriptor to fill
the netlink attribute IFLA_NET_NS_FD. This file descriptor is never closed.
When batch mode is used, the number of file descriptor may grow greatly and
reach the maximum file descriptor number that can be opened.
This fd can be closed only after the netlink answer. Moreover, a second
fd could be opened because some (struct link_util)->parse_opt() handlers
call iplink_parse().
Let's add a helper to manage these fds:
- open_fds_add() stores a fd, up to 5 (arbitrary choice, it seems enough);
- open_fds_close() closes all stored fds.
Fixes: 0dc34c7713bb ("iproute2: Add processless network namespace support")
Reported-by: Alexandre Ferrieux <alexandre.ferrieux@orange.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reference:https://github.com/iproute2/iproute2/commit/57daf8ff8c6c357a5a083657e5b03d2883cbc4f9
Conflict:Context adaptation
---
include/utils.h | 3 +++
ip/iplink.c | 6 +++++-
lib/utils.c | 23 +++++++++++++++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/include/utils.h b/include/utils.h
index f26ed82..4a08372 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -390,4 +390,7 @@ int proto_a2n(unsigned short *id, const char *buf,
const char *proto_n2a(unsigned short id, char *buf, int len,
const struct proto *proto_tb, size_t tb_len);
+int open_fds_add(int fd);
+void open_fds_close(void);
+
#endif /* __UTILS_H__ */
diff --git a/ip/iplink.c b/ip/iplink.c
index 9a548dd..f7465d1 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -675,9 +675,11 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
if (netns != -1)
duparg("netns", *argv);
netns = netns_get_fd(*argv);
- if (netns >= 0)
+ if (netns >= 0) {
+ open_fds_add(netns);
addattr_l(&req->n, sizeof(*req), IFLA_NET_NS_FD,
&netns, 4);
+ }
else if (get_integer(&netns, *argv, 0) == 0)
addattr_l(&req->n, sizeof(*req),
IFLA_NET_NS_PID, &netns, 4);
@@ -1141,6 +1143,8 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
else
ret = rtnl_talk(&rth, &req.n, NULL);
+ open_fds_close();
+
if (ret)
return -2;
diff --git a/lib/utils.c b/lib/utils.c
index 99ba7a2..1f4a498 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -40,6 +40,9 @@ int timestamp_short;
int pretty;
const char *_SL_ = "\n";
+static int open_fds[5];
+static int open_fds_cnt;
+
static int af_byte_len(int af);
static void print_time(char *buf, int len, __u32 time);
static void print_time64(char *buf, int len, __s64 time);
@@ -1970,3 +1973,23 @@ int proto_a2n(unsigned short *id, const char *buf,
return 0;
}
+
+int open_fds_add(int fd)
+{
+ if (open_fds_cnt >= ARRAY_SIZE(open_fds))
+ return -1;
+
+ open_fds[open_fds_cnt++] = fd;
+ return 0;
+}
+
+
+void open_fds_close(void)
+{
+ int i;
+
+ for (i = 0; i < open_fds_cnt; i++)
+ close(open_fds[i]);
+
+ open_fds_cnt = 0;
+}
--
2.43.0

View File

@ -0,0 +1,32 @@
From 225f74761b091e51444cf1f9686547f3c42e44b3 Mon Sep 17 00:00:00 2001
From: Denis Kirjanov <kirjanov@gmail.com>
Date: Wed, 13 Nov 2024 13:53:49 +0300
Subject: [PATCH] lib: names: check calloc return value in db_names_alloc
db_names_load() may crash since it touches the
hash member. Fix it by checking the return value
Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Conflict: NA
Reference: https://github.com/iproute2/iproute2/commit/225f74761b091e51444cf1f9686547f3c42e44b3
---
lib/names.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/names.c b/lib/names.c
index cbfa971ff..4ecae92b9 100644
--- a/lib/names.c
+++ b/lib/names.c
@@ -55,6 +55,10 @@ struct db_names *db_names_alloc(void)
db->size = MAX_ENTRIES;
db->hash = calloc(db->size, sizeof(struct db_entry *));
+ if (!db->hash) {
+ free(db);
+ return NULL;
+ }
return db;
}

View File

@ -0,0 +1,86 @@
From 07bfa4482d49cc87a7b7c810c99397b9e8f794f6 Mon Sep 17 00:00:00 2001
From: wenglianfa <wenglianfa@huawei.com>
Date: Tue, 10 Oct 2023 15:55:26 +0800
Subject: [PATCH] rdma: Add support to dump SRQ resource in raw format
Add support to dump SRQ resource in raw format.
This patch relies on the corresponding kernel commit aebf8145e11a
("RDMA/core: Add support to dump SRQ resource in RAW format")
Example:
$ rdma res show srq -r
dev hns3 149000...
$ rdma res show srq -j -r
[{"ifindex":0,"ifname":"hns3","data":[149,0,0,...]}]
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
---
rdma/res-srq.c | 20 ++++++++++++++++++--
rdma/res.h | 2 ++
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/rdma/res-srq.c b/rdma/res-srq.c
index 186ae281..cf9209d7 100644
--- a/rdma/res-srq.c
+++ b/rdma/res-srq.c
@@ -162,6 +162,20 @@ out:
return -EINVAL;
}
+static int res_srq_line_raw(struct rd *rd, const char *name, int idx,
+ struct nlattr **nla_line)
+{
+ if (!nla_line[RDMA_NLDEV_ATTR_RES_RAW])
+ return MNL_CB_ERROR;
+
+ open_json_object(NULL);
+ print_dev(rd, idx, name);
+ print_raw_data(rd, nla_line);
+ newline(rd);
+
+ return MNL_CB_OK;
+}
+
static int res_srq_line(struct rd *rd, const char *name, int idx,
struct nlattr **nla_line)
{
@@ -248,7 +262,8 @@ int res_srq_idx_parse_cb(const struct nlmsghdr *nlh, void *data)
name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]);
idx = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);
- return res_srq_line(rd, name, idx, tb);
+ return (rd->show_raw) ? res_srq_line_raw(rd, name, idx, tb) :
+ res_srq_line(rd, name, idx, tb);
}
int res_srq_parse_cb(const struct nlmsghdr *nlh, void *data)
@@ -276,7 +291,8 @@ int res_srq_parse_cb(const struct nlmsghdr *nlh, void *data)
if (ret != MNL_CB_OK)
break;
- ret = res_srq_line(rd, name, idx, nla_line);
+ ret = (rd->show_raw) ? res_srq_line_raw(rd, name, idx, nla_line) :
+ res_srq_line(rd, name, idx, nla_line);
if (ret != MNL_CB_OK)
break;
}
diff --git a/rdma/res.h b/rdma/res.h
index 70e51acd..e880c28b 100644
--- a/rdma/res.h
+++ b/rdma/res.h
@@ -39,6 +39,8 @@ static inline uint32_t res_get_command(uint32_t command, struct rd *rd)
return RDMA_NLDEV_CMD_RES_CQ_GET_RAW;
case RDMA_NLDEV_CMD_RES_MR_GET:
return RDMA_NLDEV_CMD_RES_MR_GET_RAW;
+ case RDMA_NLDEV_CMD_RES_SRQ_GET:
+ return RDMA_NLDEV_CMD_RES_SRQ_GET_RAW;
default:
return command;
}
--
2.25.1

View File

@ -0,0 +1,204 @@
From 3a882b6b4e0ee8c7cfd11176d36a98d30fc449d3 Mon Sep 17 00:00:00 2001
From: wenglianfa <wenglianfa@huawei.com>
Date: Fri, 29 Dec 2023 14:52:41 +0800
Subject: [PATCH] rdma: Fix the error of accessing string variable outside the
lifecycle
All these SPRINT_BUF(b) definitions are inside the 'if' block, but
accessed outside the 'if' block through the pointers 'comm'. This
leads to empty 'comm' attribute when querying resource information.
So move the definitions to the beginning of the functions to extend
their life cycle.
Before:
$ rdma res show srq
dev hns_0 srqn 0 type BASIC lqpn 18 pdn 5 pid 7775 comm
After:
$ rdma res show srq
dev hns_0 srqn 0 type BASIC lqpn 18 pdn 5 pid 7775 comm ib_send_bw
Fixes: 1808f002dfdd ("lib/fs: fix memory leak in get_task_name()")
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Acked-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
rdma/res-cmid.c | 3 +--
rdma/res-cq.c | 3 +--
rdma/res-ctx.c | 3 +--
rdma/res-mr.c | 3 +--
rdma/res-pd.c | 3 +--
rdma/res-qp.c | 3 +--
rdma/res-srq.c | 3 +--
rdma/stat.c | 3 +--
8 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/rdma/res-cmid.c b/rdma/res-cmid.c
index 8b6b3497..17a89cc4 100644
--- a/rdma/res-cmid.c
+++ b/rdma/res-cmid.c
@@ -99,6 +99,7 @@ static int res_cm_id_line(struct rd *rd, const char *name, int idx,
uint32_t lqpn = 0, ps;
uint32_t cm_idn = 0;
char *comm = NULL;
+ SPRINT_BUF(b);
if (!nla_line[RDMA_NLDEV_ATTR_RES_STATE] ||
!nla_line[RDMA_NLDEV_ATTR_RES_PS])
@@ -156,8 +157,6 @@ static int res_cm_id_line(struct rd *rd, const char *name, int idx,
goto out;
if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) {
- SPRINT_BUF(b);
-
pid = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_RES_PID]);
if (!get_task_name(pid, b, sizeof(b)))
comm = b;
diff --git a/rdma/res-cq.c b/rdma/res-cq.c
index 420e935a..0cab3fe0 100644
--- a/rdma/res-cq.c
+++ b/rdma/res-cq.c
@@ -63,6 +63,7 @@ static int res_cq_line(struct rd *rd, const char *name, int idx,
uint32_t cqn = 0;
uint64_t users;
uint32_t cqe;
+ SPRINT_BUF(b);
if (!nla_line[RDMA_NLDEV_ATTR_RES_CQE] ||
!nla_line[RDMA_NLDEV_ATTR_RES_USECNT])
@@ -84,8 +85,6 @@ static int res_cq_line(struct rd *rd, const char *name, int idx,
goto out;
if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) {
- SPRINT_BUF(b);
-
pid = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_RES_PID]);
if (!get_task_name(pid, b, sizeof(b)))
comm = b;
diff --git a/rdma/res-ctx.c b/rdma/res-ctx.c
index 0a84d016..235c837a 100644
--- a/rdma/res-ctx.c
+++ b/rdma/res-ctx.c
@@ -13,13 +13,12 @@ static int res_ctx_line(struct rd *rd, const char *name, int idx,
char *comm = NULL;
uint32_t ctxn = 0;
uint32_t pid = 0;
+ SPRINT_BUF(b);
if (!nla_line[RDMA_NLDEV_ATTR_RES_CTXN])
return MNL_CB_ERROR;
if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) {
- SPRINT_BUF(b);
-
pid = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_RES_PID]);
if (!get_task_name(pid, b, sizeof(b)))
comm = b;
diff --git a/rdma/res-mr.c b/rdma/res-mr.c
index 693d98c1..f6c2534a 100644
--- a/rdma/res-mr.c
+++ b/rdma/res-mr.c
@@ -31,6 +31,7 @@ static int res_mr_line(struct rd *rd, const char *name, int idx,
uint32_t pdn = 0;
uint32_t mrn = 0;
uint32_t pid = 0;
+ SPRINT_BUF(b);
if (!nla_line[RDMA_NLDEV_ATTR_RES_MRLEN])
return MNL_CB_ERROR;
@@ -48,8 +49,6 @@ static int res_mr_line(struct rd *rd, const char *name, int idx,
goto out;
if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) {
- SPRINT_BUF(b);
-
pid = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_RES_PID]);
if (!get_task_name(pid, b, sizeof(b)))
comm = b;
diff --git a/rdma/res-pd.c b/rdma/res-pd.c
index 40a3f9bd..8b9f7aa6 100644
--- a/rdma/res-pd.c
+++ b/rdma/res-pd.c
@@ -16,6 +16,7 @@ static int res_pd_line(struct rd *rd, const char *name, int idx,
uint32_t pid = 0;
uint32_t pdn = 0;
uint64_t users;
+ SPRINT_BUF(b);
if (!nla_line[RDMA_NLDEV_ATTR_RES_USECNT])
return MNL_CB_ERROR;
@@ -34,8 +35,6 @@ static int res_pd_line(struct rd *rd, const char *name, int idx,
nla_line[RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY]);
if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) {
- SPRINT_BUF(b);
-
pid = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_RES_PID]);
if (!get_task_name(pid, b, sizeof(b)))
comm = b;
diff --git a/rdma/res-qp.c b/rdma/res-qp.c
index 145292aa..65ff54ab 100644
--- a/rdma/res-qp.c
+++ b/rdma/res-qp.c
@@ -84,6 +84,7 @@ static int res_qp_line(struct rd *rd, const char *name, int idx,
uint32_t port = 0, pid = 0;
uint32_t pdn = 0;
char *comm = NULL;
+ SPRINT_BUF(b);
if (!nla_line[RDMA_NLDEV_ATTR_RES_LQPN] ||
!nla_line[RDMA_NLDEV_ATTR_RES_SQ_PSN] ||
@@ -144,8 +145,6 @@ static int res_qp_line(struct rd *rd, const char *name, int idx,
goto out;
if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) {
- SPRINT_BUF(b);
-
pid = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_RES_PID]);
if (!get_task_name(pid, b, sizeof(b)))
comm = b;
diff --git a/rdma/res-srq.c b/rdma/res-srq.c
index 1d35900a..8ab2538a 100644
--- a/rdma/res-srq.c
+++ b/rdma/res-srq.c
@@ -183,13 +183,12 @@ static int res_srq_line(struct rd *rd, const char *name, int idx,
char qp_str[MAX_QP_STR_LEN] = {};
char *comm = NULL;
uint8_t type = 0;
+ SPRINT_BUF(b);
if (!nla_line[RDMA_NLDEV_ATTR_RES_SRQN])
return MNL_CB_ERROR;
if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) {
- SPRINT_BUF(b);
-
pid = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_RES_PID]);
if (!get_task_name(pid, b, sizeof(b)))
comm = b;
diff --git a/rdma/stat.c b/rdma/stat.c
index 46ed1765..bf78f7cc 100644
--- a/rdma/stat.c
+++ b/rdma/stat.c
@@ -222,6 +222,7 @@ static int res_counter_line(struct rd *rd, const char *name, int index,
struct nlattr *hwc_table, *qp_table;
struct nlattr *nla_entry;
const char *comm = NULL;
+ SPRINT_BUF(b);
bool isfirst;
int err;
@@ -247,8 +248,6 @@ static int res_counter_line(struct rd *rd, const char *name, int index,
return MNL_CB_OK;
if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) {
- SPRINT_BUF(b);
-
pid = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_RES_PID]);
if (!get_task_name(pid, b, sizeof(b)))
comm = b;
--
2.25.1

View File

@ -0,0 +1,32 @@
From cd4315de422ebeb2d9844ddc71ca5a431abc2c2f Mon Sep 17 00:00:00 2001
From: Junxian Huang <huangjunxian6@hisilicon.com>
Date: Tue, 10 Oct 2023 15:55:25 +0800
Subject: [PATCH] rdma: Update uapi headers
Update rdma_netlink.h file upto kernel commit aebf8145e11a
("RDMA/core: Add support to dump SRQ resource in RAW format")
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
---
rdma/include/uapi/rdma/rdma_netlink.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h
index 92c528a0..84f775be 100644
--- a/rdma/include/uapi/rdma/rdma_netlink.h
+++ b/rdma/include/uapi/rdma/rdma_netlink.h
@@ -299,6 +299,8 @@ enum rdma_nldev_command {
RDMA_NLDEV_CMD_STAT_GET_STATUS,
+ RDMA_NLDEV_CMD_RES_SRQ_GET_RAW,
+
RDMA_NLDEV_NUM_OPS
};
--
2.25.1

View File

@ -0,0 +1,88 @@
From 0ea0699ea01df81750becf742083933a23a95d94 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Thu, 4 Jul 2024 17:26:41 -0700
Subject: [PATCH] route: filter by interface on multipath routes
The ip route command would silently hide multipath routes when filter
by interface. The problem was it was not looking for interface when
filter multipath routes.
Example:
ip link add name dummy1 up type dummy
ip link add name dummy2 up type dummy
ip address add 192.0.2.1/28 dev dummy1
ip address add 192.0.2.17/28 dev dummy2
ip route add 198.51.100.0/24 \
nexthop via 192.0.2.2 dev dummy1 \
nexthop via 192.0.2.18 dev dummy2
Before:
ip route show dev dummy1
192.0.2.0/28 proto kernel scope link src 192.0.2.1
After:
ip route show dev dummy1
192.0.2.0/28 proto kernel scope link src 192.0.2.1
198.51.100.0/24
nexthop via 192.0.2.2 dev dummy1 weight 1
nexthop via 192.0.2.18 dev dummy2 weight 1
Reported-by: "Muggeridge, Matt" <matt.muggeridge2@hpe.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Conflict: NA
Reference: https://github.com/iproute2/iproute2/commit/0ea0699ea01df81750becf742083933a23a95d94.patch
---
ip/iproute.c | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/ip/iproute.c b/ip/iproute.c
index b53046116..446662404 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -154,6 +154,24 @@ static int flush_update(void)
return 0;
}
+static bool filter_multipath(const struct rtattr *rta)
+{
+ const struct rtnexthop *nh = RTA_DATA(rta);
+ int len = RTA_PAYLOAD(rta);
+
+ while (len >= sizeof(*nh)) {
+ if (nh->rtnh_len > len)
+ break;
+
+ if (!((nh->rtnh_ifindex ^ filter.oif) & filter.oifmask))
+ return true;
+
+ len -= NLMSG_ALIGN(nh->rtnh_len);
+ nh = RTNH_NEXT(nh);
+ }
+ return false;
+}
+
static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
{
struct rtmsg *r = NLMSG_DATA(n);
@@ -310,12 +328,15 @@ static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
return 0;
}
if (filter.oifmask) {
- int oif = 0;
+ if (tb[RTA_OIF]) {
+ int oif = rta_getattr_u32(tb[RTA_OIF]);
- if (tb[RTA_OIF])
- oif = rta_getattr_u32(tb[RTA_OIF]);
- if ((oif^filter.oif)&filter.oifmask)
- return 0;
+ if ((oif ^ filter.oif) & filter.oifmask)
+ return 0;
+ } else if (tb[RTA_MULTIPATH]) {
+ if (!filter_multipath(tb[RTA_MULTIPATH]))
+ return 0;
+ }
}
if (filter.markmask) {
int mark = 0;

View File

@ -0,0 +1,52 @@
From 3e807112fdf3d7b89a8295379dd8474f08a38b4b Mon Sep 17 00:00:00 2001
From: xixiliguo <xixiliguo@foxmail.com>
Date: Sat, 20 Jul 2024 23:23:27 +0800
Subject: [PATCH] ss: fix expired time format of timer
When expired time of time-wait timer is less than or equal to 9 seconds,
as shown below, result that below 1 sec is incorrect.
Expect output should be show 9 seconds and 373 millisecond, but 9.373ms
mean only 9 millisecond and 373 microseconds
Before:
TIME-WAIT 0 0 ... timer:(timewait,12sec,0)
TIME-WAIT 0 0 ... timer:(timewait,11sec,0)
TIME-WAIT 0 0 ... timer:(timewait,10sec,0)
TIME-WAIT 0 0 ... timer:(timewait,9.373ms,0)
TIME-WAIT 0 0 ... timer:(timewait,8.679ms,0)
TIME-WAIT 0 0 ... timer:(timewait,1.574ms,0)
TIME-WAIT 0 0 ... timer:(timewait,954ms,0)
TIME-WAIT 0 0 ... timer:(timewait,303ms,0)
After:
TIME-WAIT 0 0 ... timer:(timewait,13sec,0)
TIME-WAIT 0 0 ... timer:(timewait,12sec,0)
TIME-WAIT 0 0 ... timer:(timewait,10sec,0)
TIME-WAIT 0 0 ... timer:(timewait,9.501sec,0)
TIME-WAIT 0 0 ... timer:(timewait,8.990sec,0)
TIME-WAIT 0 0 ... timer:(timewait,7.865sec,0)
TIME-WAIT 0 0 ... timer:(timewait,1.098sec,0)
TIME-WAIT 0 0 ... timer:(timewait,476ms,0)
Signed-off-by: xixiliguo <xixiliguo@foxmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Conflict: NA
Reference: https://github.com/iproute2/iproute2/commit/3e807112fdf3d7b89a8295379dd8474f08a38b4b
---
misc/ss.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/ss.c b/misc/ss.c
index 27f0f20d8..620f4c8fb 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1516,7 +1516,7 @@ static const char *print_ms_timer(unsigned int timeout)
sprintf(buf+strlen(buf), "%d%s", secs, msecs ? "." : "sec");
}
if (msecs)
- sprintf(buf+strlen(buf), "%03dms", msecs);
+ sprintf(buf+strlen(buf), "%03d%s", msecs, secs ? "sec" : "ms");
return buf;
}

View File

@ -1,38 +0,0 @@
From c0a06885b944e1f14440f601a0b5266233814d54 Mon Sep 17 00:00:00 2001
From: gaoxingwang <gaoxingwang1@huawei.com>
Date: Fri, 10 Feb 2023 16:45:31 +0800
Subject: [PATCH] testsuite: fix testsuite build failure when iproute build
without libcap-devel
iproute allows to build without libcap.The testsuite will fail to
compile when libcap dose not exists.It was required in 6d68d7f85d.
Fixes: 6d68d7f85d ("testsuite: fix build failure")
Signed-off-by: gaoxingwang <gaoxingwang1@huawei.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
testsuite/tools/Makefile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/testsuite/tools/Makefile b/testsuite/tools/Makefile
index e0162ccc..0356ddae 100644
--- a/testsuite/tools/Makefile
+++ b/testsuite/tools/Makefile
@@ -1,9 +1,13 @@
# SPDX-License-Identifier: GPL-2.0
CFLAGS=
+LDLIBS=
include ../../config.mk
+ifeq ($(HAVE_CAP),y)
+LDLIBS+= -lcap
+endif
generate_nlmsg: generate_nlmsg.c ../../lib/libnetlink.a ../../lib/libutil.a
- $(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -I../../include -I../../include/uapi -include../../include/uapi/linux/netlink.h -o $@ $^ -lmnl -lcap
+ $(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -I../../include -I../../include/uapi -include../../include/uapi/linux/netlink.h -o $@ $^ -lmnl $(LDLIBS)
clean:
rm -f generate_nlmsg
--
2.27.0

View File

@ -1,8 +1,8 @@
#needsrootforbuild
Name: iproute
Version: 6.4.0
Version: 6.6.0
Epoch: 1
Release: 1
Release: 5
Summary: Linux network configuration utilities
License: GPLv2+ and Public Domain
URL: https://kernel.org/pub/linux/utils/net/iproute2/
@ -11,6 +11,17 @@ Source0: https://mirrors.edge.kernel.org/pub/linux/utils/net/iproute2/iproute2-%
Patch1: bugfix-iproute2-3.10.0-fix-maddr-show.patch
Patch2: bugfix-iproute2-change-proc-to-ipnetnsproc-which-is-private.patch
patch6000: backport-rdma-Update-uapi-headers.patch
patch6001: backport-rdma-Add-support-to-dump-SRQ-resource-in-raw-format.patch
patch6002: backport-rdma-Fix-the-error-of-accessing-string-variable-outs.patch
patch6003: backport-exit-exec-in-child-process-if-setup-fails.patch
# https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=70ba338cd8314410380b8bdae9e5f302e8e98039
Patch6004: backport-ss-fix-expired-time-format-of-timer.patch
Patch6005: backport-route-filter-by-interface-on-multipath-routes.patch
Patch6006: backport-lib-names-check-calloc-return-value-in-db_names_alloc.patch
Patch6007: backport-fix-fd-leak-when-playing-with-netns.patch
Patch9000: feature-iproute-add-support-for-ipvlan-l2e-mode.patch
Patch9001: bugfix-iproute2-cancel-some-test-cases.patch
@ -56,7 +67,6 @@ if test -n "$(find . -name *.err)"; then
fi
%install
export CONFDIR='%{_sysconfdir}/iproute2'
export SBINDIR='%{_sbindir}'
export LIBDIR='%{_libdir}'
export DOCDIR='%{_docdir}'
@ -71,7 +81,7 @@ install -m 0644 lib/libnetlink.a %{buildroot}%{_libdir}/libnetlink.a
%defattr(-,root,root)
%license COPYING
%doc README
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/iproute2/*
%attr(644,root,root) %config(noreplace) %{_libdir}/iproute2/*
%{_sbindir}/*
%{_libdir}/tc/*
%{_datadir}/bash-completion/completions/*
@ -88,6 +98,39 @@ install -m 0644 lib/libnetlink.a %{buildroot}%{_libdir}/libnetlink.a
%{_mandir}/*
%changelog
* Thu Apr 17 2025 yanglu <yanglu72@h-partners.com> - 1:6.6.0-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix fd leak when playing with netns
* Thu Feb 13 2025 xinghe <xinghe2@h-partners.com> - 1:6.6.0-4
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:ss: fix expired time format of timer
route: filter by interface on multipath routes
lib: names: check calloc return value in db_names_alloc
remove redundant patches
* Wed May 22 2024 zhangyaqi <zhangyaqi@kylinos.cn> - 1:6.6.0-3
- Type:feature
- ID:NA
- SUG:NA
- DESC:Exit exec in child process if setup fails
* Mon Feb 26 2024 Ran Zhou <zhouran10@h-partners.com> - 1:6.6.0-2
- Type:feature
- ID:NA
- SUG:NA
- DESC:Add support to dump rdma SRQ resource in raw format
* Mon Feb 5 2024 liubo <liubo335@huawei.com> - 1:6.6.0-1
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:update to 6.6.0
* Thu Jul 20 2023 gaoxingwang <gaoxingwang1@huawei.com> - 1:6.4.0-1
- Type:bugfix
- ID:NA

Binary file not shown.

BIN
iproute2-6.6.0.tar.xz Normal file

Binary file not shown.