Tommaso Pecorella (c5a591eb) at 20 Mar 00:29
internet: fix off-by-one in Icmpv4DestinationUnreachable and Icmpv4...
Tommaso Pecorella (c5a591eb) at 20 Mar 00:19
internet: fix off-by-one in Icmpv4DestinationUnreachable and Icmpv4...
While reviewing the ICMPv4 header formatting code, I noticed a small off-by-one condition in the Print() methods.
In both Icmpv4DestinationUnreachable::Print() and Icmpv4TimeExceeded::Print(), the code prints the 8 data bytes contained in the header using a loop (i = 0..7). The previous condition checked i != 8 before printing a separator space, which is always true for this loop and results in an extra trailing space after the last byte.
The condition is corrected to i != 7, ensuring spaces are printed only between bytes and not after the final element.
This change only affects debug / textual output formatting and does not alter packet semantics or simulation behavior.
@das.manmita12 would it be possible to add a test for this behavior?
Tommaso Pecorella (e84081c2) at 19 Mar 22:29
sixlowpan: Fix missing stdlib includes for Windows compatibility
... and 1 more commit
Tommaso Pecorella (c5a591eb) at 19 Mar 22:28
internet: fix off-by-one in Icmpv4DestinationUnreachable and Icmpv4...
... and 2 more commits
Tommaso Pecorella (e84081c2) at 19 Mar 22:26
sixlowpan: Fix missing stdlib includes for Windows compatibility
Add explicit <algorithm>, <ios>, <list>, <map>, <unordered_map>, <utility>, and <vector> includes to sixlowpan-nd headers and sources. GCC/Clang pull these in transitively; MSVC does not.
Tommaso Pecorella (e84081c2) at 19 Mar 22:26
sixlowpan: Fix missing stdlib includes for Windows compatibility
... and 1 more commit
Tommaso Pecorella (2ea1a3c1) at 19 Mar 22:25
internet: Make Icmpv6L4Protocol::PROT_NUMBER constexpr for Windows ...
static const data members are not auto-exported by CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS, causing linker failures when referenced across DLL boundaries. constexpr makes the value inline in the header, eliminating the cross-DLL symbol reference entirely.
Tommaso Pecorella (1ae527b3) at 19 Mar 04:22
sixlowpan: Add 6LoWPAN-ND GSoC implementation
... and 1 more commit
Tommaso Pecorella (15b9c0ab) at 18 Mar 19:32
internet: fix off-by-one in Icmpv4DestinationUnreachable and Icmpv4...
... and 6 more commits
Tommaso Pecorella (bfaa28b9) at 17 Mar 22:37
wifi: (fixes #1318) Replace interference-helper std::find with std:...
... and 3 more commits
grep -r " M_" src
It seems that we use:
M_1_PI (std::numbers::inv_pi)M_PI, M_PI_2 and M_PI_4 (std::numbers::pi with eventual divisions, it's constexpr)M_SQRT2 (std::numbers::sqrt2)Just a couple of suggestions:
pi or PI when it's used only once - e.g. in src/uan/examples/uan-rc-example.cc. In this case I'd find acceptable to just use std::numbers::pi.M_SQRT2 with std::numbers::sqrt2 and (possibly) other symbols. See for example https://en.cppreference.com/w/cpp/numeric/constants.html
While reviewing the ICMPv4 header formatting code, I noticed a small off-by-one condition in the Print() methods.
In both Icmpv4DestinationUnreachable::Print() and Icmpv4TimeExceeded::Print(), the code prints the 8 data bytes contained in the header using a loop (i = 0..7). The previous condition checked i != 8 before printing a separator space, which is always true for this loop and results in an extra trailing space after the last byte.
The condition is corrected to i != 7, ensuring spaces are printed only between bytes and not after the final element.
This change only affects debug / textual output formatting and does not alter packet semantics or simulation behavior.
It would be useful to have an example of the output before and after the patch.