Net::S...yIPPort(3pm)
π NAME π
Net::SIP::Dropper::ByIPPort β okay so bestie, this is the module that drops SIP messages based on senders IP and port. That's literally it. It's the bouncer at the club door of your SIP stack. πͺβ¨
Oh and btw the page header calls this thing Net::S...yIPPort(3pm) (they truncated it, iconic of them), and it lives in the User Contributed Perl Documentation section. So you're in the right place. π«Ά
β¨ SYNOPSIS β¨
use Net::SIP::Dropper::ByIPPort;
my $drop_by_ipport = Net::SIP::Dropper::ByIPPort->new(
database => '/path/to/database.drop',
methods => [ 'REGISTER', '...', '' ],
attempts => 10,
interval => 60,
);
my $dropper = Net::SIP::Dropper->new( cb => $drop_by_ipport );
my $chain = Net::SIP::ReceiveChain->new([ $dropper, ... ]);
See how easy that was? No cap. You build the dropper, you hand it to a Net::SIP::Dropper, you slot that into a Net::SIP::ReceiveChain, and now your chain has opinions about who gets to talk. π
πΈ DESCRIPTION πΈ
So with Net::SIP::Dropper::ByIPPort one can drop packets, if too much packets are received from the same IP and port within a specific interval. And like... that's the whole point. It's to stop bad behaving clients. π«
It's giving "we have had ENOUGH of you, specifically you, at that port." π
π CONSTRUCTOR π
new ( ARGS )
ARGS is a hash with the following keys, bestie. Buckle up:
databaseβ Optional file name of database or callback for storing/retrieving the data.
If it is a callback it will be called with $callback->(\%data) to retrieve the data (%data will be updated) and "$callback->(\%data,true)" to save the data. No return value will be expected from the callback. π No return value, we don't want it, we don't need it.
%data contains the number of attempts from a specific IP, port at a specific time in the following format: "$data{ip}{port}{time} = count"
attemptsβ After how many attempts within the specific interval the packet will be dropped. Argument is required. Like, required required. π₯intervalβ The interval for attempts. Argument is required. Also non-negotiable. β°methodsβ Optional argument to restrict dropping to specific methods.
Is array reference of method names, if one of the names is empty also responses will be considered. If not given all packets will be checked. π (so yes, an empty string in there is doing something, it's not a typo, it's a feature)
π¦ METHODS π¦
run ( PACKET, LEG, FROM )
This method is called as a callback from the Net::SIP::Dropper object. It returns true if the packet should be dropped, e.g. if there are too much packets from the same ip,port within the given interval. ποΈ
Basically the vibe check. Fails it? Packet's gone.
expire
This method is called from within "run" but can also be called by hand. It will expire all entries which are outside of the interval. π§Ή
Spring cleaning but for stale IP/port records, and it happens automatically, which honestly? Slay.
savedb
This method is called from "expire" and "run" for saving to the database after changes, but can be called by hand to, useful if you made manual changes using the "data" method. πΎ
Handy if you've been messing with the data yourself and want it to actually persist. Fr fr.
data
This method gives access to the internal hash which stores the attempts. An attempt from a specific IP and port and a specific time (as int, like time() gives) will be added to "$self->data->{ip}{port}{time}". π’
By manually manipulating the hash one can restrict a specific IP,port forever (just set time to a large value and add a high number of attempts) or even restrict access for the whole IP (all ports) until time by using a port number of 0. π«π
After changes to the data it is advised to call "savedb". Don't forget it or your edits will just... vibe away into the void. π
Okay that's the whole page, bestie, you ate it. Go forth and drop some packets. π β¨
This was Net::S...yIPPort(3pm) from the User Contributed Perl Documentation, and it's perl v5.40.1, dated 2025-12-07. Obsessed. Byeeeee ππ¦
π¦ where this page comes from
- ubuntu resolute: libnet-sip-perl 0.840-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-sip-perl 0.840-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms