From ea65ed57afcaef722da75a6f317db4da370e7f98 Mon Sep 17 00:00:00 2001 From: Bill Fenner <> Date: Mon, 8 Oct 2007 22:30:30 +0000 Subject: [PATCH] Teach Baystack's e_index() that Entity's e_index() is implemented based on e_descr() - otherwise, Entity's e_index() will always return a mapping even if the device doesn't implement the ENTITY-MIB. --- Info/Layer2/Baystack.pm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Info/Layer2/Baystack.pm b/Info/Layer2/Baystack.pm index 716d68d3..8810ee4a 100644 --- a/Info/Layer2/Baystack.pm +++ b/Info/Layer2/Baystack.pm @@ -347,7 +347,17 @@ sub e_index { my $stack = shift; my $partial = shift; - return $stack->SUPER::e_index($partial) || $stack->ns_e_index($partial); + # This has intimate knowledge of the implementation of e_index. + # e_index is implemented in terms of e_descr, so unlike the other + # functions below we can't just + # return $stack->SUPER::e_index($partial) || $stack->ns_e_index($partial); + # since it will call *our* e_descr. So we only call e_index if + # SUPER::e_descr works. + if ($stack->SUPER::e_descr($partial)) { + return $stack->SUPER::e_index($partial); + } else { + return $stack->ns_e_index($partial); + } } sub e_class { @@ -607,7 +617,9 @@ L for details on ns_e_* methods. =item $baystack->e_index() -If the device doesn't support B, this will try ns_e_index(). +If the device doesn't support B, this will try ns_e_index(). +Note that this is based on B due to implementation +details of SNMP::Info::Entity::e_index(). =item $baystack->e_class()