Subject: | Update.pm / constructing AGGREGATOR attribute |
Date: | Thu, 8 Jan 2009 13:54:56 +0100 |
To: | bug-Net-BGP [...] rt.cpan.org |
From: | Christian Zeng <christian [...] zengl.net> |
Hi,
fist of all, I like to express how I enjoyed playing with Net::BGP -
thank you very much for this useful framework/module.
I think i found a bug in Update.pm, in the way the AGGREGATOR attribute
gets constructed at _encode_aggregator. inet_aton will output an packet
format/struct already, so its not required to pack it again. Please see
the diff below.
I tested this behavior with a BGP adjacency and can confirm that
advertising routes with AGGREGATOR only works when I apply the patch
(verified with packet captures and debugging at the peer).
Kind regards,
Christian
$ uname -a
Linux hobel 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686 GNU/Linux
$ perl -v | grep built
This is perl, v5.10.0 built for i486-linux-gnu-thread-multi
$ egrep '^\$VERSION' perl/5.10.0/Net/BGP.pm
$VERSION = '0.10';
$ egrep '^\$VERSION' perl/5.10.0/Net/BGP/Update_orig.pm
$VERSION = '0.07';
$ diff -u perl/5.10.0/Net/BGP/Update_orig.pm perl/5.10.0/Net/BGP/Update.pm
--- perl/5.10.0/Net/BGP/Update_orig.pm 2008-06-21 06:42:00.000000000 +0200
+++ perl/5.10.0/Net/BGP/Update.pm 2008-12-25 23:05:17.000000000 +0100
@@ -642,10 +642,12 @@
sub _encode_aggregator
{
my $this = shift();
- $this->_encode_attr(BGP_PATH_ATTR_AGGREGATOR,
- pack('Cn',
- $this->{_aggregator}->[0],
- inet_aton($this->{_aggregator}->[1])));
+ my $buffer;
+
+ $buffer = pack('n', $this->{_aggregator}->[0]);
+ $buffer .= inet_aton($this->{_aggregator}->[1]);
+
+ $this->_encode_attr(BGP_PATH_ATTR_AGGREGATOR, $buffer);
}
sub _encode_communities