ironcore-dev / dpservice

DPDK based fast Dataplane / L3 router / SDN enabler, installable on compute nodes / SmartNICs
Apache License 2.0
7 stars 1 forks source link

Dual IP address structure safety #525

Closed PlagueCZ closed 6 months ago

PlagueCZ commented 6 months ago

Since the introduction of IPv6 overlay, there is a structure to hold either IPv4 or IPv6. This currently is not always set properly to the right type and even when it is, it's really easy to forget to in the future.

It would be best to have some wrappers to enforce proper type to be set when setting the value.

There is also a problem with the fact that it is being stored as a union which can be initialized improperly.

And IPv6 data is stored as a plain uint8_t array, so proper overflow checks against the size of this array are not always easy to do.