dotpcap / packetnet

Official repository - High performance .Net assembly for dissecting and constructing network packets such as ethernet, ip, tcp, udp etc.
Mozilla Public License 2.0
482 stars 104 forks source link

Improvement: Avoid invalid enum conversion of GRE custom protocols #191

Closed Aegle1 closed 2 years ago

Aegle1 commented 2 years ago

Provide non-enum accessor for GRE custom protocols

Aegle1 commented 2 years ago

For non-standard protocol IDs, (ushort)((EthernetType)Protocol) doesn't make sense. Therefore this PR.

PhyxionNL commented 2 years ago

I disagree, missing protocols should be added to EtherType. GRE's RFC also cleary states this:

The Protocol Type field contains the protocol type of the payload packet. These Protocol Types are defined in [RFC1700] as "ETHER TYPES" and in [ETYPES]. An implementation receiving a packet containing a Protocol Type which is not listed in [RFC1700] or [ETYPES] SHOULD discard the packet.