app/testpmd: fix port id check in Tx VLAN command
authorChengchang Tang <tangchengchang@huawei.com>
Fri, 25 Sep 2020 12:47:14 +0000 (20:47 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 30 Sep 2020 17:19:13 +0000 (19:19 +0200)
commitb428e71775e43acc7b074c82b0d9e08f401dde6b
tree6196459fc6f3d1819b3b179e7d37a5f20c592a52
parentea42cae43de6ea83972ee18b7ced8d8c2b3b9299
app/testpmd: fix port id check in Tx VLAN command

To set Tx vlan offloads, it is required to stop port firstly. But before
checking whether the port is stopped, the port id entered by the user
is not checked for validity. When the port id is illegal, it would lead
to a segmentation fault since it attempts to access a member of
non-existent port.

This patch adds verification of port id in tx vlan offloads and remove
duplicated check.

Fixes: 597f9fafe13b ("app/testpmd: convert to new Tx offloads API")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
app/test-pmd/cmdline.c
app/test-pmd/config.c