app/testpmd: fix hexadecimal parser with odd length
authorGregory Etelson <getelson@nvidia.com>
Wed, 24 Nov 2021 12:33:54 +0000 (14:33 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 24 Nov 2021 16:34:38 +0000 (17:34 +0100)
commitea1da434c0a876b1913b9f0758abd1b6e70a19fd
tree067a48a1055250b5bfb7f666ba0044e1e2992c35
parent3f7b90eb80b1c6fc63c70f77e27ddbd2599e592e
app/testpmd: fix hexadecimal parser with odd length

Current hex string parser assumes input has even characters number.
The parser fails input string with odd length.

The patch parses hex strings with even and odd length.
Parse result of an input with odd length will match result of
even length input, that has `0` as MSB, following by the original
sequence.
For example:
"0x1" results in *dst={0x01, 0x00}, *size=1
"0xabc" results in *dst={0x0a, 0xbc, 0x00}, *size=2

Fixes: 169a9fed1f4c ("app/testpmd: fix hex string parser support for flow API")
Cc: stable@dpdk.org
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
app/test-pmd/cmdline_flow.c