Skip to content

Commit

Permalink
Merge branch 'master' into flowtime
Browse files Browse the repository at this point in the history
  • Loading branch information
lspgn authored May 1, 2019
2 parents 91411f0 + 959ed13 commit ec20c3b
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 49 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ The format is the following:
| IPv6FlowLabel | IPv6 Flow Label |
| TimeFlowStart | Start Timestamp of the flow (this field is empty for sFlow, in NetFlow it's the uptime of the router minus FIRST_SWITCHED field, in IPFIX it's flowStart* field) |
| TimeFlowEnd | End Timestamp of the flow (same as TimeRecvd in sFlow, in NetFlow it's the uptime of the router minus LAST_SWITCHED field, in IPFIX it's flowEnd* field) |
| IngressVrfId | Ingress VRF ID |
| EgressVrfId | Egress VRF ID |

### Implementation notes

Expand Down
4 changes: 3 additions & 1 deletion decoders/netflow/nfv9.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func NFv9TypeToString(typeId uint16) string {
84: "SAMPLER_NAME",
85: "IN_ PERMANENT _BYTES",
86: "IN_ PERMANENT _PKTS",
87: "* Vendor Proprietary*",
87: "*Vendor Proprietary*",
88: "FRAGMENT_OFFSET",
89: "FORWARDING STATUS",
90: "MPLS PAL RD",
Expand All @@ -229,6 +229,8 @@ func NFv9TypeToString(typeId uint16) string {
102: "layer2packetSectionOffset",
103: "layer2packetSectionSize",
104: "layer2packetSectionData",
234: "ingressVRFID",
235: "egressVRFID",
}

if typeId > 104 || typeId == 0 {
Expand Down
106 changes: 62 additions & 44 deletions pb/flow.pb.go

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

4 changes: 4 additions & 0 deletions pb/flow.proto
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ message FlowMessage {

uint32 IPv6FlowLabel = 37;

// VRF
uint32 IngressVrfId = 38;
uint32 EgressVrfId = 39;

// time information, found inside packets
uint64 TimeFlowStart = 40;
uint64 TimeFlowEnd = 41;
Expand Down
13 changes: 9 additions & 4 deletions producer/producer_nf.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ func ConvertNetFlowDataSet(version uint16, baseTime uint32, uptime uint32, recor
case netflow.NFV9_FIELD_ICMP_TYPE:
var icmpTypeCode uint16
DecodeUNumber(v, &icmpTypeCode)
flowMessage.IcmpType = uint32(icmpTypeCode>>8)
flowMessage.IcmpCode = uint32(icmpTypeCode&0xff)
flowMessage.IcmpType = uint32(icmpTypeCode >> 8)
flowMessage.IcmpCode = uint32(icmpTypeCode & 0xff)
case netflow.IPFIX_FIELD_icmpTypeCodeIPv6:
var icmpTypeCode uint16
DecodeUNumber(v, &icmpTypeCode)
flowMessage.IcmpType = uint32(icmpTypeCode>>8)
flowMessage.IcmpCode = uint32(icmpTypeCode&0xff)
flowMessage.IcmpType = uint32(icmpTypeCode >> 8)
flowMessage.IcmpCode = uint32(icmpTypeCode & 0xff)
case netflow.IPFIX_FIELD_icmpTypeIPv4:
DecodeUNumber(v, &(flowMessage.IcmpType))
case netflow.IPFIX_FIELD_icmpTypeIPv6:
Expand All @@ -259,6 +259,11 @@ func ConvertNetFlowDataSet(version uint16, baseTime uint32, uptime uint32, recor
case netflow.NFV9_FIELD_DST_VLAN:
DecodeUNumber(v, &(flowMessage.DstVlan))

case netflow.IPFIX_FIELD_ingressVRFID:
DecodeUNumber(v, &(flowMessage.IngressVrfId))
case netflow.IPFIX_FIELD_egressVRFID:
DecodeUNumber(v, &(flowMessage.EgressVrfId))

case netflow.NFV9_FIELD_IPV4_IDENT:
DecodeUNumber(v, &(flowMessage.FragmentId))
case netflow.NFV9_FIELD_FRAGMENT_OFFSET:
Expand Down

0 comments on commit ec20c3b

Please sign in to comment.