Open arctic-alpaca opened 1 month ago
Hey,
if the EtherType or the IP protocol number don't match any of the defined discriminants in their respective enums, the behavior is undefined.
According to https://doc.rust-lang.org/reference/behavior-considered-undefined.html, producing an a discriminant in an enum not included in the type definition is undefined.
a discriminant in an enum not included in the type definition
This could be fixed by replacing the enum with the corresponding integer and adding a TryFrom to the enum implementation.
TryFrom
The replacement of IpProto and EtherType with their discriminats in structs would also allow to use zerocopy to actually make the crate safe to use
IpProto
EtherType
Hey,
if the EtherType or the IP protocol number don't match any of the defined discriminants in their respective enums, the behavior is undefined.
According to https://doc.rust-lang.org/reference/behavior-considered-undefined.html, producing an
a discriminant in an enum not included in the type definition
is undefined.This could be fixed by replacing the enum with the corresponding integer and adding a
TryFrom
to the enum implementation.