feat: support to parse enip and cip protocols for industrial automation#137
Merged
mosajjal merged 4 commits intogopacket:masterfrom Nov 2, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for industrial automation protocols CIP (Common Industrial Protocol) and ENIP (Ethernet/IP) by porting implementations from google/gopacket PR #758. The changes enable packet capture and analysis of industrial control system communications commonly used in manufacturing and automation environments.
Key Changes:
- Implementation of CIP and ENIP protocol layers with full decoding support
- Registration of new layer types and port mappings for automatic protocol detection
- Addition of EthernetTypeRaw constant for special IP handling
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| layers/enip.go | New ENIP protocol decoder with command/status handling and CIP payload support |
| layers/cip.go | New CIP protocol decoder with service codes, path segment parsing, and request/response differentiation |
| layers/layertypes.go | Registration of LayerTypeENIP (151) and LayerTypeCIP (152) |
| layers/ports.go | TCP/UDP port mappings for ports 2222 and 44818 to ENIP layer |
| layers/enums.go | Addition of EthernetTypeERSPAN and EthernetTypeRaw constants |
| INDUSTRIAL_PROTOCOLS_PATCH.md | Documentation of protocol implementations and specifications |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Patch Set Summary: Industrial Protocol Support (CIP, Ethernet/IP)
Overview
This patch set ports the changes from google/gopacket PR #758 to add support for industrial automation protocols: CIP (Common Industrial Protocol), and ENIP (Ethernet/IP).
New Protocol Implementations
1. CIP (Common Industrial Protocol)
File:
layers/cip.go2. ENIP (Ethernet/IP)
File:
layers/enip.goModified Files
Core Layer Registration
layers/layertypes.goLayerTypeENIP(ID: 151)LayerTypeCIP(ID: 152)layers/ports.goAdded port mappings for automatic protocol detection:
TCP Ports:
LayerTypeENIP(EtherNet/IP-1)LayerTypeENIP(EtherNet/IP-2)UDP Ports:
LayerTypeENIP(EtherNet/IP-1)LayerTypeENIP(EtherNet/IP-2)layers/enums.goerrorsimportEthernetTypeERSPANconstant (0x88be)EthernetTypeRawconstant (0xFFFF)Protocol Specifications
Port Numbers
Layer Hierarchy
Credits
References