From d82c43db87ac421ad9830c77342ad68b1d4d20c3 Mon Sep 17 00:00:00 2001 From: Bryan Mason Date: Sat, 24 Jun 2023 12:31:23 -0700 Subject: [PATCH 1/2] Fix delays printing to lpd when reserved ports are exhausted cups_rresvport() doesn't reserve ports less than 512; however, lpd_queue() continues decrementing the port number to 0. This leads to delays of ~511 seconds once all ports between 512-1023 are exhausted. Even when ports become available, lpd_queue() still tries calling cups_rresvport() with port numbers less than 512, waiting one second between each call. --- backend/lpd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/lpd.c b/backend/lpd.c index a7a44ab20..425b8512a 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -63,7 +63,7 @@ static int abort_job = 0; /* Non-zero if we get SIGTERM */ #define RESERVE_NONE 0 /* Don't reserve a privileged port */ #define RESERVE_RFC1179 1 /* Reserve port 721-731 */ -#define RESERVE_ANY 2 /* Reserve port 1-1023 */ +#define RESERVE_ANY 2 /* Reserve port 512-1023 */ /* @@ -775,7 +775,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ if (lport < 721 && reserve == RESERVE_RFC1179) lport = 731; - else if (lport < 1) + else if (lport < 512) lport = 1023; #ifdef HAVE_GETEUID -- 2.41.0