Closed sapslaj closed 7 months ago
Sounds good, even if Debian's /etc/ethertypes
is a little bit thin. API looks good to me, it follows and should follow the pattern this module uses for protocols and services. I've checked with the upstream Debian repo to make sure it contains an ethertypes to auto-generate the builtin data from.
Interestingly Debian's /etc/ethertypes
is more comprehensive than what ships with Arch Linux, at least based on what my machine has. Either way, it's pretty easy for someone to add in more entries to the index if needed so it's probably fine.
~I got a WIP branch that implements this that I can share in just a bit.~
WIP branch here: https://github.com/sapslaj/netdb/tree/ethertypes-support
I'll make a proper PR once I get through some TODOs
Ah, a PR sounds really great!
(I'm a little bit disappointed that Debian doesn't include the Profinet Ethertypes 😀)
Oh man does Profinet have its own EtherType? I've only ever dealt with EtherNet/IP and IIRC it uses regular TCP and UDP over IP (it's been a few years though so could be wrong...)
released as v1.1.0; thank you very much!
I'm working on replacing an ad-hoc implementation of protocol and service lookups in one of my projects, a NetFlow collection and metadata enrichment agent with this library. It was pretty simple to slot this library in place for protocols and services, but my project also supports adding some metadata about the Ethernet protocol type of the flow. Adding support for /etc/ethertypes to this project would be really helpful and I'd be able to get rid of the hard-coded mappings.
Some ideas for the API:
Not totally sure if the comment parsing is really necessary, but it does contain some useful info sometimes.