dhcp pkt getIndex() and setIndex() should use int64_t instead of uint32_t type for ifindex
Describe the bug https://github.com/isc-projects/kea/commit/2a453ec2f66ea4681283df5a4d9e99410a974507 modified ifindex_ to int64_t from an earlier int type and introduced methods: resetIndex() which sets ifindex_ to -1 and indexSet() which checks if ifindex_ is greater than equal to 0
However, the getIndex() and setIndex() methods still work with a uint32_t ifindex and this causes ifindex to be truncated for the users of these 2 methods.
So, if a resetIndex() is followed either by getIndex() OR setIndex()[for example - copying of pkt], indexSet() invocation on the same pkt will return true.
To Reproduce Steps to reproduce the behavior:
- Run Kea dhcpv4
- Install a pkt4_receive() kea dhcp library hook which does a query4/pkt->resetIndex()
- IfaceMgr::getIface(const PktPtr& pkt) will return an invalid interface.
Expected behavior If a resetIndex() is followed either by getIndex() OR setIndex()[for example - copying of pkt], indexSet() invocation on the same pkt should return false.
Environment:
- Kea version: 1.8.2
- OS: Ubuntu 16.04 x64
- Which features were compiled in (in particular which backends): Stock features enabled in the Makefile.
- If/which hooks where loaded in: libdhcp_ha.so, libdhcp_lease_cmds.so, libdhcp_stat_cmds.so and a custom hook to reproduce the issue by installing a pkt4_receive() kea dhcp library hook which does a query4/pkt->resetIndex()
Additional Information
Contacting you bglsriram@gmail.com