Use ether_gen_addr for mac generation
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
@jrtc27 is there any issue to CHERI with the ether_addr cast like this? It is __packed.
No, that should be fine, the only time packed causes issues is when it's on structs that contain pointers (including intptr_t). I don't know why ether_addr is packed though, it just contains a byte array, packed is redundant.
sys/dev/e1000/if_em.c | ||
---|---|---|
1080 | I think this type punning is OK and well defined. The ether_addr structure is just an array of 6 bytes for the array, and hw->mac.addr provides 6 bytes of storage. __packed on the ether_addr structure should keep this well defined. |
I think it may date from the pre-EABI days of ARM where it did really weird things with structure padding. I suspect it can be dropped, but conservatism and the fact there will be little gain from dropping it has kept people from doing so...