Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

producer: support custom mapping of ipip #235

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion producer/proto/producer_sf.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func ParseEthernetHeader(flowMessage *ProtoProducerMessage, data []byte, config
var appOffset int // keeps track of the user payload

// Transport protocols
if nextHeader == 17 || nextHeader == 6 || nextHeader == 1 || nextHeader == 58 {
if nextHeader == 17 || nextHeader == 6 || nextHeader == 1 || nextHeader == 58 || nextHeader == 4 {
prevOffset := offset
if flowMessage.FragmentOffset == 0 {
if nextHeader == 17 { // UDP
Expand Down Expand Up @@ -351,6 +351,13 @@ func ParseEthernetHeader(flowMessage *ProtoProducerMessage, data []byte, config
return err
}
}
} else if nextHeader == 4 { // IPIP
for _, configLayer := range GetSFlowConfigLayer(config, "ipip") {
extracted := GetBytes(data, prevOffset*8+configLayer.Offset, configLayer.Length)
if err := MapCustom(flowMessage, extracted, configLayer.MapConfigBase); err != nil {
return err
}
}
}
}
appOffset = offset
Expand Down
Loading