patch 'net/ark: use standard IPv4 address parser' has been queued to stable release 24.11.7
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Thu Jun 11 15:20:26 CEST 2026
Hi,
FYI, your patch has been queued to stable release 24.11.7
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/13/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable
This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/e446a33bf98ab404c6a6a9ca30dc19de24d16733
Thanks.
Luca Boccassi
---
>From e446a33bf98ab404c6a6a9ca30dc19de24d16733 Mon Sep 17 00:00:00 2001
From: Denis Sergeev <denserg.edu at gmail.com>
Date: Mon, 8 Jun 2026 07:41:11 +0300
Subject: [PATCH] net/ark: use standard IPv4 address parser
[ upstream commit fd4f604e174f95d7ab71957f6460ced6021cae00 ]
The IPv4 parsing helper used by pktgen and pktchkr read each octet with
"%u", which accepts values above 255 from the configuration file and
encodes them into unintended device register values.
Replace the hand-rolled parser in both modules with inet_pton(), which
validates the dotted-quad format and the octet range, and matches the
IPv4 parsing already used by other DPDK drivers. For valid input the
returned value is byte-order identical to the previous helper, so the
register contents are unchanged.
Fixes: 9c7188a68d7b ("net/ark: provide API for hardware modules pktchkr and pktgen")
Signed-off-by: Denis Sergeev <denserg.edu at gmail.com>
---
drivers/net/ark/ark_pktchkr.c | 10 ++++++----
drivers/net/ark/ark_pktgen.c | 10 ++++++----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c
index e1f336c73c..e1a2943957 100644
--- a/drivers/net/ark/ark_pktchkr.c
+++ b/drivers/net/ark/ark_pktchkr.c
@@ -4,9 +4,12 @@
#include <stdlib.h>
#include <unistd.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
#include <rte_string_fns.h>
#include <rte_malloc.h>
+#include <rte_byteorder.h>
#include "ark_pktchkr.h"
#include "ark_logs.h"
@@ -374,12 +377,11 @@ static int32_t parse_ipv4_string(char const *ip_address);
static int32_t
parse_ipv4_string(char const *ip_address)
{
- unsigned int ip[4];
+ struct in_addr addr;
- if (sscanf(ip_address, "%u.%u.%u.%u",
- &ip[0], &ip[1], &ip[2], &ip[3]) != 4)
+ if (inet_pton(AF_INET, ip_address, &addr) != 1)
return 0;
- return ip[3] + ip[2] * 0x100 + ip[1] * 0x10000ul + ip[0] * 0x1000000ul;
+ return rte_be_to_cpu_32(addr.s_addr);
}
void
diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
index 69ff7072b2..17ac33fce6 100644
--- a/drivers/net/ark/ark_pktgen.c
+++ b/drivers/net/ark/ark_pktgen.c
@@ -4,9 +4,12 @@
#include <stdlib.h>
#include <unistd.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
#include <rte_string_fns.h>
#include <rte_malloc.h>
+#include <rte_byteorder.h>
#include <rte_thread.h>
#include "ark_pktgen.h"
@@ -355,12 +358,11 @@ static int32_t parse_ipv4_string(char const *ip_address);
static int32_t
parse_ipv4_string(char const *ip_address)
{
- unsigned int ip[4];
+ struct in_addr addr;
- if (sscanf(ip_address, "%u.%u.%u.%u",
- &ip[0], &ip[1], &ip[2], &ip[3]) != 4)
+ if (inet_pton(AF_INET, ip_address, &addr) != 1)
return 0;
- return ip[3] + ip[2] * 0x100 + ip[1] * 0x10000ul + ip[0] * 0x1000000ul;
+ return rte_be_to_cpu_32(addr.s_addr);
}
static void
--
2.47.3
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-06-11 14:20:04.372154280 +0100
+++ 0077-net-ark-use-standard-IPv4-address-parser.patch 2026-06-11 14:20:01.310748315 +0100
@@ -1 +1 @@
-From fd4f604e174f95d7ab71957f6460ced6021cae00 Mon Sep 17 00:00:00 2001
+From e446a33bf98ab404c6a6a9ca30dc19de24d16733 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit fd4f604e174f95d7ab71957f6460ced6021cae00 ]
+
@@ -17 +18,0 @@
-Cc: stable at dpdk.org
More information about the stable
mailing list