mfontanini / libtins

High-level, multiplatform C++ network packet sniffing and crafting library.
http://libtins.github.io/
BSD 2-Clause "Simplified" License
1.91k stars 377 forks source link

fix incorrect IP address range calculation when using /0 prefix (#484) #486

Closed mbcdev closed 2 years ago

mbcdev commented 2 years ago

According to the C/C++ Standard, for shift operations, the behavior is undefined if the right operand is equal to the width of the promoted left operand. On a 64-bit Windows machine, this causes IP addresses 0.0.0.0 and 255.255.255.255 to have the same internal representation, leading to various issues when using a /0 prefix.

rectified95 commented 2 years ago

@mbcdev Sorry about this totally unrelated question but there seems to be very little traffic on this repo otherwise - I assume you're able to use libtins in an app. I'm getting an error about missing wpcap.dll (like this one: https://github.com/mfontanini/libtins/issues/380) and wonder how to mitigate it. Did you encounter this issue during development?

mfontanini commented 2 years ago

Thanks for the fix! @rectified95 there's not much traffic but this library is working fine and you can use it in applications. There's some companies using it in their products :)