diff --git a/plugins/ident/geoip b/plugins/ident/geoip index b33d1d4..6961ed6 100644 --- a/plugins/ident/geoip +++ b/plugins/ident/geoip @@ -375,6 +375,9 @@ sub set_asn { return if ! $self->{GeoIPASNum}; my $asn = $self->{GeoIPASNum}->name_by_addr($ip) or return; + if ('AS' eq substr($asn, 0, 2)) { + $asn = substr($asn, 2); + } $self->qp->connection->notes('geoip_asn', $asn); return $asn; } diff --git a/t/plugin_tests/ident/geoip b/t/plugin_tests/ident/geoip index 2610894..43392fd 100644 --- a/t/plugin_tests/ident/geoip +++ b/t/plugin_tests/ident/geoip @@ -176,10 +176,10 @@ sub test_set_asn { $self->qp->connection->remote_ip('24.24.24.24'); $asn = $self->set_asn(); - ok( $self->connection->notes('geoip_asn') =~ /^AS11351/, "note has: $asn"); + ok( $self->connection->notes('geoip_asn') =~ /^11351/, "note has: $asn"); $self->qp->connection->remote_ip('66.128.51.163'); $asn = $self->set_asn(); - ok( $self->connection->notes('geoip_asn') =~ /^AS7819/, "note has: $asn"); + ok( $self->connection->notes('geoip_asn') =~ /^7819/, "note has: $asn"); };