conn_waitpong: exempt loopback (per ipv4/ipv6) and per-class from the registration ping cookie

This commit is contained in:
Jean Chevronnet 2026-08-22 23:49:46 +00:00
parent 70a4ecb0a0
commit 5c286a94cb
No known key found for this signature in database
GPG key ID: 439666D63A9477E4
2 changed files with 34 additions and 4 deletions

View file

@ -52,6 +52,7 @@ pub struct ConnClass {
pub requireident: bool, // refuse if the ident lookup fails
pub resolvehostnames: bool, // resolve rDNS for this class (default yes)
pub maxconnwarn: bool, // snotice opers when a limit refuses a client
pub waitpongexempt: bool, // skip the conn_waitpong cookie for this class
}
/// Split a `key=value` value on commas into non-empty pieces.
@ -91,6 +92,7 @@ fn apply(c: &mut ConnClass, k: &str, v: &str) {
"requireident" => c.requireident = v.eq_ignore_ascii_case("yes"),
"resolvehostnames" => c.resolvehostnames = !v.eq_ignore_ascii_case("no"),
"maxconnwarn" => c.maxconnwarn = v.eq_ignore_ascii_case("yes"),
"waitpongexempt" => c.waitpongexempt = v.eq_ignore_ascii_case("yes"),
_ => {}
}
}
@ -512,6 +514,10 @@ pub fn flood_over(s: &Server, uid: Uid) -> Option<(Option<usize>, Option<u64>, b
pub fn resolve_hostnames(s: &Server, uid: Uid) -> bool {
class_of(s, uid).map(|c| c.resolvehostnames).unwrap_or(true)
}
/// Whether this client's class opts out of the conn_waitpong cookie.
pub fn waitpong_exempt(s: &Server, uid: Uid) -> bool {
class_of(s, uid).map(|c| c.waitpongexempt).unwrap_or(false)
}
/// `(useident, requireident)` for this client's class.
pub fn ident_policy(s: &Server, uid: Uid) -> (bool, bool) {
class_of(s, uid)