PacketFence - BTS - PacketFence
View Issue Details
0001839PacketFencecorepublic2014-10-28 08:142014-12-17 08:48
caralo 
fdurand 
highmajoralways
resolvedfixed 
LinuxDebian7 (Wheezy)
4.4.0 
 
364882d0d75b0191ab3e935db9d9592c11b03721
0001839: Re-evaluate access fails with undefined subroutine
After registration in portal, vlan _reevaluation fails when it calls subroutine &pf::api::locationlog_view_open_switchport_no_VoIP
Debian 7 and PF 4.4/4.5

These are the logs:

Oct 27 19:11:42 httpd.portal(21155) INFO: [00:44:54:85:f7:0c] re-evaluating access (manage_register called) (pf::enforcement::reevaluate_access)
Oct 27 19:11:42 httpd.portal(21155) INFO: [00:44:54:85:f7:0c] switch port is (10.0.1.4) ifIndex 10040 connection type: Wired SNMP (pf::enforcement::_vlan_reevaluation)
Oct 27 19:11:44 httpd.webservices(3662) ERROR: Undefined subroutine &pf::api::locationlog_view_open_switchport_no_VoIP call
ed at /usr/local/pf/lib/pf/api.pm line 251.
 (pf::WebAPI::JSONRPC::__ANON__)
Oct 27 19:12:21 httpd.portal(3622) INFO: [00:44:54:85:f7:0c] shouldn't reach here. Calling access re-evaluation. Make sure
your network device configuration is correct. (captiveportal::PacketFence::Controller::CaptivePortal::unknownState)
No tags attached.
Issue History
2014-10-28 08:14caraloNew Issue
2014-10-28 08:29fdurandNote Added: 0003602
2014-10-28 08:53fdurandAssigned To => fdurand
2014-10-28 08:53fdurandStatusnew => assigned
2014-10-28 10:50caraloNote Added: 0003603
2014-10-28 10:54fdurandNote Added: 0003604
2014-10-28 11:04caraloNote Added: 0003605
2014-11-20 10:18fdurandfixed in git revision => 364882d0d75b0191ab3e935db9d9592c11b03721
2014-12-17 08:48fdurandStatusassigned => resolved
2014-12-17 08:48fdurandResolutionopen => fixed

Notes
(0003602)
fdurand   
2014-10-28 08:29   
Hello,

can you change the line 251 of /usr/local/pf/lib/pf/api.pm to that:
my @locationlog = pf::locationlog::locationlog_view_open_switchport_no_VoIP( $switch->{_id}, $ifIndex );

and also add this function in api.pm:

sub node_determine_and_set_into_VLAN {
    my ( $mac, $switch, $ifIndex, $connection_type ) = @_;

    my $logger = Log::Log4perl->get_logger('pfsetvlan::handling');
    Log::Log4perl::MDC->put( 'tid', threads->self->tid() );

    my $vlan_obj = new pf::vlan::custom();

    my ($vlan,$wasInline) = $vlan_obj->fetchVlanForNode($mac, $switch, $ifIndex, $connection_type);

    $switch->setVlan(
        $ifIndex,
        $vlan,
        undef,
        $mac
    );
}

And retry.

Regards
Fabrice
(0003603)
caralo   
2014-10-28 10:50   
Good job !!! I retried and it is working now with your patch.

There is a new error but i suppose it is not that important. It is another undefined subroutine &pf::api::violation_view_open_desc

These are the logs:

Oct 28 15:39:39 httpd.webservices(0) INFO: [55:d0:2b:55:e1:84] PID: "carcalo", Status: reg. Returned VLAN: 710 (pf::vlan::fetchVlanForNode)
Oct 28 15:39:40 httpd.webservices(0) INFO: setting VLAN at 10.0.1.67 ifIndex 10009 from 719 to 710 (pf::Switch::setVlan)
Oct 28 15:39:41 httpd.webservices(0) ERROR: Undefined subroutine &pf::api::violation_view_open_desc called at /usr/local/pf/lib/pf/api.pm line 269.
 (pf::WebAPI::JSONRPC::__ANON__)
(0003604)
fdurand   
2014-10-28 10:54   
Ok so try this in the api.pm file:
my @violations = pf::violation::violation_view_open_desc($mac);
 at line 269
(0003605)
caralo   
2014-10-28 11:04   
Excellent!!! No more errors in the logs. You can close the bug.