Skip to content

Commit

Permalink
rename ipv6eh, layer-size
Browse files Browse the repository at this point in the history
  • Loading branch information
lspgn committed Aug 5, 2024
1 parent 4520ac5 commit 9eaf510
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 42 deletions.
72 changes: 41 additions & 31 deletions pb/flow.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pb/flow.proto
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ message FlowMessage {
// todo: add nsh
}
repeated LayerStack layer_stack = 103;
repeated uint32 layer_size = 104;

repeated bytes ipv6_routing_header_addresses = 104; // SRv6
uint32 ipv6_routing_header_seg_left = 105; // SRv6
repeated bytes ipv6_routing_header_addresses = 105; // SRv6
uint32 ipv6_routing_header_seg_left = 106; // SRv6

}
15 changes: 8 additions & 7 deletions producer/proto/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,14 @@ func mapFormat(cfg *ProducerConfig) (*FormatterConfigMapper, error) {
formatterMapped.render = make(map[string]RenderFunc)
formatterMapped.rename = make(map[string]string)
formatterMapped.isSlice = map[string]bool{
"BgpCommunities": true,
"AsPath": true,
"MplsIp": true,
"MplsLabel": true,
"MplsTtl": true,
"LayerStack": true,
"Ipv6RoutingHeaderAddresses": true,
"BgpCommunities": true,
"AsPath": true,
"MplsIp": true,
"MplsLabel": true,
"MplsTtl": true,
"LayerStack": true,
"LayerSize": true,
"Ipv6RoutingHeaderAddresses": true,
} // todo: improve this with defaults
for k, v := range defaultRenderers {
formatterMapped.render[k] = v
Expand Down
7 changes: 5 additions & 2 deletions producer/proto/producer_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ var (
}
parserIPv6HeaderRouting = ParserInfo{
nil, //ParseIPv6HeaderRouting2,
[]string{"ipv6he_routing", "ipv6he"},
[]string{"ipv6eh_routing", "ipv6eh"},
35,
7,
false,
}
parserIPv6HeaderFragment = ParserInfo{
nil, //ParseIPv6HeaderFragment2,
[]string{"ipv6he_fragment", "ipv6he"},
[]string{"ipv6eh_fragment", "ipv6eh"},
35,
6,
true,
Expand Down Expand Up @@ -259,6 +259,9 @@ func ParsePacket(flowMessage ProtoProducerMessageIf, data []byte, config PacketM
}
}

fm := flowMessage.GetFlowMessage()
fm.LayerSize = append(fm.LayerSize, uint32(res.Size))

// compares the next layer index with current to determine if it's an encapsulation
// IP over IP is the equals case
// except if layer is skipping comparison (will be compared after). For instance IPv6 Fragment Header, dot1q and MPLS cannot trigger encap
Expand Down

0 comments on commit 9eaf510

Please sign in to comment.