From 7cec5d80b3b5e2935a3a38c42a4c9763200f1c87 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 14 Mar 2026 05:48:58 +0000 Subject: Rewrite portparser and move to stringutils. --- src/socket.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/socket.cpp') diff --git a/src/socket.cpp b/src/socket.cpp index c88823c1b..aabe0efe3 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -112,24 +112,17 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports) continue; } - irc::portparser portrange(portlist, false); - while (long port = portrange.GetToken()) + NumberRange portrange(portlist); + for (in_port_t port; portrange.GetToken(port); ) { - // Check if the port is out of range. - if (port <= std::numeric_limits::min() || port > std::numeric_limits::max()) - { - failed_ports.emplace_back(FMT::format("Port is not valid: {}", port), bindspec, tag); - continue; - } - switch (bindspec.family()) { case AF_INET: - bindspec.in4.sin_port = htons(static_cast(port)); + bindspec.in4.sin_port = htons(port); break; case AF_INET6: - bindspec.in6.sin6_port = htons(static_cast(port)); + bindspec.in6.sin6_port = htons(port); break; default: -- cgit v1.3.1-10-gc9f91