Skip to content

Commit

Permalink
Add VLAN and agent address
Browse files Browse the repository at this point in the history
  • Loading branch information
jbemmel committed Apr 27, 2023
1 parent ab4e437 commit 5101386
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/runtime/sflow/goflow2-detect-ixp-bgp-sessions
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ while (<SFLOWTOOL>) {
# $srcip, $dstip, $protocol, $tos, $ttl,
# $srcport, $dstport, $tcpflags, $pktsize, $payloadsize, $samplerate) = @sample;

# SrcAddr,DstAddr,Etype,Proto,SrcPort,DstPort,TCPFlags
# SrcAddr,DstAddr,Etype,Proto,SrcPort,DstPort,TCPFlags,SamplerAddress,VlanId
# see https://github.com/netsampler/goflow2/blob/main/docs/protocols.md for more fields
my $ethertype = $sample->{ Etype }
my $srcip = $sample->{ SrcAddr }
my $dstip = $sample->{ DstAddr }
Expand All @@ -130,7 +131,7 @@ while (<SFLOWTOOL>) {
next;
}

my $protocol = $sample->{ Proto }
my $protocol = $sample->{ Proto }
my $srcport = $sample->{ SrcPort }
my $dstport = $sample->{ DstPort }

Expand All @@ -147,6 +148,8 @@ while (<SFLOWTOOL>) {
}

# we're also only interested in ip addresses that have a database match
my $agent = $sample->{ SamplerAddress }
my $vlan = $sample->{ VlanId }
if ($ipmappings->{$ipprotocol}->{$srcip} && $ipmappings->{$ipprotocol}->{$dstip}) {
print STDERR " database updated" if ($debug);
if (!$sth->execute($ipmappings->{$ipprotocol}->{$srcip}, $ipmappings->{$ipprotocol}->{$dstip}, $ipprotocol, $vlan, $agent)) {
Expand Down

0 comments on commit 5101386

Please sign in to comment.