From 663466daa70ec74f6be3704c493481b0a0f55e47 Mon Sep 17 00:00:00 2001 From: ywc689 Date: Thu, 19 Sep 2024 17:33:26 +0800 Subject: [PATCH 1/2] scripts: fix param setting problem in dpdk-build.sh Signed-off-by: ywc689 --- scripts/dpdk-build.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/dpdk-build.sh b/scripts/dpdk-build.sh index 3e2d1a4b..600a263d 100755 --- a/scripts/dpdk-build.sh +++ b/scripts/dpdk-build.sh @@ -9,9 +9,8 @@ dpdkver=20.11.10 # default dpdk version (use stable v tarball=dpdk-${dpdkver}.tar.xz srcdir=dpdk-stable-$dpdkver -workdir=$(pwd)/dpdk # default work directory -patchdir=$(pwd)/patch/dpdk-stable-$dpdkver # default dpdk patch directory - +workdir="" +patchdir="" function help() { @@ -23,6 +22,13 @@ function help() echo -e "\033[31m -p specify the dpdk patch directory, default $(pwd)/patch/dpdk-stable-$dpdkver\033[0m" } +function set_dpdk_version() +{ + dpdkver=$1 + tarball=dpdk-${dpdkver}.tar.xz + srcdir=dpdk-stable-$dpdkver +} + function set_work_directory() { [ ! -d $1 ] && return 1 @@ -38,7 +44,7 @@ function set_patch_directory() ## parse args while getopts "hw:p:dv:" OPT; do case $OPT in - v) dpdkver=$OPTARG;; + v) set_dpdk_version $OPTARG;; w) set_work_directory $OPTARG ;; p) set_patch_directory $OPTARG;; d) build_options="${build_options} ${debug_options}";; @@ -46,6 +52,9 @@ while getopts "hw:p:dv:" OPT; do esac done +[ -z "$workdir" ] && workdir=$(pwd)/dpdk # use default work directory +[ -z "$patchdir" ] && patchdir=$(pwd)/patch/dpdk-stable-$dpdkver # use default dpdk patch directory + [ ! -d $workdir ] && mkdir $workdir echo -e "\033[32mwork directory: $workdir\033[0m" From 69101a3bd6bac62c323b67a0577688fc2202cdbc Mon Sep 17 00:00:00 2001 From: ywc689 Date: Thu, 19 Sep 2024 17:35:30 +0800 Subject: [PATCH 2/2] netif: fix memory corruption problem when retrieving nic's xstats Signed-off-by: ywc689 --- src/VERSION | 3 ++- src/netif.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/VERSION b/src/VERSION index 2aba272e..f97d35bb 100755 --- a/src/VERSION +++ b/src/VERSION @@ -1,6 +1,6 @@ #!/bin/sh # program: dpvs -# Sep 13, 2024 # +# Sep 19, 2024 # ## # Features # - dpvs: Support QUIC/HTTP3, add nginx patches and facilitating code snippets for use of quic. @@ -22,6 +22,7 @@ # - dpvs: Fix segmentation fault problem when running on machines whose cpu number is over DPVS_MAX_LCORE. # - dpvs: Refactor netif_rte_port_alloc with netif_alloc. # - dpvs: Fix prolems in IPv6 all-nodes and all-routers address initialization. +# - dpvs: Fix memory corruption problem when retrieving nic's xstats. # - tools: Fix concurrency racing problem when dpvs-agent and healthcheck changing rs simultaneously. # - tools: Fix healthchech bad icmp checksum problem ocasionally appeared in udp and udpping checkers. # - tools: Fix keepalived quorum up script not excuted problem when old rs removed and new ones added in a reload. diff --git a/src/netif.c b/src/netif.c index 5d8fe0b3..0a071a1d 100644 --- a/src/netif.c +++ b/src/netif.c @@ -3371,7 +3371,7 @@ static int netif_op_get_xstats(struct netif_port *dev, netif_nic_xstats_get_t ** if (nentries < 0) return EDPVS_DPDKAPIFAIL; - get = rte_calloc("xstats_get", 1, nentries * sizeof(struct netif_nic_xstats_entry), 0); + get = rte_calloc("xstats_get", 1, sizeof(*get) + nentries * sizeof(struct netif_nic_xstats_entry), 0); if (unlikely(!get)) return EDPVS_NOMEM; xstats = rte_calloc("xstats", 1, nentries * sizeof(struct rte_eth_xstat), 0);