[ixpmanager] Problem with sflow-detect-ixp-bgp-sessions

Nick Hilliard nick at inex.ie
Thu Mar 3 22:06:54 GMT 2016


this:

> Can't call method "short" on an undefined value at
> /usr/local/bin/sflow-detect-ixp-bgp-sessions line 206.
>
> Line 206:
>              
>   $mapping->{6}->{NetAddr::IP->new($rec->{address})->short()} = $rec->{id};

is a different problem to this:

> When debugging a bit and changing the code on line 206 to the following:
>
>                 my $foo = NetAddr::IP->new($rec->{address})->short();
>                 print $foo
>                 $mapping->{6}->{$foo} == $rec->{id};

> Can't use string ("2001:7f8:3e:0:a500:3:3886:1") as a symbol ref while
> "strict refs" in use at /usr/local/bin/sflow-detect-ixp-bgp-sessions
> line 208.
>
> ... where line 208 is "print $foo".

The code you added is wrong: you need a ";" after "print $foo".  At the
moment it is being interpreted as:

my $foo = NetAddr::IP->new($rec->{address})->short();
print $foo $mapping->{6}->{$foo} == $rec->{id};

I.e. print is attempting to interpret $foo as a file handle.  You also
used the "==" comparative operator instead of the "=" assignment operator.

Can you change your code to:

--
print Dumper ($rec);
my $foo = NetAddr::IP->new($rec->{address})->short();
print $foo;
$mapping->{6}->{$foo} = $rec->{id};
--

When short() aborts, the last entry printed should be an empty $rec
entry.  Can you post this (removing all sensitive data)?

Nick


More information about the ixpmanager mailing list