When ban period is minimal, the 'now > e->expires' condition alone
cleared scores before a client was banned.
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
This ensures all subsequent worker communications reach the original
secmod instance that authenticated the client, enabling correct session
accounting after IP address changes.
Closes: #674
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
The previous condition for resetting a ban score was insufficient.
It failed to reset the score for a client that had just exited a ban,
and also incorrectly reset the score of a currently banned client,
causing premature unbans.
Closes: #678
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
Added current timestamp comparison to ensure only active bans
are shown by 'occtl show ip bans'.
Closes: #675.
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
Existing code used the loop index 'i == 0' to determine when to print
column headers. However, a 'continue' statement inside the loop could
skip the 'i = 0' iteration, causing the headers to never be printed.
Introduced a separate boolean 'header_printed' variable to track
whether headers have been printed.
Closes: #677
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
Remove IPV6_V6ONLY flag from per-client UDP sockets as it prevents
IPv4 traffic on systemd-provided IPv6 sockets. This was a legacy
from the old reopen_udp_port() code and is no longer needed.
Fixes: #647
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
Return proper values (1 for success, 0 for error) from iroutes_handler()
to prevent premature parser termination
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
A misplaced bracket passed 'sizeof(*addr1) == -1' instead of 'sizeof(*addr1)'
to sendto(), causing it to fail. This prevented icmp_ping4() from sending
ICMP echo requests.
Consequently, the 'ping-leases' option has been non-functional since
this bug was introduced in commit 2aaa287a.
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
Silence misleading debug message on server startup since absence
of the socket file is normal and expected.
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
Correct the argument order passed to the printf-like function
to match the format string "expected %d, received %d".
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
Check for gperf in ./configure to provide a clear, user-friendly
error message if it's not found and required generated files are
missing, instead of failing at compile time.
Also fix an invalid package name ('install') in README.md for
Fedora/RHEL build.
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
This reverts commit 6fea92a961.
The URL consolidation caused worker to no longer recognize either of the original URLs.
This led to "unexpected URL" errors and immediate worker termination.
The original change was intended to simplify URL configuration,
but it inadvertently broke functionality for both endpoints.
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>