Development/CommandFloodControl
From Inspire IRCd (InspIRCd)
| | This page has been marked as Development Material. Information posted here may be subject to change and/or only available in unstable versions of InspIRCd. |
Contents |
Command Flood Control
Introduction
To prevent users from flooding excessively on InspIRCd servers, we have introduced a penalty/delay system which queues commands. This prevents large amounts of flooding by throttling down the user's sent text to reasonable levels. This is done by what is known as a 'penalty' system.
Penalty System Explained
In the InspIRCd penalty system, each user has a counter, which starts at zero. For every command they issue their counter rises by a set figure, depending on the penalty value of that command. Commands may have penalty values ranging from 0 (does not affect the user) through to 4 and up for resource intensive commands.
For every second that passes, the penalty count for the user ticks down by one, back to zero.
If the user's penalty count reaches or goes above ten, then commands are not executed immediately when received. Instead, they are executed one at a time, when there are enough free seconds below ten for them to be executed. For example, if your current penalty is 8, and the value of the NICK command is 2, then you may execute NICK, but if the value of the MOTD command is 4 and you send MOTD, you may not execute that MOTD command for another 2 seconds. As you send more commands your penalty value will continue to increase and your queue will grow larger, and take longer to empty depending on what was sent. Of course, if you completely fill your sendq before the penalty system can flush it, you will be disconnected.
Penalty Values
The penalty values of each command at present are listed below:
- CONNECT: 1 second
- DIE: 0 seconds
- ELINE: 0 seconds
- KLINE: 0 seconds
- GLINE: 0 seconds
- QLINE: 0 seconds
- ZLINE: 0 seconds
- INVITE: 4 seconds
- JOIN: 2 seconds
- KILL: 0 seconds
- LIST: 5 seconds
- MAP: 2 seconds
- OPER: 2 seconds (see note)
- PART: 5 seconds
- PASS: 0 seconds
- PING: 0 seconds
- PONG: 0 seconds
- REHASH: 3 seconds
- RESTART: 0 seconds
- TOPIC: 2 seconds
- USER: 0 seconds
- WHO: 2 seconds
- WHOIS: 2 seconds
- WHOWAS: 2 seconds
- CYCLE: 5 seconds
- SAMODE: 0 seconds
- SAJOIN: 0 seconds
- SAQUIT: 0 seconds
- SAPART: 0 seconds
- SANICK: 0 seconds
All commands not listed here have the default penalty time of 1 second.
NOTE: For OPER, a failed oper has a penalty of 12 seconds and a successful oper a penalty of 2 seconds. This is to help prevent bruteforcing in the event all other measures fail and opers are idle (this shouldn't happen, but it does quite often!).

















