From nobody Mon Dec 09 15:02:32 2024 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y6Q886TYBz5gPTD; Mon, 09 Dec 2024 15:02:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y6Q885ZWvz4Kmy; Mon, 9 Dec 2024 15:02:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733756552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hnSNn2FG7PzN7TDNAsKzrcLvZCrpW6itrLShe12zRc8=; b=LsAVgUOnOEZu4QKQKApI0Ec7v9eyUTAFJE7ay+/Ye9im8L4gOQIHaQJfQiSkW9yN5FFXj+ JxWoqwgJyFhscmgvN8tMM0EnM2wtCYZukr3i+Kw9sfYGugnr5hyMEHqfcqUbBP29UPjPo+ 6quio+3/KOINx6YEgrM5QE09KrdruVhaYZ9UyNPumpzfnU0S56qXYA7+9gKQDwymUbmLBr hIawJYBcHCfxBsL8GV5LkvlZGNF5rmoOmU2OGB0vBit4aiCf2eI3ACZvstQpgDJsJNfimu cTeVh8WcfLuHmHDVZmGgvpy4lWe1QdBI0DJuVSPzXXN4bp3lLTFRO4DvE/jQXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733756552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hnSNn2FG7PzN7TDNAsKzrcLvZCrpW6itrLShe12zRc8=; b=rEmL++QTR13+W8lxzbS/2rdr4gGGyXgn5VpPmDmOTCbKwcDD97xxUvt7uiYX00AnYas+Pc hEeh0TdHFt2M3UtzARhRL6MVVymtMReVdfs+bo+5Xf1JP1XZJTh9OEWwLVxPbrUyo/tZPA jyRqhJSA7qNDxgrcyTvWvsiS5cmMU/6m3qZofq/zCkVYtSlgn0mN+wsKpbD2xFrseAkOOg utifqvrKl/78exypWxafoUh3iNmaa1hg9moulQCROAkJTU4pErabe+Vj05PwJDFZaeMQ4L u5wvH4tbNZP5B1kYiaYZCfxjDueYInjdobAhy+FqEdJtrMbI0p1gBmjNlOGbhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733756552; a=rsa-sha256; cv=none; b=gdWWfQeao+sIHseI5Duqe3qj8iwhwCQPwTRoPXYNkm1tmxbsMFWZRDrX8Jipa1lSg2IDkH fSygiQ2Lg9G0xOPFT+KULR+xUkRoBBJqiuNs3tKg36JzGHuli+5BY+mhT8gX0YKrLBYBU0 3vkazi3JuHIAdESTFRDC4r1d7FYrcSREICtDhNuajps3xLdMDxZm+9JaB3MIFypgaTZ7S5 9PbQLstIns537ZcliKW1scnvrq/jy/t1X3ya6nMYi29x234cTP6fLNYJVBPHmLKmvEQkUx brHEGtCb/9vzYVugWHePn00QZ6nMGp77Ib7N7glWHFCIgBguHdrRYlmO+M7K5w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y6Q8859p3zjkj; Mon, 9 Dec 2024 15:02:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B9F2WYb087574; Mon, 9 Dec 2024 15:02:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B9F2WTM087571; Mon, 9 Dec 2024 15:02:32 GMT (envelope-from git) Date: Mon, 9 Dec 2024 15:02:32 GMT Message-Id: <202412091502.4B9F2WTM087571@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Michael Gmelin Subject: git: 9e46f71b468d - main - net/rinetd: Downgrade to 0.62, take maintainership List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-all@freebsd.org Sender: owner-dev-commits-ports-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grembo X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e46f71b468dd8d6446d8960b818afbac5416d62 Auto-Submitted: auto-generated The branch main has been updated by grembo: URL: https://cgit.FreeBSD.org/ports/commit/?id=9e46f71b468dd8d6446d8960b818afbac5416d62 commit 9e46f71b468dd8d6446d8960b818afbac5416d62 Author: Michael Gmelin AuthorDate: 2024-12-09 13:57:13 +0000 Commit: Michael Gmelin CommitDate: 2024-12-09 15:01:57 +0000 net/rinetd: Downgrade to 0.62, take maintainership This fixes massive performance issues, but also loses IPv6 support. Updates will come back, once regressions have been corrected. PR: 281873 --- net/rinetd/Makefile | 22 ++-- net/rinetd/distinfo | 6 +- net/rinetd/files/patch-Makefile | 22 ++++ net/rinetd/files/patch-rinetd.c | 210 +++++++++++++++++++++++++++++++++ net/rinetd/files/patch-src_Makefile.am | 11 -- net/rinetd/files/patch-src_rinetd.c | 11 -- net/rinetd/pkg-plist | 3 - 7 files changed, 244 insertions(+), 41 deletions(-) diff --git a/net/rinetd/Makefile b/net/rinetd/Makefile index 0151bc1221c9..86ea7bda2bf0 100644 --- a/net/rinetd/Makefile +++ b/net/rinetd/Makefile @@ -1,24 +1,23 @@ PORTNAME= rinetd -PORTVERSION= 0.73 -PORTREVISION= 2 +PORTVERSION= 0.62 DISTVERSIONPREFIX= v +PORTEPOCH= 1 CATEGORIES= net -MAINTAINER= garga@FreeBSD.org +MAINTAINER= grembo@FreeBSD.org COMMENT= Simple TCP port redirector WWW= https://github.com/samhocevar/rinetd LICENSE= GPLv2 -USES= cpe dos2unix autoreconf +USES= cpe dos2unix USE_GITHUB= yes GH_ACCOUNT= samhocevar -GH_TAGNAME= d4e0a60 +GH_TAGNAME= 1c95abb27dbf3 USE_RC_SUBR= rinetd -GNU_CONFIGURE= yes -GNU_CONFIGURE_MANPREFIX= ${PREFIX}/share - +PLIST_FILES= sbin/rinetd \ + share/man/man8/rinetd.8.gz PORTDOCS= index.html OPTIONS_DEFINE= DOCS @@ -29,11 +28,8 @@ post-patch: -e "s,/usr(/sbin/rinetd),${PREFIX}\1," \ ${WRKSRC}/rinetd.8 @${REINPLACE_CMD} -E "s,(/etc/rinetd.conf),${PREFIX}\1," \ - ${WRKSRC}/src/rinetd.h - -post-install: - ${MV} ${STAGEDIR}${PREFIX}/etc/rinetd.conf \ - ${STAGEDIR}${PREFIX}/etc/rinetd.conf.sample + ${WRKSRC}/rinetd.c + @${REINPLACE_CMD} -e "s,cc ,${CC} ,g" ${WRKSRC}/Makefile post-install-DOCS-on: ${MKDIR} ${STAGEDIR}${DOCSDIR} diff --git a/net/rinetd/distinfo b/net/rinetd/distinfo index 7f43e7e364cf..40603a290e70 100644 --- a/net/rinetd/distinfo +++ b/net/rinetd/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1696686326 -SHA256 (samhocevar-rinetd-v0.73-d4e0a60_GH0.tar.gz) = 76eef19e0af8459c9434ac8ac0b58edac1bba353f5aaceb1d5f971fb3f6a3016 -SIZE (samhocevar-rinetd-v0.73-d4e0a60_GH0.tar.gz) = 45544 +TIMESTAMP = 1733754055 +SHA256 (samhocevar-rinetd-v0.62-1c95abb27dbf3_GH0.tar.gz) = 6567abbcad830004b32eed8e0e21c9fb28a7843bd2916f60ab5d289d1f3327fd +SIZE (samhocevar-rinetd-v0.62-1c95abb27dbf3_GH0.tar.gz) = 24036 diff --git a/net/rinetd/files/patch-Makefile b/net/rinetd/files/patch-Makefile new file mode 100644 index 000000000000..1d9797822e2d --- /dev/null +++ b/net/rinetd/files/patch-Makefile @@ -0,0 +1,22 @@ +--- Makefile.orig 2024-12-09 14:53:18 UTC ++++ Makefile +@@ -1,9 +1,14 @@ +-CFLAGS=-DLINUX -g ++CFLAGS+=-I. -DLINUX + +-rinetd: rinetd.o match.o +- gcc rinetd.o match.o -o rinetd ++all: rinetd + ++rinetd: rinetd.o match.o getopt.o ++ ${CC} ${CFLAGS} rinetd.o match.o getopt.o -o rinetd ++ ++getopt.o: ++ ${CC} ${CFLAGS} -c getopt.c ++ + install: rinetd +- install -m 700 rinetd /usr/sbin +- install -m 644 rinetd.8 /usr/man/man8 ++ install -s -m 755 rinetd ${DESTDIR}${PREFIX}/sbin ++ install -m 644 rinetd.8 ${DESTDIR}${PREFIX}/share/man/man8 + diff --git a/net/rinetd/files/patch-rinetd.c b/net/rinetd/files/patch-rinetd.c new file mode 100644 index 000000000000..11df38569ea4 --- /dev/null +++ b/net/rinetd/files/patch-rinetd.c @@ -0,0 +1,210 @@ +--- rinetd.c.orig 2024-12-09 14:53:18 UTC ++++ rinetd.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #define INVALID_SOCKET (-1) + #include + #endif /* WIN32 */ +@@ -94,6 +95,7 @@ void Sleep(long ms) + #include "match.h" + + SOCKET *seFds = 0; ++static int first_set = 0; + /* In network order, for network purposes */ + struct in_addr *seLocalAddrs = 0; + unsigned short *seLocalPorts = 0; +@@ -243,6 +245,7 @@ int main(int argc, char *argv[]) + signal(SIGHUP, hup); + #endif /* WIN32 */ + signal(SIGTERM, term); ++ setsid(); + initArrays(); + readConfiguration(); + RegisterPID(); +@@ -646,6 +649,7 @@ void readConfiguration(void) + } + } + } ++ fclose(in); + /* Open the log file */ + if (logFile) { + fclose(logFile); +@@ -750,15 +754,82 @@ void handleAccept(int i); + void openLocalFd(int se, int i); + int getAddress(char *host, struct in_addr *iaddr); + ++inline void poll_init_fds(struct pollfd *pfds, int size) { ++ int i; ++ ++ memset(pfds, 0, sizeof(struct pollfd) * size); ++ first_set = 1; ++ for(i = 0; i < size; i++) ++ pfds[i].fd = -1; ++} ++ ++inline int poll_set_fd(struct pollfd *pfds, int size, int count, ++ int fd, short int ev) { ++#ifdef _NEW_POLL_SET_FD ++ if(first_set) { ++ pfds[count].fd = fd; ++ pfds[count].events |= ev; ++ first_set = 0; ++ return 0; ++ } ++ if(pfds[count].fd != fd && !first_set) { ++ count++; ++ } ++ ++ pfds[count].fd = fd; ++ pfds[count].events |= ev; ++ ++ return count; ++#else ++ int i; ++ ++ for(i = 0; i < size; i++) { ++ if(pfds[i].fd == -1) { ++ pfds[i].fd = fd; ++ pfds[i].events |= ev; ++ count++; ++ break; ++ } ++ if(pfds[i].fd == fd) { ++ pfds[i].events |= ev; ++ break; ++ } ++ } ++ ++ return count; ++#endif ++} ++ ++int poll_fd_isset(struct pollfd *pfds, int nfds, int fd, short event) { ++ int i; ++ ++ for(i = 0; i < nfds; i++) { ++ if(pfds[i].fd == fd) ++ return pfds[i].revents & event; ++ } ++ ++ return 0; ++} ++ + void selectPass(void) { + int i; +- fd_set readfds, writefds; +- FD_ZERO(&readfds); +- FD_ZERO(&writefds); ++ int nfds = 0; ++ int total = 0; ++ static struct pollfd *pfds = NULL; ++ + /* Server sockets */ ++ total = seTotal + (coTotal * 2); ++ ++ if(!pfds) { ++ pfds = malloc(sizeof(struct pollfd) * total); ++ } ++ ++ poll_init_fds(pfds, total); ++ + for (i = 0; (i < seTotal); i++) { + if (seFds[i] != INVALID_SOCKET) { +- FD_SET(seFds[i], &readfds); ++ //FD_SET(seFds[i], &readfds) ++ nfds = poll_set_fd(pfds, total, nfds, seFds[i], POLLIN); + } + } + /* Connection sockets */ +@@ -768,35 +839,47 @@ void selectPass(void) { + } + if (coClosing[i]) { + if (!reClosed[i]) { +- FD_SET(reFds[i], &writefds); ++ //FD_SET(reFds[i], &writefds); ++ nfds = poll_set_fd(pfds, total, nfds, ++ reFds[i], POLLOUT); + } +- if (!loClosed[i]) { +- FD_SET(loFds[i], &writefds); +- } + } + /* Get more input if we have room for it */ + if ((!reClosed[i]) && (coInputRPos[i] < bufferSpace)) { +- FD_SET(reFds[i], &readfds); ++ //FD_SET(reFds[i], &readfds); ++ nfds = poll_set_fd(pfds, total, nfds, reFds[i], POLLIN); + } + /* Send more output if we have any */ + if ((!reClosed[i]) && (coOutputWPos[i] < coOutputRPos[i])) { +- FD_SET(reFds[i], &writefds); ++ //FD_SET(reFds[i], &writefds); ++ nfds = poll_set_fd(pfds, total, nfds, reFds[i], POLLOUT); + } ++ if (coClosing[i]) { ++ if (!loClosed[i]) { ++ //FD_SET(loFds[i], &writefds); ++ nfds = poll_set_fd(pfds, total, nfds, ++ loFds[i], POLLOUT); ++ } ++ } + /* Accept more output from the local + server if there's room */ + if ((!loClosed[i]) && (coOutputRPos[i] < bufferSpace)) { +- FD_SET(loFds[i], &readfds); ++ //FD_SET(loFds[i], &readfds); ++ nfds = poll_set_fd(pfds, total, nfds, loFds[i], POLLIN); + } + /* Send more input to the local server + if we have any */ + if ((!loClosed[i]) && (coInputWPos[i] < coInputRPos[i])) { +- FD_SET(loFds[i], &writefds); ++ //FD_SET(loFds[i], &writefds); ++ nfds = poll_set_fd(pfds, total, nfds, loFds[i], POLLOUT); + } + } +- select(maxfd + 1, &readfds, &writefds, 0, 0); ++ //select(maxfd + 1, &readfds, &writefds, 0, 0); ++ poll(pfds, nfds + 1, -1); + for (i = 0; (i < seTotal); i++) { + if (seFds[i] != -1) { +- if (FD_ISSET(seFds[i], &readfds)) { ++ //if (FD_ISSET(seFds[i], &readfds)) { ++ if (poll_fd_isset(pfds, nfds, seFds[i], POLLIN)) { + handleAccept(i); + } + } +@@ -806,22 +889,26 @@ void selectPass(void) { + continue; + } + if (!reClosed[i]) { +- if (FD_ISSET(reFds[i], &readfds)) { ++ //if (FD_ISSET(reFds[i], &readfds)) { ++ if (poll_fd_isset(pfds, nfds, reFds[i], POLLIN)) { + handleRemoteRead(i); + } + } + if (!reClosed[i]) { +- if (FD_ISSET(reFds[i], &writefds)) { ++ //if (FD_ISSET(reFds[i], &writefds)) { ++ if (poll_fd_isset(pfds, nfds, reFds[i], POLLOUT)) { + handleRemoteWrite(i); + } + } + if (!loClosed[i]) { +- if (FD_ISSET(loFds[i], &readfds)) { ++ //if (FD_ISSET(loFds[i], &readfds)) { ++ if (poll_fd_isset(pfds, nfds, loFds[i], POLLIN)) { + handleLocalRead(i); + } + } + if (!loClosed[i]) { +- if (FD_ISSET(loFds[i], &writefds)) { ++ //if (FD_ISSET(loFds[i], &writefds)) { ++ if (poll_fd_isset(pfds, nfds, loFds[i], POLLOUT)) { + handleLocalWrite(i); + } + } diff --git a/net/rinetd/files/patch-src_Makefile.am b/net/rinetd/files/patch-src_Makefile.am deleted file mode 100644 index 1ab42eb1cad7..000000000000 --- a/net/rinetd/files/patch-src_Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ ---- src/Makefile.am.orig 2023-10-07 16:13:36 UTC -+++ src/Makefile.am -@@ -18,7 +18,7 @@ parse.c: parse.peg - # _DARWIN_C_SOURCE is for NI_MAXHOST on OS X - # _XOPEN_SOURCE is for struct sigaction - # _GNU_SOURCE is for h_errno and gethostbyname-related macros --___rinetd_CFLAGS = -std=c99 -D_POSIX_C_SOURCE=200809L \ -+___rinetd_CFLAGS = -std=c99 \ - -D_XOPEN_SOURCE -D_GNU_SOURCE -D_DARWIN_C_SOURCE \ - -Wall -Wextra -Wwrite-strings - diff --git a/net/rinetd/files/patch-src_rinetd.c b/net/rinetd/files/patch-src_rinetd.c deleted file mode 100644 index 5f0ea6dc73b1..000000000000 --- a/net/rinetd/files/patch-src_rinetd.c +++ /dev/null @@ -1,11 +0,0 @@ ---- src/rinetd.c.orig 2023-10-07 16:13:36 UTC -+++ src/rinetd.c -@@ -927,7 +927,7 @@ RETSIGTYPE quit(int s) - - void registerPID(char const *pid_file_name) - { --#if defined(__linux__) -+#if defined(__linux__) || defined(__FreeBSD__) - FILE *pid_file = fopen(pid_file_name, "w"); - if (pid_file == NULL) { - /* non-fatal, non-Linux may lack /var/run... */ diff --git a/net/rinetd/pkg-plist b/net/rinetd/pkg-plist deleted file mode 100644 index 4942042aa806..000000000000 --- a/net/rinetd/pkg-plist +++ /dev/null @@ -1,3 +0,0 @@ -@sample etc/rinetd.conf.sample -sbin/rinetd -share/man/man8/rinetd.8.gz