PacketFence
Bug Tracking System

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000832PacketFencecorepublic2009-10-28 14:312012-02-29 10:58
Reporterobilodeau 
Assigned Toobilodeau 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version2.1.0 
Summary0000832: Warning in vlan.pm around line 152
Description        my @upLinks = $switch->getUpLinks();
        if ( $upLinks[0] == -1 ) {

we should validate for empty array!
TagsNo tags attached.
fixed in git revision
fixed in mtn revisionc0cb2ad2a1b2eacec58aca67d83a7095b4e42b9a
Attached Files

- Relationships
related to 0000831closedobilodeau not careful enough when validating uplink parameter in switches.conf causes threads to hang later 

-  Notes
(0001836)
fgaudreault (viewer)
2011-01-27 13:28

Did a patch for it, to be validated/tested.
(0001853)
obilodeau (reporter)
2011-02-03 14:47
edited on: 2011-02-03 14:47

Reproduced issue with test cases in t/vlan.t. Two cases where the code bombs:
- not an array
- empty array

trying the patch

(0001854)
obilodeau (reporter)
2011-02-03 14:50

the patch doesn't respect the desired behavior. A zero uplink list should return 1 and with the patch it'll return 0.

#   Failed test 'avoid empty array warning (issue \0000832)'
#   in vlan.t at line 112.
#          got: '0'
#     expected: '1'
not ok 10 - avoid empty array warning (issue \0000832)

#   Failed test 'Zero uplinks'
#   in vlan.t at line 119.
#          got: '0'
#     expected: '1'
not ok 11 - Zero uplinks

#   Failed test 'getUpLinks not supported return 0'
#   in vlan.t at line 126.
#          got: '1'
#     expected: '0'
not ok 12 - getUpLinks not supported return 0
ok 13 - do we act on uplink?
# Looks like you failed 3 tests of 14.

(0001855)
obilodeau (reporter)
2011-02-03 14:53

fixed it. Here's the patch:

#
# old_revision [c29f24c5813973df2563988671ab3e279c219927]
#
# patch "pf/lib/pf/vlan.pm"
#  from [ba5ea5b5334a6a05b0234f7039666c40ecc9de22]
#    to [db0fbb6caa31e08eaa05674fd61d4e27fbacb061]
#
============================================================
--- pf/lib/pf/vlan.pm   ba5ea5b5334a6a05b0234f7039666c40ecc9de22
+++ pf/lib/pf/vlan.pm   db0fbb6caa31e08eaa05674fd61d4e27fbacb061
@@ -106,7 +106,7 @@ sub doWeActOnThisTrap {
     if ( ( $ifType == $SNMP::ETHERNET_CSMACD ) || ( $ifType == $SNMP::GIGABIT_ETHERNET ) ) {
         my @upLinks = $switch->getUpLinks();
         # TODO: need to validate for empty array here to avoid warning
-        if ( $upLinks[0] == -1 ) {
+        if ( @upLinks && $upLinks[0] == -1 ) {
             $logger->warn("Can't determine Uplinks for the switch -> do nothing");
         
} else {
             if ( grep( { $_ == $ifIndex } @upLinks ) == 0 ) {



Test results:
ok 10 - avoid empty array warning (issue \0000832)
ok 11 - Zero uplinks
ok 12 - getUpLinks not supported return 0
ok 13 - do we act on uplink?
ok 14 - no warnings
(0001856)
obilodeau (reporter)
2011-02-03 15:05

fix committed

- Issue History
Date Modified Username Field Change
2009-10-28 14:31 obilodeau New Issue
2009-10-28 14:31 obilodeau Relationship added related to 0000831
2009-10-28 14:31 obilodeau Status new => assigned
2009-10-28 14:31 obilodeau Assigned To => obilodeau
2011-01-18 11:53 obilodeau Target Version => 2.0.1
2011-01-26 15:30 obilodeau Target Version 2.0.1 => 2.0.2
2011-01-27 13:28 fgaudreault Note Added: 0001836
2011-01-27 13:29 fgaudreault File Added: vlan.pm.patch
2011-02-03 14:47 obilodeau Note Added: 0001853
2011-02-03 14:47 obilodeau Note Edited: 0001853
2011-02-03 14:50 obilodeau Note Added: 0001854
2011-02-03 14:53 obilodeau Note Added: 0001855
2011-02-03 14:55 obilodeau File Deleted: vlan.pm.patch
2011-02-03 15:05 obilodeau mtn revision => c0cb2ad2a1b2eacec58aca67d83a7095b4e42b9a
2011-02-03 15:05 obilodeau Note Added: 0001856
2011-02-03 15:05 obilodeau Status assigned => resolved
2011-02-03 15:05 obilodeau Fixed in Version => 2.0.2
2011-02-03 15:05 obilodeau Resolution open => fixed
2011-03-03 15:20 obilodeau Fixed in Version 2.0.2 => 2.1.0
2011-03-03 15:25 obilodeau Status resolved => closed
2012-02-29 10:58 obilodeau Category future => core


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker