2 ms·
Very interesting tutorial, more people should know about using tun/tap for directly accessing ethernet/ip frames. However, please note that this is not product
by jnbiche 11y ago
Very interesting tutorial, more people should know about using tun/tap for directly accessing ethernet/ip frames.
However, please note that this is not production-capable code. Casting directly a struct directly into the data as a way to "parse" is easy and convenient, but ignores issues like endianness, alignment, etc. By all means, use a struct, but for production code, pick off the bits bit-by-by or word-by-word using appropriate bit operators and assign them to the struct members. Also, someone already mentioned the `char` issue with certain architectures. I'm sure I'm missing some other issues, since writing safe, portable C code isn't always obvious.
I look forward to reading the next part of these series.