Fix for invalid check of SPARSE_VEC_INVALID_INDEX 99/2599/2
authorAlex Popovsky <apopovsk@cisco.com>
Fri, 2 Sep 2016 03:57:45 +0000 (20:57 -0700)
committerJohn Lo <loj@cisco.com>
Fri, 2 Sep 2016 10:46:15 +0000 (10:46 +0000)
commit52901246e02c3d648c25a089c3dce5b6b4fb3112
treea9a121a0a5a62f0bac73991c884ee4741c62a346
parentee4743adf5019ccc800257991492aec75d2f3e44
Fix for invalid check of SPARSE_VEC_INVALID_INDEX

When looking up a UDP port / GRE protocol in the sparse vectors
next_by_dst_port / next_by_protocol a data from the vector was
tested for SPARSE_VEC_INVALID_INDEX instead of sparse index itself.

This doesn’t matter for most cases since V[0] = 0 is true for all
sparse vectors. This however could cause an issue when a valid
sparse entry e.g. V[1234] = 0, with data (0) mistakenly passing
the test for SPARSE_VEC_INVALID_INDEX, while the index itself (1234)
is a valid index.

Change-Id: I04818cc43efeae047a4dae79078157d48b8c359c
Signed-off-by: Alex Popovsky <apopovsk@cisco.com>
vnet/vnet/gre/node.c
vnet/vnet/ip/udp_local.c