On 5/31/2012 5:25 PM, Barry Quiel wrote:
> On 5/31/2012 1:49 PM, Barry Quiel wrote:
>> On 5/31/2012 10:41 AM, Barry Quiel wrote:
>>> On 5/31/2012 10:28 AM, Olivier Bilodeau wrote:
>>>> Note: Re-adding the list.
>>>>
>>>> On 05/31/2012 12:02 PM, Barry Quiel wrote:
>>>>> On 5/31/2012 6:37 AM, Olivier Bilodeau wrote:
>>>>>> You are having the weirdest problems..
>>>>> That goes without saying :-D
>>>> ...
>>>>
>>>> Your output all looks fine. I seriously don't understand what's 
>>>> going on
>>>> here..
>>>>
>>>> Are you familiar with the perl debugger?
>>>>
>>>> If you are not in production, add a -d to the first line of bin/pfcmd
>>>> then run:
>>>>
>>>> $ cd /usr/local/pf/
>>>> $ PERLLIB=lib bin/pfcmd checkup
>>>> or it might need to be:
>>>> $ PERLLIB=lib perl -d bin/pfcmd checkup
>>>>
>>>> then set a breakpoint with:
>>>>> use pf::pfcmd::checkup;
>>>>> b pf::pfcmd::checkup::interfaces_defined
>>>> then continue to there:
>>>>> c
>>>> Once there, look at the various globals with x. For ex:
>>>>> x \%Config
>>>> This should result in the display of a _huge_ hash with all your
>>>> configuration in it.
>>>>
>>>> Try poking around and find what's wrong and let us know of anything 
>>>> you
>>>> find.
>>>>
>>>> Good luck.
>>> It looks like the %Config hash is defined along with lots of keys, 
>>> including the network,interface eth0, and interface eth1.  It shows 
>>> that those keys are references to Hashes, but they are all empty.  
>>> Those referenced hash don't contain any keys.  Can you point me in 
>>> the direction of the function that builds %Config, I can try and see 
>>> whats coming out of there and then step to interface_defined and see 
>>> where %Config is getting clobbered.
>>>
>> So I'm a bit confused.  Debugging pfcmd, the first piece of code the 
>> debugger gets to is $> = 0; ( Line 59 ).  At that point %Config is 
>> defined and has keys, although those keys don't have an data in them 
>> ( references to non-existent hashes ).  I wouldn't expect %Config to 
>> exist yet, not until you get to use pf:config on like 75.  Forgive my 
>> perl rustiness, but aren't use statement "used" when you get to that 
>> point in the code at run time, or are the included at "compile" 
>> time.  I would expect that %Config not exist before line 75, but it 
>> does on line 59.  Which presents a problem.  I would like to get in 
>> and debug pf:config but use statements are not breakable points.  I 
>> tried setting a break point at pf::config::readPfConfigFiles but it 
>> just blew right past it.
>
> I found the how I just don't know the why.  in lib/pf/config.pm on 
> about line 331 "foreach my $interface ( 
> tied(%Config)->GroupMembers("interface") ) {" %Config gets clobbered.
>
> I put print $Config{'interface eth0'}{'ip'} . "\n"; right before the 
> foreach and it prints the IP address of eth0.
> I put print $Config{'interface eth0'}{'ip'} . "\n"; right after the 
> foreach and it prints nothing.  I did a check for undef and it is not 
> defined.
>
> So I looked at the yum log and perl-Config-IniFiles was updated at the 
> same time I did the packetfence update ( I just did a yum update to 
> update everything ).  Is it possible that 2.72-1 of 
> perl-Config-IniFiles is broken using tied?  Any chance you have a 
> Cent6 box with that version that you could confirm?
Sorry to keep spamming the list, but I email, then I have a thought, 
then I email, and on and on.  I wish all my thoughts could come at once.

Anyway...

It looks like Config::IniFiles version 2.72-1 ( from yum centos repo ) 
is broken, specifically the GroupMembers function.  I hopped on CPAN and 
got the latest 2.75 and all is fine.  I wrote a small test perl script 
to check and everything and was able to confirm that GroupMembers wasn't 
returning anything in 2.72 and returns correctly in 2.75.  I started 
packetfence and it started correctly.  I think the problem is solved.


Here is the test perl:

#!/usr/bin/perl

use strict;
use Config::IniFiles;

my %Config;
my $interface;
my @iface;

tie %Config, 'Config::IniFiles', ( -file => '/usr/local/pf/conf/pf.conf' );

@iface = tied(%Config)->Groups;

foreach my $group ( @iface )
{
    print "Checking group $group \n";
    foreach $interface ( tied(%Config)->GroupMembers($group) )
    {
       print $Config{$interface}{'ip'} . "\n";
    }

}

foreach $interface ( tied(%Config)->GroupMembers("interface") )
{
     print $Config{$interface}{'ip'} . "\n";
}


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users

Reply via email to