Skip to content

Commit

Permalink
counter value 0 is fine ... fixing #108 (#109)
Browse files Browse the repository at this point in the history
* counter value 0 is fine ... fixing #108

* Update CHANGES
  • Loading branch information
oetiker committed Aug 31, 2023
1 parent c2f79f4 commit 433ebfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
From: tobi
* fix noHC detection in cfgmaker (interfaces with traffic counter = 0 could still be valid)

From: fweimer-rh
* Future C compilers are likely to reject implicit function declarations by default. This language feature was officially removed in 1999. @ffwmeier-rh

Expand Down
4 changes: 2 additions & 2 deletions src/bin/cfgmaker
Original file line number Diff line number Diff line change
Expand Up @@ -911,11 +911,11 @@ sub IsCounterBroken ($$$) {
my $snmphost = v4onlyifnecessary($router, $ipv4only);

if ($router =~ /:[\d.]*:[\d.]*:[\d.]*:[23]/) {
my $speed = (snmpget($snmphost, $v3opt, 'ifHighSpeed.'.$if))[0] || 'unknown';
my $speed = (snmpget($snmphost, $v3opt, 'ifHighSpeed.'.$if))[0] // 'unknown';
debug('base',"snmpget $snmphost for ifHighSpeed.$if -> $speed Mb/s");
$SNMP_Session::errmsg = undef;
$Net_SNMP_util::ErrorMessage = undef;
my $counter = (snmpget($snmphost,$v3opt, 'ifHCInOctets.'.$if))[0] || 'unknown';
my $counter = (snmpget($snmphost,$v3opt, 'ifHCInOctets.'.$if))[0] // 'unknown';
debug('base',"snmpget $snmphost for ifHCInOctets.$if -> $counter");
if( $speed eq 'unknown' or $counter !~ /^\d+$/ or $SNMP_Session::errmsg or $Net_SNMP_util::ErrorMessage){
$SNMP_Session::errmsg = undef;
Expand Down

0 comments on commit 433ebfa

Please sign in to comment.