Thread View: linux.kernel.netdev
4 messages
4 total messages
Started by Dave Seddon
Sat, 28 Nov 2026 06:40
[PATCH iproute2 v2 0/2] ip xfrm: deleteall mark payload, and drop the cast
Author: Dave Seddon
Date: Sat, 28 Nov 2026 06:40
Date: Sat, 28 Nov 2026 06:40
19 lines
10966 bytes
10966 bytes
Stephen asked why RTA_DATA() is cast to (void *) in the deleteall mark fix. The cast predates the fix and is not needed, so patch 1 is the fix as posted and patch 2 removes the two casts. v2: add patch 2; drop the Assisted-by tag. Dave Seddon (2): ip xfrm: copy only the mark payload in deleteall ip xfrm: drop the cast of RTA_DATA() in deleteall ip/xfrm_policy.c | 2 +- ip/xfrm_state.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) base-commit: 35033e4713fef87ac204fe0fe574045563d1475d -- 2.56.0
[PATCH iproute2 v2 1/2] ip xfrm: copy only the mark payload in deleteall
Author: Dave Seddon
Date: Sat, 28 Nov 2026 06:40
Date: Sat, 28 Nov 2026 06:40
40 lines
12145 bytes
12145 bytes
Pass RTA_PAYLOAD() as the length when deleteall copies XFRMA_MARK. It
passes rta_len, which includes the attribute header, so each delete
request carries four extra bytes.
Fixes: 0c7d651b38d6 ("xfrm_{state, policy}: Allow to deleteall polices/states with marks")
Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
ip/xfrm_policy.c | 2 +-
ip/xfrm_state.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c
index 5261a292..1a41f2a9 100644
--- a/ip/xfrm_policy.c
+++ b/ip/xfrm_policy.c
@@ -783,7 +783,7 @@ static int xfrm_policy_keep(struct nlmsghdr *n, void *arg)
if (tb[XFRMA_MARK]) {
int r = addattr_l(new_n, xb->size, XFRMA_MARK,
- (void *)RTA_DATA(tb[XFRMA_MARK]), tb[XFRMA_MARK]->rta_len);
+ (void *)RTA_DATA(tb[XFRMA_MARK]), RTA_PAYLOAD(tb[XFRMA_MARK]));
if (r < 0) {
fprintf(stderr, "%s: XFRMA_MARK failed\n", __func__);
exit(1);
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index dcd08d59..7e365b19 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -1203,7 +1203,7 @@ static int xfrm_state_keep(struct nlmsghdr *n, void *arg)
if (tb[XFRMA_MARK]) {
int r = addattr_l(new_n, xb->size, XFRMA_MARK,
- (void *)RTA_DATA(tb[XFRMA_MARK]), tb[XFRMA_MARK]->rta_len);
+ (void *)RTA_DATA(tb[XFRMA_MARK]), RTA_PAYLOAD(tb[XFRMA_MARK]));
if (r < 0) {
fprintf(stderr, "%s: XFRMA_MARK failed\n", __func__);
exit(1);
--
2.56.0
[PATCH iproute2 v2 2/2] ip xfrm: drop the cast of RTA_DATA() in deleteall
Author: Dave Seddon
Date: Sat, 28 Nov 2026 06:40
Date: Sat, 28 Nov 2026 06:40
38 lines
12023 bytes
12023 bytes
Remove the (void *) cast on RTA_DATA() in the two deleteall callers.
RTA_DATA() already yields a void pointer. No functional change.
Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
ip/xfrm_policy.c | 2 +-
ip/xfrm_state.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c
index 1a41f2a9..a673cbb2 100644
--- a/ip/xfrm_policy.c
+++ b/ip/xfrm_policy.c
@@ -783,7 +783,7 @@ static int xfrm_policy_keep(struct nlmsghdr *n, void *arg)
if (tb[XFRMA_MARK]) {
int r = addattr_l(new_n, xb->size, XFRMA_MARK,
- (void *)RTA_DATA(tb[XFRMA_MARK]), RTA_PAYLOAD(tb[XFRMA_MARK]));
+ RTA_DATA(tb[XFRMA_MARK]), RTA_PAYLOAD(tb[XFRMA_MARK]));
if (r < 0) {
fprintf(stderr, "%s: XFRMA_MARK failed\n", __func__);
exit(1);
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index 7e365b19..a2e0ed08 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -1203,7 +1203,7 @@ static int xfrm_state_keep(struct nlmsghdr *n, void *arg)
if (tb[XFRMA_MARK]) {
int r = addattr_l(new_n, xb->size, XFRMA_MARK,
- (void *)RTA_DATA(tb[XFRMA_MARK]), RTA_PAYLOAD(tb[XFRMA_MARK]));
+ RTA_DATA(tb[XFRMA_MARK]), RTA_PAYLOAD(tb[XFRMA_MARK]));
if (r < 0) {
fprintf(stderr, "%s: XFRMA_MARK failed\n", __func__);
exit(1);
--
2.56.0
Re: [PATCH iproute2 v2 2/2] ip xfrm: drop the cast of RTA_DATA() in deleteall
Author: Stephen Hemminger
Date: Sat, 28 Nov 2026 18:16
Date: Sat, 28 Nov 2026 18:16
11 lines
11326 bytes
11326 bytes
On Fri, 27 Nov 2026 22:40:08 -0800 Dave Seddon <dave.seddon.ca@gmail.com> wrote: > Remove the (void *) cast on RTA_DATA() in the two deleteall callers. > RTA_DATA() already yields a void pointer. No functional change. > > Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com> > --- There were a couple of other places in iproute2 so widened it to address those.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads