#!/usr/bin/perl use strict; use warnings; use AnyEvent; use Net::Radius::Dictionary; use Net::Radius::Packet; use AnyEvent::Handle::UDP; use AnyEvent::Socket (); use Socket; use Thread::Queue; use Data::Dump qw( pp ); my %config = ( hostname_accounting => '10.63.95.6', port_accounting => 1813, ); my $cv = AnyEvent->condvar; my $client_radius = AnyEvent::Handle::UDP->new( #bind => ['10.0.2.15', 1813], connect => [$config{hostname_accounting} => $config{port_accounting}], on_recv => sub { }, ); for (my $ports = 1000; $ports <= 2000; $ports++){ ############################## my $dict = new Net::Radius::Dictionary 'dictionary' or die "Couldn't read dictionary: $!"; # Open a new object with right dictionary my $req = new Net::Radius::Packet $dict; $req->set_code('Accounting-Request'); #### injection the specific fields: $req->set_attr('Acct-Status-Type','Start'); ##################### # adding some extra info in radius packet....from a threads queue ... ##################### $req->set_authenticator(''); #print pp ($req) . "\n"; #my $packet = auth_resp($req->pack(), $config{secret}); my $packet = auth_resp($req->pack()); ############################## #$client_radius->push_send($packet, pack_sockaddr_in(53, Socket::inet_aton('10.63.95.6'))); $client_radius->bind_to(['10.0.2.15',$ports]); $client_radius->push_send($packet); } $cv->wait;