From 8dbe4f42f125c8158510ee950c374c9d3fcfc332 Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Wed, 1 Nov 2023 20:37:29 +0000 Subject: [PATCH] Fixes --- tools/docker/containers/sflow-scripts/ixpmanager.conf | 6 ++++-- tools/runtime/sflow/goflow2-detect-ixp-bgp-sessions | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/docker/containers/sflow-scripts/ixpmanager.conf b/tools/docker/containers/sflow-scripts/ixpmanager.conf index e7f673a00..78954e5b2 100644 --- a/tools/docker/containers/sflow-scripts/ixpmanager.conf +++ b/tools/docker/containers/sflow-scripts/ixpmanager.conf @@ -7,8 +7,10 @@ - sflowtool = /usr/local/bin/sflowtool - sflowtool_opts = -4 -p 6343 -l + # sflowtool = /usr/bin/sflowtool + # sflowtool_opts = -4 -p 6343 -l + sflowtool = /usr/bin/goflow2 + debug = 1 sflow_rrdcached = 1 sflow_rrddir = /data/ixpmatrix diff --git a/tools/runtime/sflow/goflow2-detect-ixp-bgp-sessions b/tools/runtime/sflow/goflow2-detect-ixp-bgp-sessions index ae3317db7..7df56fe64 100755 --- a/tools/runtime/sflow/goflow2-detect-ixp-bgp-sessions +++ b/tools/runtime/sflow/goflow2-detect-ixp-bgp-sessions @@ -120,9 +120,9 @@ while () { my $srcip = $sample->{ SrcAddr }; my $dstip = $sample->{ DstAddr }; - if ($ethertype eq '0x0800') { + if ($ethertype == 2048) { $ipprotocol = 4; - } elsif ($ethertype eq '0x86dd') { + } elsif ($ethertype == 34525) { # 0x86dd $ipprotocol = 6; $srcip = NetAddr::IP->new($srcip)->short(); $dstip = NetAddr::IP->new($dstip)->short(); @@ -138,7 +138,7 @@ while () { if ($protocol == 6 && ($srcport == 179 || $dstport == 179)) { use NetPacket::TCP; - my $tcpflags = hex($sample->{TCPFlags}); + my $tcpflags = hex($sample->{TcpFlags}); # we're only interested in established sessions if (($tcpflags & ACK) && !(($tcpflags & SYN) || ($tcpflags & RST) ||($tcpflags & FIN))) { @@ -158,6 +158,10 @@ while () { print STDERR " ignored - no address match in database" if ($debug); } print STDERR ".\n" if ($debug); + } else { + if ($debug) { + print STDERR "DEBUG: ignoring [$srcip]:$srcport - [$dstip]:$dstport ".debug_tcpflags($tcpflags)."."; + } } }