Skip to content

Commit

Permalink
Fix SrcAS/DstAS for sFlow (cloudflare#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentbernat authored Oct 8, 2022
1 parent f2a5297 commit 57fad2e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions producer/producer_sf.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,19 @@ func SearchSFlowSamplesConfig(samples []interface{}, config *SFlowMapper) []*flo
case sflow.ExtendedGateway:
ipNh = recordData.NextHop
flowMessage.BgpNextHop = ipNh
flowMessage.SrcAS = recordData.SrcAS
flowMessage.BgpCommunities = recordData.Communities
flowMessage.AsPath = recordData.ASPath
if len(recordData.ASPath) > 0 {
flowMessage.DstAS = recordData.ASPath[len(recordData.ASPath)-1]
flowMessage.NextHopAS = recordData.ASPath[0]
flowMessage.SrcAS = recordData.AS
} else {
flowMessage.DstAS = recordData.AS
}
if recordData.SrcAS > 0 {
flowMessage.SrcAS = recordData.SrcAS
} else {
flowMessage.SrcAS = recordData.AS
}
case sflow.ExtendedSwitch:
flowMessage.SrcVlan = recordData.SrcVlan
flowMessage.DstVlan = recordData.DstVlan
Expand Down

0 comments on commit 57fad2e

Please sign in to comment.