From owner-dev-commits-src-all@freebsd.org Mon May 3 00:09:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E1445FEEFC; Mon, 3 May 2021 00:09:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYNcY3ghWz3k3l; Mon, 3 May 2021 00:09:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 71126146BD; Mon, 3 May 2021 00:09:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14309199026290; Mon, 3 May 2021 00:09:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143091LA026289; Mon, 3 May 2021 00:09:01 GMT (envelope-from git) Date: Mon, 3 May 2021 00:09:01 GMT Message-Id: <202105030009.143091LA026289@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 655c200cc891 - main - Fix build after 5f2e1835054ee84f2e68ebc890d92716a91775b7. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 655c200cc89185c940bc7d5724be09a0f2e1a8a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 00:09:01 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=655c200cc89185c940bc7d5724be09a0f2e1a8a6 commit 655c200cc89185c940bc7d5724be09a0f2e1a8a6 Author: Alexander Motin AuthorDate: 2021-05-03 00:07:38 +0000 Commit: Alexander Motin CommitDate: 2021-05-03 00:07:38 +0000 Fix build after 5f2e1835054ee84f2e68ebc890d92716a91775b7. --- sys/netinet/sctp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 072322ea074a..10e1c37c6cfb 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -1534,7 +1534,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, break; } /* end switch */ sctp_stop_all_cookie_timers(stcb); - if ((ret = sctp_load_addresses_from_init(stcb, m, + if ((retval = sctp_load_addresses_from_init(stcb, m, init_offset + sizeof(struct sctp_init_chunk), initack_offset, src, dst, init_src, stcb->asoc.port)) < 0) { if (how_indx < sizeof(asoc->cookie_how)) From owner-dev-commits-src-all@freebsd.org Mon May 3 00:22:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4EC075FF8AF; Mon, 3 May 2021 00:22:56 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYNwc1mW1z3kkM; Mon, 3 May 2021 00:22:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2F89614AE2; Mon, 3 May 2021 00:22:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1430Mu23052385; Mon, 3 May 2021 00:22:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1430MukB052384; Mon, 3 May 2021 00:22:56 GMT (envelope-from git) Date: Mon, 3 May 2021 00:22:56 GMT Message-Id: <202105030022.1430MukB052384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: a89481d328fd - main - sctp: improve restart handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a89481d328fd96ccbfa642e1db6d03825fa1dc6d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 00:22:56 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=a89481d328fd96ccbfa642e1db6d03825fa1dc6d commit a89481d328fd96ccbfa642e1db6d03825fa1dc6d Author: Michael Tuexen AuthorDate: 2021-05-03 00:20:24 +0000 Commit: Michael Tuexen CommitDate: 2021-05-03 00:20:24 +0000 sctp: improve restart handling This fixes in particular a possible use after free bug reported Anatoly Korniltsev and Taylor Brandstetter for the userland stack. MFC after: 3 days --- sys/netinet/sctp_input.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 10e1c37c6cfb..b6fe6449bc21 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -1761,11 +1761,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, /* temp code */ if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 12; - sctp_timer_stop(SCTP_TIMER_TYPE_INIT, inp, stcb, net, - SCTP_FROM_SCTP_INPUT + SCTP_LOC_16); - sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net, - SCTP_FROM_SCTP_INPUT + SCTP_LOC_17); - + sctp_stop_association_timers(stcb, false); /* notify upper layer */ *notification = SCTP_NOTIFY_ASSOC_RESTART; atomic_add_int(&stcb->asoc.refcnt, 1); @@ -1798,6 +1794,10 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, asoc->str_reset_seq_in = asoc->init_seq_number; asoc->advanced_peer_ack_point = asoc->last_acked_seq; asoc->send_sack = 1; + asoc->data_pkts_seen = 0; + asoc->last_data_chunk_from = NULL; + asoc->last_control_chunk_from = NULL; + asoc->last_net_cmt_send_started = NULL; if (asoc->mapping_array) { memset(asoc->mapping_array, 0, asoc->mapping_array_size); @@ -1858,6 +1858,9 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk); SCTP_DECR_CHK_COUNT(); } + asoc->ctrl_queue_cnt = 0; + asoc->str_reset = NULL; + asoc->stream_reset_outstanding = 0; TAILQ_FOREACH_SAFE(chk, &asoc->asconf_send_queue, sctp_next, nchk) { TAILQ_REMOVE(&asoc->asconf_send_queue, chk, sctp_next); if (chk->data) { @@ -1937,12 +1940,13 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, return (NULL); } /* respond with a COOKIE-ACK */ - sctp_stop_all_cookie_timers(stcb); - sctp_toss_old_cookies(stcb, asoc); sctp_send_cookie_ack(stcb); if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 15; - + if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE) && + (asoc->sctp_autoclose_ticks > 0)) { + sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL); + } return (stcb); } if (how_indx < sizeof(asoc->cookie_how)) From owner-dev-commits-src-all@freebsd.org Mon May 3 00:53:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB9BA62227F; Mon, 3 May 2021 00:53:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYPbK4ybMz3mcv; Mon, 3 May 2021 00:53:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9C8CC151C1; Mon, 3 May 2021 00:53:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1430r1Aq091724; Mon, 3 May 2021 00:53:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1430r1gn091723; Mon, 3 May 2021 00:53:01 GMT (envelope-from git) Date: Mon, 3 May 2021 00:53:01 GMT Message-Id: <202105030053.1430r1gn091723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 8b3d0f6439fa - main - sctp: improve address list scanning MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b3d0f6439fa27f0d37a9a7b9d27bbfdfdf487c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 00:53:01 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=8b3d0f6439fa27f0d37a9a7b9d27bbfdfdf487c4 commit 8b3d0f6439fa27f0d37a9a7b9d27bbfdfdf487c4 Author: Michael Tuexen AuthorDate: 2021-05-03 00:50:05 +0000 Commit: Michael Tuexen CommitDate: 2021-05-03 00:50:05 +0000 sctp: improve address list scanning If the alternate address has to be removed, force the stack to find a new one, if it is still needed. MFC after: 3 days --- sys/netinet/sctp_pcb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index f4264ab387f1..08acccbf9185 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -6562,11 +6562,15 @@ next_param: /* remove and free it */ stcb->asoc.numnets--; TAILQ_REMOVE(&stcb->asoc.nets, net, sctp_next); - sctp_free_remote_addr(net); + if (net == stcb->asoc.alternate) { + sctp_free_remote_addr(stcb->asoc.alternate); + stcb->asoc.alternate = NULL; + } if (net == stcb->asoc.primary_destination) { stcb->asoc.primary_destination = NULL; sctp_select_primary_destination(stcb); } + sctp_free_remote_addr(net); } } if ((stcb->asoc.ecn_supported == 1) && From owner-dev-commits-src-all@freebsd.org Mon May 3 01:38:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03BAB62358F; Mon, 3 May 2021 01:38:39 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYQby6kNhz3nrD; Mon, 3 May 2021 01:38:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D8D2A157CB; Mon, 3 May 2021 01:38:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1431cc1b045309; Mon, 3 May 2021 01:38:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1431ccX9045308; Mon, 3 May 2021 01:38:38 GMT (envelope-from git) Date: Mon, 3 May 2021 01:38:38 GMT Message-Id: <202105030138.1431ccX9045308@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 46ec1227e793 - stable/13 - connectat(2): clarify that the s argument is socket MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 46ec1227e793af8c47c1ad2937c4c955883f529e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 01:38:39 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=46ec1227e793af8c47c1ad2937c4c955883f529e commit 46ec1227e793af8c47c1ad2937c4c955883f529e Author: Konstantin Belousov AuthorDate: 2021-04-28 15:47:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 01:26:50 +0000 connectat(2): clarify that the s argument is socket (cherry picked from commit 07f229d20c0cd6285c5ddf1df45eb69bbea4445b) --- lib/libc/sys/connectat.2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/connectat.2 b/lib/libc/sys/connectat.2 index 1d7e740b89c4..3b90baa0b6f2 100644 --- a/lib/libc/sys/connectat.2 +++ b/lib/libc/sys/connectat.2 @@ -45,7 +45,8 @@ .Sh DESCRIPTION The .Fn connectat -system call initiates a connection on a socket. +system call initiates a connection on the socket +.Fa s . When passed the special value .Dv AT_FDCWD in the From owner-dev-commits-src-all@freebsd.org Mon May 3 01:38:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 373FC623059; Mon, 3 May 2021 01:38:40 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYQc00fVGz3pJp; Mon, 3 May 2021 01:38:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F0C6E157CC; Mon, 3 May 2021 01:38:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1431cdiR045337; Mon, 3 May 2021 01:38:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1431cdbC045336; Mon, 3 May 2021 01:38:39 GMT (envelope-from git) Date: Mon, 3 May 2021 01:38:39 GMT Message-Id: <202105030138.1431cdbC045336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: dd93a6270db3 - stable/13 - O_PATH: disable kqfilter for fifos MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dd93a6270db30ca9ff07a108b0173368c8bf97e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 01:38:40 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dd93a6270db30ca9ff07a108b0173368c8bf97e3 commit dd93a6270db30ca9ff07a108b0173368c8bf97e3 Author: Konstantin Belousov AuthorDate: 2021-04-28 15:45:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 01:27:05 +0000 O_PATH: disable kqfilter for fifos (cherry picked from commit 2082565798041ceb9fb77137f00ea6b0ff50fe5e) --- sys/kern/vfs_vnops.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index f715c9828d04..832c717a33b7 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -427,7 +427,10 @@ vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred, return (error); } if ((fmode & O_PATH) != 0) { - error = VOP_ACCESS(vp, VREAD, cred, td); + if (vp->v_type == VFIFO) + error = EPIPE; + else + error = VOP_ACCESS(vp, VREAD, cred, td); if (error == 0) fp->f_flag |= FKQALLOWED; return (0); From owner-dev-commits-src-all@freebsd.org Mon May 3 01:38:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8071E6230E0; Mon, 3 May 2021 01:38:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYQc11NKNz3pQ0; Mon, 3 May 2021 01:38:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 21812158C9; Mon, 3 May 2021 01:38:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1431cfa6045358; Mon, 3 May 2021 01:38:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1431cfj4045357; Mon, 3 May 2021 01:38:41 GMT (envelope-from git) Date: Mon, 3 May 2021 01:38:41 GMT Message-Id: <202105030138.1431cfj4045357@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: df6241fcef9a - stable/13 - amd64: disable LA57 by default for now MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: df6241fcef9a8df76839caeaef61520d5f3a7925 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 01:38:41 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=df6241fcef9a8df76839caeaef61520d5f3a7925 commit df6241fcef9a8df76839caeaef61520d5f3a7925 Author: Konstantin Belousov AuthorDate: 2021-04-28 15:50:16 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 01:27:22 +0000 amd64: disable LA57 by default for now (cherry picked from commit 72a42ec63b4a98f812f5f6164415eeb9a55e1933) --- sys/amd64/amd64/pmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 54dbadfb95c3..1fb81384f11e 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2015,8 +2015,7 @@ pmap_bootstrap_la57(void *arg __unused) if ((cpu_stdext_feature2 & CPUID_STDEXT2_LA57) == 0) return; - if (!TUNABLE_INT_FETCH("vm.pmap.la57", &la57)) - la57 = 1; + TUNABLE_INT_FETCH("vm.pmap.la57", &la57); if (!la57) return; From owner-dev-commits-src-all@freebsd.org Mon May 3 01:39:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 643FC62362B; Mon, 3 May 2021 01:39:47 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYQdH2PjCz3pSW; Mon, 3 May 2021 01:39:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 454F615A0A; Mon, 3 May 2021 01:39:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1431dlOG045595; Mon, 3 May 2021 01:39:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1431dlFx045594; Mon, 3 May 2021 01:39:47 GMT (envelope-from git) Date: Mon, 3 May 2021 01:39:47 GMT Message-Id: <202105030139.1431dlFx045594@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 8559a014cd43 - stable/12 - connectat(2): clarify that the s argument is socket MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8559a014cd43399c4b6731d3adca7684dbe468c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 01:39:47 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8559a014cd43399c4b6731d3adca7684dbe468c1 commit 8559a014cd43399c4b6731d3adca7684dbe468c1 Author: Konstantin Belousov AuthorDate: 2021-04-28 15:47:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 01:39:27 +0000 connectat(2): clarify that the s argument is socket (cherry picked from commit 07f229d20c0cd6285c5ddf1df45eb69bbea4445b) --- lib/libc/sys/connectat.2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/connectat.2 b/lib/libc/sys/connectat.2 index 1d7e740b89c4..3b90baa0b6f2 100644 --- a/lib/libc/sys/connectat.2 +++ b/lib/libc/sys/connectat.2 @@ -45,7 +45,8 @@ .Sh DESCRIPTION The .Fn connectat -system call initiates a connection on a socket. +system call initiates a connection on the socket +.Fa s . When passed the special value .Dv AT_FDCWD in the From owner-dev-commits-src-all@freebsd.org Mon May 3 02:32:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B46686248EF; Mon, 3 May 2021 02:32:45 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYRpP4gFfz3rXb; Mon, 3 May 2021 02:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 932501669F; Mon, 3 May 2021 02:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1432Wjvr024376; Mon, 3 May 2021 02:32:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1432WjTq024374; Mon, 3 May 2021 02:32:45 GMT (envelope-from git) Date: Mon, 3 May 2021 02:32:45 GMT Message-Id: <202105030232.1432WjTq024374@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: f886c2a0aa7b - stable/13 - e1000: Add support for [Tiger, Alder, Meteor] Lake MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f886c2a0aa7befe3e030f7b4dc5af7758c6573fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 02:32:45 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f886c2a0aa7befe3e030f7b4dc5af7758c6573fd commit f886c2a0aa7befe3e030f7b4dc5af7758c6573fd Author: Kevin Bowling AuthorDate: 2021-04-19 02:11:27 +0000 Commit: Kevin Bowling CommitDate: 2021-05-03 02:31:29 +0000 e1000: Add support for [Tiger, Alder, Meteor] Lake Add support for current and future client platform PCI IDs. These are all I219 variants and have no known driver changes versus previous generation client platform I219 variants. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29801 (cherry picked from commit 59690eab572dde1176886bff7ed0c506df974e5e) --- sys/dev/e1000/e1000_api.c | 23 +++++++++++++++++++++++ sys/dev/e1000/e1000_hw.h | 17 +++++++++++++++++ sys/dev/e1000/e1000_ich8lan.c | 21 +++++++++++++++++++++ sys/dev/e1000/if_em.c | 23 +++++++++++++++++++++++ 4 files changed, 84 insertions(+) diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index 4f860166aba4..b1d5ef74c24f 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -327,6 +327,26 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_PCH_CMP_I219_V11: mac->type = e1000_pch_cnp; break; + case E1000_DEV_ID_PCH_TGP_I219_LM13: + case E1000_DEV_ID_PCH_TGP_I219_V13: + case E1000_DEV_ID_PCH_TGP_I219_LM14: + case E1000_DEV_ID_PCH_TGP_I219_V14: + case E1000_DEV_ID_PCH_TGP_I219_LM15: + case E1000_DEV_ID_PCH_TGP_I219_V15: + mac->type = e1000_pch_tgp; + break; + case E1000_DEV_ID_PCH_ADL_I219_LM16: + case E1000_DEV_ID_PCH_ADL_I219_V16: + case E1000_DEV_ID_PCH_ADL_I219_LM17: + case E1000_DEV_ID_PCH_ADL_I219_V17: + mac->type = e1000_pch_adp; + break; + case E1000_DEV_ID_PCH_MTP_I219_LM18: + case E1000_DEV_ID_PCH_MTP_I219_V18: + case E1000_DEV_ID_PCH_MTP_I219_LM19: + case E1000_DEV_ID_PCH_MTP_I219_V19: + mac->type = e1000_pch_mtp; + break; case E1000_DEV_ID_82575EB_COPPER: case E1000_DEV_ID_82575EB_FIBER_SERDES: case E1000_DEV_ID_82575GB_QUAD_COPPER: @@ -479,6 +499,9 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: e1000_init_function_pointers_ich8lan(hw); break; case e1000_82575: diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index f521c2c8c5e6..b3eb1641cca9 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -161,6 +161,20 @@ struct e1000_hw; #define E1000_DEV_ID_PCH_CMP_I219_V11 0x0D4D #define E1000_DEV_ID_PCH_CMP_I219_LM12 0x0D53 #define E1000_DEV_ID_PCH_CMP_I219_V12 0x0D55 +#define E1000_DEV_ID_PCH_TGP_I219_LM13 0x15FB +#define E1000_DEV_ID_PCH_TGP_I219_V13 0x15FC +#define E1000_DEV_ID_PCH_TGP_I219_LM14 0x15F9 +#define E1000_DEV_ID_PCH_TGP_I219_V14 0x15FA +#define E1000_DEV_ID_PCH_TGP_I219_LM15 0x15F4 +#define E1000_DEV_ID_PCH_TGP_I219_V15 0x15F5 +#define E1000_DEV_ID_PCH_ADL_I219_LM16 0x1A1E +#define E1000_DEV_ID_PCH_ADL_I219_V16 0x1A1F +#define E1000_DEV_ID_PCH_ADL_I219_LM17 0x1A1C +#define E1000_DEV_ID_PCH_ADL_I219_V17 0x1A1D +#define E1000_DEV_ID_PCH_MTP_I219_LM18 0x550A +#define E1000_DEV_ID_PCH_MTP_I219_V18 0x550B +#define E1000_DEV_ID_PCH_MTP_I219_LM19 0x550C +#define E1000_DEV_ID_PCH_MTP_I219_V19 0x550D #define E1000_DEV_ID_82576 0x10C9 #define E1000_DEV_ID_82576_FIBER 0x10E6 #define E1000_DEV_ID_82576_SERDES 0x10E7 @@ -248,6 +262,9 @@ enum e1000_mac_type { e1000_pch_lpt, e1000_pch_spt, e1000_pch_cnp, + e1000_pch_tgp, + e1000_pch_adp, + e1000_pch_mtp, e1000_82575, e1000_82576, e1000_82580, diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index b4f8b6a2b694..b798bacb37a0 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -346,6 +346,9 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: if (e1000_phy_is_accessible_pchlan(hw)) break; @@ -495,6 +498,9 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: /* In case the PHY needs to be in mdio slow mode, * set slow mode and try to get the PHY id again. */ @@ -794,6 +800,9 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: /* multicast address update for pch2 */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_pch2lan; @@ -1832,6 +1841,9 @@ void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: hw->phy.ops.init_params = e1000_init_phy_params_pchlan; break; default: @@ -2288,6 +2300,9 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; break; default: @@ -3408,6 +3423,9 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) switch (hw->mac.type) { case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: bank1_offset = nvm->flash_bank_size; act_offset = E1000_ICH_NVM_SIG_WORD; @@ -4377,6 +4395,9 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: word = NVM_COMPAT; valid_csum_mask = NVM_COMPAT_VALID_CSUM; break; diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 25236bf9cb79..5ac050382ab1 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -180,6 +180,20 @@ static pci_vendor_info_t em_vendor_info_array[] = PVID(0x8086, E1000_DEV_ID_PCH_CMP_I219_V11, "Intel(R) PRO/1000 Network Connection"), PVID(0x8086, E1000_DEV_ID_PCH_CMP_I219_LM12, "Intel(R) PRO/1000 Network Connection"), PVID(0x8086, E1000_DEV_ID_PCH_CMP_I219_V12, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_LM13, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_V13, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_LM14, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_V14, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_LM15, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_V15, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_ADL_I219_LM16, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_ADL_I219_V16, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_ADL_I219_LM17, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_ADL_I219_V17, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_LM18, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_V18, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_LM19, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_V19, "Intel(R) PRO/1000 Network Connection"), /* required last entry */ PVID_END }; @@ -1219,6 +1233,9 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: case e1000_82574: case e1000_82583: case e1000_80003es2lan: @@ -2514,6 +2531,9 @@ em_reset(if_ctx_t ctx) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: pba = E1000_PBA_26K; break; case e1000_82575: @@ -2623,6 +2643,9 @@ em_reset(if_ctx_t ctx) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: hw->fc.high_water = 0x5C20; hw->fc.low_water = 0x5048; hw->fc.pause_time = 0x0650; From owner-dev-commits-src-all@freebsd.org Mon May 3 02:32:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0AFFD624CA0; Mon, 3 May 2021 02:32:47 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYRpQ6FYZz3rjN; Mon, 3 May 2021 02:32:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B8961166A0; Mon, 3 May 2021 02:32:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1432WkOK024398; Mon, 3 May 2021 02:32:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1432Wk91024397; Mon, 3 May 2021 02:32:46 GMT (envelope-from git) Date: Mon, 3 May 2021 02:32:46 GMT Message-Id: <202105030232.1432Wk91024397@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: bbe0f3fbc67c - stable/13 - e1000: Fix register name in reg_dump sysctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bbe0f3fbc67c586bd9b8d11b14f7aa2c710931a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 02:32:47 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=bbe0f3fbc67c586bd9b8d11b14f7aa2c710931a0 commit bbe0f3fbc67c586bd9b8d11b14f7aa2c710931a0 Author: Kevin Bowling AuthorDate: 2021-04-26 16:30:54 +0000 Commit: Kevin Bowling CommitDate: 2021-05-03 02:31:30 +0000 e1000: Fix register name in reg_dump sysctl The correct name of this register is CTRL_EXT. Approved by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29967 (cherry picked from commit ba7b31b3e967a57c0269330d4e5aacf541d1b479) --- sys/dev/e1000/if_em.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 5ac050382ab1..27f498cd3d46 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -654,7 +654,7 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS) sbuf_printf(sb, "General Registers\n"); sbuf_printf(sb, "\tCTRL\t %08x\n", regs_buff[0]); sbuf_printf(sb, "\tSTATUS\t %08x\n", regs_buff[1]); - sbuf_printf(sb, "\tCTRL_EXIT\t %08x\n\n", regs_buff[2]); + sbuf_printf(sb, "\tCTRL_EXT\t %08x\n\n", regs_buff[2]); sbuf_printf(sb, "Interrupt Registers\n"); sbuf_printf(sb, "\tICR\t %08x\n\n", regs_buff[3]); From owner-dev-commits-src-all@freebsd.org Mon May 3 02:36:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67621624B77; Mon, 3 May 2021 02:36:07 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYRtH2Vd5z3rvS; Mon, 3 May 2021 02:36:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 48B12164A3; Mon, 3 May 2021 02:36:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1432a7qA024890; Mon, 3 May 2021 02:36:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1432a73D024889; Mon, 3 May 2021 02:36:07 GMT (envelope-from git) Date: Mon, 3 May 2021 02:36:07 GMT Message-Id: <202105030236.1432a73D024889@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: c9c1838988fa - stable/12 - e1000: Add support for [Tiger, Alder, Meteor] Lake MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c9c1838988faa8bcb74af30384ab45a483562727 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 02:36:07 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c9c1838988faa8bcb74af30384ab45a483562727 commit c9c1838988faa8bcb74af30384ab45a483562727 Author: Kevin Bowling AuthorDate: 2021-04-19 02:11:27 +0000 Commit: Kevin Bowling CommitDate: 2021-05-03 02:34:57 +0000 e1000: Add support for [Tiger, Alder, Meteor] Lake Add support for current and future client platform PCI IDs. These are all I219 variants and have no known driver changes versus previous generation client platform I219 variants. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29801 (cherry picked from commit 59690eab572dde1176886bff7ed0c506df974e5e) --- sys/dev/e1000/e1000_api.c | 23 +++++++++++++++++++++++ sys/dev/e1000/e1000_hw.h | 17 +++++++++++++++++ sys/dev/e1000/e1000_ich8lan.c | 21 +++++++++++++++++++++ sys/dev/e1000/if_em.c | 23 +++++++++++++++++++++++ 4 files changed, 84 insertions(+) diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index 4f860166aba4..b1d5ef74c24f 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -327,6 +327,26 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_PCH_CMP_I219_V11: mac->type = e1000_pch_cnp; break; + case E1000_DEV_ID_PCH_TGP_I219_LM13: + case E1000_DEV_ID_PCH_TGP_I219_V13: + case E1000_DEV_ID_PCH_TGP_I219_LM14: + case E1000_DEV_ID_PCH_TGP_I219_V14: + case E1000_DEV_ID_PCH_TGP_I219_LM15: + case E1000_DEV_ID_PCH_TGP_I219_V15: + mac->type = e1000_pch_tgp; + break; + case E1000_DEV_ID_PCH_ADL_I219_LM16: + case E1000_DEV_ID_PCH_ADL_I219_V16: + case E1000_DEV_ID_PCH_ADL_I219_LM17: + case E1000_DEV_ID_PCH_ADL_I219_V17: + mac->type = e1000_pch_adp; + break; + case E1000_DEV_ID_PCH_MTP_I219_LM18: + case E1000_DEV_ID_PCH_MTP_I219_V18: + case E1000_DEV_ID_PCH_MTP_I219_LM19: + case E1000_DEV_ID_PCH_MTP_I219_V19: + mac->type = e1000_pch_mtp; + break; case E1000_DEV_ID_82575EB_COPPER: case E1000_DEV_ID_82575EB_FIBER_SERDES: case E1000_DEV_ID_82575GB_QUAD_COPPER: @@ -479,6 +499,9 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: e1000_init_function_pointers_ich8lan(hw); break; case e1000_82575: diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index 42b35c4637aa..0a616786e954 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -161,6 +161,20 @@ struct e1000_hw; #define E1000_DEV_ID_PCH_CMP_I219_V11 0x0D4D #define E1000_DEV_ID_PCH_CMP_I219_LM12 0x0D53 #define E1000_DEV_ID_PCH_CMP_I219_V12 0x0D55 +#define E1000_DEV_ID_PCH_TGP_I219_LM13 0x15FB +#define E1000_DEV_ID_PCH_TGP_I219_V13 0x15FC +#define E1000_DEV_ID_PCH_TGP_I219_LM14 0x15F9 +#define E1000_DEV_ID_PCH_TGP_I219_V14 0x15FA +#define E1000_DEV_ID_PCH_TGP_I219_LM15 0x15F4 +#define E1000_DEV_ID_PCH_TGP_I219_V15 0x15F5 +#define E1000_DEV_ID_PCH_ADL_I219_LM16 0x1A1E +#define E1000_DEV_ID_PCH_ADL_I219_V16 0x1A1F +#define E1000_DEV_ID_PCH_ADL_I219_LM17 0x1A1C +#define E1000_DEV_ID_PCH_ADL_I219_V17 0x1A1D +#define E1000_DEV_ID_PCH_MTP_I219_LM18 0x550A +#define E1000_DEV_ID_PCH_MTP_I219_V18 0x550B +#define E1000_DEV_ID_PCH_MTP_I219_LM19 0x550C +#define E1000_DEV_ID_PCH_MTP_I219_V19 0x550D #define E1000_DEV_ID_82576 0x10C9 #define E1000_DEV_ID_82576_FIBER 0x10E6 #define E1000_DEV_ID_82576_SERDES 0x10E7 @@ -248,6 +262,9 @@ enum e1000_mac_type { e1000_pch_lpt, e1000_pch_spt, e1000_pch_cnp, + e1000_pch_tgp, + e1000_pch_adp, + e1000_pch_mtp, e1000_82575, e1000_82576, e1000_82580, diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 53d8506054cc..3b480d1d25d1 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -346,6 +346,9 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: if (e1000_phy_is_accessible_pchlan(hw)) break; @@ -495,6 +498,9 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: /* In case the PHY needs to be in mdio slow mode, * set slow mode and try to get the PHY id again. */ @@ -794,6 +800,9 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: /* multicast address update for pch2 */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_pch2lan; @@ -1832,6 +1841,9 @@ void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: hw->phy.ops.init_params = e1000_init_phy_params_pchlan; break; default: @@ -2288,6 +2300,9 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; break; default: @@ -3408,6 +3423,9 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) switch (hw->mac.type) { case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: bank1_offset = nvm->flash_bank_size; act_offset = E1000_ICH_NVM_SIG_WORD; @@ -4377,6 +4395,9 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: word = NVM_COMPAT; valid_csum_mask = NVM_COMPAT_VALID_CSUM; break; diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 2d0f65b34144..79a9d8fdcfe9 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -180,6 +180,20 @@ static pci_vendor_info_t em_vendor_info_array[] = PVID(0x8086, E1000_DEV_ID_PCH_CMP_I219_V11, "Intel(R) PRO/1000 Network Connection"), PVID(0x8086, E1000_DEV_ID_PCH_CMP_I219_LM12, "Intel(R) PRO/1000 Network Connection"), PVID(0x8086, E1000_DEV_ID_PCH_CMP_I219_V12, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_LM13, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_V13, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_LM14, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_V14, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_LM15, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_TGP_I219_V15, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_ADL_I219_LM16, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_ADL_I219_V16, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_ADL_I219_LM17, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_ADL_I219_V17, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_LM18, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_V18, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_LM19, "Intel(R) PRO/1000 Network Connection"), + PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_V19, "Intel(R) PRO/1000 Network Connection"), /* required last entry */ PVID_END }; @@ -1222,6 +1236,9 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: case e1000_82574: case e1000_82583: case e1000_80003es2lan: @@ -2504,6 +2521,9 @@ em_reset(if_ctx_t ctx) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: pba = E1000_PBA_26K; break; case e1000_82575: @@ -2613,6 +2633,9 @@ em_reset(if_ctx_t ctx) case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: hw->fc.high_water = 0x5C20; hw->fc.low_water = 0x5048; hw->fc.pause_time = 0x0650; From owner-dev-commits-src-all@freebsd.org Mon May 3 02:36:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 850F0624A78; Mon, 3 May 2021 02:36:08 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYRtJ37vHz3rsF; Mon, 3 May 2021 02:36:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5D3A7166A2; Mon, 3 May 2021 02:36:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1432a8i7024911; Mon, 3 May 2021 02:36:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1432a8Pw024910; Mon, 3 May 2021 02:36:08 GMT (envelope-from git) Date: Mon, 3 May 2021 02:36:08 GMT Message-Id: <202105030236.1432a8Pw024910@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: d7d72459f2cd - stable/12 - e1000: Fix register name in reg_dump sysctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d7d72459f2cd5ef40683f05f6c6c23bf2a13718a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 02:36:08 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d7d72459f2cd5ef40683f05f6c6c23bf2a13718a commit d7d72459f2cd5ef40683f05f6c6c23bf2a13718a Author: Kevin Bowling AuthorDate: 2021-04-26 16:30:54 +0000 Commit: Kevin Bowling CommitDate: 2021-05-03 02:35:01 +0000 e1000: Fix register name in reg_dump sysctl The correct name of this register is CTRL_EXT. Approved by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29967 (cherry picked from commit ba7b31b3e967a57c0269330d4e5aacf541d1b479) --- sys/dev/e1000/if_em.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 79a9d8fdcfe9..32c07f05dec8 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -657,7 +657,7 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS) sbuf_printf(sb, "General Registers\n"); sbuf_printf(sb, "\tCTRL\t %08x\n", regs_buff[0]); sbuf_printf(sb, "\tSTATUS\t %08x\n", regs_buff[1]); - sbuf_printf(sb, "\tCTRL_EXIT\t %08x\n\n", regs_buff[2]); + sbuf_printf(sb, "\tCTRL_EXT\t %08x\n\n", regs_buff[2]); sbuf_printf(sb, "Interrupt Registers\n"); sbuf_printf(sb, "\tICR\t %08x\n\n", regs_buff[3]); From owner-dev-commits-src-all@freebsd.org Mon May 3 06:46:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83054628979; Mon, 3 May 2021 06:46:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYYRV3KlCz4W8W; Mon, 3 May 2021 06:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 64CDC19AD0; Mon, 3 May 2021 06:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1436kk5f056685; Mon, 3 May 2021 06:46:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1436kkBY056684; Mon, 3 May 2021 06:46:46 GMT (envelope-from git) Date: Mon, 3 May 2021 06:46:46 GMT Message-Id: <202105030646.1436kkBY056684@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 573bd33a33b6 - main - stress2: Fix a typo. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 573bd33a33b6b38724c9c986355452a6d23583e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 06:46:46 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=573bd33a33b6b38724c9c986355452a6d23583e5 commit 573bd33a33b6b38724c9c986355452a6d23583e5 Author: Peter Holm AuthorDate: 2021-05-03 06:45:55 +0000 Commit: Peter Holm CommitDate: 2021-05-03 06:45:55 +0000 stress2: Fix a typo. --- tools/test/stress2/misc/syzkaller33.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test/stress2/misc/syzkaller33.sh b/tools/test/stress2/misc/syzkaller33.sh index c416d0cde1e4..746cecbffaab 100755 --- a/tools/test/stress2/misc/syzkaller33.sh +++ b/tools/test/stress2/misc/syzkaller33.sh @@ -38,7 +38,7 @@ [ `uname -p` != "amd64" ] && exit 0 -../default.cfg +. ../default.cfg cat > /tmp/syzkaller33.c < Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FA686292E7; Mon, 3 May 2021 07:06:05 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYYsn2Gwjz4WPx; Mon, 3 May 2021 07:06:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3C8FD1986E; Mon, 3 May 2021 07:06:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143765Zs083317; Mon, 3 May 2021 07:06:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143765RF083316; Mon, 3 May 2021 07:06:05 GMT (envelope-from git) Date: Mon, 3 May 2021 07:06:05 GMT Message-Id: <202105030706.143765RF083316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: a7d46ad08709 - main - stress2: Added a syzkaller reproducer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7d46ad0870987c2fdf93a30507f61ca8d82babe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 07:06:05 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=a7d46ad0870987c2fdf93a30507f61ca8d82babe commit a7d46ad0870987c2fdf93a30507f61ca8d82babe Author: Peter Holm AuthorDate: 2021-05-03 07:05:32 +0000 Commit: Peter Holm CommitDate: 2021-05-03 07:05:32 +0000 stress2: Added a syzkaller reproducer --- tools/test/stress2/misc/syzkaller34.sh | 119 +++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/tools/test/stress2/misc/syzkaller34.sh b/tools/test/stress2/misc/syzkaller34.sh new file mode 100755 index 000000000000..c426fef129b1 --- /dev/null +++ b/tools/test/stress2/misc/syzkaller34.sh @@ -0,0 +1,119 @@ +#!/bin/sh + +# Fixed by git: 208256579804 - main - O_PATH: disable kqfilter for fifos +# Submitted by markj@ + +[ `uname -p` != "amd64" ] && exit 0 + +. ../default.cfg +cat > /tmp/syzkaller34.c < + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void kill_and_wait(int pid, int* status) +{ + kill(pid, SIGKILL); + while (waitpid(-1, status, 0) != pid) { + } +} + +static void sleep_ms(uint64_t ms) +{ + usleep(ms * 1000); +} + +static uint64_t current_time_ms(void) +{ + struct timespec ts; + if (clock_gettime(CLOCK_MONOTONIC, &ts)) + exit(1); + return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; +} + +static void execute_one(void); + +#define WAIT_FLAGS 0 + +static void loop(void) +{ + int iter = 0; + for (;; iter++) { + int pid = fork(); + if (pid < 0) + exit(1); + if (pid == 0) { + execute_one(); + exit(0); + } + int status = 0; + uint64_t start = current_time_ms(); + for (;;) { + if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) + break; + sleep_ms(1); + if (current_time_ms() - start < 5000) { + continue; + } + kill_and_wait(pid, &status); + break; + } + } +} + +uint64_t r[1] = {0xffffffffffffffff}; + +void execute_one(void) +{ + intptr_t res = 0; + memcpy((void*)0x20000000, "./file0\000", 8); + syscall(SYS_mknodat, 0xffffff9c, 0x20000000ul, 0x1000ul, 0ul); + memcpy((void*)0x20000040, "./file0\000", 8); + syscall(SYS_open, 0x20000040ul, 0x400000ul, 0x72ul); + res = syscall(SYS_kqueue); + if (res != -1) + r[0] = res; + *(uint64_t*)0x20000100 = 3; + *(uint16_t*)0x20000108 = -1; + *(uint16_t*)0x2000010a = 0x4015; + *(uint32_t*)0x2000010c = 0; + *(uint64_t*)0x20000110 = 0x400000000; + *(uint64_t*)0x20000118 = 5; + *(uint64_t*)0x20000120 = 4; + *(uint64_t*)0x20000128 = 0; + *(uint64_t*)0x20000130 = 0; + *(uint64_t*)0x20000138 = 0; + syscall(SYS_kevent, r[0], 0x20000100ul, 0x2cul, 0ul, 0ul, 0ul); +} +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); + loop(); + return 0; +} + + +EOF +mycc -o /tmp/syzkaller34 -Wall -Wextra -O0 /tmp/syzkaller34.c || + exit 1 + +(cd /tmp; timeout 3m ./syzkaller34) + +rm -rf /tmp/syzkaller34 syzkaller34.c /tmp/syzkaller.* +exit 0 From owner-dev-commits-src-all@freebsd.org Mon May 3 07:09:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E4356299A1; Mon, 3 May 2021 07:09:14 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYYxQ1Jcmz4WcQ; Mon, 3 May 2021 07:09:14 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1FDF6199E5; Mon, 3 May 2021 07:09:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14379E6f083838; Mon, 3 May 2021 07:09:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14379EXf083837; Mon, 3 May 2021 07:09:14 GMT (envelope-from git) Date: Mon, 3 May 2021 07:09:14 GMT Message-Id: <202105030709.14379EXf083837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: cff133b05ba1 - main - stress2: Added a regression test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cff133b05ba1481e535e67b37fda6608fb52f2d0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 07:09:14 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=cff133b05ba1481e535e67b37fda6608fb52f2d0 commit cff133b05ba1481e535e67b37fda6608fb52f2d0 Author: Peter Holm AuthorDate: 2021-05-03 07:08:43 +0000 Commit: Peter Holm CommitDate: 2021-05-03 07:08:43 +0000 stress2: Added a regression test --- tools/test/stress2/misc/mdconfig4.sh | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tools/test/stress2/misc/mdconfig4.sh b/tools/test/stress2/misc/mdconfig4.sh new file mode 100755 index 000000000000..fb7bdd869b2a --- /dev/null +++ b/tools/test/stress2/misc/mdconfig4.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Peter Holm +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +# Test scenario from Bug 255119 by nvass@gmx.com + +# Fatal trap 12: page fault while in kernel mode +# Fixed by 54f98c4dbf9b + +. ../default.cfg + +mount | grep "on $mntpoint " | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 512m -u $mdstart || exit 1 +bsdlabel -w md$mdstart auto +newfs $newfs_flags md$mdstart > /dev/null +mount /dev/md$mdstart $mntpoint + +md2=$((mdstart + 1)) +cp /bin/sleep $mntpoint +$mntpoint/sleep 60 & +sleep .2 +mdconfig -f $mntpoint/sleep -u $md2 2>&1 | + grep -v 'Text file busy' + +kill $! +mdconfig -l | grep -q md$md2 && mdconfig -d -u $md2 +wait + +umount $mntpoint +mdconfig -d -u $mdstart +exit 0 From owner-dev-commits-src-all@freebsd.org Mon May 3 07:53:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 02DA062A1B6; Mon, 3 May 2021 07:53:09 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYZw46X2Tz4YZF; Mon, 3 May 2021 07:53:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D33B61A6BB; Mon, 3 May 2021 07:53:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1437r8Up049318; Mon, 3 May 2021 07:53:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1437r81c049317; Mon, 3 May 2021 07:53:08 GMT (envelope-from git) Date: Mon, 3 May 2021 07:53:08 GMT Message-Id: <202105030753.1437r81c049317@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tai-hwa Liang Subject: git: 89ed20a9b6b1 - stable/13 - if_firewire: fixing panic upon packet reception for VNET build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avatar X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 89ed20a9b6b1ae45eb8afba377ef80b202b6d767 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 07:53:09 -0000 The branch stable/13 has been updated by avatar: URL: https://cgit.FreeBSD.org/src/commit/?id=89ed20a9b6b1ae45eb8afba377ef80b202b6d767 commit 89ed20a9b6b1ae45eb8afba377ef80b202b6d767 Author: Tai-hwa Liang AuthorDate: 2021-04-10 15:32:27 +0000 Commit: Tai-hwa Liang CommitDate: 2021-05-03 07:51:53 +0000 if_firewire: fixing panic upon packet reception for VNET build netisr_dispatch_src() needs valid VNET pointer or firewire_input() will panic when receiving a packet. Reviewed by: glebius MFC after: 2 weeks (cherry picked from commit d9b61e7153c64b141436b4d9619b166c6d35a0a6) --- sys/net/if_fwsubr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net/if_fwsubr.c b/sys/net/if_fwsubr.c index d6296bf33b65..29ca2f713e8e 100644 --- a/sys/net/if_fwsubr.c +++ b/sys/net/if_fwsubr.c @@ -634,7 +634,9 @@ firewire_input(struct ifnet *ifp, struct mbuf *m, uint16_t src) } M_SETFIB(m, ifp->if_fib); + CURVNET_SET_QUIET(ifp->if_vnet); netisr_dispatch(isr, m); + CURVNET_RESTORE(); } int From owner-dev-commits-src-all@freebsd.org Mon May 3 07:53:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 40D4062A49D; Mon, 3 May 2021 07:53:10 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYZw60xhJz4YhN; Mon, 3 May 2021 07:53:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0720A1A838; Mon, 3 May 2021 07:53:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1437r9wv049340; Mon, 3 May 2021 07:53:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1437r98a049339; Mon, 3 May 2021 07:53:09 GMT (envelope-from git) Date: Mon, 3 May 2021 07:53:09 GMT Message-Id: <202105030753.1437r98a049339@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tai-hwa Liang Subject: git: c59b71fd5414 - stable/13 - arp(8): fixing the deletion failure of IEEE1394 associated addresses MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avatar X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c59b71fd5414b2ae2a175126424cdc58c93d59dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 07:53:10 -0000 The branch stable/13 has been updated by avatar: URL: https://cgit.FreeBSD.org/src/commit/?id=c59b71fd5414b2ae2a175126424cdc58c93d59dd commit c59b71fd5414b2ae2a175126424cdc58c93d59dd Author: Tai-hwa Liang AuthorDate: 2021-04-12 06:27:03 +0000 Commit: Tai-hwa Liang CommitDate: 2021-05-03 07:51:53 +0000 arp(8): fixing the deletion failure of IEEE1394 associated addresses Without this, 'arp -d ${IEEE1394_ADDRESS}' gives the following error: arp: delete: cannot locate 10.0.0.71 Reviewed by: glebius MFC after: 2 weeks (cherry picked from commit a0d6d0d0b9aba6d4c025b2f2807e7c4b4c4b2415) --- usr.sbin/arp/arp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 08698c7bc299..f018baa2679e 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -299,6 +299,7 @@ valid_type(int type) switch (type) { case IFT_ETHER: case IFT_FDDI: + case IFT_IEEE1394: case IFT_INFINIBAND: case IFT_ISO88023: case IFT_ISO88024: From owner-dev-commits-src-all@freebsd.org Mon May 3 09:49:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEBC162CD0D; Mon, 3 May 2021 09:49:17 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYdV552R6z4d9w; Mon, 3 May 2021 09:49:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9B5471BFA1; Mon, 3 May 2021 09:49:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1439nHec095476; Mon, 3 May 2021 09:49:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1439nH4R095475; Mon, 3 May 2021 09:49:17 GMT (envelope-from git) Date: Mon, 3 May 2021 09:49:17 GMT Message-Id: <202105030949.1439nH4R095475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: b41a8364fb65 - stable/13 - geom_uzip(4): fix a typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b41a8364fb655f9d84a08e446e850bc98147483b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 09:49:17 -0000 The branch stable/13 has been updated by ygy (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b41a8364fb655f9d84a08e446e850bc98147483b commit b41a8364fb655f9d84a08e446e850bc98147483b Author: Ceri Davies AuthorDate: 2021-04-28 04:55:32 +0000 Commit: Guangyuan Yang CommitDate: 2021-05-03 09:48:35 +0000 geom_uzip(4): fix a typo While I was there, also fixed a whitespace issue reported by mandoc -Tlint. PR: 254338 (cherry picked from commit f33f2365eeefa38730e365bf6813cd0b90c9e9bc) --- share/man/man4/geom_uzip.4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man4/geom_uzip.4 b/share/man/man4/geom_uzip.4 index 359940bd2cf1..4b8e8d355c81 100644 --- a/share/man/man4/geom_uzip.4 +++ b/share/man/man4/geom_uzip.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 13, 2019 +.Dd April 28, 2021 .Dt GEOM_UZIP 4 .Os .Sh NAME @@ -53,7 +53,7 @@ The framework provides support for compressed read-only disk images. This allows significant storage savings at the expense of -a some CPU time on each read. +some CPU time on each read. Data written in the GEOM label area allows .Nm to detect compressed images which have been created with @@ -70,7 +70,7 @@ is not limited to supporting only .Xr md 4 images. The image can also reside on a block device. -.Pq For example, a disk, USB flash drive, DVD-ROM, etc. +.Pq For example, a disk, USB flash drive, DVD-ROM, etc . The appropriate device node will appear with the .Pa .uzip suffix. From owner-dev-commits-src-all@freebsd.org Mon May 3 10:29:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F27462E1B4; Mon, 3 May 2021 10:29:02 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYfMx6v2Tz4gH7; Mon, 3 May 2021 10:29:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DFAFF1CA1C; Mon, 3 May 2021 10:29:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143AT1O5048791; Mon, 3 May 2021 10:29:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143AT1Yl048790; Mon, 3 May 2021 10:29:01 GMT (envelope-from git) Date: Mon, 3 May 2021 10:29:01 GMT Message-Id: <202105031029.143AT1Yl048790@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 5c4fe2ac81a5 - main - service/ipfw: Silence warning on restart MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c4fe2ac81a5e05062266d684fb53b9faefd0d38 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 10:29:02 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=5c4fe2ac81a5e05062266d684fb53b9faefd0d38 commit 5c4fe2ac81a5e05062266d684fb53b9faefd0d38 Author: Lutz Donnerhacke AuthorDate: 2021-05-02 20:47:04 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-03 10:27:20 +0000 service/ipfw: Silence warning on restart Once the ipfw0 interface has been created, ifconfig(8) create will throw a warning: ifconfig: create: bad value' when trying to create it again. PR: 241013 Submitted by: Jose Luis Duran Approved by: kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30083 --- libexec/rc/rc.d/ipfw | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.d/ipfw b/libexec/rc/rc.d/ipfw index ece0a93ba6f4..fd1c97671d70 100755 --- a/libexec/rc/rc.d/ipfw +++ b/libexec/rc/rc.d/ipfw @@ -74,8 +74,14 @@ ipfw_start() ${SYSCTL} net.inet.ip.fw.verbose=1 >/dev/null fi if checkyesno firewall_logif; then - ifconfig ipfw0 create - echo 'Firewall logging pseudo-interface (ipfw0) created.' + if ! ifconfig ipfw0 >/dev/null 2>&1; then + ifconfig ipfw0 create + echo 'Firewall logging pseudo-interface (ipfw0)' \ + 'created.' + else + echo 'Firewall logging pseudo-interface (ipfw0)' \ + 'already created.' + fi fi } From owner-dev-commits-src-all@freebsd.org Mon May 3 11:33:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C571A62FF1C; Mon, 3 May 2021 11:33:55 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYgpq5CnNz4jxg; Mon, 3 May 2021 11:33:55 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A5DFF1D90C; Mon, 3 May 2021 11:33:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143BXtuL040800; Mon, 3 May 2021 11:33:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143BXt5H040799; Mon, 3 May 2021 11:33:55 GMT (envelope-from git) Date: Mon, 3 May 2021 11:33:55 GMT Message-Id: <202105031133.143BXt5H040799@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 0ec205197b56 - main - Also enable IPIs on 32-bit arm MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ec205197b56b9257cf0fdc1a5b268fef3e3f2dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 11:33:55 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=0ec205197b56b9257cf0fdc1a5b268fef3e3f2dc commit 0ec205197b56b9257cf0fdc1a5b268fef3e3f2dc Author: Andrew Turner AuthorDate: 2021-05-02 10:05:03 +0000 Commit: Andrew Turner CommitDate: 2021-05-03 08:36:57 +0000 Also enable IPIs on 32-bit arm This was missed in 2420f6a Reported by: tuexen, imp --- sys/arm/arm/machdep_intr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm/arm/machdep_intr.c b/sys/arm/arm/machdep_intr.c index e2fb34ce93c8..cc2e67a6211e 100644 --- a/sys/arm/arm/machdep_intr.c +++ b/sys/arm/arm/machdep_intr.c @@ -223,6 +223,7 @@ intr_pic_ipi_setup(u_int ipi, const char *name, intr_ipi_handler_t *hand, isrc->isrc_handlers++; intr_ipi_setup(ipi, name, hand, arg, pic_ipi_send, isrc); + PIC_ENABLE_INTR(intr_irq_root_dev, isrc); return (0); } #endif From owner-dev-commits-src-all@freebsd.org Mon May 3 11:39:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6074D62FFAE; Mon, 3 May 2021 11:39:15 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYgwz2Jylz4kBh; Mon, 3 May 2021 11:39:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3DB211D90D; Mon, 3 May 2021 11:39:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143BdFFP041328; Mon, 3 May 2021 11:39:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143BdFL8041327; Mon, 3 May 2021 11:39:15 GMT (envelope-from git) Date: Mon, 3 May 2021 11:39:15 GMT Message-Id: <202105031139.143BdFL8041327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 0ea8a7f36db3 - main - ifconfig: Minor documentation fix MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ea8a7f36db31bfc550bbe5e39703fdedd12fa8c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 11:39:15 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0ea8a7f36db31bfc550bbe5e39703fdedd12fa8c commit 0ea8a7f36db31bfc550bbe5e39703fdedd12fa8c Author: Jose Luis Duran AuthorDate: 2021-04-29 11:03:48 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 11:38:52 +0000 ifconfig: Minor documentation fix Fix what appears to have been a small copy/paste typo in ifconfig(8)'s documentation (man page and header file). Not that it matters anymore. Reference: Table I-2 in IEEE Std 802.1Q-2014. PR: 255557 Submitted by: Jose Luis Duran MFC after: 1 week --- sbin/ifconfig/ifconfig.8 | 6 +++--- sys/net/ethernet.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index b8adad3c75b0..f183bc3dd66f 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd January 28, 2021 +.Dd April 29, 2021 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2729,9 +2729,9 @@ Values in order of priority are: .Cm 3 .Pq Dv Critical applications , .Cm 4 -.Pq Dv Video, < 100ms latency , +.Pq Dv Video, < 100ms latency and jitter , .Cm 5 -.Pq Dv Video, < 10ms latency , +.Pq Dv Voice, < 10ms latency and jitter , .Cm 6 .Pq Dv Internetwork control , .Cm 7 diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h index f174ca9eb143..9a80a6db794f 100644 --- a/sys/net/ethernet.h +++ b/sys/net/ethernet.h @@ -416,8 +416,8 @@ struct ether_vlan_header { #define IEEE8021Q_PCP_BE 0 /* Best effort (default) */ #define IEEE8021Q_PCP_EE 2 /* Excellent effort */ #define IEEE8021Q_PCP_CA 3 /* Critical applications */ -#define IEEE8021Q_PCP_VI 4 /* Video, < 100ms latency */ -#define IEEE8021Q_PCP_VO 5 /* Video, < 10ms latency */ +#define IEEE8021Q_PCP_VI 4 /* Video, < 100ms latency and jitter */ +#define IEEE8021Q_PCP_VO 5 /* Voice, < 10ms latency and jitter */ #define IEEE8021Q_PCP_IC 6 /* Internetwork control */ #define IEEE8021Q_PCP_NC 7 /* Network control (highest) */ From owner-dev-commits-src-all@freebsd.org Mon May 3 11:39:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A5EC62FFAF; Mon, 3 May 2021 11:39:16 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYgx02wWMz4kPd; Mon, 3 May 2021 11:39:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 55BDE1D376; Mon, 3 May 2021 11:39:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143BdGSx041349; Mon, 3 May 2021 11:39:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143BdGWx041348; Mon, 3 May 2021 11:39:16 GMT (envelope-from git) Date: Mon, 3 May 2021 11:39:16 GMT Message-Id: <202105031139.143BdGWx041348@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 5b8b6b26e40a - main - uart_bus_pci.c: Style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b8b6b26e40a81320f02a46df98b96bd8e93295a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 11:39:16 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5b8b6b26e40a81320f02a46df98b96bd8e93295a commit 5b8b6b26e40a81320f02a46df98b96bd8e93295a Author: Jose Luis Duran AuthorDate: 2021-05-02 21:20:25 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 11:38:52 +0000 uart_bus_pci.c: Style Wrap long lines, use tab instead of spaces. PR: 255556 Submitted by: Jose Luis Duran MFC after: 1 week --- sys/dev/uart/uart_bus_pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index fbd1d68b88ca..123ee3e26829 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -135,12 +135,13 @@ static const struct pci_id pci_ns8250_ids[] = { { 0x8086, 0x108f, 0xffff, 0, "Intel AMT - SOL", 0x10 }, { 0x8086, 0x19d8, 0xffff, 0, "Intel Denverton UART", 0x10 }, { 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, -{ 0x8086, 0x1d3d, 0xffff, 0, "Intel C600/X79 Series Chipset KT Controller", 0x10 }, +{ 0x8086, 0x1d3d, 0xffff, 0, "Intel C600/X79 Series Chipset KT Controller", + 0x10 }, { 0x8086, 0x1e3d, 0xffff, 0, "Intel Panther Point KT Controller", 0x10 }, { 0x8086, 0x228a, 0xffff, 0, "Intel Cherryview SIO HSUART#1", 0x10, - 24 * DEFAULT_RCLK, 2 }, + 24 * DEFAULT_RCLK, 2 }, { 0x8086, 0x228c, 0xffff, 0, "Intel Cherryview SIO HSUART#2", 0x10, - 24 * DEFAULT_RCLK, 2 }, + 24 * DEFAULT_RCLK, 2 }, { 0x8086, 0x2a07, 0xffff, 0, "Intel AMT - PM965/GM965 KT Controller", 0x10 }, { 0x8086, 0x2a47, 0xffff, 0, "Mobile 4 Series Chipset KT Controller", 0x10 }, { 0x8086, 0x2e17, 0xffff, 0, "4 Series Chipset Serial KT Controller", 0x10 }, From owner-dev-commits-src-all@freebsd.org Mon May 3 11:39:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA190630091; Mon, 3 May 2021 11:39:17 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYgx14Lvmz4k3Y; Mon, 3 May 2021 11:39:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7A3881D85A; Mon, 3 May 2021 11:39:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143BdHCg041376; Mon, 3 May 2021 11:39:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143BdH9u041375; Mon, 3 May 2021 11:39:17 GMT (envelope-from git) Date: Mon, 3 May 2021 11:39:17 GMT Message-Id: <202105031139.143BdH9u041375@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 8f1562430fbb - main - Add Apollo Lake SIO/LPSS UARTs PCI IDs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8f1562430fbb83f6cedff6450e1aa1b593e3d7e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 11:39:17 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8f1562430fbb83f6cedff6450e1aa1b593e3d7e7 commit 8f1562430fbb83f6cedff6450e1aa1b593e3d7e7 Author: Jose Luis Duran AuthorDate: 2021-05-02 21:20:25 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 11:38:52 +0000 Add Apollo Lake SIO/LPSS UARTs PCI IDs Add PCI IDs for Intel Apollo Lake Series HSUARTs: # pciconf -ll drv selector class rev hdr vendor device subven subdev uart0@pci0:0:24:0: 118000 0b 00 8086 5abc 8086 7270 uart1@pci0:0:24:1: 118000 0b 00 8086 5abe 8086 7270 uart2@pci0:0:24:2: 118000 0b 00 8086 5ac0 8086 7270 uart3@pci0:0:24:3: 118000 0b 00 8086 5aee 8086 7270 NB (Intel Document Number 336256-004US): 1. The E3900 and A3900 Series Processors support four LPSS_UART ports, while the N- and J- Series Processors support only LPSS_UART [2:1] ports. 2. The LPSS_UART1 port is dedicated for discrete Global Navigation Satellite System (GNSS). This port can be used for generic UART functionality if GNSS is not used. 3. The LPSS_UART2 port is dedicated for host OS debug. 4. The LPSS_UART0 and LPSS_UART3 ports are for generic UART functionality. 5. Only UART [1:0] ports support DMA. PR: 255556 Submitted by: Jose Luis Duran MFC after: 1 week --- sys/dev/uart/uart_bus_pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index 123ee3e26829..707b82dc078b 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -147,6 +147,14 @@ static const struct pci_id pci_ns8250_ids[] = { { 0x8086, 0x2e17, 0xffff, 0, "4 Series Chipset Serial KT Controller", 0x10 }, { 0x8086, 0x3b67, 0xffff, 0, "5 Series/3400 Series Chipset KT Controller", 0x10 }, +{ 0x8086, 0x5abc, 0xffff, 0, "Intel Apollo Lake SIO/LPSS UART 0", 0x10, + 24 * DEFAULT_RCLK, 2 }, +{ 0x8086, 0x5abe, 0xffff, 0, "Intel Apollo Lake SIO/LPSS UART 1", 0x10, + 24 * DEFAULT_RCLK, 2 }, +{ 0x8086, 0x5ac0, 0xffff, 0, "Intel Apollo Lake SIO/LPSS UART 2", 0x10, + 24 * DEFAULT_RCLK, 2 }, +{ 0x8086, 0x5aee, 0xffff, 0, "Intel Apollo Lake SIO/LPSS UART 3", 0x10, + 24 * DEFAULT_RCLK, 2 }, { 0x8086, 0x8811, 0xffff, 0, "Intel EG20T Serial Port 0", 0x10 }, { 0x8086, 0x8812, 0xffff, 0, "Intel EG20T Serial Port 1", 0x10 }, { 0x8086, 0x8813, 0xffff, 0, "Intel EG20T Serial Port 2", 0x10 }, From owner-dev-commits-src-all@freebsd.org Mon May 3 12:35:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E6EF631FA2; Mon, 3 May 2021 12:35:39 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYjB324Lbz4mlb; Mon, 3 May 2021 12:35:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 39FE51E2B4; Mon, 3 May 2021 12:35:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143CZdMx020960; Mon, 3 May 2021 12:35:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143CZdvH020959; Mon, 3 May 2021 12:35:39 GMT (envelope-from git) Date: Mon, 3 May 2021 12:35:39 GMT Message-Id: <202105031235.143CZdvH020959@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 67dc1da8f32a - stable/13 - imgact_elf: Ensure that the return value in parse_notes is initialized MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 67dc1da8f32a36e2017cabda4ad6e974a22207b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 12:35:39 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=67dc1da8f32a36e2017cabda4ad6e974a22207b4 commit 67dc1da8f32a36e2017cabda4ad6e974a22207b4 Author: Mark Johnston AuthorDate: 2021-04-26 18:53:16 +0000 Commit: Mark Johnston CommitDate: 2021-05-03 12:35:33 +0000 imgact_elf: Ensure that the return value in parse_notes is initialized parse_notes relies on the caller-supplied callback to initialize "res". Two callbacks are used in practice, brandnote_cb and note_fctl_cb, and the latter fails to initialize res. Fix it. In the worst case, the bug would cause the inner loop of check_note to examine more program headers than necessary, and the note header usually comes last anyway. Reviewed by: kib Reported by: KMSAN Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29986 (cherry picked from commit 409ab7e109c692014e3484a74af248dd7a4746e8) --- sys/kern/imgact_elf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 245894926ee1..c4aedbe6bbfa 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -2736,6 +2736,7 @@ note_fctl_cb(const Elf_Note *note, void *arg0, boolean_t *res) desc = (const Elf32_Word *)p; *arg->has_fctl0 = TRUE; *arg->fctl0 = desc[0]; + *res = TRUE; return (TRUE); } From owner-dev-commits-src-all@freebsd.org Mon May 3 12:39:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D51676320A6; Mon, 3 May 2021 12:39:34 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYjGZ5jT5z4n9C; Mon, 3 May 2021 12:39:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B260C1E5AF; Mon, 3 May 2021 12:39:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143CdYVd021343; Mon, 3 May 2021 12:39:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143CdYbl021342; Mon, 3 May 2021 12:39:34 GMT (envelope-from git) Date: Mon, 3 May 2021 12:39:34 GMT Message-Id: <202105031239.143CdYbl021342@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 0048a3237ddb - stable/12 - imgact_elf: Ensure that the return value in parse_notes is initialized MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0048a3237ddbf9b83b44a82d9467d65c646e3289 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 12:39:34 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0048a3237ddbf9b83b44a82d9467d65c646e3289 commit 0048a3237ddbf9b83b44a82d9467d65c646e3289 Author: Mark Johnston AuthorDate: 2021-04-26 18:53:16 +0000 Commit: Mark Johnston CommitDate: 2021-05-03 12:39:02 +0000 imgact_elf: Ensure that the return value in parse_notes is initialized parse_notes relies on the caller-supplied callback to initialize "res". Two callbacks are used in practice, brandnote_cb and note_fctl_cb, and the latter fails to initialize res. Fix it. In the worst case, the bug would cause the inner loop of check_note to examine more program headers than necessary, and the note header usually comes last anyway. Reviewed by: kib Reported by: KMSAN Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29986 (cherry picked from commit 409ab7e109c692014e3484a74af248dd7a4746e8) --- sys/kern/imgact_elf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 4c05be66e51f..416de09630ae 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -2666,6 +2666,7 @@ note_fctl_cb(const Elf_Note *note, void *arg0, boolean_t *res) p += roundup2(note->n_namesz, ELF_NOTE_ROUNDSIZE); desc = (const Elf32_Word *)p; *arg->fctl0 = desc[0]; + *res = TRUE; return (TRUE); } From owner-dev-commits-src-all@freebsd.org Mon May 3 14:20:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E43C8634184; Mon, 3 May 2021 14:20:37 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYlW9654gz4rjf; Mon, 3 May 2021 14:20:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C42C41F8A6; Mon, 3 May 2021 14:20:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143EKb8J064576; Mon, 3 May 2021 14:20:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143EKbhZ064575; Mon, 3 May 2021 14:20:37 GMT (envelope-from git) Date: Mon, 3 May 2021 14:20:37 GMT Message-Id: <202105031420.143EKbhZ064575@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 7818653fd6e0 - main - cam: fix integer overflow during inquiry MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7818653fd6e00c3e310584723978e65674c95939 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 14:20:38 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=7818653fd6e00c3e310584723978e65674c95939 commit 7818653fd6e00c3e310584723978e65674c95939 Author: Edward Tomasz Napierala AuthorDate: 2021-05-03 13:46:11 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-03 14:20:17 +0000 cam: fix integer overflow during inquiry From my understanding this could happen with iSCSI LUNs with unusually long names. The bug would make CAM fail to retrieve the full inquiry data. Instead of bumping the size of the local variable, just use a macro. Reviewed By: imp, mav Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #50 Differential Revision: https://reviews.freebsd.org/D29991 --- sys/cam/scsi/scsi_xpt.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index bed1f3ad1373..67b94488dff0 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -1210,8 +1210,6 @@ out: if (periph_qual == SID_QUAL_LU_CONNECTED || periph_qual == SID_QUAL_LU_OFFLINE) { - u_int8_t len; - /* * We conservatively request only * SHORT_INQUIRY_LEN bytes of inquiry @@ -1222,11 +1220,9 @@ out: * the amount of information the device * is willing to give. */ - len = inq_buf->additional_length - + offsetof(struct scsi_inquiry_data, - additional_length) + 1; if (softc->action == PROBE_INQUIRY - && len > SHORT_INQUIRY_LENGTH) { + && SID_ADDITIONAL_LENGTH(inq_buf) + > SHORT_INQUIRY_LENGTH) { PROBE_SET_ACTION(softc, PROBE_FULL_INQUIRY); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); From owner-dev-commits-src-all@freebsd.org Mon May 3 15:56:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C41A635FA0; Mon, 3 May 2021 15:56:24 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYndh40fbz3CDM; Mon, 3 May 2021 15:56:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7796220F0E; Mon, 3 May 2021 15:56:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143FuOix087052; Mon, 3 May 2021 15:56:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143FuOxZ087051; Mon, 3 May 2021 15:56:24 GMT (envelope-from git) Date: Mon, 3 May 2021 15:56:24 GMT Message-Id: <202105031556.143FuOxZ087051@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 3b57d80c7aa9 - main - daemon: add some basic tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b57d80c7aa924ed0fad565591f5292c2ac88da5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 15:56:24 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=3b57d80c7aa924ed0fad565591f5292c2ac88da5 commit 3b57d80c7aa924ed0fad565591f5292c2ac88da5 Author: Alan Somers AuthorDate: 2021-03-17 16:35:00 +0000 Commit: Alan Somers CommitDate: 2021-05-03 15:55:40 +0000 daemon: add some basic tests MFC after: 2 weeks Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D29316 --- etc/mtree/BSD.tests.dist | 2 + usr.sbin/daemon/Makefile | 5 + usr.sbin/daemon/tests/Makefile | 7 ++ usr.sbin/daemon/tests/daemon_test.sh | 224 +++++++++++++++++++++++++++++++++++ 4 files changed, 238 insertions(+) diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 3d50a1943ce4..51cc6f8a2871 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -1094,6 +1094,8 @@ usr.sbin chown .. + daemon + .. etcupdate .. extattr diff --git a/usr.sbin/daemon/Makefile b/usr.sbin/daemon/Makefile index eb0d50280161..0bf34c351932 100644 --- a/usr.sbin/daemon/Makefile +++ b/usr.sbin/daemon/Makefile @@ -5,4 +5,9 @@ MAN= daemon.8 LIBADD= util +.include + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include diff --git a/usr.sbin/daemon/tests/Makefile b/usr.sbin/daemon/tests/Makefile new file mode 100644 index 000000000000..c687361ec4e7 --- /dev/null +++ b/usr.sbin/daemon/tests/Makefile @@ -0,0 +1,7 @@ +# $FreeBSD$ + +PACKAGE= tests + +ATF_TESTS_SH= daemon_test + +.include diff --git a/usr.sbin/daemon/tests/daemon_test.sh b/usr.sbin/daemon/tests/daemon_test.sh new file mode 100644 index 000000000000..ab5d86e0e71b --- /dev/null +++ b/usr.sbin/daemon/tests/daemon_test.sh @@ -0,0 +1,224 @@ +#!/bin/sh +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Axcient +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# $FreeBSD$ + +atf_test_case both_pidfile cleanup +both_pidfile_head() { + atf_set "descr" "daemon should write pid files for itself and its child" +} +both_pidfile_body() { + daemon -P daemon.pid -p sleep.pid sleep 300 + atf_check -s exit:0 test -f daemon.pid + atf_check -s exit:0 -o match:"daemon: sleep" ps -p `cat daemon.pid` + atf_check -s exit:0 test -f sleep.pid + atf_check -s exit:0 -o match:"[0-9] sleep 300$" ps -p `cat sleep.pid` +} +both_pidfile_cleanup() { + if [ -f daemon.pid ]; then + daemon_pid=`cat daemon.pid` + fi + if [ -f sleep_pid ]; then + sleep_pid=`cat sleep.pid` + fi + [ -n "$sleep_pid" ] && kill $sleep_pid + # NB: killing the sleep should kill the daemon too, so we musn't fail + # the test if the second kill fails with ESRCH + [ -n "$daemon_pid" ] && kill $daemon_pid || true +} + +atf_test_case chdir cleanup +chdir_head() { + atf_set "descr" "daemon should chdir to /" +} +chdir_body() { + # Executing sleep by relative path will only work from / + daemon -p ${PWD}/sleep.pid -c bin/sleep 300 + atf_check -s exit:0 test -f sleep.pid + atf_check -s exit:0 -o match:"[0-9] bin/sleep 300$" \ + ps -p `cat sleep.pid` +} +chdir_cleanup() { + [ -f sleep.pid ] && kill `cat sleep.pid` +} + +atf_test_case child_pidfile cleanup +child_pidfile_head() { + atf_set "descr" "daemon should write its child's pid to a pidfile" +} +child_pidfile_body() { + daemon -p sleep.pid sleep 300 + atf_check -s exit:0 test -f sleep.pid + atf_check -s exit:0 -o match:"[0-9] sleep 300$" ps -p `cat sleep.pid` +} +child_pidfile_cleanup() { + [ -f sleep.pid ] && kill `cat sleep.pid` +} + +atf_test_case child_pidfile_lock cleanup +child_pidfile_lock_head() { + atf_set "descr" "daemon should refuse to clobber an existing child" +} +child_pidfile_lock_body() { + daemon -p sleep.pid sleep 300 + atf_check -s exit:0 test -f sleep.pid + atf_check -s not-exit:0 -e match:"process already running" \ + daemon -p sleep.pid sleep 300 +} +child_pidfile_lock_cleanup() { + [ -f sleep.pid ] && kill `cat sleep.pid` +} + +atf_test_case newsyslog cleanup +newsyslog_head() { + atf_set "descr" "daemon should close and reopen the output file on SIGHUP" +} +newsyslog_body() { + cat > child.sh < expected_file + atf_check -s exit:0 cmp output_file expected_file +} + +atf_test_case restart_child cleanup +restart_child_head() { + atf_set "descr" "daemon should restart a dead child" +} +restart_child_body() { + daemon -rP daemon.pid -p sleep.pid sleep 300 + atf_check -s exit:0 test -f daemon.pid + atf_check -s exit:0 test -f sleep.pid + orig_sleep_pid=`cat sleep.pid` + kill $orig_sleep_pid + # Wait up to 10s for the daemon to restart the child. + for t in `seq 0 0.1 10`; do + new_sleep_pid=`cat sleep.pid` + [ "$orig_sleep_pid" -ne "$new_sleep_pid" ] && break + sleep 0.1 + done + [ "$orig_sleep_pid" -ne "$new_sleep_pid" ] || \ + atf_fail "child was not restarted" + +} +restart_child_cleanup() { + [ -f daemon.pid ] && kill `cat daemon.pid` +} + +atf_test_case supervisor_pidfile cleanup +supervisor_pidfile_head() { + atf_set "descr" "daemon should write its own pid to a pidfile" +} +supervisor_pidfile_body() { + daemon -P daemon.pid sleep 300 + atf_check -s exit:0 test -f daemon.pid + atf_check -s exit:0 -o match:"daemon: sleep" ps -p `cat daemon.pid` +} +supervisor_pidfile_cleanup() { + [ -f daemon.pid ] && kill `cat daemon.pid` +} + +atf_test_case supervisor_pidfile_lock cleanup +supervisor_pidfile_lock_head() { + atf_set "descr" "daemon should refuse to clobber an existing instance" +} +supervisor_pidfile_lock_body() { + daemon -P daemon.pid sleep 300 + atf_check -s exit:0 test -f daemon.pid + atf_check -s not-exit:0 -e match:"process already running" \ + daemon -p daemon.pid sleep 300 +} +supervisor_pidfile_lock_cleanup() { + [ -f daemon.pid ] && kill `cat daemon.pid` +} + +atf_test_case title cleanup +title_head() { + atf_set "descr" "daemon should change its process title" +} +title_body() { + daemon -P daemon.pid -t "I'm a title!" sleep 300 + atf_check -s exit:0 test -f daemon.pid + atf_check -s exit:0 -o match:"daemon: I'm a title!" \ + ps -p `cat daemon.pid` +} +title_cleanup() { + [ -f daemon.pid ] && kill `cat daemon.pid` +} + +atf_test_case user cleanup +user_head() { + atf_set "descr" "daemon should drop privileges" + atf_set "require.user" "root" +} +user_body() { + daemon -p sleep.pid -u nobody sleep 300 + atf_check -s exit:0 test -f sleep.pid + atf_check -s exit:0 -o match:"^nobody" ps -up `cat sleep.pid` +} +user_cleanup() { + [ -f sleep.pid ] && kill `cat sleep.pid` +} + + +atf_init_test_cases() { + atf_add_test_case both_pidfile + atf_add_test_case chdir + atf_add_test_case child_pidfile + atf_add_test_case child_pidfile_lock + atf_add_test_case newsyslog + atf_add_test_case output_file + atf_add_test_case restart_child + atf_add_test_case supervisor_pidfile + atf_add_test_case supervisor_pidfile_lock + atf_add_test_case title + atf_add_test_case user +} From owner-dev-commits-src-all@freebsd.org Mon May 3 16:20:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B733F6369A9; Mon, 3 May 2021 16:20:37 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYp9d4t7cz3DK0; Mon, 3 May 2021 16:20:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8FB0820F7E; Mon, 3 May 2021 16:20:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GKbR1022195; Mon, 3 May 2021 16:20:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKbjF022194; Mon, 3 May 2021 16:20:37 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:37 GMT Message-Id: <202105031620.143GKbjF022194@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 5bc3c61780d7 - main - imgact_elf: consistently pass flags from coredump down to helper functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5bc3c61780d775810eea852936671ca4a232b2a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:37 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5bc3c61780d775810eea852936671ca4a232b2a8 commit 5bc3c61780d775810eea852936671ca4a232b2a8 Author: Konstantin Belousov AuthorDate: 2021-04-24 11:42:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:13:47 +0000 imgact_elf: consistently pass flags from coredump down to helper functions Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- sys/kern/imgact_elf.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index c4aedbe6bbfa..77045842a13c 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1471,12 +1471,13 @@ static void cb_put_phdr(vm_map_entry_t, void *); static void cb_size_segment(vm_map_entry_t, void *); static int core_write(struct coredump_params *, const void *, size_t, off_t, enum uio_seg, size_t *); -static void each_dumpable_segment(struct thread *, segment_callback, void *); +static void each_dumpable_segment(struct thread *, segment_callback, void *, + int); static int __elfN(corehdr)(struct coredump_params *, int, void *, size_t, - struct note_info_list *, size_t); + struct note_info_list *, size_t, int); static void __elfN(prepare_notes)(struct thread *, struct note_info_list *, size_t *); -static void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t); +static void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t, int); static void __elfN(putnote)(struct note_info *, struct sbuf *); static size_t register_note(struct note_info_list *, int, outfunc_t, void *); static int sbuf_drain_core_output(void *, const char *, int); @@ -1669,7 +1670,7 @@ __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags) /* Size the program segments. */ seginfo.count = 0; seginfo.size = 0; - each_dumpable_segment(td, cb_size_segment, &seginfo); + each_dumpable_segment(td, cb_size_segment, &seginfo, flags); /* * Collect info about the core file header area. @@ -1722,7 +1723,7 @@ __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags) */ hdr = malloc(hdrsize, M_TEMP, M_WAITOK); error = __elfN(corehdr)(¶ms, seginfo.count, hdr, hdrsize, ¬elst, - notesz); + notesz, flags); /* Write the contents of all of the writable segments. */ if (error == 0) { @@ -1806,7 +1807,8 @@ cb_size_segment(vm_map_entry_t entry, void *closure) * caller-supplied data. */ static void -each_dumpable_segment(struct thread *td, segment_callback func, void *closure) +each_dumpable_segment(struct thread *td, segment_callback func, void *closure, + int flags) { struct proc *p = td->td_proc; vm_map_t map = &p->p_vmspace->vm_map; @@ -1867,7 +1869,8 @@ each_dumpable_segment(struct thread *td, segment_callback func, void *closure) */ static int __elfN(corehdr)(struct coredump_params *p, int numsegs, void *hdr, - size_t hdrsize, struct note_info_list *notelst, size_t notesz) + size_t hdrsize, struct note_info_list *notelst, size_t notesz, + int flags) { struct note_info *ninfo; struct sbuf *sb; @@ -1875,7 +1878,7 @@ __elfN(corehdr)(struct coredump_params *p, int numsegs, void *hdr, /* Fill in the header. */ bzero(hdr, hdrsize); - __elfN(puthdr)(p->td, hdr, hdrsize, numsegs, notesz); + __elfN(puthdr)(p->td, hdr, hdrsize, numsegs, notesz, flags); sb = sbuf_new(NULL, NULL, CORE_BUF_SIZE, SBUF_FIXEDLEN); sbuf_set_drain(sb, sbuf_drain_core_output, p); @@ -1953,7 +1956,7 @@ __elfN(prepare_notes)(struct thread *td, struct note_info_list *list, static void __elfN(puthdr)(struct thread *td, void *hdr, size_t hdrsize, int numsegs, - size_t notesz) + size_t notesz, int flags) { Elf_Ehdr *ehdr; Elf_Phdr *phdr; @@ -2032,7 +2035,7 @@ __elfN(puthdr)(struct thread *td, void *hdr, size_t hdrsize, int numsegs, /* All the writable segments from the program. */ phc.phdr = phdr; phc.offset = round_page(hdrsize + notesz); - each_dumpable_segment(td, cb_put_phdr, &phc); + each_dumpable_segment(td, cb_put_phdr, &phc, flags); } static size_t From owner-dev-commits-src-all@freebsd.org Mon May 3 16:20:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE37B6364E5; Mon, 3 May 2021 16:20:38 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYp9f4sk0z3D02; Mon, 3 May 2021 16:20:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9A18920F7F; Mon, 3 May 2021 16:20:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GKckV022216; Mon, 3 May 2021 16:20:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKcJo022215; Mon, 3 May 2021 16:20:38 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:38 GMT Message-Id: <202105031620.143GKcJo022215@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 86ffb3d1a0cb - main - ELF coredump: define several useful flags for the coredump operations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 86ffb3d1a0cbb09ba0123ff8d34149e691b461c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:38 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=86ffb3d1a0cbb09ba0123ff8d34149e691b461c4 commit 86ffb3d1a0cbb09ba0123ff8d34149e691b461c4 Author: Konstantin Belousov AuthorDate: 2021-04-24 11:45:01 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:13:47 +0000 ELF coredump: define several useful flags for the coredump operations - SVC_ALL request dumping all map entries, including those marked as non-dumpable - SVC_NOCOMPRESS disallows compressing the dump regardless of the sysctl policy - SVC_PC_COREDUMP is provided for future use by userspace core dump request Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- sys/kern/imgact_elf.c | 31 ++++++++++++++++++++----------- sys/sys/sysent.h | 5 +++++ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 77045842a13c..563629b747b5 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1655,7 +1655,7 @@ int __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags) { struct ucred *cred = td->td_ucred; - int error = 0; + int compm, error = 0; struct sseg_closure seginfo; struct note_info_list notelst; struct coredump_params params; @@ -1706,9 +1706,13 @@ __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags) } /* Create a compression stream if necessary. */ - if (compress_user_cores != 0) { + compm = compress_user_cores; + if ((flags & (SVC_PT_COREDUMP | SVC_NOCOMPRESS)) == SVC_PT_COREDUMP && + compm == 0) + compm = COMPRESS_GZIP; + if (compm != 0) { params.comp = compressor_init(core_compressed_write, - compress_user_cores, CORE_BUF_SIZE, + compm, CORE_BUF_SIZE, compress_user_cores_level, ¶ms); if (params.comp == NULL) { error = EFAULT; @@ -1826,12 +1830,15 @@ each_dumpable_segment(struct thread *td, segment_callback func, void *closure, * are marked MAP_ENTRY_NOCOREDUMP now so we no longer * need to arbitrarily ignore such segments. */ - if (elf_legacy_coredump) { - if ((entry->protection & VM_PROT_RW) != VM_PROT_RW) - continue; - } else { - if ((entry->protection & VM_PROT_ALL) == 0) - continue; + if ((flags & SVC_ALL) == 0) { + if (elf_legacy_coredump) { + if ((entry->protection & VM_PROT_RW) != + VM_PROT_RW) + continue; + } else { + if ((entry->protection & VM_PROT_ALL) == 0) + continue; + } } /* @@ -1840,9 +1847,11 @@ each_dumpable_segment(struct thread *td, segment_callback func, void *closure, * madvise(2). Do not dump submaps (i.e. parts of the * kernel map). */ - if (entry->eflags & (MAP_ENTRY_NOCOREDUMP|MAP_ENTRY_IS_SUB_MAP)) + if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 0) + continue; + if ((entry->eflags & MAP_ENTRY_NOCOREDUMP) != 0 && + (flags & SVC_ALL) == 0) continue; - if ((object = entry->object.vm_object) == NULL) continue; diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index db729239243f..e6db2ec3dfb1 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -171,6 +171,11 @@ struct sysentvec { #define SV_ABI_CLOUDABI 17 #define SV_ABI_UNDEF 255 +/* sv_coredump flags */ +#define SVC_PT_COREDUMP 0x00000001 /* dump requested by ptrace(2) */ +#define SVC_NOCOMPRESS 0x00000002 /* disable compression. */ +#define SVC_ALL 0x00000004 /* dump everything */ + #ifdef _KERNEL extern struct sysentvec aout_sysvec; extern struct sysent sysent[]; From owner-dev-commits-src-all@freebsd.org Mon May 3 16:20:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FE486366EE; Mon, 3 May 2021 16:20:40 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYp9g6ZMbz3DNY; Mon, 3 May 2021 16:20:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CB6AF21316; Mon, 3 May 2021 16:20:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GKdTw022237; Mon, 3 May 2021 16:20:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKdDt022236; Mon, 3 May 2021 16:20:39 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:39 GMT Message-Id: <202105031620.143GKdDt022236@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 15465a2c25cc - main - Add sleepq_remove_nested() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 15465a2c25cc2915e8c7c65178805b10e339dde3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:40 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=15465a2c25cc2915e8c7c65178805b10e339dde3 commit 15465a2c25cc2915e8c7c65178805b10e339dde3 Author: Konstantin Belousov AuthorDate: 2021-04-25 00:01:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:13:47 +0000 Add sleepq_remove_nested() The helper removes the thread from a sleep queue, assuming that it would need to sleep. The sleepq_remove_nested() function is intended for quite special case, where suspended thread from traced stopped process is temporary unsuspended to do some work on behalf of the debugger in the target context, and this work might require sleep. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- sys/kern/subr_sleepqueue.c | 20 ++++++++++++++++++++ sys/sys/sleepqueue.h | 1 + 2 files changed, 21 insertions(+) diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c index 20ca455480b5..0718f01fa48a 100644 --- a/sys/kern/subr_sleepqueue.c +++ b/sys/kern/subr_sleepqueue.c @@ -854,6 +854,26 @@ sleepq_remove_thread(struct sleepqueue *sq, struct thread *td) (void *)td, (long)td->td_proc->p_pid, td->td_name); } +void +sleepq_remove_nested(struct thread *td) +{ + struct sleepqueue_chain *sc; + struct sleepqueue *sq; + const void *wchan; + + MPASS(TD_ON_SLEEPQ(td)); + + wchan = td->td_wchan; + sc = SC_LOOKUP(wchan); + mtx_lock_spin(&sc->sc_lock); + sq = sleepq_lookup(wchan); + MPASS(sq != NULL); + thread_lock(td); + sleepq_remove_thread(sq, td); + mtx_unlock_spin(&sc->sc_lock); + /* Returns with the thread lock owned. */ +} + #ifdef INVARIANTS /* * UMA zone item deallocator. diff --git a/sys/sys/sleepqueue.h b/sys/sys/sleepqueue.h index ba2f85f2c8a1..18c7568777b6 100644 --- a/sys/sys/sleepqueue.h +++ b/sys/sys/sleepqueue.h @@ -100,6 +100,7 @@ void sleepq_release(const void *wchan); void sleepq_remove(struct thread *td, const void *wchan); int sleepq_remove_matching(struct sleepqueue *sq, int queue, bool (*matches)(struct thread *), int pri); +void sleepq_remove_nested(struct thread *td); int sleepq_signal(const void *wchan, int flags, int pri, int queue); void sleepq_set_timeout_sbt(const void *wchan, sbintime_t sbt, sbintime_t pr, int flags); From owner-dev-commits-src-all@freebsd.org Mon May 3 16:20:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C41A06366F0; Mon, 3 May 2021 16:20:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYp9j0LMrz3DNZ; Mon, 3 May 2021 16:20:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EA44C21481; Mon, 3 May 2021 16:20:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GKeU5022258; Mon, 3 May 2021 16:20:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKejI022257; Mon, 3 May 2021 16:20:40 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:40 GMT Message-Id: <202105031620.143GKejI022257@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: af928fded070 - main - Add thread_run_flash() helper MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af928fded0705100e4f3926c99ed488f7ab6dcf1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=af928fded0705100e4f3926c99ed488f7ab6dcf1 commit af928fded0705100e4f3926c99ed488f7ab6dcf1 Author: Konstantin Belousov AuthorDate: 2021-04-24 11:47:53 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:13:47 +0000 Add thread_run_flash() helper It unsuspends single suspended thread, passed as the argument. It is up to the caller to arrange the target thread to suspend later, since the state of the process is not changed from stopped. In particular, the unsuspended thread must not leave to userspace, since boundary code is not prepared to this situation. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- sys/kern/kern_thread.c | 25 +++++++++++++++++++++++++ sys/sys/proc.h | 1 + 2 files changed, 26 insertions(+) diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index ea569576e7c9..d5549baa6ad5 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -1514,6 +1514,31 @@ thread_unsuspend_one(struct thread *td, struct proc *p, bool boundary) return (setrunnable(td, 0)); } +void +thread_run_flash(struct thread *td) +{ + struct proc *p; + + p = td->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); + + if (TD_ON_SLEEPQ(td)) + sleepq_remove_nested(td); + else + thread_lock(td); + + THREAD_LOCK_ASSERT(td, MA_OWNED); + KASSERT(TD_IS_SUSPENDED(td), ("Thread not suspended")); + + TD_CLR_SUSPENDED(td); + PROC_SLOCK(p); + MPASS(p->p_suspcount > 0); + p->p_suspcount--; + PROC_SUNLOCK(p); + if (setrunnable(td, 0)) + kick_proc0(); +} + /* * Allow all threads blocked by single threading to continue running. */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index b82de183aa44..a078b859ddc1 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1191,6 +1191,7 @@ void thread_stopped(struct proc *p); void childproc_stopped(struct proc *child, int reason); void childproc_continued(struct proc *child); void childproc_exited(struct proc *child); +void thread_run_flash(struct thread *td); int thread_suspend_check(int how); bool thread_suspend_check_needed(void); void thread_suspend_switch(struct thread *, struct proc *p); From owner-dev-commits-src-all@freebsd.org Mon May 3 16:20:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C2E76369B3; Mon, 3 May 2021 16:20:42 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYp9k2Ydzz3D7S; Mon, 3 May 2021 16:20:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1683C20FDE; Mon, 3 May 2021 16:20:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GKfhY022286; Mon, 3 May 2021 16:20:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKfWb022285; Mon, 3 May 2021 16:20:41 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:41 GMT Message-Id: <202105031620.143GKfWb022285@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2bd0506c8d94 - main - kern_ptrace: change type of proctree_locked to bool MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2bd0506c8d94a2c581dd16407f3a1c159a38769b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:42 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2bd0506c8d94a2c581dd16407f3a1c159a38769b commit 2bd0506c8d94a2c581dd16407f3a1c159a38769b Author: Konstantin Belousov AuthorDate: 2021-04-30 21:14:26 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:13:48 +0000 kern_ptrace: change type of proctree_locked to bool Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- sys/kern/sys_process.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 27a690e65638..492ef287ca53 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -612,13 +612,14 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) struct ptrace_lwpinfo *pl; struct ptrace_sc_ret *psr; int error, num, tmp; - int proctree_locked = 0; lwpid_t tid = 0, *buf; #ifdef COMPAT_FREEBSD32 int wrap32 = 0, safe = 0; #endif + bool proctree_locked; curp = td->td_proc; + proctree_locked = false; /* Lock proctree before locking the process. */ switch (req) { @@ -636,7 +637,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) case PT_DETACH: case PT_GET_SC_ARGS: sx_xlock(&proctree_lock); - proctree_locked = 1; + proctree_locked = true; break; default: break; @@ -816,7 +817,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) p->p_oppid); sx_xunlock(&proctree_lock); - proctree_locked = 0; + proctree_locked = false; MPASS(p->p_xthread == NULL); MPASS((p->p_flag & P_STOPPED_TRACE) == 0); @@ -1053,10 +1054,10 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) } sx_xunlock(&proctree_lock); - proctree_locked = 0; + proctree_locked = false; sendsig: - MPASS(proctree_locked == 0); + MPASS(!proctree_locked); /* * Clear the pending event for the thread that just From owner-dev-commits-src-all@freebsd.org Mon May 3 16:20:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C019963684E; Mon, 3 May 2021 16:20:44 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYp9m3Cgyz3DX0; Mon, 3 May 2021 16:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4244421405; Mon, 3 May 2021 16:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GKiUT022328; Mon, 3 May 2021 16:20:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKib3022327; Mon, 3 May 2021 16:20:44 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:44 GMT Message-Id: <202105031620.143GKib3022327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9ebf9100bad1 - main - ptrace: do not allow for parallel ptrace requests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ebf9100bad129a92961572ac862781d6c5681c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:44 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9ebf9100bad129a92961572ac862781d6c5681c7 commit 9ebf9100bad129a92961572ac862781d6c5681c7 Author: Konstantin Belousov AuthorDate: 2021-04-24 11:57:40 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:16:30 +0000 ptrace: do not allow for parallel ptrace requests Set a new P2_PTRACEREQ flag around the request Wait for the target . process P2_PTRACEREQ flag to clear before setting ours . Otherwise, we rely on the moment that the process lock is not dropped until the stopped target state is important. This is going to be no longer true after some future change. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- sys/kern/sys_process.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- sys/sys/proc.h | 1 + 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 4eb7383ca8f0..27849de47fde 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -604,11 +604,18 @@ proc_set_traced(struct proc *p, bool stop) static int proc_can_ptrace(struct thread *td, struct proc *p) { + int error; + PROC_LOCK_ASSERT(p, MA_OWNED); if ((p->p_flag & P_WEXIT) != 0) return (ESRCH); + if ((error = p_cansee(td, p)) != 0) + return (error); + if ((error = p_candebug(td, p)) != 0) + return (error); + /* not being traced... */ if ((p->p_flag & P_TRACED) == 0) return (EPERM); @@ -640,10 +647,11 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) #ifdef COMPAT_FREEBSD32 int wrap32 = 0, safe = 0; #endif - bool proctree_locked; + bool proctree_locked, p2_req_set; curp = td->td_proc; proctree_locked = false; + p2_req_set = false; /* Lock proctree before locking the process. */ switch (req) { @@ -782,15 +790,47 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) /* FALLTHROUGH */ default: + /* + * Check for ptrace eligibility before waiting for + * holds to drain. + */ error = proc_can_ptrace(td, p); if (error != 0) goto fail; + /* + * Block parallel ptrace requests. Most important, do + * not allow other thread in debugger to continue the + * debuggee until coredump finished. + */ + while ((p->p_flag2 & P2_PTRACEREQ) != 0) { + if (proctree_locked) + sx_xunlock(&proctree_lock); + error = msleep(&p->p_flag2, &p->p_mtx, PPAUSE | PCATCH | + (proctree_locked ? PDROP : 0), "pptrace", 0); + if (proctree_locked) { + sx_xlock(&proctree_lock); + PROC_LOCK(p); + } + if (error == 0 && td2->td_proc != p) + error = ESRCH; + if (error == 0) + error = proc_can_ptrace(td, p); + if (error != 0) + goto fail; + } + /* Ok */ break; } - /* Keep this process around until we finish this request. */ + /* + * Keep this process around and request parallel ptrace() + * request to wait until we finish this request. + */ + MPASS((p->p_flag2 & P2_PTRACEREQ) == 0); + p->p_flag2 |= P2_PTRACEREQ; + p2_req_set = true; _PHOLD(p); /* @@ -1325,6 +1365,11 @@ out: /* Drop our hold on this process now that the request has completed. */ _PRELE(p); fail: + if (p2_req_set) { + if ((p->p_flag2 & P2_PTRACEREQ) != 0) + wakeup(&p->p_flag2); + p->p_flag2 &= ~P2_PTRACEREQ; + } PROC_UNLOCK(p); if (proctree_locked) sx_xunlock(&proctree_lock); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index a078b859ddc1..e02e97d74229 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -829,6 +829,7 @@ struct proc { #define P2_STKGAP_DISABLE_EXEC 0x00001000 /* Stack gap disabled after exec */ #define P2_ITSTOPPED 0x00002000 +#define P2_PTRACEREQ 0x00004000 /* Active ptrace req */ /* Flags protected by proctree_lock, kept in p_treeflags. */ #define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */ From owner-dev-commits-src-all@freebsd.org Mon May 3 16:20:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B81616366FA; Mon, 3 May 2021 16:20:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYp9l3Hrmz3DR0; Mon, 3 May 2021 16:20:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4222821381; Mon, 3 May 2021 16:20:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GKhCr022307; Mon, 3 May 2021 16:20:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKhoI022306; Mon, 3 May 2021 16:20:43 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:43 GMT Message-Id: <202105031620.143GKhoI022306@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 54c8baa02195 - main - kern_ptrace(): extract code to determine ptrace eligibility into helper MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 54c8baa021957bc026406b3a424296e84b28baa5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:44 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=54c8baa021957bc026406b3a424296e84b28baa5 commit 54c8baa021957bc026406b3a424296e84b28baa5 Author: Konstantin Belousov AuthorDate: 2021-04-24 11:52:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:13:48 +0000 kern_ptrace(): extract code to determine ptrace eligibility into helper Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- sys/kern/sys_process.c | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 492ef287ca53..4eb7383ca8f0 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -601,6 +601,30 @@ proc_set_traced(struct proc *p, bool stop) p->p_ptevents = PTRACE_DEFAULT; } +static int +proc_can_ptrace(struct thread *td, struct proc *p) +{ + PROC_LOCK_ASSERT(p, MA_OWNED); + + if ((p->p_flag & P_WEXIT) != 0) + return (ESRCH); + + /* not being traced... */ + if ((p->p_flag & P_TRACED) == 0) + return (EPERM); + + /* not being traced by YOU */ + if (p->p_pptr != td->td_proc) + return (EBUSY); + + /* not currently stopped */ + if ((p->p_flag & P_STOPPED_TRACE) == 0 || + p->p_suspcount != p->p_numthreads || + (p->p_flag & P_WAITED) == 0) + return (EBUSY); + + return (0); +} int kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) { @@ -758,27 +782,11 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) /* FALLTHROUGH */ default: - /* not being traced... */ - if ((p->p_flag & P_TRACED) == 0) { - error = EPERM; + error = proc_can_ptrace(td, p); + if (error != 0) goto fail; - } - - /* not being traced by YOU */ - if (p->p_pptr != td->td_proc) { - error = EBUSY; - goto fail; - } - /* not currently stopped */ - if ((p->p_flag & P_STOPPED_TRACE) == 0 || - p->p_suspcount != p->p_numthreads || - (p->p_flag & P_WAITED) == 0) { - error = EBUSY; - goto fail; - } - - /* OK */ + /* Ok */ break; } From owner-dev-commits-src-all@freebsd.org Mon May 3 16:20:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F21463694D; Mon, 3 May 2021 16:20:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYp9n6WWnz3D7j; Mon, 3 May 2021 16:20:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 733F7210D8; Mon, 3 May 2021 16:20:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GKjRw022349; Mon, 3 May 2021 16:20:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKjRQ022348; Mon, 3 May 2021 16:20:45 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:45 GMT Message-Id: <202105031620.143GKjRQ022348@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 68d311b66678 - main - ptracestop: mark threads suspended there with the new TDB_SSWITCH flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 68d311b66678d9daffc5cf1c78f3101f2eeec3ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:46 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=68d311b66678d9daffc5cf1c78f3101f2eeec3ea commit 68d311b66678d9daffc5cf1c78f3101f2eeec3ea Author: Konstantin Belousov AuthorDate: 2021-04-24 12:02:40 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:18:25 +0000 ptracestop: mark threads suspended there with the new TDB_SSWITCH flag This way threads in ptracestop can be discovered by debugger Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- sys/kern/kern_sig.c | 2 ++ sys/sys/proc.h | 1 + 2 files changed, 3 insertions(+) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 46b520030dcd..445582a176c8 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2648,7 +2648,9 @@ ptracestop(struct thread *td, int sig, ksiginfo_t *si) td->td_dbgflags &= ~TDB_STOPATFORK; } stopme: + td->td_dbgflags |= TDB_SSWITCH; thread_suspend_switch(td, p); + td->td_dbgflags &= ~TDB_SSWITCH; if (p->p_xthread == td) p->p_xthread = NULL; if (!(p->p_flag & P_TRACED)) diff --git a/sys/sys/proc.h b/sys/sys/proc.h index e02e97d74229..b959681e992b 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -485,6 +485,7 @@ do { \ #define TDB_VFORK 0x00000800 /* vfork indicator for ptrace() */ #define TDB_FSTP 0x00001000 /* The thread is PT_ATTACH leader */ #define TDB_STEP 0x00002000 /* (x86) PSL_T set for PT_STEP */ +#define TDB_SSWITCH 0x00004000 /* Suspended in ptracestop */ /* * "Private" flags kept in td_pflags: From owner-dev-commits-src-all@freebsd.org Mon May 3 16:20:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BDA06369B9; Mon, 3 May 2021 16:20:47 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYp9p6Jfjz3D7s; Mon, 3 May 2021 16:20:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 97789211BF; Mon, 3 May 2021 16:20:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GKkqA022370; Mon, 3 May 2021 16:20:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKk2F022369; Mon, 3 May 2021 16:20:46 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:46 GMT Message-Id: <202105031620.143GKk2F022369@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 87a64872cd31 - main - Add ptrace(PT_COREDUMP) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 87a64872cd3166a09b58aac28cdb95380d6a38eb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:47 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=87a64872cd3166a09b58aac28cdb95380d6a38eb commit 87a64872cd3166a09b58aac28cdb95380d6a38eb Author: Konstantin Belousov AuthorDate: 2021-04-23 13:26:01 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:18:26 +0000 Add ptrace(PT_COREDUMP) It writes the core of live stopped process to the file descriptor provided as an argument. Based on the initial version from https://reviews.freebsd.org/D29691, submitted by MichaÅ‚ Górny . Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- lib/libc/sys/ptrace.2 | 66 ++++++++++++++++++++++++++- sys/compat/freebsd32/freebsd32.h | 7 +++ sys/compat/freebsd32/freebsd32_misc.c | 12 +++++ sys/kern/kern_sig.c | 42 +++++++++++++++++ sys/kern/sys_process.c | 85 ++++++++++++++++++++++++++++++++++- sys/sys/proc.h | 2 + sys/sys/ptrace.h | 21 +++++++++ 7 files changed, 233 insertions(+), 2 deletions(-) diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2 index 8e9c5d8ab87a..6148e6d333d5 100644 --- a/lib/libc/sys/ptrace.2 +++ b/lib/libc/sys/ptrace.2 @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd July 15, 2019 +.Dd April 10, 2021 .Dt PTRACE 2 .Os .Sh NAME @@ -807,6 +807,70 @@ and extends up to The .Fa data argument is ignored. +.It Dv PT_COREDUMP +This request creates a coredump for the stopped program. +The +.Fa addr +argument specifies a pointer to a +.Vt "struct ptrace_coredump" , +which is defined as follows: +.Bd -literal +struct ptrace_coredump { + int pc_fd; + uint32_t pc_flags; + off_t pc_limit; +}; +.Ed +The fields of the structure are: +.Bl -tag -width pc_flags +.It Dv pc_fd +File descriptor to write the dump to. +It must refer to a regular file, opened for writing. +.It Dv pc_flags +Flags. +The following flags are defined: +.Bl -tag -width PC_COMPRESS +.It Dv PC_COMPRESS +Request compression of the dump. +.It Dv PC_ALL +Include non-dumpable entries into the dump. +The dumper ignores +.Dv MAP_NOCORE +flag of the process map entry, but device mappings are not dumped even with +.Dv PC_ALL +set. +.El +.It Dv pc_limit +Maximum size of the coredump. +Specify zero for no limit. +.El +.Pp +The size of +.Vt "struct ptrace_coredump" +must be passed in +.Fa data . +.Pp +The process must be stopped before dumping core. +A single thread in the target process is temporarily unsuspended +in kernel to write the dump. +If the +.Nm +call fails before a thread is unsuspended, there is no event to +.Xr waitpid 2 +for. +If a thread was unsuspended, it will stop again before the +.Nm +call returns, and the process must be waited upon using +.Xr waitpid 2 +to consume the new stop event. +Since it is hard to deduce whether a thread was unsuspended before +an error occurred, it is recommended to unconditionally perform +.Xr waitpid 2 +with +.Dv WNOHANG +flag after +.Dv PT_COREDUMP , +and silently accept zero result from it. .El .Sh ARM MACHINE-SPECIFIC REQUESTS .Bl -tag -width "Dv PT_SETVFPREGS" diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h index 4227d9037afb..2e4f5155cbf4 100644 --- a/sys/compat/freebsd32/freebsd32.h +++ b/sys/compat/freebsd32/freebsd32.h @@ -429,4 +429,11 @@ struct timex32 { int32_t stbcnt; }; +struct ptrace_coredump32 { + int pc_fd; + uint32_t pc_flags; + uint32_t pc_limit1, pc_limit2; +}; + + #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */ diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index c2caa7c10544..f221397e91dc 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -932,6 +932,7 @@ freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap) struct ptrace_io_desc piod; struct ptrace_lwpinfo pl; struct ptrace_vm_entry pve; + struct ptrace_coredump pc; struct dbreg32 dbreg; struct fpreg32 fpreg; struct reg32 reg; @@ -943,6 +944,7 @@ freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap) struct ptrace_io_desc32 piod; struct ptrace_lwpinfo32 pl; struct ptrace_vm_entry32 pve; + struct ptrace_coredump32 pc; uint32_t args[nitems(td->td_sa.args)]; struct ptrace_sc_ret32 psr; } r32; @@ -1021,6 +1023,16 @@ freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap) CP(r32.pve, r.pve, pve_fsid); PTRIN_CP(r32.pve, r.pve, pve_path); break; + case PT_COREDUMP: + if (uap->data != sizeof(r32.pc)) + error = EINVAL; + else + error = copyin(uap->addr, &r32.pc, uap->data); + CP(r32.pc, r.pc, pc_fd); + CP(r32.pc, r.pc, pc_flags); + r.pc.pc_limit = PAIR32TO64(off_t, r32.pc.pc_limit); + data = sizeof(r.pc); + break; default: addr = uap->addr; break; diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 445582a176c8..0453d3b2702c 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2521,6 +2521,42 @@ out: thread_unlock(td); } +static void +ptrace_coredump(struct thread *td) +{ + struct proc *p; + struct thr_coredump_req *tcq; + void *rl_cookie; + + MPASS(td == curthread); + p = td->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); + if ((td->td_dbgflags & TDB_COREDUMPRQ) == 0) + return; + KASSERT((p->p_flag & P_STOPPED_TRACE) != 0, ("not stopped")); + + tcq = td->td_coredump; + KASSERT(tcq != NULL, ("td_coredump is NULL")); + + if (p->p_sysent->sv_coredump == NULL) { + tcq->tc_error = ENOSYS; + goto wake; + } + + PROC_UNLOCK(p); + rl_cookie = vn_rangelock_wlock(tcq->tc_vp, 0, OFF_MAX); + + tcq->tc_error = p->p_sysent->sv_coredump(td, tcq->tc_vp, + tcq->tc_limit, tcq->tc_flags); + + vn_rangelock_unlock(tcq->tc_vp, rl_cookie); + PROC_LOCK(p); +wake: + td->td_dbgflags &= ~TDB_COREDUMPRQ; + td->td_coredump = NULL; + wakeup(p); +} + static int sig_suspend_threads(struct thread *td, struct proc *p, int sending) { @@ -2651,6 +2687,12 @@ stopme: td->td_dbgflags |= TDB_SSWITCH; thread_suspend_switch(td, p); td->td_dbgflags &= ~TDB_SSWITCH; + if ((td->td_dbgflags & TDB_COREDUMPRQ) != 0) { + PROC_SUNLOCK(p); + ptrace_coredump(td); + PROC_SLOCK(p); + goto stopme; + } if (p->p_xthread == td) p->p_xthread = NULL; if (!(p->p_flag & P_TRACED)) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 27849de47fde..50157106a35e 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include @@ -469,6 +471,7 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) struct ptrace_io_desc piod; struct ptrace_lwpinfo pl; struct ptrace_vm_entry pve; + struct ptrace_coredump pc; struct dbreg dbreg; struct fpreg fpreg; struct reg reg; @@ -519,6 +522,12 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) case PT_VM_ENTRY: error = copyin(uap->addr, &r.pve, sizeof(r.pve)); break; + case PT_COREDUMP: + if (uap->data != sizeof(r.pc)) + error = EINVAL; + else + error = copyin(uap->addr, &r.pc, uap->data); + break; default: addr = uap->addr; break; @@ -632,6 +641,22 @@ proc_can_ptrace(struct thread *td, struct proc *p) return (0); } + +static struct thread * +ptrace_sel_coredump_thread(struct proc *p) +{ + struct thread *td2; + + PROC_LOCK_ASSERT(p, MA_OWNED); + MPASS((p->p_flag & P_STOPPED_TRACE) != 0); + + FOREACH_THREAD_IN_PROC(p, td2) { + if ((td2->td_dbgflags & TDB_SSWITCH) != 0) + return (td2); + } + return (NULL); +} + int kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) { @@ -642,6 +667,9 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) struct ptrace_io_desc *piod = NULL; struct ptrace_lwpinfo *pl; struct ptrace_sc_ret *psr; + struct file *fp; + struct ptrace_coredump *pc; + struct thr_coredump_req *tcq; int error, num, tmp; lwpid_t tid = 0, *buf; #ifdef COMPAT_FREEBSD32 @@ -1348,6 +1376,62 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) PROC_LOCK(p); break; + case PT_COREDUMP: + pc = addr; + CTR2(KTR_PTRACE, "PT_COREDUMP: pid %d, fd %d", + p->p_pid, pc->pc_fd); + + if ((pc->pc_flags & ~(PC_COMPRESS | PC_ALL)) != 0) { + error = EINVAL; + break; + } + PROC_UNLOCK(p); + + tcq = malloc(sizeof(*tcq), M_TEMP, M_WAITOK | M_ZERO); + fp = NULL; + error = fget_write(td, pc->pc_fd, &cap_write_rights, &fp); + if (error != 0) + goto coredump_cleanup_nofp; + if (fp->f_type != DTYPE_VNODE || fp->f_vnode->v_type != VREG) { + error = EPIPE; + goto coredump_cleanup; + } + + PROC_LOCK(p); + error = proc_can_ptrace(td, p); + if (error != 0) + goto coredump_cleanup_locked; + + td2 = ptrace_sel_coredump_thread(p); + if (td2 == NULL) { + error = EBUSY; + goto coredump_cleanup_locked; + } + KASSERT((td2->td_dbgflags & TDB_COREDUMPRQ) == 0, + ("proc %d tid %d req coredump", p->p_pid, td2->td_tid)); + + tcq->tc_vp = fp->f_vnode; + tcq->tc_limit = pc->pc_limit == 0 ? OFF_MAX : pc->pc_limit; + tcq->tc_flags = SVC_PT_COREDUMP; + if ((pc->pc_flags & PC_COMPRESS) == 0) + tcq->tc_flags |= SVC_NOCOMPRESS; + if ((pc->pc_flags & PC_ALL) != 0) + tcq->tc_flags |= SVC_ALL; + td2->td_coredump = tcq; + td2->td_dbgflags |= TDB_COREDUMPRQ; + thread_run_flash(td2); + while ((td2->td_dbgflags & TDB_COREDUMPRQ) != 0) + msleep(p, &p->p_mtx, PPAUSE, "crdmp", 0); + error = tcq->tc_error; +coredump_cleanup_locked: + PROC_UNLOCK(p); +coredump_cleanup: + fdrop(fp, td); +coredump_cleanup_nofp: + free(tcq, M_TEMP); + PROC_LOCK(p); + break; + default: #ifdef __HAVE_PTRACE_MACHDEP if (req >= PT_FIRSTMACH) { @@ -1360,7 +1444,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) error = EINVAL; break; } - out: /* Drop our hold on this process now that the request has completed. */ _PRELE(p); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index b959681e992b..ebd396b4aebe 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -377,6 +377,7 @@ struct thread { int td_oncpu; /* (t) Which cpu we are on. */ void *td_lkpi_task; /* LinuxKPI task struct pointer */ int td_pmcpend; + void *td_coredump; /* (c) coredump request. */ #ifdef EPOCH_TRACE SLIST_HEAD(, epoch_tracker) td_epochs; #endif @@ -486,6 +487,7 @@ do { \ #define TDB_FSTP 0x00001000 /* The thread is PT_ATTACH leader */ #define TDB_STEP 0x00002000 /* (x86) PSL_T set for PT_STEP */ #define TDB_SSWITCH 0x00004000 /* Suspended in ptracestop */ +#define TDB_COREDUMPRQ 0x00008000 /* Coredump request */ /* * "Private" flags kept in td_pflags: diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h index 1ee42318e57e..06f01a04fd9d 100644 --- a/sys/sys/ptrace.h +++ b/sys/sys/ptrace.h @@ -74,6 +74,8 @@ #define PT_GET_SC_ARGS 27 /* fetch syscall args */ #define PT_GET_SC_RET 28 /* fetch syscall results */ +#define PT_COREDUMP 29 /* create a coredump */ + #define PT_GETREGS 33 /* get general-purpose registers */ #define PT_SETREGS 34 /* set general-purpose registers */ #define PT_GETFPREGS 35 /* get floating-point registers */ @@ -176,8 +178,27 @@ struct ptrace_vm_entry { char *pve_path; /* Path name of object. */ }; +/* Argument structure for PT_COREDUMP */ +struct ptrace_coredump { + int pc_fd; /* File descriptor to write dump to. */ + uint32_t pc_flags; /* Flags PC_* */ + off_t pc_limit; /* Maximum size of the coredump, + 0 for no limit. */ +}; + +/* Flags for PT_COREDUMP pc_flags */ +#define PC_COMPRESS 0x00000001 /* Allow compression */ +#define PC_ALL 0x00000002 /* Include non-dumpable entries */ + #ifdef _KERNEL +struct thr_coredump_req { + struct vnode *tc_vp; /* vnode to write coredump to. */ + off_t tc_limit; /* max coredump file size. */ + int tc_flags; /* user flags */ + int tc_error; /* request result */ +}; + int ptrace_set_pc(struct thread *_td, unsigned long _addr); int ptrace_single_step(struct thread *_td); int ptrace_clear_single_step(struct thread *_td); From owner-dev-commits-src-all@freebsd.org Mon May 3 16:20:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 224DD6369BF; Mon, 3 May 2021 16:20:48 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYp9q6HXxz3DZV; Mon, 3 May 2021 16:20:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B39B72159D; Mon, 3 May 2021 16:20:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GKlWA022395; Mon, 3 May 2021 16:20:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKlWv022394; Mon, 3 May 2021 16:20:47 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:47 GMT Message-Id: <202105031620.143GKlWv022394@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: c192228b7398 - main - gcore: split code to open core file into helper MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c192228b7398df72e472128605338555e5aa2db9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:48 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c192228b7398df72e472128605338555e5aa2db9 commit c192228b7398df72e472128605338555e5aa2db9 Author: Konstantin Belousov AuthorDate: 2021-04-24 10:31:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:18:26 +0000 gcore: split code to open core file into helper Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- usr.bin/gcore/gcore.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/usr.bin/gcore/gcore.c b/usr.bin/gcore/gcore.c index 8681b8484d81..cbbfea82085b 100644 --- a/usr.bin/gcore/gcore.c +++ b/usr.bin/gcore/gcore.c @@ -78,12 +78,27 @@ static pid_t pid; SET_DECLARE(dumpset, struct dumpers); +static int +open_corefile(char *corefile) +{ + char fname[MAXPATHLEN]; + + if (corefile == NULL) { + (void)snprintf(fname, sizeof(fname), "core.%d", pid); + corefile = fname; + } + fd = open(corefile, O_RDWR | O_CREAT | O_TRUNC, DEFFILEMODE); + if (fd < 0) + err(1, "%s", corefile); + return (fd); +} + int main(int argc, char *argv[]) { int ch, efd, fd, name[4]; char *binfile, *corefile; - char passpath[MAXPATHLEN], fname[MAXPATHLEN]; + char passpath[MAXPATHLEN]; struct dumpers **d, *dumper; size_t len; @@ -138,13 +153,7 @@ main(int argc, char *argv[]) } if (dumper == NULL) errx(1, "Invalid executable file"); - if (corefile == NULL) { - (void)snprintf(fname, sizeof(fname), "core.%d", pid); - corefile = fname; - } - fd = open(corefile, O_RDWR|O_CREAT|O_TRUNC, DEFFILEMODE); - if (fd < 0) - err(1, "%s", corefile); + fd = open_corefile(corefile); dumper->dump(efd, fd, pid); (void)close(fd); From owner-dev-commits-src-all@freebsd.org Mon May 3 16:20:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0DEC636B88; Mon, 3 May 2021 16:20:49 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYp9s0wbxz3DPG; Mon, 3 May 2021 16:20:48 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C399521407; Mon, 3 May 2021 16:20:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GKmtS022418; Mon, 3 May 2021 16:20:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKmsd022417; Mon, 3 May 2021 16:20:48 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:48 GMT Message-Id: <202105031620.143GKmsd022417@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 73e8f06ac523 - main - gcore: add option to dump core using kernel facility MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 73e8f06ac523ee4b530e17d50cc580dc366f7ad8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:50 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=73e8f06ac523ee4b530e17d50cc580dc366f7ad8 commit 73e8f06ac523ee4b530e17d50cc580dc366f7ad8 Author: Konstantin Belousov AuthorDate: 2021-04-24 11:20:24 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:18:26 +0000 gcore: add option to dump core using kernel facility -k switch causes gcore to use ptrace(PT_COREDUMP) instead of manually reading process memory and constructing the core. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- usr.bin/gcore/gcore.1 | 16 +++++++++-- usr.bin/gcore/gcore.c | 75 ++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 80 insertions(+), 11 deletions(-) diff --git a/usr.bin/gcore/gcore.1 b/usr.bin/gcore/gcore.1 index 55db2aed3e3a..aa93a5ef1fe0 100644 --- a/usr.bin/gcore/gcore.1 +++ b/usr.bin/gcore/gcore.1 @@ -28,7 +28,7 @@ .\" @(#)gcore.1 8.2 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd July 13, 2016 +.Dd April 24, 2021 .Dt GCORE 1 .Os .Sh NAME @@ -37,6 +37,7 @@ .Sh SYNOPSIS .Nm .Op Fl f +.Op Fl k .Op Fl c Ar core .Op Ar executable .Ar pid @@ -58,13 +59,24 @@ The following options are available: Write the core file to the specified file instead of .Dq Pa core. . .It Fl f -Dumps all available segments, excluding only malformed and undumpable segments. +Dumps all available segments, excluding only malformed and undumpable +segments. Unlike the default invocation, this flag dumps mappings of devices which may invalidate the state of device transactions or trigger other unexpected behavior. As a result, this flag should only be used when the behavior of the application and any devices it has mapped is fully understood and any side effects can be controlled or tolerated. +.It Fl k +Use the +.Xr ptrace 2 +.Dv PT_COREDUMP +kernel facility to write the core dump, instead of reading the process' +memory and constructing the dump file in +.Nm +itself. +This is faster, and the dump is written by the +same kernel code that writes core dumps upon fatal signals. .El .Sh FILES .Bl -tag -width /var/log/messages -compact diff --git a/usr.bin/gcore/gcore.c b/usr.bin/gcore/gcore.c index cbbfea82085b..8055193625f9 100644 --- a/usr.bin/gcore/gcore.c +++ b/usr.bin/gcore/gcore.c @@ -56,13 +56,16 @@ __FBSDID("$FreeBSD$"); */ #include +#include #include #include #include #include +#include #include #include +#include #include #include #include @@ -75,6 +78,7 @@ static void killed(int); static void usage(void) __dead2; static pid_t pid; +static bool kflag = false; SET_DECLARE(dumpset, struct dumpers); @@ -82,6 +86,7 @@ static int open_corefile(char *corefile) { char fname[MAXPATHLEN]; + int fd; if (corefile == NULL) { (void)snprintf(fname, sizeof(fname), "core.%d", pid); @@ -93,6 +98,45 @@ open_corefile(char *corefile) return (fd); } +static void +kcoredump(int fd, pid_t pid) +{ + struct ptrace_coredump pc; + int error, res, ret, waited; + + error = ptrace(PT_ATTACH, pid, NULL, 0); + if (error != 0) + err(1, "attach"); + + waited = waitpid(pid, &res, 0); + if (waited == -1) + err(1, "wait for STOP"); + + ret = 0; + memset(&pc, 0, sizeof(pc)); + pc.pc_fd = fd; + pc.pc_flags = (pflags & PFLAGS_FULL) != 0 ? PC_ALL : 0; + error = ptrace(PT_COREDUMP, pid, (void *)&pc, sizeof(pc)); + if (error == -1) { + warn("coredump"); + ret = 1; + } + + waited = waitpid(pid, &res, WNOHANG); + if (waited == -1) { + warn("wait after coredump"); + ret = 1; + } + + error = ptrace(PT_DETACH, pid, NULL, 0); + if (error == -1) { + warn("detach failed, check process status"); + ret = 1; + } + + exit(ret); +} + int main(int argc, char *argv[]) { @@ -104,7 +148,7 @@ main(int argc, char *argv[]) pflags = 0; corefile = NULL; - while ((ch = getopt(argc, argv, "c:f")) != -1) { + while ((ch = getopt(argc, argv, "c:fk")) != -1) { switch (ch) { case 'c': corefile = optarg; @@ -112,6 +156,9 @@ main(int argc, char *argv[]) case 'f': pflags |= PFLAGS_FULL; break; + case 'k': + kflag = true; + break; default: usage(); break; @@ -119,10 +166,26 @@ main(int argc, char *argv[]) } argv += optind; argc -= optind; + /* XXX we should check that the pid argument is really a number */ switch (argc) { case 1: pid = atoi(argv[0]); + break; + case 2: + binfile = argv[0]; + pid = atoi(argv[1]); + break; + default: + usage(); + } + + if (kflag) { + fd = open_corefile(corefile); + kcoredump(fd, pid); + } + + if (argc == 1) { name[0] = CTL_KERN; name[1] = KERN_PROC; name[2] = KERN_PROC_PATHNAME; @@ -131,13 +194,6 @@ main(int argc, char *argv[]) if (sysctl(name, 4, passpath, &len, NULL, 0) == -1) errx(1, "kern.proc.pathname failure"); binfile = passpath; - break; - case 2: - pid = atoi(argv[1]); - binfile = argv[0]; - break; - default: - usage(); } efd = open(binfile, O_RDONLY, 0); if (efd < 0) @@ -165,6 +221,7 @@ void usage(void) { - (void)fprintf(stderr, "usage: gcore [-c core] [executable] pid\n"); + (void)fprintf(stderr, + "usage: gcore [-kf] [-c core] [executable] pid\n"); exit(1); } From owner-dev-commits-src-all@freebsd.org Mon May 3 16:38:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 128DD637409; Mon, 3 May 2021 16:38:11 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYpYv03s2z3F8w; Mon, 3 May 2021 16:38:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E4B84217E5; Mon, 3 May 2021 16:38:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GcAne040609; Mon, 3 May 2021 16:38:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GcAZ9040608; Mon, 3 May 2021 16:38:10 GMT (envelope-from git) Date: Mon, 3 May 2021 16:38:10 GMT Message-Id: <202105031638.143GcAZ9040608@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: b87a5b266d88 - main - ndis: remove leftover ndis_events binary and manpage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b87a5b266d88b658ac0afa10f5f82adc21f4382a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:38:11 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=b87a5b266d88b658ac0afa10f5f82adc21f4382a commit b87a5b266d88b658ac0afa10f5f82adc21f4382a Author: Dimitry Andric AuthorDate: 2021-05-03 16:37:31 +0000 Commit: Dimitry Andric CommitDate: 2021-05-03 16:37:42 +0000 ndis: remove leftover ndis_events binary and manpage Fixes: bfc99943b04b ("ndis(4): remove as previous announced") --- ObsoleteFiles.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 4b66a3ecbb97..2b4996f4dc98 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -2965,10 +2965,12 @@ OLD_LIBS+=usr/lib/libpanel.so.5 OLD_LIBS+=usr/lib/libpanelw.so.5 # 20210125: ndis driver support removed +OLD_FILES+=usr/sbin/ndis_events OLD_FILES+=usr/sbin/ndiscvt OLD_FILES+=usr/sbin/ndisgen OLD_FILES+=usr/share/man/man4/ndis.4.gz OLD_FILES+=usr/share/man/man4/if_ndis.4.gz +OLD_FILES+=usr/share/man/man8/ndis_events.8.gz OLD_FILES+=usr/share/man/man8/ndiscvt.8.gz OLD_FILES+=usr/share/man/man8/ndisgen.8.gz OLD_FILES+=usr/share/misc/windrv_stub.c From owner-dev-commits-src-all@freebsd.org Mon May 3 16:51:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF40463726C; Mon, 3 May 2021 16:51:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYprl5Z5kz3Fkx; Mon, 3 May 2021 16:51:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B107F219A8; Mon, 3 May 2021 16:51:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143Gp3kx065157; Mon, 3 May 2021 16:51:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143Gp31q065156; Mon, 3 May 2021 16:51:03 GMT (envelope-from git) Date: Mon, 3 May 2021 16:51:03 GMT Message-Id: <202105031651.143Gp31q065156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 7cb40543e964 - main - filt_timerexpire: do not iterate over the interval MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7cb40543e96451092d5bc6bb3d96ebee364327e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:51:03 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7cb40543e96451092d5bc6bb3d96ebee364327e0 commit 7cb40543e96451092d5bc6bb3d96ebee364327e0 Author: Konstantin Belousov AuthorDate: 2021-04-28 16:28:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:49:54 +0000 filt_timerexpire: do not iterate over the interval User-supplied data might make this loop too time-consuming. Divide directly, and handle both the possibility that we were woken up earlier, and arithmetic overflows/underflows from the calculation. Reported and tested by: pho (previous version) Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30069 --- sys/kern/kern_event.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 33a6cdcda486..1067e7f128b7 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -718,6 +718,7 @@ filt_timerexpire_l(struct knote *kn, bool proc_locked) { struct kq_timer_cb_data *kc; struct proc *p; + uint64_t delta; sbintime_t now; kc = kn->kn_ptr.p_v; @@ -728,9 +729,17 @@ filt_timerexpire_l(struct knote *kn, bool proc_locked) return; } - for (now = sbinuptime(); kc->next <= now; kc->next += kc->to) - kn->kn_data++; - KNOTE_ACTIVATE(kn, 0); /* XXX - handle locking */ + now = sbinuptime(); + if (now >= kc->next) { + delta = (now - kc->next) / kc->to; + if (delta == 0) + delta = 1; + kn->kn_data += delta; + kc->next += (delta + 1) * kc->to; + if (now >= kc->next) /* overflow */ + kc->next = now + kc->to; + KNOTE_ACTIVATE(kn, 0); /* XXX - handle locking */ + } /* * Initial check for stopped kc->p is racy. It is fine to From owner-dev-commits-src-all@freebsd.org Mon May 3 17:55:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25763638E2A; Mon, 3 May 2021 17:55:38 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYrHG0cX6z3JYC; Mon, 3 May 2021 17:55:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 03C8F22458; Mon, 3 May 2021 17:55:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143Htb0c046775; Mon, 3 May 2021 17:55:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143HtbmP046774; Mon, 3 May 2021 17:55:37 GMT (envelope-from git) Date: Mon, 3 May 2021 17:55:37 GMT Message-Id: <202105031755.143HtbmP046774@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 02e7a6514e63 - main - bhyve: Set SO_REUSEADDR on the gdb stub socket MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02e7a6514e63ceca680fade40797280aef1bf55f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 17:55:38 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=02e7a6514e63ceca680fade40797280aef1bf55f commit 02e7a6514e63ceca680fade40797280aef1bf55f Author: Mark Johnston AuthorDate: 2021-05-03 16:42:54 +0000 Commit: Mark Johnston CommitDate: 2021-05-03 17:24:30 +0000 bhyve: Set SO_REUSEADDR on the gdb stub socket Reviewed by: jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30037 --- usr.sbin/bhyve/gdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c index 5df10467cd62..219d192b7c9a 100644 --- a/usr.sbin/bhyve/gdb.c +++ b/usr.sbin/bhyve/gdb.c @@ -1821,7 +1821,7 @@ void init_gdb(struct vmctx *_ctx, int sport, bool wait) { struct sockaddr_in sin; - int error, flags, s; + int error, flags, optval, s; debug("==> starting on %d, %swaiting\n", sport, wait ? "" : "not "); @@ -1837,6 +1837,9 @@ init_gdb(struct vmctx *_ctx, int sport, bool wait) if (s < 0) err(1, "gdb socket create"); + optval = 1; + (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)); + sin.sin_len = sizeof(sin); sin.sin_family = AF_INET; sin.sin_addr.s_addr = htonl(INADDR_ANY); From owner-dev-commits-src-all@freebsd.org Mon May 3 17:55:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DD2E638F85; Mon, 3 May 2021 17:55:39 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYrHH0xDKz3JpC; Mon, 3 May 2021 17:55:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 12B5E224E5; Mon, 3 May 2021 17:55:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143Htduj046796; Mon, 3 May 2021 17:55:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143HtdH4046795; Mon, 3 May 2021 17:55:39 GMT (envelope-from git) Date: Mon, 3 May 2021 17:55:39 GMT Message-Id: <202105031755.143HtdH4046795@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: cdfcfc607acc - main - smp: Initialize arg->cpus sooner in smp_rendezvous_cpus_retry() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cdfcfc607acc10c8b1b2b6a427c9e1ed7e94ebb3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 17:55:39 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cdfcfc607acc10c8b1b2b6a427c9e1ed7e94ebb3 commit cdfcfc607acc10c8b1b2b6a427c9e1ed7e94ebb3 Author: Mark Johnston AuthorDate: 2021-05-03 16:43:00 +0000 Commit: Mark Johnston CommitDate: 2021-05-03 17:24:30 +0000 smp: Initialize arg->cpus sooner in smp_rendezvous_cpus_retry() Otherwise, if !smp_started is true, then smp_rendezvous_cpus_done() will harmlessly perform an atomic RMW on an uninitialized variable. Reported by: KMSAN MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/kern/subr_smp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index 093622d8f6aa..d4f8aac9e751 100644 --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -895,6 +895,8 @@ smp_rendezvous_cpus_retry(cpuset_t map, { int cpu; + CPU_COPY(&map, &arg->cpus); + /* * Only one CPU to execute on. */ @@ -914,7 +916,6 @@ smp_rendezvous_cpus_retry(cpuset_t map, * Execute an action on all specified CPUs while retrying until they * all acknowledge completion. */ - CPU_COPY(&map, &arg->cpus); for (;;) { smp_rendezvous_cpus( arg->cpus, From owner-dev-commits-src-all@freebsd.org Mon May 3 17:55:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 752AD638EAA; Mon, 3 May 2021 17:55:40 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYrHJ2nwGz3JvL; Mon, 3 May 2021 17:55:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 422102288A; Mon, 3 May 2021 17:55:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143Hterl046819; Mon, 3 May 2021 17:55:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143HteM7046818; Mon, 3 May 2021 17:55:40 GMT (envelope-from git) Date: Mon, 3 May 2021 17:55:40 GMT Message-Id: <202105031755.143HteM7046818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 2b2d77e7204d - main - VOP_STAT: Provide a default value for va_gen MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b2d77e7204d2264dbe0338f4400f14702a2c582 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 17:55:40 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2b2d77e7204d2264dbe0338f4400f14702a2c582 commit 2b2d77e7204d2264dbe0338f4400f14702a2c582 Author: Mark Johnston AuthorDate: 2021-05-03 16:43:05 +0000 Commit: Mark Johnston CommitDate: 2021-05-03 17:24:30 +0000 VOP_STAT: Provide a default value for va_gen Some filesystems, e.g., pseudofs and the NFSv3 client, do not provide one. Reviewed by: kib Reported by: KMSAN Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30091 --- sys/kern/vfs_default.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 4b9b1b43f1ce..cf224981cbe7 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1500,6 +1500,7 @@ vop_stdstat(struct vop_stat_args *a) vap->va_birthtime.tv_sec = -1; vap->va_birthtime.tv_nsec = 0; vap->va_fsid = VNOVAL; + vap->va_gen = 0; vap->va_rdev = NODEV; error = VOP_GETATTR(vp, vap, a->a_active_cred); From owner-dev-commits-src-all@freebsd.org Mon May 3 17:55:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACC1F638F34; Mon, 3 May 2021 17:55:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYrHK46lVz3K1N; Mon, 3 May 2021 17:55:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 604C222459; Mon, 3 May 2021 17:55:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143HtfSa046842; Mon, 3 May 2021 17:55:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143HtfUP046841; Mon, 3 May 2021 17:55:41 GMT (envelope-from git) Date: Mon, 3 May 2021 17:55:41 GMT Message-Id: <202105031755.143HtfUP046841@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 243b324f9668 - main - devfs: Avoid comparison with an uninitialized var in devfs_fp_check() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 243b324f96686642177c8479c03288e2a6f68b50 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 17:55:41 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=243b324f96686642177c8479c03288e2a6f68b50 commit 243b324f96686642177c8479c03288e2a6f68b50 Author: Mark Johnston AuthorDate: 2021-05-03 16:43:29 +0000 Commit: Mark Johnston CommitDate: 2021-05-03 17:24:30 +0000 devfs: Avoid comparison with an uninitialized var in devfs_fp_check() devvn_refthread() will initialize *devp only if it succeeds, so check for success before comparing with fp->f_data. Other devvn_refthread() callers are careful to do this. Reported by: KMSAN Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30068 --- sys/fs/devfs/devfs_vnops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 043cee74fde2..40b80596523d 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -120,9 +120,8 @@ static int devfs_fp_check(struct file *fp, struct cdev **devp, struct cdevsw **dswp, int *ref) { - *dswp = devvn_refthread(fp->f_vnode, devp, ref); - if (*devp != fp->f_data) { + if (*dswp == NULL || *devp != fp->f_data) { if (*dswp != NULL) dev_relthread(*devp, *ref); return (ENXIO); From owner-dev-commits-src-all@freebsd.org Mon May 3 17:55:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D222E638E33; Mon, 3 May 2021 17:55:42 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYrHL4FcHz3JlD; Mon, 3 May 2021 17:55:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6A71322906; Mon, 3 May 2021 17:55:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143Htgmt046865; Mon, 3 May 2021 17:55:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143HtgvE046864; Mon, 3 May 2021 17:55:42 GMT (envelope-from git) Date: Mon, 3 May 2021 17:55:42 GMT Message-Id: <202105031755.143HtgvE046864@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 1d712c05370d - main - traceroute6: Properly calculate UDP checksum MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1d712c05370dca8cbf81d1ecd9acd606fdcacaf4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 17:55:43 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1d712c05370dca8cbf81d1ecd9acd606fdcacaf4 commit 1d712c05370dca8cbf81d1ecd9acd606fdcacaf4 Author: Zhenlei Huang AuthorDate: 2021-05-03 16:46:19 +0000 Commit: Mark Johnston CommitDate: 2021-05-03 17:24:30 +0000 traceroute6: Properly calculate UDP checksum The revision D25604 capsicumize traceroute6. For UDP the send socket was changed from SOCK_DGRAM to SOCK_RAW and thus the UDP checksum need be calculated by application itself other than the kernel. outpacket is filled with zeros by line 707, thus the first round the UDP checksum is correct. But subsequent rounds outudp->uh_sum will be left with garbage. PR: 255507 Reviewed by: ae, markj, tuexen MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D30042 --- usr.sbin/traceroute6/traceroute6.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index 8449a9861302..a071c084ad07 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -1118,6 +1118,7 @@ send_probe(int seq, u_long hops) outudp->uh_sport = htons(ident); outudp->uh_dport = htons(port+seq); outudp->uh_ulen = htons(datalen); + outudp->uh_sum = 0; outudp->uh_sum = udp_cksum(&Src, &Dst, outpacket, datalen); break; case IPPROTO_NONE: From owner-dev-commits-src-all@freebsd.org Mon May 3 17:55:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA319638CED; Mon, 3 May 2021 17:55:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYrHM4j7Wz3JYT; Mon, 3 May 2021 17:55:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8D5B2224E6; Mon, 3 May 2021 17:55:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143HthPw046895; Mon, 3 May 2021 17:55:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143HthpM046894; Mon, 3 May 2021 17:55:43 GMT (envelope-from git) Date: Mon, 3 May 2021 17:55:43 GMT Message-Id: <202105031755.143HthpM046894@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a3c7da3d08ee - main - kern/intr: declare interrupt vectors unsigned MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a3c7da3d08eec921f16a32c4c716b896385264e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 17:55:43 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a3c7da3d08eec921f16a32c4c716b896385264e9 commit a3c7da3d08eec921f16a32c4c716b896385264e9 Author: Elliott Mitchell AuthorDate: 2021-05-03 16:50:17 +0000 Commit: Mark Johnston CommitDate: 2021-05-03 17:24:30 +0000 kern/intr: declare interrupt vectors unsigned These should never get values large enough for sign to matter, but one of them becoming negative could cause problems. MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D29327 --- sys/kern/subr_intr.c | 8 ++++---- sys/sys/intr.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c index 7f99d194e971..df6bf9e63ba0 100644 --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -143,7 +143,7 @@ static bool irq_assign_cpu = false; #endif #endif -int intr_nirq = NIRQ; +u_int intr_nirq = NIRQ; SYSCTL_UINT(_machdep, OID_AUTO, nirq, CTLFLAG_RDTUN, &intr_nirq, 0, "Number of IRQs"); @@ -166,7 +166,7 @@ static void intr_map_copy_map_data(u_int res_id, device_t *dev, intptr_t *xref, static void intr_irq_init(void *dummy __unused) { - int intrcnt_count; + u_int intrcnt_count; SLIST_INIT(&pic_list); mtx_init(&pic_list_lock, "intr pic list", NULL, MTX_DEF); @@ -1576,8 +1576,8 @@ struct intr_map_entry /* XXX Convert irq_map[] to dynamicaly expandable one. */ static struct intr_map_entry **irq_map; -static int irq_map_count; -static int irq_map_first_free_idx; +static u_int irq_map_count; +static u_int irq_map_first_free_idx; static struct mtx irq_map_lock; static struct intr_irqsrc * diff --git a/sys/sys/intr.h b/sys/sys/intr.h index c922b10f3368..b373a6f23bf0 100644 --- a/sys/sys/intr.h +++ b/sys/sys/intr.h @@ -165,6 +165,6 @@ u_long * intr_ipi_setup_counters(const char *name); #endif -extern int intr_nirq; /* number of IRQs on intrng platforms */ +extern u_int intr_nirq; /* number of IRQs on intrng platforms */ #endif /* _SYS_INTR_H */ From owner-dev-commits-src-all@freebsd.org Mon May 3 17:55:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25362638C7D; Mon, 3 May 2021 17:55:45 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYrHN6BfYz3JlL; Mon, 3 May 2021 17:55:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B183722907; Mon, 3 May 2021 17:55:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143Hti9u046916; Mon, 3 May 2021 17:55:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143HtiA0046915; Mon, 3 May 2021 17:55:44 GMT (envelope-from git) Date: Mon, 3 May 2021 17:55:44 GMT Message-Id: <202105031755.143HtiA0046915@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f161d294b927 - main - Add missing sockaddr length and family validation to various protocols MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f161d294b92732df6254a89f393ab24999e122bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 17:55:45 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f161d294b92732df6254a89f393ab24999e122bf commit f161d294b92732df6254a89f393ab24999e122bf Author: Mark Johnston AuthorDate: 2021-05-03 16:51:04 +0000 Commit: Mark Johnston CommitDate: 2021-05-03 17:35:19 +0000 Add missing sockaddr length and family validation to various protocols Several protocol methods take a sockaddr as input. In some cases the sockaddr lengths were not being validated, or were validated after some out-of-bounds accesses could occur. Add requisite checking to various protocol entry points, and convert some existing checks to assertions where appropriate. Reported by: syzkaller+KASAN Reviewed by: tuexen, melifaro MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29519 --- sys/dev/hyperv/hvsock/hv_sock.c | 9 ++++++++ sys/netgraph/ng_socket.c | 19 ++++++++++++---- sys/netinet/in_pcb.c | 28 +++++++++++------------ sys/netinet/ip_divert.c | 21 ++++++++++++++--- sys/netinet/raw_ip.c | 14 ++++++++++-- sys/netinet/sctp_usrreq.c | 24 +++++++++----------- sys/netinet/tcp_usrreq.c | 31 ++++++++++++++++---------- sys/netinet/udp_usrreq.c | 28 ++++++++++++++++++++++- sys/netinet6/in6_pcb.c | 25 +++++++++------------ sys/netinet6/raw_ip6.c | 6 +++++ sys/netinet6/sctp6_usrreq.c | 21 +++++++++++++++++ sys/netinet6/send.c | 8 +++++++ sys/netinet6/udp6_usrreq.c | 12 +++++++++- sys/netipsec/keysock.c | 2 +- sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c | 23 +++++++++++++++---- 15 files changed, 202 insertions(+), 69 deletions(-) diff --git a/sys/dev/hyperv/hvsock/hv_sock.c b/sys/dev/hyperv/hvsock/hv_sock.c index d212c2d8c2de..bcc237271465 100644 --- a/sys/dev/hyperv/hvsock/hv_sock.c +++ b/sys/dev/hyperv/hvsock/hv_sock.c @@ -300,6 +300,7 @@ hvs_addr_set(struct sockaddr_hvs *addr, unsigned int port) { memset(addr, 0, sizeof(*addr)); addr->sa_family = AF_HYPERV; + addr->sa_len = sizeof(*addr); addr->hvs_port = port; } @@ -430,6 +431,12 @@ hvs_trans_bind(struct socket *so, struct sockaddr *addr, struct thread *td) __func__, sa->sa_family); return (EAFNOSUPPORT); } + if (sa->sa_len != sizeof(*sa)) { + HVSOCK_DBG(HVSOCK_DBG_ERR, + "%s: Not supported, sa_len is %u\n", + __func__, sa->sa_len); + return (EINVAL); + } HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: binding port = 0x%x\n", __func__, sa->hvs_port); @@ -521,6 +528,8 @@ hvs_trans_connect(struct socket *so, struct sockaddr *nam, struct thread *td) return (EINVAL); if (raddr->sa_family != AF_HYPERV) return (EAFNOSUPPORT); + if (raddr->sa_len != sizeof(*raddr)) + return (EINVAL); mtx_lock(&hvs_trans_socks_mtx); if (so->so_state & diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c index 865e9dd7948f..1c67099a4dc4 100644 --- a/sys/netgraph/ng_socket.c +++ b/sys/netgraph/ng_socket.c @@ -240,11 +240,16 @@ ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, goto release; } + if (sap->sg_len > NG_NODESIZ + offsetof(struct sockaddr_ng, sg_data)) { + error = EINVAL; + goto release; + } + /* * Allocate an expendable buffer for the path, chop off * the sockaddr header, and make sure it's NUL terminated. */ - len = sap->sg_len - 2; + len = sap->sg_len - offsetof(struct sockaddr_ng, sg_data); path = malloc(len + 1, M_NETGRAPH_PATH, M_WAITOK); bcopy(sap->sg_data, path, len); path[len] = '\0'; @@ -422,10 +427,16 @@ ngd_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, goto release; } - if (sap == NULL) + if (sap == NULL) { len = 0; /* Make compiler happy. */ - else - len = sap->sg_len - 2; + } else { + if (sap->sg_len > NG_NODESIZ + + offsetof(struct sockaddr_ng, sg_data)) { + error = EINVAL; + goto release; + } + len = sap->sg_len - offsetof(struct sockaddr_ng, sg_data); + } /* * If the user used any of these ways to not specify an address diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 43eb31c4e31d..4c21bdbf1347 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -654,6 +654,10 @@ in_pcbbind(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred) { int anonport, error; + KASSERT(nam == NULL || nam->sa_family == AF_INET, + ("%s: invalid address family for %p", __func__, nam)); + KASSERT(nam == NULL || nam->sa_len == sizeof(struct sockaddr_in), + ("%s: invalid address length for %p", __func__, nam)); INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); @@ -940,16 +944,11 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp, return (error); } else { sin = (struct sockaddr_in *)nam; - if (nam->sa_len != sizeof (*sin)) - return (EINVAL); -#ifdef notdef - /* - * We should check the family, but old programs - * incorrectly fail to initialize it. - */ - if (sin->sin_family != AF_INET) - return (EAFNOSUPPORT); -#endif + KASSERT(sin->sin_family == AF_INET, + ("%s: invalid family for address %p", __func__, sin)); + KASSERT(sin->sin_len == sizeof(*sin), + ("%s: invalid length for address %p", __func__, sin)); + error = prison_local_ip4(cred, &sin->sin_addr); if (error) return (error); @@ -1372,6 +1371,11 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam, u_short lport, fport; int error; + KASSERT(sin->sin_family == AF_INET, + ("%s: invalid address family for %p", __func__, sin)); + KASSERT(sin->sin_len == sizeof(*sin), + ("%s: invalid address length for %p", __func__, sin)); + /* * Because a global state change doesn't actually occur here, a read * lock is sufficient. @@ -1382,10 +1386,6 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam, if (oinpp != NULL) *oinpp = NULL; - if (nam->sa_len != sizeof (*sin)) - return (EINVAL); - if (sin->sin_family != AF_INET) - return (EAFNOSUPPORT); if (sin->sin_port == 0) return (EADDRNOTAVAIL); laddr.s_addr = *laddrp; diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index c3f9c43b8f70..65974051ad1f 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -327,6 +327,22 @@ div_output(struct socket *so, struct mbuf *m, struct sockaddr_in *sin, struct ipfw_rule_ref *dt; int error, family; + if (control) { + m_freem(control); /* XXX */ + control = NULL; + } + + if (sin != NULL) { + if (sin->sin_family != AF_INET) { + m_freem(m); + return (EAFNOSUPPORT); + } + if (sin->sin_len != sizeof(*sin)) { + m_freem(m); + return (EINVAL); + } + } + /* * An mbuf may hasn't come from userland, but we pretend * that it has. @@ -335,9 +351,6 @@ div_output(struct socket *so, struct mbuf *m, struct sockaddr_in *sin, m->m_nextpkt = NULL; M_SETFIB(m, so->so_fibnum); - if (control) - m_freem(control); /* XXX */ - mtag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL); if (mtag == NULL) { /* this should be normal */ @@ -628,6 +641,8 @@ div_bind(struct socket *so, struct sockaddr *nam, struct thread *td) */ if (nam->sa_family != AF_INET) return EAFNOSUPPORT; + if (nam->sa_len != sizeof(struct sockaddr_in)) + return EINVAL; ((struct sockaddr_in *)nam)->sin_addr.s_addr = INADDR_ANY; INP_INFO_WLOCK(&V_divcbinfo); INP_WLOCK(inp); diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index c9def015343c..89ab6a6bbdad 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -996,6 +996,8 @@ rip_bind(struct socket *so, struct sockaddr *nam, struct thread *td) struct inpcb *inp; int error; + if (nam->sa_family != AF_INET) + return (EAFNOSUPPORT); if (nam->sa_len != sizeof(*addr)) return (EINVAL); @@ -1070,6 +1072,7 @@ rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, { struct inpcb *inp; u_long dst; + int error; inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip_send: inp == NULL")); @@ -1084,9 +1087,16 @@ rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, } dst = inp->inp_faddr.s_addr; /* Unlocked read. */ } else { - if (nam == NULL) { + error = 0; + if (nam == NULL) + error = ENOTCONN; + else if (nam->sa_family != AF_INET) + error = EAFNOSUPPORT; + else if (nam->sa_len != sizeof(struct sockaddr_in)) + error = EINVAL; + if (error != 0) { m_freem(m); - return (ENOTCONN); + return (error); } dst = ((struct sockaddr_in *)nam)->sin_addr.s_addr; } diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 49cc6f22cc5a..238c20c0e368 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -598,29 +598,27 @@ sctp_sendm(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, ((inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) || (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE))) { goto connected_type; - } else if (addr == NULL) { + } + + error = 0; + if (addr == NULL) { SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EDESTADDRREQ); error = EDESTADDRREQ; - sctp_m_freem(m); - if (control) { - sctp_m_freem(control); - control = NULL; - } - return (error); + } else if (addr->sa_family != AF_INET) { + SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EAFNOSUPPORT); + error = EAFNOSUPPORT; + } else if (addr->sa_len != sizeof(struct sockaddr_in)) { + SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; } -#ifdef INET6 - if (addr->sa_family != AF_INET) { - /* must be a v4 address! */ - SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EDESTADDRREQ); + if (error != 0) { sctp_m_freem(m); if (control) { sctp_m_freem(control); control = NULL; } - error = EDESTADDRREQ; return (error); } -#endif /* INET6 */ connected_type: /* now what about control */ if (control) { diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index c4cfb5ea199f..cbc36860bf32 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -321,14 +321,16 @@ tcp_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td) struct sockaddr_in *sinp; sinp = (struct sockaddr_in *)nam; - if (nam->sa_len != sizeof (*sinp)) + if (nam->sa_family != AF_INET) + return (EAFNOSUPPORT); + if (nam->sa_len != sizeof(*sinp)) return (EINVAL); + /* * Must check for multicast addresses and disallow binding * to them. */ - if (sinp->sin_family == AF_INET && - IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) + if (IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) return (EAFNOSUPPORT); TCPDEBUG0; @@ -364,14 +366,16 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td) u_char vflagsav; sin6 = (struct sockaddr_in6 *)nam; - if (nam->sa_len != sizeof (*sin6)) + if (nam->sa_family != AF_INET6) + return (EAFNOSUPPORT); + if (nam->sa_len != sizeof(*sin6)) return (EINVAL); + /* * Must check for multicast addresses and disallow binding * to them. */ - if (sin6->sin6_family == AF_INET6 && - IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) + if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return (EAFNOSUPPORT); TCPDEBUG0; @@ -542,16 +546,17 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td) struct sockaddr_in *sinp; sinp = (struct sockaddr_in *)nam; + if (nam->sa_family != AF_INET) + return (EAFNOSUPPORT); if (nam->sa_len != sizeof (*sinp)) return (EINVAL); + /* * Must disallow TCP ``connections'' to multicast addresses. */ - if (sinp->sin_family == AF_INET - && IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) + if (IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) return (EAFNOSUPPORT); - if ((sinp->sin_family == AF_INET) && - (ntohl(sinp->sin_addr.s_addr) == INADDR_BROADCAST)) + if (ntohl(sinp->sin_addr.s_addr) == INADDR_BROADCAST) return (EACCES); if ((error = prison_remote_ip4(td->td_ucred, &sinp->sin_addr)) != 0) return (error); @@ -606,13 +611,15 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td) TCPDEBUG0; sin6 = (struct sockaddr_in6 *)nam; + if (nam->sa_family != AF_INET6) + return (EAFNOSUPPORT); if (nam->sa_len != sizeof (*sin6)) return (EINVAL); + /* * Must disallow TCP ``connections'' to multicast addresses. */ - if (sin6->sin6_family == AF_INET6 - && IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) + if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return (EAFNOSUPPORT); inp = sotoinpcb(so); diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index c2ad9381850e..16ae0a89bb15 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1626,6 +1626,12 @@ udp_bind(struct socket *so, struct sockaddr *nam, struct thread *td) pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp_bind: inp == NULL")); + + if (nam->sa_family != AF_INET) + return (EAFNOSUPPORT); + if (nam->sa_len != sizeof(struct sockaddr_in)) + return (EINVAL); + INP_WLOCK(inp); INP_HASH_WLOCK(pcbinfo); error = in_pcbbind(inp, nam, td->td_ucred); @@ -1666,12 +1672,18 @@ udp_connect(struct socket *so, struct sockaddr *nam, struct thread *td) pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp_connect: inp == NULL")); + + sin = (struct sockaddr_in *)nam; + if (sin->sin_family != AF_INET) + return (EAFNOSUPPORT); + if (sin->sin_len != sizeof(*sin)) + return (EINVAL); + INP_WLOCK(inp); if (inp->inp_faddr.s_addr != INADDR_ANY) { INP_WUNLOCK(inp); return (EISCONN); } - sin = (struct sockaddr_in *)nam; error = prison_remote_ip4(td->td_ucred, &sin->sin_addr); if (error != 0) { INP_WUNLOCK(inp); @@ -1741,9 +1753,23 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *td) { struct inpcb *inp; + int error; inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp_send: inp == NULL")); + + if (addr != NULL) { + error = 0; + if (addr->sa_family != AF_INET) + error = EAFNOSUPPORT; + else if (addr->sa_len != sizeof(struct sockaddr_in)) + error = EINVAL; + if (__predict_false(error != 0)) { + m_freem(control); + m_freem(m); + return (error); + } + } return (udp_output(inp, m, addr, control, td, flags)); } #endif /* INET */ diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 4cdd2a8f152f..9572efaf5e1d 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -146,13 +146,10 @@ in6_pcbbind(struct inpcb *inp, struct sockaddr *nam, return (error); } else { sin6 = (struct sockaddr_in6 *)nam; - if (nam->sa_len != sizeof(*sin6)) - return (EINVAL); - /* - * family check. - */ - if (nam->sa_family != AF_INET6) - return (EAFNOSUPPORT); + KASSERT(sin6->sin6_family == AF_INET6, + ("%s: invalid address family for %p", __func__, sin6)); + KASSERT(sin6->sin6_len == sizeof(*sin6), + ("%s: invalid address length for %p", __func__, sin6)); if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0) return(error); @@ -345,10 +342,9 @@ in6_pcbbind(struct inpcb *inp, struct sockaddr *nam, * have forced minor changes in every protocol). */ static int -in6_pcbladdr(struct inpcb *inp, struct sockaddr *nam, +in6_pcbladdr(struct inpcb *inp, struct sockaddr_in6 *sin6, struct in6_addr *plocal_addr6) { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; int error = 0; int scope_ambiguous = 0; struct in6_addr in6a; @@ -357,10 +353,6 @@ in6_pcbladdr(struct inpcb *inp, struct sockaddr *nam, INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); /* XXXRW: why? */ - if (nam->sa_len != sizeof (*sin6)) - return (EINVAL); - if (sin6->sin6_family != AF_INET6) - return (EAFNOSUPPORT); if (sin6->sin6_port == 0) return (EADDRNOTAVAIL); @@ -421,6 +413,11 @@ in6_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam, struct sockaddr_in6 laddr6; int error; + KASSERT(sin6->sin6_family == AF_INET6, + ("%s: invalid address family for %p", __func__, sin6)); + KASSERT(sin6->sin6_len == sizeof(*sin6), + ("%s: invalid address length for %p", __func__, sin6)); + bzero(&laddr6, sizeof(laddr6)); laddr6.sin6_family = AF_INET6; @@ -442,7 +439,7 @@ in6_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam, * Call inner routine, to assign local interface address. * in6_pcbladdr() may automatically fill in sin6_scope_id. */ - if ((error = in6_pcbladdr(inp, nam, &laddr6.sin6_addr)) != 0) + if ((error = in6_pcbladdr(inp, sin6, &laddr6.sin6_addr)) != 0) return (error); if (in6_pcblookup_hash_locked(pcbinfo, &sin6->sin6_addr, diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 8d71c40455a1..3d2af6e5c9e6 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -760,6 +760,8 @@ rip6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip6_bind: inp == NULL")); + if (nam->sa_family != AF_INET6) + return (EAFNOSUPPORT); if (nam->sa_len != sizeof(*addr)) return (EINVAL); if ((error = prison_check_ip6(td->td_ucred, &addr->sin6_addr)) != 0) @@ -891,6 +893,10 @@ rip6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, m_freem(m); return (ENOTCONN); } + if (nam->sa_family != AF_INET6) { + m_freem(m); + return (EAFNOSUPPORT); + } if (nam->sa_len != sizeof(struct sockaddr_in6)) { m_freem(m); return (EINVAL); diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index fcf15e4f81bf..1030fe1bbb68 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -709,6 +709,27 @@ sctp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EDESTADDRREQ); return (EDESTADDRREQ); } + switch (addr->sa_family) { +#ifdef INET + case AF_INET: + if (addr->sa_len != sizeof(struct sockaddr_in)) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); + return (EINVAL); + } + break; +#endif +#ifdef INET6 + case AF_INET6: + if (addr->sa_len != sizeof(struct sockaddr_in6)) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); + return (EINVAL); + } + break; +#endif + default: + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); + return (EINVAL); + } #ifdef INET sin6 = (struct sockaddr_in6 *)addr; if (SCTP_IPV6_V6ONLY(inp)) { diff --git a/sys/netinet6/send.c b/sys/netinet6/send.c index 0c839519b724..aef2ee400c0e 100644 --- a/sys/netinet6/send.c +++ b/sys/netinet6/send.c @@ -231,6 +231,14 @@ send_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, __func__, so, V_send_so)); sendsrc = (struct sockaddr_send *)nam; + if (sendsrc->send_family != AF_INET6) { + error = EAFNOSUPPORT; + goto err; + } + if (sendsrc->send_len != sizeof(*sendsrc)) { + error = EINVAL; + goto err; + } ifp = ifnet_byindex_ref(sendsrc->send_ifidx); if (ifp == NULL) { error = ENETUNREACH; diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 3a001fea077d..7c573d095d77 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -1091,6 +1091,11 @@ udp6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp6_bind: inp == NULL")); + if (nam->sa_family != AF_INET6) + return (EAFNOSUPPORT); + if (nam->sa_len != sizeof(struct sockaddr_in6)) + return (EINVAL); + INP_WLOCK(inp); INP_HASH_WLOCK(pcbinfo); vflagsav = inp->inp_vflag; @@ -1176,9 +1181,14 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); - sin6 = (struct sockaddr_in6 *)nam; KASSERT(inp != NULL, ("udp6_connect: inp == NULL")); + sin6 = (struct sockaddr_in6 *)nam; + if (sin6->sin6_family != AF_INET6) + return (EAFNOSUPPORT); + if (sin6->sin6_len != sizeof(*sin6)) + return (EINVAL); + /* * XXXRW: Need to clarify locking of v4/v6 flags. */ diff --git a/sys/netipsec/keysock.c b/sys/netipsec/keysock.c index 49efa0a3c510..317eb53289cf 100644 --- a/sys/netipsec/keysock.c +++ b/sys/netipsec/keysock.c @@ -322,7 +322,7 @@ key_attach(struct socket *so, int proto, struct thread *td) static int key_bind(struct socket *so, struct sockaddr *nam, struct thread *td) { - return EINVAL; + return EINVAL; } /* diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c index e7ae4e03365e..a38bdfcbed59 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c @@ -519,9 +519,9 @@ sdp_bind(struct socket *so, struct sockaddr *nam, struct thread *td) struct sockaddr_in *sin; sin = (struct sockaddr_in *)nam; - if (nam->sa_len != sizeof (*sin)) - return (EINVAL); if (sin->sin_family != AF_INET) + return (EAFNOSUPPORT); + if (nam->sa_len != sizeof(*sin)) return (EINVAL); if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return (EAFNOSUPPORT); @@ -617,10 +617,10 @@ sdp_connect(struct socket *so, struct sockaddr *nam, struct thread *td) struct sockaddr_in *sin; sin = (struct sockaddr_in *)nam; - if (nam->sa_len != sizeof (*sin)) + if (nam->sa_len != sizeof(*sin)) return (EINVAL); if (sin->sin_family != AF_INET) - return (EINVAL); + return (EAFNOSUPPORT); if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return (EAFNOSUPPORT); if ((error = prison_remote_ip4(td->td_ucred, &sin->sin_addr)) != 0) @@ -932,6 +932,21 @@ sdp_send(struct socket *so, int flags, struct mbuf *m, int error; int cnt; + if (nam != NULL) { + if (nam->sa_family != AF_INET) { + if (control) + m_freem(control); + m_freem(m); + return (EAFNOSUPPORT); + } + if (nam->sa_len != sizeof(struct sockaddr_in)) { + if (control) + m_freem(control); + m_freem(m); + return (EINVAL); + } + } + error = 0; ssk = sdp_sk(so); KASSERT(m->m_flags & M_PKTHDR, From owner-dev-commits-src-all@freebsd.org Mon May 3 17:55:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41B17638C7F; Mon, 3 May 2021 17:55:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYrHP73c5z3JYZ; Mon, 3 May 2021 17:55:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CF1C62245A; Mon, 3 May 2021 17:55:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143HtjIt046939; Mon, 3 May 2021 17:55:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143Htj33046938; Mon, 3 May 2021 17:55:45 GMT (envelope-from git) Date: Mon, 3 May 2021 17:55:45 GMT Message-Id: <202105031755.143Htj33046938@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 64881da47807 - main - ixgbe: Restore AIM support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 64881da478071431a2d9e62613997a5772c56cdf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 17:55:46 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=64881da478071431a2d9e62613997a5772c56cdf commit 64881da478071431a2d9e62613997a5772c56cdf Author: Sai Rajesh Tallamraju AuthorDate: 2021-05-03 17:45:00 +0000 Commit: Mark Johnston CommitDate: 2021-05-03 17:47:14 +0000 ixgbe: Restore AIM support AIM (adaptive interrupt moderation) was part of BSD11 driver. Upon IFLIB migration, AIM feature got lost. Re-introducing AIM back into IFLIB based IXGBE driver. One caveat is that in BSD11 driver, a queue comprises both Rx and Tx ring. Starting from BSD12, Rx and Tx have their own queues and rings. Also, IRQ is now only configured for Rx side. So, when AIM is re-enabled, we should now consider only Rx stats for configuring EITR register in contrast to BSD11 where Rx and Tx stats were considered to manipulate EITR register. Reviewed by: gallatin, markj Sponsored by: NetApp, Inc. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27344 --- sys/dev/ixgbe/if_ix.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/ixgbe/ixgbe.h | 1 + 2 files changed, 74 insertions(+) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 489e891cf509..fbe4f1df38ca 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -347,6 +347,16 @@ static int ixgbe_enable_rss = 1; SYSCTL_INT(_hw_ix, OID_AUTO, enable_rss, CTLFLAG_RDTUN, &ixgbe_enable_rss, 0, "Enable Receive-Side Scaling (RSS)"); +/* + * AIM: Adaptive Interrupt Moderation + * which means that the interrupt rate + * is varied over time based on the + * traffic for that interrupt vector + */ +static int ixgbe_enable_aim = FALSE; +SYSCTL_INT(_hw_ix, OID_AUTO, enable_aim, CTLFLAG_RWTUN, &ixgbe_enable_aim, 0, + "Enable adaptive interrupt moderation"); + #if 0 /* Keep running tab on them for sanity check */ static int ixgbe_total_ports; @@ -2100,6 +2110,60 @@ fail: return (error); } /* ixgbe_if_msix_intr_assign */ +static inline void +ixgbe_perform_aim(struct adapter *adapter, struct ix_rx_queue *que) +{ + uint32_t newitr = 0; + struct rx_ring *rxr = &que->rxr; + + /* + * Do Adaptive Interrupt Moderation: + * - Write out last calculated setting + * - Calculate based on average size over + * the last interval. + */ + if (que->eitr_setting) { + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(que->msix), + que->eitr_setting); + } + + que->eitr_setting = 0; + /* Idle, do nothing */ + if (rxr->bytes == 0) { + return; + } + + if ((rxr->bytes) && (rxr->packets)) { + newitr = (rxr->bytes / rxr->packets); + } + + newitr += 24; /* account for hardware frame, crc */ + /* set an upper boundary */ + newitr = min(newitr, 3000); + + /* Be nice to the mid range */ + if ((newitr > 300) && (newitr < 1200)) { + newitr = (newitr / 3); + } else { + newitr = (newitr / 2); + } + + if (adapter->hw.mac.type == ixgbe_mac_82598EB) { + newitr |= newitr << 16; + } else { + newitr |= IXGBE_EITR_CNT_WDIS; + } + + /* save for next interrupt */ + que->eitr_setting = newitr; + + /* Reset state */ + rxr->bytes = 0; + rxr->packets = 0; + + return; +} + /********************************************************************* * ixgbe_msix_que - MSI-X Queue Interrupt Service routine **********************************************************************/ @@ -2117,6 +2181,11 @@ ixgbe_msix_que(void *arg) ixgbe_disable_queue(adapter, que->msix); ++que->irqs; + /* Check for AIM */ + if (adapter->enable_aim) { + ixgbe_perform_aim(adapter, que); + } + return (FILTER_SCHEDULE_THREAD); } /* ixgbe_msix_que */ @@ -2575,6 +2644,10 @@ ixgbe_add_device_sysctls(if_ctx_t ctx) adapter, 0, ixgbe_sysctl_advertise, "I", IXGBE_SYSCTL_DESC_ADV_SPEED); + adapter->enable_aim = ixgbe_enable_aim; + SYSCTL_ADD_INT(ctx_list, child, OID_AUTO, "enable_aim", CTLFLAG_RW, + &adapter->enable_aim, 0, "Interrupt Moderation"); + #ifdef IXGBE_DEBUG /* testing sysctls (for all devices) */ SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "power_state", diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 30dd1d5368fb..31d5cc41c066 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -408,6 +408,7 @@ struct adapter { /* Info about the interface */ int advertise; /* link speeds */ + int enable_aim; /* adaptive interrupt moderation */ bool link_active; u16 num_segs; u32 link_speed; From owner-dev-commits-src-all@freebsd.org Mon May 3 18:12:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2725563980E for ; Mon, 3 May 2021 18:12:59 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYrgH0S4Gz3L78 for ; Mon, 3 May 2021 18:12:58 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb2f.google.com with SMTP id x131so8707202ybg.11 for ; Mon, 03 May 2021 11:12:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=E+BxIIkbEP5jcScv3YzphzWCFE1GMuhz8eC6TiUgJWk=; b=GGiWIireaKVRQFYiWDPgjNUslxMtx45KtzkEQcQtQ/5SoDPO2bTGQiVmVSMmBcE6v9 4Z2DOBlbTqy+VblDZgLvVTq9d9Wg6Ym3/VKAThqoAJbPMvRvCuCqfOU/2zAHuiJIM7n7 uT9UVokevoLztzwJtJaGhKQFmt4IjG5LWGtfw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=E+BxIIkbEP5jcScv3YzphzWCFE1GMuhz8eC6TiUgJWk=; b=McoBMiDOcO+ARhQIH4Trs5a59j+kBQ83nKQ4W05nOm6WFf8LOlADXmUb51cyHNPoOa gI9r3O19Tre9yiDUI+KI7Z/YpO4H1zRHPLlNjDX5c2uWNHRVUWNHvara9ue0j40qwICc hblZ6zy5wH/RoVcxaRnM2B8rOHLIX82VHoJyaAwmg23jy1unW9hI/rou6LoYoQ7QsKin 7QvgJ8P7YCxXh7VmKJAUWJIURyR56b/9xOnHp1sgjp77nhQBv93dg3BLpO09aRe1WpxH dPsyIHBXkvOqUyyJjcRHyZIo5apBS3pJe0jL/zA4Az0guTqmdVOYGNRq705EEewsAAfm DMdA== X-Gm-Message-State: AOAM531XfiJ5Fq794zN+aNCd+yVIirJHf8iIuA3ZRaYRzkN1gRAu5J1u SNQQrMJRNGndIpaTOMHT4v2uQXwJAN2BY54aTv+kjg== X-Google-Smtp-Source: ABdhPJxjwlUd9/5ML2za63P3+4GVWCcWKqt0AF9hy1qOFXC70Ieuz1daxT7sacDEatbF5R90n7mekYsINvont0kft5Y= X-Received: by 2002:a25:ce51:: with SMTP id x78mr19273112ybe.87.1620065577873; Mon, 03 May 2021 11:12:57 -0700 (PDT) MIME-Version: 1.0 References: <202105031755.143Htj33046938@gitrepo.freebsd.org> In-Reply-To: <202105031755.143Htj33046938@gitrepo.freebsd.org> From: Kevin Bowling Date: Mon, 3 May 2021 11:12:46 -0700 Message-ID: Subject: Re: git: 64881da47807 - main - ixgbe: Restore AIM support To: Mark Johnston Cc: dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, src-committers@freebsd.org X-Rspamd-Queue-Id: 4FYrgH0S4Gz3L78 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 18:12:59 -0000 Should we enable this by default? My primary concern in the review is not making things like this require expert tuning. If it is expected to be necessary, which Gallatin@ makes a case for, let=E2=80=99s toggle it on by = default. On Mon, May 3, 2021 at 10:56 AM Mark Johnston wrote: > The branch main has been updated by markj: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D64881da478071431a2d9e62613997a5= 772c56cdf > > commit 64881da478071431a2d9e62613997a5772c56cdf > Author: Sai Rajesh Tallamraju > AuthorDate: 2021-05-03 17:45:00 +0000 > Commit: Mark Johnston > CommitDate: 2021-05-03 17:47:14 +0000 > > ixgbe: Restore AIM support > > AIM (adaptive interrupt moderation) was part of BSD11 driver. Upon > IFLIB > migration, AIM feature got lost. Re-introducing AIM back into IFLIB > based IXGBE driver. > > One caveat is that in BSD11 driver, a queue comprises both Rx and Tx > ring. Starting from BSD12, Rx and Tx have their own queues and rings. > Also, IRQ is now only configured for Rx side. So, when AIM is > re-enabled, we should now consider only Rx stats for configuring EITR > register in contrast to BSD11 where Rx and Tx stats were considered t= o > manipulate EITR register. > > Reviewed by: gallatin, markj > Sponsored by: NetApp, Inc. > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D27344 > --- > sys/dev/ixgbe/if_ix.c | 73 > +++++++++++++++++++++++++++++++++++++++++++++++++++ > sys/dev/ixgbe/ixgbe.h | 1 + > 2 files changed, 74 insertions(+) > > diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c > index 489e891cf509..fbe4f1df38ca 100644 > --- a/sys/dev/ixgbe/if_ix.c > +++ b/sys/dev/ixgbe/if_ix.c > @@ -347,6 +347,16 @@ static int ixgbe_enable_rss =3D 1; > SYSCTL_INT(_hw_ix, OID_AUTO, enable_rss, CTLFLAG_RDTUN, > &ixgbe_enable_rss, 0, > "Enable Receive-Side Scaling (RSS)"); > > +/* > + * AIM: Adaptive Interrupt Moderation > + * which means that the interrupt rate > + * is varied over time based on the > + * traffic for that interrupt vector > + */ > +static int ixgbe_enable_aim =3D FALSE; > +SYSCTL_INT(_hw_ix, OID_AUTO, enable_aim, CTLFLAG_RWTUN, > &ixgbe_enable_aim, 0, > + "Enable adaptive interrupt moderation"); > + > #if 0 > /* Keep running tab on them for sanity check */ > static int ixgbe_total_ports; > @@ -2100,6 +2110,60 @@ fail: > return (error); > } /* ixgbe_if_msix_intr_assign */ > > +static inline void > +ixgbe_perform_aim(struct adapter *adapter, struct ix_rx_queue *que) > +{ > + uint32_t newitr =3D 0; > + struct rx_ring *rxr =3D &que->rxr; > + > + /* > + * Do Adaptive Interrupt Moderation: > + * - Write out last calculated setting > + * - Calculate based on average size over > + * the last interval. > + */ > + if (que->eitr_setting) { > + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(que->msix), > + que->eitr_setting); > + } > + > + que->eitr_setting =3D 0; > + /* Idle, do nothing */ > + if (rxr->bytes =3D=3D 0) { > + return; > + } > + > + if ((rxr->bytes) && (rxr->packets)) { > + newitr =3D (rxr->bytes / rxr->packets); > + } > + > + newitr +=3D 24; /* account for hardware frame, crc */ > + /* set an upper boundary */ > + newitr =3D min(newitr, 3000); > + > + /* Be nice to the mid range */ > + if ((newitr > 300) && (newitr < 1200)) { > + newitr =3D (newitr / 3); > + } else { > + newitr =3D (newitr / 2); > + } > + > + if (adapter->hw.mac.type =3D=3D ixgbe_mac_82598EB) { > + newitr |=3D newitr << 16; > + } else { > + newitr |=3D IXGBE_EITR_CNT_WDIS; > + } > + > + /* save for next interrupt */ > + que->eitr_setting =3D newitr; > + > + /* Reset state */ > + rxr->bytes =3D 0; > + rxr->packets =3D 0; > + > + return; > +} > + > /********************************************************************* > * ixgbe_msix_que - MSI-X Queue Interrupt Service routine > **********************************************************************/ > @@ -2117,6 +2181,11 @@ ixgbe_msix_que(void *arg) > ixgbe_disable_queue(adapter, que->msix); > ++que->irqs; > > + /* Check for AIM */ > + if (adapter->enable_aim) { > + ixgbe_perform_aim(adapter, que); > + } > + > return (FILTER_SCHEDULE_THREAD); > } /* ixgbe_msix_que */ > > @@ -2575,6 +2644,10 @@ ixgbe_add_device_sysctls(if_ctx_t ctx) > adapter, 0, ixgbe_sysctl_advertise, "I", > IXGBE_SYSCTL_DESC_ADV_SPEED); > > + adapter->enable_aim =3D ixgbe_enable_aim; > + SYSCTL_ADD_INT(ctx_list, child, OID_AUTO, "enable_aim", CTLFLAG_R= W, > + &adapter->enable_aim, 0, "Interrupt Moderation"); > + > #ifdef IXGBE_DEBUG > /* testing sysctls (for all devices) */ > SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "power_state", > diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h > index 30dd1d5368fb..31d5cc41c066 100644 > --- a/sys/dev/ixgbe/ixgbe.h > +++ b/sys/dev/ixgbe/ixgbe.h > @@ -408,6 +408,7 @@ struct adapter { > > /* Info about the interface */ > int advertise; /* link speeds */ > + int enable_aim; /* adaptive interrupt > moderation */ > bool link_active; > u16 num_segs; > u32 link_speed; > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to " > dev-commits-src-main-unsubscribe@freebsd.org" > From owner-dev-commits-src-all@freebsd.org Mon May 3 19:31:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15F1E63B48F; Mon, 3 May 2021 19:31:03 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from tor1-11.mx.scaleengine.net (tor1-11.mx.scaleengine.net [IPv6:2001:470:1:474::25]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4FYtPM026Kz3Pb9; Mon, 3 May 2021 19:31:02 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.3] (senat1-01.HML3.ScaleEngine.net [209.51.186.5]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by tor1-11.mx.scaleengine.net (Postfix) with ESMTPSA id 2952D9F64; Mon, 3 May 2021 19:30:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 tor1-11.mx.scaleengine.net 2952D9F64 Subject: Re: git: 64881da47807 - main - ixgbe: Restore AIM support To: Kevin Bowling , Mark Johnston Cc: dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, src-committers@freebsd.org References: <202105031755.143Htj33046938@gitrepo.freebsd.org> From: Allan Jude Message-ID: <295b05d0-58ba-6e04-6fbf-cb997c9ab112@freebsd.org> Date: Mon, 3 May 2021 15:30:55 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4FYtPM026Kz3Pb9 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 19:31:03 -0000 On 5/3/2021 2:12 PM, Kevin Bowling wrote: > Should we enable this by default?  My primary concern in the review is > not making things like this require expert tuning.  If it is expected to > be necessary, which Gallatin@ makes a case for, let’s toggle it on by > default. > > On Mon, May 3, 2021 at 10:56 AM Mark Johnston > wrote: > > The branch main has been updated by markj: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=64881da478071431a2d9e62613997a5772c56cdf > > > commit 64881da478071431a2d9e62613997a5772c56cdf > Author:     Sai Rajesh Tallamraju > > AuthorDate: 2021-05-03 17:45:00 +0000 > Commit:     Mark Johnston > CommitDate: 2021-05-03 17:47:14 +0000 > It looks like AIM was on by default in 11.x and earlier: hw.ix.enable_aim: 1 hw.igb.enable_aim: 1 So I think enabling it does make sense in light of Drew's comments about mbuf sorting only being useful in the face of something like AIM where there will be a sufficient number of mbufs to sort. -- Allan Jude From owner-dev-commits-src-all@freebsd.org Mon May 3 20:11:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DCB663C58E; Mon, 3 May 2021 20:11:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYvJF0m8Gz3hG4; Mon, 3 May 2021 20:11:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0D04C2451C; Mon, 3 May 2021 20:11:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143KBe3w032233; Mon, 3 May 2021 20:11:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143KBeYW032232; Mon, 3 May 2021 20:11:40 GMT (envelope-from git) Date: Mon, 3 May 2021 20:11:40 GMT Message-Id: <202105032011.143KBeYW032232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: dec9f377531d - stable/13 - gpioc_detach: fix freeing of wrong pointers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dec9f377531db4ddb6de200d14ee306b61b66bac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 20:11:41 -0000 The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=dec9f377531db4ddb6de200d14ee306b61b66bac commit dec9f377531db4ddb6de200d14ee306b61b66bac Author: Andriy Gapon AuthorDate: 2021-03-23 10:45:18 +0000 Commit: Andriy Gapon CommitDate: 2021-05-03 20:11:12 +0000 gpioc_detach: fix freeing of wrong pointers MFC after: 1 week (cherry picked from commit 3c6b59567f61277ed487320aa9ad130c6894ad7a) --- sys/dev/gpio/gpioc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/gpio/gpioc.c b/sys/dev/gpio/gpioc.c index 9e46b32ffcba..15d0848fc020 100644 --- a/sys/dev/gpio/gpioc.c +++ b/sys/dev/gpio/gpioc.c @@ -618,7 +618,7 @@ gpioc_detach(device_t dev) for (int i = 0; i < sc->sc_npins; i++) { mtx_destroy(&sc->sc_pin_intr[i].mtx); - free(&sc->sc_pin_intr[i].pin, M_GPIOC); + free(sc->sc_pin_intr[i].pin, M_GPIOC); } free(sc->sc_pin_intr, M_GPIOC); From owner-dev-commits-src-all@freebsd.org Mon May 3 20:16:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8061863C5D1; Mon, 3 May 2021 20:16:25 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYvPj3H8yz3hHW; Mon, 3 May 2021 20:16:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 63A0A243D3; Mon, 3 May 2021 20:16:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143KGPZI034361; Mon, 3 May 2021 20:16:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143KGPUX034360; Mon, 3 May 2021 20:16:25 GMT (envelope-from git) Date: Mon, 3 May 2021 20:16:25 GMT Message-Id: <202105032016.143KGPUX034360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 0a28a6a608d0 - stable/12 - gpioc_detach: fix freeing of wrong pointers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0a28a6a608d081b819f65a92706392e41764ce5d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 20:16:25 -0000 The branch stable/12 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=0a28a6a608d081b819f65a92706392e41764ce5d commit 0a28a6a608d081b819f65a92706392e41764ce5d Author: Andriy Gapon AuthorDate: 2021-03-23 10:45:18 +0000 Commit: Andriy Gapon CommitDate: 2021-05-03 20:14:49 +0000 gpioc_detach: fix freeing of wrong pointers MFC after: 1 week (cherry picked from commit 3c6b59567f61277ed487320aa9ad130c6894ad7a) --- sys/dev/gpio/gpioc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/gpio/gpioc.c b/sys/dev/gpio/gpioc.c index 727b07a70589..878f761e6dbc 100644 --- a/sys/dev/gpio/gpioc.c +++ b/sys/dev/gpio/gpioc.c @@ -618,7 +618,7 @@ gpioc_detach(device_t dev) for (int i = 0; i <= sc->sc_npins; i++) { mtx_destroy(&sc->sc_pin_intr[i].mtx); - free(&sc->sc_pin_intr[i].pin, M_GPIOC); + free(sc->sc_pin_intr[i].pin, M_GPIOC); } free(sc->sc_pin_intr, M_GPIOC); From owner-dev-commits-src-all@freebsd.org Mon May 3 20:25:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B5B263C8E1; Mon, 3 May 2021 20:25:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYvbd19Gqz3hjq; Mon, 3 May 2021 20:25:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1AD3924358; Mon, 3 May 2021 20:25:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143KP1dU047975; Mon, 3 May 2021 20:25:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143KP0fN047974; Mon, 3 May 2021 20:25:00 GMT (envelope-from git) Date: Mon, 3 May 2021 20:25:00 GMT Message-Id: <202105032025.143KP0fN047974@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: b9ec6f2ef9d6 - main - Add a whole bunch of missed obsolete manpages to ObsoleteFiles.inc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b9ec6f2ef9d6e3783a66e9e954b58226f06f565c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 20:25:01 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=b9ec6f2ef9d6e3783a66e9e954b58226f06f565c commit b9ec6f2ef9d6e3783a66e9e954b58226f06f565c Author: Dimitry Andric AuthorDate: 2021-05-03 20:24:27 +0000 Commit: Dimitry Andric CommitDate: 2021-05-03 20:24:27 +0000 Add a whole bunch of missed obsolete manpages to ObsoleteFiles.inc --- ObsoleteFiles.inc | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 4 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 2b4996f4dc98..16fedfbb708b 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -2946,6 +2946,10 @@ OLD_FILES+=usr/include/crypto/xform_auth.h OLD_FILES+=usr/include/crypto/xform_comp.h OLD_FILES+=usr/include/crypto/xform_enc.h +# 20210315: if_wg(4) removed +OLD_FILES+=usr/share/man/man4/if_wg.4.gz +OLD_FILES+=usr/share/man/man4/wg.4.gz + # 20210305: removed Poly1305_* symbols OLD_FILES+=usr/include/crypto/xform_poly1305.h @@ -2986,6 +2990,7 @@ OLD_FILES+=usr/include/dev/wi/if_wavelan_ieee.h OLD_FILES+=usr/include/dev/wi/if_wivar.h OLD_FILES+=usr/sbin/bt3cfw OLD_FILES+=usr/share/man/man4/cmw.4.gz +OLD_FILES+=usr/share/man/man4/if_wi.4.gz OLD_FILES+=usr/share/man/man4/ng_bt3c.4.gz OLD_FILES+=usr/share/man/man4/wi.4.gz OLD_FILES+=usr/share/man/man8/bt3cfw.8.gz @@ -2994,6 +2999,9 @@ OLD_FILES+=usr/share/man/man8/bt3cfw.8.gz OLD_DIRS+=usr/lib/aout OLD_DIRS+=usr/lib/compat/aout +# 20210107: remove cmx(4) +OLD_FILES+=usr/share/man/man4/cmx.4.gz + # 20210105: remove non widechar version of ncurses OLD_LIBS+=lib/libncurses.so.9 @@ -3263,6 +3271,9 @@ OLD_DIRS+=usr/lib/clang/11.0.0/lib/freebsd OLD_DIRS+=usr/lib/clang/11.0.0/lib OLD_DIRS+=usr/lib/clang/11.0.0 +# 20201225: PMC for Xscale removed +OLD_FILES+=usr/share/man/man3/pmc.xscale.3.gz + # 20201225: libregex removed OLD_FILES+=usr/lib/libgnuregex.so OLD_LIBS+=usr/lib/libgnuregex.so.5 @@ -3374,6 +3385,8 @@ OLD_FILES+=boot/lua/logo-orbbw.lua # 20200825: merged OpenZFS support OLD_LIBS+=lib/libzfs.so.3 OLD_LIBS+=usr/lib32/libzfs.so.3 +OLD_FILES+=usr/share/man/man1/zstreamdump.1.gz +OLD_FILES+=usr/share/man/man7/zpool-features.7.gz # 20200923: memfd_test moved to /usr/tests/sys/posixshm OLD_FILES+=usr/tests/sys/kern/memfd_test @@ -3676,6 +3689,7 @@ OLD_FILES+=usr/include/opencsd/etmv4/trc_pkt_elem_etmv4d.h OLD_FILES+=usr/bin/as OLD_FILES+=usr/bin/ld.bfd OLD_FILES+=usr/share/man/man1/as.1.gz +OLD_FILES+=usr/share/man/man1/ld.bfd.1.gz OLD_FILES+=usr/share/man/man7/as.7.gz OLD_FILES+=usr/share/man/man7/ld.7.gz OLD_FILES+=usr/share/man/man7/ldint.7.gz @@ -4476,6 +4490,7 @@ OLD_FILES+=usr/include/machine/ioctl_bktr.h OLD_FILES+=usr/include/machine/ioctl_meteor.h .endif OLD_FILES+=usr/share/man/man4/bktr.4.gz +OLD_FILES+=usr/share/man/man4/brooktree.4.gz # 20200229: GCC 4.2.1 removed .if !defined(WITH_PORT_BASE_GCC) @@ -5089,7 +5104,7 @@ OLD_FILES+=usr/libexec/cc1 OLD_FILES+=usr/libexec/cc1plus OLD_FILES+=usr/share/man/man1/gcpp.1.gz OLD_FILES+=usr/share/man/man1/gperf.1.gz -OLD_FILES+=usr/share/man/man1/gperf.7.gz +OLD_FILES+=usr/share/man/man7/gperf.7.gz # 20200220: Upgrade of ncurses, shlib bumped to version 9 OLD_LIBS+=lib/libncurses.so.8 @@ -5116,8 +5131,9 @@ OLD_FILES+=usr/include/ssp/unistd.h OLD_DIRS+=usr/include/ssp # 20191229: GEOM_SCHED class and gsched tool removed -OLD_FILES+=sbin/gsched OLD_LIBS+=lib/geom/geom_sched.so +OLD_FILES+=sbin/gsched +OLD_FILES+=usr/share/man/man8/gsched.8.gz # 20191222: new clang import which bumps version from 9.0.0 to 9.0.1. OLD_FILES+=usr/lib/clang/9.0.0/include/cuda_wrappers/algorithm @@ -5355,8 +5371,14 @@ OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.xray-x86_64.a OLD_DIRS+=usr/lib/clang/9.0.0/lib/freebsd OLD_DIRS+=usr/lib/clang/9.0.0/lib OLD_DIRS+=usr/lib/clang/9.0.0 +# 20191221: Update libpcap from 1.9.0 to 1.9.1 +OLD_FILES+=usr/share/man/man3/pcap_set_immediate_mode.3.gz +OLD_FILES+=usr/share/man/man3/pcap_set_protocol.3.gz # 20191214: Removal of sranddev(3) OLD_FILES+=usr/share/man/man3/sranddev.3.gz +# 20191213: Renamed (BIT|CPU)_NAND to (BIT|CPU)_ANDNOT +OLD_FILES+=usr/share/man/man9/BIT_NAND.9.gz +OLD_FILES+=usr/share/man/man9/CPU_NAND.9.gz # 20191213: remove timeout(9) OLD_FILES+=usr/share/man/man9/callout_handle_init.9.gz OLD_FILES+=usr/share/man/man9/timeout.9.gz @@ -5367,6 +5389,8 @@ OLD_FILES+=usr/share/man/man4/trm.4.gz OLD_FILES+=usr/share/man/man4/sio.4.gz # 20191105: picobsd(8), et al, removed. OLD_FILES+=usr/share/man/man8/picobsd.8.gz +# 20191017: taskqueue_start_threads_pinned became taskqueue_start_threads_cpuset +OLD_FILES+=usr/share/man/man9/taskqueue_start_threads_pinned.9.gz # 20191009: new clang import which bumps version from 8.0.1 to 9.0.0. OLD_FILES+=usr/lib/clang/8.0.1/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/8.0.1/include/sanitizer/asan_interface.h @@ -5538,6 +5562,8 @@ OLD_FILES+=usr/bin/mklocale OLD_FILES+=usr/share/man/man1/mklocale.1.gz OLD_FILES+=usr/bin/colldef OLD_FILES+=usr/share/man/man1/colldef.1.gz +# 20190909: vm_map_unwire(9) removed +OLD_FILES+=usr/share/man/man9/vm_map_unwire.9.gz # 20190904: Remove boot1.efifat and gptboot.efifat (which never should have been) OLD_FILES+=boot/boot1.efifat OLD_FILES+=boot/gptboot.efifat @@ -5629,16 +5655,23 @@ OLD_FILES+=usr/tests/sys/netpfil/pf/sniffer.py OLD_FILES+=usr/tests/sys/netpfil/pf/pft_ping.py # 20190816: dir.h removed from POSIX OLD_FILES+=usr/include/sys/dir.h +# 20190813: deprecated GEOM classes removed +OLD_FILES+=usr/share/man/man4/geom_fox.4.gz # 20190729: gzip'ed a.out support removed OLD_FILES+=usr/include/sys/inflate.h # 20190722: cap_random(3) removed OLD_LIBS+=lib/casper/libcap_random.so.1 OLD_FILES+=usr/include/casper/cap_random.h OLD_LIBS+=usr/lib/casper/libcap_random.so +OLD_FILES+=usr/share/man/man3/libcap_random.3.gz OLD_FILES+=usr/share/man/man3/cap_random.3.gz OLD_FILES+=usr/share/man/man3/cap_random_buf.3.gz # 20190708: vm_page_hold() and _unhold() removed OLD_FILES+=usr/share/man/man9/vm_page_hold.9.gz +OLD_FILES+=usr/share/man/man9/vm_page_unhold.9.gz +# 20190625: Remove NAND and NANDFS support +OLD_FILES+=usr/share/man/man4/nand.4.gz +OLD_FILES+=usr/share/man/man4/nandsim.4.gz # 20190618: sys/capability.h removed (sys/capsicum.h is the one to use) OLD_FILES+=usr/include/sys/capability.h # 20190615: sys/pwm.h renamed to dev/pwmc.h @@ -5821,6 +5854,7 @@ OLD_FILES+=usr/share/man/man4/txp.4.gz OLD_FILES+=usr/share/man/man4/if_txp.4.gz OLD_FILES+=usr/share/man/man4/vx.4.gz OLD_FILES+=usr/share/man/man4/wb.4.gz +OLD_FILES+=usr/share/man/man4/if_wb.4.gz OLD_FILES+=usr/share/man/man4/xe.4.gz OLD_FILES+=usr/share/man/man4/if_xe.4.gz # 20190513: libcap_sysctl interface change @@ -6176,6 +6210,18 @@ OLD_LIBS+=lib/libcrypto.so.9 OLD_LIBS+=usr/lib/libssl.so.9 OLD_LIBS+=usr/lib32/libcrypto.so.9 OLD_LIBS+=usr/lib32/libssl.so.9 +# 20181022: aha(4) removal +OLD_FILES+=usr/share/man/man4/aha.4.gz +# 20181022: dpt(4) removal +OLD_FILES+=usr/share/man/man4/dpt.4.gz +# 20181022: ncr(4) removal +OLD_FILES+=usr/share/man/man4/ncr.4.gz +# 20181022: ncv(4) removal +OLD_FILES+=usr/share/man/man4/ncv.4.gz +# 20181022: nsp(4) removal +OLD_FILES+=usr/share/man/man4/nsp.4.gz +# 20181022: stg(4) removal +OLD_FILES+=usr/share/man/man4/stg.4.gz # 20181021: mse(4) removal OLD_FILES+=usr/share/man/man4/mse.4.gz # 20181015: Stale libcasper(3) files following r329452 @@ -6192,6 +6238,7 @@ OLD_LIBS+=usr/lib32/libcap_random.so.0 OLD_LIBS+=usr/lib32/libcap_dns.so.0 OLD_LIBS+=usr/lib32/libcap_syslog.so.0 # 20181012: rename of ixlv(4) to iavf(4) +OLD_FILES+=usr/share/man/man4/if_ixlv.4.gz OLD_FILES+=usr/share/man/man4/ixlv.4.gz # 20181009: OpenSSL 1.1.1 OLD_FILES+=usr/include/openssl/des_old.h @@ -6433,6 +6480,8 @@ OLD_FILES+=usr/share/man/man3/arc4random_addrandom.3.gz OLD_FILES+=usr/share/man/man3/arc4random_stir.3.gz # 20180819: send-pr(1) placeholder removal OLD_FILES+=usr/bin/send-pr +# 20180801: jedec_ts(4) removed +OLD_FILES+=usr/share/man/man4/jedec_ts.4.gz # 20180725: Cleanup old libcasper.so.0 OLD_LIBS+=lib/libcasper.so.0 OLD_LIBS+=usr/lib32/libcasper.so.0 @@ -6446,6 +6495,8 @@ OLD_FILES+=usr/bin/indent/tests/sac.0.stdout # 20180721: move of libmlx5.so.1 and libibverbs.so.1 OLD_LIBS+=usr/lib/libmlx5.so.1 OLD_LIBS+=usr/lib/libibverbs.so.1 +# 20180720: zfsloader.8 merged into loader.8 +OLD_FILES+=usr/share/man/man8/zfsloader.8.gz # 20180710: old numa cleanup OLD_FILES+=usr/include/sys/numa.h OLD_FILES+=usr/share/man/man2/numa_getaffinity.2.gz @@ -6967,6 +7018,8 @@ OLD_FILES+=usr/share/games/fortune/zippy.dat OLD_FILES+=usr/share/misc/eqnchar # 20171110: Removal of mailaddr man page OLD_FILES+=usr/share/man/man7/mailaddr.7.gz +# 20171108: Rename of NgSendMsgReply to NgSendReplyMsg +OLD_FILES+=usr/share/man/man3/NgSendMsgReply.3.gz # 20171108: badsect(8) removal OLD_FILES+=sbin/badsect OLD_FILES+=rescue/badsect @@ -7177,6 +7230,8 @@ OLD_DIRS+=usr/share/openssl/man/cat1 OLD_DIRS+=usr/share/openssl/man/cat3 OLD_DIRS+=usr/share/openssl/man/en.ISO8859-1/cat1 OLD_DIRS+=usr/share/openssl/man/en.ISO8859-1/cat3 +# 20170830: rename ntb_hw(4) to ntb_hw_intel(4) +OLD_FILES+=usr/share/man/man4/ntb_hw.4.gz # 20170802: ksyms(4) ioctl interface was removed OLD_FILES+=usr/include/sys/ksyms.h # 20170729: the iicbus/pcf8563 driver is replaced with iicbus/nxprtc @@ -7928,6 +7983,9 @@ OLD_LIBS+=usr/lib32/libmilter.so.5 OLD_FILES+=etc/rc.d/atm1 OLD_FILES+=etc/rc.d/atm2 OLD_FILES+=etc/rc.d/atm3 +OLD_FILES+=usr/share/man/man8/rc.atm.8.gz +# 20170426: UMA_ZONE_REFCNT removed +OLD_FILES+=usr/share/man/man9/uma_find_refcnt.9.gz # 20170424: NATM support removed OLD_FILES+=rescue/atmconfig OLD_FILES+=sbin/atmconfig @@ -8000,6 +8058,8 @@ OLD_DIRS+=usr/tests/sys/geom/eli # 20170313: sbin/ipftest and ipresend temporarily disconnected. OLD_FILES+=sbin/ipftest OLD_FILES+=sbin/ipresend +OLD_FILES+=usr/share/man/man1/ipftest.1.gz +OLD_FILES+=usr/share/man/man1/ipresend.1.gz # 20170311: Remove WITHOUT_MANDOCDB option OLD_FILES+=usr/share/man/man1/makewhatis.1.gz # 20170308: rename some tests @@ -8131,6 +8191,10 @@ OLD_FILES+=usr/tests/lib/libpam/t_openpam_ctype OLD_FILES+=usr/tests/lib/libpam/t_openpam_readlinev OLD_FILES+=usr/tests/lib/libpam/t_openpam_readword OLD_DIRS+=usr/test/lib/libpam +# 20170216: remove ahb(4) +OLD_FILES+=usr/share/man/man4/ahb.4.gz +# 20170216: remove fea(4) +OLD_FILES+=usr/share/man/man4/fea.4.gz # 20170206: remove bdes(1) OLD_FILES+=usr/bin/bdes OLD_FILES+=usr/lib/debug/usr/bin/bdes.debug @@ -8387,6 +8451,7 @@ OLD_FILES+=usr/share/man/man4/hv_vss.4.gz # 20161118: Remove hv_ata_pci_disengage(4) OLD_FILES+=usr/share/man/man4/hv_ata_pci_disengage.4.gz # 20161017: urtwn(4) was merged into rtwn(4) +OLD_FILES+=usr/share/man/man4/if_urtwn.4.gz OLD_FILES+=usr/share/man/man4/urtwn.4.gz OLD_FILES+=usr/share/man/man4/urtwnfw.4.gz # 20161015: Remove GNU rcs @@ -8723,6 +8788,7 @@ OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.ubsan_standalone_cxx-x86_ OLD_DIRS+=usr/lib/clang/3.7.1/lib/freebsd OLD_DIRS+=usr/lib/clang/3.7.1/lib OLD_DIRS+=usr/lib/clang/3.7.1 +OLD_FILES+=usr/share/man/man1/tblgen.1.gz # 20160301: Remove taskqueue_enqueue_fast OLD_FILES+=usr/share/man/man9/taskqueue_enqueue_fast.9.gz # 20160225: Remove casperd and libcapsicum. @@ -10098,7 +10164,7 @@ OLD_FILES+=usr/tests/usr.sbin/pw/pw_delete OLD_FILES+=usr/tests/usr.sbin/pw/pw_modify # 20141202: update to mandoc CVS 20141201 OLD_FILES+=usr.bin/preconv -OLD_FILES+=share/man/man1/preconv.1.gz +OLD_FILES+=usr/share/man/man1/preconv.1.gz # 20141129: mrouted rc.d scripts removed from base OLD_FILES+=etc/rc.d/mrouted # 20141126: convert sbin/mdconfig/tests to ATF format tests @@ -10327,6 +10393,8 @@ OLD_FILES+=usr/lib/libssp_p.a OLD_FILES+=usr/lib/libstand_p.a OLD_FILES+=usr/lib32/libssp_p.a OLD_FILES+=usr/lib32/libstand_p.a +# 20140413: Removed NO_MANCOMPRESS from mount_fusefs +OLD_FILES+=usr/share/man/man8/mount_fusefs.8 # 20140314: AppleTalk OLD_DIRS+=usr/include/netatalk OLD_FILES+=usr/include/netatalk/aarp.h @@ -10782,7 +10850,7 @@ OLD_FILES+=usr/share/man/man9/vm_page_io.9.gz OLD_FILES+=usr/share/man/man9/vm_page_io_finish.9.gz OLD_FILES+=usr/share/man/man9/vm_page_io_start.9.gz OLD_FILES+=usr/share/man/man9/vm_page_wakeup.9.gz -# 20130710: libkvm version bump +# 20130710: libkvm version bump OLD_LIBS+=lib/libkvm.so.5 OLD_LIBS+=usr/lib32/libkvm.so.5 # 20130623: dialog update from 1.1 to 1.2 From owner-dev-commits-src-all@freebsd.org Mon May 3 20:40:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9197363CB6C; Mon, 3 May 2021 20:40:33 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYvxY3lmRz3hxy; Mon, 3 May 2021 20:40:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 73A1C24AEF; Mon, 3 May 2021 20:40:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143KeXca069399; Mon, 3 May 2021 20:40:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143KeXF6069398; Mon, 3 May 2021 20:40:33 GMT (envelope-from git) Date: Mon, 3 May 2021 20:40:33 GMT Message-Id: <202105032040.143KeXF6069398@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: d134e496151e - main - Add a few missed gnuregex libraries to ObsoleteFiles.inc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d134e496151e8103ca8acc7bb1696babe07576a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 20:40:33 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=d134e496151e8103ca8acc7bb1696babe07576a7 commit d134e496151e8103ca8acc7bb1696babe07576a7 Author: Dimitry Andric AuthorDate: 2021-05-03 20:40:11 +0000 Commit: Dimitry Andric CommitDate: 2021-05-03 20:40:11 +0000 Add a few missed gnuregex libraries to ObsoleteFiles.inc --- ObsoleteFiles.inc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 16fedfbb708b..5b42cd94b738 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -3275,14 +3275,19 @@ OLD_DIRS+=usr/lib/clang/11.0.0 OLD_FILES+=usr/share/man/man3/pmc.xscale.3.gz # 20201225: libregex removed -OLD_FILES+=usr/lib/libgnuregex.so -OLD_LIBS+=usr/lib/libgnuregex.so.5 -OLD_FILES+=usr/lib/libgnuregex_p.a OLD_FILES+=usr/include/gnu/posix/regex.h OLD_DIRS+=usr/include/gnu/posix OLD_FILES+=usr/include/gnu/regex.h OLD_DIRS+=usr/include/gnu OLD_FILES+=usr/include/gnuregex.h +OLD_FILES+=usr/lib/libgnuregex.a +OLD_FILES+=usr/lib/libgnuregex.so +OLD_LIBS+=usr/lib/libgnuregex.so.5 +OLD_FILES+=usr/lib/libgnuregex_p.a +OLD_FILES+=usr/lib32/libgnuregex.a +OLD_FILES+=usr/lib32/libgnuregex.so +OLD_LIBS+=usr/lib32/libgnuregex.so.5 +OLD_FILES+=usr/lib32/libgnuregex_p.a # 20201225: gnugrep removed OLD_FILES+=usr/bin/bsdgrep From owner-dev-commits-src-all@freebsd.org Mon May 3 20:51:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 130CA63D419; Mon, 3 May 2021 20:51:02 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYw9d5Yr0z3jdd; Mon, 3 May 2021 20:51:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AF6F924D1C; Mon, 3 May 2021 20:51:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143Kp1wN082423; Mon, 3 May 2021 20:51:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143Kp1DZ082422; Mon, 3 May 2021 20:51:01 GMT (envelope-from git) Date: Mon, 3 May 2021 20:51:01 GMT Message-Id: <202105032051.143Kp1DZ082422@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 1c3dcf8d571e - main - Add a few missed libprivateevent files to ObsoleteFiles.inc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c3dcf8d571e979e5bfe06c285c610e4ca8ecc2f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 20:51:02 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=1c3dcf8d571e979e5bfe06c285c610e4ca8ecc2f commit 1c3dcf8d571e979e5bfe06c285c610e4ca8ecc2f Author: Dimitry Andric AuthorDate: 2021-05-03 20:43:39 +0000 Commit: Dimitry Andric CommitDate: 2021-05-03 20:43:39 +0000 Add a few missed libprivateevent files to ObsoleteFiles.inc --- ObsoleteFiles.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 5b42cd94b738..7f15953105ed 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -3902,11 +3902,15 @@ OLD_LIBS+=usr/lib32/padlock.so # 20200528: libevent renamed libevent1 OLD_FILES+=usr/include/private/event/event.h +OLD_DIRS+=usr/include/private/event OLD_FILES+=usr/lib/libprivateevent.a OLD_FILES+=usr/lib/libprivateevent.so OLD_LIBS+=usr/lib/libprivateevent.so.1 OLD_FILES+=usr/lib/libprivateevent_p.a -OLD_DIRS+=usr/include/private/event +OLD_FILES+=usr/lib32/libprivateevent.a +OLD_FILES+=usr/lib32/libprivateevent.so +OLD_LIBS+=usr/lib32/libprivateevent.so.1 +OLD_FILES+=usr/lib32/libprivateevent_p.a # 20200523: new clang import which bumps version from 10.0.0 to 10.0.1. OLD_FILES+=usr/lib/clang/10.0.0/include/cuda_wrappers/algorithm From owner-dev-commits-src-all@freebsd.org Mon May 3 20:51:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E81363D48C; Mon, 3 May 2021 20:51:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYw9f6JxBz3jhC; Mon, 3 May 2021 20:51:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CA09124D9D; Mon, 3 May 2021 20:51:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143Kp2PB082445; Mon, 3 May 2021 20:51:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143Kp2bS082444; Mon, 3 May 2021 20:51:02 GMT (envelope-from git) Date: Mon, 3 May 2021 20:51:02 GMT Message-Id: <202105032051.143Kp2bS082444@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 0dad05dd3057 - main - Add a few missed libalias_cuseeme files to ObsoleteFiles.inc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0dad05dd3057fac1a11c67ada163be5b653f9ec3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 20:51:03 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=0dad05dd3057fac1a11c67ada163be5b653f9ec3 commit 0dad05dd3057fac1a11c67ada163be5b653f9ec3 Author: Dimitry Andric AuthorDate: 2021-05-03 20:45:08 +0000 Commit: Dimitry Andric CommitDate: 2021-05-03 20:45:08 +0000 Add a few missed libalias_cuseeme files to ObsoleteFiles.inc --- ObsoleteFiles.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 7f15953105ed..f179299d4a0a 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -4170,6 +4170,9 @@ OLD_FILES+=usr/include/crypto/xform_userland.h OLD_LIBS+=lib/libalias_cuseeme.so OLD_FILES+=usr/lib/libalias_cuseeme.a OLD_FILES+=usr/lib/libalias_cuseeme_p.a +OLD_FILES+=usr/lib32/libalias_cuseeme.a +OLD_LIBS+=usr/lib32/libalias_cuseeme.so +OLD_FILES+=usr/lib32/libalias_cuseeme_p.a # 20200511: Remove deprecated crypto algorithms OLD_FILES+=usr/include/crypto/cast.h From owner-dev-commits-src-all@freebsd.org Mon May 3 20:51:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DC7F63CEF9; Mon, 3 May 2021 20:51:04 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYw9h0bsSz3jmb; Mon, 3 May 2021 20:51:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EEACD24BD1; Mon, 3 May 2021 20:51:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143Kp30j082474; Mon, 3 May 2021 20:51:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143Kp3Wu082473; Mon, 3 May 2021 20:51:03 GMT (envelope-from git) Date: Mon, 3 May 2021 20:51:03 GMT Message-Id: <202105032051.143Kp3Wu082473@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 64fe4400daad - main - Add a few missed libauditd files to ObsoleteFiles.inc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 64fe4400daada6b19b8a60d966978d26e9d3474f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 20:51:04 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=64fe4400daada6b19b8a60d966978d26e9d3474f commit 64fe4400daada6b19b8a60d966978d26e9d3474f Author: Dimitry Andric AuthorDate: 2021-05-03 20:47:41 +0000 Commit: Dimitry Andric CommitDate: 2021-05-03 20:47:41 +0000 Add a few missed libauditd files to ObsoleteFiles.inc --- ObsoleteFiles.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index f179299d4a0a..62a4dcc5df31 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -4194,6 +4194,10 @@ OLD_FILES+=usr/lib/libauditd.a OLD_FILES+=usr/lib/libauditd.so OLD_LIBS+=usr/lib/libauditd.so.5 OLD_FILES+=usr/lib/libauditd_p.a +OLD_FILES+=usr/lib32/libauditd.a +OLD_FILES+=usr/lib32/libauditd.so +OLD_LIBS+=usr/lib32/libauditd.so.5 +OLD_FILES+=usr/lib32/libauditd_p.a # 20200418: Remove bogus man links OLD_FILES+=usr/share/man/man3/getauusernam_R.3.gz From owner-dev-commits-src-all@freebsd.org Mon May 3 21:09:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4F7B63DC4C; Mon, 3 May 2021 21:09:43 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYwbC4z36z3kbK; Mon, 3 May 2021 21:09:43 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qv1-xf2b.google.com with SMTP id jm10so3379722qvb.5; Mon, 03 May 2021 14:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=4RwtE0kenZqRa+dtUu8k58tCG99Yq5Ak8QZ27XkKHG4=; b=ngh7zHR6SYSrz0szF6iUFEN0sJxpe3wGjsmy/EvsMvDazWqjB4ggqV3tKZRRykNw4l Trd0yr4IkavJoxkieO93hQXVoYMTp9VA3uKMmFCrYbiZLLPm5XqjJLil7AxjIR9Xw8h2 o74zC/Mvv8WiAYUIBqHoJIXE8Rwu0JLUvhqo3MZDwVWOJ92UtZdMhPwo0b8APvLa5GaD O5+n705DCreYpcl6KVHlxMEqY9jUsJFynqtKhysKmtuoOHBDS3WOqq7vFbvkJhzYkJSV dETwBQQK2jq9iTrNOnpsBbyhHMIJMn5kDbfhHdm5VQu8sACBfxhB1kExVdDQ76jI5ujS f0tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=4RwtE0kenZqRa+dtUu8k58tCG99Yq5Ak8QZ27XkKHG4=; b=ipNkCYKMUQo1A4W/0BzCmgAXUQ7t7dg2lzUm/rEdoSVnUIA4EZ5kDqE1HqJbUNQ5P0 BeCp/CBZmdukg1rZq2g2zRDdp35KO8f0NOM3Qec19Of2iP9d7lMeshvBUt0oW8cMgyIW AXWlr52ALLoZ9qPF8stkzdM2XODFVyzd6G2CbOatMBO+J4CKSsc8iiWOHvTjhnZzE7fo jllrlADNqwmrQL2G7LpB2YMDpjR1FwhgbyoaJhL9SafPYc8+fmDiHKiXsOd8jIKOyoWF WIwKbhA+3866udDAPAOLHniDRZGSr+8Syo7djqxTHphFELLb2o+lvEnndzxEpRTnejO8 VEiw== X-Gm-Message-State: AOAM532OB7MxHcCkeQUr429DACK2blBpmNOkeaNVw8B6eLkE+ty1HexR xdmfY7hnoMpF3GacX0qYO+9BBJOMUyGCjQ== X-Google-Smtp-Source: ABdhPJzOppMafHmzZ0dW42lBddlA4bCenf+DKKvOoRaC9pXInSQ+NbBwgo3+QZCZ9B5CKa50gIl+tQ== X-Received: by 2002:a0c:bd2b:: with SMTP id m43mr22052860qvg.52.1620076181913; Mon, 03 May 2021 14:09:41 -0700 (PDT) Received: from nuc ([142.126.164.150]) by smtp.gmail.com with ESMTPSA id j22sm1481859qkk.58.2021.05.03.14.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 14:09:41 -0700 (PDT) Sender: Mark Johnston Date: Mon, 3 May 2021 17:09:42 -0400 From: Mark Johnston To: Allan Jude Cc: Kevin Bowling , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, src-committers@freebsd.org Subject: Re: git: 64881da47807 - main - ixgbe: Restore AIM support Message-ID: References: <202105031755.143Htj33046938@gitrepo.freebsd.org> <295b05d0-58ba-6e04-6fbf-cb997c9ab112@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <295b05d0-58ba-6e04-6fbf-cb997c9ab112@freebsd.org> X-Rspamd-Queue-Id: 4FYwbC4z36z3kbK X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 21:09:43 -0000 On Mon, May 03, 2021 at 03:30:55PM -0400, Allan Jude wrote: > On 5/3/2021 2:12 PM, Kevin Bowling wrote: > > Should we enable this by default?  My primary concern in the review is > > not making things like this require expert tuning.  If it is expected to > > be necessary, which Gallatin@ makes a case for, let’s toggle it on by > > default. > > > > On Mon, May 3, 2021 at 10:56 AM Mark Johnston > > wrote: > > > > The branch main has been updated by markj: > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=64881da478071431a2d9e62613997a5772c56cdf > > > > > > commit 64881da478071431a2d9e62613997a5772c56cdf > > Author:     Sai Rajesh Tallamraju > > > > AuthorDate: 2021-05-03 17:45:00 +0000 > > Commit:     Mark Johnston > > CommitDate: 2021-05-03 17:47:14 +0000 > > > > It looks like AIM was on by default in 11.x and earlier: > hw.ix.enable_aim: 1 > hw.igb.enable_aim: 1 > > So I think enabling it does make sense in light of Drew's comments about > mbuf sorting only being useful in the face of something like AIM where > there will be a sufficient number of mbufs to sort. See https://reviews.freebsd.org/D30094 From owner-dev-commits-src-all@freebsd.org Tue May 4 00:43:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E8125F9F98; Tue, 4 May 2021 00:43:15 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZ1Kb1DVkz3t8s; Tue, 4 May 2021 00:43:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1D19327D9E; Tue, 4 May 2021 00:43:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1440hFC1091320; Tue, 4 May 2021 00:43:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1440hFA7091319; Tue, 4 May 2021 00:43:15 GMT (envelope-from git) Date: Tue, 4 May 2021 00:43:15 GMT Message-Id: <202105040043.1440hFA7091319@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: bbd5039e9197 - stable/13 - nfsd: fix stripe size reply for the File Layout pNFS server MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bbd5039e919728c739d717344f2183c29d142f89 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 00:43:15 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=bbd5039e919728c739d717344f2183c29d142f89 commit bbd5039e919728c739d717344f2183c29d142f89 Author: Rick Macklem AuthorDate: 2021-04-20 00:51:07 +0000 Commit: Rick Macklem CommitDate: 2021-05-04 00:40:01 +0000 nfsd: fix stripe size reply for the File Layout pNFS server At a recent testing event I found out that I had misinterpreted RFC5661 where it describes the stripe size in the File Layout's nfl_util field. This patch fixes the pNFS File Layout server so that it returns the correct value to the NFSv4.1/4.2 pNFS enabled client. This affects almost no one, since pNFS server configurations are rare and the extant pNFS aware NFS clients seemed to function correctly despite the erroneous stripe size. It *might* be needed for correct behaviour if a recent Linux client mounts a FreeBSD pNFS server configuration that is using File Layout (non-mirrored configuration). (cherry picked from commit 5a89498d19863d0c4cb074f9b93862a70040bf1b) --- sys/fs/nfsserver/nfs_nfsdstate.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index fa7bb3ba9f56..60647ab288d8 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -6873,14 +6873,8 @@ nfsrv_filelayout(struct nfsrv_descript *nd, int iomode, fhandle_t *fhp, NFSBCOPY(devid, tl, NFSX_V4DEVICEID); /* Device ID. */ tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); - /* - * Make the stripe size as many 64K blocks as will fit in the stripe - * mask. Since there is only one stripe, the stripe size doesn't really - * matter, except that the Linux client will only handle an exact - * multiple of their PAGE_SIZE (usually 4K). I chose 64K as a value - * that should cover most/all arches w.r.t. PAGE_SIZE. - */ - *tl++ = txdr_unsigned(NFSFLAYUTIL_STRIPE_MASK & ~0xffff); + /* Set the stripe size to the maximum I/O size. */ + *tl++ = txdr_unsigned(NFS_SRVMAXIO & NFSFLAYUTIL_STRIPE_MASK); *tl++ = 0; /* 1st stripe index. */ pattern_offset = 0; txdr_hyper(pattern_offset, tl); tl += 2; /* Pattern offset. */ From owner-dev-commits-src-all@freebsd.org Tue May 4 00:44:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B32755F9AF6; Tue, 4 May 2021 00:44:38 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZ1MB4grKz3t6p; Tue, 4 May 2021 00:44:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 937A627ECE; Tue, 4 May 2021 00:44:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1440ic3U091533; Tue, 4 May 2021 00:44:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1440icIT091532; Tue, 4 May 2021 00:44:38 GMT (envelope-from git) Date: Tue, 4 May 2021 00:44:38 GMT Message-Id: <202105040044.1440icIT091532@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: d0fbb03a4dc5 - stable/13 - nfscommon: fix function name in comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d0fbb03a4dc51d78f92c1ef37fd4b6beecb0d724 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 00:44:38 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d0fbb03a4dc51d78f92c1ef37fd4b6beecb0d724 commit d0fbb03a4dc51d78f92c1ef37fd4b6beecb0d724 Author: Rick Macklem AuthorDate: 2021-04-20 03:09:46 +0000 Commit: Rick Macklem CommitDate: 2021-05-04 00:41:48 +0000 nfscommon: fix function name in comment (cherry picked from commit 78ffcb86d98fc9c27ac7a723c65621667036c42d) --- sys/fs/nfs/nfs_commonsubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 4afa4c2d9ab4..a30ee458e06c 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -4614,7 +4614,7 @@ nfsmout: * Handle an NFSv4.1 Sequence request for the session. * If reply != NULL, use it to return the cached reply, as required. * The client gets a cached reply via this call for callbacks, however the - * server gets a cached reply via the nfsv4_seqsess_cachereply() call. + * server gets a cached reply via the nfsv4_seqsess_cacherep() call. */ int nfsv4_seqsession(uint32_t seqid, uint32_t slotid, uint32_t highslot, From owner-dev-commits-src-all@freebsd.org Tue May 4 00:48:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBDE05FA1A1; Tue, 4 May 2021 00:48:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZ1Rs6JyZz3tCv; Tue, 4 May 2021 00:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C6F5C27C25; Tue, 4 May 2021 00:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1440mfuL091911; Tue, 4 May 2021 00:48:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1440mf46091910; Tue, 4 May 2021 00:48:41 GMT (envelope-from git) Date: Tue, 4 May 2021 00:48:41 GMT Message-Id: <202105040048.1440mf46091910@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 51c1b8c6e2b9 - stable/12 - nfsd: fix stripe size reply for the File Layout pNFS server MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 51c1b8c6e2b90dddbd7515416ab7fd3362c44df9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 00:48:42 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=51c1b8c6e2b90dddbd7515416ab7fd3362c44df9 commit 51c1b8c6e2b90dddbd7515416ab7fd3362c44df9 Author: Rick Macklem AuthorDate: 2021-04-20 00:51:07 +0000 Commit: Rick Macklem CommitDate: 2021-05-04 00:45:30 +0000 nfsd: fix stripe size reply for the File Layout pNFS server At a recent testing event I found out that I had misinterpreted RFC5661 where it describes the stripe size in the File Layout's nfl_util field. This patch fixes the pNFS File Layout server so that it returns the correct value to the NFSv4.1/4.2 pNFS enabled client. This affects almost no one, since pNFS server configurations are rare and the extant pNFS aware NFS clients seemed to function correctly despite the erroneous stripe size. It *might* be needed for correct behaviour if a recent Linux client mounts a FreeBSD pNFS server configuration that is using File Layout (non-mirrored configuration). (cherry picked from commit 5a89498d19863d0c4cb074f9b93862a70040bf1b) --- sys/fs/nfsserver/nfs_nfsdstate.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 5aafebf0dd77..f0c72487121c 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -6849,14 +6849,8 @@ nfsrv_filelayout(struct nfsrv_descript *nd, int iomode, fhandle_t *fhp, NFSBCOPY(devid, tl, NFSX_V4DEVICEID); /* Device ID. */ tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); - /* - * Make the stripe size as many 64K blocks as will fit in the stripe - * mask. Since there is only one stripe, the stripe size doesn't really - * matter, except that the Linux client will only handle an exact - * multiple of their PAGE_SIZE (usually 4K). I chose 64K as a value - * that should cover most/all arches w.r.t. PAGE_SIZE. - */ - *tl++ = txdr_unsigned(NFSFLAYUTIL_STRIPE_MASK & ~0xffff); + /* Set the stripe size to the maximum I/O size. */ + *tl++ = txdr_unsigned(NFS_SRVMAXIO & NFSFLAYUTIL_STRIPE_MASK); *tl++ = 0; /* 1st stripe index. */ pattern_offset = 0; txdr_hyper(pattern_offset, tl); tl += 2; /* Pattern offset. */ From owner-dev-commits-src-all@freebsd.org Tue May 4 00:50:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E71A65FA32E; Tue, 4 May 2021 00:50:13 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZ1Td6GcKz3t7H; Tue, 4 May 2021 00:50:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CA3AF27D63; Tue, 4 May 2021 00:50:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1440oDIL096693; Tue, 4 May 2021 00:50:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1440oDLi096690; Tue, 4 May 2021 00:50:13 GMT (envelope-from git) Date: Tue, 4 May 2021 00:50:13 GMT Message-Id: <202105040050.1440oDLi096690@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 832f2982a1cc - stable/12 - nfscommon: fix function name in comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 832f2982a1cc5c81521cb93712662e23c8eb380b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 00:50:14 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=832f2982a1cc5c81521cb93712662e23c8eb380b commit 832f2982a1cc5c81521cb93712662e23c8eb380b Author: Rick Macklem AuthorDate: 2021-04-20 03:09:46 +0000 Commit: Rick Macklem CommitDate: 2021-05-04 00:47:34 +0000 nfscommon: fix function name in comment (cherry picked from commit 78ffcb86d98fc9c27ac7a723c65621667036c42d) --- sys/fs/nfs/nfs_commonsubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 07652fbdb911..39cf9e9fc819 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -4556,7 +4556,7 @@ nfsmout: * Handle an NFSv4.1 Sequence request for the session. * If reply != NULL, use it to return the cached reply, as required. * The client gets a cached reply via this call for callbacks, however the - * server gets a cached reply via the nfsv4_seqsess_cachereply() call. + * server gets a cached reply via the nfsv4_seqsess_cacherep() call. */ int nfsv4_seqsession(uint32_t seqid, uint32_t slotid, uint32_t highslot, From owner-dev-commits-src-all@freebsd.org Tue May 4 01:33:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BA685FCD47; Tue, 4 May 2021 01:33:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZ2R30lKyz4Qsp; Tue, 4 May 2021 01:33:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0C6BB823; Tue, 4 May 2021 01:33:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1441X2cF058157; Tue, 4 May 2021 01:33:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1441X2kX058156; Tue, 4 May 2021 01:33:02 GMT (envelope-from git) Date: Tue, 4 May 2021 01:33:02 GMT Message-Id: <202105040133.1441X2kX058156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 0755df1eeee8 - main - nfscl: fix typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0755df1eeee838e5b114c61886d6462507290977 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 01:33:03 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=0755df1eeee838e5b114c61886d6462507290977 commit 0755df1eeee838e5b114c61886d6462507290977 Author: Rick Macklem AuthorDate: 2021-05-04 01:29:27 +0000 Commit: Rick Macklem CommitDate: 2021-05-04 01:29:27 +0000 nfscl: fix typo in a comment MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clrpcops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index ed95173b732b..4ce871e810fe 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -1229,7 +1229,7 @@ nfsrpc_getattr(vnode_t vp, struct ucred *cred, NFSPROC_T *p, } /* - * nfs getattr call with non-vnode arguemnts. + * nfs getattr call with non-vnode arguments. */ int nfsrpc_getattrnovp(struct nfsmount *nmp, u_int8_t *fhp, int fhlen, int syscred, From owner-dev-commits-src-all@freebsd.org Tue May 4 01:42:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31D795FCFD4; Tue, 4 May 2021 01:42:07 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4FZ2dV0s5Vz4RDb; Tue, 4 May 2021 01:42:05 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from disco.vangyzen.net (unknown [70.97.188.230]) by smtp.vangyzen.net (Postfix) with ESMTPSA id E61E956488; Mon, 3 May 2021 20:41:58 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=vangyzen.net; s=default; t=1620092519; bh=EDbJBjHJDbDEHDIza9qlZG8fhYdw3tlTUMfqpSAfjlI=; h=Subject:To:References:From:Date:In-Reply-To; b=aJ3rMqW4cTqQ6ncea5wf2TS0cy6QWcIwisBy0QmgghsEmRyuBQ6suFv0hVKvEMsu9 MceJtr0u7oazsyZ3G5MG1Iry4p/HaDXDkmWs2ApVHbvc8w9+UQni35JB8CyKJqEGad SDryHRGky9UorfXlcvpswWqS4pMMO/0sD4YmybyTlypIBdwXwFmQZuMU7phYZRgd53 dVAfMDBsr0skA6rV5puDGqt+7ExcZRz9uEKed6gZ9hP1u66pvYIAeL01vXwbBQhY5J YlSbr5EHiTT52qn5GLUofQJtSHvIN2IC233rIdRqDXTTjfHuEGbG7uz0ASoRem+bDA Sr5yh8zdtf94A== Subject: Re: ee8b757a949a - main - ipmi: support getting address from EFI To: Ravi Pokala , Eric van Gyzen , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104291525.13TFPCQR020414@gitrepo.freebsd.org> From: Eric van Gyzen Message-ID: <7c68e6f9-29c4-71a6-c172-465fc8dda9e3@vangyzen.net> Date: Mon, 3 May 2021 20:41:55 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4FZ2dV0s5Vz4RDb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=vangyzen.net header.s=default header.b=aJ3rMqW4; dmarc=pass (policy=none) header.from=vangyzen.net; spf=pass (mx1.freebsd.org: domain of eric@vangyzen.net designates 199.48.133.146 as permitted sender) smtp.mailfrom=eric@vangyzen.net X-Spamd-Result: default: False [-4.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[vangyzen.net:s=default]; FREEFALL_USER(0.00)[eric]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+a]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[199.48.133.146:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DKIM_TRACE(0.00)[vangyzen.net:+]; DMARC_POLICY_ALLOW(-0.50)[vangyzen.net,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[199.48.133.146:from]; ASN(0.00)[asn:36236, ipnet:199.48.132.0/22, country:US]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 01:42:07 -0000 > URL: https://cgit.FreeBSD.org/src/commit/?id=ee8b757a949a9575c7355ea01f0475e0c526b9e5 > > commit ee8b757a949a9575c7355ea01f0475e0c526b9e5 > > ipmi: support getting address from EFI > > I get why the MODULE_DEPEND() was added to ipmi_smbios.c: it's now making an efirt call. But why was it added to the other three files? Those other files call the function that calls into efirt. I don’t know if the explicit dependencies were actually necessary, but since they’re logically correct, I figure they don’t hurt. Eric From owner-dev-commits-src-all@freebsd.org Tue May 4 10:56:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01BA462D9D5; Tue, 4 May 2021 10:56:52 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZGxb6gldz4sfy; Tue, 4 May 2021 10:56:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D2F2010783; Tue, 4 May 2021 10:56:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144AupdP001005; Tue, 4 May 2021 10:56:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144AupbH001004; Tue, 4 May 2021 10:56:51 GMT (envelope-from git) Date: Tue, 4 May 2021 10:56:51 GMT Message-Id: <202105041056.144AupbH001004@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: c85b57ac0130 - main - stress2: New test scenario added MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c85b57ac01308fadd6ca57dff97d3c2474b6186c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 10:56:52 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=c85b57ac01308fadd6ca57dff97d3c2474b6186c commit c85b57ac01308fadd6ca57dff97d3c2474b6186c Author: Peter Holm AuthorDate: 2021-05-04 10:55:58 +0000 Commit: Peter Holm CommitDate: 2021-05-04 10:55:58 +0000 stress2: New test scenario added --- tools/test/stress2/misc/ptrace12.sh | 82 +++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/tools/test/stress2/misc/ptrace12.sh b/tools/test/stress2/misc/ptrace12.sh new file mode 100755 index 000000000000..b7381c4937e1 --- /dev/null +++ b/tools/test/stress2/misc/ptrace12.sh @@ -0,0 +1,82 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Peter Holm +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +# D29955: ptrace(PT_COREDUMP) test scenario. + +# "panic: Assertion td->td_sleepqueue != NULL failed" seen with WiP kernel code. + +. ../default.cfg + +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 2g -u $mdstart +newfs $newfs_flags -n md$mdstart > /dev/null +mount /dev/md$mdstart $mntpoint +chmod 777 $mntpoint + +export runRUNTIME=10m +export RUNDIR=$mntpoint/stressX +set `df -ik $mntpoint | tail -1 | awk '{print $4,$7}'` +export KBLOCKS=$(($1 / 2)) +export INODES=$(($2 / 2)) + +su $testuser -c 'cd ..; ./run.sh marcus.cfg' & +sleep 5 +while pgrep -q run; do + # exclude "swap" due to core file size + list=`ps -U$testuser | sed 1d | grep -vE "\.sh|run|defunct|swap" | \ + awk '{print $1}'` + [ -z "$list" ] && { pkill swap; continue; } + n=0 + pids= + for p in $list; do + ( gcore -k -c $mntpoint/core.$p $p 2>&1 | \ + grep -v 'No such process' ) & + pids="$pids $!" + n=$((n + 1)) + [ $n -ge 2 ] && break + done + for p in "$pids"; do + wait $p + done + rm -f $mntpoint/core.* +done +while pkill -U$testuser; do sleep 2; done +wait + +n=0 +while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 + [ $((n += 1)) -gt 300 ] && { echo FAIL; exit 1; } +done +checkfs /dev/md$mdstart; s=$? +mdconfig -d -u $mdstart +exit $s From owner-dev-commits-src-all@freebsd.org Tue May 4 12:02:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35D9062FB7D; Tue, 4 May 2021 12:02:22 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZJPB0WdNz3CNp; Tue, 4 May 2021 12:02:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 04E5C1124A; Tue, 4 May 2021 12:02:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144C2L5T093206; Tue, 4 May 2021 12:02:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144C2L6q093205; Tue, 4 May 2021 12:02:21 GMT (envelope-from git) Date: Tue, 4 May 2021 12:02:21 GMT Message-Id: <202105041202.144C2L6q093205@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: fc58438ca26b - stable/12 - pfctl: Revert "pfctl: Another set skip fix" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fc58438ca26b46f65439bcfc89052de1008b9774 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 12:02:22 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fc58438ca26b46f65439bcfc89052de1008b9774 commit fc58438ca26b46f65439bcfc89052de1008b9774 Author: Kristof Provost AuthorDate: 2021-04-26 08:07:07 +0000 Commit: Kristof Provost CommitDate: 2021-05-04 07:52:00 +0000 pfctl: Revert "pfctl: Another set skip fix" This reverts commit 0c156a3c32cd0d9168570da5686ddc96abcbbc5a. This fix broke using ':network' in tables. MFC after: 1 week (cherry picked from commit d5b08e13dd6beb3436e181ff1f3e034cc8186584) --- sbin/pfctl/pfctl_parser.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 2efb97285798..7416ae26be48 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1392,26 +1392,6 @@ ifa_exists(char *ifa_name) return (NULL); } -static struct node_host * -if_lookup(char *if_name) -{ - struct node_host *p, *n; - - for (p = iftab; p; p = p->next) { - if (! strcmp(if_name, p->ifname)) { - n = calloc(1, sizeof(struct node_host)); - bcopy(p, n, sizeof(struct node_host)); - - n->next = NULL; - n->tail = n; - - return (n); - } - } - - return (NULL); -} - struct node_host * ifa_grouplookup(char *ifa_name, int flags) { @@ -1435,7 +1415,7 @@ ifa_grouplookup(char *ifa_name, int flags) for (ifg = ifgr.ifgr_groups; ifg && len >= sizeof(struct ifg_req); ifg++) { len -= sizeof(struct ifg_req); - if ((n = if_lookup(ifg->ifgrq_member)) == NULL) + if ((n = ifa_lookup(ifg->ifgrq_member, flags)) == NULL) continue; if (h == NULL) h = n; From owner-dev-commits-src-all@freebsd.org Tue May 4 12:02:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A35662FBDC; Tue, 4 May 2021 12:02:23 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZJPC2YCJz3CZk; Tue, 4 May 2021 12:02:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3C1B0113A9; Tue, 4 May 2021 12:02:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144C2N6X093231; Tue, 4 May 2021 12:02:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144C2MF7093230; Tue, 4 May 2021 12:02:22 GMT (envelope-from git) Date: Tue, 4 May 2021 12:02:22 GMT Message-Id: <202105041202.144C2MF7093230@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: dbe42afd0a95 - stable/12 - pf tests: Test using ':network' in tables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: dbe42afd0a95d943331c2552582df8c4b8a23222 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 12:02:23 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dbe42afd0a95d943331c2552582df8c4b8a23222 commit dbe42afd0a95d943331c2552582df8c4b8a23222 Author: Kristof Provost AuthorDate: 2021-04-25 10:18:48 +0000 Commit: Kristof Provost CommitDate: 2021-05-04 07:54:45 +0000 pf tests: Test using ':network' in tables MFC after: 1 week (cherry picked from commit daa5350d0e0c5fbe42c5a057dd37b9d22df91bb7) --- tests/sys/netpfil/pf/table.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh index 8aae4cf492c5..5826fab245d8 100644 --- a/tests/sys/netpfil/pf/table.sh +++ b/tests/sys/netpfil/pf/table.sh @@ -146,9 +146,41 @@ pr251414_cleanup() pft_cleanup } +atf_test_case "network" "cleanup" +network_head() +{ + atf_set descr 'Test :network' + atf_set require.user root +} + +network_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz \ + "table const { epair:network }"\ + "block in" \ + "pass in from " + + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 +} + +network_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4_counters" atf_add_test_case "v6_counters" atf_add_test_case "pr251414" + atf_add_test_case "network" } From owner-dev-commits-src-all@freebsd.org Tue May 4 12:02:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3CFC62FD4F; Tue, 4 May 2021 12:02:25 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZJPF50hxz3CFW; Tue, 4 May 2021 12:02:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9BAE111374; Tue, 4 May 2021 12:02:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144C2PJP093343; Tue, 4 May 2021 12:02:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144C2PRs093342; Tue, 4 May 2021 12:02:25 GMT (envelope-from git) Date: Tue, 4 May 2021 12:02:25 GMT Message-Id: <202105041202.144C2PRs093342@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 487633009f6f - stable/13 - pfctl: Revert "pfctl: Another set skip fix" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 487633009f6f1c819d947f53d903c7716f27d682 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 12:02:25 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=487633009f6f1c819d947f53d903c7716f27d682 commit 487633009f6f1c819d947f53d903c7716f27d682 Author: Kristof Provost AuthorDate: 2021-04-26 08:07:07 +0000 Commit: Kristof Provost CommitDate: 2021-05-04 07:50:34 +0000 pfctl: Revert "pfctl: Another set skip fix" This reverts commit 0c156a3c32cd0d9168570da5686ddc96abcbbc5a. This fix broke using ':network' in tables. MFC after: 1 week (cherry picked from commit d5b08e13dd6beb3436e181ff1f3e034cc8186584) --- sbin/pfctl/pfctl_parser.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 1fd26711ea86..47a3992da128 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1392,26 +1392,6 @@ ifa_exists(char *ifa_name) return (NULL); } -static struct node_host * -if_lookup(char *if_name) -{ - struct node_host *p, *n; - - for (p = iftab; p; p = p->next) { - if (! strcmp(if_name, p->ifname)) { - n = calloc(1, sizeof(struct node_host)); - bcopy(p, n, sizeof(struct node_host)); - - n->next = NULL; - n->tail = n; - - return (n); - } - } - - return (NULL); -} - struct node_host * ifa_grouplookup(char *ifa_name, int flags) { @@ -1435,7 +1415,7 @@ ifa_grouplookup(char *ifa_name, int flags) for (ifg = ifgr.ifgr_groups; ifg && len >= sizeof(struct ifg_req); ifg++) { len -= sizeof(struct ifg_req); - if ((n = if_lookup(ifg->ifgrq_member)) == NULL) + if ((n = ifa_lookup(ifg->ifgrq_member, flags)) == NULL) continue; if (h == NULL) h = n; From owner-dev-commits-src-all@freebsd.org Tue May 4 12:02:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0765C62FF80; Tue, 4 May 2021 12:02:27 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZJPG5p56z3CZy; Tue, 4 May 2021 12:02:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B6F5111582; Tue, 4 May 2021 12:02:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144C2QGa093364; Tue, 4 May 2021 12:02:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144C2QBa093363; Tue, 4 May 2021 12:02:26 GMT (envelope-from git) Date: Tue, 4 May 2021 12:02:26 GMT Message-Id: <202105041202.144C2QBa093363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: d6d039ea74a2 - stable/13 - pf tests: Test using ':network' in tables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d6d039ea74a26357173d1263682d4f5119037434 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 12:02:27 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d6d039ea74a26357173d1263682d4f5119037434 commit d6d039ea74a26357173d1263682d4f5119037434 Author: Kristof Provost AuthorDate: 2021-04-25 10:18:48 +0000 Commit: Kristof Provost CommitDate: 2021-05-04 07:51:25 +0000 pf tests: Test using ':network' in tables MFC after: 1 week (cherry picked from commit daa5350d0e0c5fbe42c5a057dd37b9d22df91bb7) --- tests/sys/netpfil/pf/table.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh index 9003f61ba189..516895ae1759 100644 --- a/tests/sys/netpfil/pf/table.sh +++ b/tests/sys/netpfil/pf/table.sh @@ -146,9 +146,41 @@ pr251414_cleanup() pft_cleanup } +atf_test_case "network" "cleanup" +network_head() +{ + atf_set descr 'Test :network' + atf_set require.user root +} + +network_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz \ + "table const { epair:network }"\ + "block in" \ + "pass in from " + + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 +} + +network_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4_counters" atf_add_test_case "v6_counters" atf_add_test_case "pr251414" + atf_add_test_case "network" } From owner-dev-commits-src-all@freebsd.org Tue May 4 12:03:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 450B262FF68; Tue, 4 May 2021 12:03:15 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZJQC1PnLz3Cpl; Tue, 4 May 2021 12:03:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 234131124E; Tue, 4 May 2021 12:03:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144C3FhK094359; Tue, 4 May 2021 12:03:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144C3FoB094358; Tue, 4 May 2021 12:03:15 GMT (envelope-from git) Date: Tue, 4 May 2021 12:03:15 GMT Message-Id: <202105041203.144C3FoB094358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 3657010266b2 - main - pci_vendors: update to 2021-05-04 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3657010266b235f6394aefbe755dc316bb2535b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 12:03:15 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=3657010266b235f6394aefbe755dc316bb2535b4 commit 3657010266b235f6394aefbe755dc316bb2535b4 Author: Baptiste Daroussin AuthorDate: 2021-05-04 12:02:41 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-04 12:03:07 +0000 pci_vendors: update to 2021-05-04 --- share/misc/pci_vendors | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors index 1a00db8f19dc..9deb7293e596 100644 --- a/share/misc/pci_vendors +++ b/share/misc/pci_vendors @@ -1,8 +1,8 @@ # # List of PCI ID's # -# Version: 2021.04.26 -# Date: 2021-04-26 03:15:02 +# Version: 2021.05.04 +# Date: 2021-05-04 03:15:01 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at https://pci-ids.ucw.cz/. @@ -12142,6 +12142,7 @@ 1e04 TU102 [GeForce RTX 2080 Ti] 1e07 TU102 [GeForce RTX 2080 Ti Rev. A] 1462 3715 RTX 2080 Ti GAMING X TRIO + 1e09 CMP 50HX 1e2d TU102 [GeForce RTX 2080 Ti Engineering Sample] 1e2e TU102 [GeForce RTX 2080 Ti 12GB Engineering Sample] 1e30 TU102GL [Quadro RTX 6000/8000] @@ -12257,6 +12258,7 @@ 10de 146d GA102 [GeForce RTX 3080 20GB] 1462 3892 RTX 3080 10GB GAMING X TRIO 2208 GA102 [GeForce RTX 3080 Ti] + 220d GA102 222b GA102 [GeForce RTX 3090 Engineering Sample] 222f GA102 [GeForce RTX 3080 11GB / 12GB Engineering Sample] 2230 GA102GL [RTX A6000] @@ -12281,13 +12283,15 @@ 24ad GA104 [GeForce RTX 3060 Engineering Sample] 24af GA104 [GeForce RTX 3070 Engineering Sample] 24b0 GA104GL [RTX A4000] - 24b6 GA104 - 24b8 GA104 + 24b6 GA104GLM [RTX A5000 Mobile] + 24b7 GA104GLM [RTX A4000 Mobile] + 24b8 GA104GLM [RTX A3000 Mobile] 24bf GA104 [GeForce RTX 3070 Engineering Sample] 24dc GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB] 24dd GA104M [GeForce RTX 3070 Mobile / Max-Q] 2501 GA106 [GeForce RTX 3060] 2503 GA106 [GeForce RTX 3060] + 2504 GA106 [GeForce RTX 3060 Lite Hash Rate] 2505 GA106 2520 GA106M [GeForce RTX 3060 Mobile / Max-Q] 252f GA106 [GeForce RTX 3060 Engineering Sample] @@ -12299,7 +12303,7 @@ 25a5 GA107M 25af GA107 [GeForce RTX 3050 Engineering Sample] 25b5 GA107GLM [RTX A4 Mobile] - 25b8 GA107GLM + 25b8 GA107GLM [RTX A2000 Mobile] 25e0 GA107BM 25e2 GA107BM 10df Emulex Corporation @@ -19324,8 +19328,12 @@ 1750 BCM57508 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb/200Gb Ethernet 14e4 2100 NetXtreme-E Dual-port 100G QSFP56 Ethernet PCIe4.0 x16 Adapter (BCM957508-P2100G) 14e4 5208 NetXtreme-E Dual-port 100G QSFP56 Ethernet OCP 3.0 Adapter (BCM957508-N2100G) + 14e4 d124 NetXtreme-E P2100D BCM57508 2x100G QSFP PCIE 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz Ethernet 1751 BCM57504 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb/200Gb Ethernet + 14e4 5045 NetXtreme-E BCM57504 4x25G OCP3.0 + 14e4 5250 NetXtreme-E BCM57504 4x25G KR Mezz + 14e4 d142 NetXtreme-E P425D BCM57504 4x25G SFP28 PCIE 1752 BCM57502 NetXtreme-E 10Gb/25Gb/40Gb/50Gb Ethernet 1800 BCM57502 NetXtreme-E Ethernet Partition 1801 BCM57504 NetXtreme-E Ethernet Partition @@ -23868,7 +23876,7 @@ 1eae XFX Limited 1eb1 VeriSilicon Inc 1001 Video Accelerator -1ebd Emerge Technologies Company Ltd. +1ebd EMERGETECH Company Ltd. 0101 Seirios 2063 Video Codec 1ed3 Yeston 1ed8 Digiteq Automotive @@ -26198,7 +26206,7 @@ 103c 2159 Ethernet 10Gb 2-port 562i Adapter 108e 7b11 Ethernet Server Adapter X520-2 1170 004c 82599 DP 10G Mezzanine Adapter - 15d9 0611 AOC-STGN-I2S [REV 1.01] + 15d9 0611 AOC-STGN-i2S 1734 11a9 10 Gigabit Dual Port Network Connection 17aa 1071 ThinkServer X520-2 AnyFabric 17aa 4007 82599ES 10-Gigabit SFI/SFP+ Network Connection @@ -26533,6 +26541,7 @@ 1093 775b PCIe-8237 Ethernet Adapter 10a9 802a UV2-BaseIO dual-port GbE 1137 023e 1GigE I350 LOM + 15d9 0000 AOC-SGP-i4 15d9 0652 Dual Port i350 GbE MicroLP [AOC-CGP-i2] 17aa 1074 ThinkServer I350-T4 AnyFabric 17aa 4005 I350 Gigabit Network Connection @@ -27383,6 +27392,7 @@ 15d9 066b X9SRL-F 1d2d C600/X79 series chipset USB2 Enhanced Host Controller #2 1028 04f7 C602J on PowerEdge R320 server + 103c 18a9 HP DL360e G8 15d9 066b X9SRL-F 1d33 C600/X79 series chipset LAN Controller 1d35 C600/X79 series chipset VECI Controller @@ -30469,7 +30479,7 @@ 31d9 Gemini Lake PCI Express Root Port 31da Gemini Lake PCI Express Root Port 31db Gemini Lake PCI Express Root Port - 31dc AC 1550i Wireless + 31dc Gemini Lake PCH CNVi WiFi 31e3 Celeron/Pentium Silver Processor SATA Controller 31e8 Celeron/Pentium Silver Processor LPC Controller 31ee Celeron/Pentium Silver Processor Serial IO UART Host Controller @@ -30570,7 +30580,7 @@ 34eb Ice Lake-LP Serial IO I2C Controller #3 34ed Ice Lake-LP USB 3.1 xHCI Host Controller 34ef Ice Lake-LP DRAM Controller - 34f0 Killer Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201NGW) + 34f0 Ice Lake-LP PCH CNVi WiFi 34f8 Ice Lake-LP SD Controller 34fc Ice Lake-LP Integrated Sensor Solution 3500 6311ESB/6321ESB PCI Express Upstream Port @@ -32145,6 +32155,7 @@ 9a60 TigerLake-H GT1 [UHD Graphics] 9a68 TigerLake-H GT1 [UHD Graphics] 9b41 CometLake-U GT2 [UHD Graphics] + 1028 09bd Latitude 7310 9b44 10th Gen Core Processor Host Bridge/DRAM Registers 9b53 Comet Lake-S 6c Host Bridge/DRAM Controller 9b54 10th Gen Core Processor Host Bridge/DRAM Registers @@ -32766,7 +32777,7 @@ a36d Cannon Lake PCH USB 3.1 xHCI Host Controller 1028 0869 Vostro 3470 a36f Cannon Lake PCH Shared SRAM - a370 Wireless-AC 9560 [Jefferson Peak] + a370 Cannon Lake PCH CNVi WiFi 1a56 1552 Killer(R) Wireless-AC 1550i Wireless Network Adapter (9560NGW) a379 Cannon Lake PCH Thermal Controller 1028 0869 Vostro 3470 From owner-dev-commits-src-all@freebsd.org Tue May 4 12:37:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BAE8631084; Tue, 4 May 2021 12:37:02 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZK9B0JM9z3F3g; Tue, 4 May 2021 12:37:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F17CE11B99; Tue, 4 May 2021 12:37:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144Cb1pE034589; Tue, 4 May 2021 12:37:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144Cb1Va034588; Tue, 4 May 2021 12:37:01 GMT (envelope-from git) Date: Tue, 4 May 2021 12:37:01 GMT Message-Id: <202105041237.144Cb1Va034588@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: ee384b229dc6 - main - linux(4): make linkat(2) handle AT_EMPTY_PATH MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee384b229dc62b2b0c9180db8c71fa99f30144cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 12:37:02 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=ee384b229dc62b2b0c9180db8c71fa99f30144cf commit ee384b229dc62b2b0c9180db8c71fa99f30144cf Author: Edward Tomasz Napierala AuthorDate: 2021-05-04 12:09:31 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-04 12:09:46 +0000 linux(4): make linkat(2) handle AT_EMPTY_PATH Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29974 --- sys/compat/linux/linux_file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 1febb11b0131..0549d536ba51 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -1134,11 +1134,12 @@ linux_linkat(struct thread *td, struct linux_linkat_args *args) char *path, *to; int error, olddfd, newdfd, flag; - if (args->flag & ~LINUX_AT_SYMLINK_FOLLOW) + if (args->flag & ~(LINUX_AT_SYMLINK_FOLLOW | LINUX_AT_EMPTY_PATH)) return (EINVAL); flag = (args->flag & LINUX_AT_SYMLINK_FOLLOW) == 0 ? AT_SYMLINK_FOLLOW : 0; + flag |= (args->flag & LINUX_AT_EMPTY_PATH) == 0 ? AT_EMPTY_PATH : 0; olddfd = (args->olddfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->olddfd; newdfd = (args->newdfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->newdfd; From owner-dev-commits-src-all@freebsd.org Tue May 4 12:57:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C01846312CB; Tue, 4 May 2021 12:57:37 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZKcx4ycVz3G4H; Tue, 4 May 2021 12:57:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9D08511F5E; Tue, 4 May 2021 12:57:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144CvbA1061526; Tue, 4 May 2021 12:57:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144Cvb8G061525; Tue, 4 May 2021 12:57:37 GMT (envelope-from git) Date: Tue, 4 May 2021 12:57:37 GMT Message-Id: <202105041257.144Cvb8G061525@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 8bde6d15d1fa - main - nfsclient: Copy only initialized fields in nfs_getattr() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8bde6d15d1fa9a947c2bdc5eddae36cfbb1076dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 12:57:37 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8bde6d15d1fa9a947c2bdc5eddae36cfbb1076dc commit 8bde6d15d1fa9a947c2bdc5eddae36cfbb1076dc Author: Mark Johnston AuthorDate: 2021-05-04 12:53:57 +0000 Commit: Mark Johnston CommitDate: 2021-05-04 12:53:57 +0000 nfsclient: Copy only initialized fields in nfs_getattr() When loading attributes from the cache, the NFS client is careful to copy only the fields that it initialized. After fetching attributes from the server, however, it would copy the entire vattr structure initialized from the RPC response, so uninitialized stack bytes would end up being copied to userspace. In particular, va_birthtime (v2 and v3) and va_gen (v3) had this problem. Use a common subroutine to copy fields provided by the NFS client, and ensure that we provide a dummy va_gen for the v3 case. Reviewed by: rmacklem Reported by: KMSAN MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30090 --- sys/fs/nfs/nfsport.h | 1 + sys/fs/nfsclient/nfs_clcomsubs.c | 1 + sys/fs/nfsclient/nfs_clport.c | 24 +++++++++++++++++++++++- sys/fs/nfsclient/nfs_clvnops.c | 19 ++----------------- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h index 6777dc72f6a3..cb82666ab397 100644 --- a/sys/fs/nfs/nfsport.h +++ b/sys/fs/nfs/nfsport.h @@ -1001,6 +1001,7 @@ int nfscl_loadattrcache(struct vnode **, struct nfsvattr *, void *, void *, int, int); int newnfs_realign(struct mbuf **, int); bool ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep); +void ncl_copy_vattr(struct vattr *dst, struct vattr *src); /* * If the port runs on an SMP box that can enforce Atomic ops with low diff --git a/sys/fs/nfsclient/nfs_clcomsubs.c b/sys/fs/nfsclient/nfs_clcomsubs.c index 6a36aed478d9..8a51d51f093f 100644 --- a/sys/fs/nfsclient/nfs_clcomsubs.c +++ b/sys/fs/nfsclient/nfs_clcomsubs.c @@ -285,6 +285,7 @@ nfsm_loadattr(struct nfsrv_descript *nd, struct nfsvattr *nap) fxdr_nfsv3time(&fp->fa3_ctime, &nap->na_ctime); fxdr_nfsv3time(&fp->fa3_mtime, &nap->na_mtime); nap->na_flags = 0; + nap->na_gen = 0; nap->na_filerev = 0; } else { NFSM_DISSECT(fp, struct nfs_fattr *, NFSX_V2FATTR); diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index 81a0e05c3234..64820cd11f1c 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -400,6 +400,28 @@ nfscl_warn_fileid(struct nfsmount *nmp, struct nfsvattr *oldnap, ncl_fileid_maxwarnings); } +void +ncl_copy_vattr(struct vattr *dst, struct vattr *src) +{ + dst->va_type = src->va_type; + dst->va_mode = src->va_mode; + dst->va_nlink = src->va_nlink; + dst->va_uid = src->va_uid; + dst->va_gid = src->va_gid; + dst->va_fsid = src->va_fsid; + dst->va_fileid = src->va_fileid; + dst->va_size = src->va_size; + dst->va_blocksize = src->va_blocksize; + dst->va_atime = src->va_atime; + dst->va_mtime = src->va_mtime; + dst->va_ctime = src->va_ctime; + dst->va_gen = src->va_gen; + dst->va_flags = src->va_flags; + dst->va_rdev = src->va_rdev; + dst->va_bytes = src->va_bytes; + dst->va_filerev = src->va_filerev; +} + /* * Load the attribute cache (that lives in the nfsnode entry) with * the attributes of the second argument and @@ -551,7 +573,7 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvattr *nap, void *nvaper, KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); } if (vaper != NULL) { - NFSBCOPY((caddr_t)vap, (caddr_t)vaper, sizeof(*vap)); + ncl_copy_vattr(vaper, vap); if (np->n_flag & NCHG) { if (np->n_flag & NACC) vaper->va_atime = np->n_atim; diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 217290b080b3..5f81bb5b42a4 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -962,23 +962,8 @@ nfs_getattr(struct vop_getattr_args *ap) * First look in the cache. */ if (ncl_getattrcache(vp, &vattr) == 0) { - vap->va_type = vattr.va_type; - vap->va_mode = vattr.va_mode; - vap->va_nlink = vattr.va_nlink; - vap->va_uid = vattr.va_uid; - vap->va_gid = vattr.va_gid; - vap->va_fsid = vattr.va_fsid; - vap->va_fileid = vattr.va_fileid; - vap->va_size = vattr.va_size; - vap->va_blocksize = vattr.va_blocksize; - vap->va_atime = vattr.va_atime; - vap->va_mtime = vattr.va_mtime; - vap->va_ctime = vattr.va_ctime; - vap->va_gen = vattr.va_gen; - vap->va_flags = vattr.va_flags; - vap->va_rdev = vattr.va_rdev; - vap->va_bytes = vattr.va_bytes; - vap->va_filerev = vattr.va_filerev; + ncl_copy_vattr(vap, &vattr); + /* * Get the local modify time for the case of a write * delegation. From owner-dev-commits-src-all@freebsd.org Tue May 4 12:57:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF52D631601; Tue, 4 May 2021 12:57:38 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZKcy6Kfwz3FtM; Tue, 4 May 2021 12:57:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C99F21201F; Tue, 4 May 2021 12:57:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144CvcOM061547; Tue, 4 May 2021 12:57:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144CvcWi061546; Tue, 4 May 2021 12:57:38 GMT (envelope-from git) Date: Tue, 4 May 2021 12:57:38 GMT Message-Id: <202105041257.144CvcWi061546@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b59851e99c20 - main - path_test: Add a few new test cases MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b59851e99c20f3a72c34bdf9919e3bf49b894e4e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 12:57:39 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b59851e99c20f3a72c34bdf9919e3bf49b894e4e commit b59851e99c20f3a72c34bdf9919e3bf49b894e4e Author: Mark Johnston AuthorDate: 2021-05-04 12:56:31 +0000 Commit: Mark Johnston CommitDate: 2021-05-04 12:56:31 +0000 path_test: Add a few new test cases MFC after: 1 week Sponsored by: The FreeBSD Foundation --- tests/sys/file/path_test.c | 100 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/tests/sys/file/path_test.c b/tests/sys/file/path_test.c index a8354f88b091..e1f5240374c4 100644 --- a/tests/sys/file/path_test.c +++ b/tests/sys/file/path_test.c @@ -38,10 +38,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include @@ -49,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -205,6 +208,47 @@ ATF_TC_BODY(path_capsicum, tc) waitchild(child, 4); } +/* Make sure that ptrace(PT_COREDUMP) cannot be used to write to a path fd. */ +ATF_TC_WITHOUT_HEAD(path_coredump); +ATF_TC_BODY(path_coredump, tc) +{ + char path[PATH_MAX]; + struct ptrace_coredump pc; + int error, pathfd, status; + pid_t child; + + mktdir(path, "path_coredump.XXXXXX"); + + child = fork(); + ATF_REQUIRE_MSG(child != -1, FMT_ERR("fork")); + if (child == 0) { + while (true) + (void)sleep(1); + } + + pathfd = open(path, O_PATH); + ATF_REQUIRE_MSG(pathfd >= 0, FMT_ERR("open")); + + error = ptrace(PT_ATTACH, child, 0, 0); + ATF_REQUIRE_MSG(error == 0, FMT_ERR("ptrace")); + error = waitpid(child, &status, 0); + ATF_REQUIRE_MSG(error != -1, FMT_ERR("waitpid")); + ATF_REQUIRE_MSG(WIFSTOPPED(status), "unexpected status %d", status); + + pc.pc_fd = pathfd; + pc.pc_flags = 0; + pc.pc_limit = 0; + error = ptrace(PT_COREDUMP, child, (void *)&pc, sizeof(pc)); + ATF_REQUIRE_ERRNO(EBADF, error == -1); + + error = ptrace(PT_DETACH, child, 0, 0); + ATF_REQUIRE_MSG(error == 0, FMT_ERR("ptrace")); + + ATF_REQUIRE_MSG(kill(child, SIGKILL) == 0, FMT_ERR("kill")); + + CHECKED_CLOSE(pathfd); +} + /* Verify operations on directory path descriptors. */ ATF_TC_WITHOUT_HEAD(path_directory); ATF_TC_BODY(path_directory, tc) @@ -506,6 +550,33 @@ ATF_TC_BODY(path_fexecve, tc) ATF_REQUIRE_ERRNO(EACCES, pathfd < 0); } +/* Make sure that O_PATH restrictions apply to named pipes as well. */ +ATF_TC_WITHOUT_HEAD(path_fifo); +ATF_TC_BODY(path_fifo, tc) +{ + char path[PATH_MAX], buf[BUFSIZ]; + struct kevent ev; + int kq, pathfd; + + snprintf(path, sizeof(path), "path_fifo.XXXXXX"); + ATF_REQUIRE_MSG(mktemp(path) == path, FMT_ERR("mktemp")); + + ATF_REQUIRE_MSG(mkfifo(path, 0666) == 0, FMT_ERR("mkfifo")); + + pathfd = open(path, O_PATH); + ATF_REQUIRE_MSG(pathfd >= 0, FMT_ERR("open")); + memset(buf, 0, sizeof(buf)); + ATF_REQUIRE_ERRNO(EBADF, write(pathfd, buf, sizeof(buf))); + ATF_REQUIRE_ERRNO(EBADF, read(pathfd, buf, sizeof(buf))); + + kq = kqueue(); + ATF_REQUIRE_MSG(kq >= 0, FMT_ERR("kqueue")); + EV_SET(&ev, pathfd, EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, 0); + ATF_REQUIRE_ERRNO(EBADF, kevent(kq, &ev, 1, NULL, 0, NULL) == -1); + + CHECKED_CLOSE(pathfd); +} + /* Files may be unlinked using a path fd. */ ATF_TC_WITHOUT_HEAD(path_funlinkat); ATF_TC_BODY(path_funlinkat, tc) @@ -755,11 +826,38 @@ ATF_TC_BODY(path_rights, tc) CHECKED_CLOSE(sd[1]); } +/* Verify that a local socket can't be opened with O_PATH. */ +ATF_TC_WITHOUT_HEAD(path_unix); +ATF_TC_BODY(path_unix, tc) +{ + char path[PATH_MAX]; + struct sockaddr_un sun; + int pathfd, sd; + + snprintf(path, sizeof(path), "path_unix.XXXXXX"); + ATF_REQUIRE_MSG(mktemp(path) == path, FMT_ERR("mktemp")); + + sd = socket(PF_LOCAL, SOCK_STREAM, 0); + ATF_REQUIRE_MSG(sd >= 0, FMT_ERR("socket")); + + memset(&sun, 0, sizeof(sun)); + sun.sun_family = PF_LOCAL; + (void)strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + ATF_REQUIRE_MSG(bind(sd, (struct sockaddr *)&sun, SUN_LEN(&sun)) == 0, + FMT_ERR("bind")); + + pathfd = open(path, O_RDONLY); + ATF_REQUIRE_ERRNO(EOPNOTSUPP, pathfd < 0); + + CHECKED_CLOSE(sd); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, path_access); ATF_TP_ADD_TC(tp, path_aio); ATF_TP_ADD_TC(tp, path_capsicum); + ATF_TP_ADD_TC(tp, path_coredump); ATF_TP_ADD_TC(tp, path_directory); ATF_TP_ADD_TC(tp, path_directory_not_root); ATF_TP_ADD_TC(tp, path_empty); @@ -768,11 +866,13 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, path_event); ATF_TP_ADD_TC(tp, path_fcntl); ATF_TP_ADD_TC(tp, path_fexecve); + ATF_TP_ADD_TC(tp, path_fifo); ATF_TP_ADD_TC(tp, path_funlinkat); ATF_TP_ADD_TC(tp, path_io); ATF_TP_ADD_TC(tp, path_ioctl); ATF_TP_ADD_TC(tp, path_lock); ATF_TP_ADD_TC(tp, path_rights); + ATF_TP_ADD_TC(tp, path_unix); return (atf_no_error()); } From owner-dev-commits-src-all@freebsd.org Tue May 4 14:21:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5097963365A; Tue, 4 May 2021 14:21:20 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZMTX1sp8z3Ksh; Tue, 4 May 2021 14:21:20 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3332813387; Tue, 4 May 2021 14:21:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144ELKNC076333; Tue, 4 May 2021 14:21:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144ELKUq076332; Tue, 4 May 2021 14:21:20 GMT (envelope-from git) Date: Tue, 4 May 2021 14:21:20 GMT Message-Id: <202105041421.144ELKUq076332@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 023bff799098 - main - linux(4): fix ptrace(2) to properly handle orig_rax MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 023bff799098cac28732f2800c967f0248d2eb47 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 14:21:20 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=023bff799098cac28732f2800c967f0248d2eb47 commit 023bff799098cac28732f2800c967f0248d2eb47 Author: Edward Tomasz Napierala AuthorDate: 2021-05-04 13:11:01 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-04 14:21:06 +0000 linux(4): fix ptrace(2) to properly handle orig_rax This fixes strace(1) erroneously reporting return values as "Function not implemented", combined with reporting the binary ABI as X32. Very similar code in linux_ptrace_getregs() is left as it is - it's probably wrong too, but I don't have a way to test it. Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29927 --- sys/amd64/linux/linux_ptrace.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index 76ad9b1e25c4..43ecd8892e0f 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -506,18 +506,18 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid_t pid, l_ulong data) } if (lwpinfo.pl_flags & PL_FLAG_SCE) { /* - * The strace(1) utility depends on RAX being set to -ENOSYS - * on syscall entry; otherwise it loops printing those: - * - * [ Process PID=928 runs in 64 bit mode. ] - * [ Process PID=928 runs in x32 mode. ] + * Undo the mangling done in exception.S:fast_syscall_common(). */ - l_regset.rax = -38; /* -ENOSYS */ + l_regset.r10 = l_regset.rcx; + } + if (lwpinfo.pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX)) { /* - * Undo the mangling done in exception.S:fast_syscall_common(). + * In Linux, the syscall number - passed to the syscall + * as rax - is preserved in orig_rax; rax gets overwritten + * with syscall return value. */ - l_regset.r10 = l_regset.rcx; + l_regset.orig_rax = lwpinfo.pl_syscall_code; } len = MIN(iov.iov_len, sizeof(l_regset)); From owner-dev-commits-src-all@freebsd.org Tue May 4 14:23:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 957B66338D4; Tue, 4 May 2021 14:23:16 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZMWm3tzsz3LRG; Tue, 4 May 2021 14:23:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 787FF12DF2; Tue, 4 May 2021 14:23:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144ENG1U080706; Tue, 4 May 2021 14:23:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144ENGD6080705; Tue, 4 May 2021 14:23:16 GMT (envelope-from git) Date: Tue, 4 May 2021 14:23:16 GMT Message-Id: <202105041423.144ENGD6080705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 1bffa4416607 - main - ptrace: document ENOMEM MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1bffa441660770a03fb287124c1ac84ec8b8677a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 14:23:16 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=1bffa441660770a03fb287124c1ac84ec8b8677a commit 1bffa441660770a03fb287124c1ac84ec8b8677a Author: Edward Tomasz Napierala AuthorDate: 2021-05-04 14:22:36 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-04 14:22:42 +0000 ptrace: document ENOMEM Reviewed By: emaste, markj Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29960 --- lib/libc/sys/ptrace.2 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2 index 6148e6d333d5..0135db98dc97 100644 --- a/lib/libc/sys/ptrace.2 +++ b/lib/libc/sys/ptrace.2 @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd April 10, 2021 +.Dd May 4, 2021 .Dt PTRACE 2 .Os .Sh NAME @@ -1211,6 +1211,17 @@ above. previously returned the last entry of the memory map. No more entries exist. .El +.It Bq Er ENOMEM +.Bl -bullet -compact +.It +A +.Dv PT_READ_I, +.Dv PT_READ_D, +.Dv PT_WRITE_I, or +.Dv PT_WRITE_D +request attempted to access an invalid address, or a memory allocation failure +occurred when accessing process memory. +.El .It Bq Er ENAMETOOLONG .Bl -bullet -compact .It From owner-dev-commits-src-all@freebsd.org Tue May 4 16:43:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07B985F8F9E; Tue, 4 May 2021 16:43:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZQds6slVz3l3h; Tue, 4 May 2021 16:43:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DE78014DC7; Tue, 4 May 2021 16:43:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144Ghjjw066718; Tue, 4 May 2021 16:43:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144GhjTM066717; Tue, 4 May 2021 16:43:45 GMT (envelope-from git) Date: Tue, 4 May 2021 16:43:45 GMT Message-Id: <202105041643.144GhjTM066717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: b621fbb1bf1b - main - sctp: drop packet with SHUTDOWN-ACK chunks with wrong vtags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b621fbb1bf1b2a1e6ea22e0ad2d7667b1aec9fae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 16:43:46 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=b621fbb1bf1b2a1e6ea22e0ad2d7667b1aec9fae commit b621fbb1bf1b2a1e6ea22e0ad2d7667b1aec9fae Author: Michael Tuexen AuthorDate: 2021-05-04 16:42:31 +0000 Commit: Michael Tuexen CommitDate: 2021-05-04 16:43:31 +0000 sctp: drop packet with SHUTDOWN-ACK chunks with wrong vtags MFC after: 3 days --- sys/netinet/sctp_input.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index b6fe6449bc21..e1f096ea5817 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -4502,27 +4502,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, } return (NULL); } - } else if (ch->chunk_type == SCTP_SHUTDOWN_ACK) { - if (vtag_in != asoc->my_vtag) { - /* - * this could be a stale SHUTDOWN-ACK or the - * peer never got the SHUTDOWN-COMPLETE and - * is still hung; we have started a new asoc - * but it won't complete until the shutdown - * is completed - */ - if (stcb != NULL) { - SCTP_TCB_UNLOCK(stcb); - } - SCTP_SNPRINTF(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); - op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), - msg); - sctp_handle_ootb(m, iphlen, *offset, src, dst, - sh, inp, op_err, - mflowtype, mflowid, fibnum, - vrf_id, port); - return (NULL); - } } else { /* for all other chunks, vtag must match */ if (vtag_in != asoc->my_vtag) { From owner-dev-commits-src-all@freebsd.org Tue May 4 20:07:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 089C7621694; Tue, 4 May 2021 20:07:47 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZW9G6wLdz4SB4; Tue, 4 May 2021 20:07:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E07F917476; Tue, 4 May 2021 20:07:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144K7ksk037869; Tue, 4 May 2021 20:07:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144K7ku0037868; Tue, 4 May 2021 20:07:46 GMT (envelope-from git) Date: Tue, 4 May 2021 20:07:46 GMT Message-Id: <202105042007.144K7ku0037868@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 36be84b96699 - main - ttys: diff reduction MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36be84b96699310e0020e194f81fe8e4a6c3f787 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 20:07:47 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=36be84b96699310e0020e194f81fe8e4a6c3f787 commit 36be84b96699310e0020e194f81fe8e4a6c3f787 Author: Warner Losh AuthorDate: 2021-05-04 19:49:27 +0000 Commit: Warner Losh CommitDate: 2021-05-04 20:06:31 +0000 ttys: diff reduction Back in the day, we used to have a number of entries that were either 'on' or 'off' directly, rather than conditionally on 'onifexists' etc. Back then, we tried to line up the 'secure' columns by using the construct 'on secure' or 'off secure' (one space or two). Now that these have all moved to a conditional construct, remove the second space on the ttys that still have it. This reduces diffs between the different ttys and is no functional change. i386 and amd64 did this a long time ago, and those are the only ones that affected external users (who used to sed 's/on /off /' the entires as part of the automation). MFC After: 3 days Sponsored by: Netflix --- sbin/init/ttys.aarch64 | 8 ++++---- sbin/init/ttys.arm | 8 ++++---- sbin/init/ttys.riscv | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sbin/init/ttys.aarch64 b/sbin/init/ttys.aarch64 index 7412f97fee0b..8a2376e799a1 100644 --- a/sbin/init/ttys.aarch64 +++ b/sbin/init/ttys.aarch64 @@ -41,9 +41,9 @@ ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure #ttyv8 "/usr/local/bin/xdm -nodaemon" xterm onifexists secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure # Dumb console dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/sbin/init/ttys.arm b/sbin/init/ttys.arm index 8bbb4883fbd6..b0722e4522dd 100644 --- a/sbin/init/ttys.arm +++ b/sbin/init/ttys.arm @@ -41,9 +41,9 @@ ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure #ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure # Dumb console dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/sbin/init/ttys.riscv b/sbin/init/ttys.riscv index f2c91229bed2..4e49b7a83bd8 100644 --- a/sbin/init/ttys.riscv +++ b/sbin/init/ttys.riscv @@ -41,11 +41,11 @@ ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure #ttyv8 "/usr/local/bin/xdm -nodaemon" xterm onifexists secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure # Dumb console dcons "/usr/libexec/getty std.9600" vt100 off secure # RISC-V HTIF console -rcons "/usr/libexec/getty std.9600" vt100 onifconsole secure +rcons "/usr/libexec/getty std.9600" vt100 onifconsole secure From owner-dev-commits-src-all@freebsd.org Tue May 4 20:17:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F67B62167D for ; Tue, 4 May 2021 20:17:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZWMy72wyz4SJk; Tue, 4 May 2021 20:17:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E54A317E97; Tue, 4 May 2021 20:17:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144KH2Q8051337; Tue, 4 May 2021 20:17:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144KH2Xv051336; Tue, 4 May 2021 20:17:02 GMT (envelope-from git) Date: Tue, 4 May 2021 20:17:02 GMT Message-Id: <202105042017.144KH2Xv051336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: f5bcb8fb4e73 - internal/admin - Safekeep src bit of sbruno@ Approved by: core MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: f5bcb8fb4e73fb58e0dab0298b375b5b8b4fecd0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 20:17:03 -0000 The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f5bcb8fb4e73fb58e0dab0298b375b5b8b4fecd0 commit f5bcb8fb4e73fb58e0dab0298b375b5b8b4fecd0 Author: Muhammad Moinur Rahman AuthorDate: 2021-05-04 20:16:27 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-05-04 20:16:27 +0000 Safekeep src bit of sbruno@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 1dd27a968833..0325f69f7fc1 100644 --- a/access +++ b/access @@ -177,7 +177,6 @@ rscheff rstone rwatson bb+lists.freebsd.cvs-committers@cyrus.watson.org sam -sbruno schweikh scottl scottph From owner-dev-commits-src-all@freebsd.org Tue May 4 20:19:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF7CB621B47; Tue, 4 May 2021 20:19:28 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZWQm4bR2z4SK7; Tue, 4 May 2021 20:19:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 90A1317A7B; Tue, 4 May 2021 20:19:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144KJSNt051830; Tue, 4 May 2021 20:19:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144KJS9E051829; Tue, 4 May 2021 20:19:28 GMT (envelope-from git) Date: Tue, 4 May 2021 20:19:28 GMT Message-Id: <202105042019.144KJS9E051829@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: b1bd44732d83 - main - netgraph/ng_bridge: learn MACs via control message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1bd44732d8332930dc6a17092f47a201caff1ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 20:19:28 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=b1bd44732d8332930dc6a17092f47a201caff1ef commit b1bd44732d8332930dc6a17092f47a201caff1ef Author: Lutz Donnerhacke AuthorDate: 2021-05-04 20:14:59 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-04 20:14:59 +0000 netgraph/ng_bridge: learn MACs via control message Add a new control message to move ethernet addresses to a given link in ng_bridge(4). Send this message instead of doing the work directly. This decouples the read-only activity from the modification under a more strict writer lock. Decoupling the work is a prerequisite for multithreaded operation. Approved by: manpages (bcr), kp (earlier version) MFC: 3 weeks Differential Revision: https://reviews.freebsd.org/D28516 --- share/man/man4/ng_bridge.4 | 21 +++++++++++++- sys/netgraph/ng_bridge.c | 69 ++++++++++++++++++++++++++++++++++++++++------ sys/netgraph/ng_bridge.h | 11 ++++++++ 3 files changed, 91 insertions(+), 10 deletions(-) diff --git a/share/man/man4/ng_bridge.4 b/share/man/man4/ng_bridge.4 index be128d62c938..216dea3c392a 100644 --- a/share/man/man4/ng_bridge.4 +++ b/share/man/man4/ng_bridge.4 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 6, 2021 +.Dd February 17, 2021 .Dt NG_BRIDGE 4 .Os .Sh NAME @@ -214,6 +214,25 @@ Returns the current host mapping table used to direct packets, in a .Vt "struct ng_bridge_host_ary" . .It Dv NGM_BRIDGE_SET_PERSISTENT Pq Ar setpersistent This command sets the persistent flag on the node, and takes no arguments. +.It Dv NGM_BRIDGE_MOVE_HOST Pq Ar movehost +This command takes a +.Vt "struct ng_bridge_move_host" +as an argument. +It assigns the MAC +.Va addr +to the +.Va hook , +which must not be assigned yet. +If the +.Va hook +is the empty string, the incoming hook of the control message is +used as fallback. +.Bd -literal -offset 0n +struct ng_bridge_move_host { + u_char addr[ETHER_ADDR_LEN]; /* ethernet address */ + char hook[NG_HOOKSIZ]; /* link where addr can be found */ +}; +.Ed .El .Sh SHUTDOWN This node shuts down upon receipt of a diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c index 7b03b1a2599b..915a18550cba 100644 --- a/sys/netgraph/ng_bridge.c +++ b/sys/netgraph/ng_bridge.c @@ -234,6 +234,13 @@ static const struct ng_parse_type ng_bridge_stats_type = { &ng_parse_struct_type, &ng_bridge_stats_type_fields }; +/* Parse type for struct ng_bridge_move_host */ +static const struct ng_parse_struct_field ng_bridge_move_host_type_fields[] + = NG_BRIDGE_MOVE_HOST_TYPE_INFO(&ng_parse_enaddr_type); +static const struct ng_parse_type ng_bridge_move_host_type = { + &ng_parse_struct_type, + &ng_bridge_move_host_type_fields +}; /* List of commands and how to convert arguments to/from ASCII */ static const struct ng_cmdlist ng_bridge_cmdlist[] = { @@ -293,6 +300,13 @@ static const struct ng_cmdlist ng_bridge_cmdlist[] = { NULL, NULL }, + { + NGM_BRIDGE_COOKIE, + NGM_BRIDGE_MOVE_HOST, + "movehost", + &ng_bridge_move_host_type, + NULL + }, { 0 } }; @@ -601,6 +615,32 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p lasthook) priv->persistent = 1; break; } + case NGM_BRIDGE_MOVE_HOST: + { + struct ng_bridge_move_host *mh; + hook_p hook; + struct ng_bridge_host *host; + + if (msg->header.arglen < sizeof(*mh)) { + error = EINVAL; + break; + } + mh = (struct ng_bridge_move_host *)msg->data; + hook = (mh->hook[0] == 0) + ? lasthook + : ng_findhook(node, mh->hook); + if (hook == NULL) { + error = ENOENT; + break; + } + host = ng_bridge_get(priv, mh->addr); + if (host != NULL) { + error = EADDRINUSE; + break; + } + error = ng_bridge_put(priv, mh->addr, NG_HOOK_PRIVATE(hook)); + break; + } default: error = EINVAL; break; @@ -809,12 +849,26 @@ ng_bridge_rcvdata(hook_p hook, item_p item) host->age = 0; } } else if (ctx.incoming->learnMac) { - if (!ng_bridge_put(priv, eh->ether_shost, ctx.incoming)) { + struct ng_mesg *msg; + struct ng_bridge_move_host *mh; + int error = 0; + + NG_MKMESSAGE(msg, NGM_BRIDGE_COOKIE, NGM_BRIDGE_MOVE_HOST, + sizeof(*mh), M_NOWAIT); + if (msg == NULL) { counter_u64_add(ctx.incoming->stats.memoryFailures, 1); NG_FREE_ITEM(item); NG_FREE_M(ctx.m); return (ENOMEM); } + mh = (struct ng_bridge_move_host *)msg->data; + strncpy(mh->hook, NG_HOOK_NAME(ctx.incoming->hook), + sizeof(mh->hook)); + memcpy(mh->addr, eh->ether_shost, sizeof(mh->addr)); + NG_SEND_MSG_ID(error, node, msg, NG_NODE_ID(node), + NG_NODE_ID(node)); + if (error) + counter_u64_add(ctx.incoming->stats.memoryFailures, 1); } /* Run packet through ipfw processing, if enabled */ @@ -959,8 +1013,7 @@ ng_bridge_get(priv_cp priv, const u_char *addr) /* * Add a new host entry to the table. This assumes the host doesn't - * already exist in the table. Returns 1 on success, 0 if there - * was a memory allocation failure. + * already exist in the table. Returns 0 on success. */ static int ng_bridge_put(priv_p priv, const u_char *addr, link_p link) @@ -970,16 +1023,14 @@ ng_bridge_put(priv_p priv, const u_char *addr, link_p link) #ifdef INVARIANTS /* Assert that entry does not already exist in hashtable */ - SLIST_FOREACH(host, &priv->tab[bucket], next) { - KASSERT(!ETHER_EQUAL(host->addr, addr), - ("%s: entry %6D exists in table", __func__, addr, ":")); - } + KASSERT(ng_bridge_get(priv, addr) == NULL, + ("%s: entry %6D exists in table", __func__, addr, ":")); #endif /* Allocate and initialize new hashtable entry */ host = malloc(sizeof(*host), M_NETGRAPH_BRIDGE, M_NOWAIT); if (host == NULL) - return (0); + return (ENOMEM); bcopy(addr, host->addr, ETHER_ADDR_LEN); host->link = link; host->staleness = 0; @@ -991,7 +1042,7 @@ ng_bridge_put(priv_p priv, const u_char *addr, link_p link) /* Resize table if necessary */ ng_bridge_rehash(priv); - return (1); + return (0); } /* diff --git a/sys/netgraph/ng_bridge.h b/sys/netgraph/ng_bridge.h index 03541deceacd..12717d16ac7a 100644 --- a/sys/netgraph/ng_bridge.h +++ b/sys/netgraph/ng_bridge.h @@ -140,6 +140,16 @@ struct ng_bridge_host_ary { { NULL } \ } +struct ng_bridge_move_host { + u_char addr[ETHER_ADDR_LEN]; /* ethernet address */ + char hook[NG_HOOKSIZ]; /* link where addr can be found */ +}; +/* Keep this in sync with the above structure definition */ +#define NG_BRIDGE_MOVE_HOST_TYPE_INFO(entype) { \ + { "addr", (entype) }, \ + { "hook", &ng_parse_hookbuf_type }, \ +} + /* Netgraph control messages */ enum { NGM_BRIDGE_SET_CONFIG = 1, /* set node configuration */ @@ -150,6 +160,7 @@ enum { NGM_BRIDGE_GETCLR_STATS, /* atomically get & clear link stats */ NGM_BRIDGE_GET_TABLE, /* get link table */ NGM_BRIDGE_SET_PERSISTENT, /* set persistent mode */ + NGM_BRIDGE_MOVE_HOST, /* move a host to a link */ }; #endif /* _NETGRAPH_NG_BRIDGE_H_ */ From owner-dev-commits-src-all@freebsd.org Tue May 4 21:08:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42BF86235A9; Tue, 4 May 2021 21:08:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZXWf1PqWz4Vw7; Tue, 4 May 2021 21:08:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 23A3B1877F; Tue, 4 May 2021 21:08:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144L8kjW019593; Tue, 4 May 2021 21:08:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144L8kSE019592; Tue, 4 May 2021 21:08:46 GMT (envelope-from git) Date: Tue, 4 May 2021 21:08:46 GMT Message-Id: <202105042108.144L8kSE019592@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 15c0aaf51703 - main - Cirrus-CI: switch to Clang/LLVM 12 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 15c0aaf51703cc102940aa647d623ec8ffbe9259 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 21:08:46 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=15c0aaf51703cc102940aa647d623ec8ffbe9259 commit 15c0aaf51703cc102940aa647d623ec8ffbe9259 Author: Ed Maste AuthorDate: 2021-05-04 19:22:25 +0000 Commit: Ed Maste CommitDate: 2021-05-04 21:07:11 +0000 Cirrus-CI: switch to Clang/LLVM 12 dim@ is preparing to import Clang/LLVM 12 into the base system as the system compiler / toolchain. Apply the same change to the Cirrus-CI config. Reviewed by: imp, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30109 --- .cirrus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index b29dddc34849..33f51a0a5024 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -13,7 +13,7 @@ env: task: timeout_in: 120m install_script: - - pkg install -y llvm11 + - pkg install -y llvm12 setup_script: - uname -a - df -m @@ -21,7 +21,7 @@ task: - mkdir -p /usr/obj/$(pwd -P) - chown user:user /usr/obj/$(pwd -P) script: - - su user -c "make -j$(sysctl -n hw.ncpu) CROSS_TOOLCHAIN=llvm11 WITHOUT_TOOLCHAIN=yes buildworld buildkernel" + - su user -c "make -j$(sysctl -n hw.ncpu) CROSS_TOOLCHAIN=llvm12 WITHOUT_TOOLCHAIN=yes buildworld buildkernel" post_script: - df -m - du -m -s /usr/obj From owner-dev-commits-src-all@freebsd.org Tue May 4 21:14:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 765DE623B87 for ; Tue, 4 May 2021 21:14:45 +0000 (UTC) (envelope-from johnpannos@gmail.com) Received: from slot0.mino.monster (slot0.mino.monster [91.235.116.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZXfY0C01z4WRk for ; Tue, 4 May 2021 21:14:44 +0000 (UTC) (envelope-from johnpannos@gmail.com) Reply-To: jamenicholas9@gmail.com From: jamenicholas9@gmail.com To: dev-commits-src-all@freebsd.org Subject: Financial Capital Date: 4 May 2021 14:04:18 -0700 Message-ID: <20210504140418.414914ED9387C3FF@gmail.com> X-Rspamd-Queue-Id: 4FZXfY0C01z4WRk X-Spamd-Bar: +++++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 91.235.116.200 is neither permitted nor denied by domain of johnpannos@gmail.com) smtp.mailfrom=johnpannos@gmail.com X-Spamd-Result: default: False [7.10 / 15.00]; HAS_REPLYTO(0.00)[jamenicholas9@gmail.com]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; FORGED_SENDER(0.30)[jamenicholas9@gmail.com,johnpannos@gmail.com]; RCVD_COUNT_ZERO(0.00)[0]; MIME_TRACE(0.00)[0:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RBL_DBL_DONT_QUERY_IPS(0.00)[91.235.116.200:from]; R_DKIM_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jamenicholas9@gmail.com,johnpannos@gmail.com]; ASN(0.00)[asn:51177, ipnet:91.235.116.0/24, country:RO]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FREEMAIL_REPLYTO(0.00)[gmail.com]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[91.235.116.200:from:127.0.2.255]; VIOLATED_DIRECT_SPF(3.50)[]; NEURAL_SPAM_LONG(1.00)[1.000]; FROM_NO_DN(0.00)[]; MIME_HTML_ONLY(0.20)[]; NEURAL_SPAM_SHORT(1.00)[1.000]; GREYLIST(0.00)[pass,body]; MAILMAN_DEST(0.00)[dev-commits-src-all]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-Spam: Yes MIME-Version: 1.0 Content-Type: text/plain X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 21:14:45 -0000 From owner-dev-commits-src-all@freebsd.org Tue May 4 21:43:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5616E6247C5; Tue, 4 May 2021 21:43:07 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZYHH23Ftz4Xry; Tue, 4 May 2021 21:43:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3957219382; Tue, 4 May 2021 21:43:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144Lh7hC072617; Tue, 4 May 2021 21:43:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144Lh7u9072616; Tue, 4 May 2021 21:43:07 GMT (envelope-from git) Date: Tue, 4 May 2021 21:43:07 GMT Message-Id: <202105042143.144Lh7u9072616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 3fd9848f1593 - stable/13 - [rtsock] Enforce netmask/RTF_HOST consistency. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3fd9848f15930d5ddde4375e540045cc4dc214d6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 21:43:07 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=3fd9848f15930d5ddde4375e540045cc4dc214d6 commit 3fd9848f15930d5ddde4375e540045cc4dc214d6 Author: Alexander V. Chernikov AuthorDate: 2021-04-23 21:53:47 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-05-04 21:29:36 +0000 [rtsock] Enforce netmask/RTF_HOST consistency. Traditionally we had 2 sources of information whether the added/delete route request targets network or a host route: netmask (RTA_NETMASK) and RTF_HOST flag. The former one is tricky: netmask can be empty or can explicitly specify the host netmask. Parsing netmask sockaddr requires per-family parsing and that's what rtsock code traditionally avoided. As a result, consistency was not enforced and it was possible to specify network with the RTF_HOST flag and vice versa. Continue normalization efforts from D29826 and D29826 and ensure that RTF_HOST flag always reflects host/network data from netmask field. Differential Revision: https://reviews.freebsd.org/D29958 MFC after: 2 days (cherry picked from commit 5d1403a79a3e56403fb63c062252a23fce81e5f1) --- sys/net/rtsock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 405300a394de..6930bd167ac1 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1503,6 +1503,7 @@ cleanup_xaddrs_inet(struct rt_addrinfo *info, struct linear_buffer *lb) return (ENOBUFS); fill_sockaddr_inet(mask_sa, mask); info->rti_info[RTAX_NETMASK] = (struct sockaddr *)mask_sa; + info->rti_flags &= ~RTF_HOST; } else remove_netmask(info); @@ -1563,6 +1564,7 @@ cleanup_xaddrs_inet6(struct rt_addrinfo *info, struct linear_buffer *lb) return (ENOBUFS); fill_sockaddr_inet6((struct sockaddr_in6 *)sa, &mask, 0); info->rti_info[RTAX_NETMASK] = sa; + info->rti_flags &= ~RTF_HOST; } else remove_netmask(info); From owner-dev-commits-src-all@freebsd.org Tue May 4 21:43:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 857136246BC; Tue, 4 May 2021 21:43:08 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZYHJ37X8z4Xb6; Tue, 4 May 2021 21:43:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5CE7C190AA; Tue, 4 May 2021 21:43:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144Lh8dx072640; Tue, 4 May 2021 21:43:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144Lh8al072639; Tue, 4 May 2021 21:43:08 GMT (envelope-from git) Date: Tue, 4 May 2021 21:43:08 GMT Message-Id: <202105042143.144Lh8al072639@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 83add84c00ed - stable/13 - [fib algo] Delay algo init at fib growth to to allow to reliably use rib KPI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 83add84c00edfe0e690568a2bb23fcaf3ccfbb20 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 21:43:08 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=83add84c00edfe0e690568a2bb23fcaf3ccfbb20 commit 83add84c00edfe0e690568a2bb23fcaf3ccfbb20 Author: Alexander V. Chernikov AuthorDate: 2021-04-25 10:22:45 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-05-04 21:30:35 +0000 [fib algo] Delay algo init at fib growth to to allow to reliably use rib KPI. Currently, most of the rib(9) KPI does not use rnh pointers, using fibnum and family parameters to determine the rib pointer instead. This works well except for the case when we initialize new rib pointers during fib growth. In that case, there is no mapping between fib/family and the new rib, as an entirely new rib pointer array is populated. Address this by delaying fib algo initialization till after switching to the new pointer array and updating the number of fibs. Set datapath pointer to the dummy function, so the potential callers won't crash the kernel in the brief moment when the rib exists, but no fib algo is attached. This change allows to avoid creating duplicates of existing rib functions, with altered signature. Differential Revision: https://reviews.freebsd.org/D29969 MFC after: 1 week (cherry picked from commit 8a0d57baecf70aa7f49b0b1468f6264c75d8e6df) --- sys/net/route/fib_algo.c | 89 ++++++++++++++++++++++++++++++++------------ sys/net/route/route_tables.c | 17 +++++---- sys/net/route/route_var.h | 3 +- 3 files changed, 76 insertions(+), 33 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index 9fdc80001986..837ea7c2b43b 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -1538,6 +1538,12 @@ SYSCTL_PROC(_net_route_algo_inet6, OID_AUTO, algo, set_algo_inet6_sysctl_handler, "A", "Set IPv6 lookup algo"); #endif +static struct nhop_object * +dummy_lookup(void *algo_data, const struct flm_lookup_key key, uint32_t scopeid) +{ + return (NULL); +} + static void destroy_fdh_epoch(epoch_context_t ctx) { @@ -1556,8 +1562,15 @@ alloc_fib_dp_array(uint32_t num_tables, bool waitok) sz = sizeof(struct fib_dp_header); sz += sizeof(struct fib_dp) * num_tables; fdh = malloc(sz, M_RTABLE, (waitok ? M_WAITOK : M_NOWAIT) | M_ZERO); - if (fdh != NULL) + if (fdh != NULL) { fdh->fdh_num_tables = num_tables; + /* + * Set dummy lookup function ptr always returning NULL, so + * we can delay algo init. + */ + for (uint32_t i = 0; i < num_tables; i++) + fdh->fdh_idx[i].f = dummy_lookup; + } return (fdh); } @@ -1933,19 +1946,18 @@ fib_check_best_algo(struct rib_head *rh, struct fib_lookup_module *orig_flm) * Called when new route table is created. * Selects, allocates and attaches fib algo for the table. */ -int -fib_select_algo_initial(struct rib_head *rh) +static bool +fib_select_algo_initial(struct rib_head *rh, struct fib_dp *dp) { struct fib_lookup_module *flm; struct fib_data *fd = NULL; enum flm_op_result result; struct epoch_tracker et; - int error = 0; flm = fib_check_best_algo(rh, NULL); if (flm == NULL) { RH_PRINTF(LOG_CRIT, rh, "no algo selected"); - return (ENOENT); + return (false); } RH_PRINTF(LOG_INFO, rh, "selected algo %s", flm->flm_name); @@ -1956,29 +1968,58 @@ fib_select_algo_initial(struct rib_head *rh) NET_EPOCH_EXIT(et); RH_PRINTF(LOG_DEBUG, rh, "result=%d fd=%p", result, fd); - if (result == FLM_SUCCESS) { - - /* - * Attach datapath directly to avoid multiple reallocations - * during fib growth - */ - struct fib_dp_header *fdp; - struct fib_dp **pdp; - - pdp = get_family_dp_ptr(rh->rib_family); - if (pdp != NULL) { - fdp = get_fib_dp_header(*pdp); - fdp->fdh_idx[fd->fd_fibnum] = fd->fd_dp; - FD_PRINTF(LOG_INFO, fd, "datapath attached"); - } - } else { - error = EINVAL; + if (result == FLM_SUCCESS) + *dp = fd->fd_dp; + else RH_PRINTF(LOG_CRIT, rh, "unable to setup algo %s", flm->flm_name); - } fib_unref_algo(flm); - return (error); + return (result == FLM_SUCCESS); +} + +/* + * Sets up fib algo instances for the non-initialized RIBs in the @family. + * Allocates temporary datapath index to amortize datapaint index updates + * with large @num_tables. + */ +void +fib_setup_family(int family, uint32_t num_tables) +{ + struct fib_dp_header *new_fdh = alloc_fib_dp_array(num_tables, false); + if (new_fdh == NULL) { + ALGO_PRINTF(LOG_CRIT, "Unable to setup framework for %s", print_family(family)); + return; + } + + for (int i = 0; i < num_tables; i++) { + struct rib_head *rh = rt_tables_get_rnh(i, family); + if (rh->rib_algo_init) + continue; + if (!fib_select_algo_initial(rh, &new_fdh->fdh_idx[i])) + continue; + + rh->rib_algo_init = true; + } + + FIB_MOD_LOCK(); + struct fib_dp **pdp = get_family_dp_ptr(family); + struct fib_dp_header *old_fdh = get_fib_dp_header(*pdp); + + /* Update the items not touched by the new init, from the old data pointer */ + for (int i = 0; i < num_tables; i++) { + if (new_fdh->fdh_idx[i].f == dummy_lookup) + new_fdh->fdh_idx[i] = old_fdh->fdh_idx[i]; + } + + /* Ensure all index writes have completed */ + atomic_thread_fence_rel(); + /* Set new datapath pointer */ + *pdp = &new_fdh->fdh_idx[0]; + + FIB_MOD_UNLOCK(); + + fib_epoch_call(destroy_fdh_epoch, &old_fdh->fdh_epoch_ctx); } /* diff --git a/sys/net/route/route_tables.c b/sys/net/route/route_tables.c index e3743d55404d..c9a9d6a915eb 100644 --- a/sys/net/route/route_tables.c +++ b/sys/net/route/route_tables.c @@ -214,13 +214,6 @@ grow_rtables(uint32_t num_tables) if (rh == NULL) log(LOG_ERR, "unable to create routing table for %d.%d\n", dom->dom_family, i); -#ifdef FIB_ALGO - if (fib_select_algo_initial(rh) != 0) { - log(LOG_ERR, "unable to select algo for table %d.%d\n", - dom->dom_family, i); - // TODO: detach table - } -#endif *prnh = rh; } } @@ -238,9 +231,17 @@ grow_rtables(uint32_t num_tables) atomic_thread_fence_rel(); epoch_wait_preempt(net_epoch_preempt); - /* Finally, set number of fibs to a new value */ + /* Set number of fibs to a new value */ V_rt_numfibs = num_tables; +#ifdef FIB_ALGO + /* Attach fib algo to the new rtables */ + for (dom = domains; dom; dom = dom->dom_next) { + if (dom->dom_rtattach != NULL) + fib_setup_family(dom->dom_family, num_tables); + } +#endif + if (old_rt_tables != NULL) free(old_rt_tables, M_RTABLE); } diff --git a/sys/net/route/route_var.h b/sys/net/route/route_var.h index f12931476fd3..ad397104209b 100644 --- a/sys/net/route/route_var.h +++ b/sys/net/route/route_var.h @@ -76,6 +76,7 @@ struct rib_head { #endif uint32_t rib_dying:1; /* rib is detaching */ uint32_t rib_algo_fixed:1;/* fixed algorithm */ + uint32_t rib_algo_init:1;/* algo init done */ struct nh_control *nh_control; /* nexthop subsystem data */ CK_STAILQ_HEAD(, rib_subscription) rnh_subscribers;/* notification subscribers */ }; @@ -328,7 +329,7 @@ int rtsock_addrmsg(int cmd, struct ifaddr *ifa, int fibnum); /* lookup_framework.c */ void fib_grow_rtables(uint32_t new_num_tables); -int fib_select_algo_initial(struct rib_head *rh); +void fib_setup_family(int family, uint32_t num_tables); void fib_destroy_rib(struct rib_head *rh); void vnet_fib_init(void); void vnet_fib_destroy(void); From owner-dev-commits-src-all@freebsd.org Tue May 4 21:43:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E230624A98; Tue, 4 May 2021 21:43:11 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZYHL1qSlz4Xpc; Tue, 4 May 2021 21:43:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 89D031930B; Tue, 4 May 2021 21:43:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144Lh9u4072661; Tue, 4 May 2021 21:43:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144Lh9ZZ072660; Tue, 4 May 2021 21:43:09 GMT (envelope-from git) Date: Tue, 4 May 2021 21:43:09 GMT Message-Id: <202105042143.144Lh9ZZ072660@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: d0666c87184f - stable/13 - Add rib_walk_from() wrapper for selective rib tree traversal. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d0666c87184f977442fec32a820cac63b5334bbd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 21:43:11 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=d0666c87184f977442fec32a820cac63b5334bbd commit d0666c87184f977442fec32a820cac63b5334bbd Author: Alexander V. Chernikov AuthorDate: 2021-04-25 11:59:40 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-05-04 21:30:35 +0000 Add rib_walk_from() wrapper for selective rib tree traversal. Provide wrapper for the rnh_walktree_from() rib callback. As currently `struct rib_head` is considered internal to the routing subsystem, this wrapper is necessary to maintain isolation from the external code. Differential Revision: https://reviews.freebsd.org/D29971 MFC after: 1 week (cherry picked from commit f9668e42b44f22c9ab213eb9a4792d5acfcf6903) --- sys/net/route/route_ctl.h | 6 ++++++ sys/net/route/route_helpers.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/sys/net/route/route_ctl.h b/sys/net/route/route_ctl.h index 46dba759f8df..4fe45cc8a970 100644 --- a/sys/net/route/route_ctl.h +++ b/sys/net/route/route_ctl.h @@ -62,6 +62,10 @@ int rib_add_redirect(u_int fibnum, struct sockaddr *dst, struct sockaddr *gateway, struct sockaddr *author, struct ifnet *ifp, int flags, int expire_sec); +/* common flags for the functions below */ +#define RIB_FLAG_WLOCK 0x01 /* Need exclusive rnh lock */ +#define RIB_FLAG_LOCKED 0x02 /* Do not explicitly acquire rnh lock */ + enum rib_walk_hook { RIB_WALK_HOOK_PRE, /* Hook is called before iteration */ RIB_WALK_HOOK_POST, /* Hook is called after iteration */ @@ -77,6 +81,8 @@ void rib_walk_ext_internal(struct rib_head *rnh, bool wlock, rib_walktree_f_t *wa_f, rib_walk_hook_f_t *hook_f, void *arg); void rib_walk_ext_locked(struct rib_head *rnh, rib_walktree_f_t *wa_f, rib_walk_hook_f_t *hook_f, void *arg); +void rib_walk_from(uint32_t fibnum, int family, uint32_t flags, struct sockaddr *prefix, + struct sockaddr *mask, rib_walktree_f_t *wa_f, void *arg); void rib_walk_del(u_int fibnum, int family, rib_filter_f_t *filter_f, void *arg, bool report); diff --git a/sys/net/route/route_helpers.c b/sys/net/route/route_helpers.c index 782e160ca51b..5d29197cc4fb 100644 --- a/sys/net/route/route_helpers.c +++ b/sys/net/route/route_helpers.c @@ -128,6 +128,38 @@ rib_walk(uint32_t fibnum, int family, bool wlock, rib_walktree_f_t *wa_f, rib_walk_ext(fibnum, family, wlock, wa_f, NULL, arg); } +/* + * Calls @wa_f with @arg for each entry in the table matching @prefix/@mask. + * + * The following flags are supported: + * RIB_FLAG_WLOCK: acquire exclusive lock + * RIB_FLAG_LOCKED: Assumes the table is already locked & skip locking + * + * By default, table is traversed under read lock. + */ +void +rib_walk_from(uint32_t fibnum, int family, uint32_t flags, struct sockaddr *prefix, + struct sockaddr *mask, rib_walktree_f_t *wa_f, void *arg) +{ + RIB_RLOCK_TRACKER; + struct rib_head *rnh = rt_tables_get_rnh(fibnum, family); + + if (rnh == NULL) + return; + + if (flags & RIB_FLAG_WLOCK) + RIB_WLOCK(rnh); + else if (!(flags & RIB_FLAG_LOCKED)) + RIB_RLOCK(rnh); + + rnh->rnh_walktree_from(&rnh->head, prefix, mask, (walktree_f_t *)wa_f, arg); + + if (flags & RIB_FLAG_WLOCK) + RIB_WUNLOCK(rnh); + else if (!(flags & RIB_FLAG_LOCKED)) + RIB_RUNLOCK(rnh); +} + /* * Iterates over all existing fibs in system calling * @hook_f function before/after traversing each fib. From owner-dev-commits-src-all@freebsd.org Tue May 4 21:43:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 309986249F4; Tue, 4 May 2021 21:43:11 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZYHM0bvPz4XsB; Tue, 4 May 2021 21:43:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C222718F2E; Tue, 4 May 2021 21:43:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144LhAr6072689; Tue, 4 May 2021 21:43:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144LhAUW072688; Tue, 4 May 2021 21:43:10 GMT (envelope-from git) Date: Tue, 4 May 2021 21:43:10 GMT Message-Id: <202105042143.144LhAUW072688@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 939c41f3b89b - stable/13 - Fix drace CTF for the rib_head. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 939c41f3b89b18054b59a4432fdf18d583377849 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 21:43:11 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=939c41f3b89b18054b59a4432fdf18d583377849 commit 939c41f3b89b18054b59a4432fdf18d583377849 Author: Alexander V. Chernikov AuthorDate: 2021-04-27 07:47:53 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-05-04 21:31:25 +0000 Fix drace CTF for the rib_head. 33cb3cb2e321 introduced an `rib_head` structure field under the FIB_ALGO define. This may be problematic for the CTF, as some of the files including `route_var.h` do not have `fib_algo` defined. Make dtrace happy by making the field unconditional. Suggested by: markj (cherry picked from commit bc5ef45aec3fa8acf2dd3408cebd207317543a8b) --- sys/net/route/route_var.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/net/route/route_var.h b/sys/net/route/route_var.h index ad397104209b..b29b79c88864 100644 --- a/sys/net/route/route_var.h +++ b/sys/net/route/route_var.h @@ -71,9 +71,7 @@ struct rib_head { struct callout expire_callout; /* Callout for expiring dynamic routes */ time_t next_expire; /* Next expire run ts */ uint32_t rnh_prefixes; /* Number of prefixes */ -#ifdef FIB_ALGO - rt_gen_t rnh_gen_rib; /* rib generation counter */ -#endif + rt_gen_t rnh_gen_rib; /* fib algo: rib generation counter */ uint32_t rib_dying:1; /* rib is detaching */ uint32_t rib_algo_fixed:1;/* fixed algorithm */ uint32_t rib_algo_init:1;/* algo init done */ From owner-dev-commits-src-all@freebsd.org Tue May 4 21:43:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E351E624B04; Tue, 4 May 2021 21:43:13 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZYHM75Rhz4Xn9; Tue, 4 May 2021 21:43:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BF46E19383; Tue, 4 May 2021 21:43:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144LhBIU072712; Tue, 4 May 2021 21:43:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144LhBMZ072711; Tue, 4 May 2021 21:43:11 GMT (envelope-from git) Date: Tue, 4 May 2021 21:43:11 GMT Message-Id: <202105042143.144LhBMZ072711@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 972fcfb34b0d - stable/13 - [fib algo] Update fib_gen counter under FIB_MOD_LOCK. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 972fcfb34b0d84dc1d869c351da8e19c702a3c35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 21:43:14 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=972fcfb34b0d84dc1d869c351da8e19c702a3c35 commit 972fcfb34b0d84dc1d869c351da8e19c702a3c35 Author: Alexander V. Chernikov AuthorDate: 2021-04-28 20:21:58 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-05-04 21:31:36 +0000 [fib algo] Update fib_gen counter under FIB_MOD_LOCK. MFC after: 3 days (cherry picked from commit 41ce0e34ea42a4f7113d1ba15d25b9b64d5921b8) --- sys/net/route/fib_algo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index 837ea7c2b43b..3a09408c92b1 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -1169,19 +1169,19 @@ try_setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, estimate_nhop_scale(old_fd, fd); fd->fd_rh = rh; - fd->fd_gen = ++fib_gen; fd->fd_family = rh->rib_family; fd->fd_fibnum = rh->rib_fibnum; callout_init_rm(&fd->fd_callout, &rh->rib_lock, 0); fd->fd_vnet = curvnet; fd->fd_flm = flm; - FD_PRINTF(LOG_DEBUG, fd, "allocated fd %p", fd); - FIB_MOD_LOCK(); flm->flm_refcount++; + fd->fd_gen = ++fib_gen; FIB_MOD_UNLOCK(); + FD_PRINTF(LOG_DEBUG, fd, "allocated fd %p", fd); + /* Allocate nhidx -> nhop_ptr table */ size = fd->number_nhops * sizeof(void *); fd->nh_idx = malloc(size, M_RTABLE, M_NOWAIT | M_ZERO); From owner-dev-commits-src-all@freebsd.org Tue May 4 23:52:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A29B6275FA; Tue, 4 May 2021 23:52:35 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZc8g1CHYz4djL; Tue, 4 May 2021 23:52:35 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1C51E1AD70; Tue, 4 May 2021 23:52:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144NqZCe049102; Tue, 4 May 2021 23:52:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144NqZhu049101; Tue, 4 May 2021 23:52:35 GMT (envelope-from git) Date: Tue, 4 May 2021 23:52:35 GMT Message-Id: <202105042352.144NqZhu049101@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: fe70d7b26d7a - main - iwmbtfw(8): Add support for Intel 7260/7265 bluetooth adapter firmwares MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fe70d7b26d7a98b17e315bc3455bee267c618b4e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 23:52:35 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=fe70d7b26d7a98b17e315bc3455bee267c618b4e commit fe70d7b26d7a98b17e315bc3455bee267c618b4e Author: Philippe Michaud-Boudreault AuthorDate: 2021-05-04 23:48:21 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-05-04 23:50:32 +0000 iwmbtfw(8): Add support for Intel 7260/7265 bluetooth adapter firmwares To use it comms/iwmbt-firmware port should be updated to 20210315 version. Submitted by: Philippe Michaud-Boudreault Tested by: Helge Oldach Reviewed by: wulf PR: 228787 MFC after: 2 weeks --- usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c | 14 ++ usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c | 189 +++++++++++++++++++++++- usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h | 5 + usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 | 10 +- usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf | 2 +- usr.sbin/bluetooth/iwmbtfw/main.c | 253 +++++++++++++++++++++++--------- 6 files changed, 401 insertions(+), 72 deletions(-) diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c b/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c index 7764f8bc4ac3..fc93ce094adc 100644 --- a/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c +++ b/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c @@ -119,6 +119,20 @@ iwmbt_get_fwname(struct iwmbt_version *ver, struct iwmbt_boot_params *params, char *fwname; switch (ver->hw_variant) { + case 0x07: /* 7260 */ + asprintf(&fwname, "%s/ibt-hw-%x.%x.%x-fw-%x.%x.%x.%x.%x.%s", + prefix, + le16toh(ver->hw_platform), + le16toh(ver->hw_variant), + le16toh(ver->hw_revision), + le16toh(ver->fw_variant), + le16toh(ver->fw_revision), + le16toh(ver->fw_build_num), + le16toh(ver->fw_build_ww), + le16toh(ver->fw_build_yy), + suffix); + break; + case 0x0b: /* 8260 */ case 0x0c: /* 8265 */ asprintf(&fwname, "%s/ibt-%u-%u.%s", diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c b/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c index af48e038340f..f4272548d560 100644 --- a/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c +++ b/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c @@ -27,7 +27,7 @@ * $FreeBSD$ */ -#include +#include #include #include @@ -126,6 +126,125 @@ iwmbt_hci_command(struct libusb_device_handle *hdl, struct iwmbt_hci_cmd *cmd, return (ret); } +int +iwmbt_patch_fwfile(struct libusb_device_handle *hdl, + const struct iwmbt_firmware *fw) +{ + int ret, transferred; + struct iwmbt_firmware fw_job = *fw; + uint16_t cmd_opcode; + uint8_t cmd_length; + uint8_t cmd_buf[IWMBT_HCI_MAX_CMD_SIZE]; + uint8_t evt_code; + uint8_t evt_length; + uint8_t evt_buf[IWMBT_HCI_MAX_EVENT_SIZE]; + int skip_patch = 0; + + for (;;) { + skip_patch = 0; + + if (fw_job.len < 4) + break; + + if (fw_job.buf[0] != 0x01) { + iwmbt_err("Invalid firmware, expected HCI command (%d)", + fw_job.buf[0]); + return (-1); + } + + /* Advance by one. */ + fw_job.buf++; + fw_job.len--; + + /* Load in the HCI command to perform. */ + cmd_opcode = le16dec(fw_job.buf); + cmd_length = fw_job.buf[2]; + memcpy(cmd_buf, fw_job.buf, 3); + + iwmbt_debug("opcode=%04x, len=%02x", cmd_opcode, cmd_length); + + /* For some reason the command 0xfc2f hangs up my card. */ + if (cmd_opcode == 0xfc2f) + skip_patch = 1; + + /* Advance by three. */ + fw_job.buf += 3; + fw_job.len -= 3; + + if (fw_job.len < cmd_length) + cmd_length = fw_job.len; + + /* Copy data to HCI command buffer. */ + memcpy(cmd_buf + 3, fw_job.buf, + MIN(cmd_length, IWMBT_HCI_MAX_CMD_SIZE - 3)); + + /* Advance by data length. */ + fw_job.buf += cmd_length; + fw_job.len -= cmd_length; + + /* + * Every command has its associated event: data must match + * what is recorded in the firmware file. Perform that check + * now. + * + * Some commands are mapped to more than one event sequence, + * in that case we can drop the non-patch commands, as we + * probably don't need them for operation of the card. + * + */ + + for (;;) { + /* Is this the end of the file? */ + if (fw_job.len < 3) + break; + + if (fw_job.buf[0] != 0x02) + break; + + /* Advance by one. */ + fw_job.buf++; + fw_job.len--; + + /* Load in the HCI event. */ + evt_code = fw_job.buf[0]; + evt_length = fw_job.buf[1]; + + /* Advance by two. */ + fw_job.buf += 2; + fw_job.len -= 2; + + /* Prepare HCI event buffer. */ + memset(evt_buf, 0, IWMBT_HCI_MAX_EVENT_SIZE); + + iwmbt_debug("event=%04x, len=%02x", + evt_code, evt_length); + + /* Advance by data length. */ + fw_job.buf += evt_length; + fw_job.len -= evt_length; + + if (skip_patch == 0) { + ret = iwmbt_hci_command(hdl, + (struct iwmbt_hci_cmd *)cmd_buf, + evt_buf, + IWMBT_HCI_MAX_EVENT_SIZE, + &transferred, + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0) { + iwmbt_debug("Can't send patch: " + "code=%d, size=%d", + ret, + transferred); + return (-1); + } + } + } + } + + return (0); +} + int iwmbt_load_fwfile(struct libusb_device_handle *hdl, const struct iwmbt_firmware *fw, uint32_t *boot_param) @@ -217,6 +336,74 @@ iwmbt_load_fwfile(struct libusb_device_handle *hdl, return (0); } +int +iwmbt_enter_manufacturer(struct libusb_device_handle *hdl) +{ + int ret, transferred; + static struct iwmbt_hci_cmd cmd = { + .opcode = htole16(0xfc11), + .length = 2, + .data = { 0x01, 0x00 }, + }; + uint8_t buf[IWMBT_HCI_MAX_EVENT_SIZE]; + + ret = iwmbt_hci_command(hdl, + &cmd, + buf, + sizeof(buf), + &transferred, + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0) { + iwmbt_debug("Can't enter manufacturer mode: code=%d, size=%d", + ret, + transferred); + return (-1); + } + + return (0); +} + +int +iwmbt_exit_manufacturer(struct libusb_device_handle *hdl, int mode) +{ + int ret, transferred; + static struct iwmbt_hci_cmd cmd = { + .opcode = htole16(0xfc11), + .length = 2, + .data = { 0x00, 0x00 }, + }; + uint8_t buf[IWMBT_HCI_MAX_EVENT_SIZE]; + + /* + * The mode sets the type of reset we want to perform: + * 0x00: simply exit manufacturer mode without a reset. + * 0x01: exit manufacturer mode with a reset and patches disabled + * 0x02: exit manufacturer mode with a reset and patches enabled + */ + if (mode > 2) { + iwmbt_debug("iwmbt_exit_manufacturer(): unknown mode (%d)", + mode); + } + cmd.data[1] = mode; + + ret = iwmbt_hci_command(hdl, + &cmd, + buf, + sizeof(buf), + &transferred, + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0) { + iwmbt_debug("Can't exit manufacturer mode: code=%d, size=%d", + ret, + transferred); + return (-1); + } + + return (0); +} + int iwmbt_get_version(struct libusb_device_handle *hdl, struct iwmbt_version *version) diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h b/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h index 6a87f499fa26..5bc1d15181cd 100644 --- a/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h +++ b/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h @@ -73,8 +73,13 @@ struct iwmbt_hci_event_cmd_compl { #define IWMBT_HCI_CMD_TIMEOUT 2000 /* ms */ #define IWMBT_LOADCMPL_TIMEOUT 5000 /* ms */ +extern int iwmbt_patch_fwfile(struct libusb_device_handle *hdl, + const struct iwmbt_firmware *fw); extern int iwmbt_load_fwfile(struct libusb_device_handle *hdl, const struct iwmbt_firmware *fw, uint32_t *boot_param); +extern int iwmbt_enter_manufacturer(struct libusb_device_handle *hdl); +extern int iwmbt_exit_manufacturer(struct libusb_device_handle *hdl, + int mode); extern int iwmbt_get_version(struct libusb_device_handle *hdl, struct iwmbt_version *version); extern int iwmbt_get_boot_params(struct libusb_device_handle *hdl, diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 b/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 index 3afbf54793f9..10e68040e0e4 100644 --- a/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 +++ b/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 @@ -1,5 +1,6 @@ .\" Copyright (c) 2013, 2016 Adrian Chadd .\" Copyright (c) 2019 Vladimir Kondratyev +.\" Copyright (c) 2021 Philippe Michaud-Boudreault .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -24,12 +25,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 4, 2019 +.Dd May 3, 2021 .Dt IWMBTFW 8 .Os .Sh NAME .Nm iwmbtfw -.Nd firmware download utility for Intel Wireless 8260/8265 chip based Bluetooth +.Nd firmware download utility for Intel Wireless 7260/8260/8265 chip based Bluetooth USB devices .Sh SYNOPSIS .Nm @@ -46,7 +47,7 @@ device. .Pp This utility will .Em only -work with Intel Wireless 8260/8265 chip based Bluetooth USB devices and some of +work with Intel Wireless 7260/8260/8265 chip based Bluetooth USB devices and some of their successors. The identification is currently based on USB vendor ID/product ID pair. The vendor ID should be 0x8087 @@ -91,6 +92,9 @@ utility used as firmware downloader template and on Linux btintel driver source code. It is written by .An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . +.Pp +Support for the 7260 card added by +.An Philippe Michaud-Boudreault Aq Mt pitwuu@gmail.com . .Sh BUGS Most likely. Please report if found. diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf b/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf index 4bd1f020237c..6b417089c68b 100644 --- a/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf +++ b/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf @@ -7,6 +7,6 @@ notify 100 { match "subsystem" "DEVICE"; match "type" "ATTACH"; match "vendor" "0x8087"; - match "product" "(0x0a2b|0x0aaa|0x0025|0x0026|0x0029)"; + match "product" "(0x07dc|0x0a2a|0x0aa7|0x0a2b|0x0aaa|0x0025|0x0026|0x0029)"; action "/usr/sbin/iwmbtfw -d $cdev -f /usr/local/share/iwmbt-firmware"; }; diff --git a/usr.sbin/bluetooth/iwmbtfw/main.c b/usr.sbin/bluetooth/iwmbtfw/main.c index ecd9d226b91f..3476e3fcd613 100644 --- a/usr.sbin/bluetooth/iwmbtfw/main.c +++ b/usr.sbin/bluetooth/iwmbtfw/main.c @@ -57,7 +57,15 @@ struct iwmbt_devid { uint16_t vendor_id; }; -static struct iwmbt_devid iwmbt_list[] = { +static struct iwmbt_devid iwmbt_list_72xx[] = { + + /* Intel Wireless 7260/7265 and successors */ + { .vendor_id = 0x8087, .product_id = 0x07dc }, + { .vendor_id = 0x8087, .product_id = 0x0a2a }, + { .vendor_id = 0x8087, .product_id = 0x0aa7 }, +}; + +static struct iwmbt_devid iwmbt_list_82xx[] = { /* Intel Wireless 8260/8265 and successors */ { .vendor_id = 0x8087, .product_id = 0x0a2b }, @@ -67,15 +75,33 @@ static struct iwmbt_devid iwmbt_list[] = { { .vendor_id = 0x8087, .product_id = 0x0029 }, }; +static int +iwmbt_is_7260(struct libusb_device_descriptor *d) +{ + int i; + + /* Search looking for whether it's an 7260/7265 */ + for (i = 0; i < (int) nitems(iwmbt_list_72xx); i++) { + if ((iwmbt_list_72xx[i].product_id == d->idProduct) && + (iwmbt_list_72xx[i].vendor_id == d->idVendor)) { + iwmbt_info("found 7260/7265"); + return (1); + } + } + + /* Not found */ + return (0); +} + static int iwmbt_is_8260(struct libusb_device_descriptor *d) { int i; /* Search looking for whether it's an 8260/8265 */ - for (i = 0; i < (int) nitems(iwmbt_list); i++) { - if ((iwmbt_list[i].product_id == d->idProduct) && - (iwmbt_list[i].vendor_id == d->idVendor)) { + for (i = 0; i < (int) nitems(iwmbt_list_82xx); i++) { + if ((iwmbt_list_82xx[i].product_id == d->idProduct) && + (iwmbt_list_82xx[i].vendor_id == d->idVendor)) { iwmbt_info("found 8260/8265"); return (1); } @@ -86,7 +112,8 @@ iwmbt_is_8260(struct libusb_device_descriptor *d) } static libusb_device * -iwmbt_find_device(libusb_context *ctx, int bus_id, int dev_id) +iwmbt_find_device(libusb_context *ctx, int bus_id, int dev_id, + int *iwmbt_use_old_method) { libusb_device **list, *dev = NULL, *found = NULL; struct libusb_device_descriptor d; @@ -116,11 +143,20 @@ iwmbt_find_device(libusb_context *ctx, int bus_id, int dev_id) } /* Match on the vendor/product id */ + if (iwmbt_is_7260(&d)) { + /* + * Take a reference so it's not freed later on. + */ + found = libusb_ref_device(dev); + *iwmbt_use_old_method = 1; + break; + } else if (iwmbt_is_8260(&d)) { /* * Take a reference so it's not freed later on. */ found = libusb_ref_device(dev); + *iwmbt_use_old_method = 0; break; } } @@ -166,6 +202,31 @@ iwmbt_dump_boot_params(struct iwmbt_boot_params *params) params->otp_bdaddr[0]); } +static int +iwmbt_patch_firmware(libusb_device_handle *hdl, const char *firmware_path) +{ + struct iwmbt_firmware fw; + int ret; + + iwmbt_debug("loading %s", firmware_path); + + /* Read in the firmware */ + if (iwmbt_fw_read(&fw, firmware_path) <= 0) { + iwmbt_debug("iwmbt_fw_read() failed"); + return (-1); + } + + /* Load in the firmware */ + ret = iwmbt_patch_fwfile(hdl, &fw); + if (ret < 0) + iwmbt_debug("Loading firmware file failed"); + + /* free it */ + iwmbt_fw_free(&fw); + + return (ret); +} + static int iwmbt_init_firmware(libusb_device_handle *hdl, const char *firmware_path, uint32_t *boot_param) @@ -268,6 +329,7 @@ main(int argc, char *argv[]) char *firmware_dir = NULL; char *firmware_path = NULL; int retcode = 1; + int iwmbt_use_old_method = 0; /* Parse command line arguments */ while ((n = getopt(argc, argv, "Dd:f:hIm:p:v:")) != -1) { @@ -312,7 +374,7 @@ main(int argc, char *argv[]) iwmbt_debug("opening dev %d.%d", (int) bus_id, (int) dev_id); /* Find a device based on the bus/dev id */ - dev = iwmbt_find_device(ctx, bus_id, dev_id); + dev = iwmbt_find_device(ctx, bus_id, dev_id, &iwmbt_use_old_method); if (dev == NULL) { iwmbt_err("device not found"); goto shutdown; @@ -344,87 +406,144 @@ main(int argc, char *argv[]) /* Get Intel version */ r = iwmbt_get_version(hdl, &ver); if (r < 0) { - iwmbt_debug("iwmbt_get_version() failedL code %d", r); + iwmbt_debug("iwmbt_get_version() failed code %d", r); goto shutdown; } iwmbt_dump_version(&ver); iwmbt_debug("fw_variant=0x%02x", (int) ver.fw_variant); - /* fw_variant = 0x06 bootloader mode / 0x23 operational mode */ - if (ver.fw_variant == 0x23) { - iwmbt_info("Firmware has already been downloaded"); + if (iwmbt_use_old_method) { + + /* fw_patch_num = >0 operational mode */ + if (ver.fw_patch_num > 0x00) { + iwmbt_info("Firmware has already been downloaded"); + retcode = 0; + goto reset; + } + + /* Default the firmware path */ + if (firmware_dir == NULL) + firmware_dir = strdup(_DEFAULT_IWMBT_FIRMWARE_PATH); + + firmware_path = iwmbt_get_fwname(&ver, ¶ms, firmware_dir, "bseq"); + if (firmware_path == NULL) + goto shutdown; + + iwmbt_debug("firmware_path = %s", firmware_path); + + /* Enter manufacturer mode */ + r = iwmbt_enter_manufacturer(hdl); + if (r < 0) { + iwmbt_debug("iwmbt_enter_manufacturer() failed code %d", r); + goto shutdown; + } + + /* Download firmware and parse it for magic Intel Reset parameter */ + r = iwmbt_patch_firmware(hdl, firmware_path); + free(firmware_path); + if (r < 0) + goto shutdown; + + iwmbt_info("Firmware download complete"); + + /* Exit manufacturer mode */ + r = iwmbt_exit_manufacturer(hdl, 0x02); + if (r < 0) { + iwmbt_debug("iwmbt_exit_manufacturer() failed code %d", r); + goto shutdown; + } + + /* Once device is running in operational mode we can ignore failures */ retcode = 0; - goto reset; - } - if (ver.fw_variant != 0x06){ - iwmbt_err("unknown fw_variant 0x%02x", (int) ver.fw_variant); - goto shutdown; - } + /* Execute Read Intel Version one more time */ + r = iwmbt_get_version(hdl, &ver); + if (r == 0) + iwmbt_dump_version(&ver); - /* Read Intel Secure Boot Params */ - r = iwmbt_get_boot_params(hdl, ¶ms); - if (r < 0) { - iwmbt_debug("iwmbt_get_boot_params() failed!"); - goto shutdown; - } - iwmbt_dump_boot_params(¶ms); + /* Set Intel Event mask */ + r = iwmbt_set_event_mask(hdl); + if (r == 0) + iwmbt_info("Intel Event Mask is set"); - /* Check if firmware fragments are ACKed with a cmd complete event */ - if (params.limited_cce != 0x00) { - iwmbt_err("Unsupported Intel firmware loading method (%u)", - params.limited_cce); - goto shutdown; - } + } else { - /* Default the firmware path */ - if (firmware_dir == NULL) - firmware_dir = strdup(_DEFAULT_IWMBT_FIRMWARE_PATH); + /* fw_variant = 0x06 bootloader mode / 0x23 operational mode */ + if (ver.fw_variant == 0x23) { + iwmbt_info("Firmware has already been downloaded"); + retcode = 0; + goto reset; + } - firmware_path = iwmbt_get_fwname(&ver, ¶ms, firmware_dir, "sfi"); - if (firmware_path == NULL) - goto shutdown; + if (ver.fw_variant != 0x06){ + iwmbt_err("unknown fw_variant 0x%02x", (int) ver.fw_variant); + goto shutdown; + } - iwmbt_debug("firmware_path = %s", firmware_path); + /* Read Intel Secure Boot Params */ + r = iwmbt_get_boot_params(hdl, ¶ms); + if (r < 0) { + iwmbt_debug("iwmbt_get_boot_params() failed!"); + goto shutdown; + } + iwmbt_dump_boot_params(¶ms); - /* Download firmware and parse it for magic Intel Reset parameter */ - r = iwmbt_init_firmware(hdl, firmware_path, &boot_param); - free(firmware_path); - if (r < 0) - goto shutdown; + /* Check if firmware fragments are ACKed with a cmd complete event */ + if (params.limited_cce != 0x00) { + iwmbt_err("Unsupported Intel firmware loading method (%u)", + params.limited_cce); + goto shutdown; + } - iwmbt_info("Firmware download complete"); + /* Default the firmware path */ + if (firmware_dir == NULL) + firmware_dir = strdup(_DEFAULT_IWMBT_FIRMWARE_PATH); - r = iwmbt_intel_reset(hdl, boot_param); - if (r < 0) { - iwmbt_debug("iwmbt_intel_reset() failed!"); - goto shutdown; - } + firmware_path = iwmbt_get_fwname(&ver, ¶ms, firmware_dir, "sfi"); + if (firmware_path == NULL) + goto shutdown; - iwmbt_info("Firmware operational"); + iwmbt_debug("firmware_path = %s", firmware_path); - /* Once device is running in operational mode we can ignore failures */ - retcode = 0; + /* Download firmware and parse it for magic Intel Reset parameter */ + r = iwmbt_init_firmware(hdl, firmware_path, &boot_param); + free(firmware_path); + if (r < 0) + goto shutdown; - /* Execute Read Intel Version one more time */ - r = iwmbt_get_version(hdl, &ver); - if (r == 0) - iwmbt_dump_version(&ver); - - /* Apply the device configuration (DDC) parameters */ - firmware_path = iwmbt_get_fwname(&ver, ¶ms, firmware_dir, "ddc"); - iwmbt_debug("ddc_path = %s", firmware_path); - if (firmware_path != NULL) { - r = iwmbt_init_ddc(hdl, firmware_path); + iwmbt_info("Firmware download complete"); + + r = iwmbt_intel_reset(hdl, boot_param); + if (r < 0) { + iwmbt_debug("iwmbt_intel_reset() failed!"); + goto shutdown; + } + + iwmbt_info("Firmware operational"); + + /* Once device is running in operational mode we can ignore failures */ + retcode = 0; + + /* Execute Read Intel Version one more time */ + r = iwmbt_get_version(hdl, &ver); if (r == 0) - iwmbt_info("DDC download complete"); - free(firmware_path); - } + iwmbt_dump_version(&ver); + + /* Apply the device configuration (DDC) parameters */ + firmware_path = iwmbt_get_fwname(&ver, ¶ms, firmware_dir, "ddc"); + iwmbt_debug("ddc_path = %s", firmware_path); + if (firmware_path != NULL) { + r = iwmbt_init_ddc(hdl, firmware_path); + if (r == 0) + iwmbt_info("DDC download complete"); + free(firmware_path); + } - /* Set Intel Event mask */ - r = iwmbt_set_event_mask(hdl); - if (r == 0) - iwmbt_info("Intel Event Mask is set"); + /* Set Intel Event mask */ + r = iwmbt_set_event_mask(hdl); + if (r == 0) + iwmbt_info("Intel Event Mask is set"); + } reset: From owner-dev-commits-src-all@freebsd.org Wed May 5 00:56:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CAFA629A91; Wed, 5 May 2021 00:56:21 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZdZF43GYz4hTf; Wed, 5 May 2021 00:56:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 73BC41BA10; Wed, 5 May 2021 00:56:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1450uLkg028134; Wed, 5 May 2021 00:56:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1450uLG6028133; Wed, 5 May 2021 00:56:21 GMT (envelope-from git) Date: Wed, 5 May 2021 00:56:21 GMT Message-Id: <202105050056.1450uLG6028133@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 22b9f618e873 - stable/13 - Set PCIe device's Max_Payload_Size to match PCIe root's. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 22b9f618e873140127570e629c19e25d13edc568 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 00:56:21 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=22b9f618e873140127570e629c19e25d13edc568 commit 22b9f618e873140127570e629c19e25d13edc568 Author: Alexander Motin AuthorDate: 2021-04-05 14:34:40 +0000 Commit: Alexander Motin CommitDate: 2021-05-05 00:53:55 +0000 Set PCIe device's Max_Payload_Size to match PCIe root's. Usually on boot the MPS is already configured by BIOS. But we've found that on hot-plug it is not true at least for our Supermicro X11 boards. As result, mismatch between root's configuration of 256 bytes and device's default of 128 bytes cause problems for some devices, while others seem to work fine. MFC after: 1 month Sponsored by: iXsystems, Inc. (cherry picked from commit 5a898b2b78ce04d608bbaaa0813424b11f921ae7) --- sys/dev/pci/pci.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index d85ce5baa7bc..54d7957dcbf1 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -4267,6 +4267,45 @@ pci_create_iov_child_method(device_t bus, device_t pf, uint16_t rid, } #endif +/* + * For PCIe device set Max_Payload_Size to match PCIe root's. + */ +static void +pcie_setup_mps(device_t dev) +{ + struct pci_devinfo *dinfo = device_get_ivars(dev); + device_t root; + uint16_t rmps, mmps, mps; + + if (dinfo->cfg.pcie.pcie_location == 0) + return; + root = pci_find_pcie_root_port(dev); + if (root == NULL) + return; + /* Check whether the MPS is already configured. */ + rmps = pcie_read_config(root, PCIER_DEVICE_CTL, 2) & + PCIEM_CTL_MAX_PAYLOAD; + mps = pcie_read_config(dev, PCIER_DEVICE_CTL, 2) & + PCIEM_CTL_MAX_PAYLOAD; + if (mps == rmps) + return; + /* Check whether the device is capable of the root's MPS. */ + mmps = (pcie_read_config(dev, PCIER_DEVICE_CAP, 2) & + PCIEM_CAP_MAX_PAYLOAD) << 5; + if (rmps > mmps) { + /* + * The device is unable to handle root's MPS. Limit root. + * XXX: We should traverse through all the tree, applying + * it to all the devices. + */ + pcie_adjust_config(root, PCIER_DEVICE_CTL, + PCIEM_CTL_MAX_PAYLOAD, mmps, 2); + } else { + pcie_adjust_config(dev, PCIER_DEVICE_CTL, + PCIEM_CTL_MAX_PAYLOAD, rmps, 2); + } +} + static void pci_add_child_clear_aer(device_t dev, struct pci_devinfo *dinfo) { @@ -4354,6 +4393,7 @@ pci_add_child(device_t bus, struct pci_devinfo *dinfo) pci_cfg_restore(dev, dinfo); pci_print_verbose(dinfo); pci_add_resources(bus, dev, 0, 0); + pcie_setup_mps(dev); pci_child_added(dinfo->cfg.dev); if (pci_clear_aer_on_attach) From owner-dev-commits-src-all@freebsd.org Wed May 5 00:58:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E3A5629C4D; Wed, 5 May 2021 00:58:42 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZdcy44X2z4hV5; Wed, 5 May 2021 00:58:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7F0AF1B830; Wed, 5 May 2021 00:58:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1450wg4B028391; Wed, 5 May 2021 00:58:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1450wgbE028390; Wed, 5 May 2021 00:58:42 GMT (envelope-from git) Date: Wed, 5 May 2021 00:58:42 GMT Message-Id: <202105050058.1450wgbE028390@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 96033da5c38e - stable/12 - Set PCIe device's Max_Payload_Size to match PCIe root's. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 96033da5c38e20c27e2ca9007cca8bfab7e350cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 00:58:42 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=96033da5c38e20c27e2ca9007cca8bfab7e350cc commit 96033da5c38e20c27e2ca9007cca8bfab7e350cc Author: Alexander Motin AuthorDate: 2021-04-05 14:34:40 +0000 Commit: Alexander Motin CommitDate: 2021-05-05 00:57:07 +0000 Set PCIe device's Max_Payload_Size to match PCIe root's. Usually on boot the MPS is already configured by BIOS. But we've found that on hot-plug it is not true at least for our Supermicro X11 boards. As result, mismatch between root's configuration of 256 bytes and device's default of 128 bytes cause problems for some devices, while others seem to work fine. MFC after: 1 month Sponsored by: iXsystems, Inc. (cherry picked from commit 5a898b2b78ce04d608bbaaa0813424b11f921ae7) --- sys/dev/pci/pci.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index f3a0309c5202..e167465db9b3 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -4248,6 +4248,45 @@ pci_create_iov_child_method(device_t bus, device_t pf, uint16_t rid, } #endif +/* + * For PCIe device set Max_Payload_Size to match PCIe root's. + */ +static void +pcie_setup_mps(device_t dev) +{ + struct pci_devinfo *dinfo = device_get_ivars(dev); + device_t root; + uint16_t rmps, mmps, mps; + + if (dinfo->cfg.pcie.pcie_location == 0) + return; + root = pci_find_pcie_root_port(dev); + if (root == NULL) + return; + /* Check whether the MPS is already configured. */ + rmps = pcie_read_config(root, PCIER_DEVICE_CTL, 2) & + PCIEM_CTL_MAX_PAYLOAD; + mps = pcie_read_config(dev, PCIER_DEVICE_CTL, 2) & + PCIEM_CTL_MAX_PAYLOAD; + if (mps == rmps) + return; + /* Check whether the device is capable of the root's MPS. */ + mmps = (pcie_read_config(dev, PCIER_DEVICE_CAP, 2) & + PCIEM_CAP_MAX_PAYLOAD) << 5; + if (rmps > mmps) { + /* + * The device is unable to handle root's MPS. Limit root. + * XXX: We should traverse through all the tree, applying + * it to all the devices. + */ + pcie_adjust_config(root, PCIER_DEVICE_CTL, + PCIEM_CTL_MAX_PAYLOAD, mmps, 2); + } else { + pcie_adjust_config(dev, PCIER_DEVICE_CTL, + PCIEM_CTL_MAX_PAYLOAD, rmps, 2); + } +} + static void pci_add_child_clear_aer(device_t dev, struct pci_devinfo *dinfo) { @@ -4335,6 +4374,7 @@ pci_add_child(device_t bus, struct pci_devinfo *dinfo) pci_cfg_restore(dev, dinfo); pci_print_verbose(dinfo); pci_add_resources(bus, dev, 0, 0); + pcie_setup_mps(dev); pci_child_added(dinfo->cfg.dev); if (pci_clear_aer_on_attach) From owner-dev-commits-src-all@freebsd.org Wed May 5 03:17:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EEE6062DE81; Wed, 5 May 2021 03:17:50 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZhjV6Qxnz4nw2; Wed, 5 May 2021 03:17:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CF9C21D5BA; Wed, 5 May 2021 03:17:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1453HoxL015878; Wed, 5 May 2021 03:17:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1453HoR9015877; Wed, 5 May 2021 03:17:50 GMT (envelope-from git) Date: Wed, 5 May 2021 03:17:50 GMT Message-Id: <202105050317.1453HoR9015877@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: f4ba035bca92 - main - cxgbe(4): Use ifaddr_event_ext instead of ifaddr_event for CLIP management. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4ba035bca927e21f0f88ce56915523bafd573d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 03:17:51 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=f4ba035bca927e21f0f88ce56915523bafd573d9 commit f4ba035bca927e21f0f88ce56915523bafd573d9 Author: Navdeep Parhar AuthorDate: 2021-05-01 23:53:50 +0000 Commit: Navdeep Parhar CommitDate: 2021-05-05 03:16:25 +0000 cxgbe(4): Use ifaddr_event_ext instead of ifaddr_event for CLIP management. The _ext event notification includes the address being added/removed and that gives the driver an easy way to ignore non-IPv6 addresses. Remove 'tom' from the handler's name while here, it was moved out of t4_tom a long time ago. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_clip.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/dev/cxgbe/t4_clip.c b/sys/dev/cxgbe/t4_clip.c index da7b168721ab..ad26d212315e 100644 --- a/sys/dev/cxgbe/t4_clip.c +++ b/sys/dev/cxgbe/t4_clip.c @@ -343,9 +343,13 @@ t4_destroy_clip_table(struct adapter *sc) } static void -t4_tom_ifaddr_event(void *arg __unused, struct ifnet *ifp) +t4_ifaddr_event(void *arg __unused, struct ifnet *ifp, struct ifaddr *ifa, + int event) { + if (ifa->ifa_addr->sa_family != AF_INET6) + return; + atomic_add_rel_int(&in6_ifaddr_gen, 1); taskqueue_enqueue_timeout(taskqueue_thread, &clip_task, -hz / 4); } @@ -390,15 +394,15 @@ t4_clip_modload(void) { TIMEOUT_TASK_INIT(taskqueue_thread, &clip_task, 0, t4_clip_task, NULL); - ifaddr_evhandler = EVENTHANDLER_REGISTER(ifaddr_event, - t4_tom_ifaddr_event, NULL, EVENTHANDLER_PRI_ANY); + ifaddr_evhandler = EVENTHANDLER_REGISTER(ifaddr_event_ext, + t4_ifaddr_event, NULL, EVENTHANDLER_PRI_ANY); } void t4_clip_modunload(void) { - EVENTHANDLER_DEREGISTER(ifaddr_event, ifaddr_evhandler); + EVENTHANDLER_DEREGISTER(ifaddr_event_ext, ifaddr_evhandler); taskqueue_cancel_timeout(taskqueue_thread, &clip_task, NULL); } #endif From owner-dev-commits-src-all@freebsd.org Wed May 5 03:53:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6669C62EB7F for ; Wed, 5 May 2021 03:53:15 +0000 (UTC) (envelope-from wpchu342@cde.org.tw) Received: from antispam.cde.org.tw (mail.cde.org.tw [60.248.70.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZjVL1Lwnz4qsk for ; Wed, 5 May 2021 03:53:13 +0000 (UTC) (envelope-from wpchu342@cde.org.tw) Received: from antispam.cde.org.tw (localhost [127.0.0.2] (may be forged)) by antispam.cde.org.tw with ESMTP id 1453fN8w049552 for ; Wed, 5 May 2021 11:41:23 +0800 (GMT-8) (envelope-from wpchu342@cde.org.tw) Received: from [103.156.90.40] ([103.156.90.40]) (authenticated bits=0) by antispam.cde.org.tw with ESMTPSA id 1453dPCr004393 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 5 May 2021 11:40:35 +0800 (GMT-8) (envelope-from wpchu342@cde.org.tw) Message-Id: <202105050340.1453dPCr004393@antispam.cde.org.tw> Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Description: Mail message body Subject: Mutual Benefit. To: dev-commits-src-all@freebsd.org From: "Mr. G" Date: Tue, 04 May 2021 20:40:37 -0700 Reply-To: gp4112316@gmail.com X-DNSRBL: X-MAIL: antispam.cde.org.tw 1453fN8w049552 X-Rspamd-Queue-Id: 4FZjVL1Lwnz4qsk X-Spamd-Bar: ++++++++++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of wpchu342@cde.org.tw has no SPF policy when checking 60.248.70.244) smtp.mailfrom=wpchu342@cde.org.tw X-Spamd-Result: default: False [12.40 / 15.00]; HAS_REPLYTO(0.00)[gp4112316@gmail.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MSBL_EBL(7.50)[gp4112316@gmail.com:email]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[60.248.70.244:from]; ASN(0.00)[asn:3462, ipnet:60.248.0.0/16, country:TW]; R_DKIM_NA(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[103.156.90.40:received]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(1.00)[0.999]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; FREEMAIL_REPLYTO(0.00)[gmail.com]; AUTH_NA(1.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[60.248.70.244:from:127.0.2.255]; DMARC_NA(0.00)[cde.org.tw]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; NEURAL_SPAM_LONG(1.00)[1.000]; FROM_NAME_HAS_TITLE(1.00)[mr]; R_SPF_NA(0.00)[no SPF record]; GREYLIST(0.00)[pass,body]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-Spam: Yes X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 03:53:15 -0000 Good day, I have a very important transaction I would like to carry out with you. do = write me back on: gp4112316@gmail.com for more details. Best regards, Gary Phys. From owner-dev-commits-src-all@freebsd.org Wed May 5 05:03:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0F3563014E; Wed, 5 May 2021 05:03:51 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZl3q63vLz4tGR; Wed, 5 May 2021 05:03:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C33ED1EF0E; Wed, 5 May 2021 05:03:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14553p53061628; Wed, 5 May 2021 05:03:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14553pwh061627; Wed, 5 May 2021 05:03:51 GMT (envelope-from git) Date: Wed, 5 May 2021 05:03:51 GMT Message-Id: <202105050503.14553pwh061627@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 2941198570cd - stable/13 - arcmsr(4): Fix SCSI command timeout on ARC-1886. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2941198570cde6357de80064d70bcafdbef17353 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 05:03:51 -0000 The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=2941198570cde6357de80064d70bcafdbef17353 commit 2941198570cde6357de80064d70bcafdbef17353 Author: Xin LI AuthorDate: 2021-04-21 08:03:54 +0000 Commit: Xin LI CommitDate: 2021-05-05 05:03:22 +0000 arcmsr(4): Fix SCSI command timeout on ARC-1886. Many thanks to Areca for continuing to support FreeBSD. Submitted by: 黃清隆 (cherry picked from commit 438b5532070f7c52e88f514380ee8662de1f600b) --- sys/dev/arcmsr/arcmsr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index f2217deb1ce0..f7f913de89af 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -83,6 +83,8 @@ ** 1.40.00.01 10/30/2017 Ching Huang Fixed release memory resource ** 1.50.00.00 09/30/2020 Ching Huang Added support ARC-1886, NVMe/SAS/SATA controller ** 1.50.00.01 02/26/2021 Ching Huang Fixed no action of hot plugging device on type_F adapter +** 1.50.00.02 04/16/2021 Ching Huang Fixed scsi command timeout on ARC-1886 when +** scatter-gather count large than some number ****************************************************************************************** */ @@ -140,7 +142,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1); -#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.01 2021-02-26" +#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.02 2021-04-16" #include /* ************************************************************************** @@ -1183,8 +1185,12 @@ static void arcmsr_post_srb(struct AdapterControlBlock *acb, struct CommandContr if (srb->arc_cdb_size <= 0x300) arc_cdb_size = (srb->arc_cdb_size - 1) >> 6 | 1; - else - arc_cdb_size = (((srb->arc_cdb_size + 0xff) >> 8) + 2) << 1 | 1; + else { + arc_cdb_size = ((srb->arc_cdb_size + 0xff) >> 8) + 2; + if (arc_cdb_size > 0xF) + arc_cdb_size = 0xF; + arc_cdb_size = (arc_cdb_size << 1) | 1; + } ccb_post_stamp = (srb->smid | arc_cdb_size); CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_queueport_high, 0); CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_queueport_low, ccb_post_stamp); From owner-dev-commits-src-all@freebsd.org Wed May 5 05:06:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B62A163048C; Wed, 5 May 2021 05:06:08 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZl6S4nhgz4tC9; Wed, 5 May 2021 05:06:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 974F31ECF3; Wed, 5 May 2021 05:06:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145568bx062040; Wed, 5 May 2021 05:06:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145568g6062039; Wed, 5 May 2021 05:06:08 GMT (envelope-from git) Date: Wed, 5 May 2021 05:06:08 GMT Message-Id: <202105050506.145568g6062039@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 5a37780dd84c - stable/12 - arcmsr(4): Fix SCSI command timeout on ARC-1886. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5a37780dd84c61bd9a3ad92e2dbe3f4e3116c671 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 05:06:08 -0000 The branch stable/12 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=5a37780dd84c61bd9a3ad92e2dbe3f4e3116c671 commit 5a37780dd84c61bd9a3ad92e2dbe3f4e3116c671 Author: Xin LI AuthorDate: 2021-04-21 08:03:54 +0000 Commit: Xin LI CommitDate: 2021-05-05 05:05:57 +0000 arcmsr(4): Fix SCSI command timeout on ARC-1886. Many thanks to Areca for continuing to support FreeBSD. Submitted by: 黃清隆 (cherry picked from commit 438b5532070f7c52e88f514380ee8662de1f600b) --- sys/dev/arcmsr/arcmsr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index 16fe5ee959e6..375f1f114d13 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -83,6 +83,8 @@ ** 1.40.00.01 10/30/2017 Ching Huang Fixed release memory resource ** 1.50.00.00 09/30/2020 Ching Huang Added support ARC-1886, NVMe/SAS/SATA controller ** 1.50.00.01 02/26/2021 Ching Huang Fixed no action of hot plugging device on type_F adapter +** 1.50.00.02 04/16/2021 Ching Huang Fixed scsi command timeout on ARC-1886 when +** scatter-gather count large than some number ****************************************************************************************** */ @@ -140,7 +142,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1); -#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.01 2021-02-26" +#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.02 2021-04-16" #include /* ************************************************************************** @@ -1183,8 +1185,12 @@ static void arcmsr_post_srb(struct AdapterControlBlock *acb, struct CommandContr if (srb->arc_cdb_size <= 0x300) arc_cdb_size = (srb->arc_cdb_size - 1) >> 6 | 1; - else - arc_cdb_size = (((srb->arc_cdb_size + 0xff) >> 8) + 2) << 1 | 1; + else { + arc_cdb_size = ((srb->arc_cdb_size + 0xff) >> 8) + 2; + if (arc_cdb_size > 0xF) + arc_cdb_size = 0xF; + arc_cdb_size = (arc_cdb_size << 1) | 1; + } ccb_post_stamp = (srb->smid | arc_cdb_size); CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_queueport_high, 0); CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_queueport_low, ccb_post_stamp); From owner-dev-commits-src-all@freebsd.org Wed May 5 05:17:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D65B6305DC; Wed, 5 May 2021 05:17:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZlMn1GpFz4tkf; Wed, 5 May 2021 05:17:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 19B6E1F0EC; Wed, 5 May 2021 05:17:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1455He5t075109; Wed, 5 May 2021 05:17:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1455HeE1075108; Wed, 5 May 2021 05:17:40 GMT (envelope-from git) Date: Wed, 5 May 2021 05:17:40 GMT Message-Id: <202105050517.1455HeE1075108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 32ba69e6a320 - stable/11 - arcmsr(4): Fix SCSI command timeout on ARC-1886. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 32ba69e6a320eabfb0b6afe80911481470c36dc5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 05:17:41 -0000 The branch stable/11 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=32ba69e6a320eabfb0b6afe80911481470c36dc5 commit 32ba69e6a320eabfb0b6afe80911481470c36dc5 Author: Xin LI AuthorDate: 2021-04-21 08:03:54 +0000 Commit: Xin LI CommitDate: 2021-05-05 05:17:31 +0000 arcmsr(4): Fix SCSI command timeout on ARC-1886. Many thanks to Areca for continuing to support FreeBSD. Submitted by: 黃清隆 (cherry picked from commit 438b5532070f7c52e88f514380ee8662de1f600b) --- sys/dev/arcmsr/arcmsr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index c2027eb8e987..bc9ddffe4960 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -81,6 +81,8 @@ ** 1.40.00.01 10/30/2017 Ching Huang Fixed release memory resource ** 1.50.00.00 09/30/2020 Ching Huang Added support ARC-1886, NVMe/SAS/SATA controller ** 1.50.00.01 02/26/2021 Ching Huang Fixed no action of hot plugging device on type_F adapter +** 1.50.00.02 04/16/2021 Ching Huang Fixed scsi command timeout on ARC-1886 when +** scatter-gather count large than some number ****************************************************************************************** */ @@ -138,7 +140,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1); -#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.01 2021-02-26" +#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.02 2021-04-16" #include /* ************************************************************************** @@ -1181,8 +1183,12 @@ static void arcmsr_post_srb(struct AdapterControlBlock *acb, struct CommandContr if (srb->arc_cdb_size <= 0x300) arc_cdb_size = (srb->arc_cdb_size - 1) >> 6 | 1; - else - arc_cdb_size = (((srb->arc_cdb_size + 0xff) >> 8) + 2) << 1 | 1; + else { + arc_cdb_size = ((srb->arc_cdb_size + 0xff) >> 8) + 2; + if (arc_cdb_size > 0xF) + arc_cdb_size = 0xF; + arc_cdb_size = (arc_cdb_size << 1) | 1; + } ccb_post_stamp = (srb->smid | arc_cdb_size); CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_queueport_high, 0); CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_queueport_low, ccb_post_stamp); From owner-dev-commits-src-all@freebsd.org Wed May 5 06:35:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCDEE63209C; Wed, 5 May 2021 06:35:26 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZn5V5Rplz3DH9; Wed, 5 May 2021 06:35:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A395220314; Wed, 5 May 2021 06:35:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1456ZQZT081453; Wed, 5 May 2021 06:35:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1456ZQ2E081452; Wed, 5 May 2021 06:35:26 GMT (envelope-from git) Date: Wed, 5 May 2021 06:35:26 GMT Message-Id: <202105050635.1456ZQ2E081452@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9e0ba9536b7c - main - param.h: Document __FreeBSD_version better MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e0ba9536b7cbba0e81e561458e95aafb65ee485 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 06:35:26 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9e0ba9536b7cbba0e81e561458e95aafb65ee485 commit 9e0ba9536b7cbba0e81e561458e95aafb65ee485 Author: Warner Losh AuthorDate: 2021-04-22 16:44:15 +0000 Commit: Warner Losh CommitDate: 2021-05-05 06:33:56 +0000 param.h: Document __FreeBSD_version better Document what __FreeBSD_version means a bit better by documenting the sorts of events it should be bumped for. Also include a handy shorthand for what it means. Add a some advice for how frequently to change this as well. Added a note about the approved way to parse this from the param.h file, though that was not in the review. All in-tree users have been updated to this method prior to this commit. Move and reword the comment that was on the same line. Suggestions by: greg@unrelenting, arch@ Reviewed by: rgrimes@ (earlier version). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29850 --- sys/sys/param.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 92161cae13ae..a1ebced4b9a1 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -54,13 +54,29 @@ * * documentation/content/en/books/porters-handbook/versions/_index.adoc * - * scheme is: Rxx + * Encoding: Rxx * 'R' is in the range 0 to 4 if this is a release branch or * X.0-CURRENT before releng/X.0 is created, otherwise 'R' is * in the range 5 to 9. + * Short hand: MMmmXXX + * + * __FreeBSD_version is bumped every time there's a change in the base system + * that's noteworthy. A noteworthy change is any change which changes the + * kernel's KBI in -CURRENT, one that changes some detail about the system that + * external software (or the ports system) would want to know about, one that + * adds a system call, one that adds or deletes a shipped library, a secuirty + * fix, or similar change not specifically noted here. Bumps should be limited + * to one per day / a couple per week except for security fixes. + * + * The approved way to obtain this from a shell script is: + * awk '/^\#define[[:space:]]*__FreeBSD_version/ {print $3}' + * Other methods to parse this file may work, but are not guaranteed against + * future changes. The above script works back to FreeBSD 3.x when this macro + * was introduced. This number is propigated to other places needing it that + * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400013 /* Master, propagated to newvers */ +#define __FreeBSD_version 1400013 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Wed May 5 06:52:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F5276322A5; Wed, 5 May 2021 06:52:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZnSg2YqGz3F0s; Wed, 5 May 2021 06:52:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4ABE72042C; Wed, 5 May 2021 06:52:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1456q3LM006958; Wed, 5 May 2021 06:52:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1456q31G006957; Wed, 5 May 2021 06:52:03 GMT (envelope-from git) Date: Wed, 5 May 2021 06:52:03 GMT Message-Id: <202105050652.1456q31G006957@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 122a8c7eb1ba - main - param.h: Fix typos MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 122a8c7eb1baeed7d6d2e213dcfc7e2872bfe878 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 06:52:03 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=122a8c7eb1baeed7d6d2e213dcfc7e2872bfe878 commit 122a8c7eb1baeed7d6d2e213dcfc7e2872bfe878 Author: Warner Losh AuthorDate: 2021-05-05 06:50:35 +0000 Commit: Warner Losh CommitDate: 2021-05-05 06:50:35 +0000 param.h: Fix typos Submitted by: rpokala@ Sponsored by: Netflix --- sys/sys/param.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index a1ebced4b9a1..68808f3e2185 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -64,7 +64,7 @@ * that's noteworthy. A noteworthy change is any change which changes the * kernel's KBI in -CURRENT, one that changes some detail about the system that * external software (or the ports system) would want to know about, one that - * adds a system call, one that adds or deletes a shipped library, a secuirty + * adds a system call, one that adds or deletes a shipped library, a security * fix, or similar change not specifically noted here. Bumps should be limited * to one per day / a couple per week except for security fixes. * @@ -72,7 +72,7 @@ * awk '/^\#define[[:space:]]*__FreeBSD_version/ {print $3}' * Other methods to parse this file may work, but are not guaranteed against * future changes. The above script works back to FreeBSD 3.x when this macro - * was introduced. This number is propigated to other places needing it that + * was introduced. This number is propagated to other places needing it that * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version From owner-dev-commits-src-all@freebsd.org Wed May 5 07:23:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5393632ADF; Wed, 5 May 2021 07:23:58 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZp9V6832z3G5r; Wed, 5 May 2021 07:23:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C5F4C20A46; Wed, 5 May 2021 07:23:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1457Nwgm048285; Wed, 5 May 2021 07:23:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1457Nwpw048284; Wed, 5 May 2021 07:23:58 GMT (envelope-from git) Date: Wed, 5 May 2021 07:23:58 GMT Message-Id: <202105050723.1457Nwpw048284@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 2abb724cad0f - stable/13 - sh: improve emacs mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2abb724cad0faac54dcab7155c684afa724cb3d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 07:23:59 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=2abb724cad0faac54dcab7155c684afa724cb3d5 commit 2abb724cad0faac54dcab7155c684afa724cb3d5 Author: Baptiste Daroussin AuthorDate: 2021-03-30 09:37:29 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:17:09 +0000 sh: improve emacs mode In emacs mode, force ^R to backware search the history This behaviour is the default in emacs mode for most of the other shells Note: Note that this can still be overridden via $EDITRC, ~/.editrc or a bind command after set -o emacs. Approved by: jilles Reviewed by: jilles, arichardson, pstef Differential Revision: https://reviews.freebsd.org/D29494 (cherry picked from commit 660045fb5360d328da199ae78c89d5cc15b6d1ca) --- bin/sh/histedit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 4c596c82257e..e59967b255b1 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -137,8 +137,10 @@ bad: if (el) { if (Vflag) el_set(el, EL_EDITOR, "vi"); - else if (Eflag) + else if (Eflag) { el_set(el, EL_EDITOR, "emacs"); + el_set(el, EL_BIND, "^R", "em-inc-search-prev", NULL); + } el_set(el, EL_BIND, "^I", "sh-complete", NULL); el_source(el, NULL); } From owner-dev-commits-src-all@freebsd.org Wed May 5 07:24:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20B3C632CE8; Wed, 5 May 2021 07:24:00 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZp9X0DTPz3G3K; Wed, 5 May 2021 07:24:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E95EE20A47; Wed, 5 May 2021 07:23:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1457Nxce048306; Wed, 5 May 2021 07:23:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1457NxGs048305; Wed, 5 May 2021 07:23:59 GMT (envelope-from git) Date: Wed, 5 May 2021 07:23:59 GMT Message-Id: <202105050723.1457NxGs048305@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 3c5d1c587c59 - stable/13 - Make pkg(7) use environment variables specified in pkg.conf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3c5d1c587c59e58a3b9f85b93ecee7156c219972 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 07:24:00 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=3c5d1c587c59e58a3b9f85b93ecee7156c219972 commit 3c5d1c587c59e58a3b9f85b93ecee7156c219972 Author: Moritz Schmitt AuthorDate: 2021-04-27 01:59:12 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:17:14 +0000 Make pkg(7) use environment variables specified in pkg.conf Modify /usr/sbin/pkg to use environment variables specified in pkg.conf. This allows control over underlying libraries like fetch(3), which can be configured by setting HTTP_PROXY. Differential Revision: https://reviews.freebsd.org/D29820 (cherry picked from commit e869d3c60147bbb226b5ad97d2ef73391aeebafa) --- usr.sbin/pkg/config.c | 29 +++++++++++++++++++++++++---- usr.sbin/pkg/config.h | 2 ++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 3a5434639d6d..2bcfd9c405f3 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "config.h" @@ -136,6 +137,15 @@ static struct config_entry c[] = { NULL, false, false + }, + [PKG_ENV] = { + PKG_CONFIG_OBJECT, + "PKG_ENV", + NULL, + NULL, + NULL, + false, + false, } }; @@ -207,11 +217,11 @@ static void config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) { struct sbuf *buf = sbuf_new_auto(); - const ucl_object_t *cur, *seq; - ucl_object_iter_t it = NULL, itseq = NULL; + const ucl_object_t *cur, *seq, *tmp; + ucl_object_iter_t it = NULL, itseq = NULL, it_obj = NULL; struct config_entry *temp_config; struct config_value *cv; - const char *key; + const char *key, *evkey; int i; size_t j; @@ -226,7 +236,7 @@ config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) if (conftype == CONFFILE_PKG) { for (j = 0; j < strlen(key); ++j) - sbuf_putc(buf, key[j]); + sbuf_putc(buf, toupper(key[j])); sbuf_finish(buf); } else if (conftype == CONFFILE_REPO) { if (strcasecmp(key, "url") == 0) @@ -287,6 +297,17 @@ config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) temp_config[i].value = strdup(ucl_object_toboolean(cur) ? "yes" : "no"); break; + case PKG_CONFIG_OBJECT: + if (strcmp(c[i].key, "PKG_ENV") == 0) { + while ((tmp = + ucl_iterate_object(cur, &it_obj, true))) { + evkey = ucl_object_key(tmp); + if (evkey != NULL && *evkey != '\0') { + setenv(evkey, ucl_object_tostring_forced(tmp), 1); + } + } + } + break; default: /* Normal string value. */ temp_config[i].value = strdup(ucl_object_tostring(cur)); diff --git a/usr.sbin/pkg/config.h b/usr.sbin/pkg/config.h index afcd728abd92..87efd3c29e94 100644 --- a/usr.sbin/pkg/config.h +++ b/usr.sbin/pkg/config.h @@ -44,6 +44,7 @@ typedef enum { FINGERPRINTS, REPOS_DIR, PUBKEY, + PKG_ENV, CONFIG_SIZE } pkg_config_key; @@ -51,6 +52,7 @@ typedef enum { PKG_CONFIG_STRING=0, PKG_CONFIG_BOOL, PKG_CONFIG_LIST, + PKG_CONFIG_OBJECT } pkg_config_t; typedef enum { From owner-dev-commits-src-all@freebsd.org Wed May 5 07:24:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D92663296D; Wed, 5 May 2021 07:24:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZp9Y1fHtz3G3N; Wed, 5 May 2021 07:24:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1869420E14; Wed, 5 May 2021 07:24:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1457O1a7048327; Wed, 5 May 2021 07:24:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1457O0YM048326; Wed, 5 May 2021 07:24:00 GMT (envelope-from git) Date: Wed, 5 May 2021 07:24:00 GMT Message-Id: <202105050724.1457O0YM048326@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 2cd8c2e5959d - stable/13 - libucl: vendor import snapshort 20210314 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2cd8c2e5959de8c72c3e75d80afc4e01bbb320a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 07:24:01 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=2cd8c2e5959de8c72c3e75d80afc4e01bbb320a8 commit 2cd8c2e5959de8c72c3e75d80afc4e01bbb320a8 Author: Baptiste Daroussin AuthorDate: 2021-03-22 14:13:02 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:18:44 +0000 libucl: vendor import snapshort 20210314 (cherry picked from commit a0409676120c1e558d0ade943019934e0f15118d) --- contrib/libucl/CMakeLists.txt | 105 ++- contrib/libucl/ChangeLog.md | 38 +- contrib/libucl/README.md | 64 +- contrib/libucl/configure.ac | 8 +- contrib/libucl/doc/api.md | 17 +- contrib/libucl/doc/libucl.3 | 26 +- contrib/libucl/doc/lua_api.md | 4 +- contrib/libucl/include/lua_ucl.h | 20 +- contrib/libucl/include/ucl++.h | 191 ++++- contrib/libucl/include/ucl.h | 191 ++++- contrib/libucl/klib/kvec.h | 78 ++- contrib/libucl/lua/lua_ucl.c | 450 ++++++++++-- contrib/libucl/python/MANIFEST.in | 5 + contrib/libucl/python/setup.py | 42 +- contrib/libucl/python/src/uclmodule.c | 3 +- contrib/libucl/python/tests/test_example.py | 59 ++ contrib/libucl/python/tests/test_load.py | 17 +- contrib/libucl/src/mum.h | 8 +- contrib/libucl/src/ucl_chartable.h | 4 +- contrib/libucl/src/ucl_emitter.c | 12 +- contrib/libucl/src/ucl_emitter_utils.c | 57 +- contrib/libucl/src/ucl_hash.c | 218 +++++- contrib/libucl/src/ucl_hash.h | 20 +- contrib/libucl/src/ucl_internal.h | 105 ++- contrib/libucl/src/ucl_msgpack.c | 82 ++- contrib/libucl/src/ucl_parser.c | 552 ++++++++++++--- contrib/libucl/src/ucl_schema.c | 29 +- contrib/libucl/src/ucl_util.c | 780 ++++++++++++++++----- contrib/libucl/tests/basic.test | 2 +- contrib/libucl/tests/basic/13.in | 2 +- contrib/libucl/tests/basic/20.in | 2 - contrib/libucl/tests/basic/20.res | 5 - contrib/libucl/tests/basic/21.in | 2 - contrib/libucl/tests/basic/21.res | 10 - contrib/libucl/tests/basic/9.in | 2 +- contrib/libucl/tests/basic/9.res | 8 +- contrib/libucl/tests/basic/squote.in | 8 + contrib/libucl/tests/basic/squote.res | 7 + .../libucl/tests/fuzzers/ucl_add_string_fuzzer.c | 25 + contrib/libucl/tests/fuzzers/ucl_msgpack_fuzzer.c | 29 + contrib/libucl/tests/generate.test | 2 +- contrib/libucl/tests/run_tests.sh | 4 +- contrib/libucl/tests/streamline.test | 2 +- contrib/libucl/tests/test_basic.c | 11 +- contrib/libucl/tests/test_generate.c | 15 +- contrib/libucl/tests/test_msgpack.c | 1 + contrib/libucl/utils/CMakeLists.txt | 12 + contrib/libucl/utils/objdump.c | 17 +- contrib/libucl/utils/ucl-tool.c | 100 +-- 49 files changed, 2820 insertions(+), 631 deletions(-) diff --git a/contrib/libucl/CMakeLists.txt b/contrib/libucl/CMakeLists.txt index 7b55faf8243f..5fe772a30f88 100644 --- a/contrib/libucl/CMakeLists.txt +++ b/contrib/libucl/CMakeLists.txt @@ -9,13 +9,16 @@ SET(LIBUCL_VERSION "${LIBUCL_VERSION_MAJOR}.${LIBUCL_VERSION_MINOR}.${LIBUCL_VERSION_PATCH}") INCLUDE(CheckCCompilerFlag) +INCLUDE(CheckCSourceCompiles) INCLUDE(FindOpenSSL) +INCLUDE(GNUInstallDirs) OPTION(ENABLE_URL_INCLUDE "Enable urls in ucl includes (requires libcurl or libfetch) [default: OFF]" OFF) OPTION(ENABLE_URL_SIGN "Enable signatures check in ucl includes (requires openssl) [default: OFF]" OFF) OPTION(BUILD_SHARED_LIBS "Build Shared Libraries [default: OFF]" OFF) OPTION(ENABLE_LUA "Enable lua support [default: OFF]" OFF) OPTION(ENABLE_LUAJIT "Enable luajit support [default: OFF]" OFF) +OPTION(ENABLE_UTILS "Enable building utility binaries [default: OFF]" OFF) # Find lua installation MACRO(FindLua) @@ -150,40 +153,47 @@ IF(ENABLE_URL_INCLUDE MATCHES "ON") DOC "Path to libfetch header") ELSE(LIBFETCH_LIBRARY) # Try to find libcurl - ProcessPackage(CURL libcurl) + FIND_PACKAGE(CURL) IF(NOT CURL_FOUND) MESSAGE(WARNING "Neither libcurl nor libfetch were found, no support of URL includes in configuration") ENDIF(NOT CURL_FOUND) ENDIF(LIBFETCH_LIBRARY) ENDIF(ENABLE_URL_INCLUDE MATCHES "ON") +set(SYNC_BUILTINS_TEST_SOURCE [====[ +int main() +{ + unsigned long val; + + __sync_bool_compare_and_swap(&val, 0, 1); + __sync_add_and_fetch(&val, 1); + __sync_fetch_and_add(&val, 0); + __sync_sub_and_fetch(&val, 1); + + return 0; +} +]====]) + +CHECK_C_SOURCE_COMPILES("${SYNC_BUILTINS_TEST_SOURCE}" HAVE_ATOMIC_BUILTINS) +IF(NOT HAVE_ATOMIC_BUILTINS) + MESSAGE(WARNING "Libucl references could be thread-unsafe because atomic builtins are missing") +ENDIF(NOT HAVE_ATOMIC_BUILTINS) + SET(CMAKE_C_WARN_FLAGS "") -CHECK_C_COMPILER_FLAG(-Wall SUPPORT_WALL) CHECK_C_COMPILER_FLAG(-W SUPPORT_W) -CHECK_C_COMPILER_FLAG(-Wno-unused-parameter SUPPORT_WPARAM) CHECK_C_COMPILER_FLAG(-Wno-pointer-sign SUPPORT_WPOINTER_SIGN) -CHECK_C_COMPILER_FLAG(-Wstrict-prototypes SUPPORT_WSTRICT_PROTOTYPES) -IF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro) - CHECK_C_COMPILER_FLAG("-std=c99" SUPPORT_STD_FLAG) -ENDIF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro) +CHECK_C_COMPILER_FLAG(-Wno-unused-parameter SUPPORT_WUNUSED_PARAMETER) IF(SUPPORT_W) - SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -W") + SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -W") ENDIF(SUPPORT_W) -IF(SUPPORT_WALL) - SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wall") -ENDIF(SUPPORT_WALL) -IF(SUPPORT_WPARAM) - SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-unused-parameter") -ENDIF(SUPPORT_WPARAM) IF(SUPPORT_WPOINTER_SIGN) SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-pointer-sign") ENDIF(SUPPORT_WPOINTER_SIGN) -IF(SUPPORT_WSTRICT_PROTOTYPES) - SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wstrict-prototypes") -ENDIF(SUPPORT_WSTRICT_PROTOTYPES) -IF(SUPPORT_STD_FLAG) - SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -std=c99") -ENDIF(SUPPORT_STD_FLAG) +IF(SUPPORT_WUNUSED_PARAMETER) + SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-unused-parameter") +ENDIF(SUPPORT_WUNUSED_PARAMETER) + +SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_WARN_FLAGS}" ) IF(ENABLE_URL_SIGN MATCHES "ON") IF(OPENSSL_FOUND) @@ -192,10 +202,19 @@ IF(ENABLE_URL_SIGN MATCHES "ON") ENDIF(OPENSSL_FOUND) ENDIF(ENABLE_URL_SIGN MATCHES "ON") -INCLUDE_DIRECTORIES("src") -INCLUDE_DIRECTORIES("include") -INCLUDE_DIRECTORIES("uthash") -INCLUDE_DIRECTORIES("klib") +SET(UCL_COMPILE_DEFS) +IF(HAVE_FETCH_H) + LIST(APPEND UCL_COMPILE_DEFS -DHAVE_FETCH_H=1) +ENDIF(HAVE_FETCH_H) +IF(CURL_FOUND) + LIST(APPEND UCL_COMPILE_DEFS -DCURL_FOUND=1) +ENDIF(CURL_FOUND) +IF(HAVE_OPENSSL) + LIST(APPEND UCL_COMPILE_DEFS -DHAVE_OPENSSL=1) +ENDIF(HAVE_OPENSSL) +IF(HAVE_ATOMIC_BUILTINS) + LIST(APPEND UCL_COMPILE_DEFS -DHAVE_ATOMIC_BUILTINS=1) +ENDIF(HAVE_ATOMIC_BUILTINS) SET(UCLSRC src/ucl_util.c src/ucl_parser.c @@ -207,13 +226,27 @@ SET(UCLSRC src/ucl_util.c src/ucl_msgpack.c src/ucl_sexp.c) +SET(UCLHDR include/ucl.h + include/ucl++.h) SET (LIB_TYPE STATIC) IF (BUILD_SHARED_LIBS) SET (LIB_TYPE SHARED) ENDIF (BUILD_SHARED_LIBS) ADD_LIBRARY(ucl ${LIB_TYPE} ${UCLSRC}) +ADD_LIBRARY(ucl::ucl ALIAS ucl) SET_TARGET_PROPERTIES(ucl PROPERTIES VERSION ${LIBUCL_VERSION} SOVERSION ${LIBUCL_VERSION_MAJOR}) +TARGET_INCLUDE_DIRECTORIES(ucl + PUBLIC + include + PRIVATE + src + uthash + klib) +TARGET_COMPILE_DEFINITIONS(ucl + PRIVATE + ${UCL_COMPILE_DEFS} +) IF(ENABLE_LUA MATCHES "ON") IF(ENABLE_LUAJIT MATCHES "ON") @@ -236,13 +269,20 @@ IF(ENABLE_LUA MATCHES "ON") ENDIF(ENABLE_LUAJIT MATCHES "ON") SET(UCL_LUA_SRC lua/lua_ucl.c) ADD_LIBRARY(lua-ucl ${LIB_TYPE} ${UCL_LUA_SRC}) + ADD_LIBRARY(ucl::lua ALIAS lua-ucl) IF(ENABLE_LUAJIT MATCHES "ON") TARGET_LINK_LIBRARIES(lua-ucl "${LUAJIT_LIBRARY}") ELSE(ENABLE_LUAJIT MATCHES "ON") TARGET_LINK_LIBRARIES(lua-ucl "${LUA_LIBRARY}") ENDIF(ENABLE_LUAJIT MATCHES "ON") TARGET_LINK_LIBRARIES(lua-ucl ucl) - SET_TARGET_PROPERTIES(lua-ucl PROPERTIES VERSION ${LIBUCL_VERSION} SOVERSION ${LIBUCL_VERSION_MAJOR}) + TARGET_INCLUDE_DIRECTORIES(lua-ucl PUBLIC include PRIVATE src uthash) + SET_TARGET_PROPERTIES(lua-ucl PROPERTIES + VERSION ${LIBUCL_VERSION} + SOVERSION ${LIBUCL_VERSION_MAJOR} + PUBLIC_HEADER include/lua_ucl.h) + INSTALL(TARGETS lua-ucl DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ENDIF() IF(HAVE_FETCH_H) @@ -257,3 +297,18 @@ IF(ENABLE_URL_SIGN MATCHES "ON") TARGET_LINK_LIBRARIES(ucl ${OPENSSL_LIBRARIES}) ENDIF(OPENSSL_FOUND) ENDIF(ENABLE_URL_SIGN MATCHES "ON") + +IF(UNIX) + TARGET_LINK_LIBRARIES(ucl -lm) +ENDIF(UNIX) + +SET_TARGET_PROPERTIES(ucl PROPERTIES + PUBLIC_HEADER "${UCLHDR}") + +INSTALL(TARGETS ucl DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +IF(ENABLE_UTILS MATCHES "ON") + ADD_SUBDIRECTORY(utils) +ENDIF() + diff --git a/contrib/libucl/ChangeLog.md b/contrib/libucl/ChangeLog.md index e4c1263bccb7..cba29aa9a7b5 100644 --- a/contrib/libucl/ChangeLog.md +++ b/contrib/libucl/ChangeLog.md @@ -64,4 +64,40 @@ **Incompatible changes**: -- `ucl_object_emit_full` now accepts additional argument `comments` that could be used to emit comments with UCL output \ No newline at end of file +- `ucl_object_emit_full` now accepts additional argument `comments` that could be used to emit comments with UCL output + +### Libucl 0.8.1 + +- Create ucl_parser_add_file_full() to be able to specify merge mode and parser type (by Allan Jude) +- C++ wrapper improvements (by @ftilde) +- C++ wrapper: add convenience method at() and lookup() (by Yonghee Kim) +- C++ wrapper: add assignment operator to Ucl class (by Yonghee Kim) +- C++ wrapper: support variables in parser (by Yonghee Kim) +- C++ wrapper: refactoring C++ interface (by Yonghee Kim): + - use auto variables (if possible) + - remove dangling expressions + - use std::set::emplace instead of std::set::insert + - not use std::move in return statement; considering copy elision +- C++ wrapper: fix compilation error and warnings (by Zhe Wang) +- C++ wrapper: fix iteration over objects in which the first value is `false` (by Zhe Wang) +- C++ wrapper: Macro helper functions (by Chris Meacham) +- C++ wrapper: Changing the duplicate strategy in the C++ API (by Chris Meacham) +- C++ wrapper: Added access functions for the size of a UCL_ARRAY (by Chris Meacham) +- Fix caseless comparison +- Fix include when EPERM is issued +- Fix Windows build +- Allow to reserve space in arrays and hashes +- Fix bug with including of empty files +- Move to mum_hash from xxhash +- Fix msgpack on non-x86 +- python: Add support to Python 3 (by Denis Volpato Martins) +- python: Add support for Python 2.6 tests (by Denis Volpato Martins) +- python: Implement validation function and tests (by Denis Volpato Martins) +- python: Added UCL_NULL handling and tests (by Denis Volpato Martins) +- Fix schema validation for patternProperties with object data (by Denis Volpato Martins) +- Remove the dependency on NBBY, add missing include (by Ed Schouten) +- Allow to emit msgpack from Lua +- Performance improvements in Lua API +- Allow to pass opaque objects in Lua API for transparent C passthrough +- Various bugs fixed +- Couple of memory leaks plugged \ No newline at end of file diff --git a/contrib/libucl/README.md b/contrib/libucl/README.md index 44983c57d643..53d8a651d73b 100644 --- a/contrib/libucl/README.md +++ b/contrib/libucl/README.md @@ -1,6 +1,6 @@ # LIBUCL -[![Build Status](https://travis-ci.org/vstakhov/libucl.svg?branch=master)](https://travis-ci.org/vstakhov/libucl) +[![CircleCI](https://circleci.com/gh/vstakhov/libucl.svg?style=svg)](https://circleci.com/gh/vstakhov/libucl) [![Coverity](https://scan.coverity.com/projects/4138/badge.svg)](https://scan.coverity.com/projects/4138) [![Coverage Status](https://coveralls.io/repos/github/vstakhov/libucl/badge.svg?branch=master)](https://coveralls.io/github/vstakhov/libucl?branch=master) @@ -18,6 +18,7 @@ - [Macros support](#macros-support) - [Variables support](#variables-support) - [Multiline strings](#multiline-strings) + - [Single quoted strings](#single-quoted-strings) - [Emitter](#emitter) - [Validation](#validation) - [Performance](#performance) @@ -65,19 +66,25 @@ section { ```json { "param": "value", - "param1": "value1", - "flag": true, - "subsection": { - "host": [ - { - "host": "hostname", - "port": 900 - }, - { - "host": "hostname", - "port": 901 + "section": { + "param": "value", + "param1": "value1", + "flag": true, + "number": 10000, + "time": "0.2s", + "string": "something", + "subsection": { + "host": [ + { + "host": "hostname", + "port": 900 + }, + { + "host": "hostname", + "port": 901 + } + ] } - ] } } ``` @@ -288,7 +295,22 @@ as following: By default, the priority of top-level object is set to zero (lowest priority). Currently, you can define up to 16 priorities (from 0 to 15). Includes with bigger priorities will -rewrite keys from the objects with lower priorities as specified by the policy. +rewrite keys from the objects with lower priorities as specified by the policy. The priority +of the top-level or any other object can be changed with the `.priority` macro, which has no +options and takes the new priority: + +``` +# Default priority: 0. +foo = 6 +.priority 5 +# The following will have priority 5. +bar = 6 +baz = 7 +# The following will be included with a priority of 3, 5, and 6 respectively. +.include(priority=3) "path.conf" +.include(priority=5) "equivalent-path.conf" +.include(priority=6) "highpriority-path.conf" +``` ### Variables support @@ -333,9 +355,21 @@ text EOD ``` +### Single quoted strings + +It is possible to use single quoted strings to simplify escaping rules. All values passed in single quoted strings are *NOT* escaped, with two exceptions: a single `'` character just before `\` character, and a newline character just after `\` character that is ignored. + +``` +key = 'value'; # Read as value +key = 'value\n\'; # Read as value\n\ +key = 'value\''; # Read as value' +key = 'value\ +bla'; # Read as valuebla +``` + ## Emitter -Each UCL object can be serialized to one of the three supported formats: +Each UCL object can be serialized to one of the four supported formats: * `JSON` - canonic json notation (with spaces indented structure); * `Compacted JSON` - compact json notation (without spaces or newlines); diff --git a/contrib/libucl/configure.ac b/contrib/libucl/configure.ac index 6457268854ac..731b7113e689 100644 --- a/contrib/libucl/configure.ac +++ b/contrib/libucl/configure.ac @@ -1,7 +1,7 @@ m4_define([maj_ver], [0]) m4_define([med_ver], [8]) -m4_define([min_ver], [0]) -m4_define([so_version], [6:0:0]) +m4_define([min_ver], [1]) +m4_define([so_version], [6:0:1]) m4_define([ucl_version], [maj_ver.med_ver.min_ver]) AC_INIT([libucl],[ucl_version],[https://github.com/vstakhov/libucl],[libucl]) @@ -73,11 +73,11 @@ AC_ARG_ENABLE([utils], AM_CONDITIONAL([UTILS], [test x$utils = xtrue]) AS_IF([test "x$enable_signatures" = "xyes"], [ - AC_SEARCH_LIBS([EVP_MD_CTX_create], [crypto], [ + AC_SEARCH_LIBS([CRYPTO_new_ex_data], [crypto], [ AC_DEFINE(HAVE_OPENSSL, 1, [Define to 1 if you have the 'crypto' library (-lcrypto).]) LIBCRYPTO_LIB="-lcrypto" LIBS_EXTRA="${LIBS_EXTRA} -lcrypto" - ], [AC_MSG_ERROR([unable to find the EVP_MD_CTX_create() function])]) + ], [AC_MSG_ERROR([unable to find the CRYPTO_new_ex_data() function])]) ]) AC_SUBST(LIBCRYPTO_LIB) AC_PATH_PROG(PANDOC, pandoc, [/non/existent]) diff --git a/contrib/libucl/doc/api.md b/contrib/libucl/doc/api.md index 75b954bb302c..a0d33c0e68a9 100644 --- a/contrib/libucl/doc/api.md +++ b/contrib/libucl/doc/api.md @@ -243,7 +243,7 @@ return ret; # Emitting functions -Libucl can transform UCL objects to a number of tectual formats: +Libucl can transform UCL objects to a number of textual formats: - configuration (`UCL_EMIT_CONFIG`) - nginx like human readable configuration file where implicit arrays are transformed to the duplicate keys - compact json: `UCL_EMIT_JSON_COMPACT` - single line valid json without spaces @@ -349,7 +349,7 @@ This object should be released by caller. Libucl provides the functions similar to inverse conversion functions called with the specific C type: - `ucl_object_fromint` - converts `int64_t` to UCL object - `ucl_object_fromdouble` - converts `double` to UCL object -- `ucl_object_fromboolean` - converts `bool` to UCL object +- `ucl_object_frombool` - converts `bool` to UCL object - `ucl_object_fromstring` - converts `const char *` to UCL object (this string should be NULL terminated) - `ucl_object_fromlstring` - converts `const char *` and `size_t` len to UCL object (string does not need to be NULL terminated) @@ -432,7 +432,8 @@ UCL defines the following functions to manage safe iterators: - `ucl_object_iterate_new` - creates new safe iterator - `ucl_object_iterate_reset` - resets iterator to a new object -- `ucl_object_iterate_safe` - safely iterate the object inside iterator +- `ucl_object_iterate_safe` - safely iterate the object inside iterator. Note: function may allocate and free memory during its operation. Therefore it returns `NULL` either while trying to access item after the last one or when exception (such as memory allocation failure) happens. +- `ucl_object_iter_chk_excpn` - check if the last call to `ucl_object_iterate_safe` ended up in unrecoverable exception (e.g. `ENOMEM`). - `ucl_object_iterate_free` - free memory associated with the safe iterator Please note that unlike unsafe iterators, safe iterators *must* be explicitly initialized and freed. @@ -447,6 +448,11 @@ it = ucl_object_iterate_new (obj); while ((cur = ucl_object_iterate_safe (it, true)) != NULL) { /* Do something */ } +/* Check error condition */ +if (ucl_object_iter_chk_excpn (it)) { + ucl_object_iterate_free (it); + exit (1); +} /* Switch to another object */ it = ucl_object_iterate_reset (it, another_obj); @@ -454,6 +460,11 @@ it = ucl_object_iterate_reset (it, another_obj); while ((cur = ucl_object_iterate_safe (it, true)) != NULL) { /* Do something else */ } +/* Check error condition */ +if (ucl_object_iter_chk_excpn (it)) { + ucl_object_iterate_free (it); + exit (1); +} ucl_object_iterate_free (it); ~~~ diff --git a/contrib/libucl/doc/libucl.3 b/contrib/libucl/doc/libucl.3 index ec5046325700..b5fef09f7691 100644 --- a/contrib/libucl/doc/libucl.3 +++ b/contrib/libucl/doc/libucl.3 @@ -612,15 +612,23 @@ Iteration\ without\ expansion: .PP UCL defines the following functions to manage safe iterators: .IP \[bu] 2 -\f[C]ucl_object_iterate_new\f[] \- creates new safe iterator +\f[C]ucl_object_iterate_new\f[] \- creates new safe iterator. .IP \[bu] 2 -\f[C]ucl_object_iterate_reset\f[] \- resets iterator to a new object +\f[C]ucl_object_iterate_reset\f[] \- resets iterator to a new object. .IP \[bu] 2 \f[C]ucl_object_iterate_safe\f[] \- safely iterate the object inside -iterator +iterator. +Note: function may allocate and free memory during its operation. +Therefore it returns \f[C]NULL\f[] either while trying to access item +after the last one or when exception (such as memory allocation +failure) happens. +.IP \[bu] 2 +\f[C]ucl_object_iter_chk_excpn\f[] \- check if the last call to +\f[C]ucl_object_iterate_safe\f[] ended up in unrecoverable exception +(e.g. \f[C]ENOMEM\f[]). .IP \[bu] 2 \f[C]ucl_object_iterate_free\f[] \- free memory associated with the safe -iterator +iterator. .PP Please note that unlike unsafe iterators, safe iterators \f[I]must\f[] be explicitly initialized and freed. @@ -637,6 +645,11 @@ it\ =\ ucl_object_iterate_new\ (obj); while\ ((cur\ =\ ucl_object_iterate_safe\ (it,\ true))\ !=\ NULL)\ { \ \ \ \ /*\ Do\ something\ */ } +/*\ Check\ error\ condition\ */ +if\ (ucl_object_iter_chk_excpn\ (it))\ { +\ \ \ \ ucl_object_iterate_free\ (it); +\ \ \ \ exit\ (1); +} /*\ Switch\ to\ another\ object\ */ it\ =\ ucl_object_iterate_reset\ (it,\ another_obj); @@ -644,6 +657,11 @@ it\ =\ ucl_object_iterate_reset\ (it,\ another_obj); while\ ((cur\ =\ ucl_object_iterate_safe\ (it,\ true))\ !=\ NULL)\ { \ \ \ \ /*\ Do\ something\ else\ */ } +/*\ Check\ error\ condition\ */ +if\ (ucl_object_iter_chk_excpn\ (it))\ { +\ \ \ \ ucl_object_iterate_free\ (it); +\ \ \ \ exit\ (1); +} ucl_object_iterate_free\ (it); \f[] diff --git a/contrib/libucl/doc/lua_api.md b/contrib/libucl/doc/lua_api.md index f7af3caffff4..7da414903b01 100644 --- a/contrib/libucl/doc/lua_api.md +++ b/contrib/libucl/doc/lua_api.md @@ -69,8 +69,8 @@ converts `obj` to lua representation using the following conversions: - *scalar* values are directly presented by lua objects - *userdata* values are converted to lua function objects using `LUA_REGISTRYINDEX`, this can be used to pass functions from lua to c and vice-versa -- *arrays* are converted to lua tables with numeric indicies suitable for `ipairs` iterations -- *objects* are converted to lua tables with string indicies +- *arrays* are converted to lua tables with numeric indices suitable for `ipairs` iterations +- *objects* are converted to lua tables with string indices **Parameters:** diff --git a/contrib/libucl/include/lua_ucl.h b/contrib/libucl/include/lua_ucl.h index 38e74d3f619d..5b7f88e031e1 100644 --- a/contrib/libucl/include/lua_ucl.h +++ b/contrib/libucl/include/lua_ucl.h @@ -54,6 +54,14 @@ UCL_EXTERN int luaopen_ucl (lua_State *L); */ UCL_EXTERN ucl_object_t* ucl_object_lua_import (lua_State *L, int idx); +/** + * Import UCL object from lua state, escaping JSON strings + * @param L lua state + * @param idx index of object at the lua stack to convert to UCL + * @return new UCL object or NULL, the caller should unref object after using + */ +UCL_EXTERN ucl_object_t* ucl_object_lua_import_escape (lua_State *L, int idx); + /** * Push an object to lua * @param L lua state @@ -62,8 +70,16 @@ UCL_EXTERN ucl_object_t* ucl_object_lua_import (lua_State *L, int idx); */ UCL_EXTERN int ucl_object_push_lua (lua_State *L, const ucl_object_t *obj, bool allow_array); +/** + * Push an object to lua replacing all ucl.null with `false` + * @param L lua state + * @param obj object to push + * @param allow_array traverse over implicit arrays + */ +UCL_EXTERN int ucl_object_push_lua_filter_nil (lua_State *L, + const ucl_object_t *obj, + bool allow_array); -UCL_EXTERN struct ucl_lua_funcdata* ucl_object_toclosure ( - const ucl_object_t *obj); +UCL_EXTERN struct ucl_lua_funcdata* ucl_object_toclosure (const ucl_object_t *obj); #endif /* LUA_UCL_H_ */ diff --git a/contrib/libucl/include/ucl++.h b/contrib/libucl/include/ucl++.h index 2c2bdde51559..fb63430d400d 100644 --- a/contrib/libucl/include/ucl++.h +++ b/contrib/libucl/include/ucl++.h @@ -29,6 +29,7 @@ #include #include #include +#include #include "ucl.h" @@ -106,7 +107,7 @@ private: static bool ucl_variable_getter(const unsigned char *data, size_t len, unsigned char ** /*replace*/, size_t * /*replace_len*/, bool *need_free, void* ud) { - *need_free = false; + *need_free = false; auto vars = reinterpret_cast *>(ud); if (vars && data && len != 0) { @@ -123,17 +124,17 @@ private: auto replacer = reinterpret_cast(ud); if (!replacer) { return false; - } + } std::string var_name (data, data + len); if (!replacer->is_variable (var_name)) { return false; - } + } std::string var_value = replacer->replace (var_name); if (var_value.empty ()) { return false; - } + } *replace = (unsigned char *)UCL_ALLOC (var_value.size ()); memcpy (*replace, var_value.data (), var_value.size ()); @@ -152,7 +153,8 @@ private: config_func (parser); if (!parse_func (parser)) { - err.assign (ucl_parser_get_error (parser)); + const char *error = ucl_parser_get_error (parser); //Assigning here without checking result first causes a + if( error != NULL ) err.assign(error); // crash if ucl_parser_get_error returns NULL ucl_parser_free (parser); return nullptr; @@ -168,6 +170,16 @@ private: std::unique_ptr obj; public: + struct macro_handler_s { + ucl_macro_handler handler; + ucl_context_macro_handler ctx_handler; + }; + + struct macro_userdata_s { + ucl_parser *parser; + void *userdata; + }; + class const_iterator { private: struct ucl_iter_deleter { @@ -184,7 +196,7 @@ public: it = std::shared_ptr(ucl_object_iterate_new (obj.obj.get()), ucl_iter_deleter()); cur.reset (new Ucl(ucl_object_iterate_safe (it.get(), true))); - if (cur->type() == UCL_NULL) { + if (!cur->obj) { it.reset (); cur.reset (); } @@ -218,7 +230,7 @@ public: cur.reset (new Ucl(ucl_object_iterate_safe (it.get(), true))); } - if (cur && cur->type() == UCL_NULL) { + if (cur && !cur->obj) { it.reset (); cur.reset (); } @@ -330,7 +342,7 @@ public: return UCL_NULL; } - const std::string key () const { + std::string key () const { std::string res; if (obj->key) { @@ -373,7 +385,7 @@ public: return default_val; } - const std::string string_value (const std::string& default_val = "") const + std::string string_value (const std::string& default_val = "") const { const char* res = nullptr; @@ -384,7 +396,16 @@ public: return default_val; } - const Ucl at (size_t i) const + size_t size () const + { + if (type () == UCL_ARRAY) { + return ucl_array_size (obj.get()); + } + + return 0; + } + + Ucl at (size_t i) const { if (type () == UCL_ARRAY) { return Ucl (ucl_array_find_index (obj.get(), i)); @@ -393,7 +414,7 @@ public: return Ucl (nullptr); } - const Ucl lookup (const std::string &key) const + Ucl lookup (const std::string &key) const { if (type () == UCL_OBJECT) { return Ucl (ucl_object_lookup_len (obj.get(), @@ -403,12 +424,12 @@ public: return Ucl (nullptr); } - inline const Ucl operator[] (size_t i) const + inline Ucl operator[] (size_t i) const { return at(i); } - inline const Ucl operator[](const std::string &key) const + inline Ucl operator[](const std::string &key) const { return lookup(key); } @@ -432,43 +453,116 @@ public: return out; } - static Ucl parse (const std::string &in, std::string &err) + static Ucl parse (const std::string &in, std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) { - return parse (in, std::map(), err); + return parse (in, std::map(), err, duplicate_strategy); } - static Ucl parse (const std::string &in, const std::map &vars, std::string &err) + static Ucl parse (const std::string &in, const std::map &vars, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) { - auto config_func = [&vars] (ucl_parser *parser) { + std::vector< std::tuple< std::string, macro_handler_s, void * > > emptyVector; + return parse ( in, vars, emptyVector, err, duplicate_strategy ); + } + + //Macro handler will receive a macro_userdata_s as void *ud + static Ucl parse (const std::string &in, + std::vector< std::tuple< std::string /*name*/, macro_handler_s, void * /*userdata*/ > > ¯os, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + return parse (in, std::map(), macros, err, duplicate_strategy); + } + + //Macro handler will receive a macro_userdata_s as void *ud + static Ucl parse (const std::string &in, const std::map &vars, + std::vector< std::tuple< std::string /*name*/, macro_handler_s, void * /*userdata*/ > > ¯os, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + //Preserve macro_userdata_s memory for later use in parse_with_strategy_function() + std::vector userdata_list; + userdata_list.reserve (macros.size()); + auto config_func = [&userdata_list, &vars, ¯os] (ucl_parser *parser) { for (const auto & item : vars) { ucl_parser_register_variable (parser, item.first.c_str (), item.second.c_str ()); - } + } + for (auto & macro : macros) { + userdata_list.push_back ({parser, std::get<2>(macro)}); + if (std::get<1>(macro).handler != NULL) { + ucl_parser_register_macro (parser, + std::get<0>(macro).c_str(), + std::get<1>(macro).handler, + reinterpret_cast(&userdata_list.back())); + } + else if (std::get<1>(macro).ctx_handler != NULL) { + ucl_parser_register_context_macro (parser, + std::get<0>(macro).c_str(), + std::get<1>(macro).ctx_handler, + reinterpret_cast(&userdata_list.back())); + } + } }; - auto parse_func = [&in] (ucl_parser *parser) { - return ucl_parser_add_chunk (parser, (unsigned char *)in.data (), in.size ()); + auto parse_func = [&in, &duplicate_strategy] (struct ucl_parser *parser) -> bool { + return ucl_parser_add_chunk_full (parser, + (unsigned char *) in.data (), + in.size (), + (unsigned int)ucl_parser_get_default_priority (parser), + duplicate_strategy, + UCL_PARSE_UCL); }; return parse_with_strategy_function (config_func, parse_func, err); } - static Ucl parse (const std::string &in, const variable_replacer &replacer, std::string &err) - { - auto config_func = [&replacer] (ucl_parser *parser) { - ucl_parser_set_variables_handler (parser, ucl_variable_replacer, - &const_cast(replacer)); + static Ucl parse (const std::string &in, const variable_replacer &replacer, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + std::vector< std::tuple< std::string, macro_handler_s, void * > > emptyVector; + return parse ( in, replacer, emptyVector, err, duplicate_strategy ); + } + + //Macro handler will receive a macro_userdata_s as void *ud + static Ucl parse (const std::string &in, const variable_replacer &replacer, + std::vector< std::tuple< std::string /*name*/, macro_handler_s, void * /*userdata*/ > > ¯os, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + //Preserve macro_userdata_s memory for later use in parse_with_strategy_function() + std::vector userdata_list; + userdata_list.reserve (macros.size()); + auto config_func = [&userdata_list, &replacer, ¯os] (ucl_parser *parser) { + ucl_parser_set_variables_handler (parser, ucl_variable_replacer, &const_cast(replacer)); + for (auto & macro : macros) { + userdata_list.push_back ({parser, std::get<2>(macro)}); + if (std::get<1>(macro).handler != NULL) { + ucl_parser_register_macro (parser, + std::get<0>(macro).c_str(), + std::get<1>(macro).handler, + reinterpret_cast(&userdata_list.back())); + } + else if (std::get<1>(macro).ctx_handler != NULL) { + ucl_parser_register_context_macro (parser, + std::get<0>(macro).c_str(), + std::get<1>(macro).ctx_handler, + reinterpret_cast(&userdata_list.back())); + } + } }; - auto parse_func = [&in] (ucl_parser *parser) { - return ucl_parser_add_chunk (parser, (unsigned char *) in.data (), in.size ()); + auto parse_func = [&in, &duplicate_strategy] (struct ucl_parser *parser) -> bool { + return ucl_parser_add_chunk_full (parser, + (unsigned char *) in.data (), + in.size (), + (unsigned int)ucl_parser_get_default_priority (parser), + duplicate_strategy, + UCL_PARSE_UCL); }; return parse_with_strategy_function (config_func, parse_func, err); } - static Ucl parse (const char *in, std::string &err) + static Ucl parse (const char *in, std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) { - return parse (in, std::map(), err); + return parse (in, std::map(), err, duplicate_strategy); } static Ucl parse (const char *in, const std::map &vars, std::string &err) @@ -480,13 +574,46 @@ public: return parse (std::string (in), vars, err); } - static Ucl parse (const char *in, const variable_replacer &replacer, std::string &err) + //Macro handler will receive a macro_userdata_s as void *ud + static Ucl parse (const char *in, + std::vector< std::tuple< std::string /*name*/, macro_handler_s, void * /*userdata*/ > > ¯os, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + return parse (in, std::map(), macros, err, duplicate_strategy); + } + + //Macro handler will receive a macro_userdata_s as void *ud + static Ucl parse (const char *in, const std::map &vars, + std::vector< std::tuple< std::string /*name*/, macro_handler_s, void * /*userdata*/ > > ¯os, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) { if (!in) { err = "null input"; return nullptr; } - return parse (std::string(in), replacer, err); + return parse (std::string (in), vars, macros, err, duplicate_strategy); + } + + static Ucl parse (const char *in, const variable_replacer &replacer, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + if (!in) { + err = "null input"; + return nullptr; + } + return parse (std::string(in), replacer, err, duplicate_strategy); + } + + //Macro handler will receive a macro_userdata_s as void *ud + static Ucl parse (const char *in, const variable_replacer &replacer, + std::vector< std::tuple< std::string /*name*/, macro_handler_s, void * /*userdata*/ > > ¯os, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + if (!in) { + err = "null input"; + return nullptr; + } + return parse (std::string (in), replacer, macros, err, duplicate_strategy); } static Ucl parse_from_file (const std::string &filename, std::string &err) @@ -556,7 +683,7 @@ public: std::vector result; std::move (vars.begin (), vars.end (), std::back_inserter (result)); - return std::move (result); + return result; } Ucl& operator= (Ucl rhs) diff --git a/contrib/libucl/include/ucl.h b/contrib/libucl/include/ucl.h index fccf6fcb2237..39da2593648d 100644 --- a/contrib/libucl/include/ucl.h +++ b/contrib/libucl/include/ucl.h @@ -105,10 +105,11 @@ typedef enum ucl_error { UCL_EIO, /**< IO error occurred during parsing */ UCL_ESTATE, /**< Invalid state machine state */ UCL_ENESTED, /**< Input has too many recursion levels */ + UCL_EUNPAIRED, /**< Input has too many recursion levels */ UCL_EMACRO, /**< Error processing a macro */ UCL_EINTERNAL, /**< Internal unclassified error */ UCL_ESSL, /**< SSL error */ - UCL_EMERGE /**< A merge error occured */ + UCL_EMERGE /**< A merge error occurred */ } ucl_error_t; /** @@ -177,7 +178,8 @@ typedef enum ucl_string_flags { } ucl_string_flags_t; /** - * Basic flags for an object + * Basic flags for an object (can use up to 12 bits as higher 4 bits are used + * for priorities) */ typedef enum ucl_object_flags { UCL_OBJECT_ALLOCATED_KEY = (1 << 0), /**< An object has key allocated internally */ @@ -187,7 +189,8 @@ typedef enum ucl_object_flags { UCL_OBJECT_MULTILINE = (1 << 4), /**< String should be displayed as multiline string */ UCL_OBJECT_MULTIVALUE = (1 << 5), /**< Object is a key with multiple values */ UCL_OBJECT_INHERITED = (1 << 6), /**< Object has been inherited from another */ - UCL_OBJECT_BINARY = (1 << 7) /**< Object contains raw binary data */ + UCL_OBJECT_BINARY = (1 << 7), /**< Object contains raw binary data */ + UCL_OBJECT_SQUOTED = (1 << 8) /**< Object has been enclosed in single quotes */ } ucl_object_flags_t; /** @@ -462,6 +465,14 @@ UCL_EXTERN ucl_object_t* ucl_object_pop_key (ucl_object_t *top, const char *key) UCL_EXTERN bool ucl_object_insert_key_merged (ucl_object_t *top, ucl_object_t *elt, const char *key, size_t keylen, bool copy_key); +/** + * Reserve space in ucl array or object for `elt` elements + * @param obj object to reserve + * @param reserved size to reserve in an object + * @return 0 on success, -1 on failure (i.e. ENOMEM) + */ +UCL_EXTERN bool ucl_object_reserve (ucl_object_t *obj, size_t reserved); + /** * Append an element to the end of array object * @param top destination object (must NOT be NULL) @@ -533,6 +544,13 @@ UCL_EXTERN ucl_object_t* ucl_array_pop_last (ucl_object_t *top); */ UCL_EXTERN ucl_object_t* ucl_array_pop_first (ucl_object_t *top); *** 5210 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed May 5 07:24:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EAE0632B6D; Wed, 5 May 2021 07:24:02 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZp9Z1Q05z3GMT; Wed, 5 May 2021 07:24:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2126020E15; Wed, 5 May 2021 07:24:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1457O2FG048354; Wed, 5 May 2021 07:24:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1457O2xr048353; Wed, 5 May 2021 07:24:02 GMT (envelope-from git) Date: Wed, 5 May 2021 07:24:02 GMT Message-Id: <202105050724.1457O2xr048353@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 59a02060673d - stable/13 - libedit: vendor import libedit 2021-03-28 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 59a02060673da4c978c7ae8db00ebb814a2605e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 07:24:02 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=59a02060673da4c978c7ae8db00ebb814a2605e5 commit 59a02060673da4c978c7ae8db00ebb814a2605e5 Author: Baptiste Daroussin AuthorDate: 2021-03-22 14:34:14 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:21:54 +0000 libedit: vendor import libedit 2021-03-28 (cherry picked from commit f9a159da2a292968cd5c37b56a6c43b6af8c5eed) (cherry picked from commit 19318a62d7f8cfe2f0f5c24178fa33e8844ae5d1) --- contrib/libedit/Makefile | 6 +- contrib/libedit/chartype.h | 2 +- contrib/libedit/common.c | 8 +- contrib/libedit/filecomplete.c | 258 ++++++++++++++++++++++------------------- contrib/libedit/filecomplete.h | 8 +- contrib/libedit/history.c | 14 ++- contrib/libedit/map.c | 10 +- contrib/libedit/readline.c | 18 ++- contrib/libedit/refresh.c | 5 +- contrib/libedit/search.c | 26 ++--- contrib/libedit/terminal.c | 61 +++++----- contrib/libedit/tty.c | 7 +- 12 files changed, 230 insertions(+), 193 deletions(-) diff --git a/contrib/libedit/Makefile b/contrib/libedit/Makefile index 8a02211504a8..105a6a92e0ee 100644 --- a/contrib/libedit/Makefile +++ b/contrib/libedit/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.65 2017/06/30 20:26:52 kre Exp $ +# $NetBSD: Makefile,v 1.66 2019/10/13 07:28:10 mrg Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 USE_SHLIBDIR= yes @@ -137,3 +137,7 @@ COPTS.literal.c+= -Wno-sign-conversion COPTS.tokenizer.c+= -Wno-cast-qual COPTS.tokenizern.c+= -Wno-cast-qual .endif + +COPTS.history.c+= ${GCC_NO_STRINGOP_OVERFLOW} +COPTS.historyn.c+= ${GCC_NO_STRINGOP_OVERFLOW} +COPTS.readline.c+= ${GCC_NO_STRINGOP_TRUNCATION} ${GCC_NO_STRINGOP_OVERFLOW} diff --git a/contrib/libedit/chartype.h b/contrib/libedit/chartype.h index 3eda7da07296..bfa3d54ec36c 100644 --- a/contrib/libedit/chartype.h +++ b/contrib/libedit/chartype.h @@ -1,4 +1,4 @@ -/* $NetBSD: chartype.h,v 1.35 2017/05/22 19:16:25 christos Exp $ */ +/* $NetBSD: chartype.h,v 1.36 2019/09/15 21:09:11 christos Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. diff --git a/contrib/libedit/common.c b/contrib/libedit/common.c index bc6c057cf51d..f33c29650d79 100644 --- a/contrib/libedit/common.c +++ b/contrib/libedit/common.c @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.48 2018/02/26 17:36:14 christos Exp $ */ +/* $NetBSD: common.c,v 1.49 2020/03/30 06:54:37 ryo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: common.c,v 1.48 2018/02/26 17:36:14 christos Exp $"); +__RCSID("$NetBSD: common.c,v 1.49 2020/03/30 06:54:37 ryo Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -658,7 +658,7 @@ ed_search_prev_history(EditLine *el, wint_t c __attribute__((__unused__))) while (hp != NULL) { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); + (void) fprintf(el->el_errfile, "Comparing with \"%ls\"\n", hp); #endif if ((wcsncmp(hp, el->el_line.buffer, (size_t) (el->el_line.lastchar - el->el_line.buffer)) || @@ -713,7 +713,7 @@ ed_search_next_history(EditLine *el, wint_t c __attribute__((__unused__))) for (h = 1; h < el->el_history.eventno && hp; h++) { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); + (void) fprintf(el->el_errfile, "Comparing with \"%ls\"\n", hp); #endif if ((wcsncmp(hp, el->el_line.buffer, (size_t) (el->el_line.lastchar - el->el_line.buffer)) || diff --git a/contrib/libedit/filecomplete.c b/contrib/libedit/filecomplete.c index 662a0bb85d0b..8279d7ff82b6 100644 --- a/contrib/libedit/filecomplete.c +++ b/contrib/libedit/filecomplete.c @@ -1,4 +1,4 @@ -/* $NetBSD: filecomplete.c,v 1.58 2019/09/08 05:50:58 abhinav Exp $ */ +/* $NetBSD: filecomplete.c,v 1.67 2021/03/28 13:39:39 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: filecomplete.c,v 1.58 2019/09/08 05:50:58 abhinav Exp $"); +__RCSID("$NetBSD: filecomplete.c,v 1.67 2021/03/28 13:39:39 christos Exp $"); #endif /* not lint && not SCCSID */ #include @@ -86,8 +86,7 @@ fn_tilde_expand(const char *txt) temp = el_calloc(len, sizeof(*temp)); if (temp == NULL) return NULL; - (void)strncpy(temp, txt + 1, len - 2); - temp[len - 2] = '\0'; + (void)strlcpy(temp, txt + 1, len - 1); } if (temp[0] == 0) { #ifdef HAVE_GETPW_R_POSIX @@ -292,7 +291,7 @@ escape_filename(EditLine * el, const char *filename, int single_match, if (single_match && app_func) { escaped_str[offset] = 0; - append_char = app_func(escaped_str); + append_char = app_func(filename); /* we want to append space only if we are not inside quotes */ if (append_char[0] == ' ') { if (!s_quoted && !d_quoted) @@ -354,8 +353,7 @@ fn_filename_completion_function(const char *text, int state) return NULL; } dirname = nptr; - (void)strncpy(dirname, text, len); - dirname[len] = '\0'; + (void)strlcpy(dirname, text, len + 1); } else { el_free(filename); if (*text == 0) @@ -509,8 +507,7 @@ completion_matches(const char *text, char *(*genfunc)(const char *, int)) el_free(match_list); return NULL; } - (void)strncpy(retstr, match_list[1], max_equal); - retstr[max_equal] = '\0'; + (void)strlcpy(retstr, match_list[1], max_equal + 1); match_list[0] = retstr; /* add NULL as last pointer to the array */ @@ -586,10 +583,12 @@ fn_display_match_list(EditLine * el, char **matches, size_t num, size_t width, static wchar_t * find_word_to_complete(const wchar_t * cursor, const wchar_t * buffer, - const wchar_t * word_break, const wchar_t * special_prefixes, size_t * length) + const wchar_t * word_break, const wchar_t * special_prefixes, size_t * length, + int do_unescape) { /* We now look backwards for the start of a filename/variable word */ const wchar_t *ctemp = cursor; + wchar_t *temp; size_t len; /* if the cursor is placed at a slash or a quote, we need to find the @@ -614,12 +613,8 @@ find_word_to_complete(const wchar_t * cursor, const wchar_t * buffer, if (ctemp - buffer >= 2 && ctemp[-2] == '\\') { ctemp -= 2; continue; - } else if (ctemp - buffer >= 2 && - (ctemp[-2] == '\'' || ctemp[-2] == '"')) { - ctemp--; - continue; - } else - break; + } + break; } if (special_prefixes && wcschr(special_prefixes, ctemp[-1])) break; @@ -632,10 +627,16 @@ find_word_to_complete(const wchar_t * cursor, const wchar_t * buffer, ctemp++; } *length = len; - wchar_t *unescaped_word = unescape_string(ctemp, len); - if (unescaped_word == NULL) - return NULL; - return unescaped_word; + if (do_unescape) { + wchar_t *unescaped_word = unescape_string(ctemp, len); + if (unescaped_word == NULL) + return NULL; + return unescaped_word; + } + temp = el_malloc((len + 1) * sizeof(*temp)); + (void) wcsncpy(temp, ctemp, len); + temp[len] = '\0'; + return temp; } /* @@ -651,12 +652,13 @@ find_word_to_complete(const wchar_t * cursor, const wchar_t * buffer, * '!' could never be invoked */ int -fn_complete(EditLine *el, - char *(*complet_func)(const char *, int), - char **(*attempted_completion_function)(const char *, int, int), - const wchar_t *word_break, const wchar_t *special_prefixes, - const char *(*app_func)(const char *), size_t query_items, - int *completion_type, int *over, int *point, int *end) +fn_complete2(EditLine *el, + char *(*complete_func)(const char *, int), + char **(*attempted_completion_function)(const char *, int, int), + const wchar_t *word_break, const wchar_t *special_prefixes, + const char *(*app_func)(const char *), size_t query_items, + int *completion_type, int *over, int *point, int *end, + unsigned int flags) { const LineInfoW *li; wchar_t *temp; @@ -665,6 +667,7 @@ fn_complete(EditLine *el, size_t len; int what_to_do = '\t'; int retval = CC_NORM; + int do_unescape = flags & FN_QUOTE_MATCH; if (el->el_state.lastcmd == el->el_state.thiscmd) what_to_do = '?'; @@ -673,14 +676,14 @@ fn_complete(EditLine *el, if (completion_type != NULL) *completion_type = what_to_do; - if (!complet_func) - complet_func = fn_filename_completion_function; + if (!complete_func) + complete_func = fn_filename_completion_function; if (!app_func) app_func = append_char_function; li = el_wline(el); temp = find_word_to_complete(li->cursor, - li->buffer, word_break, special_prefixes, &len); + li->buffer, word_break, special_prefixes, &len, do_unescape); if (temp == NULL) goto out; @@ -701,117 +704,136 @@ fn_complete(EditLine *el, if (!attempted_completion_function || (over != NULL && !*over && !matches)) matches = completion_matches( - ct_encode_string(temp, &el->el_scratch), complet_func); + ct_encode_string(temp, &el->el_scratch), complete_func); if (over != NULL) *over = 0; - if (matches) { - int i; - size_t matches_num, maxlen, match_len, match_display=1; - int single_match = matches[2] == NULL && - (matches[1] == NULL || strcmp(matches[0], matches[1]) == 0); - - retval = CC_REFRESH; - - if (matches[0][0] != '\0') { - el_deletestr(el, (int)len); - if (!attempted_completion_function) - completion = escape_filename(el, matches[0], - single_match, app_func); - else - completion = strdup(matches[0]); - if (completion == NULL) - goto out; - if (single_match) { - /* We found exact match. Add a space after it, - * unless we do filename completion and the - * object is a directory. Also do necessary - * escape quoting - */ - el_winsertstr(el, - ct_decode_string(completion, &el->el_scratch)); - } else { - /* Only replace the completed string with - * common part of possible matches if there is - * possible completion. - */ - el_winsertstr(el, - ct_decode_string(completion, &el->el_scratch)); - } - free(completion); - } + if (matches == NULL) { + goto out; + } + int i; + size_t matches_num, maxlen, match_len, match_display=1; + int single_match = matches[2] == NULL && + (matches[1] == NULL || strcmp(matches[0], matches[1]) == 0); + + retval = CC_REFRESH; + + if (matches[0][0] != '\0') { + el_deletestr(el, (int)len); + if (flags & FN_QUOTE_MATCH) + completion = escape_filename(el, matches[0], + single_match, app_func); + else + completion = strdup(matches[0]); + if (completion == NULL) + goto out; + /* + * Replace the completed string with the common part of + * all possible matches if there is a possible completion. + */ + el_winsertstr(el, + ct_decode_string(completion, &el->el_scratch)); - if (!single_match && (what_to_do == '!' || what_to_do == '?')) { + if (single_match && attempted_completion_function && + !(flags & FN_QUOTE_MATCH)) + { /* - * More than one match and requested to list possible - * matches. + * We found an exact match. Add a space after + * it, unless we do filename completion and the + * object is a directory. Also do necessary + * escape quoting */ + el_winsertstr(el, ct_decode_string( + (*app_func)(completion), &el->el_scratch)); + } + free(completion); + } - for(i = 1, maxlen = 0; matches[i]; i++) { - match_len = strlen(matches[i]); - if (match_len > maxlen) - maxlen = match_len; - } - /* matches[1] through matches[i-1] are available */ - matches_num = (size_t)(i - 1); - /* newline to get on next line from command line */ - (void)fprintf(el->el_outfile, "\n"); + if (!single_match && (what_to_do == '!' || what_to_do == '?')) { + /* + * More than one match and requested to list possible + * matches. + */ - /* - * If there are too many items, ask user for display - * confirmation. - */ - if (matches_num > query_items) { - (void)fprintf(el->el_outfile, - "Display all %zu possibilities? (y or n) ", - matches_num); - (void)fflush(el->el_outfile); - if (getc(stdin) != 'y') - match_display = 0; - (void)fprintf(el->el_outfile, "\n"); - } + for(i = 1, maxlen = 0; matches[i]; i++) { + match_len = strlen(matches[i]); + if (match_len > maxlen) + maxlen = match_len; + } + /* matches[1] through matches[i-1] are available */ + matches_num = (size_t)(i - 1); - if (match_display) { - /* - * Interface of this function requires the - * strings be matches[1..num-1] for compat. - * We have matches_num strings not counting - * the prefix in matches[0], so we need to - * add 1 to matches_num for the call. - */ - fn_display_match_list(el, matches, - matches_num+1, maxlen, app_func); - } - retval = CC_REDISPLAY; - } else if (matches[0][0]) { + /* newline to get on next line from command line */ + (void)fprintf(el->el_outfile, "\n"); + + /* + * If there are too many items, ask user for display + * confirmation. + */ + if (matches_num > query_items) { + (void)fprintf(el->el_outfile, + "Display all %zu possibilities? (y or n) ", + matches_num); + (void)fflush(el->el_outfile); + if (getc(stdin) != 'y') + match_display = 0; + (void)fprintf(el->el_outfile, "\n"); + } + + if (match_display) { /* - * There was some common match, but the name was - * not complete enough. Next tab will print possible - * completions. + * Interface of this function requires the + * strings be matches[1..num-1] for compat. + * We have matches_num strings not counting + * the prefix in matches[0], so we need to + * add 1 to matches_num for the call. */ - el_beep(el); - } else { - /* lcd is not a valid object - further specification */ - /* is needed */ - el_beep(el); - retval = CC_NORM; + fn_display_match_list(el, matches, + matches_num+1, maxlen, app_func); } - - /* free elements of array and the array itself */ - for (i = 0; matches[i]; i++) - el_free(matches[i]); - el_free(matches); - matches = NULL; + retval = CC_REDISPLAY; + } else if (matches[0][0]) { + /* + * There was some common match, but the name was + * not complete enough. Next tab will print possible + * completions. + */ + el_beep(el); + } else { + /* lcd is not a valid object - further specification */ + /* is needed */ + el_beep(el); + retval = CC_NORM; } + /* free elements of array and the array itself */ + for (i = 0; matches[i]; i++) + el_free(matches[i]); + el_free(matches); + matches = NULL; + out: el_free(temp); return retval; } +int +fn_complete(EditLine *el, + char *(*complete_func)(const char *, int), + char **(*attempted_completion_function)(const char *, int, int), + const wchar_t *word_break, const wchar_t *special_prefixes, + const char *(*app_func)(const char *), size_t query_items, + int *completion_type, int *over, int *point, int *end) +{ + return fn_complete2(el, complete_func, attempted_completion_function, + word_break, special_prefixes, app_func, query_items, + completion_type, over, point, end, + attempted_completion_function ? 0 : FN_QUOTE_MATCH); +} + /* * el-compatible wrapper around rl_complete; needed for key binding */ diff --git a/contrib/libedit/filecomplete.h b/contrib/libedit/filecomplete.h index 61d81389a0f7..60ea4894414b 100644 --- a/contrib/libedit/filecomplete.h +++ b/contrib/libedit/filecomplete.h @@ -1,4 +1,4 @@ -/* $NetBSD: filecomplete.h,v 1.11 2017/04/21 05:38:03 abhinav Exp $ */ +/* $NetBSD: filecomplete.h,v 1.13 2021/03/28 13:38:10 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -36,6 +36,12 @@ int fn_complete(EditLine *, char **(*)(const char *, int, int), const wchar_t *, const wchar_t *, const char *(*)(const char *), size_t, int *, int *, int *, int *); +int fn_complete2(EditLine *, + char *(*)(const char *, int), + char **(*)(const char *, int, int), + const wchar_t *, const wchar_t *, const char *(*)(const char *), size_t, + int *, int *, int *, int *, unsigned int); +#define FN_QUOTE_MATCH 1 /* Quote the returned match */ void fn_display_match_list(EditLine *, char **, size_t, size_t, const char *(*)(const char *)); diff --git a/contrib/libedit/history.c b/contrib/libedit/history.c index 227f72c4a102..73cfa6b8ead9 100644 --- a/contrib/libedit/history.c +++ b/contrib/libedit/history.c @@ -1,4 +1,4 @@ -/* $NetBSD: history.c,v 1.62 2018/09/13 09:03:40 kre Exp $ */ +/* $NetBSD: history.c,v 1.63 2019/10/08 19:17:57 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: history.c,v 1.62 2018/09/13 09:03:40 kre Exp $"); +__RCSID("$NetBSD: history.c,v 1.63 2019/10/08 19:17:57 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -411,21 +411,23 @@ static int history_def_add(void *p, TYPE(HistEvent) *ev, const Char *str) { history_t *h = (history_t *) p; - size_t len; + size_t len, elen, slen; Char *s; HistEventPrivate *evp = (void *)&h->cursor->ev; if (h->cursor == &h->list) return history_def_enter(p, ev, str); - len = Strlen(evp->str) + Strlen(str) + 1; + elen = Strlen(evp->str); + slen = Strlen(str); + len = elen + slen + 1; s = h_malloc(len * sizeof(*s)); if (s == NULL) { he_seterrev(ev, _HE_MALLOC_FAILED); return -1; } - (void) Strncpy(s, h->cursor->ev.str, len); + memcpy(s, evp->str, elen * sizeof(*s)); + memcpy(s + elen, str, slen * sizeof(*s)); s[len - 1] = '\0'; - (void) Strncat(s, str, len - Strlen(s) - 1); h_free(evp->str); evp->str = s; *ev = h->cursor->ev; diff --git a/contrib/libedit/map.c b/contrib/libedit/map.c index 0c489593335a..46bf6f1c9472 100644 --- a/contrib/libedit/map.c +++ b/contrib/libedit/map.c @@ -1,4 +1,4 @@ -/* $NetBSD: map.c,v 1.52 2019/07/23 10:18:52 christos Exp $ */ +/* $NetBSD: map.c,v 1.53 2020/03/30 06:54:37 ryo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: map.c,v 1.52 2019/07/23 10:18:52 christos Exp $"); +__RCSID("$NetBSD: map.c,v 1.53 2020/03/30 06:54:37 ryo Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -906,11 +906,11 @@ map_init(EditLine *el) */ #ifdef MAP_DEBUG if (sizeof(el_map_emacs) != N_KEYS * sizeof(el_action_t)) - EL_ABORT((el->errfile, "Emacs map incorrect\n")); + EL_ABORT((el->el_errfile, "Emacs map incorrect\n")); if (sizeof(el_map_vi_command) != N_KEYS * sizeof(el_action_t)) - EL_ABORT((el->errfile, "Vi command map incorrect\n")); + EL_ABORT((el->el_errfile, "Vi command map incorrect\n")); if (sizeof(el_map_vi_insert) != N_KEYS * sizeof(el_action_t)) - EL_ABORT((el->errfile, "Vi insert map incorrect\n")); + EL_ABORT((el->el_errfile, "Vi insert map incorrect\n")); #endif el->el_map.alt = el_calloc(N_KEYS, sizeof(*el->el_map.alt)); diff --git a/contrib/libedit/readline.c b/contrib/libedit/readline.c index dc852f5539c1..792dddbaf70b 100644 --- a/contrib/libedit/readline.c +++ b/contrib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $NetBSD: readline.c,v 1.157 2019/08/21 11:11:48 christos Exp $ */ +/* $NetBSD: readline.c,v 1.159 2019/10/09 14:31:07 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: readline.c,v 1.157 2019/08/21 11:11:48 christos Exp $"); +__RCSID("$NetBSD: readline.c,v 1.159 2019/10/09 14:31:07 christos Exp $"); #endif /* not lint && not SCCSID */ #include @@ -521,7 +521,7 @@ _rl_compat_sub(const char *str, const char *what, const char *with, s = str; while (*s) { if (*s == *what && !strncmp(s, what, what_len)) { - (void)strncpy(r, with, with_len); + memcpy(r, with, with_len); r += with_len; s += what_len; if (!globally) { @@ -607,8 +607,7 @@ get_history_event(const char *cmd, int *cindex, int qchar) else { if ((pat = el_calloc(len + 1, sizeof(*pat))) == NULL) return NULL; - (void)strncpy(pat, cmd + begin, len); - pat[len] = '\0'; + (void)strlcpy(pat, cmd + begin, len + 1); } if (history(h, &ev, H_CURR) != 0) { @@ -702,8 +701,7 @@ _history_expand_command(const char *command, size_t offs, size_t cmdlen, if ((aptr = el_calloc(offs + 1, sizeof(*aptr))) == NULL) return -1; - (void)strncpy(aptr, command, offs); - aptr[offs] = '\0'; + (void)strlcpy(aptr, command, offs + 1); idx = 1; } else { int qchar; @@ -960,9 +958,8 @@ history_expand(char *str, char **output) } \ result = nresult; \ } \ - (void)strncpy(&result[idx], what, len); \ + (void)strlcpy(&result[idx], what, len + 1); \ idx += len; \ - result[idx] = '\0'; \ } result = NULL; @@ -1150,8 +1147,7 @@ history_tokenize(const char *str) el_free(result); return NULL; } - (void)strncpy(temp, &str[start], len); - temp[len] = '\0'; + (void)strlcpy(temp, &str[start], len + 1); result[idx++] = temp; result[idx] = NULL; if (str[i]) diff --git a/contrib/libedit/refresh.c b/contrib/libedit/refresh.c index 584eec624976..fab29746478c 100644 --- a/contrib/libedit/refresh.c +++ b/contrib/libedit/refresh.c @@ -1,4 +1,4 @@ -/* $NetBSD: refresh.c,v 1.56 2019/01/04 03:03:44 uwe Exp $ */ +/* $NetBSD: refresh.c,v 1.57 2020/03/30 06:54:37 ryo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: refresh.c,v 1.56 2019/01/04 03:03:44 uwe Exp $"); +__RCSID("$NetBSD: refresh.c,v 1.57 2020/03/30 06:54:37 ryo Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -45,6 +45,7 @@ __RCSID("$NetBSD: refresh.c,v 1.56 2019/01/04 03:03:44 uwe Exp $"); * refresh.c: Lower level screen refreshing functions */ #include +#include #include #include diff --git a/contrib/libedit/search.c b/contrib/libedit/search.c index 78e15d720cb8..e909d1475725 100644 --- a/contrib/libedit/search.c +++ b/contrib/libedit/search.c @@ -1,4 +1,4 @@ -/* $NetBSD: search.c,v 1.49 2019/07/23 10:18:52 christos Exp $ */ +/* $NetBSD: search.c,v 1.51 2020/03/30 06:56:38 ryo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: search.c,v 1.49 2019/07/23 10:18:52 christos Exp $"); +__RCSID("$NetBSD: search.c,v 1.51 2020/03/30 06:56:38 ryo Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -162,7 +162,7 @@ libedit_private int c_hmatch(EditLine *el, const wchar_t *str) { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "match `%s' with `%s'\n", + (void) fprintf(el->el_errfile, "match `%ls' with `%ls'\n", el->el_search.patbuf, str); #endif /* SDEBUG */ @@ -182,20 +182,17 @@ c_setpat(EditLine *el) (size_t)(EL_CURSOR(el) - el->el_line.buffer); if (el->el_search.patlen >= EL_BUFSIZ) el->el_search.patlen = EL_BUFSIZ - 1; - if (el->el_search.patlen != 0) { - (void) wcsncpy(el->el_search.patbuf, el->el_line.buffer, - el->el_search.patlen); - el->el_search.patbuf[el->el_search.patlen] = '\0'; - } else - el->el_search.patlen = wcslen(el->el_search.patbuf); + (void) wcsncpy(el->el_search.patbuf, el->el_line.buffer, + el->el_search.patlen); + el->el_search.patbuf[el->el_search.patlen] = '\0'; } #ifdef SDEBUG (void) fprintf(el->el_errfile, "\neventno = %d\n", el->el_history.eventno); - (void) fprintf(el->el_errfile, "patlen = %d\n", el->el_search.patlen); - (void) fprintf(el->el_errfile, "patbuf = \"%s\"\n", + (void) fprintf(el->el_errfile, "patlen = %ld\n", el->el_search.patlen); + (void) fprintf(el->el_errfile, "patbuf = \"%ls\"\n", el->el_search.patbuf); - (void) fprintf(el->el_errfile, "cursor %d lastchar %d\n", + (void) fprintf(el->el_errfile, "cursor %ld lastchar %ld\n", EL_CURSOR(el) - el->el_line.buffer, el->el_line.lastchar - el->el_line.buffer); #endif @@ -573,8 +570,9 @@ cv_repeat_srch(EditLine *el, wint_t c) { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "dir %d patlen %d patbuf %s\n", - c, el->el_search.patlen, ct_encode_string(el->el_search.patbuf)); + static ct_buffer_t conv; + (void) fprintf(el->el_errfile, "dir %d patlen %ld patbuf %s\n", + c, el->el_search.patlen, ct_encode_string(el->el_search.patbuf, &conv)); #endif el->el_state.lastcmd = (el_action_t) c; /* Hack to stop c_setpat */ diff --git a/contrib/libedit/terminal.c b/contrib/libedit/terminal.c index 34f4985a90bc..b3ab5bfb6244 100644 --- a/contrib/libedit/terminal.c +++ b/contrib/libedit/terminal.c @@ -1,4 +1,4 @@ -/* $NetBSD: terminal.c,v 1.39 2019/07/23 10:18:52 christos Exp $ */ +/* $NetBSD: terminal.c,v 1.43 2020/07/10 20:34:24 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95"; #else -__RCSID("$NetBSD: terminal.c,v 1.39 2019/07/23 10:18:52 christos Exp $"); +__RCSID("$NetBSD: terminal.c,v 1.43 2020/07/10 20:34:24 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -497,7 +497,7 @@ terminal_move_to_line(EditLine *el, int where) if (where == el->el_cursor.v) return; - if (where > el->el_terminal.t_size.v) { + if (where >= el->el_terminal.t_size.v) { #ifdef DEBUG_SCREEN (void) fprintf(el->el_errfile, "%s: where is ridiculous: %d\r\n", __func__, where); @@ -647,7 +647,8 @@ terminal_overwrite(EditLine *el, const wchar_t *cp, size_t n) if (el->el_cursor.h >= el->el_terminal.t_size.h) { /* wrap? */ if (EL_HAS_AUTO_MARGINS) { /* yes */ el->el_cursor.h = 0; - el->el_cursor.v++; + if (el->el_cursor.v + 1 < el->el_terminal.t_size.v) + el->el_cursor.v++; if (EL_HAS_MAGIC_MARGINS) { /* force the wrap to avoid the "magic" * situation */ @@ -1314,14 +1315,14 @@ terminal_settc(EditLine *el, int argc __attribute__((__unused__)), const struct termcapstr *ts; const struct termcapval *tv; char what[8], how[8]; + long i; + char *ep; if (argv == NULL || argv[1] == NULL || argv[2] == NULL) return -1; - strncpy(what, ct_encode_string(argv[1], &el->el_scratch), sizeof(what)); - what[sizeof(what) - 1] = '\0'; - strncpy(how, ct_encode_string(argv[2], &el->el_scratch), sizeof(how)); - how[sizeof(how) - 1] = '\0'; + strlcpy(what, ct_encode_string(argv[1], &el->el_scratch), sizeof(what)); + strlcpy(how, ct_encode_string(argv[2], &el->el_scratch), sizeof(how)); /* * Do the strings first @@ -1342,11 +1343,17 @@ terminal_settc(EditLine *el, int argc __attribute__((__unused__)), if (strcmp(tv->name, what) == 0) break; - if (tv->name != NULL) + if (tv->name == NULL) { + (void) fprintf(el->el_errfile, + "%ls: Bad capability `%s'.\n", argv[0], what); return -1; + } if (tv == &tval[T_pt] || tv == &tval[T_km] || tv == &tval[T_am] || tv == &tval[T_xn]) { + /* + * Booleans + */ if (strcmp(how, "yes") == 0) el->el_terminal.t_val[tv - tval] = 1; else if (strcmp(how, "no") == 0) @@ -1357,28 +1364,30 @@ terminal_settc(EditLine *el, int argc __attribute__((__unused__)), return -1; } terminal_setflags(el); - if (terminal_change_size(el, Val(T_li), Val(T_co)) == -1) - return -1; return 0; - } else { - long i; - char *ep; + } - i = strtol(how, &ep, 10); - if (*ep != '\0') { - (void) fprintf(el->el_errfile, - "%ls: Bad value `%s'.\n", argv[0], how); - return -1; - } - el->el_terminal.t_val[tv - tval] = (int) i; + /* + * Numerics + */ + i = strtol(how, &ep, 10); + if (*ep != '\0') { + (void) fprintf(el->el_errfile, + "%ls: Bad value `%s'.\n", argv[0], how); + return -1; + } + el->el_terminal.t_val[tv - tval] = (int) i; + i = 0; + if (tv == &tval[T_co]) { el->el_terminal.t_size.v = Val(T_co); + i++; + } else if (tv == &tval[T_li]) { el->el_terminal.t_size.h = Val(T_li); - if (tv == &tval[T_co] || tv == &tval[T_li]) - if (terminal_change_size(el, Val(T_li), Val(T_co)) - == -1) - return -1; - return 0; + i++; } + if (i && terminal_change_size(el, Val(T_li), Val(T_co)) == -1) + return -1; + return 0; } diff --git a/contrib/libedit/tty.c b/contrib/libedit/tty.c index 743075e08b3f..bafc906ccc4e 100644 --- a/contrib/libedit/tty.c +++ b/contrib/libedit/tty.c @@ -1,4 +1,4 @@ -/* $NetBSD: tty.c,v 1.68 2018/12/02 16:58:13 christos Exp $ */ +/* $NetBSD: tty.c,v 1.69 2020/05/31 23:24:23 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: tty.c,v 1.68 2018/12/02 16:58:13 christos Exp $"); +__RCSID("$NetBSD: tty.c,v 1.69 2020/05/31 23:24:23 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -1163,8 +1163,7 @@ tty_stty(EditLine *el, int argc __attribute__((__unused__)), if (argv == NULL) return -1; - strncpy(name, ct_encode_string(*argv++, &el->el_scratch), sizeof(name)); - name[sizeof(name) - 1] = '\0'; + strlcpy(name, ct_encode_string(*argv++, &el->el_scratch), sizeof(name)); while (argv && *argv && argv[0][0] == '-' && argv[0][2] == '\0') switch (argv[0][1]) { From owner-dev-commits-src-all@freebsd.org Wed May 5 07:24:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27D1A63297C; Wed, 5 May 2021 07:24:09 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZp9j0VLTz3GHp; Wed, 5 May 2021 07:24:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 042BB20A48; Wed, 5 May 2021 07:24:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1457O82W048498; Wed, 5 May 2021 07:24:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1457O84q048497; Wed, 5 May 2021 07:24:08 GMT (envelope-from git) Date: Wed, 5 May 2021 07:24:08 GMT Message-Id: <202105050724.1457O84q048497@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 2f2bbc485f22 - stable/12 - sh: improve emacs mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2f2bbc485f2263ab8eb9d272a22d32c06f9e94e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 07:24:09 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=2f2bbc485f2263ab8eb9d272a22d32c06f9e94e9 commit 2f2bbc485f2263ab8eb9d272a22d32c06f9e94e9 Author: Baptiste Daroussin AuthorDate: 2021-03-30 09:37:29 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:16:23 +0000 sh: improve emacs mode In emacs mode, force ^R to backware search the history This behaviour is the default in emacs mode for most of the other shells Note: Note that this can still be overridden via $EDITRC, ~/.editrc or a bind command after set -o emacs. Approved by: jilles Reviewed by: jilles, arichardson, pstef Differential Revision: https://reviews.freebsd.org/D29494 (cherry picked from commit 660045fb5360d328da199ae78c89d5cc15b6d1ca) --- bin/sh/histedit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index a46fe946df18..81967a8a503d 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -139,8 +139,10 @@ bad: if (el) { if (Vflag) el_set(el, EL_EDITOR, "vi"); - else if (Eflag) + else if (Eflag) { el_set(el, EL_EDITOR, "emacs"); + el_set(el, EL_BIND, "^R", "em-inc-search-prev", NULL); + } el_set(el, EL_BIND, "^I", "sh-complete", NULL); el_source(el, NULL); } From owner-dev-commits-src-all@freebsd.org Wed May 5 07:24:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72E5B632E41; Wed, 5 May 2021 07:24:10 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZp9k2C1bz3GLS; Wed, 5 May 2021 07:24:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 349D720F00; Wed, 5 May 2021 07:24:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1457OA8X048519; Wed, 5 May 2021 07:24:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1457OAWP048518; Wed, 5 May 2021 07:24:10 GMT (envelope-from git) Date: Wed, 5 May 2021 07:24:10 GMT Message-Id: <202105050724.1457OAWP048518@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 3e1022b4eb5f - stable/12 - Make pkg(7) use environment variables specified in pkg.conf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3e1022b4eb5f452a8bbcb651f3367417988e75ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 07:24:10 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=3e1022b4eb5f452a8bbcb651f3367417988e75ab commit 3e1022b4eb5f452a8bbcb651f3367417988e75ab Author: Moritz Schmitt AuthorDate: 2021-04-27 01:59:12 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:16:30 +0000 Make pkg(7) use environment variables specified in pkg.conf Modify /usr/sbin/pkg to use environment variables specified in pkg.conf. This allows control over underlying libraries like fetch(3), which can be configured by setting HTTP_PROXY. Differential Revision: https://reviews.freebsd.org/D29820 (cherry picked from commit e869d3c60147bbb226b5ad97d2ef73391aeebafa) --- usr.sbin/pkg/config.c | 29 +++++++++++++++++++++++++---- usr.sbin/pkg/config.h | 2 ++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index e467a3c34357..80469bf2b5a5 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "config.h" @@ -134,6 +135,15 @@ static struct config_entry c[] = { NULL, false, false + }, + [PKG_ENV] = { + PKG_CONFIG_OBJECT, + "PKG_ENV", + NULL, + NULL, + NULL, + false, + false, } }; @@ -205,11 +215,11 @@ static void config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) { struct sbuf *buf = sbuf_new_auto(); - const ucl_object_t *cur, *seq; - ucl_object_iter_t it = NULL, itseq = NULL; + const ucl_object_t *cur, *seq, *tmp; + ucl_object_iter_t it = NULL, itseq = NULL, it_obj = NULL; struct config_entry *temp_config; struct config_value *cv; - const char *key; + const char *key, *evkey; int i; size_t j; @@ -224,7 +234,7 @@ config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) if (conftype == CONFFILE_PKG) { for (j = 0; j < strlen(key); ++j) - sbuf_putc(buf, key[j]); + sbuf_putc(buf, toupper(key[j])); sbuf_finish(buf); } else if (conftype == CONFFILE_REPO) { if (strcasecmp(key, "url") == 0) @@ -285,6 +295,17 @@ config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) temp_config[i].value = strdup(ucl_object_toboolean(cur) ? "yes" : "no"); break; + case PKG_CONFIG_OBJECT: + if (strcmp(c[i].key, "PKG_ENV") == 0) { + while ((tmp = + ucl_iterate_object(cur, &it_obj, true))) { + evkey = ucl_object_key(tmp); + if (evkey != NULL && *evkey != '\0') { + setenv(evkey, ucl_object_tostring_forced(tmp), 1); + } + } + } + break; default: /* Normal string value. */ temp_config[i].value = strdup(ucl_object_tostring(cur)); diff --git a/usr.sbin/pkg/config.h b/usr.sbin/pkg/config.h index a63997a7a60d..b5553111c610 100644 --- a/usr.sbin/pkg/config.h +++ b/usr.sbin/pkg/config.h @@ -43,6 +43,7 @@ typedef enum { FINGERPRINTS, REPOS_DIR, PUBKEY, + PKG_ENV, CONFIG_SIZE } pkg_config_key; @@ -50,6 +51,7 @@ typedef enum { PKG_CONFIG_STRING=0, PKG_CONFIG_BOOL, PKG_CONFIG_LIST, + PKG_CONFIG_OBJECT } pkg_config_t; typedef enum { From owner-dev-commits-src-all@freebsd.org Wed May 5 07:24:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49527632AF3; Wed, 5 May 2021 07:24:13 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZp9m5smVz3GNQ; Wed, 5 May 2021 07:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6939C20A49; Wed, 5 May 2021 07:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1457OCmd048561; Wed, 5 May 2021 07:24:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1457OCS2048560; Wed, 5 May 2021 07:24:12 GMT (envelope-from git) Date: Wed, 5 May 2021 07:24:12 GMT Message-Id: <202105050724.1457OCS2048560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: b7367d87d9c8 - stable/12 - libedit: vendor import libedit 2021-03-28 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b7367d87d9c8cbb2dd707d1fadb9b96234f4dbd7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 07:24:13 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=b7367d87d9c8cbb2dd707d1fadb9b96234f4dbd7 commit b7367d87d9c8cbb2dd707d1fadb9b96234f4dbd7 Author: Baptiste Daroussin AuthorDate: 2021-03-22 14:34:14 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:22:42 +0000 libedit: vendor import libedit 2021-03-28 (cherry picked from commit f9a159da2a292968cd5c37b56a6c43b6af8c5eed) (cherry picked from commit 19318a62d7f8cfe2f0f5c24178fa33e8844ae5d1) --- contrib/libedit/Makefile | 6 +- contrib/libedit/chartype.h | 2 +- contrib/libedit/common.c | 8 +- contrib/libedit/filecomplete.c | 258 ++++++++++++++++++++++------------------- contrib/libedit/filecomplete.h | 8 +- contrib/libedit/history.c | 14 ++- contrib/libedit/map.c | 10 +- contrib/libedit/readline.c | 18 ++- contrib/libedit/refresh.c | 5 +- contrib/libedit/search.c | 26 ++--- contrib/libedit/terminal.c | 61 +++++----- contrib/libedit/tty.c | 7 +- 12 files changed, 230 insertions(+), 193 deletions(-) diff --git a/contrib/libedit/Makefile b/contrib/libedit/Makefile index 8a02211504a8..105a6a92e0ee 100644 --- a/contrib/libedit/Makefile +++ b/contrib/libedit/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.65 2017/06/30 20:26:52 kre Exp $ +# $NetBSD: Makefile,v 1.66 2019/10/13 07:28:10 mrg Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 USE_SHLIBDIR= yes @@ -137,3 +137,7 @@ COPTS.literal.c+= -Wno-sign-conversion COPTS.tokenizer.c+= -Wno-cast-qual COPTS.tokenizern.c+= -Wno-cast-qual .endif + +COPTS.history.c+= ${GCC_NO_STRINGOP_OVERFLOW} +COPTS.historyn.c+= ${GCC_NO_STRINGOP_OVERFLOW} +COPTS.readline.c+= ${GCC_NO_STRINGOP_TRUNCATION} ${GCC_NO_STRINGOP_OVERFLOW} diff --git a/contrib/libedit/chartype.h b/contrib/libedit/chartype.h index 3eda7da07296..bfa3d54ec36c 100644 --- a/contrib/libedit/chartype.h +++ b/contrib/libedit/chartype.h @@ -1,4 +1,4 @@ -/* $NetBSD: chartype.h,v 1.35 2017/05/22 19:16:25 christos Exp $ */ +/* $NetBSD: chartype.h,v 1.36 2019/09/15 21:09:11 christos Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. diff --git a/contrib/libedit/common.c b/contrib/libedit/common.c index bc6c057cf51d..f33c29650d79 100644 --- a/contrib/libedit/common.c +++ b/contrib/libedit/common.c @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.48 2018/02/26 17:36:14 christos Exp $ */ +/* $NetBSD: common.c,v 1.49 2020/03/30 06:54:37 ryo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: common.c,v 1.48 2018/02/26 17:36:14 christos Exp $"); +__RCSID("$NetBSD: common.c,v 1.49 2020/03/30 06:54:37 ryo Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -658,7 +658,7 @@ ed_search_prev_history(EditLine *el, wint_t c __attribute__((__unused__))) while (hp != NULL) { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); + (void) fprintf(el->el_errfile, "Comparing with \"%ls\"\n", hp); #endif if ((wcsncmp(hp, el->el_line.buffer, (size_t) (el->el_line.lastchar - el->el_line.buffer)) || @@ -713,7 +713,7 @@ ed_search_next_history(EditLine *el, wint_t c __attribute__((__unused__))) for (h = 1; h < el->el_history.eventno && hp; h++) { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); + (void) fprintf(el->el_errfile, "Comparing with \"%ls\"\n", hp); #endif if ((wcsncmp(hp, el->el_line.buffer, (size_t) (el->el_line.lastchar - el->el_line.buffer)) || diff --git a/contrib/libedit/filecomplete.c b/contrib/libedit/filecomplete.c index 662a0bb85d0b..8279d7ff82b6 100644 --- a/contrib/libedit/filecomplete.c +++ b/contrib/libedit/filecomplete.c @@ -1,4 +1,4 @@ -/* $NetBSD: filecomplete.c,v 1.58 2019/09/08 05:50:58 abhinav Exp $ */ +/* $NetBSD: filecomplete.c,v 1.67 2021/03/28 13:39:39 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: filecomplete.c,v 1.58 2019/09/08 05:50:58 abhinav Exp $"); +__RCSID("$NetBSD: filecomplete.c,v 1.67 2021/03/28 13:39:39 christos Exp $"); #endif /* not lint && not SCCSID */ #include @@ -86,8 +86,7 @@ fn_tilde_expand(const char *txt) temp = el_calloc(len, sizeof(*temp)); if (temp == NULL) return NULL; - (void)strncpy(temp, txt + 1, len - 2); - temp[len - 2] = '\0'; + (void)strlcpy(temp, txt + 1, len - 1); } if (temp[0] == 0) { #ifdef HAVE_GETPW_R_POSIX @@ -292,7 +291,7 @@ escape_filename(EditLine * el, const char *filename, int single_match, if (single_match && app_func) { escaped_str[offset] = 0; - append_char = app_func(escaped_str); + append_char = app_func(filename); /* we want to append space only if we are not inside quotes */ if (append_char[0] == ' ') { if (!s_quoted && !d_quoted) @@ -354,8 +353,7 @@ fn_filename_completion_function(const char *text, int state) return NULL; } dirname = nptr; - (void)strncpy(dirname, text, len); - dirname[len] = '\0'; + (void)strlcpy(dirname, text, len + 1); } else { el_free(filename); if (*text == 0) @@ -509,8 +507,7 @@ completion_matches(const char *text, char *(*genfunc)(const char *, int)) el_free(match_list); return NULL; } - (void)strncpy(retstr, match_list[1], max_equal); - retstr[max_equal] = '\0'; + (void)strlcpy(retstr, match_list[1], max_equal + 1); match_list[0] = retstr; /* add NULL as last pointer to the array */ @@ -586,10 +583,12 @@ fn_display_match_list(EditLine * el, char **matches, size_t num, size_t width, static wchar_t * find_word_to_complete(const wchar_t * cursor, const wchar_t * buffer, - const wchar_t * word_break, const wchar_t * special_prefixes, size_t * length) + const wchar_t * word_break, const wchar_t * special_prefixes, size_t * length, + int do_unescape) { /* We now look backwards for the start of a filename/variable word */ const wchar_t *ctemp = cursor; + wchar_t *temp; size_t len; /* if the cursor is placed at a slash or a quote, we need to find the @@ -614,12 +613,8 @@ find_word_to_complete(const wchar_t * cursor, const wchar_t * buffer, if (ctemp - buffer >= 2 && ctemp[-2] == '\\') { ctemp -= 2; continue; - } else if (ctemp - buffer >= 2 && - (ctemp[-2] == '\'' || ctemp[-2] == '"')) { - ctemp--; - continue; - } else - break; + } + break; } if (special_prefixes && wcschr(special_prefixes, ctemp[-1])) break; @@ -632,10 +627,16 @@ find_word_to_complete(const wchar_t * cursor, const wchar_t * buffer, ctemp++; } *length = len; - wchar_t *unescaped_word = unescape_string(ctemp, len); - if (unescaped_word == NULL) - return NULL; - return unescaped_word; + if (do_unescape) { + wchar_t *unescaped_word = unescape_string(ctemp, len); + if (unescaped_word == NULL) + return NULL; + return unescaped_word; + } + temp = el_malloc((len + 1) * sizeof(*temp)); + (void) wcsncpy(temp, ctemp, len); + temp[len] = '\0'; + return temp; } /* @@ -651,12 +652,13 @@ find_word_to_complete(const wchar_t * cursor, const wchar_t * buffer, * '!' could never be invoked */ int -fn_complete(EditLine *el, - char *(*complet_func)(const char *, int), - char **(*attempted_completion_function)(const char *, int, int), - const wchar_t *word_break, const wchar_t *special_prefixes, - const char *(*app_func)(const char *), size_t query_items, - int *completion_type, int *over, int *point, int *end) +fn_complete2(EditLine *el, + char *(*complete_func)(const char *, int), + char **(*attempted_completion_function)(const char *, int, int), + const wchar_t *word_break, const wchar_t *special_prefixes, + const char *(*app_func)(const char *), size_t query_items, + int *completion_type, int *over, int *point, int *end, + unsigned int flags) { const LineInfoW *li; wchar_t *temp; @@ -665,6 +667,7 @@ fn_complete(EditLine *el, size_t len; int what_to_do = '\t'; int retval = CC_NORM; + int do_unescape = flags & FN_QUOTE_MATCH; if (el->el_state.lastcmd == el->el_state.thiscmd) what_to_do = '?'; @@ -673,14 +676,14 @@ fn_complete(EditLine *el, if (completion_type != NULL) *completion_type = what_to_do; - if (!complet_func) - complet_func = fn_filename_completion_function; + if (!complete_func) + complete_func = fn_filename_completion_function; if (!app_func) app_func = append_char_function; li = el_wline(el); temp = find_word_to_complete(li->cursor, - li->buffer, word_break, special_prefixes, &len); + li->buffer, word_break, special_prefixes, &len, do_unescape); if (temp == NULL) goto out; @@ -701,117 +704,136 @@ fn_complete(EditLine *el, if (!attempted_completion_function || (over != NULL && !*over && !matches)) matches = completion_matches( - ct_encode_string(temp, &el->el_scratch), complet_func); + ct_encode_string(temp, &el->el_scratch), complete_func); if (over != NULL) *over = 0; - if (matches) { - int i; - size_t matches_num, maxlen, match_len, match_display=1; - int single_match = matches[2] == NULL && - (matches[1] == NULL || strcmp(matches[0], matches[1]) == 0); - - retval = CC_REFRESH; - - if (matches[0][0] != '\0') { - el_deletestr(el, (int)len); - if (!attempted_completion_function) - completion = escape_filename(el, matches[0], - single_match, app_func); - else - completion = strdup(matches[0]); - if (completion == NULL) - goto out; - if (single_match) { - /* We found exact match. Add a space after it, - * unless we do filename completion and the - * object is a directory. Also do necessary - * escape quoting - */ - el_winsertstr(el, - ct_decode_string(completion, &el->el_scratch)); - } else { - /* Only replace the completed string with - * common part of possible matches if there is - * possible completion. - */ - el_winsertstr(el, - ct_decode_string(completion, &el->el_scratch)); - } - free(completion); - } + if (matches == NULL) { + goto out; + } + int i; + size_t matches_num, maxlen, match_len, match_display=1; + int single_match = matches[2] == NULL && + (matches[1] == NULL || strcmp(matches[0], matches[1]) == 0); + + retval = CC_REFRESH; + + if (matches[0][0] != '\0') { + el_deletestr(el, (int)len); + if (flags & FN_QUOTE_MATCH) + completion = escape_filename(el, matches[0], + single_match, app_func); + else + completion = strdup(matches[0]); + if (completion == NULL) + goto out; + /* + * Replace the completed string with the common part of + * all possible matches if there is a possible completion. + */ + el_winsertstr(el, + ct_decode_string(completion, &el->el_scratch)); - if (!single_match && (what_to_do == '!' || what_to_do == '?')) { + if (single_match && attempted_completion_function && + !(flags & FN_QUOTE_MATCH)) + { /* - * More than one match and requested to list possible - * matches. + * We found an exact match. Add a space after + * it, unless we do filename completion and the + * object is a directory. Also do necessary + * escape quoting */ + el_winsertstr(el, ct_decode_string( + (*app_func)(completion), &el->el_scratch)); + } + free(completion); + } - for(i = 1, maxlen = 0; matches[i]; i++) { - match_len = strlen(matches[i]); - if (match_len > maxlen) - maxlen = match_len; - } - /* matches[1] through matches[i-1] are available */ - matches_num = (size_t)(i - 1); - /* newline to get on next line from command line */ - (void)fprintf(el->el_outfile, "\n"); + if (!single_match && (what_to_do == '!' || what_to_do == '?')) { + /* + * More than one match and requested to list possible + * matches. + */ - /* - * If there are too many items, ask user for display - * confirmation. - */ - if (matches_num > query_items) { - (void)fprintf(el->el_outfile, - "Display all %zu possibilities? (y or n) ", - matches_num); - (void)fflush(el->el_outfile); - if (getc(stdin) != 'y') - match_display = 0; - (void)fprintf(el->el_outfile, "\n"); - } + for(i = 1, maxlen = 0; matches[i]; i++) { + match_len = strlen(matches[i]); + if (match_len > maxlen) + maxlen = match_len; + } + /* matches[1] through matches[i-1] are available */ + matches_num = (size_t)(i - 1); - if (match_display) { - /* - * Interface of this function requires the - * strings be matches[1..num-1] for compat. - * We have matches_num strings not counting - * the prefix in matches[0], so we need to - * add 1 to matches_num for the call. - */ - fn_display_match_list(el, matches, - matches_num+1, maxlen, app_func); - } - retval = CC_REDISPLAY; - } else if (matches[0][0]) { + /* newline to get on next line from command line */ + (void)fprintf(el->el_outfile, "\n"); + + /* + * If there are too many items, ask user for display + * confirmation. + */ + if (matches_num > query_items) { + (void)fprintf(el->el_outfile, + "Display all %zu possibilities? (y or n) ", + matches_num); + (void)fflush(el->el_outfile); + if (getc(stdin) != 'y') + match_display = 0; + (void)fprintf(el->el_outfile, "\n"); + } + + if (match_display) { /* - * There was some common match, but the name was - * not complete enough. Next tab will print possible - * completions. + * Interface of this function requires the + * strings be matches[1..num-1] for compat. + * We have matches_num strings not counting + * the prefix in matches[0], so we need to + * add 1 to matches_num for the call. */ - el_beep(el); - } else { - /* lcd is not a valid object - further specification */ - /* is needed */ - el_beep(el); - retval = CC_NORM; + fn_display_match_list(el, matches, + matches_num+1, maxlen, app_func); } - - /* free elements of array and the array itself */ - for (i = 0; matches[i]; i++) - el_free(matches[i]); - el_free(matches); - matches = NULL; + retval = CC_REDISPLAY; + } else if (matches[0][0]) { + /* + * There was some common match, but the name was + * not complete enough. Next tab will print possible + * completions. + */ + el_beep(el); + } else { + /* lcd is not a valid object - further specification */ + /* is needed */ + el_beep(el); + retval = CC_NORM; } + /* free elements of array and the array itself */ + for (i = 0; matches[i]; i++) + el_free(matches[i]); + el_free(matches); + matches = NULL; + out: el_free(temp); return retval; } +int +fn_complete(EditLine *el, + char *(*complete_func)(const char *, int), + char **(*attempted_completion_function)(const char *, int, int), + const wchar_t *word_break, const wchar_t *special_prefixes, + const char *(*app_func)(const char *), size_t query_items, + int *completion_type, int *over, int *point, int *end) +{ + return fn_complete2(el, complete_func, attempted_completion_function, + word_break, special_prefixes, app_func, query_items, + completion_type, over, point, end, + attempted_completion_function ? 0 : FN_QUOTE_MATCH); +} + /* * el-compatible wrapper around rl_complete; needed for key binding */ diff --git a/contrib/libedit/filecomplete.h b/contrib/libedit/filecomplete.h index 61d81389a0f7..60ea4894414b 100644 --- a/contrib/libedit/filecomplete.h +++ b/contrib/libedit/filecomplete.h @@ -1,4 +1,4 @@ -/* $NetBSD: filecomplete.h,v 1.11 2017/04/21 05:38:03 abhinav Exp $ */ +/* $NetBSD: filecomplete.h,v 1.13 2021/03/28 13:38:10 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -36,6 +36,12 @@ int fn_complete(EditLine *, char **(*)(const char *, int, int), const wchar_t *, const wchar_t *, const char *(*)(const char *), size_t, int *, int *, int *, int *); +int fn_complete2(EditLine *, + char *(*)(const char *, int), + char **(*)(const char *, int, int), + const wchar_t *, const wchar_t *, const char *(*)(const char *), size_t, + int *, int *, int *, int *, unsigned int); +#define FN_QUOTE_MATCH 1 /* Quote the returned match */ void fn_display_match_list(EditLine *, char **, size_t, size_t, const char *(*)(const char *)); diff --git a/contrib/libedit/history.c b/contrib/libedit/history.c index 227f72c4a102..73cfa6b8ead9 100644 --- a/contrib/libedit/history.c +++ b/contrib/libedit/history.c @@ -1,4 +1,4 @@ -/* $NetBSD: history.c,v 1.62 2018/09/13 09:03:40 kre Exp $ */ +/* $NetBSD: history.c,v 1.63 2019/10/08 19:17:57 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: history.c,v 1.62 2018/09/13 09:03:40 kre Exp $"); +__RCSID("$NetBSD: history.c,v 1.63 2019/10/08 19:17:57 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -411,21 +411,23 @@ static int history_def_add(void *p, TYPE(HistEvent) *ev, const Char *str) { history_t *h = (history_t *) p; - size_t len; + size_t len, elen, slen; Char *s; HistEventPrivate *evp = (void *)&h->cursor->ev; if (h->cursor == &h->list) return history_def_enter(p, ev, str); - len = Strlen(evp->str) + Strlen(str) + 1; + elen = Strlen(evp->str); + slen = Strlen(str); + len = elen + slen + 1; s = h_malloc(len * sizeof(*s)); if (s == NULL) { he_seterrev(ev, _HE_MALLOC_FAILED); return -1; } - (void) Strncpy(s, h->cursor->ev.str, len); + memcpy(s, evp->str, elen * sizeof(*s)); + memcpy(s + elen, str, slen * sizeof(*s)); s[len - 1] = '\0'; - (void) Strncat(s, str, len - Strlen(s) - 1); h_free(evp->str); evp->str = s; *ev = h->cursor->ev; diff --git a/contrib/libedit/map.c b/contrib/libedit/map.c index 0c489593335a..46bf6f1c9472 100644 --- a/contrib/libedit/map.c +++ b/contrib/libedit/map.c @@ -1,4 +1,4 @@ -/* $NetBSD: map.c,v 1.52 2019/07/23 10:18:52 christos Exp $ */ +/* $NetBSD: map.c,v 1.53 2020/03/30 06:54:37 ryo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: map.c,v 1.52 2019/07/23 10:18:52 christos Exp $"); +__RCSID("$NetBSD: map.c,v 1.53 2020/03/30 06:54:37 ryo Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -906,11 +906,11 @@ map_init(EditLine *el) */ #ifdef MAP_DEBUG if (sizeof(el_map_emacs) != N_KEYS * sizeof(el_action_t)) - EL_ABORT((el->errfile, "Emacs map incorrect\n")); + EL_ABORT((el->el_errfile, "Emacs map incorrect\n")); if (sizeof(el_map_vi_command) != N_KEYS * sizeof(el_action_t)) - EL_ABORT((el->errfile, "Vi command map incorrect\n")); + EL_ABORT((el->el_errfile, "Vi command map incorrect\n")); if (sizeof(el_map_vi_insert) != N_KEYS * sizeof(el_action_t)) - EL_ABORT((el->errfile, "Vi insert map incorrect\n")); + EL_ABORT((el->el_errfile, "Vi insert map incorrect\n")); #endif el->el_map.alt = el_calloc(N_KEYS, sizeof(*el->el_map.alt)); diff --git a/contrib/libedit/readline.c b/contrib/libedit/readline.c index dc852f5539c1..792dddbaf70b 100644 --- a/contrib/libedit/readline.c +++ b/contrib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $NetBSD: readline.c,v 1.157 2019/08/21 11:11:48 christos Exp $ */ +/* $NetBSD: readline.c,v 1.159 2019/10/09 14:31:07 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: readline.c,v 1.157 2019/08/21 11:11:48 christos Exp $"); +__RCSID("$NetBSD: readline.c,v 1.159 2019/10/09 14:31:07 christos Exp $"); #endif /* not lint && not SCCSID */ #include @@ -521,7 +521,7 @@ _rl_compat_sub(const char *str, const char *what, const char *with, s = str; while (*s) { if (*s == *what && !strncmp(s, what, what_len)) { - (void)strncpy(r, with, with_len); + memcpy(r, with, with_len); r += with_len; s += what_len; if (!globally) { @@ -607,8 +607,7 @@ get_history_event(const char *cmd, int *cindex, int qchar) else { if ((pat = el_calloc(len + 1, sizeof(*pat))) == NULL) return NULL; - (void)strncpy(pat, cmd + begin, len); - pat[len] = '\0'; + (void)strlcpy(pat, cmd + begin, len + 1); } if (history(h, &ev, H_CURR) != 0) { @@ -702,8 +701,7 @@ _history_expand_command(const char *command, size_t offs, size_t cmdlen, if ((aptr = el_calloc(offs + 1, sizeof(*aptr))) == NULL) return -1; - (void)strncpy(aptr, command, offs); - aptr[offs] = '\0'; + (void)strlcpy(aptr, command, offs + 1); idx = 1; } else { int qchar; @@ -960,9 +958,8 @@ history_expand(char *str, char **output) } \ result = nresult; \ } \ - (void)strncpy(&result[idx], what, len); \ + (void)strlcpy(&result[idx], what, len + 1); \ idx += len; \ - result[idx] = '\0'; \ } result = NULL; @@ -1150,8 +1147,7 @@ history_tokenize(const char *str) el_free(result); return NULL; } - (void)strncpy(temp, &str[start], len); - temp[len] = '\0'; + (void)strlcpy(temp, &str[start], len + 1); result[idx++] = temp; result[idx] = NULL; if (str[i]) diff --git a/contrib/libedit/refresh.c b/contrib/libedit/refresh.c index 584eec624976..fab29746478c 100644 --- a/contrib/libedit/refresh.c +++ b/contrib/libedit/refresh.c @@ -1,4 +1,4 @@ -/* $NetBSD: refresh.c,v 1.56 2019/01/04 03:03:44 uwe Exp $ */ +/* $NetBSD: refresh.c,v 1.57 2020/03/30 06:54:37 ryo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: refresh.c,v 1.56 2019/01/04 03:03:44 uwe Exp $"); +__RCSID("$NetBSD: refresh.c,v 1.57 2020/03/30 06:54:37 ryo Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -45,6 +45,7 @@ __RCSID("$NetBSD: refresh.c,v 1.56 2019/01/04 03:03:44 uwe Exp $"); * refresh.c: Lower level screen refreshing functions */ #include +#include #include #include diff --git a/contrib/libedit/search.c b/contrib/libedit/search.c index 78e15d720cb8..e909d1475725 100644 --- a/contrib/libedit/search.c +++ b/contrib/libedit/search.c @@ -1,4 +1,4 @@ -/* $NetBSD: search.c,v 1.49 2019/07/23 10:18:52 christos Exp $ */ +/* $NetBSD: search.c,v 1.51 2020/03/30 06:56:38 ryo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: search.c,v 1.49 2019/07/23 10:18:52 christos Exp $"); +__RCSID("$NetBSD: search.c,v 1.51 2020/03/30 06:56:38 ryo Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -162,7 +162,7 @@ libedit_private int c_hmatch(EditLine *el, const wchar_t *str) { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "match `%s' with `%s'\n", + (void) fprintf(el->el_errfile, "match `%ls' with `%ls'\n", el->el_search.patbuf, str); #endif /* SDEBUG */ @@ -182,20 +182,17 @@ c_setpat(EditLine *el) (size_t)(EL_CURSOR(el) - el->el_line.buffer); if (el->el_search.patlen >= EL_BUFSIZ) el->el_search.patlen = EL_BUFSIZ - 1; - if (el->el_search.patlen != 0) { - (void) wcsncpy(el->el_search.patbuf, el->el_line.buffer, - el->el_search.patlen); - el->el_search.patbuf[el->el_search.patlen] = '\0'; - } else - el->el_search.patlen = wcslen(el->el_search.patbuf); + (void) wcsncpy(el->el_search.patbuf, el->el_line.buffer, + el->el_search.patlen); + el->el_search.patbuf[el->el_search.patlen] = '\0'; } #ifdef SDEBUG (void) fprintf(el->el_errfile, "\neventno = %d\n", el->el_history.eventno); - (void) fprintf(el->el_errfile, "patlen = %d\n", el->el_search.patlen); - (void) fprintf(el->el_errfile, "patbuf = \"%s\"\n", + (void) fprintf(el->el_errfile, "patlen = %ld\n", el->el_search.patlen); + (void) fprintf(el->el_errfile, "patbuf = \"%ls\"\n", el->el_search.patbuf); - (void) fprintf(el->el_errfile, "cursor %d lastchar %d\n", + (void) fprintf(el->el_errfile, "cursor %ld lastchar %ld\n", EL_CURSOR(el) - el->el_line.buffer, el->el_line.lastchar - el->el_line.buffer); #endif @@ -573,8 +570,9 @@ cv_repeat_srch(EditLine *el, wint_t c) { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "dir %d patlen %d patbuf %s\n", - c, el->el_search.patlen, ct_encode_string(el->el_search.patbuf)); + static ct_buffer_t conv; + (void) fprintf(el->el_errfile, "dir %d patlen %ld patbuf %s\n", + c, el->el_search.patlen, ct_encode_string(el->el_search.patbuf, &conv)); #endif el->el_state.lastcmd = (el_action_t) c; /* Hack to stop c_setpat */ diff --git a/contrib/libedit/terminal.c b/contrib/libedit/terminal.c index 34f4985a90bc..b3ab5bfb6244 100644 --- a/contrib/libedit/terminal.c +++ b/contrib/libedit/terminal.c @@ -1,4 +1,4 @@ -/* $NetBSD: terminal.c,v 1.39 2019/07/23 10:18:52 christos Exp $ */ +/* $NetBSD: terminal.c,v 1.43 2020/07/10 20:34:24 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95"; #else -__RCSID("$NetBSD: terminal.c,v 1.39 2019/07/23 10:18:52 christos Exp $"); +__RCSID("$NetBSD: terminal.c,v 1.43 2020/07/10 20:34:24 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -497,7 +497,7 @@ terminal_move_to_line(EditLine *el, int where) if (where == el->el_cursor.v) return; - if (where > el->el_terminal.t_size.v) { + if (where >= el->el_terminal.t_size.v) { #ifdef DEBUG_SCREEN (void) fprintf(el->el_errfile, "%s: where is ridiculous: %d\r\n", __func__, where); @@ -647,7 +647,8 @@ terminal_overwrite(EditLine *el, const wchar_t *cp, size_t n) if (el->el_cursor.h >= el->el_terminal.t_size.h) { /* wrap? */ if (EL_HAS_AUTO_MARGINS) { /* yes */ el->el_cursor.h = 0; - el->el_cursor.v++; + if (el->el_cursor.v + 1 < el->el_terminal.t_size.v) + el->el_cursor.v++; if (EL_HAS_MAGIC_MARGINS) { /* force the wrap to avoid the "magic" * situation */ @@ -1314,14 +1315,14 @@ terminal_settc(EditLine *el, int argc __attribute__((__unused__)), const struct termcapstr *ts; const struct termcapval *tv; char what[8], how[8]; + long i; + char *ep; if (argv == NULL || argv[1] == NULL || argv[2] == NULL) return -1; - strncpy(what, ct_encode_string(argv[1], &el->el_scratch), sizeof(what)); - what[sizeof(what) - 1] = '\0'; - strncpy(how, ct_encode_string(argv[2], &el->el_scratch), sizeof(how)); - how[sizeof(how) - 1] = '\0'; + strlcpy(what, ct_encode_string(argv[1], &el->el_scratch), sizeof(what)); + strlcpy(how, ct_encode_string(argv[2], &el->el_scratch), sizeof(how)); /* * Do the strings first @@ -1342,11 +1343,17 @@ terminal_settc(EditLine *el, int argc __attribute__((__unused__)), if (strcmp(tv->name, what) == 0) break; - if (tv->name != NULL) + if (tv->name == NULL) { + (void) fprintf(el->el_errfile, + "%ls: Bad capability `%s'.\n", argv[0], what); return -1; + } if (tv == &tval[T_pt] || tv == &tval[T_km] || tv == &tval[T_am] || tv == &tval[T_xn]) { + /* + * Booleans + */ if (strcmp(how, "yes") == 0) el->el_terminal.t_val[tv - tval] = 1; else if (strcmp(how, "no") == 0) @@ -1357,28 +1364,30 @@ terminal_settc(EditLine *el, int argc __attribute__((__unused__)), return -1; } terminal_setflags(el); - if (terminal_change_size(el, Val(T_li), Val(T_co)) == -1) - return -1; return 0; - } else { - long i; - char *ep; + } - i = strtol(how, &ep, 10); - if (*ep != '\0') { - (void) fprintf(el->el_errfile, - "%ls: Bad value `%s'.\n", argv[0], how); - return -1; - } - el->el_terminal.t_val[tv - tval] = (int) i; + /* + * Numerics + */ + i = strtol(how, &ep, 10); + if (*ep != '\0') { + (void) fprintf(el->el_errfile, + "%ls: Bad value `%s'.\n", argv[0], how); + return -1; + } + el->el_terminal.t_val[tv - tval] = (int) i; + i = 0; + if (tv == &tval[T_co]) { el->el_terminal.t_size.v = Val(T_co); + i++; + } else if (tv == &tval[T_li]) { el->el_terminal.t_size.h = Val(T_li); - if (tv == &tval[T_co] || tv == &tval[T_li]) - if (terminal_change_size(el, Val(T_li), Val(T_co)) - == -1) - return -1; - return 0; + i++; } + if (i && terminal_change_size(el, Val(T_li), Val(T_co)) == -1) + return -1; + return 0; } diff --git a/contrib/libedit/tty.c b/contrib/libedit/tty.c index 743075e08b3f..bafc906ccc4e 100644 --- a/contrib/libedit/tty.c +++ b/contrib/libedit/tty.c @@ -1,4 +1,4 @@ -/* $NetBSD: tty.c,v 1.68 2018/12/02 16:58:13 christos Exp $ */ +/* $NetBSD: tty.c,v 1.69 2020/05/31 23:24:23 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: tty.c,v 1.68 2018/12/02 16:58:13 christos Exp $"); +__RCSID("$NetBSD: tty.c,v 1.69 2020/05/31 23:24:23 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -1163,8 +1163,7 @@ tty_stty(EditLine *el, int argc __attribute__((__unused__)), if (argv == NULL) return -1; - strncpy(name, ct_encode_string(*argv++, &el->el_scratch), sizeof(name)); - name[sizeof(name) - 1] = '\0'; + strlcpy(name, ct_encode_string(*argv++, &el->el_scratch), sizeof(name)); while (argv && *argv && argv[0][0] == '-' && argv[0][2] == '\0') switch (argv[0][1]) { From owner-dev-commits-src-all@freebsd.org Wed May 5 07:24:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D811C632F6B; Wed, 5 May 2021 07:24:11 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZp9l59ptz3GNJ; Wed, 5 May 2021 07:24:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5B64020E88; Wed, 5 May 2021 07:24:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1457OB74048540; Wed, 5 May 2021 07:24:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1457OB7C048539; Wed, 5 May 2021 07:24:11 GMT (envelope-from git) Date: Wed, 5 May 2021 07:24:11 GMT Message-Id: <202105050724.1457OB7C048539@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: c57a440af2da - stable/12 - libucl: vendor import snapshort 20210314 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c57a440af2daf752a99d4e3d7791226734090f06 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 07:24:12 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=c57a440af2daf752a99d4e3d7791226734090f06 commit c57a440af2daf752a99d4e3d7791226734090f06 Author: Baptiste Daroussin AuthorDate: 2021-03-22 14:13:02 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:18:53 +0000 libucl: vendor import snapshort 20210314 (cherry picked from commit a0409676120c1e558d0ade943019934e0f15118d) --- contrib/libucl/CMakeLists.txt | 105 ++- contrib/libucl/ChangeLog.md | 38 +- contrib/libucl/README.md | 64 +- contrib/libucl/configure.ac | 8 +- contrib/libucl/doc/api.md | 17 +- contrib/libucl/doc/libucl.3 | 26 +- contrib/libucl/doc/lua_api.md | 4 +- contrib/libucl/include/lua_ucl.h | 20 +- contrib/libucl/include/ucl++.h | 191 ++++- contrib/libucl/include/ucl.h | 191 ++++- contrib/libucl/klib/kvec.h | 78 ++- contrib/libucl/lua/lua_ucl.c | 450 ++++++++++-- contrib/libucl/python/MANIFEST.in | 5 + contrib/libucl/python/setup.py | 42 +- contrib/libucl/python/src/uclmodule.c | 3 +- contrib/libucl/python/tests/test_example.py | 59 ++ contrib/libucl/python/tests/test_load.py | 17 +- contrib/libucl/src/mum.h | 8 +- contrib/libucl/src/ucl_chartable.h | 4 +- contrib/libucl/src/ucl_emitter.c | 12 +- contrib/libucl/src/ucl_emitter_utils.c | 57 +- contrib/libucl/src/ucl_hash.c | 218 +++++- contrib/libucl/src/ucl_hash.h | 20 +- contrib/libucl/src/ucl_internal.h | 105 ++- contrib/libucl/src/ucl_msgpack.c | 82 ++- contrib/libucl/src/ucl_parser.c | 552 ++++++++++++--- contrib/libucl/src/ucl_schema.c | 29 +- contrib/libucl/src/ucl_util.c | 780 ++++++++++++++++----- contrib/libucl/tests/basic.test | 2 +- contrib/libucl/tests/basic/13.in | 2 +- contrib/libucl/tests/basic/20.in | 2 - contrib/libucl/tests/basic/20.res | 5 - contrib/libucl/tests/basic/21.in | 2 - contrib/libucl/tests/basic/21.res | 10 - contrib/libucl/tests/basic/9.in | 2 +- contrib/libucl/tests/basic/9.res | 8 +- contrib/libucl/tests/basic/squote.in | 8 + contrib/libucl/tests/basic/squote.res | 7 + .../libucl/tests/fuzzers/ucl_add_string_fuzzer.c | 25 + contrib/libucl/tests/fuzzers/ucl_msgpack_fuzzer.c | 29 + contrib/libucl/tests/generate.test | 2 +- contrib/libucl/tests/run_tests.sh | 4 +- contrib/libucl/tests/streamline.test | 2 +- contrib/libucl/tests/test_basic.c | 11 +- contrib/libucl/tests/test_generate.c | 15 +- contrib/libucl/tests/test_msgpack.c | 1 + contrib/libucl/utils/CMakeLists.txt | 12 + contrib/libucl/utils/objdump.c | 17 +- contrib/libucl/utils/ucl-tool.c | 100 +-- 49 files changed, 2820 insertions(+), 631 deletions(-) diff --git a/contrib/libucl/CMakeLists.txt b/contrib/libucl/CMakeLists.txt index 7b55faf8243f..5fe772a30f88 100644 --- a/contrib/libucl/CMakeLists.txt +++ b/contrib/libucl/CMakeLists.txt @@ -9,13 +9,16 @@ SET(LIBUCL_VERSION "${LIBUCL_VERSION_MAJOR}.${LIBUCL_VERSION_MINOR}.${LIBUCL_VERSION_PATCH}") INCLUDE(CheckCCompilerFlag) +INCLUDE(CheckCSourceCompiles) INCLUDE(FindOpenSSL) +INCLUDE(GNUInstallDirs) OPTION(ENABLE_URL_INCLUDE "Enable urls in ucl includes (requires libcurl or libfetch) [default: OFF]" OFF) OPTION(ENABLE_URL_SIGN "Enable signatures check in ucl includes (requires openssl) [default: OFF]" OFF) OPTION(BUILD_SHARED_LIBS "Build Shared Libraries [default: OFF]" OFF) OPTION(ENABLE_LUA "Enable lua support [default: OFF]" OFF) OPTION(ENABLE_LUAJIT "Enable luajit support [default: OFF]" OFF) +OPTION(ENABLE_UTILS "Enable building utility binaries [default: OFF]" OFF) # Find lua installation MACRO(FindLua) @@ -150,40 +153,47 @@ IF(ENABLE_URL_INCLUDE MATCHES "ON") DOC "Path to libfetch header") ELSE(LIBFETCH_LIBRARY) # Try to find libcurl - ProcessPackage(CURL libcurl) + FIND_PACKAGE(CURL) IF(NOT CURL_FOUND) MESSAGE(WARNING "Neither libcurl nor libfetch were found, no support of URL includes in configuration") ENDIF(NOT CURL_FOUND) ENDIF(LIBFETCH_LIBRARY) ENDIF(ENABLE_URL_INCLUDE MATCHES "ON") +set(SYNC_BUILTINS_TEST_SOURCE [====[ +int main() +{ + unsigned long val; + + __sync_bool_compare_and_swap(&val, 0, 1); + __sync_add_and_fetch(&val, 1); + __sync_fetch_and_add(&val, 0); + __sync_sub_and_fetch(&val, 1); + + return 0; +} +]====]) + +CHECK_C_SOURCE_COMPILES("${SYNC_BUILTINS_TEST_SOURCE}" HAVE_ATOMIC_BUILTINS) +IF(NOT HAVE_ATOMIC_BUILTINS) + MESSAGE(WARNING "Libucl references could be thread-unsafe because atomic builtins are missing") +ENDIF(NOT HAVE_ATOMIC_BUILTINS) + SET(CMAKE_C_WARN_FLAGS "") -CHECK_C_COMPILER_FLAG(-Wall SUPPORT_WALL) CHECK_C_COMPILER_FLAG(-W SUPPORT_W) -CHECK_C_COMPILER_FLAG(-Wno-unused-parameter SUPPORT_WPARAM) CHECK_C_COMPILER_FLAG(-Wno-pointer-sign SUPPORT_WPOINTER_SIGN) -CHECK_C_COMPILER_FLAG(-Wstrict-prototypes SUPPORT_WSTRICT_PROTOTYPES) -IF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro) - CHECK_C_COMPILER_FLAG("-std=c99" SUPPORT_STD_FLAG) -ENDIF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro) +CHECK_C_COMPILER_FLAG(-Wno-unused-parameter SUPPORT_WUNUSED_PARAMETER) IF(SUPPORT_W) - SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -W") + SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -W") ENDIF(SUPPORT_W) -IF(SUPPORT_WALL) - SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wall") -ENDIF(SUPPORT_WALL) -IF(SUPPORT_WPARAM) - SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-unused-parameter") -ENDIF(SUPPORT_WPARAM) IF(SUPPORT_WPOINTER_SIGN) SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-pointer-sign") ENDIF(SUPPORT_WPOINTER_SIGN) -IF(SUPPORT_WSTRICT_PROTOTYPES) - SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wstrict-prototypes") -ENDIF(SUPPORT_WSTRICT_PROTOTYPES) -IF(SUPPORT_STD_FLAG) - SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -std=c99") -ENDIF(SUPPORT_STD_FLAG) +IF(SUPPORT_WUNUSED_PARAMETER) + SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-unused-parameter") +ENDIF(SUPPORT_WUNUSED_PARAMETER) + +SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_WARN_FLAGS}" ) IF(ENABLE_URL_SIGN MATCHES "ON") IF(OPENSSL_FOUND) @@ -192,10 +202,19 @@ IF(ENABLE_URL_SIGN MATCHES "ON") ENDIF(OPENSSL_FOUND) ENDIF(ENABLE_URL_SIGN MATCHES "ON") -INCLUDE_DIRECTORIES("src") -INCLUDE_DIRECTORIES("include") -INCLUDE_DIRECTORIES("uthash") -INCLUDE_DIRECTORIES("klib") +SET(UCL_COMPILE_DEFS) +IF(HAVE_FETCH_H) + LIST(APPEND UCL_COMPILE_DEFS -DHAVE_FETCH_H=1) +ENDIF(HAVE_FETCH_H) +IF(CURL_FOUND) + LIST(APPEND UCL_COMPILE_DEFS -DCURL_FOUND=1) +ENDIF(CURL_FOUND) +IF(HAVE_OPENSSL) + LIST(APPEND UCL_COMPILE_DEFS -DHAVE_OPENSSL=1) +ENDIF(HAVE_OPENSSL) +IF(HAVE_ATOMIC_BUILTINS) + LIST(APPEND UCL_COMPILE_DEFS -DHAVE_ATOMIC_BUILTINS=1) +ENDIF(HAVE_ATOMIC_BUILTINS) SET(UCLSRC src/ucl_util.c src/ucl_parser.c @@ -207,13 +226,27 @@ SET(UCLSRC src/ucl_util.c src/ucl_msgpack.c src/ucl_sexp.c) +SET(UCLHDR include/ucl.h + include/ucl++.h) SET (LIB_TYPE STATIC) IF (BUILD_SHARED_LIBS) SET (LIB_TYPE SHARED) ENDIF (BUILD_SHARED_LIBS) ADD_LIBRARY(ucl ${LIB_TYPE} ${UCLSRC}) +ADD_LIBRARY(ucl::ucl ALIAS ucl) SET_TARGET_PROPERTIES(ucl PROPERTIES VERSION ${LIBUCL_VERSION} SOVERSION ${LIBUCL_VERSION_MAJOR}) +TARGET_INCLUDE_DIRECTORIES(ucl + PUBLIC + include + PRIVATE + src + uthash + klib) +TARGET_COMPILE_DEFINITIONS(ucl + PRIVATE + ${UCL_COMPILE_DEFS} +) IF(ENABLE_LUA MATCHES "ON") IF(ENABLE_LUAJIT MATCHES "ON") @@ -236,13 +269,20 @@ IF(ENABLE_LUA MATCHES "ON") ENDIF(ENABLE_LUAJIT MATCHES "ON") SET(UCL_LUA_SRC lua/lua_ucl.c) ADD_LIBRARY(lua-ucl ${LIB_TYPE} ${UCL_LUA_SRC}) + ADD_LIBRARY(ucl::lua ALIAS lua-ucl) IF(ENABLE_LUAJIT MATCHES "ON") TARGET_LINK_LIBRARIES(lua-ucl "${LUAJIT_LIBRARY}") ELSE(ENABLE_LUAJIT MATCHES "ON") TARGET_LINK_LIBRARIES(lua-ucl "${LUA_LIBRARY}") ENDIF(ENABLE_LUAJIT MATCHES "ON") TARGET_LINK_LIBRARIES(lua-ucl ucl) - SET_TARGET_PROPERTIES(lua-ucl PROPERTIES VERSION ${LIBUCL_VERSION} SOVERSION ${LIBUCL_VERSION_MAJOR}) + TARGET_INCLUDE_DIRECTORIES(lua-ucl PUBLIC include PRIVATE src uthash) + SET_TARGET_PROPERTIES(lua-ucl PROPERTIES + VERSION ${LIBUCL_VERSION} + SOVERSION ${LIBUCL_VERSION_MAJOR} + PUBLIC_HEADER include/lua_ucl.h) + INSTALL(TARGETS lua-ucl DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ENDIF() IF(HAVE_FETCH_H) @@ -257,3 +297,18 @@ IF(ENABLE_URL_SIGN MATCHES "ON") TARGET_LINK_LIBRARIES(ucl ${OPENSSL_LIBRARIES}) ENDIF(OPENSSL_FOUND) ENDIF(ENABLE_URL_SIGN MATCHES "ON") + +IF(UNIX) + TARGET_LINK_LIBRARIES(ucl -lm) +ENDIF(UNIX) + +SET_TARGET_PROPERTIES(ucl PROPERTIES + PUBLIC_HEADER "${UCLHDR}") + +INSTALL(TARGETS ucl DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +IF(ENABLE_UTILS MATCHES "ON") + ADD_SUBDIRECTORY(utils) +ENDIF() + diff --git a/contrib/libucl/ChangeLog.md b/contrib/libucl/ChangeLog.md index e4c1263bccb7..cba29aa9a7b5 100644 --- a/contrib/libucl/ChangeLog.md +++ b/contrib/libucl/ChangeLog.md @@ -64,4 +64,40 @@ **Incompatible changes**: -- `ucl_object_emit_full` now accepts additional argument `comments` that could be used to emit comments with UCL output \ No newline at end of file +- `ucl_object_emit_full` now accepts additional argument `comments` that could be used to emit comments with UCL output + +### Libucl 0.8.1 + +- Create ucl_parser_add_file_full() to be able to specify merge mode and parser type (by Allan Jude) +- C++ wrapper improvements (by @ftilde) +- C++ wrapper: add convenience method at() and lookup() (by Yonghee Kim) +- C++ wrapper: add assignment operator to Ucl class (by Yonghee Kim) +- C++ wrapper: support variables in parser (by Yonghee Kim) +- C++ wrapper: refactoring C++ interface (by Yonghee Kim): + - use auto variables (if possible) + - remove dangling expressions + - use std::set::emplace instead of std::set::insert + - not use std::move in return statement; considering copy elision +- C++ wrapper: fix compilation error and warnings (by Zhe Wang) +- C++ wrapper: fix iteration over objects in which the first value is `false` (by Zhe Wang) +- C++ wrapper: Macro helper functions (by Chris Meacham) +- C++ wrapper: Changing the duplicate strategy in the C++ API (by Chris Meacham) +- C++ wrapper: Added access functions for the size of a UCL_ARRAY (by Chris Meacham) +- Fix caseless comparison +- Fix include when EPERM is issued +- Fix Windows build +- Allow to reserve space in arrays and hashes +- Fix bug with including of empty files +- Move to mum_hash from xxhash +- Fix msgpack on non-x86 +- python: Add support to Python 3 (by Denis Volpato Martins) +- python: Add support for Python 2.6 tests (by Denis Volpato Martins) +- python: Implement validation function and tests (by Denis Volpato Martins) +- python: Added UCL_NULL handling and tests (by Denis Volpato Martins) +- Fix schema validation for patternProperties with object data (by Denis Volpato Martins) +- Remove the dependency on NBBY, add missing include (by Ed Schouten) +- Allow to emit msgpack from Lua +- Performance improvements in Lua API +- Allow to pass opaque objects in Lua API for transparent C passthrough +- Various bugs fixed +- Couple of memory leaks plugged \ No newline at end of file diff --git a/contrib/libucl/README.md b/contrib/libucl/README.md index 44983c57d643..53d8a651d73b 100644 --- a/contrib/libucl/README.md +++ b/contrib/libucl/README.md @@ -1,6 +1,6 @@ # LIBUCL -[![Build Status](https://travis-ci.org/vstakhov/libucl.svg?branch=master)](https://travis-ci.org/vstakhov/libucl) +[![CircleCI](https://circleci.com/gh/vstakhov/libucl.svg?style=svg)](https://circleci.com/gh/vstakhov/libucl) [![Coverity](https://scan.coverity.com/projects/4138/badge.svg)](https://scan.coverity.com/projects/4138) [![Coverage Status](https://coveralls.io/repos/github/vstakhov/libucl/badge.svg?branch=master)](https://coveralls.io/github/vstakhov/libucl?branch=master) @@ -18,6 +18,7 @@ - [Macros support](#macros-support) - [Variables support](#variables-support) - [Multiline strings](#multiline-strings) + - [Single quoted strings](#single-quoted-strings) - [Emitter](#emitter) - [Validation](#validation) - [Performance](#performance) @@ -65,19 +66,25 @@ section { ```json { "param": "value", - "param1": "value1", - "flag": true, - "subsection": { - "host": [ - { - "host": "hostname", - "port": 900 - }, - { - "host": "hostname", - "port": 901 + "section": { + "param": "value", + "param1": "value1", + "flag": true, + "number": 10000, + "time": "0.2s", + "string": "something", + "subsection": { + "host": [ + { + "host": "hostname", + "port": 900 + }, + { + "host": "hostname", + "port": 901 + } + ] } - ] } } ``` @@ -288,7 +295,22 @@ as following: By default, the priority of top-level object is set to zero (lowest priority). Currently, you can define up to 16 priorities (from 0 to 15). Includes with bigger priorities will -rewrite keys from the objects with lower priorities as specified by the policy. +rewrite keys from the objects with lower priorities as specified by the policy. The priority +of the top-level or any other object can be changed with the `.priority` macro, which has no +options and takes the new priority: + +``` +# Default priority: 0. +foo = 6 +.priority 5 +# The following will have priority 5. +bar = 6 +baz = 7 +# The following will be included with a priority of 3, 5, and 6 respectively. +.include(priority=3) "path.conf" +.include(priority=5) "equivalent-path.conf" +.include(priority=6) "highpriority-path.conf" +``` ### Variables support @@ -333,9 +355,21 @@ text EOD ``` +### Single quoted strings + +It is possible to use single quoted strings to simplify escaping rules. All values passed in single quoted strings are *NOT* escaped, with two exceptions: a single `'` character just before `\` character, and a newline character just after `\` character that is ignored. + +``` +key = 'value'; # Read as value +key = 'value\n\'; # Read as value\n\ +key = 'value\''; # Read as value' +key = 'value\ +bla'; # Read as valuebla +``` + ## Emitter -Each UCL object can be serialized to one of the three supported formats: +Each UCL object can be serialized to one of the four supported formats: * `JSON` - canonic json notation (with spaces indented structure); * `Compacted JSON` - compact json notation (without spaces or newlines); diff --git a/contrib/libucl/configure.ac b/contrib/libucl/configure.ac index 6457268854ac..731b7113e689 100644 --- a/contrib/libucl/configure.ac +++ b/contrib/libucl/configure.ac @@ -1,7 +1,7 @@ m4_define([maj_ver], [0]) m4_define([med_ver], [8]) -m4_define([min_ver], [0]) -m4_define([so_version], [6:0:0]) +m4_define([min_ver], [1]) +m4_define([so_version], [6:0:1]) m4_define([ucl_version], [maj_ver.med_ver.min_ver]) AC_INIT([libucl],[ucl_version],[https://github.com/vstakhov/libucl],[libucl]) @@ -73,11 +73,11 @@ AC_ARG_ENABLE([utils], AM_CONDITIONAL([UTILS], [test x$utils = xtrue]) AS_IF([test "x$enable_signatures" = "xyes"], [ - AC_SEARCH_LIBS([EVP_MD_CTX_create], [crypto], [ + AC_SEARCH_LIBS([CRYPTO_new_ex_data], [crypto], [ AC_DEFINE(HAVE_OPENSSL, 1, [Define to 1 if you have the 'crypto' library (-lcrypto).]) LIBCRYPTO_LIB="-lcrypto" LIBS_EXTRA="${LIBS_EXTRA} -lcrypto" - ], [AC_MSG_ERROR([unable to find the EVP_MD_CTX_create() function])]) + ], [AC_MSG_ERROR([unable to find the CRYPTO_new_ex_data() function])]) ]) AC_SUBST(LIBCRYPTO_LIB) AC_PATH_PROG(PANDOC, pandoc, [/non/existent]) diff --git a/contrib/libucl/doc/api.md b/contrib/libucl/doc/api.md index 75b954bb302c..a0d33c0e68a9 100644 --- a/contrib/libucl/doc/api.md +++ b/contrib/libucl/doc/api.md @@ -243,7 +243,7 @@ return ret; # Emitting functions -Libucl can transform UCL objects to a number of tectual formats: +Libucl can transform UCL objects to a number of textual formats: - configuration (`UCL_EMIT_CONFIG`) - nginx like human readable configuration file where implicit arrays are transformed to the duplicate keys - compact json: `UCL_EMIT_JSON_COMPACT` - single line valid json without spaces @@ -349,7 +349,7 @@ This object should be released by caller. Libucl provides the functions similar to inverse conversion functions called with the specific C type: - `ucl_object_fromint` - converts `int64_t` to UCL object - `ucl_object_fromdouble` - converts `double` to UCL object -- `ucl_object_fromboolean` - converts `bool` to UCL object +- `ucl_object_frombool` - converts `bool` to UCL object - `ucl_object_fromstring` - converts `const char *` to UCL object (this string should be NULL terminated) - `ucl_object_fromlstring` - converts `const char *` and `size_t` len to UCL object (string does not need to be NULL terminated) @@ -432,7 +432,8 @@ UCL defines the following functions to manage safe iterators: - `ucl_object_iterate_new` - creates new safe iterator - `ucl_object_iterate_reset` - resets iterator to a new object -- `ucl_object_iterate_safe` - safely iterate the object inside iterator +- `ucl_object_iterate_safe` - safely iterate the object inside iterator. Note: function may allocate and free memory during its operation. Therefore it returns `NULL` either while trying to access item after the last one or when exception (such as memory allocation failure) happens. +- `ucl_object_iter_chk_excpn` - check if the last call to `ucl_object_iterate_safe` ended up in unrecoverable exception (e.g. `ENOMEM`). - `ucl_object_iterate_free` - free memory associated with the safe iterator Please note that unlike unsafe iterators, safe iterators *must* be explicitly initialized and freed. @@ -447,6 +448,11 @@ it = ucl_object_iterate_new (obj); while ((cur = ucl_object_iterate_safe (it, true)) != NULL) { /* Do something */ } +/* Check error condition */ +if (ucl_object_iter_chk_excpn (it)) { + ucl_object_iterate_free (it); + exit (1); +} /* Switch to another object */ it = ucl_object_iterate_reset (it, another_obj); @@ -454,6 +460,11 @@ it = ucl_object_iterate_reset (it, another_obj); while ((cur = ucl_object_iterate_safe (it, true)) != NULL) { /* Do something else */ } +/* Check error condition */ +if (ucl_object_iter_chk_excpn (it)) { + ucl_object_iterate_free (it); + exit (1); +} ucl_object_iterate_free (it); ~~~ diff --git a/contrib/libucl/doc/libucl.3 b/contrib/libucl/doc/libucl.3 index ec5046325700..b5fef09f7691 100644 --- a/contrib/libucl/doc/libucl.3 +++ b/contrib/libucl/doc/libucl.3 @@ -612,15 +612,23 @@ Iteration\ without\ expansion: .PP UCL defines the following functions to manage safe iterators: .IP \[bu] 2 -\f[C]ucl_object_iterate_new\f[] \- creates new safe iterator +\f[C]ucl_object_iterate_new\f[] \- creates new safe iterator. .IP \[bu] 2 -\f[C]ucl_object_iterate_reset\f[] \- resets iterator to a new object +\f[C]ucl_object_iterate_reset\f[] \- resets iterator to a new object. .IP \[bu] 2 \f[C]ucl_object_iterate_safe\f[] \- safely iterate the object inside -iterator +iterator. +Note: function may allocate and free memory during its operation. +Therefore it returns \f[C]NULL\f[] either while trying to access item +after the last one or when exception (such as memory allocation +failure) happens. +.IP \[bu] 2 +\f[C]ucl_object_iter_chk_excpn\f[] \- check if the last call to +\f[C]ucl_object_iterate_safe\f[] ended up in unrecoverable exception +(e.g. \f[C]ENOMEM\f[]). .IP \[bu] 2 \f[C]ucl_object_iterate_free\f[] \- free memory associated with the safe -iterator +iterator. .PP Please note that unlike unsafe iterators, safe iterators \f[I]must\f[] be explicitly initialized and freed. @@ -637,6 +645,11 @@ it\ =\ ucl_object_iterate_new\ (obj); while\ ((cur\ =\ ucl_object_iterate_safe\ (it,\ true))\ !=\ NULL)\ { \ \ \ \ /*\ Do\ something\ */ } +/*\ Check\ error\ condition\ */ +if\ (ucl_object_iter_chk_excpn\ (it))\ { +\ \ \ \ ucl_object_iterate_free\ (it); +\ \ \ \ exit\ (1); +} /*\ Switch\ to\ another\ object\ */ it\ =\ ucl_object_iterate_reset\ (it,\ another_obj); @@ -644,6 +657,11 @@ it\ =\ ucl_object_iterate_reset\ (it,\ another_obj); while\ ((cur\ =\ ucl_object_iterate_safe\ (it,\ true))\ !=\ NULL)\ { \ \ \ \ /*\ Do\ something\ else\ */ } +/*\ Check\ error\ condition\ */ +if\ (ucl_object_iter_chk_excpn\ (it))\ { +\ \ \ \ ucl_object_iterate_free\ (it); +\ \ \ \ exit\ (1); +} ucl_object_iterate_free\ (it); \f[] diff --git a/contrib/libucl/doc/lua_api.md b/contrib/libucl/doc/lua_api.md index f7af3caffff4..7da414903b01 100644 --- a/contrib/libucl/doc/lua_api.md +++ b/contrib/libucl/doc/lua_api.md @@ -69,8 +69,8 @@ converts `obj` to lua representation using the following conversions: - *scalar* values are directly presented by lua objects - *userdata* values are converted to lua function objects using `LUA_REGISTRYINDEX`, this can be used to pass functions from lua to c and vice-versa -- *arrays* are converted to lua tables with numeric indicies suitable for `ipairs` iterations -- *objects* are converted to lua tables with string indicies +- *arrays* are converted to lua tables with numeric indices suitable for `ipairs` iterations +- *objects* are converted to lua tables with string indices **Parameters:** diff --git a/contrib/libucl/include/lua_ucl.h b/contrib/libucl/include/lua_ucl.h index 38e74d3f619d..5b7f88e031e1 100644 --- a/contrib/libucl/include/lua_ucl.h +++ b/contrib/libucl/include/lua_ucl.h @@ -54,6 +54,14 @@ UCL_EXTERN int luaopen_ucl (lua_State *L); */ UCL_EXTERN ucl_object_t* ucl_object_lua_import (lua_State *L, int idx); +/** + * Import UCL object from lua state, escaping JSON strings + * @param L lua state + * @param idx index of object at the lua stack to convert to UCL + * @return new UCL object or NULL, the caller should unref object after using + */ +UCL_EXTERN ucl_object_t* ucl_object_lua_import_escape (lua_State *L, int idx); + /** * Push an object to lua * @param L lua state @@ -62,8 +70,16 @@ UCL_EXTERN ucl_object_t* ucl_object_lua_import (lua_State *L, int idx); */ UCL_EXTERN int ucl_object_push_lua (lua_State *L, const ucl_object_t *obj, bool allow_array); +/** + * Push an object to lua replacing all ucl.null with `false` + * @param L lua state + * @param obj object to push + * @param allow_array traverse over implicit arrays + */ +UCL_EXTERN int ucl_object_push_lua_filter_nil (lua_State *L, + const ucl_object_t *obj, + bool allow_array); -UCL_EXTERN struct ucl_lua_funcdata* ucl_object_toclosure ( - const ucl_object_t *obj); +UCL_EXTERN struct ucl_lua_funcdata* ucl_object_toclosure (const ucl_object_t *obj); #endif /* LUA_UCL_H_ */ diff --git a/contrib/libucl/include/ucl++.h b/contrib/libucl/include/ucl++.h index 2c2bdde51559..fb63430d400d 100644 --- a/contrib/libucl/include/ucl++.h +++ b/contrib/libucl/include/ucl++.h @@ -29,6 +29,7 @@ #include #include #include +#include #include "ucl.h" @@ -106,7 +107,7 @@ private: static bool ucl_variable_getter(const unsigned char *data, size_t len, unsigned char ** /*replace*/, size_t * /*replace_len*/, bool *need_free, void* ud) { - *need_free = false; + *need_free = false; auto vars = reinterpret_cast *>(ud); if (vars && data && len != 0) { @@ -123,17 +124,17 @@ private: auto replacer = reinterpret_cast(ud); if (!replacer) { return false; - } + } std::string var_name (data, data + len); if (!replacer->is_variable (var_name)) { return false; - } + } std::string var_value = replacer->replace (var_name); if (var_value.empty ()) { return false; - } + } *replace = (unsigned char *)UCL_ALLOC (var_value.size ()); memcpy (*replace, var_value.data (), var_value.size ()); @@ -152,7 +153,8 @@ private: config_func (parser); if (!parse_func (parser)) { - err.assign (ucl_parser_get_error (parser)); + const char *error = ucl_parser_get_error (parser); //Assigning here without checking result first causes a + if( error != NULL ) err.assign(error); // crash if ucl_parser_get_error returns NULL ucl_parser_free (parser); return nullptr; @@ -168,6 +170,16 @@ private: std::unique_ptr obj; public: + struct macro_handler_s { + ucl_macro_handler handler; + ucl_context_macro_handler ctx_handler; + }; + + struct macro_userdata_s { + ucl_parser *parser; + void *userdata; + }; + class const_iterator { private: struct ucl_iter_deleter { @@ -184,7 +196,7 @@ public: it = std::shared_ptr(ucl_object_iterate_new (obj.obj.get()), ucl_iter_deleter()); cur.reset (new Ucl(ucl_object_iterate_safe (it.get(), true))); - if (cur->type() == UCL_NULL) { + if (!cur->obj) { it.reset (); cur.reset (); } @@ -218,7 +230,7 @@ public: cur.reset (new Ucl(ucl_object_iterate_safe (it.get(), true))); } - if (cur && cur->type() == UCL_NULL) { + if (cur && !cur->obj) { it.reset (); cur.reset (); } @@ -330,7 +342,7 @@ public: return UCL_NULL; } - const std::string key () const { + std::string key () const { std::string res; if (obj->key) { @@ -373,7 +385,7 @@ public: return default_val; } - const std::string string_value (const std::string& default_val = "") const + std::string string_value (const std::string& default_val = "") const { const char* res = nullptr; @@ -384,7 +396,16 @@ public: return default_val; } - const Ucl at (size_t i) const + size_t size () const + { + if (type () == UCL_ARRAY) { + return ucl_array_size (obj.get()); + } + + return 0; + } + + Ucl at (size_t i) const { if (type () == UCL_ARRAY) { return Ucl (ucl_array_find_index (obj.get(), i)); @@ -393,7 +414,7 @@ public: return Ucl (nullptr); } - const Ucl lookup (const std::string &key) const + Ucl lookup (const std::string &key) const { if (type () == UCL_OBJECT) { return Ucl (ucl_object_lookup_len (obj.get(), @@ -403,12 +424,12 @@ public: return Ucl (nullptr); } - inline const Ucl operator[] (size_t i) const + inline Ucl operator[] (size_t i) const { return at(i); } - inline const Ucl operator[](const std::string &key) const + inline Ucl operator[](const std::string &key) const { return lookup(key); } @@ -432,43 +453,116 @@ public: return out; } - static Ucl parse (const std::string &in, std::string &err) + static Ucl parse (const std::string &in, std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) { - return parse (in, std::map(), err); + return parse (in, std::map(), err, duplicate_strategy); } - static Ucl parse (const std::string &in, const std::map &vars, std::string &err) + static Ucl parse (const std::string &in, const std::map &vars, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) { - auto config_func = [&vars] (ucl_parser *parser) { + std::vector< std::tuple< std::string, macro_handler_s, void * > > emptyVector; + return parse ( in, vars, emptyVector, err, duplicate_strategy ); + } + + //Macro handler will receive a macro_userdata_s as void *ud + static Ucl parse (const std::string &in, + std::vector< std::tuple< std::string /*name*/, macro_handler_s, void * /*userdata*/ > > ¯os, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + return parse (in, std::map(), macros, err, duplicate_strategy); + } + + //Macro handler will receive a macro_userdata_s as void *ud + static Ucl parse (const std::string &in, const std::map &vars, + std::vector< std::tuple< std::string /*name*/, macro_handler_s, void * /*userdata*/ > > ¯os, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + //Preserve macro_userdata_s memory for later use in parse_with_strategy_function() + std::vector userdata_list; + userdata_list.reserve (macros.size()); + auto config_func = [&userdata_list, &vars, ¯os] (ucl_parser *parser) { for (const auto & item : vars) { ucl_parser_register_variable (parser, item.first.c_str (), item.second.c_str ()); - } + } + for (auto & macro : macros) { + userdata_list.push_back ({parser, std::get<2>(macro)}); + if (std::get<1>(macro).handler != NULL) { + ucl_parser_register_macro (parser, + std::get<0>(macro).c_str(), + std::get<1>(macro).handler, + reinterpret_cast(&userdata_list.back())); + } + else if (std::get<1>(macro).ctx_handler != NULL) { + ucl_parser_register_context_macro (parser, + std::get<0>(macro).c_str(), + std::get<1>(macro).ctx_handler, + reinterpret_cast(&userdata_list.back())); + } + } }; - auto parse_func = [&in] (ucl_parser *parser) { - return ucl_parser_add_chunk (parser, (unsigned char *)in.data (), in.size ()); + auto parse_func = [&in, &duplicate_strategy] (struct ucl_parser *parser) -> bool { + return ucl_parser_add_chunk_full (parser, + (unsigned char *) in.data (), + in.size (), + (unsigned int)ucl_parser_get_default_priority (parser), + duplicate_strategy, + UCL_PARSE_UCL); }; return parse_with_strategy_function (config_func, parse_func, err); } - static Ucl parse (const std::string &in, const variable_replacer &replacer, std::string &err) - { - auto config_func = [&replacer] (ucl_parser *parser) { - ucl_parser_set_variables_handler (parser, ucl_variable_replacer, - &const_cast(replacer)); + static Ucl parse (const std::string &in, const variable_replacer &replacer, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + std::vector< std::tuple< std::string, macro_handler_s, void * > > emptyVector; + return parse ( in, replacer, emptyVector, err, duplicate_strategy ); + } + + //Macro handler will receive a macro_userdata_s as void *ud + static Ucl parse (const std::string &in, const variable_replacer &replacer, + std::vector< std::tuple< std::string /*name*/, macro_handler_s, void * /*userdata*/ > > ¯os, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + //Preserve macro_userdata_s memory for later use in parse_with_strategy_function() + std::vector userdata_list; + userdata_list.reserve (macros.size()); + auto config_func = [&userdata_list, &replacer, ¯os] (ucl_parser *parser) { + ucl_parser_set_variables_handler (parser, ucl_variable_replacer, &const_cast(replacer)); + for (auto & macro : macros) { + userdata_list.push_back ({parser, std::get<2>(macro)}); + if (std::get<1>(macro).handler != NULL) { + ucl_parser_register_macro (parser, + std::get<0>(macro).c_str(), + std::get<1>(macro).handler, + reinterpret_cast(&userdata_list.back())); + } + else if (std::get<1>(macro).ctx_handler != NULL) { + ucl_parser_register_context_macro (parser, + std::get<0>(macro).c_str(), + std::get<1>(macro).ctx_handler, + reinterpret_cast(&userdata_list.back())); + } + } }; - auto parse_func = [&in] (ucl_parser *parser) { - return ucl_parser_add_chunk (parser, (unsigned char *) in.data (), in.size ()); + auto parse_func = [&in, &duplicate_strategy] (struct ucl_parser *parser) -> bool { + return ucl_parser_add_chunk_full (parser, + (unsigned char *) in.data (), + in.size (), + (unsigned int)ucl_parser_get_default_priority (parser), + duplicate_strategy, + UCL_PARSE_UCL); }; return parse_with_strategy_function (config_func, parse_func, err); } - static Ucl parse (const char *in, std::string &err) + static Ucl parse (const char *in, std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) { - return parse (in, std::map(), err); + return parse (in, std::map(), err, duplicate_strategy); } static Ucl parse (const char *in, const std::map &vars, std::string &err) @@ -480,13 +574,46 @@ public: return parse (std::string (in), vars, err); } - static Ucl parse (const char *in, const variable_replacer &replacer, std::string &err) + //Macro handler will receive a macro_userdata_s as void *ud + static Ucl parse (const char *in, + std::vector< std::tuple< std::string /*name*/, macro_handler_s, void * /*userdata*/ > > ¯os, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + return parse (in, std::map(), macros, err, duplicate_strategy); + } + + //Macro handler will receive a macro_userdata_s as void *ud + static Ucl parse (const char *in, const std::map &vars, + std::vector< std::tuple< std::string /*name*/, macro_handler_s, void * /*userdata*/ > > ¯os, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) { if (!in) { err = "null input"; return nullptr; } - return parse (std::string(in), replacer, err); + return parse (std::string (in), vars, macros, err, duplicate_strategy); + } + + static Ucl parse (const char *in, const variable_replacer &replacer, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + if (!in) { + err = "null input"; + return nullptr; + } + return parse (std::string(in), replacer, err, duplicate_strategy); + } + + //Macro handler will receive a macro_userdata_s as void *ud + static Ucl parse (const char *in, const variable_replacer &replacer, + std::vector< std::tuple< std::string /*name*/, macro_handler_s, void * /*userdata*/ > > ¯os, + std::string &err, enum ucl_duplicate_strategy duplicate_strategy = UCL_DUPLICATE_APPEND) + { + if (!in) { + err = "null input"; + return nullptr; + } + return parse (std::string (in), replacer, macros, err, duplicate_strategy); } static Ucl parse_from_file (const std::string &filename, std::string &err) @@ -556,7 +683,7 @@ public: std::vector result; std::move (vars.begin (), vars.end (), std::back_inserter (result)); - return std::move (result); + return result; } Ucl& operator= (Ucl rhs) diff --git a/contrib/libucl/include/ucl.h b/contrib/libucl/include/ucl.h index fccf6fcb2237..39da2593648d 100644 --- a/contrib/libucl/include/ucl.h +++ b/contrib/libucl/include/ucl.h @@ -105,10 +105,11 @@ typedef enum ucl_error { UCL_EIO, /**< IO error occurred during parsing */ UCL_ESTATE, /**< Invalid state machine state */ UCL_ENESTED, /**< Input has too many recursion levels */ + UCL_EUNPAIRED, /**< Input has too many recursion levels */ UCL_EMACRO, /**< Error processing a macro */ UCL_EINTERNAL, /**< Internal unclassified error */ UCL_ESSL, /**< SSL error */ - UCL_EMERGE /**< A merge error occured */ + UCL_EMERGE /**< A merge error occurred */ } ucl_error_t; /** @@ -177,7 +178,8 @@ typedef enum ucl_string_flags { } ucl_string_flags_t; /** - * Basic flags for an object + * Basic flags for an object (can use up to 12 bits as higher 4 bits are used + * for priorities) */ typedef enum ucl_object_flags { UCL_OBJECT_ALLOCATED_KEY = (1 << 0), /**< An object has key allocated internally */ @@ -187,7 +189,8 @@ typedef enum ucl_object_flags { UCL_OBJECT_MULTILINE = (1 << 4), /**< String should be displayed as multiline string */ UCL_OBJECT_MULTIVALUE = (1 << 5), /**< Object is a key with multiple values */ UCL_OBJECT_INHERITED = (1 << 6), /**< Object has been inherited from another */ - UCL_OBJECT_BINARY = (1 << 7) /**< Object contains raw binary data */ + UCL_OBJECT_BINARY = (1 << 7), /**< Object contains raw binary data */ + UCL_OBJECT_SQUOTED = (1 << 8) /**< Object has been enclosed in single quotes */ } ucl_object_flags_t; /** @@ -462,6 +465,14 @@ UCL_EXTERN ucl_object_t* ucl_object_pop_key (ucl_object_t *top, const char *key) UCL_EXTERN bool ucl_object_insert_key_merged (ucl_object_t *top, ucl_object_t *elt, const char *key, size_t keylen, bool copy_key); +/** + * Reserve space in ucl array or object for `elt` elements + * @param obj object to reserve + * @param reserved size to reserve in an object + * @return 0 on success, -1 on failure (i.e. ENOMEM) + */ +UCL_EXTERN bool ucl_object_reserve (ucl_object_t *obj, size_t reserved); + /** * Append an element to the end of array object * @param top destination object (must NOT be NULL) @@ -533,6 +544,13 @@ UCL_EXTERN ucl_object_t* ucl_array_pop_last (ucl_object_t *top); */ UCL_EXTERN ucl_object_t* ucl_array_pop_first (ucl_object_t *top); *** 5210 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed May 5 07:50:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90A92633B8A; Wed, 5 May 2021 07:50:26 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZpm23jzqz3H4g; Wed, 5 May 2021 07:50:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 727C42111E; Wed, 5 May 2021 07:50:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1457oQDD083175; Wed, 5 May 2021 07:50:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1457oQtK083174; Wed, 5 May 2021 07:50:26 GMT (envelope-from git) Date: Wed, 5 May 2021 07:50:26 GMT Message-Id: <202105050750.1457oQtK083174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: c80150333627 - stable/13 - pw(8): use open_memstream(3) instead of sbuf(9) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c80150333627af3f2adbbdcfda4781a9f0c279dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 07:50:26 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=c80150333627af3f2adbbdcfda4781a9f0c279dd commit c80150333627af3f2adbbdcfda4781a9f0c279dd Author: Baptiste Daroussin AuthorDate: 2021-04-27 03:05:13 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:37:01 +0000 pw(8): use open_memstream(3) instead of sbuf(9) open_memstream(3) is a standard function that brings here the same functionnality what we were doing with sbuf(9). (cherry picked from commit 0cd4b781a6fa1ed4ca04a7b642f41652e25bbc9b) --- usr.sbin/pw/Makefile | 2 +- usr.sbin/pw/pw_conf.c | 86 +++++++++++++++++++++++++++------------------------ 2 files changed, 47 insertions(+), 41 deletions(-) diff --git a/usr.sbin/pw/Makefile b/usr.sbin/pw/Makefile index 8db96d90f6e2..353eac132c7d 100644 --- a/usr.sbin/pw/Makefile +++ b/usr.sbin/pw/Makefile @@ -8,7 +8,7 @@ SRCS= pw.c pw_conf.c pw_user.c pw_group.c pw_log.c pw_nis.c pw_vpw.c \ WARNS?= 3 -LIBADD= crypt util sbuf +LIBADD= crypt util .include diff --git a/usr.sbin/pw/pw_conf.c b/usr.sbin/pw/pw_conf.c index c446a663f082..b9b80f85cd48 100644 --- a/usr.sbin/pw/pw_conf.c +++ b/usr.sbin/pw/pw_conf.c @@ -31,9 +31,6 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -#include -#include - #include #include #include @@ -414,9 +411,11 @@ write_userconfig(struct userconf *cnf, const char *file) { int fd; int i, j; - struct sbuf *buf; + FILE *buffp; FILE *fp; char cfgfile[MAXPATHLEN]; + char *buf; + size_t sz; if (file == NULL) { snprintf(cfgfile, sizeof(cfgfile), "%s/" _PW_CONF, @@ -431,117 +430,124 @@ write_userconfig(struct userconf *cnf, const char *file) close(fd); return (0); } - - buf = sbuf_new_auto(); + + sz = 0; + buf = NULL; + buffp = open_memstream(&buf, &sz); + if (buffp == NULL) + err(EXIT_FAILURE, "open_memstream()"); + for (i = _UC_NONE; i < _UC_FIELDS; i++) { int quote = 1; - sbuf_clear(buf); + if (buf != NULL) + memset(buf, 0, sz); + rewind(buffp); switch (i) { case _UC_DEFAULTPWD: - sbuf_cat(buf, boolean_str(cnf->default_password)); + fputs(boolean_str(cnf->default_password), buffp); break; case _UC_REUSEUID: - sbuf_cat(buf, boolean_str(cnf->reuse_uids)); + fputs(boolean_str(cnf->reuse_uids), buffp); break; case _UC_REUSEGID: - sbuf_cat(buf, boolean_str(cnf->reuse_gids)); + fputs(boolean_str(cnf->reuse_gids), buffp); break; case _UC_NISPASSWD: - sbuf_cat(buf, cnf->nispasswd ? cnf->nispasswd : ""); + fputs(cnf->nispasswd ? cnf->nispasswd : "", buffp); quote = 0; break; case _UC_DOTDIR: - sbuf_cat(buf, cnf->dotdir ? cnf->dotdir : - boolean_str(0)); + fputs(cnf->dotdir ? cnf->dotdir : boolean_str(0), + buffp); break; case _UC_NEWMAIL: - sbuf_cat(buf, cnf->newmail ? cnf->newmail : - boolean_str(0)); + fputs(cnf->newmail ? cnf->newmail : boolean_str(0), + buffp); break; case _UC_LOGFILE: - sbuf_cat(buf, cnf->logfile ? cnf->logfile : - boolean_str(0)); + fputs(cnf->logfile ? cnf->logfile : boolean_str(0), + buffp); break; case _UC_HOMEROOT: - sbuf_cat(buf, cnf->home); + fputs(cnf->home, buffp); break; case _UC_HOMEMODE: - sbuf_printf(buf, "%04o", cnf->homemode); + fprintf(buffp, "%04o", cnf->homemode); quote = 0; break; case _UC_SHELLPATH: - sbuf_cat(buf, cnf->shelldir); + fputs(cnf->shelldir, buffp); break; case _UC_SHELLS: for (j = 0; j < _UC_MAXSHELLS && system_shells[j] != NULL; j++) - sbuf_printf(buf, "%s\"%s\"", j ? + fprintf(buffp, "%s\"%s\"", j ? "," : "", system_shells[j]); quote = 0; break; case _UC_DEFAULTSHELL: - sbuf_cat(buf, cnf->shell_default ? - cnf->shell_default : bourne_shell); + fputs(cnf->shell_default ? cnf->shell_default : + bourne_shell, buffp); break; case _UC_DEFAULTGROUP: - sbuf_cat(buf, cnf->default_group ? - cnf->default_group : ""); + fputs(cnf->default_group ? cnf->default_group : "", + buffp); break; case _UC_EXTRAGROUPS: for (j = 0; cnf->groups != NULL && j < (int)cnf->groups->sl_cur; j++) - sbuf_printf(buf, "%s\"%s\"", j ? + fprintf(buffp, "%s\"%s\"", j ? "," : "", cnf->groups->sl_str[j]); quote = 0; break; case _UC_DEFAULTCLASS: - sbuf_cat(buf, cnf->default_class ? - cnf->default_class : ""); + fputs(cnf->default_class ? cnf->default_class : "", + buffp); break; case _UC_MINUID: - sbuf_printf(buf, "%ju", (uintmax_t)cnf->min_uid); + fprintf(buffp, "%ju", (uintmax_t)cnf->min_uid); quote = 0; break; case _UC_MAXUID: - sbuf_printf(buf, "%ju", (uintmax_t)cnf->max_uid); + fprintf(buffp, "%ju", (uintmax_t)cnf->max_uid); quote = 0; break; case _UC_MINGID: - sbuf_printf(buf, "%ju", (uintmax_t)cnf->min_gid); + fprintf(buffp, "%ju", (uintmax_t)cnf->min_gid); quote = 0; break; case _UC_MAXGID: - sbuf_printf(buf, "%ju", (uintmax_t)cnf->max_gid); + fprintf(buffp, "%ju", (uintmax_t)cnf->max_gid); quote = 0; break; case _UC_EXPIRE: - sbuf_printf(buf, "%jd", (intmax_t)cnf->expire_days); + fprintf(buffp, "%jd", (intmax_t)cnf->expire_days); quote = 0; break; case _UC_PASSWORD: - sbuf_printf(buf, "%jd", (intmax_t)cnf->password_days); + fprintf(buffp, "%jd", (intmax_t)cnf->password_days); quote = 0; break; case _UC_NONE: break; } - sbuf_finish(buf); + fflush(buffp); if (comments[i]) fputs(comments[i], fp); if (*kwds[i]) { if (quote) - fprintf(fp, "%s = \"%s\"\n", kwds[i], - sbuf_data(buf)); + fprintf(fp, "%s = \"%s\"\n", kwds[i], buf); else - fprintf(fp, "%s = %s\n", kwds[i], sbuf_data(buf)); + fprintf(fp, "%s = %s\n", kwds[i], buf); #if debugging - printf("WROTE: %s = %s\n", kwds[i], sbuf_data(buf)); + printf("WROTE: %s = %s\n", kwds[i], buf); #endif } } - sbuf_delete(buf); + fclose(buffp); + free(buf); return (fclose(fp) != EOF); } From owner-dev-commits-src-all@freebsd.org Wed May 5 07:50:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDF13633A13; Wed, 5 May 2021 07:50:27 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZpm34m8Sz3HJP; Wed, 5 May 2021 07:50:27 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 94A3A21305; Wed, 5 May 2021 07:50:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1457oRdP083203; Wed, 5 May 2021 07:50:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1457oRxx083202; Wed, 5 May 2021 07:50:27 GMT (envelope-from git) Date: Wed, 5 May 2021 07:50:27 GMT Message-Id: <202105050750.1457oRxx083202@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 78ee2a028ec5 - stable/13 - pkg(7): when bootstrapping first search for pkg.pkg file then pkg.txz MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 78ee2a028ec5f5e4fe3336d41967de8d521cfe60 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 07:50:27 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=78ee2a028ec5f5e4fe3336d41967de8d521cfe60 commit 78ee2a028ec5f5e4fe3336d41967de8d521cfe60 Author: Baptiste Daroussin AuthorDate: 2021-03-12 17:36:30 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:49:37 +0000 pkg(7): when bootstrapping first search for pkg.pkg file then pkg.txz The package extension is going to be changed to .pkg to be among other things resilient to the change of compression format used and reduce the impact of all third party tool of that change. Ensure the bootstrap knows about it Reviewed by: manu Differential revision: https://reviews.freebsd.org/D29232 (cherry picked from commit a2aac2f5e5642740507a3cadb98046f3dd434ce4) (cherry picked from commit c244b1d8a38731041d0f3ff4191192a85dd8608b) --- usr.sbin/pkg/pkg.c | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 1f787e3dd246..04232672ac39 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -84,6 +84,12 @@ struct fingerprint { STAILQ_ENTRY(fingerprint) next; }; +static const char *bootstrap_names [] = { + "pkg.pkg", + "pkg.txz", + NULL +}; + STAILQ_HEAD(fingerprint_list, fingerprint); static int @@ -836,6 +842,7 @@ bootstrap_pkg(bool force, const char *fetchOpts) const char *packagesite; const char *signature_type; char pkgstatic[MAXPATHLEN]; + const char *bootstrap_name; fd_sig = -1; ret = -1; @@ -858,22 +865,29 @@ bootstrap_pkg(bool force, const char *fetchOpts) if (strncmp(URL_SCHEME_PREFIX, packagesite, strlen(URL_SCHEME_PREFIX)) == 0) packagesite += strlen(URL_SCHEME_PREFIX); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz", packagesite); - - snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - - if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) == -1) + for (int j = 0; bootstrap_names[j] != NULL; j++) { + bootstrap_name = bootstrap_names[j]; + + snprintf(url, MAXPATHLEN, "%s/Latest/%s", packagesite, bootstrap_name); + snprintf(tmppkg, MAXPATHLEN, "%s/%s.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) != -1) + break; + bootstrap_name = NULL; + } + if (bootstrap_name == NULL) goto fetchfail; if (signature_type != NULL && strcasecmp(signature_type, "NONE") != 0) { if (strcasecmp(signature_type, "FINGERPRINTS") == 0) { - snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig", - packagesite); + snprintf(tmpsig, MAXPATHLEN, "%s/%s.sig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + snprintf(url, MAXPATHLEN, "%s/Latest/%s.sig", + packagesite, bootstrap_name); if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { fprintf(stderr, "Signature for pkg not " @@ -886,10 +900,11 @@ bootstrap_pkg(bool force, const char *fetchOpts) } else if (strcasecmp(signature_type, "PUBKEY") == 0) { snprintf(tmpsig, MAXPATHLEN, - "%s/pkg.txz.pubkeysig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.pubkeysig", - packagesite); + "%s/%s.pubkeysig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + snprintf(url, MAXPATHLEN, "%s/Latest/%s.pubkeysig", + packagesite, bootstrap_name); if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { fprintf(stderr, "Signature for pkg not " From owner-dev-commits-src-all@freebsd.org Wed May 5 07:50:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D7AD3633B22; Wed, 5 May 2021 07:50:28 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZpm45jj8z3HJS; Wed, 5 May 2021 07:50:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B6E47211A1; Wed, 5 May 2021 07:50:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1457oSdR083224; Wed, 5 May 2021 07:50:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1457oSVt083223; Wed, 5 May 2021 07:50:28 GMT (envelope-from git) Date: Wed, 5 May 2021 07:50:28 GMT Message-Id: <202105050750.1457oSVt083223@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: d39a1652d4e4 - stable/13 - pkg(7): indentation fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d39a1652d4e402344deee0f31d32e393314c7907 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 07:50:28 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=d39a1652d4e402344deee0f31d32e393314c7907 commit d39a1652d4e402344deee0f31d32e393314c7907 Author: Baptiste Daroussin AuthorDate: 2021-04-27 02:07:05 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:50:02 +0000 pkg(7): indentation fixes Non functional changes (cherry picked from commit f648d757b76d70d58bbda7c3ed3ff79261d24d0f) --- usr.sbin/pkg/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 2bcfd9c405f3..70c745900931 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -51,8 +51,8 @@ __FBSDID("$FreeBSD$"); #define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ struct config_value { - char *value; - STAILQ_ENTRY(config_value) next; + char *value; + STAILQ_ENTRY(config_value) next; }; struct config_entry { From owner-dev-commits-src-all@freebsd.org Wed May 5 07:50:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22660633A98; Wed, 5 May 2021 07:50:30 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZpm572Ytz3H4q; Wed, 5 May 2021 07:50:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DB7A1211A2; Wed, 5 May 2021 07:50:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1457oTPV083245; Wed, 5 May 2021 07:50:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1457oTTb083244; Wed, 5 May 2021 07:50:29 GMT (envelope-from git) Date: Wed, 5 May 2021 07:50:29 GMT Message-Id: <202105050750.1457oTTb083244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 63d098d8d8d6 - stable/13 - pkg(7): replace usage of sbuf(9) with open_memstream(3) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 63d098d8d8d6bb12e7e2652ebb338e526906d83a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 07:50:30 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=63d098d8d8d6bb12e7e2652ebb338e526906d83a commit 63d098d8d8d6bb12e7e2652ebb338e526906d83a Author: Baptiste Daroussin AuthorDate: 2021-04-27 02:38:55 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:50:02 +0000 pkg(7): replace usage of sbuf(9) with open_memstream(3) open_memstream(3) is a standard way to obtain the same feature we do get by using sbuf(9) (aka dynamic size buffer), switching to using it makes pkg(7) more portable, and reduces its number of dependencies. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D30005 (cherry picked from commit cc9a8a116d19daf224222506441e91a3d329160e) --- usr.sbin/pkg/Makefile | 2 +- usr.sbin/pkg/config.c | 33 +++++++++++++++---------- usr.sbin/pkg/pkg.c | 67 +++++++++++++++++++++++++++------------------------ 3 files changed, 56 insertions(+), 46 deletions(-) diff --git a/usr.sbin/pkg/Makefile b/usr.sbin/pkg/Makefile index 980faafc6b6c..a71f0b2acb86 100644 --- a/usr.sbin/pkg/Makefile +++ b/usr.sbin/pkg/Makefile @@ -25,6 +25,6 @@ MAN= pkg.7 CFLAGS+=-I${SRCTOP}/contrib/libucl/include .PATH: ${SRCTOP}/contrib/libucl/include -LIBADD= archive fetch ucl sbuf crypto ssl util +LIBADD= archive fetch ucl crypto ssl util .include diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 70c745900931..97983ea1f58a 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -216,7 +215,9 @@ boolstr_to_bool(const char *str) static void config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) { - struct sbuf *buf = sbuf_new_auto(); + FILE *buffp; + char *buf = NULL; + size_t bufsz = 0; const ucl_object_t *cur, *seq, *tmp; ucl_object_iter_t it = NULL, itseq = NULL, it_obj = NULL; struct config_entry *temp_config; @@ -227,39 +228,44 @@ config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) /* Temporary config for configs that may be disabled. */ temp_config = calloc(CONFIG_SIZE, sizeof(struct config_entry)); + buffp = open_memstream(&buf, &bufsz); + if (buffp == NULL) + err(EXIT_FAILURE, "open_memstream()"); while ((cur = ucl_iterate_object(obj, &it, true))) { key = ucl_object_key(cur); if (key == NULL) continue; - sbuf_clear(buf); + if (buf != NULL) + memset(buf, 0, bufsz); + rewind(buffp); if (conftype == CONFFILE_PKG) { for (j = 0; j < strlen(key); ++j) - sbuf_putc(buf, toupper(key[j])); - sbuf_finish(buf); + fputc(toupper(key[j]), buffp); + fflush(buffp); } else if (conftype == CONFFILE_REPO) { if (strcasecmp(key, "url") == 0) - sbuf_cpy(buf, "PACKAGESITE"); + fputs("PACKAGESITE", buffp); else if (strcasecmp(key, "mirror_type") == 0) - sbuf_cpy(buf, "MIRROR_TYPE"); + fputs("MIRROR_TYPE", buffp); else if (strcasecmp(key, "signature_type") == 0) - sbuf_cpy(buf, "SIGNATURE_TYPE"); + fputs("SIGNATURE_TYPE", buffp); else if (strcasecmp(key, "fingerprints") == 0) - sbuf_cpy(buf, "FINGERPRINTS"); + fputs("FINGERPRINTS", buffp); else if (strcasecmp(key, "pubkey") == 0) - sbuf_cpy(buf, "PUBKEY"); + fputs("PUBKEY", buffp); else if (strcasecmp(key, "enabled") == 0) { if ((cur->type != UCL_BOOLEAN) || !ucl_object_toboolean(cur)) goto cleanup; } else continue; - sbuf_finish(buf); + fflush(buffp); } for (i = 0; i < CONFIG_SIZE; i++) { - if (strcmp(sbuf_data(buf), c[i].key) == 0) + if (strcmp(buf, c[i].key) == 0) break; } @@ -334,7 +340,8 @@ config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) cleanup: free(temp_config); - sbuf_delete(buf); + fclose(buffp); + free(buf); } /*- diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 04232672ac39..8193dc79a430 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -595,7 +594,9 @@ static struct pubkey * read_pubkey(int fd) { struct pubkey *pk; - struct sbuf *sig; + char *sigb; + size_t sigsz; + FILE *sig; char buf[4096]; int r; @@ -604,18 +605,22 @@ read_pubkey(int fd) return (NULL); } - sig = sbuf_new_auto(); + sigsz = 0; + sigb = NULL; + sig = open_memstream(&sigb, &sigsz); + if (sig == NULL) + err(EXIT_FAILURE, "open_memstream()"); while ((r = read(fd, buf, sizeof(buf))) >0) { - sbuf_bcat(sig, buf, r); + fwrite(buf, 1, r, sig); } - sbuf_finish(sig); + fclose(sig); pk = calloc(1, sizeof(struct pubkey)); - pk->siglen = sbuf_len(sig); + pk->siglen = sigsz; pk->sig = calloc(1, pk->siglen); - memcpy(pk->sig, sbuf_data(sig), pk->siglen); - sbuf_delete(sig); + memcpy(pk->sig, sigb, pk->siglen); + free(sigb); return (pk); } @@ -624,16 +629,17 @@ static struct sig_cert * parse_cert(int fd) { int my_fd; struct sig_cert *sc; - FILE *fp; - struct sbuf *buf, *sig, *cert; + FILE *fp, *sigfp, *certfp, *tmpfp; char *line; - size_t linecap; + char *sig, *cert; + size_t linecap, sigsz, certsz; ssize_t linelen; - buf = NULL; sc = NULL; line = NULL; linecap = 0; + sig = cert = NULL; + sigfp = certfp = tmpfp = NULL; if (lseek(fd, 0, 0) == -1) { warn("lseek"); @@ -652,41 +658,38 @@ parse_cert(int fd) { return (NULL); } - sig = sbuf_new_auto(); - cert = sbuf_new_auto(); + sigsz = certsz = 0; + sigfp = open_memstream(&sig, &sigsz); + if (sigfp == NULL) + err(EXIT_FAILURE, "open_memstream()"); + certfp = open_memstream(&cert, &certsz); + if (certfp == NULL) + err(EXIT_FAILURE, "open_memstream()"); while ((linelen = getline(&line, &linecap, fp)) > 0) { if (strcmp(line, "SIGNATURE\n") == 0) { - buf = sig; + tmpfp = sigfp; continue; } else if (strcmp(line, "CERT\n") == 0) { - buf = cert; + tmpfp = certfp; continue; } else if (strcmp(line, "END\n") == 0) { break; } - if (buf != NULL) - sbuf_bcat(buf, line, linelen); + if (tmpfp != NULL) + fwrite(line, 1, linelen, tmpfp); } fclose(fp); - - /* Trim out unrelated trailing newline */ - sbuf_setpos(sig, sbuf_len(sig) - 1); - - sbuf_finish(sig); - sbuf_finish(cert); + fclose(sigfp); + fclose(certfp); sc = calloc(1, sizeof(struct sig_cert)); - sc->siglen = sbuf_len(sig); - sc->sig = calloc(1, sc->siglen); - memcpy(sc->sig, sbuf_data(sig), sc->siglen); - - sc->certlen = sbuf_len(cert); - sc->cert = strdup(sbuf_data(cert)); + sc->siglen = sigsz -1; /* Trim out unrelated trailing newline */ + sc->sig = sig; - sbuf_delete(sig); - sbuf_delete(cert); + sc->certlen = certsz; + sc->cert = cert; return (sc); } From owner-dev-commits-src-all@freebsd.org Wed May 5 08:25:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B6E5634BFC; Wed, 5 May 2021 08:25:25 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqXP275Pz3JQ7; Wed, 5 May 2021 08:25:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3B90721B7F; Wed, 5 May 2021 08:25:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458PPTI028718; Wed, 5 May 2021 08:25:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458PPb7028717; Wed, 5 May 2021 08:25:25 GMT (envelope-from git) Date: Wed, 5 May 2021 08:25:25 GMT Message-Id: <202105050825.1458PPb7028717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 432610226b1c - stable/12 - pw(8): use open_memstream(3) instead of sbuf(9) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 432610226b1ca188c5e7a7029e4852a5ad00edf5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:25:25 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=432610226b1ca188c5e7a7029e4852a5ad00edf5 commit 432610226b1ca188c5e7a7029e4852a5ad00edf5 Author: Baptiste Daroussin AuthorDate: 2021-04-27 03:05:13 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:37:17 +0000 pw(8): use open_memstream(3) instead of sbuf(9) open_memstream(3) is a standard function that brings here the same functionnality what we were doing with sbuf(9). (cherry picked from commit 0cd4b781a6fa1ed4ca04a7b642f41652e25bbc9b) --- usr.sbin/pw/Makefile | 2 +- usr.sbin/pw/pw_conf.c | 86 +++++++++++++++++++++++++++------------------------ 2 files changed, 47 insertions(+), 41 deletions(-) diff --git a/usr.sbin/pw/Makefile b/usr.sbin/pw/Makefile index 8db96d90f6e2..353eac132c7d 100644 --- a/usr.sbin/pw/Makefile +++ b/usr.sbin/pw/Makefile @@ -8,7 +8,7 @@ SRCS= pw.c pw_conf.c pw_user.c pw_group.c pw_log.c pw_nis.c pw_vpw.c \ WARNS?= 3 -LIBADD= crypt util sbuf +LIBADD= crypt util .include diff --git a/usr.sbin/pw/pw_conf.c b/usr.sbin/pw/pw_conf.c index 9dff3fe03efa..38df8cd8f50d 100644 --- a/usr.sbin/pw/pw_conf.c +++ b/usr.sbin/pw/pw_conf.c @@ -31,9 +31,6 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -#include -#include - #include #include #include @@ -412,9 +409,11 @@ write_userconfig(struct userconf *cnf, const char *file) { int fd; int i, j; - struct sbuf *buf; + FILE *buffp; FILE *fp; char cfgfile[MAXPATHLEN]; + char *buf; + size_t sz; if (file == NULL) { snprintf(cfgfile, sizeof(cfgfile), "%s/" _PW_CONF, @@ -429,117 +428,124 @@ write_userconfig(struct userconf *cnf, const char *file) close(fd); return (0); } - - buf = sbuf_new_auto(); + + sz = 0; + buf = NULL; + buffp = open_memstream(&buf, &sz); + if (buffp == NULL) + err(EXIT_FAILURE, "open_memstream()"); + for (i = _UC_NONE; i < _UC_FIELDS; i++) { int quote = 1; - sbuf_clear(buf); + if (buf != NULL) + memset(buf, 0, sz); + rewind(buffp); switch (i) { case _UC_DEFAULTPWD: - sbuf_cat(buf, boolean_str(cnf->default_password)); + fputs(boolean_str(cnf->default_password), buffp); break; case _UC_REUSEUID: - sbuf_cat(buf, boolean_str(cnf->reuse_uids)); + fputs(boolean_str(cnf->reuse_uids), buffp); break; case _UC_REUSEGID: - sbuf_cat(buf, boolean_str(cnf->reuse_gids)); + fputs(boolean_str(cnf->reuse_gids), buffp); break; case _UC_NISPASSWD: - sbuf_cat(buf, cnf->nispasswd ? cnf->nispasswd : ""); + fputs(cnf->nispasswd ? cnf->nispasswd : "", buffp); quote = 0; break; case _UC_DOTDIR: - sbuf_cat(buf, cnf->dotdir ? cnf->dotdir : - boolean_str(0)); + fputs(cnf->dotdir ? cnf->dotdir : boolean_str(0), + buffp); break; case _UC_NEWMAIL: - sbuf_cat(buf, cnf->newmail ? cnf->newmail : - boolean_str(0)); + fputs(cnf->newmail ? cnf->newmail : boolean_str(0), + buffp); break; case _UC_LOGFILE: - sbuf_cat(buf, cnf->logfile ? cnf->logfile : - boolean_str(0)); + fputs(cnf->logfile ? cnf->logfile : boolean_str(0), + buffp); break; case _UC_HOMEROOT: - sbuf_cat(buf, cnf->home); + fputs(cnf->home, buffp); break; case _UC_HOMEMODE: - sbuf_printf(buf, "%04o", cnf->homemode); + fprintf(buffp, "%04o", cnf->homemode); quote = 0; break; case _UC_SHELLPATH: - sbuf_cat(buf, cnf->shelldir); + fputs(cnf->shelldir, buffp); break; case _UC_SHELLS: for (j = 0; j < _UC_MAXSHELLS && system_shells[j] != NULL; j++) - sbuf_printf(buf, "%s\"%s\"", j ? + fprintf(buffp, "%s\"%s\"", j ? "," : "", system_shells[j]); quote = 0; break; case _UC_DEFAULTSHELL: - sbuf_cat(buf, cnf->shell_default ? - cnf->shell_default : bourne_shell); + fputs(cnf->shell_default ? cnf->shell_default : + bourne_shell, buffp); break; case _UC_DEFAULTGROUP: - sbuf_cat(buf, cnf->default_group ? - cnf->default_group : ""); + fputs(cnf->default_group ? cnf->default_group : "", + buffp); break; case _UC_EXTRAGROUPS: for (j = 0; cnf->groups != NULL && j < (int)cnf->groups->sl_cur; j++) - sbuf_printf(buf, "%s\"%s\"", j ? + fprintf(buffp, "%s\"%s\"", j ? "," : "", cnf->groups->sl_str[j]); quote = 0; break; case _UC_DEFAULTCLASS: - sbuf_cat(buf, cnf->default_class ? - cnf->default_class : ""); + fputs(cnf->default_class ? cnf->default_class : "", + buffp); break; case _UC_MINUID: - sbuf_printf(buf, "%ju", (uintmax_t)cnf->min_uid); + fprintf(buffp, "%ju", (uintmax_t)cnf->min_uid); quote = 0; break; case _UC_MAXUID: - sbuf_printf(buf, "%ju", (uintmax_t)cnf->max_uid); + fprintf(buffp, "%ju", (uintmax_t)cnf->max_uid); quote = 0; break; case _UC_MINGID: - sbuf_printf(buf, "%ju", (uintmax_t)cnf->min_gid); + fprintf(buffp, "%ju", (uintmax_t)cnf->min_gid); quote = 0; break; case _UC_MAXGID: - sbuf_printf(buf, "%ju", (uintmax_t)cnf->max_gid); + fprintf(buffp, "%ju", (uintmax_t)cnf->max_gid); quote = 0; break; case _UC_EXPIRE: - sbuf_printf(buf, "%jd", (intmax_t)cnf->expire_days); + fprintf(buffp, "%jd", (intmax_t)cnf->expire_days); quote = 0; break; case _UC_PASSWORD: - sbuf_printf(buf, "%jd", (intmax_t)cnf->password_days); + fprintf(buffp, "%jd", (intmax_t)cnf->password_days); quote = 0; break; case _UC_NONE: break; } - sbuf_finish(buf); + fflush(buffp); if (comments[i]) fputs(comments[i], fp); if (*kwds[i]) { if (quote) - fprintf(fp, "%s = \"%s\"\n", kwds[i], - sbuf_data(buf)); + fprintf(fp, "%s = \"%s\"\n", kwds[i], buf); else - fprintf(fp, "%s = %s\n", kwds[i], sbuf_data(buf)); + fprintf(fp, "%s = %s\n", kwds[i], buf); #if debugging - printf("WROTE: %s = %s\n", kwds[i], sbuf_data(buf)); + printf("WROTE: %s = %s\n", kwds[i], buf); #endif } } - sbuf_delete(buf); + fclose(buffp); + free(buf); return (fclose(fp) != EOF); } From owner-dev-commits-src-all@freebsd.org Wed May 5 08:25:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CD67634F17; Wed, 5 May 2021 08:25:26 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqXQ3Sqdz3JhV; Wed, 5 May 2021 08:25:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 61CB821B99; Wed, 5 May 2021 08:25:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458PQWS028739; Wed, 5 May 2021 08:25:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458PQqP028738; Wed, 5 May 2021 08:25:26 GMT (envelope-from git) Date: Wed, 5 May 2021 08:25:26 GMT Message-Id: <202105050825.1458PQqP028738@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: d1cba26deb90 - stable/12 - fix up docs, if signature checking is enabled, the file MUST exist... MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d1cba26deb90a0f13e5816d69237a061bf4841fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:25:26 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=d1cba26deb90a0f13e5816d69237a061bf4841fd commit d1cba26deb90a0f13e5816d69237a061bf4841fd Author: John-Mark Gurney AuthorDate: 2020-11-06 22:11:05 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 07:51:43 +0000 fix up docs, if signature checking is enabled, the file MUST exist... (cherry picked from commit e771d590741ea39be83558bda72854c65e1084ae) --- usr.sbin/pkg/pkg.7 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/usr.sbin/pkg/pkg.7 b/usr.sbin/pkg/pkg.7 index 342c93420b6a..f7116f5da828 100644 --- a/usr.sbin/pkg/pkg.7 +++ b/usr.sbin/pkg/pkg.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 12, 2013 +.Dd November 6, 2020 .Dt PKG 7 .Os .Sh NAME @@ -69,11 +69,8 @@ If already installed, the command requested will be forwarded to the real Install .Xr pkg 8 from a local package instead of fetching from remote. -If a -.Pa pkg.txz.sig -file exists and -signature checking is enabled, then the signature will be verified -before installing the package. +If signature checking is enabled, then the correct signature file +must exist and the signature valid before the package will be installed. If the .Fl f flag is specified, then From owner-dev-commits-src-all@freebsd.org Wed May 5 08:25:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5878634C53; Wed, 5 May 2021 08:25:27 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqXR52w7z3Jxm; Wed, 5 May 2021 08:25:27 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 83DE5217CA; Wed, 5 May 2021 08:25:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458PRMW028760; Wed, 5 May 2021 08:25:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458PRXa028759; Wed, 5 May 2021 08:25:27 GMT (envelope-from git) Date: Wed, 5 May 2021 08:25:27 GMT Message-Id: <202105050825.1458PRXa028759@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: fb8d0baa3acd - stable/12 - Use asprintf instead of sbuf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fb8d0baa3acd6d0e639dcabaa2039cd0100b5dbb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:25:27 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=fb8d0baa3acd6d0e639dcabaa2039cd0100b5dbb commit fb8d0baa3acd6d0e639dcabaa2039cd0100b5dbb Author: Baptiste Daroussin AuthorDate: 2020-10-19 07:26:42 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:11:10 +0000 Use asprintf instead of sbuf --- usr.sbin/pkg/config.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 80469bf2b5a5..69bdece6c1a9 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include @@ -178,7 +178,7 @@ pkg_get_myabi(char *dest, size_t sz) static void subst_packagesite(const char *abi) { - struct sbuf *newval; + char *newval; const char *variable_string; const char *oldval; @@ -190,14 +190,14 @@ subst_packagesite(const char *abi) if ((variable_string = strstr(oldval, "${ABI}")) == NULL) return; - newval = sbuf_new_auto(); - sbuf_bcat(newval, oldval, variable_string - oldval); - sbuf_cat(newval, abi); - sbuf_cat(newval, variable_string + strlen("${ABI}")); - sbuf_finish(newval); + asprintf(&newval, "%.*s%s%s", + (int)(variable_string - oldval), oldval, abi, + variable_string + strlen("${ABI}")); + if (newval == NULL) + errx(EXIT_FAILURE, "asprintf"); free(c[PACKAGESITE].value); - c[PACKAGESITE].value = strdup(sbuf_data(newval)); + c[PACKAGESITE].value = newval; } static int From owner-dev-commits-src-all@freebsd.org Wed May 5 08:25:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33FEE634FAC; Wed, 5 May 2021 08:25:29 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqXS5W46z3JyT; Wed, 5 May 2021 08:25:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A46CC21C00; Wed, 5 May 2021 08:25:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458PSQV028781; Wed, 5 May 2021 08:25:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458PSCw028780; Wed, 5 May 2021 08:25:28 GMT (envelope-from git) Date: Wed, 5 May 2021 08:25:28 GMT Message-Id: <202105050825.1458PSCw028780@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 0543e10e950d - stable/12 - pkg(7): rework the arguments handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0543e10e950dd5c8b17cdb7cf60b9f95aece094a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:25:29 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=0543e10e950dd5c8b17cdb7cf60b9f95aece094a commit 0543e10e950dd5c8b17cdb7cf60b9f95aece094a Author: Baptiste Daroussin AuthorDate: 2021-01-06 10:35:22 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:16:47 +0000 pkg(7): rework the arguments handling Rework the arguments handling around using getopt_long: * add long option support * add -4 and -6 support to enforce ipv4 or ipv6 While here fix a regression which occured between FreeBSD 12.1 and FreeBSD 12.2 where pkg bootstrap -y stopped working PR: 252270 Submitted by: evilham Differential Revision: https://reviews.freebsd.org/D27860 (cherry picked from commit ae994fdc5bd2ccc0ac0b8745fd1f1be67ad6e071) --- usr.sbin/pkg/pkg.7 | 25 ++++++++++-- usr.sbin/pkg/pkg.c | 117 ++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 102 insertions(+), 40 deletions(-) diff --git a/usr.sbin/pkg/pkg.7 b/usr.sbin/pkg/pkg.7 index f7116f5da828..c672306ac08d 100644 --- a/usr.sbin/pkg/pkg.7 +++ b/usr.sbin/pkg/pkg.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 6, 2020 +.Dd December 31, 2020 .Dt PKG 7 .Os .Sh NAME @@ -36,12 +36,15 @@ .Nm add .Op Fl f +.Op Fl y .Ao Pa pkg.txz Ac .Nm .Fl N .Nm +.Op Fl 4 | Fl 6 bootstrap .Op Fl f +.Op Fl y .Sh DESCRIPTION .Nm is the package management tool. @@ -65,7 +68,7 @@ is not installed yet, it will be fetched, have its signature verified, installed, and then have the original command forwarded to it. If already installed, the command requested will be forwarded to the real .Xr pkg 8 . -.It Nm Li add Oo Fl f Oc Ao Pa pkg.txz Ac +.It Nm Li add Oo Fl f Oc Oo Fl y Oc Ao Pa pkg.txz Ac Install .Xr pkg 8 from a local package instead of fetching from remote. @@ -76,21 +79,37 @@ If the flag is specified, then .Xr pkg 8 will be installed regardless if it is already installed. +If the +.Fl y +flag is specified, no confirmation will be asked when bootstrapping +.Xr pkg 8 . .It Nm Fl N Do not bootstrap, just determine if .Xr pkg 8 is actually installed or not. Returns 0 and the number of packages installed if it is, otherwise 1. -.It Nm Li bootstrap Op Fl f +.It Nm Oo Fl 4 | Fl 6 Oc Li bootstrap Oo Fl f Oc Oo Fl y Oc Attempt to bootstrap and do not forward anything to .Xr pkg 8 after it is installed. +With +.Fl 4 +and +.Fl 6 , +.Nm +will force IPv4 or IPv6 respectively to fetch +.Xr pkg 8 +and its signatures as needed. If the .Fl f flag is specified, then .Xr pkg 8 will be fetched and installed regardless if it is already installed. +If the +.Fl y +flag is specified, no confirmation will be asked when bootstrapping +.Xr pkg 8 . .El .Sh CONFIGURATION Configuration varies in whether it is in a repository configuration file diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 54eaf0882372..aa45a96683ec 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -173,7 +174,7 @@ install_pkg_static(const char *path, const char *pkgpath, bool force) } static int -fetch_to_fd(const char *url, char *path) +fetch_to_fd(const char *url, char *path, const char *fetchOpts) { struct url *u; struct dns_srvinfo *mirrors, *current; @@ -225,7 +226,7 @@ fetch_to_fd(const char *url, char *path) u->port = current->port; } - remote = fetchXGet(u, &st, ""); + remote = fetchXGet(u, &st, fetchOpts); if (remote == NULL) { --retry; if (retry <= 0) @@ -825,7 +826,7 @@ cleanup: } static int -bootstrap_pkg(bool force) +bootstrap_pkg(bool force, const char *fetchOpts) { int fd_pkg, fd_sig; int ret; @@ -862,7 +863,7 @@ bootstrap_pkg(bool force) snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX", getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - if ((fd_pkg = fetch_to_fd(url, tmppkg)) == -1) + if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) == -1) goto fetchfail; if (signature_type != NULL && @@ -874,7 +875,7 @@ bootstrap_pkg(bool force) snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig", packagesite); - if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { + if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { fprintf(stderr, "Signature for pkg not " "available.\n"); goto fetchfail; @@ -890,7 +891,7 @@ bootstrap_pkg(bool force) snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.pubkeysig", packagesite); - if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { + if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { fprintf(stderr, "Signature for pkg not " "available.\n"); goto fetchfail; @@ -945,6 +946,14 @@ static const char non_interactive_message[] = "Please set ASSUME_ALWAYS_YES=yes environment variable to be able to bootstrap " "in non-interactive (stdin not being a tty)\n"; +static const char args_bootstrap_message[] = +"Too many arguments\n" +"Usage: pkg [-4|-6] bootstrap [-f] [-y]\n"; + +static const char args_add_message[] = +"Too many arguments\n" +"Usage: pkg add [-f] [-y] {pkg.txz}\n"; + static int pkg_query_yes_no(void) { @@ -1034,28 +1043,75 @@ main(int argc, char *argv[]) { char pkgpath[MAXPATHLEN]; const char *pkgarg; - int i; - bool bootstrap_only, force, yes; + bool activation_test, add_pkg, bootstrap_only, force, yes; + signed char ch; + const char *fetchOpts; + char *command; + activation_test = false; + add_pkg = false; bootstrap_only = false; + command = NULL; + fetchOpts = ""; force = false; pkgarg = NULL; yes = false; + struct option longopts[] = { + { "force", no_argument, NULL, 'f' }, + { "only-ipv4", no_argument, NULL, '4' }, + { "only-ipv6", no_argument, NULL, '6' }, + { "yes", no_argument, NULL, 'y' }, + { NULL, 0, NULL, 0 }, + }; + snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE); - if (argc > 1 && strcmp(argv[1], "bootstrap") == 0) { - bootstrap_only = true; - if (argc > 3) { - fprintf(stderr, "Too many arguments\nUsage: pkg bootstrap [-f]\n"); - exit(EXIT_FAILURE); - } - if (argc == 3 && strcmp(argv[2], "-f") == 0) { + while ((ch = getopt_long(argc, argv, "-:fyN46", longopts, NULL)) != -1) { + switch (ch) { + case 'f': force = true; - } else if (argc == 3) { - fprintf(stderr, "Invalid argument specified\nUsage: pkg bootstrap [-f]\n"); - exit(EXIT_FAILURE); + break; + case 'N': + activation_test = true; + break; + case 'y': + yes = true; + break; + case '4': + fetchOpts = "4"; + break; + case '6': + fetchOpts = "6"; + break; + case 1: + // Non-option arguments, first one is the command + if (command == NULL) { + command = argv[optind-1]; + if (strcmp(command, "add") == 0) { + add_pkg = true; + } + else if (strcmp(command, "bootstrap") == 0) { + bootstrap_only = true; + } + } + // bootstrap doesn't accept other arguments + else if (bootstrap_only) { + fprintf(stderr, args_bootstrap_message); + exit(EXIT_FAILURE); + } + // For add, we accept exactly one further argument + else if (add_pkg && pkgarg != NULL) { + fprintf(stderr, args_add_message); + exit(EXIT_FAILURE); + } + else if (add_pkg) { + pkgarg = argv[optind-1]; + } + break; + default: + break; } } @@ -1063,19 +1119,14 @@ main(int argc, char *argv[]) /* * To allow 'pkg -N' to be used as a reliable test for whether * a system is configured to use pkg, don't bootstrap pkg - * when that argument is given as argv[1]. + * when that that option is passed. */ - if (argv[1] != NULL && strcmp(argv[1], "-N") == 0) + if (activation_test) errx(EXIT_FAILURE, "pkg is not installed"); config_init(); - if (argc > 1 && strcmp(argv[1], "add") == 0) { - if (argc > 2 && strcmp(argv[2], "-f") == 0) { - force = true; - pkgarg = argv[3]; - } else - pkgarg = argv[2]; + if (add_pkg) { if (pkgarg == NULL) { fprintf(stderr, "Path to pkg.txz required\n"); exit(EXIT_FAILURE); @@ -1093,16 +1144,8 @@ main(int argc, char *argv[]) * not tty. Check the environment to see if user has answer * tucked in there already. */ - config_bool(ASSUME_ALWAYS_YES, &yes); - if (!yes) { - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-y") == 0 || - strcmp(argv[i], "--yes") == 0) { - yes = true; - break; - } - } - } + if (!yes) + config_bool(ASSUME_ALWAYS_YES, &yes); if (!yes) { if (!isatty(fileno(stdin))) { fprintf(stderr, non_interactive_message); @@ -1113,7 +1156,7 @@ main(int argc, char *argv[]) if (pkg_query_yes_no() == 0) exit(EXIT_FAILURE); } - if (bootstrap_pkg(force) != 0) + if (bootstrap_pkg(force, fetchOpts) != 0) exit(EXIT_FAILURE); config_finish(); From owner-dev-commits-src-all@freebsd.org Wed May 5 08:25:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CAAB634FAE; Wed, 5 May 2021 08:25:30 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqXT69vdz3K4Z; Wed, 5 May 2021 08:25:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C3A3E21A1F; Wed, 5 May 2021 08:25:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458PTt7028813; Wed, 5 May 2021 08:25:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458PTgR028812; Wed, 5 May 2021 08:25:29 GMT (envelope-from git) Date: Wed, 5 May 2021 08:25:29 GMT Message-Id: <202105050825.1458PTgR028812@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: c669cd841847 - stable/12 - usr.sbin/pkg: Don't re-define roundup2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c669cd841847766952492eff0566210d35ce93f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:25:30 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=c669cd841847766952492eff0566210d35ce93f9 commit c669cd841847766952492eff0566210d35ce93f9 Author: Alex Richardson AuthorDate: 2021-01-28 17:25:50 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:17:19 +0000 usr.sbin/pkg: Don't re-define roundup2 The file already includes sys/param.h and should use that definition. I found this while testing D28332. Reviewed By: bapt Differential Revision: https://reviews.freebsd.org/D28331 --- usr.sbin/pkg/config.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 69bdece6c1a9..68c3e7d63d1a 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -46,8 +46,6 @@ __FBSDID("$FreeBSD$"); #include "config.h" -#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ - struct config_value { char *value; STAILQ_ENTRY(config_value) next; From owner-dev-commits-src-all@freebsd.org Wed May 5 08:25:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D558634C56; Wed, 5 May 2021 08:25:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqXW0M6fz3K4k; Wed, 5 May 2021 08:25:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E850721A20; Wed, 5 May 2021 08:25:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458PUiW028834; Wed, 5 May 2021 08:25:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458PU8Y028833; Wed, 5 May 2021 08:25:30 GMT (envelope-from git) Date: Wed, 5 May 2021 08:25:30 GMT Message-Id: <202105050825.1458PU8Y028833@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 15ed3e7d70fc - stable/12 - pkg(7): add an -r reponame option for bootstrap and add MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 15ed3e7d70fc13273271f0fe454dc6d43bc6de6a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:25:31 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=15ed3e7d70fc13273271f0fe454dc6d43bc6de6a commit 15ed3e7d70fc13273271f0fe454dc6d43bc6de6a Author: Kyle Evans AuthorDate: 2021-02-12 00:58:26 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:17:31 +0000 pkg(7): add an -r reponame option for bootstrap and add This is limited to bootstrap/add because some real pkg(8) commands have -r flags with an incompatible meaning/usage, e.g., pkg-audit. pkg(7) will still commence the search as it has, but it will ignore any repo objects without the given name so that overrides and whatnot still work as expected. The use of it for add is noted in the manpage; notably, that the signature config for that repository will be used over global config if it's specified. i.e., pkg(7) should assume that the given pkg did come from that repository and treat it appropriately. Reviewed by: bapt, manu MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28524 --- usr.sbin/pkg/config.c | 24 +++++++++++++++--------- usr.sbin/pkg/config.h | 2 +- usr.sbin/pkg/pkg.7 | 37 +++++++++++++++++++++++++++++++------ usr.sbin/pkg/pkg.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 91 insertions(+), 19 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 68c3e7d63d1a..cba8ff49e774 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -341,7 +341,7 @@ cleanup: * etc... */ static void -parse_repo_file(ucl_object_t *obj) +parse_repo_file(ucl_object_t *obj, const char *requested_repo) { ucl_object_iter_t it = NULL; const ucl_object_t *cur; @@ -356,13 +356,17 @@ parse_repo_file(ucl_object_t *obj) if (cur->type != UCL_OBJECT) continue; + if (requested_repo != NULL && strcmp(requested_repo, key) != 0) + continue; + config_parse(cur, CONFFILE_REPO); } } static int -read_conf_file(const char *confpath, pkg_conf_file_t conftype) +read_conf_file(const char *confpath, const char *requested_repo, + pkg_conf_file_t conftype) { struct ucl_parser *p; ucl_object_t *obj = NULL; @@ -386,7 +390,7 @@ read_conf_file(const char *confpath, pkg_conf_file_t conftype) if (conftype == CONFFILE_PKG) config_parse(obj, conftype); else if (conftype == CONFFILE_REPO) - parse_repo_file(obj); + parse_repo_file(obj, requested_repo); } ucl_object_unref(obj); @@ -396,7 +400,7 @@ read_conf_file(const char *confpath, pkg_conf_file_t conftype) } static int -load_repositories(const char *repodir) +load_repositories(const char *repodir, const char *requested_repo) { struct dirent *ent; DIR *d; @@ -420,8 +424,10 @@ load_repositories(const char *repodir) repodir, repodir[strlen(repodir) - 1] == '/' ? "" : "/", ent->d_name); - if (access(path, F_OK) == 0 && - read_conf_file(path, CONFFILE_REPO)) { + if (access(path, F_OK) != 0) + continue; + if (read_conf_file(path, requested_repo, + CONFFILE_REPO)) { ret = 1; goto cleanup; } @@ -435,7 +441,7 @@ cleanup: } int -config_init(void) +config_init(const char *requested_repo) { char *val; int i; @@ -477,7 +483,7 @@ config_init(void) snprintf(confpath, sizeof(confpath), "%s/etc/pkg.conf", localbase); - if (access(confpath, F_OK) == 0 && read_conf_file(confpath, + if (access(confpath, F_OK) == 0 && read_conf_file(confpath, NULL, CONFFILE_PKG)) goto finalize; @@ -495,7 +501,7 @@ config_init(void) } STAILQ_FOREACH(cv, c[REPOS_DIR].list, next) - if (load_repositories(cv->value)) + if (load_repositories(cv->value, requested_repo)) goto finalize; finalize: diff --git a/usr.sbin/pkg/config.h b/usr.sbin/pkg/config.h index b5553111c610..a813ceebc26b 100644 --- a/usr.sbin/pkg/config.h +++ b/usr.sbin/pkg/config.h @@ -59,7 +59,7 @@ typedef enum { CONFFILE_REPO, } pkg_conf_file_t; -int config_init(void); +int config_init(const char *); void config_finish(void); int config_string(pkg_config_key, const char **); int config_bool(pkg_config_key, bool *); diff --git a/usr.sbin/pkg/pkg.7 b/usr.sbin/pkg/pkg.7 index c672306ac08d..b92f5c9820cd 100644 --- a/usr.sbin/pkg/pkg.7 +++ b/usr.sbin/pkg/pkg.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 31, 2020 +.Dd February 7, 2021 .Dt PKG 7 .Os .Sh NAME @@ -36,6 +36,7 @@ .Nm add .Op Fl f +.Op Fl r Ar reponame .Op Fl y .Ao Pa pkg.txz Ac .Nm @@ -44,6 +45,7 @@ add .Op Fl 4 | Fl 6 bootstrap .Op Fl f +.Op Fl r Ar reponame .Op Fl y .Sh DESCRIPTION .Nm @@ -68,7 +70,7 @@ is not installed yet, it will be fetched, have its signature verified, installed, and then have the original command forwarded to it. If already installed, the command requested will be forwarded to the real .Xr pkg 8 . -.It Nm Li add Oo Fl f Oc Oo Fl y Oc Ao Pa pkg.txz Ac +.It Nm Li add Oo Fl f Oc Oo Fl r Ar reponame Oc Oo Fl y Oc Ao Pa pkg.txz Ac Install .Xr pkg 8 from a local package instead of fetching from remote. @@ -83,13 +85,19 @@ If the .Fl y flag is specified, no confirmation will be asked when bootstrapping .Xr pkg 8 . +.Pp +If a +.Ar reponame +has been specified, then the signature configuration for that repository will be +used. .It Nm Fl N Do not bootstrap, just determine if .Xr pkg 8 is actually installed or not. Returns 0 and the number of packages installed if it is, otherwise 1. -.It Nm Oo Fl 4 | Fl 6 Oc Li bootstrap Oo Fl f Oc Oo Fl y Oc +.It Nm Oo Fl 4 | Fl 6 Oc Li bootstrap Oo Fl f Oc \ +Oo Fl r Ar reponame Oc Oo Fl y Oc Attempt to bootstrap and do not forward anything to .Xr pkg 8 after it is installed. @@ -110,14 +118,30 @@ If the .Fl y flag is specified, no confirmation will be asked when bootstrapping .Xr pkg 8 . +.Pp +If a +.Ar reponame +has been specified, then the configuration for that repository will be used. .El .Sh CONFIGURATION Configuration varies in whether it is in a repository configuration file or the global configuration file. +The default repository configuration for +.Fx +is stored in +.Pa /etc/pkg/FreeBSD.conf , +and additional repository configuration files will be searched for in +.Ev REPOS_DIR , +or +.Pa /usr/local/etc/pkg/repos +if it is unset. .Pp -Repository configuration can be stored in -.Pa /etc/pkg/FreeBSD.conf -in the following format: +For bootstrapping, +.Nm +will process all repositories that it finds and use the last enabled repository +by default. +.Pp +Repository configuration is stored in the following format: .Bd -literal -offset indent FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", @@ -127,6 +151,7 @@ FreeBSD: { enabled: yes } .Ed +.Pp .Bl -tag -width signature_type -compact .It url Refer to diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index aa45a96683ec..59348f7fc478 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -1042,7 +1042,7 @@ int main(int argc, char *argv[]) { char pkgpath[MAXPATHLEN]; - const char *pkgarg; + const char *pkgarg, *repo_name; bool activation_test, add_pkg, bootstrap_only, force, yes; signed char ch; const char *fetchOpts; @@ -1055,6 +1055,7 @@ main(int argc, char *argv[]) fetchOpts = ""; force = false; pkgarg = NULL; + repo_name = NULL; yes = false; struct option longopts[] = { @@ -1068,7 +1069,7 @@ main(int argc, char *argv[]) snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE); - while ((ch = getopt_long(argc, argv, "-:fyN46", longopts, NULL)) != -1) { + while ((ch = getopt_long(argc, argv, "-:fr::yN46", longopts, NULL)) != -1) { switch (ch) { case 'f': force = true; @@ -1085,6 +1086,46 @@ main(int argc, char *argv[]) case '6': fetchOpts = "6"; break; + case 'r': + /* + * The repository can only be specified for an explicit + * bootstrap request at this time, so that we don't + * confuse the user if they're trying to use a verb that + * has some other conflicting meaning but we need to + * bootstrap. + * + * For that reason, we specify that -r has an optional + * argument above and process the next index ourselves. + * This is mostly significant because getopt(3) will + * otherwise eat the next argument, which could be + * something we need to try and make sense of. + * + * At worst this gets us false positives that we ignore + * in other contexts, and we have to do a little fudging + * in order to support separating -r from the reponame + * with a space since it's not actually optional in + * the bootstrap/add sense. + */ + if (add_pkg || bootstrap_only) { + if (optarg != NULL) { + repo_name = optarg; + } else if (optind < argc) { + repo_name = argv[optind]; + } + + if (repo_name == NULL || *repo_name == '\0') { + fprintf(stderr, + "Must specify a repository with -r!\n"); + exit(EXIT_FAILURE); + } + + if (optarg == NULL) { + /* Advance past repo name. */ + optreset = 1; + optind++; + } + } + break; case 1: // Non-option arguments, first one is the command if (command == NULL) { @@ -1124,7 +1165,7 @@ main(int argc, char *argv[]) if (activation_test) errx(EXIT_FAILURE, "pkg is not installed"); - config_init(); + config_init(repo_name); if (add_pkg) { if (pkgarg == NULL) { From owner-dev-commits-src-all@freebsd.org Wed May 5 08:25:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCD72635028; Wed, 5 May 2021 08:25: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqXX1pZgz3Jyq; Wed, 5 May 2021 08:25:32 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1AA332175E; Wed, 5 May 2021 08:25:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458PVvZ028855; Wed, 5 May 2021 08:25:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458PVML028854; Wed, 5 May 2021 08:25:31 GMT (envelope-from git) Date: Wed, 5 May 2021 08:25:31 GMT Message-Id: <202105050825.1458PVML028854@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: eabdd103a155 - stable/12 - pkg(7): when bootstrapping first search for pkg.pkg file then pkg. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: eabdd103a155f8c643ab7504cd509fc607b9fd64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:25:33 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=eabdd103a155f8c643ab7504cd509fc607b9fd64 commit eabdd103a155f8c643ab7504cd509fc607b9fd64 Author: Baptiste Daroussin AuthorDate: 2021-03-12 17:36:30 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:19:58 +0000 pkg(7): when bootstrapping first search for pkg.pkg file then pkg. The package extension is going to be changed to .pkg to be among other things resilient to the change of compression format used and reduce the impact of all third party tool of that change. Ensure the bootstrap knows about it Reviewed by: manu Differential revision: https://reviews.freebsd.org/D29232 (cherry picked from commit a2aac2f5e5642740507a3cadb98046f3dd434ce4) (cherry picked from commit c244b1d8a38731041d0f3ff4191192a85dd8608b) --- usr.sbin/pkg/pkg.c | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 59348f7fc478..c499fb28c42d 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -84,6 +84,12 @@ struct fingerprint { STAILQ_ENTRY(fingerprint) next; }; +static const char *bootstrap_names [] = { + "pkg.pkg", + "pkg.txz", + NULL +}; + STAILQ_HEAD(fingerprint_list, fingerprint); static int @@ -836,6 +842,7 @@ bootstrap_pkg(bool force, const char *fetchOpts) const char *packagesite; const char *signature_type; char pkgstatic[MAXPATHLEN]; + const char *bootstrap_name; fd_sig = -1; ret = -1; @@ -858,22 +865,29 @@ bootstrap_pkg(bool force, const char *fetchOpts) if (strncmp(URL_SCHEME_PREFIX, packagesite, strlen(URL_SCHEME_PREFIX)) == 0) packagesite += strlen(URL_SCHEME_PREFIX); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz", packagesite); - - snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - - if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) == -1) + for (int j = 0; bootstrap_names[j] != NULL; j++) { + bootstrap_name = bootstrap_names[j]; + + snprintf(url, MAXPATHLEN, "%s/Latest/%s", packagesite, bootstrap_name); + snprintf(tmppkg, MAXPATHLEN, "%s/%s.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) != -1) + break; + bootstrap_name = NULL; + } + if (bootstrap_name == NULL) goto fetchfail; if (signature_type != NULL && strcasecmp(signature_type, "NONE") != 0) { if (strcasecmp(signature_type, "FINGERPRINTS") == 0) { - snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig", - packagesite); + snprintf(tmpsig, MAXPATHLEN, "%s/%s.sig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + snprintf(url, MAXPATHLEN, "%s/Latest/%s.sig", + packagesite, bootstrap_name); if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { fprintf(stderr, "Signature for pkg not " @@ -886,10 +900,11 @@ bootstrap_pkg(bool force, const char *fetchOpts) } else if (strcasecmp(signature_type, "PUBKEY") == 0) { snprintf(tmpsig, MAXPATHLEN, - "%s/pkg.txz.pubkeysig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.pubkeysig", - packagesite); + "%s/%s.pubkeysig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + snprintf(url, MAXPATHLEN, "%s/Latest/%s.pubkeysig", + packagesite, bootstrap_name); if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { fprintf(stderr, "Signature for pkg not " From owner-dev-commits-src-all@freebsd.org Wed May 5 08:25:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8568D63502B; Wed, 5 May 2021 08:25:33 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqXY2M6Yz3K9G; Wed, 5 May 2021 08:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 367D621B9A; Wed, 5 May 2021 08:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458PXbt028876; Wed, 5 May 2021 08:25:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458PXS1028875; Wed, 5 May 2021 08:25:33 GMT (envelope-from git) Date: Wed, 5 May 2021 08:25:33 GMT Message-Id: <202105050825.1458PXS1028875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 1c6e6d014ae4 - stable/12 - pkg(7): indentation fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1c6e6d014ae45650cfbc961198423e8dd172cc39 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:25:33 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=1c6e6d014ae45650cfbc961198423e8dd172cc39 commit 1c6e6d014ae45650cfbc961198423e8dd172cc39 Author: Baptiste Daroussin AuthorDate: 2021-04-27 02:07:05 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:20:29 +0000 pkg(7): indentation fixes Non functional changes (cherry picked from commit f648d757b76d70d58bbda7c3ed3ff79261d24d0f) --- usr.sbin/pkg/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index cba8ff49e774..3b411859e9c4 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -47,8 +47,8 @@ __FBSDID("$FreeBSD$"); #include "config.h" struct config_value { - char *value; - STAILQ_ENTRY(config_value) next; + char *value; + STAILQ_ENTRY(config_value) next; }; struct config_entry { From owner-dev-commits-src-all@freebsd.org Wed May 5 08:25:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14E8F634CBA; Wed, 5 May 2021 08:25:35 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqXZ3BV0z3Jyx; Wed, 5 May 2021 08:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 48BD521B9B; Wed, 5 May 2021 08:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458PY95028897; Wed, 5 May 2021 08:25:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458PY7J028896; Wed, 5 May 2021 08:25:34 GMT (envelope-from git) Date: Wed, 5 May 2021 08:25:34 GMT Message-Id: <202105050825.1458PY7J028896@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 527a1eda9db8 - stable/12 - pkg(7): replace usage of sbuf(9) with open_memstream(3) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 527a1eda9db8fada53b1434f71f12546fbaf16a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:25:35 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=527a1eda9db8fada53b1434f71f12546fbaf16a4 commit 527a1eda9db8fada53b1434f71f12546fbaf16a4 Author: Baptiste Daroussin AuthorDate: 2021-04-27 02:38:55 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:20:29 +0000 pkg(7): replace usage of sbuf(9) with open_memstream(3) open_memstream(3) is a standard way to obtain the same feature we do get by using sbuf(9) (aka dynamic size buffer), switching to using it makes pkg(7) more portable, and reduces its number of dependencies. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D30005 (cherry picked from commit cc9a8a116d19daf224222506441e91a3d329160e) --- usr.sbin/pkg/Makefile | 1 + usr.sbin/pkg/config.c | 33 +++++++++++++++---------- usr.sbin/pkg/pkg.c | 67 +++++++++++++++++++++++++++------------------------ 3 files changed, 56 insertions(+), 45 deletions(-) diff --git a/usr.sbin/pkg/Makefile b/usr.sbin/pkg/Makefile index ebfb71c1699b..725367ad4485 100644 --- a/usr.sbin/pkg/Makefile +++ b/usr.sbin/pkg/Makefile @@ -26,5 +26,6 @@ MAN= pkg.7 CFLAGS+=-I${SRCTOP}/contrib/libucl/include .PATH: ${SRCTOP}/contrib/libucl/include LIBADD= archive fetch ucl sbuf crypto ssl +LIBADD= archive fetch ucl crypto ssl .include diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 3b411859e9c4..f29bd586f338 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -212,7 +211,9 @@ boolstr_to_bool(const char *str) static void config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) { - struct sbuf *buf = sbuf_new_auto(); + FILE *buffp; + char *buf = NULL; + size_t bufsz = 0; const ucl_object_t *cur, *seq, *tmp; ucl_object_iter_t it = NULL, itseq = NULL, it_obj = NULL; struct config_entry *temp_config; @@ -223,39 +224,44 @@ config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) /* Temporary config for configs that may be disabled. */ temp_config = calloc(CONFIG_SIZE, sizeof(struct config_entry)); + buffp = open_memstream(&buf, &bufsz); + if (buffp == NULL) + err(EXIT_FAILURE, "open_memstream()"); while ((cur = ucl_iterate_object(obj, &it, true))) { key = ucl_object_key(cur); if (key == NULL) continue; - sbuf_clear(buf); + if (buf != NULL) + memset(buf, 0, bufsz); + rewind(buffp); if (conftype == CONFFILE_PKG) { for (j = 0; j < strlen(key); ++j) - sbuf_putc(buf, toupper(key[j])); - sbuf_finish(buf); + fputc(toupper(key[j]), buffp); + fflush(buffp); } else if (conftype == CONFFILE_REPO) { if (strcasecmp(key, "url") == 0) - sbuf_cpy(buf, "PACKAGESITE"); + fputs("PACKAGESITE", buffp); else if (strcasecmp(key, "mirror_type") == 0) - sbuf_cpy(buf, "MIRROR_TYPE"); + fputs("MIRROR_TYPE", buffp); else if (strcasecmp(key, "signature_type") == 0) - sbuf_cpy(buf, "SIGNATURE_TYPE"); + fputs("SIGNATURE_TYPE", buffp); else if (strcasecmp(key, "fingerprints") == 0) - sbuf_cpy(buf, "FINGERPRINTS"); + fputs("FINGERPRINTS", buffp); else if (strcasecmp(key, "pubkey") == 0) - sbuf_cpy(buf, "PUBKEY"); + fputs("PUBKEY", buffp); else if (strcasecmp(key, "enabled") == 0) { if ((cur->type != UCL_BOOLEAN) || !ucl_object_toboolean(cur)) goto cleanup; } else continue; - sbuf_finish(buf); + fflush(buffp); } for (i = 0; i < CONFIG_SIZE; i++) { - if (strcmp(sbuf_data(buf), c[i].key) == 0) + if (strcmp(buf, c[i].key) == 0) break; } @@ -330,7 +336,8 @@ config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) cleanup: free(temp_config); - sbuf_delete(buf); + fclose(buffp); + free(buf); } /*- diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index c499fb28c42d..da3498438fa1 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -595,7 +594,9 @@ static struct pubkey * read_pubkey(int fd) { struct pubkey *pk; - struct sbuf *sig; + char *sigb; + size_t sigsz; + FILE *sig; char buf[4096]; int r; @@ -604,18 +605,22 @@ read_pubkey(int fd) return (NULL); } - sig = sbuf_new_auto(); + sigsz = 0; + sigb = NULL; + sig = open_memstream(&sigb, &sigsz); + if (sig == NULL) + err(EXIT_FAILURE, "open_memstream()"); while ((r = read(fd, buf, sizeof(buf))) >0) { - sbuf_bcat(sig, buf, r); + fwrite(buf, 1, r, sig); } - sbuf_finish(sig); + fclose(sig); pk = calloc(1, sizeof(struct pubkey)); - pk->siglen = sbuf_len(sig); + pk->siglen = sigsz; pk->sig = calloc(1, pk->siglen); - memcpy(pk->sig, sbuf_data(sig), pk->siglen); - sbuf_delete(sig); + memcpy(pk->sig, sigb, pk->siglen); + free(sigb); return (pk); } @@ -624,16 +629,17 @@ static struct sig_cert * parse_cert(int fd) { int my_fd; struct sig_cert *sc; - FILE *fp; - struct sbuf *buf, *sig, *cert; + FILE *fp, *sigfp, *certfp, *tmpfp; char *line; - size_t linecap; + char *sig, *cert; + size_t linecap, sigsz, certsz; ssize_t linelen; - buf = NULL; sc = NULL; line = NULL; linecap = 0; + sig = cert = NULL; + sigfp = certfp = tmpfp = NULL; if (lseek(fd, 0, 0) == -1) { warn("lseek"); @@ -652,41 +658,38 @@ parse_cert(int fd) { return (NULL); } - sig = sbuf_new_auto(); - cert = sbuf_new_auto(); + sigsz = certsz = 0; + sigfp = open_memstream(&sig, &sigsz); + if (sigfp == NULL) + err(EXIT_FAILURE, "open_memstream()"); + certfp = open_memstream(&cert, &certsz); + if (certfp == NULL) + err(EXIT_FAILURE, "open_memstream()"); while ((linelen = getline(&line, &linecap, fp)) > 0) { if (strcmp(line, "SIGNATURE\n") == 0) { - buf = sig; + tmpfp = sigfp; continue; } else if (strcmp(line, "CERT\n") == 0) { - buf = cert; + tmpfp = certfp; continue; } else if (strcmp(line, "END\n") == 0) { break; } - if (buf != NULL) - sbuf_bcat(buf, line, linelen); + if (tmpfp != NULL) + fwrite(line, 1, linelen, tmpfp); } fclose(fp); - - /* Trim out unrelated trailing newline */ - sbuf_setpos(sig, sbuf_len(sig) - 1); - - sbuf_finish(sig); - sbuf_finish(cert); + fclose(sigfp); + fclose(certfp); sc = calloc(1, sizeof(struct sig_cert)); - sc->siglen = sbuf_len(sig); - sc->sig = calloc(1, sc->siglen); - memcpy(sc->sig, sbuf_data(sig), sc->siglen); - - sc->certlen = sbuf_len(cert); - sc->cert = strdup(sbuf_data(cert)); + sc->siglen = sigsz -1; /* Trim out unrelated trailing newline */ + sc->sig = sig; - sbuf_delete(sig); - sbuf_delete(cert); + sc->certlen = certsz; + sc->cert = cert; return (sc); } From owner-dev-commits-src-all@freebsd.org Wed May 5 08:32:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAF5C6353BF; Wed, 5 May 2021 08:32:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqhb6Mwxz3KrS; Wed, 5 May 2021 08:32:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CD7C121C30; Wed, 5 May 2021 08:32:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458WVk8042534; Wed, 5 May 2021 08:32:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458WVFc042533; Wed, 5 May 2021 08:32:31 GMT (envelope-from git) Date: Wed, 5 May 2021 08:32:31 GMT Message-Id: <202105050832.1458WVFc042533@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 1481f6337235 - stable/13 - pci_vendors: update to 2021.01.11 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1481f63372358dfc7d8d84f9d41df8ac7dcfbc26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:32:32 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=1481f63372358dfc7d8d84f9d41df8ac7dcfbc26 commit 1481f63372358dfc7d8d84f9d41df8ac7dcfbc26 Author: Baptiste Daroussin AuthorDate: 2021-01-28 08:19:50 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:30:27 +0000 pci_vendors: update to 2021.01.11 (cherry picked from commit f59810e34bae867059163cb9f651e074043fcec8) --- share/misc/pci_vendors | 104 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 79 insertions(+), 25 deletions(-) diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors index 61b9069d9ca7..c5b923d463af 100644 --- a/share/misc/pci_vendors +++ b/share/misc/pci_vendors @@ -1,8 +1,8 @@ # # List of PCI ID's # -# Version: 2020.12.26 -# Date: 2020-12-26 03:15:02 +# Version: 2021.01.11 +# Date: 2021-01-11 03:15:01 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at https://pci-ids.ucw.cz/. @@ -953,6 +953,7 @@ 1478 Navi 10 XL Upstream Port of PCI Express Switch 1479 Navi 10 XL Downstream Port of PCI Express Switch 154c Kryptos [Radeon RX 350] + 1462 7c28 MS-7C28 Motherboard 154e Garfield 1551 Arlene 1552 Pooky @@ -963,7 +964,7 @@ ea50 cc10 RXi2-BP 15dd Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series] 103c 83c6 Radeon Vega 8 Mobile - 1043 876b PRIME B450M-A Motherboard + 1043 876b PRIME Motherboard 1458 d000 Radeon RX Vega 11 ea50 cc10 RXi2-BP 15de Raven/Raven2/Fenghuang HDMI/DP Audio Controller @@ -977,6 +978,9 @@ 15ff Fenghuang [Zhongshan Subor Z+] 1607 Arden 1636 Renoir + 1638 Cezanne + 163f VanGogh + 164c Lucienne 1714 BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series] 103c 168b ProBook 4535s 3150 RV380/M24 [Mobility Radeon X600] @@ -1766,7 +1770,7 @@ 5964 RV280 [Radeon 9200 SE] 1002 5964 Radeon 9200 SE, 64-bit 128MB DDR, 200/166MHz 1043 c006 Radeon 9200 SE / TD / 128M - 1458 4018 Radeon 9200 SE + 1458 4018 R92S128T (Radeon 9200 SE 128MB) 1458 4032 Radeon 9200 SE 128MB 147b 6191 R9200SE-DT 148c 2073 CN-AG92E @@ -1855,7 +1859,7 @@ 1002 5c63 Apple iBook G4 2004 144d c00c P30 notebook 5d44 RV280 [Radeon 9200 SE] (Secondary) - 1458 4019 Radeon 9200 SE (Secondary) + 1458 4019 R92S128T (Radeon 9200 SE 128MB Secondary) 1458 4032 Radeon 9200 SE 128MB 147b 6190 R9200SE-DT (Secondary) 174b 7c12 Radeon 9200 SE (Secondary) @@ -1994,9 +1998,9 @@ 6667 Jet ULT [Radeon R5 M230] 666f Sun LE [Radeon HD 8550M / R5 M230] 66a0 Vega 20 [Radeon Instinct] - 66a1 Vega 20 + 66a1 Vega 20 WKS GL-XE [Radeon Pro VII] 66a2 Vega 20 - 66a3 Vega 20 + 66a3 Vega 20 [Radeon Pro Vega II/Radeon Pro Vega II Duo] 66a7 Vega 20 [Radeon Pro Vega 20] 66af Vega 20 [Radeon VII] 6704 Cayman PRO GL [FirePro V7900] @@ -2623,6 +2627,7 @@ 1462 3418 Radeon RX 580 Armor 4G OC 1462 341b Radeon RX 570 Armor 8G OC 1462 341e Radeon RX 570 Armor 4G OC + 1462 809e Radeon RX 480 4GB 1462 8a92 Radeon RX 580 148c 2372 Radeon RX 480 [Red Dragon] 148c 2373 Radeon RX 470 @@ -2904,7 +2909,12 @@ 6864 Vega 10 [Radeon Pro V340] 6867 Vega 10 XL [Radeon Pro Vega 56] 6868 Vega 10 [Radeon PRO WX 8100/8200] + 6869 Vega 10 XGA [Radeon Pro Vega 48] + 686a Vega 10 LEA + 686b Vega 10 XTXA [Radeon Pro Vega 64X] 686c Vega 10 [Radeon Instinct MI25 MxGPU] + 686d Vega 10 GLXTA + 686e Vega 10 GLXLA 687f Vega 10 XL/XT [Radeon RX Vega 56/64] 1002 0b36 RX Vega64 1002 6b76 RX Vega64 @@ -3155,6 +3165,7 @@ 17af 3000 Radeon HD 6510 17af 3010 Radeon HD 5630 68da Redwood LE [Radeon HD 5550/5570/5630/6390/6490/7570] + 1462 8071 VR5550-MD1G (Radeon HD 5550) 148c 3000 Radeon HD 6390 148c 3001 Radeon HD 6490 1545 7570 Radeon HD 7570 @@ -3602,6 +3613,9 @@ 7347 Navi 14 [Radeon Pro W5500M] 734f Navi 14 [Radeon Pro W5300M] 7360 Navi 12 [Radeon Pro 5600M] + 7388 Arcturus GL-XL + 738c Arcturus GL-XL [AMD Instinct MI100] + 738e Arcturus GL-XL 73bf Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] 73c3 Navi 22 73df Navi 22 @@ -4677,6 +4691,7 @@ 149b Starship Reserved SSP 149c Matisse USB 3.0 Host Controller 1462 7c37 X570-A PRO motherboard + 149d Vangogh CVIP 1510 Family 14h Processor Root Complex 174b 1001 PURE Fusion Mini 1512 Family 14h Processor Root Port @@ -4776,17 +4791,17 @@ 15dc Raven/Raven2 Internal PCIe GPP Bridge 0 to Bus B 15de Raven/Raven2/FireFlight HD Audio Controller 15df Family 17h (Models 10h-1fh) Platform Security Processor - 1043 876b PRIME B450M-A Motherboard + 1043 876b PRIME Motherboard 17aa 5124 ThinkPad E595 ea50 ce19 mCOM10-L1900 15e0 Raven USB 3.1 103c 8615 Pavilion Laptop 15-cw1xxx - 1043 876b PRIME B450M-A Motherboard + 1043 876b PRIME Motherboard 17aa 5124 ThinkPad E595 ea50 ce19 mCOM10-L1900 15e1 Raven USB 3.1 103c 8615 Pavilion Laptop 15-cw1xxx - 1043 876b PRIME B450M-A Motherboard + 1043 876b PRIME Motherboard 17aa 5124 ThinkPad E595 ea50 ce19 mCOM10-L1900 15e2 Raven/Raven2/FireFlight/Renoir Audio Processor @@ -4862,6 +4877,8 @@ 1642 Renoir WLAN 1643 Renoir BT 1644 Renoir I2S + 1648 VanGogh Root Complex + 1649 VanGogh PSP/CCP 1700 Family 12h/14h Processor Function 0 1701 Family 12h/14h Processor Function 1 1702 Family 12h/14h Processor Function 2 @@ -5060,7 +5077,7 @@ 7900 FCH SATA Controller [IDE mode] 7901 FCH SATA Controller [AHCI mode] 103c 8615 Pavilion Laptop 15-cw1xxx - 1043 876b PRIME B450M-A Motherboard + 1043 876b PRIME Motherboard 1462 7c37 X570-A PRO motherboard ea50 ce19 mCOM10-L1900 7902 FCH SATA Controller [RAID mode] @@ -5070,7 +5087,7 @@ 7908 FCH USB EHCI Controller 790b FCH SMBus Controller 103c 8615 Pavilion Laptop 15-cw1xxx - 1043 876b PRIME B450M-A Motherboard + 1043 876b PRIME Motherboard 1462 7c37 X570-A PRO motherboard 17aa 5124 ThinkPad E595 ea50 ce19 mCOM10-L1900 @@ -5664,6 +5681,7 @@ 1931 000a GlobeTrotter Fusion Quad Lite (PPP data) 1931 000b GlobeTrotter Fusion Quad Lite (GSM data) 807d 0035 PCI-USB2 (OHCI subsystem) + 8086 4d44 D850EMV2 motherboard 003b PCI to C-bus Bridge 003e NAPCCARD Cardbus Controller 0046 PowerVR PCX2 [midas] @@ -5694,6 +5712,7 @@ 14c2 0205 PTI-205N USB 2.0 Host Controller 1799 0002 Root Hub 807d 1043 PCI-USB2 (EHCI subsystem) + 8086 4d44 D850EMV2 motherboard 00e7 uPD72873 [Firewarden] IEEE1394a OHCI 1.1 Link/2-port PHY Controller 00f2 uPD72874 [Firewarden] IEEE1394a OHCI 1.1 Link/3-port PHY Controller 00f3 uPD6113x Multimedia Decoder/Processor [EMMA2] @@ -11911,6 +11930,7 @@ 1aeb TU116 High Definition Audio Controller 1aec TU116 USB 3.1 Host Controller 1aed TU116 USB Type-C UCSI Controller + 1aef GA102 High Definition Audio Controller 1b00 GP102 [TITAN X] 1b01 GP102 [GeForce GTX 1080 Ti 10GB] 1b02 GP102 [TITAN Xp] @@ -12142,6 +12162,7 @@ 2192 TU116M [GeForce GTX 1650 Ti Mobile] 21ae TU116GL 21bf TU116GL + 21c2 TU116 21c4 TU116 [GeForce GTX 1660 SUPER] 21d1 TU116BM [GeForce GTX 1660 Ti Mobile] 2204 GA102 [GeForce RTX 3090] @@ -12164,9 +12185,11 @@ 2486 GA104 [GeForce RTX 3060 Ti] 249c GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB] 249d GA104M [GeForce RTX 3070 Mobile / Max-Q] + 249f GA104M 24ac GA104 [GeForce RTX 30x0 Engineering Sample] 24ad GA104 [GeForce RTX 3060 Engineering Sample] 24af GA104 [GeForce RTX 3070 Engineering Sample] + 24b6 GA104 24bf GA104 [GeForce RTX 3070 Engineering Sample] 24dc GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB] 24dd GA104M [GeForce RTX 3070 Mobile / Max-Q] @@ -12558,7 +12581,7 @@ ea50 ce19 mCOM10-L1900 816c RTL8111xP IPMI interface ea50 ce19 mCOM10-L1900 - 816d RTL8111xP EHCI host controller + 816d RTL811x EHCI host controller ea50 ce19 mCOM10-L1900 8171 RTL8191SEvA Wireless LAN Controller 8172 RTL8191SEvB Wireless LAN Controller @@ -12622,6 +12645,7 @@ 5005 Alveo U250 7038 FPGA Card XC7VX690T 17aa 402f FPGA XC7VX690T-3FFG1157E + 8019 Memory controller 8380 Ellips ProfiXpress Profibus Master 8381 Ellips Santos Frame Grabber d154 Copley Controls CAN card (PCI-CAN-02) @@ -16254,6 +16278,7 @@ 8888 IT8888F/G PCI to ISA Bridge with SMB [Golden Gate] 8889 IT8889F PCI to ISA Bridge 8892 IT8892E PCIe to PCI Bridge + 8086 200d DH61CR motherboard 8893 IT8893E PCIe to PCI Bridge e886 IT8330G 1284 Sahara Networks, Inc. @@ -19167,6 +19192,7 @@ 1805 BCM57508 NetXtreme-E RDMA Partition 1806 BCM5750X NetXtreme-E Ethernet Virtual Function 1807 BCM5750X NetXtreme-E RDMA Virtual Function + 2711 BCM2711 PCIe Bridge 3352 BCM3352 3360 BCM3360 4210 BCM4210 iLine10 HomePNA 2.0 @@ -21361,6 +21387,7 @@ 0400 Datacenter Technologies QDF2432 PCI Express Root Port 0401 Datacenter Technologies QDF2400 PCI Express Root Port 1000 QCS405 PCIe Root Complex + 1101 QCA6390 Wireless Network Adapter [AX500-DBS (2x2)] 17cc NetChip Technology, Inc 2280 USB 2.0 17cd Cadence Design Systems, Inc. @@ -22816,8 +22843,9 @@ 9192 88SE9172 SATA III 6Gb/s RAID Controller 91a0 88SE912x SATA 6Gb/s Controller [IDE mode] 91a4 88SE912x IDE Controller + 9215 88SE9215 PCIe 2.0 x1 4-port SATA 6 Gb/s Controller 9220 88SE9220 PCIe 2.0 x2 2-port SATA 6 Gb/s RAID Controller - 9230 88SE9230 PCIe SATA 6Gb/s Controller + 9230 88SE9230 PCIe 2.0 x2 4-port SATA 6 Gb/s RAID Controller 1028 1fd6 BOSS-S1 Adapter 1028 1fdf BOSS-S1 Modular 1028 1fe2 BOSS-S1 Adapter @@ -23060,10 +23088,9 @@ 2839 PE8000 Series NVMe Solid State Drive 1c5c 0100 PE8000 Series NVMe Solid State Drive 1c5f Beijing Memblaze Technology Co. Ltd. - 000d PBlaze5 520/526 AIC - 003d PBlaze5 920/926 AIC - 010d PBlaze5 520/526 U.2 - 013d PBlaze5 920/926 U.2 + 000d PBlaze5 520/526 + 003d PBlaze5 920/926 + 003e PBlaze6 6920 0540 PBlaze4 NVMe SSD 0550 PBlaze5 700/900 0555 PBlaze5 510/516 @@ -23509,6 +23536,7 @@ 0002 T11 [CloudBlazer] 0003 T10s [CloudBlazer] 8011 I10 [CloudBlazer] + 8012 I10L [CloudBlazer] # nee Thinci, Inc 1e38 Blaize, Inc 0102 Xplorer X1600 @@ -23549,7 +23577,7 @@ 1601 NVMe SSD Controller MAP1601 1e4c GSI Technology # Associative Processing Unit (APU) - 0010 APU [Leda-G] + 0010 APU [Leda] 1e4c 0120 SE120 1e57 Beijing Panyi Technology Co., Ltd 0100 The device has already been deleted. @@ -24408,6 +24436,7 @@ 0100 2nd Generation Core Processor Family DRAM Controller 1028 04aa XPS 8300 1043 844d P8P67/P8H67 Series Motherboard + 8086 200d DH61CR motherboard 0101 Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port 1028 04b2 Vostro 3350 106b 00dc MacBookPro8,2 [Core i7, 15", 2011] @@ -24487,6 +24516,7 @@ 1043 844d P8B WS Motherboard 0172 Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller 0176 3rd Gen Core processor Graphics Controller + 0201 Arctic Sound 0284 Comet Lake PCH-LP LPC Premium Controller/eSPI Controller 02a3 Comet Lake PCH-LP SMBus Host Controller 02a4 Comet Lake SPI (flash) Controller @@ -26147,6 +26177,7 @@ 1503 82579V Gigabit Network Connection 1043 849c P8P67 Deluxe Motherboard 10cf 161c LIFEBOOK E752 + 8086 200d DH61CR motherboard 1507 Ethernet Express Module X520-P2 1508 82598EB Gigabit BX Network Connection 1509 82580 Gigabit Network Connection @@ -26704,7 +26735,7 @@ 18a0 C4xxx Series QAT 18a1 C4XXX Series QAT Virtual Function 1900 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers - 1901 6th-9th Gen Core Processor PCIe Controller (x16) + 1901 6th-10th Gen Core Processor PCIe Controller (x16) 1902 HD Graphics 510 1903 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem 1028 06d6 Latitude 7275 tablet @@ -26717,6 +26748,7 @@ 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 103c 8079 EliteBook 840 G3 + 17aa 2247 ThinkPad T570 17aa 382a B51-80 Laptop 1905 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x8) 1906 HD Graphics 510 @@ -26862,6 +26894,7 @@ 1c02 6 Series/C200 Series Chipset Family 6 port Desktop SATA AHCI Controller 1028 04aa XPS 8300 1043 844d P8 series motherboard + 8086 200d DH61CR motherboard 8086 7270 Server Board S1200BT Family 1c03 6 Series/C200 Series Chipset Family 6 port Mobile SATA AHCI Controller 1028 04a3 Precision M4600 @@ -26912,6 +26945,7 @@ 17aa 21cf ThinkPad T520 # Realtek ALC888 audio codec 8086 2008 DQ67SW board + 8086 200d DH61CR motherboard 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011] 1c22 6 Series/C200 Series Chipset Family SMBus Controller 1028 04a3 Precision M4600 @@ -26920,6 +26954,7 @@ 1028 04da Vostro 3750 1043 844d P8 series motherboard 17aa 21cf ThinkPad T520 + 8086 200d DH61CR motherboard 8086 7270 Server Board S1200BT Family / Apple MacBook Pro 8,1/8,2 1c24 6 Series/C200 Series Chipset Family Thermal Management Controller 1c25 6 Series/C200 Series Chipset Family DMI to PCI Bridge @@ -26930,6 +26965,7 @@ 1028 04da Vostro 3750 1043 844d P8 series motherboard 17aa 21cf ThinkPad T520 + 8086 200d DH61CR motherboard 8086 7270 Server Board S1200BT Family / Apple MacBook Pro 8,1/8,2 1c27 6 Series/C200 Series Chipset Family USB Universal Host Controller #1 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011] @@ -26942,6 +26978,7 @@ 1028 04da Vostro 3750 1043 844d P8 series motherboard 17aa 21cf ThinkPad T520 + 8086 200d DH61CR motherboard 8086 7270 Server Board S1200BT Family / Apple MacBook Pro 8,1/8,2 1c33 6 Series/C200 Series Chipset Family LAN Controller 1c35 6 Series/C200 Series Chipset Family VECI Controller @@ -26952,6 +26989,7 @@ 1028 04da Vostro 3750 1043 844d P8 series motherboard 17aa 21cf ThinkPad T520 + 8086 200d DH61CR motherboard 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011] 1c3b 6 Series/C200 Series Chipset Family MEI Controller #2 1c3c 6 Series/C200 Series Chipset Family IDE-r Controller @@ -26995,6 +27033,7 @@ 1c5a Upgraded Q67 Express Chipset LPC Controller 1c5b 6 Series/C200 Series Chipset Family LPC Controller 1c5c H61 Express Chipset LPC Controller + 8086 200d DH61CR motherboard 1c5d 6 Series/C200 Series Chipset Family LPC Controller 1c5e 6 Series/C200 Series Chipset Family LPC Controller 1c5f 6 Series/C200 Series Chipset Family LPC Controller @@ -27458,6 +27497,7 @@ 147b 0507 TH7II-RAID 8086 4532 Desktop Board D815EEA2/D815EFV 8086 4557 D815EGEW Mainboard + 8086 4d44 D850EMV2 motherboard 8086 5744 S845WD1-E mainboard 2443 82801BA/BAM SMBus Controller 1014 01c6 Netvista A40/A40p @@ -27499,6 +27539,7 @@ 147b 0507 TH7II-RAID 8086 4557 D815EGEW Mainboard 8086 4656 Desktop Board D815EFV + 8086 4d44 D850EMV2 motherboard 2446 82801BA/BAM AC'97 Modem Controller 1025 1016 Travelmate 612 TX 104d 80df Vaio PCG-FX403 @@ -27573,6 +27614,7 @@ 15d9 3280 Supermicro P4SBE Mainboard 8086 4532 Desktop Board D815EEA2/D815EFV 8086 4557 D815EGEW Mainboard + 8086 4d44 D850EMV2 motherboard 8086 5744 S845WD1-E mainboard 244c 82801BAM ISA Bridge (LPC) 244e 82801 PCI Bridge @@ -30817,7 +30859,8 @@ 3e81 8th Gen Core Processor PCIe Controller (x16) 3e85 8th Gen Core Processor PCIe Controller (x8) 3e89 8th Gen Core Processor PCIe Controller (x4) - 3e91 8th Gen Core Processor Gaussian Mixture Model + 3e90 UHD Graphics 610 + 3e91 UHD Graphics 630 3e92 UHD Graphics 630 (Desktop) 1028 0869 Vostro 3470 3e93 UHD Graphics 610 @@ -30966,7 +31009,16 @@ 8086 1316 WiMAX/WiFi Link 5150 ABG 444e Turbo Memory Controller 467f Volume Management Device NVMe RAID Controller + 4680 AlderLake-S GT1 + 46a0 AlderLake-P GT2 + 4905 DG1 [Iris Xe MAX Graphics] + 4906 DG1 [Iris Xe Pod] + 4907 SG1 [Server GPU SG-18M] + 4908 DG1 [Iris Xe Graphics] 4c3d Volume Management Device NVMe RAID Controller + 4f80 DG2 + 4f81 DG2 + 4f82 DG2 5001 LE80578 5002 LE80578 Graphics Processor Unit 5009 LE80578 Video Display Controller @@ -31714,15 +31766,17 @@ 9a2f Tiger Lake-H Thunderbolt 4 PCI Express Root Port #2 9a31 Tiger Lake-H Thunderbolt 4 PCI Express Root Port #3 9a33 Tiger Lake Trace Hub - 9a49 Iris Xe Graphics - 9b41 UHD Graphics + 9a49 TigerLake GT2 [Iris Xe Graphics] + 9b41 CometLake-U GT2 [UHD Graphics] 9b44 10th Gen Core Processor Host Bridge/DRAM Registers 9b53 Comet Lake-S 6c Host Bridge/DRAM Controller 9b54 10th Gen Core Processor Host Bridge/DRAM Registers 9b61 Comet Lake-U v1 4c Host Bridge/DRAM Controller + 9b63 10th Gen Core Processor Host Bridge/DRAM Registers 9b64 10th Gen Core Processor Host Bridge/DRAM Registers - 9bc4 UHD Graphics - 9bc8 UHD Graphics 630 + 9bc4 CometLake-H GT2 [UHD Graphics] + 9bc5 CometLake-S GT2 [UHD Graphics 630] + 9bc8 CometLake-S GT2 [UHD Graphics 630] 9c00 8 Series SATA Controller 1 [IDE mode] 9c01 8 Series SATA Controller 1 [IDE mode] 9c02 8 Series SATA Controller 1 [AHCI mode] From owner-dev-commits-src-all@freebsd.org Wed May 5 08:32:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B09C6351EA; Wed, 5 May 2021 08:32:33 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqhd0GM9z3KZX; Wed, 5 May 2021 08:32:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EE7EB21A51; Wed, 5 May 2021 08:32:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458WWk8042555; Wed, 5 May 2021 08:32:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458WWEx042554; Wed, 5 May 2021 08:32:32 GMT (envelope-from git) Date: Wed, 5 May 2021 08:32:32 GMT Message-Id: <202105050832.1458WWEx042554@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: ad616f3e385f - stable/13 - pci_vendors: update to 2021.02.20 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ad616f3e385fe00bee1ddc7e3f2482a64ba917e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:32:33 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=ad616f3e385fe00bee1ddc7e3f2482a64ba917e7 commit ad616f3e385fe00bee1ddc7e3f2482a64ba917e7 Author: Baptiste Daroussin AuthorDate: 2021-02-21 05:09:03 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:30:36 +0000 pci_vendors: update to 2021.02.20 (cherry picked from commit e6bb49f12ca7a2dc103d69d4c70e1504195f70a6) --- share/misc/pci_vendors | 349 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 275 insertions(+), 74 deletions(-) diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors index c5b923d463af..35692066d391 100644 --- a/share/misc/pci_vendors +++ b/share/misc/pci_vendors @@ -1,8 +1,8 @@ # # List of PCI ID's # -# Version: 2021.01.11 -# Date: 2021-01-11 03:15:01 +# Version: 2021.02.20 +# Date: 2021-02-20 03:15:02 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at https://pci-ids.ucw.cz/. @@ -705,8 +705,7 @@ 1d49 0200 ThinkSystem 430-8i SAS/SATA 12Gb HBA 1d49 0202 ThinkSystem 430-8e SAS/SATA 12Gb HBA 1d49 0204 ThinkSystem 430-8i SAS/SATA 12Gb Dense HBA -# PCIe switch SES management endpoint - 00b2 PEX880xx PCIe Gen 4 Switch SES management endpoint + 00b2 PCIe Switch management endpoint 1d49 0003 ThinkSystem 1611-8P PCIe Gen4 NVMe Switch Adapter 00be SAS3504 Fusion-MPT Tri-Mode RAID On Chip (ROC) 00bf SAS3404 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) @@ -1163,6 +1162,7 @@ 1179 ff50 Satellite P305D-S8995E 1458 a022 GA-MA770-DS3rev2.0 Motherboard 1458 a102 GA-880GMA-USB3 + 1462 7596 760GM-E51(MS-7596) Motherboard 17f2 5000 KI690-AM2 Motherboard 4384 SBx00 PCI to PCI Bridge 4385 SBx00 SMBus Controller @@ -1175,6 +1175,7 @@ 1179 ff50 Satellite P305D-S8995E 1458 4385 GA-MA770-DS3rev2.0 Motherboard 1462 7368 K9AG Neo2 + 1462 7596 760GM-E51(MS-7596) Motherboard 15d9 a811 H8DGU 174b 1001 PURE Fusion Mini 17f2 5000 KI690-AM2 Motherboard @@ -1225,6 +1226,7 @@ 1043 8389 M4A785TD Motherboard 105b 0e13 N15235/A74MX mainboard / AMD SB700 1458 b002 GA-MA770-DS3rev2.0 Motherboard + 1462 7596 760GM-E51(MS-7596) Motherboard 1849 4390 Motherboard (one of many) 4391 SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] 103c 1609 ProLiant MicroServer N36L @@ -1248,6 +1250,7 @@ 1043 8443 M5A88-V EVO 105b 0e13 N15235/A74MX mainboard / AMD SB700 1458 5004 GA-880GMA-USB3 + 1462 7596 760GM-E51(MS-7596) Motherboard 15d9 a811 H8DGU 174b 1001 PURE Fusion Mini 4397 SB7x0/SB8x0/SB9x0 USB OHCI0 Controller @@ -1258,12 +1261,14 @@ 1043 8443 M5A88-V EVO 105b 0e13 N15235/A74MX mainboard / AMD SB700 1458 5004 GA-880GMA-USB3 + 1462 7596 760GM-E51(MS-7596) Motherboard 15d9 a811 H8DGU 174b 1001 PURE Fusion Mini 4398 SB7x0 USB OHCI1 Controller 1019 2120 A785GM-M 1043 82ef M3A78-EH Motherboard 105b 0e13 N15235/A74MX mainboard / AMD SB700 + 1462 7596 760GM-E51(MS-7596) Motherboard 15d9 a811 H8DGU 4399 SB7x0/SB8x0/SB9x0 USB OHCI2 Controller 1019 2120 A785GM-M @@ -1271,6 +1276,7 @@ 1043 8443 M5A88-V EVO 105b 0e13 N15235/A74MX mainboard / AMD SB700 1458 5004 GA-880GMA-USB3 + 1462 7596 760GM-E51(MS-7596) Motherboard 174b 1001 PURE Fusion Mini 439c SB7x0/SB8x0/SB9x0 IDE Controller 1002 4392 MSI MS-7713 motherboard @@ -1278,6 +1284,7 @@ 103c 1609 ProLiant MicroServer N36L 1043 82ef M3A78-EH Motherboard 105b 0e13 N15235/A74MX mainboard / AMD SB700 + 1462 7596 760GM-E51(MS-7596) Motherboard 439d SB7x0/SB8x0/SB9x0 LPC host controller 1019 2120 A785GM-M 103c 1609 ProLiant MicroServer N36L @@ -1285,6 +1292,7 @@ 1043 82ef M3A78-EH Motherboard 1043 8443 M5A88-V EVO 105b 0e13 N15235/A74MX mainboard / AMD SB700 + 1462 7596 760GM-E51(MS-7596) Motherboard 174b 1001 PURE Fusion Mini 43a0 SB700/SB800/SB900 PCI to PCI bridge (PCIE port 0) 43a1 SB700/SB800/SB900 PCI to PCI bridge (PCIE port 1) @@ -1913,6 +1921,7 @@ 6607 Mars LE [Radeon HD 8530M / R5 M240] 6608 Oland GL [FirePro W2100] 13cc 3d28 MXRT-2600 + 6609 Oland GL [FirePro W2100 / Barco MXRT 2600] 6610 Oland XT [Radeon HD 8670 / R7 250/350] 1019 0030 Radeon HD 8670 1028 2120 Radeon R7 250 @@ -2592,6 +2601,7 @@ 1043 04dd STRIX R9 390 148c 2358 Radeon R9 390 174b e324 Sapphire Nitro R9 390 + 67b8 Hawaii XT [Radeon R9 290X Engineering Sample] 67b9 Vesuvius [Radeon R9 295X2] 67be Hawaii LE 67c0 Ellesmere [Radeon Pro WX 7100 Mobile] @@ -3617,8 +3627,10 @@ 738c Arcturus GL-XL [AMD Instinct MI100] 738e Arcturus GL-XL 73bf Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] + 1eae 6701 XFX Speedster MERC 319 AMD Radeon RX 6800 XT Black 73c3 Navi 22 73df Navi 22 + 73e0 Navi 23 73ff Navi 23 7833 RS350 Host Bridge 7834 RS350 [Radeon 9100 PRO/XT IGP] @@ -3827,6 +3839,7 @@ 95cd RV620 GL [FirePro 2450] 95cf RV620 GL [FirePro 2260] 960f RS780 HDMI Audio [Radeon 3000/3100 / HD 3200/3300] + 1462 7596 760GM-E51(MS-7596) Motherboard 9610 RS780 [Radeon HD 3200] 1458 d000 GA-MA78GM-S2H Motherboard 9611 RS780C [Radeon 3100] @@ -3835,6 +3848,8 @@ 9614 RS780D [Radeon HD 3300] 9615 RS780E [Radeon HD 3200] 9616 RS780L [Radeon 3000] +# ID is probably a copy-paste error by a MSI developer from another mainboard, since all other ID numbers on this mainboard including the sub-device of this device has used subsystem ID 1462:7596 + 1462 7501 760GM-E51(MS-7596) Motherboard 9640 Sumo [Radeon HD 6550D] 9641 Sumo [Radeon HD 6620G] 9642 SuperSumo [Radeon HD 6370D] @@ -4169,12 +4184,12 @@ 2646 0001 KNE100TX Fast Ethernet 000a 21230 Video Codec 000d PBXGB [TGA2] - 000f DEFPA FDDI PCI-to-PDQ Interface Chip [PFI] - 1011 def1 FDDI controller (DEFPA) - 103c def1 FDDI controller (3X-DEFPA) + 000f PCI-to-PDQ Interface Chip [PFI] FDDI (DEFPA) + 1011 def1 FDDIcontroller/PCI (DEFPA) + 103c def1 FDDIcontroller/PCI (3X-DEFPA) 0014 DECchip 21041 [Tulip Pass 3] 1186 0100 DE-530+ - 0016 DGLPB [OPPO] + 0016 ATMworks 350 Adapter [OPPO] (DGLPB) 0017 PV-PCI Graphics Controller (ZLXp-L) 0018 Memory Channel interface 0019 DECchip 21142/43 @@ -4637,6 +4652,7 @@ 1450 Family 17h (Models 00h-0fh) Root Complex 1451 Family 17h (Models 00h-0fh) I/O Memory Management Unit 1452 Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge + ea50 ce19 mCOM10-L1900 1453 Family 17h (Models 00h-0fh) PCIe GPP Bridge 1454 Family 17h (Models 00h-0fh) Internal PCIe GPP Bridge 0 to Bus B 1455 Zeppelin/Renoir PCIe Dummy Function @@ -4788,7 +4804,9 @@ 15d5 FireFlight USB 3.1 15da Raven/Raven2 PCIe Dummy Host Bridge 15db Raven/Raven2 Internal PCIe GPP Bridge 0 to Bus A + ea50 ce19 mCOM10-L1900 15dc Raven/Raven2 Internal PCIe GPP Bridge 0 to Bus B + ea50 ce19 mCOM10-L1900 15de Raven/Raven2/FireFlight HD Audio Controller 15df Family 17h (Models 10h-1fh) Platform Security Processor 1043 876b PRIME Motherboard @@ -4938,6 +4956,7 @@ 2096 CS5536 [Geode companion] UDC 2097 CS5536 [Geode companion] UOC 209a CS5536 [Geode companion] IDE + 2625 AMD Lance/PCI PCNet/32 3000 ELanSC520 Microcontroller 43a0 Hudson PCI to PCI bridge (PCIE port 0) 43a1 Hudson PCI to PCI bridge (PCIE port 1) @@ -7057,6 +7076,7 @@ 103c 17e8 SN1000Q 16Gb Dual Port Fibre Channel Adapter 103c 1939 QMH2672 16Gb Dual Port Fibre Channel Adapter 103c 8002 3830C 16G Fibre Channel Host Bus Adapter + 1077 0241 QLE2670 16Gb Single Port Fibre Channel Adapter 2071 ISP2714-based 16/32Gb Fibre Channel to PCIe Adapter 1077 0283 QLE2764 Quad Port 32Gb Fibre Channel to PCIe Adapter 1077 029e QLE2694 Quad Port 16Gb Fibre Channel to PCIe Adapter @@ -7065,6 +7085,9 @@ 2081 ISP2814-based 64/32G Fibre Channel to PCIe Controller 1077 02e1 QLE2874 Quad Port 64GFC PCIe Gen4 x16 Adapter 1077 02e3 QLE2774 Quad Port 32GFC PCIe Gen4 x16 Adapter + 2089 ISP2854-based 64/32G Fibre Channel to PCIe Controller with StorCryption + 1077 02e8 QLE2884 Quad Port 64GFC PCIe Gen4 x16 Adapter with StorCryption + 1077 02ea QLE2784 Quad Port 32GFC PCIe Gen4 x16 Adapter with StorCryption 2100 QLA2100 64-bit Fibre Channel Adapter 1077 0001 QLA2100 64-bit Fibre Channel Adapter 2200 QLA2200 64-bit Fibre Channel Adapter @@ -7085,6 +7108,7 @@ 1590 0203 StoreFabric SN1600Q 32Gb Single Port Fibre Channel Host Bus Adapter 1590 0204 StoreFabric SN1600Q 32Gb Dual Port Fibre Channel Host Bus Adapter 1590 022d 5830C 32Gb Dual Port Fibre Channel Adapter + 193d 100d NIC-FC680i-Mb-2x16G 2281 ISP2812-based 64/32G Fibre Channel to PCIe Controller 1077 02e2 QLE2872 Dual Port 64GFC PCIe Gen4 x8 Adapter 1077 02e4 QLE2772 Dual Port 32GFC PCIe Gen4 x8 Adapter @@ -7094,6 +7118,11 @@ 1077 02f3 QLogic 2x32Gb QLE2772 FC HBA 1590 02d3 SN1610Q - 1P Enhanced 32GFC Single Port Fibre Channel Host Bus Adapter 1590 02d4 SN1610Q – 2P Enhanced 32GFC Dual Port Fibre Channel Host Bus Adapter + 2289 ISP2852-based 64/32G Fibre Channel to PCIe Controller with StorCryption + 1077 02e9 QLE2882 Dual Port 64GFC PCIe Gen4 x8 Adapter with StorCryption + 1077 02eb QLE2782 Dual Port 32GFC PCIe Gen4 x8 Adapter with StorCryption + 1077 02ef QLE2880 Single Port 64GFC PCIe Gen4 x8 Adapter with StorCryption + 1077 02f1 QLE2780 Single Port 32GFC PCIe Gen4 x8 Adapter with StorCryption 2300 QLA2300 64-bit Fibre Channel Adapter 2312 ISP2312-based 2Gb Fibre Channel to PCI-X HBA 103c 0131 2Gb Fibre Channel - Single port [A7538A] @@ -7186,6 +7215,8 @@ 1590 021f 10/25GbE 2P QL41262HMCU-HP Adapter 1590 0220 10/25GbE 2P QL41122HLRJ-HP Adapter 1590 02bd 10Gb 2P 524SFP+ NIC + 193d 1030 NIC-ETH681i-Mb-2x25G + 193d 1032 NIC-ETH682i-Mb-2x25G 8080 FastLinQ QL41000 Series 10/25/40/50GbE Controller (FCoE) 1077 0001 10GE 2P QL41162HxRJ-DE Adapter 1077 0002 10GE 2P QL41112HxCU-DE Adapter @@ -11994,8 +12025,8 @@ 1c2d GP106M 1c30 GP106GL [Quadro P2000] 1c31 GP106GL [Quadro P2200] - 1c35 GP106 - 1c36 GP106 + 1c35 GP106M [Quadro P2000 Mobile] + 1c36 GP106 [P106M] 1c60 GP106BM [GeForce GTX 1060 Mobile 6GB] 103c 8390 GeForce GTX 1060 Max-Q 6GB 1c61 GP106BM [GeForce GTX 1050 Ti Mobile] @@ -12141,6 +12172,7 @@ 1f98 TU117M [GeForce MX450] 1f99 TU117M 1f9c TU117M [GeForce MX450] + 1f9d TU117M [GeForce GTX 1650 Mobile / Max-Q] 1fae TU117GL 1fb8 TU117GLM [Quadro T2000 Mobile / Max-Q] 1fb9 TU117GLM [Quadro T1000 Mobile] @@ -12150,6 +12182,7 @@ 1ff9 TU117GLM [Quadro T1000 Mobile] 20b0 GA100 [A100 SXM4 40GB] 20b1 GA100 [A100 PCIe 40GB] + 20b2 GA100 [A100 SXM4 80GB] 20be GA100 [GRID A100A] 20bf GA100 [GRID A100B] 20f1 GA100 [A100 PCIe 40GB] @@ -12175,6 +12208,7 @@ 222f GA102 [GeForce RTX 3080 11GB / 12GB Engineering Sample] 2230 GA102GL [RTX A6000] 2235 GA102GL [RTX A40] + 2236 GA102GL 223f GA102GL 228b GA104 High Definition Audio Controller 2321 GA103 @@ -12190,16 +12224,20 @@ 24ad GA104 [GeForce RTX 3060 Engineering Sample] 24af GA104 [GeForce RTX 3070 Engineering Sample] 24b6 GA104 + 24b8 GA104 24bf GA104 [GeForce RTX 3070 Engineering Sample] 24dc GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB] 24dd GA104M [GeForce RTX 3070 Mobile / Max-Q] - 2501 GA106 [GeForce RTX 3060 12GB] - 2503 GA106 [GeForce RTX 3060 6GB] + 2501 GA106 [GeForce RTX 3060] + 2503 GA106 [GeForce RTX 3060] 2505 GA106 2520 GA106M [GeForce RTX 3060 Mobile / Max-Q] 252f GA106 [GeForce RTX 3060 Engineering Sample] 2560 GA106M [GeForce RTX 3060 Mobile / Max-Q] 2583 GA107 [GeForce RTX 3050] + 25a0 GA107M [GeForce RTX 3050 Ti Mobile] + 25a2 GA107M [GeForce RTX 3050 Mobile] + 25a4 GA107 25af GA107 [GeForce RTX 3050 Engineering Sample] 10df Emulex Corporation 0720 OneConnect NIC (Skyhawk) @@ -12261,6 +12299,7 @@ 1590 0213 StoreFabric SN1200E 1-Port 16Gb Fibre Channel Adapter 1590 0214 StoreFabric SN1200E 2-Port 16Gb Fibre Channel Adapter 1590 022e Synergy 5330C 2-Port 32Gb Fibre Channel Mezz Card + 193d 1060 NIC-FC730i-Mb-2P f011 Saturn: LightPulse Fibre Channel Host Adapter f015 Saturn: LightPulse Fibre Channel Host Adapter f085 LP850 Fibre Channel Host Adapter @@ -12521,6 +12560,7 @@ 1028 0283 Vostro 220 1028 04b2 Vostro 3350 1028 04da Vostro 3750 + 1028 05d7 Alienware X51 R2 1028 06f2 Latitude 3470 1028 06f3 Latitude 3570 1028 0869 Vostro 3470 @@ -12930,12 +12970,12 @@ 0336 K8M890CE Host Bridge 0340 PT900 Host Bridge 0351 K8T890CF Host Bridge - 0353 VX800 Host Bridge + 0353 VX800/820-Series Chipset Host-Bridge Controller 0364 CN896/VN896/P4M900 Host Bridge 1043 81ce P5VD2-VM mothervoard 0391 VT8371 [KX133] 0409 VX855/VX875 Host Bridge: Host Control - 0410 VX900 Host Bridge: Host Control + 0410 VX900 Series Host Bridge: Host Control 0415 VT6415 PATA IDE Host Controller 1043 838f Motherboard 0501 VT8501 [Apollo MVP4] @@ -12962,7 +13002,7 @@ # probably all K7VT2/4*/6 1849 0571 K7VT series Motherboards 0576 VT82C576 3V [Apollo Master] - 0581 CX700/VX700 RAID Controller + 0581 CX700/VX700/VX800/820-Series Serial ATA RAID-Controller # Upgrade bios to get correct ID: 5324 instead of 0581 1106 0581 Wrong IDE ID 0585 VT82C585VP [Apollo VP1/VPX] @@ -13028,7 +13068,7 @@ 1353 VX800/VX820 Error Reporting 1364 CN896/VN896/P4M900 Host Bridge 1409 VX855/VX875 Error Reporting - 1410 VX900 Error Reporting + 1410 VX900 Series Error Reporting 1571 VT82C576M/VT82C586 1595 VT82C595/97 [Apollo VP2/97] 1732 VT1732 [Envy24 II] PCI Multi-Channel Audio Controller @@ -13053,7 +13093,7 @@ 2353 VX800/VX820 Host Bus Control 2364 CN896/VN896/P4M900 Host Bridge 2409 VX855/VX875 Host Bus Control - 2410 VX900 CPU Bus Controller + 2410 VX900 Series CPU Bus Controller 287a VT8251 PCI to PCI Bridge 287b VT8251 Host Bridge 287c VT8251 PCIE Root Port @@ -13186,7 +13226,7 @@ 3101 VT8653 Host Bridge 3102 VT8662 Host Bridge 3103 VT8615 Host Bridge - 3104 USB 2.0 + 3104 USB 2.0 EHCI-Compliant Host-Controller 0925 1234 onboard EHCI USB 2.0 Controller 1019 0a81 L7VTA v1.0 Motherboard (KT400-8235) 1043 808c A7V8X motherboard @@ -13299,7 +13339,7 @@ 3269 KT880 Host Bridge 3282 K8T800Pro Host Bridge 3287 VT8251 PCI to ISA Bridge - 3288 VT8237A/VT8251 HDA Controller + 3288 VX900/VT8xxx High Definition Audio Controller 19da a179 ZBOX VD01 3290 K8M890 Host Bridge 3296 P4M800 Host Bridge @@ -13312,7 +13352,7 @@ 3344 CN700/P4M800 Pro/P4M800 CE/VN800 Graphics [S3 UniChrome Pro] 3349 VT8251 AHCI/SATA 4-Port Controller 3351 VT3351 Host Bridge - 3353 VX800 PCI to PCI Bridge + 3353 VX800/820 PCI to PCI Bridge 3364 CN896/VN896/P4M900 Host Bridge 3371 CN896/VN896/P4M900 [Chrome 9 HC] 3372 VT8237S PCI to ISA Bridge @@ -13322,12 +13362,12 @@ 1043 8374 M5A88-V EVO 1043 8384 P8P67 Deluxe Motherboard 3409 VX855/VX875 DRAM Bus Control - 3410 VX900 DRAM Bus Control + 3410 VX900 Series DRAM Bus Control 19da a179 ZBOX nano VD01 - 3432 VL80x xHCI USB 3.0 Controller + 3432 VL800/801 xHCI USB 3.0 Controller 3456 VX11 Standard Host Bridge 345b VX11 Miscellaneous Bus - 3483 VL805 USB 3.0 Host Controller + 3483 VL805/806 xHCI USB 3.0 Controller 3a01 VX11 Graphics [Chrome 645/640] 4149 VIA VT6420 (ATA133) Controller 4204 K8M800 Host Bridge @@ -13350,7 +13390,7 @@ 4353 VX800/VX820 Power Management Control 4364 CN896/VN896/P4M900 Host Bridge 4409 VX855/VX875 Power Management Control - 4410 VX900 Power Management and Chip Testing Control + 4410 VX900 Series Power Management and Chip Testing Control 19da a179 ZBOX nano VD01 5030 VT82C596 ACPI [Apollo PRO] 5122 VX855/VX875 Chrome 9 HCM Integrated Graphics @@ -13359,7 +13399,7 @@ 5287 VT8251 Serial ATA Controller 5290 K8M890 I/O APIC Interrupt Controller 5308 PT894 I/O APIC Interrupt Controller - 5324 VX800 Serial ATA and EIDE Controller + 5324 CX700M2/VX700/VX800/820-Series Serial ATA & EIDE-Controller 5327 P4M890 I/O APIC Interrupt Controller 5336 K8M890CE I/O APIC Interrupt Controller 5340 PT900 I/O APIC Interrupt Controller @@ -13368,7 +13408,7 @@ 5364 CN896/VN896/P4M900 I/O APIC Interrupt Controller 5372 VT8237/8251 Serial ATA Controller 5409 VX855/VX875 APIC and Central Traffic Control - 5410 VX900 APIC and Central Traffic Control + 5410 VX900 Series APIC and Central Traffic Control 6100 VT85C100A [Rhine II] 6287 SATA RAID Controller 6290 K8M890CE Host Bridge @@ -13376,7 +13416,7 @@ 6353 VX800/VX820 Scratch Registers 6364 CN896/VN896/P4M900 Security Device 6409 VX855/VX875 Scratch Registers - 6410 VX900 Scratch Registers + 6410 VX900 Series Scratch Registers 19da a179 ZBOX nano VD01 7122 VX900 Graphics [Chrome9 HD] 7204 K8M800 Host Bridge @@ -13402,7 +13442,7 @@ 7353 VX800/VX820 North-South Module Interface Control 7364 CN896/VN896/P4M900 Host Bridge 7409 VX855/VX875 North-South Module Interface Control - 7410 VX900 North-South Module Interface Control + 7410 VX900 Series North-South Module Interface Control 19da a179 ZBOX nano VD01 8231 VT8231 [PCI-to-ISA Bridge] 8235 VT8235 ACPI @@ -13412,7 +13452,7 @@ 8391 VT8371 [KX133 AGP] 8400 MVP4 8409 VX855/VX875 Bus Control and Power Management - 8410 VX900 Bus Control and Power Management + 8410 VX900 Series Bus Control and Power Management 19da a179 ZBOX VD01 8500 KLE133/PLE133/PLE133T 8501 VT8501 [Apollo MVP4 AGP] @@ -13428,19 +13468,19 @@ 8a26 KL133/KL133A/KM133/KM133A [S3 ProSavage] 8d01 PN133/PN133T [S3 Twister] 8d04 KM266/P4M266/P4M266A/P4N266 [S3 ProSavageDDR] - 9001 VX900 Serial ATA Controller + 9001 VX900 Series Serial-ATA Controller 9082 Standard AHCI 1.0 SATA Controller 9140 HDMI Audio Device 9201 USB3.0 Controller - 9530 Secure Digital Memory Card Controller - 95d0 SDIO Host Controller + 9530 VX800/820/900 Series Secure Digital Memory Card Controller + 95d0 VX800/820/900 Series SDIO Host Controller a208 PT890 PCI to PCI Bridge Controller a238 K8T890 PCI to PCI Bridge Controller a327 P4M890 PCI to PCI Bridge Controller - a353 VX8xx South-North Module Interface Control + a353 VX8xx/900 Series South-North Module Interface Control a364 CN896/VN896/P4M900 PCI to PCI Bridge Controller - a409 VX855/VX875 USB Device Controller - a410 VX900 PCI Express Root Port 0 + a409 VX855/VX875/VX900 Series USB Device Controller + a410 VX900 Series PCI Express Root Port 0 b091 VT8633 [Apollo Pro266 AGP] b099 VT8366/A/7 [Apollo KT266/A/333 AGP] b101 VT8653 AGP Bridge @@ -13455,31 +13495,32 @@ b198 VT8237/VX700 PCI Bridge b213 VPX/VPX2 I/O APIC Interrupt Controller b353 VX855/VX875/VX900 PCI to PCI Bridge - b410 VX900 PCI Express Root Port 1 + b410 VX900 Series PCI Express Root Port 1 b999 [K8T890 North / VT8237 South] PCI Bridge c208 PT890 PCI to PCI Bridge Controller c238 K8T890 PCI to PCI Bridge Controller c327 P4M890 PCI to PCI Bridge Controller c340 PT900 PCI to PCI Bridge Controller - c353 VX800/VX820 PCI Express Root Port + c353 VX800/820-Series PCI-Express Root (PCI-to-PCI Virtual Bridge) c364 CN896/VN896/P4M900 PCI to PCI Bridge Controller c409 VX855/VX875 EIDE Controller - c410 VX900 PCI Express Root Port 2 + c410 VX900 Series PCI Express Root Port 2 d104 VT8237R USB UDCI Controller d208 PT890 PCI to PCI Bridge Controller d213 VPX/VPX2 PCI to PCI Bridge Controller d238 K8T890 PCI to PCI Bridge Controller d340 PT900 PCI to PCI Bridge Controller - d410 VX900 PCI Express Root Port 3 + d410 VX900 Series PCI Express Root Port 3 e208 PT890 PCI to PCI Bridge Controller e238 K8T890 PCI to PCI Bridge Controller e340 PT900 PCI to PCI Bridge Controller - e353 VX800/VX820 PCI Express Root Port - e410 VX900 PCI Express Physical Layer Electrical Sub-block + e353 VX800/820-Series PCI-Express Root Port 0 + e410 VX900 Series PCI Express Physical Layer Electrical Sub-block f208 PT890 PCI to PCI Bridge Controller f238 K8T890 PCI to PCI Bridge Controller f340 PT900 PCI to PCI Bridge Controller - f353 VX800/VX820 PCI Express Root Port + f353 VX800/820-Series PCI-Express Root Port 1 + f410 VX900 Series PCI UART Port 0-3 1107 Stratus Computers 0576 VIA VT82C570MV [Apollo] (Wrong vendor ID!) 1108 Proteon, Inc. @@ -15520,6 +15561,7 @@ 8073 PM8073 Tachyon SPCve 12G 16-port SAS/SATA controller 8531 PM8531 PFX 24xG3 Fanout PCIe Switches 8546 PM8546 B-FEIP PSX 96xG3 PCIe Storage Switch + 8562 PM8562 Switchtec PFX-L 32xG3 Fanout-Lite PCIe Gen3 Switch 11f9 I-Cube Inc 11fa Kasan Electronics Company, Ltd. 11fb Datel Inc @@ -18369,6 +18411,7 @@ 144d a801 SM963 2.5" NVMe PCIe SSD a808 NVMe SSD Controller SM981/PM981/PM983 1d49 403b Thinksystem U.2 PM983 NVMe SSD + a80a NVMe SSD Controller PM9A1/980PRO a820 NVMe SSD Controller 171X 1028 1f95 Express Flash NVMe XS1715 SSD 400GB 1028 1f96 Express Flash NVMe XS1715 SSD 800GB @@ -18970,6 +19013,7 @@ 103c 339d Ethernet 10Gb 2-port 530SFP+ Adapter 193d 1003 530F-B 193d 1006 530F-L + 193d 100f NIC-ETH522i-Mb-2x10G 1690 NetXtreme BCM57760 Gigabit Ethernet PCIe 1691 NetLink BCM57788 Gigabit Ethernet PCIe 1028 04aa XPS 8300 @@ -18996,6 +19040,7 @@ 16a0 NetLink BCM5785 Fast Ethernet 16a1 BCM57840 NetXtreme II 10 Gigabit Ethernet 1043 866e PEB-10G/57840-2T 10GBase-T Network Adapter + 193d 100b NIC-ETH521i-Mb-4x10G 16a2 BCM57840 NetXtreme II 10/20-Gigabit Ethernet 103c 1916 FlexFabric 20Gb 2-port 630FLB Adapter 103c 1917 FlexFabric 20Gb 2-port 630M Adapter @@ -20246,12 +20291,14 @@ 15b3 0021 MCX4421A-ACQN ConnectX-4 Lx EN OCP,2x25G 15b3 0025 ConnectX-4 Lx 25 GbE Dual Port SFP28 rNDC 193d 100a 620F-B + 193d 1031 NIC-ETH640i-Mb-2x25G 1016 MT27710 Family [ConnectX-4 Lx Virtual Function] 1017 MT27800 Family [ConnectX-5] 15b3 0006 ConnectX®-5 EN network interface card, 100GbE single-port QSFP28, PCIe3.0 x16, tall bracket; MCX515A-CCAT 15b3 0007 Mellanox ConnectX®-5 MCX516A-CCAT 15b3 0020 ConnectX®-5 EN network interface card, 10/25GbE dual-port SFP28, PCIe3.0 x8, tall bracket ; MCX512A-ACAT 15b3 0068 ConnectX®-5 EN network interface card for OCP2.0, Type 1, with host management, 25GbE dual-port SFP28, PCIe3.0 x8, no bracket Halogen free ; MCX542B-ACAN + 193d 1051 NIC-IB1040i-Mb-2P 1018 MT27800 Family [ConnectX-5 Virtual Function] 1019 MT28800 Family [ConnectX-5 Ex] 15b3 0008 ConnectX-5 Ex EN network interface card, 100GbE dual-port QSFP28, PCIe4.0 x16, tall bracket; MCX516A-CDAT @@ -20372,7 +20419,7 @@ 15b7 Sandisk Corp 2001 Skyhawk Series NVME SSD 5001 WD Black NVMe SSD - 5002 WD Black 2018 / PC SN720 NVMe SSD + 5002 WD Black 2018/SN750 / PC SN720 NVMe SSD 5003 WD Blue SN500 / PC SN520 NVMe SSD 5004 PC SN520 NVMe SSD 5005 PC SN520 NVMe SSD @@ -20382,6 +20429,7 @@ 500b PC SN530 NVMe SSD 1414 500b Xbox Series X 500d WD Ultrastar DC SN340 NVMe SSD + 5011 WD Black SN850 15b8 ADDI-DATA GmbH 1001 APCI1516 SP controller (16 digi outputs) 1003 APCI1032 SP controller (32 digi inputs w/ opto coupler) @@ -21132,6 +21180,7 @@ ab08 21x4x DEC-Tulip compatible 10/100 Ethernet ab09 21x4x DEC-Tulip compatible 10/100 Ethernet 173b Altima (nee Broadcom) + 0001 AC1002 PCI Gigabit Ethernet controller 03e8 AC1000 Gigabit Ethernet 03e9 AC1001 Gigabit Ethernet 03ea AC9100 Gigabit Ethernet @@ -21179,6 +21228,10 @@ 0245 PCA7428CE_F1 - Analog Inputs isolated 0303 PCD-7006C Digital Input & Output PCI Card 0800 PCD8006 - PCIe digital Inputs/Outputs + 0840 PCA-8428 General-purpose multifunctional PCIe card with 8 analog inputs and 2 analog outputs + 0841 PCA-8429 General-purpose multifunctional PCIe card with 8 analog inputs + 0842 PCA-8438 General-purpose multifunctional PCIe card with 16 analog inputs and 2 analog outputs + 0843 PCA-8439 General-purpose multifunctional PCIe card with 16 analog inputs ff00 CTU CAN FD PCIe Card 1761 Pickering Interfaces Ltd 1771 InnoVISION Multimedia Ltd. @@ -22757,6 +22810,7 @@ 1242 ASM1142 USB 3.1 Host Controller 1343 ASM1143 USB 3.1 Host Controller 2142 ASM2142 USB 3.1 Host Controller + 1462 7a72 H270 PC MATE 3242 ASM3242 USB 3.2 Host Controller 1b26 Netcope Technologies, a.s. c132 COMBO-LXT155 @@ -22839,6 +22893,7 @@ 9172 88SE9172 SATA 6Gb/s Controller 9178 88SE9170 PCIe SATA 6Gb/s Controller 917a 88SE9172 SATA III 6Gb/s RAID Controller + 9182 88SE9182 PCIe 2.0 x2 2-port SATA 6 Gb/s Controller 9183 88SS9183 PCIe SSD Controller 9192 88SE9172 SATA III 6Gb/s RAID Controller 91a0 88SE912x SATA 6Gb/s Controller [IDE mode] @@ -23081,6 +23136,7 @@ 1284 PC300 NVMe Solid State Drive 512GB 1285 PC300 NVMe Solid State Drive 1TB 1327 BC501 NVMe Solid State Drive 512GB + 1339 BC511 1504 SC300 512GB M.2 2280 SATA Solid State Drive 1527 PC401 NVMe Solid State Drive 256GB 243b PE6110 NVMe Solid State Drive @@ -23091,6 +23147,10 @@ 000d PBlaze5 520/526 003d PBlaze5 920/926 003e PBlaze6 6920 + 1c5f 0a31 NVMe SSD PBlaze6 6920 3840GB 2.5" U.2 + 1c5f 0a41 NVMe SSD PBlaze6 6920 7680GB 2.5" U.2 + 1c5f 4a31 NVMe SSD PBlaze6 6920 3200GB 2.5" U.2 + 1c5f 4a41 NVMe SSD PBlaze6 6920 6400GB 2.5" U.2 0540 PBlaze4 NVMe SSD 0550 PBlaze5 700/900 0555 PBlaze5 510/516 @@ -23174,6 +23234,7 @@ 1d00 Pure Storage 1d05 Tongfang Hongkong Limited 1d0f Amazon.com, Inc. + 8061 NVMe EBS Controller cd01 NVMe SSD Controller ec20 Elastic Network Adapter (ENA) efa0 Elastic Fabric Adapter (EFA) @@ -23304,6 +23365,9 @@ 1014 AR-MAN-U280 [Manitou Class Accelerator for U280] 1015 AR-ARK-BBDEV-FX0 [Arkville 32B DPDK Baseband Device] 1016 AR-ARK-BBDEV-FX1 [Arkville 64B DPDK Baseband Device] + 1017 AR-ARK-FX1 [Arkville 64B Multi-Homed Primary Endpoint] + 1018 AR-ARK-FX1 [Arkville 64B Multi-Homed Secondary Endpoint] + 1019 AR-ARK-FX1 [Arkville 64B Multi-Homed Tertiary Endpoint] 4200 A5PL-E1-10GETI [10 GbE Ethernet Traffic Instrument] 1d72 Xiaomi 1d78 DERA Storage @@ -23331,7 +23395,7 @@ 0100 RK3399 PCI Express Root Port 1808 RK1808 Neural Network Processor Card 1d8f Enyx -1d93 YADRO (KNS Group) +1d93 YADRO 1d94 Chengdu Haiguang IC Design Co., Ltd. 1450 Root Complex 1451 I/O Memory Management Unit @@ -23387,61 +23451,61 @@ 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB 1dd8 4002 Naples 25Gb 2-port SFP28 x8 4GB - 1dd8 4007 DSP DSC-25 10/25G 2p OCP Card - 1dd8 4008 DSC-25 10/25G 2-port SFP28 x8 4GB RAM 8GB eMMC + 1dd8 4007 DSP DSC-25 Ent 10/25G OCP3 Card + 1dd8 4008 DSP DSC-25 10/25G 2p SFP28 Card 1dd8 400a DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card - 1dd8 400d DSP DSC-100 100G 2p QSFP28 Card + 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1001 DSC Virtual Downstream Port 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB 1dd8 4002 Naples 25Gb 2-port SFP28 x8 4GB - 1dd8 4007 DSP DSC-25 10/25G 2p OCP Card - 1dd8 4008 DSC-25 10/25G 2-port SFP28 x8 4GB RAM 8GB eMMC + 1dd8 4007 DSP DSC-25 Ent 10/25G OCP3 Card + 1dd8 4008 DSP DSC-25 10/25G 2p SFP28 Card 1dd8 400a DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card - 1dd8 400d DSP DSC-100 100G 2p QSFP28 Card + 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1002 DSC Ethernet Controller 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB 1dd8 4002 Naples 25Gb 2-port SFP28 x8 4GB - 1dd8 4007 DSP DSC-25 10/25G 2p OCP Card - 1dd8 4008 DSC-25 10/25G 2-port SFP28 x8 4GB RAM 8GB eMMC + 1dd8 4007 DSP DSC-25 Ent 10/25G OCP3 Card + 1dd8 4008 DSP DSC-25 10/25G 2p SFP28 Card 1dd8 400a DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card - 1dd8 400d DSP DSC-100 100G 2p QSFP28 Card + 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1003 DSC Ethernet Controller VF 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB 1dd8 4002 Naples 25Gb 2-port SFP28 x8 4GB - 1dd8 4007 DSP DSC-25 10/25G 2p OCP Card - 1dd8 4008 DSC-25 10/25G 2-port SFP28 x8 4GB RAM 8GB eMMC + 1dd8 4007 DSP DSC-25 Ent 10/25G OCP3 Card + 1dd8 4008 DSP DSC-25 10/25G 2p SFP28 Card 1dd8 400a DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card - 1dd8 400d DSP DSC-100 100G 2p QSFP28 Card + 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1004 DSC Management Controller 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB 1dd8 4002 Naples 25Gb 2-port SFP28 x8 4GB - 1dd8 4007 DSP DSC-25 10/25G 2p OCP Card - 1dd8 4008 DSC-25 10/25G 2-port SFP28 x8 4GB RAM 8GB eMMC + 1dd8 4007 DSP DSC-25 Ent 10/25G OCP3 Card + 1dd8 4008 DSP DSC-25 10/25G 2p SFP28 Card 1dd8 400a DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card - 1dd8 400d DSP DSC-100 100G 2p QSFP28 Card + 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1007 DSC Storage Accelerator 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB 1dd8 4002 Naples 25Gb 2-port SFP28 x8 4GB - 1dd8 4007 DSP DSC-25 10/25G 2p OCP Card - 1dd8 4008 DSC-25 10/25G 2-port SFP28 x8 4GB RAM 8GB eMMC + 1dd8 4007 DSP DSC-25 Ent 10/25G OCP3 Card + 1dd8 4008 DSP DSC-25 10/25G 2p SFP28 Card 1dd8 400a DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card - 1dd8 400d DSP DSC-100 100G 2p QSFP28 Card + 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1de0 Groq # rename due to conflict with a term in use by another company for an entirely different product. @@ -23465,6 +23529,42 @@ e00a eMAG PCI Express Root Port 5 e00b eMAG PCI Express Root Port 6 e00c eMAG PCI Express Root Port 7 +# Root Complex A (RCA) + e100 Altra PCI Express Root Complex A +# RCA port 0 + e101 Altra PCI Express Root Port a0 +# RCA port 1 + e102 Altra PCI Express Root Port a1 +# RCA port 2 + e103 Altra PCI Express Root Port a2 +# RAC port 3 + e104 Altra PCI Express Root Port a3 +# RCA port 4 + e105 Altra PCI Express Root Port a4 +# RCA port 5 + e106 Altra PCI Express Root Port a5 +# RCA port 6 + e107 Altra PCI Express Root Port a6 +# RCA port 7 + e108 Altra PCI Express Root Port a7 +# Root Complex B (RCB) + e110 Altra PCI Express Root Complex B +# RCB port 0 + e111 Altra PCI Express Root Port b0 +# RCB port 1 + e112 Altra PCI Express Root Port b1 +# RCB port 2 + e113 Altra PCI Express Root Port b2 +# RCB port 3 + e114 Altra PCI Express Root Port b3 +# RCB port 4 + e115 Altra PCI Express Root Port b4 +# RCB port 5 + e116 Altra PCI Express Root Port b5 +# RCB port 6 + e117 Altra PCI Express Root Port b6 +# RCB port 7 + e118 Altra PCI Express Root Port b7 1df3 Ethernity Networks 0201 ACE-NIC40 Programmable Network Accelerator 1df3 0001 ENA1040 @@ -23595,12 +23695,18 @@ # aka SED Systems 1e94 Calian SED 1e95 Solid State Storage Technology Corporation +1ea0 Tencent Technology (Shenzhen) Company Limited + 2a16 Cloud Intelligent Inference Controller 1eab Hefei DATANG Storage Technology Co.,LTD. 300a NVMe SSD Controller 300A 300b NVMe SSD Controller 300B 1eae XFX Limited 1eb1 VeriSilicon Inc 1001 Video Accelerator +1ed8 Digiteq Automotive + 0101 FG4 PCIe Frame Grabber +1ed9 Myrtle.ai +1ee9 SUSE LLC # nee Tumsan Oy 1fc0 Ascom (Finland) Oy 0300 E2200 Dual E1/Rawpipe Card @@ -23851,6 +23957,8 @@ 7073 CH356 PCI Quad Serial and Parallel Ports Controller 7173 CH355 PCI Quad Serial Port Controller 434e CAST Navigation LLC +43b0 Tiger Lake-H PCIe Root Port #9 +43bc Tiger Lake-H PCIe Root Port #5 4444 Internext Compression Inc 0016 iTVC16 (CX23416) Video Decoder 0070 0003 WinTV PVR 250 @@ -24521,11 +24629,19 @@ 02a3 Comet Lake PCH-LP SMBus Host Controller 02a4 Comet Lake SPI (flash) Controller 02a6 Comet Lake North Peak + 02b0 Comet Lake PCI Express Root Port #9 + 02b1 Comet Lake PCI Express Root Port #10 + 02b3 Comet Lake PCI Express Root Port #12 + 02b4 Comet Lake PCI Express Root Port #13 + 02b8 Comet Lake PCI Express Root Port #1 + 02bc Comet Lake PCI Express Root Port #5 + 02c5 Comet Lake Serial IO I2C Host Controller 02c8 Comet Lake PCH-LP cAVS 02d3 Comet Lake SATA AHCI Controller 02e0 Comet Lake Management Engine Interface 02e8 Serial IO I2C Host Controller 02e9 Comet Lake Serial IO I2C Host Controller + 02ea Comet Lake PCH-LP LPSS: I2C Controller #2 02ed Comet Lake PCH-LP USB 3.1 xHCI Host Controller 02ef Comet Lake PCH-LP Shared SRAM 02f0 Comet Lake PCH-LP CNVi WiFi @@ -24564,6 +24680,7 @@ 0406 Haswell Integrated Graphics Controller 040a Xeon E3-1200 v3 Processor Integrated Graphics Controller 0412 Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller + 1028 05d7 Alienware X51 R2 103c 1998 EliteDesk 800 G1 17aa 3098 ThinkCentre E73 17aa 309f ThinkCentre M83 @@ -25112,7 +25229,7 @@ 1028 1fe9 Express Flash NVMe 4.0TB HHHL AIC (P4600) 0b26 Thunderbolt 4 Bridge [Goshen Ridge 2020] 0b27 Thunderbolt 4 USB Controller [Goshen Ridge 2020] - 0b60 NVMe DC SSD [3DNAND, Beta Rock Controller] + 0b60 NVMe DC SSD [3DNAND, Sentinel Rock Controller] 1028 2060 NVMe SED MU U.2 1.6TB (P5600) 1028 2061 NVMe SED MU U.2 3.2TB (P5600) 1028 2062 NVMe SED MU U.2 6.4TB (P5600) @@ -25125,6 +25242,7 @@ 1028 2102 NVMe RI U.2 1.92TB (P5500) 1028 2103 NVMe RI U.2 3.84TB (P5500) 1028 2104 NVMe RI U.2 7.68TB (P5500) + 8086 8008 NVMe Datacenter SSD [3DNAND] SE 2.5" U.2 (P5510) 0be0 Atom Processor D2xxx/N2xxx Integrated Graphics Controller 0be1 Atom Processor D2xxx/N2xxx Integrated Graphics Controller 105b 0d7c D270S/D250S Motherboard @@ -25152,6 +25270,7 @@ 0bf6 Atom Processor D2xxx/N2xxx DRAM Controller 0bf7 Atom Processor D2xxx/N2xxx DRAM Controller 0c00 4th Gen Core Processor DRAM Controller + 1028 05d7 Alienware X51 R2 103c 1998 EliteDesk 800 G1 17aa 3098 ThinkCentre E73 17aa 309f ThinkCentre M83 @@ -26397,6 +26516,7 @@ 156f Ethernet Connection I219-LM 1028 06dc Latitude E7470 103c 8079 EliteBook 840 G3 + 17aa 2247 ThinkPad T570 1570 Ethernet Connection I219-V 1571 Ethernet Virtual Function 700 Series 1572 Ethernet Controller X710 for 10GbE SFP+ @@ -26415,7 +26535,10 @@ 17aa 0000 ThinkServer X710 AnyFabric for 10GbE SFP+ 17aa 4001 ThinkServer X710-4 AnyFabric for 10GbE SFP+ 17aa 4002 ThinkServer X710-2 AnyFabric for 10GbE SFP+ + 193d 1020 NIC-ETH561F-sL-4x10G + 193d 1021 NIC-ETH561F-sL-2x10G 19e5 d11c Ethernet 2-port X710 10Gb SFP+ Adapter SP330 + 1bd4 0042 10G SFP+ DP EP102Fi4 Adapter 1bd4 0056 Ethernet Network Adapter X710-BM2 for OCP NIC 3.0 8086 0000 Ethernet Converged Network Adapter X710 8086 0001 Ethernet Converged Network Adapter X710-4 @@ -26461,6 +26584,7 @@ 1059 0170 RD-01213 10GbE interface 1590 0000 Ethernet 2-port 563i Adapter 1590 00f8 Ethernet 2-port 563i Adapter + 193d 100e NIC-ETH561i-Mb-4x10G 8086 0000 Ethernet Converged Network Adapter XL710-Q2 1583 Ethernet Controller XL710 for 40GbE QSFP+ 1028 0000 Ethernet 40G 2P XL710 QSFP+ rNDC @@ -26599,6 +26723,7 @@ 15b6 DSL6540 USB 3.1 Controller [Alpine Ridge] 15b7 Ethernet Connection (2) I219-LM 15b8 Ethernet Connection (2) I219-V + 1462 7a72 H270 PC MATE 15b9 Ethernet Connection (3) I219-LM 15bb Ethernet Connection (7) I219-LM 15bc Ethernet Connection (7) I219-V @@ -26764,6 +26889,7 @@ 103c 825b OMEN-17-w001nv 1911 Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model 1028 0869 Vostro 3470 + 1462 7a72 H270 PC MATE 17aa 2247 ThinkPad T570 17aa 224f ThinkPad X1 Carbon 5th Gen 17aa 225d ThinkPad T480 @@ -26772,6 +26898,7 @@ 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 103c 8079 EliteBook 840 G3 + 17aa 2247 ThinkPad T570 1918 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers 1919 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Imaging Unit 1028 06d6 Latitude 7275 tablet @@ -28681,6 +28808,7 @@ 277c 82975X Memory Controller Hub 1043 8178 P5WDG2 WS Professional motherboard 277d 82975X PCI Express Root Port + 2780 82915G/GV/GL/910GL [Grantsdale] Graphics Device 2782 82915G Integrated Graphics Controller 1043 2582 P5GD1-VW Mainboard 1734 105b Scenic W620 @@ -29698,6 +29826,7 @@ 2a41 Mobile 4 Series Chipset PCI Express Graphics Port e4bf cc4d CCM-BOOGIE 2a42 Mobile 4 Series Chipset Integrated Graphics Controller + 1028 02aa Dell Inspiron 1545 17aa 2112 ThinkPad T400 e4bf cc4d CCM-BOOGIE 2a43 Mobile 4 Series Chipset Integrated Graphics Controller @@ -30113,8 +30242,8 @@ 8086 4210 Dual Band Wireless AC 3165 3166 Dual Band Wireless-AC 3165 Plus Bluetooth 8086 4210 Dual Band Wireless-AC 3165 - 3184 UHD Graphics 605 - 3185 UHD Graphics 605 + 3184 GeminiLake [UHD Graphics 605] + 3185 GeminiLake [UHD Graphics 600] 318c Celeron/Pentium Silver Processor Dynamic Platform and Thermal Framework Processor Participant 318e Celeron/Pentium Silver Processor NorthPeak 3190 Celeron/Pentium Silver Processor Gaussian Mixture Model @@ -30859,17 +30988,17 @@ 3e81 8th Gen Core Processor PCIe Controller (x16) 3e85 8th Gen Core Processor PCIe Controller (x8) 3e89 8th Gen Core Processor PCIe Controller (x4) - 3e90 UHD Graphics 610 - 3e91 UHD Graphics 630 - 3e92 UHD Graphics 630 (Desktop) + 3e90 CoffeeLake-S GT1 [UHD Graphics 610] + 3e91 CoffeeLake-S GT2 [UHD Graphics 630] + 3e92 CometLake-S GT2 [UHD Graphics 630] 1028 0869 Vostro 3470 - 3e93 UHD Graphics 610 - 3e96 HD Graphics P630 - 3e98 UHD Graphics 630 (Desktop 9 Series) - 3e9b UHD Graphics 630 (Mobile) - 3ea0 UHD Graphics 620 (Whiskey Lake) + 3e93 CoffeeLake-S GT1 [UHD Graphics 610] + 3e96 CoffeeLake-S GT2 [UHD Graphics P630] + 3e98 CoffeeLake-S GT2 [UHD Graphics 630] + 3e9b CoffeeLake-H GT2 [UHD Graphics 630] + 3ea0 WhiskeyLake-U GT2 [UHD Graphics 620] 1028 089e Inspiron 5482 - 3ea5 Iris Plus Graphics 655 + 3ea5 CoffeeLake-U GT3e [Iris Plus Graphics 655] 3ec2 8th Gen Core Processor Host Bridge/DRAM Registers 1028 0869 Vostro 3470 1043 8694 PRIME H310M-D @@ -31007,6 +31136,14 @@ 8086 1216 WiMAX/WiFi Link 5150 ABG 8086 1311 WiMAX/WiFi Link 5150 AGN 8086 1316 WiMAX/WiFi Link 5150 ABG + 438b Tiger Lake-H LPC/eSPI Controller + 43a3 Tiger Lake-H SMBus Controller + 43a4 Tiger Lake-H SPI Controller *** 284 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed May 5 08:32:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E9B36355B2; Wed, 5 May 2021 08:32:34 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqhf13XWz3KpZ; Wed, 5 May 2021 08:32:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1332C21BD4; Wed, 5 May 2021 08:32:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458WY9o042580; Wed, 5 May 2021 08:32:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458WXOt042579; Wed, 5 May 2021 08:32:33 GMT (envelope-from git) Date: Wed, 5 May 2021 08:32:33 GMT Message-Id: <202105050832.1458WXOt042579@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 9c2ee10d85e5 - stable/13 - pci_vendors: update to 2021.04.26 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9c2ee10d85e575627f77f5d646fe9d1da5a8b9a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:32:34 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=9c2ee10d85e575627f77f5d646fe9d1da5a8b9a8 commit 9c2ee10d85e575627f77f5d646fe9d1da5a8b9a8 Author: Baptiste Daroussin AuthorDate: 2021-04-29 04:46:26 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:30:44 +0000 pci_vendors: update to 2021.04.26 (cherry picked from commit a4b5f7ba3e9bf8385b6e113c284d1559333048a0) --- share/misc/pci_vendors | 319 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 274 insertions(+), 45 deletions(-) diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors index 35692066d391..1a00db8f19dc 100644 --- a/share/misc/pci_vendors +++ b/share/misc/pci_vendors @@ -1,8 +1,8 @@ # # List of PCI ID's # -# Version: 2021.02.20 -# Date: 2021-02-20 03:15:02 +# Version: 2021.04.26 +# Date: 2021-04-26 03:15:02 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at https://pci-ids.ucw.cz/. @@ -522,6 +522,7 @@ 1000 3040 9210-8i 1000 3080 9200-8e [LSI SAS 6Gb/s SAS/SATA PCIe x8 External HBA] 1000 30b0 9200-8e [LSI SAS 6Gb/s SAS/SATA PCIe x8 External HBA] + 1014 03ca IBM 6Gb SAS HBA [9212-4i4e] 1028 1f1c 6Gbps SAS HBA Adapter 1028 1f1d PERC H200 Adapter 1028 1f1e PERC H200 Integrated @@ -873,6 +874,14 @@ 1d49 060e ThinkSystem RAID 940-32i 8GB Flash PCIe Gen4 12Gb Adapter 1d49 060f ThinkSystem RAID 940-8e 4GB Flash PCIe Gen4 12Gb Adapter 10e2 MegaRAID 12GSAS/PCIe Secure SAS39xx +# 9560 16 internal port RAID controller + 1000 4000 MegaRAID 9560-16i +# 9560 8 internal port RAID controller + 1000 4010 MegaRAID 9560-8i +# 9580 8 internal & 8 external port RAID controller + 1000 4020 MegaRAID 9580-8i8e +# MegaRAID 9562-16i 9562 16 internal port RAID controller + 1000 40b0 MegaRAID 9562-16i 1028 1ae0 PERC H755 Adapter 1028 1ae1 PERC H755 Front 1028 1ae2 PERC H755N Front @@ -907,6 +916,7 @@ 8086 0523 MegaRAID RAID Controller SRCS16 3050 SAS2008 PCI-Express Fusion-MPT SAS-2 6001 DX1 Multiformat Broadcast HD/SD Encoder/Decoder + c010 PEX88048 50 lane, 50 port, PCI Express Gen 4.0 ExpressFabric Platform c012 PEX880xx PCIe Gen 4 Switch 1d49 0003 ThinkSystem 1611-8P PCIe Gen4 NVMe Switch Adapter 1001 Kolter Electronic @@ -959,6 +969,7 @@ 1561 Anubis 15d8 Picasso 103c 8615 Pavilion Laptop 15-cw1xxx + 17aa 3181 ThinkCentre M75n IoT 17aa 5124 ThinkPad E595 ea50 cc10 RXi2-BP 15dd Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series] @@ -980,6 +991,7 @@ 1638 Cezanne 163f VanGogh 164c Lucienne + 164d Rembrandt 1714 BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series] 103c 168b ProBook 4535s 3150 RV380/M24 [Mobility Radeon X600] @@ -1904,7 +1916,7 @@ 5e6d RV410 [Radeon X700] (Secondary) 148c 2117 Bravo X700 (Secondary) 5f57 R423 [Radeon X800 XT] - 6600 Mars [Radeon HD 8670A/8670M/8750M] + 6600 Mars [Radeon HD 8670A/8670M/8750M / R7 M370] 103c 1952 ProBook 455 G1 6601 Mars [Radeon HD 8730M] 103c 2100 FirePro M4100 @@ -1922,8 +1934,10 @@ 6608 Oland GL [FirePro W2100] 13cc 3d28 MXRT-2600 6609 Oland GL [FirePro W2100 / Barco MXRT 2600] - 6610 Oland XT [Radeon HD 8670 / R7 250/350] + 6610 Oland XT [Radeon HD 8670 / R5 340X OEM / R7 250/350/350X OEM] 1019 0030 Radeon HD 8670 + 1028 0081 Radeon R7 350X OEM + 1028 0083 Radeon R5 340X OEM 1028 2120 Radeon R7 250 1028 2322 Radeon R7 250 1462 2910 Radeon HD 8670 @@ -1933,7 +1947,15 @@ 1642 3c91 Radeon HD 8670 1642 3f09 Radeon R7 350 6611 Oland [Radeon HD 8570 / R5 430 OEM / R7 240/340 / Radeon 520 OEM] + 1028 1001 Radeon R5 430 OEM (1024 MByte) + 1028 1002 Radeon R5 430 OEM (2048 MByte) +# The 'AMD Radeon R5 430' instead of 240/340 is NOT a typo! It's actually correct. + 1028 1711 R5 430 OEM (2048 MByte) 1028 210b Radeon R5 240 OEM +# OEM-card for Dell; verified through AMD's own drivers (*.inf) and a TPU BIOS in database + 1028 2121 Radeon HD 8570 OEM +# OEM-card from Fujitsu; verified through AMD's own drivers (*.inf) + 10cf 1889 Radeon HD 8570 OEM 1642 1869 Radeon 520 OEM 174b 4248 Radeon R7 240 OEM 174b a240 Radeon R7 240 OEM @@ -2203,7 +2225,7 @@ 8086 2111 Radeon HD 6625M 6743 Whistler [Radeon E6760] 6749 Turks GL [FirePro V4900] - 15c3 2b06 MED-X4900 + 15c3 2b06 MED-X4900 (EIZO) 674a Turks GL [FirePro V3900] 13cc 3d22 MXRT-2500 15c3 0106 MED-X3900 @@ -2232,7 +2254,7 @@ 174b 7670 Radeon HD 7670 174b e181 Radeon HD 6670 1787 2309 Radeon HD 6670 - 6759 Turks PRO [Radeon HD 6570/7570/8550] + 6759 Turks PRO [Radeon HD 6570/7570/8550 / R5 230] 103c 3130 Radeon HD 6570 1043 0403 Radeon HD 6570 1462 2500 Radeon HD 6570 @@ -2241,9 +2263,15 @@ 1642 3a67 Radeon HD 6570 1682 3280 Radeon HD 7570 1682 3530 Radeon HD 8550 + 1682 5230 Radeon R5 230 series + 1682 6450 Radeon HD 6450 series 174b 7570 Radeon HD 7570 + 174b 8550 Radeon HD8550 OEM + 174b 8570 Radeon HD8550 OEM 174b e142 Radeon HD 6570 174b e181 Radeon HD 6570 + 1787 a230 Radeon R5 230 series + 1787 a450 Radeon HD 6450 series 1b0a 908f Radeon HD 6570 1b0a 9090 Radeon HD 6570 1b0a 9091 Radeon HD 6570 @@ -2645,6 +2673,7 @@ # https://www.techpowerup.com/vgabios/?manufacturer=Powercolor&model=RX+580 148c 2378 Radeon RX 580 148c 2379 Radeon RX 570 4G [Red Dragon] + 148c 2391 Radeon RX 590 [Red Devil] 1682 9470 Radeon RX 470 1682 9480 Radeon RX 480 1682 9587 Radeon RX 590 FATBOY 8GB @@ -3614,24 +3643,32 @@ 174b e329 Radeon R9 FURY 7310 Navi 10 [Radeon Pro W5700X] 7312 Navi 10 [Radeon Pro W5700] + 7314 Navi 10 USB 731f Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT] 1458 2313 Radeon RX 5700 XT Gaming OC 1682 5701 RX 5700 XT RAW II + 1849 5120 Radeon RX 5600 XT 1da2 e411 Radeon RX 5600 XT 7340 Navi 14 [Radeon RX 5500/5500M / Pro 5500M] 7341 Navi 14 [Radeon Pro W5500] 7347 Navi 14 [Radeon Pro W5500M] 734f Navi 14 [Radeon Pro W5300M] - 7360 Navi 12 [Radeon Pro 5600M] + 7360 Navi 12 [Radeon Pro 5600M / V520] + 7362 Navi 12 [Radeon Pro V520] 7388 Arcturus GL-XL 738c Arcturus GL-XL [AMD Instinct MI100] 738e Arcturus GL-XL + 73a4 Navi 21 USB + 73af Navi 21 [Radeon RX 6900 XT] 73bf Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] 1eae 6701 XFX Speedster MERC 319 AMD Radeon RX 6800 XT Black 73c3 Navi 22 - 73df Navi 22 + 73c4 Navi 22 USB + 73df Navi 22 [Radeon RX 6700/6700 XT / 6800M] 73e0 Navi 23 - 73ff Navi 23 + 73e1 Navi 23 + 73e4 Navi 23 USB + 73ff Navi 23 [Radeon RX 6600/6600 XT/6600M] 7833 RS350 Host Bridge 7834 RS350 [Radeon 9100 PRO/XT IGP] 7835 RS350M [Mobility Radeon 9000 IGP] @@ -4034,6 +4071,7 @@ ab10 Lexa HDMI Audio ab18 Vega 12 HDMI Audio ab20 Vega 20 HDMI Audio [Radeon VII] + ab28 Navi 21 HDMI Audio [Radeon RX 6800/6800 XT / 6900 XT] ab38 Navi 10 HDMI Audio ac00 Theater 506 World-Wide Analog Decoder ac01 Theater 506 World-Wide Analog Decoder @@ -4937,7 +4975,8 @@ 4c53 1030 PC5 mainboard 4c53 1040 CL7 mainboard 4c53 1060 PC7 mainboard - 2001 79c978 [HomePNA] +# Via AMD's own technical reference on their Am79C978 NICs; https://www.amd.com/system/files/TechDocs/22206.pdf + 2001 Am79C978 PCnet Home (HomePNA) 1/10 PCI Ethernet Adapter [Am79C971 PHY] 1092 0a78 Multimedia Home Network Adapter 1668 0299 ActionLink Home Network Adapter 2003 Am 1771 MBW [Alchemy] @@ -4956,7 +4995,8 @@ 2096 CS5536 [Geode companion] UDC 2097 CS5536 [Geode companion] UOC 209a CS5536 [Geode companion] IDE - 2625 AMD Lance/PCI PCNet/32 + 2625 Am79C973 [Lance/PCI PCNet/32] + 2627 Am79C975 [Lance/PCI PCNet/32] 3000 ELanSC520 Microcontroller 43a0 Hudson PCI to PCI bridge (PCIE port 0) 43a1 Hudson PCI to PCI bridge (PCIE port 1) @@ -6906,6 +6946,7 @@ 0003 Control Video 0004 PlanB Video-In 0007 O'Hare I/O + 000b Apple Camera 000c DOS on Mac 000e Hydra Mac I/O 0010 Heathrow Mac I/O @@ -7133,7 +7174,8 @@ 103c 12dd 4Gb Fibre Channel [AB429A] 2432 ISP2432-based 4Gb Fibre Channel to PCI Express HBA 103c 7040 FC1142SR 4Gb 1-port PCIe Fibre Channel Host Bus Adapter [HPAE311A] - 1077 0137 QLE2460 4 GB PCI-X Host-Bus-Adapter + 1077 0137 QLE2460 Single-Port 4Gbps FC-to-PCI-X/PCIe Host Bus Adapter + 1077 0138 QLE2462 Dual-Port 4Gbps FC-to-PCI-X/PCIe Host Bus Adapter 2532 ISP2532-based 8Gb Fibre Channel to PCI Express HBA 1014 041e FC EN0Y/EN12 PCIe2 LP 8 Gb 4-port Fibre Channel Adapter for POWER 103c 3262 StorageWorks 81Q @@ -10064,7 +10106,7 @@ 0331 NV35 [GeForce FX 5900] 1043 8145 V9950GE 0332 NV35 [GeForce FX 5900XT] - 0333 NV38 [GeForce FX 5950 Ultra] + 0333 NV38 [GeForce FX 5950 Ultra / PCX 5950] 0334 NV35 [GeForce FX 5900ZT] 1462 9373 FX5900ZT-VTD128 (MS-8937) 0338 NV35GL [Quadro FX 3000] @@ -11676,6 +11718,7 @@ 1184 GK104 [GeForce GTX 770] 1185 GK104 [GeForce GTX 660 OEM] 10de 106f GK104 [GeForce GTX 760 OEM] + 1186 GK104 [GeForce GTX 660 Ti] 1187 GK104 [GeForce GTX 760] 1188 GK104 [GeForce GTX 690] 1189 GK104 [GeForce GTX 670] @@ -12147,6 +12190,7 @@ 1f08 TU106 [GeForce RTX 2060 Rev. A] 1f09 TU106 [GeForce GTX 1660 SUPER] 1f0a TU106 [GeForce GTX 1650] + 1f0b TU106 [CMP 40HX] 1f10 TU106M [GeForce RTX 2070 Mobile] 1f11 TU106M [GeForce RTX 2060 Mobile] 1f12 TU106M [GeForce RTX 2060 Max-Q] @@ -12174,15 +12218,21 @@ 1f9c TU117M [GeForce MX450] 1f9d TU117M [GeForce GTX 1650 Mobile / Max-Q] 1fae TU117GL + 1fb0 TU117GLM [Quadro T1000 Mobile] + 1fb1 TU117GLM [Quadro T600 Mobile] + 1fb2 TU117GLM [Quadro T400 Mobile] 1fb8 TU117GLM [Quadro T2000 Mobile / Max-Q] 1fb9 TU117GLM [Quadro T1000 Mobile] 1fbb TU117GLM [Quadro T500 Mobile] 1fbf TU117GL 1fd9 TU117BM [GeForce GTX 1650 Mobile Refresh] + 1fdd TU117BM [GeForce GTX 1650 Mobile Refresh] 1ff9 TU117GLM [Quadro T1000 Mobile] 20b0 GA100 [A100 SXM4 40GB] 20b1 GA100 [A100 PCIe 40GB] 20b2 GA100 [A100 SXM4 80GB] + 20b6 GA100GL [PG506-232] + 20b7 GA100GL [A30 PCIe] 20be GA100 [GRID A100A] 20bf GA100 [GRID A100B] 20f1 GA100 [A100 PCIe 40GB] @@ -12191,6 +12241,7 @@ 2184 TU116 [GeForce GTX 1660] 2187 TU116 [GeForce GTX 1650 SUPER] 2188 TU116 [GeForce GTX 1650] + 2189 TU116 [CMP 30HX] 2191 TU116M [GeForce GTX 1660 Ti Mobile] 2192 TU116M [GeForce GTX 1650 Ti Mobile] 21ae TU116GL @@ -12198,21 +12249,27 @@ 21c2 TU116 21c4 TU116 [GeForce GTX 1660 SUPER] 21d1 TU116BM [GeForce GTX 1660 Ti Mobile] + 2200 GA102 2204 GA102 [GeForce RTX 3090] - 2205 GA102 [GeForce RTX 3080 Ti] + 2205 GA102 [GeForce RTX 3080 20GB] 2206 GA102 [GeForce RTX 3080] 10de 1467 GA102 [GeForce RTX 3080] 10de 146d GA102 [GeForce RTX 3080 20GB] 1462 3892 RTX 3080 10GB GAMING X TRIO + 2208 GA102 [GeForce RTX 3080 Ti] 222b GA102 [GeForce RTX 3090 Engineering Sample] 222f GA102 [GeForce RTX 3080 11GB / 12GB Engineering Sample] 2230 GA102GL [RTX A6000] - 2235 GA102GL [RTX A40] - 2236 GA102GL + 2231 GA102GL [RTX A5000] + 2235 GA102GL [A40] + 2236 GA102GL [A10] + 2237 GA102GL [A10G] 223f GA102GL 228b GA104 High Definition Audio Controller + 2302 GA103 2321 GA103 2482 GA104 [GeForce RTX 3070 Ti] + 2483 GA104 2484 GA104 [GeForce RTX 3070] 10de 146b GA104 [GeForce RTX 3070] 10de 14ae GA104 [GeForce RTX 3070 16GB] @@ -12223,6 +12280,7 @@ 24ac GA104 [GeForce RTX 30x0 Engineering Sample] 24ad GA104 [GeForce RTX 3060 Engineering Sample] 24af GA104 [GeForce RTX 3070 Engineering Sample] + 24b0 GA104GL [RTX A4000] 24b6 GA104 24b8 GA104 24bf GA104 [GeForce RTX 3070 Engineering Sample] @@ -12238,7 +12296,12 @@ 25a0 GA107M [GeForce RTX 3050 Ti Mobile] 25a2 GA107M [GeForce RTX 3050 Mobile] 25a4 GA107 + 25a5 GA107M 25af GA107 [GeForce RTX 3050 Engineering Sample] + 25b5 GA107GLM [RTX A4 Mobile] + 25b8 GA107GLM + 25e0 GA107BM + 25e2 GA107BM 10df Emulex Corporation 0720 OneConnect NIC (Skyhawk) 103c 1934 FlexFabric 20Gb 2-port 650M Adapter @@ -12923,6 +12986,7 @@ 3220 RocketRAID 3220 3320 RocketRAID 3320 4310 RocketRaid 4310 + 7505 SSD7505 PCIe Gen4 x16 4-Port M.2 NVMe RAID Controller 1104 RasterOps Corp. 1105 Sigma Designs, Inc. 1105 REALmagic Xcard MPEG 1/2/3/4 DVD Decoder @@ -13060,7 +13124,7 @@ 1296 P4M800 Host Bridge 1308 PT894 Host Bridge 1314 CN700/VN800/P4M800CE/Pro Host Bridge - 1324 CX700/VX700 Host Bridge + 1324 CX700/VX700-Series Error Reporting 1327 P4M890 Host Bridge 1336 K8M890CE Host Bridge 1340 PT900 Host Bridge @@ -13085,7 +13149,7 @@ 2296 P4M800 Host Bridge 2308 PT894 Host Bridge 2314 CN700/VN800/P4M800CE/Pro Host Bridge - 2324 CX700/VX700 Host Bridge + 2324 CX700/VX700-Series Host Interface Control 2327 P4M890 Host Bridge 2336 K8M890CE Host Bridge 2340 PT900 Host Bridge @@ -13100,15 +13164,16 @@ 287d VT8251 PCIE Root Port 287e VT8237/8251 Ultra VLINK Controller 3022 CLE266 - 3038 VT82xx/62xx UHCI USB 1.1 Controller + 3038 VT82xx/62xx/VX700/8x0/900 UHCI USB 1.1 Controller 0925 1234 onboard UHCI USB 1.1 Controller 1019 0985 P6VXA Motherboard 1019 0a81 L7VTA v1.0 Motherboard (KT400-8235) 1043 8080 A7V333 motherboard - 1043 808c VT6202 USB2.0 4 port controller + 1043 808c VT62xx USB1.1 4 port controller 1043 80a1 A7V8X-X motherboard 1043 80ed A7V600/K8V-X/A8V Deluxe motherboard 1179 0001 Magnia Z310 + 1234 0925 MVP3 USB Controller 1458 5004 GA-7VAX Mainboard 1462 5901 KT6 Delta-FIS2R (MS-6590) 1462 7020 K8T NEO 2 motherboard @@ -13343,7 +13408,7 @@ 19da a179 ZBOX VD01 3290 K8M890 Host Bridge 3296 P4M800 Host Bridge - 3324 CX700/VX700 Host Bridge + 3324 CX700/VX700-Series DRAM Bus Control 3327 P4M890 Host Bridge 3336 K8M890CE Host Bridge 3337 VT8237A PCI to ISA Bridge @@ -13354,6 +13419,7 @@ 3351 VT3351 Host Bridge 3353 VX800/820 PCI to PCI Bridge 3364 CN896/VN896/P4M900 Host Bridge + 3365 VT630x IEEE 1394 Host Controller [Fire II/M] 3371 CN896/VN896/P4M900 [Chrome 9 HC] 3372 VT8237S PCI to ISA Bridge 337a VT8237A PCI to PCI Bridge @@ -13382,7 +13448,7 @@ 4296 P4M800 Host Bridge 4308 PT894 Host Bridge 4314 CN700/VN800/P4M800CE/Pro Host Bridge - 4324 CX700/VX700 Host Bridge + 4324 CX700/VX700-Series Power Management and Testing Control 4327 P4M890 Host Bridge 4336 K8M890CE Host Bridge 4340 PT900 Host Bridge @@ -13434,7 +13500,7 @@ 7296 P4M800 Host Bridge 7308 PT894 Host Bridge 7314 CN700/VN800/P4M800CE/Pro Host Bridge - 7324 CX700/VX700 Host Bridge + 7324 CX700/VX700-Series North-South Module Interface Control 7327 P4M890 Host Bridge 7336 K8M890CE Host Bridge 7340 PT900 Host Bridge @@ -13447,7 +13513,7 @@ 8231 VT8231 [PCI-to-ISA Bridge] 8235 VT8235 ACPI 8305 VT8363/8365 [KT133/KM133 AGP] - 8324 CX700/VX700 PCI to ISA Bridge + 8324 CX700/VX700-Series Bus Control and Power Management 8353 VX800/VX820 Bus Control and Power Management 8391 VT8371 [KX133 AGP] 8400 MVP4 @@ -13492,7 +13558,7 @@ b168 VT8235 PCI Bridge b188 VT8237/8251 PCI bridge [K8M890/K8T800/K8T890 South] 147b 1407 KV8-MAX3 motherboard - b198 VT8237/VX700 PCI Bridge + b198 VT8237/CX700/VX700-Series PCI to PCI Bridge b213 VPX/VPX2 I/O APIC Interrupt Controller b353 VX855/VX875/VX900 PCI to PCI Bridge b410 VX900 Series PCI Express Root Port 1 @@ -14155,7 +14221,7 @@ 0002 Dual PCI to RapidIO Bridge 000b POET Serial RapidIO Bridge 000d POET PSDMS Device -1135 Fuji Xerox Co Ltd +1135 FUJIFILM Business Innovation Corp. 0001 Printer controller 1136 Momentum Data Systems 0002 PCI-JTAG @@ -15013,6 +15079,7 @@ 11aa Actel # Nee Galileo Technology, Inc. 11ab Marvell Technology Group Ltd. + 0100 88F3700 [Armada 3700 Family] ARM SoC 0146 GT-64010/64010A System Controller 0f53 88E6318 Link Street network controller 11ab MV88SE614x SATA II PCI-E controller @@ -15229,6 +15296,8 @@ 6480 MV64460/64461/64462 System Controller 1775 c200 C2K CompactPCI single board computer 6485 MV64460/64461/64462 System Controller, Revision B + 6820 88F6820 [Armada 385] ARM SoC + 6828 88F6828 [Armada 388] ARM SoC 7042 88SX7042 PCI-e 4-port SATA-II 16b8 434b Tempo SATA E4P 7810 MV78100 [Discovery Innovation] ARM SoC @@ -15244,7 +15313,7 @@ 11ad 0003 LNE100TX 11ad f003 LNE100TX 11ad ffff LNE100TX - 1385 f004 FA310TX + 1385 f004 FA310/TX LAN 10/100 PCI Ethernet Adapter 2646 f002 KNE110TX EtheRx Fast Ethernet c115 LNE100TX [Linksys EtherFast 10/100] 11ad c001 LNE100TX [ver 2.0] @@ -16061,6 +16130,8 @@ 5a4b Telsat Turbo 1268 Tektronix 1269 Thomson-CSF/TTM +# MBIM on top of MHI + 00b4 5G Data Card [Cinterion MV31-W] 126a Lexmark International, Inc. 126b Adax, Inc. 126c Northern Telecom @@ -17607,6 +17678,8 @@ 1414 Microsoft Corporation 0001 MN-120 (ADMtek Centaur-C based) 0002 MN-130 (ADMtek Centaur-P based) +# Virtual Video Card Device for Windows Remote Desktop (RDP) + 008c Basic Render Driver 5353 Hyper-V virtual VGA 5801 XMA Decoder (Xenon) 5802 SATA Controller - CdRom (Xenon) @@ -18475,6 +18548,22 @@ 1028 2097 EMC PowerEdge Express Flash Ent NVMe AGN SED RI U.2 Gen4 1.92TB 1028 2098 EMC PowerEdge Express Flash Ent NVMe AGN SED RI U.2 Gen4 3.84TB 1028 2099 EMC PowerEdge Express Flash Ent NVMe AGN SED RI U.2 Gen4 7.68TB + 1028 2118 Ent NVMe v2 AGN FIPS MU U.2 1.6TB + 1028 2119 Ent NVMe v2 AGN MU U.2 1.6TB + 1028 2120 Ent NVMe v2 AGN FIPS MU U.2 3.2T + 1028 2121 Ent NVMe v2 AGN MU U.2 3.2TB + 1028 2122 Ent NVMe v2 AGN FIPS MU U.2 6.4TB + 1028 2123 Ent NVMe v2 AGN MU U.2 6.4TB + 1028 2124 Ent NVMe v2 AGN FIPS MU U.2 6.4TB + 1028 2125 Ent NVMe v2 AGN MU U.2 12.8TB + 1028 2126 Ent NVMe v2 AGN FIPS RI U.2 1.92TB + 1028 2127 Ent NVMe v2 AGN RI U.2 1.92TB + 1028 2128 Ent NVMe v2 AGN FIPS RI U.2 3.84TB + 1028 2129 Ent NVMe v2 AGN RI U.2 3.84TB + 1028 2130 Ent NVMe v2 AGN FIPS RI U.2 7.68TB + 1028 2131 Ent NVMe v2 AGN RI U.2 7.68TB + 1028 2132 Ent NVMe v2 AGN FIPS RI U.2 15.36TB + 1028 2133 Ent NVMe v2 AGN RI U.2 15.36TB ecec Exynos 8895 PCIe Root Complex 144e OLITEC 144f Askey Computer Corp. @@ -18486,6 +18575,7 @@ 1456 Advanced Hardware Architectures 1457 Nuera Communications Inc 1458 Gigabyte Technology Co., Ltd + 3483 USB 3.0 Controller (VIA VL80x-based xHCI Controller) 1459 DOOIN Electronics 145a Escalate Networks Inc 145b PRAIM SRL @@ -18502,6 +18592,8 @@ e836 M115S Hybrid Analog/DVB PAL/SECAM/NTSC Tuner f436 AVerTV Hybrid+FM 1462 Micro-Star International Co., Ltd. [MSI] +# VIA Driver-inf + 3483 MSI USB 3.0 (VIA VL80x-based xHCI USB Controller) aaf0 Radeon RX 580 Gaming X 8G 1463 Fast Corporation 1464 Interactive Circuits & Systems Ltd @@ -18551,6 +18643,7 @@ 148a OPTO 148b INNOMEDIALOGIC Inc. 148c Tul Corporation / PowerColor + 2391 Radeon RX 590 [Red Devil] 148d DIGICOM Systems, Inc. 1003 HCF 56k Data/Fax Modem 148e OSI Plus Corporation @@ -18652,9 +18745,11 @@ 103c 1240 Myrinet M2L-PCI64/2-3.0 LANai 7.4 (HP OEM) 14c2 DTK Computer 14c3 MEDIATEK Corp. + 7612 MT7612E 802.11acbgn PCI Express Wireless Network Adapter 7630 MT7630e 802.11bgn Wireless Network Adapter # MT7612E too? 7662 MT7662E 802.11ac PCI Express Wireless Network Adapter + 7915 MT7915E 802.11ax PCI Express Wireless Network Adapter 14c4 IWASAKI Information Systems Co Ltd 14c5 Automation Products AB 14c6 Data Race Inc @@ -18923,11 +19018,13 @@ 103c 0890 NC6000 laptop 103c 099c NX6110/NC6120 10cf 1279 LifeBook E8010D - 165f NetXtreme BCM5720 2-port Gigabit Ethernet PCIe + 165f NetXtreme BCM5720 Gigabit Ethernet PCIe 1028 04f7 PowerEdge R320 server 1028 08fd PowerEdge R6515/R7515 LOM 1028 08ff PowerEdge Rx5xx LOM Board 1028 0900 PowerEdge C6525 LOM +# Dell 5720 LOM + 1028 0917 PowerEdge C6520 LOM 103c 1786 NC332T Adapter 103c 193d NC332i Adapter 103c 2133 NC332i Adapter @@ -19160,12 +19257,12 @@ 16d4 BCM57402 NetXtreme-E Ethernet Partition 16d5 BCM57407 NetXtreme-E 10GBase-T Ethernet Controller 16d6 BCM57412 NetXtreme-E 10Gb RDMA Ethernet Controller + 14e4 1202 BCM957412M4122C OCP 1x25G Type1 wRoCE 14e4 4120 NetXtreme E-Series Advanced Dual-port 10Gb SFP+ Ethernet Network Daughter Card 14e4 4126 NetXtreme-E Dual-port 10G SFP+ Ethernet OCP 3.0 Adapter (BCM957412N4120C) 152d 8b20 BCM57412 NetXtreme-E 10Gb RDMA Ethernet Controller 152d 8b22 BCM57412 NetXtreme-E 25Gb RDMA Ethernet Controller 16d7 BCM57414 NetXtreme-E 10Gb/25Gb RDMA Ethernet Controller - 14e4 1202 BCM957412M4122C OCP 1x25G Type1 wRoCE 14e4 1402 BCM957414A4142CC 10Gb/25Gb Ethernet PCIe 14e4 1404 BCM957414M4142C OCP 2x25G Type1 wRoCE 14e4 4140 NetXtreme E-Series Advanced Dual-port 25Gb SFP28 Network Daughter Card @@ -19227,16 +19324,25 @@ 1750 BCM57508 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb/200Gb Ethernet 14e4 2100 NetXtreme-E Dual-port 100G QSFP56 Ethernet PCIe4.0 x16 Adapter (BCM957508-P2100G) 14e4 5208 NetXtreme-E Dual-port 100G QSFP56 Ethernet OCP 3.0 Adapter (BCM957508-N2100G) + 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz Ethernet 1751 BCM57504 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb/200Gb Ethernet 1752 BCM57502 NetXtreme-E 10Gb/25Gb/40Gb/50Gb Ethernet 1800 BCM57502 NetXtreme-E Ethernet Partition 1801 BCM57504 NetXtreme-E Ethernet Partition 1802 BCM57508 NetXtreme-E Ethernet Partition + 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz Ethernet Partition 1803 BCM57502 NetXtreme-E RDMA Partition 1804 BCM57504 NetXtreme-E RDMA Partition - 1805 BCM57508 NetXtreme-E RDMA Partition + 1805 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz RDMA Partition + 14e4 df24 NetXtreme-E NGM2100D BCM57508 2x100G KR Mezz RDMA Partition 1806 BCM5750X NetXtreme-E Ethernet Virtual Function + 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz Ethernet Virtual Function 1807 BCM5750X NetXtreme-E RDMA Virtual Function + 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz RDMA Virtual Function + 1808 BCM5750X NetXtreme-E Ethernet Virtual Function + 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz Ethernet Virtual Function + 1809 BCM5750X NetXtreme-E RDMA Virtual Function + 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz RDMA Virtual Function 2711 BCM2711 PCIe Bridge 3352 BCM3352 3360 BCM3360 @@ -19439,6 +19545,7 @@ 4410 BCM4413 iLine32 HomePNA 2.0 4411 BCM4413 V.90 56k modem 4412 BCM4412 10/100BaseT + 4415 BCM4359 802.11ac Dual-Band Wireless Network Controller 441f BCM4361 802.11ac Dual-Band Wireless Network Controller 4420 BCM4361 802.11ac 2.4 GHz Wireless Network Controller 4421 BCM4361 802.11ac 5 GHz Wireless Network Controller @@ -20000,6 +20107,7 @@ 9260 RCIM-II Real-Time Clock & Interrupt Module 9271 RCIM-III Real-Time Clock & Interrupt Module (PCIe) 9272 Pulse Width Modulator Card + 9273 RCIM-IV Real-Time Clock & Interrupt Module (PCIe) 9277 5 Volt Delta Sigma Converter Card 9278 10 Volt Delta Sigma Converter Card 9287 Analog Output Card @@ -20291,7 +20399,13 @@ 15b3 0021 MCX4421A-ACQN ConnectX-4 Lx EN OCP,2x25G 15b3 0025 ConnectX-4 Lx 25 GbE Dual Port SFP28 rNDC 193d 100a 620F-B +# NIC-ETH540F-LP-2P SFP+ Ethernet Card + 193d 1023 NIC-ETH540F-LP-2P 193d 1031 NIC-ETH640i-Mb-2x25G +# NIC-ETH640F-3S-2P OCP3.0 Card + 193d 1083 NIC-ETH640F-3S-2P +# NIC-ETH540F-3S-2P OCP3.0 2x10G Card + 193d 1084 NIC-ETH540F-3S-2P 1016 MT27710 Family [ConnectX-4 Lx Virtual Function] 1017 MT27800 Family [ConnectX-5] 15b3 0006 ConnectX®-5 EN network interface card, 100GbE single-port QSFP28, PCIe3.0 x16, tall bracket; MCX515A-CCAT @@ -20319,6 +20433,10 @@ 1979 MT2910 Family [ConnectX-7 PCIe Bridge] 197a MT43162 Family [BlueField-3 Lx SoC PCIe Bridge] 197b MT43244 Family [BlueField-3 SoC PCIe Bridge] + 2020 MT2892 Family [ConnectX-6 Dx Emulated PCIe Bridge] + 2021 MT42822 Family [BlueField-2 SoC Emulated PCIe Bridge] + 2023 MT2910 Family [ConnectX-7 Emulated PCIe Bridge] + 2024 MT43244 Family [BlueField-3 SoC Emulated PCIe Bridge] 4117 MT27712A0-FDCF-AE 1bd4 0039 SN10XMP2P25 1bd4 003a 25G SFP28 SP EO251FM9 Adapter @@ -20735,6 +20853,9 @@ 2086 CryptoServer Se-Series Hardware Security Module c040 CryptoServer CSe-Series Hardware Security Module c051 CryptoServer Se-Series Gen2 Hardware Security Module + c070 u.trust Anchor Hardware Security Module cs7.2 Series + c071 u.trust Anchor Hardware Security Module cs7.3 Series + c072 u.trust Anchor Hardware Security Module cs7.3 Series Virtual Function # nee Atheros Communications, Inc. 168c Qualcomm Atheros 0007 AR5210 Wireless Network Adapter [AR5000 802.11a] @@ -21409,8 +21530,10 @@ 8083 GL880 USB 1.1 UHCI controller 8084 GL880 USB 2.0 EHCI controller 9750 GL9750 SD Host Controller + 9755 GL9755 SD Host Controller e763 GL9763E eMMC Controller 17aa Lenovo + 3181 ThinkCentre M75n IoT 402b Intel 82599ES 10Gb 2-port Server Adapter X520-2 17ab Phillips Components 17af Hightech Information System Ltd. @@ -21433,10 +21556,11 @@ 1385 6d00 WPNT511 RangeMax 240 Mbps Wireless CardBus Adapter 1737 0054 WPC54GX4 v1 802.11g Wireless-G Notebook Adapter with SRX400 0105 MSM8998 PCIe Root Complex - 0108 SM8150/SA8195P PCIe Root Complex - 0300 MDM9x35 LTE Modem - 0301 MDM9640 PCIe Root Complex - 0302 MDM9x55 LTE Modem [Snapdragon X12] + 0108 SM8150 PCIe Root Complex + 0109 SA8195P PCIe Root Complex + 0300 MDM9x35 LTE Modem [Snapdragon X7] + 0301 MDM9x45 LTE Modem [Snapdragon X12] + 0302 MDM9x55 LTE Modem [Snapdragon X16] 0400 Datacenter Technologies QDF2432 PCI Express Root Port 0401 Datacenter Technologies QDF2400 PCI Express Root Port 1000 QCS405 PCIe Root Complex @@ -22780,6 +22904,7 @@ 1052 Virtio input # virtio 1.0 1053 Virtio socket + 105a Virtio file system 1110 Inter-VM shared memory 1af4 1100 QEMU Virtual Machine 1af5 Netezza Corp. @@ -22805,8 +22930,10 @@ 1080 ASM1083/1085 PCIe to PCI Bridge 1849 1080 Motherboard 1142 ASM1042A USB 3.0 Host Controller - 1184 ASM1184e PCIe Switch Port - 1849 1184 ASM1184e PCIe Switch + 1182 ASM1182e 2-Port PCIe x1 Gen2 Packet Switch + 1b21 118f ASM1182e 2-Port PCIe x1 Gen2 Packet Switch + 1184 ASM1184e 4-Port PCIe x1 Gen2 Packet Switch + 1849 1184 ASM1184e 4-Port PCIe x1 Gen2 Packet Switch 1242 ASM1142 USB 3.1 Host Controller 1343 ASM1143 USB 3.1 Host Controller 2142 ASM2142 USB 3.1 Host Controller @@ -22877,6 +23004,8 @@ 0601 NumaChip N601 0602 NumaChip N602 1b4b Marvell Technology Group Ltd. +# device 1b4b:0100 reports incorrect vendor id due to hw erratum (correct is 11ab) + 0100 88F3700 [Armada 3700 Family] ARM SoC 0640 88SE9128 SATA III 6Gb/s RAID Controller 2241 88NR2241 Non-Volatile memory controller 1028 2112 BOSS-N1 Monolithic @@ -23020,6 +23149,8 @@ # Kersey 2.5" TCG 1bb1 0152 Nytro 5520 TCG 1bb1 01a1 Nytro XP7102 + 5012 FireCuda 510 SSD + 5016 FireCuda 520 SSD 1bb3 Bluecherry 4304 BC-04120A MPEG4 4 port video encoder / decoder 4309 BC-08240A MPEG4 4 port video encoder / decoder @@ -23034,6 +23165,16 @@ 1bbf Maxeler Technologies Ltd. 0003 MAX3 0004 MAX4 +1bc0 Innodisk Corporation + 1001 PCIe 3TG6-P Controller + 1002 PCIe 3TE6 Controller + 1160 PCIe 3TE2 Controller + 1321 PCIe 4TG-P Controller + 1322 PCIe 4TE Controller + 2262 PCIe 3TG3-P Controller + 5208 PCIe 3TE7 Controller + 5216 PCIe 3TE8 Controller + 5236 PCIe 4TG2-P Controller 1bcf NEC Corporation 001c Vector Engine 1.0 1bd0 Astronics Corporation @@ -23041,9 +23182,17 @@ 1002 PM1553-5 (PC/104+ MIL-STD-1553 Interface Card) 1004 AB3000 Series Rugged Computer 1005 PE1000 (Multi-Protocol PCIe/104 Interface Card) + 1006 webCS Wireless Aircraft Communications Server + 1007 AB3000 Series Rugged Computer (Series N) + 1008 ME1000 mPCIe Avionics Interface Card + 100a NG1 Series Avionics Converter 1101 OmniBus II PCIe Multi-Protocol Interface Card 1102 OmniBusBox II Multi-Protocol Interface Core 1103 OmniBus II cPCIe/PXIe Multi-Protocol Interface Card + 1200 NG3 Series Mil-Std-1553 Interface + 1201 NG3 Series ARINC 429 Interface + 1202 NG3 Series Avionics Discrete & Serial Interface + 1203 NG3 Series Avionics Discrete Interface 1bd4 Inspur Electronic Information Industry Co., Ltd. 0911 Arria10_PCIe_F10A1150 1bee IXXAT Automation GmbH @@ -23076,6 +23225,7 @@ 001b FD720 001c FD922 001d Vega + 001f FD940 1c28 Lite-On IT Corp. / Plextor 0122 M6e PCI Express SSD [Marvell 88SS9183] # previously Fiberblaze @@ -23096,6 +23246,8 @@ 00e1 PacketMover 2x100Gb [Tivoli] 00e3 PacketMover 2x10Gb [Tivoli] 00e5 PacketMover 2x10Gb [Corfu] + 1000 SmartNIC N5010 4x100Gb + 1001 SmartNIC N5011 w/2xE810 4x100Gb a000 FBC2CGG3 Capture 2x40Gb [Mango_02] a001 FBC2CGG3 Capture 2x100Gb [Mango_02] a003 FBC2CGG3 Capture 16x10Gb [Mango] @@ -23167,6 +23319,10 @@ 0001 Hunter PCI Express 1c8c Mobiveil, Inc. 1cb0 Shannon Systems + 8266 Andalusia Series SSD + 1cb0 2021 Andalusia Series OCS U.2 SSD + 1cb0 2121 Andalusia Series ZNS U.2 SSD + 1cb0 2f21 Andalusia Series NVMe U.2 SSD d000 Venice NVMe SSD 1cb0 2010 Venice-E Series OCS U.2 1cb0 2011 Venice Series OCS U.2 @@ -23228,6 +23384,7 @@ 0009 ExaNIC X25 000a ExaNIC X100 000b ExaNIC V9P + 000c ExaNIC V9P-3 0100 ExaDISK FX1 1cf0 Akitio 1cf7 Subspace Dynamics @@ -23391,9 +23548,11 @@ 0101 Codensity D400 SSD 0102 Codensity D408 PCIe Gen4 NVMe SSD 0202 Codensity T408 Video Encoding-Decoding Accelerator -1d87 Fuzhou Rockchip Electronics Co., Ltd +# nee Fuzhou Rockchip Electronics Co., Ltd +1d87 Rockchip Electronics Co., Ltd 0100 RK3399 PCI Express Root Port 1808 RK1808 Neural Network Processor Card + 3566 RK3568 Remote Signal Processor 1d8f Enyx 1d93 YADRO 1d94 Chengdu Haiguang IC Design Co., Ltd. @@ -23512,7 +23671,7 @@ 0000 TSP100 Tensor Streaming Processor 1de1 Tekram Technology Co.,Ltd. 0391 TRM-S1040 [DC-315 / DC-395 series] - 2020 DC-390 + 2020 DC-390 Series SCSI Adapter [AMD Am53C974] 690c 690c dc29 DC290 1de5 Eideticom, Inc @@ -23588,6 +23747,12 @@ 0206 ACE-NIC200 Programmable Network Accelerator 1df3 0000 Maintenance Mode 1df3 0001 ENA2200F + 0207 ACE-NIC50RN Programmable Network Accelerator + 1df3 0000 Maintenance Mode + 1df3 0001 ENA2050RN + 0208 ACE-NIC100RN Programmable Network Accelerator + 1df3 0000 Maintenance Mode + 1df3 0001 ENA2100RN 1df7 opencpi.org 0001 ml605 0002 alst4 @@ -23703,6 +23868,9 @@ 1eae XFX Limited 1eb1 VeriSilicon Inc 1001 Video Accelerator +1ebd Emerge Technologies Company Ltd. + 0101 Seirios 2063 Video Codec +1ed3 Yeston 1ed8 Digiteq Automotive 0101 FG4 PCIe Frame Grabber 1ed9 Myrtle.ai @@ -23789,6 +23957,7 @@ 2010 8142 100VG/AnyLAN 2646 Kingston Technology Company, Inc. 0010 HyperX Predator PCIe AHCI SSD + 2262 KC2000 NVMe SSD 2263 A2000 NVMe SSD 5008 U-SNS8154P3 NVMe SSD 500d OM3PDP3 NVMe SSD @@ -23956,8 +24125,7 @@ 7053 CH353 PCI Dual Serial and Parallel Ports Controller 7073 CH356 PCI Quad Serial and Parallel Ports Controller 7173 CH355 PCI Quad Serial Port Controller -434e CAST Navigation LLC -43b0 Tiger Lake-H PCIe Root Port #9 +434e Cornelis Networks 43bc Tiger Lake-H PCIe Root Port #5 4444 Internext Compression Inc 0016 iTVC16 (CX23416) Video Decoder @@ -24648,6 +24816,7 @@ 8086 0034 Wireless-AC 9560 160MHz 8086 0070 Wi-Fi 6 AX201 160MHz 8086 0074 Wi-Fi 6 AX201 160MHz + 8086 4070 Wireless-AC 9462 80MHz 02f5 Comet Lake PCH-LP SCS3 02f9 Comet Lake Thermal Subsytem 02fc Comet Lake Integrated Sensor Solution @@ -24742,9 +24911,12 @@ 06ab Comet Lake PCH Serial IO SPI Controller #1 06ac Comet Lake PCI Express Root Port #21 06b0 Comet Lake PCI Express Root Port #9 + 06bd Comet Lake PCIe Port #6 06c0 Comet Lake PCI Express Root Port #17 06c8 Comet Lake PCH cAVS + 06d2 Comet Lake SATA AHCI Controller 06e0 Comet Lake HECI Controller + 06e3 Comet Lake Keyboard and Text (KT) Redirection 06e8 Comet Lake PCH Serial IO I2C Controller #0 06e9 Comet Lake PCH Serial IO I2C Controller #1 06ea Comet Lake PCH Serial IO I2C Controller #2 @@ -25243,6 +25415,9 @@ 1028 2103 NVMe RI U.2 3.84TB (P5500) 1028 2104 NVMe RI U.2 7.68TB (P5500) 8086 8008 NVMe Datacenter SSD [3DNAND] SE 2.5" U.2 (P5510) + 8086 8d08 NVMe Datacenter SSD [3DNAND] VE 2.5" U.2 (P5316) + 8086 8d1d NVMe Datacenter SSD [3DNAND] VE E1.L 9.5/18mm (P5316) + 0bd0 Ponte Vecchio 2T 0be0 Atom Processor D2xxx/N2xxx Integrated Graphics Controller 0be1 Atom Processor D2xxx/N2xxx Integrated Graphics Controller 105b 0d7c D270S/D250S Motherboard @@ -26364,6 +26539,8 @@ 18d4 0c07 I350 1Gb 2-port RJ45 OCP Mezz Card MOP41-I-1GT2 193d 1005 360T-B 193d 1007 360T-L +# NIC-ETH360T-3S-4P OCP3.0 4x1G Base-T Card + 193d 1080 NIC-ETH360T-3S-4P 1bd4 001d 1G base-T QP EP014Ti1 Adapter 1bd4 0035 1G base-T QP EP014Ti1 Adapter 8086 0001 Ethernet Server Adapter I350-T4 @@ -26537,6 +26714,8 @@ 17aa 4002 ThinkServer X710-2 AnyFabric for 10GbE SFP+ 193d 1020 NIC-ETH561F-sL-4x10G 193d 1021 NIC-ETH561F-sL-2x10G +# NIC-ETH561F-3S-2P OCP3.0 2x10G SFP+ Card + 193d 1081 NIC-ETH561F-3S-2P 19e5 d11c Ethernet 2-port X710 10Gb SFP+ Adapter SP330 1bd4 0042 10G SFP+ DP EP102Fi4 Adapter 1bd4 0056 Ethernet Network Adapter X710-BM2 for OCP NIC 3.0 @@ -26669,6 +26848,7 @@ 1591 Ethernet Controller E810-C for backplane 1592 Ethernet Controller E810-C for QSFP 1137 02bf E810CQDA2 2x100 GbE QSFP28 PCIe NIC + 193d 1050 NIC-ETH1060F-LP-2P 2x100GbE Ethernet PCIe Card 8086 0001 Ethernet Network Adapter E810-C-Q1 8086 0002 Ethernet Network Adapter E810-C-Q2 8086 0004 Ethernet Network Adapter E810-C-Q2 @@ -26679,6 +26859,7 @@ 8086 000b Ethernet 100G 2P E810-C Adapter 8086 000c Ethernet 100G 2P E810-C OCP 8086 000d Ethernet Network Adapter E810-L-Q2 for OCP 3.0 + 8086 000e Ethernet Network Adapter E810-2C-Q2 1593 Ethernet Controller E810-C for SFP 1137 02c3 E810XXVDA4 4x25/10 GbE SFP28 PCIe NIC 8086 0002 Ethernet Network Adapter E810-L-2 @@ -26795,6 +26976,8 @@ 1137 02c2 X710T4LG 4x10 GbE RJ45 PCIe NIC 1137 02d9 Ethernet Network Adapter X710-T2L OCP 3.0 1137 02da Ethernet Network Adapter X710-T4L OCP 3.0 +# NIC-ETH565T-3S-2P OCP3.0 2x10G Base-T Card + 193d 1082 NIC-ETH565T-3S-2P 8086 0000 Ethernet Network Adapter X710-TL 8086 0001 Ethernet Network Adapter X710-T4L 8086 0002 Ethernet Network Adapter X710-T4L @@ -28244,6 +28427,7 @@ 1cb8 0002 Omni-Path HFI Adapter 100 Series, 1 Port, PCIe x16, TC6600 Fixed Port 1cb8 0003 Omni-Path HFI Adapter 100 Series, 2 Port, 2 PCIe x16, Earth Simulation QSFP28 1cb8 0004 Omni-Path HFI Adapter 100 Series, 1 Port, PCIe x16, TC4600E QSFP28 + 434e 0001 Omni-Path HFI 100 Series, 1 Port, OCP 3.0 Adapter 8086 2628 Omni-Path HFI Adapter 100 Series, 1 Port, PCIe x16 8086 2629 Omni-Path HFI Adapter 100 Series, 1 Port, PCIe x8 8086 262a Omni-Path HFI Adapter 100 Series, 2 Ports, Split PCIe x16 @@ -28782,6 +28966,20 @@ 8086 3905 NVMe Datacenter SSD [Optane] 15mm 2.5" U.2 (P4800X) 2723 Wi-Fi 6 AX200 8086 2723 Wireless AX200 + 2725 Wi-Fi 6 AX210/AX211/AX411 160MHz + 8086 0020 Wi-Fi 6 AX210 160MHz + 8086 0024 Wi-Fi 6 AX210 160MHz + 8086 0090 Wi-Fi 6 AX211 160MHz + 8086 00b0 Wi-Fi 6 AX411 160MHz + 8086 0310 Wi-Fi 6 AX210 160MHz + 8086 0510 Wi-Fi 6 AX210 160MHz + 8086 0a10 Wi-Fi 6 AX210 160MHz + 8086 2020 Wi-Fi 6 AX210 160MHz + 8086 4020 Wi-Fi 6 AX210 160MHz + 8086 6020 Wi-Fi 6 AX210 160MHz + 8086 6024 Wi-Fi 6 AX210 160MHz + 8086 e020 Wi-Fi 6 AX210 160MHz + 8086 e024 Wi-Fi 6 AX210 160MHz 2770 82945G/GZ/P/PL Memory Controller Hub 1028 01ad OptiPlex GX620 103c 2a3b Pavilion A1512X @@ -31043,7 +31241,7 @@ 4140 NVMe Datacenter SSD [Optane] 1028 2134 NVMe Datacenter SSD [Optane] SED 400GB 2.5" U.2 (P5800X) 1028 2135 NVMe Datacenter SSD [Optane] SED 800GB 2.5" U.2 (P5800X) - 1028 2136 NVMe Datacenter SSD [Optane] SED 1.6GB 2.5" U.2 (P5800X) + 1028 2136 NVMe Datacenter SSD [Optane] SED 1.6TB 2.5" U.2 (P5800X) 1028 2137 NVMe Datacenter SSD [Optane] 400GB 2.5" U.2 (P5800X) 1028 2138 NVMe Datacenter SSD [Optane] 800GB 2.5" U.2 (P5800X) 1028 2139 NVMe Datacenter SSD [Optane] 1.6TB 2.5" U.2 (P5800X) @@ -31139,20 +31337,42 @@ 438b Tiger Lake-H LPC/eSPI Controller 43a3 Tiger Lake-H SMBus Controller 43a4 Tiger Lake-H SPI Controller + 43b0 Tiger Lake-H PCI Express Root Port #9 + 43bc Tiger Lake-H PCI Express Root Port #5 43c8 Tiger Lake-H HD Audio Controller 43e0 Tiger Lake-H Management Engine Interface 43e8 Tiger Lake-H Serial IO I2C Controller #0 43ed Tiger Lake-H USB 3.2 Gen 2x1 xHCI Host Controller *** 102 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed May 5 08:32:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A5A4635353; Wed, 5 May 2021 08:32:35 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqhg27Jsz3Krg; Wed, 5 May 2021 08:32:35 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3A8FB21CA2; Wed, 5 May 2021 08:32:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458WZob042604; Wed, 5 May 2021 08:32:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458WZdt042603; Wed, 5 May 2021 08:32:35 GMT (envelope-from git) Date: Wed, 5 May 2021 08:32:35 GMT Message-Id: <202105050832.1458WZdt042603@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 320e553b49c7 - stable/13 - pci_vendors: update to 2021-05-04 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 320e553b49c73853820b36a53126b973d14aff78 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:32:35 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=320e553b49c73853820b36a53126b973d14aff78 commit 320e553b49c73853820b36a53126b973d14aff78 Author: Baptiste Daroussin AuthorDate: 2021-05-04 12:02:41 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:30:54 +0000 pci_vendors: update to 2021-05-04 (cherry picked from commit 3657010266b235f6394aefbe755dc316bb2535b4) --- share/misc/pci_vendors | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors index 1a00db8f19dc..9deb7293e596 100644 --- a/share/misc/pci_vendors +++ b/share/misc/pci_vendors @@ -1,8 +1,8 @@ # # List of PCI ID's # -# Version: 2021.04.26 -# Date: 2021-04-26 03:15:02 +# Version: 2021.05.04 +# Date: 2021-05-04 03:15:01 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at https://pci-ids.ucw.cz/. @@ -12142,6 +12142,7 @@ 1e04 TU102 [GeForce RTX 2080 Ti] 1e07 TU102 [GeForce RTX 2080 Ti Rev. A] 1462 3715 RTX 2080 Ti GAMING X TRIO + 1e09 CMP 50HX 1e2d TU102 [GeForce RTX 2080 Ti Engineering Sample] 1e2e TU102 [GeForce RTX 2080 Ti 12GB Engineering Sample] 1e30 TU102GL [Quadro RTX 6000/8000] @@ -12257,6 +12258,7 @@ 10de 146d GA102 [GeForce RTX 3080 20GB] 1462 3892 RTX 3080 10GB GAMING X TRIO 2208 GA102 [GeForce RTX 3080 Ti] + 220d GA102 222b GA102 [GeForce RTX 3090 Engineering Sample] 222f GA102 [GeForce RTX 3080 11GB / 12GB Engineering Sample] 2230 GA102GL [RTX A6000] @@ -12281,13 +12283,15 @@ 24ad GA104 [GeForce RTX 3060 Engineering Sample] 24af GA104 [GeForce RTX 3070 Engineering Sample] 24b0 GA104GL [RTX A4000] - 24b6 GA104 - 24b8 GA104 + 24b6 GA104GLM [RTX A5000 Mobile] + 24b7 GA104GLM [RTX A4000 Mobile] + 24b8 GA104GLM [RTX A3000 Mobile] 24bf GA104 [GeForce RTX 3070 Engineering Sample] 24dc GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB] 24dd GA104M [GeForce RTX 3070 Mobile / Max-Q] 2501 GA106 [GeForce RTX 3060] 2503 GA106 [GeForce RTX 3060] + 2504 GA106 [GeForce RTX 3060 Lite Hash Rate] 2505 GA106 2520 GA106M [GeForce RTX 3060 Mobile / Max-Q] 252f GA106 [GeForce RTX 3060 Engineering Sample] @@ -12299,7 +12303,7 @@ 25a5 GA107M 25af GA107 [GeForce RTX 3050 Engineering Sample] 25b5 GA107GLM [RTX A4 Mobile] - 25b8 GA107GLM + 25b8 GA107GLM [RTX A2000 Mobile] 25e0 GA107BM 25e2 GA107BM 10df Emulex Corporation @@ -19324,8 +19328,12 @@ 1750 BCM57508 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb/200Gb Ethernet 14e4 2100 NetXtreme-E Dual-port 100G QSFP56 Ethernet PCIe4.0 x16 Adapter (BCM957508-P2100G) 14e4 5208 NetXtreme-E Dual-port 100G QSFP56 Ethernet OCP 3.0 Adapter (BCM957508-N2100G) + 14e4 d124 NetXtreme-E P2100D BCM57508 2x100G QSFP PCIE 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz Ethernet 1751 BCM57504 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb/200Gb Ethernet + 14e4 5045 NetXtreme-E BCM57504 4x25G OCP3.0 + 14e4 5250 NetXtreme-E BCM57504 4x25G KR Mezz + 14e4 d142 NetXtreme-E P425D BCM57504 4x25G SFP28 PCIE 1752 BCM57502 NetXtreme-E 10Gb/25Gb/40Gb/50Gb Ethernet 1800 BCM57502 NetXtreme-E Ethernet Partition 1801 BCM57504 NetXtreme-E Ethernet Partition @@ -23868,7 +23876,7 @@ 1eae XFX Limited 1eb1 VeriSilicon Inc 1001 Video Accelerator -1ebd Emerge Technologies Company Ltd. +1ebd EMERGETECH Company Ltd. 0101 Seirios 2063 Video Codec 1ed3 Yeston 1ed8 Digiteq Automotive @@ -26198,7 +26206,7 @@ 103c 2159 Ethernet 10Gb 2-port 562i Adapter 108e 7b11 Ethernet Server Adapter X520-2 1170 004c 82599 DP 10G Mezzanine Adapter - 15d9 0611 AOC-STGN-I2S [REV 1.01] + 15d9 0611 AOC-STGN-i2S 1734 11a9 10 Gigabit Dual Port Network Connection 17aa 1071 ThinkServer X520-2 AnyFabric 17aa 4007 82599ES 10-Gigabit SFI/SFP+ Network Connection @@ -26533,6 +26541,7 @@ 1093 775b PCIe-8237 Ethernet Adapter 10a9 802a UV2-BaseIO dual-port GbE 1137 023e 1GigE I350 LOM + 15d9 0000 AOC-SGP-i4 15d9 0652 Dual Port i350 GbE MicroLP [AOC-CGP-i2] 17aa 1074 ThinkServer I350-T4 AnyFabric 17aa 4005 I350 Gigabit Network Connection @@ -27383,6 +27392,7 @@ 15d9 066b X9SRL-F 1d2d C600/X79 series chipset USB2 Enhanced Host Controller #2 1028 04f7 C602J on PowerEdge R320 server + 103c 18a9 HP DL360e G8 15d9 066b X9SRL-F 1d33 C600/X79 series chipset LAN Controller 1d35 C600/X79 series chipset VECI Controller @@ -30469,7 +30479,7 @@ 31d9 Gemini Lake PCI Express Root Port 31da Gemini Lake PCI Express Root Port 31db Gemini Lake PCI Express Root Port - 31dc AC 1550i Wireless + 31dc Gemini Lake PCH CNVi WiFi 31e3 Celeron/Pentium Silver Processor SATA Controller 31e8 Celeron/Pentium Silver Processor LPC Controller 31ee Celeron/Pentium Silver Processor Serial IO UART Host Controller @@ -30570,7 +30580,7 @@ 34eb Ice Lake-LP Serial IO I2C Controller #3 34ed Ice Lake-LP USB 3.1 xHCI Host Controller 34ef Ice Lake-LP DRAM Controller - 34f0 Killer Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201NGW) + 34f0 Ice Lake-LP PCH CNVi WiFi 34f8 Ice Lake-LP SD Controller 34fc Ice Lake-LP Integrated Sensor Solution 3500 6311ESB/6321ESB PCI Express Upstream Port @@ -32145,6 +32155,7 @@ 9a60 TigerLake-H GT1 [UHD Graphics] 9a68 TigerLake-H GT1 [UHD Graphics] 9b41 CometLake-U GT2 [UHD Graphics] + 1028 09bd Latitude 7310 9b44 10th Gen Core Processor Host Bridge/DRAM Registers 9b53 Comet Lake-S 6c Host Bridge/DRAM Controller 9b54 10th Gen Core Processor Host Bridge/DRAM Registers @@ -32766,7 +32777,7 @@ a36d Cannon Lake PCH USB 3.1 xHCI Host Controller 1028 0869 Vostro 3470 a36f Cannon Lake PCH Shared SRAM - a370 Wireless-AC 9560 [Jefferson Peak] + a370 Cannon Lake PCH CNVi WiFi 1a56 1552 Killer(R) Wireless-AC 1550i Wireless Network Adapter (9560NGW) a379 Cannon Lake PCH Thermal Controller 1028 0869 Vostro 3470 From owner-dev-commits-src-all@freebsd.org Wed May 5 08:38:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE79263567C; Wed, 5 May 2021 08:38:16 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqqD60VVz3L2C; Wed, 5 May 2021 08:38:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C0FDB21CA5; Wed, 5 May 2021 08:38:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458cGYR043596; Wed, 5 May 2021 08:38:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458cGZG043595; Wed, 5 May 2021 08:38:16 GMT (envelope-from git) Date: Wed, 5 May 2021 08:38:16 GMT Message-Id: <202105050838.1458cGZG043595@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: a3b7f912600b - stable/13 - cp: fix indentation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a3b7f912600b62ebd1740b44c96a9d8fa35b8ca6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:38:16 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=a3b7f912600b62ebd1740b44c96a9d8fa35b8ca6 commit a3b7f912600b62ebd1740b44c96a9d8fa35b8ca6 Author: Baptiste Daroussin AuthorDate: 2021-01-26 09:52:22 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:35:02 +0000 cp: fix indentation No functional changes (cherry picked from commit 45b252fc9182b96342b8a598f271e49c20cbfe40) --- bin/cp/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cp/utils.c b/bin/cp/utils.c index 7742b0d0a516..e7ae0c9dd733 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -235,7 +235,7 @@ copy_file(const FTSENT *entp, int dne) do { if (use_copy_file_range) { rcount = copy_file_range(from_fd, NULL, - to_fd, NULL, SSIZE_MAX, 0); + to_fd, NULL, SSIZE_MAX, 0); if (rcount < 0 && errno == EINVAL) { /* Prob a non-seekable FD */ use_copy_file_range = 0; From owner-dev-commits-src-all@freebsd.org Wed May 5 08:38:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B36363599F; Wed, 5 May 2021 08:38:18 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqqG00mgz3LBt; Wed, 5 May 2021 08:38:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E52C821BD8; Wed, 5 May 2021 08:38:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458cHxE043618; Wed, 5 May 2021 08:38:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458cHha043617; Wed, 5 May 2021 08:38:17 GMT (envelope-from git) Date: Wed, 5 May 2021 08:38:17 GMT Message-Id: <202105050838.1458cHha043617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 07d72ca90585 - stable/13 - diff: add a test case about the non regular file support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 07d72ca90585ee98dbdd8f4fd2bb01bc2329d99c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:38:18 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=07d72ca90585ee98dbdd8f4fd2bb01bc2329d99c commit 07d72ca90585ee98dbdd8f4fd2bb01bc2329d99c Author: Baptiste Daroussin AuthorDate: 2021-01-26 10:38:36 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:37:07 +0000 diff: add a test case about the non regular file support (cherry picked from commit c440e7870a020546ad241848e2ff8e9cb27a3073) --- usr.bin/diff/tests/diff_test.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh index 6da2bbaea34d..60b56f0d9067 100755 --- a/usr.bin/diff/tests/diff_test.sh +++ b/usr.bin/diff/tests/diff_test.sh @@ -16,6 +16,7 @@ atf_test_case tabsize atf_test_case conflicting_format atf_test_case label atf_test_case report_identical +atf_test_case non_regular_file simple_body() { @@ -236,6 +237,19 @@ report_identical_body() -o empty diff -s A B } +non_regular_file_body() +{ + printf "\tA\n" > A + mkfifo B + printf "\tA\n" > B & + + atf_check diff A B + printf "\tB\n" > B & + atf_check -s exit:1 \ + -o inline:"--- A\n+++ B\n@@ -1 +1 @@\n-\tA\n+\tB\n" \ + diff --label A --label B -u A B +} + atf_init_test_cases() { atf_add_test_case simple @@ -254,4 +268,5 @@ atf_init_test_cases() atf_add_test_case conflicting_format atf_add_test_case label atf_add_test_case report_identical + atf_add_test_case non_regular_file } From owner-dev-commits-src-all@freebsd.org Wed May 5 08:38:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51BF86357F6; Wed, 5 May 2021 08:38:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqqH11PKz3L6Y; Wed, 5 May 2021 08:38:19 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0D132219BD; Wed, 5 May 2021 08:38:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458cI7n043639; Wed, 5 May 2021 08:38:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458cIC0043638; Wed, 5 May 2021 08:38:18 GMT (envelope-from git) Date: Wed, 5 May 2021 08:38:18 GMT Message-Id: <202105050838.1458cIC0043638@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 0ce985a23b50 - stable/13 - diff: eliminate space at end of line MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0ce985a23b505750faa446ebf7dae177bf3f88c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:38:19 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=0ce985a23b505750faa446ebf7dae177bf3f88c4 commit 0ce985a23b505750faa446ebf7dae177bf3f88c4 Author: Baptiste Daroussin AuthorDate: 2021-01-27 10:46:15 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:37:08 +0000 diff: eliminate space at end of line No functionnal changes (cherry picked from commit 15abb23286541c17ff95bac056cd4979822c4288) --- usr.bin/diff/diffreg.c | 66 +++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 4e887ab27c7b..e6b36697fb28 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -268,17 +268,17 @@ diffreg(char *file1, char *file2, int flags, int capsicum) lastmatchline = 0; context_vec_ptr = context_vec_start - 1; - /* - * hw excludes padding and make sure when -t is not used, + /* + * hw excludes padding and make sure when -t is not used, * the second column always starts from the closest tab stop */ - if (diff_format == D_SIDEBYSIDE) { + if (diff_format == D_SIDEBYSIDE) { hw = width >> 1; padding = tabsize - (hw % tabsize); if ((flags & D_EXPANDTABS) != 0 || (padding % tabsize == 0)) padding = MIN_PAD; - hw = (width >> 1) - + hw = (width >> 1) - ((padding == MIN_PAD) ? (padding << 1) : padding) - 1; } @@ -902,14 +902,14 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) if (diff_format != D_EDIT) { for (i0 = 1; i0 <= m; i0 = i1 + 1) { while (i0 <= m && J[i0] == J[i0 - 1] + 1){ - if (diff_format == D_SIDEBYSIDE && + if (diff_format == D_SIDEBYSIDE && suppress_common != 1) { - nc = fetch(ixold, i0, i0, f1, '\0', + nc = fetch(ixold, i0, i0, f1, '\0', 1, flags); - print_space(nc, - (hw - nc) + (padding << 1) + 1, + print_space(nc, + (hw - nc) + (padding << 1) + 1, flags); - fetch(ixnew, J[i0], J[i0], f2, '\0', + fetch(ixnew, J[i0], J[i0], f2, '\0', 0, flags); diff_output("\n"); } @@ -923,32 +923,32 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) J[i1] = j1; /* - * When using side-by-side, lines from both of the - * files are printed. The algorithm used by diff(1) - * identifies the ranges in which two files differ. - * See the change() function below. - * The for loop below consumes the shorter range, - * whereas one of the while loops deals with the + * When using side-by-side, lines from both of the + * files are printed. The algorithm used by diff(1) + * identifies the ranges in which two files differ. + * See the change() function below. + * The for loop below consumes the shorter range, + * whereas one of the while loops deals with the * longer one. */ if (diff_format == D_SIDEBYSIDE) { - for (i=i0, j=j0; i<=i1 && j<=j1; i++, j++) - change(file1, f1, file2, f2, i, i, + for (i=i0, j=j0; i<=i1 && j<=j1; i++, j++) + change(file1, f1, file2, f2, i, i, j, j, &flags); while (i <= i1) { - change(file1, f1, file2, f2, + change(file1, f1, file2, f2, i, i, j+1, j, &flags); i++; } while (j <= j1) { - change(file1, f1, file2, f2, + change(file1, f1, file2, f2, i+1, i, j, j, &flags); j++; } } else - change(file1, f1, file2, f2, i0, i1, j0, + change(file1, f1, file2, f2, i0, i1, j0, j1, &flags); } } else { @@ -1188,10 +1188,10 @@ proceed: print_space(0, hw + padding , *pflags); } else { nc = fetch(ixold, a, b, f1, '\0', 1, *pflags); - print_space(nc, hw - nc + padding, *pflags); + print_space(nc, hw - nc + padding, *pflags); } diff_output("%c", (a>b)? '>' : ((c>d)? '<' : '|')); - print_space(hw + padding + 1 , padding, *pflags); + print_space(hw + padding + 1 , padding, *pflags); fetch(ixnew, c, d, f2, '\0', 0, *pflags); diff_output("\n"); } @@ -1260,13 +1260,13 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) for (i = a; i <= b; i++) { fseek(lb, f[i - 1], SEEK_SET); nc = (f[i] - f[i - 1]); - if (diff_format == D_SIDEBYSIDE && hw < nc) + if (diff_format == D_SIDEBYSIDE && hw < nc) nc = hw; - if ((diff_format != D_IFDEF && diff_format != D_GFORMAT) && + if ((diff_format != D_IFDEF && diff_format != D_GFORMAT) && ch != '\0') { diff_output("%c", ch); - if (Tflag && (diff_format == D_NORMAL || - diff_format == D_CONTEXT || + if (Tflag && (diff_format == D_NORMAL || + diff_format == D_CONTEXT || diff_format == D_UNIFIED)) diff_output("\t"); else if (diff_format != D_UNIFIED) @@ -1275,7 +1275,7 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) col = 0; for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { if ((c = getc(lb)) == EOF) { - if (diff_format == D_EDIT || + if (diff_format == D_EDIT || diff_format == D_REVERSE || diff_format == D_NREVERSE) warnx("No newline at end of file"); @@ -1284,8 +1284,8 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) "file\n"); return col; } - /* - * when using --side-by-side, col needs to be increased + /* + * when using --side-by-side, col needs to be increased * in any case to keep the columns aligned */ if (c == '\t') { @@ -1297,9 +1297,9 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) diff_output(" "); } while (++col < newcol && j < nc); } else { - if (diff_format == D_SIDEBYSIDE) { + if (diff_format == D_SIDEBYSIDE) { if ((j + tabsize) > nc) { - diff_output("%*s", + diff_output("%*s", nc - j,""); j = col = nc; } else { @@ -1691,9 +1691,9 @@ print_header(const char *file1, const char *file2) file2, buf2); } -/* +/* * Prints n number of space characters either by using tab - * or single space characters. + * or single space characters. * nc is the preceding number of characters */ static void From owner-dev-commits-src-all@freebsd.org Wed May 5 08:38:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A96B63591C; Wed, 5 May 2021 08:38:20 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqqJ2kYfz3L2K; Wed, 5 May 2021 08:38:20 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 39C7D21C33; Wed, 5 May 2021 08:38:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458cK3X043660; Wed, 5 May 2021 08:38:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458cKQG043659; Wed, 5 May 2021 08:38:20 GMT (envelope-from git) Date: Wed, 5 May 2021 08:38:20 GMT Message-Id: <202105050838.1458cKQG043659@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: c5820184feb6 - stable/13 - diff: remove stalled entries in headers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c5820184feb6c76516da025233b6ac9be8eaf14d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:38:20 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=c5820184feb6c76516da025233b6ac9be8eaf14d commit c5820184feb6c76516da025233b6ac9be8eaf14d Author: Baptiste Daroussin AuthorDate: 2021-01-27 11:13:47 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:37:08 +0000 diff: remove stalled entries in headers (cherry picked from commit 931ad51808a650fd28be27210f25ba05d8e71199) --- usr.bin/diff/diff.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h index 1974b5cc08d6..b5536bd7bf77 100644 --- a/usr.bin/diff/diff.h +++ b/usr.bin/diff/diff.h @@ -102,9 +102,6 @@ extern regex_t ignore_re; char *splice(char *, char *); int diffreg(char *, char *, int, int); -int easprintf(char **, const char *, ...); -void *emalloc(size_t); -void *erealloc(void *, size_t); void diffdir(char *, char *, int); void print_only(const char *, size_t, const char *); void print_status(int, char *, char *, const char *); From owner-dev-commits-src-all@freebsd.org Wed May 5 08:38:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FC68635773; Wed, 5 May 2021 08:38:21 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqqK3C96z3L08; Wed, 5 May 2021 08:38:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5E12421A56; Wed, 5 May 2021 08:38:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458cLw9043681; Wed, 5 May 2021 08:38:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458cL8h043680; Wed, 5 May 2021 08:38:21 GMT (envelope-from git) Date: Wed, 5 May 2021 08:38:21 GMT Message-Id: <202105050838.1458cL8h043680@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: ffbf0225b7d2 - stable/13 - diff: fix typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ffbf0225b7d2fbee1acd430eaf714b29f378bebf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:38:21 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=ffbf0225b7d2fbee1acd430eaf714b29f378bebf commit ffbf0225b7d2fbee1acd430eaf714b29f378bebf Author: Baptiste Daroussin AuthorDate: 2021-01-26 14:20:44 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:37:09 +0000 diff: fix typo in a comment (cherry picked from commit e52546a3a75f6e4b327178f4d50a98dd99101c64) --- usr.bin/diff/diffreg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index e6b36697fb28..9839171c5639 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -348,7 +348,7 @@ diffreg(char *file1, char *file2, int flags, int capsicum) if (caph_rights_limit(fileno(f2), &rights_ro) < 0) err(2, "unable to limit rights on: %s", file2); if (fileno(f1) == STDIN_FILENO || fileno(f2) == STDIN_FILENO) { - /* stding has already been limited */ + /* stdin has already been limited */ if (caph_limit_stderr() == -1) err(2, "unable to limit stderr"); if (caph_limit_stdout() == -1) From owner-dev-commits-src-all@freebsd.org Wed May 5 08:38:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3515B635A26; Wed, 5 May 2021 08:38:23 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqqL42XVz3L55; Wed, 5 May 2021 08:38:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7B3D921943; Wed, 5 May 2021 08:38:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458cMUT043708; Wed, 5 May 2021 08:38:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458cMgs043707; Wed, 5 May 2021 08:38:22 GMT (envelope-from git) Date: Wed, 5 May 2021 08:38:22 GMT Message-Id: <202105050838.1458cMgs043707@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: b6b26cecc0ba - stable/13 - diff: simplify the hash functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b6b26cecc0babc7834c026b43bb761cbd5147ed9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:38:23 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=b6b26cecc0babc7834c026b43bb761cbd5147ed9 commit b6b26cecc0babc7834c026b43bb761cbd5147ed9 Author: Baptiste Daroussin AuthorDate: 2021-01-26 15:25:00 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:37:09 +0000 diff: simplify the hash functions Instead of 3 different complex case they have all been folded into a simple on based on switch (cherry picked from commit e43239f5140e1b80de122458a2ac037172866058) --- usr.bin/diff/diffreg.c | 77 ++++++++++++++++++-------------------------------- 1 file changed, 27 insertions(+), 50 deletions(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 9839171c5639..35d41b28fb7c 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1350,64 +1350,41 @@ readhash(FILE *f, int flags) sum = 1; space = 0; - if ((flags & (D_FOLDBLANKS|D_IGNOREBLANKS)) == 0) { - if (flags & D_IGNORECASE) - for (i = 0; (t = getc(f)) != '\n'; i++) { - if (flags & D_STRIPCR && t == '\r') { - t = getc(f); - if (t == '\n') - break; - ungetc(t, f); - } - if (t == EOF) { - if (i == 0) - return (0); + for (i = 0;;) { + switch (t = getc(f)) { + case '\r': + if (flags & D_STRIPCR) { + t = getc(f); + if (t == '\n') break; - } - sum = sum * 127 + chrtran(t); - } - else - for (i = 0; (t = getc(f)) != '\n'; i++) { - if (flags & D_STRIPCR && t == '\r') { - t = getc(f); - if (t == '\n') - break; - ungetc(t, f); - } - if (t == EOF) { - if (i == 0) - return (0); - break; - } - sum = sum * 127 + t; + ungetc(t, f); } - } else { - for (i = 0;;) { - switch (t = getc(f)) { - case '\r': - case '\t': - case '\v': - case '\f': - case ' ': + /* FALLTHROUGH */ + case '\t': + case '\v': + case '\f': + case ' ': + if ((flags & (D_FOLDBLANKS|D_IGNOREBLANKS)) != 0) { space++; continue; - default: - if (space && (flags & D_IGNOREBLANKS) == 0) { - i++; - space = 0; - } - sum = sum * 127 + chrtran(t); + } + /* FALLTHROUGH */ + default: + if (space && (flags & D_IGNOREBLANKS) == 0) { i++; - continue; - case EOF: - if (i == 0) - return (0); - /* FALLTHROUGH */ - case '\n': - break; + space = 0; } + sum = sum * 127 + chrtran(t); + i++; + continue; + case EOF: + if (i == 0) + return (0); + /* FALLTHROUGH */ + case '\n': break; } + break; } /* * There is a remote possibility that we end up with a zero sum. From owner-dev-commits-src-all@freebsd.org Wed May 5 08:38:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23B52635A28; Wed, 5 May 2021 08:38:24 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqqM5yX3z3L70; Wed, 5 May 2021 08:38:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A268821C34; Wed, 5 May 2021 08:38:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458cN88043733; Wed, 5 May 2021 08:38:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458cNJL043732; Wed, 5 May 2021 08:38:23 GMT (envelope-from git) Date: Wed, 5 May 2021 08:38:23 GMT Message-Id: <202105050838.1458cNJL043732@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 7904a2e5a8c5 - stable/13 - diff: eleminitate useless macros MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7904a2e5a8c56853bd39f5fe22a14cf8b526cd3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:38:24 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=7904a2e5a8c56853bd39f5fe22a14cf8b526cd3c commit 7904a2e5a8c56853bd39f5fe22a14cf8b526cd3c Author: Baptiste Daroussin AuthorDate: 2021-01-27 10:47:17 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:37:09 +0000 diff: eleminitate useless macros The diff_output was not bringing any values but was obfuscating the code. (cherry picked from commit 7a57c9cb5a4dffb0483beeae6da7cf266ea634be) --- usr.bin/diff/diffreg.c | 113 ++++++++++++++++++++++++------------------------- 1 file changed, 56 insertions(+), 57 deletions(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 35d41b28fb7c..1b28281024c6 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -180,7 +180,6 @@ struct context_vec { int d; /* end line in new file */ }; -#define diff_output printf #define MIN_PAD 1 static FILE *opentemp(const char *); static void output(char *, FILE *, char *, FILE *, int); @@ -911,7 +910,7 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) flags); fetch(ixnew, J[i0], J[i0], f2, '\0', 0, flags); - diff_output("\n"); + printf("\n"); } i0++; } @@ -971,7 +970,7 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) #define c i0 if ((c = getc(f1)) == EOF) return; - diff_output("%c", c); + printf("%c", c); } #undef c } @@ -986,20 +985,20 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) static void range(int a, int b, const char *separator) { - diff_output("%d", a > b ? b : a); + printf("%d", a > b ? b : a); if (a < b) - diff_output("%s%d", separator, b); + printf("%s%d", separator, b); } static void uni_range(int a, int b) { if (a < b) - diff_output("%d,%d", a, b - a + 1); + printf("%d,%d", a, b - a + 1); else if (a == b) - diff_output("%d", b); + printf("%d", b); else - diff_output("%d,0", b); + printf("%d,0", b); } static char * @@ -1090,7 +1089,7 @@ restart: } proceed: if (*pflags & D_HEADER && diff_format != D_BRIEF) { - diff_output("%s %s %s\n", diffargs, file1, file2); + printf("%s %s %s\n", diffargs, file1, file2); *pflags &= ~D_HEADER; } if (diff_format == D_CONTEXT || diff_format == D_UNIFIED) { @@ -1137,24 +1136,24 @@ proceed: case D_NORMAL: case D_EDIT: range(a, b, ","); - diff_output("%c", a > b ? 'a' : c > d ? 'd' : 'c'); + printf("%c", a > b ? 'a' : c > d ? 'd' : 'c'); if (diff_format == D_NORMAL) range(c, d, ","); - diff_output("\n"); + printf("\n"); break; case D_REVERSE: - diff_output("%c", a > b ? 'a' : c > d ? 'd' : 'c'); + printf("%c", a > b ? 'a' : c > d ? 'd' : 'c'); range(a, b, " "); - diff_output("\n"); + printf("\n"); break; case D_NREVERSE: if (a > b) - diff_output("a%d %d\n", b, d - c + 1); + printf("a%d %d\n", b, d - c + 1); else { - diff_output("d%d %d\n", a, b - a + 1); + printf("d%d %d\n", a, b - a + 1); if (!(c > d)) /* add changed lines */ - diff_output("a%d %d\n", b, d - c + 1); + printf("a%d %d\n", b, d - c + 1); } break; } @@ -1163,7 +1162,7 @@ proceed: /* print through if append (a>b), else to (nb: 0 vs 1 orig) */ nc = ixold[a > b ? b : a - 1] - curpos; for (i = 0; i < nc; i++) - diff_output("%c", getc(f1)); + printf("%c", getc(f1)); for (walk = group_format; *walk != '\0'; walk++) { if (*walk == '%') { walk++; @@ -1175,12 +1174,12 @@ proceed: fetch(ixnew, c, d, f2, '>', 0, *pflags); break; default: - diff_output("%%%c", *walk); + printf("%%%c", *walk); break; } continue; } - diff_output("%c", *walk); + printf("%c", *walk); } } if (diff_format == D_SIDEBYSIDE) { @@ -1190,15 +1189,15 @@ proceed: nc = fetch(ixold, a, b, f1, '\0', 1, *pflags); print_space(nc, hw - nc + padding, *pflags); } - diff_output("%c", (a>b)? '>' : ((c>d)? '<' : '|')); + printf("%c", (a>b)? '>' : ((c>d)? '<' : '|')); print_space(hw + padding + 1 , padding, *pflags); fetch(ixnew, c, d, f2, '\0', 0, *pflags); - diff_output("\n"); + printf("\n"); } if (diff_format == D_NORMAL || diff_format == D_IFDEF) { fetch(ixold, a, b, f1, '<', 1, *pflags); if (a <= b && c <= d && diff_format == D_NORMAL) - diff_output("---\n"); + printf("---\n"); } if (diff_format != D_GFORMAT && diff_format != D_SIDEBYSIDE) fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0, *pflags); @@ -1210,17 +1209,17 @@ proceed: * it. We have to add a substitute command to change this * back and restart where we left off. */ - diff_output(".\n"); - diff_output("%ds/.//\n", a + edoffset - 1); + printf(".\n"); + printf("%ds/.//\n", a + edoffset - 1); b = a + edoffset - 1; a = b + 1; c += edoffset; goto restart; } if ((diff_format == D_EDIT || diff_format == D_REVERSE) && c <= d) - diff_output(".\n"); + printf(".\n"); if (inifdef) { - diff_output("#endif /* %s */\n", ifdefname); + printf("#endif /* %s */\n", ifdefname); inifdef = 0; } } @@ -1241,19 +1240,19 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) /* print through if append (a>b), else to (nb: 0 vs 1 orig) */ nc = f[a > b ? b : a - 1] - curpos; for (i = 0; i < nc; i++) - diff_output("%c", getc(lb)); + printf("%c", getc(lb)); } if (a > b) return (0); if (diff_format == D_IFDEF) { if (inifdef) { - diff_output("#else /* %s%s */\n", + printf("#else /* %s%s */\n", oldfile == 1 ? "!" : "", ifdefname); } else { if (oldfile) - diff_output("#ifndef %s\n", ifdefname); + printf("#ifndef %s\n", ifdefname); else - diff_output("#ifdef %s\n", ifdefname); + printf("#ifdef %s\n", ifdefname); } inifdef = 1 + oldfile; } @@ -1264,13 +1263,13 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) nc = hw; if ((diff_format != D_IFDEF && diff_format != D_GFORMAT) && ch != '\0') { - diff_output("%c", ch); + printf("%c", ch); if (Tflag && (diff_format == D_NORMAL || diff_format == D_CONTEXT || diff_format == D_UNIFIED)) - diff_output("\t"); + printf("\t"); else if (diff_format != D_UNIFIED) - diff_output(" "); + printf(" "); } col = 0; for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { @@ -1280,7 +1279,7 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) diff_format == D_NREVERSE) warnx("No newline at end of file"); else - diff_output("\n\\ No newline at end of " + printf("\n\\ No newline at end of " "file\n"); return col; } @@ -1294,21 +1293,21 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) do { if (diff_format == D_SIDEBYSIDE) j++; - diff_output(" "); + printf(" "); } while (++col < newcol && j < nc); } else { if (diff_format == D_SIDEBYSIDE) { if ((j + tabsize) > nc) { - diff_output("%*s", + printf("%*s", nc - j,""); j = col = nc; } else { - diff_output("\t"); + printf("\t"); col += tabsize - 1; j += tabsize - 1; } } else { - diff_output("\t"); + printf("\t"); col++; } } @@ -1324,13 +1323,13 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) * The caller must check the value * of edoffset */ - diff_output(".\n"); + printf(".\n"); edoffset = i - a + 1; return edoffset; } /* when side-by-side, do not print a newline */ if (diff_format != D_SIDEBYSIDE || c != '\n') { - diff_output("%c", c); + printf("%c", c); col++; } } @@ -1470,15 +1469,15 @@ dump_context_vec(FILE *f1, FILE *f2, int flags) lowc = MAX(1, cvp->c - diff_context); upd = MIN(len[1], context_vec_ptr->d + diff_context); - diff_output("***************"); + printf("***************"); if ((flags & D_PROTOTYPE)) { f = match_function(ixold, lowa-1, f1); if (f != NULL) - diff_output(" %s", f); + printf(" %s", f); } - diff_output("\n*** "); + printf("\n*** "); range(lowa, upb, ","); - diff_output(" ****\n"); + printf(" ****\n"); /* * Output changes to the "old" file. The first loop suppresses @@ -1517,9 +1516,9 @@ dump_context_vec(FILE *f1, FILE *f2, int flags) fetch(ixold, b + 1, upb, f1, ' ', 0, flags); } /* output changes to the "new" file */ - diff_output("--- "); + printf("--- "); range(lowc, upd, ","); - diff_output(" ----\n"); + printf(" ----\n"); do_output = 0; for (cvp = context_vec_start; cvp <= context_vec_ptr; cvp++) @@ -1573,17 +1572,17 @@ dump_unified_vec(FILE *f1, FILE *f2, int flags) lowc = MAX(1, cvp->c - diff_context); upd = MIN(len[1], context_vec_ptr->d + diff_context); - diff_output("@@ -"); + printf("@@ -"); uni_range(lowa, upb); - diff_output(" +"); + printf(" +"); uni_range(lowc, upd); - diff_output(" @@"); + printf(" @@"); if ((flags & D_PROTOTYPE)) { f = match_function(ixold, lowa-1, f1); if (f != NULL) - diff_output(" %s", f); + printf(" %s", f); } - diff_output("\n"); + printf("\n"); /* * Output changes in "unified" diff format--the old and new lines @@ -1655,16 +1654,16 @@ print_header(const char *file1, const char *file2) sprintf(buf2, "%s.%.9d %s", buf2, nsec2, end2); } if (label[0] != NULL) - diff_output("%s %s\n", diff_format == D_CONTEXT ? "***" : "---", + printf("%s %s\n", diff_format == D_CONTEXT ? "***" : "---", label[0]); else - diff_output("%s %s\t%s\n", diff_format == D_CONTEXT ? "***" : "---", + printf("%s %s\t%s\n", diff_format == D_CONTEXT ? "***" : "---", file1, buf1); if (label[1] != NULL) - diff_output("%s %s\n", diff_format == D_CONTEXT ? "---" : "+++", + printf("%s %s\n", diff_format == D_CONTEXT ? "---" : "+++", label[1]); else - diff_output("%s %s\t%s\n", diff_format == D_CONTEXT ? "---" : "+++", + printf("%s %s\t%s\n", diff_format == D_CONTEXT ? "---" : "+++", file2, buf2); } @@ -1682,10 +1681,10 @@ print_space(int nc, int n, int flags) { /* first tabstop may be closer than tabsize */ i = tabsize - (nc % tabsize); while (col >= tabsize) { - diff_output("\t"); + printf("\t"); col -= i; i = tabsize; } } - diff_output("%*s", col, ""); + printf("%*s", col, ""); } From owner-dev-commits-src-all@freebsd.org Wed May 5 08:43:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6E93635CA3; Wed, 5 May 2021 08:43:18 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqx25mGyz3Ldj; Wed, 5 May 2021 08:43:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B88EA219DB; Wed, 5 May 2021 08:43:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458hIJw056688; Wed, 5 May 2021 08:43:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458hIF8056687; Wed, 5 May 2021 08:43:18 GMT (envelope-from git) Date: Wed, 5 May 2021 08:43:18 GMT Message-Id: <202105050843.1458hIF8056687@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: df53974dbc62 - stable/12 - Fix build post a0409676120c1e558d0ade943019934e0f15118d. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: df53974dbc62a50753a39ee34348304696242861 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:43:18 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=df53974dbc62a50753a39ee34348304696242861 commit df53974dbc62a50753a39ee34348304696242861 Author: Cy Schubert AuthorDate: 2021-03-22 15:42:18 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:43:03 +0000 Fix build post a0409676120c1e558d0ade943019934e0f15118d. (cherry picked from commit 048488c0c4e47aa2aac9709b18d7da14b06f78cd) --- contrib/libucl/src/ucl_msgpack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/libucl/src/ucl_msgpack.c b/contrib/libucl/src/ucl_msgpack.c index 3335e39cd9e7..08e690a4728a 100644 --- a/contrib/libucl/src/ucl_msgpack.c +++ b/contrib/libucl/src/ucl_msgpack.c @@ -1247,7 +1247,7 @@ ucl_msgpack_consume (struct ucl_parser *parser) if (len != 0) { ucl_create_err (&parser->err, "invalid non-empty container at the end; len=%zu", - (uintmax_t)len); + (size_t)len); return false; } From owner-dev-commits-src-all@freebsd.org Wed May 5 08:43:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7420A635E52; Wed, 5 May 2021 08:43:30 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqxG2c13z3Lbv; Wed, 5 May 2021 08:43:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4C67421F0B; Wed, 5 May 2021 08:43:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458hUfP056819; Wed, 5 May 2021 08:43:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458hUcZ056818; Wed, 5 May 2021 08:43:30 GMT (envelope-from git) Date: Wed, 5 May 2021 08:43:30 GMT Message-Id: <202105050843.1458hUcZ056818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 80b7a3d4af7a - stable/13 - Fix build post a0409676120c1e558d0ade943019934e0f15118d. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 80b7a3d4af7ade0d25457b7fdbd68f44d993b54a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:43:30 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=80b7a3d4af7ade0d25457b7fdbd68f44d993b54a commit 80b7a3d4af7ade0d25457b7fdbd68f44d993b54a Author: Cy Schubert AuthorDate: 2021-03-22 15:42:18 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-05 08:42:57 +0000 Fix build post a0409676120c1e558d0ade943019934e0f15118d. (cherry picked from commit 048488c0c4e47aa2aac9709b18d7da14b06f78cd) --- contrib/libucl/src/ucl_msgpack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/libucl/src/ucl_msgpack.c b/contrib/libucl/src/ucl_msgpack.c index 3335e39cd9e7..08e690a4728a 100644 --- a/contrib/libucl/src/ucl_msgpack.c +++ b/contrib/libucl/src/ucl_msgpack.c @@ -1247,7 +1247,7 @@ ucl_msgpack_consume (struct ucl_parser *parser) if (len != 0) { ucl_create_err (&parser->err, "invalid non-empty container at the end; len=%zu", - (uintmax_t)len); + (size_t)len); return false; } From owner-dev-commits-src-all@freebsd.org Wed May 5 10:08:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62D29638E97; Wed, 5 May 2021 10:08:22 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZsqB2NtTz3R0X; Wed, 5 May 2021 10:08:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 44F8922F7A; Wed, 5 May 2021 10:08:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145A8MGd063862; Wed, 5 May 2021 10:08:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145A8MVn063861; Wed, 5 May 2021 10:08:22 GMT (envelope-from git) Date: Wed, 5 May 2021 10:08:22 GMT Message-Id: <202105051008.145A8MVn063861@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: 5e09282e5e17 - stable/13 - Correct the link of external mirrors MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5e09282e5e1778d206ffbb4cfbd5912425dda256 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 10:08:22 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=5e09282e5e1778d206ffbb4cfbd5912425dda256 commit 5e09282e5e1778d206ffbb4cfbd5912425dda256 Author: Li-Wen Hsu AuthorDate: 2021-04-28 19:39:18 +0000 Commit: Li-Wen Hsu CommitDate: 2021-05-05 10:06:51 +0000 Correct the link of external mirrors Reported by: 0mp Fixes: 8ef03ce6db33 MFC after: 1 day (cherry picked from commit 164d49a5842dcd07823570eaa775e82ed10022d3) --- share/man/man7/development.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man7/development.7 b/share/man/man7/development.7 index 032161030f1f..f64f01f24d17 100644 --- a/share/man/man7/development.7 +++ b/share/man/man7/development.7 @@ -69,7 +69,7 @@ The push URL is: .Pp There is also a list of public, read-only Git mirrors at: .Pp -.Lk https://docs.FreeBSD.org/en/books/handbook/mirrors/#_external_mirrors +.Lk https://docs.freebsd.org/en/books/handbook/mirrors/#external-mirrors .Pp The .Ql main From owner-dev-commits-src-all@freebsd.org Wed May 5 10:33:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AEC056396C1; Wed, 5 May 2021 10:33:25 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZtN54d7Tz3hr4; Wed, 5 May 2021 10:33:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 91A682369D; Wed, 5 May 2021 10:33:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145AXPIC002779; Wed, 5 May 2021 10:33:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145AXPof002778; Wed, 5 May 2021 10:33:25 GMT (envelope-from git) Date: Wed, 5 May 2021 10:33:25 GMT Message-Id: <202105051033.145AXPof002778@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marko Zec Subject: git: a43104ebe763 - main - Revise FIB lookups per second benchmarking routines. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zec X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a43104ebe7630111d7e7debc56aacf49787dcf43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 10:33:25 -0000 The branch main has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=a43104ebe7630111d7e7debc56aacf49787dcf43 commit a43104ebe7630111d7e7debc56aacf49787dcf43 Author: Marko Zec AuthorDate: 2021-05-05 10:28:17 +0000 Commit: Marko Zec CommitDate: 2021-05-05 10:28:17 +0000 Revise FIB lookups per second benchmarking routines. Add a LPS benchmark variant which introduces artificial dependencies between successive lookups. While here, instead of writing the results from the lookups to a huge array, add them to an accumulator, in a more lightweight attempt at preventing the CPU's OOO machinery from discarding the lookup results if they would be completely unused. net.route.test.run_lps_rnd measures LPS throughput with independent uniformly random keys net.route.test.run_lps_seq measures LPS throughput with uniformly random keys with artificial interdependencies Reviewed by: melifaro MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D30096 --- sys/tests/fib_lookup/fib_lookup.c | 42 +++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/sys/tests/fib_lookup/fib_lookup.c b/sys/tests/fib_lookup/fib_lookup.c index ea07e3d697c6..4093ff9dd487 100644 --- a/sys/tests/fib_lookup/fib_lookup.c +++ b/sys/tests/fib_lookup/fib_lookup.c @@ -509,13 +509,13 @@ static int rnd_lps(SYSCTL_HANDLER_ARGS) { struct epoch_tracker et; - struct in_addr *keys; - struct nhop_object **nhops; - + struct in_addr key; struct timespec ts_pre, ts_post; uint64_t total_diff, lps; - int error; + uint32_t *keys; + uintptr_t acc = 0; int count = 0; + int error; error = sysctl_handle_int(oidp, &count, 0, req); if (error != 0) @@ -524,12 +524,8 @@ rnd_lps(SYSCTL_HANDLER_ARGS) return (0); keys = malloc(sizeof(*keys) * count, M_TEMP, M_NOWAIT); - nhops = malloc(sizeof(*nhops) * count, M_TEMP, M_NOWAIT); - if (keys == NULL || nhops == NULL) { - free(keys, M_TEMP); - free(nhops, M_TEMP); + if (keys == NULL) return (ENOMEM); - } printf("Preparing %d random keys...\n", count); arc4random_buf(keys, sizeof(*keys) * count); @@ -537,26 +533,42 @@ rnd_lps(SYSCTL_HANDLER_ARGS) NET_EPOCH_ENTER(et); nanouptime(&ts_pre); - for (int i = 0; i < count; i++) - nhops[i] = fib4_lookup(RT_DEFAULT_FIB, keys[i], 0, NHR_NONE, 0); + switch (arg2) { + case 0: + for (int i = 0; i < count; i++) { + key.s_addr = keys[i] + acc; + acc += (uintptr_t) fib4_lookup(RT_DEFAULT_FIB, key, 0, + NHR_NONE, 0); + } + case 1: + for (int i = 0; i < count; i++) { + key.s_addr = keys[i]; + acc += (uintptr_t) fib4_lookup(RT_DEFAULT_FIB, key, 0, + NHR_NONE, 0); + } + } nanouptime(&ts_post); NET_EPOCH_EXIT(et); free(keys, M_TEMP); - free(nhops, M_TEMP); total_diff = (ts_post.tv_sec - ts_pre.tv_sec) * 1000000000 + - (ts_post.tv_nsec - ts_pre.tv_nsec); + (ts_post.tv_nsec - ts_pre.tv_nsec) + (acc & 1); lps = 1000000000ULL * count / total_diff; printf("%d lookups in %zu nanoseconds, %lu.%06lu MLPS\n", count, total_diff, lps / 1000000, lps % 1000000); return (0); } -SYSCTL_PROC(_net_route_test, OID_AUTO, rnd_lps, +SYSCTL_PROC(_net_route_test, OID_AUTO, run_lps_seq, CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, rnd_lps, "I", - "Measure lookups per second using uniformly random keys"); + "Measure lookups per second, uniformly random keys, " + "artificial dependencies between lookups"); +SYSCTL_PROC(_net_route_test, OID_AUTO, run_lps_rnd, + CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + 0, 1, rnd_lps, "I", + "Measure lookups per second, uniformly random keys, independent lookups"); static int test_fib_lookup_modevent(module_t mod, int type, void *unused) From owner-dev-commits-src-all@freebsd.org Wed May 5 11:05:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82E7F639BFB; Wed, 5 May 2021 11:05:56 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZv5c3Gf7z3jdr; Wed, 5 May 2021 11:05:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 63A4623B1E; Wed, 5 May 2021 11:05:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145B5ujS043342; Wed, 5 May 2021 11:05:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145B5uTb043341; Wed, 5 May 2021 11:05:56 GMT (envelope-from git) Date: Wed, 5 May 2021 11:05:56 GMT Message-Id: <202105051105.145B5uTb043341@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 21b292072409 - stable/13 - sh(1): autocomplete commands MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 21b292072409f47f7413bc151bd4eb2b71d2c506 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 11:05:56 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=21b292072409f47f7413bc151bd4eb2b71d2c506 commit 21b292072409f47f7413bc151bd4eb2b71d2c506 Author: Piotr Pawel Stefaniak AuthorDate: 2021-03-28 09:58:20 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-05-05 11:04:57 +0000 sh(1): autocomplete commands (cherry picked from commit b315a7296d2a69883c483d79dfcb3860a0428f21) --- bin/sh/histedit.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++- bin/sh/myhistedit.h | 2 + lib/libedit/Makefile | 2 +- 3 files changed, 130 insertions(+), 2 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index e59967b255b1..ba2bec357181 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -39,6 +39,8 @@ static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95"; __FBSDID("$FreeBSD$"); #include +#include +#include #include #include #include @@ -72,6 +74,9 @@ static FILE *el_in, *el_out; static char *fc_replace(const char *, char *, char *); static int not_fcnumber(const char *); static int str_to_event(const char *, int); +static int comparator(const void *, const void *, void *); +static char **sh_matches(const char *, int, int); +static unsigned char sh_complete(EditLine *, int); /* * Set history and editing status. Called whenever the status may @@ -122,7 +127,7 @@ histedit(void) el_set(el, EL_PROMPT, getprompt); el_set(el, EL_ADDFN, "sh-complete", "Filename completion", - _el_fn_complete); + sh_complete); } else { bad: out2fmt_flush("sh: can't initialize editing\n"); @@ -521,3 +526,124 @@ bindcmd(int argc __unused, char **argv __unused) return (0); } #endif + +/* + * Comparator function for qsort(). The use of curpos here is to skip + * characters that we already know to compare equal (common prefix). + */ +static int +comparator(const void *a, const void *b, void *thunk) +{ + size_t curpos = (intptr_t)thunk; + return (strcmp(*(char *const *)a + curpos, + *(char *const *)b + curpos)); +} + +/* + * This function is passed to libedit's fn_complete2(). The library will + * use it instead of its standard function that finds matching files in + * current directory. If we're at the start of the line, we want to look + * for available commands from all paths in $PATH. + */ +static char +**sh_matches(const char *text, int start, int end) +{ + char *free_path = NULL, *path; + const char *dirname; + char **matches = NULL; + size_t i = 0, size = 16, j, k; + size_t curpos = end - start; + + if (start > 0 || memchr("/.~", text[0], 3) != NULL) + return (NULL); + if ((free_path = path = strdup(pathval())) == NULL) + goto out; + if ((matches = malloc(size * sizeof(matches[0]))) == NULL) + goto out; + while ((dirname = strsep(&path, ":")) != NULL) { + struct dirent *entry; + DIR *dir; + int dfd; + + dir = opendir(dirname[0] == '\0' ? "." : dirname); + if (dir == NULL) + continue; + if ((dfd = dirfd(dir)) == -1) { + closedir(dir); + continue; + } + while ((entry = readdir(dir)) != NULL) { + struct stat statb; + char **rmatches; + + if (strncmp(entry->d_name, text, curpos) != 0) + continue; + if (entry->d_type == DT_UNKNOWN || entry->d_type == DT_LNK) { + if (fstatat(dfd, entry->d_name, &statb, 0) == -1) + continue; + if (!S_ISREG(statb.st_mode)) + continue; + } else if (entry->d_type != DT_REG) + continue; + matches[++i] = strdup(entry->d_name); + if (i < size - 1) + continue; + size *= 2; + rmatches = reallocarray(matches, size, sizeof(matches[0])); + if (rmatches == NULL) { + closedir(dir); + goto out; + } + matches = rmatches; + } + closedir(dir); + } +out: + free(free_path); + /* + * matches[0] is special: it's not a real matching file name but a common + * prefix for all matching names. It can't be null, unlike any other + * element of the array. When strings matches[0] and matches[1] compare + * equal and matches[2] is null that means to libedit that there is only + * a single match. It will then replace user input with possibly escaped + * string in matches[0] which is the reason to copy the full name of the + * only match. + */ + if (i == 0) { + free(matches); + return (NULL); + } else if (i == 1) { + matches[0] = strdup(matches[1]); + matches[2] = NULL; + if (matches[0] != NULL) + return (matches); + } else + matches[0] = strdup(text); + if (matches[0] == NULL) { + for (j = 1; j <= i; j++) + free(matches[j]); + free(matches); + return (NULL); + } + qsort_s(matches + 1, i, sizeof(matches[0]), comparator, + (void *)(intptr_t)curpos); + for (j = 1, k = 2; k <= i; k++) + if (strcmp(matches[j] + curpos, matches[k] + curpos) == 0) + free(matches[k]); + else + matches[++j] = matches[k]; + matches[j + 1] = NULL; + return (matches); +} + +/* + * This is passed to el_set(el, EL_ADDFN, ...) so that it's possible to + * bind a key (tab by default) to execute the function. + */ +unsigned char +sh_complete(EditLine *sel, int ch __unused) +{ + return (unsigned char)fn_complete2(sel, NULL, sh_matches, + L" \t\n\"\\'`@$><=;|&{(", NULL, NULL, (size_t)100, + NULL, &((int) {0}), NULL, NULL, FN_QUOTE_MATCH); +} diff --git a/bin/sh/myhistedit.h b/bin/sh/myhistedit.h index a4c0b56fafd7..968d23c9c1f8 100644 --- a/bin/sh/myhistedit.h +++ b/bin/sh/myhistedit.h @@ -38,6 +38,8 @@ extern History *hist; extern EditLine *el; extern int displayhist; +#include + void histedit(void); void sethistsize(const char *); void setterm(const char *); diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile index 963063ef90fa..e549ac15c000 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -65,7 +65,7 @@ MLINKS= \ editline.3 tok_wreset.3 \ editline.3 tok_wstr.3 -INCS= histedit.h +INCS= histedit.h filecomplete.h SRCS+= common.h emacs.h fcns.h func.h help.h vi.h CLEANFILES+= common.h emacs.h fcns.h func.h help.h vi.h From owner-dev-commits-src-all@freebsd.org Wed May 5 11:05:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFDE563A280; Wed, 5 May 2021 11:05:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZv5d4lcdz3jdt; Wed, 5 May 2021 11:05:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8358923E01; Wed, 5 May 2021 11:05:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145B5v1b043364; Wed, 5 May 2021 11:05:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145B5vs4043363; Wed, 5 May 2021 11:05:57 GMT (envelope-from git) Date: Wed, 5 May 2021 11:05:57 GMT Message-Id: <202105051105.145B5vs4043363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: bee62aa5a69f - stable/13 - sh: silence sanitizer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bee62aa5a69f808bf7503e6d5d9ff375240511a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 11:05:57 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=bee62aa5a69f808bf7503e6d5d9ff375240511a2 commit bee62aa5a69f808bf7503e6d5d9ff375240511a2 Author: Piotr Pawel Stefaniak AuthorDate: 2021-04-01 05:31:03 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-05-05 11:04:58 +0000 sh: silence sanitizer (cherry picked from commit 5a18515b3143792135881ce64e2380115c4744c1) --- bin/sh/memalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/sh/memalloc.c b/bin/sh/memalloc.c index a2191771386d..7ea31af050e5 100644 --- a/bin/sh/memalloc.c +++ b/bin/sh/memalloc.c @@ -227,7 +227,10 @@ popstackmark(struct stackmark *mark) } stacknxt = mark->stacknxt; stacknleft = mark->stacknleft; - sstrend = stacknxt + stacknleft; + if (stacknleft != 0) + sstrend = stacknxt + stacknleft; + else + sstrend = stacknxt; INTON; } From owner-dev-commits-src-all@freebsd.org Wed May 5 11:05:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BAE663A252; Wed, 5 May 2021 11:05:59 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZv5f6FmVz3jwf; Wed, 5 May 2021 11:05:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A8D7823BAE; Wed, 5 May 2021 11:05:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145B5wf9043393; Wed, 5 May 2021 11:05:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145B5wMQ043392; Wed, 5 May 2021 11:05:58 GMT (envelope-from git) Date: Wed, 5 May 2021 11:05:58 GMT Message-Id: <202105051105.145B5wMQ043392@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 2556ee3a27af - stable/13 - sh: fix debug build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2556ee3a27afa3a8688ed0ef5daaaa9360738f54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 11:05:59 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=2556ee3a27afa3a8688ed0ef5daaaa9360738f54 commit 2556ee3a27afa3a8688ed0ef5daaaa9360738f54 Author: Piotr Pawel Stefaniak AuthorDate: 2021-04-11 07:09:28 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-05-05 11:04:58 +0000 sh: fix debug build (cherry picked from commit 1a4e959eb34ae03a96f6d0dea68b6a6a88ac4462) --- bin/sh/show.c | 7 +++---- bin/sh/show.h | 2 ++ bin/sh/trap.c | 4 ---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/bin/sh/show.c b/bin/sh/show.c index 04dc123381af..01035d76093d 100644 --- a/bin/sh/show.c +++ b/bin/sh/show.c @@ -73,7 +73,7 @@ static void shtree(union node *n, int ind, char *pfx, FILE *fp) { struct nodelist *lp; - char *s; + const char *s; if (n == NULL) return; @@ -125,7 +125,7 @@ shcmd(union node *cmd, FILE *fp) { union node *np; int first; - char *s; + const char *s; int dftfd; first = 1; @@ -274,8 +274,7 @@ indent(int amount, char *pfx, FILE *fp) */ -FILE *tracefile; - +static FILE *tracefile; #if DEBUG >= 2 int debug = 1; #else diff --git a/bin/sh/show.h b/bin/sh/show.h index 1dbdaa152b33..790a62e2942c 100644 --- a/bin/sh/show.h +++ b/bin/sh/show.h @@ -39,4 +39,6 @@ void trargs(char **); void trputc(int); void trputs(const char *); void opentrace(void); + +extern int debug; #endif diff --git a/bin/sh/trap.c b/bin/sh/trap.c index d7a98604c22c..d7ef40274270 100644 --- a/bin/sh/trap.c +++ b/bin/sh/trap.c @@ -274,12 +274,8 @@ setsignal(int signo) break; case SIGQUIT: #ifdef DEBUG - { - extern int debug; - if (debug) break; - } #endif action = S_CATCH; break; From owner-dev-commits-src-all@freebsd.org Wed May 5 11:06:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 088DA639DB7; Wed, 5 May 2021 11:06:00 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZv5g6KXFz3jcS; Wed, 5 May 2021 11:05:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C966123968; Wed, 5 May 2021 11:05:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145B5xaO043416; Wed, 5 May 2021 11:05:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145B5xOa043415; Wed, 5 May 2021 11:05:59 GMT (envelope-from git) Date: Wed, 5 May 2021 11:05:59 GMT Message-Id: <202105051105.145B5xOa043415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 6ac7b0221f45 - stable/13 - Balance parentheses in sysctl descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6ac7b0221f458286add911e49c8bbb63946693c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 11:06:00 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=6ac7b0221f458286add911e49c8bbb63946693c2 commit 6ac7b0221f458286add911e49c8bbb63946693c2 Author: Piotr Pawel Stefaniak AuthorDate: 2021-04-11 08:29:34 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-05-05 11:04:58 +0000 Balance parentheses in sysctl descriptions (cherry picked from commit a212f56d10d04508849cd817d2c595dd61107890) --- sys/amd64/amd64/trap.c | 2 +- sys/kern/kern_timeout.c | 2 +- sys/x86/x86/cpu_machdep.c | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 01519d9a7c16..4ce31ce47a45 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1135,7 +1135,7 @@ SYSCTL_PROC(_machdep, OID_AUTO, syscall_ret_flush_l1d, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, machdep_syscall_ret_flush_l1d, "I", "Flush L1D on syscall return with error (0 - off, 1 - on, " - "2 - use hw only, 3 - use sw only"); + "2 - use hw only, 3 - use sw only)"); /* * System call handler for native binaries. The trap frame is already diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 5bb948610da1..cc1521adf151 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -119,7 +119,7 @@ static int pin_pcpu_swi = 0; SYSCTL_INT(_kern, OID_AUTO, pin_default_swi, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &pin_default_swi, 0, "Pin the default (non-per-cpu) swi (shared with PCPU 0 swi)"); SYSCTL_INT(_kern, OID_AUTO, pin_pcpu_swi, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &pin_pcpu_swi, - 0, "Pin the per-CPU swis (except PCPU 0, which is also default"); + 0, "Pin the per-CPU swis (except PCPU 0, which is also default)"); /* * TODO: diff --git a/sys/x86/x86/cpu_machdep.c b/sys/x86/x86/cpu_machdep.c index 4798f913d5b2..77ae7b360a25 100644 --- a/sys/x86/x86/cpu_machdep.c +++ b/sys/x86/x86/cpu_machdep.c @@ -966,12 +966,12 @@ hw_ssb_disable_handler(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_hw, OID_AUTO, spec_store_bypass_disable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ssb_disable_handler, "I", - "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto"); + "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto)"); SYSCTL_PROC(_machdep_mitigations_ssb, OID_AUTO, disable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ssb_disable_handler, "I", - "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto"); + "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto)"); int hw_mds_disable; @@ -1185,13 +1185,13 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, sysctl_mds_disable_handler, "I", "Microarchitectural Data Sampling Mitigation " - "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO"); + "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO)"); SYSCTL_PROC(_machdep_mitigations_mds, OID_AUTO, disable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, sysctl_mds_disable_handler, "I", "Microarchitectural Data Sampling Mitigation " - "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO"); + "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO)"); /* * Intel Transactional Memory Asynchronous Abort Mitigation @@ -1330,7 +1330,7 @@ SYSCTL_PROC(_machdep_mitigations_taa, OID_AUTO, enable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, sysctl_taa_handler, "I", "TAA Mitigation enablement control " - "(0 - off, 1 - disable TSX, 2 - VERW, 3 - on AUTO"); + "(0 - off, 1 - disable TSX, 2 - VERW, 3 - on AUTO)"); static int sysctl_taa_state_handler(SYSCTL_HANDLER_ARGS) @@ -1403,7 +1403,7 @@ SYSCTL_PROC(_machdep_mitigations_rngds, OID_AUTO, enable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, sysctl_rngds_mitg_enable_handler, "I", "MCU Optimization, disabling RDSEED mitigation control " - "(0 - mitigation disabled (RDSEED optimized), 1 - mitigation enabled"); + "(0 - mitigation disabled (RDSEED optimized), 1 - mitigation enabled)"); static int sysctl_rngds_state_handler(SYSCTL_HANDLER_ARGS) From owner-dev-commits-src-all@freebsd.org Wed May 5 11:06:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 943B063A260; Wed, 5 May 2021 11:06:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZv5j16MCz3k2P; Wed, 5 May 2021 11:06:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EB28223D8D; Wed, 5 May 2021 11:06:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145B60La043437; Wed, 5 May 2021 11:06:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145B60Bc043436; Wed, 5 May 2021 11:06:00 GMT (envelope-from git) Date: Wed, 5 May 2021 11:06:00 GMT Message-Id: <202105051106.145B60Bc043436@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: c69775749f2b - stable/13 - getdirentries.2: remove unnecessary space MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c69775749f2b1f59c56224eee074c9da84778e6c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 11:06:01 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=c69775749f2b1f59c56224eee074c9da84778e6c commit c69775749f2b1f59c56224eee074c9da84778e6c Author: Piotr Pawel Stefaniak AuthorDate: 2021-04-11 09:17:01 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-05-05 11:04:58 +0000 getdirentries.2: remove unnecessary space (cherry picked from commit 1fdd6934d596b0259096d0c310e97a9c4ebf6b6b) --- lib/libc/sys/getdirentries.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2 index 658be9459af5..4185fb84f0f9 100644 --- a/lib/libc/sys/getdirentries.2 +++ b/lib/libc/sys/getdirentries.2 @@ -132,7 +132,7 @@ the end of the directory has been reached. .Pp If the .Fa basep -pointer value is non-NULL , +pointer value is non-NULL, the .Fn getdirentries system call writes the position of the block read into the location pointed to by From owner-dev-commits-src-all@freebsd.org Wed May 5 11:48:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4720963B776; Wed, 5 May 2021 11:48:13 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZw2P1Zt0z3lvr; Wed, 5 May 2021 11:48:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2911A2460D; Wed, 5 May 2021 11:48:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145BmDPW098047; Wed, 5 May 2021 11:48:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145BmDJd098044; Wed, 5 May 2021 11:48:13 GMT (envelope-from git) Date: Wed, 5 May 2021 11:48:13 GMT Message-Id: <202105051148.145BmDJd098044@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marko Zec Subject: git: 2aca58e16f50 - main - Introduce DXR as an IPv4 longest prefix matching / FIB module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zec X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2aca58e16f507bfcad127a0865a9d5c75c5eedc3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 11:48:13 -0000 The branch main has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=2aca58e16f507bfcad127a0865a9d5c75c5eedc3 commit 2aca58e16f507bfcad127a0865a9d5c75c5eedc3 Author: Marko Zec AuthorDate: 2021-05-05 11:45:52 +0000 Commit: Marko Zec CommitDate: 2021-05-05 11:45:52 +0000 Introduce DXR as an IPv4 longest prefix matching / FIB module DXR maintains compressed lookup structures with a trivial search procedure. A two-stage trie is indexed by the more significant bits of the search key (IPv4 address), while the remaining bits are used for finding the next hop in a sorted array. The tradeoff between memory footprint and search speed depends on the split between the trie and the remaining binary search. The default of 20 bits of the key being used for trie indexing yields good performance (see below) with footprints of around 2.5 Bytes per prefix with current BGP snapshots. Rebuilding lookup structures takes some time, which is compensated for by batching several RIB change requests into a single FIB update, i.e. FIB synchronization with the RIB may be delayed for a fraction of a second. RIB to FIB synchronization, next-hop table housekeeping, and lockless lookup capability is provided by the FIB_ALGO infrastructure. DXR works well on modern CPUs with several MBytes of caches, especially in VMs, where is outperforms other currently available IPv4 FIB algorithms by a large margin. Synthetic single-thread LPM throughput test method: kldload test_lookup; kldload dpdk_lpm4; kldload fib_dxr sysctl net.route.test.run_lps_rnd=N sysctl net.route.test.run_lps_seq=N where N is the number of randomly generated keys (IPv4 addresses) which should be chosen so that each test iteration runs for several seconds. Each reported score represents the best of three runs, in million lookups per second (MLPS), for two bechmarks (RND & SEQ) with two FIBs: host: single interface address, local subnet route + default route BGP: snapshot from linx.routeviews.org, 887957 prefixes, 496 next hops Bhyve VM on an Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60 GHz: inet.algo host, RND host, SEQ BGP, RND BGP, SEQ bsearch4 40.6 20.2 N/A N/A radix4 7.8 3.8 1.2 0.6 radix4_lockless 18.0 9.0 1.6 0.8 dpdk_lpm4 14.4 5.0 14.6 5.0 dxr 70.3 34.7 43.0 19.5 Intel(R) Core(TM) i5-5300U CPU @ 2.30 GHz: inet.algo host, RND host, SEQ BGP, RND BGP, SEQ bsearch4 47.0 23.1 N/A N/A radix4 8.5 4.2 1.9 1.0 radix4_lockless 19.2 9.5 2.5 1.2 dpdk_lpm4 31.2 9.4 31.6 9.3 dxr 84.9 41.4 51.7 23.6 Intel(R) Core(TM) i7-4771 CPU @ 3.50 GHz: inet.algo host, RND host, SEQ BGP, RND BGP, SEQ bsearch4 59.5 29.4 N/A N/A radix4 10.8 5.5 2.5 1.3 radix4_lockless 24.7 12.0 3.1 1.6 dpdk_lpm4 29.1 9.0 30.2 9.1 dxr 101.3 49.9 69.8 32.5 AMD Ryzen 7 3700X 8-Core Processor @ 3.60 GHz: inet.algo host, RND host, SEQ BGP, RND BGP, SEQ bsearch4 70.8 35.4 N/A N/A radix4 14.4 7.2 2.8 1.4 radix4_lockless 30.2 15.1 3.7 1.8 dpdk_lpm4 29.9 9.0 30.0 8.9 dxr 163.3 81.5 99.5 44.4 AMD Ryzen 5 5600X 6-Core Processor @ 3.70 GHz: inet.algo host, RND host, SEQ BGP, RND BGP, SEQ bsearch4 93.6 46.7 N/A N/A radix4 18.9 9.3 4.3 2.1 radix4_lockless 37.2 18.6 5.3 2.7 dpdk_lpm4 51.8 15.1 51.6 14.9 dxr 218.2 103.3 114.0 49.0 Reviewed by: melifaro MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29821 --- sys/modules/Makefile | 2 + sys/modules/fib_dxr/Makefile | 11 + sys/netinet/in_fib_dxr.c | 1253 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1266 insertions(+) diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 799cb947491f..9d5b84ccf58f 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -120,6 +120,7 @@ SUBDIR= \ fdc \ fdescfs \ ${_ffec} \ + ${_fib_dxr} \ filemon \ firewire \ firmware \ @@ -474,6 +475,7 @@ _ipfilter= ipfilter .if ${MK_INET_SUPPORT} != "no" && ${KERN_OPTS:MFIB_ALGO} _dpdk_lpm4= dpdk_lpm4 +_fib_dxr= fib_dxr .endif .if ${MK_INET6_SUPPORT} != "no" && ${KERN_OPTS:MFIB_ALGO} diff --git a/sys/modules/fib_dxr/Makefile b/sys/modules/fib_dxr/Makefile new file mode 100644 index 000000000000..c1a704beb535 --- /dev/null +++ b/sys/modules/fib_dxr/Makefile @@ -0,0 +1,11 @@ +# $FreeBSD$ + +SYSDIR?=${SRCTOP}/sys +.include "${SYSDIR}/conf/kern.opts.mk" + +.PATH: ${SYSDIR}/netinet + +KMOD= fib_dxr +SRCS= in_fib_dxr.c opt_inet.h + +.include diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c new file mode 100644 index 000000000000..ec32819a5a6d --- /dev/null +++ b/sys/netinet/in_fib_dxr.c @@ -0,0 +1,1253 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2012-2021 Marko Zec + * Copyright (c) 2005, 2018 University of Zagreb + * Copyright (c) 2005 International Computer Science Institute + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * An implementation of DXR, a simple IPv4 LPM scheme with compact lookup + * structures and a trivial search procedure. More significant bits of + * the search key are used to directly index a two-stage trie, while the + * remaining bits are used for finding the next hop in a sorted array. + * More details in: + * + * M. Zec, L. Rizzo, M. Mikuc, DXR: towards a billion routing lookups per + * second in software, ACM SIGCOMM Computer Communication Review, September + * 2012 + * + * M. Zec, M. Mikuc, Pushing the envelope: beyond two billion IP routing + * lookups per second on commodity CPUs, IEEE SoftCOM, September 2017, Split + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_inet.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include + +#define DXR_TRIE_BITS 20 + +CTASSERT(DXR_TRIE_BITS >= 16 && DXR_TRIE_BITS <= 24); + +/* DXR2: two-stage primary trie, instead of a single direct lookup table */ +#define DXR2 + +#if DXR_TRIE_BITS > 16 +#define DXR_D 16 +#else +#define DXR_D (DXR_TRIE_BITS - 1) +#endif +#define DXR_X (DXR_TRIE_BITS - DXR_D) + +#define D_TBL_SIZE (1 << DXR_D) +#define DIRECT_TBL_SIZE (1 << DXR_TRIE_BITS) +#define DXR_RANGE_MASK (0xffffffffU >> DXR_TRIE_BITS) +#define DXR_RANGE_SHIFT (32 - DXR_TRIE_BITS) + +#define DESC_BASE_BITS 22 +#define DESC_FRAGMENTS_BITS (32 - DESC_BASE_BITS) +#define BASE_MAX ((1 << DESC_BASE_BITS) - 1) +#define RTBL_SIZE_INCR (BASE_MAX / 64) + +#if DXR_TRIE_BITS < 24 +#define FRAGS_MASK_SHORT ((1 << (23 - DXR_TRIE_BITS)) - 1) +#else +#define FRAGS_MASK_SHORT 0 +#endif +#define FRAGS_PREF_SHORT (((1 << DESC_FRAGMENTS_BITS) - 1) & \ + ~FRAGS_MASK_SHORT) +#define FRAGS_MARK_XL (FRAGS_PREF_SHORT - 1) +#define FRAGS_MARK_HIT (FRAGS_PREF_SHORT - 2) + +#define IS_SHORT_FORMAT(x) ((x & FRAGS_PREF_SHORT) == FRAGS_PREF_SHORT) +#define IS_LONG_FORMAT(x) ((x & FRAGS_PREF_SHORT) != FRAGS_PREF_SHORT) +#define IS_XL_FORMAT(x) (x == FRAGS_MARK_XL) + +#define RE_SHORT_MAX_NH ((1 << (DXR_TRIE_BITS - 8)) - 1) + +#define CHUNK_HASH_BITS 16 +#define CHUNK_HASH_SIZE (1 << CHUNK_HASH_BITS) +#define CHUNK_HASH_MASK (CHUNK_HASH_SIZE - 1) + +#define TRIE_HASH_BITS 16 +#define TRIE_HASH_SIZE (1 << TRIE_HASH_BITS) +#define TRIE_HASH_MASK (TRIE_HASH_SIZE - 1) + +#define XTBL_SIZE_INCR (DIRECT_TBL_SIZE / 16) + +/* Lookup structure elements */ + +struct direct_entry { + uint32_t fragments: DESC_FRAGMENTS_BITS, + base: DESC_BASE_BITS; +}; + +struct range_entry_long { + uint32_t start: DXR_RANGE_SHIFT, + nexthop: DXR_TRIE_BITS; +}; + +#if DXR_TRIE_BITS < 24 +struct range_entry_short { + uint16_t start: DXR_RANGE_SHIFT - 8, + nexthop: DXR_TRIE_BITS - 8; +}; +#endif + +/* Auxiliary structures */ + +struct heap_entry { + uint32_t start; + uint32_t end; + uint32_t preflen; + uint32_t nexthop; +}; + +struct chunk_desc { + LIST_ENTRY(chunk_desc) cd_all_le; + LIST_ENTRY(chunk_desc) cd_hash_le; + uint32_t cd_hash; + uint32_t cd_refcnt; + uint32_t cd_base; + uint32_t cd_cur_size; + uint32_t cd_max_size; +}; + +struct trie_desc { + LIST_ENTRY(trie_desc) td_all_le; + LIST_ENTRY(trie_desc) td_hash_le; + uint32_t td_hash; + uint32_t td_index; + uint32_t td_refcnt; +}; + +struct dxr_aux { + /* Glue to external state */ + struct fib_data *fd; + uint32_t fibnum; + int refcnt; + + /* Auxiliary build-time tables */ + struct direct_entry direct_tbl[DIRECT_TBL_SIZE]; + uint16_t d_tbl[D_TBL_SIZE]; + struct direct_entry *x_tbl; + union { + struct range_entry_long re; + uint32_t fragments; + } *range_tbl; + + /* Auxiliary internal state */ + uint32_t updates_mask[DIRECT_TBL_SIZE / 32]; + struct trie_desc *trietbl[D_TBL_SIZE]; + LIST_HEAD(, chunk_desc) chunk_hashtbl[CHUNK_HASH_SIZE]; + LIST_HEAD(, chunk_desc) all_chunks; + LIST_HEAD(, chunk_desc) unused_chunks; /* abuses hash link entry */ + LIST_HEAD(, trie_desc) trie_hashtbl[TRIE_HASH_SIZE]; + LIST_HEAD(, trie_desc) all_trie; + LIST_HEAD(, trie_desc) unused_trie; /* abuses hash link entry */ + struct sockaddr_in dst; + struct sockaddr_in mask; + struct heap_entry heap[33]; + uint32_t prefixes; + uint32_t updates_low; + uint32_t updates_high; + uint32_t all_chunks_cnt; + uint32_t unused_chunks_cnt; + uint32_t xtbl_size; + uint32_t all_trie_cnt; + uint32_t unused_trie_cnt; + uint32_t trie_rebuilt_prefixes; + uint32_t heap_index; + uint32_t d_bits; + uint32_t rtbl_size; + uint32_t rtbl_top; + uint32_t rtbl_work_frags; + uint32_t work_chunk; +}; + +/* Main lookup structure container */ + +struct dxr { + /* Lookup tables */ + uint16_t d_shift; + uint16_t x_shift; + uint32_t x_mask; + void *d; + void *x; + void *r; + struct nhop_object **nh_tbl; + + /* Glue to external state */ + struct dxr_aux *aux; + struct fib_data *fd; + struct epoch_context epoch_ctx; + uint32_t fibnum; +}; + +static MALLOC_DEFINE(M_DXRLPM, "dxr", "DXR LPM"); +static MALLOC_DEFINE(M_DXRAUX, "dxr aux", "DXR auxiliary"); + +uma_zone_t chunk_zone; +uma_zone_t trie_zone; + +SYSCTL_DECL(_net_route_algo); +SYSCTL_NODE(_net_route_algo, OID_AUTO, dxr, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "DXR tunables"); + +VNET_DEFINE_STATIC(int, max_trie_holes) = 8; +#define V_max_trie_holes VNET(max_trie_holes) +SYSCTL_INT(_net_route_algo_dxr, OID_AUTO, max_trie_holes, + CTLFLAG_RW | CTLFLAG_VNET, &VNET_NAME(max_trie_holes), 0, + "Trie fragmentation threshold before triggering a full rebuild"); + +VNET_DEFINE_STATIC(int, max_range_holes) = 16; +#define V_max_range_holes VNET(max_range_holes) +SYSCTL_INT(_net_route_algo_dxr, OID_AUTO, max_range_holes, + CTLFLAG_RW | CTLFLAG_VNET, &VNET_NAME(max_range_holes), 0, + "Range table fragmentation threshold before triggering a full rebuild"); + +/* Binary search for a matching address range */ +#define DXR_LOOKUP_STAGE \ + if (masked_dst < range[middle].start) { \ + upperbound = middle; \ + middle = (middle + lowerbound) / 2; \ + } else if (masked_dst < range[middle + 1].start) \ + return (range[middle].nexthop); \ + else { \ + lowerbound = middle + 1; \ + middle = (upperbound + middle + 1) / 2; \ + } \ + if (upperbound == lowerbound) \ + return (range[lowerbound].nexthop); + +static int +dxr_lookup(struct dxr *dxr, uint32_t dst) +{ +#ifdef DXR2 + uint16_t *dt = dxr->d; + struct direct_entry *xt = dxr->x; + int xi; +#else + struct direct_entry *dt = dxr->d; +#endif + struct direct_entry de; + struct range_entry_long *rt; + uint32_t base; + uint32_t upperbound; + uint32_t middle; + uint32_t lowerbound; + uint32_t masked_dst; + +#ifdef DXR2 + xi = (dt[dst >> dxr->d_shift] << dxr->x_shift) + + ((dst >> DXR_RANGE_SHIFT) & dxr->x_mask); + de = xt[xi]; +#else + de = dt[dst >> DXR_RANGE_SHIFT]; +#endif + + if (__predict_true(de.fragments == FRAGS_MARK_HIT)) + return (de.base); + + rt = dxr->r; + base = de.base; + lowerbound = 0; + masked_dst = dst & DXR_RANGE_MASK; + +#if DXR_TRIE_BITS < 24 + if (__predict_true(IS_SHORT_FORMAT(de.fragments))) { + upperbound = de.fragments & FRAGS_MASK_SHORT; + struct range_entry_short *range = + (struct range_entry_short *) &rt[base]; + + masked_dst >>= 8; + middle = upperbound; + upperbound = upperbound * 2 + 1; + + for (;;) { + DXR_LOOKUP_STAGE + DXR_LOOKUP_STAGE + } + } +#endif + + upperbound = de.fragments; + middle = upperbound / 2; + struct range_entry_long *range = &rt[base]; + if (__predict_false(IS_XL_FORMAT(de.fragments))) { + upperbound = *((uint32_t *) range); + range++; + middle = upperbound / 2; + } + + for (;;) { + DXR_LOOKUP_STAGE + DXR_LOOKUP_STAGE + } +} + +static void +initheap(struct dxr_aux *da, uint32_t dst_u32, uint32_t chunk) +{ + struct heap_entry *fhp = &da->heap[0]; + struct rtentry *rt; + struct route_nhop_data rnd; + + da->heap_index = 0; + da->dst.sin_addr.s_addr = htonl(dst_u32); + rt = fib4_lookup_rt(da->fibnum, da->dst.sin_addr, 0, NHR_UNLOCKED, + &rnd); + if (rt != NULL) { + struct in_addr addr; + uint32_t scopeid; + + rt_get_inet_prefix_plen(rt, &addr, &fhp->preflen, &scopeid); + fhp->start = ntohl(addr.s_addr); + fhp->end = fhp->start; + if (fhp->preflen < 32) + fhp->end |= (0xffffffffU >> fhp->preflen); + fhp->nexthop = fib_get_nhop_idx(da->fd, rnd.rnd_nhop); + } else { + fhp->preflen = fhp->nexthop = fhp->start = 0; + fhp->end = 0xffffffffU; + } +} + +static uint32_t +chunk_size(struct dxr_aux *da, struct direct_entry *fdesc) +{ + + if (IS_SHORT_FORMAT(fdesc->fragments)) + return ((fdesc->fragments & FRAGS_MASK_SHORT) + 1); + else if (IS_XL_FORMAT(fdesc->fragments)) + return (da->range_tbl[fdesc->base].fragments + 2); + else /* if (IS_LONG_FORMAT(fdesc->fragments)) */ + return (fdesc->fragments + 1); +} + +static uint32_t +chunk_hash(struct dxr_aux *da, struct direct_entry *fdesc) +{ + uint32_t size = chunk_size(da, fdesc); + uint32_t *p = (uint32_t *) &da->range_tbl[fdesc->base]; + uint32_t *l = (uint32_t *) &da->range_tbl[fdesc->base + size]; + uint32_t hash = fdesc->fragments; + + for (; p < l; p++) + hash = (hash << 7) + (hash >> 13) + *p; + + return (hash + (hash >> 16)); +} + +static int +chunk_ref(struct dxr_aux *da, uint32_t chunk) +{ + struct direct_entry *fdesc = &da->direct_tbl[chunk]; + struct chunk_desc *cdp, *empty_cdp; + uint32_t base = fdesc->base; + uint32_t size = chunk_size(da, fdesc); + uint32_t hash = chunk_hash(da, fdesc); + + /* Find an existing descriptor */ + LIST_FOREACH(cdp, &da->chunk_hashtbl[hash & CHUNK_HASH_MASK], + cd_hash_le) { + if (cdp->cd_hash != hash || cdp->cd_cur_size != size || + memcmp(&da->range_tbl[base], &da->range_tbl[cdp->cd_base], + sizeof(struct range_entry_long) * size)) + continue; + da->rtbl_top = fdesc->base; + fdesc->base = cdp->cd_base; + cdp->cd_refcnt++; + return (0); + } + + /* No matching chunks found. Recycle an empty or allocate a new one */ + cdp = NULL; + LIST_FOREACH(empty_cdp, &da->unused_chunks, cd_hash_le) + if (empty_cdp->cd_max_size >= size && (cdp == NULL || + empty_cdp->cd_max_size < cdp->cd_max_size)) { + cdp = empty_cdp; + if (empty_cdp->cd_max_size == size) + break; + } + + if (cdp != NULL) { + /* Copy from heap into the recycled chunk */ + bcopy(&da->range_tbl[fdesc->base], &da->range_tbl[cdp->cd_base], + size * sizeof(struct range_entry_long)); + fdesc->base = cdp->cd_base; + da->rtbl_top -= size; + da->unused_chunks_cnt--; + if (cdp->cd_max_size > size + 1) { + /* Split the range in two, need a new descriptor */ + empty_cdp = uma_zalloc(chunk_zone, M_NOWAIT); + if (empty_cdp == NULL) + return (1); + empty_cdp->cd_max_size = cdp->cd_max_size - size; + empty_cdp->cd_base = cdp->cd_base + size; + LIST_INSERT_AFTER(cdp, empty_cdp, cd_all_le); + LIST_INSERT_AFTER(cdp, empty_cdp, cd_hash_le); + da->all_chunks_cnt++; + da->unused_chunks_cnt++; + cdp->cd_max_size = size; + } + LIST_REMOVE(cdp, cd_hash_le); + } else { + /* Alloc a new descriptor */ + cdp = uma_zalloc(chunk_zone, M_NOWAIT); + if (cdp == NULL) + return (1); + cdp->cd_max_size = size; + cdp->cd_base = fdesc->base; + LIST_INSERT_HEAD(&da->all_chunks, cdp, cd_all_le); + da->all_chunks_cnt++; + } + + cdp->cd_hash = hash; + cdp->cd_refcnt = 1; + cdp->cd_cur_size = size; + LIST_INSERT_HEAD(&da->chunk_hashtbl[hash & CHUNK_HASH_MASK], cdp, + cd_hash_le); + if (da->rtbl_top >= da->rtbl_size) { + if (da->rtbl_top >= BASE_MAX) { + FIB_PRINTF(LOG_ERR, da->fd, + "structural limit exceeded at %d " + "range table elements", da->rtbl_top); + return (1); + } + da->rtbl_size += RTBL_SIZE_INCR; + if (da->rtbl_top >= BASE_MAX / 4) + FIB_PRINTF(LOG_WARNING, da->fd, "range table at %d%%", + da->rtbl_top * 100 / BASE_MAX); + da->range_tbl = realloc(da->range_tbl, + sizeof(*da->range_tbl) * da->rtbl_size + FRAGS_PREF_SHORT, + M_DXRAUX, M_NOWAIT); + if (da->range_tbl == NULL) + return (1); + } + + return (0); +} + +static void +chunk_unref(struct dxr_aux *da, uint32_t chunk) +{ + struct direct_entry *fdesc = &da->direct_tbl[chunk]; + struct chunk_desc *cdp; + uint32_t base = fdesc->base; + uint32_t size = chunk_size(da, fdesc); + uint32_t hash = chunk_hash(da, fdesc); + + /* Find an existing descriptor */ + LIST_FOREACH(cdp, &da->chunk_hashtbl[hash & CHUNK_HASH_MASK], + cd_hash_le) + if (cdp->cd_hash == hash && cdp->cd_cur_size == size && + memcmp(&da->range_tbl[base], &da->range_tbl[cdp->cd_base], + sizeof(struct range_entry_long) * size) == 0) + break; + + KASSERT(cdp != NULL, ("dxr: dangling chunk")); + if (--cdp->cd_refcnt > 0) + return; + + LIST_REMOVE(cdp, cd_hash_le); + da->unused_chunks_cnt++; + if (cdp->cd_base + cdp->cd_max_size != da->rtbl_top) { + LIST_INSERT_HEAD(&da->unused_chunks, cdp, cd_hash_le); + return; + } + + do { + da->all_chunks_cnt--; + da->unused_chunks_cnt--; + da->rtbl_top -= cdp->cd_max_size; + LIST_REMOVE(cdp, cd_all_le); + uma_zfree(chunk_zone, cdp); + LIST_FOREACH(cdp, &da->unused_chunks, cd_hash_le) + if (cdp->cd_base + cdp->cd_max_size == da->rtbl_top) { + LIST_REMOVE(cdp, cd_hash_le); + break; + } + } while (cdp != NULL); +} + +#ifdef DXR2 +static uint32_t +trie_hash(struct dxr_aux *da, uint32_t dxr_x, uint32_t index) +{ + uint32_t i, *val; + uint32_t hash = 0; + + for (i = 0; i < (1 << dxr_x); i++) { + hash = (hash << 3) ^ (hash >> 3); + val = (uint32_t *) + (void *) &da->direct_tbl[(index << dxr_x) + i]; + hash += (*val << 5); + hash += (*val >> 5); + } + + return (hash + (hash >> 16)); +} + +static int +trie_ref(struct dxr_aux *da, uint32_t index) +{ + struct trie_desc *tp; + uint32_t dxr_d = da->d_bits; + uint32_t dxr_x = DXR_TRIE_BITS - dxr_d; + uint32_t hash = trie_hash(da, dxr_x, index); + + /* Find an existing descriptor */ + LIST_FOREACH(tp, &da->trie_hashtbl[hash & TRIE_HASH_MASK], td_hash_le) + if (tp->td_hash == hash && + memcmp(&da->direct_tbl[index << dxr_x], + &da->x_tbl[tp->td_index << dxr_x], + sizeof(*da->x_tbl) << dxr_x) == 0) { + tp->td_refcnt++; + da->trietbl[index] = tp; + return(tp->td_index); + } + + tp = LIST_FIRST(&da->unused_trie); + if (tp != NULL) { + LIST_REMOVE(tp, td_hash_le); + da->unused_trie_cnt--; + } else { + tp = uma_zalloc(trie_zone, M_NOWAIT); + if (tp == NULL) + return (-1); + LIST_INSERT_HEAD(&da->all_trie, tp, td_all_le); + tp->td_index = da->all_trie_cnt++; + } + + tp->td_hash = hash; + tp->td_refcnt = 1; + LIST_INSERT_HEAD(&da->trie_hashtbl[hash & TRIE_HASH_MASK], tp, + td_hash_le); + memcpy(&da->x_tbl[tp->td_index << dxr_x], + &da->direct_tbl[index << dxr_x], sizeof(*da->x_tbl) << dxr_x); + da->trietbl[index] = tp; + if (da->all_trie_cnt >= da->xtbl_size >> dxr_x) { + da->xtbl_size += XTBL_SIZE_INCR; + da->x_tbl = realloc(da->x_tbl, + sizeof(*da->x_tbl) * da->xtbl_size, M_DXRAUX, M_NOWAIT); + if (da->x_tbl == NULL) + return (-1); + } + return(tp->td_index); +} + +static void +trie_unref(struct dxr_aux *da, uint32_t index) +{ + struct trie_desc *tp = da->trietbl[index]; + + if (tp == NULL) + return; + da->trietbl[index] = NULL; + if (--tp->td_refcnt > 0) + return; + + LIST_REMOVE(tp, td_hash_le); + da->unused_trie_cnt++; + if (tp->td_index != da->all_trie_cnt - 1) { + LIST_INSERT_HEAD(&da->unused_trie, tp, td_hash_le); + return; + } + + do { + da->all_trie_cnt--; + da->unused_trie_cnt--; + LIST_REMOVE(tp, td_all_le); + uma_zfree(trie_zone, tp); + LIST_FOREACH(tp, &da->unused_trie, td_hash_le) + if (tp->td_index == da->all_trie_cnt - 1) { + LIST_REMOVE(tp, td_hash_le); + break; + } + } while (tp != NULL); +} +#endif + +static void +heap_inject(struct dxr_aux *da, uint32_t start, uint32_t end, uint32_t preflen, + uint32_t nh) +{ + struct heap_entry *fhp; + int i; + + for (i = da->heap_index; i >= 0; i--) { + if (preflen > da->heap[i].preflen) + break; + else if (preflen < da->heap[i].preflen) + da->heap[i + 1] = da->heap[i]; + else + return; + } + + fhp = &da->heap[i + 1]; + fhp->preflen = preflen; + fhp->start = start; + fhp->end = end; + fhp->nexthop = nh; + da->heap_index++; +} + +static int +dxr_walk(struct rtentry *rt, void *arg) +{ + struct dxr_aux *da = arg; + uint32_t chunk = da->work_chunk; + uint32_t first = chunk << DXR_RANGE_SHIFT; + uint32_t last = first | DXR_RANGE_MASK; + struct range_entry_long *fp = + &da->range_tbl[da->rtbl_top + da->rtbl_work_frags].re; + struct heap_entry *fhp = &da->heap[da->heap_index]; + uint32_t preflen, nh, start, end, scopeid; + struct in_addr addr; + + rt_get_inet_prefix_plen(rt, &addr, &preflen, &scopeid); + start = ntohl(addr.s_addr); + if (start > last) + return (-1); /* Beyond chunk boundaries, we are done */ + if (start < first) + return (0); /* Skip this route */ + + end = start; + if (preflen < 32) + end |= (0xffffffffU >> preflen); + nh = fib_get_nhop_idx(da->fd, rt_get_raw_nhop(rt)); + + if (start == fhp->start) + heap_inject(da, start, end, preflen, nh); + else { + /* start > fhp->start */ + while (start > fhp->end) { + uint32_t oend = fhp->end; + + if (da->heap_index > 0) { + fhp--; + da->heap_index--; + } else + initheap(da, fhp->end + 1, chunk); + if (fhp->end > oend && fhp->nexthop != fp->nexthop) { + fp++; + da->rtbl_work_frags++; + fp->start = (oend + 1) & DXR_RANGE_MASK; + fp->nexthop = fhp->nexthop; + } + } + if (start > ((chunk << DXR_RANGE_SHIFT) | fp->start) && + nh != fp->nexthop) { + fp++; + da->rtbl_work_frags++; + fp->start = start & DXR_RANGE_MASK; + } else if (da->rtbl_work_frags) { + if ((--fp)->nexthop == nh) + da->rtbl_work_frags--; + else + fp++; + } + fp->nexthop = nh; + heap_inject(da, start, end, preflen, nh); + } + + return (0); +} + +static int +update_chunk(struct dxr_aux *da, uint32_t chunk) +{ + struct range_entry_long *fp; +#if DXR_TRIE_BITS < 24 + struct range_entry_short *fps; + uint32_t start, nh, i; +#endif + struct heap_entry *fhp; + uint32_t first = chunk << DXR_RANGE_SHIFT; + uint32_t last = first | DXR_RANGE_MASK; + + if (da->direct_tbl[chunk].fragments != FRAGS_MARK_HIT) + chunk_unref(da, chunk); + + initheap(da, first, chunk); + + fp = &da->range_tbl[da->rtbl_top].re; + da->rtbl_work_frags = 0; + fp->start = first & DXR_RANGE_MASK; + fp->nexthop = da->heap[0].nexthop; + + da->dst.sin_addr.s_addr = htonl(first); + da->mask.sin_addr.s_addr = htonl(~DXR_RANGE_MASK); + + da->work_chunk = chunk; + rib_walk_from(da->fibnum, AF_INET, RIB_FLAG_LOCKED, + (struct sockaddr *) &da->dst, (struct sockaddr *) &da->mask, + dxr_walk, da); + + /* Flush any remaining objects on the heap */ + fp = &da->range_tbl[da->rtbl_top + da->rtbl_work_frags].re; + fhp = &da->heap[da->heap_index]; + while (fhp->preflen > DXR_TRIE_BITS) { + uint32_t oend = fhp->end; + + if (da->heap_index > 0) { + fhp--; + da->heap_index--; + } else + initheap(da, fhp->end + 1, chunk); + if (fhp->end > oend && fhp->nexthop != fp->nexthop) { + /* Have we crossed the upper chunk boundary? */ + if (oend >= last) + break; + fp++; + da->rtbl_work_frags++; + fp->start = (oend + 1) & DXR_RANGE_MASK; + fp->nexthop = fhp->nexthop; + } + } + + /* Direct hit if the chunk contains only a single fragment */ + if (da->rtbl_work_frags == 0) { + da->direct_tbl[chunk].base = fp->nexthop; + da->direct_tbl[chunk].fragments = FRAGS_MARK_HIT; + return (0); + } + + da->direct_tbl[chunk].base = da->rtbl_top; + da->direct_tbl[chunk].fragments = da->rtbl_work_frags; + +#if DXR_TRIE_BITS < 24 + /* Check whether the chunk can be more compactly encoded */ + fp = &da->range_tbl[da->rtbl_top].re; + for (i = 0; i <= da->rtbl_work_frags; i++, fp++) + if ((fp->start & 0xff) != 0 || fp->nexthop > RE_SHORT_MAX_NH) + break; + if (i == da->rtbl_work_frags + 1) { + fp = &da->range_tbl[da->rtbl_top].re; + fps = (void *) fp; + for (i = 0; i <= da->rtbl_work_frags; i++, fp++, fps++) { + start = fp->start; + nh = fp->nexthop; + fps->start = start >> 8; + fps->nexthop = nh; + } + fps->start = start >> 8; + fps->nexthop = nh; + da->rtbl_work_frags >>= 1; + da->direct_tbl[chunk].fragments = + da->rtbl_work_frags | FRAGS_PREF_SHORT; + } else +#endif + if (da->rtbl_work_frags >= FRAGS_MARK_HIT) { + da->direct_tbl[chunk].fragments = FRAGS_MARK_XL; + memmove(&da->range_tbl[da->rtbl_top + 1], + &da->range_tbl[da->rtbl_top], + (da->rtbl_work_frags + 1) * sizeof(*da->range_tbl)); + da->range_tbl[da->rtbl_top].fragments = da->rtbl_work_frags; + da->rtbl_work_frags++; + } + da->rtbl_top += (da->rtbl_work_frags + 1); + return (chunk_ref(da, chunk)); +} + +static void +dxr_build(struct dxr *dxr) +{ + struct dxr_aux *da = dxr->aux; + struct chunk_desc *cdp; + struct rib_rtable_info rinfo; + struct timeval t0, t1, t2, t3; + uint32_t r_size, dxr_tot_size; + uint32_t i, m, range_rebuild = 0; +#ifdef DXR2 + struct trie_desc *tp; + uint32_t d_tbl_size, dxr_x, d_size, x_size; + uint32_t ti, trie_rebuild = 0, prev_size = 0; +#endif + + KASSERT(dxr->d == NULL, ("dxr: d not free")); + + if (da == NULL) { + da = malloc(sizeof(*dxr->aux), M_DXRAUX, M_NOWAIT); + if (da == NULL) + return; + dxr->aux = da; + da->fibnum = dxr->fibnum; + da->refcnt = 1; + LIST_INIT(&da->all_chunks); + LIST_INIT(&da->all_trie); + da->rtbl_size = RTBL_SIZE_INCR; + da->range_tbl = NULL; + da->xtbl_size = XTBL_SIZE_INCR; + da->x_tbl = NULL; + bzero(&da->dst, sizeof(da->dst)); + bzero(&da->mask, sizeof(da->mask)); + da->dst.sin_len = sizeof(da->dst); + da->mask.sin_len = sizeof(da->mask); + da->dst.sin_family = AF_INET; + da->mask.sin_family = AF_INET; + } + if (da->range_tbl == NULL) { + da->range_tbl = malloc(sizeof(*da->range_tbl) * da->rtbl_size + + FRAGS_PREF_SHORT, M_DXRAUX, M_NOWAIT); + if (da->range_tbl == NULL) + return; + range_rebuild = 1; + } +#ifdef DXR2 + if (da->x_tbl == NULL) { + da->x_tbl = malloc(sizeof(*da->x_tbl) * da->xtbl_size, + M_DXRAUX, M_NOWAIT); + if (da->x_tbl == NULL) + return; + trie_rebuild = 1; + } +#endif + da->fd = dxr->fd; + + microuptime(&t0); *** 404 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed May 5 13:27:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E26C863EEAD; Wed, 5 May 2021 13:27:14 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZyDf620pz3s4b; Wed, 5 May 2021 13:27:14 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C1CEB258AD; Wed, 5 May 2021 13:27:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145DREhv031370; Wed, 5 May 2021 13:27:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145DRE3u031369; Wed, 5 May 2021 13:27:14 GMT (envelope-from git) Date: Wed, 5 May 2021 13:27:14 GMT Message-Id: <202105051327.145DRE3u031369@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 5e8caee259d0 - main - linux: remove redundant SDT tracepoints MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e8caee259d0cc73301b8fc60c8fb388e7f745af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 13:27:14 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=5e8caee259d0cc73301b8fc60c8fb388e7f745af commit 5e8caee259d0cc73301b8fc60c8fb388e7f745af Author: Edward Tomasz Napierala AuthorDate: 2021-05-05 12:58:54 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-05 12:59:00 +0000 linux: remove redundant SDT tracepoints Remove all the 'entry' and 'return' probes; they clutter up the source and are redundant to FBT. Reviewed By: dchagin Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30040 --- sys/compat/linux/linux_futex.c | 189 +++------------------------------------- sys/compat/linux/linux_sysctl.c | 21 +---- sys/compat/linux/linux_time.c | 71 +-------------- sys/compat/linux/linux_uid16.c | 90 +------------------ sys/compat/linux/linux_util.h | 5 -- 5 files changed, 18 insertions(+), 358 deletions(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 43ac318d2b51..da1a91916869 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -91,58 +91,32 @@ LIN_SDT_PROBE_DEFINE1(futex, futex, destroy, "struct sx *"); /** * DTrace probes in this module. */ -LIN_SDT_PROBE_DEFINE2(futex, futex_put, entry, "struct futex *", - "struct waiting_proc *"); LIN_SDT_PROBE_DEFINE3(futex, futex_put, destroy, "uint32_t *", "uint32_t", "int"); LIN_SDT_PROBE_DEFINE3(futex, futex_put, unlock, "uint32_t *", "uint32_t", "int"); -LIN_SDT_PROBE_DEFINE0(futex, futex_put, return); -LIN_SDT_PROBE_DEFINE3(futex, futex_get0, entry, "uint32_t *", "struct futex **", - "uint32_t"); LIN_SDT_PROBE_DEFINE1(futex, futex_get0, umtx_key_get_error, "int"); LIN_SDT_PROBE_DEFINE3(futex, futex_get0, shared, "uint32_t *", "uint32_t", "int"); LIN_SDT_PROBE_DEFINE1(futex, futex_get0, null, "uint32_t *"); LIN_SDT_PROBE_DEFINE3(futex, futex_get0, new, "uint32_t *", "uint32_t", "int"); -LIN_SDT_PROBE_DEFINE1(futex, futex_get0, return, "int"); -LIN_SDT_PROBE_DEFINE3(futex, futex_get, entry, "uint32_t *", - "struct waiting_proc **", "struct futex **"); LIN_SDT_PROBE_DEFINE0(futex, futex_get, error); -LIN_SDT_PROBE_DEFINE1(futex, futex_get, return, "int"); -LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, entry, "struct futex *", - "struct waiting_proc **", "struct timespec *"); LIN_SDT_PROBE_DEFINE5(futex, futex_sleep, requeue_error, "int", "uint32_t *", "struct waiting_proc *", "uint32_t *", "uint32_t"); LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, sleep_error, "int", "uint32_t *", "struct waiting_proc *"); -LIN_SDT_PROBE_DEFINE1(futex, futex_sleep, return, "int"); -LIN_SDT_PROBE_DEFINE3(futex, futex_wake, entry, "struct futex *", "int", - "uint32_t"); LIN_SDT_PROBE_DEFINE3(futex, futex_wake, iterate, "uint32_t", "struct waiting_proc *", "uint32_t"); LIN_SDT_PROBE_DEFINE1(futex, futex_wake, wakeup, "struct waiting_proc *"); -LIN_SDT_PROBE_DEFINE1(futex, futex_wake, return, "int"); -LIN_SDT_PROBE_DEFINE4(futex, futex_requeue, entry, "struct futex *", "int", - "struct futex *", "int"); LIN_SDT_PROBE_DEFINE1(futex, futex_requeue, wakeup, "struct waiting_proc *"); LIN_SDT_PROBE_DEFINE3(futex, futex_requeue, requeue, "uint32_t *", "struct waiting_proc *", "uint32_t"); -LIN_SDT_PROBE_DEFINE1(futex, futex_requeue, return, "int"); -LIN_SDT_PROBE_DEFINE4(futex, futex_wait, entry, "struct futex *", - "struct waiting_proc **", "struct timespec *", "uint32_t"); LIN_SDT_PROBE_DEFINE1(futex, futex_wait, sleep_error, "int"); -LIN_SDT_PROBE_DEFINE1(futex, futex_wait, return, "int"); -LIN_SDT_PROBE_DEFINE3(futex, futex_atomic_op, entry, "struct thread *", - "int", "uint32_t"); LIN_SDT_PROBE_DEFINE4(futex, futex_atomic_op, decoded_op, "int", "int", "int", "int"); LIN_SDT_PROBE_DEFINE0(futex, futex_atomic_op, missing_access_check); LIN_SDT_PROBE_DEFINE1(futex, futex_atomic_op, unimplemented_op, "int"); LIN_SDT_PROBE_DEFINE1(futex, futex_atomic_op, unimplemented_cmp, "int"); -LIN_SDT_PROBE_DEFINE1(futex, futex_atomic_op, return, "int"); -LIN_SDT_PROBE_DEFINE2(futex, linux_sys_futex, entry, "struct thread *", - "struct linux_sys_futex_args *"); LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, unimplemented_clockswitch); LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, copyin_error, "int"); LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, invalid_cmp_requeue_use); @@ -166,28 +140,11 @@ LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, deprecated_requeue); LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, unimplemented_wait_requeue_pi); LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, unimplemented_cmp_requeue_pi); LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, unknown_operation, "int"); -LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, return, "int"); -LIN_SDT_PROBE_DEFINE2(futex, linux_set_robust_list, entry, "struct thread *", - "struct linux_set_robust_list_args *"); LIN_SDT_PROBE_DEFINE0(futex, linux_set_robust_list, size_error); -LIN_SDT_PROBE_DEFINE1(futex, linux_set_robust_list, return, "int"); -LIN_SDT_PROBE_DEFINE2(futex, linux_get_robust_list, entry, "struct thread *", - "struct linux_get_robust_list_args *"); LIN_SDT_PROBE_DEFINE1(futex, linux_get_robust_list, copyout_error, "int"); -LIN_SDT_PROBE_DEFINE1(futex, linux_get_robust_list, return, "int"); -LIN_SDT_PROBE_DEFINE3(futex, handle_futex_death, entry, - "struct linux_emuldata *", "uint32_t *", "unsigned int"); LIN_SDT_PROBE_DEFINE1(futex, handle_futex_death, copyin_error, "int"); -LIN_SDT_PROBE_DEFINE1(futex, handle_futex_death, return, "int"); -LIN_SDT_PROBE_DEFINE3(futex, fetch_robust_entry, entry, - "struct linux_robust_list **", "struct linux_robust_list **", - "unsigned int *"); LIN_SDT_PROBE_DEFINE1(futex, fetch_robust_entry, copyin_error, "int"); -LIN_SDT_PROBE_DEFINE1(futex, fetch_robust_entry, return, "int"); -LIN_SDT_PROBE_DEFINE2(futex, release_futexes, entry, "struct thread *", - "struct linux_emuldata *"); LIN_SDT_PROBE_DEFINE1(futex, release_futexes, copyin_error, "int"); -LIN_SDT_PROBE_DEFINE0(futex, release_futexes, return); struct futex; @@ -298,7 +255,6 @@ futex_copyin_timeout(int op, struct l_timespec *luts, int clockrt, static void futex_put(struct futex *f, struct waiting_proc *wp) { - LIN_SDT_PROBE2(futex, futex_put, entry, f, wp); if (wp != NULL) { if ((wp->wp_flags & FUTEX_WP_REMOVED) == 0) @@ -320,8 +276,6 @@ futex_put(struct futex *f, struct waiting_proc *wp) umtx_key_release(&f->f_key); FUTEX_DESTROY(f); free(f, M_FUTEX); - - LIN_SDT_PROBE0(futex, futex_put, return); return; } @@ -332,8 +286,6 @@ futex_put(struct futex *f, struct waiting_proc *wp) if (FUTEX_LOCKED(f)) futex_unlock(f); FUTEXES_UNLOCK; - - LIN_SDT_PROBE0(futex, futex_put, return); } static int @@ -343,15 +295,12 @@ futex_get0(uint32_t *uaddr, struct futex **newf, uint32_t flags) struct umtx_key key; int error; - LIN_SDT_PROBE3(futex, futex_get0, entry, uaddr, newf, flags); - *newf = tmpf = NULL; error = umtx_key_get(uaddr, TYPE_FUTEX, (flags & FUTEX_SHARED) ? AUTO_SHARE : THREAD_SHARE, &key); if (error) { LIN_SDT_PROBE1(futex, futex_get0, umtx_key_get_error, error); - LIN_SDT_PROBE1(futex, futex_get0, return, error); return (error); } retry: @@ -368,8 +317,6 @@ retry: FUTEXES_UNLOCK; umtx_key_release(&key); - LIN_SDT_PROBE1(futex, futex_get0, return, - EINVAL); return (EINVAL); } @@ -389,7 +336,6 @@ retry: LINUX_CTR3(sys_futex, "futex_get uaddr %p ref %d shared %d", uaddr, f->f_refcount, f->f_key.shared); - LIN_SDT_PROBE1(futex, futex_get0, return, 0); return (0); } } @@ -400,7 +346,6 @@ retry: LIN_SDT_PROBE1(futex, futex_get0, null, uaddr); LINUX_CTR1(sys_futex, "futex_get uaddr %p null", uaddr); - LIN_SDT_PROBE1(futex, futex_get0, return, 0); return (0); } @@ -432,7 +377,6 @@ retry: uaddr, tmpf->f_refcount, tmpf->f_key.shared); *newf = tmpf; - LIN_SDT_PROBE1(futex, futex_get0, return, 0); return (0); } @@ -442,8 +386,6 @@ futex_get(uint32_t *uaddr, struct waiting_proc **wp, struct futex **f, { int error; - LIN_SDT_PROBE3(futex, futex_get, entry, uaddr, wp, f); - if (flags & FUTEX_CREATE_WP) { *wp = malloc(sizeof(struct waiting_proc), M_FUTEX_WP, M_WAITOK); (*wp)->wp_flags = 0; @@ -455,7 +397,6 @@ futex_get(uint32_t *uaddr, struct waiting_proc **wp, struct futex **f, if (flags & FUTEX_CREATE_WP) free(*wp, M_FUTEX_WP); - LIN_SDT_PROBE1(futex, futex_get, return, error); return (error); } if (flags & FUTEX_CREATE_WP) { @@ -463,7 +404,6 @@ futex_get(uint32_t *uaddr, struct waiting_proc **wp, struct futex **f, (*wp)->wp_futex = *f; } - LIN_SDT_PROBE1(futex, futex_get, return, error); return (error); } @@ -512,7 +452,6 @@ futex_sleep(struct futex *f, struct waiting_proc *wp, struct timespec *ts) sbt = 0; prec = 0; } - LIN_SDT_PROBE3(futex, futex_sleep, entry, f, wp, sbt); LINUX_CTR4(sys_futex, "futex_sleep enter uaddr %p wp %p timo %ld ref %d", f->f_uaddr, wp, sbt, f->f_refcount); @@ -544,7 +483,6 @@ futex_sleep(struct futex *f, struct waiting_proc *wp, struct timespec *ts) futex_put(f, wp); - LIN_SDT_PROBE1(futex, futex_sleep, return, error); return (error); } @@ -554,12 +492,8 @@ futex_wake(struct futex *f, int n, uint32_t bitset) struct waiting_proc *wp, *wpt; int count = 0; - LIN_SDT_PROBE3(futex, futex_wake, entry, f, n, bitset); - - if (bitset == 0) { - LIN_SDT_PROBE1(futex, futex_wake, return, EINVAL); + if (bitset == 0) return (EINVAL); - } FUTEX_ASSERT_LOCKED(f); TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) { @@ -582,7 +516,6 @@ futex_wake(struct futex *f, int n, uint32_t bitset) break; } - LIN_SDT_PROBE1(futex, futex_wake, return, count); return (count); } @@ -592,8 +525,6 @@ futex_requeue(struct futex *f, int n, struct futex *f2, int n2) struct waiting_proc *wp, *wpt; int count = 0; - LIN_SDT_PROBE4(futex, futex_requeue, entry, f, n, f2, n2); - FUTEX_ASSERT_LOCKED(f); FUTEX_ASSERT_LOCKED(f2); @@ -629,7 +560,6 @@ futex_requeue(struct futex *f, int n, struct futex *f2, int n2) } } - LIN_SDT_PROBE1(futex, futex_requeue, return, count); return (count); } @@ -639,10 +569,7 @@ futex_wait(struct futex *f, struct waiting_proc *wp, struct timespec *ts, { int error; - LIN_SDT_PROBE4(futex, futex_wait, entry, f, wp, ts, bitset); - if (bitset == 0) { - LIN_SDT_PROBE1(futex, futex_wait, return, EINVAL); futex_put(f, wp); return (EINVAL); } @@ -654,7 +581,6 @@ futex_wait(struct futex *f, struct waiting_proc *wp, struct timespec *ts, if (error == EWOULDBLOCK) error = ETIMEDOUT; - LIN_SDT_PROBE1(futex, futex_wait, return, error); return (error); } @@ -667,8 +593,6 @@ futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr) int cmparg = (encoded_op << 20) >> 20; int oldval = 0, ret; - LIN_SDT_PROBE3(futex, futex_atomic_op, entry, td, encoded_op, uaddr); - if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) oparg = 1 << oparg; @@ -700,10 +624,8 @@ futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr) break; } - if (ret) { - LIN_SDT_PROBE1(futex, futex_atomic_op, return, ret); + if (ret) return (ret); - } switch (cmp) { case FUTEX_OP_CMP_EQ: @@ -729,7 +651,6 @@ futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr) ret = -ENOSYS; } - LIN_SDT_PROBE1(futex, futex_atomic_op, return, ret); return (ret); } @@ -744,8 +665,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args) int error, save; uint32_t flags, val; - LIN_SDT_PROBE2(futex, linux_sys_futex, entry, td, args); - if (args->op & LINUX_FUTEX_PRIVATE_FLAG) { flags = 0; args->op &= ~LINUX_FUTEX_PRIVATE_FLAG; @@ -764,7 +683,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args) args->op != LINUX_FUTEX_WAIT_REQUEUE_PI) { LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_clockswitch); - LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS); return (ENOSYS); } @@ -788,7 +706,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args) if (error) { LIN_SDT_PROBE1(futex, linux_sys_futex, copyin_error, error); - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } ts = &uts; @@ -798,10 +715,8 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args) retry0: error = futex_get(args->uaddr, &wp, &f, flags | FUTEX_CREATE_WP); - if (error) { - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); + if (error) return (error); - } error = copyin_nofault(args->uaddr, &val, sizeof(val)); if (error) { @@ -813,7 +728,6 @@ retry0: error); LINUX_CTR1(sys_futex, "WAIT copyin failed %d", error); - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } if (val != args->val) { @@ -824,9 +738,6 @@ retry0: "WAIT uaddr %p val 0x%x != uval 0x%x", args->uaddr, args->val, val); futex_put(f, wp); - - LIN_SDT_PROBE1(futex, linux_sys_futex, return, - EWOULDBLOCK); return (EWOULDBLOCK); } @@ -845,15 +756,11 @@ retry0: error = futex_get(args->uaddr, NULL, &f, flags | FUTEX_DONTCREATE); - if (error) { - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); + if (error) return (error); - } if (f == NULL) { td->td_retval[0] = 0; - - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } td->td_retval[0] = futex_wake(f, args->val, args->val3); @@ -876,16 +783,13 @@ retry0: if (args->uaddr == args->uaddr2) { LIN_SDT_PROBE0(futex, linux_sys_futex, invalid_cmp_requeue_use); - LIN_SDT_PROBE1(futex, linux_sys_futex, return, EINVAL); return (EINVAL); } retry1: error = futex_get(args->uaddr, NULL, &f, flags | FUTEX_DONTLOCK); - if (error) { - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); + if (error) return (error); - } /* * To avoid deadlocks return EINVAL if second futex @@ -898,8 +802,6 @@ retry1: flags | FUTEX_DONTEXISTS | FUTEX_DONTLOCK); if (error) { futex_put(f, NULL); - - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } futex_lock(f); @@ -915,7 +817,6 @@ retry1: error); LINUX_CTR1(sys_futex, "CMP_REQUEUE copyin failed %d", error); - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } if (val != args->val3) { @@ -925,8 +826,6 @@ retry1: args->val, val); futex_put(f2, NULL); futex_put(f, NULL); - - LIN_SDT_PROBE1(futex, linux_sys_futex, return, EAGAIN); return (EAGAIN); } @@ -944,23 +843,17 @@ retry1: args->uaddr, args->val, args->uaddr2, args->val3, args->timeout); - if (args->uaddr == args->uaddr2) { - LIN_SDT_PROBE1(futex, linux_sys_futex, return, EINVAL); + if (args->uaddr == args->uaddr2) return (EINVAL); - } retry2: error = futex_get(args->uaddr, NULL, &f, flags | FUTEX_DONTLOCK); - if (error) { - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); + if (error) return (error); - } error = futex_get(args->uaddr2, NULL, &f2, flags | FUTEX_DONTLOCK); if (error) { futex_put(f, NULL); - - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } futex_lock(f); @@ -984,7 +877,6 @@ retry2: error = copyin(args->uaddr2, &val, sizeof(val)); if (error == 0) goto retry2; - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } @@ -1015,7 +907,6 @@ retry2: LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_lock_pi); } - LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS); return (ENOSYS); case LINUX_FUTEX_UNLOCK_PI: @@ -1027,7 +918,6 @@ retry2: LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_unlock_pi); } - LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS); return (ENOSYS); case LINUX_FUTEX_TRYLOCK_PI: @@ -1039,7 +929,6 @@ retry2: LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_trylock_pi); } - LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS); return (ENOSYS); case LINUX_FUTEX_REQUEUE: @@ -1056,8 +945,6 @@ retry2: LIN_SDT_PROBE0(futex, linux_sys_futex, deprecated_requeue); } - - LIN_SDT_PROBE1(futex, linux_sys_futex, return, EINVAL); return (EINVAL); case LINUX_FUTEX_WAIT_REQUEUE_PI: @@ -1069,7 +956,6 @@ retry2: LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_wait_requeue_pi); } - LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS); return (ENOSYS); case LINUX_FUTEX_CMP_REQUEUE_PI: @@ -1081,18 +967,15 @@ retry2: LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_cmp_requeue_pi); } - LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS); return (ENOSYS); default: linux_msg(td, "unsupported futex op %d", args->op); LIN_SDT_PROBE1(futex, linux_sys_futex, unknown_operation, args->op); - LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS); return (ENOSYS); } - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } @@ -1101,18 +984,14 @@ linux_set_robust_list(struct thread *td, struct linux_set_robust_list_args *args { struct linux_emuldata *em; - LIN_SDT_PROBE2(futex, linux_set_robust_list, entry, td, args); - if (args->len != sizeof(struct linux_robust_list_head)) { LIN_SDT_PROBE0(futex, linux_set_robust_list, size_error); - LIN_SDT_PROBE1(futex, linux_set_robust_list, return, EINVAL); return (EINVAL); } em = em_find(td); em->robust_futexes = args->head; - LIN_SDT_PROBE1(futex, linux_set_robust_list, return, 0); return (0); } @@ -1125,22 +1004,15 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args struct thread *td2; int error = 0; - LIN_SDT_PROBE2(futex, linux_get_robust_list, entry, td, args); - if (!args->pid) { em = em_find(td); KASSERT(em != NULL, ("get_robust_list: emuldata notfound.\n")); head = em->robust_futexes; } else { td2 = tdfind(args->pid, -1); - if (td2 == NULL) { - LIN_SDT_PROBE1(futex, linux_get_robust_list, return, - ESRCH); + if (td2 == NULL) return (ESRCH); - } if (SV_PROC_ABI(td2->td_proc) != SV_ABI_LINUX) { - LIN_SDT_PROBE1(futex, linux_get_robust_list, return, - EPERM); PROC_UNLOCK(td2->td_proc); return (EPERM); } @@ -1152,9 +1024,6 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args priv_check(td, PRIV_CRED_SETEUID) || p_candebug(td, td2->td_proc)) { PROC_UNLOCK(td2->td_proc); - - LIN_SDT_PROBE1(futex, linux_get_robust_list, return, - EPERM); return (EPERM); } head = em->robust_futexes; @@ -1166,7 +1035,6 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args if (error) { LIN_SDT_PROBE1(futex, linux_get_robust_list, copyout_error, error); - LIN_SDT_PROBE1(futex, linux_get_robust_list, return, EFAULT); return (EFAULT); } @@ -1176,7 +1044,6 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args error); } - LIN_SDT_PROBE1(futex, linux_get_robust_list, return, error); return (error); } @@ -1188,24 +1055,18 @@ handle_futex_death(struct linux_emuldata *em, uint32_t *uaddr, struct futex *f; int error; - LIN_SDT_PROBE3(futex, handle_futex_death, entry, em, uaddr, pi); - retry: error = copyin(uaddr, &uval, 4); if (error) { LIN_SDT_PROBE1(futex, handle_futex_death, copyin_error, error); - LIN_SDT_PROBE1(futex, handle_futex_death, return, EFAULT); return (EFAULT); } if ((uval & FUTEX_TID_MASK) == em->em_tid) { mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED; nval = casuword32(uaddr, uval, mval); - if (nval == -1) { - LIN_SDT_PROBE1(futex, handle_futex_death, return, - EFAULT); + if (nval == -1) return (EFAULT); - } if (nval != uval) goto retry; @@ -1213,11 +1074,8 @@ retry: if (!pi && (uval & FUTEX_WAITERS)) { error = futex_get(uaddr, NULL, &f, FUTEX_DONTCREATE | FUTEX_SHARED); - if (error) { - LIN_SDT_PROBE1(futex, handle_futex_death, - return, error); + if (error) return (error); - } if (f != NULL) { futex_wake(f, 1, FUTEX_BITSET_MATCH_ANY); futex_put(f, NULL); @@ -1225,7 +1083,6 @@ retry: } } - LIN_SDT_PROBE1(futex, handle_futex_death, return, 0); return (0); } @@ -1236,19 +1093,15 @@ fetch_robust_entry(struct linux_robust_list **entry, l_ulong uentry; int error; - LIN_SDT_PROBE3(futex, fetch_robust_entry, entry, entry, head, pi); - error = copyin((const void *)head, &uentry, sizeof(l_ulong)); if (error) { LIN_SDT_PROBE1(futex, fetch_robust_entry, copyin_error, error); - LIN_SDT_PROBE1(futex, fetch_robust_entry, return, EFAULT); return (EFAULT); } *entry = (void *)(uentry & ~1UL); *pi = uentry & 1; - LIN_SDT_PROBE1(futex, fetch_robust_entry, return, 0); return (0); } @@ -1262,32 +1115,23 @@ release_futexes(struct thread *td, struct linux_emuldata *em) l_long futex_offset; int rc, error; - LIN_SDT_PROBE2(futex, release_futexes, entry, td, em); - head = em->robust_futexes; - if (head == NULL) { - LIN_SDT_PROBE0(futex, release_futexes, return); + if (head == NULL) return; - } - if (fetch_robust_entry(&entry, PTRIN(&head->list.next), &pi)) { - LIN_SDT_PROBE0(futex, release_futexes, return); + if (fetch_robust_entry(&entry, PTRIN(&head->list.next), &pi)) return; - } error = copyin(&head->futex_offset, &futex_offset, sizeof(futex_offset)); if (error) { LIN_SDT_PROBE1(futex, release_futexes, copyin_error, error); - LIN_SDT_PROBE0(futex, release_futexes, return); return; } - if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip)) { - LIN_SDT_PROBE0(futex, release_futexes, return); + if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip)) return; - } while (entry != &head->list) { rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi); @@ -1295,13 +1139,10 @@ release_futexes(struct thread *td, struct linux_emuldata *em) if (entry != pending) if (handle_futex_death(em, (uint32_t *)((caddr_t)entry + futex_offset), pi)) { - LIN_SDT_PROBE0(futex, release_futexes, return); return; } - if (rc) { - LIN_SDT_PROBE0(futex, release_futexes, return); + if (rc) return; - } entry = next_entry; pi = next_pi; @@ -1314,6 +1155,4 @@ release_futexes(struct thread *td, struct linux_emuldata *em) if (pending) handle_futex_death(em, (uint32_t *)((caddr_t)pending + futex_offset), pip); - - LIN_SDT_PROBE0(futex, release_futexes, return); } diff --git a/sys/compat/linux/linux_sysctl.c b/sys/compat/linux/linux_sysctl.c index 76d04164a807..e722280a2bbf 100644 --- a/sys/compat/linux/linux_sysctl.c +++ b/sys/compat/linux/linux_sysctl.c @@ -75,16 +75,10 @@ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); /** * DTrace probes in this module. */ -LIN_SDT_PROBE_DEFINE2(sysctl, handle_string, entry, "struct l___sysctl_args *", - "char *"); LIN_SDT_PROBE_DEFINE1(sysctl, handle_string, copyout_error, "int"); -LIN_SDT_PROBE_DEFINE1(sysctl, handle_string, return, "int"); -LIN_SDT_PROBE_DEFINE2(sysctl, linux_sysctl, entry, "struct l___sysctl_args *", - "struct thread *"); LIN_SDT_PROBE_DEFINE1(sysctl, linux_sysctl, copyin_error, "int"); LIN_SDT_PROBE_DEFINE2(sysctl, linux_sysctl, wrong_length, "int", "int"); LIN_SDT_PROBE_DEFINE1(sysctl, linux_sysctl, unsupported_sysctl, "char *"); -LIN_SDT_PROBE_DEFINE1(sysctl, linux_sysctl, return, "int"); #ifdef LINUX_LEGACY_SYSCALLS static int @@ -92,8 +86,6 @@ handle_string(struct l___sysctl_args *la, char *value) { int error; - LIN_SDT_PROBE2(sysctl, handle_string, entry, la, value); - if (la->oldval != 0) { l_int len = strlen(value); error = copyout(value, PTRIN(la->oldval), len + 1); @@ -102,17 +94,13 @@ handle_string(struct l___sysctl_args *la, char *value) if (error) { LIN_SDT_PROBE1(sysctl, handle_string, copyout_error, error); - LIN_SDT_PROBE1(sysctl, handle_string, return, error); return (error); } } - if (la->newval != 0) { - LIN_SDT_PROBE1(sysctl, handle_string, return, ENOTDIR); + if (la->newval != 0) return (ENOTDIR); - } - LIN_SDT_PROBE1(sysctl, handle_string, return, 0); return (0); } @@ -125,19 +113,15 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args) char *sysctl_string; int error, i; - LIN_SDT_PROBE2(sysctl, linux_sysctl, entry, td, args->args); - error = copyin(args->args, &la, sizeof(la)); if (error) { LIN_SDT_PROBE1(sysctl, linux_sysctl, copyin_error, error); - LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error); return (error); } if (la.nlen <= 0 || la.nlen > LINUX_CTL_MAXNAME) { LIN_SDT_PROBE2(sysctl, linux_sysctl, wrong_length, la.nlen, LINUX_CTL_MAXNAME); - LIN_SDT_PROBE1(sysctl, linux_sysctl, return, ENOTDIR); return (ENOTDIR); } @@ -145,7 +129,6 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args) error = copyin(PTRIN(la.name), mib, la.nlen * sizeof(l_int)); if (error) { LIN_SDT_PROBE1(sysctl, linux_sysctl, copyin_error, error); - LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error); free(mib, M_LINUX); return (error); } @@ -159,7 +142,6 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args) case LINUX_KERN_VERSION: error = handle_string(&la, version); free(mib, M_LINUX); - LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error); return (error); default: break; @@ -189,7 +171,6 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args) free(mib, M_LINUX); - LIN_SDT_PROBE1(sysctl, linux_sysctl, return, ENOTDIR); return (ENOTDIR); } #endif diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 6f1ef36a9114..1d7dcc869159 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -75,58 +75,33 @@ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); /** * DTrace probes in this module. */ -LIN_SDT_PROBE_DEFINE2(time, native_to_linux_timespec, entry, - "struct l_timespec *", "struct timespec *"); -LIN_SDT_PROBE_DEFINE0(time, native_to_linux_timespec, return); -LIN_SDT_PROBE_DEFINE2(time, linux_to_native_timespec, entry, - "struct timespec *", "struct l_timespec *"); -LIN_SDT_PROBE_DEFINE1(time, linux_to_native_timespec, return, "int"); -LIN_SDT_PROBE_DEFINE2(time, linux_to_native_clockid, entry, "clockid_t *", - "clockid_t"); LIN_SDT_PROBE_DEFINE1(time, linux_to_native_clockid, unsupported_clockid, "clockid_t"); LIN_SDT_PROBE_DEFINE1(time, linux_to_native_clockid, unknown_clockid, "clockid_t"); -LIN_SDT_PROBE_DEFINE1(time, linux_to_native_clockid, return, "int"); -LIN_SDT_PROBE_DEFINE2(time, linux_clock_gettime, entry, "clockid_t", - "struct l_timespec *"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, gettime_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, copyout_error, "int"); -LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, return, "int"); -LIN_SDT_PROBE_DEFINE2(time, linux_clock_settime, entry, "clockid_t", - "struct l_timespec *"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, settime_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, copyin_error, "int"); -LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, return, "int"); -LIN_SDT_PROBE_DEFINE2(time, linux_clock_getres, entry, "clockid_t", - "struct l_timespec *"); LIN_SDT_PROBE_DEFINE0(time, linux_clock_getres, nullcall); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, getres_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, copyout_error, "int"); -LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, return, "int"); -LIN_SDT_PROBE_DEFINE2(time, linux_nanosleep, entry, "const struct l_timespec *", - "struct l_timespec *"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyin_error, "int"); -LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, return, "int"); -LIN_SDT_PROBE_DEFINE4(time, linux_clock_nanosleep, entry, "clockid_t", "int", - "struct l_timespec *", "struct l_timespec *"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_flags, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_clockid, "int"); -LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, return, "int"); int native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp) { - LIN_SDT_PROBE2(time, native_to_linux_timespec, entry, ltp, ntp); #ifdef COMPAT_LINUX32 if (ntp->tv_sec > INT_MAX || ntp->tv_sec < INT_MIN) return (EOVERFLOW); @@ -134,7 +109,6 @@ native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp) ltp->tv_sec = ntp->tv_sec; ltp->tv_nsec = ntp->tv_nsec; - LIN_SDT_PROBE0(time, native_to_linux_timespec, return); return (0); } @@ -142,16 +116,11 @@ int linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp) { - LIN_SDT_PROBE2(time, linux_to_native_timespec, entry, ntp, ltp); - - if (ltp->tv_sec < 0 || ltp->tv_nsec < 0 || ltp->tv_nsec > 999999999) { - LIN_SDT_PROBE1(time, linux_to_native_timespec, return, EINVAL); + if (ltp->tv_sec < 0 || ltp->tv_nsec < 0 || ltp->tv_nsec > 999999999) return (EINVAL); - } ntp->tv_sec = ltp->tv_sec; ntp->tv_nsec = ltp->tv_nsec; - LIN_SDT_PROBE1(time, linux_to_native_timespec, return, 0); return (0); } @@ -181,8 +150,6 @@ int linux_to_native_clockid(clockid_t *n, clockid_t l) { - LIN_SDT_PROBE2(time, linux_to_native_clockid, entry, n, l); - if (l < 0) { /* cpu-clock */ if ((l & LINUX_CLOCKFD_MASK) == LINUX_CLOCKFD) @@ -226,16 +193,13 @@ linux_to_native_clockid(clockid_t *n, clockid_t l) case LINUX_CLOCK_TAI: LIN_SDT_PROBE1(time, linux_to_native_clockid, unsupported_clockid, l); - LIN_SDT_PROBE1(time, linux_to_native_clockid, return, EINVAL); return (EINVAL); default: LIN_SDT_PROBE1(time, linux_to_native_clockid, unknown_clockid, l); - LIN_SDT_PROBE1(time, linux_to_native_clockid, return, EINVAL); return (EINVAL); } - LIN_SDT_PROBE1(time, linux_to_native_clockid, return, 0); return (0); } @@ -264,15 +228,12 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) pid_t pid; lwpid_t tid; - LIN_SDT_PROBE2(time, linux_clock_gettime, entry, args->which, args->tp); - error = linux_to_native_clockid(&nwhich, args->which); if (error != 0) { linux_msg(curthread, "unsupported clock_gettime clockid %d", args->which); LIN_SDT_PROBE1(time, linux_clock_gettime, conversion_error, error); - LIN_SDT_PROBE1(time, linux_clock_gettime, return, error); return (error); } @@ -375,7 +336,6 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) } if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_gettime, gettime_error, error); - LIN_SDT_PROBE1(time, linux_clock_gettime, return, error); return (error); } error = native_to_linux_timespec(<s, &tp); @@ -385,7 +345,6 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) if (error != 0) LIN_SDT_PROBE1(time, linux_clock_gettime, copyout_error, error); - LIN_SDT_PROBE1(time, linux_clock_gettime, return, error); return (error); } @@ -397,28 +356,23 @@ linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args) int error; clockid_t nwhich; - LIN_SDT_PROBE2(time, linux_clock_settime, entry, args->which, args->tp); - error = linux_to_native_clockid(&nwhich, args->which); if (error != 0) { linux_msg(curthread, "unsupported clock_settime clockid %d", args->which); LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error, error); - LIN_SDT_PROBE1(time, linux_clock_settime, return, error); return (error); } error = copyin(args->tp, <s, sizeof lts); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_settime, copyin_error, error); - LIN_SDT_PROBE1(time, linux_clock_settime, return, error); return (error); } error = linux_to_native_timespec(&ts, <s); *** 450 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed May 5 14:07:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0126C63FBBE; Wed, 5 May 2021 14:07:52 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZz7W6czDz3tQv; Wed, 5 May 2021 14:07:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D63442629E; Wed, 5 May 2021 14:07:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145E7pwT084436; Wed, 5 May 2021 14:07:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145E7pjB084435; Wed, 5 May 2021 14:07:51 GMT (envelope-from git) Date: Wed, 5 May 2021 14:07:51 GMT Message-Id: <202105051407.145E7pjB084435@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: cec2682cd291 - main - Restore Cirrus-CI boot smoke test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cec2682cd2910080951782391d7d7cd30c95c4ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 14:07:52 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=cec2682cd2910080951782391d7d7cd30c95c4ea commit cec2682cd2910080951782391d7d7cd30c95c4ea Author: Ed Maste AuthorDate: 2021-05-02 19:28:36 +0000 Commit: Ed Maste CommitDate: 2021-05-05 14:05:58 +0000 Restore Cirrus-CI boot smoke test This reverts commit a7d593dd1da27833b5384349700bc3c7bcae6aad. We now use compute_engine_instance which allows us to specify a custom disk size. Also go back to using the default qemu version (rather than qemu42 or qemu-devel) as any issues were fixed some time ago. Reviewed by: lwhsu, markj MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30082 --- .cirrus.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 33f51a0a5024..58a57e5c61c8 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,11 +1,14 @@ # $FreeBSD$ -freebsd_instance: +compute_engine_instance: # Image list available via # gcloud compute images list --project freebsd-org-cloud-dev --no-standard-images + platform: freebsd + image_project: freebsd-org-cloud-dev image: freebsd-13-0-release-amd64 cpu: 8 memory: 24G + disk: 40 env: CIRRUS_CLONE_DEPTH: 1 @@ -13,7 +16,7 @@ env: task: timeout_in: 120m install_script: - - pkg install -y llvm12 + - pkg install -y qemu uefi-edk2-qemu-x86_64 llvm12 setup_script: - uname -a - df -m @@ -22,6 +25,10 @@ task: - chown user:user /usr/obj/$(pwd -P) script: - su user -c "make -j$(sysctl -n hw.ncpu) CROSS_TOOLCHAIN=llvm12 WITHOUT_TOOLCHAIN=yes buildworld buildkernel" + package_script: + - su user -c "make CROSS_TOOLCHAIN=llvm12 WITHOUT_TOOLCHAIN=yes PKG_FORMAT=tar packages" + test_script: + - sh tools/boot/ci-qemu-test.sh post_script: - df -m - du -m -s /usr/obj From owner-dev-commits-src-all@freebsd.org Wed May 5 15:02:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 969415F9A49; Wed, 5 May 2021 15:02:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb0L13xb9z4RYM; Wed, 5 May 2021 15:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7A46426FB0; Wed, 5 May 2021 15:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145F2147061734; Wed, 5 May 2021 15:02:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145F21h7061733; Wed, 5 May 2021 15:02:01 GMT (envelope-from git) Date: Wed, 5 May 2021 15:02:01 GMT Message-Id: <202105051502.145F21h7061733@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9d45365e3321 - stable/13 - pipe: Avoid calling selrecord() on a closing pipe MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9d45365e332114459e46509e4d9aa31c81ce32a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 15:02:01 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9d45365e332114459e46509e4d9aa31c81ce32a7 commit 9d45365e332114459e46509e4d9aa31c81ce32a7 Author: Mark Johnston AuthorDate: 2021-04-28 14:42:59 +0000 Commit: Mark Johnston CommitDate: 2021-05-05 15:01:43 +0000 pipe: Avoid calling selrecord() on a closing pipe pipe_poll() may add the calling thread to the selinfo lists of both ends of a pipe. It is ok to do this for the local end, since we know we hold a reference on the file and so the local end is not closed. It is not ok to do this for the remote end, which may already be closed and have called seldrain(). In this scenario, when the polling thread wakes up, it may end up referencing a freed selinfo. Guard the selrecord() call appropriately. Reviewed by: kib Reported by: syzkaller+KASAN Differential Revision: https://reviews.freebsd.org/D30016 (cherry picked from commit d1e9441583fd85c7de5f48197d80c287f1a9494b) --- sys/kern/sys_pipe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 558337794950..ec0fb3860eda 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1470,7 +1470,8 @@ pipe_poll(struct file *fp, int events, struct ucred *active_cred, rpipe->pipe_state |= PIPE_SEL; } - if ((fp->f_flag & FWRITE) != 0) { + if ((fp->f_flag & FWRITE) != 0 && + wpipe->pipe_present == PIPE_ACTIVE) { selrecord(td, &wpipe->pipe_sel); if (SEL_WAITING(&wpipe->pipe_sel)) wpipe->pipe_state |= PIPE_SEL; From owner-dev-commits-src-all@freebsd.org Wed May 5 15:02:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9BA25F9974; Wed, 5 May 2021 15:02:02 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb0L258D1z4Rfr; Wed, 5 May 2021 15:02:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A0AFD26CDC; Wed, 5 May 2021 15:02:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145F22Bd061755; Wed, 5 May 2021 15:02:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145F22FG061754; Wed, 5 May 2021 15:02:02 GMT (envelope-from git) Date: Wed, 5 May 2021 15:02:02 GMT Message-Id: <202105051502.145F22FG061754@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 11af9a9cf930 - stable/13 - cap_sysctl.3: Fix bugs in the example MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 11af9a9cf930123ba164ffc63976fe1d67ce614e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 15:02:02 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=11af9a9cf930123ba164ffc63976fe1d67ce614e commit 11af9a9cf930123ba164ffc63976fe1d67ce614e Author: Mark Johnston AuthorDate: 2021-04-28 14:38:52 +0000 Commit: Mark Johnston CommitDate: 2021-05-05 15:01:56 +0000 cap_sysctl.3: Fix bugs in the example - Correct the type of the sysctl value. - Initialize the oldsize parameter to cap_sysctlbyname() Sponsored by: The FreeBSD Foundation (cherry picked from commit 44bbda649dc6c1cdc5a99641e14c77157967e140) --- lib/libcasper/services/cap_sysctl/cap_sysctl.3 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libcasper/services/cap_sysctl/cap_sysctl.3 b/lib/libcasper/services/cap_sysctl/cap_sysctl.3 index 5d840796515e..0a7d009e1c3c 100644 --- a/lib/libcasper/services/cap_sysctl/cap_sysctl.3 +++ b/lib/libcasper/services/cap_sysctl/cap_sysctl.3 @@ -131,8 +131,8 @@ capability to get the value of cap_channel_t *capcas, *capsysctl; const char *name = "kern.trap_enotcap"; void *limit; -int value; size_t size; +bool value; /* Open capability to Casper. */ capcas = cap_init(); @@ -160,6 +160,7 @@ if (cap_sysctl_limit(limit) < 0) err(1, "Unable to set limits"); /* Fetch value. */ +size = sizeof(value); if (cap_sysctlbyname(capsysctl, name, &value, &size, NULL, 0) < 0) err(1, "Unable to get value of sysctl"); From owner-dev-commits-src-all@freebsd.org Wed May 5 15:03:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CAEA5F9B77; Wed, 5 May 2021 15:03:05 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb0MF23lxz4RZK; Wed, 5 May 2021 15:03:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 39F4B26A7C; Wed, 5 May 2021 15:03:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145F35VL064293; Wed, 5 May 2021 15:03:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145F35km064292; Wed, 5 May 2021 15:03:05 GMT (envelope-from git) Date: Wed, 5 May 2021 15:03:05 GMT Message-Id: <202105051503.145F35km064292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 53a9046635f1 - stable/12 - pipe: Avoid calling selrecord() on a closing pipe MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 53a9046635f1856e549f28fba20d9ffc068fa81e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 15:03:05 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=53a9046635f1856e549f28fba20d9ffc068fa81e commit 53a9046635f1856e549f28fba20d9ffc068fa81e Author: Mark Johnston AuthorDate: 2021-04-28 14:42:59 +0000 Commit: Mark Johnston CommitDate: 2021-05-05 15:02:59 +0000 pipe: Avoid calling selrecord() on a closing pipe pipe_poll() may add the calling thread to the selinfo lists of both ends of a pipe. It is ok to do this for the local end, since we know we hold a reference on the file and so the local end is not closed. It is not ok to do this for the remote end, which may already be closed and have called seldrain(). In this scenario, when the polling thread wakes up, it may end up referencing a freed selinfo. Guard the selrecord() call appropriately. Reviewed by: kib Reported by: syzkaller+KASAN Differential Revision: https://reviews.freebsd.org/D30016 (cherry picked from commit d1e9441583fd85c7de5f48197d80c287f1a9494b) --- sys/kern/sys_pipe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index cb6c283d0e91..fefc16a9eb06 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1456,7 +1456,8 @@ pipe_poll(struct file *fp, int events, struct ucred *active_cred, rpipe->pipe_state |= PIPE_SEL; } - if ((fp->f_flag & FWRITE) != 0) { + if ((fp->f_flag & FWRITE) != 0 && + wpipe->pipe_present == PIPE_ACTIVE) { selrecord(td, &wpipe->pipe_sel); if (SEL_WAITING(&wpipe->pipe_sel)) wpipe->pipe_state |= PIPE_SEL; From owner-dev-commits-src-all@freebsd.org Wed May 5 15:22:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 539F05FA2DD; Wed, 5 May 2021 15:22:30 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb0nf1ykvz4S7D; Wed, 5 May 2021 15:22:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2C6CD2712D; Wed, 5 May 2021 15:22:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145FMUlK090701; Wed, 5 May 2021 15:22:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145FMUgw090700; Wed, 5 May 2021 15:22:30 GMT (envelope-from git) Date: Wed, 5 May 2021 15:22:30 GMT Message-Id: <202105051522.145FMUgw090700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 4e1e1d667fc8 - main - virtio_blk: Fix issuing T_GET_ID before DRIVER_OK status MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e1e1d667fc84460c131dfe617b39072e87473ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 15:22:30 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=4e1e1d667fc84460c131dfe617b39072e87473ab commit 4e1e1d667fc84460c131dfe617b39072e87473ab Author: Ka Ho Ng AuthorDate: 2021-05-05 15:16:29 +0000 Commit: Ka Ho Ng CommitDate: 2021-05-05 15:22:16 +0000 virtio_blk: Fix issuing T_GET_ID before DRIVER_OK status DRIVER_OK status is set after device_attach() succeeds. For now postpone disk_create to attach_completed() method. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Reviewed by: grehan Approved by: lwhsu (mentor) Differential Revision: https://reviews.freebsd.org/D30049 --- sys/dev/virtio/block/virtio_blk.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sys/dev/virtio/block/virtio_blk.c b/sys/dev/virtio/block/virtio_blk.c index 50642fb0b009..8a5558f4571d 100644 --- a/sys/dev/virtio/block/virtio_blk.c +++ b/sys/dev/virtio/block/virtio_blk.c @@ -126,6 +126,7 @@ static int vtblk_detach(device_t); static int vtblk_suspend(device_t); static int vtblk_resume(device_t); static int vtblk_shutdown(device_t); +static int vtblk_attach_completed(device_t); static int vtblk_config_change(device_t); static int vtblk_open(struct disk *); @@ -255,6 +256,7 @@ static device_method_t vtblk_methods[] = { DEVMETHOD(device_shutdown, vtblk_shutdown), /* VirtIO methods. */ + DEVMETHOD(virtio_attach_completed, vtblk_attach_completed), DEVMETHOD(virtio_config_change, vtblk_config_change), DEVMETHOD_END @@ -378,8 +380,6 @@ vtblk_attach(device_t dev) goto fail; } - vtblk_create_disk(sc); - virtqueue_enable_intr(sc->vtblk_vq); fail: @@ -461,6 +461,22 @@ vtblk_shutdown(device_t dev) return (0); } +static int +vtblk_attach_completed(device_t dev) +{ + struct vtblk_softc *sc; + + sc = device_get_softc(dev); + + /* + * Create disk after attach as VIRTIO_BLK_T_GET_ID can only be + * processed after the device acknowledged + * VIRTIO_CONFIG_STATUS_DRIVER_OK. + */ + vtblk_create_disk(sc); + return (0); +} + static int vtblk_config_change(device_t dev) { From owner-dev-commits-src-all@freebsd.org Wed May 5 17:47:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00CBE5FDFCF; Wed, 5 May 2021 17:47:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb40N6glyz4ZXS; Wed, 5 May 2021 17:47:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CD75812AC; Wed, 5 May 2021 17:47:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145Hl0lW076888; Wed, 5 May 2021 17:47:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145Hl0YV076887; Wed, 5 May 2021 17:47:00 GMT (envelope-from git) Date: Wed, 5 May 2021 17:47:00 GMT Message-Id: <202105051747.145Hl0YV076887@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: cb5880594387 - main - cam: Add doxygen docs to cam_sim_alloc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb5880594387d5b07c5d580c4aa1b633947a6046 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 17:47:01 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cb5880594387d5b07c5d580c4aa1b633947a6046 commit cb5880594387d5b07c5d580c4aa1b633947a6046 Author: Warner Losh AuthorDate: 2021-05-05 17:44:19 +0000 Commit: Warner Losh CommitDate: 2021-05-05 17:44:39 +0000 cam: Add doxygen docs to cam_sim_alloc Add description for what each of the parameters are to the cam_sim_alloc call. Add some additional context for the mtx and queue parameters to explain what special values passed in mean. MFC After: 3 days Reviewed by: mav@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30115 --- sys/cam/cam_sim.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/sys/cam/cam_sim.c b/sys/cam/cam_sim.c index e82332b999c3..5b6d43b81d5d 100644 --- a/sys/cam/cam_sim.c +++ b/sys/cam/cam_sim.c @@ -64,6 +64,42 @@ cam_simq_free(struct cam_devq *devq) cam_devq_free(devq); } + + +/** + * @brief allocate a new sim and fill in the details + * + * A Storage Interface Module (SIM) is the interface between CAM and + * hardware. SIM receives CCBs from CAM via @p sim_action callback and + * translates them into DMA or other hardware transactions. During system + * dumps, it can be polled with the @p sim_poll callback. CCB processing is + * terminated by calling @c xpt_done(). + * + * The @p mtx acts as a perimeter lock for the SIM. All calls into the SIM's + * @p sim_action are made with this lock held. It is also used to hold/release + * a SIM, managing its reference count. When the lock is NULL, the SIM is 100% + * responsible for locking (and the reference counting is done with a shared + * lock. + * + * The cam_devq passed in (@c queue) is used to arbitrate the number of + * outstanding transactions to the SIM. For HBAs that have global limits shared + * between the different buses, the same devq should be specified for each bus + * attached to the SIM. + * + * @param sim_action Function to call to process CCBs + * @param sim_poll Function to poll the hardware for completions + * @param sim_name Name of SIM class + * @param softc Software context associated with the SIM + * @param unit Unit number of SIM + * @param mtx Mutex to lock while interacting with the SIM, or NULL + * for a SIM that handle its own locking to enable multi + * queue support. + * @param max_dev_transactions Maximum number of concurrent untagged + * transactions possible + * @param max_tagged_dev_transactions Maximum number of concurrent tagged + * transactions possible. + * @param queue The cam_devq to use for this SIM. + */ struct cam_sim * cam_sim_alloc(sim_action_func sim_action, sim_poll_func sim_poll, const char *sim_name, void *softc, u_int32_t unit, From owner-dev-commits-src-all@freebsd.org Wed May 5 18:35:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C67385FEE79; Wed, 5 May 2021 18:35:24 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb54D4vRyz4cFW; Wed, 5 May 2021 18:35:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9B58418F6; Wed, 5 May 2021 18:35:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145IZOIm043456; Wed, 5 May 2021 18:35:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145IZOg9043455; Wed, 5 May 2021 18:35:24 GMT (envelope-from git) Date: Wed, 5 May 2021 18:35:24 GMT Message-Id: <202105051835.145IZOg9043455@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a512d0ab009e - main - kern: clarify boot time MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a512d0ab009eedf2f1876fce86d6386bfee626d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 18:35:24 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a512d0ab009eedf2f1876fce86d6386bfee626d8 commit a512d0ab009eedf2f1876fce86d6386bfee626d8 Author: Warner Losh AuthorDate: 2021-05-05 18:32:13 +0000 Commit: Warner Losh CommitDate: 2021-05-05 18:32:13 +0000 kern: clarify boot time In FreeBSD, the current time is computed from uptime + boottime. Uptime is a continuous, smooth function that's monotonically increasing. To effect changes to the current time, boottime is adjusted. boottime is mutable and shouldn't be cached against future need. Document the current implementation, with the caveat that we may stop stepping boottime on resume in the future and will step uptime instead (noted in the commit message, but not in the code). Sponsored by: Netflix Reviewed by: phk, rpokala Differential Revision: https://reviews.freebsd.org/D30116 --- share/man/man9/time.9 | 16 ++++++++++++++-- sys/kern/kern_tc.c | 8 +++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/share/man/man9/time.9 b/share/man/man9/time.9 index 4a2b2f7240e1..443608dd3f5b 100644 --- a/share/man/man9/time.9 +++ b/share/man/man9/time.9 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2004 +.Dd May 4, 2021 .Dt TIME 9 .Os .Sh NAME @@ -48,7 +48,18 @@ .Sh DESCRIPTION The .Va boottime -variable holds the system boot time. +variable holds the estimated system boot time. +This time is initially set when the system boots, either from the RTC, or from a +time estimated from the system's root filesystem. +When the current system time is set, stepped by +.Xr ntpd 8 , +or a new time is read from the RTC as the system resumes, +.Va boottime +is recomputed as new_time - uptime. +The +.Xr sysctl 8 +.Va kern.boottime +returns this value. .Pp The .Va time_second @@ -83,6 +94,7 @@ and in an atomic manner. The .Va boottime variable may be read and written without special precautions. +It is adjusted when the phase of the system time changes. .Sh SEE ALSO .Xr clock_settime 2 , .Xr ntp_adjtime 2 , diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index b1dcb18e31be..4d4e20ef1934 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -103,11 +103,17 @@ int tc_min_ticktock_freq = 1; volatile time_t time_second = 1; volatile time_t time_uptime = 1; +/* + * The system time is always computed by summing the estimated boot time and the + * system uptime. The timehands track boot time, but it changes when the system + * time is set by the user, stepped by ntpd or adjusted when resuming. It + * is set to new_time - uptime. + */ static int sysctl_kern_boottime(SYSCTL_HANDLER_ARGS); SYSCTL_PROC(_kern, KERN_BOOTTIME, boottime, CTLTYPE_STRUCT | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_kern_boottime, "S,timeval", - "System boottime"); + "Estimated system boottime"); SYSCTL_NODE(_kern, OID_AUTO, timecounter, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, ""); From owner-dev-commits-src-all@freebsd.org Wed May 5 20:59:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD86D62351A; Wed, 5 May 2021 20:59:36 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb8Gc4WzXz4jfW; Wed, 5 May 2021 20:59:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8E67B3AF8; Wed, 5 May 2021 20:59:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145Kxanf028723; Wed, 5 May 2021 20:59:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145KxadA028722; Wed, 5 May 2021 20:59:36 GMT (envelope-from git) Date: Wed, 5 May 2021 20:59:36 GMT Message-Id: <202105052059.145KxadA028722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d17e0940f79f - main - Rework compat shims in ifioctl(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d17e0940f79fd96a2bf27413c1fe682dd8ee5bac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 20:59:36 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d17e0940f79fd96a2bf27413c1fe682dd8ee5bac commit d17e0940f79fd96a2bf27413c1fe682dd8ee5bac Author: John Baldwin AuthorDate: 2021-05-05 20:58:23 +0000 Commit: John Baldwin CommitDate: 2021-05-05 20:58:23 +0000 Rework compat shims in ifioctl(). Centralize logic for handling compat ioctls into two blocks of code at the start and end of the ioctl routine. This avoids the conversion logic being spread out both in multiple blocks in ifioctl as well as various helper functions. Reviewed by: brooks, kib Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D29891 --- sys/net/if.c | 118 +++++++++++++++++++++++++---------------------------------- 1 file changed, 49 insertions(+), 69 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 1e410142747f..a3f5a8dc831a 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2917,38 +2917,6 @@ struct ifconf32 { }; #define SIOCGIFCONF32 _IOWR('i', 36, struct ifconf32) #endif - -#ifdef COMPAT_FREEBSD32 -static void -ifmr_init(struct ifmediareq *ifmr, caddr_t data) -{ - struct ifmediareq32 *ifmr32; - - ifmr32 = (struct ifmediareq32 *)data; - memcpy(ifmr->ifm_name, ifmr32->ifm_name, - sizeof(ifmr->ifm_name)); - ifmr->ifm_current = ifmr32->ifm_current; - ifmr->ifm_mask = ifmr32->ifm_mask; - ifmr->ifm_status = ifmr32->ifm_status; - ifmr->ifm_active = ifmr32->ifm_active; - ifmr->ifm_count = ifmr32->ifm_count; - ifmr->ifm_ulist = (int *)(uintptr_t)ifmr32->ifm_ulist; -} - -static void -ifmr_update(const struct ifmediareq *ifmr, caddr_t data) -{ - struct ifmediareq32 *ifmr32; - - ifmr32 = (struct ifmediareq32 *)data; - ifmr32->ifm_current = ifmr->ifm_current; - ifmr32->ifm_mask = ifmr->ifm_mask; - ifmr32->ifm_status = ifmr->ifm_status; - ifmr32->ifm_active = ifmr->ifm_active; - ifmr32->ifm_count = ifmr->ifm_count; -} -#endif - /* * Interface ioctls. */ @@ -2956,9 +2924,14 @@ int ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) { #ifdef COMPAT_FREEBSD32 - caddr_t saved_data = NULL; - struct ifmediareq ifmr; - struct ifmediareq *ifmrp = NULL; + union { + struct ifconf ifc; + struct ifmediareq ifmr; + } thunk; + caddr_t saved_data; + u_long saved_cmd; + struct ifconf32 *ifc32; + struct ifmediareq32 *ifmr32; #endif struct ifnet *ifp; struct ifreq *ifr; @@ -2978,41 +2951,40 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) } #endif - switch (cmd) { - case SIOCGIFCONF: - error = ifconf(cmd, data); - goto out_noref; - -#ifdef COMPAT_FREEBSD32 - case SIOCGIFCONF32: - { - struct ifconf32 *ifc32; - struct ifconf ifc; - - ifc32 = (struct ifconf32 *)data; - ifc.ifc_len = ifc32->ifc_len; - ifc.ifc_buf = PTRIN(ifc32->ifc_buf); - - error = ifconf(SIOCGIFCONF, (void *)&ifc); - if (error == 0) - ifc32->ifc_len = ifc.ifc_len; - goto out_noref; - } -#endif - } - #ifdef COMPAT_FREEBSD32 + saved_cmd = cmd; + saved_data = data; switch (cmd) { + case SIOCGIFCONF32: + ifc32 = (struct ifconf32 *)data; + thunk.ifc.ifc_len = ifc32->ifc_len; + thunk.ifc.ifc_buf = PTRIN(ifc32->ifc_buf); + data = (caddr_t)&thunk.ifc; + cmd = SIOCGIFCONF; + break; case SIOCGIFMEDIA32: case SIOCGIFXMEDIA32: - ifmrp = &ifmr; - ifmr_init(ifmrp, data); + ifmr32 = (struct ifmediareq32 *)data; + memcpy(thunk.ifmr.ifm_name, ifmr32->ifm_name, + sizeof(thunk.ifmr.ifm_name)); + thunk.ifmr.ifm_current = ifmr32->ifm_current; + thunk.ifmr.ifm_mask = ifmr32->ifm_mask; + thunk.ifmr.ifm_status = ifmr32->ifm_status; + thunk.ifmr.ifm_active = ifmr32->ifm_active; + thunk.ifmr.ifm_count = ifmr32->ifm_count; + thunk.ifmr.ifm_ulist = PTRIN(ifmr32->ifm_ulist); + data = (caddr_t)&thunk.ifmr; cmd = _IOC_NEWTYPE(cmd, struct ifmediareq); - saved_data = data; - data = (caddr_t)ifmrp; + break; } #endif + switch (cmd) { + case SIOCGIFCONF: + error = ifconf(cmd, data); + goto out_noref; + } + ifr = (struct ifreq *)data; switch (cmd) { #ifdef VIMAGE @@ -3102,16 +3074,24 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) out_ref: if_rele(ifp); out_noref: + CURVNET_RESTORE(); #ifdef COMPAT_FREEBSD32 - if (ifmrp != NULL) { - KASSERT((cmd == SIOCGIFMEDIA || cmd == SIOCGIFXMEDIA), - ("ifmrp non-NULL, but cmd is not an ifmedia req 0x%lx", - cmd)); - data = saved_data; - ifmr_update(ifmrp, data); + if (error != 0) + return (error); + switch (saved_cmd) { + case SIOCGIFCONF32: + ifc32->ifc_len = thunk.ifc.ifc_len; + break; + case SIOCGIFMEDIA32: + case SIOCGIFXMEDIA32: + ifmr32->ifm_current = thunk.ifmr.ifm_current; + ifmr32->ifm_mask = thunk.ifmr.ifm_mask; + ifmr32->ifm_status = thunk.ifmr.ifm_status; + ifmr32->ifm_active = thunk.ifmr.ifm_active; + ifmr32->ifm_count = thunk.ifmr.ifm_count; + break; } #endif - CURVNET_RESTORE(); return (error); } From owner-dev-commits-src-all@freebsd.org Wed May 5 20:59:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC3AC623261; Wed, 5 May 2021 20:59:37 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb8Gd5HNnz4kJw; Wed, 5 May 2021 20:59:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A6ABE3AF9; Wed, 5 May 2021 20:59:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145KxbxU028744; Wed, 5 May 2021 20:59:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145KxbLf028743; Wed, 5 May 2021 20:59:37 GMT (envelope-from git) Date: Wed, 5 May 2021 20:59:37 GMT Message-Id: <202105052059.145KxbLf028743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d61d98f4ed68 - main - Add freebsd32 compat shims for SIOC[GS]DRVSPEC. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d61d98f4ed68c5f6c81586a529057fe51fd50a60 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 20:59:37 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d61d98f4ed68c5f6c81586a529057fe51fd50a60 commit d61d98f4ed68c5f6c81586a529057fe51fd50a60 Author: John Baldwin AuthorDate: 2021-05-05 20:58:50 +0000 Commit: John Baldwin CommitDate: 2021-05-05 20:58:50 +0000 Add freebsd32 compat shims for SIOC[GS]DRVSPEC. Reviewed by: brooks, kib Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D29892 --- sys/net/if.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/sys/net/if.c b/sys/net/if.c index a3f5a8dc831a..2517c1f7e5bc 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -149,6 +149,15 @@ CTASSERT(sizeof(struct ifreq) == sizeof(struct ifreq32)); CTASSERT(__offsetof(struct ifreq, ifr_ifru) == __offsetof(struct ifreq32, ifr_ifru)); +struct ifdrv32 { + char ifd_name[IFNAMSIZ]; + uint32_t ifd_cmd; + uint32_t ifd_len; + uint32_t ifd_data; +}; +#define SIOCSDRVSPEC32 _IOC_NEWTYPE(SIOCSDRVSPEC, struct ifdrv32) +#define SIOCGDRVSPEC32 _IOC_NEWTYPE(SIOCGDRVSPEC, struct ifdrv32) + struct ifgroupreq32 { char ifgr_name[IFNAMSIZ]; u_int ifgr_len; @@ -2926,11 +2935,13 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) #ifdef COMPAT_FREEBSD32 union { struct ifconf ifc; + struct ifdrv ifd; struct ifmediareq ifmr; } thunk; caddr_t saved_data; u_long saved_cmd; struct ifconf32 *ifc32; + struct ifdrv32 *ifd32; struct ifmediareq32 *ifmr32; #endif struct ifnet *ifp; @@ -2962,6 +2973,17 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) data = (caddr_t)&thunk.ifc; cmd = SIOCGIFCONF; break; + case SIOCGDRVSPEC32: + case SIOCSDRVSPEC32: + ifd32 = (struct ifdrv32 *)data; + memcpy(thunk.ifd.ifd_name, ifd32->ifd_name, + sizeof(thunk.ifd.ifd_name)); + thunk.ifd.ifd_cmd = ifd32->ifd_cmd; + thunk.ifd.ifd_len = ifd32->ifd_len; + thunk.ifd.ifd_data = PTRIN(ifd32->ifd_data); + data = (caddr_t)&thunk.ifd; + cmd = _IOC_NEWTYPE(cmd, struct ifdrv); + break; case SIOCGIFMEDIA32: case SIOCGIFXMEDIA32: ifmr32 = (struct ifmediareq32 *)data; @@ -3082,6 +3104,17 @@ out_noref: case SIOCGIFCONF32: ifc32->ifc_len = thunk.ifc.ifc_len; break; + case SIOCGDRVSPEC32: + /* + * SIOCGDRVSPEC is IOWR, but nothing actually touches + * the struct so just assert that ifd_len (the only + * field it might make sense to update) hasn't + * changed. + */ + KASSERT(thunk.ifd.ifd_len == ifd32->ifd_len, + ("ifd_len was updated %u -> %zu", ifd32->ifd_len, + thunk.ifd.ifd_len)); + break; case SIOCGIFMEDIA32: case SIOCGIFXMEDIA32: ifmr32->ifm_current = thunk.ifmr.ifm_current; From owner-dev-commits-src-all@freebsd.org Wed May 5 20:59:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 114EB6233FB; Wed, 5 May 2021 20:59:40 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb8Gg6vM6z4kGm; Wed, 5 May 2021 20:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DED1C3AFA; Wed, 5 May 2021 20:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145KxdBl028786; Wed, 5 May 2021 20:59:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145Kxd4r028785; Wed, 5 May 2021 20:59:39 GMT (envelope-from git) Date: Wed, 5 May 2021 20:59:39 GMT Message-Id: <202105052059.145Kxd4r028785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 9c87db4b3c5b - main - Group all compat shim structures together to consolidate #ifdef's. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c87db4b3c5b119809c7ff12d20ecbfd62f01996 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 20:59:40 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9c87db4b3c5b119809c7ff12d20ecbfd62f01996 commit 9c87db4b3c5b119809c7ff12d20ecbfd62f01996 Author: John Baldwin AuthorDate: 2021-05-05 20:59:09 +0000 Commit: John Baldwin CommitDate: 2021-05-05 20:59:09 +0000 Group all compat shim structures together to consolidate #ifdef's. Reviewed by: brooks, kib Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D29894 --- sys/net/if.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 9b461a15a57a..e444faa54cb0 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -149,6 +149,15 @@ CTASSERT(sizeof(struct ifreq) == sizeof(struct ifreq32)); CTASSERT(__offsetof(struct ifreq, ifr_ifru) == __offsetof(struct ifreq32, ifr_ifru)); +struct ifconf32 { + int32_t ifc_len; + union { + uint32_t ifcu_buf; + uint32_t ifcu_req; + } ifc_ifcu; +}; +#define SIOCGIFCONF32 _IOWR('i', 36, struct ifconf32) + struct ifdrv32 { char ifd_name[IFNAMSIZ]; uint32_t ifd_cmd; @@ -2879,16 +2888,6 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) return (error); } -#ifdef COMPAT_FREEBSD32 -struct ifconf32 { - int32_t ifc_len; - union { - uint32_t ifcu_buf; - uint32_t ifcu_req; - } ifc_ifcu; -}; -#define SIOCGIFCONF32 _IOWR('i', 36, struct ifconf32) -#endif /* * Interface ioctls. */ From owner-dev-commits-src-all@freebsd.org Wed May 5 20:59:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33E5662351C; Wed, 5 May 2021 20:59:39 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb8Gf6br5z4kK2; Wed, 5 May 2021 20:59:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D1A8A3D94; Wed, 5 May 2021 20:59:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145KxccF028765; Wed, 5 May 2021 20:59:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145Kxcxr028764; Wed, 5 May 2021 20:59:38 GMT (envelope-from git) Date: Wed, 5 May 2021 20:59:38 GMT Message-Id: <202105052059.145Kxcxr028764@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 01e9cbc4c56d - main - Use thunks for compat ioctls using struct ifgroupreq. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 01e9cbc4c56d6eecc52f1e4547d56124243f0dd2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 20:59:39 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=01e9cbc4c56d6eecc52f1e4547d56124243f0dd2 commit 01e9cbc4c56d6eecc52f1e4547d56124243f0dd2 Author: John Baldwin AuthorDate: 2021-05-05 20:59:00 +0000 Commit: John Baldwin CommitDate: 2021-05-05 20:59:00 +0000 Use thunks for compat ioctls using struct ifgroupreq. Reviewed by: brooks, kib Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D29893 --- sys/net/if.c | 99 +++++++++++++++++++++++++++--------------------------------- sys/net/if.h | 2 -- 2 files changed, 45 insertions(+), 56 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 2517c1f7e5bc..9b461a15a57a 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -166,6 +166,10 @@ struct ifgroupreq32 { uint32_t ifgru_groups; } ifgr_ifgru; }; +#define SIOCAIFGROUP32 _IOC_NEWTYPE(SIOCAIFGROUP, struct ifgroupreq32) +#define SIOCGIFGROUP32 _IOC_NEWTYPE(SIOCGIFGROUP, struct ifgroupreq32) +#define SIOCDIFGROUP32 _IOC_NEWTYPE(SIOCDIFGROUP, struct ifgroupreq32) +#define SIOCGIFGMEMB32 _IOC_NEWTYPE(SIOCGIFGMEMB, struct ifgroupreq32) struct ifmediareq32 { char ifm_name[IFNAMSIZ]; @@ -178,16 +182,7 @@ struct ifmediareq32 { }; #define SIOCGIFMEDIA32 _IOC_NEWTYPE(SIOCGIFMEDIA, struct ifmediareq32) #define SIOCGIFXMEDIA32 _IOC_NEWTYPE(SIOCGIFXMEDIA, struct ifmediareq32) - -#define _CASE_IOC_IFGROUPREQ_32(cmd) \ - _IOC_NEWTYPE((cmd), struct ifgroupreq32): case -#else /* !COMPAT_FREEBSD32 */ -#define _CASE_IOC_IFGROUPREQ_32(cmd) -#endif /* !COMPAT_FREEBSD32 */ - -#define CASE_IOC_IFGROUPREQ(cmd) \ - _CASE_IOC_IFGROUPREQ_32(cmd) \ - (cmd) +#endif /* COMPAT_FREEBSD32 */ union ifreq_union { struct ifreq ifr; @@ -196,13 +191,6 @@ union ifreq_union { #endif }; -union ifgroupreq_union { - struct ifgroupreq ifgr; -#ifdef COMPAT_FREEBSD32 - struct ifgroupreq32 ifgr32; -#endif -}; - SYSCTL_NODE(_net, PF_LINK, link, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Link layers"); SYSCTL_NODE(_net_link, 0, generic, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, @@ -1663,33 +1651,6 @@ if_delgroups(struct ifnet *ifp) IFNET_WUNLOCK(); } -static char * -ifgr_group_get(void *ifgrp) -{ - union ifgroupreq_union *ifgrup; - - ifgrup = ifgrp; -#ifdef COMPAT_FREEBSD32 - if (SV_CURPROC_FLAG(SV_ILP32)) - return (&ifgrup->ifgr32.ifgr_ifgru.ifgru_group[0]); -#endif - return (&ifgrup->ifgr.ifgr_ifgru.ifgru_group[0]); -} - -static struct ifg_req * -ifgr_groups_get(void *ifgrp) -{ - union ifgroupreq_union *ifgrup; - - ifgrup = ifgrp; -#ifdef COMPAT_FREEBSD32 - if (SV_CURPROC_FLAG(SV_ILP32)) - return ((struct ifg_req *)(uintptr_t) - ifgrup->ifgr32.ifgr_ifgru.ifgru_groups); -#endif - return (ifgrup->ifgr.ifgr_ifgru.ifgru_groups); -} - /* * Stores all groups from an interface in memory pointed to by ifgr. */ @@ -1709,7 +1670,7 @@ if_getgroup(struct ifgroupreq *ifgr, struct ifnet *ifp) } len = ifgr->ifgr_len; - ifgp = ifgr_groups_get(ifgr); + ifgp = ifgr->ifgr_groups; /* XXX: wire */ CK_STAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next) { if (len < sizeof(ifgrq)) @@ -1754,7 +1715,7 @@ if_getgroupmembers(struct ifgroupreq *ifgr) } len = ifgr->ifgr_len; - ifgp = ifgr_groups_get(ifgr); + ifgp = ifgr->ifgr_groups; CK_STAILQ_FOREACH(ifgm, &ifg->ifg_members, ifgm_next) { if (len < sizeof(ifgrq)) { IFNET_RUNLOCK(); @@ -2881,16 +2842,17 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) error = if_gethwaddr(ifp, ifr); break; - case CASE_IOC_IFGROUPREQ(SIOCAIFGROUP): + case SIOCAIFGROUP: error = priv_check(td, PRIV_NET_ADDIFGROUP); if (error) return (error); - if ((error = if_addgroup(ifp, - ifgr_group_get((struct ifgroupreq *)data)))) + error = if_addgroup(ifp, + ((struct ifgroupreq *)data)->ifgr_group); + if (error != 0) return (error); break; - case CASE_IOC_IFGROUPREQ(SIOCGIFGROUP): + case SIOCGIFGROUP: { struct epoch_tracker et; @@ -2900,12 +2862,13 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) break; } - case CASE_IOC_IFGROUPREQ(SIOCDIFGROUP): + case SIOCDIFGROUP: error = priv_check(td, PRIV_NET_DELIFGROUP); if (error) return (error); - if ((error = if_delgroup(ifp, - ifgr_group_get((struct ifgroupreq *)data)))) + error = if_delgroup(ifp, + ((struct ifgroupreq *)data)->ifgr_group); + if (error != 0) return (error); break; @@ -2936,12 +2899,14 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) union { struct ifconf ifc; struct ifdrv ifd; + struct ifgroupreq ifgr; struct ifmediareq ifmr; } thunk; caddr_t saved_data; u_long saved_cmd; struct ifconf32 *ifc32; struct ifdrv32 *ifd32; + struct ifgroupreq32 *ifgr32; struct ifmediareq32 *ifmr32; #endif struct ifnet *ifp; @@ -2984,6 +2949,28 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) data = (caddr_t)&thunk.ifd; cmd = _IOC_NEWTYPE(cmd, struct ifdrv); break; + case SIOCAIFGROUP32: + case SIOCGIFGROUP32: + case SIOCDIFGROUP32: + case SIOCGIFGMEMB32: + ifgr32 = (struct ifgroupreq32 *)data; + memcpy(thunk.ifgr.ifgr_name, ifgr32->ifgr_name, + sizeof(thunk.ifgr.ifgr_name)); + thunk.ifgr.ifgr_len = ifgr32->ifgr_len; + switch (cmd) { + case SIOCAIFGROUP32: + case SIOCDIFGROUP32: + memcpy(thunk.ifgr.ifgr_group, ifgr32->ifgr_group, + sizeof(thunk.ifgr.ifgr_group)); + break; + case SIOCGIFGROUP32: + case SIOCGIFGMEMB32: + thunk.ifgr.ifgr_groups = PTRIN(ifgr32->ifgr_groups); + break; + } + data = (caddr_t)&thunk.ifgr; + cmd = _IOC_NEWTYPE(cmd, struct ifgroupreq); + break; case SIOCGIFMEDIA32: case SIOCGIFXMEDIA32: ifmr32 = (struct ifmediareq32 *)data; @@ -3039,7 +3026,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) error = if_clone_list((struct if_clonereq *)data); goto out_noref; - case CASE_IOC_IFGROUPREQ(SIOCGIFGMEMB): + case SIOCGIFGMEMB: error = if_getgroupmembers((struct ifgroupreq *)data); goto out_noref; @@ -3115,6 +3102,10 @@ out_noref: ("ifd_len was updated %u -> %zu", ifd32->ifd_len, thunk.ifd.ifd_len)); break; + case SIOCGIFGROUP32: + case SIOCGIFGMEMB32: + ifgr32->ifgr_len = thunk.ifgr.ifgr_len; + break; case SIOCGIFMEDIA32: case SIOCGIFXMEDIA32: ifmr32->ifm_current = thunk.ifmr.ifm_current; diff --git a/sys/net/if.h b/sys/net/if.h index e6073563bce2..782e792cf87c 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -530,10 +530,8 @@ struct ifgroupreq { char ifgru_group[IFNAMSIZ]; struct ifg_req *ifgru_groups; } ifgr_ifgru; -#ifndef _KERNEL #define ifgr_group ifgr_ifgru.ifgru_group #define ifgr_groups ifgr_ifgru.ifgru_groups -#endif }; /* From owner-dev-commits-src-all@freebsd.org Wed May 5 21:11:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29C69623584; Wed, 5 May 2021 21:11:49 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb8Xj0jRgz4l0Y; Wed, 5 May 2021 21:11:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0B498415E; Wed, 5 May 2021 21:11:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145LBm8W054230; Wed, 5 May 2021 21:11:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145LBmvP054229; Wed, 5 May 2021 21:11:48 GMT (envelope-from git) Date: Wed, 5 May 2021 21:11:48 GMT Message-Id: <202105052111.145LBmvP054229@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a2bc17474b96 - main - Disable building svnlite(1) by default. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2bc17474b962ba9e29c4526356203fe48a549eb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 21:11:49 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a2bc17474b962ba9e29c4526356203fe48a549eb commit a2bc17474b962ba9e29c4526356203fe48a549eb Author: John Baldwin AuthorDate: 2021-05-05 21:05:10 +0000 Commit: John Baldwin CommitDate: 2021-05-05 21:11:13 +0000 Disable building svnlite(1) by default. Now that all repositories have switched to git, initiate the de-orbit burn for svnlite(1). Reviewed by: emaste MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D30105 --- share/mk/src.opts.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 619aa8f4a1d8..71e60e676803 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -173,7 +173,6 @@ __DEFAULT_YES_OPTIONS = \ SOURCELESS_HOST \ SOURCELESS_UCODE \ STATS \ - SVNLITE \ SYSCONS \ SYSTEM_COMPILER \ SYSTEM_LINKER \ @@ -213,6 +212,7 @@ __DEFAULT_NO_OPTIONS = \ RPCBIND_WARMSTART_SUPPORT \ SORT_THREADS \ SVN \ + SVNLITE \ ZONEINFO_LEAPSECONDS_SUPPORT \ # LEFT/RIGHT. Left options which default to "yes" unless their corresponding From owner-dev-commits-src-all@freebsd.org Wed May 5 21:11:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59C79623869; Wed, 5 May 2021 21:11:50 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb8Xk1w3Rz4l0Z; Wed, 5 May 2021 21:11:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 303DE3E4A; Wed, 5 May 2021 21:11:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145LBojT054251; Wed, 5 May 2021 21:11:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145LBoMk054250; Wed, 5 May 2021 21:11:50 GMT (envelope-from git) Date: Wed, 5 May 2021 21:11:50 GMT Message-Id: <202105052111.145LBoMk054250@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 0ac711e07ece - main - Add a description for WITH_SVNLITE. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ac711e07ece9ac260023a62250d50fb2f37e975 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 21:11:50 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0ac711e07ece9ac260023a62250d50fb2f37e975 commit 0ac711e07ece9ac260023a62250d50fb2f37e975 Author: John Baldwin AuthorDate: 2021-05-05 21:05:38 +0000 Commit: John Baldwin CommitDate: 2021-05-05 21:11:32 +0000 Add a description for WITH_SVNLITE. Reviewed by: emaste MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D30106 --- tools/build/options/WITH_SVNLITE | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/build/options/WITH_SVNLITE b/tools/build/options/WITH_SVNLITE new file mode 100644 index 000000000000..25aeec40fab1 --- /dev/null +++ b/tools/build/options/WITH_SVNLITE @@ -0,0 +1,3 @@ +Build +.Xr svnlite 1 +and related programs. From owner-dev-commits-src-all@freebsd.org Wed May 5 21:11:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FC9B6239A4; Wed, 5 May 2021 21:11:51 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb8Xl3NGZz4l0f; Wed, 5 May 2021 21:11:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 56658415F; Wed, 5 May 2021 21:11:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145LBpJ0054279; Wed, 5 May 2021 21:11:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145LBp71054278; Wed, 5 May 2021 21:11:51 GMT (envelope-from git) Date: Wed, 5 May 2021 21:11:51 GMT Message-Id: <202105052111.145LBp71054278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 1b2806931ae3 - main - src.conf.5: Regen. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1b2806931ae33d1f70ae1e7e88f7f02217d5bb71 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 21:11:51 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1b2806931ae33d1f70ae1e7e88f7f02217d5bb71 commit 1b2806931ae33d1f70ae1e7e88f7f02217d5bb71 Author: John Baldwin AuthorDate: 2021-05-05 21:05:53 +0000 Commit: John Baldwin CommitDate: 2021-05-05 21:11:33 +0000 src.conf.5: Regen. Reviewed by: emaste MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D30107 --- share/man/man5/src.conf.5 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index fede8aea2ba8..0fe0df58144d 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd April 9, 2021 +.Dd May 5, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1508,8 +1508,8 @@ Install .Xr svnlite 1 as .Xr svn 1 . -.It Va WITHOUT_SVNLITE -Do not build +.It Va WITH_SVNLITE +Build .Xr svnlite 1 and related programs. .It Va WITHOUT_SYSCONS From owner-dev-commits-src-all@freebsd.org Wed May 5 21:13:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDCF5623976; Wed, 5 May 2021 21:13:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb8Z75yMHz4l6R; Wed, 5 May 2021 21:13:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BF65D3E5F; Wed, 5 May 2021 21:13:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145LD3RG055196; Wed, 5 May 2021 21:13:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145LD3eX055195; Wed, 5 May 2021 21:13:03 GMT (envelope-from git) Date: Wed, 5 May 2021 21:13:03 GMT Message-Id: <202105052113.145LD3eX055195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 9a7c2de36460 - main - realloc: Fix KASAN(9) shadow map updates MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9a7c2de36460cdb916734a6969aac666707a639b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 21:13:03 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9a7c2de36460cdb916734a6969aac666707a639b commit 9a7c2de36460cdb916734a6969aac666707a639b Author: Mark Johnston AuthorDate: 2021-05-05 21:05:46 +0000 Commit: Mark Johnston CommitDate: 2021-05-05 21:12:51 +0000 realloc: Fix KASAN(9) shadow map updates When copying from the old buffer to the new buffer, we don't know the requested size of the old allocation, but only the size of the allocation provided by UMA. This value is "alloc". Because the copy may access bytes in the old allocation's red zone, we must mark the full allocation valid in the shadow map. Do so using the correct size. Reported by: kp Tested by: kp Sponsored by: The FreeBSD Foundation --- sys/kern/kern_malloc.c | 2 +- sys/vm/uma_core.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index e2a05c004637..75cbc2a0fd04 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1024,7 +1024,7 @@ realloc(void *addr, size_t size, struct malloc_type *mtp, int flags) * Copy over original contents. For KASAN, the redzone must be marked * valid before performing the copy. */ - kasan_mark(addr, size, size, 0); + kasan_mark(addr, alloc, alloc, 0); bcopy(addr, newaddr, min(size, alloc)); free(addr, mtp); return (newaddr); diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index a85b88b24110..d2e01f3a0605 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -540,6 +540,9 @@ bucket_zone_drain(int domain) } #ifdef KASAN +_Static_assert(UMA_SMALLEST_UNIT % KASAN_SHADOW_SCALE == 0, + "Base UMA allocation size not a multiple of the KASAN scale factor"); + static void kasan_mark_item_valid(uma_zone_t zone, void *item) { From owner-dev-commits-src-all@freebsd.org Wed May 5 21:13:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14237623AF1; Wed, 5 May 2021 21:13:05 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb8Z873hzz4l1T; Wed, 5 May 2021 21:13:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E36BD4176; Wed, 5 May 2021 21:13:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145LD48f055217; Wed, 5 May 2021 21:13:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145LD4kS055216; Wed, 5 May 2021 21:13:04 GMT (envelope-from git) Date: Wed, 5 May 2021 21:13:04 GMT Message-Id: <202105052113.145LD4kS055216@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 6c34dde83ee6 - main - igmp: Avoid an out-of-bounds access when zeroing counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6c34dde83ee61fc0ba095dcfdac2f381f6bae007 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 21:13:05 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6c34dde83ee61fc0ba095dcfdac2f381f6bae007 commit 6c34dde83ee61fc0ba095dcfdac2f381f6bae007 Author: Mark Johnston AuthorDate: 2021-05-05 21:06:23 +0000 Commit: Mark Johnston CommitDate: 2021-05-05 21:12:51 +0000 igmp: Avoid an out-of-bounds access when zeroing counters When verifying, byte-by-byte, that the user-supplied counters are zero-filled, sysctl_igmp_stat() would check for zero before checking the loop bound. Perform the checks in the correct order. Reported by: KASAN MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/netinet/igmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index 21bce1ff885a..ef0da5e5cb46 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -382,7 +382,7 @@ sysctl_igmp_stat(SYSCTL_HANDLER_ARGS) * igps0 must be "all zero". */ p = (char *)&igps0; - while (*p == '\0' && p < (char *)&igps0 + sizeof(igps0)) + while (p < (char *)&igps0 + sizeof(igps0) && *p == '\0') p++; if (p != (char *)&igps0 + sizeof(igps0)) { error = EINVAL; From owner-dev-commits-src-all@freebsd.org Wed May 5 21:13:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33704623E91; Wed, 5 May 2021 21:13:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb8Zy0zhpz4lLH; Wed, 5 May 2021 21:13:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0B370429D; Wed, 5 May 2021 21:13:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145LDjLs055387; Wed, 5 May 2021 21:13:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145LDjbh055386; Wed, 5 May 2021 21:13:45 GMT (envelope-from git) Date: Wed, 5 May 2021 21:13:45 GMT Message-Id: <202105052113.145LDjbh055386@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f009aedae4d0 - main - bsnmpd: Return the correct uptime. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f009aedae4d054819848ab3f7ef1b846c4d35d3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 21:13:46 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f009aedae4d054819848ab3f7ef1b846c4d35d3c commit f009aedae4d054819848ab3f7ef1b846c4d35d3c Author: Warner Losh AuthorDate: 2021-05-05 21:11:56 +0000 Commit: Warner Losh CommitDate: 2021-05-05 21:12:38 +0000 bsnmpd: Return the correct uptime. Do not assume that the kernel boot time is invariant. It is not. FreeBSD uses the formula: wall_time = boot_time + uptime where uptime is monotinically increasing and boot_time is adjusted to get the proper time of day. FreeBSD offers a way to retrieve the uptime directly, so use that instead of trying to compute it by subtracting boot_time from wall_time. Sponsored by: Netflix Reviewed by: cy@ Differential Revision: https://reviews.freebsd.org/D30114 --- .../bsnmpd/modules/snmp_hostres/hostres_scalars.c | 37 ++++------------------ 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c index 6634ae271a45..872b8a5da329 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c @@ -47,9 +47,6 @@ #include "hostres_oid.h" #include "hostres_tree.h" -/* boot timestamp in centi-seconds */ -static uint64_t kernel_boot; - /* physical memory size in Kb */ static uint64_t phys_mem_size; @@ -76,39 +73,19 @@ fini_scalars(void) static int OS_getSystemUptime(uint32_t *ut) { - struct timeval right_now; - uint64_t now; - - if (kernel_boot == 0) { - /* first time, do the sysctl */ - struct timeval kernel_boot_timestamp; - int mib[2] = { CTL_KERN, KERN_BOOTTIME }; - size_t len = sizeof(kernel_boot_timestamp); - - if (sysctl(mib, nitems(mib), &kernel_boot_timestamp, - &len, NULL, 0) == -1) { - syslog(LOG_ERR, "sysctl KERN_BOOTTIME failed: %m"); - return (SNMP_ERR_GENERR); - } + uint64_t uptime; + struct timespec ts; - HRDBG("boot timestamp from kernel: {%lld, %ld}", - (long long)kernel_boot_timestamp.tv_sec, - (long)kernel_boot_timestamp.tv_usec); - - kernel_boot = ((uint64_t)kernel_boot_timestamp.tv_sec * 100) + - (kernel_boot_timestamp.tv_usec / 10000); - } - - if (gettimeofday(&right_now, NULL) < 0) { - syslog(LOG_ERR, "gettimeofday failed: %m"); + if (clock_gettime(CLOCK_UPTIME, &ts)) { + syslog(LOG_ERR, "clock_gettime failed: %m"); return (SNMP_ERR_GENERR); } - now = ((uint64_t)right_now.tv_sec * 100) + (right_now.tv_usec / 10000); - if (now - kernel_boot > UINT32_MAX) + uptime = ts.tv_sec * 100 + ts.tv_nsec / 1000000; + if (uptime > UINT32_MAX) *ut = UINT32_MAX; else - *ut = now - kernel_boot; + *ut = (uint32_t)uptime; return (SNMP_ERR_NOERROR); } From owner-dev-commits-src-all@freebsd.org Wed May 5 21:21:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B647623E41; Wed, 5 May 2021 21:21:17 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb8ld37qbz4lM5; Wed, 5 May 2021 21:21:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5F3F33B95; Wed, 5 May 2021 21:21:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145LLHMD068685; Wed, 5 May 2021 21:21:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145LLHem068684; Wed, 5 May 2021 21:21:17 GMT (envelope-from git) Date: Wed, 5 May 2021 21:21:17 GMT Message-Id: <202105052121.145LLHem068684@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: d00aff627828 - main - provide easy way to disable kld_list loading MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d00aff627828ef69d7333537e3a81b47bfa1a8e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 21:21:17 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d00aff627828ef69d7333537e3a81b47bfa1a8e8 commit d00aff627828ef69d7333537e3a81b47bfa1a8e8 Author: Warner Losh AuthorDate: 2020-10-25 06:22:43 +0000 Commit: Warner Losh CommitDate: 2021-05-05 21:19:41 +0000 provide easy way to disable kld_list loading set kld_disbale=y or any value in the boot loader and that will disable loading of the kld_list. Differential Revision: https://reviews.freebsd.org/D26939 --- libexec/rc/rc.d/kld | 1 + 1 file changed, 1 insertion(+) diff --git a/libexec/rc/rc.d/kld b/libexec/rc/rc.d/kld index d3829efe824a..e9a8e6d37a08 100755 --- a/libexec/rc/rc.d/kld +++ b/libexec/rc/rc.d/kld @@ -41,6 +41,7 @@ stop_cmd=':' kld_start() { [ -n "$kld_list" ] || return + [ -z "$(kenv -q kld_disable 2>/dev/null)" ] || return local _kld From owner-dev-commits-src-all@freebsd.org Wed May 5 21:27:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C274624310; Wed, 5 May 2021 21:27: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fb8tr29tWz4lmy; Wed, 5 May 2021 21:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3960C43AB; Wed, 5 May 2021 21:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145LRWd1069338; Wed, 5 May 2021 21:27:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145LRW0x069337; Wed, 5 May 2021 21:27:32 GMT (envelope-from git) Date: Wed, 5 May 2021 21:27:32 GMT Message-Id: <202105052127.145LRW0x069337@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 097e8701c9fc - main - fix style nit: space after if MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 097e8701c9fc0d56caa8c9dad64a77d8ffa1cf2c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 21:27:32 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=097e8701c9fc0d56caa8c9dad64a77d8ffa1cf2c commit 097e8701c9fc0d56caa8c9dad64a77d8ffa1cf2c Author: Warner Losh AuthorDate: 2021-05-05 21:26:09 +0000 Commit: Warner Losh CommitDate: 2021-05-05 21:26:09 +0000 fix style nit: space after if --- sys/ddb/db_expr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/ddb/db_expr.c b/sys/ddb/db_expr.c index 340951089248..60fa463dc5dc 100644 --- a/sys/ddb/db_expr.c +++ b/sys/ddb/db_expr.c @@ -125,7 +125,7 @@ db_unary(db_expr_t *valuep) return (true); } if (t == tEXCL) { - if(!db_unary(valuep)) { + if (!db_unary(valuep)) { db_printf("Expression syntax error after '%c'\n", '!'); db_error(NULL); /* NOTREACHED */ @@ -134,7 +134,7 @@ db_unary(db_expr_t *valuep) return (true); } if (t == tBIT_NOT) { - if(!db_unary(valuep)) { + if (!db_unary(valuep)) { db_printf("Expression syntax error after '%c'\n", '~'); db_error(NULL); /* NOTREACHED */ From owner-dev-commits-src-all@freebsd.org Wed May 5 23:03:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B98DB625E7A; Wed, 5 May 2021 23:03:51 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbC1z4tyqz4q6Y; Wed, 5 May 2021 23:03:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9ACC65657; Wed, 5 May 2021 23:03:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 145N3psc001648; Wed, 5 May 2021 23:03:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 145N3pPh001647; Wed, 5 May 2021 23:03:51 GMT (envelope-from git) Date: Wed, 5 May 2021 23:03:51 GMT Message-Id: <202105052303.145N3pPh001647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: d1cb8d11b0c0 - main - sctp: improve consistency when handling chunks of wrong size MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d1cb8d11b0c09c35b87c144bab7b02b75c5725b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 23:03:51 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=d1cb8d11b0c09c35b87c144bab7b02b75c5725b6 commit d1cb8d11b0c09c35b87c144bab7b02b75c5725b6 Author: Michael Tuexen AuthorDate: 2021-05-05 23:02:41 +0000 Commit: Michael Tuexen CommitDate: 2021-05-05 23:02:41 +0000 sctp: improve consistency when handling chunks of wrong size MFC after: 3 days --- sys/netinet/sctp_input.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index e1f096ea5817..050f30d145b7 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -4840,11 +4840,12 @@ process_control_chunks: break; case SCTP_SHUTDOWN_ACK: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN_ACK, stcb %p\n", (void *)stcb); - if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { + if ((chk_length == sizeof(struct sctp_shutdown_ack_chunk)) && + (stcb != NULL) && (netp != NULL) && (*netp != NULL)) { sctp_handle_shutdown_ack((struct sctp_shutdown_ack_chunk *)ch, stcb, *netp); + *offset = length; + return (NULL); } - *offset = length; - return (NULL); break; case SCTP_OPERATION_ERROR: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_OP_ERR\n"); @@ -5032,12 +5033,13 @@ process_control_chunks: *offset = length; return (stcb); } - if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { + if ((chk_length == sizeof(struct sctp_shutdown_complete_chunk)) && + (stcb != NULL) && (netp != NULL) && (*netp != NULL)) { sctp_handle_shutdown_complete((struct sctp_shutdown_complete_chunk *)ch, stcb, *netp); + *offset = length; + return (NULL); } - *offset = length; - return (NULL); break; case SCTP_ASCONF: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ASCONF\n"); From owner-dev-commits-src-all@freebsd.org Thu May 6 00:12:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62FF16299B4 for ; Thu, 6 May 2021 00:12:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbDYV2P8gz4vQN; Thu, 6 May 2021 00:12:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 454D967B6; Thu, 6 May 2021 00:12:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1460CkWj093903; Thu, 6 May 2021 00:12:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1460CkLR093902; Thu, 6 May 2021 00:12:46 GMT (envelope-from git) Date: Thu, 6 May 2021 00:12:46 GMT Message-Id: <202105060012.1460CkLR093902@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: acc9e82dfd3b - internal/admin - Safekeep src bit of kan@ Approved by: core MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: acc9e82dfd3b5772a38704e79ab7d0f526f6179c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 00:12:46 -0000 The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=acc9e82dfd3b5772a38704e79ab7d0f526f6179c commit acc9e82dfd3b5772a38704e79ab7d0f526f6179c Author: Muhammad Moinur Rahman AuthorDate: 2021-05-06 00:11:55 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-05-06 00:11:55 +0000 Safekeep src bit of kan@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 0325f69f7fc1..97b50de9da8a 100644 --- a/access +++ b/access @@ -108,7 +108,6 @@ jtl julian kadesai kaktus -kan karels ken kevans From owner-dev-commits-src-all@freebsd.org Thu May 6 01:57:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB4F162E999; Thu, 6 May 2021 01:57:52 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbGtm5P2lz3HYP; Thu, 6 May 2021 01:57:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AC1587F2E; Thu, 6 May 2021 01:57:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1461vq2j026775; Thu, 6 May 2021 01:57:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1461vqQq026774; Thu, 6 May 2021 01:57:52 GMT (envelope-from git) Date: Thu, 6 May 2021 01:57:52 GMT Message-Id: <202105060157.1461vqQq026774@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 664057961085 - main - msun fixes for SPE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6640579610856168a64e12c097ce012c46648e00 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 01:57:52 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=6640579610856168a64e12c097ce012c46648e00 commit 6640579610856168a64e12c097ce012c46648e00 Author: Justin Hibbits AuthorDate: 2021-05-05 14:20:56 +0000 Commit: Justin Hibbits CommitDate: 2021-05-06 01:57:33 +0000 msun fixes for SPE Summary: Fix FPU exception management for powerpcspe. Bits are in a different place from the standard FPSCR, so we need to handle the shifting differences. Also, there's no concept of a "software exception" raise, so we need to do exceptional math to trigger the exception from software. Reviewed By: alfredo Differential Revision: https://reviews.freebsd.org/D22824 --- lib/msun/powerpc/fenv.c | 30 ++++++++++++++++++++++++++++++ lib/msun/powerpc/fenv.h | 19 ++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/lib/msun/powerpc/fenv.c b/lib/msun/powerpc/fenv.c index b7e611ed99a0..7f7d98515995 100644 --- a/lib/msun/powerpc/fenv.c +++ b/lib/msun/powerpc/fenv.c @@ -30,6 +30,10 @@ #define __fenv_static #include "fenv.h" +#ifdef __SPE__ +#include +#include +#endif #ifdef __GNUC_GNU_INLINE__ #error "This file must be compiled with C99 'inline' semantics" @@ -40,7 +44,9 @@ const fenv_t __fe_dfl_env = 0x00000000; extern inline int feclearexcept(int __excepts); extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts); +#ifndef __SPE__ extern inline int feraiseexcept(int __excepts); +#endif extern inline int fetestexcept(int __excepts); extern inline int fegetround(void); extern inline int fesetround(int __round); @@ -48,3 +54,27 @@ extern inline int fegetenv(fenv_t *__envp); extern inline int feholdexcept(fenv_t *__envp); extern inline int fesetenv(const fenv_t *__envp); extern inline int feupdateenv(const fenv_t *__envp); + +#ifdef __SPE__ +#define PMAX 0x7f7fffff +#define PMIN 0x00800000 +int feraiseexcept(int __excepts) +{ + uint32_t spefscr; + + spefscr = mfspr(SPR_SPEFSCR); + mtspr(SPR_SPEFSCR, spefscr | (__excepts & FE_ALL_EXCEPT)); + + if (__excepts & FE_INVALID) + __asm __volatile ("efsdiv %0, %0, %1" :: "r"(0), "r"(0)); + if (__excepts & FE_DIVBYZERO) + __asm __volatile ("efsdiv %0, %0, %1" :: "r"(1.0f), "r"(0)); + if (__excepts & FE_UNDERFLOW) + __asm __volatile ("efsmul %0, %0, %0" :: "r"(PMIN)); + if (__excepts & FE_OVERFLOW) + __asm __volatile ("efsadd %0, %0, %0" :: "r"(PMAX)); + if (__excepts & FE_INEXACT) + __asm __volatile ("efssub %0, %0, %1" :: "r"(PMIN), "r"(1.0f)); + return (0); +} +#endif diff --git a/lib/msun/powerpc/fenv.h b/lib/msun/powerpc/fenv.h index d054220678c2..21a70df3d104 100644 --- a/lib/msun/powerpc/fenv.h +++ b/lib/msun/powerpc/fenv.h @@ -42,6 +42,17 @@ typedef __uint32_t fenv_t; typedef __uint32_t fexcept_t; /* Exception flags */ +#ifdef __SPE__ +#define FE_OVERFLOW 0x00000100 +#define FE_UNDERFLOW 0x00000200 +#define FE_DIVBYZERO 0x00000400 +#define FE_INVALID 0x00000800 +#define FE_INEXACT 0x00001000 + +#define FE_ALL_INVALID FE_INVALID + +#define _FPUSW_SHIFT 6 +#else #define FE_INEXACT 0x02000000 #define FE_DIVBYZERO 0x04000000 #define FE_UNDERFLOW 0x08000000 @@ -67,6 +78,9 @@ typedef __uint32_t fexcept_t; #define FE_ALL_INVALID (FE_VXCVI | FE_VXSQRT | FE_VXSOFT | FE_VXVC | \ FE_VXIMZ | FE_VXZDZ | FE_VXIDI | FE_VXISI | \ FE_VXSNAN | FE_INVALID) + +#define _FPUSW_SHIFT 22 +#endif #define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | \ FE_ALL_INVALID | FE_OVERFLOW | FE_UNDERFLOW) @@ -85,7 +99,6 @@ extern const fenv_t __fe_dfl_env; #define FE_DFL_ENV (&__fe_dfl_env) /* We need to be able to map status flag positions to mask flag positions */ -#define _FPUSW_SHIFT 22 #define _ENABLE_MASK ((FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \ FE_OVERFLOW | FE_UNDERFLOW) >> _FPUSW_SHIFT) @@ -156,6 +169,9 @@ fesetexceptflag(const fexcept_t *__flagp, int __excepts) return (0); } +#ifdef __SPE__ +extern int feraiseexcept(int __excepts); +#else __fenv_static inline int feraiseexcept(int __excepts) { @@ -168,6 +184,7 @@ feraiseexcept(int __excepts) __mtfsf(__r); return (0); } +#endif __fenv_static inline int fetestexcept(int __excepts) From owner-dev-commits-src-all@freebsd.org Thu May 6 01:57:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E248662E6D0; Thu, 6 May 2021 01:57:53 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbGtn64Q3z3Hc1; Thu, 6 May 2021 01:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C3E3A7F2F; Thu, 6 May 2021 01:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1461vr9M026796; Thu, 6 May 2021 01:57:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1461vr5H026795; Thu, 6 May 2021 01:57:53 GMT (envelope-from git) Date: Thu, 6 May 2021 01:57:53 GMT Message-Id: <202105060157.1461vr5H026795@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 49c894ddced5 - main - powerpc64: Split out DMAP and non-DMAP implementations of some methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 49c894ddced5eaad8d536d8603356576ce58c2df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 01:57:54 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=49c894ddced5eaad8d536d8603356576ce58c2df commit 49c894ddced5eaad8d536d8603356576ce58c2df Author: Justin Hibbits AuthorDate: 2021-05-05 14:21:51 +0000 Commit: Justin Hibbits CommitDate: 2021-05-06 01:57:33 +0000 powerpc64: Split out DMAP and non-DMAP implementations of some methods Summary: Some methods are split between DMAP and non-DMAP, conditional on hw_direct_map variable. Rather than checking this variable every time, use it to install different functions via IFUNCs. Reviewed By: luporl Differential Revision: https://reviews.freebsd.org/D30071 --- sys/powerpc/aim/mmu_oea64.c | 127 +++++++++++++++++++++++----------------- sys/powerpc/aim/mmu_oea64.h | 3 + sys/powerpc/aim/moea64_native.c | 2 + sys/powerpc/powerpc/machdep.c | 4 ++ sys/powerpc/ps3/mmu_ps3.c | 1 + sys/powerpc/pseries/mmu_phyp.c | 2 + 6 files changed, 86 insertions(+), 53 deletions(-) diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 0e9b15661758..c2e8e6e49913 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -386,8 +386,11 @@ static __inline bool moea64_sp_pvo_in_range(struct pvo_entry *pvo, */ void moea64_clear_modify(vm_page_t); void moea64_copy_page(vm_page_t, vm_page_t); +void moea64_copy_page_dmap(vm_page_t, vm_page_t); void moea64_copy_pages(vm_page_t *ma, vm_offset_t a_offset, vm_page_t *mb, vm_offset_t b_offset, int xfersize); +void moea64_copy_pages_dmap(vm_page_t *ma, vm_offset_t a_offset, + vm_page_t *mb, vm_offset_t b_offset, int xfersize); int moea64_enter(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, u_int flags, int8_t psind); void moea64_enter_object(pmap_t, vm_offset_t, vm_offset_t, vm_page_t, @@ -416,6 +419,7 @@ void moea64_remove_all(vm_page_t); void moea64_remove_write(vm_page_t); void moea64_unwire(pmap_t, vm_offset_t, vm_offset_t); void moea64_zero_page(vm_page_t); +void moea64_zero_page_dmap(vm_page_t); void moea64_zero_page_area(vm_page_t, int, int); void moea64_activate(struct thread *); void moea64_deactivate(struct thread *); @@ -432,6 +436,7 @@ void moea64_dumpsys_map(vm_paddr_t pa, size_t sz, void **va); void moea64_scan_init(void); vm_offset_t moea64_quick_enter_page(vm_page_t m); +vm_offset_t moea64_quick_enter_page_dmap(vm_page_t m); void moea64_quick_remove_page(vm_offset_t addr); boolean_t moea64_page_is_mapped(vm_page_t m); static int moea64_map_user_ptr(pmap_t pm, @@ -935,14 +940,6 @@ moea64_early_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) battable[i].batl = 0; } #else - moea64_probe_large_page(); - - /* Use a direct map if we have large page support */ - if (moea64_large_page_size > 0) - hw_direct_map = 1; - else - hw_direct_map = 0; - /* Install trap handlers for SLBs */ bcopy(&slbtrap, (void *)EXC_DSE,(size_t)&slbtrapend - (size_t)&slbtrap); bcopy(&slbtrap, (void *)EXC_ISE,(size_t)&slbtrapend - (size_t)&slbtrap); @@ -1462,6 +1459,20 @@ void moea64_set_scratchpage_pa(int which, vm_paddr_t pa) void moea64_copy_page(vm_page_t msrc, vm_page_t mdst) +{ + mtx_lock(&moea64_scratchpage_mtx); + + moea64_set_scratchpage_pa(0, VM_PAGE_TO_PHYS(msrc)); + moea64_set_scratchpage_pa(1, VM_PAGE_TO_PHYS(mdst)); + + bcopy((void *)moea64_scratchpage_va[0], + (void *)moea64_scratchpage_va[1], PAGE_SIZE); + + mtx_unlock(&moea64_scratchpage_mtx); +} + +void +moea64_copy_page_dmap(vm_page_t msrc, vm_page_t mdst) { vm_offset_t dst; vm_offset_t src; @@ -1469,23 +1480,11 @@ moea64_copy_page(vm_page_t msrc, vm_page_t mdst) dst = VM_PAGE_TO_PHYS(mdst); src = VM_PAGE_TO_PHYS(msrc); - if (hw_direct_map) { - bcopy((void *)PHYS_TO_DMAP(src), (void *)PHYS_TO_DMAP(dst), - PAGE_SIZE); - } else { - mtx_lock(&moea64_scratchpage_mtx); - - moea64_set_scratchpage_pa(0, src); - moea64_set_scratchpage_pa(1, dst); - - bcopy((void *)moea64_scratchpage_va[0], - (void *)moea64_scratchpage_va[1], PAGE_SIZE); - - mtx_unlock(&moea64_scratchpage_mtx); - } + bcopy((void *)PHYS_TO_DMAP(src), (void *)PHYS_TO_DMAP(dst), + PAGE_SIZE); } -static inline void +inline void moea64_copy_pages_dmap(vm_page_t *ma, vm_offset_t a_offset, vm_page_t *mb, vm_offset_t b_offset, int xfersize) { @@ -1511,8 +1510,8 @@ moea64_copy_pages_dmap(vm_page_t *ma, vm_offset_t a_offset, } } -static inline void -moea64_copy_pages_nodmap(vm_page_t *ma, vm_offset_t a_offset, +void +moea64_copy_pages(vm_page_t *ma, vm_offset_t a_offset, vm_page_t *mb, vm_offset_t b_offset, int xfersize) { void *a_cp, *b_cp; @@ -1539,20 +1538,6 @@ moea64_copy_pages_nodmap(vm_page_t *ma, vm_offset_t a_offset, mtx_unlock(&moea64_scratchpage_mtx); } -void -moea64_copy_pages(vm_page_t *ma, vm_offset_t a_offset, - vm_page_t *mb, vm_offset_t b_offset, int xfersize) -{ - - if (hw_direct_map) { - moea64_copy_pages_dmap(ma, a_offset, mb, b_offset, - xfersize); - } else { - moea64_copy_pages_nodmap(ma, a_offset, mb, b_offset, - xfersize); - } -} - void moea64_zero_page_area(vm_page_t m, int off, int size) { @@ -1580,20 +1565,26 @@ moea64_zero_page(vm_page_t m) vm_paddr_t pa = VM_PAGE_TO_PHYS(m); vm_offset_t va, off; - if (!hw_direct_map) { - mtx_lock(&moea64_scratchpage_mtx); + mtx_lock(&moea64_scratchpage_mtx); - moea64_set_scratchpage_pa(0, pa); - va = moea64_scratchpage_va[0]; - } else { - va = PHYS_TO_DMAP(pa); - } + moea64_set_scratchpage_pa(0, pa); + va = moea64_scratchpage_va[0]; for (off = 0; off < PAGE_SIZE; off += cacheline_size) __asm __volatile("dcbz 0,%0" :: "r"(va + off)); - if (!hw_direct_map) - mtx_unlock(&moea64_scratchpage_mtx); + mtx_unlock(&moea64_scratchpage_mtx); +} + +void +moea64_zero_page_dmap(vm_page_t m) +{ + vm_paddr_t pa = VM_PAGE_TO_PHYS(m); + vm_offset_t va, off; + + va = PHYS_TO_DMAP(pa); + for (off = 0; off < PAGE_SIZE; off += cacheline_size) + __asm __volatile("dcbz 0,%0" :: "r"(va + off)); } vm_offset_t @@ -1602,9 +1593,6 @@ moea64_quick_enter_page(vm_page_t m) struct pvo_entry *pvo; vm_paddr_t pa = VM_PAGE_TO_PHYS(m); - if (hw_direct_map) - return (PHYS_TO_DMAP(pa)); - /* * MOEA64_PTE_REPLACE does some locking, so we can't just grab * a critical section and access the PCPU data like on i386. @@ -1625,11 +1613,16 @@ moea64_quick_enter_page(vm_page_t m) return (PCPU_GET(qmap_addr)); } +vm_offset_t +moea64_quick_enter_page_dmap(vm_page_t m) +{ + + return (PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m))); +} + void moea64_quick_remove_page(vm_offset_t addr) { - if (hw_direct_map) - return; mtx_assert(PCPU_PTR(aim.qmap_lock), MA_OWNED); KASSERT(PCPU_GET(qmap_addr) == addr, @@ -3532,6 +3525,34 @@ struct moea64_funcs *moea64_ops; return (f != NULL ? f : (moea64_##func##_t)def);\ } +void +moea64_install(void) +{ +#ifdef __powerpc64__ + if (hw_direct_map == -1) { + moea64_probe_large_page(); + + /* Use a direct map if we have large page support */ + if (moea64_large_page_size > 0) + hw_direct_map = 1; + else + hw_direct_map = 0; + } +#endif + + /* + * Default to non-DMAP, and switch over to DMAP functions once we know + * we have DMAP. + */ + if (hw_direct_map) { + moea64_methods.quick_enter_page = moea64_quick_enter_page_dmap; + moea64_methods.quick_remove_page = NULL; + moea64_methods.copy_page = moea64_copy_page_dmap; + moea64_methods.zero_page = moea64_zero_page_dmap; + moea64_methods.copy_pages = moea64_copy_pages_dmap; + } +} + DEFINE_OEA64_IFUNC(int64_t, pte_replace, (struct pvo_entry *, int), moea64_pte_replace_default) DEFINE_OEA64_IFUNC(int64_t, pte_insert, (struct pvo_entry *), moea64_null_method) diff --git a/sys/powerpc/aim/mmu_oea64.h b/sys/powerpc/aim/mmu_oea64.h index e0b47bad8eed..4ee766689380 100644 --- a/sys/powerpc/aim/mmu_oea64.h +++ b/sys/powerpc/aim/mmu_oea64.h @@ -77,6 +77,9 @@ void moea64_mid_bootstrap(vm_offset_t kernelstart, void moea64_late_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend); +/* "base" install method for initializing moea64 pmap ifuncs */ +void moea64_install(void); + int64_t moea64_pte_replace(struct pvo_entry *, int); int64_t moea64_pte_insert(struct pvo_entry *); int64_t moea64_pte_unset(struct pvo_entry *); diff --git a/sys/powerpc/aim/moea64_native.c b/sys/powerpc/aim/moea64_native.c index 29ba51a48587..367b99856502 100644 --- a/sys/powerpc/aim/moea64_native.c +++ b/sys/powerpc/aim/moea64_native.c @@ -308,6 +308,8 @@ moea64_install_native() /* Install the MOEA64 ops. */ moea64_ops = &moea64_native_funcs; + + moea64_install(); } static int64_t diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c index 716f7e43db48..4e8b6089beea 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -137,7 +137,11 @@ int cacheline_size = 128; #else int cacheline_size = 32; #endif +#ifdef __powerpc64__ +int hw_direct_map = -1; +#else int hw_direct_map = 1; +#endif #ifdef BOOKE extern vm_paddr_t kernload; diff --git a/sys/powerpc/ps3/mmu_ps3.c b/sys/powerpc/ps3/mmu_ps3.c index 2d9fdd06c5ac..c21faccf631c 100644 --- a/sys/powerpc/ps3/mmu_ps3.c +++ b/sys/powerpc/ps3/mmu_ps3.c @@ -94,6 +94,7 @@ static void mps3_install() { moea64_ops = &mps3_funcs; + moea64_install(); } static void diff --git a/sys/powerpc/pseries/mmu_phyp.c b/sys/powerpc/pseries/mmu_phyp.c index 709a7dffc995..d94fb2aa5ae1 100644 --- a/sys/powerpc/pseries/mmu_phyp.c +++ b/sys/powerpc/pseries/mmu_phyp.c @@ -127,6 +127,8 @@ mphyp_install() { moea64_ops = &mmu_phyp_funcs; + + moea64_install(); } static void From owner-dev-commits-src-all@freebsd.org Thu May 6 03:18:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83051630BB1; Thu, 6 May 2021 03:18:42 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbJh23Jc7z3MLS; Thu, 6 May 2021 03:18:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6477E10CE4; Thu, 6 May 2021 03:18:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1463IgqU033937; Thu, 6 May 2021 03:18:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1463IgMF033936; Thu, 6 May 2021 03:18:42 GMT (envelope-from git) Date: Thu, 6 May 2021 03:18:42 GMT Message-Id: <202105060318.1463IgMF033936@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 22efcea413cf - stable/13 - Introduce "soft" serseq variant. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 22efcea413cf9880975e2ba06b5f3c5df4678055 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 03:18:42 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=22efcea413cf9880975e2ba06b5f3c5df4678055 commit 22efcea413cf9880975e2ba06b5f3c5df4678055 Author: Alexander Motin AuthorDate: 2021-04-06 21:27:16 +0000 Commit: Alexander Motin CommitDate: 2021-05-06 03:18:38 +0000 Introduce "soft" serseq variant. With new ZFS prefetcher improvements it is no longer needed to fully serialize reads to reach decent prediction hit rate. Softer variant only creates small time window to reduce races instead of completely blocking following reads while previous is running. It much less hurts the performance in case of prediction miss. MFC after: 1 month (cherry picked from commit ac503c194cd8e9dbef5c120e87f9521e1a89003a) --- sys/cam/ctl/ctl.c | 3 --- sys/cam/ctl/ctl_backend.h | 1 + sys/cam/ctl/ctl_backend_block.c | 32 ++++++++++++++++++++++---------- sys/cam/ctl/ctl_backend_ramdisk.c | 5 ++++- usr.sbin/ctladm/ctladm.8 | 9 +++++---- 5 files changed, 32 insertions(+), 18 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index cae6dd4aa101..575c8eea5198 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -13272,9 +13272,6 @@ ctl_serseq_done(union ctl_io *io) { struct ctl_lun *lun = CTL_LUN(io); - if (lun->be_lun->serseq == CTL_LUN_SERSEQ_OFF) - return; - /* This is racy, but should not be a problem. */ if (!TAILQ_EMPTY(&io->io_hdr.blocked_queue)) { mtx_lock(&lun->lun_lock); diff --git a/sys/cam/ctl/ctl_backend.h b/sys/cam/ctl/ctl_backend.h index 05e65abe41f8..fe4e7f5df1d0 100644 --- a/sys/cam/ctl/ctl_backend.h +++ b/sys/cam/ctl/ctl_backend.h @@ -47,6 +47,7 @@ typedef enum { CTL_LUN_SERSEQ_OFF, + CTL_LUN_SERSEQ_SOFT, CTL_LUN_SERSEQ_READ, CTL_LUN_SERSEQ_ON } ctl_lun_serseq; diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 9f96c157d5ae..4ffaf0912915 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -490,13 +490,12 @@ ctl_be_block_move_done(union ctl_io *io, bool samethr) static void ctl_be_block_biodone(struct bio *bio) { - struct ctl_be_block_io *beio; - struct ctl_be_block_lun *be_lun; + struct ctl_be_block_io *beio = bio->bio_caller1; + struct ctl_be_block_lun *be_lun = beio->lun; + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; union ctl_io *io; int error; - beio = bio->bio_caller1; - be_lun = beio->lun; io = beio->io; DPRINTF("entered\n"); @@ -576,7 +575,8 @@ ctl_be_block_biodone(struct bio *bio) if ((ARGS(io)->flags & CTL_LLF_READ) && beio->beio_cont == NULL) { ctl_set_success(&io->scsiio); - ctl_serseq_done(io); + if (cbe_lun->serseq >= CTL_LUN_SERSEQ_SOFT) + ctl_serseq_done(io); } ctl_datamove(io); } @@ -636,6 +636,7 @@ static void ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio) { + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; struct ctl_be_block_filedata *file_data; union ctl_io *io; struct uio xuio; @@ -679,6 +680,9 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, if (beio->bio_cmd == BIO_READ) { vn_lock(be_lun->vn, LK_SHARED | LK_RETRY); + if (beio->beio_cont == NULL && + cbe_lun->serseq == CTL_LUN_SERSEQ_SOFT) + ctl_serseq_done(io); /* * UFS pays attention to IO_DIRECT for reads. If the * DIRECTIO option is configured into the kernel, it calls @@ -786,7 +790,8 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, if ((ARGS(io)->flags & CTL_LLF_READ) && beio->beio_cont == NULL) { ctl_set_success(&io->scsiio); - ctl_serseq_done(io); + if (cbe_lun->serseq > CTL_LUN_SERSEQ_SOFT) + ctl_serseq_done(io); } ctl_datamove(io); } @@ -863,6 +868,7 @@ static void ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio) { + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; union ctl_io *io; struct cdevsw *csw; struct cdev *dev; @@ -904,9 +910,12 @@ ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, csw = devvn_refthread(be_lun->vn, &dev, &ref); if (csw) { - if (beio->bio_cmd == BIO_READ) + if (beio->bio_cmd == BIO_READ) { + if (beio->beio_cont == NULL && + cbe_lun->serseq == CTL_LUN_SERSEQ_SOFT) + ctl_serseq_done(io); error = csw->d_read(dev, &xuio, flags); - else + } else error = csw->d_write(dev, &xuio, flags); dev_relthread(dev, ref); } else @@ -952,7 +961,8 @@ ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, if ((ARGS(io)->flags & CTL_LLF_READ) && beio->beio_cont == NULL) { ctl_set_success(&io->scsiio); - ctl_serseq_done(io); + if (cbe_lun->serseq > CTL_LUN_SERSEQ_SOFT) + ctl_serseq_done(io); } ctl_datamove(io); } @@ -2187,12 +2197,14 @@ again: ctl_be_block_close(be_lun); cbe_lun->serseq = CTL_LUN_SERSEQ_OFF; if (be_lun->dispatch != ctl_be_block_dispatch_dev) - cbe_lun->serseq = CTL_LUN_SERSEQ_READ; + cbe_lun->serseq = CTL_LUN_SERSEQ_SOFT; value = dnvlist_get_string(cbe_lun->options, "serseq", NULL); if (value != NULL && strcmp(value, "on") == 0) cbe_lun->serseq = CTL_LUN_SERSEQ_ON; else if (value != NULL && strcmp(value, "read") == 0) cbe_lun->serseq = CTL_LUN_SERSEQ_READ; + else if (value != NULL && strcmp(value, "soft") == 0) + cbe_lun->serseq = CTL_LUN_SERSEQ_SOFT; else if (value != NULL && strcmp(value, "off") == 0) cbe_lun->serseq = CTL_LUN_SERSEQ_OFF; return (0); diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c index e67d699bda70..6febdd469bdd 100644 --- a/sys/cam/ctl/ctl_backend_ramdisk.c +++ b/sys/cam/ctl/ctl_backend_ramdisk.c @@ -507,7 +507,8 @@ nospc: if ((ARGS(io)->flags & CTL_LLF_READ) && ARGS(io)->len <= PRIV(io)->len) { ctl_set_success(&io->scsiio); - ctl_serseq_done(io); + if (cbe_lun->serseq >= CTL_LUN_SERSEQ_SOFT) + ctl_serseq_done(io); } ctl_datamove(io); } @@ -1036,6 +1037,8 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc, cbe_lun->serseq = CTL_LUN_SERSEQ_ON; else if (value != NULL && strcmp(value, "read") == 0) cbe_lun->serseq = CTL_LUN_SERSEQ_READ; + else if (value != NULL && strcmp(value, "soft") == 0) + cbe_lun->serseq = CTL_LUN_SERSEQ_SOFT; else if (value != NULL && strcmp(value, "off") == 0) cbe_lun->serseq = CTL_LUN_SERSEQ_OFF; diff --git a/usr.sbin/ctladm/ctladm.8 b/usr.sbin/ctladm/ctladm.8 index 25380c86441a..b8b90ad200fe 100644 --- a/usr.sbin/ctladm/ctladm.8 +++ b/usr.sbin/ctladm/ctladm.8 @@ -1,6 +1,6 @@ .\" .\" Copyright (c) 2003 Silicon Graphics International Corp. -.\" Copyright (c) 2015-2020 Alexander Motin +.\" Copyright (c) 2015-2021 Alexander Motin .\" Copyright (c) 2018 Marcelo Araujo .\" All rights reserved. .\" @@ -36,7 +36,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd November 23, 2020 +.Dd March 9, 2021 .Dt CTLADM 8 .Os .Sh NAME @@ -919,8 +919,9 @@ appropriate commands and task attributes. The default value is "restricted". It improves data integrity, but may introduce some additional delays. .It Va serseq -Set to "on" to serialize consecutive reads/writes. -Set to "read" to serialize consecutive reads. +Set to "on" to fully serialize consecutive reads/writes. +Set to "read" to fully serialize consecutive reads. +Set to "soft" to slightly serialize consecutive reads. Set to "off" to allow them be issued in parallel. Parallel issue of consecutive operations may confuse logic of the backing file system, hurting performance; but it may improve performance From owner-dev-commits-src-all@freebsd.org Thu May 6 05:51:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FD286377F3 for ; Thu, 6 May 2021 05:51:40 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbN4W6GTFz3kht; Thu, 6 May 2021 05:51:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C7A0012EF0; Thu, 6 May 2021 05:51:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1465pdJM040583; Thu, 6 May 2021 05:51:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1465pdNV040578; Thu, 6 May 2021 05:51:39 GMT (envelope-from git) Date: Thu, 6 May 2021 05:51:39 GMT Message-Id: <202105060551.1465pdNV040578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Cy Schubert Subject: git: 24dd5bad67e5 - Create tag vendor/sqlite3/sqlite-3350500 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/tags/vendor/sqlite3/sqlite-3350500 X-Git-Reftype: annotated tag X-Git-Commit: 24dd5bad67e5c7e9d29cc5d43d9091b8ce91ae64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 05:51:40 -0000 The annotated tag vendor/sqlite3/sqlite-3350500 has been created by cy: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/sqlite3/sqlite-3350500 tag vendor/sqlite3/sqlite-3350500 Tagger: Cy Schubert TaggerDate: 2021-05-06 05:37:48 +0000 Tag sqlite3-3350500. commit eccd5a4d3926c0716dd11bdf3242da56116f68c6 Author: Cy Schubert AuthorDate: 2021-05-06 05:35:02 +0000 Commit: Cy Schubert CommitDate: 2021-05-06 05:35:02 +0000 sqlite3: Vendor import of sqlite3 3.35.5 Changes at https://www.sqlite.org/releaselog/3_35_5.html. From owner-dev-commits-src-all@freebsd.org Thu May 6 05:51:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62F29637E24 for ; Thu, 6 May 2021 05:51:38 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbN4V2Cpkz3kyH; Thu, 6 May 2021 05:51:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3F0EB130C2; Thu, 6 May 2021 05:51:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1465pcSw040552; Thu, 6 May 2021 05:51:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1465pNnA040538; Thu, 6 May 2021 05:51:23 GMT (envelope-from git) Date: Thu, 6 May 2021 05:51:23 GMT Message-Id: <202105060551.1465pNnA040538@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Cy Schubert Subject: git: eccd5a4d3926 - vendor/sqlite3 - sqlite3: Vendor import of sqlite3 3.35.5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/vendor/sqlite3 X-Git-Reftype: branch X-Git-Commit: eccd5a4d3926c0716dd11bdf3242da56116f68c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 05:51:38 -0000 The branch vendor/sqlite3 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=eccd5a4d3926c0716dd11bdf3242da56116f68c6 commit eccd5a4d3926c0716dd11bdf3242da56116f68c6 Author: Cy Schubert AuthorDate: 2021-05-06 05:35:02 +0000 Commit: Cy Schubert CommitDate: 2021-05-06 05:35:02 +0000 sqlite3: Vendor import of sqlite3 3.35.5 Changes at https://www.sqlite.org/releaselog/3_35_5.html. --- .fossil-settings/empty-dirs | 1 + .fossil-settings/ignore-glob | 1 + LICENSE.md | 6 + Makefile.in | 2482 +- Makefile.linux-gcc | 115 + Makefile.msc | 1658 +- README.md | 327 + VERSION | 1 + aclocal.m4 | 5541 +- art/sqlite370.eps | 5333 + art/sqlite370.ico | Bin 0 -> 2238 bytes art/sqlite370.jpg | Bin 0 -> 80726 bytes INSTALL => autoconf/INSTALL | 0 Makefile.am => autoconf/Makefile.am | 0 Makefile.fallback => autoconf/Makefile.fallback | 0 autoconf/Makefile.msc | 1039 + autoconf/README.first | 11 + README.txt => autoconf/README.txt | 0 autoconf/configure.ac | 285 + {tea => autoconf/tea}/Makefile.in | 0 {tea => autoconf/tea}/README | 0 {tea => autoconf/tea}/aclocal.m4 | 0 {tea => autoconf/tea}/configure.ac | 2 +- {tea => autoconf/tea}/doc/sqlite3.n | 0 {tea => autoconf/tea}/license.terms | 0 {tea => autoconf/tea}/pkgIndex.tcl.in | 0 {tea => autoconf/tea}/tclconfig/install-sh | 0 {tea => autoconf/tea}/tclconfig/tcl.m4 | 0 {tea => autoconf/tea}/win/makefile.vc | 0 {tea => autoconf/tea}/win/nmakehlp.c | 0 {tea => autoconf/tea}/win/rules.vc | 0 compile | 347 - config.guess | 353 +- config.h.in | 131 + config.sub | 2469 +- configure | 10217 +- configure.ac | 953 +- contrib/sqlitecon.tcl | 679 + depcomp | 791 - doc/F2FS.txt | 87 + doc/lemon.html | 1240 + doc/pager-invariants.txt | 76 + doc/trusted-schema.md | 142 + doc/vdbesort-memory.md | 49 + doc/vfs-shm.txt | 130 + doc/wal-lock.md | 88 + ext/README.md | 8 + ext/async/README.txt | 170 + ext/async/sqlite3async.c | 1706 + ext/async/sqlite3async.h | 222 + ext/expert/README.md | 83 + ext/expert/expert.c | 156 + ext/expert/expert1.test | 458 + ext/expert/sqlite3expert.c | 1962 + ext/expert/sqlite3expert.h | 168 + ext/expert/test_expert.c | 220 + ext/fts1/README.txt | 2 + ext/fts1/ft_hash.c | 404 + ext/fts1/ft_hash.h | 111 + ext/fts1/fts1.c | 3348 + ext/fts1/fts1.h | 11 + ext/fts1/fts1_hash.c | 369 + ext/fts1/fts1_hash.h | 112 + ext/fts1/fts1_porter.c | 643 + ext/fts1/fts1_tokenizer.h | 90 + ext/fts1/fts1_tokenizer1.c | 221 + ext/fts1/fulltext.c | 1511 + ext/fts1/fulltext.h | 11 + ext/fts1/simple_tokenizer.c | 174 + ext/fts1/tokenizer.h | 89 + ext/fts2/README.tokenizers | 133 + ext/fts2/README.txt | 4 + ext/fts2/fts2.c | 6860 + ext/fts2/fts2.h | 26 + ext/fts2/fts2_hash.c | 376 + ext/fts2/fts2_hash.h | 110 + ext/fts2/fts2_icu.c | 260 + ext/fts2/fts2_porter.c | 644 + ext/fts2/fts2_tokenizer.c | 375 + ext/fts2/fts2_tokenizer.h | 145 + ext/fts2/fts2_tokenizer1.c | 233 + ext/fts2/mkfts2amal.tcl | 116 + ext/fts3/README.content | 176 + ext/fts3/README.syntax | 209 + ext/fts3/README.tokenizers | 135 + ext/fts3/README.txt | 4 + ext/fts3/fts3.c | 6098 + ext/fts3/fts3.h | 26 + ext/fts3/fts3Int.h | 652 + ext/fts3/fts3_aux.c | 551 + ext/fts3/fts3_expr.c | 1293 + ext/fts3/fts3_hash.c | 383 + ext/fts3/fts3_hash.h | 112 + ext/fts3/fts3_icu.c | 262 + ext/fts3/fts3_porter.c | 662 + ext/fts3/fts3_snippet.c | 1748 + ext/fts3/fts3_term.c | 374 + ext/fts3/fts3_test.c | 621 + ext/fts3/fts3_tokenize_vtab.c | 456 + ext/fts3/fts3_tokenizer.c | 520 + ext/fts3/fts3_tokenizer.h | 161 + ext/fts3/fts3_tokenizer1.c | 234 + ext/fts3/fts3_unicode.c | 397 + ext/fts3/fts3_unicode2.c | 383 + ext/fts3/fts3_write.c | 5797 + ext/fts3/fts3speed.tcl | 122 + ext/fts3/mkfts3amal.tcl | 115 + ext/fts3/tool/fts3cov.sh | 16 + ext/fts3/tool/fts3view.c | 875 + ext/fts3/unicode/CaseFolding.txt | 1224 + ext/fts3/unicode/UnicodeData.txt | 24428 ++ ext/fts3/unicode/mkunicode.tcl | 984 + ext/fts3/unicode/parseunicode.tcl | 205 + ext/fts5/extract_api_docs.tcl | 252 + ext/fts5/fts5.h | 575 + ext/fts5/fts5Int.h | 842 + ext/fts5/fts5_aux.c | 714 + ext/fts5/fts5_buffer.c | 403 + ext/fts5/fts5_config.c | 960 + ext/fts5/fts5_expr.c | 3054 + ext/fts5/fts5_hash.c | 560 + ext/fts5/fts5_index.c | 6709 + ext/fts5/fts5_main.c | 2921 + ext/fts5/fts5_storage.c | 1161 + ext/fts5/fts5_tcl.c | 1154 + ext/fts5/fts5_test_mi.c | 421 + ext/fts5/fts5_test_tok.c | 483 + ext/fts5/fts5_tokenize.c | 1415 + ext/fts5/fts5_unicode2.c | 778 + ext/fts5/fts5_varint.c | 344 + ext/fts5/fts5_vocab.c | 783 + ext/fts5/fts5parse.y | 197 + ext/fts5/mkportersteps.tcl | 222 + ext/fts5/test/fts5_common.tcl | 647 + ext/fts5/test/fts5aa.test | 641 + ext/fts5/test/fts5ab.test | 296 + ext/fts5/test/fts5ac.test | 278 + ext/fts5/test/fts5ad.test | 243 + ext/fts5/test/fts5ae.test | 311 + ext/fts5/test/fts5af.test | 190 + ext/fts5/test/fts5ag.test | 144 + ext/fts5/test/fts5ah.test | 169 + ext/fts5/test/fts5ai.test | 63 + ext/fts5/test/fts5aj.test | 68 + ext/fts5/test/fts5ak.test | 157 + ext/fts5/test/fts5al.test | 299 + ext/fts5/test/fts5alter.test | 101 + ext/fts5/test/fts5auto.test | 344 + ext/fts5/test/fts5aux.test | 311 + ext/fts5/test/fts5auxdata.test | 114 + ext/fts5/test/fts5bigpl.test | 63 + ext/fts5/test/fts5bigtok.test | 66 + ext/fts5/test/fts5cat.test | 59 + ext/fts5/test/fts5circref.test | 80 + ext/fts5/test/fts5colset.test | 105 + ext/fts5/test/fts5columnsize.test | 150 + ext/fts5/test/fts5config.test | 265 + ext/fts5/test/fts5conflict.test | 68 + ext/fts5/test/fts5connect.test | 246 + ext/fts5/test/fts5content.test | 297 + ext/fts5/test/fts5corrupt.test | 100 + ext/fts5/test/fts5corrupt2.test | 273 + ext/fts5/test/fts5corrupt3.test | 14598 ++ ext/fts5/test/fts5corrupt4.test | 63 + ext/fts5/test/fts5delete.test | 117 + ext/fts5/test/fts5detail.test | 243 + ext/fts5/test/fts5determin.test | 65 + ext/fts5/test/fts5dlidx.test | 197 + ext/fts5/test/fts5doclist.test | 46 + ext/fts5/test/fts5ea.test | 99 + ext/fts5/test/fts5eb.test | 100 + ext/fts5/test/fts5fault1.test | 353 + ext/fts5/test/fts5fault2.test | 139 + ext/fts5/test/fts5fault3.test | 112 + ext/fts5/test/fts5fault4.test | 397 + ext/fts5/test/fts5fault5.test | 131 + ext/fts5/test/fts5fault6.test | 293 + ext/fts5/test/fts5fault7.test | 118 + ext/fts5/test/fts5fault8.test | 84 + ext/fts5/test/fts5fault9.test | 159 + ext/fts5/test/fts5faultA.test | 63 + ext/fts5/test/fts5faultB.test | 173 + ext/fts5/test/fts5faultD.test | 87 + ext/fts5/test/fts5faultE.test | 71 + ext/fts5/test/fts5first.test | 95 + ext/fts5/test/fts5full.test | 42 + ext/fts5/test/fts5fuzz1.test | 92 + ext/fts5/test/fts5hash.test | 168 + ext/fts5/test/fts5integrity.test | 320 + ext/fts5/test/fts5interrupt.test | 67 + ext/fts5/test/fts5lastrowid.test | 72 + ext/fts5/test/fts5leftjoin.test | 43 + ext/fts5/test/fts5matchinfo.test | 523 + ext/fts5/test/fts5merge.test | 243 + ext/fts5/test/fts5merge2.test | 57 + ext/fts5/test/fts5misc.test | 327 + ext/fts5/test/fts5multi.test | 99 + ext/fts5/test/fts5multiclient.test | 47 + ext/fts5/test/fts5near.test | 70 + ext/fts5/test/fts5onepass.test | 180 + ext/fts5/test/fts5optimize.test | 108 + ext/fts5/test/fts5phrase.test | 118 + ext/fts5/test/fts5plan.test | 65 + ext/fts5/test/fts5porter.test | 11805 + ext/fts5/test/fts5porter2.test | 69 + ext/fts5/test/fts5prefix.test | 343 + ext/fts5/test/fts5prefix2.test | 57 + ext/fts5/test/fts5query.test | 91 + ext/fts5/test/fts5rank.test | 183 + ext/fts5/test/fts5rebuild.test | 67 + ext/fts5/test/fts5restart.test | 151 + ext/fts5/test/fts5rowid.test | 219 + ext/fts5/test/fts5savepoint.test | 85 + ext/fts5/test/fts5simple.test | 483 + ext/fts5/test/fts5simple2.test | 372 + ext/fts5/test/fts5simple3.test | 118 + ext/fts5/test/fts5synonym.test | 423 + ext/fts5/test/fts5synonym2.test | 163 + ext/fts5/test/fts5tok1.test | 150 + ext/fts5/test/fts5tok2.test | 47 + ext/fts5/test/fts5tokenizer.test | 304 + ext/fts5/test/fts5trigram.test | 201 + ext/fts5/test/fts5umlaut.test | 65 + ext/fts5/test/fts5unicode.test | 85 + ext/fts5/test/fts5unicode2.test | 588 + ext/fts5/test/fts5unicode3.test | 140 + ext/fts5/test/fts5unicode4.test | 31 + ext/fts5/test/fts5unindexed.test | 78 + ext/fts5/test/fts5update.test | 157 + ext/fts5/test/fts5version.test | 65 + ext/fts5/test/fts5vocab.test | 557 + ext/fts5/test/fts5vocab2.test | 237 + ext/fts5/tool/fts5speed.tcl | 64 + ext/fts5/tool/fts5txt2db.tcl | 231 + ext/fts5/tool/loadfts5.tcl | 172 + ext/fts5/tool/mkfts5c.tcl | 113 + ext/fts5/tool/showfts5.tcl | 97 + ext/icu/README.txt | 170 + ext/icu/icu.c | 554 + ext/icu/sqliteicu.h | 26 + ext/lsm1/Makefile | 56 + ext/lsm1/Makefile.msc | 102 + ext/lsm1/lsm-test/README | 40 + ext/lsm1/lsm-test/lsmtest.h | 303 + ext/lsm1/lsm-test/lsmtest1.c | 656 + ext/lsm1/lsm-test/lsmtest2.c | 488 + ext/lsm1/lsm-test/lsmtest3.c | 238 + ext/lsm1/lsm-test/lsmtest4.c | 127 + ext/lsm1/lsm-test/lsmtest5.c | 633 + ext/lsm1/lsm-test/lsmtest6.c | 661 + ext/lsm1/lsm-test/lsmtest7.c | 206 + ext/lsm1/lsm-test/lsmtest8.c | 324 + ext/lsm1/lsm-test/lsmtest9.c | 140 + ext/lsm1/lsm-test/lsmtest_bt.c | 71 + ext/lsm1/lsm-test/lsmtest_datasource.c | 96 + ext/lsm1/lsm-test/lsmtest_func.c | 177 + ext/lsm1/lsm-test/lsmtest_io.c | 248 + ext/lsm1/lsm-test/lsmtest_main.c | 1548 + ext/lsm1/lsm-test/lsmtest_mem.c | 409 + ext/lsm1/lsm-test/lsmtest_tdb.c | 846 + ext/lsm1/lsm-test/lsmtest_tdb.h | 174 + ext/lsm1/lsm-test/lsmtest_tdb2.cc | 369 + ext/lsm1/lsm-test/lsmtest_tdb3.c | 1429 + ext/lsm1/lsm-test/lsmtest_tdb4.c | 980 + ext/lsm1/lsm-test/lsmtest_util.c | 223 + ext/lsm1/lsm-test/lsmtest_win32.c | 30 + ext/lsm1/lsm.h | 684 + ext/lsm1/lsmInt.h | 993 + ext/lsm1/lsm_ckpt.c | 1239 + ext/lsm1/lsm_file.c | 3312 + ext/lsm1/lsm_log.c | 1156 + ext/lsm1/lsm_main.c | 1008 + ext/lsm1/lsm_mem.c | 104 + ext/lsm1/lsm_mutex.c | 88 + ext/lsm1/lsm_shared.c | 1976 + ext/lsm1/lsm_sorted.c | 6192 + ext/lsm1/lsm_str.c | 148 + ext/lsm1/lsm_tree.c | 2465 + ext/lsm1/lsm_unix.c | 753 + ext/lsm1/lsm_varint.c | 196 + ext/lsm1/lsm_vtab.c | 1079 + ext/lsm1/lsm_win32.c | 1063 + ext/lsm1/test/lsm1_common.tcl | 38 + ext/lsm1/test/lsm1_simple.test | 152 + ext/lsm1/tool/mklsm1c.tcl | 88 + ext/misc/README.md | 60 + ext/misc/amatch.c | 1501 + ext/misc/anycollseq.c | 58 + ext/misc/appendvfs.c | 669 + ext/misc/blobio.c | 152 + ext/misc/btreeinfo.c | 429 + ext/misc/carray.c | 521 + ext/misc/carray.h | 23 + ext/misc/cksumvfs.c | 868 + ext/misc/closure.c | 965 + ext/misc/completion.c | 501 + ext/misc/compress.c | 131 + ext/misc/csv.c | 957 + ext/misc/dbdata.c | 851 + ext/misc/dbdump.c | 724 + ext/misc/decimal.c | 634 + ext/misc/eval.c | 125 + ext/misc/explain.c | 322 + ext/misc/fileio.c | 1000 + ext/misc/fossildelta.c | 1092 + ext/misc/fuzzer.c | 1187 + ext/misc/ieee754.c | 289 + ext/misc/json1.c | 2631 + ext/misc/memstat.c | 428 + ext/misc/memtrace.c | 108 + ext/misc/memvfs.c | 574 + ext/misc/mmapwarm.c | 107 + ext/misc/nextchar.c | 314 + ext/misc/noop.c | 68 + ext/misc/normalize.c | 716 + ext/misc/percentile.c | 220 + ext/misc/prefixes.c | 320 + ext/misc/regexp.c | 760 + ext/misc/remember.c | 72 + ext/misc/rot13.c | 115 + ext/misc/scrub.c | 610 + ext/misc/series.c | 445 + ext/misc/sha1.c | 393 + ext/misc/shathree.c | 723 + ext/misc/showauth.c | 103 + ext/misc/spellfix.c | 3071 + ext/misc/sqlar.c | 124 + ext/misc/stmt.c | 300 + ext/misc/templatevtab.c | 268 + ext/misc/totype.c | 514 + ext/misc/uint.c | 92 + ext/misc/unionvtab.c | 1382 + ext/misc/urifuncs.c | 209 + ext/misc/uuid.c | 233 + ext/misc/vfslog.c | 759 + ext/misc/vfsstat.c | 819 + ext/misc/vtablog.c | 510 + ext/misc/vtshim.c | 553 + ext/misc/wholenumber.c | 275 + ext/misc/zipfile.c | 2190 + ext/misc/zorder.c | 102 + ext/rbu/rbu.c | 195 + ext/rbu/rbu1.test | 672 + ext/rbu/rbu10.test | 187 + ext/rbu/rbu11.test | 197 + ext/rbu/rbu12.test | 234 + ext/rbu/rbu13.test | 64 + ext/rbu/rbu14.test | 94 + ext/rbu/rbu3.test | 205 + ext/rbu/rbu5.test | 302 + ext/rbu/rbu6.test | 102 + ext/rbu/rbu7.test | 108 + ext/rbu/rbu8.test | 74 + ext/rbu/rbu9.test | 127 + ext/rbu/rbuA.test | 82 + ext/rbu/rbuB.test | 61 + ext/rbu/rbuC.test | 141 + ext/rbu/rbu_common.tcl | 110 + ext/rbu/rbucollate.test | 62 + ext/rbu/rbucrash.test | 147 + ext/rbu/rbucrash2.test | 105 + ext/rbu/rbudiff.test | 310 + ext/rbu/rbudor.test | 58 + ext/rbu/rbuexpr.test | 93 + ext/rbu/rbufault.test | 236 + ext/rbu/rbufault2.test | 66 + ext/rbu/rbufault3.test | 95 + ext/rbu/rbufault4.test | 65 + ext/rbu/rbufts.test | 133 + ext/rbu/rbumisc.test | 180 + ext/rbu/rbumulti.test | 174 + ext/rbu/rbupartial.test | 99 + ext/rbu/rbuprogress.test | 450 + ext/rbu/rburesume.test | 253 + ext/rbu/rbusave.test | 104 + ext/rbu/rbusplit.test | 94 + ext/rbu/rbutemplimit.test | 129 + ext/rbu/rbuvacuum.test | 399 + ext/rbu/rbuvacuum2.test | 243 + ext/rbu/rbuvacuum3.test | 63 + ext/rbu/rbuvacuum4.test | 116 + ext/rbu/sqlite3rbu.c | 5306 + ext/rbu/sqlite3rbu.h | 605 + ext/rbu/test_rbu.c | 391 + ext/repair/README.md | 16 + ext/repair/checkfreelist.c | 299 + ext/repair/checkindex.c | 927 + ext/repair/sqlite3_checker.c.in | 86 + ext/repair/sqlite3_checker.tcl | 264 + ext/repair/test/README.md | 13 + ext/repair/test/checkfreelist01.test | 92 + ext/repair/test/checkindex01.test | 349 + ext/repair/test/test.tcl | 67 + ext/rtree/README | 120 + ext/rtree/geopoly.c | 1810 + ext/rtree/rtree.c | 4545 + ext/rtree/rtree.h | 30 + ext/rtree/rtree1.test | 733 + ext/rtree/rtree2.test | 147 + ext/rtree/rtree3.test | 266 + ext/rtree/rtree4.test | 254 + ext/rtree/rtree5.test | 83 + ext/rtree/rtree6.test | 181 + ext/rtree/rtree7.test | 73 + ext/rtree/rtree8.test | 209 + ext/rtree/rtree9.test | 129 + ext/rtree/rtreeA.test | 262 + ext/rtree/rtreeB.test | 50 + ext/rtree/rtreeC.test | 378 + ext/rtree/rtreeD.test | 55 + ext/rtree/rtreeE.test | 143 + ext/rtree/rtreeF.test | 84 + ext/rtree/rtreeG.test | 69 + ext/rtree/rtreeH.test | 103 + ext/rtree/rtreeI.test | 74 + ext/rtree/rtree_perf.tcl | 74 + ext/rtree/rtree_util.tcl | 197 + ext/rtree/rtreecheck.test | 160 + ext/rtree/rtreecirc.test | 66 + ext/rtree/rtreeconnect.test | 56 + ext/rtree/rtreefuzz001.test | 1049 + ext/rtree/sqlite3rtree.h | 117 + ext/rtree/tkt3363.test | 50 + ext/rtree/util/randomshape.tcl | 87 + ext/rtree/viewrtree.tcl | 188 + ext/rtree/visual01.txt | 602 + ext/session/changeset.c | 417 + ext/session/changesetfuzz.c | 1238 + ext/session/changesetfuzz1.test | 84 + ext/session/session1.test | 669 + ext/session/session2.test | 639 + ext/session/session3.test | 214 + ext/session/session4.test | 146 + ext/session/session5.test | 408 + ext/session/session6.test | 90 + ext/session/session8.test | 91 + ext/session/session9.test | 287 + ext/session/sessionA.test | 106 + ext/session/sessionB.test | 507 + ext/session/sessionC.test | 197 + ext/session/sessionD.test | 257 + ext/session/sessionE.test | 113 + ext/session/sessionF.test | 294 + ext/session/sessionG.test | 250 + ext/session/sessionH.test | 84 + ext/session/session_common.tcl | 215 + ext/session/session_speed_test.c | 358 + ext/session/sessionat.test | 249 + ext/session/sessiondiff.test | 114 + ext/session/sessionfault.test | 589 + ext/session/sessionfault2.test | 284 + ext/session/sessioninvert.test | 183 + ext/session/sessionmem.test | 57 + ext/session/sessionnoop.test | 187 + ext/session/sessionrebase.test | 476 + ext/session/sessionstat1.test | 310 + ext/session/sessionwor.test | 123 + ext/session/sqlite3session.c | 5610 + ext/session/sqlite3session.h | 1673 + ext/session/test_session.c | 1318 + ext/userauth/sqlite3userauth.h | 96 + ext/userauth/user-auth.txt | 164 + ext/userauth/userauth.c | 355 + install-sh | 667 +- ltmain.sh | 8185 +- magic.txt | 32 + main.mk | 1144 + manifest | 1919 + manifest.uuid | 1 + missing | 215 - mkso.sh | 32 + mptest/config01.test | 46 + mptest/config02.test | 123 + mptest/crash01.test | 106 + mptest/crash02.subtest | 53 + mptest/mptest.c | 1470 + mptest/multiwrite01.test | 415 + spec.template | 67 + sqlite.pc.in | 13 + sqlite3.c | 231756 ------------------ sqlite3rc.h | 3 - src/alter.c | 1994 + src/analyze.c | 1943 + src/attach.c | 592 + src/auth.c | 268 + src/backup.c | 771 + src/bitvec.c | 411 + src/btmutex.c | 308 + src/btree.c | 10736 + src/btree.h | 408 + src/btreeInt.h | 730 + src/build.c | 5333 + src/callback.c | 536 + src/complete.c | 290 + src/ctime.c | 765 + src/date.c | 1250 + src/dbpage.c | 416 + src/dbstat.c | 853 + src/delete.c | 966 + src/expr.c | 6115 + src/fault.c | 87 + src/fkey.c | 1452 + src/func.c | 2287 + src/global.c | 321 + src/hash.c | 269 + src/hash.h | 96 + src/hwtime.h | 85 + src/in-operator.md | 107 + src/insert.c | 3055 + src/legacy.c | 141 + src/loadext.c | 854 + src/main.c | 4676 + src/malloc.c | 828 + src/mem0.c | 59 + src/mem1.c | 291 + src/mem2.c | 528 + src/mem3.c | 687 + src/mem5.c | 576 + src/memdb.c | 635 + src/memjournal.c | 434 + src/msvc.h | 41 + src/mutex.c | 361 + src/mutex.h | 71 + src/mutex_noop.c | 215 + src/mutex_unix.c | 394 + src/mutex_w32.c | 399 + src/notify.c | 332 + src/os.c | 438 + src/os.h | 212 + src/os_common.h | 105 + src/os_setup.h | 57 + src/os_unix.c | 8046 + src/os_win.c | 6154 + src/os_win.h | 88 + src/pager.c | 7708 + src/pager.h | 242 + src/parse.y | 1872 + src/pcache.c | 882 + src/pcache.h | 190 + src/pcache1.c | 1278 + src/pragma.c | 2593 + src/pragma.h | 648 + src/prepare.c | 1013 + src/printf.c | 1310 + src/random.c | 134 + src/resolve.c | 2022 + src/rowset.c | 502 + src/select.c | 7160 + shell.c => src/shell.c.in | 10545 +- sqlite3.h => src/sqlite.h.in | 3803 +- sqlite3.rc => src/sqlite3.rc | 0 sqlite3ext.h => src/sqlite3ext.h | 0 src/sqliteInt.h | 5167 + src/sqliteLimit.h | 210 + src/status.c | 393 + src/table.c | 198 + tea/generic/tclsqlite3.c => src/tclsqlite.c | 5 - src/test1.c | 8620 + src/test2.c | 752 + src/test3.c | 690 + src/test4.c | 726 + src/test5.c | 220 + src/test6.c | 1107 + src/test7.c | 718 + src/test8.c | 1444 + src/test9.c | 204 + src/test_async.c | 248 + src/test_autoext.c | 228 + src/test_backup.c | 157 + src/test_bestindex.c | 620 + src/test_blob.c | 330 + src/test_btree.c | 66 + src/test_config.c | 828 + src/test_delete.c | 156 + src/test_demovfs.c | 689 + src/test_devsym.c | 525 + src/test_fs.c | 917 + src/test_func.c | 952 + src/test_hexio.c | 465 + src/test_init.c | 295 + src/test_intarray.c | 392 + src/test_intarray.h | 135 + src/test_journal.c | 869 + src/test_loadext.c | 128 + src/test_malloc.c | 1513 + src/test_md5.c | 450 + src/test_multiplex.c | 1323 + src/test_multiplex.h | 99 + src/test_mutex.c | 510 + src/test_onefile.c | 831 + src/test_osinst.c | 1224 + src/test_pcache.c | 467 + src/test_quota.c | 1979 + src/test_quota.h | 268 + src/test_rtree.c | 511 + src/test_schema.c | 366 + src/test_server.c | 516 + src/test_sqllog.c | 556 + src/test_superlock.c | 363 + src/test_syscall.c | 765 + src/test_tclsh.c | 205 + src/test_tclvar.c | 562 + src/test_thread.c | 635 + src/test_vdbecov.c | 120 + src/test_vfs.c | 1692 + src/test_vfstrace.c | 892 + src/test_windirent.c | 191 + src/test_windirent.h | 159 + src/test_window.c | 349 + src/test_wsd.c | 84 + src/threads.c | 274 + src/tokenize.c | 856 + src/treeview.c | 783 + src/trigger.c | 1400 + src/update.c | 1321 + src/upsert.c | 315 + src/utf.c | 535 + src/util.c | 1705 + src/vacuum.c | 404 + src/vdbe.c | 8265 + src/vdbe.h | 396 + src/vdbeInt.h | 624 + src/vdbeapi.c | 2051 + src/vdbeaux.c | 5247 + src/vdbeblob.c | 508 + src/vdbemem.c | 1905 + src/vdbesort.c | 2763 + src/vdbetrace.c | 194 + src/vdbevtab.c | 424 + src/vtab.c | 1319 + src/vxworks.h | 32 + src/wal.c | 4050 + src/wal.h | 155 + src/walker.c | 247 + src/where.c | 5626 + src/whereInt.h | 607 + src/wherecode.c | 2494 + src/whereexpr.c | 1901 + src/window.c | 3050 + tea/configure | 9989 - test/8_3_names.test | 197 + test/affinity2.test | 136 + test/affinity3.test | 91 + test/aggerror.test | 78 + test/aggnested.test | 312 + test/alias.test | 140 + test/all.test | 51 + test/alter.test | 918 + test/alter2.test | 470 + test/alter3.test | 398 + test/alter4.test | 427 + test/alterauth.test | 72 + test/alterauth2.test | 115 + test/altercol.test | 839 + test/altercorrupt.test | 175 + test/alterdropcol.test | 319 + test/alterdropcol2.test | 222 + test/alterlegacy.test | 469 + test/altermalloc.test | 71 + test/altermalloc2.test | 101 + test/altermalloc3.test | 40 + test/altertab.test | 741 + test/altertab2.test | 363 + test/altertab3.test | 651 + test/amatch1.test | 117 + test/analyze.test | 380 + test/analyze3.test | 739 + test/analyze4.test | 111 + test/analyze5.test | 247 + test/analyze6.test | 126 + test/analyze7.test | 114 + test/analyze8.test | 115 + test/analyze9.test | 1235 + test/analyzeC.test | 181 + test/analyzeD.test | 107 + test/analyzeE.test | 242 + test/analyzeF.test | 150 + test/analyzeG.test | 88 + test/analyzer1.test | 55 + test/async.test | 90 + test/async2.test | 126 + test/async3.test | 76 + test/async4.test | 168 + test/async5.test | 68 + test/atof1.test | 84 + test/atomic.test | 41 + test/atomic2.test | 95 + test/atrc.c | 150 + test/attach.test | 928 + test/attach2.test | 391 + test/attach3.test | 353 + test/attach4.test | 138 + test/attachmalloc.test | 77 + test/auth.test | 2618 + test/auth2.test | 160 + test/auth3.test | 132 + test/autoanalyze1.test | 123 + test/autoinc.test | 883 + test/autoindex1.test | 548 + test/autoindex2.test | 232 + test/autoindex3.test | 93 + test/autoindex4.test | 83 + test/autoindex5.test | 230 + test/autovacuum.test | 716 + test/autovacuum_ioerr2.test | 132 + test/avfs.test | 395 + test/avtrans.test | 927 + test/backcompat.test | 524 + test/backup.test | 972 + test/backup2.test | 187 + test/backup4.test | 108 + test/backup5.test | 65 + test/backup_ioerr.test | 286 + test/backup_malloc.test | 119 + test/badutf.test | 143 + test/badutf2.test | 127 + test/bc_common.tcl | 75 + test/bestindex1.test | 327 + test/bestindex2.test | 142 + test/bestindex3.test | 182 + test/bestindex4.test | 175 + test/bestindex5.test | 249 + test/bestindex6.test | 109 + test/bestindex7.test | 79 + test/between.test | 143 + test/bigfile.test | 203 + test/bigfile2.test | 62 + test/bigmmap.test | 104 + test/bigrow.test | 223 + test/bigsort.test | 50 + test/bind.test | 758 + test/bindxfer.test | 76 + test/bitvec.test | 195 + test/blob.test | 147 + test/boundary1.tcl | 289 + test/boundary1.test | 7645 + test/boundary2.tcl | 445 + test/boundary2.test | 15198 ++ test/boundary3.tcl | 289 + test/boundary3.test | 12456 + test/boundary4.tcl | 340 + test/boundary4.test | 343 + test/btree01.test | 132 + test/btree02.test | 62 + test/btreefault.test | 57 + test/busy.test | 139 + test/busy2.test | 171 + test/cache.test | 140 + test/cacheflush.test | 323 + test/cachespill.test | 77 + test/capi2.test | 803 + test/capi3.test | 1276 + test/capi3b.test | 145 + test/capi3c.test | 1400 + test/capi3d.test | 203 + test/capi3e.test | 126 + test/carray01.test | 100 + test/cast.test | 487 + test/cffault.test | 158 + test/check.test | 611 + test/checkfault.test | 41 + test/chunksize.test | 41 + test/close.test | 89 + test/closure01.test | 295 + test/coalesce.test | 84 + test/collate1.test | 451 + test/collate2.test | 724 + test/collate3.test | 531 + test/collate4.test | 704 + test/collate5.test | 292 + test/collate6.test | 153 + test/collate7.test | 72 + test/collate8.test | 157 + test/collate9.test | 178 + test/collateA.test | 217 + test/collateB.test | 77 + test/colmeta.test | 110 + test/colname.test | 447 + test/columncount.test | 57 + test/conflict.test | 860 + test/conflict2.test | 858 + test/conflict3.test | 437 + test/contrib01.test | 90 + test/corrupt.test | 349 + test/corrupt2.test | 611 + test/corrupt3.test | 121 + test/corrupt4.test | 82 + test/corrupt5.test | 50 + test/corrupt6.test | 259 + test/corrupt7.test | 112 + test/corrupt8.test | 108 + test/corrupt9.test | 140 + test/corruptA.test | 83 + test/corruptB.test | 193 + test/corruptC.test | 428 + test/corruptD.test | 145 + test/corruptE.test | 152 + test/corruptF.test | 153 + test/corruptG.test | 75 + test/corruptH.test | 176 + test/corruptI.test | 263 + test/corruptJ.test | 80 + test/corruptK.test | 234 + test/corruptL.test | 1341 + test/corruptM.test | 186 + test/corruptN.test | 106 + test/cost.test | 289 + test/count.test | 237 + test/countofview.test | 56 + test/coveridxscan.test | 119 + test/crash.test | 411 + test/crash2.test | 133 + test/crash3.test | 190 + test/crash4.test | 102 + test/crash5.test | 127 + test/crash6.test | 118 + test/crash7.test | 116 + test/crash8.test | 419 + test/crashM.test | 80 + test/crashtest1.c | 96 + test/createtab.test | 154 + test/cse.test | 200 + test/csv01.test | 240 + test/ctime.test | 258 + test/cursorhint.test | 162 + test/cursorhint2.test | 204 + test/dataversion1.test | 87 + test/date.test | 612 + test/date2.test | 176 + test/dbdata.test | 115 + test/dbfuzz.c | 754 + test/dbfuzz001.test | 374 + test/dbfuzz2-seed1.db | Bin 0 -> 3584 bytes test/dbfuzz2.c | 403 + test/dbpage.test | 105 + test/dbstatus.test | 457 + test/dbstatus2.test | 115 + test/decimal.test | 186 + test/default.test | 140 + test/delete.test | 419 + test/delete2.test | 119 + test/delete3.test | 57 + test/delete4.test | 264 + test/delete_db.test | 222 + test/descidx1.test | 365 + test/descidx2.test | 186 + test/descidx3.test | 155 + test/diskfull.test | 115 + test/distinct.test | 297 + test/distinct2.test | 304 + test/distinctagg.test | 62 + test/e_blobbytes.test | 74 + test/e_blobclose.test | 170 + test/e_blobopen.test | 548 + test/e_blobwrite.test | 203 + test/e_changes.test | 441 + test/e_createtable.test | 1960 + test/e_delete.test | 477 + test/e_droptrigger.test | 218 + test/e_dropview.test | 192 + test/e_expr.test | 1991 + test/e_fkey.test | 3041 + test/e_fts3.test | 707 + test/e_insert.test | 431 + test/e_reindex.test | 299 + test/e_resolve.test | 135 + test/e_select.test | 2172 + test/e_select2.test | 580 + test/e_totalchanges.test | 213 + test/e_update.test | 605 + test/e_uri.test | 462 + test/e_vacuum.test | 347 + test/e_wal.test | 230 + test/e_walauto.test | 214 + test/e_walckpt.test | 753 + test/e_walhook.test | 200 + test/emptytable.test | 50 + test/enc.test | 252 + test/enc2.test | 567 + test/enc3.test | 108 + test/enc4.test | 137 + test/eqp.test | 830 + test/errmsg.test | 118 + test/eval.test | 87 + test/exclusive.test | 540 + test/exclusive2.test | 324 + test/exec.test | 37 + test/exists.test | 199 + test/exists2.test | 194 + test/existsfault.test | 52 + test/expr.test | 1059 + test/expr2.test | 54 + test/extension01.test | 83 + test/extraquick.test | 16 + test/fallocate.test | 157 + test/filectrl.test | 72 + test/filefmt.test | 254 + test/filter1.test | 225 + test/filter2.tcl | 132 + test/filter2.test | 156 + test/filterfault.test | 44 + test/fkey1.test | 226 + test/fkey2.test | 2047 + test/fkey3.test | 186 + test/fkey4.test | 57 + test/fkey5.test | 492 + test/fkey6.test | 229 + test/fkey7.test | 121 + test/fkey8.test | 231 + test/fkey_malloc.test | 134 + test/fordelete.test | 209 + test/format4.test | 66 + test/fts-9fd058691.test | 59 + test/fts1a.test | 186 + test/fts1b.test | 147 + test/fts1c.test | 1213 + test/fts1d.test | 65 + test/fts1e.test | 85 + test/fts1f.test | 90 + test/fts1i.test | 88 + test/fts1j.test | 89 + test/fts1k.test | 69 + test/fts1l.test | 65 + test/fts1m.test | 50 + test/fts1n.test | 45 + test/fts1o.test | 138 + test/fts1porter.test | 23590 ++ test/fts2.test | 67 + test/fts2a.test | 202 + test/fts2b.test | 147 + test/fts2c.test | 1213 + test/fts2d.test | 65 + test/fts2e.test | 85 + test/fts2f.test | 90 + test/fts2g.test | 93 + test/fts2h.test | 76 + test/fts2i.test | 87 + test/fts2j.test | 89 + test/fts2k.test | 105 + test/fts2l.test | 69 + test/fts2m.test | 65 + test/fts2n.test | 196 + test/fts2o.test | 169 + test/fts2p.test | 357 + test/fts2q.test | 346 + test/fts2r.test | 121 + test/fts2token.test | 174 + test/fts3.test | 19 + test/fts3_common.tcl | 420 + test/fts3aa.test | 265 + test/fts3ab.test | 147 + test/fts3ac.test | 1219 + test/fts3ad.test | 106 + test/fts3ae.test | 85 + test/fts3af.test | 90 + test/fts3ag.test | 93 + test/fts3ah.test | 71 + test/fts3ai.test | 92 + test/fts3aj.test | 89 + test/fts3ak.test | 105 + test/fts3al.test | 73 + test/fts3am.test | 65 + test/fts3an.test | 218 + test/fts3ao.test | 250 + test/fts3atoken.test | 287 + test/fts3auto.test | 717 + test/fts3aux1.test | 531 + test/fts3aux2.test | 168 + test/fts3b.test | 230 + test/fts3c.test | 255 + test/fts3comp1.test | 115 + test/fts3conf.test | 254 + test/fts3corrupt.test | 196 + *** 1262571 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu May 6 09:33:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D05815F8F06; Thu, 6 May 2021 09:33:36 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbT0c5YB0z4Tg7; Thu, 6 May 2021 09:33:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B18E7161A9; Thu, 6 May 2021 09:33:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1469Xa2N040983; Thu, 6 May 2021 09:33:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1469XaJI040982; Thu, 6 May 2021 09:33:36 GMT (envelope-from git) Date: Thu, 6 May 2021 09:33:36 GMT Message-Id: <202105060933.1469XaJI040982@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 916f3dba4523 - main - linux(4): make arch_prctl(2) support GET_CET_STATUS, report unknown codes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 916f3dba4523d1b2d478538875d45df56b20bcdb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 09:33:36 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=916f3dba4523d1b2d478538875d45df56b20bcdb commit 916f3dba4523d1b2d478538875d45df56b20bcdb Author: Edward Tomasz Napierala AuthorDate: 2021-05-06 08:33:35 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-06 08:33:42 +0000 linux(4): make arch_prctl(2) support GET_CET_STATUS, report unknown codes This is largely a no-op, to make future debugging slightly easier. Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30035 --- sys/amd64/linux/linux.h | 1 + sys/amd64/linux/linux_machdep.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h index cf9f5cccb287..dc4986817d11 100644 --- a/sys/amd64/linux/linux.h +++ b/sys/amd64/linux/linux.h @@ -431,6 +431,7 @@ struct l_pollfd { #define LINUX_ARCH_SET_FS 0x1002 #define LINUX_ARCH_GET_FS 0x1003 #define LINUX_ARCH_GET_GS 0x1004 +#define LINUX_ARCH_CET_STATUS 0x3001 #define linux_copyout_rusage(r, u) copyout(r, u, sizeof(*r)) diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c index a82ab411daa1..d2f9d0cacd3c 100644 --- a/sys/amd64/linux/linux_machdep.c +++ b/sys/amd64/linux/linux_machdep.c @@ -242,6 +242,7 @@ linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap) int linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) { + unsigned long long cet[3]; struct pcb *pcb; int error; @@ -275,7 +276,12 @@ linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) error = copyout(&pcb->pcb_gsbase, PTRIN(args->addr), sizeof(args->addr)); break; + case LINUX_ARCH_CET_STATUS: + memset(cet, 0, sizeof(cet)); + error = copyout(&cet, PTRIN(args->addr), sizeof(cet)); + break; default: + linux_msg(td, "unsupported arch_prctl code %#x", args->code); error = EINVAL; } return (error); From owner-dev-commits-src-all@freebsd.org Thu May 6 10:06:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DF275FA159; Thu, 6 May 2021 10:06:48 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbTkv72W9z4W8M; Thu, 6 May 2021 10:06:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E47C11646C; Thu, 6 May 2021 10:06:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146A6lBR081305; Thu, 6 May 2021 10:06:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146A6lFX081304; Thu, 6 May 2021 10:06:47 GMT (envelope-from git) Date: Thu, 6 May 2021 10:06:47 GMT Message-Id: <202105061006.146A6lFX081304@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 0ec3e991112d - main - Use '.arch_extension crc' in the arm64 crc32 code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ec3e991112d85a790ca3bbb4175652f37f4bd15 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 10:06:48 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=0ec3e991112d85a790ca3bbb4175652f37f4bd15 commit 0ec3e991112d85a790ca3bbb4175652f37f4bd15 Author: Andrew Turner AuthorDate: 2021-05-06 07:37:47 +0000 Commit: Andrew Turner CommitDate: 2021-05-06 07:42:35 +0000 Use '.arch_extension crc' in the arm64 crc32 code We don't care about the base architecture here, just that the crc extension is enabled. Sponsored by: Innovate UK --- sys/libkern/arm64/crc32c_armv8.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/libkern/arm64/crc32c_armv8.S b/sys/libkern/arm64/crc32c_armv8.S index e5d0ff80d97b..6a1991262a33 100644 --- a/sys/libkern/arm64/crc32c_armv8.S +++ b/sys/libkern/arm64/crc32c_armv8.S @@ -27,7 +27,8 @@ #include __FBSDID("$FreeBSD$"); -.arch armv8-a+crc + +.arch_extension crc /* * uint32_t From owner-dev-commits-src-all@freebsd.org Thu May 6 12:59:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9814621057; Thu, 6 May 2021 12:59:54 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbYZf6JB2z4fY4; Thu, 6 May 2021 12:59:54 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CB1D018466; Thu, 6 May 2021 12:59:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146CxsP0007089; Thu, 6 May 2021 12:59:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146CxsIN007088; Thu, 6 May 2021 12:59:54 GMT (envelope-from git) Date: Thu, 6 May 2021 12:59:54 GMT Message-Id: <202105061259.146CxsIN007088@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: e183dd501caf - stable/13 - traceroute6: Properly calculate UDP checksum MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e183dd501caf03751c96c7c0683ccc3a6c0cd27d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 12:59:55 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e183dd501caf03751c96c7c0683ccc3a6c0cd27d commit e183dd501caf03751c96c7c0683ccc3a6c0cd27d Author: Zhenlei Huang AuthorDate: 2021-05-03 16:46:19 +0000 Commit: Mark Johnston CommitDate: 2021-05-06 12:59:19 +0000 traceroute6: Properly calculate UDP checksum The revision D25604 capsicumize traceroute6. For UDP the send socket was changed from SOCK_DGRAM to SOCK_RAW and thus the UDP checksum need be calculated by application itself other than the kernel. outpacket is filled with zeros by line 707, thus the first round the UDP checksum is correct. But subsequent rounds outudp->uh_sum will be left with garbage. PR: 255507 Reviewed by: ae, markj, tuexen Differential Revision: https://reviews.freebsd.org/D30042 (cherry picked from commit 1d712c05370dca8cbf81d1ecd9acd606fdcacaf4) --- usr.sbin/traceroute6/traceroute6.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index 8449a9861302..a071c084ad07 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -1118,6 +1118,7 @@ send_probe(int seq, u_long hops) outudp->uh_sport = htons(ident); outudp->uh_dport = htons(port+seq); outudp->uh_ulen = htons(datalen); + outudp->uh_sum = 0; outudp->uh_sum = udp_cksum(&Src, &Dst, outpacket, datalen); break; case IPPROTO_NONE: From owner-dev-commits-src-all@freebsd.org Thu May 6 13:21:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E12F621893; Thu, 6 May 2021 13:21:59 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbZ470GF5z4gBP; Thu, 6 May 2021 13:21:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F006F18FE3; Thu, 6 May 2021 13:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146DLwVY044509; Thu, 6 May 2021 13:21:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146DLwkq044508; Thu, 6 May 2021 13:21:58 GMT (envelope-from git) Date: Thu, 6 May 2021 13:21:58 GMT Message-Id: <202105061321.146DLwkq044508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tai-hwa Liang Subject: git: 26993638c024 - stable/12 - if_firewire: fixing panic upon packet reception for VNET build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avatar X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 26993638c02456cc0752722c348a98c6b960602a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 13:21:59 -0000 The branch stable/12 has been updated by avatar: URL: https://cgit.FreeBSD.org/src/commit/?id=26993638c02456cc0752722c348a98c6b960602a commit 26993638c02456cc0752722c348a98c6b960602a Author: Tai-hwa Liang AuthorDate: 2021-04-10 15:32:27 +0000 Commit: Tai-hwa Liang CommitDate: 2021-05-06 13:18:45 +0000 if_firewire: fixing panic upon packet reception for VNET build netisr_dispatch_src() needs a valid VNET pointer or firewire_input() will panic when receiving a packet. Reviewed by: glebius MFC after: 2 weeks (cherry picked from commit d9b61e7153c64b141436b4d9619b166c6d35a0a6) --- sys/net/if_fwsubr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net/if_fwsubr.c b/sys/net/if_fwsubr.c index d6296bf33b65..29ca2f713e8e 100644 --- a/sys/net/if_fwsubr.c +++ b/sys/net/if_fwsubr.c @@ -634,7 +634,9 @@ firewire_input(struct ifnet *ifp, struct mbuf *m, uint16_t src) } M_SETFIB(m, ifp->if_fib); + CURVNET_SET_QUIET(ifp->if_vnet); netisr_dispatch(isr, m); + CURVNET_RESTORE(); } int From owner-dev-commits-src-all@freebsd.org Thu May 6 13:22:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68A2B621757; Thu, 6 May 2021 13:22:00 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbZ482HLNz4g7y; Thu, 6 May 2021 13:22:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1374418FE4; Thu, 6 May 2021 13:22:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146DM0gA044537; Thu, 6 May 2021 13:22:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146DM0Ga044531; Thu, 6 May 2021 13:22:00 GMT (envelope-from git) Date: Thu, 6 May 2021 13:22:00 GMT Message-Id: <202105061322.146DM0Ga044531@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tai-hwa Liang Subject: git: 85983c6d646b - stable/12 - arp(8): fixing the deletion failure of IEEE1394 associated addresses MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avatar X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 85983c6d646bc000e9746708d350459da8c7a958 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 13:22:00 -0000 The branch stable/12 has been updated by avatar: URL: https://cgit.FreeBSD.org/src/commit/?id=85983c6d646bc000e9746708d350459da8c7a958 commit 85983c6d646bc000e9746708d350459da8c7a958 Author: Tai-hwa Liang AuthorDate: 2021-04-12 06:27:03 +0000 Commit: Tai-hwa Liang CommitDate: 2021-05-06 13:18:45 +0000 arp(8): fixing the deletion failure of IEEE1394 associated addresses Without this, 'arp -d ${IEEE1394_ADDRESS}' gives the following error: arp: delete: cannot locate 10.0.0.71 Reviewed by: glebius MFC after: 2 weeks (cherry picked from commit a0d6d0d0b9aba6d4c025b2f2807e7c4b4c4b2415) --- usr.sbin/arp/arp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 07e07f1f2da9..01eb9a3260b5 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -299,6 +299,7 @@ valid_type(int type) switch (type) { case IFT_ETHER: case IFT_FDDI: + case IFT_IEEE1394: case IFT_INFINIBAND: case IFT_ISO88023: case IFT_ISO88024: From owner-dev-commits-src-all@freebsd.org Thu May 6 13:23:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1B85621BC7; Thu, 6 May 2021 13:23:23 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbZ5l5cfJz4gcG; Thu, 6 May 2021 13:23:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B38EA19042; Thu, 6 May 2021 13:23:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146DNNJj047462; Thu, 6 May 2021 13:23:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146DNNja047461; Thu, 6 May 2021 13:23:23 GMT (envelope-from git) Date: Thu, 6 May 2021 13:23:23 GMT Message-Id: <202105061323.146DNNja047461@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tai-hwa Liang Subject: git: 5fcae416655b - stable/13 - fwip(4): fixing kernel panic when receiving unicast packet MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avatar X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5fcae416655bc66e0eefaa87f9797ff8791d8de1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 13:23:24 -0000 The branch stable/13 has been updated by avatar: URL: https://cgit.FreeBSD.org/src/commit/?id=5fcae416655bc66e0eefaa87f9797ff8791d8de1 commit 5fcae416655bc66e0eefaa87f9797ff8791d8de1 Author: Tai-hwa Liang AuthorDate: 2021-04-15 14:24:14 +0000 Commit: Tai-hwa Liang CommitDate: 2021-05-06 13:23:00 +0000 fwip(4): fixing kernel panic when receiving unicast packet Wrapping fwip_unicast_input() with NET_EPOCH_{ENTER,EXIT} to avoid a NET_EPOCH_ASSERT() in netisr_dispatch(). Reviewed by: hselasky MFC after: 2 weeks (cherry picked from commit bdf316e892e9a7afa70e094135b5d05fbc26e867) --- sys/dev/firewire/if_fwip.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c index 46cd56e30748..e45fd67baea7 100644 --- a/sys/dev/firewire/if_fwip.c +++ b/sys/dev/firewire/if_fwip.c @@ -838,6 +838,7 @@ fwip_unicast_input(struct fw_xfer *xfer) uint64_t address; struct mbuf *m; struct m_tag *mtag; + struct epoch_tracker et; struct ifnet *ifp; struct fwip_softc *fwip; struct fw_pkt *fp; @@ -863,6 +864,7 @@ fwip_unicast_input(struct fw_xfer *xfer) } else { rtcode = FWRCODE_COMPLETE; } + NET_EPOCH_ENTER(et); /* * Pick up a new mbuf and stick it on the back of the receive @@ -876,7 +878,7 @@ fwip_unicast_input(struct fw_xfer *xfer) if (rtcode != FWRCODE_COMPLETE) { m_freem(m); if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); - return; + goto done; } if (bpf_peers_present(ifp->if_bpf)) { @@ -911,6 +913,8 @@ fwip_unicast_input(struct fw_xfer *xfer) m->m_pkthdr.rcvif = ifp; firewire_input(ifp, m, fp->mode.wreqb.src); if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); +done: + NET_EPOCH_EXIT(et); } static devclass_t fwip_devclass; From owner-dev-commits-src-all@freebsd.org Thu May 6 15:26:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 565506253C7; Thu, 6 May 2021 15:26:29 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fbcqn1qPWz4n8t; Thu, 6 May 2021 15:26:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 314231AC08; Thu, 6 May 2021 15:26:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146FQTTh008756; Thu, 6 May 2021 15:26:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146FQS0E008755; Thu, 6 May 2021 15:26:28 GMT (envelope-from git) Date: Thu, 6 May 2021 15:26:28 GMT Message-Id: <202105061526.146FQS0E008755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d8fd932e418f03e98b3469c4088a36f0ef34ffe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 15:26:29 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=5d8fd932e418f03e98b3469c4088a36f0ef34ffe commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe Author: Randall Stewart AuthorDate: 2021-05-06 15:22:26 +0000 Commit: Randall Stewart CommitDate: 2021-05-06 15:22:26 +0000 This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. Sponsored by: Netflix Reviewed by: rscheff, mtuexen Differential Revision: https://reviews.freebsd.org/D30036 --- sys/netinet/cc/cc.h | 7 +- sys/netinet/cc/cc_newreno.c | 34 +- sys/netinet/cc/cc_newreno.h | 13 +- sys/netinet/tcp.h | 24 +- sys/netinet/tcp_accounting.h | 39 + sys/netinet/tcp_input.c | 10 +- sys/netinet/tcp_log_buf.h | 8 +- sys/netinet/tcp_ratelimit.c | 29 +- sys/netinet/tcp_ratelimit.h | 4 +- sys/netinet/tcp_sack.c | 11 + sys/netinet/tcp_stacks/bbr.c | 92 +- sys/netinet/tcp_stacks/rack.c | 9876 ++++++++++++++++++++++-------- sys/netinet/tcp_stacks/rack_bbr_common.c | 473 +- sys/netinet/tcp_stacks/rack_bbr_common.h | 21 +- sys/netinet/tcp_stacks/tcp_bbr.h | 6 +- sys/netinet/tcp_stacks/tcp_rack.h | 201 +- sys/netinet/tcp_subr.c | 105 + sys/netinet/tcp_var.h | 12 + 18 files changed, 8181 insertions(+), 2784 deletions(-) diff --git a/sys/netinet/cc/cc.h b/sys/netinet/cc/cc.h index a52cfca9579b..be84a6841d15 100644 --- a/sys/netinet/cc/cc.h +++ b/sys/netinet/cc/cc.h @@ -91,15 +91,20 @@ struct cc_var { struct sctp_nets *sctp; } ccvc; uint16_t nsegs; /* # segments coalesced into current chain. */ + uint8_t labc; /* Dont use system abc use passed in */ }; /* cc_var flags. */ #define CCF_ABC_SENTAWND 0x0001 /* ABC counted cwnd worth of bytes? */ #define CCF_CWND_LIMITED 0x0002 /* Are we currently cwnd limited? */ -#define CCF_UNUSED1 0x0004 /* unused */ +#define CCF_USE_LOCAL_ABC 0x0004 /* Dont use the system l_abc val */ #define CCF_ACKNOW 0x0008 /* Will this ack be sent now? */ #define CCF_IPHDR_CE 0x0010 /* Does this packet set CE bit? */ #define CCF_TCPHDR_CWR 0x0020 /* Does this packet set CWR bit? */ +#define CCF_MAX_CWND 0x0040 /* Have we reached maximum cwnd? */ +#define CCF_CHG_MAX_CWND 0x0080 /* Cubic max_cwnd changed, for K */ +#define CCF_USR_IWND 0x0100 /* User specified initial window */ +#define CCF_USR_IWND_INIT_NSEG 0x0200 /* Convert segs to bytes on conn init */ /* ACK types passed to the ack_received() hook. */ #define CC_ACK 0x0001 /* Regular in sequence ACK. */ diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c index daf4e3351ffa..5f91ad8d1e7b 100644 --- a/sys/netinet/cc/cc_newreno.c +++ b/sys/netinet/cc/cc_newreno.c @@ -86,8 +86,8 @@ static void newreno_cong_signal(struct cc_var *ccv, uint32_t type); static void newreno_post_recovery(struct cc_var *ccv); static int newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf); -VNET_DEFINE_STATIC(uint32_t, newreno_beta) = 50; -VNET_DEFINE_STATIC(uint32_t, newreno_beta_ecn) = 80; +VNET_DEFINE(uint32_t, newreno_beta) = 50; +VNET_DEFINE(uint32_t, newreno_beta_ecn) = 80; #define V_newreno_beta VNET(newreno_beta) #define V_newreno_beta_ecn VNET(newreno_beta_ecn) @@ -101,11 +101,6 @@ struct cc_algo newreno_cc_algo = { .ctl_output = newreno_ctl_output, }; -struct newreno { - uint32_t beta; - uint32_t beta_ecn; -}; - static inline struct newreno * newreno_malloc(struct cc_var *ccv) { @@ -182,9 +177,15 @@ newreno_ack_received(struct cc_var *ccv, uint16_t type) * XXXLAS: Find a way to signal SS after RTO that * doesn't rely on tcpcb vars. */ + uint16_t abc_val; + + if (ccv->flags & CCF_USE_LOCAL_ABC) + abc_val = ccv->labc; + else + abc_val = V_tcp_abc_l_var; if (CCV(ccv, snd_nxt) == CCV(ccv, snd_max)) incr = min(ccv->bytes_this_ack, - ccv->nsegs * V_tcp_abc_l_var * + ccv->nsegs * abc_val * CCV(ccv, t_maxseg)); else incr = min(ccv->bytes_this_ack, CCV(ccv, t_maxseg)); @@ -237,11 +238,19 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) u_int mss; cwin = CCV(ccv, snd_cwnd); - mss = tcp_maxseg(ccv->ccvc.tcp); + mss = tcp_fixed_maxseg(ccv->ccvc.tcp); nreno = ccv->cc_data; beta = (nreno == NULL) ? V_newreno_beta : nreno->beta; beta_ecn = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn; - if (V_cc_do_abe && type == CC_ECN) + + /* + * Note that we only change the backoff for ECN if the + * global sysctl V_cc_do_abe is set the stack itself + * has set a flag in our newreno_flags (due to pacing) telling + * us to use the lower valued back-off. + */ + if (V_cc_do_abe || + (nreno && (nreno->newreno_flags & CC_NEWRENO_BETA_ECN) && (type == CC_ECN))) factor = beta_ecn; else factor = beta; @@ -260,8 +269,7 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) V_cc_do_abe && V_cc_abe_frlossreduce)) { CCV(ccv, snd_ssthresh) = ((uint64_t)CCV(ccv, snd_ssthresh) * - (uint64_t)beta) / - (100ULL * (uint64_t)beta_ecn); + (uint64_t)beta) / (uint64_t)beta_ecn; } if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) CCV(ccv, snd_ssthresh) = cwin; @@ -344,7 +352,7 @@ newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf) nreno->beta = opt->val; break; case CC_NEWRENO_BETA_ECN: - if (!V_cc_do_abe) + if ((!V_cc_do_abe) && ((nreno->newreno_flags & CC_NEWRENO_BETA_ECN) == 0)) return (EACCES); nreno->beta_ecn = opt->val; break; diff --git a/sys/netinet/cc/cc_newreno.h b/sys/netinet/cc/cc_newreno.h index 9e2a3cff5fe9..16cf1757e830 100644 --- a/sys/netinet/cc/cc_newreno.h +++ b/sys/netinet/cc/cc_newreno.h @@ -31,12 +31,17 @@ #define CCALGONAME_NEWRENO "newreno" +struct newreno { + uint32_t beta; + uint32_t beta_ecn; + uint32_t newreno_flags; +}; + struct cc_newreno_opts { - int name; + int name; uint32_t val; }; -#define CC_NEWRENO_BETA 1 -#define CC_NEWRENO_BETA_ECN 2 - +#define CC_NEWRENO_BETA 1 /* Beta for normal DUP-ACK/Sack recovery */ +#define CC_NEWRENO_BETA_ECN 2 /* ECN Beta for Abe */ #endif /* _CC_NEWRENO_H */ diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index d2bf1f8431fd..50f0811a6517 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -181,13 +181,24 @@ struct tcphdr { #define TCP_TXTLS_MODE 40 /* Transmit TLS mode */ #define TCP_RXTLS_ENABLE 41 /* TLS framing and encryption for receive */ #define TCP_RXTLS_MODE 42 /* Receive TLS mode */ +#define TCP_IWND_NB 43 /* Override initial window (units: bytes) */ +#define TCP_IWND_NSEG 44 /* Override initial window (units: MSS segs) */ +#define TCP_LOGID_CNT 46 /* get number of connections with the same ID */ +#define TCP_LOG_TAG 47 /* configure tag for grouping logs */ +#define TCP_USER_LOG 48 /* userspace log event */ #define TCP_CONGESTION 64 /* get/set congestion control algorithm */ #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */ +#define TCP_MAXUNACKTIME 68 /* maximum time without making progress (sec) */ +#define TCP_MAXPEAKRATE 69 /* maximum peak rate allowed (kbps) */ +#define TCP_IDLE_REDUCE 70 /* Reduce cwnd on idle input */ #define TCP_REMOTE_UDP_ENCAPS_PORT 71 /* Enable TCP over UDP tunneling via the specified port */ #define TCP_DELACK 72 /* socket option for delayed ack */ #define TCP_FIN_IS_RST 73 /* A fin from the peer is treated has a RST */ #define TCP_LOG_LIMIT 74 /* Limit to number of records in tcp-log */ #define TCP_SHARED_CWND_ALLOWED 75 /* Use of a shared cwnd is allowed */ +#define TCP_PROC_ACCOUNTING 76 /* Do accounting on tcp cpu usage and counts */ +#define TCP_USE_CMP_ACKS 77 /* The transport can handle the Compressed mbuf acks */ +#define TCP_PERF_INFO 78 /* retrieve accounting counters */ #define TCP_KEEPINIT 128 /* N, time to establish connection */ #define TCP_KEEPIDLE 256 /* L,N,X start keeplives after this period */ #define TCP_KEEPINTVL 512 /* L,N interval between keepalives */ @@ -201,7 +212,7 @@ struct tcphdr { #define TCP_RACK_MBUF_QUEUE 1050 /* Do we allow mbuf queuing if supported */ #define TCP_RACK_PROP 1051 /* RACK proportional rate reduction (bool) */ #define TCP_RACK_TLP_REDUCE 1052 /* RACK TLP cwnd reduction (bool) */ -#define TCP_RACK_PACE_REDUCE 1053 /* RACK Pacing reduction factor (divisor) */ +#define TCP_RACK_PACE_REDUCE 1053 /* RACK Pacingv reduction factor (divisor) */ #define TCP_RACK_PACE_MAX_SEG 1054 /* Max TSO size we will send */ #define TCP_RACK_PACE_ALWAYS 1055 /* Use the always pace method */ #define TCP_RACK_PROP_RATE 1056 /* The proportional reduction rate */ @@ -284,6 +295,16 @@ struct tcphdr { #define TCP_RACK_PACE_TO_FILL 1127 /* If we are not in recovery, always pace to fill the cwnd in 1 RTT */ #define TCP_SHARED_CWND_TIME_LIMIT 1128 /* we should limit to low time values the scwnd life */ #define TCP_RACK_PROFILE 1129 /* Select a profile that sets multiple options */ +#define TCP_HDWR_RATE_CAP 1130 /* Allow hardware rates to cap pacing rate */ +#define TCP_PACING_RATE_CAP 1131 /* Highest rate allowed in pacing in bytes per second (uint64_t) */ +#define TCP_HDWR_UP_ONLY 1132 /* Allow the pacing rate to climb but not descend (with the exception of fill-cw */ +#define TCP_RACK_ABC_VAL 1133 /* Set a local ABC value different then the system default */ +#define TCP_REC_ABC_VAL 1134 /* Do we use the ABC value for recovery or the override one from sysctl */ +#define TCP_RACK_MEASURE_CNT 1135 /* How many measurements are required in GP pacing */ +#define TCP_DEFER_OPTIONS 1136 /* Defer options until the proper number of measurements occur, does not defer TCP_RACK_MEASURE_CNT */ +#define TCP_FAST_RSM_HACK 1137 /* Do we do the broken thing where we don't twiddle the TLP bits properly in fast_rsm_output? */ +#define TCP_RACK_PACING_BETA 1138 /* Changing the beta for pacing */ +#define TCP_RACK_PACING_BETA_ECN 1139 /* Changing the beta for ecn with pacing */ /* Start of reserved space for third-party user-settable options. */ #define TCP_VENDOR SO_VENDOR @@ -295,6 +316,7 @@ struct tcphdr { #define TCPI_OPT_WSCALE 0x04 #define TCPI_OPT_ECN 0x08 #define TCPI_OPT_TOE 0x10 +#define TCPI_OPT_TFO 0x20 /* Maximum length of log ID. */ #define TCP_LOG_ID_LEN 64 diff --git a/sys/netinet/tcp_accounting.h b/sys/netinet/tcp_accounting.h new file mode 100644 index 000000000000..a2e2d4edd46d --- /dev/null +++ b/sys/netinet/tcp_accounting.h @@ -0,0 +1,39 @@ +#ifndef __tcp_accounting_h__ +#define __tcp_accounting_h__ +/* + * Return values from tcp_do_ack_accounting + * and indexs to the into the tcp_proc_time[] + * array. + */ +#define ACK_BEHIND 0 +#define ACK_SACK 1 +#define ACK_CUMACK 2 +#define ACK_CUMACK_SACK 3 +#define ACK_DUPACK 4 +#define ACK_RWND 5 +/* Added values for tracking output too */ +#define SND_BLOCKED 6 +#define SND_LIMITED 7 +#define SND_OUT_DATA 8 +#define SND_OUT_ACK 9 +#define SND_OUT_FAIL 10 +/* We also count in the counts array two added (MSS sent and ACKS In) */ +#define CNT_OF_MSS_OUT 11 +#define CNT_OF_ACKS_IN 12 + +/* for the tcpcb we add two more cycle counters */ +#define CYC_HANDLE_MAP 11 +#define CYC_HANDLE_ACK 12 + +/* Should the tp->xxx array's be alloc'ed? */ +/* #define TCP_NUM_PROC_COUNTERS 11 defined in tcp_var.h */ +/* #define TCP_NUM_CNT_COUNTERS 13 defined in tcp_var.h */ + +#ifdef _KERNEL +#ifdef TCP_ACCOUNTING +extern counter_u64_t tcp_cnt_counters[TCP_NUM_CNT_COUNTERS]; +extern counter_u64_t tcp_proc_time[TCP_NUM_PROC_COUNTERS]; +#endif +#endif + +#endif diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index bdbf28556149..bfa95feb7eee 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -526,7 +526,7 @@ cc_post_recovery(struct tcpcb *tp, struct tcphdr *th) (V_tcp_delack_enabled || (tp->t_flags & TF_NEEDSYN))) void inline -cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th, uint8_t iptos) +cc_ecnpkt_handler_flags(struct tcpcb *tp, uint16_t flags, uint8_t iptos) { INP_WLOCK_ASSERT(tp->t_inpcb); @@ -544,7 +544,7 @@ cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th, uint8_t iptos) break; } - if (th->th_flags & TH_CWR) + if (flags & TH_CWR) tp->ccv->flags |= CCF_TCPHDR_CWR; else tp->ccv->flags &= ~CCF_TCPHDR_CWR; @@ -558,6 +558,12 @@ cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th, uint8_t iptos) } } +void inline +cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th, uint8_t iptos) +{ + cc_ecnpkt_handler_flags(tp, th->th_flags, iptos); +} + /* * TCP input handling is split into multiple parts: * tcp6_input is a thin wrapper around tcp_input for the extended diff --git a/sys/netinet/tcp_log_buf.h b/sys/netinet/tcp_log_buf.h index bdd56c94587e..47993660cb1f 100644 --- a/sys/netinet/tcp_log_buf.h +++ b/sys/netinet/tcp_log_buf.h @@ -174,7 +174,7 @@ enum tcp_log_events { TCP_LOG_IN = 1, /* Incoming packet 1 */ TCP_LOG_OUT, /* Transmit (without other event) 2 */ TCP_LOG_RTO, /* Retransmit timeout 3 */ - TCP_LOG_TF_ACK, /* Transmit due to TF_ACK 4 */ + TCP_LOG_SB_WAKE, /* Awaken socket buffer 4 */ TCP_LOG_BAD_RETRAN, /* Detected bad retransmission 5 */ TCP_LOG_PRR, /* Doing PRR 6 */ TCP_LOG_REORDER, /* Detected reorder 7 */ @@ -200,7 +200,7 @@ enum tcp_log_events { BBR_LOG_DOSEG_DONE, /* hpts do_segment completes 27 */ BBR_LOG_EXIT_GAIN, /* hpts do_segment completes 28 */ BBR_LOG_THRESH_CALC, /* Doing threshold calculation 29 */ - BBR_LOG_EXTRACWNDGAIN, /* Removed 30 */ + TCP_LOG_MAPCHG, /* Map Changes to the sendmap 30 */ TCP_LOG_USERSEND, /* User level sends data 31 */ BBR_RSM_CLEARED, /* RSM cleared of ACK flags 32 */ BBR_LOG_STATE_TARGET, /* Log of target at state 33 */ @@ -232,7 +232,9 @@ enum tcp_log_events { TCP_LOG_USER_EVENT, /* User space event data 59 */ TCP_LOG_SENDFILE, /* sendfile() logging for TCP connections 60 */ TCP_LOG_HTTP_T, /* logging of http request tracking 61 */ - TCP_LOG_END /* End (keep at end) 62 */ + TCP_LOG_ACCOUNTING, /* Log of TCP Accounting data 62 */ + TCP_LOG_FSB, /* FSB information 63 */ + TCP_LOG_END /* End (keep at end) 64 */ }; enum tcp_log_states { diff --git a/sys/netinet/tcp_ratelimit.c b/sys/netinet/tcp_ratelimit.c index 8f2cf3d8d061..c33b2872e91f 100644 --- a/sys/netinet/tcp_ratelimit.c +++ b/sys/netinet/tcp_ratelimit.c @@ -367,11 +367,22 @@ rl_add_syctl_entries(struct sysctl_oid *rl_sysctl_root, struct tcp_rate_set *rs) OID_AUTO, "pacetime", CTLFLAG_RD, &rs->rs_rlt[i].time_between, 0, "Time hardware inserts between 1500 byte sends"); - SYSCTL_ADD_U64(&rs->sysctl_ctx, + SYSCTL_ADD_LONG(&rs->sysctl_ctx, SYSCTL_CHILDREN(rl_rate_num), OID_AUTO, "rate", CTLFLAG_RD, - &rs->rs_rlt[i].rate, 0, + &rs->rs_rlt[i].rate, "Rate in bytes per second"); + SYSCTL_ADD_LONG(&rs->sysctl_ctx, + SYSCTL_CHILDREN(rl_rate_num), + OID_AUTO, "using", CTLFLAG_RD, + &rs->rs_rlt[i].using, + "Number of flows using"); + SYSCTL_ADD_LONG(&rs->sysctl_ctx, + SYSCTL_CHILDREN(rl_rate_num), + OID_AUTO, "enobufs", CTLFLAG_RD, + &rs->rs_rlt[i].rs_num_enobufs, + "Number of enobufs logged on this rate"); + } } #endif @@ -667,6 +678,8 @@ bail: */ rs->rs_rlt[i].ptbl = rs; rs->rs_rlt[i].tag = NULL; + rs->rs_rlt[i].using = 0; + rs->rs_rlt[i].rs_num_enobufs = 0; /* * Calculate the time between. */ @@ -1063,16 +1076,28 @@ rt_find_real_interface(struct ifnet *ifp, struct inpcb *inp, int *error) static void rl_increment_using(const struct tcp_hwrate_limit_table *rte) { + struct tcp_hwrate_limit_table *decon_rte; + + decon_rte = __DECONST(struct tcp_hwrate_limit_table *, rte); + atomic_add_long(&decon_rte->using, 1); } static void rl_decrement_using(const struct tcp_hwrate_limit_table *rte) { + struct tcp_hwrate_limit_table *decon_rte; + + decon_rte = __DECONST(struct tcp_hwrate_limit_table *, rte); + atomic_subtract_long(&decon_rte->using, 1); } void tcp_rl_log_enobuf(const struct tcp_hwrate_limit_table *rte) { + struct tcp_hwrate_limit_table *decon_rte; + + decon_rte = __DECONST(struct tcp_hwrate_limit_table *, rte); + atomic_add_long(&decon_rte->rs_num_enobufs, 1); } /* diff --git a/sys/netinet/tcp_ratelimit.h b/sys/netinet/tcp_ratelimit.h index b69f0e634b60..8747708e8b5e 100644 --- a/sys/netinet/tcp_ratelimit.h +++ b/sys/netinet/tcp_ratelimit.h @@ -43,7 +43,9 @@ struct m_snd_tag; struct tcp_hwrate_limit_table { const struct tcp_rate_set *ptbl; /* Pointer to parent table */ struct m_snd_tag *tag; /* Send tag if needed (chelsio) */ - uint64_t rate; /* Rate we get in Bytes per second (Bps) */ + long rate; /* Rate we get in Bytes per second (Bps) */ + long using; /* How many flows are using this hdwr rate. */ + long rs_num_enobufs; uint32_t time_between; /* Time-Gap between packets at this rate */ uint32_t flags; }; diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 0eaeb39af71a..96056b5efd4d 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -156,6 +156,17 @@ SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, globalholes, CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(tcp_sack_globalholes), 0, "Global number of TCP SACK holes currently allocated"); +int +tcp_dsack_block_exists(struct tcpcb *tp) +{ + /* Return true if a DSACK block exists */ + if (tp->rcv_numsacks == 0) + return (0); + if (SEQ_LEQ(tp->sackblks[0].end, tp->rcv_nxt)) + return(1); + return (0); +} + /* * This function will find overlaps with the currently stored sackblocks * and add any overlap as a dsack block upfront diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index febac7ad424c..af6c9462c8e0 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -3930,6 +3930,9 @@ bbr_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type, struct bbr_s struct tcp_bbr *bbr; INP_WLOCK_ASSERT(tp->t_inpcb); +#ifdef STATS + stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_CSIG, type); +#endif bbr = (struct tcp_bbr *)tp->t_fb_ptr; switch (type) { case CC_NDUPACK: @@ -4403,6 +4406,7 @@ bbr_clone_rsm(struct tcp_bbr *bbr, struct bbr_sendmap *nrsm, struct bbr_sendmap nrsm->r_start = start; nrsm->r_end = rsm->r_end; nrsm->r_rtr_cnt = rsm->r_rtr_cnt; + nrsm-> r_rtt_not_allowed = rsm->r_rtt_not_allowed; nrsm->r_flags = rsm->r_flags; /* We don't transfer forward the SYN flag */ nrsm->r_flags &= ~BBR_HAS_SYN; @@ -6429,65 +6433,6 @@ tcp_bbr_xmit_timer_commit(struct tcp_bbr *bbr, struct tcpcb *tp, uint32_t cts) bbr->r_ctl.bbr_smallest_srtt_this_state = rtt; } -static void -bbr_earlier_retran(struct tcpcb *tp, struct tcp_bbr *bbr, struct bbr_sendmap *rsm, - uint32_t t, uint32_t cts, int ack_type) -{ - /* - * For this RSM, we acknowledged the data from a previous - * transmission, not the last one we made. This means we did a false - * retransmit. - */ - if (rsm->r_flags & BBR_HAS_FIN) { - /* - * The sending of the FIN often is multiple sent when we - * have everything outstanding ack'd. We ignore this case - * since its over now. - */ - return; - } - if (rsm->r_flags & BBR_TLP) { - /* - * We expect TLP's to have this occur often - */ - bbr->rc_tlp_rtx_out = 0; - return; - } - if (ack_type != BBR_CUM_ACKED) { - /* - * If it was not a cum-ack we - * don't really know for sure since - * the timestamp could be from some - * other transmission. - */ - return; - } - - if (rsm->r_flags & BBR_WAS_SACKPASS) { - /* - * We retransmitted based on a sack and the earlier - * retransmission ack'd it - re-ordering is occuring. - */ - BBR_STAT_INC(bbr_reorder_seen); - bbr->r_ctl.rc_reorder_ts = cts; - } - /* Back down the loss count */ - if (rsm->r_flags & BBR_MARKED_LOST) { - bbr->r_ctl.rc_lost -= rsm->r_end - rsm->r_start; - bbr->r_ctl.rc_lost_bytes -= rsm->r_end - rsm->r_start; - rsm->r_flags &= ~BBR_MARKED_LOST; - if (SEQ_GT(bbr->r_ctl.rc_lt_lost, bbr->r_ctl.rc_lost)) - /* LT sampling also needs adjustment */ - bbr->r_ctl.rc_lt_lost = bbr->r_ctl.rc_lost; - } - /***** RRS HERE ************************/ - /* Do we need to do this??? */ - /* bbr_reset_lt_bw_sampling(bbr, cts); */ - /***** RRS HERE ************************/ - BBR_STAT_INC(bbr_badfr); - BBR_STAT_ADD(bbr_badfr_bytes, (rsm->r_end - rsm->r_start)); -} - static void bbr_set_reduced_rtt(struct tcp_bbr *bbr, uint32_t cts, uint32_t line) { @@ -6869,6 +6814,10 @@ bbr_update_rtt(struct tcpcb *tp, struct tcp_bbr *bbr, /* Already done */ return (0); } + if (rsm->r_rtt_not_allowed) { + /* Not allowed */ + return (0); + } if (rsm->r_rtr_cnt == 1) { /* * Only one transmit. Hopefully the normal case. @@ -6926,7 +6875,7 @@ bbr_update_rtt(struct tcpcb *tp, struct tcp_bbr *bbr, rsm->r_tim_lastsent[i], ack_type, to); if ((i + 1) < rsm->r_rtr_cnt) { /* Likely */ - bbr_earlier_retran(tp, bbr, rsm, t, cts, ack_type); + return (0); } else if (rsm->r_flags & BBR_TLP) { bbr->rc_tlp_rtx_out = 0; } @@ -6974,7 +6923,7 @@ bbr_update_rtt(struct tcpcb *tp, struct tcp_bbr *bbr, t = 1; bbr_update_bbr_info(bbr, rsm, t, cts, to->to_tsecr, uts, BBR_RTT_BY_EARLIER_RET, rsm->r_tim_lastsent[i], ack_type, to); - bbr_earlier_retran(tp, bbr, rsm, t, cts, ack_type); + return (0); } else { /* * Too many prior transmissions, just @@ -10207,7 +10156,7 @@ bbr_init(struct tcpcb *tp) tp->t_fb_ptr = NULL; return (ENOMEM); } - rsm->r_flags = BBR_OVERMAX; + rsm->r_rtt_not_allowed = 1; rsm->r_tim_lastsent[0] = cts; rsm->r_rtr_cnt = 1; rsm->r_rtr_bytes = 0; @@ -10320,6 +10269,10 @@ bbr_fini(struct tcpcb *tp, int32_t tcb_is_purged) counter_u64_add(bbr_flows_whdwr_pacing, -1); else counter_u64_add(bbr_flows_nohdwr_pacing, -1); + if (bbr->r_ctl.crte != NULL) { + tcp_rel_pacing_rate(bbr->r_ctl.crte, tp); + bbr->r_ctl.crte = NULL; + } rsm = TAILQ_FIRST(&bbr->r_ctl.rc_map); while (rsm) { TAILQ_REMOVE(&bbr->r_ctl.rc_map, rsm, r_next); @@ -13463,15 +13416,6 @@ send: th->th_seq = htonl(tp->snd_max); bbr_seq = tp->snd_max; } - } else if (flags & TH_RST) { - /* - * For a Reset send the last cum ack in sequence - * (this like any other choice may still generate a - * challenge ack, if a ack-update packet is in - * flight). - */ - th->th_seq = htonl(tp->snd_una); - bbr_seq = tp->snd_una; } else { /* * len == 0 and not persist we use snd_max, sending @@ -14536,9 +14480,9 @@ bbr_set_sockopt(struct socket *so, struct sockopt *sopt, } else { bbr->bbr_hdw_pace_ena = 0; #ifdef RATELIMIT - if (bbr->bbr_hdrw_pacing) { - bbr->bbr_hdrw_pacing = 0; - in_pcbdetach_txrtlmt(bbr->rc_inp); + if (bbr->r_ctl.crte != NULL) { + tcp_rel_pacing_rate(bbr->r_ctl.crte, tp); + bbr->r_ctl.crte = NULL; } #endif } diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index d2093e1afab7..64180125658f 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -63,7 +63,10 @@ __FBSDID("$FreeBSD$"); #include #include #include - +#ifdef TCP_ACCOUNTING +#include +#include +#endif #include #include @@ -91,8 +94,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #ifdef NETFLIX_SHARED_CWND @@ -133,6 +138,15 @@ uma_zone_t rack_pcb_zone; #define TICKS2SBT(__t) (tick_sbt * ((sbintime_t)(__t))) #endif +VNET_DECLARE(uint32_t, newreno_beta); +VNET_DECLARE(uint32_t, newreno_beta_ecn); +#define V_newreno_beta VNET(newreno_beta) +#define V_newreno_beta_ecn VNET(newreno_beta_ecn) + + +MALLOC_DEFINE(M_TCPFSB, "tcp_fsb", "TCP fast send block"); +MALLOC_DEFINE(M_TCPDO, "tcp_do", "TCP deferred options"); + struct sysctl_ctx_list rack_sysctl_ctx; struct sysctl_oid *rack_sysctl_root; @@ -175,30 +189,51 @@ static int32_t rack_tlp_thresh = 1; static int32_t rack_tlp_limit = 2; /* No more than 2 TLPs w-out new data */ static int32_t rack_tlp_use_greater = 1; static int32_t rack_reorder_thresh = 2; -static int32_t rack_reorder_fade = 60000; /* 0 - never fade, def 60,000 +static int32_t rack_reorder_fade = 60000000; /* 0 - never fade, def 60,000,000 * - 60 seconds */ +static uint8_t rack_req_measurements = 1; /* Attack threshold detections */ static uint32_t rack_highest_sack_thresh_seen = 0; static uint32_t rack_highest_move_thresh_seen = 0; - -static int32_t rack_pkt_delay = 1; -static int32_t rack_early_recovery = 1; +static int32_t rack_enable_hw_pacing = 0; /* Due to CCSP keep it off by default */ +static int32_t rack_hw_pace_extra_slots = 2; /* 2 extra MSS time betweens */ +static int32_t rack_hw_rate_caps = 1; /* 1; */ +static int32_t rack_hw_rate_min = 0; /* 1500000;*/ +static int32_t rack_hw_rate_to_low = 0; /* 1200000; */ +static int32_t rack_hw_up_only = 1; +static int32_t rack_stats_gets_ms_rtt = 1; +static int32_t rack_prr_addbackmax = 2; + +static int32_t rack_pkt_delay = 1000; static int32_t rack_send_a_lot_in_prr = 1; -static int32_t rack_min_to = 1; /* Number of ms minimum timeout */ +static int32_t rack_min_to = 1000; /* Number of microsecond min timeout */ static int32_t rack_verbose_logging = 0; static int32_t rack_ignore_data_after_close = 1; -static int32_t rack_enable_shared_cwnd = 0; +static int32_t rack_enable_shared_cwnd = 1; +static int32_t rack_use_cmp_acks = 1; +static int32_t rack_use_fsb = 1; +static int32_t rack_use_rfo = 1; +static int32_t rack_use_rsm_rfo = 1; +static int32_t rack_max_abc_post_recovery = 2; +static int32_t rack_client_low_buf = 0; +#ifdef TCP_ACCOUNTING +static int32_t rack_tcp_accounting = 0; +#endif static int32_t rack_limits_scwnd = 1; static int32_t rack_enable_mqueue_for_nonpaced = 0; static int32_t rack_disable_prr = 0; static int32_t use_rack_rr = 1; static int32_t rack_non_rxt_use_cr = 0; /* does a non-rxt in recovery use the configured rate (ss/ca)? */ -static int32_t rack_persist_min = 250; /* 250ms */ -static int32_t rack_persist_max = 2000; /* 2 Second */ -static int32_t rack_sack_not_required = 0; /* set to one to allow non-sack to use rack */ -static int32_t rack_default_init_window = 0; /* Use system default */ +static int32_t rack_persist_min = 250000; /* 250usec */ +static int32_t rack_persist_max = 2000000; /* 2 Second in usec's */ +static int32_t rack_sack_not_required = 1; /* set to one to allow non-sack to use rack */ +static int32_t rack_default_init_window = 0; /* Use system default */ static int32_t rack_limit_time_with_srtt = 0; -static int32_t rack_hw_pace_adjust = 0; +static int32_t rack_autosndbuf_inc = 20; /* In percentage form */ +static int32_t rack_enobuf_hw_boost_mult = 2; /* How many times the hw rate we boost slot using time_between */ +static int32_t rack_enobuf_hw_max = 12000; /* 12 ms in usecs */ +static int32_t rack_enobuf_hw_min = 10000; /* 10 ms in usecs */ +static int32_t rack_hw_rwnd_factor = 2; /* How many max_segs the rwnd must be before we hold off sending */ /* * Currently regular tcp has a rto_min of 30ms * the backoff goes 12 times so that ends up @@ -209,23 +244,21 @@ static uint32_t rack_def_data_window = 20; static uint32_t rack_goal_bdp = 2; static uint32_t rack_min_srtts = 1; static uint32_t rack_min_measure_usec = 0; -static int32_t rack_tlp_min = 10; -static int32_t rack_rto_min = 30; /* 30ms same as main freebsd */ -static int32_t rack_rto_max = 4000; /* 4 seconds */ +static int32_t rack_tlp_min = 10000; /* 10ms */ +static int32_t rack_rto_min = 30000; /* 30,000 usec same as main freebsd */ +static int32_t rack_rto_max = 4000000; /* 4 seconds in usec's */ static const int32_t rack_free_cache = 2; static int32_t rack_hptsi_segments = 40; static int32_t rack_rate_sample_method = USE_RTT_LOW; static int32_t rack_pace_every_seg = 0; -static int32_t rack_delayed_ack_time = 200; /* 200ms */ +static int32_t rack_delayed_ack_time = 40000; /* 40ms in usecs */ static int32_t rack_slot_reduction = 4; static int32_t rack_wma_divisor = 8; /* For WMA calculation */ static int32_t rack_cwnd_block_ends_measure = 0; static int32_t rack_rwnd_block_ends_measure = 0; +static int32_t rack_def_profile = 0; static int32_t rack_lower_cwnd_at_tlp = 0; -static int32_t rack_use_proportional_reduce = 0; -static int32_t rack_proportional_rate = 10; -static int32_t rack_tlp_max_resend = 2; static int32_t rack_limited_retran = 0; static int32_t rack_always_send_oldest = 0; static int32_t rack_tlp_threshold_use = TLP_USE_TWO_ONE; @@ -247,13 +280,13 @@ static uint32_t rack_probertt_use_min_rtt_entry = 1; /* Use the min to calculate static uint32_t rack_probertt_use_min_rtt_exit = 0; static uint32_t rack_probe_rtt_sets_cwnd = 0; static uint32_t rack_probe_rtt_safety_val = 2000000; /* No more than 2 sec in probe-rtt */ -static uint32_t rack_time_between_probertt = 9600000; /* 9.6 sec in us */ +static uint32_t rack_time_between_probertt = 9600000; /* 9.6 sec in usecs */ static uint32_t rack_probertt_gpsrtt_cnt_mul = 0; /* How many srtt periods does probe-rtt last top fraction */ -static uint32_t rack_probertt_gpsrtt_cnt_div = 0; /* How many srtt periods does probe-rtt last bottom fraction */ -static uint32_t rack_min_probertt_hold = 200000; /* Equal to delayed ack time */ +static uint32_t rack_probertt_gpsrtt_cnt_div = 0; /* How many srtt periods does probe-rtt last bottom fraction */ +static uint32_t rack_min_probertt_hold = 40000; /* Equal to delayed ack time */ static uint32_t rack_probertt_filter_life = 10000000; static uint32_t rack_probertt_lower_within = 10; -static uint32_t rack_min_rtt_movement = 250; /* Must move at least 250 useconds to count as a lowering */ +static uint32_t rack_min_rtt_movement = 250000; /* Must move at least 250ms (in microseconds) to count as a lowering */ static int32_t rack_pace_one_seg = 0; /* Shall we pace for less than 1.4Meg 1MSS at a time */ static int32_t rack_probertt_clear_is = 1; static int32_t rack_max_drain_hbp = 1; /* Extra drain times gpsrtt for highly buffered paths */ @@ -264,7 +297,7 @@ static int32_t rack_max_per_above = 30; /* When we go to increment stop if abov /* Timely information */ /* Combine these two gives the range of 'no change' to bw */ -/* ie the up/down provide the upper and lower bound */ +/* ie the up/down provide the upper and lower bound */ static int32_t rack_gp_per_bw_mul_up = 2; /* 2% */ static int32_t rack_gp_per_bw_mul_down = 4; /* 4% */ static int32_t rack_gp_rtt_maxmul = 3; /* 3 x maxmin */ @@ -286,6 +319,7 @@ static int32_t rack_timely_int_timely_only = 0; /* do interim timely's only use static int32_t rack_timely_no_stopping = 0; static int32_t rack_down_raise_thresh = 100; static int32_t rack_req_segs = 1; +static uint64_t rack_bw_rate_cap = 0; /* Weird delayed ack mode */ static int32_t rack_use_imac_dack = 0; @@ -301,9 +335,14 @@ counter_u64_t rack_unpaced_segments; counter_u64_t rack_calc_zero; counter_u64_t rack_calc_nonzero; counter_u64_t rack_saw_enobuf; +counter_u64_t rack_saw_enobuf_hw; counter_u64_t rack_saw_enetunreach; counter_u64_t rack_per_timer_hole; - +counter_u64_t rack_large_ackcmp; +counter_u64_t rack_small_ackcmp; +#ifdef INVARIANTS +counter_u64_t rack_adjust_map_bw; +#endif /* Tail loss probe counters */ counter_u64_t rack_tlp_tot; counter_u64_t rack_tlp_newdata; @@ -313,6 +352,7 @@ counter_u64_t rack_tlp_retran_fail; counter_u64_t rack_to_tot; counter_u64_t rack_to_arm_rack; counter_u64_t rack_to_arm_tlp; +counter_u64_t rack_hot_alloc; counter_u64_t rack_to_alloc; counter_u64_t rack_to_alloc_hard; counter_u64_t rack_to_alloc_emerg; @@ -320,6 +360,17 @@ counter_u64_t rack_to_alloc_limited; counter_u64_t rack_alloc_limited_conns; counter_u64_t rack_split_limited; +#define MAX_NUM_OF_CNTS 13 +counter_u64_t rack_proc_comp_ack[MAX_NUM_OF_CNTS]; +counter_u64_t rack_multi_single_eq; +counter_u64_t rack_proc_non_comp_ack; + +counter_u64_t rack_fto_send; +counter_u64_t rack_fto_rsm_send; +counter_u64_t rack_nfto_resend; +counter_u64_t rack_non_fto_send; +counter_u64_t rack_extended_rfo; + counter_u64_t rack_sack_proc_all; counter_u64_t rack_sack_proc_short; counter_u64_t rack_sack_proc_restart; @@ -342,6 +393,10 @@ counter_u64_t rack_input_idle_reduces; counter_u64_t rack_collapsed_win; counter_u64_t rack_tlp_does_nada; counter_u64_t rack_try_scwnd; +counter_u64_t rack_hw_pace_init_fail; +counter_u64_t rack_hw_pace_lost; +counter_u64_t rack_sbsndptr_right; +counter_u64_t rack_sbsndptr_wrong; /* Temp CPU counters */ counter_u64_t rack_find_high; @@ -350,6 +405,17 @@ counter_u64_t rack_progress_drops; counter_u64_t rack_out_size[TCP_MSS_ACCT_SIZE]; counter_u64_t rack_opts_arry[RACK_OPTS_SIZE]; + +#define RACK_REXMTVAL(tp) max(rack_rto_min, ((tp)->t_srtt + ((tp)->t_rttvar << 2))) + +#define RACK_TCPT_RANGESET(tv, value, tvmin, tvmax) do { \ + (tv) = (value) + TICKS_2_USEC(tcp_rexmit_slop); \ + if ((u_long)(tv) < (u_long)(tvmin)) \ + (tv) = (tvmin); \ + if ((u_long)(tv) > (u_long)(tvmax)) \ + (tv) = (tvmax); \ +} while (0) + static void rack_log_progress_event(struct tcp_rack *rack, struct tcpcb *tp, uint32_t tick, int event, int line); @@ -363,7 +429,7 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt); static void rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack, - struct tcphdr *th, uint16_t nsegs, uint16_t type, int32_t recovery); + uint32_t th_ack, uint16_t nsegs, uint16_t type, int32_t recovery); static struct rack_sendmap *rack_alloc(struct tcp_rack *rack); static struct rack_sendmap *rack_alloc_limit(struct tcp_rack *rack, uint8_t limit_type); @@ -371,24 +437,21 @@ static struct rack_sendmap * rack_check_recovery_mode(struct tcpcb *tp, uint32_t tsused); static void -rack_cong_signal(struct tcpcb *tp, struct tcphdr *th, - uint32_t type); +rack_cong_signal(struct tcpcb *tp, + uint32_t type, uint32_t ack); static void rack_counter_destroy(void); static int rack_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb *inp, struct tcpcb *tp); static int32_t rack_ctor(void *mem, int32_t size, void *arg, int32_t how); static void -rack_set_pace_segments(struct tcpcb *tp, struct tcp_rack *rack, uint32_t line); +rack_set_pace_segments(struct tcpcb *tp, struct tcp_rack *rack, uint32_t line, uint64_t *fill_override); static void rack_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, int32_t drop_hdrlen, int32_t tlen, uint8_t iptos); static void rack_dtor(void *mem, int32_t size, void *arg); static void -rack_earlier_retran(struct tcpcb *tp, struct rack_sendmap *rsm, - uint32_t t, uint32_t cts); -static void rack_log_alt_to_to_cancel(struct tcp_rack *rack, uint32_t flex1, uint32_t flex2, uint32_t flex3, uint32_t flex4, @@ -416,11 +479,12 @@ static int32_t rack_init(struct tcpcb *tp); static void rack_init_sysctls(void); static void rack_log_ack(struct tcpcb *tp, struct tcpopt *to, - struct tcphdr *th); + struct tcphdr *th, int entered_rec, int dup_ack_struck); static void rack_log_output(struct tcpcb *tp, struct tcpopt *to, int32_t len, - uint32_t seq_out, uint8_t th_flags, int32_t err, uint32_t ts, - uint8_t pass, struct rack_sendmap *hintrsm, uint32_t us_cts); + uint32_t seq_out, uint8_t th_flags, int32_t err, uint64_t ts, + struct rack_sendmap *hintrsm, uint16_t add_flags, struct mbuf *s_mb, uint32_t s_moff); + static void rack_log_sack_passed(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendmap *rsm); @@ -431,7 +495,7 @@ static uint32_t rack_proc_sack_blk(struct tcpcb *tp, struct tcp_rack *rack, struct sackblk *sack, struct tcpopt *to, struct rack_sendmap **prsm, uint32_t cts, int *moved_two); -static void rack_post_recovery(struct tcpcb *tp, struct tcphdr *th); +static void rack_post_recovery(struct tcpcb *tp, uint32_t th_seq); static void rack_remxt_tmr(struct tcpcb *tp); static int rack_set_sockopt(struct socket *so, struct sockopt *sopt, @@ -446,10 +510,10 @@ static void rack_timer_cancel(struct tcpcb *tp, struct tcp_rack *rack, uint32_t static void rack_timer_stop(struct tcpcb *tp, uint32_t timer_type); static uint32_t rack_update_entry(struct tcpcb *tp, struct tcp_rack *rack, - struct rack_sendmap *rsm, uint32_t ts, int32_t * lenp); + struct rack_sendmap *rsm, uint64_t ts, int32_t * lenp, uint16_t add_flag); static void rack_update_rsm(struct tcpcb *tp, struct tcp_rack *rack, - struct rack_sendmap *rsm, uint32_t ts); + struct rack_sendmap *rsm, uint64_t ts, uint16_t add_flag); static int rack_update_rtt(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendmap *rsm, struct tcpopt *to, uint32_t cts, int32_t ack_type, tcp_seq th_ack); @@ -496,15 +560,182 @@ tcp_rack_output(struct tcpcb *tp, struct tcp_rack *rack, static void tcp_rack_xmit_timer(struct tcp_rack *rack, int32_t rtt, uint32_t len, uint32_t us_tim, int confidence, struct rack_sendmap *rsm, uint16_t rtrcnt); static void - tcp_rack_partialack(struct tcpcb *tp, struct tcphdr *th); + tcp_rack_partialack(struct tcpcb *tp); +static int +rack_set_profile(struct tcp_rack *rack, int prof); +static void +rack_apply_deferred_options(struct tcp_rack *rack); int32_t rack_clear_counter=0; +static void +rack_set_cc_pacing(struct tcp_rack *rack) +{ + struct sockopt sopt; + struct cc_newreno_opts opt; + struct newreno old, *ptr; + struct tcpcb *tp; + int error; + + if (rack->rc_pacing_cc_set) + return; + + tp = rack->rc_tp; + if (tp->cc_algo == NULL) { + /* Tcb is leaving */ + printf("No cc algorithm?\n"); + return; + } + rack->rc_pacing_cc_set = 1; + if (strcmp(tp->cc_algo->name, CCALGONAME_NEWRENO) != 0) { + /* Not new-reno we can't play games with beta! */ + printf("cc_algo:%s is not NEWRENO:%s\n", + tp->cc_algo->name, CCALGONAME_NEWRENO); + goto out; + } + ptr = ((struct newreno *)tp->ccv->cc_data); + if (CC_ALGO(tp)->ctl_output == NULL) { + /* Huh, why does new_reno no longer have a set function? */ + printf("no ctl_output for algo:%s\n", tp->cc_algo->name); + goto out; + } + if (ptr == NULL) { + /* Just the default values */ + old.beta = V_newreno_beta_ecn; *** 14144 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu May 6 17:22:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B131628A9C; Thu, 6 May 2021 17:22:45 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbgPx409yz4t1l; Thu, 6 May 2021 17:22:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7BE7D1C1D7; Thu, 6 May 2021 17:22:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146HMjfc067916; Thu, 6 May 2021 17:22:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146HMjpO067915; Thu, 6 May 2021 17:22:45 GMT (envelope-from git) Date: Thu, 6 May 2021 17:22:45 GMT Message-Id: <202105061722.146HMjpO067915@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: be578b67b5a5 - main - tcp_twcheck(): use correct unlock macro. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be578b67b5a5bedbbec61c7164875b6b1e1b8fff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 17:22:45 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=be578b67b5a5bedbbec61c7164875b6b1e1b8fff commit be578b67b5a5bedbbec61c7164875b6b1e1b8fff Author: Gleb Smirnoff AuthorDate: 2021-05-06 17:19:21 +0000 Commit: Gleb Smirnoff CommitDate: 2021-05-06 17:19:21 +0000 tcp_twcheck(): use correct unlock macro. This crippled in due to conflict between two last commits 1db08fbe3ff and 9e644c23000. Submitted by: Peter Lei --- sys/netinet/tcp_timewait.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 695ec4413ac9..5d4de222b802 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -478,7 +478,7 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, tcp_respond(NULL, mtod(m, void *), th, m, th->th_seq+tlen, (tcp_seq)0, TH_RST|TH_ACK); } - INP_WUNLOCK(inp); + INP_UNLOCK(inp); return (0); } From owner-dev-commits-src-all@freebsd.org Thu May 6 17:39:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 974826291A2 for ; Thu, 6 May 2021 17:39:39 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbgnR3Lqdz4tfN for ; Thu, 6 May 2021 17:39:39 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x735.google.com with SMTP id o27so5736589qkj.9 for ; Thu, 06 May 2021 10:39:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=PW3GN0XN1zRQlMn2Ae4dC70S3Zm5SF/gzRpwzsnuGa8=; b=OJ7BJ7B/QYSrwdptaNZpwo8fU7M3hHeePg21wrQcI+cuf7JzafZs7vv3s+snzIBBsw 5EFo7JahWvvCgHtdhH0z4zmPUvfwzZNZof3tLc7JNN6lbW6eRxnNaajpLQmaswVU4zm3 +qrMGq3Up7l74JtiolqRAIs9Ni58jnjEDocWK949ouZagDZF9adlotQwxH8ARtcipuO2 y5g829jJBuCvDSXIfj5HjAEhuz4NaotWqiNfwPNNAK0hOuBsis/bTnk25aGogT6cwSCA AgnJIhq+cPjouR6+BdC6V4pSPsn3FafVtZt7tOtDVsfSrcl0+qmEgNULpT2Zz6jXeuKX PISA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=PW3GN0XN1zRQlMn2Ae4dC70S3Zm5SF/gzRpwzsnuGa8=; b=A6ovfl2y16pidE7UOJc3xssVLRG0o7w4pxnXQLLRuqU4mcWF2hh04yY4XqbI/Ib8LZ mL1bxreI368FIOPF3+x/eAc5BnBo8myu7qqyeiPd1rY6vOrkid4iw69BPbSBRGpk7BCq +gi+xuOPUl6Rf/JS0vF1iM/bM/mOj7JnCcScFxAU8Z6fZnu0ejqHYX/WEaHw9tnhZIU3 N1Xprus68WFaB6f0yuyx/EPKwa1mhMB4gps1OLqiH1Y7N4RptnwXa3qSigBRy0p2vFIj OhCgKI0SqK/3CKm2wquGiEoTHGzc4NdUG8uTEmmR0tF+LTehpW4zFP6i0NZXe/ZvqG65 rm4A== X-Gm-Message-State: AOAM531kaK4IHfNeYGzJeemylraLk+5b5xiiBXP7fQtc/QOtojtCAFIK 9Dp/LyHJdYLVMDJBIjE96S0wJQ== X-Google-Smtp-Source: ABdhPJyq7NK04kjtG1ePIiOh5gp6Jw+acF/tXrGNzoRUWa7bVwEFCZCLbIEfa/xqK9P9IPfpWNgGpg== X-Received: by 2002:ae9:f10b:: with SMTP id k11mr5338470qkg.62.1620322778490; Thu, 06 May 2021 10:39:38 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-222-53.bltmmd.fios.verizon.net. [100.16.222.53]) by smtp.gmail.com with ESMTPSA id f7sm2986285qtm.41.2021.05.06.10.39.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 May 2021 10:39:37 -0700 (PDT) Date: Thu, 6 May 2021 13:39:37 -0400 From: Shawn Webb To: Randall Stewart Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. Message-ID: <20210506173937.khuft4fuvztidkf3@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="u2yl6bpfqrkntlk5" Content-Disposition: inline In-Reply-To: <202105061526.146FQS0E008755@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4FbgnR3Lqdz4tfN X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 17:39:39 -0000 --u2yl6bpfqrkntlk5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 06, 2021 at 03:26:28PM +0000, Randall Stewart wrote: > The branch main has been updated by rrs: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D5d8fd932e418f03e98b3469c40= 88a36f0ef34ffe >=20 > commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe > Author: Randall Stewart > AuthorDate: 2021-05-06 15:22:26 +0000 > Commit: Randall Stewart > CommitDate: 2021-05-06 15:22:26 +0000 >=20 > This brings into sync FreeBSD with the netflix versions of rack and b= br. > This fixes several breakages (panics) since the tcp_lro code was > committed that have been reported. Quite a few new features are > now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the > largest). There is also support for ack-war prevention. Documents > comming soon on rack.. > =20 > Sponsored by: Netflix > Reviewed by: rscheff, mtuexen > Differential Revision: https://reviews.freebsd.org/D30036 > --- > sys/netinet/cc/cc.h | 7 +- > sys/netinet/cc/cc_newreno.c | 34 +- > sys/netinet/cc/cc_newreno.h | 13 +- > sys/netinet/tcp.h | 24 +- > sys/netinet/tcp_accounting.h | 39 + > sys/netinet/tcp_input.c | 10 +- > sys/netinet/tcp_log_buf.h | 8 +- > sys/netinet/tcp_ratelimit.c | 29 +- > sys/netinet/tcp_ratelimit.h | 4 +- > sys/netinet/tcp_sack.c | 11 + > sys/netinet/tcp_stacks/bbr.c | 92 +- > sys/netinet/tcp_stacks/rack.c | 9876 ++++++++++++++++++++++--= ------ Hey Randall, Out of curiosity, did anyone take the time to audit/review the changes to rack.c? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --u2yl6bpfqrkntlk5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmCUKdYACgkQ/y5nonf4 4fqASw//dqyYRZi4/PsnGz12e4XA6TSu1cczo0IHSc7kqNFv2Naq4mlM0+wLL3ke jibw5yU0FiRa0uglmoaTskigwbqNjm0zPQjGeJUvyCdoW6SbyJtWDvbjnNf8aqi2 xKnHlOvAWeFiQ3FUAsfK3LRvEC0eqUtV5dywxJ6vfVzi5O1pQr9m0steGc0+QLvo KvnF9vcQGSmaYGm4yPoufDXv3yWPek8MynsEJQeSmN0/I4+4fvERPKRVd1KQvEcB ittFDnCntPxgUG1JkWAE5KTsn1AfondEn/r/lYPIXjQJbTXf9MoHpPp6WukVhCnt fzwp0tLjPARQIv6DWuIOs3ngKOK3DdjxGsrO5n74tQtOtSeWUh9h06P6BPMa1Cn9 +sBhJSDE70ahcfCQE/vONZbCeX8tta18EXG3MmrhOJOsDBgeoPqTXxH1pV59Lqaw SMpfa7q7e/GcgblJSxOa5lpBXZmke1MYOtIaVtYzV2Ua1ee0ZqN5kRo+ccAKxsbU dQWvB9/b6qgNewmpOJgf/ljntuQUTbHGiszXokqju+3rFMZL3jFSWI/oknd8W2Ww W+r8iisXw8M8tEFwCOcMPF/rRG49xnwrcHASrejJZ/+nQm3iSvdlDisAGciHFVTC oUEHTU4+70FiQSesfV8JEbhP2U4h6tl+huZoTTU1BQfH1v/j5hI= =CQ+6 -----END PGP SIGNATURE----- --u2yl6bpfqrkntlk5-- From owner-dev-commits-src-all@freebsd.org Thu May 6 18:33:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC8A462A826; Thu, 6 May 2021 18:33:26 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbhzV5yMdz4x9T; Thu, 6 May 2021 18:33:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BF4941D394; Thu, 6 May 2021 18:33:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146IXQfv061403; Thu, 6 May 2021 18:33:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146IXQAP061402; Thu, 6 May 2021 18:33:26 GMT (envelope-from git) Date: Thu, 6 May 2021 18:33:26 GMT Message-Id: <202105061833.146IXQAP061402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 420dbe763f15 - main - gmultipath: make physpath distinct from the underlying providers' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 420dbe763f15b076751443edfeeb4f676deb3c44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 18:33:26 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=420dbe763f15b076751443edfeeb4f676deb3c44 commit 420dbe763f15b076751443edfeeb4f676deb3c44 Author: Alan Somers AuthorDate: 2021-04-22 21:09:03 +0000 Commit: Alan Somers CommitDate: 2021-05-06 18:32:27 +0000 gmultipath: make physpath distinct from the underlying providers' zfsd uses a device's physical path attribute to automatically replace a missing ZFS disk when a blank disk is inserted into the same physical slot. Currently gmultipath passes through its underlying providers' physical path attribute. That may cause zfsd to replace a missing gmultipath provider with a newly arrived, single-path disk. That would be bad. This commit fixes that problem by simply appending "/mp" to the underlying providers' physical path, in a manner similar to what geli already does. Sponsored by: Axcient MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D29941 --- sys/geom/multipath/g_multipath.c | 6 ++++++ tests/sys/geom/class/multipath/misc.sh | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/geom/multipath/g_multipath.c b/sys/geom/multipath/g_multipath.c index 5972b63e680a..120fced0a8f1 100644 --- a/sys/geom/multipath/g_multipath.c +++ b/sys/geom/multipath/g_multipath.c @@ -394,6 +394,12 @@ g_multipath_done(struct bio *bp) mtx_unlock(&sc->sc_mtx); } else mtx_unlock(&sc->sc_mtx); + if (bp->bio_error == 0 && + bp->bio_cmd == BIO_GETATTR && + !strcmp(bp->bio_attribute, "GEOM::physpath")) + { + strlcat(bp->bio_data, "/mp", bp->bio_length); + } g_std_done(bp); } } diff --git a/tests/sys/geom/class/multipath/misc.sh b/tests/sys/geom/class/multipath/misc.sh index 583434e1cfa5..4da8462588ca 100755 --- a/tests/sys/geom/class/multipath/misc.sh +++ b/tests/sys/geom/class/multipath/misc.sh @@ -198,7 +198,7 @@ fail_on_error_cleanup() atf_test_case physpath cleanup physpath_head() { - atf_set "descr" "gmultipath should pass through the underlying providers' physical path" + atf_set "descr" "gmultipath should append /mp to the underlying providers' physical path" atf_set "require.user" "root" } physpath_body() @@ -217,7 +217,7 @@ physpath_body() atf_check gnop create -z $physpath /dev/${md1} atf_check -s exit:0 gmultipath create "$name" ${md0}.nop ${md1}.nop gmultipath_physpath=$(diskinfo -p multipath/"$name") - atf_check_equal "$physpath" "$gmultipath_physpath" + atf_check_equal "$physpath/mp" "$gmultipath_physpath" } physpath_cleanup() { From owner-dev-commits-src-all@freebsd.org Thu May 6 18:52:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D590B62AEEF; Thu, 6 May 2021 18:52:16 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbjPD5jbXz4y7d; Thu, 6 May 2021 18:52:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B72DB1D443; Thu, 6 May 2021 18:52:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146IqGBe087284; Thu, 6 May 2021 18:52:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146IqGow087283; Thu, 6 May 2021 18:52:16 GMT (envelope-from git) Date: Thu, 6 May 2021 18:52:16 GMT Message-Id: <202105061852.146IqGow087283@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 12588ce02dd8 - main - PCI hot-plug: use dedicated taskqueue for device attach / detach MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 12588ce02dd835b332952d9fece5881d943554a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 18:52:16 -0000 The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=12588ce02dd835b332952d9fece5881d943554a9 commit 12588ce02dd835b332952d9fece5881d943554a9 Author: Andriy Gapon AuthorDate: 2021-05-06 18:49:37 +0000 Commit: Andriy Gapon CommitDate: 2021-05-06 18:49:37 +0000 PCI hot-plug: use dedicated taskqueue for device attach / detach Attaching and detaching devices can be heavy-weight and detaching can sleep waiting for events. For that reason using the system-wide single-threaded taskqueue_thread is not really appropriate. There is even a possibility for a deadlock if taskqueue_thread is used for detaching. In fact, there is an easy to reproduce deadlock involving nvme, pass and a sudden removal of an NVMe device. A pass peripheral would not release a reference on an nvme sim until pass_shutdown_kqueue() is executed via taskqueue_thread. But the taskqueue's thread is blocked in nvme_detach() -> ... -> cam_sim_free() because of the outstanding reference. MFC after: 10 days Sponsored by: CyberSecure Reviewed by: mav, imp Differential Revision: https://reviews.freebsd.org/D30144 --- sys/dev/pci/pci_pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 3a11d59f51fd..d6fbb06a61ac 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -925,6 +925,8 @@ SYSCTL_INT(_hw_pci, OID_AUTO, enable_pcie_hp, CTLFLAG_RDTUN, &pci_enable_pcie_hp, 0, "Enable support for native PCI-express HotPlug."); +TASKQUEUE_DEFINE_THREAD(pci_hp); + static void pcib_probe_hotplug(struct pcib_softc *sc) { @@ -1154,7 +1156,7 @@ pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask, */ if (schedule_task && (pcib_hotplug_present(sc) != 0) != (sc->child != NULL)) - taskqueue_enqueue(taskqueue_thread, &sc->pcie_hp_task); + taskqueue_enqueue(taskqueue_pci_hp, &sc->pcie_hp_task); } static void @@ -1449,7 +1451,7 @@ pcib_detach_hotplug(struct pcib_softc *sc) error = pcib_release_pcie_irq(sc); if (error) return (error); - taskqueue_drain(taskqueue_thread, &sc->pcie_hp_task); + taskqueue_drain(taskqueue_pci_hp, &sc->pcie_hp_task); callout_drain(&sc->pcie_ab_timer); callout_drain(&sc->pcie_cc_timer); callout_drain(&sc->pcie_dll_timer); From owner-dev-commits-src-all@freebsd.org Thu May 6 19:09:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1939D62B2F0; Thu, 6 May 2021 19:09:49 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbjnT0Fvfz4yZc; Thu, 6 May 2021 19:09:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E11541D6F2; Thu, 6 May 2021 19:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146J9mN0002482; Thu, 6 May 2021 19:09:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146J9muS002481; Thu, 6 May 2021 19:09:48 GMT (envelope-from git) Date: Thu, 6 May 2021 19:09:48 GMT Message-Id: <202105061909.146J9muS002481@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e713d3a01388 - main - boot: fix OBJS to not include BTX's crt0.o MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e713d3a013882893fceb84dd14569052271497a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 19:09:49 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e713d3a013882893fceb84dd14569052271497a9 commit e713d3a013882893fceb84dd14569052271497a9 Author: Warner Losh AuthorDate: 2021-05-06 19:05:09 +0000 Commit: Warner Losh CommitDate: 2021-05-06 19:08:30 +0000 boot: fix OBJS to not include BTX's crt0.o According to comments in the Makefile, to make pxeboot work we need to have crt0.o first. This is needed because the simplified loader in pxeboot assumes that the startup code is at offset 0 in this binary. In normal booting, the start address can be obtained from headers of the binary, but since pxeboot encodes this as a pure binary, it has no way of knowing where that is and assumes 0. Added comments to that effect in the Makefile. We've done this by adding it to OBJS before all the other .o's are added. However, there's a problem. This also adds it to the CLEANFILES variable, which causes it to be removed from multiple places. The dependencies may also cause it to be re-built at a time that's after boot2 is built. This causes installs to fail because at install time boot2 is considered to be out of date and the programs to rebuild it are no longer in the path. Cope with this problem by just adding it to LDFLAGS instead. Glanced at by: kevans ("I thought that went in ages ago") Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28876 --- stand/i386/loader/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index ad95948ec50a..dcae7bd67a14 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -89,8 +89,18 @@ LINKS+= ${BINDIR}/${LOADER} ${BINDIR}/loader FILES+= ${LOADER} FILESMODE_${LOADER}= ${BINMODE} -b -# XXX crt0.o needs to be first for pxeboot(8) to work -OBJS= ${BTXCRT} +# Note: crt0.o needs to be first for pxeboot(8) to work. It assumes that the +# startup code is located at the start of the loader and will jump +# there. Although btx is more flexible than this, the emulated boot2 environment +# that pxeloader provides has none of that flexibility because it lacks access +# to the a.out/elf headers and assumes an entry point of 0. +# +# We must add it to the LDFLAGS instead of the OBJS becauce the former won't try +# to clean it. When it is in OBJS, this cleaning can lead to races where +# btxcrt.o is rebuilt, but boot2 isn't, leading to errors at installation time. +# LDFLAGS does not have this baggage and will be included first in the list of +# files. +LDFLAGS+= ${BTXCRT} DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} From owner-dev-commits-src-all@freebsd.org Thu May 6 20:11:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A21C62CE90 for ; Thu, 6 May 2021 20:11:44 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fbl8w09vLz51xY; Thu, 6 May 2021 20:11:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EB5A61E0FC; Thu, 6 May 2021 20:11:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146KBhAu092887; Thu, 6 May 2021 20:11:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146KBTt6092873; Thu, 6 May 2021 20:11:29 GMT (envelope-from git) Date: Thu, 6 May 2021 20:11:29 GMT Message-Id: <202105062011.146KBTt6092873@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Cy Schubert Subject: git: 8b10604cd159 - vendor/sqlite3 - Revert "sqlite3: Vendor import of sqlite3 3.35.5" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/vendor/sqlite3 X-Git-Reftype: branch X-Git-Commit: 8b10604cd15958e62b9d4eb62bcb925272583db1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 20:11:44 -0000 The branch vendor/sqlite3 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=8b10604cd15958e62b9d4eb62bcb925272583db1 commit 8b10604cd15958e62b9d4eb62bcb925272583db1 Author: Cy Schubert AuthorDate: 2021-05-06 20:08:52 +0000 Commit: Cy Schubert CommitDate: 2021-05-06 20:08:52 +0000 Revert "sqlite3: Vendor import of sqlite3 3.35.5" The source to be used should be sqlite-autoconf-3350500.tar.gz instead of the souce sqlite-amalgamation-3350500.zip used by the port. This reverts commit eccd5a4d3926c0716dd11bdf3242da56116f68c6. --- .fossil-settings/empty-dirs | 1 - .fossil-settings/ignore-glob | 1 - autoconf/INSTALL => INSTALL | 0 LICENSE.md | 6 - autoconf/Makefile.am => Makefile.am | 0 autoconf/Makefile.fallback => Makefile.fallback | 0 Makefile.in | 2482 +- Makefile.linux-gcc | 115 - Makefile.msc | 1658 +- README.md | 327 - autoconf/README.txt => README.txt | 0 tool/Replace.cs => Replace.cs | 0 VERSION | 1 - aclocal.m4 | 5553 +- art/sqlite370.eps | 5333 - art/sqlite370.ico | Bin 2238 -> 0 bytes art/sqlite370.jpg | Bin 80726 -> 0 bytes autoconf/Makefile.msc | 1039 - autoconf/README.first | 11 - autoconf/configure.ac | 285 - compile | 347 + config.guess | 353 +- config.h.in | 131 - config.sub | 2469 +- configure | 9983 +- configure.ac | 953 +- contrib/sqlitecon.tcl | 679 - depcomp | 791 + doc/F2FS.txt | 87 - doc/lemon.html | 1240 - doc/pager-invariants.txt | 76 - doc/trusted-schema.md | 142 - doc/vdbesort-memory.md | 49 - doc/vfs-shm.txt | 130 - doc/wal-lock.md | 88 - ext/README.md | 8 - ext/async/README.txt | 170 - ext/async/sqlite3async.c | 1706 - ext/async/sqlite3async.h | 222 - ext/expert/README.md | 83 - ext/expert/expert.c | 156 - ext/expert/expert1.test | 458 - ext/expert/sqlite3expert.c | 1962 - ext/expert/sqlite3expert.h | 168 - ext/expert/test_expert.c | 220 - ext/fts1/README.txt | 2 - ext/fts1/ft_hash.c | 404 - ext/fts1/ft_hash.h | 111 - ext/fts1/fts1.c | 3348 - ext/fts1/fts1.h | 11 - ext/fts1/fts1_hash.c | 369 - ext/fts1/fts1_hash.h | 112 - ext/fts1/fts1_porter.c | 643 - ext/fts1/fts1_tokenizer.h | 90 - ext/fts1/fts1_tokenizer1.c | 221 - ext/fts1/fulltext.c | 1511 - ext/fts1/fulltext.h | 11 - ext/fts1/simple_tokenizer.c | 174 - ext/fts1/tokenizer.h | 89 - ext/fts2/README.tokenizers | 133 - ext/fts2/README.txt | 4 - ext/fts2/fts2.c | 6860 - ext/fts2/fts2.h | 26 - ext/fts2/fts2_hash.c | 376 - ext/fts2/fts2_hash.h | 110 - ext/fts2/fts2_icu.c | 260 - ext/fts2/fts2_porter.c | 644 - ext/fts2/fts2_tokenizer.c | 375 - ext/fts2/fts2_tokenizer.h | 145 - ext/fts2/fts2_tokenizer1.c | 233 - ext/fts2/mkfts2amal.tcl | 116 - ext/fts3/README.content | 176 - ext/fts3/README.syntax | 209 - ext/fts3/README.tokenizers | 135 - ext/fts3/README.txt | 4 - ext/fts3/fts3.c | 6098 - ext/fts3/fts3.h | 26 - ext/fts3/fts3Int.h | 652 - ext/fts3/fts3_aux.c | 551 - ext/fts3/fts3_expr.c | 1293 - ext/fts3/fts3_hash.c | 383 - ext/fts3/fts3_hash.h | 112 - ext/fts3/fts3_icu.c | 262 - ext/fts3/fts3_porter.c | 662 - ext/fts3/fts3_snippet.c | 1748 - ext/fts3/fts3_term.c | 374 - ext/fts3/fts3_test.c | 621 - ext/fts3/fts3_tokenize_vtab.c | 456 - ext/fts3/fts3_tokenizer.c | 520 - ext/fts3/fts3_tokenizer.h | 161 - ext/fts3/fts3_tokenizer1.c | 234 - ext/fts3/fts3_unicode.c | 397 - ext/fts3/fts3_unicode2.c | 383 - ext/fts3/fts3_write.c | 5797 - ext/fts3/fts3speed.tcl | 122 - ext/fts3/mkfts3amal.tcl | 115 - ext/fts3/tool/fts3cov.sh | 16 - ext/fts3/tool/fts3view.c | 875 - ext/fts3/unicode/CaseFolding.txt | 1224 - ext/fts3/unicode/UnicodeData.txt | 24428 -- ext/fts3/unicode/mkunicode.tcl | 984 - ext/fts3/unicode/parseunicode.tcl | 205 - ext/fts5/extract_api_docs.tcl | 252 - ext/fts5/fts5.h | 575 - ext/fts5/fts5Int.h | 842 - ext/fts5/fts5_aux.c | 714 - ext/fts5/fts5_buffer.c | 403 - ext/fts5/fts5_config.c | 960 - ext/fts5/fts5_expr.c | 3054 - ext/fts5/fts5_hash.c | 560 - ext/fts5/fts5_index.c | 6709 - ext/fts5/fts5_main.c | 2921 - ext/fts5/fts5_storage.c | 1161 - ext/fts5/fts5_tcl.c | 1154 - ext/fts5/fts5_test_mi.c | 421 - ext/fts5/fts5_test_tok.c | 483 - ext/fts5/fts5_tokenize.c | 1415 - ext/fts5/fts5_unicode2.c | 778 - ext/fts5/fts5_varint.c | 344 - ext/fts5/fts5_vocab.c | 783 - ext/fts5/fts5parse.y | 197 - ext/fts5/mkportersteps.tcl | 222 - ext/fts5/test/fts5_common.tcl | 647 - ext/fts5/test/fts5aa.test | 641 - ext/fts5/test/fts5ab.test | 296 - ext/fts5/test/fts5ac.test | 278 - ext/fts5/test/fts5ad.test | 243 - ext/fts5/test/fts5ae.test | 311 - ext/fts5/test/fts5af.test | 190 - ext/fts5/test/fts5ag.test | 144 - ext/fts5/test/fts5ah.test | 169 - ext/fts5/test/fts5ai.test | 63 - ext/fts5/test/fts5aj.test | 68 - ext/fts5/test/fts5ak.test | 157 - ext/fts5/test/fts5al.test | 299 - ext/fts5/test/fts5alter.test | 101 - ext/fts5/test/fts5auto.test | 344 - ext/fts5/test/fts5aux.test | 311 - ext/fts5/test/fts5auxdata.test | 114 - ext/fts5/test/fts5bigpl.test | 63 - ext/fts5/test/fts5bigtok.test | 66 - ext/fts5/test/fts5cat.test | 59 - ext/fts5/test/fts5circref.test | 80 - ext/fts5/test/fts5colset.test | 105 - ext/fts5/test/fts5columnsize.test | 150 - ext/fts5/test/fts5config.test | 265 - ext/fts5/test/fts5conflict.test | 68 - ext/fts5/test/fts5connect.test | 246 - ext/fts5/test/fts5content.test | 297 - ext/fts5/test/fts5corrupt.test | 100 - ext/fts5/test/fts5corrupt2.test | 273 - ext/fts5/test/fts5corrupt3.test | 14598 -- ext/fts5/test/fts5corrupt4.test | 63 - ext/fts5/test/fts5delete.test | 117 - ext/fts5/test/fts5detail.test | 243 - ext/fts5/test/fts5determin.test | 65 - ext/fts5/test/fts5dlidx.test | 197 - ext/fts5/test/fts5doclist.test | 46 - ext/fts5/test/fts5ea.test | 99 - ext/fts5/test/fts5eb.test | 100 - ext/fts5/test/fts5fault1.test | 353 - ext/fts5/test/fts5fault2.test | 139 - ext/fts5/test/fts5fault3.test | 112 - ext/fts5/test/fts5fault4.test | 397 - ext/fts5/test/fts5fault5.test | 131 - ext/fts5/test/fts5fault6.test | 293 - ext/fts5/test/fts5fault7.test | 118 - ext/fts5/test/fts5fault8.test | 84 - ext/fts5/test/fts5fault9.test | 159 - ext/fts5/test/fts5faultA.test | 63 - ext/fts5/test/fts5faultB.test | 173 - ext/fts5/test/fts5faultD.test | 87 - ext/fts5/test/fts5faultE.test | 71 - ext/fts5/test/fts5first.test | 95 - ext/fts5/test/fts5full.test | 42 - ext/fts5/test/fts5fuzz1.test | 92 - ext/fts5/test/fts5hash.test | 168 - ext/fts5/test/fts5integrity.test | 320 - ext/fts5/test/fts5interrupt.test | 67 - ext/fts5/test/fts5lastrowid.test | 72 - ext/fts5/test/fts5leftjoin.test | 43 - ext/fts5/test/fts5matchinfo.test | 523 - ext/fts5/test/fts5merge.test | 243 - ext/fts5/test/fts5merge2.test | 57 - ext/fts5/test/fts5misc.test | 327 - ext/fts5/test/fts5multi.test | 99 - ext/fts5/test/fts5multiclient.test | 47 - ext/fts5/test/fts5near.test | 70 - ext/fts5/test/fts5onepass.test | 180 - ext/fts5/test/fts5optimize.test | 108 - ext/fts5/test/fts5phrase.test | 118 - ext/fts5/test/fts5plan.test | 65 - ext/fts5/test/fts5porter.test | 11805 - ext/fts5/test/fts5porter2.test | 69 - ext/fts5/test/fts5prefix.test | 343 - ext/fts5/test/fts5prefix2.test | 57 - ext/fts5/test/fts5query.test | 91 - ext/fts5/test/fts5rank.test | 183 - ext/fts5/test/fts5rebuild.test | 67 - ext/fts5/test/fts5restart.test | 151 - ext/fts5/test/fts5rowid.test | 219 - ext/fts5/test/fts5savepoint.test | 85 - ext/fts5/test/fts5simple.test | 483 - ext/fts5/test/fts5simple2.test | 372 - ext/fts5/test/fts5simple3.test | 118 - ext/fts5/test/fts5synonym.test | 423 - ext/fts5/test/fts5synonym2.test | 163 - ext/fts5/test/fts5tok1.test | 150 - ext/fts5/test/fts5tok2.test | 47 - ext/fts5/test/fts5tokenizer.test | 304 - ext/fts5/test/fts5trigram.test | 201 - ext/fts5/test/fts5umlaut.test | 65 - ext/fts5/test/fts5unicode.test | 85 - ext/fts5/test/fts5unicode2.test | 588 - ext/fts5/test/fts5unicode3.test | 140 - ext/fts5/test/fts5unicode4.test | 31 - ext/fts5/test/fts5unindexed.test | 78 - ext/fts5/test/fts5update.test | 157 - ext/fts5/test/fts5version.test | 65 - ext/fts5/test/fts5vocab.test | 557 - ext/fts5/test/fts5vocab2.test | 237 - ext/fts5/tool/fts5speed.tcl | 64 - ext/fts5/tool/fts5txt2db.tcl | 231 - ext/fts5/tool/loadfts5.tcl | 172 - ext/fts5/tool/mkfts5c.tcl | 113 - ext/fts5/tool/showfts5.tcl | 97 - ext/icu/README.txt | 170 - ext/icu/icu.c | 554 - ext/icu/sqliteicu.h | 26 - ext/lsm1/Makefile | 56 - ext/lsm1/Makefile.msc | 102 - ext/lsm1/lsm-test/README | 40 - ext/lsm1/lsm-test/lsmtest.h | 303 - ext/lsm1/lsm-test/lsmtest1.c | 656 - ext/lsm1/lsm-test/lsmtest2.c | 488 - ext/lsm1/lsm-test/lsmtest3.c | 238 - ext/lsm1/lsm-test/lsmtest4.c | 127 - ext/lsm1/lsm-test/lsmtest5.c | 633 - ext/lsm1/lsm-test/lsmtest6.c | 661 - ext/lsm1/lsm-test/lsmtest7.c | 206 - ext/lsm1/lsm-test/lsmtest8.c | 324 - ext/lsm1/lsm-test/lsmtest9.c | 140 - ext/lsm1/lsm-test/lsmtest_bt.c | 71 - ext/lsm1/lsm-test/lsmtest_datasource.c | 96 - ext/lsm1/lsm-test/lsmtest_func.c | 177 - ext/lsm1/lsm-test/lsmtest_io.c | 248 - ext/lsm1/lsm-test/lsmtest_main.c | 1548 - ext/lsm1/lsm-test/lsmtest_mem.c | 409 - ext/lsm1/lsm-test/lsmtest_tdb.c | 846 - ext/lsm1/lsm-test/lsmtest_tdb.h | 174 - ext/lsm1/lsm-test/lsmtest_tdb2.cc | 369 - ext/lsm1/lsm-test/lsmtest_tdb3.c | 1429 - ext/lsm1/lsm-test/lsmtest_tdb4.c | 980 - ext/lsm1/lsm-test/lsmtest_util.c | 223 - ext/lsm1/lsm-test/lsmtest_win32.c | 30 - ext/lsm1/lsm.h | 684 - ext/lsm1/lsmInt.h | 993 - ext/lsm1/lsm_ckpt.c | 1239 - ext/lsm1/lsm_file.c | 3312 - ext/lsm1/lsm_log.c | 1156 - ext/lsm1/lsm_main.c | 1008 - ext/lsm1/lsm_mem.c | 104 - ext/lsm1/lsm_mutex.c | 88 - ext/lsm1/lsm_shared.c | 1976 - ext/lsm1/lsm_sorted.c | 6192 - ext/lsm1/lsm_str.c | 148 - ext/lsm1/lsm_tree.c | 2465 - ext/lsm1/lsm_unix.c | 753 - ext/lsm1/lsm_varint.c | 196 - ext/lsm1/lsm_vtab.c | 1079 - ext/lsm1/lsm_win32.c | 1063 - ext/lsm1/test/lsm1_common.tcl | 38 - ext/lsm1/test/lsm1_simple.test | 152 - ext/lsm1/tool/mklsm1c.tcl | 88 - ext/misc/README.md | 60 - ext/misc/amatch.c | 1501 - ext/misc/anycollseq.c | 58 - ext/misc/appendvfs.c | 669 - ext/misc/blobio.c | 152 - ext/misc/btreeinfo.c | 429 - ext/misc/carray.c | 521 - ext/misc/carray.h | 23 - ext/misc/cksumvfs.c | 868 - ext/misc/closure.c | 965 - ext/misc/completion.c | 501 - ext/misc/compress.c | 131 - ext/misc/csv.c | 957 - ext/misc/dbdata.c | 851 - ext/misc/dbdump.c | 724 - ext/misc/decimal.c | 634 - ext/misc/eval.c | 125 - ext/misc/explain.c | 322 - ext/misc/fileio.c | 1000 - ext/misc/fossildelta.c | 1092 - ext/misc/fuzzer.c | 1187 - ext/misc/ieee754.c | 289 - ext/misc/json1.c | 2631 - ext/misc/memstat.c | 428 - ext/misc/memtrace.c | 108 - ext/misc/memvfs.c | 574 - ext/misc/mmapwarm.c | 107 - ext/misc/nextchar.c | 314 - ext/misc/noop.c | 68 - ext/misc/normalize.c | 716 - ext/misc/percentile.c | 220 - ext/misc/prefixes.c | 320 - ext/misc/regexp.c | 760 - ext/misc/remember.c | 72 - ext/misc/rot13.c | 115 - ext/misc/scrub.c | 610 - ext/misc/series.c | 445 - ext/misc/sha1.c | 393 - ext/misc/shathree.c | 723 - ext/misc/showauth.c | 103 - ext/misc/spellfix.c | 3071 - ext/misc/sqlar.c | 124 - ext/misc/stmt.c | 300 - ext/misc/templatevtab.c | 268 - ext/misc/totype.c | 514 - ext/misc/uint.c | 92 - ext/misc/unionvtab.c | 1382 - ext/misc/urifuncs.c | 209 - ext/misc/uuid.c | 233 - ext/misc/vfslog.c | 759 - ext/misc/vfsstat.c | 819 - ext/misc/vtablog.c | 510 - ext/misc/vtshim.c | 553 - ext/misc/wholenumber.c | 275 - ext/misc/zipfile.c | 2190 - ext/misc/zorder.c | 102 - ext/rbu/rbu.c | 195 - ext/rbu/rbu1.test | 672 - ext/rbu/rbu10.test | 187 - ext/rbu/rbu11.test | 197 - ext/rbu/rbu12.test | 234 - ext/rbu/rbu13.test | 64 - ext/rbu/rbu14.test | 94 - ext/rbu/rbu3.test | 205 - ext/rbu/rbu5.test | 302 - ext/rbu/rbu6.test | 102 - ext/rbu/rbu7.test | 108 - ext/rbu/rbu8.test | 74 - ext/rbu/rbu9.test | 127 - ext/rbu/rbuA.test | 82 - ext/rbu/rbuB.test | 61 - ext/rbu/rbuC.test | 141 - ext/rbu/rbu_common.tcl | 110 - ext/rbu/rbucollate.test | 62 - ext/rbu/rbucrash.test | 147 - ext/rbu/rbucrash2.test | 105 - ext/rbu/rbudiff.test | 310 - ext/rbu/rbudor.test | 58 - ext/rbu/rbuexpr.test | 93 - ext/rbu/rbufault.test | 236 - ext/rbu/rbufault2.test | 66 - ext/rbu/rbufault3.test | 95 - ext/rbu/rbufault4.test | 65 - ext/rbu/rbufts.test | 133 - ext/rbu/rbumisc.test | 180 - ext/rbu/rbumulti.test | 174 - ext/rbu/rbupartial.test | 99 - ext/rbu/rbuprogress.test | 450 - ext/rbu/rburesume.test | 253 - ext/rbu/rbusave.test | 104 - ext/rbu/rbusplit.test | 94 - ext/rbu/rbutemplimit.test | 129 - ext/rbu/rbuvacuum.test | 399 - ext/rbu/rbuvacuum2.test | 243 - ext/rbu/rbuvacuum3.test | 63 - ext/rbu/rbuvacuum4.test | 116 - ext/rbu/sqlite3rbu.c | 5306 - ext/rbu/sqlite3rbu.h | 605 - ext/rbu/test_rbu.c | 391 - ext/repair/README.md | 16 - ext/repair/checkfreelist.c | 299 - ext/repair/checkindex.c | 927 - ext/repair/sqlite3_checker.c.in | 86 - ext/repair/sqlite3_checker.tcl | 264 - ext/repair/test/README.md | 13 - ext/repair/test/checkfreelist01.test | 92 - ext/repair/test/checkindex01.test | 349 - ext/repair/test/test.tcl | 67 - ext/rtree/README | 120 - ext/rtree/geopoly.c | 1810 - ext/rtree/rtree.c | 4545 - ext/rtree/rtree.h | 30 - ext/rtree/rtree1.test | 733 - ext/rtree/rtree2.test | 147 - ext/rtree/rtree3.test | 266 - ext/rtree/rtree4.test | 254 - ext/rtree/rtree5.test | 83 - ext/rtree/rtree6.test | 181 - ext/rtree/rtree7.test | 73 - ext/rtree/rtree8.test | 209 - ext/rtree/rtree9.test | 129 - ext/rtree/rtreeA.test | 262 - ext/rtree/rtreeB.test | 50 - ext/rtree/rtreeC.test | 378 - ext/rtree/rtreeD.test | 55 - ext/rtree/rtreeE.test | 143 - ext/rtree/rtreeF.test | 84 - ext/rtree/rtreeG.test | 69 - ext/rtree/rtreeH.test | 103 - ext/rtree/rtreeI.test | 74 - ext/rtree/rtree_perf.tcl | 74 - ext/rtree/rtree_util.tcl | 197 - ext/rtree/rtreecheck.test | 160 - ext/rtree/rtreecirc.test | 66 - ext/rtree/rtreeconnect.test | 56 - ext/rtree/rtreefuzz001.test | 1049 - ext/rtree/sqlite3rtree.h | 117 - ext/rtree/tkt3363.test | 50 - ext/rtree/util/randomshape.tcl | 87 - ext/rtree/viewrtree.tcl | 188 - ext/rtree/visual01.txt | 602 - ext/session/changeset.c | 417 - ext/session/changesetfuzz.c | 1238 - ext/session/changesetfuzz1.test | 84 - ext/session/session1.test | 669 - ext/session/session2.test | 639 - ext/session/session3.test | 214 - ext/session/session4.test | 146 - ext/session/session5.test | 408 - ext/session/session6.test | 90 - ext/session/session8.test | 91 - ext/session/session9.test | 287 - ext/session/sessionA.test | 106 - ext/session/sessionB.test | 507 - ext/session/sessionC.test | 197 - ext/session/sessionD.test | 257 - ext/session/sessionE.test | 113 - ext/session/sessionF.test | 294 - ext/session/sessionG.test | 250 - ext/session/sessionH.test | 84 - ext/session/session_common.tcl | 215 - ext/session/session_speed_test.c | 358 - ext/session/sessionat.test | 249 - ext/session/sessiondiff.test | 114 - ext/session/sessionfault.test | 589 - ext/session/sessionfault2.test | 284 - ext/session/sessioninvert.test | 183 - ext/session/sessionmem.test | 57 - ext/session/sessionnoop.test | 187 - ext/session/sessionrebase.test | 476 - ext/session/sessionstat1.test | 310 - ext/session/sessionwor.test | 123 - ext/session/sqlite3session.c | 5610 - ext/session/sqlite3session.h | 1673 - ext/session/test_session.c | 1318 - ext/userauth/sqlite3userauth.h | 96 - ext/userauth/user-auth.txt | 164 - ext/userauth/userauth.c | 355 - install-sh | 667 +- ltmain.sh | 8153 +- magic.txt | 32 - main.mk | 1144 - manifest | 1919 - manifest.uuid | 1 - missing | 215 + mkso.sh | 32 - mptest/config01.test | 46 - mptest/config02.test | 123 - mptest/crash01.test | 106 - mptest/crash02.subtest | 53 - mptest/mptest.c | 1470 - mptest/multiwrite01.test | 415 - src/shell.c.in => shell.c | 10527 +- spec.template | 67 - sqlite.pc.in | 13 - sqlite3.c | 231756 ++++++++++++++++++ src/sqlite.h.in => sqlite3.h | 3803 +- src/sqlite3.rc => sqlite3.rc | 0 src/sqlite3ext.h => sqlite3ext.h | 0 sqlite3rc.h | 3 + src/alter.c | 1994 - src/analyze.c | 1943 - src/attach.c | 592 - src/auth.c | 268 - src/backup.c | 771 - src/bitvec.c | 411 - src/btmutex.c | 308 - src/btree.c | 10736 - src/btree.h | 408 - src/btreeInt.h | 730 - src/build.c | 5333 - src/callback.c | 536 - src/complete.c | 290 - src/ctime.c | 765 - src/date.c | 1250 - src/dbpage.c | 416 - src/dbstat.c | 853 - src/delete.c | 966 - src/expr.c | 6115 - src/fault.c | 87 - src/fkey.c | 1452 - src/func.c | 2287 - src/global.c | 321 - src/hash.c | 269 - src/hash.h | 96 - src/hwtime.h | 85 - src/in-operator.md | 107 - src/insert.c | 3055 - src/legacy.c | 141 - src/loadext.c | 854 - src/main.c | 4676 - src/malloc.c | 828 - src/mem0.c | 59 - src/mem1.c | 291 - src/mem2.c | 528 - src/mem3.c | 687 - src/mem5.c | 576 - src/memdb.c | 635 - src/memjournal.c | 434 - src/msvc.h | 41 - src/mutex.c | 361 - src/mutex.h | 71 - src/mutex_noop.c | 215 - src/mutex_unix.c | 394 - src/mutex_w32.c | 399 - src/notify.c | 332 - src/os.c | 438 - src/os.h | 212 - src/os_common.h | 105 - src/os_setup.h | 57 - src/os_unix.c | 8046 - src/os_win.c | 6154 - src/os_win.h | 88 - src/pager.c | 7708 - src/pager.h | 242 - src/parse.y | 1872 - src/pcache.c | 882 - src/pcache.h | 190 - src/pcache1.c | 1278 - src/pragma.c | 2593 - src/pragma.h | 648 - src/prepare.c | 1013 - src/printf.c | 1310 - src/random.c | 134 - src/resolve.c | 2022 - src/rowset.c | 502 - src/select.c | 7160 - src/sqliteInt.h | 5167 - src/sqliteLimit.h | 210 - src/status.c | 393 - src/table.c | 198 - src/test1.c | 8620 - src/test2.c | 752 - src/test3.c | 690 - src/test4.c | 726 - src/test5.c | 220 - src/test6.c | 1107 - src/test7.c | 718 - src/test8.c | 1444 - src/test9.c | 204 - src/test_async.c | 248 - src/test_autoext.c | 228 - src/test_backup.c | 157 - src/test_bestindex.c | 620 - src/test_blob.c | 330 - src/test_btree.c | 66 - src/test_config.c | 828 - src/test_delete.c | 156 - src/test_demovfs.c | 689 - src/test_devsym.c | 525 - src/test_fs.c | 917 - src/test_func.c | 952 - src/test_hexio.c | 465 - src/test_init.c | 295 - src/test_intarray.c | 392 - src/test_intarray.h | 135 - src/test_journal.c | 869 - src/test_loadext.c | 128 - src/test_malloc.c | 1513 - src/test_md5.c | 450 - src/test_multiplex.c | 1323 - src/test_multiplex.h | 99 - src/test_mutex.c | 510 - src/test_onefile.c | 831 - src/test_osinst.c | 1224 - src/test_pcache.c | 467 - src/test_quota.c | 1979 - src/test_quota.h | 268 - src/test_rtree.c | 511 - src/test_schema.c | 366 - src/test_server.c | 516 - src/test_sqllog.c | 556 - src/test_superlock.c | 363 - src/test_syscall.c | 765 - src/test_tclsh.c | 205 - src/test_tclvar.c | 562 - src/test_thread.c | 635 - src/test_vdbecov.c | 120 - src/test_vfs.c | 1692 - src/test_vfstrace.c | 892 - src/test_windirent.c | 191 - src/test_windirent.h | 159 - src/test_window.c | 349 - src/test_wsd.c | 84 - src/threads.c | 274 - src/tokenize.c | 856 - src/treeview.c | 783 - src/trigger.c | 1400 - src/update.c | 1321 - src/upsert.c | 315 - src/utf.c | 535 - src/util.c | 1705 - src/vacuum.c | 404 - src/vdbe.c | 8265 - src/vdbe.h | 396 - src/vdbeInt.h | 624 - src/vdbeapi.c | 2051 - src/vdbeaux.c | 5247 - src/vdbeblob.c | 508 - src/vdbemem.c | 1905 - src/vdbesort.c | 2763 - src/vdbetrace.c | 194 - src/vdbevtab.c | 424 - src/vtab.c | 1319 - src/vxworks.h | 32 - src/wal.c | 4050 - src/wal.h | 155 - src/walker.c | 247 - src/where.c | 5626 - src/whereInt.h | 607 - src/wherecode.c | 2494 - src/whereexpr.c | 1901 - src/window.c | 3050 - {autoconf/tea => tea}/Makefile.in | 0 {autoconf/tea => tea}/README | 0 {autoconf/tea => tea}/aclocal.m4 | 0 tea/configure | 9989 + {autoconf/tea => tea}/configure.ac | 2 +- {autoconf/tea => tea}/doc/sqlite3.n | 0 src/tclsqlite.c => tea/generic/tclsqlite3.c | 5 + {autoconf/tea => tea}/license.terms | 0 {autoconf/tea => tea}/pkgIndex.tcl.in | 0 {autoconf/tea => tea}/tclconfig/install-sh | 0 {autoconf/tea => tea}/tclconfig/tcl.m4 | 0 {autoconf/tea => tea}/win/makefile.vc | 0 {autoconf/tea => tea}/win/nmakehlp.c | 0 {autoconf/tea => tea}/win/rules.vc | 0 test/8_3_names.test | 197 - test/affinity2.test | 136 - test/affinity3.test | 91 - test/aggerror.test | 78 - test/aggnested.test | 312 - test/alias.test | 140 - test/all.test | 51 - test/alter.test | 918 - test/alter2.test | 470 - test/alter3.test | 398 - test/alter4.test | 427 - test/alterauth.test | 72 - test/alterauth2.test | 115 - test/altercol.test | 839 - test/altercorrupt.test | 175 - test/alterdropcol.test | 319 - test/alterdropcol2.test | 222 - test/alterlegacy.test | 469 - test/altermalloc.test | 71 - test/altermalloc2.test | 101 - test/altermalloc3.test | 40 - test/altertab.test | 741 - test/altertab2.test | 363 - test/altertab3.test | 651 - test/amatch1.test | 117 - test/analyze.test | 380 - test/analyze3.test | 739 - test/analyze4.test | 111 - test/analyze5.test | 247 - test/analyze6.test | 126 - test/analyze7.test | 114 - test/analyze8.test | 115 - test/analyze9.test | 1235 - test/analyzeC.test | 181 - test/analyzeD.test | 107 - test/analyzeE.test | 242 - test/analyzeF.test | 150 - test/analyzeG.test | 88 - test/analyzer1.test | 55 - test/async.test | 90 - test/async2.test | 126 - test/async3.test | 76 - test/async4.test | 168 - test/async5.test | 68 - test/atof1.test | 84 - test/atomic.test | 41 - test/atomic2.test | 95 - test/atrc.c | 150 - test/attach.test | 928 - test/attach2.test | 391 - test/attach3.test | 353 - test/attach4.test | 138 - test/attachmalloc.test | 77 - test/auth.test | 2618 - test/auth2.test | 160 - test/auth3.test | 132 - test/autoanalyze1.test | 123 - test/autoinc.test | 883 - test/autoindex1.test | 548 - test/autoindex2.test | 232 - test/autoindex3.test | 93 - test/autoindex4.test | 83 - test/autoindex5.test | 230 - test/autovacuum.test | 716 - test/autovacuum_ioerr2.test | 132 - test/avfs.test | 395 - test/avtrans.test | 927 - test/backcompat.test | 524 - test/backup.test | 972 - test/backup2.test | 187 - test/backup4.test | 108 - test/backup5.test | 65 - test/backup_ioerr.test | 286 - test/backup_malloc.test | 119 - test/badutf.test | 143 - test/badutf2.test | 127 - test/bc_common.tcl | 75 - test/bestindex1.test | 327 - test/bestindex2.test | 142 - test/bestindex3.test | 182 - test/bestindex4.test | 175 - test/bestindex5.test | 249 - test/bestindex6.test | 109 - test/bestindex7.test | 79 - test/between.test | 143 - test/bigfile.test | 203 - test/bigfile2.test | 62 - test/bigmmap.test | 104 - test/bigrow.test | 223 - test/bigsort.test | 50 - test/bind.test | 758 - test/bindxfer.test | 76 - test/bitvec.test | 195 - test/blob.test | 147 - test/boundary1.tcl | 289 - test/boundary1.test | 7645 - test/boundary2.tcl | 445 - test/boundary2.test | 15198 -- test/boundary3.tcl | 289 - test/boundary3.test | 12456 - test/boundary4.tcl | 340 - test/boundary4.test | 343 - test/btree01.test | 132 - test/btree02.test | 62 - test/btreefault.test | 57 - test/busy.test | 139 - test/busy2.test | 171 - test/cache.test | 140 - test/cacheflush.test | 323 - test/cachespill.test | 77 - test/capi2.test | 803 - test/capi3.test | 1276 - test/capi3b.test | 145 - test/capi3c.test | 1400 - test/capi3d.test | 203 - test/capi3e.test | 126 - test/carray01.test | 100 - test/cast.test | 487 - test/cffault.test | 158 - test/check.test | 611 - test/checkfault.test | 41 - test/chunksize.test | 41 - test/close.test | 89 - test/closure01.test | 295 - test/coalesce.test | 84 - test/collate1.test | 451 - test/collate2.test | 724 - test/collate3.test | 531 - test/collate4.test | 704 - test/collate5.test | 292 - test/collate6.test | 153 - test/collate7.test | 72 - test/collate8.test | 157 - test/collate9.test | 178 - test/collateA.test | 217 - test/collateB.test | 77 - test/colmeta.test | 110 - test/colname.test | 447 - test/columncount.test | 57 - test/conflict.test | 860 - test/conflict2.test | 858 - test/conflict3.test | 437 - test/contrib01.test | 90 - test/corrupt.test | 349 - test/corrupt2.test | 611 - test/corrupt3.test | 121 - test/corrupt4.test | 82 - test/corrupt5.test | 50 - test/corrupt6.test | 259 - test/corrupt7.test | 112 - test/corrupt8.test | 108 - test/corrupt9.test | 140 - test/corruptA.test | 83 - test/corruptB.test | 193 - test/corruptC.test | 428 - test/corruptD.test | 145 - test/corruptE.test | 152 - test/corruptF.test | 153 - test/corruptG.test | 75 - test/corruptH.test | 176 - test/corruptI.test | 263 - test/corruptJ.test | 80 - test/corruptK.test | 234 - test/corruptL.test | 1341 - test/corruptM.test | 186 - test/corruptN.test | 106 - test/cost.test | 289 - test/count.test | 237 - test/countofview.test | 56 - test/coveridxscan.test | 119 - test/crash.test | 411 - test/crash2.test | 133 - test/crash3.test | 190 - test/crash4.test | 102 - test/crash5.test | 127 - test/crash6.test | 118 - test/crash7.test | 116 - test/crash8.test | 419 - test/crashM.test | 80 - test/crashtest1.c | 96 - test/createtab.test | 154 - test/cse.test | 200 - test/csv01.test | 240 - test/ctime.test | 258 - test/cursorhint.test | 162 - test/cursorhint2.test | 204 - test/dataversion1.test | 87 - test/date.test | 612 - test/date2.test | 176 - test/dbdata.test | 115 - test/dbfuzz.c | 754 - test/dbfuzz001.test | 374 - test/dbfuzz2-seed1.db | Bin 3584 -> 0 bytes test/dbfuzz2.c | 403 - test/dbpage.test | 105 - test/dbstatus.test | 457 - test/dbstatus2.test | 115 - test/decimal.test | 186 - test/default.test | 140 - test/delete.test | 419 - test/delete2.test | 119 - test/delete3.test | 57 - test/delete4.test | 264 - test/delete_db.test | 222 - test/descidx1.test | 365 - test/descidx2.test | 186 - test/descidx3.test | 155 - test/diskfull.test | 115 - test/distinct.test | 297 - test/distinct2.test | 304 - test/distinctagg.test | 62 - test/e_blobbytes.test | 74 - test/e_blobclose.test | 170 - test/e_blobopen.test | 548 - test/e_blobwrite.test | 203 - test/e_changes.test | 441 - test/e_createtable.test | 1960 - test/e_delete.test | 477 - test/e_droptrigger.test | 218 - test/e_dropview.test | 192 - test/e_expr.test | 1991 - test/e_fkey.test | 3041 - test/e_fts3.test | 707 - test/e_insert.test | 431 - test/e_reindex.test | 299 - test/e_resolve.test | 135 - test/e_select.test | 2172 - test/e_select2.test | 580 - test/e_totalchanges.test | 213 - test/e_update.test | 605 - test/e_uri.test | 462 - test/e_vacuum.test | 347 - test/e_wal.test | 230 - test/e_walauto.test | 214 - test/e_walckpt.test | 753 - test/e_walhook.test | 200 - test/emptytable.test | 50 - test/enc.test | 252 - test/enc2.test | 567 - test/enc3.test | 108 - test/enc4.test | 137 - test/eqp.test | 830 - test/errmsg.test | 118 - test/eval.test | 87 - test/exclusive.test | 540 - test/exclusive2.test | 324 - test/exec.test | 37 - test/exists.test | 199 - test/exists2.test | 194 - test/existsfault.test | 52 - test/expr.test | 1059 - test/expr2.test | 54 - test/extension01.test | 83 - test/extraquick.test | 16 - test/fallocate.test | 157 - test/filectrl.test | 72 - test/filefmt.test | 254 - test/filter1.test | 225 - test/filter2.tcl | 132 - test/filter2.test | 156 - test/filterfault.test | 44 - test/fkey1.test | 226 - test/fkey2.test | 2047 - test/fkey3.test | 186 - test/fkey4.test | 57 - test/fkey5.test | 492 - test/fkey6.test | 229 - test/fkey7.test | 121 - test/fkey8.test | 231 - test/fkey_malloc.test | 134 - test/fordelete.test | 209 - test/format4.test | 66 - test/fts-9fd058691.test | 59 - test/fts1a.test | 186 - test/fts1b.test | 147 - test/fts1c.test | 1213 - test/fts1d.test | 65 - test/fts1e.test | 85 - test/fts1f.test | 90 - test/fts1i.test | 88 - test/fts1j.test | 89 - test/fts1k.test | 69 - test/fts1l.test | 65 - test/fts1m.test | 50 - test/fts1n.test | 45 - test/fts1o.test | 138 - test/fts1porter.test | 23590 -- test/fts2.test | 67 - test/fts2a.test | 202 - test/fts2b.test | 147 - test/fts2c.test | 1213 - test/fts2d.test | 65 - test/fts2e.test | 85 - test/fts2f.test | 90 - test/fts2g.test | 93 - test/fts2h.test | 76 - test/fts2i.test | 87 - test/fts2j.test | 89 - test/fts2k.test | 105 - test/fts2l.test | 69 - test/fts2m.test | 65 - test/fts2n.test | 196 - test/fts2o.test | 169 - test/fts2p.test | 357 - test/fts2q.test | 346 - test/fts2r.test | 121 - test/fts2token.test | 174 - test/fts3.test | 19 - test/fts3_common.tcl | 420 - test/fts3aa.test | 265 - test/fts3ab.test | 147 - test/fts3ac.test | 1219 - test/fts3ad.test | 106 - test/fts3ae.test | 85 - test/fts3af.test | 90 - test/fts3ag.test | 93 - test/fts3ah.test | 71 - test/fts3ai.test | 92 - test/fts3aj.test | 89 - test/fts3ak.test | 105 - test/fts3al.test | 73 - test/fts3am.test | 65 - test/fts3an.test | 218 - test/fts3ao.test | 250 - test/fts3atoken.test | 287 - test/fts3auto.test | 717 - test/fts3aux1.test | 531 - test/fts3aux2.test | 168 - *** 1262253 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu May 6 20:15:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E07A62CE4E for ; Thu, 6 May 2021 20:15:21 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FblF50HV7z52c9; Thu, 6 May 2021 20:15:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F0F301E984; Thu, 6 May 2021 20:15:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146KFKkF094922; Thu, 6 May 2021 20:15:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146KFKrw094921; Thu, 6 May 2021 20:15:20 GMT (envelope-from git) Date: Thu, 6 May 2021 20:15:20 GMT Message-Id: <202105062015.146KFKrw094921@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Cy Schubert Subject: git: 0511e356f5e2 - vendor/sqlite3 - sqlite3: Vendor import of sqlite3 3.35.5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/vendor/sqlite3 X-Git-Reftype: branch X-Git-Commit: 0511e356f5e2106928ee352ee974d1470c860a9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 20:15:21 -0000 The branch vendor/sqlite3 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=0511e356f5e2106928ee352ee974d1470c860a9a commit 0511e356f5e2106928ee352ee974d1470c860a9a Author: Cy Schubert AuthorDate: 2021-05-06 20:14:13 +0000 Commit: Cy Schubert CommitDate: 2021-05-06 20:14:13 +0000 sqlite3: Vendor import of sqlite3 3.35.5 Changes at https://www.sqlite.org/releaselog/3_35_5.html. --- Makefile.msc | 3 + configure | 153 +- configure.ac | 50 +- shell.c | 501 ++- sqlite3.c | 11777 ++++++++++++++++++++++++++++++++--------------------- sqlite3.h | 59 +- sqlite3rc.h | 2 +- tea/configure | 18 +- tea/configure.ac | 2 +- 9 files changed, 7708 insertions(+), 4857 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 746162a00c04..1f177557a25a 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -303,6 +303,9 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1 !ENDIF +# Always enable math functions on Windows +OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS + # Should the rbu extension be enabled? If so, add compilation options # to enable it. # diff --git a/configure b/configure index 0eedad3467dd..4a16edbb6e02 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.34.1. +# Generated by GNU Autoconf 2.69 for sqlite 3.35.5. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.34.1' -PACKAGE_STRING='sqlite 3.34.1' +PACKAGE_VERSION='3.35.5' +PACKAGE_STRING='sqlite 3.35.5' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -772,6 +772,7 @@ enable_editline enable_readline enable_threadsafe enable_dynamic_extensions +enable_math enable_fts4 enable_fts3 enable_fts5 @@ -1341,7 +1342,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.34.1 to adapt to many kinds of systems. +\`configure' configures sqlite 3.35.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1412,7 +1413,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.34.1:";; + short | recursive ) echo "Configuration of sqlite 3.35.5:";; esac cat <<\_ACEOF @@ -1437,6 +1438,7 @@ Optional Features: --enable-threadsafe build a thread-safe library [default=yes] --enable-dynamic-extensions support loadable extensions [default=yes] + --enable-math SQL math functions [default=yes] --enable-fts4 include fts4 support [default=yes] --enable-fts3 include fts3 support [default=no] --enable-fts5 include fts5 support [default=yes] @@ -1537,7 +1539,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.34.1 +sqlite configure 3.35.5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1952,7 +1954,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.34.1, which was +It was created by sqlite $as_me 3.35.5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2818,7 +2820,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.34.1' + VERSION='3.35.5' cat >>confdefs.h <<_ACEOF @@ -13335,7 +13337,9 @@ else enable_threadsafe=yes fi -if test x"$enable_threadsafe" != "xno"; then +if test x"$enable_threadsafe" == "xno"; then + BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_THREADSAFE=0" +else BUILD_CFLAGS="$BUILD_CFLAGS -D_REENTRANT=1 -DSQLITE_THREADSAFE=1" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create" >&5 $as_echo_n "checking for library containing pthread_create... " >&6; } @@ -13528,6 +13532,84 @@ $as_echo_n "checking for whether to support dynamic extensions... " >&6; } $as_echo "$enable_dynamic_extensions" >&6; } #----------------------------------------------------------------------- +#----------------------------------------------------------------------- +# --enable-math +# +# Check whether --enable-math was given. +if test "${enable_math+set}" = set; then : + enableval=$enable_math; +else + enable_math=yes +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SQL math functions" >&5 +$as_echo_n "checking SQL math functions... " >&6; } +if test x"$enable_math" = "xyes"; then + BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_MATH_FUNCTIONS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 +$as_echo "enabled" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ceil" >&5 +$as_echo_n "checking for library containing ceil... " >&6; } +if ${ac_cv_search_ceil+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ceil (); +int +main () +{ +return ceil (); + ; + return 0; +} +_ACEOF +for ac_lib in '' m; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_ceil=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_ceil+:} false; then : + break +fi +done +if ${ac_cv_search_ceil+:} false; then : + +else + ac_cv_search_ceil=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ceil" >&5 +$as_echo "$ac_cv_search_ceil" >&6; } +ac_res=$ac_cv_search_ceil +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } +fi +#----------------------------------------------------------------------- + #----------------------------------------------------------------------- # --enable-fts4 # @@ -13538,8 +13620,15 @@ else enable_fts4=yes fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking FTS4 extension" >&5 +$as_echo_n "checking FTS4 extension... " >&6; } if test x"$enable_fts4" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS4" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 +$as_echo "enabled" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } fi #----------------------------------------------------------------------- @@ -13551,8 +13640,15 @@ if test "${enable_fts3+set}" = set; then : enableval=$enable_fts3; fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking FTS3 extension" >&5 +$as_echo_n "checking FTS3 extension... " >&6; } if test x"$enable_fts3" = "xyes" -a x"$enable_fts4" = "xno"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS3" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 +$as_echo "enabled" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } fi #----------------------------------------------------------------------- @@ -13566,7 +13662,11 @@ else enable_fts5=yes fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking FTS5 extension" >&5 +$as_echo_n "checking FTS5 extension... " >&6; } if test x"$enable_fts5" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 +$as_echo "enabled" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing log" >&5 $as_echo_n "checking for library containing log... " >&6; } if ${ac_cv_search_log+:} false; then : @@ -13624,6 +13724,9 @@ if test "$ac_res" != no; then : fi BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS5" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } fi #----------------------------------------------------------------------- @@ -13637,8 +13740,15 @@ else enable_json1=yes fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking JSON functions" >&5 +$as_echo_n "checking JSON functions... " >&6; } if test x"$enable_json1" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_JSON1" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 +$as_echo "enabled" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } fi #----------------------------------------------------------------------- @@ -13652,8 +13762,15 @@ else enable_rtree=yes fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking RTREE extension" >&5 +$as_echo_n "checking RTREE extension... " >&6; } if test x"$enable_rtree" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 +$as_echo "enabled" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } fi #----------------------------------------------------------------------- @@ -13665,8 +13782,15 @@ if test "${enable_session+set}" = set; then : enableval=$enable_session; fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Session extension" >&5 +$as_echo_n "checking Session extension... " >&6; } if test x"$enable_session" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 +$as_echo "enabled" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } fi #----------------------------------------------------------------------- @@ -13678,9 +13802,16 @@ if test "${enable_debug+set}" = set; then : enableval=$enable_debug; fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Build type" >&5 +$as_echo_n "checking Build type... " >&6; } if test x"$enable_debug" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE" CFLAGS="-g -O0" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: debug" >&5 +$as_echo "debug" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: release" >&5 +$as_echo "release" >&6; } fi #----------------------------------------------------------------------- @@ -14438,7 +14569,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.34.1, which was +This file was extended by sqlite $as_me 3.35.5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14495,7 +14626,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.34.1 +sqlite config.status 3.35.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 72472467d5b7..166f7019cd5c 100644 --- a/configure.ac +++ b/configure.ac @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.34.1, http://www.sqlite.org) +AC_INIT(sqlite, 3.35.5, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_AUX_DIR([.]) @@ -87,7 +87,9 @@ AC_SUBST(READLINE_LIBS) AC_ARG_ENABLE(threadsafe, [AS_HELP_STRING( [--enable-threadsafe], [build a thread-safe library [default=yes]])], [], [enable_threadsafe=yes]) -if test x"$enable_threadsafe" != "xno"; then +if test x"$enable_threadsafe" == "xno"; then + BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_THREADSAFE=0" +else BUILD_CFLAGS="$BUILD_CFLAGS -D_REENTRANT=1 -DSQLITE_THREADSAFE=1" AC_SEARCH_LIBS(pthread_create, pthread) AC_SEARCH_LIBS(pthread_mutexattr_init, pthread) @@ -109,14 +111,34 @@ AC_MSG_CHECKING([for whether to support dynamic extensions]) AC_MSG_RESULT($enable_dynamic_extensions) #----------------------------------------------------------------------- +#----------------------------------------------------------------------- +# --enable-math +# +AC_ARG_ENABLE(math, [AS_HELP_STRING( + [--enable-math], [SQL math functions [default=yes]])], + [], [enable_math=yes]) +AC_MSG_CHECKING([SQL math functions]) +if test x"$enable_math" = "xyes"; then + BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_MATH_FUNCTIONS" + AC_MSG_RESULT([enabled]) + AC_SEARCH_LIBS(ceil, m) +else + AC_MSG_RESULT([disabled]) +fi +#----------------------------------------------------------------------- + #----------------------------------------------------------------------- # --enable-fts4 # AC_ARG_ENABLE(fts4, [AS_HELP_STRING( [--enable-fts4], [include fts4 support [default=yes]])], [], [enable_fts4=yes]) +AC_MSG_CHECKING([FTS4 extension]) if test x"$enable_fts4" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS4" + AC_MSG_RESULT([enabled]) +else + AC_MSG_RESULT([disabled]) fi #----------------------------------------------------------------------- @@ -126,8 +148,12 @@ fi AC_ARG_ENABLE(fts3, [AS_HELP_STRING( [--enable-fts3], [include fts3 support [default=no]])], [], []) +AC_MSG_CHECKING([FTS3 extension]) if test x"$enable_fts3" = "xyes" -a x"$enable_fts4" = "xno"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS3" + AC_MSG_RESULT([enabled]) +else + AC_MSG_RESULT([disabled]) fi #----------------------------------------------------------------------- @@ -137,9 +163,13 @@ fi AC_ARG_ENABLE(fts5, [AS_HELP_STRING( [--enable-fts5], [include fts5 support [default=yes]])], [], [enable_fts5=yes]) +AC_MSG_CHECKING([FTS5 extension]) if test x"$enable_fts5" = "xyes"; then + AC_MSG_RESULT([enabled]) AC_SEARCH_LIBS(log, m) BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS5" +else + AC_MSG_RESULT([disabled]) fi #----------------------------------------------------------------------- @@ -149,8 +179,12 @@ fi AC_ARG_ENABLE(json1, [AS_HELP_STRING( [--enable-json1], [include json1 support [default=yes]])], [],[enable_json1=yes]) +AC_MSG_CHECKING([JSON functions]) if test x"$enable_json1" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_JSON1" + AC_MSG_RESULT([enabled]) +else + AC_MSG_RESULT([disabled]) fi #----------------------------------------------------------------------- @@ -160,8 +194,12 @@ fi AC_ARG_ENABLE(rtree, [AS_HELP_STRING( [--enable-rtree], [include rtree support [default=yes]])], [], [enable_rtree=yes]) +AC_MSG_CHECKING([RTREE extension]) if test x"$enable_rtree" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY" + AC_MSG_RESULT([enabled]) +else + AC_MSG_RESULT([disabled]) fi #----------------------------------------------------------------------- @@ -171,8 +209,12 @@ fi AC_ARG_ENABLE(session, [AS_HELP_STRING( [--enable-session], [enable the session extension [default=no]])], [], []) +AC_MSG_CHECKING([Session extension]) if test x"$enable_session" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK" + AC_MSG_RESULT([enabled]) +else + AC_MSG_RESULT([disabled]) fi #----------------------------------------------------------------------- @@ -182,9 +224,13 @@ fi AC_ARG_ENABLE(debug, [AS_HELP_STRING( [--enable-debug], [build with debugging features enabled [default=no]])], [], []) +AC_MSG_CHECKING([Build type]) if test x"$enable_debug" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE" CFLAGS="-g -O0" + AC_MSG_RESULT([debug]) +else + AC_MSG_RESULT([release]) fi #----------------------------------------------------------------------- diff --git a/shell.c b/shell.c index 6f4fee80dc1c..27de22a3819b 100644 --- a/shell.c +++ b/shell.c @@ -1424,7 +1424,10 @@ SQLITE_EXTENSION_INIT1 #include #include #include + +#ifndef SQLITE_AMALGAMATION /* typedef sqlite3_uint64 u64; */ +#endif /* SQLITE_AMALGAMATION */ /****************************************************************************** ** The Hash Engine @@ -3637,24 +3640,23 @@ int sqlite3_completion_init( ** appended onto the end of some other file, such as an executable. ** ** A special record must appear at the end of the file that identifies the -** file as an appended database and provides an offset to page 1. For -** best performance page 1 should be located at a disk page boundary, though -** that is not required. +** file as an appended database and provides the offset to the first page +** of the exposed content. (Or, it is the length of the content prefix.) +** For best performance page 1 should be located at a disk page boundary, +** though that is not required. ** ** When opening a database using this VFS, the connection might treat -** the file as an ordinary SQLite database, or it might treat is as a -** database appended onto some other file. Here are the rules: +** the file as an ordinary SQLite database, or it might treat it as a +** database appended onto some other file. The decision is made by +** applying the following rules in order: ** -** (1) When opening a new empty file, that file is treated as an ordinary -** database. +** (1) An empty file is an ordinary database. ** -** (2) When opening a file that begins with the standard SQLite prefix -** string "SQLite format 3", that file is treated as an ordinary -** database. +** (2) If the file ends with the appendvfs trailer string +** "Start-Of-SQLite3-NNNNNNNN" that file is an appended database. ** -** (3) When opening a file that ends with the appendvfs trailer string -** "Start-Of-SQLite3-NNNNNNNN" that file is treated as an appended -** database. +** (3) If the file begins with the standard SQLite prefix string +** "SQLite format 3", that file is an ordinary database. ** ** (4) If none of the above apply and the SQLITE_OPEN_CREATE flag is ** set, then a new database is appended to the already existing file. @@ -3662,13 +3664,13 @@ int sqlite3_completion_init( ** (5) Otherwise, SQLITE_CANTOPEN is returned. ** ** To avoid unnecessary complications with the PENDING_BYTE, the size of -** the file containing the database is limited to 1GB. This VFS will refuse -** to read or write past the 1GB mark. This restriction might be lifted in -** future versions. For now, if you need a large database, then keep the -** database in a separate file. +** the file containing the database is limited to 1GiB. (1073741824 bytes) +** This VFS will not read or write past the 1GiB mark. This restriction +** might be lifted in future versions. For now, if you need a larger +** database, then keep it in a separate file. ** -** If the file being opened is not an appended database, then this shim is -** a pass-through into the default underlying VFS. +** If the file being opened is a plain database (not an appended one), then +** this shim is a pass-through into the default underlying VFS. (rule 3) **/ /* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 @@ -3681,17 +3683,27 @@ SQLITE_EXTENSION_INIT1 ** 123456789 123456789 12345 ** ** The NNNNNNNN represents a 64-bit big-endian unsigned integer which is -** the offset to page 1. +** the offset to page 1, and also the length of the prefix content. */ #define APND_MARK_PREFIX "Start-Of-SQLite3-" #define APND_MARK_PREFIX_SZ 17 -#define APND_MARK_SIZE 25 +#define APND_MARK_FOS_SZ 8 +#define APND_MARK_SIZE (APND_MARK_PREFIX_SZ+APND_MARK_FOS_SZ) /* ** Maximum size of the combined prefix + database + append-mark. This ** must be less than 0x40000000 to avoid locking issues on Windows. */ -#define APND_MAX_SIZE (65536*15259) +#define APND_MAX_SIZE (0x40000000) + +/* +** Try to align the database to an even multiple of APND_ROUNDUP bytes. +*/ +#ifndef APND_ROUNDUP +#define APND_ROUNDUP 4096 +#endif +#define APND_ALIGN_MASK ((sqlite3_int64)(APND_ROUNDUP-1)) +#define APND_START_ROUNDUP(fsz) (((fsz)+APND_ALIGN_MASK) & ~APND_ALIGN_MASK) /* ** Forward declaration of objects used by this utility @@ -3705,11 +3717,45 @@ typedef struct ApndFile ApndFile; #define ORIGVFS(p) ((sqlite3_vfs*)((p)->pAppData)) #define ORIGFILE(p) ((sqlite3_file*)(((ApndFile*)(p))+1)) -/* An open file */ +/* An open appendvfs file +** +** An instance of this structure describes the appended database file. +** A separate sqlite3_file object is always appended. The appended +** sqlite3_file object (which can be accessed using ORIGFILE()) describes +** the entire file, including the prefix, the database, and the +** append-mark. +** +** The structure of an AppendVFS database is like this: +** +** +-------------+---------+----------+-------------+ +** | prefix-file | padding | database | append-mark | +** +-------------+---------+----------+-------------+ +** ^ ^ +** | | +** iPgOne iMark +** +** +** "prefix file" - file onto which the database has been appended. +** "padding" - zero or more bytes inserted so that "database" +** starts on an APND_ROUNDUP boundary +** "database" - The SQLite database file +** "append-mark" - The 25-byte "Start-Of-SQLite3-NNNNNNNN" that indicates +** the offset from the start of prefix-file to the start +** of "database". +** +** The size of the database is iMark - iPgOne. +** +** The NNNNNNNN in the "Start-Of-SQLite3-NNNNNNNN" suffix is the value +** of iPgOne stored as a big-ending 64-bit integer. +** +** iMark will be the size of the underlying file minus 25 (APND_MARKSIZE). +** Or, iMark is -1 to indicate that it has not yet been written. +*/ struct ApndFile { - sqlite3_file base; /* IO methods */ - sqlite3_int64 iPgOne; /* File offset to page 1 */ - sqlite3_int64 iMark; /* Start of the append-mark */ + sqlite3_file base; /* Subclass. MUST BE FIRST! */ + sqlite3_int64 iPgOne; /* Offset to the start of the database */ + sqlite3_int64 iMark; /* Offset of the append mark. -1 if unwritten */ + /* Always followed by another sqlite3_file that describes the whole file */ }; /* @@ -3801,8 +3847,6 @@ static const sqlite3_io_methods apnd_io_methods = { apndUnfetch /* xUnfetch */ }; - - /* ** Close an apnd-file. */ @@ -3820,22 +3864,37 @@ static int apndRead( int iAmt, sqlite_int64 iOfst ){ - ApndFile *p = (ApndFile *)pFile; + ApndFile *paf = (ApndFile *)pFile; pFile = ORIGFILE(pFile); - return pFile->pMethods->xRead(pFile, zBuf, iAmt, iOfst+p->iPgOne); + return pFile->pMethods->xRead(pFile, zBuf, iAmt, paf->iPgOne+iOfst); } /* -** Add the append-mark onto the end of the file. +** Add the append-mark onto what should become the end of the file. +* If and only if this succeeds, internal ApndFile.iMark is updated. +* Parameter iWriteEnd is the appendvfs-relative offset of the new mark. */ -static int apndWriteMark(ApndFile *p, sqlite3_file *pFile){ - int i; +static int apndWriteMark( + ApndFile *paf, + sqlite3_file *pFile, + sqlite_int64 iWriteEnd +){ + sqlite_int64 iPgOne = paf->iPgOne; unsigned char a[APND_MARK_SIZE]; + int i = APND_MARK_FOS_SZ; + int rc; + assert(pFile == ORIGFILE(paf)); memcpy(a, APND_MARK_PREFIX, APND_MARK_PREFIX_SZ); - for(i=0; i<8; i++){ - a[APND_MARK_PREFIX_SZ+i] = (p->iPgOne >> (56 - i*8)) & 0xff; + while( --i >= 0 ){ + a[APND_MARK_PREFIX_SZ+i] = (unsigned char)(iPgOne & 0xff); + iPgOne >>= 8; + } + iWriteEnd += paf->iPgOne; + if( SQLITE_OK==(rc = pFile->pMethods->xWrite + (pFile, a, APND_MARK_SIZE, iWriteEnd)) ){ + paf->iMark = iWriteEnd; } - return pFile->pMethods->xWrite(pFile, a, APND_MARK_SIZE, p->iMark); + return rc; } /* @@ -3847,38 +3906,28 @@ static int apndWrite( int iAmt, sqlite_int64 iOfst ){ - int rc; - ApndFile *p = (ApndFile *)pFile; + ApndFile *paf = (ApndFile *)pFile; + sqlite_int64 iWriteEnd = iOfst + iAmt; + if( iWriteEnd>=APND_MAX_SIZE ) return SQLITE_FULL; pFile = ORIGFILE(pFile); - if( iOfst+iAmt>=APND_MAX_SIZE ) return SQLITE_FULL; - rc = pFile->pMethods->xWrite(pFile, zBuf, iAmt, iOfst+p->iPgOne); - if( rc==SQLITE_OK && iOfst + iAmt + p->iPgOne > p->iMark ){ - sqlite3_int64 sz = 0; - rc = pFile->pMethods->xFileSize(pFile, &sz); - if( rc==SQLITE_OK ){ - p->iMark = sz - APND_MARK_SIZE; - if( iOfst + iAmt + p->iPgOne > p->iMark ){ - p->iMark = p->iPgOne + iOfst + iAmt; - rc = apndWriteMark(p, pFile); - } - } + /* If append-mark is absent or will be overwritten, write it. */ + if( paf->iMark < 0 || paf->iPgOne + iWriteEnd > paf->iMark ){ + int rc = apndWriteMark(paf, pFile, iWriteEnd); + if( SQLITE_OK!=rc ) return rc; } - return rc; + return pFile->pMethods->xWrite(pFile, zBuf, iAmt, paf->iPgOne+iOfst); } /* ** Truncate an apnd-file. */ static int apndTruncate(sqlite3_file *pFile, sqlite_int64 size){ - int rc; - ApndFile *p = (ApndFile *)pFile; + ApndFile *paf = (ApndFile *)pFile; pFile = ORIGFILE(pFile); - rc = pFile->pMethods->xTruncate(pFile, size+p->iPgOne+APND_MARK_SIZE); - if( rc==SQLITE_OK ){ - p->iMark = p->iPgOne+size; - rc = apndWriteMark(p, pFile); - } - return rc; + /* The append mark goes out first so truncate failure does not lose it. */ + if( SQLITE_OK!=apndWriteMark(paf, pFile, size) ) return SQLITE_IOERR; + /* Truncate underlying file just past append mark */ + return pFile->pMethods->xTruncate(pFile, paf->iMark+APND_MARK_SIZE); } /* @@ -3891,16 +3940,12 @@ static int apndSync(sqlite3_file *pFile, int flags){ /* ** Return the current file-size of an apnd-file. +** If the append mark is not yet there, the file-size is 0. */ static int apndFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){ - ApndFile *p = (ApndFile *)pFile; - int rc; - pFile = ORIGFILE(p); - rc = pFile->pMethods->xFileSize(pFile, pSize); - if( rc==SQLITE_OK && p->iPgOne ){ - *pSize -= p->iPgOne + APND_MARK_SIZE; - } - return rc; + ApndFile *paf = (ApndFile *)pFile; + *pSize = ( paf->iMark >= 0 )? (paf->iMark - paf->iPgOne) : 0; + return SQLITE_OK; } /* @@ -3931,12 +3976,13 @@ static int apndCheckReservedLock(sqlite3_file *pFile, int *pResOut){ ** File control method. For custom operations on an apnd-file. */ static int apndFileControl(sqlite3_file *pFile, int op, void *pArg){ - ApndFile *p = (ApndFile *)pFile; + ApndFile *paf = (ApndFile *)pFile; int rc; pFile = ORIGFILE(pFile); + if( op==SQLITE_FCNTL_SIZE_HINT ) *(sqlite3_int64*)pArg += paf->iPgOne; rc = pFile->pMethods->xFileControl(pFile, op, pArg); if( rc==SQLITE_OK && op==SQLITE_FCNTL_VFSNAME ){ - *(char**)pArg = sqlite3_mprintf("apnd(%lld)/%z", p->iPgOne, *(char**)pArg); + *(char**)pArg = sqlite3_mprintf("apnd(%lld)/%z", paf->iPgOne,*(char**)pArg); } return rc; } @@ -3995,6 +4041,9 @@ static int apndFetch( void **pp ){ ApndFile *p = (ApndFile *)pFile; + if( p->iMark < 0 || iOfst+iAmt > p->iMark ){ + return SQLITE_IOERR; /* Cannot read what is not yet there. */ + } pFile = ORIGFILE(pFile); return pFile->pMethods->xFetch(pFile, iOfst+p->iPgOne, iAmt, pp); } @@ -4006,95 +4055,153 @@ static int apndUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *pPage){ return pFile->pMethods->xUnfetch(pFile, iOfst+p->iPgOne, pPage); } -/* -** Check to see if the file is an ordinary SQLite database file. -*/ -static int apndIsOrdinaryDatabaseFile(sqlite3_int64 sz, sqlite3_file *pFile){ - int rc; - char zHdr[16]; - static const char aSqliteHdr[] = "SQLite format 3"; - if( sz<512 ) return 0; - rc = pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), 0); - if( rc ) return 0; - return memcmp(zHdr, aSqliteHdr, sizeof(zHdr))==0; -} - /* ** Try to read the append-mark off the end of a file. Return the -** start of the appended database if the append-mark is present. If -** there is no append-mark, return -1; +** start of the appended database if the append-mark is present. +** If there is no valid append-mark, return -1; +** +** An append-mark is only valid if the NNNNNNNN start-of-database offset +** indicates that the appended database contains at least one page. The +** start-of-database value must be a multiple of 512. */ static sqlite3_int64 apndReadMark(sqlite3_int64 sz, sqlite3_file *pFile){ int rc, i; sqlite3_int64 iMark; + int msbs = 8 * (APND_MARK_FOS_SZ-1); unsigned char a[APND_MARK_SIZE]; - if( sz<=APND_MARK_SIZE ) return -1; + if( APND_MARK_SIZE!=(sz & 0x1ff) ) return -1; rc = pFile->pMethods->xRead(pFile, a, APND_MARK_SIZE, sz-APND_MARK_SIZE); if( rc ) return -1; if( memcmp(a, APND_MARK_PREFIX, APND_MARK_PREFIX_SZ)!=0 ) return -1; - iMark = ((sqlite3_int64)(a[APND_MARK_PREFIX_SZ]&0x7f))<<56; - for(i=1; i<8; i++){ - iMark += (sqlite3_int64)a[APND_MARK_PREFIX_SZ+i]<<(56-8*i); + iMark = ((sqlite3_int64)(a[APND_MARK_PREFIX_SZ] & 0x7f)) << msbs; + for(i=1; i<8; i++){ + msbs -= 8; + iMark |= (sqlite3_int64)a[APND_MARK_PREFIX_SZ+i]< (sz - APND_MARK_SIZE - 512) ) return -1; + if( iMark & 0x1ff ) return -1; return iMark; } +static const char apvfsSqliteHdr[] = "SQLite format 3"; +/* +** Check to see if the file is an appendvfs SQLite database file. +** Return true iff it is such. Parameter sz is the file's size. +*/ +static int apndIsAppendvfsDatabase(sqlite3_int64 sz, sqlite3_file *pFile){ + int rc; + char zHdr[16]; + sqlite3_int64 iMark = apndReadMark(sz, pFile); + if( iMark>=0 ){ + /* If file has the correct end-marker, the expected odd size, and the + ** SQLite DB type marker where the end-marker puts it, then it + ** is an appendvfs database. + */ + rc = pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), iMark); + if( SQLITE_OK==rc + && memcmp(zHdr, apvfsSqliteHdr, sizeof(zHdr))==0 + && (sz & 0x1ff) == APND_MARK_SIZE + && sz>=512+APND_MARK_SIZE + ){ + return 1; /* It's an appendvfs database */ + } + } + return 0; +} + +/* +** Check to see if the file is an ordinary SQLite database file. +** Return true iff so. Parameter sz is the file's size. +*/ +static int apndIsOrdinaryDatabaseFile(sqlite3_int64 sz, sqlite3_file *pFile){ + char zHdr[16]; + if( apndIsAppendvfsDatabase(sz, pFile) /* rule 2 */ + || (sz & 0x1ff) != 0 + || SQLITE_OK!=pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), 0) + || memcmp(zHdr, apvfsSqliteHdr, sizeof(zHdr))!=0 + ){ + return 0; + }else{ + return 1; + } +} + /* ** Open an apnd file handle. */ static int apndOpen( - sqlite3_vfs *pVfs, + sqlite3_vfs *pApndVfs, const char *zName, sqlite3_file *pFile, int flags, int *pOutFlags ){ - ApndFile *p; - sqlite3_file *pSubFile; - sqlite3_vfs *pSubVfs; + ApndFile *pApndFile = (ApndFile*)pFile; + sqlite3_file *pBaseFile = ORIGFILE(pFile); + sqlite3_vfs *pBaseVfs = ORIGVFS(pApndVfs); int rc; - sqlite3_int64 sz; - pSubVfs = ORIGVFS(pVfs); + sqlite3_int64 sz = 0; if( (flags & SQLITE_OPEN_MAIN_DB)==0 ){ - return pSubVfs->xOpen(pSubVfs, zName, pFile, flags, pOutFlags); + /* The appendvfs is not to be used for transient or temporary databases. + ** Just use the base VFS open to initialize the given file object and + ** open the underlying file. (Appendvfs is then unused for this file.) + */ + return pBaseVfs->xOpen(pBaseVfs, zName, pFile, flags, pOutFlags); } - p = (ApndFile*)pFile; - memset(p, 0, sizeof(*p)); - pSubFile = ORIGFILE(pFile); + memset(pApndFile, 0, sizeof(ApndFile)); pFile->pMethods = &apnd_io_methods; - rc = pSubVfs->xOpen(pSubVfs, zName, pSubFile, flags, pOutFlags); - if( rc ) goto apnd_open_done; - rc = pSubFile->pMethods->xFileSize(pSubFile, &sz); + pApndFile->iMark = -1; /* Append mark not yet written */ + + rc = pBaseVfs->xOpen(pBaseVfs, zName, pBaseFile, flags, pOutFlags); + if( rc==SQLITE_OK ){ + rc = pBaseFile->pMethods->xFileSize(pBaseFile, &sz); + } if( rc ){ - pSubFile->pMethods->xClose(pSubFile); - goto apnd_open_done; + pBaseFile->pMethods->xClose(pBaseFile); + pFile->pMethods = 0; + return rc; } - if( apndIsOrdinaryDatabaseFile(sz, pSubFile) ){ - memmove(pFile, pSubFile, pSubVfs->szOsFile); + if( apndIsOrdinaryDatabaseFile(sz, pBaseFile) ){ + /* The file being opened appears to be just an ordinary DB. Copy + ** the base dispatch-table so this instance mimics the base VFS. + */ + memmove(pApndFile, pBaseFile, pBaseVfs->szOsFile); return SQLITE_OK; } - p->iMark = 0; - p->iPgOne = apndReadMark(sz, pFile); - if( p->iPgOne>0 ){ + pApndFile->iPgOne = apndReadMark(sz, pFile); + if( pApndFile->iPgOne>=0 ){ + pApndFile->iMark = sz - APND_MARK_SIZE; /* Append mark found */ return SQLITE_OK; } if( (flags & SQLITE_OPEN_CREATE)==0 ){ - pSubFile->pMethods->xClose(pSubFile); + pBaseFile->pMethods->xClose(pBaseFile); rc = SQLITE_CANTOPEN; + pFile->pMethods = 0; + }else{ + /* Round newly added appendvfs location to #define'd page boundary. + ** Note that nothing has yet been written to the underlying file. + ** The append mark will be written along with first content write. + ** Until then, paf->iMark value indicates it is not yet written. + */ + pApndFile->iPgOne = APND_START_ROUNDUP(sz); } - p->iPgOne = (sz+0xfff) & ~(sqlite3_int64)0xfff; -apnd_open_done: - if( rc ) pFile->pMethods = 0; return rc; } /* -** All other VFS methods are pass-thrus. +** Delete an apnd file. +** For an appendvfs, this could mean delete the appendvfs portion, *** 17967 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu May 6 22:12:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CB4A62FE75; Thu, 6 May 2021 22:12: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbnrJ1fBLz574Z; Thu, 6 May 2021 22:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2B566201CC; Thu, 6 May 2021 22:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146MCW9x054215; Thu, 6 May 2021 22:12:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146MCWsg054214; Thu, 6 May 2021 22:12:32 GMT (envelope-from git) Date: Thu, 6 May 2021 22:12:32 GMT Message-Id: <202105062212.146MCWsg054214@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 510a3da1477a - main - nvmecontrol: Report status from passthru commands MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 510a3da1477a917aa2aaf6b9e3cd6fd50dd13206 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 22:12:32 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=510a3da1477a917aa2aaf6b9e3cd6fd50dd13206 commit 510a3da1477a917aa2aaf6b9e3cd6fd50dd13206 Author: Warner Losh AuthorDate: 2021-03-25 07:41:53 +0000 Commit: Warner Losh CommitDate: 2021-05-06 22:09:31 +0000 nvmecontrol: Report status from passthru commands Report status from dword0 for passthru commands. Many commands report some status or information here, so reporting it can help know what's going on. Sponsored by: Netflix --- sbin/nvmecontrol/passthru.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/passthru.c b/sbin/nvmecontrol/passthru.c index add6cf1cc7ca..8284261b769b 100644 --- a/sbin/nvmecontrol/passthru.c +++ b/sbin/nvmecontrol/passthru.c @@ -246,7 +246,8 @@ passthru(const struct cmd *f, int argc, char *argv[]) errno = 0; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) err(EX_IOERR, "passthrough request failed"); - /* XXX report status */ + if (!opt.binary) + printf("DWORD0 status= %#x\n", pt.cpl.cdw0); if (opt.read) { if (opt.binary) write(STDOUT_FILENO, data, opt.data_len); From owner-dev-commits-src-all@freebsd.org Thu May 6 22:12:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EB0462FAF2; Thu, 6 May 2021 22:12:33 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbnrK2TsNz57GC; Thu, 6 May 2021 22:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 425091FC4E; Thu, 6 May 2021 22:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146MCXB9054236; Thu, 6 May 2021 22:12:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146MCX9x054235; Thu, 6 May 2021 22:12:33 GMT (envelope-from git) Date: Thu, 6 May 2021 22:12:33 GMT Message-Id: <202105062212.146MCX9x054235@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 6d6cca363392 - main - nvmecontrol: update copyright on passthru command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d6cca363392943689204f920fa2da9226e42056 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 22:12:33 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6d6cca363392943689204f920fa2da9226e42056 commit 6d6cca363392943689204f920fa2da9226e42056 Author: Warner Losh AuthorDate: 2021-05-06 22:05:42 +0000 Commit: Warner Losh CommitDate: 2021-05-06 22:09:31 +0000 nvmecontrol: update copyright on passthru command I wrote this code, not Intel, so put my copyright on this. I mistakenly copied it for the initial commit. Sponsored by: Netflix --- sbin/nvmecontrol/passthru.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sbin/nvmecontrol/passthru.c b/sbin/nvmecontrol/passthru.c index 8284261b769b..0b24d7b1ea1f 100644 --- a/sbin/nvmecontrol/passthru.c +++ b/sbin/nvmecontrol/passthru.c @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (C) 2012-2013 Intel Corporation - * All rights reserved. + * Copyright (c) 2019-2021 Netflix, Inc * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-dev-commits-src-all@freebsd.org Thu May 6 22:22:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E44D63012C; Thu, 6 May 2021 22:22:05 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fbp3K1mV4z57SR; Thu, 6 May 2021 22:22:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2F72D20225; Thu, 6 May 2021 22:22:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146MM5XM067340; Thu, 6 May 2021 22:22:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146MM5JN067339; Thu, 6 May 2021 22:22:05 GMT (envelope-from git) Date: Thu, 6 May 2021 22:22:05 GMT Message-Id: <202105062222.146MM5JN067339@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a709a4f0d4e0 - main - headers: Implement _ISOC11_SOURCES macro when __POSIX_C_SOURCE defined MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a709a4f0d4e0303eb40ea1b39b4bb35837800805 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 22:22:05 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a709a4f0d4e0303eb40ea1b39b4bb35837800805 commit a709a4f0d4e0303eb40ea1b39b4bb35837800805 Author: Warner Losh AuthorDate: 2021-05-06 22:20:19 +0000 Commit: Warner Losh CommitDate: 2021-05-06 22:20:36 +0000 headers: Implement _ISOC11_SOURCES macro when __POSIX_C_SOURCE defined When _ISOC11_SOURCES is defined for glibc at the same time __POSIX_C_SOURCE is defined, it extends the __POSIX_C_SOURCE definition by exaclty what C11 adds to the spec for each system header. We follow both OpenBSD's and glibc's convention by also C11 or higher compliation mode is selected. The Open Group is working on issuing a new version of the POSIX standard that will realign the standard from C99 to a newer version of C. This commit is a stop-gap measure for greater compatibility until that environment has been standardized. Reviewed by: brooks@, arichards@, Olivier Certne (comments tweaked before commit) PR: 255290 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29902 --- sys/sys/cdefs.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index ff461db9ec2e..309b2a4004a6 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -718,6 +718,17 @@ #define __POSIX_VISIBLE 198808 #define __ISO_C_VISIBLE 0 #endif /* _POSIX_C_SOURCE */ +/* + * Both glibc and OpenBSD enable c11 features when _ISOC11_SOURCE is defined, or + * when compiling with -stdc=c11. A strict reading of the standard would suggest + * doing it only for the former. However, a strict reading also requires C99 + * mode only, so building with C11 is already undefined. Follow glibc's and + * OpenBSD's lead for this non-standard configuration for maximum compatibility. + */ +#if _ISOC11_SOURCE || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) +#undef __ISO_C_VISIBLE +#define __ISO_C_VISIBLE 2011 +#endif #else /*- * Deal with _ANSI_SOURCE: From owner-dev-commits-src-all@freebsd.org Thu May 6 22:43:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D05216307DA; Thu, 6 May 2021 22:43:52 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbpXS5c4Gz58c2; Thu, 6 May 2021 22:43:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B32B0205B9; Thu, 6 May 2021 22:43:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146MhqSG093805; Thu, 6 May 2021 22:43:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146MhqaJ093804; Thu, 6 May 2021 22:43:52 GMT (envelope-from git) Date: Thu, 6 May 2021 22:43:52 GMT Message-Id: <202105062243.146MhqaJ093804@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 42f3faa762f8 - main - cdefs.h: Remove __GNUCLIKE___OFFSETOF, it's unused MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 42f3faa762f8cc52ac2cb24b5d07c075826c3f9f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 22:43:52 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=42f3faa762f8cc52ac2cb24b5d07c075826c3f9f commit 42f3faa762f8cc52ac2cb24b5d07c075826c3f9f Author: Warner Losh AuthorDate: 2021-05-06 22:34:55 +0000 Commit: Warner Losh CommitDate: 2021-05-06 22:34:55 +0000 cdefs.h: Remove __GNUCLIKE___OFFSETOF, it's unused __GNUCLIKE___OFFSETOF is unreferenced in the tree, remove it as long obsolete. Sponsored by: Netflix --- sys/sys/cdefs.h | 1 - tests/sys/opencrypto/cryptodevh.py | 1 - 2 files changed, 2 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 309b2a4004a6..f8e31c25bdb5 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -84,7 +84,6 @@ #define __GNUCLIKE_ASM 2 #endif #define __GNUCLIKE___TYPEOF 1 -#define __GNUCLIKE___OFFSETOF 1 #define __GNUCLIKE___SECTION 1 #define __GNUCLIKE_CTOR_SECTION_HANDLING 1 diff --git a/tests/sys/opencrypto/cryptodevh.py b/tests/sys/opencrypto/cryptodevh.py index c5719e47c8c1..43aa04691707 100644 --- a/tests/sys/opencrypto/cryptodevh.py +++ b/tests/sys/opencrypto/cryptodevh.py @@ -27,7 +27,6 @@ def __has_builtin(x): return 0 __GNUCLIKE_ASM = 3 __GNUCLIKE_ASM = 2 __GNUCLIKE___TYPEOF = 1 -__GNUCLIKE___OFFSETOF = 1 __GNUCLIKE___SECTION = 1 __GNUCLIKE_CTOR_SECTION_HANDLING = 1 __GNUCLIKE_BUILTIN_CONSTANT_P = 1 From owner-dev-commits-src-all@freebsd.org Fri May 7 00:43:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38FF5632E72; Fri, 7 May 2021 00:43:39 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbsBg17qPz3FxN; Fri, 7 May 2021 00:43:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 19C7022020; Fri, 7 May 2021 00:43:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1470hdYo052672; Fri, 7 May 2021 00:43:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1470hdsK052671; Fri, 7 May 2021 00:43:39 GMT (envelope-from git) Date: Fri, 7 May 2021 00:43:39 GMT Message-Id: <202105070043.1470hdsK052671@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: af861a369e4e - stable/13 - amd64: invalidate TLB between page table update and access MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: af861a369e4ec7ea02d0f6611efd84d10b4b103e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 00:43:39 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=af861a369e4ec7ea02d0f6611efd84d10b4b103e commit af861a369e4ec7ea02d0f6611efd84d10b4b103e Author: Konstantin Belousov AuthorDate: 2021-04-16 18:28:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 00:35:54 +0000 amd64: invalidate TLB between page table update and access (cherry picked from commit 21fc6a2a10cf6fbd294decbb0001473693ec1618) --- sys/amd64/amd64/pmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 1fb81384f11e..01644b9661af 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2102,6 +2102,7 @@ pmap_bootstrap_la57(void *arg __unused) *(u_long *)(v_code + 2 + (la57_trampoline_gdt_desc - la57_trampoline)) = la57_trampoline_gdt - la57_trampoline + VM_PAGE_TO_PHYS(m_code); la57_tramp = (void (*)(uint64_t))VM_PAGE_TO_PHYS(m_code); + invlpg((vm_offset_t)la57_tramp); la57_tramp(KPML5phys); /* From owner-dev-commits-src-all@freebsd.org Fri May 7 00:43:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A60C4633139; Fri, 7 May 2021 00:43:40 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbsBh2TV9z3G7R; Fri, 7 May 2021 00:43:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4668521F75; Fri, 7 May 2021 00:43:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1470heTv052693; Fri, 7 May 2021 00:43:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1470heTw052692; Fri, 7 May 2021 00:43:40 GMT (envelope-from git) Date: Fri, 7 May 2021 00:43:40 GMT Message-Id: <202105070043.1470heTw052692@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: aa21554a8b03 - stable/13 - ioccom: define ioctl cmd value that can never be valid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aa21554a8b03196c4208a2a33527020f29073a00 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 00:43:40 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=aa21554a8b03196c4208a2a33527020f29073a00 commit aa21554a8b03196c4208a2a33527020f29073a00 Author: Konstantin Belousov AuthorDate: 2021-04-22 19:40:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 00:36:00 +0000 ioccom: define ioctl cmd value that can never be valid (cherry picked from commit 619fe095861274576a2cb45628076968051b1585) --- sys/sys/ioccom.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/sys/ioccom.h b/sys/sys/ioccom.h index 0329ac358491..13faba046719 100644 --- a/sys/sys/ioccom.h +++ b/sys/sys/ioccom.h @@ -79,6 +79,9 @@ #define IOCPARM_IVAL(x) ((int)(intptr_t)(void *)*(caddr_t *)(void *)(x)) #endif +#define _IOC_INVALID (_IOC_VOID|_IOC_INOUT) /* Never valid cmd value, + use as filler */ + #else #include From owner-dev-commits-src-all@freebsd.org Fri May 7 00:54:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7160A633447; Fri, 7 May 2021 00:54:49 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbsRY1sW0z3G4x; Fri, 7 May 2021 00:54:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 32BA722489; Fri, 7 May 2021 00:54:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1470snjx065815; Fri, 7 May 2021 00:54:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1470snf1065814; Fri, 7 May 2021 00:54:49 GMT (envelope-from git) Date: Fri, 7 May 2021 00:54:49 GMT Message-Id: <202105070054.1470snf1065814@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 075f27cf4a8f - stable/12 - ioccom: define ioctl cmd value that can never be valid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 075f27cf4a8ffd8d2189c40614edda074de5a6e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 00:54:49 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=075f27cf4a8ffd8d2189c40614edda074de5a6e8 commit 075f27cf4a8ffd8d2189c40614edda074de5a6e8 Author: Konstantin Belousov AuthorDate: 2021-04-22 19:40:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 00:44:08 +0000 ioccom: define ioctl cmd value that can never be valid (cherry picked from commit 619fe095861274576a2cb45628076968051b1585) --- sys/sys/ioccom.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/sys/ioccom.h b/sys/sys/ioccom.h index 3e5f7200fb1a..f7e9fa12a960 100644 --- a/sys/sys/ioccom.h +++ b/sys/sys/ioccom.h @@ -73,6 +73,9 @@ #define IOCPARM_IVAL(x) ((int)(intptr_t)(void *)*(caddr_t *)(void *)(x)) #endif +#define _IOC_INVALID (_IOC_VOID|_IOC_INOUT) /* Never valid cmd value, + use as filler */ + #else #include From owner-dev-commits-src-all@freebsd.org Fri May 7 01:09:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9BE263383C; Fri, 7 May 2021 01:09:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fbsn15Fzhz3H5k; Fri, 7 May 2021 01:09:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A2BDC22423; Fri, 7 May 2021 01:09:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14719vmm080209; Fri, 7 May 2021 01:09:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14719u2b080207; Fri, 7 May 2021 01:09:56 GMT (envelope-from git) Date: Fri, 7 May 2021 01:09:56 GMT Message-Id: <202105070109.14719u2b080207@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: ce9de47260d4 - main - sqlite3: import sqlite3 3.35.5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ce9de47260d4edc963a94140789e4a52642c28e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 01:09:57 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=ce9de47260d4edc963a94140789e4a52642c28e6 commit ce9de47260d4edc963a94140789e4a52642c28e6 Merge: 42f3faa762f8 0511e356f5e2 Author: Cy Schubert AuthorDate: 2021-05-07 01:01:44 +0000 Commit: Cy Schubert CommitDate: 2021-05-07 01:01:44 +0000 sqlite3: import sqlite3 3.35.5 Merge commit '0511e356f5e2106928ee352ee974d1470c860a9a' into new_merge Changes at https://www.sqlite.org/releaselog/3_35_5.html. MFC after: 1 month contrib/sqlite3/Makefile.msc | 3 + contrib/sqlite3/configure | 153 +- contrib/sqlite3/configure.ac | 50 +- contrib/sqlite3/shell.c | 501 +- contrib/sqlite3/sqlite3.c | 11777 ++++++++++++++++++++++--------------- contrib/sqlite3/sqlite3.h | 59 +- contrib/sqlite3/sqlite3rc.h | 2 +- contrib/sqlite3/tea/configure | 18 +- contrib/sqlite3/tea/configure.ac | 2 +- 9 files changed, 7708 insertions(+), 4857 deletions(-) From owner-dev-commits-src-all@freebsd.org Fri May 7 01:49:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C857634684; Fri, 7 May 2021 01:49:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fbtfg2yFnz3JFK; Fri, 7 May 2021 01:49:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5400E22CA4; Fri, 7 May 2021 01:49:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1471nVMQ032298; Fri, 7 May 2021 01:49:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1471nVUG032297; Fri, 7 May 2021 01:49:31 GMT (envelope-from git) Date: Fri, 7 May 2021 01:49:31 GMT Message-Id: <202105070149.1471nVUG032297@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 4dfb620ea4a7 - main - Add LS1028A clockgen driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4dfb620ea4a7a443284bdcf39c8de1f75cd8c80c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 01:49:31 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=4dfb620ea4a7a443284bdcf39c8de1f75cd8c80c commit 4dfb620ea4a7a443284bdcf39c8de1f75cd8c80c Author: Marcin Wojtas AuthorDate: 2021-05-07 01:33:04 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-07 01:48:53 +0000 Add LS1028A clockgen driver The new driver provides probe and attach functions for the NXP LS1028A clockgen and passes configuration information to QorIQ clockgen class. Submitted by: Lukasz Hajec Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30125 --- sys/arm64/qoriq/clk/ls1028a_clkgen.c | 303 +++++++++++++++++++++++++++++++++++ sys/conf/files.arm64 | 1 + 2 files changed, 304 insertions(+) diff --git a/sys/arm64/qoriq/clk/ls1028a_clkgen.c b/sys/arm64/qoriq/clk/ls1028a_clkgen.c new file mode 100644 index 000000000000..2ed84b07de3c --- /dev/null +++ b/sys/arm64/qoriq/clk/ls1028a_clkgen.c @@ -0,0 +1,303 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Alstom Group. + * Copyright (c) 2021 Semihalf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include + +static uint8_t ls1028a_pltfrm_pll_divs[] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0 +}; + +static struct qoriq_clk_pll_def ls1028a_pltfrm_pll = { + .clkdef = { + .name = "ls1028a_platform_pll", + .id = QORIQ_CLK_ID(QORIQ_TYPE_PLATFORM_PLL, 0), + .flags = 0 + }, + .offset = 0x60080, + .shift = 1, + .mask = 0xFE, + .dividers = ls1028a_pltfrm_pll_divs, + .flags = QORIQ_CLK_PLL_HAS_KILL_BIT +}; + +static const uint8_t ls1028a_cga_pll_divs[] = { + 2, 3, 4, 0 +}; + +static struct qoriq_clk_pll_def ls1028a_cga_pll1 = { + .clkdef = { + .name = "ls1028a_cga_pll1", + .id = QORIQ_CLK_ID(QORIQ_TYPE_INTERNAL, 0), + .flags = 0 + }, + .offset = 0x80, + .shift = 1, + .mask = 0xFE, + .dividers = ls1028a_cga_pll_divs, + .flags = QORIQ_CLK_PLL_HAS_KILL_BIT +}; + +static struct qoriq_clk_pll_def ls1028a_cga_pll2 = { + .clkdef = { + .name = "ls1028a_cga_pll2", + .id = QORIQ_CLK_ID(QORIQ_TYPE_INTERNAL, 20), + .flags = 0 + }, + .offset = 0xA0, + .shift = 1, + .mask = 0xFE, + .dividers = ls1028a_cga_pll_divs, + .flags = QORIQ_CLK_PLL_HAS_KILL_BIT +}; + +static struct qoriq_clk_pll_def *ls1028a_cga_plls[] = { + &ls1028a_cga_pll1, + &ls1028a_cga_pll2 +}; + +static const char *ls1028a_cmux0_parent_names[] = { + "ls1028a_cga_pll1", + "ls1028a_cga_pll1_div2", + "ls1028a_cga_pll1_div4", + NULL, + "ls1028a_cga_pll2", + "ls1028a_cga_pll2_div2", + "ls1028a_cga_pll2_div4" +}; + +static struct clk_mux_def ls1028a_cmux0 = { + .clkdef = { + .name = "ls1028a_cmux0", + .id = QORIQ_CLK_ID(QORIQ_TYPE_CMUX, 0), + .parent_names = ls1028a_cmux0_parent_names, + .parent_cnt = nitems(ls1028a_cmux0_parent_names), + .flags = 0 + }, + .offset = 0x70000, + .shift = 27, + .width = 4, + .mux_flags = 0 +}; + +static struct clk_mux_def ls1028a_cmux1 = { + .clkdef = { + .name = "ls1028a_cmux1", + .id = QORIQ_CLK_ID(QORIQ_TYPE_CMUX, 1), + .parent_names = ls1028a_cmux0_parent_names, + .parent_cnt = nitems(ls1028a_cmux0_parent_names), + .flags = 0 + }, + .offset = 0x70020, + .shift = 27, + .width = 4, + .mux_flags = 0 +}; + +static struct clk_mux_def ls1028a_cmux2 = { + .clkdef = { + .name = "ls1028a_cmux2", + .id = QORIQ_CLK_ID(QORIQ_TYPE_CMUX, 2), + .parent_names = ls1028a_cmux0_parent_names, + .parent_cnt = nitems(ls1028a_cmux0_parent_names), + .flags = 0 + }, + .offset = 0x70040, + .shift = 27, + .width = 4, + .mux_flags = 0 +}; + +static struct clk_mux_def ls1028a_cmux3 = { + .clkdef = { + .name = "ls1028a_cmux3", + .id = QORIQ_CLK_ID(QORIQ_TYPE_CMUX, 3), + .parent_names = ls1028a_cmux0_parent_names, + .parent_cnt = nitems(ls1028a_cmux0_parent_names), + .flags = 0 + }, + .offset = 0x70060, + .shift = 27, + .width = 4, + .mux_flags = 0 +}; + +static const char *ls1028a_hwaccel1_parent_names[] = { + "ls1028a_platform_pll", + "ls1028a_cga_pll1", + "ls1028a_cga_pll1_div2", + "ls1028a_cga_pll1_div3", + "ls1028a_cga_pll1_div4", + NULL, + "ls1028a_cga_pll2_div2", + "ls1028a_cga_pll2_div3" +}; + +static const char *ls1028a_hwaccel2_parent_names[] = { + "ls1028a_platform_pll", + "ls1028a_cga_pll2", + "ls1028a_cga_pll2_div2", + "ls1028a_cga_pll2_div3", + "ls1028a_cga_pll2_div4", + NULL, + "ls1028a_cga_pll1_div2", + "ls1028a_cga_pll1_div3" +}; + +static struct clk_mux_def ls1028a_hwaccel1 = { + .clkdef = { + .name = "ls1028a_hwaccel1", + .id = QORIQ_CLK_ID(QORIQ_TYPE_HWACCEL, 0), + .parent_names = ls1028a_hwaccel1_parent_names, + .parent_cnt = nitems(ls1028a_hwaccel1_parent_names), + .flags = 0 + }, + .offset = 0x10, + .shift = 27, + .width = 4, + .mux_flags = 0 +}; + +static struct clk_mux_def ls1028a_hwaccel2 = { + .clkdef = { + .name = "ls1028a_hwaccel2", + .id = QORIQ_CLK_ID(QORIQ_TYPE_HWACCEL, 1), + .parent_names = ls1028a_hwaccel2_parent_names, + .parent_cnt = nitems(ls1028a_hwaccel2_parent_names), + .flags = 0 + }, + .offset = 0x30, + .shift = 27, + .width = 4, + .mux_flags = 0 +}; + +static struct clk_mux_def ls1028a_hwaccel3 = { + .clkdef = { + .name = "ls1028a_hwaccel3", + .id = QORIQ_CLK_ID(QORIQ_TYPE_HWACCEL, 2), + .parent_names = ls1028a_hwaccel1_parent_names, + .parent_cnt = nitems(ls1028a_hwaccel1_parent_names), + .flags = 0 + }, + .offset = 0x50, + .shift = 27, + .width = 4, + .mux_flags = 0 +}; + +static struct clk_mux_def ls1028a_hwaccel4 = { + .clkdef = { + .name = "ls1028a_hwaccel4", + .id = QORIQ_CLK_ID(QORIQ_TYPE_HWACCEL, 3), + .parent_names = ls1028a_hwaccel2_parent_names, + .parent_cnt = nitems(ls1028a_hwaccel2_parent_names), + .flags = 0 + }, + .offset = 0x70, + .shift = 27, + .width = 4, + .mux_flags = 0 +}; + +static struct clk_mux_def *ls1028a_mux_nodes[] = { + &ls1028a_cmux0, + &ls1028a_cmux1, + &ls1028a_cmux2, + &ls1028a_cmux3, + &ls1028a_hwaccel1, + &ls1028a_hwaccel2, + &ls1028a_hwaccel3, + &ls1028a_hwaccel4 +}; + +static int ls1028a_clkgen_probe(device_t); +static int ls1028a_clkgen_attach(device_t); + +static device_method_t ls1028a_clkgen_methods[] = { + DEVMETHOD(device_probe, ls1028a_clkgen_probe), + DEVMETHOD(device_attach, ls1028a_clkgen_attach), + + DEVMETHOD_END +}; + +DEFINE_CLASS_1(ls1028a_clkgen, ls1028a_clkgen_driver, ls1028a_clkgen_methods, + sizeof(struct qoriq_clkgen_softc), qoriq_clkgen_driver); + +static devclass_t ls1028a_clkgen_devclass; + +EARLY_DRIVER_MODULE(ls1028a_clkgen, simplebus, ls1028a_clkgen_driver, + ls1028a_clkgen_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); + +static int +ls1028a_clkgen_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if(!ofw_bus_is_compatible(dev, "fsl,ls1028a-clockgen")) + return (ENXIO); + + device_set_desc(dev, "LS1028A clockgen"); + return (BUS_PROBE_DEFAULT); +} + +static int +ls1028a_clkgen_attach(device_t dev) +{ + struct qoriq_clkgen_softc *sc; + + sc = device_get_softc(dev); + + sc->pltfrm_pll_def = &ls1028a_pltfrm_pll; + sc->cga_pll = ls1028a_cga_plls; + sc->cga_pll_num = nitems(ls1028a_cga_plls); + sc->mux = ls1028a_mux_nodes; + sc->mux_num = nitems(ls1028a_mux_nodes); + sc->flags = QORIQ_LITTLE_ENDIAN; + + return (qoriq_clkgen_attach(dev)); +} diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 19205b8e18c0..3b0266736d7a 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -499,6 +499,7 @@ arm/freescale/vybrid/vf_i2c.c optional vf_i2c iicbus SOC_NXP_LS arm64/qoriq/qoriq_dw_pci.c optional pci fdt SOC_NXP_LS arm64/qoriq/qoriq_therm.c optional pci fdt SOC_NXP_LS arm64/qoriq/qoriq_therm_if.m optional pci fdt SOC_NXP_LS +arm64/qoriq/clk/ls1028a_clkgen.c optional clk SOC_NXP_LS arm64/qoriq/clk/ls1046a_clkgen.c optional clk SOC_NXP_LS arm64/qoriq/clk/lx2160a_clkgen.c optional clk SOC_NXP_LS arm64/qoriq/clk/qoriq_clk_pll.c optional clk SOC_NXP_LS From owner-dev-commits-src-all@freebsd.org Fri May 7 01:49:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83BAC634414; Fri, 7 May 2021 01:49: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fbtfh39sPz3JFM; Fri, 7 May 2021 01:49:32 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5B35122C24; Fri, 7 May 2021 01:49:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1471nWdn032319; Fri, 7 May 2021 01:49:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1471nWpn032318; Fri, 7 May 2021 01:49:32 GMT (envelope-from git) Date: Fri, 7 May 2021 01:49:32 GMT Message-Id: <202105070149.1471nWpn032318@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: d5b20eaafc0b - main - sdhci_fsl_fdt: specify base clk divisor per SoC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d5b20eaafc0bd8668e5deb8d2b4043c25df4134b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 01:49:32 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=d5b20eaafc0bd8668e5deb8d2b4043c25df4134b commit d5b20eaafc0bd8668e5deb8d2b4043c25df4134b Author: Marcin Wojtas AuthorDate: 2021-05-07 01:45:22 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-07 01:48:54 +0000 sdhci_fsl_fdt: specify base clk divisor per SoC Only LS1046A and LS1028A require the base clk to be divided by 2. Implement that by moving the divider to a SoC specific data. This commit fixes base clk setup for the entire SoC family, including the already suported LS2160A. Submitted by: Lukasz Hajec Reviewed by: manu Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30120 --- sys/dev/sdhci/sdhci_fsl_fdt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/dev/sdhci/sdhci_fsl_fdt.c b/sys/dev/sdhci/sdhci_fsl_fdt.c index d9b7d1954a1d..167c28b60ca0 100644 --- a/sys/dev/sdhci/sdhci_fsl_fdt.c +++ b/sys/dev/sdhci/sdhci_fsl_fdt.c @@ -108,14 +108,17 @@ struct sdhci_fsl_fdt_softc { struct sdhci_fsl_fdt_soc_data { int quirks; + int baseclk_div; }; static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_ls1046a_soc_data = { - .quirks = SDHCI_QUIRK_DONT_SET_HISPD_BIT | SDHCI_QUIRK_BROKEN_AUTO_STOP + .quirks = SDHCI_QUIRK_DONT_SET_HISPD_BIT | SDHCI_QUIRK_BROKEN_AUTO_STOP, + .baseclk_div = 2, }; static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_gen_data = { .quirks = 0, + .baseclk_div = 1, }; static const struct ofw_compat_data sdhci_fsl_fdt_compat_data[] = { @@ -511,7 +514,7 @@ sdhci_fsl_fdt_attach(device_t dev) goto err_free_irq; } - sc->baseclk_hz = clk_hz / 2; + sc->baseclk_hz = clk_hz / sc->soc_data->baseclk_div; /* Figure out eSDHC block endianness before we touch any HW regs. */ if (OF_hasprop(node, "little-endian")) { @@ -537,8 +540,9 @@ sdhci_fsl_fdt_attach(device_t dev) WR4(sc, SDHCI_FSL_PROT_CTRL, val | buf_order); /* - * Gate the SD clock and set its source to peripheral clock / 2. - * The frequency in baseclk_hz is set to match this. + * Gate the SD clock and set its source to + * peripheral clock / baseclk_div. The frequency in baseclk_hz is set + * to match this. */ val = RD4(sc, SDHCI_CLOCK_CONTROL); WR4(sc, SDHCI_CLOCK_CONTROL, val & ~SDHCI_FSL_CLK_SDCLKEN); From owner-dev-commits-src-all@freebsd.org Fri May 7 02:38:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B173A635301; Fri, 7 May 2021 02:38:28 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fbvl84CfRz3KwC; Fri, 7 May 2021 02:38:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 834502381C; Fri, 7 May 2021 02:38:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1472cSwB098541; Fri, 7 May 2021 02:38:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1472cSDT098540; Fri, 7 May 2021 02:38:28 GMT (envelope-from git) Date: Fri, 7 May 2021 02:38:28 GMT Message-Id: <202105070238.1472cSDT098540@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: 8d5898458818 - stable/13 - powerpc: implement bus_map_resource and bus_unmap_resource DEVMETHODs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8d5898458818f9c0aaf203367c8ef1ac4d00fb71 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 02:38:28 -0000 The branch stable/13 has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=8d5898458818f9c0aaf203367c8ef1ac4d00fb71 commit 8d5898458818f9c0aaf203367c8ef1ac4d00fb71 Author: Alfredo Dal'Ava Junior AuthorDate: 2021-03-29 23:28:32 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-05-07 05:32:50 +0000 powerpc: implement bus_map_resource and bus_unmap_resource DEVMETHODs Implements bus_map_resource and bus_unmap_resource DEVMETHODs to be used by powerpc targets. This is identical to the amd64 code. Required by virtio-modern. Reviewed by: bryanv Sponsored by: Eldorado Research Institute (eldorado.org.br) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28012 (cherry picked from commit befb0817bd5e47588eb0254744daec02488acd72) --- sys/powerpc/powerpc/nexus.c | 95 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/sys/powerpc/powerpc/nexus.c b/sys/powerpc/powerpc/nexus.c index 34ec3c0fe0ab..b3fe5a3e1527 100644 --- a/sys/powerpc/powerpc/nexus.c +++ b/sys/powerpc/powerpc/nexus.c @@ -69,6 +69,13 @@ static bus_setup_intr_t nexus_setup_intr; static bus_teardown_intr_t nexus_teardown_intr; static bus_activate_resource_t nexus_activate_resource; static bus_deactivate_resource_t nexus_deactivate_resource; +static int nexus_map_resource(device_t bus, device_t child, int type, + struct resource *r, + struct resource_map_request *argsp, + struct resource_map *map); +static int nexus_unmap_resource(device_t bus, device_t child, int type, + struct resource *r, struct resource_map *map); + static bus_space_tag_t nexus_get_bus_tag(device_t, device_t); static int nexus_get_cpus(device_t, device_t, enum cpu_sets, size_t, cpuset_t *); @@ -87,6 +94,8 @@ static device_method_t nexus_methods[] = { DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_activate_resource, nexus_activate_resource), DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), + DEVMETHOD(bus_map_resource, nexus_map_resource), + DEVMETHOD(bus_unmap_resource, nexus_unmap_resource), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), #ifdef SMP @@ -268,3 +277,89 @@ nexus_deactivate_resource(device_t bus __unused, device_t child __unused, return (rman_deactivate_resource(r)); } + + +static int +nexus_map_resource(device_t bus, device_t child, int type, struct resource *r, + struct resource_map_request *argsp, struct resource_map *map) +{ + + struct resource_map_request args; + rman_res_t end, length, start; + + /* Resources must be active to be mapped. */ + if (!(rman_get_flags(r) & RF_ACTIVE)) + return (ENXIO); + + /* Mappings are only supported on I/O and memory resources. */ + switch (type) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + break; + default: + return (EINVAL); + } + + resource_init_map_request(&args); + if (argsp != NULL) + bcopy(argsp, &args, imin(argsp->size, args.size)); + + start = rman_get_start(r) + args.offset; + if (args.length == 0) + length = rman_get_size(r); + else + length = args.length; + + end = start + length - 1; + if (start > rman_get_end(r) || start < rman_get_start(r)) + return (EINVAL); + + if (end > rman_get_end(r) || end < start) + return (EINVAL); + + /* + * If this is a memory resource, map it into the kernel. + */ + switch (type) { + case SYS_RES_IOPORT: + panic("%s:%d SYS_RES_IOPORT handling not implemented", __func__, __LINE__); + /* XXX: untested + map->r_bushandle = start; + map->r_bustag = nexus_get_bus_tag(NULL, NULL); + map->r_size = length; + map->r_vaddr = NULL; + */ + break; + case SYS_RES_MEMORY: + map->r_vaddr = pmap_mapdev_attr(start, length, args.memattr); + map->r_bustag = nexus_get_bus_tag(NULL, NULL); + map->r_size = length; + map->r_bushandle = (bus_space_handle_t)map->r_vaddr; + break; + } + + return (0); + +} + +static int +nexus_unmap_resource(device_t bus, device_t child, int type, struct resource *r, + struct resource_map *map) +{ + + /* + * If this is a memory resource, unmap it. + */ + switch (type) { + case SYS_RES_MEMORY: + pmap_unmapdev((vm_offset_t)map->r_vaddr, map->r_size); + /* FALLTHROUGH */ + case SYS_RES_IOPORT: + break; + default: + return (EINVAL); + } + + return (0); + +} From owner-dev-commits-src-all@freebsd.org Fri May 7 02:38:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D2AB56352A9; Fri, 7 May 2021 02:38:29 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fbvl9502nz3LFv; Fri, 7 May 2021 02:38:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9C854235D8; Fri, 7 May 2021 02:38:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1472cTwc098562; Fri, 7 May 2021 02:38:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1472cTEN098561; Fri, 7 May 2021 02:38:29 GMT (envelope-from git) Date: Fri, 7 May 2021 02:38:29 GMT Message-Id: <202105070238.1472cTEN098561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: dca829138ca5 - stable/13 - opal_console: fix serial console output corruption on powerpc64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dca829138ca576169cafd2a2bb9fc2c0de88d076 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 02:38:29 -0000 The branch stable/13 has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=dca829138ca576169cafd2a2bb9fc2c0de88d076 commit dca829138ca576169cafd2a2bb9fc2c0de88d076 Author: Alfredo Dal'Ava Junior AuthorDate: 2021-04-16 22:51:15 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-05-07 05:33:39 +0000 opal_console: fix serial console output corruption on powerpc64 Adds OPAL_CONSOLE_WRITE error handling and implements a call to OPAL_CONSOLE_WRITE_BUFFER_SPACE to verify if there's enough space before writing to console. This fixes serial port output getting corrupted on fast writes, like on "dmesg" output. Tested on Raptor Blackbird running powerpc64 BE kernel Reviewed by: luporl Sponsored by: Eldorado Reserach Institute (eldorado.org.br) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29063 (cherry picked from commit b8bc6b7954e27edb449503004ef52b8b97585545) --- sys/powerpc/powernv/opal.h | 1 + sys/powerpc/powernv/opal_console.c | 49 ++++++++++++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/sys/powerpc/powernv/opal.h b/sys/powerpc/powernv/opal.h index d7a81e33f809..8e39a39b6c9a 100644 --- a/sys/powerpc/powernv/opal.h +++ b/sys/powerpc/powernv/opal.h @@ -56,6 +56,7 @@ int opal_call(uint64_t token, ...); #define OPAL_PCI_CONFIG_WRITE_HALF_WORD 17 #define OPAL_PCI_CONFIG_WRITE_WORD 18 #define OPAL_PCI_EEH_FREEZE_STATUS 23 +#define OPAL_CONSOLE_WRITE_BUFFER_SPACE 25 #define OPAL_PCI_EEH_FREEZE_CLEAR 26 #define OPAL_PCI_PHB_MMIO_ENABLE 27 #define OPAL_PCI_SET_PHB_MEM_WINDOW 28 diff --git a/sys/powerpc/powernv/opal_console.c b/sys/powerpc/powernv/opal_console.c index 7b953d2679fb..8f6c88f81f7c 100644 --- a/sys/powerpc/powernv/opal_console.c +++ b/sys/powerpc/powernv/opal_console.c @@ -171,6 +171,24 @@ uart_opal_real_unmap_outbuffer(uint64_t *len) mtx_unlock_spin(&opalcons_buffer.mtx); } +static int64_t +uart_opal_console_write_buffer_space(int vtermid) +{ + int64_t buffer_space_val = 0; + vm_paddr_t buffer_space_ptr; + + if (pmap_bootstrapped) + buffer_space_ptr = vtophys(&buffer_space_val); + else + buffer_space_ptr = (vm_paddr_t)&buffer_space_val; + + if (opal_call(OPAL_CONSOLE_WRITE_BUFFER_SPACE, vtermid, + buffer_space_ptr) != OPAL_SUCCESS) + return (-1); + + return (be64toh(buffer_space_val)); +} + static int uart_opal_probe_node(struct uart_opal_softc *sc) { @@ -420,12 +438,12 @@ uart_opal_put(struct uart_opal_softc *sc, void *buffer, size_t bufsize) len -= 4; } -#if 0 - if (err != OPAL_SUCCESS) - len = 0; -#endif + if (err == OPAL_SUCCESS) + return (len); + else if (err == OPAL_BUSY_EVENT) + return(0); - return (len); + return (-1); } static int @@ -481,11 +499,28 @@ uart_opal_ttyoutwakeup(struct tty *tp) struct uart_opal_softc *sc; char buffer[8]; int len; + int64_t buffer_space; sc = tty_softc(tp); - while ((len = ttydisc_getc(tp, buffer, sizeof(buffer))) != 0) - uart_opal_put(sc, buffer, len); + while ((len = ttydisc_getc(tp, buffer, sizeof(buffer))) != 0) { + int bytes_written = 0; + while (bytes_written == 0) { + buffer_space = uart_opal_console_write_buffer_space(sc->vtermid); + if (buffer_space == -1) + /* OPAL failure or invalid terminal */ + break; + else if (buffer_space >= len) + bytes_written = uart_opal_put(sc, buffer, len); + + if (bytes_written == 0) + /* OPAL must be busy, poll and retry */ + opal_call(OPAL_POLL_EVENTS, NULL); + else if (bytes_written == -1) + /* OPAL failure or invalid terminal */ + break; + } + } } static void From owner-dev-commits-src-all@freebsd.org Fri May 7 02:38:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00DAA634E4E; Fri, 7 May 2021 02:38:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbvlB6LF2z3Kt1; Fri, 7 May 2021 02:38:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C59D5236BC; Fri, 7 May 2021 02:38:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1472cUCW098583; Fri, 7 May 2021 02:38:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1472cUQu098582; Fri, 7 May 2021 02:38:30 GMT (envelope-from git) Date: Fri, 7 May 2021 02:38:30 GMT Message-Id: <202105070238.1472cUQu098582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: 7d45bf699dc6 - stable/13 - mprutil: add big endian support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7d45bf699dc6417bdf13e1bd80b8e87ea8beca98 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 02:38:31 -0000 The branch stable/13 has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=7d45bf699dc6417bdf13e1bd80b8e87ea8beca98 commit 7d45bf699dc6417bdf13e1bd80b8e87ea8beca98 Author: Alfredo Dal'Ava Junior AuthorDate: 2021-04-17 01:01:38 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-05-07 05:34:19 +0000 mprutil: add big endian support This fix mprutil on big endian platforms, as follow up of D25785. Flash operations are still not working, such as MPI2_FUNCTION_FW_UPLOAD failing due to timeout. Firmware version used during tests: 16.00.01.00 Submitted by: Andre Fernando da Silva Reviewed by: luporl, Sreekanth Reddy (by e-mail) Sponsored by: Eldorado Research Institute (eldorado.org.br) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26040 (cherry picked from commit fc9780fd41e7b29db04e9cb843cb5034b88ae662) --- usr.sbin/mpsutil/mps_cmd.c | 61 +++++++++++++++++++++++++++++++++++--------- usr.sbin/mpsutil/mps_flash.c | 9 ++++--- usr.sbin/mpsutil/mps_show.c | 59 +++++++++++++++++++++--------------------- usr.sbin/mpsutil/mps_slot.c | 4 ++- usr.sbin/mpsutil/mpsutil.8 | 3 +++ 5 files changed, 90 insertions(+), 46 deletions(-) diff --git a/usr.sbin/mpsutil/mps_cmd.c b/usr.sbin/mpsutil/mps_cmd.c index f0ff98c2442b..a9cb269abc5f 100644 --- a/usr.sbin/mpsutil/mps_cmd.c +++ b/usr.sbin/mpsutil/mps_cmd.c @@ -41,6 +41,7 @@ __RCSID("$FreeBSD$"); #include #include #include +#include #include #include @@ -241,6 +242,8 @@ struct mprs_btdh_mapping { uint16_t Reserved; }; +static void adjust_iocfacts_endianness(MPI2_IOC_FACTS_REPLY *facts); + const char * mps_ioc_status(U16 IOCStatus) { @@ -296,7 +299,7 @@ mps_set_slot_status(int fd, U16 handle, U16 slot, U32 status) NULL, 0, NULL, 0, 30) != 0) return (errno); - if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) + if (!IOC_STATUS_SUCCESS(le16toh(reply.IOCStatus))) return (EIO); return (0); } @@ -319,7 +322,7 @@ mps_read_config_page_header(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, NULL, 0, NULL, 0, 30)) return (errno); - if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { + if (!IOC_STATUS_SUCCESS(le16toh(reply.IOCStatus))) { if (IOCStatus != NULL) *IOCStatus = reply.IOCStatus; return (EIO); @@ -342,15 +345,15 @@ mps_read_ext_config_page_header(int fd, U8 ExtPageType, U8 PageNumber, U32 PageA req.Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; req.ExtPageType = ExtPageType; req.Header.PageNumber = PageNumber; - req.PageAddress = PageAddress; + req.PageAddress = htole32(PageAddress); if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply), NULL, 0, NULL, 0, 30)) return (errno); - if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { + if (!IOC_STATUS_SUCCESS(le16toh(reply.IOCStatus))) { if (IOCStatus != NULL) - *IOCStatus = reply.IOCStatus; + *IOCStatus = le16toh(reply.IOCStatus); return (EIO); } if ((header == NULL) || (ExtPageLength == NULL)) @@ -381,7 +384,7 @@ mps_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, bzero(&req, sizeof(req)); req.Function = MPI2_FUNCTION_CONFIG; req.Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; - req.PageAddress = PageAddress; + req.PageAddress = htole32(PageAddress); req.Header = header; if (req.Header.PageLength == 0) req.Header.PageLength = 4; @@ -395,6 +398,7 @@ mps_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, errno = error; return (NULL); } + reply.IOCStatus = le16toh(reply.IOCStatus); if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { if (IOCStatus != NULL) *IOCStatus = reply.IOCStatus; @@ -432,14 +436,14 @@ mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion, bzero(&req, sizeof(req)); req.Function = MPI2_FUNCTION_CONFIG; req.Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; - req.PageAddress = PageAddress; + req.PageAddress = htole32(PageAddress); req.Header = header; if (pagelen == 0) - pagelen = 4; + pagelen = htole16(4); req.ExtPageLength = pagelen; req.ExtPageType = ExtPageType; - len = pagelen * 4; + len = le16toh(pagelen) * 4; buf = malloc(len); if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply), buf, len, NULL, 0, 30)) { @@ -448,6 +452,7 @@ mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion, errno = error; return (NULL); } + reply.IOCStatus = le16toh(reply.IOCStatus); if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { if (IOCStatus != NULL) *IOCStatus = reply.IOCStatus; @@ -471,7 +476,7 @@ mps_firmware_send(int fd, unsigned char *fw, uint32_t len, bool bios) bzero(&reply, sizeof(reply)); req.Function = MPI2_FUNCTION_FW_DOWNLOAD; req.ImageType = bios ? MPI2_FW_DOWNLOAD_ITYPE_BIOS : MPI2_FW_DOWNLOAD_ITYPE_FW; - req.TotalImageSize = len; + req.TotalImageSize = htole32(len); req.MsgFlags = MPI2_FW_DOWNLOAD_MSGFLGS_LAST_SEGMENT; if (mps_user_command(fd, &req, sizeof(req), &reply, sizeof(reply), @@ -502,7 +507,7 @@ mps_firmware_get(int fd, unsigned char **firmware, bool bios) return (-1); } - size = reply.ActualImageSize; + size = le32toh(reply.ActualImageSize); *firmware = calloc(size, sizeof(unsigned char)); if (*firmware == NULL) { warn("calloc"); @@ -571,6 +576,7 @@ mps_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, errno = error; return (NULL); } + req.ioc_status = le16toh(req.ioc_status); if (!IOC_STATUS_SUCCESS(req.ioc_status)) { if (IOCStatus != NULL) *IOCStatus = req.ioc_status; @@ -598,9 +604,10 @@ mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion, req.header.PageVersion = PageVersion; req.header.PageNumber = PageNumber; req.header.ExtPageType = ExtPageType; - req.page_address = PageAddress; + req.page_address = htole32(PageAddress); if (ioctl(fd, MPSIO_READ_EXT_CFG_HEADER, &req) < 0) return (NULL); + req.ioc_status = le16toh(req.ioc_status); if (!IOC_STATUS_SUCCESS(req.ioc_status)) { if (IOCStatus != NULL) *IOCStatus = req.ioc_status; @@ -620,6 +627,7 @@ mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion, errno = error; return (NULL); } + req.ioc_status = le16toh(req.ioc_status); if (!IOC_STATUS_SUCCESS(req.ioc_status)) { if (IOCStatus != NULL) *IOCStatus = req.ioc_status; @@ -761,6 +769,35 @@ mps_get_iocfacts(int fd) errno = EINVAL; return (NULL); } + adjust_iocfacts_endianness(facts); return (facts); } +static void +adjust_iocfacts_endianness(MPI2_IOC_FACTS_REPLY *facts) +{ + facts->MsgVersion = le16toh(facts->MsgVersion); + facts->HeaderVersion = le16toh(facts->HeaderVersion); + facts->Reserved1 = le16toh(facts->Reserved1); + facts->IOCExceptions = le16toh(facts->IOCExceptions); + facts->IOCStatus = le16toh(facts->IOCStatus); + facts->IOCLogInfo = le32toh(facts->IOCLogInfo); + facts->RequestCredit = le16toh(facts->RequestCredit); + facts->ProductID = le16toh(facts->ProductID); + facts->IOCCapabilities = le32toh(facts->IOCCapabilities); + facts->IOCRequestFrameSize = + le16toh(facts->IOCRequestFrameSize); + facts->FWVersion.Word = le32toh(facts->FWVersion.Word); + facts->MaxInitiators = le16toh(facts->MaxInitiators); + facts->MaxTargets = le16toh(facts->MaxTargets); + facts->MaxSasExpanders = le16toh(facts->MaxSasExpanders); + facts->MaxEnclosures = le16toh(facts->MaxEnclosures); + facts->ProtocolFlags = le16toh(facts->ProtocolFlags); + facts->HighPriorityCredit = le16toh(facts->HighPriorityCredit); + facts->MaxReplyDescriptorPostQueueDepth = + le16toh(facts->MaxReplyDescriptorPostQueueDepth); + facts->MaxDevHandle = le16toh(facts->MaxDevHandle); + facts->MaxPersistentEntries = + le16toh(facts->MaxPersistentEntries); + facts->MinDevHandle = le16toh(facts->MinDevHandle); +} diff --git a/usr.sbin/mpsutil/mps_flash.c b/usr.sbin/mpsutil/mps_flash.c index 22beaae79bb0..a0cc4a877b7d 100644 --- a/usr.sbin/mpsutil/mps_flash.c +++ b/usr.sbin/mpsutil/mps_flash.c @@ -29,6 +29,7 @@ __RCSID("$FreeBSD$"); #include #include #include +#include #include #include @@ -203,21 +204,21 @@ flash_update(int argc, char **argv) } } else { fwheader = (MPI2_FW_IMAGE_HEADER *)mem; - if (fwheader->VendorID != MPI2_MFGPAGE_VENDORID_LSI) { + if (le16toh(fwheader->VendorID) != MPI2_MFGPAGE_VENDORID_LSI) { warnx("Invalid firmware:"); warnx(" Expected Vendor ID: %04x", MPI2_MFGPAGE_VENDORID_LSI); - warnx(" Image Vendor ID: %04x", fwheader->VendorID); + warnx(" Image Vendor ID: %04x", le16toh(fwheader->VendorID)); munmap(mem, st.st_size); close(fd); free(facts); return (1); } - if (fwheader->ProductID != facts->ProductID) { + if (le16toh(fwheader->ProductID) != facts->ProductID) { warnx("Invalid image:"); warnx(" Expected Product ID: %04x", facts->ProductID); - warnx(" Image Product ID: %04x", fwheader->ProductID); + warnx(" Image Product ID: %04x", le16toh(fwheader->ProductID)); munmap(mem, st.st_size); close(fd); free(facts); diff --git a/usr.sbin/mpsutil/mps_show.c b/usr.sbin/mpsutil/mps_show.c index bb790fe21229..620bb5e27f89 100644 --- a/usr.sbin/mpsutil/mps_show.c +++ b/usr.sbin/mpsutil/mps_show.c @@ -36,6 +36,7 @@ __RCSID("$FreeBSD$"); #include #include +#include #include #include #include @@ -105,7 +106,7 @@ show_adapter(int ac, char **av) warn("Failed to get BIOS page 3 info"); return (error); } - v = bios3->BiosVersion; + v = le32toh(bios3->BiosVersion); printf(" BIOS Revision: %d.%02d.%02d.%02d\n", ((v & 0xff000000) >> 24), ((v &0xff0000) >> 16), ((v & 0xff00) >> 8), (v & 0xff)); @@ -172,12 +173,12 @@ show_adapter(int ac, char **av) minspeed = get_device_speed(phy1->MaxMinLinkRate); maxspeed = get_device_speed(phy1->MaxMinLinkRate >> 4); - type = get_device_type(phy0->ControllerPhyDeviceInfo); + type = get_device_type(le32toh(phy0->ControllerPhyDeviceInfo)); - if (phy0->AttachedDevHandle != 0) { - snprintf(devhandle, 5, "%04x", phy0->AttachedDevHandle); + if (le16toh(phy0->AttachedDevHandle) != 0) { + snprintf(devhandle, 5, "%04x", le16toh(phy0->AttachedDevHandle)); snprintf(ctrlhandle, 5, "%04x", - phy0->ControllerDevHandle); + le16toh(phy0->ControllerDevHandle)); speed = get_device_speed(phy0->NegotiatedLinkRate); } else { snprintf(devhandle, 5, " "); @@ -520,7 +521,7 @@ show_devices(int ac, char **av) close(fd); return (error); } - handle = device->DevHandle; + handle = le16toh(device->DevHandle); if (device->ParentDevHandle == 0x0) { free(device); @@ -539,7 +540,7 @@ show_devices(int ac, char **av) else snprintf(bt, sizeof(bt), "%02d %02d", bus, target); - type = get_device_type(device->DeviceInfo); + type = get_device_type(le32toh(device->DeviceInfo)); if (device->PhyNum < nphys) { phydata = &sas0->PhyData[device->PhyNum]; @@ -551,7 +552,7 @@ show_devices(int ac, char **av) MPI2_SAS_EXPAND_PGAD_FORM_HNDL_PHY_NUM | (device->PhyNum << MPI2_SAS_EXPAND_PGAD_PHYNUM_SHIFT) | - device->ParentDevHandle, &IOCStatus); + le16toh(device->ParentDevHandle), &IOCStatus); if (exp1 == NULL) { if (IOCStatus != MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) { error = errno; @@ -570,19 +571,19 @@ show_devices(int ac, char **av) speed = " "; if (device->EnclosureHandle != 0) { - snprintf(enchandle, 5, "%04x", device->EnclosureHandle); - snprintf(slot, 3, "%02d", device->Slot); + snprintf(enchandle, 5, "%04x", le16toh(device->EnclosureHandle)); + snprintf(slot, 3, "%02d", le16toh(device->Slot)); } else { snprintf(enchandle, 5, " "); snprintf(slot, 3, " "); } printf("%-10s", bt); - snprintf(buf, sizeof(buf), "%08x%08x", device->SASAddress.High, - device->SASAddress.Low); + snprintf(buf, sizeof(buf), "%08x%08x", le32toh(device->SASAddress.High), + le32toh(device->SASAddress.Low)); printf("%-17s", buf); - snprintf(buf, sizeof(buf), "%04x", device->DevHandle); + snprintf(buf, sizeof(buf), "%04x", le16toh(device->DevHandle)); printf("%-8s", buf); - snprintf(buf, sizeof(buf), "%04x", device->ParentDevHandle); + snprintf(buf, sizeof(buf), "%04x", le16toh(device->ParentDevHandle)); printf("%-10s", buf); printf("%-14s%-6s%-5s%-6s%d\n", type, speed, enchandle, slot, device->MaxPortConnections); @@ -626,16 +627,16 @@ show_enclosures(int ac, char **av) close(fd); return (error); } - type = get_enc_type(enc->Flags, &issep); + type = get_enc_type(le16toh(enc->Flags), &issep); if (issep == 0) snprintf(sepstr, 5, " "); else - snprintf(sepstr, 5, "%04x", enc->SEPDevHandle); + snprintf(sepstr, 5, "%04x", le16toh(enc->SEPDevHandle)); printf(" %.2d %08x%08x %s %04x %s\n", - enc->NumSlots, enc->EnclosureLogicalID.High, - enc->EnclosureLogicalID.Low, sepstr, enc->EnclosureHandle, + le16toh(enc->NumSlots), le32toh(enc->EnclosureLogicalID.High), + le32toh(enc->EnclosureLogicalID.Low), sepstr, le16toh(enc->EnclosureHandle), type); - handle = enc->EnclosureHandle; + handle = le16toh(enc->EnclosureHandle); free(enc); } printf("\n"); @@ -679,19 +680,19 @@ show_expanders(int ac, char **av) } nphys = exp0->NumPhys; - handle = exp0->DevHandle; + handle = le16toh(exp0->DevHandle); if (exp0->EnclosureHandle == 0x00) snprintf(enchandle, 5, " "); else - snprintf(enchandle, 5, "%04d", exp0->EnclosureHandle); + snprintf(enchandle, 5, "%04d", le16toh(exp0->EnclosureHandle)); if (exp0->ParentDevHandle == 0x0) snprintf(parent, 5, " "); else - snprintf(parent, 5, "%04x", exp0->ParentDevHandle); + snprintf(parent, 5, "%04x", le16toh(exp0->ParentDevHandle)); printf(" %02d %08x%08x %04x %s %s %d\n", - exp0->NumPhys, exp0->SASAddress.High, exp0->SASAddress.Low, - exp0->DevHandle, parent, enchandle, exp0->SASLevel); + exp0->NumPhys, le32toh(exp0->SASAddress.High), le32toh(exp0->SASAddress.Low), + le16toh(exp0->DevHandle), parent, enchandle, exp0->SASLevel); printf("\n"); printf(" Phy RemotePhy DevHandle Speed Min Max Device\n"); @@ -708,8 +709,8 @@ show_expanders(int ac, char **av) warn("Error retrieving expander pg 1"); continue; } - type = get_device_type(exp1->AttachedDeviceInfo); - if ((exp1->AttachedDeviceInfo &0x7) == 0) { + type = get_device_type(le32toh(exp1->AttachedDeviceInfo)); + if ((le32toh(exp1->AttachedDeviceInfo) &0x7) == 0) { speed = " "; snprintf(rphy, 3, " "); snprintf(rhandle, 5, " "); @@ -719,7 +720,7 @@ show_expanders(int ac, char **av) snprintf(rphy, 3, "%02d", exp1->AttachedPhyIdentifier); snprintf(rhandle, 5, "%04x", - exp1->AttachedDevHandle); + le16toh(exp1->AttachedDevHandle)); } min = get_device_speed(exp1->HwLinkRate); max = get_device_speed(exp1->HwLinkRate >> 4); @@ -762,7 +763,7 @@ show_cfgpage(int ac, char **av) switch (ac) { case 4: - addr = (uint32_t)strtoul(av[3], NULL, 0); + addr = htole32((uint32_t)strtoul(av[3], NULL, 0)); case 3: num = (uint8_t)strtoul(av[2], NULL, 0); case 2: @@ -789,7 +790,7 @@ show_cfgpage(int ac, char **av) if (page >= 0x10) { ehdr = data; - len = ehdr->ExtPageLength * 4; + len = le16toh(ehdr->ExtPageLength) * 4; page = ehdr->ExtPageType; attrs = ehdr->PageType >> 4; } else { diff --git a/usr.sbin/mpsutil/mps_slot.c b/usr.sbin/mpsutil/mps_slot.c index 1879d699067a..bb4a7324c461 100644 --- a/usr.sbin/mpsutil/mps_slot.c +++ b/usr.sbin/mpsutil/mps_slot.c @@ -31,6 +31,7 @@ __RCSID("$FreeBSD$"); #include #include #include +#include #include #include @@ -99,7 +100,8 @@ slot_set(int argc, char **argv) return (error); } - if (mps_set_slot_status(fd, handle, slot, status) != 0) { + if (mps_set_slot_status(fd, htole16(handle), htole16(slot), + htole32(status)) != 0) { warnx("Failed to set status"); close(fd); return (1); diff --git a/usr.sbin/mpsutil/mpsutil.8 b/usr.sbin/mpsutil/mpsutil.8 index 1dd4f0509174..1bb7c4d5eaec 100644 --- a/usr.sbin/mpsutil/mpsutil.8 +++ b/usr.sbin/mpsutil/mpsutil.8 @@ -163,3 +163,6 @@ The .Nm utility first appeared in .Fx 11.0 . +.Sh TODO +Flash operations (save/update) are not supported on big-endian architectures. +.Pp From owner-dev-commits-src-all@freebsd.org Fri May 7 02:54:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC38B6353DA; Fri, 7 May 2021 02:54:05 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fbw595xwpz3M2x; Fri, 7 May 2021 02:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B3C9C237F9; Fri, 7 May 2021 02:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1472s5Ek024764; Fri, 7 May 2021 02:54:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1472s5PU024763; Fri, 7 May 2021 02:54:05 GMT (envelope-from git) Date: Fri, 7 May 2021 02:54:05 GMT Message-Id: <202105070254.1472s5PU024763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: fb53b42e36a9 - main - virtio-modern: fix PCI common read/write functions on big endian targets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb53b42e36a9745d0a33821175a962c7a15eeeaa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 02:54:05 -0000 The branch main has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=fb53b42e36a9745d0a33821175a962c7a15eeeaa commit fb53b42e36a9745d0a33821175a962c7a15eeeaa Author: Alfredo Dal'Ava Junior AuthorDate: 2021-05-07 05:40:35 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-05-07 05:40:35 +0000 virtio-modern: fix PCI common read/write functions on big endian targets Virtio modern has the common data organized in little endian, but on powerpc64 BE it was reading and writing in the wrong endian. Submitted by: Leonardo Bianconi Reviewed by: bryanv, alfredo Sponsored by: Eldorado Research Institute (eldorado.org.br) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28947 --- sys/dev/virtio/pci/virtio_pci_modern.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci_modern.c b/sys/dev/virtio/pci/virtio_pci_modern.c index 7029d2ff76ce..33fdebf19402 100644 --- a/sys/dev/virtio/pci/virtio_pci_modern.c +++ b/sys/dev/virtio/pci/virtio_pci_modern.c @@ -1315,13 +1315,15 @@ vtpci_modern_read_common_1(struct vtpci_modern_softc *sc, bus_size_t off) static uint16_t vtpci_modern_read_common_2(struct vtpci_modern_softc *sc, bus_size_t off) { - return (bus_read_2(&sc->vtpci_common_res_map.vtrm_map, off)); + return virtio_htog16(true, + bus_read_2(&sc->vtpci_common_res_map.vtrm_map, off)); } static uint32_t vtpci_modern_read_common_4(struct vtpci_modern_softc *sc, bus_size_t off) { - return (bus_read_4(&sc->vtpci_common_res_map.vtrm_map, off)); + return virtio_htog32(true, + bus_read_4(&sc->vtpci_common_res_map.vtrm_map, off)); } static void @@ -1335,14 +1337,16 @@ static void vtpci_modern_write_common_2(struct vtpci_modern_softc *sc, bus_size_t off, uint16_t val) { - bus_write_2(&sc->vtpci_common_res_map.vtrm_map, off, val); + bus_write_2(&sc->vtpci_common_res_map.vtrm_map, + off, virtio_gtoh16(true, val)); } static void vtpci_modern_write_common_4(struct vtpci_modern_softc *sc, bus_size_t off, uint32_t val) { - bus_write_4(&sc->vtpci_common_res_map.vtrm_map, off, val); + bus_write_4(&sc->vtpci_common_res_map.vtrm_map, + off, virtio_gtoh32(true, val)); } static void From owner-dev-commits-src-all@freebsd.org Fri May 7 07:09:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07D805F9B90; Fri, 7 May 2021 07:09:47 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fc1mB6jlmz3m52; Fri, 7 May 2021 07:09:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D549D26966; Fri, 7 May 2021 07:09:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14779kLm058751; Fri, 7 May 2021 07:09:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14779koJ058750; Fri, 7 May 2021 07:09:46 GMT (envelope-from git) Date: Fri, 7 May 2021 07:09:46 GMT Message-Id: <202105070709.14779koJ058750@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fedor Uporov Subject: git: 1484574843a3 - main - Fix inode birthtime updating logic. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1484574843a3b49d5535ad1f7866295a0a5fb597 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 07:09:47 -0000 The branch main has been updated by fsu: URL: https://cgit.FreeBSD.org/src/commit/?id=1484574843a3b49d5535ad1f7866295a0a5fb597 commit 1484574843a3b49d5535ad1f7866295a0a5fb597 Author: Fedor Uporov AuthorDate: 2021-02-18 08:40:18 +0000 Commit: Fedor Uporov CommitDate: 2021-05-07 07:08:20 +0000 Fix inode birthtime updating logic. The birthtime field of struct vattr does not checked for VNOVAL in case of ext2_setattr() and produce incorrect inode birthtime values. Found using pjdfstest: pjdfstest/tests/utimensat/03.t Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29929 --- sys/fs/ext2fs/ext2_vnops.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c index e00dbc3e0adc..1ab360a7ad87 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -377,7 +377,7 @@ ext2_getattr(struct vop_getattr_args *ap) vap->va_mtime.tv_nsec = E2DI_HAS_XTIME(ip) ? ip->i_mtimensec : 0; vap->va_ctime.tv_sec = ip->i_ctime; vap->va_ctime.tv_nsec = E2DI_HAS_XTIME(ip) ? ip->i_ctimensec : 0; - if E2DI_HAS_XTIME(ip) { + if (E2DI_HAS_XTIME(ip)) { vap->va_birthtime.tv_sec = ip->i_birthtime; vap->va_birthtime.tv_nsec = ip->i_birthnsec; } @@ -506,8 +506,10 @@ ext2_setattr(struct vop_setattr_args *ap) ip->i_mtime = vap->va_mtime.tv_sec; ip->i_mtimensec = vap->va_mtime.tv_nsec; } - ip->i_birthtime = vap->va_birthtime.tv_sec; - ip->i_birthnsec = vap->va_birthtime.tv_nsec; + if (E2DI_HAS_XTIME(ip) && vap->va_birthtime.tv_sec != VNOVAL) { + ip->i_birthtime = vap->va_birthtime.tv_sec; + ip->i_birthnsec = vap->va_birthtime.tv_nsec; + } error = ext2_update(vp, 0); if (error) return (error); From owner-dev-commits-src-all@freebsd.org Fri May 7 07:09:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1292B5F9EF3; Fri, 7 May 2021 07:09:48 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fc1mD00gVz3mdJ; Fri, 7 May 2021 07:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E573026FB1; Fri, 7 May 2021 07:09:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14779lRv058772; Fri, 7 May 2021 07:09:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14779lLg058771; Fri, 7 May 2021 07:09:47 GMT (envelope-from git) Date: Fri, 7 May 2021 07:09:47 GMT Message-Id: <202105070709.14779lLg058771@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fedor Uporov Subject: git: 1ed5f62d61ac - main - Add chr/blk devices support. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ed5f62d61accf8c7a4d45e2e701a0179ff2fe1b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 07:09:48 -0000 The branch main has been updated by fsu: URL: https://cgit.FreeBSD.org/src/commit/?id=1ed5f62d61accf8c7a4d45e2e701a0179ff2fe1b commit 1ed5f62d61accf8c7a4d45e2e701a0179ff2fe1b Author: Fedor Uporov AuthorDate: 2021-02-18 08:26:50 +0000 Commit: Fedor Uporov CommitDate: 2021-05-07 07:08:31 +0000 Add chr/blk devices support. The dev field is placed into the inode structure. The major/minor numbers conversion to/from linux compatile format happen during on-disk inodes writing/reading. Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29930 --- sys/fs/ext2fs/ext2_inode.c | 3 +-- sys/fs/ext2fs/ext2_inode_cnv.c | 54 ++++++++++++++++++++++++++++++++++++++++-- sys/fs/ext2fs/ext2_vnops.c | 32 ++++++++++++++++--------- sys/fs/ext2fs/ext2fs.h | 7 ++++++ sys/fs/ext2fs/inode.h | 2 +- 5 files changed, 82 insertions(+), 16 deletions(-) diff --git a/sys/fs/ext2fs/ext2_inode.c b/sys/fs/ext2fs/ext2_inode.c index 34c32f2f113d..1412017b4b3c 100644 --- a/sys/fs/ext2fs/ext2_inode.c +++ b/sys/fs/ext2fs/ext2_inode.c @@ -605,8 +605,7 @@ ext2_inactive(struct vop_inactive_args *ap) if (ip->i_nlink <= 0) { ext2_extattr_free(ip); error = ext2_truncate(vp, (off_t)0, 0, NOCRED, td); - if (!(ip->i_flag & IN_E4EXTENTS)) - ip->i_rdev = 0; + ip->i_rdev = 0; mode = ip->i_mode; ip->i_mode = 0; ip->i_flag |= IN_CHANGE | IN_UPDATE; diff --git a/sys/fs/ext2fs/ext2_inode_cnv.c b/sys/fs/ext2fs/ext2_inode_cnv.c index bfa505896637..a71d5cef21aa 100644 --- a/sys/fs/ext2fs/ext2_inode_cnv.c +++ b/sys/fs/ext2fs/ext2_inode_cnv.c @@ -96,6 +96,42 @@ ext2_print_inode(struct inode *in) #define XTIME_TO_NSEC(x) ((le32toh(x) & EXT3_NSEC_MASK) >> 2) +static inline bool +ext2_old_valid_dev(dev_t dev) +{ + return (major(dev) < 256 && minor(dev) < 256); +} + +static inline uint16_t +ext2_old_encode_dev(dev_t dev) +{ + return ((major(dev) << 8) | minor(dev)); +} + +static inline dev_t +ext2_old_decode_dev(uint16_t val) +{ + return (makedev((val >> 8) & 255, val & 255)); +} + +static inline uint32_t +ext2_new_encode_dev(dev_t dev) +{ + unsigned maj = major(dev); + unsigned min = minor(dev); + + return ((min & 0xff) | (maj << 8) | ((min & ~0xff) << 12)); +} + +static inline dev_t +ext2_new_decode_dev(uint32_t dev) +{ + unsigned maj = (dev & 0xfff00) >> 8; + unsigned min = (dev & 0xff) | ((dev >> 12) & 0xfff00); + + return (makedev(maj, min)); +} + /* * raw ext2 inode LE to host inode conversion */ @@ -172,7 +208,12 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) ip->i_uid |= (uint32_t)le16toh(ei->e2di_uid_high) << 16; ip->i_gid |= (uint32_t)le16toh(ei->e2di_gid_high) << 16; - if ((ip->i_flag & IN_E4EXTENTS)) { + if (S_ISCHR(ip->i_mode) || S_ISBLK(ip->i_mode)) { + if (ei->e2di_blocks[0]) + ip->i_rdev = ext2_old_decode_dev(le32toh(ei->e2di_blocks[0])); + else + ip->i_rdev = ext2_new_decode_dev(le32toh(ei->e2di_blocks[1])); + } else if ((ip->i_flag & IN_E4EXTENTS)) { memcpy(ip->i_data, ei->e2di_blocks, sizeof(ei->e2di_blocks)); } else { for (i = 0; i < EXT2_NDADDR; i++) @@ -247,7 +288,16 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) ei->e2di_gid = htole16(ip->i_gid & 0xffff); ei->e2di_gid_high = htole16(ip->i_gid >> 16 & 0xffff); - if ((ip->i_flag & IN_E4EXTENTS)) { + if (S_ISCHR(ip->i_mode) || S_ISBLK(ip->i_mode)) { + if (ext2_old_valid_dev(ip->i_rdev)) { + ei->e2di_blocks[0] = htole32(ext2_old_encode_dev(ip->i_rdev)); + ei->e2di_blocks[1] = 0; + } else { + ei->e2di_blocks[0] = 0; + ei->e2di_blocks[1] = htole32(ext2_new_encode_dev(ip->i_rdev)); + ei->e2di_blocks[2] = 0; + } + } else if ((ip->i_flag & IN_E4EXTENTS)) { memcpy(ei->e2di_blocks, ip->i_data, sizeof(ei->e2di_blocks)); } else { for (i = 0; i < EXT2_NDADDR; i++) diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c index 1ab360a7ad87..2721aa535b40 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -322,9 +322,6 @@ ext2_access(struct vop_access_args *ap) accmode_t accmode = ap->a_accmode; int error; - if (vp->v_type == VBLK || vp->v_type == VCHR) - return (EOPNOTSUPP); - /* * Disallow write attempts on read-only file systems; * unless the file is a socket, fifo, or a block or @@ -622,6 +619,18 @@ ext2_fsync(struct vop_fsync_args *ap) return (ext2_update(ap->a_vp, ap->a_waitfor == MNT_WAIT)); } +static int +ext2_check_mknod_limits(dev_t dev) +{ + unsigned maj = major(dev); + unsigned min = minor(dev); + + if (maj > EXT2_MAJOR_MAX || min > EXT2_MINOR_MAX) + return (EINVAL); + + return (0); +} + /* * Mknod vnode call */ @@ -635,20 +644,21 @@ ext2_mknod(struct vop_mknod_args *ap) ino_t ino; int error; + if (vap->va_rdev != VNOVAL) { + error = ext2_check_mknod_limits(vap->va_rdev); + if (error) + return (error); + } + error = ext2_makeinode(MAKEIMODE(vap->va_type, vap->va_mode), ap->a_dvp, vpp, ap->a_cnp); if (error) return (error); ip = VTOI(*vpp); ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; - if (vap->va_rdev != VNOVAL) { - /* - * Want to be able to use this to make badblock - * inodes, so don't truncate the dev number. - */ - if (!(ip->i_flag & IN_E4EXTENTS)) - ip->i_rdev = vap->va_rdev; - } + if (vap->va_rdev != VNOVAL) + ip->i_rdev = vap->va_rdev; + /* * Remove inode, then reload it through VFS_VGET so it is * checked to see if it is an alias of an existing entry in diff --git a/sys/fs/ext2fs/ext2fs.h b/sys/fs/ext2fs/ext2fs.h index 81ff6838f16f..b11ccc0b5b5a 100644 --- a/sys/fs/ext2fs/ext2fs.h +++ b/sys/fs/ext2fs/ext2fs.h @@ -429,4 +429,11 @@ struct ext2_gd { #define EXT2_FIRST_INO(s) (le32toh((EXT2_SB(s)->e2fs->e2fs_rev) == \ E2FS_REV0) ? EXT2_FIRSTINO : le32toh(EXT2_SB(s)->e2fs->e2fs_first_ino)) +/* + * Linux major/minor values limits + */ +#define EXT2_MINORBITS (20) +#define EXT2_MAJOR_MAX (0xffffffff >> EXT2_MINORBITS) +#define EXT2_MINOR_MAX ((1 << EXT2_MINORBITS) - 1) + #endif /* !_FS_EXT2FS_EXT2FS_H_ */ diff --git a/sys/fs/ext2fs/inode.h b/sys/fs/ext2fs/inode.h index 2b9ec687a75c..e6af6ef8d5b6 100644 --- a/sys/fs/ext2fs/inode.h +++ b/sys/fs/ext2fs/inode.h @@ -110,6 +110,7 @@ struct inode { uint32_t i_gen; /* Generation number. */ uint64_t i_facl; /* EA block number. */ uint32_t i_flags; /* Status flags (chflags). */ + dev_t i_rdev; /* Major/minor inode values. */ union { struct { uint32_t i_db[EXT2_NDADDR]; /* Direct disk blocks. */ @@ -131,7 +132,6 @@ struct inode { * di_db area. */ #define i_shortlink i_db -#define i_rdev i_db[0] /* File permissions. */ #define IEXEC 0000100 /* Executable. */ From owner-dev-commits-src-all@freebsd.org Fri May 7 07:19:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 428415FA24A; Fri, 7 May 2021 07:19:39 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fc1zb0PrMz3mvf; Fri, 7 May 2021 07:19:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F09DC27144; Fri, 7 May 2021 07:19:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1477JcCC071905; Fri, 7 May 2021 07:19:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1477JcGo071904; Fri, 7 May 2021 07:19:38 GMT (envelope-from git) Date: Fri, 7 May 2021 07:19:38 GMT Message-Id: <202105070719.1477JcGo071904@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 8afecefd57c5 - main - storvsc: fix auto-sense reporting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8afecefd57c5ac95200f43227cd00f265154acee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 07:19:39 -0000 The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=8afecefd57c5ac95200f43227cd00f265154acee commit 8afecefd57c5ac95200f43227cd00f265154acee Author: Andriy Gapon AuthorDate: 2021-05-07 07:17:57 +0000 Commit: Andriy Gapon CommitDate: 2021-05-07 07:17:57 +0000 storvsc: fix auto-sense reporting I saw a situation where the driver set CAM_AUTOSNS_VALID on a failed ccb even though SRB_STATUS_AUTOSENSE_VALID was not set in the status. The actual sense data remained all zeros. The problem seems to be that create_storvsc_request() always sets hv_storvsc_request::sense_info_len, so checking for sense_info_len != 0 is not enough to determine if any auto-sense data is actually available. Reviewed by: whu, imp MFC after: 2 weeks Sponsored by: CyberSecure Differential Revision: https://reviews.freebsd.org/D30124 --- sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c index 968de9d14e7b..702308e26a1d 100644 --- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c +++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c @@ -2406,7 +2406,8 @@ storvsc_io_done(struct hv_storvsc_request *reqp) else ccb->csio.resid = ccb->csio.dxfer_len; - if (reqp->sense_info_len != 0) { + if ((vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID) != 0 && + reqp->sense_info_len != 0) { csio->sense_resid = csio->sense_len - reqp->sense_info_len; ccb->ccb_h.status |= CAM_AUTOSNS_VALID; } From owner-dev-commits-src-all@freebsd.org Fri May 7 07:28:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC9515FA9A6; Fri, 7 May 2021 07:28:30 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fc29p4zT6z3nG8; Fri, 7 May 2021 07:28:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 995BB273B6; Fri, 7 May 2021 07:28:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1477SURp085482; Fri, 7 May 2021 07:28:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1477SUBo085481; Fri, 7 May 2021 07:28:30 GMT (envelope-from git) Date: Fri, 7 May 2021 07:28:30 GMT Message-Id: <202105070728.1477SUBo085481@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fedor Uporov Subject: git: 5679656e09fb - main - Improve extents verification logic. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5679656e09fb58254da1613ebda75e368074c507 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 07:28:30 -0000 The branch main has been updated by fsu: URL: https://cgit.FreeBSD.org/src/commit/?id=5679656e09fb58254da1613ebda75e368074c507 commit 5679656e09fb58254da1613ebda75e368074c507 Author: Fedor Uporov AuthorDate: 2021-02-18 07:48:10 +0000 Commit: Fedor Uporov CommitDate: 2021-05-07 07:27:28 +0000 Improve extents verification logic. It is possible to walk thru inode extents if EXT2FS_PRINT_EXTENTS macro is defined. The extents headers magics and physical blocks ranges are checked during extents walk. Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29932 --- sys/fs/ext2fs/ext2_extents.c | 130 ++++++++++++++++++++++++++++------------- sys/fs/ext2fs/ext2_extents.h | 10 ++-- sys/fs/ext2fs/ext2_inode_cnv.c | 2 +- sys/fs/ext2fs/ext2_vfsops.c | 11 +++- sys/fs/ext2fs/fs.h | 2 +- 5 files changed, 104 insertions(+), 51 deletions(-) diff --git a/sys/fs/ext2fs/ext2_extents.c b/sys/fs/ext2fs/ext2_extents.c index 1a5dca66dd76..cc77107785a5 100644 --- a/sys/fs/ext2fs/ext2_extents.c +++ b/sys/fs/ext2fs/ext2_extents.c @@ -59,94 +59,140 @@ SDT_PROBE_DEFINE2(ext2fs, , trace, extents, "int", "char*"); static MALLOC_DEFINE(M_EXT2EXTENTS, "ext2_extents", "EXT2 extents"); #ifdef EXT2FS_PRINT_EXTENTS -static void -ext4_ext_print_extent(struct ext4_extent *ep) +static const bool print_extents_walk = true; + +static int ext4_ext_check_header(struct inode *, struct ext4_extent_header *); +static int ext4_ext_walk_header(struct inode *, struct ext4_extent_header *); +static inline e4fs_daddr_t ext4_ext_index_pblock(struct ext4_extent_index *); +static inline e4fs_daddr_t ext4_ext_extent_pblock(struct ext4_extent *); + +static int +ext4_ext_blk_check(struct inode *ip, e4fs_daddr_t blk) { + struct m_ext2fs *fs; - printf(" ext %p => (blk %u len %u start %ju)\n", - ep, le32toh(ep->e_blk), le16toh(ep->e_len), - (uint64_t)le16toh(ep->e_start_hi) << 32 | le32toh(ep->e_start_lo)); -} + fs = ip->i_e2fs; -static void ext4_ext_print_header(struct inode *ip, struct ext4_extent_header *ehp); + if (blk < fs->e2fs->e2fs_first_dblock || blk >= fs->e2fs_bcount) + return (EIO); -static void -ext4_ext_print_index(struct inode *ip, struct ext4_extent_index *ex, int do_walk) + return (0); +} + +static int +ext4_ext_walk_index(struct inode *ip, struct ext4_extent_index *ex, bool do_walk) { struct m_ext2fs *fs; struct buf *bp; + e4fs_daddr_t blk; int error; fs = ip->i_e2fs; - printf(" index %p => (blk %u pblk %ju)\n", - ex, le32toh(ex->ei_blk), (uint64_t)le16toh(ex->ei_leaf_hi) << 32 | - le32toh(ex->ei_leaf_lo)); + if (print_extents_walk) + printf(" index %p => (blk %u pblk %ju)\n", ex, + le32toh(ex->ei_blk), (uint64_t)le16toh(ex->ei_leaf_hi) << 32 | + le32toh(ex->ei_leaf_lo)); if(!do_walk) - return; + return (0); + + blk = ext4_ext_index_pblock(ex); + error = ext4_ext_blk_check(ip, blk); + if (error) + return (error); if ((error = bread(ip->i_devvp, - fsbtodb(fs, ((uint64_t)le16toh(ex->ei_leaf_hi) << 32 | - le32toh(ex->ei_leaf_lo))), (int)fs->e2fs_bsize, NOCRED, &bp)) != 0) { + fsbtodb(fs, blk), (int)fs->e2fs_bsize, NOCRED, &bp)) != 0) { brelse(bp); - return; + return (error); } - ext4_ext_print_header(ip, (struct ext4_extent_header *)bp->b_data); + error = ext4_ext_walk_header(ip, (struct ext4_extent_header *)bp->b_data); brelse(bp); + return (error); } -static void -ext4_ext_print_header(struct inode *ip, struct ext4_extent_header *ehp) +static int +ext4_ext_walk_extent(struct inode *ip, struct ext4_extent *ep) +{ + e4fs_daddr_t blk; + int error; + + blk = ext4_ext_extent_pblock(ep); + error = ext4_ext_blk_check(ip, blk); + if (error) + return (error); + + if (print_extents_walk) + printf(" ext %p => (blk %u len %u start %ju)\n", + ep, le32toh(ep->e_blk), le16toh(ep->e_len), + (uint64_t)blk); + + return (0); +} + +static int +ext4_ext_walk_header(struct inode *ip, struct ext4_extent_header *eh) { - int i; + int i, error = 0; - printf("header %p => (magic 0x%x entries %d max %d depth %d gen %d)\n", - ehp, le16toh(ehp->eh_magic), le16toh(ehp->eh_ecount), - le16toh(ehp->eh_max), le16toh(ehp->eh_depth), le32toh(ehp->eh_gen)); + error = ext4_ext_check_header(ip, eh); + if (error) + return (error); + + if (print_extents_walk) + printf("header %p => (entries %d max %d depth %d gen %d)\n", + eh, le16toh(eh->eh_ecount), + le16toh(eh->eh_max), le16toh(eh->eh_depth), le32toh(eh->eh_gen)); - for (i = 0; i < le16toh(ehp->eh_ecount); i++) - if (ehp->eh_depth != 0) - ext4_ext_print_index(ip, - (struct ext4_extent_index *)(ehp + 1 + i), 1); + for (i = 0; i < le16toh(eh->eh_ecount) && error == 0; i++) + if (eh->eh_depth != 0) + error = ext4_ext_walk_index(ip, + (struct ext4_extent_index *)(eh + 1 + i), true); else - ext4_ext_print_extent((struct ext4_extent *)(ehp + 1 + i)); + error = ext4_ext_walk_extent(ip, (struct ext4_extent *)(eh + 1 + i)); + + return (error); } -static void +static int ext4_ext_print_path(struct inode *ip, struct ext4_extent_path *path) { - int k, l; + int k, l, error = 0; l = path->ep_depth; - printf("ip=%ju, Path:\n", ip->i_number); - for (k = 0; k <= l; k++, path++) { + if (print_extents_walk) + printf("ip=%ju, Path:\n", ip->i_number); + + for (k = 0; k <= l && error == 0; k++, path++) { if (path->ep_index) { - ext4_ext_print_index(ip, path->ep_index, 0); + error = ext4_ext_walk_index(ip, path->ep_index, false); } else if (path->ep_ext) { - ext4_ext_print_extent(path->ep_ext); + error = ext4_ext_walk_extent(ip, path->ep_ext); } } + + return (error); } -void -ext4_ext_print_extent_tree_status(struct inode *ip) +int +ext4_ext_walk(struct inode *ip) { struct ext4_extent_header *ehp; - ehp = (struct ext4_extent_header *)(char *)ip->i_db; + ehp = (struct ext4_extent_header *)ip->i_db; - printf("Extent status:ip=%ju\n", ip->i_number); - if (!(ip->i_flag & IN_E4EXTENTS)) - return; + if (print_extents_walk) + printf("Extent status:ip=%ju\n", ip->i_number); - ext4_ext_print_header(ip, ehp); + if (!(ip->i_flag & IN_E4EXTENTS)) + return (0); - return; + return (ext4_ext_walk_header(ip, ehp)); } #endif diff --git a/sys/fs/ext2fs/ext2_extents.h b/sys/fs/ext2fs/ext2_extents.h index 52a96297b606..f662cc9b5cd3 100644 --- a/sys/fs/ext2fs/ext2_extents.h +++ b/sys/fs/ext2fs/ext2_extents.h @@ -122,15 +122,15 @@ struct m_ext2fs; void ext4_ext_tree_init(struct inode *ip); int ext4_ext_in_cache(struct inode *, daddr_t, struct ext4_extent *); void ext4_ext_put_cache(struct inode *, struct ext4_extent *, int); -int ext4_ext_find_extent(struct inode *, daddr_t, struct ext4_extent_path **); -void ext4_ext_path_free(struct ext4_extent_path *path); -int ext4_ext_remove_space(struct inode *ip, off_t length, int flags, +int ext4_ext_find_extent(struct inode *, daddr_t, struct ext4_extent_path **); +void ext4_ext_path_free(struct ext4_extent_path *path); +int ext4_ext_remove_space(struct inode *ip, off_t length, int flags, struct ucred *cred, struct thread *td); -int ext4_ext_get_blocks(struct inode *ip, int64_t iblock, +int ext4_ext_get_blocks(struct inode *ip, int64_t iblock, unsigned long max_blocks, struct ucred *cred, struct buf **bpp, int *allocate, daddr_t *); #ifdef EXT2FS_PRINT_EXTENTS -void ext4_ext_print_extent_tree_status(struct inode *ip); +int ext4_ext_walk(struct inode *ip); #endif #endif /* !_FS_EXT2FS_EXT2_EXTENTS_H_ */ diff --git a/sys/fs/ext2fs/ext2_inode_cnv.c b/sys/fs/ext2fs/ext2_inode_cnv.c index a71d5cef21aa..3c79e1162896 100644 --- a/sys/fs/ext2fs/ext2_inode_cnv.c +++ b/sys/fs/ext2fs/ext2_inode_cnv.c @@ -86,7 +86,7 @@ ext2_print_inode(struct inode *in) le16toh(ep->e_start_hi)); printf("\n"); } else { - printf("BLOCKS:"); + printf("Blocks:"); for (i = 0; i < (in->i_blocks <= 24 ? (in->i_blocks + 1) / 2 : 12); i++) printf(" %d", in->i_db[i]); printf("\n"); diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c index 099d6bfec981..43cfdf3a1a0b 100644 --- a/sys/fs/ext2fs/ext2_vfsops.c +++ b/sys/fs/ext2fs/ext2_vfsops.c @@ -1283,11 +1283,18 @@ ext2_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) for (i = used_blocks; i < EXT2_NDIR_BLOCKS; i++) ip->i_db[i] = 0; } + + bqrelse(bp); + #ifdef EXT2FS_PRINT_EXTENTS ext2_print_inode(ip); - ext4_ext_print_extent_tree_status(ip); + error = ext4_ext_walk(ip); + if (error) { + vput(vp); + *vpp = NULL; + return (error); + } #endif - bqrelse(bp); /* * Initialize the vnode from the inode, check for aliases. diff --git a/sys/fs/ext2fs/fs.h b/sys/fs/ext2fs/fs.h index e07b69b91bce..c09200af3935 100644 --- a/sys/fs/ext2fs/fs.h +++ b/sys/fs/ext2fs/fs.h @@ -164,6 +164,6 @@ /* * Use if additional debug logging is required. */ -/* #define EXT2FS_PRINT_EXTENTS */ +/* #define EXT2FS_PRINT_EXTENTS */ #endif /* !_FS_EXT2FS_FS_H_ */ From owner-dev-commits-src-all@freebsd.org Fri May 7 07:28:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE5B35FA307; Fri, 7 May 2021 07:28:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fc29q4vqDz3n73; Fri, 7 May 2021 07:28:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 99ECB2749D; Fri, 7 May 2021 07:28:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1477SVYV085509; Fri, 7 May 2021 07:28:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1477SVpF085508; Fri, 7 May 2021 07:28:31 GMT (envelope-from git) Date: Fri, 7 May 2021 07:28:31 GMT Message-Id: <202105070728.1477SVpF085508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fedor Uporov Subject: git: b3f46656393f - main - Invalidate inode extents cache on truncation. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b3f46656393f5c8a6e8305afeb5e8c3638025c26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 07:28:31 -0000 The branch main has been updated by fsu: URL: https://cgit.FreeBSD.org/src/commit/?id=b3f46656393f5c8a6e8305afeb5e8c3638025c26 commit b3f46656393f5c8a6e8305afeb5e8c3638025c26 Author: Fedor Uporov AuthorDate: 2021-02-18 08:00:07 +0000 Commit: Fedor Uporov CommitDate: 2021-05-07 07:27:37 +0000 Invalidate inode extents cache on truncation. It is needed to invalidate cache in case of inode space removal to avoid situation, when extents cache returns not exist extent. Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29931 --- sys/fs/ext2fs/ext2_extents.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/fs/ext2fs/ext2_extents.c b/sys/fs/ext2fs/ext2_extents.c index cc77107785a5..2a3ffbd0e860 100644 --- a/sys/fs/ext2fs/ext2_extents.c +++ b/sys/fs/ext2fs/ext2_extents.c @@ -1623,5 +1623,6 @@ ext4_ext_remove_space(struct inode *ip, off_t length, int flags, ext4_ext_drop_refs(path); free(path, M_EXT2EXTENTS); + ip->i_ext_cache.ec_type = EXT4_EXT_CACHE_NO; return (error); } From owner-dev-commits-src-all@freebsd.org Fri May 7 07:49:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 997C55FB028; Fri, 7 May 2021 07:49:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fc2dq3x8tz3pJR; Fri, 7 May 2021 07:49:19 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 75A312772A; Fri, 7 May 2021 07:49:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1477nJvg011723; Fri, 7 May 2021 07:49:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1477nJaH011722; Fri, 7 May 2021 07:49:19 GMT (envelope-from git) Date: Fri, 7 May 2021 07:49:19 GMT Message-Id: <202105070749.1477nJaH011722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fedor Uporov Subject: git: c40a160fd0aa - main - Make inode extra time fields updating logic more closer to linux. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c40a160fd0aa48ceb6e243c72cb8b9b59dc4e13d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 07:49:19 -0000 The branch main has been updated by fsu: URL: https://cgit.FreeBSD.org/src/commit/?id=c40a160fd0aa48ceb6e243c72cb8b9b59dc4e13d commit c40a160fd0aa48ceb6e243c72cb8b9b59dc4e13d Author: Fedor Uporov AuthorDate: 2021-05-07 07:46:55 +0000 Commit: Fedor Uporov CommitDate: 2021-05-07 07:46:55 +0000 Make inode extra time fields updating logic more closer to linux. Found using pjdfstest: pjdfstest/tests/utimensat/09.t Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29933 --- sys/fs/ext2fs/ext2_inode_cnv.c | 53 ++++++++++++++++++++++++++++++------------ sys/fs/ext2fs/inode.h | 9 +++---- 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/sys/fs/ext2fs/ext2_inode_cnv.c b/sys/fs/ext2fs/ext2_inode_cnv.c index 3c79e1162896..5ca00f3be050 100644 --- a/sys/fs/ext2fs/ext2_inode_cnv.c +++ b/sys/fs/ext2fs/ext2_inode_cnv.c @@ -94,8 +94,6 @@ ext2_print_inode(struct inode *in) } #endif /* EXT2FS_PRINT_EXTENTS */ -#define XTIME_TO_NSEC(x) ((le32toh(x) & EXT3_NSEC_MASK) >> 2) - static inline bool ext2_old_valid_dev(dev_t dev) { @@ -132,6 +130,15 @@ ext2_new_decode_dev(uint32_t dev) return (makedev(maj, min)); } +static void +ext2_decode_extra_time(ext_time_t *sec, int32_t *nsec, uint32_t extra) +{ + if (extra & htole32(EXT3_EPOCH_MASK)) + *sec += (uint64_t)(le32toh(extra) & EXT3_EPOCH_MASK) << 32; + + *nsec = (le32toh(extra) & EXT3_NSEC_MASK) >> EXT3_EPOCH_BITS; +} + /* * raw ext2 inode LE to host inode conversion */ @@ -177,15 +184,19 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) ip->i_size = le32toh(ei->e2di_size); if (S_ISREG(ip->i_mode)) ip->i_size |= (uint64_t)le32toh(ei->e2di_size_high) << 32; - ip->i_atime = le32toh(ei->e2di_atime); - ip->i_mtime = le32toh(ei->e2di_mtime); - ip->i_ctime = le32toh(ei->e2di_ctime); + ip->i_atime = (signed)le32toh(ei->e2di_atime); + ip->i_mtime = (signed)le32toh(ei->e2di_mtime); + ip->i_ctime = (signed)le32toh(ei->e2di_ctime); if (E2DI_HAS_XTIME(ip)) { - ip->i_atimensec = XTIME_TO_NSEC(ei->e2di_atime_extra); - ip->i_mtimensec = XTIME_TO_NSEC(ei->e2di_mtime_extra); - ip->i_ctimensec = XTIME_TO_NSEC(ei->e2di_ctime_extra); - ip->i_birthtime = le32toh(ei->e2di_crtime); - ip->i_birthnsec = XTIME_TO_NSEC(ei->e2di_crtime_extra); + ext2_decode_extra_time(&ip->i_atime, &ip->i_atimensec, + ei->e2di_atime_extra); + ext2_decode_extra_time(&ip->i_mtime, &ip->i_mtimensec, + ei->e2di_mtime_extra); + ext2_decode_extra_time(&ip->i_ctime, &ip->i_ctimensec, + ei->e2di_ctime_extra); + ip->i_birthtime = (signed)le32toh(ei->e2di_crtime); + ext2_decode_extra_time(&ip->i_birthtime, &ip->i_birthnsec, + ei->e2di_crtime_extra); } ip->i_flags = 0; ei_flags_host = le32toh(ei->e2di_flags); @@ -226,7 +237,15 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) return (ext2_ei_csum_verify(ip, ei)); } -#define NSEC_TO_XTIME(t) (htole32((t << 2) & EXT3_NSEC_MASK)) +static uint32_t +ext2_encode_extra_time(int64_t sec, int32_t nsec) +{ + uint32_t extra; + + extra = ((sec - (int32_t)sec) >> 32) & EXT3_EPOCH_MASK; + + return (htole32(extra | (nsec << EXT3_EPOCH_BITS))); +} /* * inode to raw ext2 LE inode conversion @@ -253,11 +272,15 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) ei->e2di_dtime = htole32(le16toh(ei->e2di_nlink) ? 0 : le32toh(ei->e2di_mtime)); if (E2DI_HAS_XTIME(ip)) { - ei->e2di_ctime_extra = NSEC_TO_XTIME(ip->i_ctimensec); - ei->e2di_mtime_extra = NSEC_TO_XTIME(ip->i_mtimensec); - ei->e2di_atime_extra = NSEC_TO_XTIME(ip->i_atimensec); + ei->e2di_ctime_extra = ext2_encode_extra_time(ip->i_ctime, + ip->i_ctimensec); + ei->e2di_mtime_extra = ext2_encode_extra_time(ip->i_mtime, + ip->i_mtimensec); + ei->e2di_atime_extra = ext2_encode_extra_time(ip->i_atime, + ip->i_atimensec); ei->e2di_crtime = htole32(ip->i_birthtime); - ei->e2di_crtime_extra = NSEC_TO_XTIME(ip->i_birthnsec); + ei->e2di_crtime_extra = ext2_encode_extra_time(ip->i_birthtime, + ip->i_birthnsec); } /* Keep these in host endian for a while since they change a lot */ ei->e2di_flags = 0; diff --git a/sys/fs/ext2fs/inode.h b/sys/fs/ext2fs/inode.h index e6af6ef8d5b6..25e77acc3a9d 100644 --- a/sys/fs/ext2fs/inode.h +++ b/sys/fs/ext2fs/inode.h @@ -62,6 +62,7 @@ typedef uint32_t e2fs_daddr_t; typedef int64_t e2fs_lbn_t; typedef int64_t e4fs_daddr_t; +typedef int64_t ext_time_t; /* * The inode is used to describe each active (or recently active) file in the @@ -99,10 +100,10 @@ struct inode { uint32_t i_gid; /* File group. */ uint64_t i_size; /* File byte count. */ uint64_t i_blocks; /* Blocks actually held. */ - int32_t i_atime; /* Last access time. */ - int32_t i_mtime; /* Last modified time. */ - int32_t i_ctime; /* Last inode change time. */ - int32_t i_birthtime; /* Inode creation time. */ + ext_time_t i_atime; /* Last access time. */ + ext_time_t i_mtime; /* Last modified time. */ + ext_time_t i_ctime; /* Last inode change time. */ + ext_time_t i_birthtime; /* Inode creation time. */ int32_t i_mtimensec; /* Last modified time. */ int32_t i_atimensec; /* Last access time. */ int32_t i_ctimensec; /* Last inode change time. */ From owner-dev-commits-src-all@freebsd.org Fri May 7 09:39:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E41905FDA1D; Fri, 7 May 2021 09:39:48 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fc55J62qyz3t7K; Fri, 7 May 2021 09:39:48 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: lwhsu/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id BDA673C73; Fri, 7 May 2021 09:39:48 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: by mail-yb1-f174.google.com with SMTP id l7so11136596ybf.8; Fri, 07 May 2021 02:39:48 -0700 (PDT) X-Gm-Message-State: AOAM530Y22eAT5+ZyNuhFXHH6JVSzNkvy/xMIQPpyt2Ry2ocFaE+hXvw GIMaiuwwlH4c51cA5NW7Pkvkeram9Oxj9u0OrzQ= X-Google-Smtp-Source: ABdhPJwqeefnpjQKQPe90a/teYt1uwesW1RO8wAOr+3V9cAySI15BV364dRyEJ+RZtbGT9hWgX/IlLWKRiXLGk8Q3Lw= X-Received: by 2002:a25:7a42:: with SMTP id v63mr11843533ybc.497.1620380388241; Fri, 07 May 2021 02:39:48 -0700 (PDT) MIME-Version: 1.0 References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> In-Reply-To: <202105061526.146FQS0E008755@gitrepo.freebsd.org> From: Li-Wen Hsu Date: Fri, 7 May 2021 17:39:37 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. To: Randall Stewart Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 09:39:49 -0000 On Thu, May 6, 2021 at 11:26 PM Randall Stewart wrote: > > The branch main has been updated by rrs: > > URL: https://cgit.FreeBSD.org/src/commit/?id=5d8fd932e418f03e98b3469c4088a36f0ef34ffe > > commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe > Author: Randall Stewart > AuthorDate: 2021-05-06 15:22:26 +0000 > Commit: Randall Stewart > CommitDate: 2021-05-06 15:22:26 +0000 > > This brings into sync FreeBSD with the netflix versions of rack and bbr. > This fixes several breakages (panics) since the tcp_lro code was > committed that have been reported. Quite a few new features are > now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the > largest). There is also support for ack-war prevention. Documents > comming soon on rack.. > > Sponsored by: Netflix > Reviewed by: rscheff, mtuexen > Differential Revision: https://reviews.freebsd.org/D30036 This seems braking LINT kernel build of powerpc: https://ci.freebsd.org/job/FreeBSD-main-powerpc-LINT/6082/console Searching "error:" leads to: 00:08:15.153 /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2143:16: error: implicit declaration of function 'tcp_hw_highest_rate' is invalid in C99 [-Werror,-Wimplicit-function-declaration] 00:08:15.153 high_rate = tcp_hw_highest_rate(rack->r_ctl.crte); 00:08:15.153 ^ and 00:08:15.163 /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2165:16: error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is invalid in C99 [-Werror,-Wimplicit-function-declaration] 00:08:15.163 high_rate = tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, rack->rc_inp); 00:08:15.163 ^ I suspect this is because RATELIMIT is not defined in default powerpc build? Is it safe to enable it? Best, Li-Wen From owner-dev-commits-src-all@freebsd.org Fri May 7 11:10:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C1C6628C2B; Fri, 7 May 2021 11:10:30 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from drew.franken.de (mail-n.franken.de [193.175.24.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fc75y31TCz4Sxb; Fri, 7 May 2021 11:10:30 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from smtpclient.apple (unknown [IPv6:2a02:8109:1140:c3d:7c86:1978:3046:7dff]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 8AA4F71C74AE3; Fri, 7 May 2021 13:10:25 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. From: Michael Tuexen In-Reply-To: Date: Fri, 7 May 2021 13:10:24 +0200 Cc: Randall Stewart , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> To: Li-Wen Hsu X-Mailer: Apple Mail (2.3654.80.0.2.43) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4Fc75y31TCz4Sxb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 11:10:30 -0000 > On 7. May 2021, at 11:39, Li-Wen Hsu wrote: >=20 > On Thu, May 6, 2021 at 11:26 PM Randall Stewart = wrote: >>=20 >> The branch main has been updated by rrs: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D5d8fd932e418f03e98b3469c4088a36f= 0ef34ffe >>=20 >> commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe >> Author: Randall Stewart >> AuthorDate: 2021-05-06 15:22:26 +0000 >> Commit: Randall Stewart >> CommitDate: 2021-05-06 15:22:26 +0000 >>=20 >> This brings into sync FreeBSD with the netflix versions of rack = and bbr. >> This fixes several breakages (panics) since the tcp_lro code was >> committed that have been reported. Quite a few new features are >> now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the >> largest). There is also support for ack-war prevention. Documents >> comming soon on rack.. >>=20 >> Sponsored by: Netflix >> Reviewed by: rscheff, mtuexen >> Differential Revision: https://reviews.freebsd.org/D30036 >=20 > This seems braking LINT kernel build of powerpc: >=20 > https://ci.freebsd.org/job/FreeBSD-main-powerpc-LINT/6082/console >=20 > Searching "error:" leads to: >=20 > 00:08:15.153 = /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:214= 3:16: > error: implicit declaration of function 'tcp_hw_highest_rate' is > invalid in C99 [-Werror,-Wimplicit-function-declaration] > 00:08:15.153 high_rate =3D > tcp_hw_highest_rate(rack->r_ctl.crte); > 00:08:15.153 ^ >=20 > and >=20 > 00:08:15.163 = /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:216= 5:16: > error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is > invalid in C99 [-Werror,-Wimplicit-function-declaration] > 00:08:15.163 high_rate =3D > tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > rack->rc_inp); > 00:08:15.163 ^ >=20 > I suspect this is because RATELIMIT is not defined in default powerpc > build? Is it safe to enable it? If you are building TCP stacks, you need RATELIMIT. You can enable it. = It is enabled on other platforms, too. Best regards Michael >=20 > Best, > Li-Wen From owner-dev-commits-src-all@freebsd.org Fri May 7 12:13:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E12D62B7B1; Fri, 7 May 2021 12:13:08 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fc8VD3jdBz4Xch; Fri, 7 May 2021 12:13:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 72761310F; Fri, 7 May 2021 12:13:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147CD8AE073017; Fri, 7 May 2021 12:13:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147CD8Wl073014; Fri, 7 May 2021 12:13:08 GMT (envelope-from git) Date: Fri, 7 May 2021 12:13:08 GMT Message-Id: <202105071213.147CD8Wl073014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 95a74ab4fb08 - main - nvmecontrol: fix typo (s/Managment/Management/) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95a74ab4fb0879da270342bc98719b0e735694f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 12:13:08 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=95a74ab4fb0879da270342bc98719b0e735694f3 commit 95a74ab4fb0879da270342bc98719b0e735694f3 Author: Edward Tomasz Napierala AuthorDate: 2021-05-07 12:12:30 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-07 12:12:30 +0000 nvmecontrol: fix typo (s/Managment/Management/) Reported By: pstef --- sbin/nvmecontrol/identify_ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/identify_ext.c b/sbin/nvmecontrol/identify_ext.c index 6e30ef0487a8..311c8cba09a9 100644 --- a/sbin/nvmecontrol/identify_ext.c +++ b/sbin/nvmecontrol/identify_ext.c @@ -138,7 +138,7 @@ nvme_print_controller(struct nvme_controller_data *cdata) fmt ? "Supported" : "Not Supported"); printf("Firmware Activate/Download: %s\n", fw ? "Supported" : "Not Supported"); - printf("Namespace Managment: %s\n", + printf("Namespace Management: %s\n", nsmgmt ? "Supported" : "Not Supported"); printf("Device Self-test: %sSupported\n", ((oacs >> NVME_CTRLR_DATA_OACS_SELFTEST_SHIFT) & From owner-dev-commits-src-all@freebsd.org Fri May 7 12:22:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CB3762BE87; Fri, 7 May 2021 12:22:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fc8jY2Bxtz4YFl; Fri, 7 May 2021 12:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3E4A4349A; Fri, 7 May 2021 12:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147CMvXA086132; Fri, 7 May 2021 12:22:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147CMvsv086131; Fri, 7 May 2021 12:22:57 GMT (envelope-from git) Date: Fri, 7 May 2021 12:22:57 GMT Message-Id: <202105071222.147CMvsv086131@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: e2ea6942ab31 - main - mpsutil: extend show adapter information, add NCQ control MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e2ea6942ab316d4cd5c2fef73ab28dc974b8dc51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 12:22:57 -0000 The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=e2ea6942ab316d4cd5c2fef73ab28dc974b8dc51 commit e2ea6942ab316d4cd5c2fef73ab28dc974b8dc51 Author: Daniel Austin AuthorDate: 2021-05-07 11:41:53 +0000 Commit: Andriy Gapon CommitDate: 2021-05-07 12:22:22 +0000 mpsutil: extend show adapter information, add NCQ control 'show adapter' now shows PCIe width and speed, IOC Speed, and the temperature of the controller. A new command, 'set ncq', is added. It enables or disables SATA NCQ in the NVRAM of the card. Its current setting is added to 'show adapter' as well. PR: 254841 MFC after: 2 weeks Relnotes: perhaps --- usr.sbin/mpsutil/Makefile | 2 +- usr.sbin/mpsutil/mps_set.c | 129 ++++++++++++++++++++++++++++++++++++++++++++ usr.sbin/mpsutil/mps_show.c | 34 ++++++++++++ usr.sbin/mpsutil/mpsutil.8 | 8 ++- 4 files changed, 171 insertions(+), 2 deletions(-) diff --git a/usr.sbin/mpsutil/Makefile b/usr.sbin/mpsutil/Makefile index dd99f5814565..0bc981366650 100644 --- a/usr.sbin/mpsutil/Makefile +++ b/usr.sbin/mpsutil/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= mpsutil -SRCS= mps_cmd.c mps_debug.c mps_flash.c mps_show.c mps_slot.c mpsutil.c +SRCS= mps_cmd.c mps_debug.c mps_flash.c mps_set.c mps_show.c mps_slot.c mpsutil.c MAN= mpsutil.8 WARNS?= 3 diff --git a/usr.sbin/mpsutil/mps_set.c b/usr.sbin/mpsutil/mps_set.c new file mode 100644 index 000000000000..91e4d23ab78d --- /dev/null +++ b/usr.sbin/mpsutil/mps_set.c @@ -0,0 +1,129 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Daniel Austin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__RCSID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpsutil.h" + +static int set_ncq(int ac, char **av); + +MPS_TABLE(top, set); + +static int +set_ncq(int ac, char **av) +{ + MPI2_CONFIG_PAGE_HEADER header; + MPI2_CONFIG_PAGE_IO_UNIT_1 *iounit1; + MPI2_CONFIG_REQUEST req; + MPI2_CONFIG_REPLY reply; + int error, fd; + + bzero(&req, sizeof(req)); + bzero(&header, sizeof(header)); + bzero(&reply, sizeof(reply)); + + fd = mps_open(mps_unit); + if (fd < 0) { + error = errno; + warn("mps_open"); + return (error); + } + + error = mps_read_config_page_header(fd, MPI2_CONFIG_PAGETYPE_IO_UNIT, 1, 0, + &header, NULL); + if (error) { + error = errno; + warn("Failed to get IOUNIT page 1 header"); + return (error); + } + + iounit1 = mps_read_config_page(fd, MPI2_CONFIG_PAGETYPE_IO_UNIT, 1, 0, NULL); + if (iounit1 == NULL) { + error = errno; + warn("Failed to get IOUNIT page 1 info"); + return (error); + } + + if (ac == 1) { + /* just show current setting */ + printf("SATA Native Command Queueing is currently: %s\n", + ((iounit1->Flags & MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE) == 0) ? + "ENABLED" : "DISABLED"); + } else if (ac == 2) { + if (!strcasecmp(av[1], "enable") || !strcmp(av[1], "1")) { + iounit1->Flags &= ~MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE; + } else if (!strcasecmp(av[1], "disable") || !strcmp(av[1], "0")) { + iounit1->Flags |= MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE; + } else { + free(iounit1); + error = EINVAL; + warn("set ncq: Only 'enable' and 'disable' allowed."); + return (EINVAL); + } + req.Function = MPI2_FUNCTION_CONFIG; + req.Action = MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT; + req.ExtPageLength = 0; + req.ExtPageType = 0; + req.Header = header; + req.PageAddress = 0; + if (mps_pass_command(fd, &req, sizeof(req) - sizeof(req.PageBufferSGE), &reply, sizeof(reply), + NULL, 0, iounit1, sizeof(iounit1), 30) != 0) { + free(iounit1); + error = errno; + warn("Failed to update config page"); + return (error); + } + if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { + free(iounit1); + error = errno; + warn("%s", mps_ioc_status(reply.IOCStatus)); + return (error); + } + printf("NCQ setting accepted. It may not take effect until the controller is reset.\n"); + } else { + free(iounit1); + errno = EINVAL; + warn("set ncq: too many arguments"); + return (EINVAL); + } + free(iounit1); + + close(fd); + return (0); +} + +MPS_COMMAND(set, ncq, set_ncq, "[enable|disable]", "set SATA NCQ function") + diff --git a/usr.sbin/mpsutil/mps_show.c b/usr.sbin/mpsutil/mps_show.c index 620bb5e27f89..7c2596497818 100644 --- a/usr.sbin/mpsutil/mps_show.c +++ b/usr.sbin/mpsutil/mps_show.c @@ -59,12 +59,18 @@ MPS_TABLE(top, show); static int show_adapter(int ac, char **av) { + const char* pcie_speed[] = { "2.5", "5.0", "8.0" }; + const char* temp_units[] = { "", "F", "C" }; + const char* ioc_speeds[] = { "", "Full", "Half", "Quarter", "Eighth" }; + MPI2_CONFIG_PAGE_SASIOUNIT_0 *sas0; MPI2_CONFIG_PAGE_SASIOUNIT_1 *sas1; MPI2_SAS_IO_UNIT0_PHY_DATA *phy0; MPI2_SAS_IO_UNIT1_PHY_DATA *phy1; MPI2_CONFIG_PAGE_MAN_0 *man0; MPI2_CONFIG_PAGE_BIOS_3 *bios3; + MPI2_CONFIG_PAGE_IO_UNIT_1 *iounit1; + MPI2_CONFIG_PAGE_IO_UNIT_7 *iounit7; MPI2_IOC_FACTS_REPLY *facts; U16 IOCStatus; char *speed, *minspeed, *maxspeed, *isdisabled, *type; @@ -126,6 +132,34 @@ show_adapter(int ac, char **av) ? "yes" : "no"); free(facts); + iounit1 = mps_read_config_page(fd, MPI2_CONFIG_PAGETYPE_IO_UNIT, 1, 0, NULL); + if (iounit1 == NULL) { + error = errno; + warn("Failed to get IOUNIT page 1 info"); + return (error); + } + printf(" SATA NCQ: %s\n", + ((iounit1->Flags & MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE) == 0) ? + "ENABLED" : "DISABLED"); + free(iounit1); + + iounit7 = mps_read_config_page(fd, MPI2_CONFIG_PAGETYPE_IO_UNIT, 7, 0, NULL); + if (iounit7 == NULL) { + error = errno; + warn("Failed to get IOUNIT page 7 info"); + return (error); + } + printf(" PCIe Width/Speed: x%d (%s GB/sec)\n", iounit7->PCIeWidth, + pcie_speed[iounit7->PCIeSpeed]); + printf(" IOC Speed: %s\n", ioc_speeds[iounit7->IOCSpeed]); + printf(" Temperature: "); + if (iounit7->IOCTemperatureUnits == MPI2_IOUNITPAGE7_IOC_TEMP_NOT_PRESENT) + printf("Unknown/Unsupported\n"); + else + printf("%d %s\n", iounit7->IOCTemperature, + temp_units[iounit7->IOCTemperatureUnits]); + free(iounit7); + fd = mps_open(mps_unit); if (fd < 0) { error = errno; diff --git a/usr.sbin/mpsutil/mpsutil.8 b/usr.sbin/mpsutil/mpsutil.8 index 1bb7c4d5eaec..e7c2fda8f84e 100644 --- a/usr.sbin/mpsutil/mpsutil.8 +++ b/usr.sbin/mpsutil/mpsutil.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 25, 2021 +.Dd May 7, 2021 .Dt MPSUTIL 8 .Os .Sh NAME @@ -62,6 +62,10 @@ .Cm show iocfacts .Nm .Op Fl u Ar unit +.Cm set ncq +.Op Ar enable Ns | Ns Ar disable +.Nm +.Op Fl u Ar unit .Cm flash save .Op Ar firmware Ns | Ns Ar bios .Op Ar file @@ -134,6 +138,8 @@ Dump raw config page in hex. .Pp Controller management commands include: .Bl -tag -width indent +.It Cm set ncq Oo Ar enable Ns | Ns Ar disable Oc +Enables or disables NCQ in the NVRAM of the card. .It Cm flash save Oo Ar firmware Ns | Ns Ar bios Oc Op Ar file Save the .Ar firmware From owner-dev-commits-src-all@freebsd.org Fri May 7 14:08:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB0FC62F133; Fri, 7 May 2021 14:08:17 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcC356M6kz4fDn; Fri, 7 May 2021 14:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CCE7F496B; Fri, 7 May 2021 14:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147E8HBA020139; Fri, 7 May 2021 14:08:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147E8HBC020138; Fri, 7 May 2021 14:08:17 GMT (envelope-from git) Date: Fri, 7 May 2021 14:08:17 GMT Message-Id: <202105071408.147E8HBC020138@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a0850dd0570f - main - swappagerops: slightly more style-compliant formatting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a0850dd0570fcfbb5cf72cb0962a201d39db040e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 14:08:18 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a0850dd0570fcfbb5cf72cb0962a201d39db040e commit a0850dd0570fcfbb5cf72cb0962a201d39db040e Author: Konstantin Belousov AuthorDate: 2021-04-30 23:54:17 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 14:08:02 +0000 swappagerops: slightly more style-compliant formatting Remove excess spaces from comments. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30070 --- sys/vm/swap_pager.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 888df04741b4..c6ebfa0167f2 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -436,13 +436,13 @@ static void swap_pager_release_writecount(vm_object_t object, struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ - .pgo_alloc = swap_pager_alloc, /* allocate an OBJT_SWAP object */ - .pgo_dealloc = swap_pager_dealloc, /* deallocate an OBJT_SWAP object */ - .pgo_getpages = swap_pager_getpages, /* pagein */ - .pgo_getpages_async = swap_pager_getpages_async, /* pagein (async) */ - .pgo_putpages = swap_pager_putpages, /* pageout */ - .pgo_haspage = swap_pager_haspage, /* get backing store status for page */ - .pgo_pageunswapped = swap_pager_unswapped, /* remove swap related to page */ + .pgo_alloc = swap_pager_alloc, /* allocate an OBJT_SWAP object */ + .pgo_dealloc = swap_pager_dealloc, /* deallocate an OBJT_SWAP object */ + .pgo_getpages = swap_pager_getpages, /* pagein */ + .pgo_getpages_async = swap_pager_getpages_async, /* pagein (async) */ + .pgo_putpages = swap_pager_putpages, /* pageout */ + .pgo_haspage = swap_pager_haspage, /* get backing store status for page */ + .pgo_pageunswapped = swap_pager_unswapped, /* remove swap related to page */ .pgo_update_writecount = swap_pager_update_writecount, .pgo_release_writecount = swap_pager_release_writecount, }; From owner-dev-commits-src-all@freebsd.org Fri May 7 14:08:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 175FE62ECFA; Fri, 7 May 2021 14:08:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcC3705vSz4fHH; Fri, 7 May 2021 14:08:19 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DFD8D496C; Fri, 7 May 2021 14:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147E8I8W020160; Fri, 7 May 2021 14:08:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147E8I18020159; Fri, 7 May 2021 14:08:18 GMT (envelope-from git) Date: Fri, 7 May 2021 14:08:18 GMT Message-Id: <202105071408.147E8I18020159@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ee4211bca600 - main - vm_pager: style some wrappers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee4211bca600af48aab95000f39b4797a74eeb85 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 14:08:19 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ee4211bca600af48aab95000f39b4797a74eeb85 commit ee4211bca600af48aab95000f39b4797a74eeb85 Author: Konstantin Belousov AuthorDate: 2021-05-01 00:28:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 14:08:02 +0000 vm_pager: style some wrappers Fill lines with the function definitions. Use local var to shorten repeated extra-long expressions. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30070 --- sys/vm/vm_pager.h | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 45a5a5654806..2dfe374b9d4a 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -129,13 +129,9 @@ void vm_pager_init(void); vm_object_t vm_pager_object_lookup(struct pagerlst *, void *); static __inline void -vm_pager_put_pages( - vm_object_t object, - vm_page_t *m, - int count, - int flags, - int *rtvals -) { +vm_pager_put_pages(vm_object_t object, vm_page_t *m, int count, int flags, + int *rtvals) +{ VM_OBJECT_ASSERT_WLOCKED(object); (*pagertab[object->type]->pgo_putpages) (object, m, count, flags, rtvals); @@ -152,12 +148,9 @@ vm_pager_put_pages( * The object must be locked. */ static __inline boolean_t -vm_pager_has_page( - vm_object_t object, - vm_pindex_t offset, - int *before, - int *after -) { +vm_pager_has_page(vm_object_t object, vm_pindex_t offset, int *before, + int *after) +{ boolean_t ret; VM_OBJECT_ASSERT_LOCKED(object); @@ -191,29 +184,33 @@ vm_pager_populate(vm_object_t object, vm_pindex_t pidx, int fault_type, static __inline void vm_pager_page_unswapped(vm_page_t m) { + pgo_pageunswapped_t *method; - if (pagertab[m->object->type]->pgo_pageunswapped) - (*pagertab[m->object->type]->pgo_pageunswapped)(m); + method = pagertab[m->object->type]->pgo_pageunswapped; + if (method != NULL) + method(m); } static __inline void vm_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end) { + pgo_writecount_t *method; - if (pagertab[object->type]->pgo_update_writecount) - pagertab[object->type]->pgo_update_writecount(object, start, - end); + method = pagertab[object->type]->pgo_update_writecount; + if (method != NULL) + method(object, start, end); } static __inline void vm_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end) { + pgo_writecount_t *method; - if (pagertab[object->type]->pgo_release_writecount) - pagertab[object->type]->pgo_release_writecount(object, start, - end); + method = pagertab[object->type]->pgo_release_writecount; + if (method != NULL) + method(object, start, end); } struct cdev_pager_ops { From owner-dev-commits-src-all@freebsd.org Fri May 7 14:08:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A49662F19D; Fri, 7 May 2021 14:08:20 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcC381p0fz4fF3; Fri, 7 May 2021 14:08:20 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1B5E746F3; Fri, 7 May 2021 14:08:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147E8JlD020181; Fri, 7 May 2021 14:08:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147E8JPN020180; Fri, 7 May 2021 14:08:19 GMT (envelope-from git) Date: Fri, 7 May 2021 14:08:19 GMT Message-Id: <202105071408.147E8JPN020180@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 180bcaa46c5d - main - vm_pager: add pgo_set_writeable_dirty method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 180bcaa46c5d297d137749258b23593d578d76a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 14:08:20 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=180bcaa46c5d297d137749258b23593d578d76a5 commit 180bcaa46c5d297d137749258b23593d578d76a5 Author: Konstantin Belousov AuthorDate: 2021-05-01 00:14:48 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 14:08:03 +0000 vm_pager: add pgo_set_writeable_dirty method specialized for swap and vnode pagers, and used to implement vm_object_set_writeable_dirty(). Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30070 --- sys/vm/swap_pager.c | 9 +++++++++ sys/vm/vm_object.c | 7 +------ sys/vm/vm_object.h | 1 + sys/vm/vm_pager.c | 11 +++++++++++ sys/vm/vm_pager.h | 3 ++- sys/vm/vnode_pager.c | 1 + 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index c6ebfa0167f2..3f2a647b269d 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -433,6 +433,7 @@ static void swap_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); static void swap_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); +static void swap_pager_set_writeable_dirty(vm_object_t object); struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ @@ -445,6 +446,7 @@ struct pagerops swappagerops = { .pgo_pageunswapped = swap_pager_unswapped, /* remove swap related to page */ .pgo_update_writecount = swap_pager_update_writecount, .pgo_release_writecount = swap_pager_release_writecount, + .pgo_set_writeable_dirty = swap_pager_set_writeable_dirty, }; /* @@ -3123,3 +3125,10 @@ swap_pager_release_writecount(vm_object_t object, vm_offset_t start, object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start; VM_OBJECT_WUNLOCK(object); } + +static void +swap_pager_set_writeable_dirty(vm_object_t object) +{ + if ((object->flags & OBJ_TMPFS_NODE) != 0) + vm_object_set_writeable_dirty_(object); +} diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 1f5194464b69..46b43e8cee14 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2332,13 +2332,8 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset, } void -vm_object_set_writeable_dirty(vm_object_t object) +vm_object_set_writeable_dirty_(vm_object_t object) { - - /* Only set for vnodes & tmpfs */ - if (object->type != OBJT_VNODE && - (object->flags & OBJ_TMPFS_NODE) == 0) - return; atomic_add_int(&object->generation, 1); } diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 3c589bd4b42e..93380d904526 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -378,6 +378,7 @@ void vm_object_deallocate (vm_object_t); void vm_object_destroy (vm_object_t); void vm_object_terminate (vm_object_t); void vm_object_set_writeable_dirty (vm_object_t); +void vm_object_set_writeable_dirty_(vm_object_t object); void vm_object_init (void); int vm_object_kvme_type(vm_object_t object, struct vnode **vpp); void vm_object_madvise(vm_object_t, vm_pindex_t, vm_pindex_t, int); diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 2a30a2073b36..258c06fd3947 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -497,3 +497,14 @@ pbrelbo(struct buf *bp) bp->b_bufobj = NULL; bp->b_flags &= ~B_PAGING; } + +void +vm_object_set_writeable_dirty(vm_object_t object) +{ + pgo_set_writeable_dirty_t *method; + + method = pagertab[object->type]->pgo_set_writeable_dirty; + if (method != NULL) + method(object); +} + diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 2dfe374b9d4a..e17e29ea961f 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -62,6 +62,7 @@ typedef int pgo_populate_t(vm_object_t, vm_pindex_t, int, vm_prot_t, vm_pindex_t *, vm_pindex_t *); typedef void pgo_pageunswapped_t(vm_page_t); typedef void pgo_writecount_t(vm_object_t, vm_offset_t, vm_offset_t); +typedef void pgo_set_writeable_dirty_t(vm_object_t); struct pagerops { pgo_init_t *pgo_init; /* Initialize pager. */ @@ -73,9 +74,9 @@ struct pagerops { pgo_haspage_t *pgo_haspage; /* Query page. */ pgo_populate_t *pgo_populate; /* Bulk spec pagein. */ pgo_pageunswapped_t *pgo_pageunswapped; - /* Operations for specialized writecount handling */ pgo_writecount_t *pgo_update_writecount; pgo_writecount_t *pgo_release_writecount; + pgo_set_writeable_dirty_t *pgo_set_writeable_dirty; }; extern struct pagerops defaultpagerops; diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index c33ffca4a700..bb0ec26ea35e 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -115,6 +115,7 @@ struct pagerops vnodepagerops = { .pgo_haspage = vnode_pager_haspage, .pgo_update_writecount = vnode_pager_update_writecount, .pgo_release_writecount = vnode_pager_release_writecount, + .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, }; static struct domainset *vnode_domainset = NULL; From owner-dev-commits-src-all@freebsd.org Fri May 7 14:08:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71F1662F1A8; Fri, 7 May 2021 14:08:21 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcC392FQTz4fHT; Fri, 7 May 2021 14:08:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 30E9D496D; Fri, 7 May 2021 14:08:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147E8LYE020202; Fri, 7 May 2021 14:08:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147E8LdR020201; Fri, 7 May 2021 14:08:21 GMT (envelope-from git) Date: Fri, 7 May 2021 14:08:21 GMT Message-Id: <202105071408.147E8LdR020201@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: c23c555bc15c - main - Add pgo_mightbedirty method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c23c555bc15ce1523b95fb8da99ae77c0bb0977e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 14:08:21 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c23c555bc15ce1523b95fb8da99ae77c0bb0977e commit c23c555bc15ce1523b95fb8da99ae77c0bb0977e Author: Konstantin Belousov AuthorDate: 2021-05-01 00:43:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 14:08:03 +0000 Add pgo_mightbedirty method Used to implement vm_object_mightbedirty() Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30070 --- sys/vm/swap_pager.c | 10 ++++++++++ sys/vm/vm_object.c | 6 ++++++ sys/vm/vm_object.h | 17 ++--------------- sys/vm/vm_pager.c | 10 ++++++++++ sys/vm/vm_pager.h | 2 ++ sys/vm/vnode_pager.c | 1 + 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 3f2a647b269d..11e494d1ad05 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -434,6 +434,7 @@ static void swap_pager_update_writecount(vm_object_t object, static void swap_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); static void swap_pager_set_writeable_dirty(vm_object_t object); +static bool swap_pager_mightbedirty(vm_object_t object); struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ @@ -447,6 +448,7 @@ struct pagerops swappagerops = { .pgo_update_writecount = swap_pager_update_writecount, .pgo_release_writecount = swap_pager_release_writecount, .pgo_set_writeable_dirty = swap_pager_set_writeable_dirty, + .pgo_mightbedirty = swap_pager_mightbedirty, }; /* @@ -3132,3 +3134,11 @@ swap_pager_set_writeable_dirty(vm_object_t object) if ((object->flags & OBJ_TMPFS_NODE) != 0) vm_object_set_writeable_dirty_(object); } + +static bool +swap_pager_mightbedirty(vm_object_t object) +{ + if ((object->flags & OBJ_TMPFS_NODE) != 0) + return (vm_object_mightbedirty_(object)); + return (false); +} diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 46b43e8cee14..b601bff33ff4 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2337,6 +2337,12 @@ vm_object_set_writeable_dirty_(vm_object_t object) atomic_add_int(&object->generation, 1); } +bool +vm_object_mightbedirty_(vm_object_t object) +{ + return (object->generation != object->cleangeneration); +} + /* * vm_object_unwire: * diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 93380d904526..c7bbec0e7a86 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -330,21 +330,6 @@ vm_object_reserv(vm_object_t object) return (false); } -static __inline bool -vm_object_mightbedirty(vm_object_t object) -{ - - if (object->type != OBJT_VNODE) { - if ((object->flags & OBJ_TMPFS_NODE) == 0) - return (false); -#ifdef KASSERT - KASSERT(object->type == OBJT_SWAP, - ("TMPFS_NODE obj %p is not swap", object)); -#endif - } - return (object->generation != object->cleangeneration); -} - void vm_object_clear_flag(vm_object_t object, u_short bits); void vm_object_pip_add(vm_object_t object, short i); void vm_object_pip_wakeup(vm_object_t object); @@ -379,6 +364,8 @@ void vm_object_destroy (vm_object_t); void vm_object_terminate (vm_object_t); void vm_object_set_writeable_dirty (vm_object_t); void vm_object_set_writeable_dirty_(vm_object_t object); +bool vm_object_mightbedirty(vm_object_t object); +bool vm_object_mightbedirty_(vm_object_t object); void vm_object_init (void); int vm_object_kvme_type(vm_object_t object, struct vnode **vpp); void vm_object_madvise(vm_object_t, vm_pindex_t, vm_pindex_t, int); diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 258c06fd3947..b113ce569e14 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -508,3 +508,13 @@ vm_object_set_writeable_dirty(vm_object_t object) method(object); } +bool +vm_object_mightbedirty(vm_object_t object) +{ + pgo_mightbedirty_t *method; + + method = pagertab[object->type]->pgo_mightbedirty; + if (method == NULL) + return (false); + return (method(object)); +} diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index e17e29ea961f..014a67c2e055 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -63,6 +63,7 @@ typedef int pgo_populate_t(vm_object_t, vm_pindex_t, int, vm_prot_t, typedef void pgo_pageunswapped_t(vm_page_t); typedef void pgo_writecount_t(vm_object_t, vm_offset_t, vm_offset_t); typedef void pgo_set_writeable_dirty_t(vm_object_t); +typedef bool pgo_mightbedirty_t(vm_object_t); struct pagerops { pgo_init_t *pgo_init; /* Initialize pager. */ @@ -77,6 +78,7 @@ struct pagerops { pgo_writecount_t *pgo_update_writecount; pgo_writecount_t *pgo_release_writecount; pgo_set_writeable_dirty_t *pgo_set_writeable_dirty; + pgo_mightbedirty_t *pgo_mightbedirty; }; extern struct pagerops defaultpagerops; diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index bb0ec26ea35e..0ab018eda6ee 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -116,6 +116,7 @@ struct pagerops vnodepagerops = { .pgo_update_writecount = vnode_pager_update_writecount, .pgo_release_writecount = vnode_pager_release_writecount, .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, + .pgo_mightbedirty = vm_object_mightbedirty_, }; static struct domainset *vnode_domainset = NULL; From owner-dev-commits-src-all@freebsd.org Fri May 7 14:08:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D2F8462EEC7; Fri, 7 May 2021 14:08:23 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcC3C48wsz4f0x; Fri, 7 May 2021 14:08:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 77DB647E0; Fri, 7 May 2021 14:08:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147E8NhK020251; Fri, 7 May 2021 14:08:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147E8NMl020250; Fri, 7 May 2021 14:08:23 GMT (envelope-from git) Date: Fri, 7 May 2021 14:08:23 GMT Message-Id: <202105071408.147E8NMl020250@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 1390a5cbeb18 - main - Add pgo_freespace method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1390a5cbeb1828b11584783c53f50b9679379651 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 14:08:24 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1390a5cbeb1828b11584783c53f50b9679379651 commit 1390a5cbeb1828b11584783c53f50b9679379651 Author: Konstantin Belousov AuthorDate: 2021-05-01 17:12:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 14:08:03 +0000 Add pgo_freespace method Makes the code in vm_object collapse/page_remove cleaner Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30070 --- sys/vm/swap_pager.c | 7 ++++--- sys/vm/swap_pager.h | 1 - sys/vm/vm_object.c | 24 ++++++++---------------- sys/vm/vm_pager.h | 14 ++++++++++++++ 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 294f61e22cb1..f09a6ffc80dc 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -437,6 +437,8 @@ static void swap_pager_set_writeable_dirty(vm_object_t object); static bool swap_pager_mightbedirty(vm_object_t object); static void swap_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp); +static void swap_pager_freespace(vm_object_t object, vm_pindex_t start, + vm_size_t size); struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ @@ -452,6 +454,7 @@ struct pagerops swappagerops = { .pgo_set_writeable_dirty = swap_pager_set_writeable_dirty, .pgo_mightbedirty = swap_pager_mightbedirty, .pgo_getvp = swap_pager_getvp, + .pgo_freespace = swap_pager_freespace, }; /* @@ -942,8 +945,6 @@ sysctl_swap_fragmentation(SYSCTL_HANDLER_ARGS) * SWAP_PAGER_FREESPACE() - frees swap blocks associated with a page * range within an object. * - * This is a globally accessible routine. - * * This routine removes swapblk assignments from swap metadata. * * The external callers of this routine typically have already destroyed @@ -952,7 +953,7 @@ sysctl_swap_fragmentation(SYSCTL_HANDLER_ARGS) * * The object must be locked. */ -void +static void swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size) { diff --git a/sys/vm/swap_pager.h b/sys/vm/swap_pager.h index 59ca2cc2cfdb..7a2ea12e887d 100644 --- a/sys/vm/swap_pager.h +++ b/sys/vm/swap_pager.h @@ -76,7 +76,6 @@ struct xswdev; int swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len); void swap_pager_copy(vm_object_t, vm_object_t, vm_pindex_t, int); vm_pindex_t swap_pager_find_least(vm_object_t object, vm_pindex_t pindex); -void swap_pager_freespace(vm_object_t, vm_pindex_t, vm_size_t); void swap_pager_swap_init(void); int swap_pager_nswapdev(void); int swap_pager_reserve(vm_object_t, vm_pindex_t, vm_size_t); diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index b601bff33ff4..7b380608cdf4 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1277,8 +1277,8 @@ vm_object_madvise_freespace(vm_object_t object, int advice, vm_pindex_t pindex, vm_size_t size) { - if (advice == MADV_FREE && object->type == OBJT_SWAP) - swap_pager_freespace(object, pindex, size); + if (advice == MADV_FREE) + vm_pager_freespace(object, pindex, size); } /* @@ -1798,9 +1798,7 @@ vm_object_collapse_scan(vm_object_t object) if (p->pindex < backing_offset_index || new_pindex >= object->size) { - if (backing_object->type == OBJT_SWAP) - swap_pager_freespace(backing_object, p->pindex, - 1); + vm_pager_freespace(backing_object, p->pindex, 1); KASSERT(!pmap_page_is_mapped(p), ("freeing mapped page %p", p)); @@ -1849,9 +1847,7 @@ vm_object_collapse_scan(vm_object_t object) * page alone. Destroy the original page from the * backing object. */ - if (backing_object->type == OBJT_SWAP) - swap_pager_freespace(backing_object, p->pindex, - 1); + vm_pager_freespace(backing_object, p->pindex, 1); KASSERT(!pmap_page_is_mapped(p), ("freeing mapped page %p", p)); if (vm_page_remove(p)) @@ -1875,9 +1871,8 @@ vm_object_collapse_scan(vm_object_t object) } /* Use the old pindex to free the right page. */ - if (backing_object->type == OBJT_SWAP) - swap_pager_freespace(backing_object, - new_pindex + backing_offset_index, 1); + vm_pager_freespace(backing_object, new_pindex + + backing_offset_index, 1); #if VM_NRESERVLEVEL > 0 /* @@ -2138,11 +2133,8 @@ wired: } vm_object_pip_wakeup(object); - if (object->type == OBJT_SWAP) { - if (end == 0) - end = object->size; - swap_pager_freespace(object, start, end - start); - } + vm_pager_freespace(object, start, (end == 0 ? object->size : end) - + start); } /* diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index cb2a896c8749..6a35c066bea6 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -67,6 +67,8 @@ typedef void pgo_set_writeable_dirty_t(vm_object_t); typedef bool pgo_mightbedirty_t(vm_object_t); typedef void pgo_getvp_t(vm_object_t object, struct vnode **vpp, bool *vp_heldp); +typedef void pgo_freespace_t(vm_object_t object, vm_pindex_t start, + vm_size_t size); struct pagerops { pgo_init_t *pgo_init; /* Initialize pager. */ @@ -83,6 +85,7 @@ struct pagerops { pgo_set_writeable_dirty_t *pgo_set_writeable_dirty; pgo_mightbedirty_t *pgo_mightbedirty; pgo_getvp_t *pgo_getvp; + pgo_freespace_t *pgo_freespace; }; extern struct pagerops defaultpagerops; @@ -236,6 +239,17 @@ vm_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) } } +static __inline void +vm_pager_freespace(vm_object_t object, vm_pindex_t start, + vm_size_t size) +{ + pgo_freespace_t *method; + + method = pagertab[object->type]->pgo_freespace; + if (method != NULL) + method(object, start, size); +} + struct cdev_pager_ops { int (*cdev_pg_fault)(vm_object_t vm_obj, vm_ooffset_t offset, int prot, vm_page_t *mres); From owner-dev-commits-src-all@freebsd.org Fri May 7 14:08:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9C5E62F228; Fri, 7 May 2021 14:08:22 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcC3B3gXQz4fHh; Fri, 7 May 2021 14:08:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5728846F4; Fri, 7 May 2021 14:08:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147E8MCX020229; Fri, 7 May 2021 14:08:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147E8MI5020228; Fri, 7 May 2021 14:08:22 GMT (envelope-from git) Date: Fri, 7 May 2021 14:08:22 GMT Message-Id: <202105071408.147E8MI5020228@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 192112b74fed - main - Add pgo_getvp method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 192112b74fed56ca652cf1d70c11ba7e17bc1ce2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 14:08:22 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=192112b74fed56ca652cf1d70c11ba7e17bc1ce2 commit 192112b74fed56ca652cf1d70c11ba7e17bc1ce2 Author: Konstantin Belousov AuthorDate: 2021-05-01 01:04:04 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 14:08:03 +0000 Add pgo_getvp method This eliminates the staircase of conditions in vm_map_entry_set_vnode_text(). Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30070 --- sys/vm/swap_pager.c | 28 ++++++++++++++++++++++++++++ sys/vm/vm_map.c | 33 +-------------------------------- sys/vm/vm_pager.c | 11 +++++++++++ sys/vm/vm_pager.h | 20 ++++++++++++++++++++ sys/vm/vnode_pager.c | 8 ++++++++ 5 files changed, 68 insertions(+), 32 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 11e494d1ad05..294f61e22cb1 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -435,6 +435,8 @@ static void swap_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); static void swap_pager_set_writeable_dirty(vm_object_t object); static bool swap_pager_mightbedirty(vm_object_t object); +static void swap_pager_getvp(vm_object_t object, struct vnode **vpp, + bool *vp_heldp); struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ @@ -449,6 +451,7 @@ struct pagerops swappagerops = { .pgo_release_writecount = swap_pager_release_writecount, .pgo_set_writeable_dirty = swap_pager_set_writeable_dirty, .pgo_mightbedirty = swap_pager_mightbedirty, + .pgo_getvp = swap_pager_getvp, }; /* @@ -3142,3 +3145,28 @@ swap_pager_mightbedirty(vm_object_t object) return (vm_object_mightbedirty_(object)); return (false); } + +static void +swap_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) +{ + struct vnode *vp; + + KASSERT((object->flags & OBJ_TMPFS_NODE) != 0, + ("swap_pager_getvp: swap and !TMPFS obj %p", object)); + + /* + * Tmpfs VREG node, which was reclaimed, has + * OBJ_TMPFS_NODE flag set, but not OBJ_TMPFS. In + * this case there is no v_writecount to adjust. + */ + VM_OBJECT_RLOCK(object); + if ((object->flags & OBJ_TMPFS) != 0) { + vp = object->un_pager.swp.swp_tmpfs; + if (vp != NULL) { + vhold(vp); + *vpp = vp; + *vp_heldp = true; + } + } + VM_OBJECT_RUNLOCK(object); +} diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index b3288fce5114..815775ee9740 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -561,38 +561,7 @@ vm_map_entry_set_vnode_text(vm_map_entry_t entry, bool add) * referenced by the entry we are processing, so it cannot go * away. */ - vp = NULL; - vp_held = false; - if (object->type == OBJT_DEAD) { - /* - * For OBJT_DEAD objects, v_writecount was handled in - * vnode_pager_dealloc(). - */ - } else if (object->type == OBJT_VNODE) { - vp = object->handle; - } else if (object->type == OBJT_SWAP) { - KASSERT((object->flags & OBJ_TMPFS_NODE) != 0, - ("vm_map_entry_set_vnode_text: swap and !TMPFS " - "entry %p, object %p, add %d", entry, object, add)); - /* - * Tmpfs VREG node, which was reclaimed, has - * OBJ_TMPFS_NODE flag set, but not OBJ_TMPFS. In - * this case there is no v_writecount to adjust. - */ - VM_OBJECT_RLOCK(object); - if ((object->flags & OBJ_TMPFS) != 0) { - vp = object->un_pager.swp.swp_tmpfs; - if (vp != NULL) { - vhold(vp); - vp_held = true; - } - } - VM_OBJECT_RUNLOCK(object); - } else { - KASSERT(0, - ("vm_map_entry_set_vnode_text: wrong object type, " - "entry %p, object %p, add %d", entry, object, add)); - } + vm_pager_getvp(object, &vp, &vp_held); if (vp != NULL) { if (add) { VOP_SET_TEXT_CHECKED(vp); diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index b113ce569e14..587407a06291 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -100,6 +100,7 @@ static vm_object_t dead_pager_alloc(void *, vm_ooffset_t, vm_prot_t, static void dead_pager_putpages(vm_object_t, vm_page_t *, int, int, int *); static boolean_t dead_pager_haspage(vm_object_t, vm_pindex_t, int *, int *); static void dead_pager_dealloc(vm_object_t); +static void dead_pager_getvp(vm_object_t, struct vnode **, bool *); static int dead_pager_getpages(vm_object_t obj, vm_page_t *ma, int count, int *rbehind, @@ -144,12 +145,22 @@ dead_pager_dealloc(vm_object_t object) } +static void +dead_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) +{ + /* + * For OBJT_DEAD objects, v_writecount was handled in + * vnode_pager_dealloc(). + */ +} + static struct pagerops deadpagerops = { .pgo_alloc = dead_pager_alloc, .pgo_dealloc = dead_pager_dealloc, .pgo_getpages = dead_pager_getpages, .pgo_putpages = dead_pager_putpages, .pgo_haspage = dead_pager_haspage, + .pgo_getvp = dead_pager_getvp, }; struct pagerops *pagertab[] = { diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 014a67c2e055..cb2a896c8749 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -47,6 +47,7 @@ #include TAILQ_HEAD(pagerlst, vm_object); +struct vnode; typedef void pgo_init_t(void); typedef vm_object_t pgo_alloc_t(void *, vm_ooffset_t, vm_prot_t, vm_ooffset_t, @@ -64,6 +65,8 @@ typedef void pgo_pageunswapped_t(vm_page_t); typedef void pgo_writecount_t(vm_object_t, vm_offset_t, vm_offset_t); typedef void pgo_set_writeable_dirty_t(vm_object_t); typedef bool pgo_mightbedirty_t(vm_object_t); +typedef void pgo_getvp_t(vm_object_t object, struct vnode **vpp, + bool *vp_heldp); struct pagerops { pgo_init_t *pgo_init; /* Initialize pager. */ @@ -79,6 +82,7 @@ struct pagerops { pgo_writecount_t *pgo_release_writecount; pgo_set_writeable_dirty_t *pgo_set_writeable_dirty; pgo_mightbedirty_t *pgo_mightbedirty; + pgo_getvp_t *pgo_getvp; }; extern struct pagerops defaultpagerops; @@ -216,6 +220,22 @@ vm_pager_release_writecount(vm_object_t object, vm_offset_t start, method(object, start, end); } +static __inline void +vm_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) +{ + pgo_getvp_t *method; + + *vpp = NULL; + *vp_heldp = false; + method = pagertab[object->type]->pgo_getvp; + if (method != NULL) { + method(object, vpp, vp_heldp); + } else { + KASSERT(0, + ("vm_pager_getvp: wrong object type obj %p", object)); + } +} + struct cdev_pager_ops { int (*cdev_pg_fault)(vm_object_t vm_obj, vm_ooffset_t offset, int prot, vm_page_t *mres); diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 0ab018eda6ee..3d8288f7e72f 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -105,6 +105,7 @@ static void vnode_pager_update_writecount(vm_object_t, vm_offset_t, vm_offset_t); static void vnode_pager_release_writecount(vm_object_t, vm_offset_t, vm_offset_t); +static void vnode_pager_getvp(vm_object_t, struct vnode **, bool *); struct pagerops vnodepagerops = { .pgo_alloc = vnode_pager_alloc, @@ -117,6 +118,7 @@ struct pagerops vnodepagerops = { .pgo_release_writecount = vnode_pager_release_writecount, .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, .pgo_mightbedirty = vm_object_mightbedirty_, + .pgo_getvp = vnode_pager_getvp, }; static struct domainset *vnode_domainset = NULL; @@ -1602,3 +1604,9 @@ vnode_pager_release_writecount(vm_object_t object, vm_offset_t start, if (mp != NULL) vn_finished_write(mp); } + +static void +vnode_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) +{ + *vpp = object->handle; +} From owner-dev-commits-src-all@freebsd.org Fri May 7 14:08:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2AF2962F1B0; Fri, 7 May 2021 14:08:25 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcC3D6L2nz4f14; Fri, 7 May 2021 14:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 96A194C15; Fri, 7 May 2021 14:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147E8OK0020272; Fri, 7 May 2021 14:08:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147E8O59020271; Fri, 7 May 2021 14:08:24 GMT (envelope-from git) Date: Fri, 7 May 2021 14:08:24 GMT Message-Id: <202105071408.147E8O59020271@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a7c198a24b12 - main - Implement vm_object_vnode() using vm_pager_getvp() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7c198a24b12b9e6d83d7718d8d16a5cef48d35f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 14:08:25 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a7c198a24b12b9e6d83d7718d8d16a5cef48d35f commit a7c198a24b12b9e6d83d7718d8d16a5cef48d35f Author: Konstantin Belousov AuthorDate: 2021-05-01 01:08:28 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 14:08:03 +0000 Implement vm_object_vnode() using vm_pager_getvp() Allow vp_heldp argument to be NULL, in which case the returned vnode is not held for tmpfs swap objects. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30070 --- sys/vm/swap_pager.c | 14 ++++++++++---- sys/vm/vm_object.c | 11 +---------- sys/vm/vm_pager.h | 9 +++------ 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index f09a6ffc80dc..ec37a26d523d 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -3160,14 +3160,20 @@ swap_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) * OBJ_TMPFS_NODE flag set, but not OBJ_TMPFS. In * this case there is no v_writecount to adjust. */ - VM_OBJECT_RLOCK(object); + if (vp_heldp != NULL) + VM_OBJECT_RLOCK(object); + else + VM_OBJECT_ASSERT_LOCKED(object); if ((object->flags & OBJ_TMPFS) != 0) { vp = object->un_pager.swp.swp_tmpfs; if (vp != NULL) { - vhold(vp); *vpp = vp; - *vp_heldp = true; + if (vp_heldp != NULL) { + vhold(vp); + *vp_heldp = true; + } } } - VM_OBJECT_RUNLOCK(object); + if (vp_heldp != NULL) + VM_OBJECT_RUNLOCK(object); } diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 7b380608cdf4..bbcbad41f10c 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2429,16 +2429,7 @@ vm_object_vnode(vm_object_t object) struct vnode *vp; VM_OBJECT_ASSERT_LOCKED(object); - if (object->type == OBJT_VNODE) { - vp = object->handle; - KASSERT(vp != NULL, ("%s: OBJT_VNODE has no vnode", __func__)); - } else if (object->type == OBJT_SWAP && - (object->flags & OBJ_TMPFS) != 0) { - vp = object->un_pager.swp.swp_tmpfs; - KASSERT(vp != NULL, ("%s: OBJT_TMPFS has no vnode", __func__)); - } else { - vp = NULL; - } + vm_pager_getvp(object, &vp, NULL); return (vp); } diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 6a35c066bea6..507123adb454 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -229,14 +229,11 @@ vm_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) pgo_getvp_t *method; *vpp = NULL; - *vp_heldp = false; + if (vp_heldp != NULL) + *vp_heldp = false; method = pagertab[object->type]->pgo_getvp; - if (method != NULL) { + if (method != NULL) method(object, vpp, vp_heldp); - } else { - KASSERT(0, - ("vm_pager_getvp: wrong object type obj %p", object)); - } } static __inline void From owner-dev-commits-src-all@freebsd.org Fri May 7 14:08:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0675862EE7B; Fri, 7 May 2021 14:08:27 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcC3G0KBVz4fKJ; Fri, 7 May 2021 14:08:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C3CFE47E1; Fri, 7 May 2021 14:08:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147E8PHO020293; Fri, 7 May 2021 14:08:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147E8PtP020292; Fri, 7 May 2021 14:08:25 GMT (envelope-from git) Date: Fri, 7 May 2021 14:08:25 GMT Message-Id: <202105071408.147E8PtP020292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 838adc533fa1 - main - Style enum obj_type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 838adc533fa11b8c4e7da5603377fdd62c2f1d90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 14:08:27 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=838adc533fa11b8c4e7da5603377fdd62c2f1d90 commit 838adc533fa11b8c4e7da5603377fdd62c2f1d90 Author: Konstantin Belousov AuthorDate: 2021-05-01 01:14:24 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 14:08:03 +0000 Style enum obj_type Put each type into dedicated line, which makes addition of new types cleaner. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30070 --- sys/vm/vm.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm.h b/sys/vm/vm.h index 9bf77db4118c..678e6eb2d2d8 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -88,8 +88,16 @@ typedef u_char vm_prot_t; /* protection codes */ #define VM_PROT_RW (VM_PROT_READ|VM_PROT_WRITE) #define VM_PROT_DEFAULT VM_PROT_ALL -enum obj_type { OBJT_DEFAULT, OBJT_SWAP, OBJT_VNODE, OBJT_DEVICE, OBJT_PHYS, - OBJT_DEAD, OBJT_SG, OBJT_MGTDEVICE }; +enum obj_type { + OBJT_DEFAULT, + OBJT_SWAP, + OBJT_VNODE, + OBJT_DEVICE, + OBJT_PHYS, + OBJT_DEAD, + OBJT_SG, + OBJT_MGTDEVICE, +}; typedef u_char objtype_t; union vm_map_object; From owner-dev-commits-src-all@freebsd.org Fri May 7 14:08:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECC1962F0FB; Fri, 7 May 2021 14:08:28 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcC3J3y5Qz4fQX; Fri, 7 May 2021 14:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0FA264AA7; Fri, 7 May 2021 14:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147E8ReC020341; Fri, 7 May 2021 14:08:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147E8Rt2020338; Fri, 7 May 2021 14:08:27 GMT (envelope-from git) Date: Fri, 7 May 2021 14:08:27 GMT Message-Id: <202105071408.147E8Rt2020338@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 4b8365d752ef - main - Add OBJT_SWAP_TMPFS pager MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b8365d752ef48c14f0584d21b719bb386a7be82 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 14:08:29 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4b8365d752ef48c14f0584d21b719bb386a7be82 commit 4b8365d752ef48c14f0584d21b719bb386a7be82 Author: Konstantin Belousov AuthorDate: 2021-05-01 01:18:00 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 14:08:03 +0000 Add OBJT_SWAP_TMPFS pager This is OBJT_SWAP pager, specialized for tmpfs. Right now, both swap pager and generic vm code have to explicitly handle swap objects which are tmpfs vnode v_object, in the special ways. Replace (almost) all such places with proper methods. Since VM still needs a notion of the 'swap object', regardless of its use, add yet another type-classification flag OBJ_SWAP. Set it in vm_object_allocate() where other type-class flags are set. This change almost completely eliminates the knowledge of tmpfs from VM, and opens a way to make OBJT_SWAP_TMPFS loadable from tmpfs.ko. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30070 --- sys/fs/procfs/procfs_map.c | 17 ++++--- sys/fs/tmpfs/tmpfs_subr.c | 11 ++--- sys/fs/tmpfs/tmpfs_vfsops.c | 10 ++-- sys/fs/tmpfs/tmpfs_vnops.c | 5 +- sys/vm/swap_pager.c | 114 ++++++++++++++++++++++++-------------------- sys/vm/vm.h | 1 + sys/vm/vm_fault.c | 2 +- sys/vm/vm_map.c | 8 ++-- sys/vm/vm_mmap.c | 5 +- sys/vm/vm_object.c | 24 ++++++---- sys/vm/vm_object.h | 2 +- sys/vm/vm_page.c | 4 +- sys/vm/vm_pageout.c | 5 +- sys/vm/vm_pager.c | 1 + sys/vm/vm_pager.h | 1 + 15 files changed, 115 insertions(+), 95 deletions(-) diff --git a/sys/fs/procfs/procfs_map.c b/sys/fs/procfs/procfs_map.c index e4969d795dcc..9ee49b0149a2 100644 --- a/sys/fs/procfs/procfs_map.c +++ b/sys/fs/procfs/procfs_map.c @@ -166,17 +166,16 @@ procfs_doprocmap(PFS_FILL_ARGS) vp = lobj->handle; vref(vp); break; - case OBJT_SWAP: - if ((lobj->flags & OBJ_TMPFS_NODE) != 0) { - type = "vnode"; - if ((lobj->flags & OBJ_TMPFS) != 0) { - vp = lobj->un_pager.swp.swp_tmpfs; - vref(vp); - } - } else { - type = "swap"; + case OBJT_SWAP_TMPFS: + type = "vnode"; + if ((lobj->flags & OBJ_TMPFS) != 0) { + vp = lobj->un_pager.swp.swp_tmpfs; + vref(vp); } break; + case OBJT_SWAP: + type = "swap"; + break; case OBJT_SG: case OBJT_DEVICE: type = "device"; diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 84473a439c43..1ea4cf23b314 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -364,12 +364,10 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, case VREG: obj = nnode->tn_reg.tn_aobj = - vm_pager_allocate(OBJT_SWAP, NULL, 0, VM_PROT_DEFAULT, 0, + vm_pager_allocate(OBJT_SWAP_TMPFS, NULL, 0, + VM_PROT_DEFAULT, 0, NULL /* XXXKIB - tmpfs needs swap reservation */); - VM_OBJECT_WLOCK(obj); /* OBJ_TMPFS is set together with the setting of vp->v_object */ - vm_object_set_flag(obj, OBJ_TMPFS_NODE); - VM_OBJECT_WUNLOCK(obj); nnode->tn_reg.tn_tmp = tmp; break; @@ -1590,8 +1588,9 @@ tmpfs_check_mtime(struct vnode *vp) if (vp->v_type != VREG) return; obj = vp->v_object; - KASSERT((obj->flags & (OBJ_TMPFS_NODE | OBJ_TMPFS)) == - (OBJ_TMPFS_NODE | OBJ_TMPFS), ("non-tmpfs obj")); + KASSERT(obj->type == OBJT_SWAP_TMPFS && + (obj->flags & (OBJ_SWAP | OBJ_TMPFS)) == + (OBJ_SWAP | OBJ_TMPFS), ("non-tmpfs obj")); /* unlocked read */ if (obj->generation != obj->cleangeneration) { VM_OBJECT_WLOCK(obj); diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index ba7c654d4f0a..51d097203135 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -120,8 +120,8 @@ tmpfs_update_mtime(struct mount *mp, bool lazy) continue; } obj = vp->v_object; - KASSERT((obj->flags & (OBJ_TMPFS_NODE | OBJ_TMPFS)) == - (OBJ_TMPFS_NODE | OBJ_TMPFS), ("non-tmpfs obj")); + MPASS(obj->type == OBJT_SWAP_TMPFS); + MPASS((obj->flags & OBJ_TMPFS) != 0); /* * In lazy case, do unlocked read, avoid taking vnode @@ -225,8 +225,7 @@ again: (entry->max_protection & VM_PROT_WRITE) == 0) continue; object = entry->object.vm_object; - if (object == NULL || object->type != OBJT_SWAP || - (object->flags & OBJ_TMPFS_NODE) == 0) + if (object == NULL || object->type != OBJT_SWAP_TMPFS) continue; /* * No need to dig into shadow chain, mapping @@ -239,8 +238,7 @@ again: continue; } MPASS(object->ref_count > 1); - if ((object->flags & (OBJ_TMPFS_NODE | OBJ_TMPFS)) != - (OBJ_TMPFS_NODE | OBJ_TMPFS)) { + if ((object->flags & OBJ_TMPFS) == 0) { VM_OBJECT_RUNLOCK(object); continue; } diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 94cb7fd868fa..401ee672b96a 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -623,8 +623,9 @@ tmpfs_read_pgcache(struct vop_read_pgcache_args *v) if (object == NULL) goto out_smr; - MPASS((object->flags & (OBJ_ANON | OBJ_DEAD | OBJ_TMPFS_NODE)) == - OBJ_TMPFS_NODE); + MPASS(object->type == OBJT_SWAP_TMPFS); + MPASS((object->flags & (OBJ_ANON | OBJ_DEAD | OBJ_SWAP)) == + OBJ_SWAP); if (!VN_IS_DOOMED(vp)) { /* size cannot become shorter due to rangelock. */ size = node->tn_size; diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index ec37a26d523d..0a91001ad44c 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -418,6 +418,9 @@ static uma_zone_t swpctrie_zone; static vm_object_t swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t offset, struct ucred *); +static vm_object_t + swap_tmpfs_pager_alloc(void *handle, vm_ooffset_t size, + vm_prot_t prot, vm_ooffset_t offset, struct ucred *); static void swap_pager_dealloc(vm_object_t object); static int swap_pager_getpages(vm_object_t, vm_page_t *, int, int *, int *); @@ -433,9 +436,7 @@ static void swap_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); static void swap_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); -static void swap_pager_set_writeable_dirty(vm_object_t object); -static bool swap_pager_mightbedirty(vm_object_t object); -static void swap_pager_getvp(vm_object_t object, struct vnode **vpp, +static void swap_tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp); static void swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size); @@ -451,9 +452,22 @@ struct pagerops swappagerops = { .pgo_pageunswapped = swap_pager_unswapped, /* remove swap related to page */ .pgo_update_writecount = swap_pager_update_writecount, .pgo_release_writecount = swap_pager_release_writecount, - .pgo_set_writeable_dirty = swap_pager_set_writeable_dirty, - .pgo_mightbedirty = swap_pager_mightbedirty, - .pgo_getvp = swap_pager_getvp, + .pgo_freespace = swap_pager_freespace, +}; + +struct pagerops swaptmpfspagerops = { + .pgo_alloc = swap_tmpfs_pager_alloc, + .pgo_dealloc = swap_pager_dealloc, + .pgo_getpages = swap_pager_getpages, + .pgo_getpages_async = swap_pager_getpages_async, + .pgo_putpages = swap_pager_putpages, + .pgo_haspage = swap_pager_haspage, + .pgo_pageunswapped = swap_pager_unswapped, + .pgo_update_writecount = swap_pager_update_writecount, + .pgo_release_writecount = swap_pager_release_writecount, + .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, + .pgo_mightbedirty = vm_object_mightbedirty_, + .pgo_getvp = swap_tmpfs_pager_getvp, .pgo_freespace = swap_pager_freespace, }; @@ -665,8 +679,8 @@ swap_pager_swap_init(void) } static vm_object_t -swap_pager_alloc_init(void *handle, struct ucred *cred, vm_ooffset_t size, - vm_ooffset_t offset) +swap_pager_alloc_init(objtype_t otype, void *handle, struct ucred *cred, + vm_ooffset_t size, vm_ooffset_t offset) { vm_object_t object; @@ -681,7 +695,7 @@ swap_pager_alloc_init(void *handle, struct ucred *cred, vm_ooffset_t size, * vm_object_allocate() to ensure the correct order of * visibility to other threads. */ - object = vm_object_allocate(OBJT_SWAP, OFF_TO_IDX(offset + + object = vm_object_allocate(otype, OFF_TO_IDX(offset + PAGE_MASK + size)); object->un_pager.swp.writemappings = 0; @@ -720,8 +734,8 @@ swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, sx_xlock(&sw_alloc_sx); object = vm_pager_object_lookup(NOBJLIST(handle), handle); if (object == NULL) { - object = swap_pager_alloc_init(handle, cred, size, - offset); + object = swap_pager_alloc_init(OBJT_SWAP, handle, cred, + size, offset); if (object != NULL) { TAILQ_INSERT_TAIL(NOBJLIST(object->handle), object, pager_object_list); @@ -729,11 +743,24 @@ swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, } sx_xunlock(&sw_alloc_sx); } else { - object = swap_pager_alloc_init(handle, cred, size, offset); + object = swap_pager_alloc_init(OBJT_SWAP, handle, cred, + size, offset); } return (object); } +static vm_object_t +swap_tmpfs_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t offset, struct ucred *cred) +{ + vm_object_t object; + + MPASS(handle == NULL); + object = swap_pager_alloc_init(OBJT_SWAP_TMPFS, handle, cred, + size, offset); + return (object); +} + /* * SWAP_PAGER_DEALLOC() - remove swap metadata from object * @@ -775,6 +802,7 @@ swap_pager_dealloc(vm_object_t object) swp_pager_meta_free_all(object); object->handle = NULL; object->type = OBJT_DEAD; + vm_object_clear_flag(object, OBJ_SWAP); } /************************************************************************ @@ -1003,9 +1031,9 @@ swp_pager_xfer_source(vm_object_t srcobject, vm_object_t dstobject, { daddr_t dstaddr; - KASSERT(srcobject->type == OBJT_SWAP, + KASSERT((srcobject->flags & OBJ_SWAP) != 0, ("%s: Srcobject not swappable", __func__)); - if (dstobject->type == OBJT_SWAP && + if ((dstobject->flags & OBJ_SWAP) != 0 && swp_pager_meta_lookup(dstobject, pindex) != SWAPBLK_NONE) { /* Caller should destroy the source block. */ return (false); @@ -1086,6 +1114,7 @@ swap_pager_copy(vm_object_t srcobject, vm_object_t dstobject, * queues. */ srcobject->type = OBJT_DEFAULT; + vm_object_clear_flag(srcobject, OBJ_SWAP); } } @@ -1107,7 +1136,7 @@ swap_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, int i; VM_OBJECT_ASSERT_LOCKED(object); - KASSERT(object->type == OBJT_SWAP, + KASSERT((object->flags & OBJ_SWAP) != 0, ("%s: object not swappable", __func__)); /* @@ -1203,7 +1232,7 @@ swap_pager_unswapped(vm_page_t m) * The meta data only exists if the object is OBJT_SWAP * and even then might not be allocated yet. */ - KASSERT(m->object->type == OBJT_SWAP, + KASSERT((m->object->flags & OBJ_SWAP) != 0, ("Free object not swappable")); sb = SWAP_PCTRIE_LOOKUP(&m->object->un_pager.swp.swp_blks, @@ -1241,7 +1270,7 @@ swap_pager_getpages_locked(vm_object_t object, vm_page_t *ma, int count, VM_OBJECT_ASSERT_WLOCKED(object); reqcount = count; - KASSERT(object->type == OBJT_SWAP, + KASSERT((object->flags & OBJ_SWAP) != 0, ("%s: object not swappable", __func__)); if (!swap_pager_haspage(object, ma[0]->pindex, &maxbehind, &maxahead)) { VM_OBJECT_WUNLOCK(object); @@ -1475,7 +1504,7 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count, * * Turn object into OBJT_SWAP. Force sync if not a pageout process. */ - if (object->type != OBJT_SWAP) { + if ((object->flags & OBJ_SWAP) == 0) { addr = swp_pager_meta_build(object, 0, SWAPBLK_NONE); KASSERT(addr == SWAPBLK_NONE, ("unexpected object swap block")); @@ -1780,7 +1809,7 @@ swap_pager_swapped_pages(vm_object_t object) int i; VM_OBJECT_ASSERT_LOCKED(object); - if (object->type != OBJT_SWAP) + if ((object->flags & OBJ_SWAP) == 0) return (0); for (res = 0, pi = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( @@ -1809,7 +1838,7 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object_t object) daddr_t blk; int i, nv, rahead, rv; - KASSERT(object->type == OBJT_SWAP, + KASSERT((object->flags & OBJ_SWAP) != 0, ("%s: Object not swappable", __func__)); for (pi = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( @@ -1917,7 +1946,7 @@ swap_pager_swapoff(struct swdevt *sp) full_rescan: mtx_lock(&vm_object_list_mtx); TAILQ_FOREACH(object, &vm_object_list, object_list) { - if (object->type != OBJT_SWAP) + if ((object->flags & OBJ_SWAP) == 0) continue; mtx_unlock(&vm_object_list_mtx); /* Depends on type-stability. */ @@ -1936,7 +1965,7 @@ full_rescan: * dead. */ atomic_thread_fence_acq(); - if (object->type != OBJT_SWAP) + if ((object->flags & OBJ_SWAP) == 0) goto next_obj; swap_pager_swapoff_object(sp, object); @@ -2031,7 +2060,7 @@ swp_pager_meta_build(vm_object_t object, vm_pindex_t pindex, daddr_t swapblk) /* * Convert default object to swap object if necessary */ - if (object->type != OBJT_SWAP) { + if ((object->flags & OBJ_SWAP) == 0) { pctrie_init(&object->un_pager.swp.swp_blks); /* @@ -2041,6 +2070,7 @@ swp_pager_meta_build(vm_object_t object, vm_pindex_t pindex, daddr_t swapblk) atomic_thread_fence_rel(); object->type = OBJT_SWAP; + vm_object_set_flag(object, OBJ_SWAP); object->un_pager.swp.writemappings = 0; KASSERT((object->flags & OBJ_ANON) != 0 || object->handle == NULL, @@ -2149,7 +2179,7 @@ swp_pager_meta_transfer(vm_object_t srcobject, vm_object_t dstobject, int i, limit, start; VM_OBJECT_ASSERT_WLOCKED(srcobject); - if (srcobject->type != OBJT_SWAP || count == 0) + if ((srcobject->flags & OBJ_SWAP) == 0 || count == 0) return; swp_pager_init_freerange(&s_free, &n_free); @@ -2216,7 +2246,7 @@ swp_pager_meta_free_all(vm_object_t object) int i; VM_OBJECT_ASSERT_WLOCKED(object); - if (object->type != OBJT_SWAP) + if ((object->flags & OBJ_SWAP) == 0) return; swp_pager_init_freerange(&s_free, &n_free); @@ -2256,7 +2286,7 @@ swp_pager_meta_lookup(vm_object_t object, vm_pindex_t pindex) * The meta data only exists if the object is OBJT_SWAP * and even then might not be allocated yet. */ - KASSERT(object->type == OBJT_SWAP, + KASSERT((object->flags & OBJ_SWAP) != 0, ("Lookup object not swappable")); sb = SWAP_PCTRIE_LOOKUP(&object->un_pager.swp.swp_blks, @@ -2280,7 +2310,7 @@ swap_pager_find_least(vm_object_t object, vm_pindex_t pindex) int i; VM_OBJECT_ASSERT_LOCKED(object); - if (object->type != OBJT_SWAP) + if ((object->flags & OBJ_SWAP) == 0) return (object->size); sb = SWAP_PCTRIE_LOOKUP_GE(&object->un_pager.swp.swp_blks, @@ -2735,10 +2765,10 @@ vmspace_swap_count(struct vmspace *vmspace) if ((cur->eflags & MAP_ENTRY_IS_SUB_MAP) != 0) continue; object = cur->object.vm_object; - if (object == NULL || object->type != OBJT_SWAP) + if (object == NULL || (object->flags & OBJ_SWAP) == 0) continue; VM_OBJECT_RLOCK(object); - if (object->type != OBJT_SWAP) + if ((object->flags & OBJ_SWAP) == 0) goto unlock; pi = OFF_TO_IDX(cur->offset); e = pi + OFF_TO_IDX(cur->end - cur->start); @@ -3133,32 +3163,14 @@ swap_pager_release_writecount(vm_object_t object, vm_offset_t start, } static void -swap_pager_set_writeable_dirty(vm_object_t object) -{ - if ((object->flags & OBJ_TMPFS_NODE) != 0) - vm_object_set_writeable_dirty_(object); -} - -static bool -swap_pager_mightbedirty(vm_object_t object) -{ - if ((object->flags & OBJ_TMPFS_NODE) != 0) - return (vm_object_mightbedirty_(object)); - return (false); -} - -static void -swap_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) +swap_tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) { struct vnode *vp; - KASSERT((object->flags & OBJ_TMPFS_NODE) != 0, - ("swap_pager_getvp: swap and !TMPFS obj %p", object)); - /* - * Tmpfs VREG node, which was reclaimed, has - * OBJ_TMPFS_NODE flag set, but not OBJ_TMPFS. In - * this case there is no v_writecount to adjust. + * Tmpfs VREG node, which was reclaimed, has OBJT_SWAP_TMPFS + * type, but not OBJ_TMPFS flag. In this case there is no + * v_writecount to adjust. */ if (vp_heldp != NULL) VM_OBJECT_RLOCK(object); diff --git a/sys/vm/vm.h b/sys/vm/vm.h index 678e6eb2d2d8..2aae787d7f58 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -97,6 +97,7 @@ enum obj_type { OBJT_DEAD, OBJT_SG, OBJT_MGTDEVICE, + OBJT_SWAP_TMPFS, }; typedef u_char objtype_t; diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index c9f3cdf2e4f6..5cfe7d1ae315 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1947,7 +1947,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map, crhold(dst_object->cred); *fork_charge += dst_object->charge; } else if ((dst_object->type == OBJT_DEFAULT || - dst_object->type == OBJT_SWAP) && + (dst_object->flags & OBJ_SWAP) != 0) && dst_object->cred == NULL) { KASSERT(dst_entry->cred != NULL, ("no cred for entry %p", dst_entry)); diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 815775ee9740..d870fe3507fd 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -2826,10 +2826,12 @@ again: continue; } - if (obj->type != OBJT_DEFAULT && obj->type != OBJT_SWAP) + if (obj->type != OBJT_DEFAULT && + (obj->flags & OBJ_SWAP) == 0) continue; VM_OBJECT_WLOCK(obj); - if (obj->type != OBJT_DEFAULT && obj->type != OBJT_SWAP) { + if (obj->type != OBJT_DEFAULT && + (obj->flags & OBJ_SWAP) == 0) { VM_OBJECT_WUNLOCK(obj); continue; } @@ -4140,7 +4142,7 @@ vm_map_copy_entry( size = src_entry->end - src_entry->start; if ((src_object = src_entry->object.vm_object) != NULL) { if (src_object->type == OBJT_DEFAULT || - src_object->type == OBJT_SWAP) { + (src_object->flags & OBJ_SWAP) != 0) { vm_map_copy_swap_object(src_entry, dst_entry, size, fork_charge); /* May have split/collapsed, reload obj. */ diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index ecdcc1272db1..21fe6d82ec6a 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -930,7 +930,7 @@ retry: VM_OBJECT_WLOCK(object); } if (object->type == OBJT_DEFAULT || - object->type == OBJT_SWAP || + (object->flags & OBJ_SWAP) != 0 || object->type == OBJT_VNODE) { pindex = OFF_TO_IDX(current->offset + (addr - current->start)); @@ -1357,7 +1357,8 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize, goto done; } } else { - KASSERT(obj->type == OBJT_DEFAULT || obj->type == OBJT_SWAP, + KASSERT(obj->type == OBJT_DEFAULT || + (obj->flags & OBJ_SWAP) != 0, ("wrong object type")); vm_object_reference(obj); #if VM_NRESERVLEVEL > 0 diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index bbcbad41f10c..1c4e879d82ea 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -240,7 +240,8 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, u_short flags, LIST_INIT(&object->shadow_head); object->type = type; - if (type == OBJT_SWAP) + object->flags = flags; + if ((flags & OBJ_SWAP) != 0) pctrie_init(&object->un_pager.swp.swp_blks); /* @@ -251,7 +252,6 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, u_short flags, atomic_thread_fence_rel(); object->pg_color = 0; - object->flags = flags; object->size = size; object->domain.dr_policy = NULL; object->generation = 1; @@ -337,6 +337,7 @@ vm_object_set_memattr(vm_object_t object, vm_memattr_t memattr) case OBJT_PHYS: case OBJT_SG: case OBJT_SWAP: + case OBJT_SWAP_TMPFS: case OBJT_VNODE: if (!TAILQ_EMPTY(&object->memq)) return (KERN_FAILURE); @@ -421,9 +422,12 @@ vm_object_allocate(objtype_t type, vm_pindex_t size) case OBJT_DEAD: panic("vm_object_allocate: can't create OBJT_DEAD"); case OBJT_DEFAULT: - case OBJT_SWAP: flags = OBJ_COLORED; break; + case OBJT_SWAP: + case OBJT_SWAP_TMPFS: + flags = OBJ_COLORED | OBJ_SWAP; + break; case OBJT_DEVICE: case OBJT_SG: flags = OBJ_FICTITIOUS | OBJ_UNMANAGED; @@ -573,7 +577,7 @@ vm_object_deallocate_anon(vm_object_t backing_object) KASSERT(object != NULL && backing_object->shadow_count == 1, ("vm_object_anon_deallocate: ref_count: %d, shadow_count: %d", backing_object->ref_count, backing_object->shadow_count)); - KASSERT((object->flags & (OBJ_TMPFS_NODE | OBJ_ANON)) == OBJ_ANON, + KASSERT((object->flags & OBJ_ANON) != 0, ("invalid shadow object %p", object)); if (!VM_OBJECT_TRYWLOCK(object)) { @@ -677,7 +681,7 @@ vm_object_deallocate(vm_object_t object) umtx_shm_object_terminated(object); temp = object->backing_object; if (temp != NULL) { - KASSERT((object->flags & OBJ_TMPFS_NODE) == 0, + KASSERT(object->type != OBJT_SWAP_TMPFS, ("shadowed tmpfs v_object 2 %p", object)); vm_object_backing_remove(object); } @@ -958,7 +962,7 @@ vm_object_terminate(vm_object_t object) #endif KASSERT(object->cred == NULL || object->type == OBJT_DEFAULT || - object->type == OBJT_SWAP, + object->type == OBJT_SWAP || object->type == OBJT_SWAP_TMPFS, ("%s: non-swap obj %p has cred", __func__, object)); /* @@ -1627,7 +1631,7 @@ retry: else if (m_busy == NULL) m_busy = m; } - if (orig_object->type == OBJT_SWAP) { + if ((orig_object->flags & OBJ_SWAP) != 0) { /* * swap_pager_copy() can sleep, in which case the orig_object's * and new_object's locks are released and reacquired. @@ -1955,7 +1959,7 @@ vm_object_collapse(vm_object_t object) /* * Move the pager from backing_object to object. */ - if (backing_object->type == OBJT_SWAP) { + if ((backing_object->flags & OBJ_SWAP) != 0) { /* * swap_pager_copy() can sleep, in which case * the backing_object's and object's locks are @@ -2482,9 +2486,9 @@ vm_object_kvme_type(vm_object_t object, struct vnode **vpp) case OBJT_VNODE: return (KVME_TYPE_VNODE); case OBJT_SWAP: - if ((object->flags & OBJ_TMPFS_NODE) != 0) - return (KVME_TYPE_VNODE); return (KVME_TYPE_SWAP); + case OBJT_SWAP_TMPFS: + return (KVME_TYPE_VNODE); case OBJT_DEVICE: return (KVME_TYPE_DEVICE); case OBJT_PHYS: diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index c7bbec0e7a86..749f33ee16c0 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -201,7 +201,7 @@ struct vm_object { #define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */ #define OBJ_SIZEVNLOCK 0x0040 /* lock vnode to check obj size */ #define OBJ_PG_DTOR 0x0080 /* dont reset object, leave that for dtor */ -#define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */ +#define OBJ_SWAP 0x0200 /* object swaps */ #define OBJ_SPLIT 0x0400 /* object is being split */ #define OBJ_COLLAPSING 0x0800 /* Parent of collapse. */ #define OBJ_COLORED 0x1000 /* pg_color is defined */ diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 98391ccecd82..29dfb52af5d3 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2639,7 +2639,7 @@ retry: } /* Don't care: PG_NODUMP, PG_ZERO. */ if (object->type != OBJT_DEFAULT && - object->type != OBJT_SWAP && + (object->flags & OBJ_SWAP) == 0 && object->type != OBJT_VNODE) { run_ext = 0; #if VM_NRESERVLEVEL > 0 @@ -2777,7 +2777,7 @@ vm_page_reclaim_run(int req_class, int domain, u_long npages, vm_page_t m_run, /* Don't care: PG_NODUMP, PG_ZERO. */ if (m->object != object || (object->type != OBJT_DEFAULT && - object->type != OBJT_SWAP && + (object->flags & OBJ_SWAP) == 0 && object->type != OBJT_VNODE)) error = EINVAL; else if (object->memattr != VM_MEMATTR_DEFAULT) diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index e49966102a9c..521fc4ce95f2 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -545,7 +545,7 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen, * clog the laundry and inactive queues. (We will try * paging it out again later.) */ - if (object->type == OBJT_SWAP && + if ((object->flags & OBJ_SWAP) != 0 && pageout_status[i] == VM_PAGER_FAIL) { vm_page_unswappable(mt); numpagedout++; @@ -897,7 +897,7 @@ free_page: vm_page_free(m); VM_CNT_INC(v_dfree); } else if ((object->flags & OBJ_DEAD) == 0) { - if (object->type != OBJT_SWAP && + if ((object->flags & OBJ_SWAP) == 0 && object->type != OBJT_DEFAULT) pageout_ok = true; else if (disable_swap_pageouts) @@ -1890,6 +1890,7 @@ vm_pageout_oom_pagecount(struct vmspace *vmspace) switch (obj->type) { case OBJT_DEFAULT: case OBJT_SWAP: + case OBJT_SWAP_TMPFS: case OBJT_PHYS: case OBJT_VNODE: res += obj->resident_page_count; diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 8be344b7665b..30e84fa00a3e 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -172,6 +172,7 @@ struct pagerops *pagertab[] = { [OBJT_DEAD] = &deadpagerops, [OBJT_SG] = &sgpagerops, [OBJT_MGTDEVICE] = &mgtdevicepagerops, + [OBJT_SWAP_TMPFS] = &swaptmpfspagerops, }; void diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 507123adb454..55d231a73f39 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -95,6 +95,7 @@ extern struct pagerops devicepagerops; extern struct pagerops physpagerops; extern struct pagerops sgpagerops; extern struct pagerops mgtdevicepagerops; +extern struct pagerops swaptmpfspagerops; /* * get/put return values From owner-dev-commits-src-all@freebsd.org Fri May 7 14:08:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A132862F24D; Fri, 7 May 2021 14:08:27 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcC3H2qwyz4fQL; Fri, 7 May 2021 14:08:27 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DE3B846F8; Fri, 7 May 2021 14:08:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147E8Q2M020314; Fri, 7 May 2021 14:08:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147E8Qxi020313; Fri, 7 May 2021 14:08:26 GMT (envelope-from git) Date: Fri, 7 May 2021 14:08:26 GMT Message-Id: <202105071408.147E8Qxi020313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 0d2dfc6fed03 - main - pagertab: use designated initializers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0d2dfc6fed03c36f7c4a9bb2a4223028f3b4431b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 14:08:27 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0d2dfc6fed03c36f7c4a9bb2a4223028f3b4431b commit 0d2dfc6fed03c36f7c4a9bb2a4223028f3b4431b Author: Konstantin Belousov AuthorDate: 2021-05-01 17:20:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 14:08:03 +0000 pagertab: use designated initializers Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30070 --- sys/vm/vm_pager.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 587407a06291..8be344b7665b 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -164,14 +164,14 @@ static struct pagerops deadpagerops = { }; struct pagerops *pagertab[] = { - &defaultpagerops, /* OBJT_DEFAULT */ - &swappagerops, /* OBJT_SWAP */ - &vnodepagerops, /* OBJT_VNODE */ - &devicepagerops, /* OBJT_DEVICE */ - &physpagerops, /* OBJT_PHYS */ - &deadpagerops, /* OBJT_DEAD */ - &sgpagerops, /* OBJT_SG */ - &mgtdevicepagerops, /* OBJT_MGTDEVICE */ + [OBJT_DEFAULT] = &defaultpagerops, + [OBJT_SWAP] = &swappagerops, + [OBJT_VNODE] = &vnodepagerops, + [OBJT_DEVICE] = &devicepagerops, + [OBJT_PHYS] = &physpagerops, + [OBJT_DEAD] = &deadpagerops, + [OBJT_SG] = &sgpagerops, + [OBJT_MGTDEVICE] = &mgtdevicepagerops, }; void From owner-dev-commits-src-all@freebsd.org Fri May 7 14:08:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B80A462F29E; Fri, 7 May 2021 14:08:29 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcC3K1tzvz4fJD; Fri, 7 May 2021 14:08:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2FCB54C87; Fri, 7 May 2021 14:08:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147E8TJG020362; Fri, 7 May 2021 14:08:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147E8TfV020361; Fri, 7 May 2021 14:08:29 GMT (envelope-from git) Date: Fri, 7 May 2021 14:08:29 GMT Message-Id: <202105071408.147E8TfV020361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d474440ab33c - main - Constify vm_pager-related virtual tables. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d474440ab33c683b0e3f55e8e854f055615db6ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 14:08:30 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d474440ab33c683b0e3f55e8e854f055615db6ec commit d474440ab33c683b0e3f55e8e854f055615db6ec Author: Konstantin Belousov AuthorDate: 2021-05-03 21:58:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-07 14:08:03 +0000 Constify vm_pager-related virtual tables. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30070 --- sys/kern/uipc_shm.c | 2 +- sys/vm/default_pager.c | 2 +- sys/vm/device_pager.c | 11 ++++++----- sys/vm/phys_pager.c | 6 +++--- sys/vm/sg_pager.c | 2 +- sys/vm/swap_pager.c | 4 ++-- sys/vm/vm_object.h | 4 ++-- sys/vm/vm_pager.c | 8 ++++---- sys/vm/vm_pager.h | 24 ++++++++++++------------ sys/vm/vnode_pager.c | 2 +- 10 files changed, 33 insertions(+), 32 deletions(-) diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index 88151f1422f9..58c9f8cec239 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -327,7 +327,7 @@ shm_largepage_phys_dtor(vm_object_t object) } } -static struct phys_pager_ops shm_largepage_phys_ops = { +static const struct phys_pager_ops shm_largepage_phys_ops = { .phys_pg_populate = shm_largepage_phys_populate, .phys_pg_haspage = shm_largepage_phys_haspage, .phys_pg_ctor = shm_largepage_phys_ctor, diff --git a/sys/vm/default_pager.c b/sys/vm/default_pager.c index 057dbe895050..758012692a48 100644 --- a/sys/vm/default_pager.c +++ b/sys/vm/default_pager.c @@ -70,7 +70,7 @@ static boolean_t default_pager_haspage(vm_object_t, vm_pindex_t, int *, * On the first request to page out a page from a default object, the * object is converted to swap pager type. */ -struct pagerops defaultpagerops = { +const struct pagerops defaultpagerops = { .pgo_alloc = default_pager_alloc, .pgo_dealloc = default_pager_dealloc, .pgo_getpages = default_pager_getpages, diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index 40b32e9bad74..25affb114a47 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -74,7 +74,7 @@ static struct pagerlst dev_pager_object_list; /* protect list manipulation */ static struct mtx dev_pager_mtx; -struct pagerops devicepagerops = { +const struct pagerops devicepagerops = { .pgo_init = dev_pager_init, .pgo_alloc = dev_pager_alloc, .pgo_dealloc = dev_pager_dealloc, @@ -83,7 +83,7 @@ struct pagerops devicepagerops = { .pgo_haspage = dev_pager_haspage, }; -struct pagerops mgtdevicepagerops = { +const struct pagerops mgtdevicepagerops = { .pgo_alloc = dev_pager_alloc, .pgo_dealloc = dev_pager_dealloc, .pgo_getpages = dev_pager_getpages, @@ -98,7 +98,7 @@ static void old_dev_pager_dtor(void *handle); static int old_dev_pager_fault(vm_object_t object, vm_ooffset_t offset, int prot, vm_page_t *mres); -static struct cdev_pager_ops old_dev_pager_ops = { +static const struct cdev_pager_ops old_dev_pager_ops = { .cdev_pg_ctor = old_dev_pager_ctor, .cdev_pg_dtor = old_dev_pager_dtor, .cdev_pg_fault = old_dev_pager_fault @@ -124,8 +124,9 @@ cdev_pager_lookup(void *handle) } vm_object_t -cdev_pager_allocate(void *handle, enum obj_type tp, struct cdev_pager_ops *ops, - vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred) +cdev_pager_allocate(void *handle, enum obj_type tp, + const struct cdev_pager_ops *ops, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t foff, struct ucred *cred) { vm_object_t object, object1; vm_pindex_t pindex; diff --git a/sys/vm/phys_pager.c b/sys/vm/phys_pager.c index 19a8b97a3d56..af7b10701b16 100644 --- a/sys/vm/phys_pager.c +++ b/sys/vm/phys_pager.c @@ -57,7 +57,7 @@ static int default_phys_pager_populate(vm_object_t object, vm_pindex_t pidx, int fault_type, vm_prot_t max_prot, vm_pindex_t *first, vm_pindex_t *last); static boolean_t default_phys_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, int *after); -struct phys_pager_ops default_phys_pg_ops = { +const struct phys_pager_ops default_phys_pg_ops = { .phys_pg_getpages = default_phys_pager_getpages, .phys_pg_populate = default_phys_pager_populate, .phys_pg_haspage = default_phys_pager_haspage, @@ -74,7 +74,7 @@ phys_pager_init(void) } vm_object_t -phys_pager_allocate(void *handle, struct phys_pager_ops *ops, void *data, +phys_pager_allocate(void *handle, const struct phys_pager_ops *ops, void *data, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred) { vm_object_t object, object1; @@ -298,7 +298,7 @@ phys_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, before, after)); } -struct pagerops physpagerops = { +const struct pagerops physpagerops = { .pgo_init = phys_pager_init, .pgo_alloc = phys_pager_alloc, .pgo_dealloc = phys_pager_dealloc, diff --git a/sys/vm/sg_pager.c b/sys/vm/sg_pager.c index 2145f487ec34..9b3e60bc170a 100644 --- a/sys/vm/sg_pager.c +++ b/sys/vm/sg_pager.c @@ -59,7 +59,7 @@ static void sg_pager_putpages(vm_object_t, vm_page_t *, int, static boolean_t sg_pager_haspage(vm_object_t, vm_pindex_t, int *, int *); -struct pagerops sgpagerops = { +const struct pagerops sgpagerops = { .pgo_alloc = sg_pager_alloc, .pgo_dealloc = sg_pager_dealloc, .pgo_getpages = sg_pager_getpages, diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 0a91001ad44c..b0b0b41d2148 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -441,7 +441,7 @@ static void swap_tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, static void swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size); -struct pagerops swappagerops = { +const struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ .pgo_alloc = swap_pager_alloc, /* allocate an OBJT_SWAP object */ .pgo_dealloc = swap_pager_dealloc, /* deallocate an OBJT_SWAP object */ @@ -455,7 +455,7 @@ struct pagerops swappagerops = { .pgo_freespace = swap_pager_freespace, }; -struct pagerops swaptmpfspagerops = { +const struct pagerops swaptmpfspagerops = { .pgo_alloc = swap_tmpfs_pager_alloc, .pgo_dealloc = swap_pager_dealloc, .pgo_getpages = swap_pager_getpages, diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 749f33ee16c0..0e1ed321255f 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -140,7 +140,7 @@ struct vm_object { */ struct { TAILQ_HEAD(, vm_page) devp_pglist; - struct cdev_pager_ops *ops; + const struct cdev_pager_ops *ops; struct cdev *dev; } devp; @@ -178,7 +178,7 @@ struct vm_object { * Phys pager */ struct { - struct phys_pager_ops *ops; + const struct phys_pager_ops *ops; union { void *data_ptr; uintptr_t data_val; diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 30e84fa00a3e..240847903f62 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -154,7 +154,7 @@ dead_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) */ } -static struct pagerops deadpagerops = { +static const struct pagerops deadpagerops = { .pgo_alloc = dead_pager_alloc, .pgo_dealloc = dead_pager_dealloc, .pgo_getpages = dead_pager_getpages, @@ -163,7 +163,7 @@ static struct pagerops deadpagerops = { .pgo_getvp = dead_pager_getvp, }; -struct pagerops *pagertab[] = { +const struct pagerops *pagertab[] __read_mostly = { [OBJT_DEFAULT] = &defaultpagerops, [OBJT_SWAP] = &swappagerops, [OBJT_VNODE] = &vnodepagerops, @@ -178,7 +178,7 @@ struct pagerops *pagertab[] = { void vm_pager_init(void) { - struct pagerops **pgops; + const struct pagerops **pgops; /* * Initialize known pagers @@ -244,7 +244,7 @@ vm_pager_allocate(objtype_t type, void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t off, struct ucred *cred) { vm_object_t ret; - struct pagerops *ops; + const struct pagerops *ops; ops = pagertab[type]; if (ops) diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 55d231a73f39..68c5fe42351e 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -88,14 +88,14 @@ struct pagerops { pgo_freespace_t *pgo_freespace; }; -extern struct pagerops defaultpagerops; -extern struct pagerops swappagerops; -extern struct pagerops vnodepagerops; -extern struct pagerops devicepagerops; -extern struct pagerops physpagerops; -extern struct pagerops sgpagerops; -extern struct pagerops mgtdevicepagerops; -extern struct pagerops swaptmpfspagerops; +extern const struct pagerops defaultpagerops; +extern const struct pagerops swappagerops; +extern const struct pagerops vnodepagerops; +extern const struct pagerops devicepagerops; +extern const struct pagerops physpagerops; +extern const struct pagerops sgpagerops; +extern const struct pagerops mgtdevicepagerops; +extern const struct pagerops swaptmpfspagerops; /* * get/put return values @@ -120,7 +120,7 @@ extern struct pagerops swaptmpfspagerops; #ifdef _KERNEL -extern struct pagerops *pagertab[]; +extern const struct pagerops *pagertab[] __read_mostly; extern struct mtx_padalign pbuf_mtx; /* @@ -260,7 +260,7 @@ struct cdev_pager_ops { }; vm_object_t cdev_pager_allocate(void *handle, enum obj_type tp, - struct cdev_pager_ops *ops, vm_ooffset_t size, vm_prot_t prot, + const struct cdev_pager_ops *ops, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred); vm_object_t cdev_pager_lookup(void *handle); void cdev_pager_free_page(vm_object_t object, vm_page_t m); @@ -277,8 +277,8 @@ struct phys_pager_ops { vm_ooffset_t foff, struct ucred *cred); void (*phys_pg_dtor)(vm_object_t vm_obj); }; -extern struct phys_pager_ops default_phys_pg_ops; -vm_object_t phys_pager_allocate(void *handle, struct phys_pager_ops *ops, +extern const struct phys_pager_ops default_phys_pg_ops; +vm_object_t phys_pager_allocate(void *handle, const struct phys_pager_ops *ops, void *data, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred); diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 3d8288f7e72f..fb0b4068183b 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -107,7 +107,7 @@ static void vnode_pager_release_writecount(vm_object_t, vm_offset_t, vm_offset_t); static void vnode_pager_getvp(vm_object_t, struct vnode **, bool *); -struct pagerops vnodepagerops = { +const struct pagerops vnodepagerops = { .pgo_alloc = vnode_pager_alloc, .pgo_dealloc = vnode_pager_dealloc, .pgo_getpages = vnode_pager_getpages, From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CB15630EEF; Fri, 7 May 2021 15:25:35 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmH35r6z4k1V; Fri, 7 May 2021 15:25:35 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5D3B8576F; Fri, 7 May 2021 15:25:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPZdw025798; Fri, 7 May 2021 15:25:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPZQm025797; Fri, 7 May 2021 15:25:35 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:35 GMT Message-Id: <202105071525.147FPZQm025797@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 95a06e369e5d - stable/13 - pf: Remove unused variable rt_listid from struct pf_krule MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 95a06e369e5d995e235a4bf45f308770360df801 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:35 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=95a06e369e5d995e235a4bf45f308770360df801 commit 95a06e369e5d995e235a4bf45f308770360df801 Author: Kristof Provost AuthorDate: 2021-04-08 09:08:33 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:40 +0000 pf: Remove unused variable rt_listid from struct pf_krule Reviewed by: donner MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29639 (cherry picked from commit 4967f672ef3095300fe74a9d1ae873d0897cc0a5) --- sys/net/pfvar.h | 1 - sys/netpfil/pf/pf_ioctl.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 2039e3277321..17f6020513bd 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -356,7 +356,6 @@ struct pf_krule { } max_src_conn_rate; u_int32_t qid; u_int32_t pqid; - u_int32_t rt_listid; u_int32_t nr; u_int32_t prob; uid_t cuid; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 3161c6b1f7c9..8ac534e0d58b 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1546,7 +1546,6 @@ pf_krule_to_rule(const struct pf_krule *krule, struct pf_rule *rule) rule->max_src_conn_rate.seconds = krule->max_src_conn_rate.seconds; rule->qid = krule->qid; rule->pqid = krule->pqid; - rule->rt_listid = krule->rt_listid; rule->nr = krule->nr; rule->prob = krule->prob; rule->cuid = krule->cuid; @@ -1680,7 +1679,6 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) krule->max_src_conn_rate.seconds = rule->max_src_conn_rate.seconds; krule->qid = rule->qid; krule->pqid = rule->pqid; - krule->rt_listid = rule->rt_listid; krule->nr = rule->nr; krule->prob = rule->prob; krule->cuid = rule->cuid; From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C7F2630EF0; Fri, 7 May 2021 15:25:36 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmJ3vjFz4jbf; Fri, 7 May 2021 15:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 771B25C88; Fri, 7 May 2021 15:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPaME025844; Fri, 7 May 2021 15:25:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPatE025837; Fri, 7 May 2021 15:25:36 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:36 GMT Message-Id: <202105071525.147FPatE025837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: f9b057eaf625 - stable/13 - pf: Introduce nvlist variant of DIOCADDRULE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f9b057eaf625c401e05760ce954830b1f12089ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:36 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f9b057eaf625c401e05760ce954830b1f12089ba commit f9b057eaf625c401e05760ce954830b1f12089ba Author: Kristof Provost AuthorDate: 2021-03-11 15:21:23 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:41 +0000 pf: Introduce nvlist variant of DIOCADDRULE This will make future extensions of the API much easier. The intent is to remove support for DIOCADDRULE in FreeBSD 14. Reviewed by: markj (previous version), glebius (previous version) MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29557 (cherry picked from commit 5c62eded5a11ebdb1d57134d923596e2b04e9466) --- sys/conf/files | 1 + sys/modules/pf/Makefile | 2 +- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf.h | 6 + sys/netpfil/pf/pf_ioctl.c | 647 ++++++++++++++++++++++++++++++++++++---------- sys/netpfil/pf/pf_nv.c | 127 +++++++++ sys/netpfil/pf/pf_nv.h | 53 ++++ 7 files changed, 697 insertions(+), 140 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 9ec7292a741b..161b70880309 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4523,6 +4523,7 @@ netpfil/pf/pf_if.c optional pf inet netpfil/pf/pf_ioctl.c optional pf inet netpfil/pf/pf_lb.c optional pf inet netpfil/pf/pf_norm.c optional pf inet +netpfil/pf/pf_nv.c optional pf inet netpfil/pf/pf_osfp.c optional pf inet netpfil/pf/pf_ruleset.c optional pf inet netpfil/pf/pf_table.c optional pf inet diff --git a/sys/modules/pf/Makefile b/sys/modules/pf/Makefile index 148b64c02a9f..7293b30cda9d 100644 --- a/sys/modules/pf/Makefile +++ b/sys/modules/pf/Makefile @@ -4,7 +4,7 @@ KMOD= pf SRCS= pf.c pf_if.c pf_lb.c pf_osfp.c pf_ioctl.c pf_norm.c pf_table.c \ - pf_ruleset.c in4_cksum.c \ + pf_ruleset.c pf_nv.c in4_cksum.c \ bus_if.h device_if.h \ opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_sctp.h opt_global.h diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 17f6020513bd..584724b88b13 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1228,6 +1228,7 @@ struct pfioc_iface { #define DIOCSTART _IO ('D', 1) #define DIOCSTOP _IO ('D', 2) #define DIOCADDRULE _IOWR('D', 4, struct pfioc_rule) +#define DIOCADDRULENV _IOWR('D', 4, struct pfioc_nv) #define DIOCGETRULES _IOWR('D', 6, struct pfioc_rule) #define DIOCGETRULE _IOWR('D', 7, struct pfioc_rule) /* XXX cut 8 - 17 */ diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 511c60f5abd1..bc6cd92ae7b8 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -187,6 +187,12 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define PF_TABLE_NAME_SIZE 32 #define PF_QNAME_SIZE 64 +struct pfioc_nv { + void *data; + size_t len; /* The length of the nvlist data. */ + size_t size; /* The total size of the data buffer. */ +}; + struct pf_rule; /* keep synced with pfi_kif, used in RB_FIND */ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 8ac534e0d58b..87a52dd41542 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -82,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef INET6 #include @@ -1622,6 +1624,294 @@ pf_check_rule_addr(const struct pf_rule_addr *addr) return (0); } +static int +pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *paddr) +{ + return (pf_nvbinary(nvl, "addr", paddr, sizeof(*paddr))); +} + +static int +pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_kpool *kpool) +{ + int error = 0; + + bzero(kpool, sizeof(*kpool)); + + PFNV_CHK(pf_nvbinary(nvl, "key", &kpool->key, sizeof(kpool->key))); + + if (nvlist_exists_nvlist(nvl, "counter")) { + PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "counter"), + &kpool->counter)); + } + + PFNV_CHK(pf_nvint(nvl, "tblidx", &kpool->tblidx)); + PFNV_CHK(pf_nvuint16_array(nvl, "proxy_port", kpool->proxy_port, 2, + NULL)); + PFNV_CHK(pf_nvuint8(nvl, "opts", &kpool->opts)); + +errout: + return (error); +} + +static int +pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) +{ + int error = 0; + + bzero(addr, sizeof(*addr)); + + PFNV_CHK(pf_nvuint8(nvl, "type", &addr->type)); + PFNV_CHK(pf_nvuint8(nvl, "iflags", &addr->iflags)); + PFNV_CHK(pf_nvstring(nvl, "ifname", addr->v.ifname, + sizeof(addr->v.ifname))); + PFNV_CHK(pf_nvstring(nvl, "tblname", addr->v.tblname, + sizeof(addr->v.tblname))); + + if (! nvlist_exists_nvlist(nvl, "addr")) + return (EINVAL); + PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), + &addr->v.a.addr)); + + if (! nvlist_exists_nvlist(nvl, "mask")) + return (EINVAL); + PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "mask"), + &addr->v.a.mask)); + + switch (addr->type) { + case PF_ADDR_DYNIFTL: + case PF_ADDR_TABLE: + case PF_ADDR_RANGE: + case PF_ADDR_ADDRMASK: + case PF_ADDR_NOROUTE: + case PF_ADDR_URPFFAILED: + break; + default: + return (EINVAL); + } + +errout: + return (error); +} + +static int +pf_validate_op(uint8_t op) +{ + switch (op) { + case PF_OP_NONE: + case PF_OP_IRG: + case PF_OP_EQ: + case PF_OP_NE: + case PF_OP_LT: + case PF_OP_LE: + case PF_OP_GT: + case PF_OP_GE: + case PF_OP_XRG: + case PF_OP_RRG: + break; + default: + return (EINVAL); + } + + return (0); +} + +static int +pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) +{ + int error = 0; + + if (! nvlist_exists_nvlist(nvl, "addr")) + return (EINVAL); + + PFNV_CHK(pf_nvaddr_wrap_to_addr_wrap(nvlist_get_nvlist(nvl, "addr"), + &addr->addr)); + PFNV_CHK(pf_nvuint16_array(nvl, "port", addr->port, 2, NULL)); + PFNV_CHK(pf_nvuint8(nvl, "neg", &addr->neg)); + PFNV_CHK(pf_nvuint8(nvl, "port_op", &addr->port_op)); + + PFNV_CHK(pf_validate_op(addr->port_op)); + +errout: + return (error); +} + +static int +pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) +{ + int error = 0; + + bzero(uid, sizeof(*uid)); + + PFNV_CHK(pf_nvuint32_array(nvl, "uid", uid->uid, 2, NULL)); + PFNV_CHK(pf_nvuint8(nvl, "op", &uid->op)); + + PFNV_CHK(pf_validate_op(uid->op)); + +errout: + return (error); +} + +static int +pf_nvrule_gid_to_rule_gid(const nvlist_t *nvl, struct pf_rule_gid *gid) +{ + /* Cheat a little. These stucts are the same, other than the name of + * the first field. */ + return (pf_nvrule_uid_to_rule_uid(nvl, (struct pf_rule_uid *)gid)); +} + +static int +pf_nvrule_to_krule(const nvlist_t *nvl, struct pf_krule **prule) +{ + struct pf_krule *rule; + int error = 0; + + rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK | M_ZERO); + + PFNV_CHK(pf_nvuint32(nvl, "nr", &rule->nr)); + + if (! nvlist_exists_nvlist(nvl, "src")) { + error = EINVAL; + goto errout; + } + error = pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "src"), + &rule->src); + if (error != 0) + goto errout; + + if (! nvlist_exists_nvlist(nvl, "dst")) { + error = EINVAL; + goto errout; + } + PFNV_CHK(pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "dst"), + &rule->dst)); + + PFNV_CHK(pf_nvstring(nvl, "label", rule->label, sizeof(rule->label))); + PFNV_CHK(pf_nvstring(nvl, "ifname", rule->ifname, + sizeof(rule->ifname))); + PFNV_CHK(pf_nvstring(nvl, "qname", rule->qname, sizeof(rule->qname))); + PFNV_CHK(pf_nvstring(nvl, "pqname", rule->pqname, + sizeof(rule->pqname))); + PFNV_CHK(pf_nvstring(nvl, "tagname", rule->tagname, + sizeof(rule->tagname))); + PFNV_CHK(pf_nvstring(nvl, "match_tagname", rule->match_tagname, + sizeof(rule->match_tagname))); + PFNV_CHK(pf_nvstring(nvl, "overload_tblname", rule->overload_tblname, + sizeof(rule->overload_tblname))); + + if (! nvlist_exists_nvlist(nvl, "rpool")) { + error = EINVAL; + goto errout; + } + PFNV_CHK(pf_nvpool_to_pool(nvlist_get_nvlist(nvl, "rpool"), + &rule->rpool)); + + PFNV_CHK(pf_nvuint32(nvl, "os_fingerprint", &rule->os_fingerprint)); + + PFNV_CHK(pf_nvint(nvl, "rtableid", &rule->rtableid)); + PFNV_CHK(pf_nvuint32_array(nvl, "timeout", rule->timeout, PFTM_MAX, NULL)); + PFNV_CHK(pf_nvuint32(nvl, "max_states", &rule->max_states)); + PFNV_CHK(pf_nvuint32(nvl, "max_src_nodes", &rule->max_src_nodes)); + PFNV_CHK(pf_nvuint32(nvl, "max_src_states", &rule->max_src_states)); + PFNV_CHK(pf_nvuint32(nvl, "max_src_conn", &rule->max_src_conn)); + PFNV_CHK(pf_nvuint32(nvl, "max_src_conn_rate.limit", + &rule->max_src_conn_rate.limit)); + PFNV_CHK(pf_nvuint32(nvl, "max_src_conn_rate.seconds", + &rule->max_src_conn_rate.seconds)); + PFNV_CHK(pf_nvuint32(nvl, "prob", &rule->prob)); + PFNV_CHK(pf_nvuint32(nvl, "cuid", &rule->cuid)); + PFNV_CHK(pf_nvuint32(nvl, "cpid", &rule->cpid)); + + PFNV_CHK(pf_nvuint16(nvl, "return_icmp", &rule->return_icmp)); + PFNV_CHK(pf_nvuint16(nvl, "return_icmp6", &rule->return_icmp6)); + + PFNV_CHK(pf_nvuint16(nvl, "max_mss", &rule->max_mss)); + PFNV_CHK(pf_nvuint16(nvl, "scrub_flags", &rule->scrub_flags)); + + if (! nvlist_exists_nvlist(nvl, "uid")) { + error = EINVAL; + goto errout; + } + PFNV_CHK(pf_nvrule_uid_to_rule_uid(nvlist_get_nvlist(nvl, "uid"), + &rule->uid)); + + if (! nvlist_exists_nvlist(nvl, "gid")) { + error = EINVAL; + goto errout; + } + PFNV_CHK(pf_nvrule_gid_to_rule_gid(nvlist_get_nvlist(nvl, "gid"), + &rule->gid)); + + PFNV_CHK(pf_nvuint32(nvl, "rule_flag", &rule->rule_flag)); + PFNV_CHK(pf_nvuint8(nvl, "action", &rule->action)); + PFNV_CHK(pf_nvuint8(nvl, "direction", &rule->direction)); + PFNV_CHK(pf_nvuint8(nvl, "log", &rule->log)); + PFNV_CHK(pf_nvuint8(nvl, "logif", &rule->logif)); + PFNV_CHK(pf_nvuint8(nvl, "quick", &rule->quick)); + PFNV_CHK(pf_nvuint8(nvl, "ifnot", &rule->ifnot)); + PFNV_CHK(pf_nvuint8(nvl, "match_tag_not", &rule->match_tag_not)); + PFNV_CHK(pf_nvuint8(nvl, "natpass", &rule->natpass)); + + PFNV_CHK(pf_nvuint8(nvl, "keep_state", &rule->keep_state)); + PFNV_CHK(pf_nvuint8(nvl, "af", &rule->af)); + PFNV_CHK(pf_nvuint8(nvl, "proto", &rule->proto)); + PFNV_CHK(pf_nvuint8(nvl, "type", &rule->type)); + PFNV_CHK(pf_nvuint8(nvl, "code", &rule->code)); + PFNV_CHK(pf_nvuint8(nvl, "flags", &rule->flags)); + PFNV_CHK(pf_nvuint8(nvl, "flagset", &rule->flagset)); + PFNV_CHK(pf_nvuint8(nvl, "min_ttl", &rule->min_ttl)); + PFNV_CHK(pf_nvuint8(nvl, "allow_opts", &rule->allow_opts)); + PFNV_CHK(pf_nvuint8(nvl, "rt", &rule->rt)); + PFNV_CHK(pf_nvuint8(nvl, "return_ttl", &rule->return_ttl)); + PFNV_CHK(pf_nvuint8(nvl, "tos", &rule->tos)); + PFNV_CHK(pf_nvuint8(nvl, "set_tos", &rule->set_tos)); + PFNV_CHK(pf_nvuint8(nvl, "anchor_relative", &rule->anchor_relative)); + PFNV_CHK(pf_nvuint8(nvl, "anchor_wildcard", &rule->anchor_wildcard)); + + PFNV_CHK(pf_nvuint8(nvl, "flush", &rule->flush)); + PFNV_CHK(pf_nvuint8(nvl, "prio", &rule->prio)); + + PFNV_CHK(pf_nvuint8_array(nvl, "set_prio", &rule->prio, 2, NULL)); + + if (nvlist_exists_nvlist(nvl, "divert")) { + const nvlist_t *nvldivert = nvlist_get_nvlist(nvl, "divert"); + + if (! nvlist_exists_nvlist(nvldivert, "addr")) { + error = EINVAL; + goto errout; + } + PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvldivert, "addr"), + &rule->divert.addr)); + PFNV_CHK(pf_nvuint16(nvldivert, "port", &rule->divert.port)); + } + + /* Validation */ +#ifndef INET + if (rule->af == AF_INET) { + error = EAFNOSUPPORT; + goto errout; + } +#endif /* INET */ +#ifndef INET6 + if (rule->af == AF_INET6) { + error = EAFNOSUPPORT; + goto errout; + } +#endif /* INET6 */ + + PFNV_CHK(pf_check_rule_addr(&rule->src)); + PFNV_CHK(pf_check_rule_addr(&rule->dst)); + + *prule = rule; + + return (0); + +errout: + pf_krule_free(rule); + *prule = NULL; + + return (error); +} + static int pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) { @@ -1796,6 +2086,163 @@ relock_DIOCKILLSTATES: return (killed); } +static int +pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, + uint32_t pool_ticket, const char *anchor, const char *anchor_call, + struct thread *td) +{ + struct pf_kruleset *ruleset; + struct pf_krule *tail; + struct pf_kpooladdr *pa; + struct pfi_kkif *kif = NULL; + int rs_num; + int error = 0; + + if ((rule->return_icmp >> 8) > ICMP_MAXTYPE) { + error = EINVAL; + goto errout_unlocked; + } + +#define ERROUT(x) { error = (x); goto errout; } + + if (rule->ifname[0]) + kif = pf_kkif_create(M_WAITOK); + rule->evaluations = counter_u64_alloc(M_WAITOK); + for (int i = 0; i < 2; i++) { + rule->packets[i] = counter_u64_alloc(M_WAITOK); + rule->bytes[i] = counter_u64_alloc(M_WAITOK); + } + rule->states_cur = counter_u64_alloc(M_WAITOK); + rule->states_tot = counter_u64_alloc(M_WAITOK); + rule->src_nodes = counter_u64_alloc(M_WAITOK); + rule->cuid = td->td_ucred->cr_ruid; + rule->cpid = td->td_proc ? td->td_proc->p_pid : 0; + TAILQ_INIT(&rule->rpool.list); + + PF_RULES_WLOCK(); + ruleset = pf_find_kruleset(anchor); + if (ruleset == NULL) + ERROUT(EINVAL); + rs_num = pf_get_ruleset_number(rule->action); + if (rs_num >= PF_RULESET_MAX) + ERROUT(EINVAL); + if (ticket != ruleset->rules[rs_num].inactive.ticket) { + DPFPRINTF(PF_DEBUG_MISC, + ("ticket: %d != [%d]%d\n", ticket, rs_num, + ruleset->rules[rs_num].inactive.ticket)); + ERROUT(EBUSY); + } + if (pool_ticket != V_ticket_pabuf) { + DPFPRINTF(PF_DEBUG_MISC, + ("pool_ticket: %d != %d\n", pool_ticket, + V_ticket_pabuf)); + ERROUT(EBUSY); + } + + tail = TAILQ_LAST(ruleset->rules[rs_num].inactive.ptr, + pf_krulequeue); + if (tail) + rule->nr = tail->nr + 1; + else + rule->nr = 0; + if (rule->ifname[0]) { + rule->kif = pfi_kkif_attach(kif, rule->ifname); + pfi_kkif_ref(rule->kif); + } else + rule->kif = NULL; + + if (rule->rtableid > 0 && rule->rtableid >= rt_numfibs) + error = EBUSY; + +#ifdef ALTQ + /* set queue IDs */ + if (rule->qname[0] != 0) { + if ((rule->qid = pf_qname2qid(rule->qname)) == 0) + error = EBUSY; + else if (rule->pqname[0] != 0) { + if ((rule->pqid = + pf_qname2qid(rule->pqname)) == 0) + error = EBUSY; + } else + rule->pqid = rule->qid; + } +#endif + if (rule->tagname[0]) + if ((rule->tag = pf_tagname2tag(rule->tagname)) == 0) + error = EBUSY; + if (rule->match_tagname[0]) + if ((rule->match_tag = + pf_tagname2tag(rule->match_tagname)) == 0) + error = EBUSY; + if (rule->rt && !rule->direction) + error = EINVAL; + if (!rule->log) + rule->logif = 0; + if (rule->logif >= PFLOGIFS_MAX) + error = EINVAL; + if (pf_addr_setup(ruleset, &rule->src.addr, rule->af)) + error = ENOMEM; + if (pf_addr_setup(ruleset, &rule->dst.addr, rule->af)) + error = ENOMEM; + if (pf_kanchor_setup(rule, ruleset, anchor_call)) + error = EINVAL; + if (rule->scrub_flags & PFSTATE_SETPRIO && + (rule->set_prio[0] > PF_PRIO_MAX || + rule->set_prio[1] > PF_PRIO_MAX)) + error = EINVAL; + TAILQ_FOREACH(pa, &V_pf_pabuf, entries) + if (pa->addr.type == PF_ADDR_TABLE) { + pa->addr.p.tbl = pfr_attach_table(ruleset, + pa->addr.v.tblname); + if (pa->addr.p.tbl == NULL) + error = ENOMEM; + } + + rule->overload_tbl = NULL; + if (rule->overload_tblname[0]) { + if ((rule->overload_tbl = pfr_attach_table(ruleset, + rule->overload_tblname)) == NULL) + error = EINVAL; + else + rule->overload_tbl->pfrkt_flags |= + PFR_TFLAG_ACTIVE; + } + + pf_mv_kpool(&V_pf_pabuf, &rule->rpool.list); + if (((((rule->action == PF_NAT) || (rule->action == PF_RDR) || + (rule->action == PF_BINAT)) && rule->anchor == NULL) || + (rule->rt > PF_NOPFROUTE)) && + (TAILQ_FIRST(&rule->rpool.list) == NULL)) + error = EINVAL; + + if (error) { + pf_free_rule(rule); + rule = NULL; + ERROUT(error); + } + + rule->rpool.cur = TAILQ_FIRST(&rule->rpool.list); + counter_u64_zero(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_zero(rule->packets[i]); + counter_u64_zero(rule->bytes[i]); + } + TAILQ_INSERT_TAIL(ruleset->rules[rs_num].inactive.ptr, + rule, entries); + ruleset->rules[rs_num].inactive.rcount++; + PF_RULES_WUNLOCK(); + + return (0); + +#undef ERROUT +errout: + PF_RULES_WUNLOCK(); +errout_unlocked: + pf_kkif_free(kif); + pf_krule_free(rule); + return (error); +} + static int pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { @@ -1946,161 +2393,83 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td } break; - case DIOCADDRULE: { - struct pfioc_rule *pr = (struct pfioc_rule *)addr; - struct pf_kruleset *ruleset; - struct pf_krule *rule, *tail; - struct pf_kpooladdr *pa; - struct pfi_kkif *kif = NULL; - int rs_num; + case DIOCADDRULENV: { + struct pfioc_nv *nv = (struct pfioc_nv *)addr; + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + struct pf_krule *rule = NULL; + const char *anchor = "", *anchor_call = ""; + uint32_t ticket = 0, pool_ticket = 0; - if (pr->rule.return_icmp >> 8 > ICMP_MAXTYPE) { - error = EINVAL; - break; - } +#define ERROUT(x) do { error = (x); goto DIOCADDRULENV_error; } while (0) - rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK); - error = pf_rule_to_krule(&pr->rule, rule); - if (error != 0) { - free(rule, M_PFRULE); - break; - } + if (nv->len > pf_ioctl_maxcount) + ERROUT(ENOMEM); - if (rule->ifname[0]) - kif = pf_kkif_create(M_WAITOK); - rule->evaluations = counter_u64_alloc(M_WAITOK); - for (int i = 0; i < 2; i++) { - rule->packets[i] = counter_u64_alloc(M_WAITOK); - rule->bytes[i] = counter_u64_alloc(M_WAITOK); - } - rule->states_cur = counter_u64_alloc(M_WAITOK); - rule->states_tot = counter_u64_alloc(M_WAITOK); - rule->src_nodes = counter_u64_alloc(M_WAITOK); - rule->cuid = td->td_ucred->cr_ruid; - rule->cpid = td->td_proc ? td->td_proc->p_pid : 0; - TAILQ_INIT(&rule->rpool.list); -#define ERROUT(x) { error = (x); goto DIOCADDRULE_error; } + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + error = copyin(nv->data, nvlpacked, nv->len); + if (error) + ERROUT(error); - PF_RULES_WLOCK(); - pr->anchor[sizeof(pr->anchor) - 1] = 0; - ruleset = pf_find_kruleset(pr->anchor); - if (ruleset == NULL) + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) + ERROUT(EBADMSG); + + if (! nvlist_exists_number(nvl, "ticket")) ERROUT(EINVAL); - rs_num = pf_get_ruleset_number(pr->rule.action); - if (rs_num >= PF_RULESET_MAX) + ticket = nvlist_get_number(nvl, "ticket"); + + if (! nvlist_exists_number(nvl, "pool_ticket")) ERROUT(EINVAL); - if (pr->ticket != ruleset->rules[rs_num].inactive.ticket) { - DPFPRINTF(PF_DEBUG_MISC, - ("ticket: %d != [%d]%d\n", pr->ticket, rs_num, - ruleset->rules[rs_num].inactive.ticket)); - ERROUT(EBUSY); - } - if (pr->pool_ticket != V_ticket_pabuf) { - DPFPRINTF(PF_DEBUG_MISC, - ("pool_ticket: %d != %d\n", pr->pool_ticket, - V_ticket_pabuf)); - ERROUT(EBUSY); - } + pool_ticket = nvlist_get_number(nvl, "pool_ticket"); - tail = TAILQ_LAST(ruleset->rules[rs_num].inactive.ptr, - pf_krulequeue); - if (tail) - rule->nr = tail->nr + 1; - else - rule->nr = 0; - if (rule->ifname[0]) { - rule->kif = pfi_kkif_attach(kif, rule->ifname); - pfi_kkif_ref(rule->kif); - } else - rule->kif = NULL; + if (! nvlist_exists_nvlist(nvl, "rule")) + ERROUT(EINVAL); - if (rule->rtableid > 0 && rule->rtableid >= rt_numfibs) - error = EBUSY; + error = pf_nvrule_to_krule(nvlist_get_nvlist(nvl, "rule"), + &rule); + if (error) + ERROUT(error); -#ifdef ALTQ - /* set queue IDs */ - if (rule->qname[0] != 0) { - if ((rule->qid = pf_qname2qid(rule->qname)) == 0) - error = EBUSY; - else if (rule->pqname[0] != 0) { - if ((rule->pqid = - pf_qname2qid(rule->pqname)) == 0) - error = EBUSY; - } else - rule->pqid = rule->qid; - } -#endif - if (rule->tagname[0]) - if ((rule->tag = pf_tagname2tag(rule->tagname)) == 0) - error = EBUSY; - if (rule->match_tagname[0]) - if ((rule->match_tag = - pf_tagname2tag(rule->match_tagname)) == 0) - error = EBUSY; - if (rule->rt && !rule->direction) - error = EINVAL; - if (!rule->log) - rule->logif = 0; - if (rule->logif >= PFLOGIFS_MAX) - error = EINVAL; - if (pf_addr_setup(ruleset, &rule->src.addr, rule->af)) - error = ENOMEM; - if (pf_addr_setup(ruleset, &rule->dst.addr, rule->af)) - error = ENOMEM; - if (pf_kanchor_setup(rule, ruleset, pr->anchor_call)) - error = EINVAL; - if (rule->scrub_flags & PFSTATE_SETPRIO && - (rule->set_prio[0] > PF_PRIO_MAX || - rule->set_prio[1] > PF_PRIO_MAX)) - error = EINVAL; - TAILQ_FOREACH(pa, &V_pf_pabuf, entries) - if (pa->addr.type == PF_ADDR_TABLE) { - pa->addr.p.tbl = pfr_attach_table(ruleset, - pa->addr.v.tblname); - if (pa->addr.p.tbl == NULL) - error = ENOMEM; - } + if (nvlist_exists_string(nvl, "anchor")) + anchor = nvlist_get_string(nvl, "anchor"); + if (nvlist_exists_string(nvl, "anchor_call")) + anchor_call = nvlist_get_string(nvl, "anchor_call"); - rule->overload_tbl = NULL; - if (rule->overload_tblname[0]) { - if ((rule->overload_tbl = pfr_attach_table(ruleset, - rule->overload_tblname)) == NULL) - error = EINVAL; - else - rule->overload_tbl->pfrkt_flags |= - PFR_TFLAG_ACTIVE; - } + if ((error = nvlist_error(nvl))) + ERROUT(error); - pf_mv_kpool(&V_pf_pabuf, &rule->rpool.list); - if (((((rule->action == PF_NAT) || (rule->action == PF_RDR) || - (rule->action == PF_BINAT)) && rule->anchor == NULL) || - (rule->rt > PF_NOPFROUTE)) && - (TAILQ_FIRST(&rule->rpool.list) == NULL)) - error = EINVAL; + /* Frees rule on error */ + error = pf_ioctl_addrule(rule, ticket, pool_ticket, anchor, + anchor_call, td); - if (error) { - pf_free_rule(rule); - PF_RULES_WUNLOCK(); + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + break; +#undef ERROUT +DIOCADDRULENV_error: + pf_krule_free(rule); + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + + break; + } + case DIOCADDRULE: { + struct pfioc_rule *pr = (struct pfioc_rule *)addr; + struct pf_krule *rule; + + rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK); + error = pf_rule_to_krule(&pr->rule, rule); + if (error != 0) { + free(rule, M_PFRULE); break; } - rule->rpool.cur = TAILQ_FIRST(&rule->rpool.list); - counter_u64_zero(rule->evaluations); - for (int i = 0; i < 2; i++) { - counter_u64_zero(rule->packets[i]); - counter_u64_zero(rule->bytes[i]); - } - TAILQ_INSERT_TAIL(ruleset->rules[rs_num].inactive.ptr, - rule, entries); - ruleset->rules[rs_num].inactive.rcount++; - PF_RULES_WUNLOCK(); - break; + pr->anchor[sizeof(pr->anchor) - 1] = 0; -#undef ERROUT -DIOCADDRULE_error: - PF_RULES_WUNLOCK(); - pf_krule_free(rule); - pf_kkif_free(kif); + /* Frees rule on error */ + error = pf_ioctl_addrule(rule, pr->ticket, pr->pool_ticket, + pr->anchor, pr->anchor_call, td); break; } diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c new file mode 100644 index 000000000000..d583844c4086 --- /dev/null +++ b/sys/netpfil/pf/pf_nv.c @@ -0,0 +1,127 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#define PV_NV_IMPL_UINT(fnname, type, max) \ + int \ + fnname(const nvlist_t *nvl, const char *name, type *val) \ + { \ + uint64_t raw; \ + if (! nvlist_exists_number(nvl, name)) \ + return (EINVAL); \ + raw = nvlist_get_number(nvl, name); \ + if (raw > max) \ + return (ERANGE); \ + *val = (type)raw; \ + return (0); \ + } \ + int \ + fnname ## _array(const nvlist_t *nvl, const char *name, type *array, \ + size_t maxelems, size_t *nelems) \ + { \ + const uint64_t *n; \ + size_t nitems; \ + bzero(array, sizeof(type) * maxelems); \ + if (! nvlist_exists_number_array(nvl, name)) \ + return (EINVAL); \ + n = nvlist_get_number_array(nvl, name, &nitems); \ + if (nitems != maxelems) \ + return (E2BIG); \ + if (nelems != NULL) \ + *nelems = nitems; \ + for (size_t i = 0; i < nitems; i++) { \ + if (n[i] > max) \ + return (ERANGE); \ + array[i] = (type)n[i]; \ + } \ + return (0); \ + } +int +pf_nvbinary(const nvlist_t *nvl, const char *name, void *data, + size_t expected_size) +{ + const uint8_t *nvdata; + size_t len; + + bzero(data, expected_size); + + if (! nvlist_exists_binary(nvl, name)) + return (EINVAL); + + nvdata = (const uint8_t *)nvlist_get_binary(nvl, name, &len); + if (len > expected_size) + return (EINVAL); + + memcpy(data, nvdata, len); + + return (0); +} + +PV_NV_IMPL_UINT(pf_nvuint8, uint8_t, UINT8_MAX) +PV_NV_IMPL_UINT(pf_nvuint16, uint16_t, UINT16_MAX); +PV_NV_IMPL_UINT(pf_nvuint32, uint32_t, UINT32_MAX) + +int +pf_nvint(const nvlist_t *nvl, const char *name, int *val) +{ + int64_t raw; + + if (! nvlist_exists_number(nvl, name)) + return (EINVAL); + + raw = nvlist_get_number(nvl, name); + if (raw > INT_MAX || raw < INT_MIN) + return (ERANGE); + + *val = (int)raw; + + return (0); +} + +int +pf_nvstring(const nvlist_t *nvl, const char *name, char *str, size_t maxlen) +{ + int ret; + + if (! nvlist_exists_string(nvl, name)) + return (EINVAL); + + ret = strlcpy(str, nvlist_get_string(nvl, name), maxlen); + if (ret >= maxlen) + return (EINVAL); + + return (0); +} diff --git a/sys/netpfil/pf/pf_nv.h b/sys/netpfil/pf/pf_nv.h new file mode 100644 index 000000000000..f0db1e880e9e --- /dev/null +++ b/sys/netpfil/pf/pf_nv.h @@ -0,0 +1,53 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +#ifndef _PF_NV_H_ +#define _PF_NV_H_ + +#include +#include + +int pf_nvbinary(const nvlist_t *, const char *, void *, size_t); +int pf_nvint(const nvlist_t *, const char *, int *); +int pf_nvuint8(const nvlist_t *, const char *, uint8_t *); +int pf_nvuint8_array(const nvlist_t *, const char *, uint8_t *, + size_t, size_t *); +int pf_nvuint16(const nvlist_t *, const char *, uint16_t *); +int pf_nvuint16_array(const nvlist_t *, const char *, uint16_t *, + size_t, size_t *); +int pf_nvuint32(const nvlist_t *, const char *, uint32_t *); +int pf_nvuint32_array(const nvlist_t *, const char *, uint32_t *, + size_t, size_t *); +int pf_nvstring(const nvlist_t *, const char *, char *, size_t); + +#define PFNV_CHK(x) do { \ + error = (x); \ + if (error != 0) \ + goto errout; \ + } while (0) + +#endif From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 094AC630DD1; Fri, 7 May 2021 15:25:37 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmJ6d92z4jpl; Fri, 7 May 2021 15:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CCFE95DB9; Fri, 7 May 2021 15:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPadW025981; Fri, 7 May 2021 15:25:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPa5L025980; Fri, 7 May 2021 15:25:36 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:36 GMT Message-Id: <202105071525.147FPa5L025980@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 3d82a24ba1bc - stable/12 - pf: Remove unused variable rt_listid from struct pf_krule MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3d82a24ba1bc90d8ac1cf9df8b13ccde42d8eb0a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:37 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3d82a24ba1bc90d8ac1cf9df8b13ccde42d8eb0a commit 3d82a24ba1bc90d8ac1cf9df8b13ccde42d8eb0a Author: Kristof Provost AuthorDate: 2021-04-08 09:08:33 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:59 +0000 pf: Remove unused variable rt_listid from struct pf_krule Reviewed by: donner MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29639 (cherry picked from commit 4967f672ef3095300fe74a9d1ae873d0897cc0a5) --- sys/net/pfvar.h | 1 - sys/netpfil/pf/pf_ioctl.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index a5ffba6c9d93..409e8fbefc5a 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -356,7 +356,6 @@ struct pf_krule { } max_src_conn_rate; u_int32_t qid; u_int32_t pqid; - u_int32_t rt_listid; u_int32_t nr; u_int32_t prob; uid_t cuid; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 5663228ac5ac..342781fa6640 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1547,7 +1547,6 @@ pf_krule_to_rule(const struct pf_krule *krule, struct pf_rule *rule) rule->max_src_conn_rate.seconds = krule->max_src_conn_rate.seconds; rule->qid = krule->qid; rule->pqid = krule->pqid; - rule->rt_listid = krule->rt_listid; rule->nr = krule->nr; rule->prob = krule->prob; rule->cuid = krule->cuid; @@ -1681,7 +1680,6 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) krule->max_src_conn_rate.seconds = rule->max_src_conn_rate.seconds; krule->qid = rule->qid; krule->pqid = rule->pqid; - krule->rt_listid = rule->rt_listid; krule->nr = rule->nr; krule->prob = rule->prob; krule->cuid = rule->cuid; From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B38CB63141B; Fri, 7 May 2021 15:25:38 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmL0nmTz4jy8; Fri, 7 May 2021 15:25:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E9B595770; Fri, 7 May 2021 15:25:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPbXO026024; Fri, 7 May 2021 15:25:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPbFo026023; Fri, 7 May 2021 15:25:37 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:37 GMT Message-Id: <202105071525.147FPbFo026023@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 8ffd90c5b5b5 - stable/12 - pf: Introduce nvlist variant of DIOCADDRULE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8ffd90c5b5b5e03ad8fe29aaa48c282dbea8e3b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:38 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8ffd90c5b5b5e03ad8fe29aaa48c282dbea8e3b5 commit 8ffd90c5b5b5e03ad8fe29aaa48c282dbea8e3b5 Author: Kristof Provost AuthorDate: 2021-03-11 15:21:23 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:00 +0000 pf: Introduce nvlist variant of DIOCADDRULE This will make future extensions of the API much easier. The intent is to remove support for DIOCADDRULE in FreeBSD 14. Reviewed by: markj (previous version), glebius (previous version) MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29557 (cherry picked from commit 5c62eded5a11ebdb1d57134d923596e2b04e9466) --- sys/conf/files | 1 + sys/modules/pf/Makefile | 2 +- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf.h | 6 + sys/netpfil/pf/pf_ioctl.c | 646 ++++++++++++++++++++++++++++++++++++---------- sys/netpfil/pf/pf_nv.c | 127 +++++++++ sys/netpfil/pf/pf_nv.h | 53 ++++ 7 files changed, 696 insertions(+), 140 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 6b24b413fe59..4195d5d21a53 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4509,6 +4509,7 @@ netpfil/pf/pf_if.c optional pf inet netpfil/pf/pf_ioctl.c optional pf inet netpfil/pf/pf_lb.c optional pf inet netpfil/pf/pf_norm.c optional pf inet +netpfil/pf/pf_nv.c optional pf inet netpfil/pf/pf_osfp.c optional pf inet netpfil/pf/pf_ruleset.c optional pf inet netpfil/pf/pf_table.c optional pf inet diff --git a/sys/modules/pf/Makefile b/sys/modules/pf/Makefile index 148b64c02a9f..7293b30cda9d 100644 --- a/sys/modules/pf/Makefile +++ b/sys/modules/pf/Makefile @@ -4,7 +4,7 @@ KMOD= pf SRCS= pf.c pf_if.c pf_lb.c pf_osfp.c pf_ioctl.c pf_norm.c pf_table.c \ - pf_ruleset.c in4_cksum.c \ + pf_ruleset.c pf_nv.c in4_cksum.c \ bus_if.h device_if.h \ opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_sctp.h opt_global.h diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 409e8fbefc5a..eb9f365f2ec9 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1229,6 +1229,7 @@ struct pfioc_iface { #define DIOCSTART _IO ('D', 1) #define DIOCSTOP _IO ('D', 2) #define DIOCADDRULE _IOWR('D', 4, struct pfioc_rule) +#define DIOCADDRULENV _IOWR('D', 4, struct pfioc_nv) #define DIOCGETRULES _IOWR('D', 6, struct pfioc_rule) #define DIOCGETRULE _IOWR('D', 7, struct pfioc_rule) /* XXX cut 8 - 17 */ diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 511c60f5abd1..bc6cd92ae7b8 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -187,6 +187,12 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define PF_TABLE_NAME_SIZE 32 #define PF_QNAME_SIZE 64 +struct pfioc_nv { + void *data; + size_t len; /* The length of the nvlist data. */ + size_t size; /* The total size of the data buffer. */ +}; + struct pf_rule; /* keep synced with pfi_kif, used in RB_FIND */ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 342781fa6640..53c850a96538 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -82,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef INET6 #include @@ -1623,6 +1625,294 @@ pf_check_rule_addr(const struct pf_rule_addr *addr) return (0); } +static int +pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *paddr) +{ + return (pf_nvbinary(nvl, "addr", paddr, sizeof(*paddr))); +} + +static int +pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_kpool *kpool) +{ + int error = 0; + + bzero(kpool, sizeof(*kpool)); + + PFNV_CHK(pf_nvbinary(nvl, "key", &kpool->key, sizeof(kpool->key))); + + if (nvlist_exists_nvlist(nvl, "counter")) { + PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "counter"), + &kpool->counter)); + } + + PFNV_CHK(pf_nvint(nvl, "tblidx", &kpool->tblidx)); + PFNV_CHK(pf_nvuint16_array(nvl, "proxy_port", kpool->proxy_port, 2, + NULL)); + PFNV_CHK(pf_nvuint8(nvl, "opts", &kpool->opts)); + +errout: + return (error); +} + +static int +pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) +{ + int error = 0; + + bzero(addr, sizeof(*addr)); + + PFNV_CHK(pf_nvuint8(nvl, "type", &addr->type)); + PFNV_CHK(pf_nvuint8(nvl, "iflags", &addr->iflags)); + PFNV_CHK(pf_nvstring(nvl, "ifname", addr->v.ifname, + sizeof(addr->v.ifname))); + PFNV_CHK(pf_nvstring(nvl, "tblname", addr->v.tblname, + sizeof(addr->v.tblname))); + + if (! nvlist_exists_nvlist(nvl, "addr")) + return (EINVAL); + PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), + &addr->v.a.addr)); + + if (! nvlist_exists_nvlist(nvl, "mask")) + return (EINVAL); + PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "mask"), + &addr->v.a.mask)); + + switch (addr->type) { + case PF_ADDR_DYNIFTL: + case PF_ADDR_TABLE: + case PF_ADDR_RANGE: + case PF_ADDR_ADDRMASK: + case PF_ADDR_NOROUTE: + case PF_ADDR_URPFFAILED: + break; + default: + return (EINVAL); + } + +errout: + return (error); +} + +static int +pf_validate_op(uint8_t op) +{ + switch (op) { + case PF_OP_NONE: + case PF_OP_IRG: + case PF_OP_EQ: + case PF_OP_NE: + case PF_OP_LT: + case PF_OP_LE: + case PF_OP_GT: + case PF_OP_GE: + case PF_OP_XRG: + case PF_OP_RRG: + break; + default: + return (EINVAL); + } + + return (0); +} + +static int +pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) +{ + int error = 0; + + if (! nvlist_exists_nvlist(nvl, "addr")) + return (EINVAL); + + PFNV_CHK(pf_nvaddr_wrap_to_addr_wrap(nvlist_get_nvlist(nvl, "addr"), + &addr->addr)); + PFNV_CHK(pf_nvuint16_array(nvl, "port", addr->port, 2, NULL)); + PFNV_CHK(pf_nvuint8(nvl, "neg", &addr->neg)); + PFNV_CHK(pf_nvuint8(nvl, "port_op", &addr->port_op)); + + PFNV_CHK(pf_validate_op(addr->port_op)); + +errout: + return (error); +} + +static int +pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) +{ + int error = 0; + + bzero(uid, sizeof(*uid)); + + PFNV_CHK(pf_nvuint32_array(nvl, "uid", uid->uid, 2, NULL)); + PFNV_CHK(pf_nvuint8(nvl, "op", &uid->op)); + + PFNV_CHK(pf_validate_op(uid->op)); + +errout: + return (error); +} + +static int +pf_nvrule_gid_to_rule_gid(const nvlist_t *nvl, struct pf_rule_gid *gid) +{ + /* Cheat a little. These stucts are the same, other than the name of + * the first field. */ + return (pf_nvrule_uid_to_rule_uid(nvl, (struct pf_rule_uid *)gid)); +} + +static int +pf_nvrule_to_krule(const nvlist_t *nvl, struct pf_krule **prule) +{ + struct pf_krule *rule; + int error = 0; + + rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK | M_ZERO); + + PFNV_CHK(pf_nvuint32(nvl, "nr", &rule->nr)); + + if (! nvlist_exists_nvlist(nvl, "src")) { + error = EINVAL; + goto errout; + } + error = pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "src"), + &rule->src); + if (error != 0) + goto errout; + + if (! nvlist_exists_nvlist(nvl, "dst")) { + error = EINVAL; + goto errout; + } + PFNV_CHK(pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "dst"), + &rule->dst)); + + PFNV_CHK(pf_nvstring(nvl, "label", rule->label, sizeof(rule->label))); + PFNV_CHK(pf_nvstring(nvl, "ifname", rule->ifname, + sizeof(rule->ifname))); + PFNV_CHK(pf_nvstring(nvl, "qname", rule->qname, sizeof(rule->qname))); + PFNV_CHK(pf_nvstring(nvl, "pqname", rule->pqname, + sizeof(rule->pqname))); + PFNV_CHK(pf_nvstring(nvl, "tagname", rule->tagname, + sizeof(rule->tagname))); + PFNV_CHK(pf_nvstring(nvl, "match_tagname", rule->match_tagname, + sizeof(rule->match_tagname))); + PFNV_CHK(pf_nvstring(nvl, "overload_tblname", rule->overload_tblname, + sizeof(rule->overload_tblname))); + + if (! nvlist_exists_nvlist(nvl, "rpool")) { + error = EINVAL; + goto errout; + } + PFNV_CHK(pf_nvpool_to_pool(nvlist_get_nvlist(nvl, "rpool"), + &rule->rpool)); + + PFNV_CHK(pf_nvuint32(nvl, "os_fingerprint", &rule->os_fingerprint)); + + PFNV_CHK(pf_nvint(nvl, "rtableid", &rule->rtableid)); + PFNV_CHK(pf_nvuint32_array(nvl, "timeout", rule->timeout, PFTM_MAX, NULL)); + PFNV_CHK(pf_nvuint32(nvl, "max_states", &rule->max_states)); + PFNV_CHK(pf_nvuint32(nvl, "max_src_nodes", &rule->max_src_nodes)); + PFNV_CHK(pf_nvuint32(nvl, "max_src_states", &rule->max_src_states)); + PFNV_CHK(pf_nvuint32(nvl, "max_src_conn", &rule->max_src_conn)); + PFNV_CHK(pf_nvuint32(nvl, "max_src_conn_rate.limit", + &rule->max_src_conn_rate.limit)); + PFNV_CHK(pf_nvuint32(nvl, "max_src_conn_rate.seconds", + &rule->max_src_conn_rate.seconds)); + PFNV_CHK(pf_nvuint32(nvl, "prob", &rule->prob)); + PFNV_CHK(pf_nvuint32(nvl, "cuid", &rule->cuid)); + PFNV_CHK(pf_nvuint32(nvl, "cpid", &rule->cpid)); + + PFNV_CHK(pf_nvuint16(nvl, "return_icmp", &rule->return_icmp)); + PFNV_CHK(pf_nvuint16(nvl, "return_icmp6", &rule->return_icmp6)); + + PFNV_CHK(pf_nvuint16(nvl, "max_mss", &rule->max_mss)); + PFNV_CHK(pf_nvuint16(nvl, "scrub_flags", &rule->scrub_flags)); + + if (! nvlist_exists_nvlist(nvl, "uid")) { + error = EINVAL; + goto errout; + } + PFNV_CHK(pf_nvrule_uid_to_rule_uid(nvlist_get_nvlist(nvl, "uid"), + &rule->uid)); + + if (! nvlist_exists_nvlist(nvl, "gid")) { + error = EINVAL; + goto errout; + } + PFNV_CHK(pf_nvrule_gid_to_rule_gid(nvlist_get_nvlist(nvl, "gid"), + &rule->gid)); + + PFNV_CHK(pf_nvuint32(nvl, "rule_flag", &rule->rule_flag)); + PFNV_CHK(pf_nvuint8(nvl, "action", &rule->action)); + PFNV_CHK(pf_nvuint8(nvl, "direction", &rule->direction)); + PFNV_CHK(pf_nvuint8(nvl, "log", &rule->log)); + PFNV_CHK(pf_nvuint8(nvl, "logif", &rule->logif)); + PFNV_CHK(pf_nvuint8(nvl, "quick", &rule->quick)); + PFNV_CHK(pf_nvuint8(nvl, "ifnot", &rule->ifnot)); + PFNV_CHK(pf_nvuint8(nvl, "match_tag_not", &rule->match_tag_not)); + PFNV_CHK(pf_nvuint8(nvl, "natpass", &rule->natpass)); + + PFNV_CHK(pf_nvuint8(nvl, "keep_state", &rule->keep_state)); + PFNV_CHK(pf_nvuint8(nvl, "af", &rule->af)); + PFNV_CHK(pf_nvuint8(nvl, "proto", &rule->proto)); + PFNV_CHK(pf_nvuint8(nvl, "type", &rule->type)); + PFNV_CHK(pf_nvuint8(nvl, "code", &rule->code)); + PFNV_CHK(pf_nvuint8(nvl, "flags", &rule->flags)); + PFNV_CHK(pf_nvuint8(nvl, "flagset", &rule->flagset)); + PFNV_CHK(pf_nvuint8(nvl, "min_ttl", &rule->min_ttl)); + PFNV_CHK(pf_nvuint8(nvl, "allow_opts", &rule->allow_opts)); + PFNV_CHK(pf_nvuint8(nvl, "rt", &rule->rt)); + PFNV_CHK(pf_nvuint8(nvl, "return_ttl", &rule->return_ttl)); + PFNV_CHK(pf_nvuint8(nvl, "tos", &rule->tos)); + PFNV_CHK(pf_nvuint8(nvl, "set_tos", &rule->set_tos)); + PFNV_CHK(pf_nvuint8(nvl, "anchor_relative", &rule->anchor_relative)); + PFNV_CHK(pf_nvuint8(nvl, "anchor_wildcard", &rule->anchor_wildcard)); + + PFNV_CHK(pf_nvuint8(nvl, "flush", &rule->flush)); + PFNV_CHK(pf_nvuint8(nvl, "prio", &rule->prio)); + + PFNV_CHK(pf_nvuint8_array(nvl, "set_prio", &rule->prio, 2, NULL)); + + if (nvlist_exists_nvlist(nvl, "divert")) { + const nvlist_t *nvldivert = nvlist_get_nvlist(nvl, "divert"); + + if (! nvlist_exists_nvlist(nvldivert, "addr")) { + error = EINVAL; + goto errout; + } + PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvldivert, "addr"), + &rule->divert.addr)); + PFNV_CHK(pf_nvuint16(nvldivert, "port", &rule->divert.port)); + } + + /* Validation */ +#ifndef INET + if (rule->af == AF_INET) { + error = EAFNOSUPPORT; + goto errout; + } +#endif /* INET */ +#ifndef INET6 + if (rule->af == AF_INET6) { + error = EAFNOSUPPORT; + goto errout; + } +#endif /* INET6 */ + + PFNV_CHK(pf_check_rule_addr(&rule->src)); + PFNV_CHK(pf_check_rule_addr(&rule->dst)); + + *prule = rule; + + return (0); + +errout: + pf_krule_free(rule); + *prule = NULL; + + return (error); +} + static int pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) { @@ -1797,6 +2087,163 @@ relock_DIOCKILLSTATES: return (killed); } +static int +pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, + uint32_t pool_ticket, const char *anchor, const char *anchor_call, + struct thread *td) +{ + struct pf_kruleset *ruleset; + struct pf_krule *tail; + struct pf_kpooladdr *pa; + struct pfi_kkif *kif = NULL; + int rs_num; + int error = 0; + + if ((rule->return_icmp >> 8) > ICMP_MAXTYPE) { + error = EINVAL; + goto errout_unlocked; + } + +#define ERROUT(x) { error = (x); goto errout; } + + if (rule->ifname[0]) + kif = pf_kkif_create(M_WAITOK); + rule->evaluations = counter_u64_alloc(M_WAITOK); + for (int i = 0; i < 2; i++) { + rule->packets[i] = counter_u64_alloc(M_WAITOK); + rule->bytes[i] = counter_u64_alloc(M_WAITOK); + } + rule->states_cur = counter_u64_alloc(M_WAITOK); + rule->states_tot = counter_u64_alloc(M_WAITOK); + rule->src_nodes = counter_u64_alloc(M_WAITOK); + rule->cuid = td->td_ucred->cr_ruid; + rule->cpid = td->td_proc ? td->td_proc->p_pid : 0; + TAILQ_INIT(&rule->rpool.list); + + PF_RULES_WLOCK(); + ruleset = pf_find_kruleset(anchor); + if (ruleset == NULL) + ERROUT(EINVAL); + rs_num = pf_get_ruleset_number(rule->action); + if (rs_num >= PF_RULESET_MAX) + ERROUT(EINVAL); + if (ticket != ruleset->rules[rs_num].inactive.ticket) { + DPFPRINTF(PF_DEBUG_MISC, + ("ticket: %d != [%d]%d\n", ticket, rs_num, + ruleset->rules[rs_num].inactive.ticket)); + ERROUT(EBUSY); + } + if (pool_ticket != V_ticket_pabuf) { + DPFPRINTF(PF_DEBUG_MISC, + ("pool_ticket: %d != %d\n", pool_ticket, + V_ticket_pabuf)); + ERROUT(EBUSY); + } + + tail = TAILQ_LAST(ruleset->rules[rs_num].inactive.ptr, + pf_krulequeue); + if (tail) + rule->nr = tail->nr + 1; + else + rule->nr = 0; + if (rule->ifname[0]) { + rule->kif = pfi_kkif_attach(kif, rule->ifname); + pfi_kkif_ref(rule->kif); + } else + rule->kif = NULL; + + if (rule->rtableid > 0 && rule->rtableid >= rt_numfibs) + error = EBUSY; + +#ifdef ALTQ + /* set queue IDs */ + if (rule->qname[0] != 0) { + if ((rule->qid = pf_qname2qid(rule->qname)) == 0) + error = EBUSY; + else if (rule->pqname[0] != 0) { + if ((rule->pqid = + pf_qname2qid(rule->pqname)) == 0) + error = EBUSY; + } else + rule->pqid = rule->qid; + } +#endif + if (rule->tagname[0]) + if ((rule->tag = pf_tagname2tag(rule->tagname)) == 0) + error = EBUSY; + if (rule->match_tagname[0]) + if ((rule->match_tag = + pf_tagname2tag(rule->match_tagname)) == 0) + error = EBUSY; + if (rule->rt && !rule->direction) + error = EINVAL; + if (!rule->log) + rule->logif = 0; + if (rule->logif >= PFLOGIFS_MAX) + error = EINVAL; + if (pf_addr_setup(ruleset, &rule->src.addr, rule->af)) + error = ENOMEM; + if (pf_addr_setup(ruleset, &rule->dst.addr, rule->af)) + error = ENOMEM; + if (pf_kanchor_setup(rule, ruleset, anchor_call)) + error = EINVAL; + if (rule->scrub_flags & PFSTATE_SETPRIO && + (rule->set_prio[0] > PF_PRIO_MAX || + rule->set_prio[1] > PF_PRIO_MAX)) + error = EINVAL; + TAILQ_FOREACH(pa, &V_pf_pabuf, entries) + if (pa->addr.type == PF_ADDR_TABLE) { + pa->addr.p.tbl = pfr_attach_table(ruleset, + pa->addr.v.tblname); + if (pa->addr.p.tbl == NULL) + error = ENOMEM; + } + + rule->overload_tbl = NULL; + if (rule->overload_tblname[0]) { + if ((rule->overload_tbl = pfr_attach_table(ruleset, + rule->overload_tblname)) == NULL) + error = EINVAL; + else + rule->overload_tbl->pfrkt_flags |= + PFR_TFLAG_ACTIVE; + } + + pf_mv_kpool(&V_pf_pabuf, &rule->rpool.list); + if (((((rule->action == PF_NAT) || (rule->action == PF_RDR) || + (rule->action == PF_BINAT)) && rule->anchor == NULL) || + (rule->rt > PF_NOPFROUTE)) && + (TAILQ_FIRST(&rule->rpool.list) == NULL)) + error = EINVAL; + + if (error) { + pf_free_rule(rule); + rule = NULL; + ERROUT(error); + } + + rule->rpool.cur = TAILQ_FIRST(&rule->rpool.list); + counter_u64_zero(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_zero(rule->packets[i]); + counter_u64_zero(rule->bytes[i]); + } + TAILQ_INSERT_TAIL(ruleset->rules[rs_num].inactive.ptr, + rule, entries); + ruleset->rules[rs_num].inactive.rcount++; + PF_RULES_WUNLOCK(); + + return (0); + +#undef ERROUT +errout: + PF_RULES_WUNLOCK(); +errout_unlocked: + pf_kkif_free(kif); + pf_krule_free(rule); + return (error); +} + static int pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { @@ -1957,162 +2404,83 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td } break; - case DIOCADDRULE: { - struct pfioc_rule *pr = (struct pfioc_rule *)addr; - struct pf_kruleset *ruleset; - struct pf_krule *rule, *tail; - struct pf_kpooladdr *pa; - struct pfi_kkif *kif = NULL; - int rs_num; + case DIOCADDRULENV: { + struct pfioc_nv *nv = (struct pfioc_nv *)addr; + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + struct pf_krule *rule = NULL; + const char *anchor = "", *anchor_call = ""; + uint32_t ticket = 0, pool_ticket = 0; - if (pr->rule.return_icmp >> 8 > ICMP_MAXTYPE) { - error = EINVAL; - break; - } +#define ERROUT(x) do { error = (x); goto DIOCADDRULENV_error; } while (0) - rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK); - error = pf_rule_to_krule(&pr->rule, rule); - if (error != 0) { - free(rule, M_PFRULE); - break; - } + if (nv->len > pf_ioctl_maxcount) + ERROUT(ENOMEM); - if (rule->ifname[0]) - kif = pf_kkif_create(M_WAITOK); - rule->evaluations = counter_u64_alloc(M_WAITOK); - for (int i = 0; i < 2; i++) { - rule->packets[i] = counter_u64_alloc(M_WAITOK); - rule->bytes[i] = counter_u64_alloc(M_WAITOK); - } - rule->states_cur = counter_u64_alloc(M_WAITOK); - rule->states_tot = counter_u64_alloc(M_WAITOK); - rule->src_nodes = counter_u64_alloc(M_WAITOK); - rule->cuid = td->td_ucred->cr_ruid; - rule->cpid = td->td_proc ? td->td_proc->p_pid : 0; - TAILQ_INIT(&rule->rpool.list); + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + error = copyin(nv->data, nvlpacked, nv->len); + if (error) + ERROUT(error); -#define ERROUT(x) { error = (x); goto DIOCADDRULE_error; } + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) + ERROUT(EBADMSG); - PF_RULES_WLOCK(); - pr->anchor[sizeof(pr->anchor) - 1] = 0; - ruleset = pf_find_kruleset(pr->anchor); - if (ruleset == NULL) + if (! nvlist_exists_number(nvl, "ticket")) ERROUT(EINVAL); - rs_num = pf_get_ruleset_number(pr->rule.action); - if (rs_num >= PF_RULESET_MAX) + ticket = nvlist_get_number(nvl, "ticket"); + + if (! nvlist_exists_number(nvl, "pool_ticket")) ERROUT(EINVAL); - if (pr->ticket != ruleset->rules[rs_num].inactive.ticket) { - DPFPRINTF(PF_DEBUG_MISC, - ("ticket: %d != [%d]%d\n", pr->ticket, rs_num, - ruleset->rules[rs_num].inactive.ticket)); - ERROUT(EBUSY); - } - if (pr->pool_ticket != V_ticket_pabuf) { - DPFPRINTF(PF_DEBUG_MISC, - ("pool_ticket: %d != %d\n", pr->pool_ticket, - V_ticket_pabuf)); - ERROUT(EBUSY); - } + pool_ticket = nvlist_get_number(nvl, "pool_ticket"); - tail = TAILQ_LAST(ruleset->rules[rs_num].inactive.ptr, - pf_krulequeue); - if (tail) - rule->nr = tail->nr + 1; - else - rule->nr = 0; - if (rule->ifname[0]) { - rule->kif = pfi_kkif_attach(kif, rule->ifname); - pfi_kkif_ref(rule->kif); - } else - rule->kif = NULL; + if (! nvlist_exists_nvlist(nvl, "rule")) + ERROUT(EINVAL); - if (rule->rtableid > 0 && rule->rtableid >= rt_numfibs) - error = EBUSY; + error = pf_nvrule_to_krule(nvlist_get_nvlist(nvl, "rule"), + &rule); + if (error) + ERROUT(error); -#ifdef ALTQ - /* set queue IDs */ - if (rule->qname[0] != 0) { - if ((rule->qid = pf_qname2qid(rule->qname)) == 0) - error = EBUSY; - else if (rule->pqname[0] != 0) { - if ((rule->pqid = - pf_qname2qid(rule->pqname)) == 0) - error = EBUSY; - } else - rule->pqid = rule->qid; - } -#endif - if (rule->tagname[0]) - if ((rule->tag = pf_tagname2tag(rule->tagname)) == 0) - error = EBUSY; - if (rule->match_tagname[0]) - if ((rule->match_tag = - pf_tagname2tag(rule->match_tagname)) == 0) - error = EBUSY; - if (rule->rt && !rule->direction) - error = EINVAL; - if (!rule->log) - rule->logif = 0; - if (rule->logif >= PFLOGIFS_MAX) - error = EINVAL; - if (pf_addr_setup(ruleset, &rule->src.addr, rule->af)) - error = ENOMEM; - if (pf_addr_setup(ruleset, &rule->dst.addr, rule->af)) - error = ENOMEM; - if (pf_kanchor_setup(rule, ruleset, pr->anchor_call)) - error = EINVAL; - if (rule->scrub_flags & PFSTATE_SETPRIO && - (rule->set_prio[0] > PF_PRIO_MAX || - rule->set_prio[1] > PF_PRIO_MAX)) - error = EINVAL; - TAILQ_FOREACH(pa, &V_pf_pabuf, entries) - if (pa->addr.type == PF_ADDR_TABLE) { - pa->addr.p.tbl = pfr_attach_table(ruleset, - pa->addr.v.tblname); - if (pa->addr.p.tbl == NULL) - error = ENOMEM; - } + if (nvlist_exists_string(nvl, "anchor")) + anchor = nvlist_get_string(nvl, "anchor"); + if (nvlist_exists_string(nvl, "anchor_call")) + anchor_call = nvlist_get_string(nvl, "anchor_call"); - rule->overload_tbl = NULL; - if (rule->overload_tblname[0]) { - if ((rule->overload_tbl = pfr_attach_table(ruleset, - rule->overload_tblname)) == NULL) - error = EINVAL; - else - rule->overload_tbl->pfrkt_flags |= - PFR_TFLAG_ACTIVE; - } + if ((error = nvlist_error(nvl))) + ERROUT(error); - pf_mv_kpool(&V_pf_pabuf, &rule->rpool.list); - if (((((rule->action == PF_NAT) || (rule->action == PF_RDR) || - (rule->action == PF_BINAT)) && rule->anchor == NULL) || - (rule->rt > PF_NOPFROUTE)) && - (TAILQ_FIRST(&rule->rpool.list) == NULL)) - error = EINVAL; + /* Frees rule on error */ + error = pf_ioctl_addrule(rule, ticket, pool_ticket, anchor, + anchor_call, td); - if (error) { - pf_free_rule(rule); - PF_RULES_WUNLOCK(); + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + break; +#undef ERROUT +DIOCADDRULENV_error: + pf_krule_free(rule); + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + + break; + } + case DIOCADDRULE: { + struct pfioc_rule *pr = (struct pfioc_rule *)addr; + struct pf_krule *rule; + + rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK); + error = pf_rule_to_krule(&pr->rule, rule); + if (error != 0) { + free(rule, M_PFRULE); break; } - rule->rpool.cur = TAILQ_FIRST(&rule->rpool.list); - counter_u64_zero(rule->evaluations); - for (int i = 0; i < 2; i++) { - counter_u64_zero(rule->packets[i]); - counter_u64_zero(rule->bytes[i]); - } - TAILQ_INSERT_TAIL(ruleset->rules[rs_num].inactive.ptr, - rule, entries); - ruleset->rules[rs_num].inactive.rcount++; - PF_RULES_WUNLOCK(); - break; + pr->anchor[sizeof(pr->anchor) - 1] = 0; -#undef ERROUT -DIOCADDRULE_error: - PF_RULES_WUNLOCK(); - pf_krule_free(rule); - pf_kkif_free(kif); + /* Frees rule on error */ + error = pf_ioctl_addrule(rule, pr->ticket, pr->pool_ticket, + pr->anchor, pr->anchor_call, td); break; } diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c new file mode 100644 index 000000000000..d583844c4086 --- /dev/null +++ b/sys/netpfil/pf/pf_nv.c @@ -0,0 +1,127 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#define PV_NV_IMPL_UINT(fnname, type, max) \ + int \ + fnname(const nvlist_t *nvl, const char *name, type *val) \ + { \ + uint64_t raw; \ + if (! nvlist_exists_number(nvl, name)) \ + return (EINVAL); \ + raw = nvlist_get_number(nvl, name); \ + if (raw > max) \ + return (ERANGE); \ + *val = (type)raw; \ + return (0); \ + } \ + int \ + fnname ## _array(const nvlist_t *nvl, const char *name, type *array, \ + size_t maxelems, size_t *nelems) \ + { \ + const uint64_t *n; \ + size_t nitems; \ + bzero(array, sizeof(type) * maxelems); \ + if (! nvlist_exists_number_array(nvl, name)) \ + return (EINVAL); \ + n = nvlist_get_number_array(nvl, name, &nitems); \ + if (nitems != maxelems) \ + return (E2BIG); \ + if (nelems != NULL) \ + *nelems = nitems; \ + for (size_t i = 0; i < nitems; i++) { \ + if (n[i] > max) \ + return (ERANGE); \ + array[i] = (type)n[i]; \ + } \ + return (0); \ + } +int +pf_nvbinary(const nvlist_t *nvl, const char *name, void *data, + size_t expected_size) +{ + const uint8_t *nvdata; + size_t len; + + bzero(data, expected_size); + + if (! nvlist_exists_binary(nvl, name)) + return (EINVAL); + + nvdata = (const uint8_t *)nvlist_get_binary(nvl, name, &len); + if (len > expected_size) + return (EINVAL); + + memcpy(data, nvdata, len); + + return (0); +} + +PV_NV_IMPL_UINT(pf_nvuint8, uint8_t, UINT8_MAX) +PV_NV_IMPL_UINT(pf_nvuint16, uint16_t, UINT16_MAX); +PV_NV_IMPL_UINT(pf_nvuint32, uint32_t, UINT32_MAX) + +int +pf_nvint(const nvlist_t *nvl, const char *name, int *val) +{ + int64_t raw; + + if (! nvlist_exists_number(nvl, name)) + return (EINVAL); + + raw = nvlist_get_number(nvl, name); + if (raw > INT_MAX || raw < INT_MIN) + return (ERANGE); + + *val = (int)raw; + + return (0); +} + +int +pf_nvstring(const nvlist_t *nvl, const char *name, char *str, size_t maxlen) +{ + int ret; + + if (! nvlist_exists_string(nvl, name)) + return (EINVAL); + + ret = strlcpy(str, nvlist_get_string(nvl, name), maxlen); + if (ret >= maxlen) + return (EINVAL); + + return (0); +} diff --git a/sys/netpfil/pf/pf_nv.h b/sys/netpfil/pf/pf_nv.h new file mode 100644 index 000000000000..f0db1e880e9e --- /dev/null +++ b/sys/netpfil/pf/pf_nv.h @@ -0,0 +1,53 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +#ifndef _PF_NV_H_ +#define _PF_NV_H_ + +#include +#include + +int pf_nvbinary(const nvlist_t *, const char *, void *, size_t); +int pf_nvint(const nvlist_t *, const char *, int *); +int pf_nvuint8(const nvlist_t *, const char *, uint8_t *); +int pf_nvuint8_array(const nvlist_t *, const char *, uint8_t *, + size_t, size_t *); +int pf_nvuint16(const nvlist_t *, const char *, uint16_t *); +int pf_nvuint16_array(const nvlist_t *, const char *, uint16_t *, + size_t, size_t *); +int pf_nvuint32(const nvlist_t *, const char *, uint32_t *); +int pf_nvuint32_array(const nvlist_t *, const char *, uint32_t *, + size_t, size_t *); +int pf_nvstring(const nvlist_t *, const char *, char *, size_t); + +#define PFNV_CHK(x) do { \ + error = (x); \ + if (error != 0) \ + goto errout; \ + } while (0) + +#endif From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBD3563138B; Fri, 7 May 2021 15:25:37 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmK5K56z4k1Y; Fri, 7 May 2021 15:25:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9B2585B39; Fri, 7 May 2021 15:25:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPbVe026003; Fri, 7 May 2021 15:25:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPbru026002; Fri, 7 May 2021 15:25:37 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:37 GMT Message-Id: <202105071525.147FPbru026002@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 9a8b57081246 - stable/13 - pfctl: Move to DIOCADDRULENV MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9a8b5708124660ae16a920f71117c85b34b455c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:38 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9a8b5708124660ae16a920f71117c85b34b455c1 commit 9a8b5708124660ae16a920f71117c85b34b455c1 Author: Kristof Provost AuthorDate: 2021-03-12 17:03:14 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:41 +0000 pfctl: Move to DIOCADDRULENV Start using the new nvlist based ioctl to add rules. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29558 (cherry picked from commit 5c11c5a3655842a176124ef2334fcdf830422c8a) --- sbin/pfctl/Makefile | 2 +- sbin/pfctl/pfctl.c | 217 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 207 insertions(+), 12 deletions(-) diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile index 14dc83eb97b0..74cefe6824a4 100644 --- a/sbin/pfctl/Makefile +++ b/sbin/pfctl/Makefile @@ -27,7 +27,7 @@ CFLAGS+= -DWITH_INET YFLAGS= -LIBADD= m md +LIBADD= m md nv HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 4e00bf2462a6..58a87a2b8395 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1422,19 +1423,217 @@ pfctl_load_ruleset(struct pfctl *pf, char *path, struct pf_ruleset *rs, } +static void +pfctl_nv_add_addr(nvlist_t *nvparent, const char *name, + const struct pf_addr *addr) +{ + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_binary(nvl, "addr", addr, sizeof(*addr)); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_addr_wrap(nvlist_t *nvparent, const char *name, + const struct pf_addr_wrap *addr) +{ + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_number(nvl, "type", addr->type); + nvlist_add_number(nvl, "iflags", addr->iflags); + nvlist_add_string(nvl, "ifname", addr->v.ifname); + nvlist_add_string(nvl, "tblname", addr->v.tblname); + pfctl_nv_add_addr(nvl, "addr", &addr->v.a.addr); + pfctl_nv_add_addr(nvl, "mask", &addr->v.a.mask); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_rule_addr(nvlist_t *nvparent, const char *name, + const struct pf_rule_addr *addr) +{ + u_int64_t ports[2]; + nvlist_t *nvl = nvlist_create(0); + + pfctl_nv_add_addr_wrap(nvl, "addr", &addr->addr); + ports[0] = addr->port[0]; + ports[1] = addr->port[1]; + nvlist_add_number_array(nvl, "port", ports, 2); + nvlist_add_number(nvl, "neg", addr->neg); + nvlist_add_number(nvl, "port_op", addr->port_op); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, + const struct pf_pool *pool) +{ + u_int64_t ports[2]; + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); + pfctl_nv_add_addr(nvl, "counter", &pool->counter); + nvlist_add_number(nvl, "tblidx", pool->tblidx); + + ports[0] = pool->proxy_port[0]; + ports[1] = pool->proxy_port[1]; + nvlist_add_number_array(nvl, "proxy_port", ports, 2); + nvlist_add_number(nvl, "opts", pool->opts); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_uid(nvlist_t *nvparent, const char *name, + const struct pf_rule_uid *uid) +{ + u_int64_t uids[2]; + nvlist_t *nvl = nvlist_create(0); + + uids[0] = uid->uid[0]; + uids[1] = uid->uid[1]; + nvlist_add_number_array(nvl, "uid", uids, 2); + nvlist_add_number(nvl, "op", uid->op); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, + const struct pf_rule *r) +{ + nvlist_t *nvl = nvlist_create(0); + + pfctl_nv_add_addr(nvl, "addr", &r->divert.addr); + nvlist_add_number(nvl, "port", r->divert.port); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static int +pfctl_addrule(struct pfctl *pf, const struct pf_rule *r, const char *anchor, + const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) +{ + struct pfioc_nv nv; + u_int64_t timeouts[PFTM_MAX]; + u_int64_t set_prio[2]; + nvlist_t *nvl, *nvlr; + int ret; + + nvl = nvlist_create(0); + nvlr = nvlist_create(0); + + nvlist_add_number(nvl, "ticket", ticket); + nvlist_add_number(nvl, "pool_ticket", pool_ticket); + nvlist_add_string(nvl, "anchor", anchor); + nvlist_add_string(nvl, "anchor_call", anchor_call); + + nvlist_add_number(nvlr, "nr", r->nr); + pfctl_nv_add_rule_addr(nvlr, "src", &r->src); + pfctl_nv_add_rule_addr(nvlr, "dst", &r->dst); + + nvlist_add_string(nvlr, "label", r->label); + nvlist_add_string(nvlr, "ifname", r->ifname); + nvlist_add_string(nvlr, "qname", r->qname); + nvlist_add_string(nvlr, "pqname", r->pqname); + nvlist_add_string(nvlr, "tagname", r->tagname); + nvlist_add_string(nvlr, "match_tagname", r->match_tagname); + nvlist_add_string(nvlr, "overload_tblname", r->overload_tblname); + + pfctl_nv_add_pool(nvlr, "rpool", &r->rpool); + + nvlist_add_number(nvlr, "os_fingerprint", r->os_fingerprint); + + nvlist_add_number(nvlr, "rtableid", r->rtableid); + for (int i = 0; i < PFTM_MAX; i++) + timeouts[i] = r->timeout[i]; + nvlist_add_number_array(nvlr, "timeout", timeouts, PFTM_MAX); + nvlist_add_number(nvlr, "max_states", r->max_states); + nvlist_add_number(nvlr, "max_src_nodes", r->max_src_nodes); + nvlist_add_number(nvlr, "max_src_states", r->max_src_states); + nvlist_add_number(nvlr, "max_src_conn", r->max_src_conn); + nvlist_add_number(nvlr, "max_src_conn_rate.limit", + r->max_src_conn_rate.limit); + nvlist_add_number(nvlr, "max_src_conn_rate.seconds", + r->max_src_conn_rate.seconds); + nvlist_add_number(nvlr, "prob", r->prob); + nvlist_add_number(nvlr, "cuid", r->cuid); + nvlist_add_number(nvlr, "cpid", r->cpid); + + nvlist_add_number(nvlr, "return_icmp", r->return_icmp); + nvlist_add_number(nvlr, "return_icmp6", r->return_icmp6); + + nvlist_add_number(nvlr, "max_mss", r->max_mss); + nvlist_add_number(nvlr, "scrub_flags", r->scrub_flags); + + pfctl_nv_add_uid(nvlr, "uid", &r->uid); + pfctl_nv_add_uid(nvlr, "gid", (struct pf_rule_uid *)&r->gid); + + nvlist_add_number(nvlr, "rule_flag", r->rule_flag); + nvlist_add_number(nvlr, "action", r->action); + nvlist_add_number(nvlr, "direction", r->direction); + nvlist_add_number(nvlr, "log", r->log); + nvlist_add_number(nvlr, "logif", r->logif); + nvlist_add_number(nvlr, "quick", r->quick); + nvlist_add_number(nvlr, "ifnot", r->ifnot); + nvlist_add_number(nvlr, "match_tag_not", r->match_tag_not); + nvlist_add_number(nvlr, "natpass", r->natpass); + + nvlist_add_number(nvlr, "keep_state", r->keep_state); + nvlist_add_number(nvlr, "af", r->af); + nvlist_add_number(nvlr, "proto", r->proto); + nvlist_add_number(nvlr, "type", r->type); + nvlist_add_number(nvlr, "code", r->code); + nvlist_add_number(nvlr, "flags", r->flags); + nvlist_add_number(nvlr, "flagset", r->flagset); + nvlist_add_number(nvlr, "min_ttl", r->min_ttl); + nvlist_add_number(nvlr, "allow_opts", r->allow_opts); + nvlist_add_number(nvlr, "rt", r->rt); + nvlist_add_number(nvlr, "return_ttl", r->return_ttl); + nvlist_add_number(nvlr, "tos", r->tos); + nvlist_add_number(nvlr, "set_tos", r->set_tos); + nvlist_add_number(nvlr, "anchor_relative", r->anchor_relative); + nvlist_add_number(nvlr, "anchor_wildcard", r->anchor_wildcard); + + nvlist_add_number(nvlr, "flush", r->flush); + + nvlist_add_number(nvlr, "prio", r->prio); + set_prio[0] = r->set_prio[0]; + set_prio[1] = r->set_prio[1]; + nvlist_add_number_array(nvlr, "set_prio", set_prio, 2); + + pfctl_nv_add_divert(nvlr, "divert", r); + + nvlist_add_nvlist(nvl, "rule", nvlr); + + /* Now do the call. */ + nv.data = nvlist_pack(nvl, &nv.len); + nv.size = nv.len; + + ret = ioctl(pf->dev, DIOCADDRULENV, &nv); + + free(nv.data); + nvlist_destroy(nvl); + + return (ret); +} + int pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth) { u_int8_t rs_num = pf_get_ruleset_number(r->action); char *name; - struct pfioc_rule pr; + u_int32_t ticket; + char anchor[PF_ANCHOR_NAME_SIZE]; int len = strlen(path); - bzero(&pr, sizeof(pr)); /* set up anchor before adding to path for anchor_call */ if ((pf->opts & PF_OPT_NOACTION) == 0) - pr.ticket = pfctl_get_ticket(pf->trans, rs_num, path); - if (strlcpy(pr.anchor, path, sizeof(pr.anchor)) >= sizeof(pr.anchor)) + ticket = pfctl_get_ticket(pf->trans, rs_num, path); + if (strlcpy(anchor, path, sizeof(anchor)) >= sizeof(anchor)) errx(1, "pfctl_load_rule: strlcpy"); if (r->anchor) { @@ -1454,13 +1653,9 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth) if ((pf->opts & PF_OPT_NOACTION) == 0) { if (pfctl_add_pool(pf, &r->rpool, r->af)) return (1); - pr.pool_ticket = pf->paddr.ticket; - memcpy(&pr.rule, r, sizeof(pr.rule)); - if (r->anchor && strlcpy(pr.anchor_call, name, - sizeof(pr.anchor_call)) >= sizeof(pr.anchor_call)) - errx(1, "pfctl_load_rule: strlcpy"); - if (ioctl(pf->dev, DIOCADDRULE, &pr)) - err(1, "DIOCADDRULE"); + if (pfctl_addrule(pf, r, anchor, name, ticket, + pf->paddr.ticket)) + err(1, "DIOCADDRULENV"); } if (pf->opts & PF_OPT_VERBOSE) { From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A644630EF7; Fri, 7 May 2021 15:25:39 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmL5Wkjz4k1f; Fri, 7 May 2021 15:25:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9A0915B3A; Fri, 7 May 2021 15:25:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPcm4026045; Fri, 7 May 2021 15:25:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPckQ026044; Fri, 7 May 2021 15:25:38 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:38 GMT Message-Id: <202105071525.147FPckQ026044@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: a3e4fd8b3393 - stable/13 - pf: Implement nvlist variant of DIOCGETRULE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a3e4fd8b33932a8168cf8a99381b4bd6c87aaad7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:39 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a3e4fd8b33932a8168cf8a99381b4bd6c87aaad7 commit a3e4fd8b33932a8168cf8a99381b4bd6c87aaad7 Author: Kristof Provost AuthorDate: 2021-03-25 09:39:14 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:41 +0000 pf: Implement nvlist variant of DIOCGETRULE MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29559 (cherry picked from commit d710367d1159423ed4da6628b7ab042d3e44f900) --- sys/net/pfvar.h | 4 + sys/netpfil/pf/pf_ioctl.c | 398 ++++++++++++++++++++++++++++++++++++++++++++ sys/netpfil/pf/pf_nv.c | 23 ++- sys/netpfil/pf/pf_nv.h | 7 + sys/netpfil/pf/pf_ruleset.c | 47 ++++++ 5 files changed, 473 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 584724b88b13..0ca46bb8048a 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -1231,6 +1232,7 @@ struct pfioc_iface { #define DIOCADDRULENV _IOWR('D', 4, struct pfioc_nv) #define DIOCGETRULES _IOWR('D', 6, struct pfioc_rule) #define DIOCGETRULE _IOWR('D', 7, struct pfioc_rule) +#define DIOCGETRULENV _IOWR('D', 7, struct pfioc_nv) /* XXX cut 8 - 17 */ #define DIOCCLRSTATES _IOWR('D', 18, struct pfioc_state_kill) #define DIOCGETSTATE _IOWR('D', 19, struct pfioc_state) @@ -1634,6 +1636,8 @@ VNET_DECLARE(struct pf_kanchor, pf_main_anchor); void pf_init_kruleset(struct pf_kruleset *); int pf_kanchor_setup(struct pf_krule *, const struct pf_kruleset *, const char *); +int pf_kanchor_nvcopyout(const struct pf_kruleset *, + const struct pf_krule *, nvlist_t *); int pf_kanchor_copyout(const struct pf_kruleset *, const struct pf_krule *, struct pfioc_rule *); void pf_kanchor_remove(struct pf_krule *); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 87a52dd41542..cdff32916953 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1630,6 +1630,20 @@ pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *paddr) return (pf_nvbinary(nvl, "addr", paddr, sizeof(*paddr))); } +static nvlist_t * +pf_addr_to_nvaddr(const struct pf_addr *paddr) +{ + nvlist_t *nvl; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + nvlist_add_binary(nvl, "addr", paddr, sizeof(*paddr)); + + return (nvl); +} + static int pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_kpool *kpool) { @@ -1653,6 +1667,33 @@ errout: return (error); } +static nvlist_t * +pf_pool_to_nvpool(const struct pf_kpool *pool) +{ + nvlist_t *nvl; + nvlist_t *tmp; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); + tmp = pf_addr_to_nvaddr(&pool->counter); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "counter", tmp); + + nvlist_add_number(nvl, "tblidx", pool->tblidx); + pf_uint16_array_nv(nvl, "proxy_port", pool->proxy_port, 2); + nvlist_add_number(nvl, "opts", pool->opts); + + return (nvl); + +error: + nvlist_destroy(nvl); + return (NULL); +} + static int pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) { @@ -1693,6 +1734,37 @@ errout: return (error); } +static nvlist_t * +pf_addr_wrap_to_nvaddr_wrap(const struct pf_addr_wrap *addr) +{ + nvlist_t *nvl; + nvlist_t *tmp; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + nvlist_add_number(nvl, "type", addr->type); + nvlist_add_number(nvl, "iflags", addr->iflags); + nvlist_add_string(nvl, "ifname", addr->v.ifname); + nvlist_add_string(nvl, "tblname", addr->v.tblname); + + tmp = pf_addr_to_nvaddr(&addr->v.a.addr); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "addr", tmp); + tmp = pf_addr_to_nvaddr(&addr->v.a.mask); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "mask", tmp); + + return (nvl); + +error: + nvlist_destroy(nvl); + return (NULL); +} + static int pf_validate_op(uint8_t op) { @@ -1735,6 +1807,31 @@ errout: return (error); } +static nvlist_t * +pf_rule_addr_to_nvrule_addr(const struct pf_rule_addr *addr) +{ + nvlist_t *nvl; + nvlist_t *tmp; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + tmp = pf_addr_wrap_to_nvaddr_wrap(&addr->addr); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "addr", tmp); + pf_uint16_array_nv(nvl, "port", addr->port, 2); + nvlist_add_number(nvl, "neg", addr->neg); + nvlist_add_number(nvl, "port_op", addr->port_op); + + return (nvl); + +error: + nvlist_destroy(nvl); + return (NULL); +} + static int pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) { @@ -1751,6 +1848,21 @@ errout: return (error); } +static nvlist_t * +pf_rule_uid_to_nvrule_uid(const struct pf_rule_uid *uid) +{ + nvlist_t *nvl; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + pf_uint32_array_nv(nvl, "uid", uid->uid, 2); + nvlist_add_number(nvl, "op", uid->op); + + return (nvl); +} + static int pf_nvrule_gid_to_rule_gid(const nvlist_t *nvl, struct pf_rule_gid *gid) { @@ -1912,6 +2024,158 @@ errout: return (error); } +static nvlist_t * +pf_divert_to_nvdivert(const struct pf_krule *rule) +{ + nvlist_t *nvl; + nvlist_t *tmp; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + tmp = pf_addr_to_nvaddr(&rule->divert.addr); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "addr", tmp); + nvlist_add_number(nvl, "port", rule->divert.port); + + return (nvl); + +error: + nvlist_destroy(nvl); + return (NULL); +} + +static nvlist_t * +pf_krule_to_nvrule(const struct pf_krule *rule) +{ + nvlist_t *nvl, *tmp; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (nvl); + + nvlist_add_number(nvl, "nr", rule->nr); + tmp = pf_rule_addr_to_nvrule_addr(&rule->src); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "src", tmp); + tmp = pf_rule_addr_to_nvrule_addr(&rule->dst); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "dst", tmp); + + for (int i = 0; i < PF_SKIP_COUNT; i++) { + nvlist_append_number_array(nvl, "skip", + rule->skip[i].ptr ? rule->skip[i].ptr->nr : -1); + } + + nvlist_add_string(nvl, "label", rule->label); + nvlist_add_string(nvl, "ifname", rule->ifname); + nvlist_add_string(nvl, "qname", rule->qname); + nvlist_add_string(nvl, "pqname", rule->pqname); + nvlist_add_string(nvl, "tagname", rule->tagname); + nvlist_add_string(nvl, "match_tagname", rule->match_tagname); + nvlist_add_string(nvl, "overload_tblname", rule->overload_tblname); + + tmp = pf_pool_to_nvpool(&rule->rpool); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "rpool", tmp); + + nvlist_add_number(nvl, "evaluations", + counter_u64_fetch(rule->evaluations)); + for (int i = 0; i < 2; i++) { + nvlist_append_number_array(nvl, "packets", + counter_u64_fetch(rule->packets[i])); + nvlist_append_number_array(nvl, "bytes", + counter_u64_fetch(rule->bytes[i])); + } + + nvlist_add_number(nvl, "os_fingerprint", rule->os_fingerprint); + + nvlist_add_number(nvl, "rtableid", rule->rtableid); + pf_uint32_array_nv(nvl, "timeout", rule->timeout, PFTM_MAX); + nvlist_add_number(nvl, "max_states", rule->max_states); + nvlist_add_number(nvl, "max_src_nodes", rule->max_src_nodes); + nvlist_add_number(nvl, "max_src_states", rule->max_src_states); + nvlist_add_number(nvl, "max_src_conn", rule->max_src_conn); + nvlist_add_number(nvl, "max_src_conn_rate.limit", + rule->max_src_conn_rate.limit); + nvlist_add_number(nvl, "max_src_conn_rate.seconds", + rule->max_src_conn_rate.seconds); + nvlist_add_number(nvl, "qid", rule->qid); + nvlist_add_number(nvl, "pqid", rule->pqid); + nvlist_add_number(nvl, "prob", rule->prob); + nvlist_add_number(nvl, "cuid", rule->cuid); + nvlist_add_number(nvl, "cpid", rule->cpid); + + nvlist_add_number(nvl, "states_cur", + counter_u64_fetch(rule->states_cur)); + nvlist_add_number(nvl, "states_tot", + counter_u64_fetch(rule->states_tot)); + nvlist_add_number(nvl, "src_nodes", + counter_u64_fetch(rule->src_nodes)); + + nvlist_add_number(nvl, "return_icmp", rule->return_icmp); + nvlist_add_number(nvl, "return_icmp6", rule->return_icmp6); + + nvlist_add_number(nvl, "max_mss", rule->max_mss); + nvlist_add_number(nvl, "scrub_flags", rule->scrub_flags); + + tmp = pf_rule_uid_to_nvrule_uid(&rule->uid); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "uid", tmp); + tmp = pf_rule_uid_to_nvrule_uid((const struct pf_rule_uid *)&rule->gid); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "gid", tmp); + + nvlist_add_number(nvl, "rule_flag", rule->rule_flag); + nvlist_add_number(nvl, "action", rule->action); + nvlist_add_number(nvl, "direction", rule->direction); + nvlist_add_number(nvl, "log", rule->log); + nvlist_add_number(nvl, "logif", rule->logif); + nvlist_add_number(nvl, "quick", rule->quick); + nvlist_add_number(nvl, "ifnot", rule->ifnot); + nvlist_add_number(nvl, "match_tag_not", rule->match_tag_not); + nvlist_add_number(nvl, "natpass", rule->natpass); + + nvlist_add_number(nvl, "keep_state", rule->keep_state); + nvlist_add_number(nvl, "af", rule->af); + nvlist_add_number(nvl, "proto", rule->proto); + nvlist_add_number(nvl, "type", rule->type); + nvlist_add_number(nvl, "code", rule->code); + nvlist_add_number(nvl, "flags", rule->flags); + nvlist_add_number(nvl, "flagset", rule->flagset); + nvlist_add_number(nvl, "min_ttl", rule->min_ttl); + nvlist_add_number(nvl, "allow_opts", rule->allow_opts); + nvlist_add_number(nvl, "rt", rule->rt); + nvlist_add_number(nvl, "return_ttl", rule->return_ttl); + nvlist_add_number(nvl, "tos", rule->tos); + nvlist_add_number(nvl, "set_tos", rule->set_tos); + nvlist_add_number(nvl, "anchor_relative", rule->anchor_relative); + nvlist_add_number(nvl, "anchor_wildcard", rule->anchor_wildcard); + + nvlist_add_number(nvl, "flush", rule->flush); + nvlist_add_number(nvl, "prio", rule->prio); + + pf_uint8_array_nv(nvl, "set_prio", &rule->prio, 2); + + tmp = pf_divert_to_nvdivert(rule); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "divert", tmp); + + return (nvl); + +error: + nvlist_destroy(nvl); + return (NULL); +} + static int pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) { @@ -2254,6 +2518,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td switch (cmd) { case DIOCGETRULES: case DIOCGETRULE: + case DIOCGETRULENV: case DIOCGETADDRS: case DIOCGETADDR: case DIOCGETSTATE: @@ -2335,6 +2600,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCIGETIFACES: case DIOCGIFSPEEDV1: case DIOCGIFSPEEDV0: + case DIOCGETRULENV: break; case DIOCRCLRTABLES: case DIOCRADDTABLES: @@ -2560,6 +2826,138 @@ DIOCADDRULENV_error: break; } + case DIOCGETRULENV: { + struct pfioc_nv *nv = (struct pfioc_nv *)addr; + nvlist_t *nvrule = NULL; + nvlist_t *nvl = NULL; + struct pf_kruleset *ruleset; + struct pf_krule *rule; + void *nvlpacked = NULL; + int rs_num, nr; + bool clear_counter = false; + +#define ERROUT(x) do { error = (x); goto DIOCGETRULENV_error; } while (0) + + if (nv->len > pf_ioctl_maxcount) + ERROUT(ENOMEM); + + /* Copy the request in */ + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + error = copyin(nv->data, nvlpacked, nv->len); + if (error) + ERROUT(error); + + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) + ERROUT(EBADMSG); + + if (! nvlist_exists_string(nvl, "anchor")) + ERROUT(EBADMSG); + if (! nvlist_exists_number(nvl, "ruleset")) + ERROUT(EBADMSG); + if (! nvlist_exists_number(nvl, "ticket")) + ERROUT(EBADMSG); + if (! nvlist_exists_number(nvl, "nr")) + ERROUT(EBADMSG); + + if (nvlist_exists_bool(nvl, "clear_counter")) + clear_counter = nvlist_get_bool(nvl, "clear_counter"); + + if (clear_counter && !(flags & FWRITE)) + ERROUT(EACCES); + + nr = nvlist_get_number(nvl, "nr"); + + PF_RULES_WLOCK(); + ruleset = pf_find_kruleset(nvlist_get_string(nvl, "anchor")); + if (ruleset == NULL) { + PF_RULES_WUNLOCK(); + ERROUT(ENOENT); + } + + rs_num = pf_get_ruleset_number(nvlist_get_number(nvl, "ruleset")); + if (rs_num >= PF_RULESET_MAX) { + PF_RULES_WUNLOCK(); + ERROUT(EINVAL); + } + + if (nvlist_get_number(nvl, "ticket") != + ruleset->rules[rs_num].active.ticket) { + PF_RULES_WUNLOCK(); + ERROUT(EBUSY); + break; + } + + if ((error = nvlist_error(nvl))) { + PF_RULES_WUNLOCK(); + ERROUT(error); + } + + rule = TAILQ_FIRST(ruleset->rules[rs_num].active.ptr); + while ((rule != NULL) && (rule->nr != nr)) + rule = TAILQ_NEXT(rule, entries); + if (rule == NULL) { + PF_RULES_WUNLOCK(); + ERROUT(EBUSY); + break; + } + + nvrule = pf_krule_to_nvrule(rule); + + nvlist_destroy(nvl); + nvl = nvlist_create(0); + if (nvl == NULL) { + PF_RULES_WUNLOCK(); + ERROUT(ENOMEM); + } + nvlist_add_number(nvl, "nr", nr); + nvlist_add_nvlist(nvl, "rule", nvrule); + nvrule = NULL; + if (pf_kanchor_nvcopyout(ruleset, rule, nvl)) { + PF_RULES_WUNLOCK(); + ERROUT(EBUSY); + } + + free(nvlpacked, M_TEMP); + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) { + PF_RULES_WUNLOCK(); + ERROUT(ENOMEM); + } + + if (nv->size == 0) { + PF_RULES_WUNLOCK(); + ERROUT(0); + } + else if (nv->size < nv->len) { + PF_RULES_WUNLOCK(); + ERROUT(ENOSPC); + } + + error = copyout(nvlpacked, nv->data, nv->len); + + if (clear_counter) { + counter_u64_zero(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_zero(rule->packets[i]); + counter_u64_zero(rule->bytes[i]); + } + counter_u64_zero(rule->states_tot); + } + PF_RULES_WUNLOCK(); + +#undef ERROUT +DIOCGETRULENV_error: + free(nvlpacked, M_TEMP); + nvlist_destroy(nvrule); + nvlist_destroy(nvl); + + break; + } + case DIOCCHANGERULE: { struct pfioc_rule *pcr = (struct pfioc_rule *)addr; struct pf_kruleset *ruleset; diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index d583844c4086..d88c0b14e435 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #define PV_NV_IMPL_UINT(fnname, type, max) \ int \ - fnname(const nvlist_t *nvl, const char *name, type *val) \ + pf_nv ## fnname(const nvlist_t *nvl, const char *name, type *val) \ { \ uint64_t raw; \ if (! nvlist_exists_number(nvl, name)) \ @@ -49,8 +49,8 @@ __FBSDID("$FreeBSD$"); return (0); \ } \ int \ - fnname ## _array(const nvlist_t *nvl, const char *name, type *array, \ - size_t maxelems, size_t *nelems) \ + pf_nv ## fnname ## _array(const nvlist_t *nvl, const char *name, \ + type *array, size_t maxelems, size_t *nelems) \ { \ const uint64_t *n; \ size_t nitems; \ @@ -68,7 +68,18 @@ __FBSDID("$FreeBSD$"); array[i] = (type)n[i]; \ } \ return (0); \ + } \ + void \ + pf_ ## fnname ## _array_nv(nvlist_t *nvl, const char *name, \ + const type *numbers, size_t count) \ + { \ + uint64_t tmp; \ + for (size_t i = 0; i < count; i++) { \ + tmp = numbers[i]; \ + nvlist_append_number_array(nvl, name, tmp); \ + } \ } + int pf_nvbinary(const nvlist_t *nvl, const char *name, void *data, size_t expected_size) @@ -90,9 +101,9 @@ pf_nvbinary(const nvlist_t *nvl, const char *name, void *data, return (0); } -PV_NV_IMPL_UINT(pf_nvuint8, uint8_t, UINT8_MAX) -PV_NV_IMPL_UINT(pf_nvuint16, uint16_t, UINT16_MAX); -PV_NV_IMPL_UINT(pf_nvuint32, uint32_t, UINT32_MAX) +PV_NV_IMPL_UINT(uint8, uint8_t, UINT8_MAX) +PV_NV_IMPL_UINT(uint16, uint16_t, UINT16_MAX); +PV_NV_IMPL_UINT(uint32, uint32_t, UINT32_MAX) int pf_nvint(const nvlist_t *nvl, const char *name, int *val) diff --git a/sys/netpfil/pf/pf_nv.h b/sys/netpfil/pf/pf_nv.h index f0db1e880e9e..0a0f9beeef40 100644 --- a/sys/netpfil/pf/pf_nv.h +++ b/sys/netpfil/pf/pf_nv.h @@ -36,12 +36,19 @@ int pf_nvint(const nvlist_t *, const char *, int *); int pf_nvuint8(const nvlist_t *, const char *, uint8_t *); int pf_nvuint8_array(const nvlist_t *, const char *, uint8_t *, size_t, size_t *); +void pf_uint8_array_nv(nvlist_t *, const char *, const uint8_t *, + size_t); int pf_nvuint16(const nvlist_t *, const char *, uint16_t *); int pf_nvuint16_array(const nvlist_t *, const char *, uint16_t *, size_t, size_t *); +void pf_uint16_array_nv(nvlist_t *, const char *, const uint16_t *, + size_t); int pf_nvuint32(const nvlist_t *, const char *, uint32_t *); int pf_nvuint32_array(const nvlist_t *, const char *, uint32_t *, size_t, size_t *); +void pf_uint32_array_nv(nvlist_t *, const char *, const uint32_t *, + size_t); + int pf_nvstring(const nvlist_t *, const char *, char *, size_t); #define PFNV_CHK(x) do { \ diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index 0cc0c357d59d..ad1b07f69fe6 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -336,6 +336,53 @@ pf_kanchor_setup(struct pf_krule *r, const struct pf_kruleset *s, return (0); } +int +pf_kanchor_nvcopyout(const struct pf_kruleset *rs, const struct pf_krule *r, + nvlist_t *nvl) +{ + char anchor_call[MAXPATHLEN] = { 0 }; + + if (r->anchor == NULL) + goto done; + if (!r->anchor_relative) { + strlcpy(anchor_call, "/", sizeof(anchor_call)); + strlcat(anchor_call, r->anchor->path, + sizeof(anchor_call)); + } else { + char a[MAXPATHLEN]; + char *p; + int i; + if (rs->anchor == NULL) + a[0] = 0; + else + strlcpy(a, rs->anchor->path, MAXPATHLEN); + for (i = 1; i < r->anchor_relative; ++i) { + if ((p = strrchr(a, '/')) == NULL) + p = a; + *p = 0; + strlcat(anchor_call, "../", + sizeof(anchor_call)); + } + if (strncmp(a, r->anchor->path, strlen(a))) { + printf("pf_anchor_copyout: '%s' '%s'\n", a, + r->anchor->path); + return (1); + } + if (strlen(r->anchor->path) > strlen(a)) + strlcat(anchor_call, r->anchor->path + (a[0] ? + strlen(a) + 1 : 0), sizeof(anchor_call)); + + } + if (r->anchor_wildcard) + strlcat(anchor_call, anchor_call[0] ? "/*" : "*", + sizeof(anchor_call)); + +done: + nvlist_add_string(nvl, "anchor_call", anchor_call); + + return (0); +} + int pf_kanchor_copyout(const struct pf_kruleset *rs, const struct pf_krule *r, struct pfioc_rule *pr) From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACDAB63114B; Fri, 7 May 2021 15:25:39 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmM2NcQz4jbw; Fri, 7 May 2021 15:25:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0A2615771; Fri, 7 May 2021 15:25:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPc4j026066; Fri, 7 May 2021 15:25:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPcds026065; Fri, 7 May 2021 15:25:38 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:38 GMT Message-Id: <202105071525.147FPcds026065@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 51a0e7f80dd6 - stable/12 - pfctl: Move to DIOCADDRULENV MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 51a0e7f80dd6d5b41015d7a5ec20bceb5a0174cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:40 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=51a0e7f80dd6d5b41015d7a5ec20bceb5a0174cb commit 51a0e7f80dd6d5b41015d7a5ec20bceb5a0174cb Author: Kristof Provost AuthorDate: 2021-03-12 17:03:14 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:00 +0000 pfctl: Move to DIOCADDRULENV Start using the new nvlist based ioctl to add rules. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29558 (cherry picked from commit 5c11c5a3655842a176124ef2334fcdf830422c8a) --- sbin/pfctl/Makefile | 2 +- sbin/pfctl/pfctl.c | 217 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 207 insertions(+), 12 deletions(-) diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile index 14dc83eb97b0..74cefe6824a4 100644 --- a/sbin/pfctl/Makefile +++ b/sbin/pfctl/Makefile @@ -27,7 +27,7 @@ CFLAGS+= -DWITH_INET YFLAGS= -LIBADD= m md +LIBADD= m md nv HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 4e00bf2462a6..58a87a2b8395 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1422,19 +1423,217 @@ pfctl_load_ruleset(struct pfctl *pf, char *path, struct pf_ruleset *rs, } +static void +pfctl_nv_add_addr(nvlist_t *nvparent, const char *name, + const struct pf_addr *addr) +{ + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_binary(nvl, "addr", addr, sizeof(*addr)); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_addr_wrap(nvlist_t *nvparent, const char *name, + const struct pf_addr_wrap *addr) +{ + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_number(nvl, "type", addr->type); + nvlist_add_number(nvl, "iflags", addr->iflags); + nvlist_add_string(nvl, "ifname", addr->v.ifname); + nvlist_add_string(nvl, "tblname", addr->v.tblname); + pfctl_nv_add_addr(nvl, "addr", &addr->v.a.addr); + pfctl_nv_add_addr(nvl, "mask", &addr->v.a.mask); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_rule_addr(nvlist_t *nvparent, const char *name, + const struct pf_rule_addr *addr) +{ + u_int64_t ports[2]; + nvlist_t *nvl = nvlist_create(0); + + pfctl_nv_add_addr_wrap(nvl, "addr", &addr->addr); + ports[0] = addr->port[0]; + ports[1] = addr->port[1]; + nvlist_add_number_array(nvl, "port", ports, 2); + nvlist_add_number(nvl, "neg", addr->neg); + nvlist_add_number(nvl, "port_op", addr->port_op); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, + const struct pf_pool *pool) +{ + u_int64_t ports[2]; + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); + pfctl_nv_add_addr(nvl, "counter", &pool->counter); + nvlist_add_number(nvl, "tblidx", pool->tblidx); + + ports[0] = pool->proxy_port[0]; + ports[1] = pool->proxy_port[1]; + nvlist_add_number_array(nvl, "proxy_port", ports, 2); + nvlist_add_number(nvl, "opts", pool->opts); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_uid(nvlist_t *nvparent, const char *name, + const struct pf_rule_uid *uid) +{ + u_int64_t uids[2]; + nvlist_t *nvl = nvlist_create(0); + + uids[0] = uid->uid[0]; + uids[1] = uid->uid[1]; + nvlist_add_number_array(nvl, "uid", uids, 2); + nvlist_add_number(nvl, "op", uid->op); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, + const struct pf_rule *r) +{ + nvlist_t *nvl = nvlist_create(0); + + pfctl_nv_add_addr(nvl, "addr", &r->divert.addr); + nvlist_add_number(nvl, "port", r->divert.port); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static int +pfctl_addrule(struct pfctl *pf, const struct pf_rule *r, const char *anchor, + const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) +{ + struct pfioc_nv nv; + u_int64_t timeouts[PFTM_MAX]; + u_int64_t set_prio[2]; + nvlist_t *nvl, *nvlr; + int ret; + + nvl = nvlist_create(0); + nvlr = nvlist_create(0); + + nvlist_add_number(nvl, "ticket", ticket); + nvlist_add_number(nvl, "pool_ticket", pool_ticket); + nvlist_add_string(nvl, "anchor", anchor); + nvlist_add_string(nvl, "anchor_call", anchor_call); + + nvlist_add_number(nvlr, "nr", r->nr); + pfctl_nv_add_rule_addr(nvlr, "src", &r->src); + pfctl_nv_add_rule_addr(nvlr, "dst", &r->dst); + + nvlist_add_string(nvlr, "label", r->label); + nvlist_add_string(nvlr, "ifname", r->ifname); + nvlist_add_string(nvlr, "qname", r->qname); + nvlist_add_string(nvlr, "pqname", r->pqname); + nvlist_add_string(nvlr, "tagname", r->tagname); + nvlist_add_string(nvlr, "match_tagname", r->match_tagname); + nvlist_add_string(nvlr, "overload_tblname", r->overload_tblname); + + pfctl_nv_add_pool(nvlr, "rpool", &r->rpool); + + nvlist_add_number(nvlr, "os_fingerprint", r->os_fingerprint); + + nvlist_add_number(nvlr, "rtableid", r->rtableid); + for (int i = 0; i < PFTM_MAX; i++) + timeouts[i] = r->timeout[i]; + nvlist_add_number_array(nvlr, "timeout", timeouts, PFTM_MAX); + nvlist_add_number(nvlr, "max_states", r->max_states); + nvlist_add_number(nvlr, "max_src_nodes", r->max_src_nodes); + nvlist_add_number(nvlr, "max_src_states", r->max_src_states); + nvlist_add_number(nvlr, "max_src_conn", r->max_src_conn); + nvlist_add_number(nvlr, "max_src_conn_rate.limit", + r->max_src_conn_rate.limit); + nvlist_add_number(nvlr, "max_src_conn_rate.seconds", + r->max_src_conn_rate.seconds); + nvlist_add_number(nvlr, "prob", r->prob); + nvlist_add_number(nvlr, "cuid", r->cuid); + nvlist_add_number(nvlr, "cpid", r->cpid); + + nvlist_add_number(nvlr, "return_icmp", r->return_icmp); + nvlist_add_number(nvlr, "return_icmp6", r->return_icmp6); + + nvlist_add_number(nvlr, "max_mss", r->max_mss); + nvlist_add_number(nvlr, "scrub_flags", r->scrub_flags); + + pfctl_nv_add_uid(nvlr, "uid", &r->uid); + pfctl_nv_add_uid(nvlr, "gid", (struct pf_rule_uid *)&r->gid); + + nvlist_add_number(nvlr, "rule_flag", r->rule_flag); + nvlist_add_number(nvlr, "action", r->action); + nvlist_add_number(nvlr, "direction", r->direction); + nvlist_add_number(nvlr, "log", r->log); + nvlist_add_number(nvlr, "logif", r->logif); + nvlist_add_number(nvlr, "quick", r->quick); + nvlist_add_number(nvlr, "ifnot", r->ifnot); + nvlist_add_number(nvlr, "match_tag_not", r->match_tag_not); + nvlist_add_number(nvlr, "natpass", r->natpass); + + nvlist_add_number(nvlr, "keep_state", r->keep_state); + nvlist_add_number(nvlr, "af", r->af); + nvlist_add_number(nvlr, "proto", r->proto); + nvlist_add_number(nvlr, "type", r->type); + nvlist_add_number(nvlr, "code", r->code); + nvlist_add_number(nvlr, "flags", r->flags); + nvlist_add_number(nvlr, "flagset", r->flagset); + nvlist_add_number(nvlr, "min_ttl", r->min_ttl); + nvlist_add_number(nvlr, "allow_opts", r->allow_opts); + nvlist_add_number(nvlr, "rt", r->rt); + nvlist_add_number(nvlr, "return_ttl", r->return_ttl); + nvlist_add_number(nvlr, "tos", r->tos); + nvlist_add_number(nvlr, "set_tos", r->set_tos); + nvlist_add_number(nvlr, "anchor_relative", r->anchor_relative); + nvlist_add_number(nvlr, "anchor_wildcard", r->anchor_wildcard); + + nvlist_add_number(nvlr, "flush", r->flush); + + nvlist_add_number(nvlr, "prio", r->prio); + set_prio[0] = r->set_prio[0]; + set_prio[1] = r->set_prio[1]; + nvlist_add_number_array(nvlr, "set_prio", set_prio, 2); + + pfctl_nv_add_divert(nvlr, "divert", r); + + nvlist_add_nvlist(nvl, "rule", nvlr); + + /* Now do the call. */ + nv.data = nvlist_pack(nvl, &nv.len); + nv.size = nv.len; + + ret = ioctl(pf->dev, DIOCADDRULENV, &nv); + + free(nv.data); + nvlist_destroy(nvl); + + return (ret); +} + int pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth) { u_int8_t rs_num = pf_get_ruleset_number(r->action); char *name; - struct pfioc_rule pr; + u_int32_t ticket; + char anchor[PF_ANCHOR_NAME_SIZE]; int len = strlen(path); - bzero(&pr, sizeof(pr)); /* set up anchor before adding to path for anchor_call */ if ((pf->opts & PF_OPT_NOACTION) == 0) - pr.ticket = pfctl_get_ticket(pf->trans, rs_num, path); - if (strlcpy(pr.anchor, path, sizeof(pr.anchor)) >= sizeof(pr.anchor)) + ticket = pfctl_get_ticket(pf->trans, rs_num, path); + if (strlcpy(anchor, path, sizeof(anchor)) >= sizeof(anchor)) errx(1, "pfctl_load_rule: strlcpy"); if (r->anchor) { @@ -1454,13 +1653,9 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth) if ((pf->opts & PF_OPT_NOACTION) == 0) { if (pfctl_add_pool(pf, &r->rpool, r->af)) return (1); - pr.pool_ticket = pf->paddr.ticket; - memcpy(&pr.rule, r, sizeof(pr.rule)); - if (r->anchor && strlcpy(pr.anchor_call, name, - sizeof(pr.anchor_call)) >= sizeof(pr.anchor_call)) - errx(1, "pfctl_load_rule: strlcpy"); - if (ioctl(pf->dev, DIOCADDRULE, &pr)) - err(1, "DIOCADDRULE"); + if (pfctl_addrule(pf, r, anchor, name, ticket, + pf->paddr.ticket)) + err(1, "DIOCADDRULENV"); } if (pf->opts & PF_OPT_VERBOSE) { From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E353631391; Fri, 7 May 2021 15:25:42 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmN24nwz4k1m; Fri, 7 May 2021 15:25:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B7C0D5ACF; Fri, 7 May 2021 15:25:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPdrU026087; Fri, 7 May 2021 15:25:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPd3W026086; Fri, 7 May 2021 15:25:39 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:39 GMT Message-Id: <202105071525.147FPd3W026086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: ad208b077153 - stable/13 - pfctl: Use the new DIOCGETRULENV ioctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ad208b0771531b8d190e55f96dd987de6d18d3f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:42 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ad208b0771531b8d190e55f96dd987de6d18d3f8 commit ad208b0771531b8d190e55f96dd987de6d18d3f8 Author: Kristof Provost AuthorDate: 2021-03-26 10:22:15 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:41 +0000 pfctl: Use the new DIOCGETRULENV ioctl Create wrapper functions to handle the parsing of the nvlist and move that code into pfctl_ioctl.c. At some point this should be moved into a libpfctl. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29560 (cherry picked from commit 0d6c8174ef2f3d8d6fb02ec97753a0937796a5c6) --- sbin/pfctl/Makefile | 2 +- sbin/pfctl/pfctl.c | 12 +- sbin/pfctl/pfctl_ioctl.c | 339 ++++++++++++++++++++++++++++++++++++++++++++ sbin/pfctl/pfctl_ioctl.h | 43 ++++++ sbin/pfctl/pfctl_optimize.c | 7 +- 5 files changed, 396 insertions(+), 7 deletions(-) diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile index 74cefe6824a4..c84d558c989d 100644 --- a/sbin/pfctl/Makefile +++ b/sbin/pfctl/Makefile @@ -9,7 +9,7 @@ MAN= pfctl.8 SRCS = pfctl.c parse.y pfctl_parser.c pf_print_state.c pfctl_altq.c SRCS+= pfctl_osfp.c pfctl_radix.c pfctl_table.c pfctl_qstats.c -SRCS+= pfctl_optimize.c +SRCS+= pfctl_optimize.c pfctl_ioctl.c SRCS+= pf_ruleset.c WARNS?= 2 diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 58a87a2b8395..1aa17065597b 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "pfctl_ioctl.h" #include "pfctl_parser.h" #include "pfctl.h" @@ -952,8 +953,9 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (ioctl(dev, DIOCGETRULE, &pr)) { - warn("DIOCGETRULE"); + if (pfctl_get_rule(dev, nr, pr.ticket, path, PF_SCRUB, + &pr.rule, pr.anchor_call)) { + warn("DIOCGETRULENV"); goto error; } @@ -984,7 +986,8 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, mnr = pr.nr; for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (ioctl(dev, DIOCGETRULE, &pr)) { + if (pfctl_get_rule(dev, nr, pr.ticket, path, PF_PASS, + &pr.rule, pr.anchor_call)) { warn("DIOCGETRULE"); goto error; } @@ -1074,7 +1077,8 @@ pfctl_show_nat(int dev, int opts, char *anchorname) mnr = pr.nr; for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (ioctl(dev, DIOCGETRULE, &pr)) { + if (pfctl_get_rule(dev, nr, pr.ticket, anchorname, + nattype[i], &pr.rule, pr.anchor_call)) { warn("DIOCGETRULE"); return (-1); } diff --git a/sbin/pfctl/pfctl_ioctl.c b/sbin/pfctl/pfctl_ioctl.c new file mode 100644 index 000000000000..878a57de0fe4 --- /dev/null +++ b/sbin/pfctl/pfctl_ioctl.c @@ -0,0 +1,339 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "pfctl_ioctl.h" + +static void +pf_nvuint_8_array(const nvlist_t *nvl, const char *name, size_t maxelems, + u_int8_t *numbers, size_t *nelems) +{ + const uint64_t *tmp; + size_t elems; + + tmp = nvlist_get_number_array(nvl, name, &elems); + assert(elems <= maxelems); + + for (size_t i = 0; i < elems; i++) + numbers[i] = tmp[i]; + + if (nelems) + *nelems = elems; +} + +static void +pf_nvuint_16_array(const nvlist_t *nvl, const char *name, size_t maxelems, + u_int16_t *numbers, size_t *nelems) +{ + const uint64_t *tmp; + size_t elems; + + tmp = nvlist_get_number_array(nvl, name, &elems); + assert(elems <= maxelems); + + for (size_t i = 0; i < elems; i++) + numbers[i] = tmp[i]; + + if (nelems) + *nelems = elems; +} + +static void +pf_nvuint_32_array(const nvlist_t *nvl, const char *name, size_t maxelems, + u_int32_t *numbers, size_t *nelems) +{ + const uint64_t *tmp; + size_t elems; + + tmp = nvlist_get_number_array(nvl, name, &elems); + assert(elems <= maxelems); + + for (size_t i = 0; i < elems; i++) + numbers[i] = tmp[i]; + + if (nelems) + *nelems = elems; +} + +static void +pf_nvuint_64_array(const nvlist_t *nvl, const char *name, size_t maxelems, + u_int64_t *numbers, size_t *nelems) +{ + const uint64_t *tmp; + size_t elems; + + tmp = nvlist_get_number_array(nvl, name, &elems); + assert(elems <= maxelems); + + for (size_t i = 0; i < elems; i++) + numbers[i] = tmp[i]; + + if (nelems) + *nelems = elems; +} + +static void +pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *addr) +{ + size_t len; + const void *data; + + data = nvlist_get_binary(nvl, "addr", &len); + assert(len == sizeof(struct pf_addr)); + memcpy(addr, data, len); +} + +static void +pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) +{ + addr->type = nvlist_get_number(nvl, "type"); + addr->iflags = nvlist_get_number(nvl, "iflags"); + strlcpy(addr->v.ifname, nvlist_get_string(nvl, "ifname"), IFNAMSIZ); + strlcpy(addr->v.tblname, nvlist_get_string(nvl, "tblname"), + PF_TABLE_NAME_SIZE); + + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), &addr->v.a.addr); + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "mask"), &addr->v.a.mask); +} + +static void +pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) +{ + pf_nvaddr_wrap_to_addr_wrap(nvlist_get_nvlist(nvl, "addr"), &addr->addr); + + pf_nvuint_16_array(nvl, "port", 2, addr->port, NULL); + addr->neg = nvlist_get_number(nvl, "neg"); + addr->port_op = nvlist_get_number(nvl, "port_op"); +} + +static void +pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_pool *pool) +{ + size_t len; + const void *data; + + data = nvlist_get_binary(nvl, "key", &len); + assert(len == sizeof(pool->key)); + memcpy(&pool->key, data, len); + + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "counter"), &pool->counter); + + pool->tblidx = nvlist_get_number(nvl, "tblidx"); + pf_nvuint_16_array(nvl, "proxy_port", 2, pool->proxy_port, NULL); + pool->opts = nvlist_get_number(nvl, "opts"); +} + +static void +pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) +{ + pf_nvuint_32_array(nvl, "uid", 2, uid->uid, NULL); + uid->op = nvlist_get_number(nvl, "op"); +} + +static void +pf_nvdivert_to_divert(const nvlist_t *nvl, struct pf_rule *rule) +{ + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), &rule->divert.addr); + rule->divert.port = nvlist_get_number(nvl, "port"); +} + +static void +pf_nvrule_to_rule(const nvlist_t *nvl, struct pf_rule *rule) +{ + const uint64_t *skip; + size_t skipcount; + + rule->nr = nvlist_get_number(nvl, "nr"); + + pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "src"), &rule->src); + pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "dst"), &rule->dst); + + skip = nvlist_get_number_array(nvl, "skip", &skipcount); + assert(skip); + assert(skipcount == PF_SKIP_COUNT); + for (int i = 0; i < PF_SKIP_COUNT; i++) + rule->skip[i].nr = skip[i]; + + strlcpy(rule->label, nvlist_get_string(nvl, "label"), PF_RULE_LABEL_SIZE); + strlcpy(rule->ifname, nvlist_get_string(nvl, "ifname"), IFNAMSIZ); + strlcpy(rule->qname, nvlist_get_string(nvl, "qname"), PF_QNAME_SIZE); + strlcpy(rule->pqname, nvlist_get_string(nvl, "pqname"), PF_QNAME_SIZE); + strlcpy(rule->tagname, nvlist_get_string(nvl, "tagname"), + PF_TAG_NAME_SIZE); + strlcpy(rule->match_tagname, nvlist_get_string(nvl, "match_tagname"), + PF_TAG_NAME_SIZE); + + strlcpy(rule->overload_tblname, nvlist_get_string(nvl, "overload_tblname"), + PF_TABLE_NAME_SIZE); + + pf_nvpool_to_pool(nvlist_get_nvlist(nvl, "rpool"), &rule->rpool); + + rule->evaluations = nvlist_get_number(nvl, "evaluations"); + pf_nvuint_64_array(nvl, "packets", 2, rule->packets, NULL); + pf_nvuint_64_array(nvl, "bytes", 2, rule->bytes, NULL); + + rule->os_fingerprint = nvlist_get_number(nvl, "os_fingerprint"); + + rule->rtableid = nvlist_get_number(nvl, "rtableid"); + pf_nvuint_32_array(nvl, "timeout", PFTM_MAX, rule->timeout, NULL); + rule->max_states = nvlist_get_number(nvl, "max_states"); + rule->max_src_nodes = nvlist_get_number(nvl, "max_src_nodes"); + rule->max_src_states = nvlist_get_number(nvl, "max_src_states"); + rule->max_src_conn = nvlist_get_number(nvl, "max_src_conn"); + rule->max_src_conn_rate.limit = + nvlist_get_number(nvl, "max_src_conn_rate.limit"); + rule->max_src_conn_rate.seconds = + nvlist_get_number(nvl, "max_src_conn_rate.seconds"); + rule->qid = nvlist_get_number(nvl, "qid"); + rule->pqid = nvlist_get_number(nvl, "pqid"); + rule->prob = nvlist_get_number(nvl, "prob"); + rule->cuid = nvlist_get_number(nvl, "cuid"); + rule->cpid = nvlist_get_number(nvl, "cpid"); + + rule->return_icmp = nvlist_get_number(nvl, "return_icmp"); + rule->return_icmp6 = nvlist_get_number(nvl, "return_icmp6"); + rule->max_mss = nvlist_get_number(nvl, "max_mss"); + rule->scrub_flags = nvlist_get_number(nvl, "scrub_flags"); + + pf_nvrule_uid_to_rule_uid(nvlist_get_nvlist(nvl, "uid"), &rule->uid); + pf_nvrule_uid_to_rule_uid(nvlist_get_nvlist(nvl, "gid"), + (struct pf_rule_uid *)&rule->gid); + + rule->rule_flag = nvlist_get_number(nvl, "rule_flag"); + rule->action = nvlist_get_number(nvl, "action"); + rule->direction = nvlist_get_number(nvl, "direction"); + rule->log = nvlist_get_number(nvl, "log"); + rule->logif = nvlist_get_number(nvl, "logif"); + rule->quick = nvlist_get_number(nvl, "quick"); + rule->ifnot = nvlist_get_number(nvl, "ifnot"); + rule->match_tag_not = nvlist_get_number(nvl, "match_tag_not"); + rule->natpass = nvlist_get_number(nvl, "natpass"); + + rule->keep_state = nvlist_get_number(nvl, "keep_state"); + rule->af = nvlist_get_number(nvl, "af"); + rule->proto = nvlist_get_number(nvl, "proto"); + rule->type = nvlist_get_number(nvl, "type"); + rule->code = nvlist_get_number(nvl, "code"); + rule->flags = nvlist_get_number(nvl, "flags"); + rule->flagset = nvlist_get_number(nvl, "flagset"); + rule->min_ttl = nvlist_get_number(nvl, "min_ttl"); + rule->allow_opts = nvlist_get_number(nvl, "allow_opts"); + rule->rt = nvlist_get_number(nvl, "rt"); + rule->return_ttl = nvlist_get_number(nvl, "return_ttl"); + rule->tos = nvlist_get_number(nvl, "tos"); + rule->set_tos = nvlist_get_number(nvl, "set_tos"); + rule->anchor_relative = nvlist_get_number(nvl, "anchor_relative"); + rule->anchor_wildcard = nvlist_get_number(nvl, "anchor_wildcard"); + + rule->flush = nvlist_get_number(nvl, "flush"); + rule->prio = nvlist_get_number(nvl, "prio"); + pf_nvuint_8_array(nvl, "set_prio", 2, rule->set_prio, NULL); + + pf_nvdivert_to_divert(nvlist_get_nvlist(nvl, "divert"), rule); + + rule->u_states_cur = nvlist_get_number(nvl, "states_cur"); + rule->u_states_tot = nvlist_get_number(nvl, "states_tot"); + rule->u_src_nodes = nvlist_get_number(nvl, "src_nodes"); +} + + +int +pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, + u_int32_t ruleset, struct pf_rule *rule, char *anchor_call) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + void *nvlpacked; + int ret; + + nvl = nvlist_create(0); + if (nvl == 0) + return (ENOMEM); + + nvlist_add_number(nvl, "nr", nr); + nvlist_add_number(nvl, "ticket", ticket); + nvlist_add_string(nvl, "anchor", anchor); + nvlist_add_number(nvl, "ruleset", ruleset); + + nvlpacked = nvlist_pack(nvl, &nv.len); + if (nvlpacked == NULL) { + nvlist_destroy(nvl); + return (ENOMEM); + } + nv.data = malloc(8182); + nv.size = 8192; + assert(nv.len <= nv.size); + memcpy(nv.data, nvlpacked, nv.len); + nvlist_destroy(nvl); + nvl = NULL; + free(nvlpacked); + + ret = ioctl(dev, DIOCGETRULENV, &nv); + if (ret != 0) { + free(nv.data); + return (ret); + } + + nvl = nvlist_unpack(nv.data, nv.len, 0); + if (nvl == NULL) { + free(nv.data); + return (EIO); + } + + pf_nvrule_to_rule(nvlist_get_nvlist(nvl, "rule"), rule); + + if (anchor_call) + strlcpy(anchor_call, nvlist_get_string(nvl, "anchor_call"), + MAXPATHLEN); + + free(nv.data); + nvlist_destroy(nvl); + + return (0); +} diff --git a/sbin/pfctl/pfctl_ioctl.h b/sbin/pfctl/pfctl_ioctl.h new file mode 100644 index 000000000000..41dd0776854a --- /dev/null +++ b/sbin/pfctl/pfctl_ioctl.h @@ -0,0 +1,43 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _PFCTL_IOCTL_H_ +#define _PFCTL_IOCTL_H_ + +#include + +int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, + const char *anchor, u_int32_t ruleset, struct pf_rule *rule, + char *anchor_call); + +#endif diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index 599ed2424ebf..d3f0aa1bf3a4 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "pfctl_ioctl.h" #include "pfctl_parser.h" #include "pfctl.h" @@ -909,8 +910,10 @@ load_feedback_profile(struct pfctl *pf, struct superblocks *superblocks) return (1); } pr.nr = nr; - if (ioctl(pf->dev, DIOCGETRULE, &pr)) { - warn("DIOCGETRULES"); + + if (pfctl_get_rule(pf->dev, nr, pr.ticket, "", PF_PASS, + &pr.rule, pr.anchor_call)) { + warn("DIOCGETRULENV"); return (1); } memcpy(&por->por_rule, &pr.rule, sizeof(por->por_rule)); From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3192E631360; Fri, 7 May 2021 15:25:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmP001pz4k1t; Fri, 7 May 2021 15:25:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CCDFD58ED; Fri, 7 May 2021 15:25:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPem5026129; Fri, 7 May 2021 15:25:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPeeB026128; Fri, 7 May 2021 15:25:40 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:40 GMT Message-Id: <202105071525.147FPeeB026128@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 259e52433f0a - stable/13 - libnv: Build PIC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 259e52433f0afd6fecbe28b4ed26fd5524f6566d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:41 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=259e52433f0afd6fecbe28b4ed26fd5524f6566d commit 259e52433f0afd6fecbe28b4ed26fd5524f6566d Author: Kristof Provost AuthorDate: 2021-04-02 15:06:02 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:41 +0000 libnv: Build PIC Build libnv as position independent code so we can use it from shared libraries. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29561 (cherry picked from commit 0dd13c77432ade1ae94c9661cbad5537e3e6ab1d) --- lib/libnv/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile index b13758931c4e..854cd2c7f3f3 100644 --- a/lib/libnv/Makefile +++ b/lib/libnv/Makefile @@ -10,6 +10,7 @@ SHLIB_MAJOR= 0 .PATH: ${SRCTOP}/sys/contrib/libnv ${SRCTOP}/sys/sys CFLAGS+=-I${.CURDIR} +CFLAGS+=-fPIC SRCS= cnvlist.c SRCS+= dnvlist.c From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B3716310CD; Fri, 7 May 2021 15:25:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmQ2dg0z4k1y; Fri, 7 May 2021 15:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4811D5DBA; Fri, 7 May 2021 15:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPfDU026150; Fri, 7 May 2021 15:25:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPfFL026149; Fri, 7 May 2021 15:25:41 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:41 GMT Message-Id: <202105071525.147FPfFL026149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: d14cf045873b - stable/12 - pfctl: Use the new DIOCGETRULENV ioctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d14cf045873bee3bd15e246274591da24cf5daed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:43 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d14cf045873bee3bd15e246274591da24cf5daed commit d14cf045873bee3bd15e246274591da24cf5daed Author: Kristof Provost AuthorDate: 2021-03-26 10:22:15 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:00 +0000 pfctl: Use the new DIOCGETRULENV ioctl Create wrapper functions to handle the parsing of the nvlist and move that code into pfctl_ioctl.c. At some point this should be moved into a libpfctl. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29560 (cherry picked from commit 0d6c8174ef2f3d8d6fb02ec97753a0937796a5c6) --- sbin/pfctl/Makefile | 2 +- sbin/pfctl/pfctl.c | 12 +- sbin/pfctl/pfctl_ioctl.c | 339 ++++++++++++++++++++++++++++++++++++++++++++ sbin/pfctl/pfctl_ioctl.h | 43 ++++++ sbin/pfctl/pfctl_optimize.c | 7 +- 5 files changed, 396 insertions(+), 7 deletions(-) diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile index 74cefe6824a4..c84d558c989d 100644 --- a/sbin/pfctl/Makefile +++ b/sbin/pfctl/Makefile @@ -9,7 +9,7 @@ MAN= pfctl.8 SRCS = pfctl.c parse.y pfctl_parser.c pf_print_state.c pfctl_altq.c SRCS+= pfctl_osfp.c pfctl_radix.c pfctl_table.c pfctl_qstats.c -SRCS+= pfctl_optimize.c +SRCS+= pfctl_optimize.c pfctl_ioctl.c SRCS+= pf_ruleset.c WARNS?= 2 diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 58a87a2b8395..1aa17065597b 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "pfctl_ioctl.h" #include "pfctl_parser.h" #include "pfctl.h" @@ -952,8 +953,9 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (ioctl(dev, DIOCGETRULE, &pr)) { - warn("DIOCGETRULE"); + if (pfctl_get_rule(dev, nr, pr.ticket, path, PF_SCRUB, + &pr.rule, pr.anchor_call)) { + warn("DIOCGETRULENV"); goto error; } @@ -984,7 +986,8 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, mnr = pr.nr; for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (ioctl(dev, DIOCGETRULE, &pr)) { + if (pfctl_get_rule(dev, nr, pr.ticket, path, PF_PASS, + &pr.rule, pr.anchor_call)) { warn("DIOCGETRULE"); goto error; } @@ -1074,7 +1077,8 @@ pfctl_show_nat(int dev, int opts, char *anchorname) mnr = pr.nr; for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (ioctl(dev, DIOCGETRULE, &pr)) { + if (pfctl_get_rule(dev, nr, pr.ticket, anchorname, + nattype[i], &pr.rule, pr.anchor_call)) { warn("DIOCGETRULE"); return (-1); } diff --git a/sbin/pfctl/pfctl_ioctl.c b/sbin/pfctl/pfctl_ioctl.c new file mode 100644 index 000000000000..878a57de0fe4 --- /dev/null +++ b/sbin/pfctl/pfctl_ioctl.c @@ -0,0 +1,339 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "pfctl_ioctl.h" + +static void +pf_nvuint_8_array(const nvlist_t *nvl, const char *name, size_t maxelems, + u_int8_t *numbers, size_t *nelems) +{ + const uint64_t *tmp; + size_t elems; + + tmp = nvlist_get_number_array(nvl, name, &elems); + assert(elems <= maxelems); + + for (size_t i = 0; i < elems; i++) + numbers[i] = tmp[i]; + + if (nelems) + *nelems = elems; +} + +static void +pf_nvuint_16_array(const nvlist_t *nvl, const char *name, size_t maxelems, + u_int16_t *numbers, size_t *nelems) +{ + const uint64_t *tmp; + size_t elems; + + tmp = nvlist_get_number_array(nvl, name, &elems); + assert(elems <= maxelems); + + for (size_t i = 0; i < elems; i++) + numbers[i] = tmp[i]; + + if (nelems) + *nelems = elems; +} + +static void +pf_nvuint_32_array(const nvlist_t *nvl, const char *name, size_t maxelems, + u_int32_t *numbers, size_t *nelems) +{ + const uint64_t *tmp; + size_t elems; + + tmp = nvlist_get_number_array(nvl, name, &elems); + assert(elems <= maxelems); + + for (size_t i = 0; i < elems; i++) + numbers[i] = tmp[i]; + + if (nelems) + *nelems = elems; +} + +static void +pf_nvuint_64_array(const nvlist_t *nvl, const char *name, size_t maxelems, + u_int64_t *numbers, size_t *nelems) +{ + const uint64_t *tmp; + size_t elems; + + tmp = nvlist_get_number_array(nvl, name, &elems); + assert(elems <= maxelems); + + for (size_t i = 0; i < elems; i++) + numbers[i] = tmp[i]; + + if (nelems) + *nelems = elems; +} + +static void +pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *addr) +{ + size_t len; + const void *data; + + data = nvlist_get_binary(nvl, "addr", &len); + assert(len == sizeof(struct pf_addr)); + memcpy(addr, data, len); +} + +static void +pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) +{ + addr->type = nvlist_get_number(nvl, "type"); + addr->iflags = nvlist_get_number(nvl, "iflags"); + strlcpy(addr->v.ifname, nvlist_get_string(nvl, "ifname"), IFNAMSIZ); + strlcpy(addr->v.tblname, nvlist_get_string(nvl, "tblname"), + PF_TABLE_NAME_SIZE); + + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), &addr->v.a.addr); + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "mask"), &addr->v.a.mask); +} + +static void +pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) +{ + pf_nvaddr_wrap_to_addr_wrap(nvlist_get_nvlist(nvl, "addr"), &addr->addr); + + pf_nvuint_16_array(nvl, "port", 2, addr->port, NULL); + addr->neg = nvlist_get_number(nvl, "neg"); + addr->port_op = nvlist_get_number(nvl, "port_op"); +} + +static void +pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_pool *pool) +{ + size_t len; + const void *data; + + data = nvlist_get_binary(nvl, "key", &len); + assert(len == sizeof(pool->key)); + memcpy(&pool->key, data, len); + + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "counter"), &pool->counter); + + pool->tblidx = nvlist_get_number(nvl, "tblidx"); + pf_nvuint_16_array(nvl, "proxy_port", 2, pool->proxy_port, NULL); + pool->opts = nvlist_get_number(nvl, "opts"); +} + +static void +pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) +{ + pf_nvuint_32_array(nvl, "uid", 2, uid->uid, NULL); + uid->op = nvlist_get_number(nvl, "op"); +} + +static void +pf_nvdivert_to_divert(const nvlist_t *nvl, struct pf_rule *rule) +{ + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), &rule->divert.addr); + rule->divert.port = nvlist_get_number(nvl, "port"); +} + +static void +pf_nvrule_to_rule(const nvlist_t *nvl, struct pf_rule *rule) +{ + const uint64_t *skip; + size_t skipcount; + + rule->nr = nvlist_get_number(nvl, "nr"); + + pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "src"), &rule->src); + pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "dst"), &rule->dst); + + skip = nvlist_get_number_array(nvl, "skip", &skipcount); + assert(skip); + assert(skipcount == PF_SKIP_COUNT); + for (int i = 0; i < PF_SKIP_COUNT; i++) + rule->skip[i].nr = skip[i]; + + strlcpy(rule->label, nvlist_get_string(nvl, "label"), PF_RULE_LABEL_SIZE); + strlcpy(rule->ifname, nvlist_get_string(nvl, "ifname"), IFNAMSIZ); + strlcpy(rule->qname, nvlist_get_string(nvl, "qname"), PF_QNAME_SIZE); + strlcpy(rule->pqname, nvlist_get_string(nvl, "pqname"), PF_QNAME_SIZE); + strlcpy(rule->tagname, nvlist_get_string(nvl, "tagname"), + PF_TAG_NAME_SIZE); + strlcpy(rule->match_tagname, nvlist_get_string(nvl, "match_tagname"), + PF_TAG_NAME_SIZE); + + strlcpy(rule->overload_tblname, nvlist_get_string(nvl, "overload_tblname"), + PF_TABLE_NAME_SIZE); + + pf_nvpool_to_pool(nvlist_get_nvlist(nvl, "rpool"), &rule->rpool); + + rule->evaluations = nvlist_get_number(nvl, "evaluations"); + pf_nvuint_64_array(nvl, "packets", 2, rule->packets, NULL); + pf_nvuint_64_array(nvl, "bytes", 2, rule->bytes, NULL); + + rule->os_fingerprint = nvlist_get_number(nvl, "os_fingerprint"); + + rule->rtableid = nvlist_get_number(nvl, "rtableid"); + pf_nvuint_32_array(nvl, "timeout", PFTM_MAX, rule->timeout, NULL); + rule->max_states = nvlist_get_number(nvl, "max_states"); + rule->max_src_nodes = nvlist_get_number(nvl, "max_src_nodes"); + rule->max_src_states = nvlist_get_number(nvl, "max_src_states"); + rule->max_src_conn = nvlist_get_number(nvl, "max_src_conn"); + rule->max_src_conn_rate.limit = + nvlist_get_number(nvl, "max_src_conn_rate.limit"); + rule->max_src_conn_rate.seconds = + nvlist_get_number(nvl, "max_src_conn_rate.seconds"); + rule->qid = nvlist_get_number(nvl, "qid"); + rule->pqid = nvlist_get_number(nvl, "pqid"); + rule->prob = nvlist_get_number(nvl, "prob"); + rule->cuid = nvlist_get_number(nvl, "cuid"); + rule->cpid = nvlist_get_number(nvl, "cpid"); + + rule->return_icmp = nvlist_get_number(nvl, "return_icmp"); + rule->return_icmp6 = nvlist_get_number(nvl, "return_icmp6"); + rule->max_mss = nvlist_get_number(nvl, "max_mss"); + rule->scrub_flags = nvlist_get_number(nvl, "scrub_flags"); + + pf_nvrule_uid_to_rule_uid(nvlist_get_nvlist(nvl, "uid"), &rule->uid); + pf_nvrule_uid_to_rule_uid(nvlist_get_nvlist(nvl, "gid"), + (struct pf_rule_uid *)&rule->gid); + + rule->rule_flag = nvlist_get_number(nvl, "rule_flag"); + rule->action = nvlist_get_number(nvl, "action"); + rule->direction = nvlist_get_number(nvl, "direction"); + rule->log = nvlist_get_number(nvl, "log"); + rule->logif = nvlist_get_number(nvl, "logif"); + rule->quick = nvlist_get_number(nvl, "quick"); + rule->ifnot = nvlist_get_number(nvl, "ifnot"); + rule->match_tag_not = nvlist_get_number(nvl, "match_tag_not"); + rule->natpass = nvlist_get_number(nvl, "natpass"); + + rule->keep_state = nvlist_get_number(nvl, "keep_state"); + rule->af = nvlist_get_number(nvl, "af"); + rule->proto = nvlist_get_number(nvl, "proto"); + rule->type = nvlist_get_number(nvl, "type"); + rule->code = nvlist_get_number(nvl, "code"); + rule->flags = nvlist_get_number(nvl, "flags"); + rule->flagset = nvlist_get_number(nvl, "flagset"); + rule->min_ttl = nvlist_get_number(nvl, "min_ttl"); + rule->allow_opts = nvlist_get_number(nvl, "allow_opts"); + rule->rt = nvlist_get_number(nvl, "rt"); + rule->return_ttl = nvlist_get_number(nvl, "return_ttl"); + rule->tos = nvlist_get_number(nvl, "tos"); + rule->set_tos = nvlist_get_number(nvl, "set_tos"); + rule->anchor_relative = nvlist_get_number(nvl, "anchor_relative"); + rule->anchor_wildcard = nvlist_get_number(nvl, "anchor_wildcard"); + + rule->flush = nvlist_get_number(nvl, "flush"); + rule->prio = nvlist_get_number(nvl, "prio"); + pf_nvuint_8_array(nvl, "set_prio", 2, rule->set_prio, NULL); + + pf_nvdivert_to_divert(nvlist_get_nvlist(nvl, "divert"), rule); + + rule->u_states_cur = nvlist_get_number(nvl, "states_cur"); + rule->u_states_tot = nvlist_get_number(nvl, "states_tot"); + rule->u_src_nodes = nvlist_get_number(nvl, "src_nodes"); +} + + +int +pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, + u_int32_t ruleset, struct pf_rule *rule, char *anchor_call) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + void *nvlpacked; + int ret; + + nvl = nvlist_create(0); + if (nvl == 0) + return (ENOMEM); + + nvlist_add_number(nvl, "nr", nr); + nvlist_add_number(nvl, "ticket", ticket); + nvlist_add_string(nvl, "anchor", anchor); + nvlist_add_number(nvl, "ruleset", ruleset); + + nvlpacked = nvlist_pack(nvl, &nv.len); + if (nvlpacked == NULL) { + nvlist_destroy(nvl); + return (ENOMEM); + } + nv.data = malloc(8182); + nv.size = 8192; + assert(nv.len <= nv.size); + memcpy(nv.data, nvlpacked, nv.len); + nvlist_destroy(nvl); + nvl = NULL; + free(nvlpacked); + + ret = ioctl(dev, DIOCGETRULENV, &nv); + if (ret != 0) { + free(nv.data); + return (ret); + } + + nvl = nvlist_unpack(nv.data, nv.len, 0); + if (nvl == NULL) { + free(nv.data); + return (EIO); + } + + pf_nvrule_to_rule(nvlist_get_nvlist(nvl, "rule"), rule); + + if (anchor_call) + strlcpy(anchor_call, nvlist_get_string(nvl, "anchor_call"), + MAXPATHLEN); + + free(nv.data); + nvlist_destroy(nvl); + + return (0); +} diff --git a/sbin/pfctl/pfctl_ioctl.h b/sbin/pfctl/pfctl_ioctl.h new file mode 100644 index 000000000000..41dd0776854a --- /dev/null +++ b/sbin/pfctl/pfctl_ioctl.h @@ -0,0 +1,43 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _PFCTL_IOCTL_H_ +#define _PFCTL_IOCTL_H_ + +#include + +int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, + const char *anchor, u_int32_t ruleset, struct pf_rule *rule, + char *anchor_call); + +#endif diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index 599ed2424ebf..d3f0aa1bf3a4 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "pfctl_ioctl.h" #include "pfctl_parser.h" #include "pfctl.h" @@ -909,8 +910,10 @@ load_feedback_profile(struct pfctl *pf, struct superblocks *superblocks) return (1); } pr.nr = nr; - if (ioctl(pf->dev, DIOCGETRULE, &pr)) { - warn("DIOCGETRULES"); + + if (pfctl_get_rule(pf->dev, nr, pr.ticket, "", PF_PASS, + &pr.rule, pr.anchor_call)) { + warn("DIOCGETRULENV"); return (1); } memcpy(&por->por_rule, &pr.rule, sizeof(por->por_rule)); From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C066631396; Fri, 7 May 2021 15:25:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmQ2dm4z4k3l; Fri, 7 May 2021 15:25:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DCC575DBB; Fri, 7 May 2021 15:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPf3r026171; Fri, 7 May 2021 15:25:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPfEp026170; Fri, 7 May 2021 15:25:41 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:41 GMT Message-Id: <202105071525.147FPfEp026170@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 0da554e4b60a - stable/13 - pfctl: Move ioctl abstraction functions into libpfctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0da554e4b60a74340896cc4292bebd97b59e3685 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:43 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0da554e4b60a74340896cc4292bebd97b59e3685 commit 0da554e4b60a74340896cc4292bebd97b59e3685 Author: Kristof Provost AuthorDate: 2021-03-26 10:38:58 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:42 +0000 pfctl: Move ioctl abstraction functions into libpfctl Introduce a library to wrap the pf ioctl interface. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29562 (cherry picked from commit 0d71f9f36e6c1849fdaf6c1edc1178be07357034) --- lib/Makefile | 1 + lib/libpfctl/Makefile | 12 ++ .../pfctl/pfctl_ioctl.c => lib/libpfctl/libpfctl.c | 199 ++++++++++++++++++- lib/libpfctl/libpfctl.h | 45 +++++ sbin/pfctl/Makefile | 5 +- sbin/pfctl/parse.y | 6 +- sbin/pfctl/pfctl.c | 212 +-------------------- sbin/pfctl/pfctl_ioctl.h | 43 ----- sbin/pfctl/pfctl_optimize.c | 2 +- sbin/pfctl/pfctl_parser.h | 2 +- share/mk/src.libnames.mk | 5 + 11 files changed, 276 insertions(+), 256 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 90f1f7f3cd73..35cba77d7d06 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -210,6 +210,7 @@ SUBDIR.${MK_BHYVE}+= libvmmapi SUBDIR.${MK_OPENMP}+= libomp .endif SUBDIR.${MK_OPENSSL}+= libmp +SUBDIR.${MK_PF}+= libpfctl SUBDIR.${MK_PMC}+= libpmc libpmcstat SUBDIR.${MK_RADIUS_SUPPORT}+= libradius SUBDIR.${MK_SENDMAIL}+= libmilter libsm libsmdb libsmutil diff --git a/lib/libpfctl/Makefile b/lib/libpfctl/Makefile new file mode 100644 index 000000000000..d7a00a94b349 --- /dev/null +++ b/lib/libpfctl/Makefile @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PACKAGE= lib${LIB} +LIB= pfctl +INTERNALLIB= true + +SRCS= libpfctl.c +INCS= libpfctl.h + +CFLAGS+= -fPIC + +.include diff --git a/sbin/pfctl/pfctl_ioctl.c b/lib/libpfctl/libpfctl.c similarity index 62% rename from sbin/pfctl/pfctl_ioctl.c rename to lib/libpfctl/libpfctl.c index 878a57de0fe4..e0d429112f5b 100644 --- a/sbin/pfctl/pfctl_ioctl.c +++ b/lib/libpfctl/libpfctl.c @@ -48,7 +48,7 @@ #include #include -#include "pfctl_ioctl.h" +#include "libpfctl.h" static void pf_nvuint_8_array(const nvlist_t *nvl, const char *name, size_t maxelems, @@ -118,6 +118,17 @@ pf_nvuint_64_array(const nvlist_t *nvl, const char *name, size_t maxelems, *nelems = elems; } +static void +pfctl_nv_add_addr(nvlist_t *nvparent, const char *name, + const struct pf_addr *addr) +{ + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_binary(nvl, "addr", addr, sizeof(*addr)); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *addr) { @@ -129,6 +140,22 @@ pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *addr) memcpy(addr, data, len); } +static void +pfctl_nv_add_addr_wrap(nvlist_t *nvparent, const char *name, + const struct pf_addr_wrap *addr) +{ + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_number(nvl, "type", addr->type); + nvlist_add_number(nvl, "iflags", addr->iflags); + nvlist_add_string(nvl, "ifname", addr->v.ifname); + nvlist_add_string(nvl, "tblname", addr->v.tblname); + pfctl_nv_add_addr(nvl, "addr", &addr->v.a.addr); + pfctl_nv_add_addr(nvl, "mask", &addr->v.a.mask); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) { @@ -142,6 +169,23 @@ pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "mask"), &addr->v.a.mask); } +static void +pfctl_nv_add_rule_addr(nvlist_t *nvparent, const char *name, + const struct pf_rule_addr *addr) +{ + u_int64_t ports[2]; + nvlist_t *nvl = nvlist_create(0); + + pfctl_nv_add_addr_wrap(nvl, "addr", &addr->addr); + ports[0] = addr->port[0]; + ports[1] = addr->port[1]; + nvlist_add_number_array(nvl, "port", ports, 2); + nvlist_add_number(nvl, "neg", addr->neg); + nvlist_add_number(nvl, "port_op", addr->port_op); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) { @@ -152,6 +196,25 @@ pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) addr->port_op = nvlist_get_number(nvl, "port_op"); } +static void +pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, + const struct pf_pool *pool) +{ + u_int64_t ports[2]; + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); + pfctl_nv_add_addr(nvl, "counter", &pool->counter); + nvlist_add_number(nvl, "tblidx", pool->tblidx); + + ports[0] = pool->proxy_port[0]; + ports[1] = pool->proxy_port[1]; + nvlist_add_number_array(nvl, "proxy_port", ports, 2); + nvlist_add_number(nvl, "opts", pool->opts); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_pool *pool) { @@ -169,6 +232,21 @@ pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_pool *pool) pool->opts = nvlist_get_number(nvl, "opts"); } +static void +pfctl_nv_add_uid(nvlist_t *nvparent, const char *name, + const struct pf_rule_uid *uid) +{ + u_int64_t uids[2]; + nvlist_t *nvl = nvlist_create(0); + + uids[0] = uid->uid[0]; + uids[1] = uid->uid[1]; + nvlist_add_number_array(nvl, "uid", uids, 2); + nvlist_add_number(nvl, "op", uid->op); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) { @@ -176,6 +254,18 @@ pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) uid->op = nvlist_get_number(nvl, "op"); } +static void +pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, + const struct pf_rule *r) +{ + nvlist_t *nvl = nvlist_create(0); + + pfctl_nv_add_addr(nvl, "addr", &r->divert.addr); + nvlist_add_number(nvl, "port", r->divert.port); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvdivert_to_divert(const nvlist_t *nvl, struct pf_rule *rule) { @@ -282,6 +372,113 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pf_rule *rule) rule->u_src_nodes = nvlist_get_number(nvl, "src_nodes"); } +int +pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, + const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) +{ + struct pfioc_nv nv; + u_int64_t timeouts[PFTM_MAX]; + u_int64_t set_prio[2]; + nvlist_t *nvl, *nvlr; + int ret; + + nvl = nvlist_create(0); + nvlr = nvlist_create(0); + + nvlist_add_number(nvl, "ticket", ticket); + nvlist_add_number(nvl, "pool_ticket", pool_ticket); + nvlist_add_string(nvl, "anchor", anchor); + nvlist_add_string(nvl, "anchor_call", anchor_call); + + nvlist_add_number(nvlr, "nr", r->nr); + pfctl_nv_add_rule_addr(nvlr, "src", &r->src); + pfctl_nv_add_rule_addr(nvlr, "dst", &r->dst); + + nvlist_add_string(nvlr, "label", r->label); + nvlist_add_string(nvlr, "ifname", r->ifname); + nvlist_add_string(nvlr, "qname", r->qname); + nvlist_add_string(nvlr, "pqname", r->pqname); + nvlist_add_string(nvlr, "tagname", r->tagname); + nvlist_add_string(nvlr, "match_tagname", r->match_tagname); + nvlist_add_string(nvlr, "overload_tblname", r->overload_tblname); + + pfctl_nv_add_pool(nvlr, "rpool", &r->rpool); + + nvlist_add_number(nvlr, "os_fingerprint", r->os_fingerprint); + + nvlist_add_number(nvlr, "rtableid", r->rtableid); + for (int i = 0; i < PFTM_MAX; i++) + timeouts[i] = r->timeout[i]; + nvlist_add_number_array(nvlr, "timeout", timeouts, PFTM_MAX); + nvlist_add_number(nvlr, "max_states", r->max_states); + nvlist_add_number(nvlr, "max_src_nodes", r->max_src_nodes); + nvlist_add_number(nvlr, "max_src_states", r->max_src_states); + nvlist_add_number(nvlr, "max_src_conn", r->max_src_conn); + nvlist_add_number(nvlr, "max_src_conn_rate.limit", + r->max_src_conn_rate.limit); + nvlist_add_number(nvlr, "max_src_conn_rate.seconds", + r->max_src_conn_rate.seconds); + nvlist_add_number(nvlr, "prob", r->prob); + nvlist_add_number(nvlr, "cuid", r->cuid); + nvlist_add_number(nvlr, "cpid", r->cpid); + + nvlist_add_number(nvlr, "return_icmp", r->return_icmp); + nvlist_add_number(nvlr, "return_icmp6", r->return_icmp6); + + nvlist_add_number(nvlr, "max_mss", r->max_mss); + nvlist_add_number(nvlr, "scrub_flags", r->scrub_flags); + + pfctl_nv_add_uid(nvlr, "uid", &r->uid); + pfctl_nv_add_uid(nvlr, "gid", (const struct pf_rule_uid *)&r->gid); + + nvlist_add_number(nvlr, "rule_flag", r->rule_flag); + nvlist_add_number(nvlr, "action", r->action); + nvlist_add_number(nvlr, "direction", r->direction); + nvlist_add_number(nvlr, "log", r->log); + nvlist_add_number(nvlr, "logif", r->logif); + nvlist_add_number(nvlr, "quick", r->quick); + nvlist_add_number(nvlr, "ifnot", r->ifnot); + nvlist_add_number(nvlr, "match_tag_not", r->match_tag_not); + nvlist_add_number(nvlr, "natpass", r->natpass); + + nvlist_add_number(nvlr, "keep_state", r->keep_state); + nvlist_add_number(nvlr, "af", r->af); + nvlist_add_number(nvlr, "proto", r->proto); + nvlist_add_number(nvlr, "type", r->type); + nvlist_add_number(nvlr, "code", r->code); + nvlist_add_number(nvlr, "flags", r->flags); + nvlist_add_number(nvlr, "flagset", r->flagset); + nvlist_add_number(nvlr, "min_ttl", r->min_ttl); + nvlist_add_number(nvlr, "allow_opts", r->allow_opts); + nvlist_add_number(nvlr, "rt", r->rt); + nvlist_add_number(nvlr, "return_ttl", r->return_ttl); + nvlist_add_number(nvlr, "tos", r->tos); + nvlist_add_number(nvlr, "set_tos", r->set_tos); + nvlist_add_number(nvlr, "anchor_relative", r->anchor_relative); + nvlist_add_number(nvlr, "anchor_wildcard", r->anchor_wildcard); + + nvlist_add_number(nvlr, "flush", r->flush); + + nvlist_add_number(nvlr, "prio", r->prio); + set_prio[0] = r->set_prio[0]; + set_prio[1] = r->set_prio[1]; + nvlist_add_number_array(nvlr, "set_prio", set_prio, 2); + + pfctl_nv_add_divert(nvlr, "divert", r); + + nvlist_add_nvlist(nvl, "rule", nvlr); + + /* Now do the call. */ + nv.data = nvlist_pack(nvl, &nv.len); + nv.size = nv.len; + + ret = ioctl(dev, DIOCADDRULENV, &nv); + + free(nv.data); + nvlist_destroy(nvl); + + return (ret); +} int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h new file mode 100644 index 000000000000..65ff2179f23d --- /dev/null +++ b/lib/libpfctl/libpfctl.h @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _PFCTL_IOCTL_H_ +#define _PFCTL_IOCTL_H_ + +#include + +int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, + const char *anchor, u_int32_t ruleset, struct pf_rule *rule, + char *anchor_call); +int pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, + const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket); + +#endif diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile index c84d558c989d..49bdfb9e3733 100644 --- a/sbin/pfctl/Makefile +++ b/sbin/pfctl/Makefile @@ -9,13 +9,14 @@ MAN= pfctl.8 SRCS = pfctl.c parse.y pfctl_parser.c pf_print_state.c pfctl_altq.c SRCS+= pfctl_osfp.c pfctl_radix.c pfctl_table.c pfctl_qstats.c -SRCS+= pfctl_optimize.c pfctl_ioctl.c +SRCS+= pfctl_optimize.c SRCS+= pf_ruleset.c WARNS?= 2 CFLAGS+= -Wall -Wmissing-prototypes -Wno-uninitialized CFLAGS+= -Wstrict-prototypes CFLAGS+= -DENABLE_ALTQ -I${.CURDIR} +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl # Need to use "WITH_" prefix to not conflict with the l/y INET/INET6 keywords .if ${MK_INET6_SUPPORT} != "no" @@ -27,7 +28,7 @@ CFLAGS+= -DWITH_INET YFLAGS= -LIBADD= m md nv +LIBADD= m md pfctl HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 9db85538feaf..89e421e6b5ad 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1040,7 +1040,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto decide_address_family($6.src.host, &r.af); decide_address_family($6.dst.host, &r.af); - pfctl_add_rule(pf, &r, $2); + pfctl_append_rule(pf, &r, $2); free($2); } ; @@ -4390,7 +4390,7 @@ binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag free($13); } - pfctl_add_rule(pf, &binat, ""); + pfctl_append_rule(pf, &binat, ""); } ; @@ -5407,7 +5407,7 @@ expand_rule(struct pf_rule *r, yyerror("skipping rule due to errors"); else { r->nr = pf->astack[pf->asd]->match++; - pfctl_add_rule(pf, r, anchor_call); + pfctl_append_rule(pf, r, anchor_call); added++; } diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 1aa17065597b..fde9d61260ef 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -63,7 +64,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "pfctl_ioctl.h" #include "pfctl_parser.h" #include "pfctl.h" @@ -1291,7 +1291,7 @@ pfctl_add_pool(struct pfctl *pf, struct pf_pool *p, sa_family_t af) } int -pfctl_add_rule(struct pfctl *pf, struct pf_rule *r, const char *anchor_call) +pfctl_append_rule(struct pfctl *pf, struct pf_rule *r, const char *anchor_call) { u_int8_t rs_num; struct pf_rule *rule; @@ -1309,22 +1309,22 @@ pfctl_add_rule(struct pfctl *pf, struct pf_rule *r, const char *anchor_call) * Don't make non-brace anchors part of the main anchor pool. */ if ((r->anchor = calloc(1, sizeof(*r->anchor))) == NULL) - err(1, "pfctl_add_rule: calloc"); + err(1, "pfctl_append_rule: calloc"); pf_init_ruleset(&r->anchor->ruleset); r->anchor->ruleset.anchor = r->anchor; if (strlcpy(r->anchor->path, anchor_call, sizeof(rule->anchor->path)) >= sizeof(rule->anchor->path)) - errx(1, "pfctl_add_rule: strlcpy"); + errx(1, "pfctl_append_rule: strlcpy"); if ((p = strrchr(anchor_call, '/')) != NULL) { if (!strlen(p)) - err(1, "pfctl_add_rule: bad anchor name %s", + err(1, "pfctl_append_rule: bad anchor name %s", anchor_call); } else p = (char *)anchor_call; if (strlcpy(r->anchor->name, p, sizeof(rule->anchor->name)) >= sizeof(rule->anchor->name)) - errx(1, "pfctl_add_rule: strlcpy"); + errx(1, "pfctl_append_rule: strlcpy"); } if ((rule = calloc(1, sizeof(*rule))) == NULL) @@ -1427,204 +1427,6 @@ pfctl_load_ruleset(struct pfctl *pf, char *path, struct pf_ruleset *rs, } -static void -pfctl_nv_add_addr(nvlist_t *nvparent, const char *name, - const struct pf_addr *addr) -{ - nvlist_t *nvl = nvlist_create(0); - - nvlist_add_binary(nvl, "addr", addr, sizeof(*addr)); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_addr_wrap(nvlist_t *nvparent, const char *name, - const struct pf_addr_wrap *addr) -{ - nvlist_t *nvl = nvlist_create(0); - - nvlist_add_number(nvl, "type", addr->type); - nvlist_add_number(nvl, "iflags", addr->iflags); - nvlist_add_string(nvl, "ifname", addr->v.ifname); - nvlist_add_string(nvl, "tblname", addr->v.tblname); - pfctl_nv_add_addr(nvl, "addr", &addr->v.a.addr); - pfctl_nv_add_addr(nvl, "mask", &addr->v.a.mask); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_rule_addr(nvlist_t *nvparent, const char *name, - const struct pf_rule_addr *addr) -{ - u_int64_t ports[2]; - nvlist_t *nvl = nvlist_create(0); - - pfctl_nv_add_addr_wrap(nvl, "addr", &addr->addr); - ports[0] = addr->port[0]; - ports[1] = addr->port[1]; - nvlist_add_number_array(nvl, "port", ports, 2); - nvlist_add_number(nvl, "neg", addr->neg); - nvlist_add_number(nvl, "port_op", addr->port_op); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, - const struct pf_pool *pool) -{ - u_int64_t ports[2]; - nvlist_t *nvl = nvlist_create(0); - - nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); - pfctl_nv_add_addr(nvl, "counter", &pool->counter); - nvlist_add_number(nvl, "tblidx", pool->tblidx); - - ports[0] = pool->proxy_port[0]; - ports[1] = pool->proxy_port[1]; - nvlist_add_number_array(nvl, "proxy_port", ports, 2); - nvlist_add_number(nvl, "opts", pool->opts); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_uid(nvlist_t *nvparent, const char *name, - const struct pf_rule_uid *uid) -{ - u_int64_t uids[2]; - nvlist_t *nvl = nvlist_create(0); - - uids[0] = uid->uid[0]; - uids[1] = uid->uid[1]; - nvlist_add_number_array(nvl, "uid", uids, 2); - nvlist_add_number(nvl, "op", uid->op); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, - const struct pf_rule *r) -{ - nvlist_t *nvl = nvlist_create(0); - - pfctl_nv_add_addr(nvl, "addr", &r->divert.addr); - nvlist_add_number(nvl, "port", r->divert.port); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static int -pfctl_addrule(struct pfctl *pf, const struct pf_rule *r, const char *anchor, - const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) -{ - struct pfioc_nv nv; - u_int64_t timeouts[PFTM_MAX]; - u_int64_t set_prio[2]; - nvlist_t *nvl, *nvlr; - int ret; - - nvl = nvlist_create(0); - nvlr = nvlist_create(0); - - nvlist_add_number(nvl, "ticket", ticket); - nvlist_add_number(nvl, "pool_ticket", pool_ticket); - nvlist_add_string(nvl, "anchor", anchor); - nvlist_add_string(nvl, "anchor_call", anchor_call); - - nvlist_add_number(nvlr, "nr", r->nr); - pfctl_nv_add_rule_addr(nvlr, "src", &r->src); - pfctl_nv_add_rule_addr(nvlr, "dst", &r->dst); - - nvlist_add_string(nvlr, "label", r->label); - nvlist_add_string(nvlr, "ifname", r->ifname); - nvlist_add_string(nvlr, "qname", r->qname); - nvlist_add_string(nvlr, "pqname", r->pqname); - nvlist_add_string(nvlr, "tagname", r->tagname); - nvlist_add_string(nvlr, "match_tagname", r->match_tagname); - nvlist_add_string(nvlr, "overload_tblname", r->overload_tblname); - - pfctl_nv_add_pool(nvlr, "rpool", &r->rpool); - - nvlist_add_number(nvlr, "os_fingerprint", r->os_fingerprint); - - nvlist_add_number(nvlr, "rtableid", r->rtableid); - for (int i = 0; i < PFTM_MAX; i++) - timeouts[i] = r->timeout[i]; - nvlist_add_number_array(nvlr, "timeout", timeouts, PFTM_MAX); - nvlist_add_number(nvlr, "max_states", r->max_states); - nvlist_add_number(nvlr, "max_src_nodes", r->max_src_nodes); - nvlist_add_number(nvlr, "max_src_states", r->max_src_states); - nvlist_add_number(nvlr, "max_src_conn", r->max_src_conn); - nvlist_add_number(nvlr, "max_src_conn_rate.limit", - r->max_src_conn_rate.limit); - nvlist_add_number(nvlr, "max_src_conn_rate.seconds", - r->max_src_conn_rate.seconds); - nvlist_add_number(nvlr, "prob", r->prob); - nvlist_add_number(nvlr, "cuid", r->cuid); - nvlist_add_number(nvlr, "cpid", r->cpid); - - nvlist_add_number(nvlr, "return_icmp", r->return_icmp); - nvlist_add_number(nvlr, "return_icmp6", r->return_icmp6); - - nvlist_add_number(nvlr, "max_mss", r->max_mss); - nvlist_add_number(nvlr, "scrub_flags", r->scrub_flags); - - pfctl_nv_add_uid(nvlr, "uid", &r->uid); - pfctl_nv_add_uid(nvlr, "gid", (struct pf_rule_uid *)&r->gid); - - nvlist_add_number(nvlr, "rule_flag", r->rule_flag); - nvlist_add_number(nvlr, "action", r->action); - nvlist_add_number(nvlr, "direction", r->direction); - nvlist_add_number(nvlr, "log", r->log); - nvlist_add_number(nvlr, "logif", r->logif); - nvlist_add_number(nvlr, "quick", r->quick); - nvlist_add_number(nvlr, "ifnot", r->ifnot); - nvlist_add_number(nvlr, "match_tag_not", r->match_tag_not); - nvlist_add_number(nvlr, "natpass", r->natpass); - - nvlist_add_number(nvlr, "keep_state", r->keep_state); - nvlist_add_number(nvlr, "af", r->af); - nvlist_add_number(nvlr, "proto", r->proto); - nvlist_add_number(nvlr, "type", r->type); - nvlist_add_number(nvlr, "code", r->code); - nvlist_add_number(nvlr, "flags", r->flags); - nvlist_add_number(nvlr, "flagset", r->flagset); - nvlist_add_number(nvlr, "min_ttl", r->min_ttl); - nvlist_add_number(nvlr, "allow_opts", r->allow_opts); - nvlist_add_number(nvlr, "rt", r->rt); - nvlist_add_number(nvlr, "return_ttl", r->return_ttl); - nvlist_add_number(nvlr, "tos", r->tos); - nvlist_add_number(nvlr, "set_tos", r->set_tos); - nvlist_add_number(nvlr, "anchor_relative", r->anchor_relative); - nvlist_add_number(nvlr, "anchor_wildcard", r->anchor_wildcard); - - nvlist_add_number(nvlr, "flush", r->flush); - - nvlist_add_number(nvlr, "prio", r->prio); - set_prio[0] = r->set_prio[0]; - set_prio[1] = r->set_prio[1]; - nvlist_add_number_array(nvlr, "set_prio", set_prio, 2); - - pfctl_nv_add_divert(nvlr, "divert", r); - - nvlist_add_nvlist(nvl, "rule", nvlr); - - /* Now do the call. */ - nv.data = nvlist_pack(nvl, &nv.len); - nv.size = nv.len; - - ret = ioctl(pf->dev, DIOCADDRULENV, &nv); - - free(nv.data); - nvlist_destroy(nvl); - - return (ret); -} - int pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth) { @@ -1657,7 +1459,7 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth) if ((pf->opts & PF_OPT_NOACTION) == 0) { if (pfctl_add_pool(pf, &r->rpool, r->af)) return (1); - if (pfctl_addrule(pf, r, anchor, name, ticket, + if (pfctl_add_rule(pf->dev, r, anchor, name, ticket, pf->paddr.ticket)) err(1, "DIOCADDRULENV"); } diff --git a/sbin/pfctl/pfctl_ioctl.h b/sbin/pfctl/pfctl_ioctl.h index 41dd0776854a..e69de29bb2d1 100644 --- a/sbin/pfctl/pfctl_ioctl.h +++ b/sbin/pfctl/pfctl_ioctl.h @@ -1,43 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _PFCTL_IOCTL_H_ -#define _PFCTL_IOCTL_H_ - -#include - -int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, - const char *anchor, u_int32_t ruleset, struct pf_rule *rule, - char *anchor_call); - -#endif diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index d3f0aa1bf3a4..821a528932f3 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -33,12 +33,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include -#include "pfctl_ioctl.h" #include "pfctl_parser.h" #include "pfctl.h" diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index aa6d98d7cf91..2547caa1a8ce 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -252,7 +252,7 @@ TAILQ_HEAD(pf_opt_queue, pf_opt_rule); int pfctl_rules(int, char *, int, int, char *, struct pfr_buffer *); int pfctl_optimize_ruleset(struct pfctl *, struct pf_ruleset *); -int pfctl_add_rule(struct pfctl *, struct pf_rule *, const char *); +int pfctl_append_rule(struct pfctl *, struct pf_rule *, const char *); int pfctl_add_altq(struct pfctl *, struct pf_altq *); int pfctl_add_pool(struct pfctl *, struct pf_pool *, sa_family_t); void pfctl_move_pool(struct pf_pool *, struct pf_pool *); diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 32cd1677bcd4..249443f1dcf2 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -57,6 +57,7 @@ _INTERNALLIBS= \ opts \ parse \ pe \ + pfctl \ pmcstat \ sl \ sm \ @@ -391,6 +392,7 @@ _DP_zutil= avl tpool _DP_be= zfs spl nvpair zfsbootenv _DP_netmap= _DP_ifconfig= m +_DP_pfctl= nv # OFED support .if ${MK_OFED} != "no" @@ -568,6 +570,9 @@ LIBOPTS?= ${LIBOPTSDIR}/libopts${PIE_SUFFIX}.a LIBPARSEDIR= ${_LIB_OBJTOP}/usr.sbin/ntp/libparse LIBPARSE?= ${LIBPARSEDIR}/libparse${PIE_SUFFIX}.a +LIBPFCTL= ${_LIB_OBJTOP}/lib/libpfctl +LIBPFCTL?= ${LIBPFCTLDIR}/libpfctl${PIE_SUFFIX}.a + LIBLPRDIR= ${_LIB_OBJTOP}/usr.sbin/lpr/common_source LIBLPR?= ${LIBLPRDIR}/liblpr${PIE_SUFFIX}.a From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F7596310B8; Fri, 7 May 2021 15:25:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmN5XFyz4jx8; Fri, 7 May 2021 15:25:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2E5965C89; Fri, 7 May 2021 15:25:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPekT026108; Fri, 7 May 2021 15:25:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPeci026107; Fri, 7 May 2021 15:25:40 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:40 GMT Message-Id: <202105071525.147FPeci026107@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 5b16c4b6e824 - stable/12 - pf: Implement nvlist variant of DIOCGETRULE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5b16c4b6e824ab3a708c75a51c73898cbf98599e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:41 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5b16c4b6e824ab3a708c75a51c73898cbf98599e commit 5b16c4b6e824ab3a708c75a51c73898cbf98599e Author: Kristof Provost AuthorDate: 2021-03-25 09:39:14 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:00 +0000 pf: Implement nvlist variant of DIOCGETRULE MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29559 (cherry picked from commit d710367d1159423ed4da6628b7ab042d3e44f900) --- sys/net/pfvar.h | 4 + sys/netpfil/pf/pf_ioctl.c | 398 ++++++++++++++++++++++++++++++++++++++++++++ sys/netpfil/pf/pf_nv.c | 23 ++- sys/netpfil/pf/pf_nv.h | 7 + sys/netpfil/pf/pf_ruleset.c | 47 ++++++ 5 files changed, 473 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index eb9f365f2ec9..e6e011d6ef99 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -1232,6 +1233,7 @@ struct pfioc_iface { #define DIOCADDRULENV _IOWR('D', 4, struct pfioc_nv) #define DIOCGETRULES _IOWR('D', 6, struct pfioc_rule) #define DIOCGETRULE _IOWR('D', 7, struct pfioc_rule) +#define DIOCGETRULENV _IOWR('D', 7, struct pfioc_nv) /* XXX cut 8 - 17 */ #define DIOCCLRSTATES _IOWR('D', 18, struct pfioc_state_kill) #define DIOCGETSTATE _IOWR('D', 19, struct pfioc_state) @@ -1636,6 +1638,8 @@ int pf_get_ruleset_number(u_int8_t); void pf_init_kruleset(struct pf_kruleset *); int pf_kanchor_setup(struct pf_krule *, const struct pf_kruleset *, const char *); +int pf_kanchor_nvcopyout(const struct pf_kruleset *, + const struct pf_krule *, nvlist_t *); int pf_kanchor_copyout(const struct pf_kruleset *, const struct pf_krule *, struct pfioc_rule *); void pf_kanchor_remove(struct pf_krule *); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 53c850a96538..7310fa18410b 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1631,6 +1631,20 @@ pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *paddr) return (pf_nvbinary(nvl, "addr", paddr, sizeof(*paddr))); } +static nvlist_t * +pf_addr_to_nvaddr(const struct pf_addr *paddr) +{ + nvlist_t *nvl; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + nvlist_add_binary(nvl, "addr", paddr, sizeof(*paddr)); + + return (nvl); +} + static int pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_kpool *kpool) { @@ -1654,6 +1668,33 @@ errout: return (error); } +static nvlist_t * +pf_pool_to_nvpool(const struct pf_kpool *pool) +{ + nvlist_t *nvl; + nvlist_t *tmp; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); + tmp = pf_addr_to_nvaddr(&pool->counter); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "counter", tmp); + + nvlist_add_number(nvl, "tblidx", pool->tblidx); + pf_uint16_array_nv(nvl, "proxy_port", pool->proxy_port, 2); + nvlist_add_number(nvl, "opts", pool->opts); + + return (nvl); + +error: + nvlist_destroy(nvl); + return (NULL); +} + static int pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) { @@ -1694,6 +1735,37 @@ errout: return (error); } +static nvlist_t * +pf_addr_wrap_to_nvaddr_wrap(const struct pf_addr_wrap *addr) +{ + nvlist_t *nvl; + nvlist_t *tmp; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + nvlist_add_number(nvl, "type", addr->type); + nvlist_add_number(nvl, "iflags", addr->iflags); + nvlist_add_string(nvl, "ifname", addr->v.ifname); + nvlist_add_string(nvl, "tblname", addr->v.tblname); + + tmp = pf_addr_to_nvaddr(&addr->v.a.addr); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "addr", tmp); + tmp = pf_addr_to_nvaddr(&addr->v.a.mask); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "mask", tmp); + + return (nvl); + +error: + nvlist_destroy(nvl); + return (NULL); +} + static int pf_validate_op(uint8_t op) { @@ -1736,6 +1808,31 @@ errout: return (error); } +static nvlist_t * +pf_rule_addr_to_nvrule_addr(const struct pf_rule_addr *addr) +{ + nvlist_t *nvl; + nvlist_t *tmp; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + tmp = pf_addr_wrap_to_nvaddr_wrap(&addr->addr); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "addr", tmp); + pf_uint16_array_nv(nvl, "port", addr->port, 2); + nvlist_add_number(nvl, "neg", addr->neg); + nvlist_add_number(nvl, "port_op", addr->port_op); + + return (nvl); + +error: + nvlist_destroy(nvl); + return (NULL); +} + static int pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) { @@ -1752,6 +1849,21 @@ errout: return (error); } +static nvlist_t * +pf_rule_uid_to_nvrule_uid(const struct pf_rule_uid *uid) +{ + nvlist_t *nvl; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + pf_uint32_array_nv(nvl, "uid", uid->uid, 2); + nvlist_add_number(nvl, "op", uid->op); + + return (nvl); +} + static int pf_nvrule_gid_to_rule_gid(const nvlist_t *nvl, struct pf_rule_gid *gid) { @@ -1913,6 +2025,158 @@ errout: return (error); } +static nvlist_t * +pf_divert_to_nvdivert(const struct pf_krule *rule) +{ + nvlist_t *nvl; + nvlist_t *tmp; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + tmp = pf_addr_to_nvaddr(&rule->divert.addr); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "addr", tmp); + nvlist_add_number(nvl, "port", rule->divert.port); + + return (nvl); + +error: + nvlist_destroy(nvl); + return (NULL); +} + +static nvlist_t * +pf_krule_to_nvrule(const struct pf_krule *rule) +{ + nvlist_t *nvl, *tmp; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (nvl); + + nvlist_add_number(nvl, "nr", rule->nr); + tmp = pf_rule_addr_to_nvrule_addr(&rule->src); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "src", tmp); + tmp = pf_rule_addr_to_nvrule_addr(&rule->dst); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "dst", tmp); + + for (int i = 0; i < PF_SKIP_COUNT; i++) { + nvlist_append_number_array(nvl, "skip", + rule->skip[i].ptr ? rule->skip[i].ptr->nr : -1); + } + + nvlist_add_string(nvl, "label", rule->label); + nvlist_add_string(nvl, "ifname", rule->ifname); + nvlist_add_string(nvl, "qname", rule->qname); + nvlist_add_string(nvl, "pqname", rule->pqname); + nvlist_add_string(nvl, "tagname", rule->tagname); + nvlist_add_string(nvl, "match_tagname", rule->match_tagname); + nvlist_add_string(nvl, "overload_tblname", rule->overload_tblname); + + tmp = pf_pool_to_nvpool(&rule->rpool); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "rpool", tmp); + + nvlist_add_number(nvl, "evaluations", + counter_u64_fetch(rule->evaluations)); + for (int i = 0; i < 2; i++) { + nvlist_append_number_array(nvl, "packets", + counter_u64_fetch(rule->packets[i])); + nvlist_append_number_array(nvl, "bytes", + counter_u64_fetch(rule->bytes[i])); + } + + nvlist_add_number(nvl, "os_fingerprint", rule->os_fingerprint); + + nvlist_add_number(nvl, "rtableid", rule->rtableid); + pf_uint32_array_nv(nvl, "timeout", rule->timeout, PFTM_MAX); + nvlist_add_number(nvl, "max_states", rule->max_states); + nvlist_add_number(nvl, "max_src_nodes", rule->max_src_nodes); + nvlist_add_number(nvl, "max_src_states", rule->max_src_states); + nvlist_add_number(nvl, "max_src_conn", rule->max_src_conn); + nvlist_add_number(nvl, "max_src_conn_rate.limit", + rule->max_src_conn_rate.limit); + nvlist_add_number(nvl, "max_src_conn_rate.seconds", + rule->max_src_conn_rate.seconds); + nvlist_add_number(nvl, "qid", rule->qid); + nvlist_add_number(nvl, "pqid", rule->pqid); + nvlist_add_number(nvl, "prob", rule->prob); + nvlist_add_number(nvl, "cuid", rule->cuid); + nvlist_add_number(nvl, "cpid", rule->cpid); + + nvlist_add_number(nvl, "states_cur", + counter_u64_fetch(rule->states_cur)); + nvlist_add_number(nvl, "states_tot", + counter_u64_fetch(rule->states_tot)); + nvlist_add_number(nvl, "src_nodes", + counter_u64_fetch(rule->src_nodes)); + + nvlist_add_number(nvl, "return_icmp", rule->return_icmp); + nvlist_add_number(nvl, "return_icmp6", rule->return_icmp6); + + nvlist_add_number(nvl, "max_mss", rule->max_mss); + nvlist_add_number(nvl, "scrub_flags", rule->scrub_flags); + + tmp = pf_rule_uid_to_nvrule_uid(&rule->uid); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "uid", tmp); + tmp = pf_rule_uid_to_nvrule_uid((const struct pf_rule_uid *)&rule->gid); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "gid", tmp); + + nvlist_add_number(nvl, "rule_flag", rule->rule_flag); + nvlist_add_number(nvl, "action", rule->action); + nvlist_add_number(nvl, "direction", rule->direction); + nvlist_add_number(nvl, "log", rule->log); + nvlist_add_number(nvl, "logif", rule->logif); + nvlist_add_number(nvl, "quick", rule->quick); + nvlist_add_number(nvl, "ifnot", rule->ifnot); + nvlist_add_number(nvl, "match_tag_not", rule->match_tag_not); + nvlist_add_number(nvl, "natpass", rule->natpass); + + nvlist_add_number(nvl, "keep_state", rule->keep_state); + nvlist_add_number(nvl, "af", rule->af); + nvlist_add_number(nvl, "proto", rule->proto); + nvlist_add_number(nvl, "type", rule->type); + nvlist_add_number(nvl, "code", rule->code); + nvlist_add_number(nvl, "flags", rule->flags); + nvlist_add_number(nvl, "flagset", rule->flagset); + nvlist_add_number(nvl, "min_ttl", rule->min_ttl); + nvlist_add_number(nvl, "allow_opts", rule->allow_opts); + nvlist_add_number(nvl, "rt", rule->rt); + nvlist_add_number(nvl, "return_ttl", rule->return_ttl); + nvlist_add_number(nvl, "tos", rule->tos); + nvlist_add_number(nvl, "set_tos", rule->set_tos); + nvlist_add_number(nvl, "anchor_relative", rule->anchor_relative); + nvlist_add_number(nvl, "anchor_wildcard", rule->anchor_wildcard); + + nvlist_add_number(nvl, "flush", rule->flush); + nvlist_add_number(nvl, "prio", rule->prio); + + pf_uint8_array_nv(nvl, "set_prio", &rule->prio, 2); + + tmp = pf_divert_to_nvdivert(rule); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "divert", tmp); + + return (nvl); + +error: + nvlist_destroy(nvl); + return (NULL); +} + static int pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) { @@ -2255,6 +2519,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td switch (cmd) { case DIOCGETRULES: case DIOCGETRULE: + case DIOCGETRULENV: case DIOCGETADDRS: case DIOCGETADDR: case DIOCGETSTATE: @@ -2336,6 +2601,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCIGETIFACES: case DIOCGIFSPEEDV1: case DIOCGIFSPEEDV0: + case DIOCGETRULENV: break; case DIOCRCLRTABLES: case DIOCRADDTABLES: @@ -2571,6 +2837,138 @@ DIOCADDRULENV_error: break; } + case DIOCGETRULENV: { + struct pfioc_nv *nv = (struct pfioc_nv *)addr; + nvlist_t *nvrule = NULL; + nvlist_t *nvl = NULL; + struct pf_kruleset *ruleset; + struct pf_krule *rule; + void *nvlpacked = NULL; + int rs_num, nr; + bool clear_counter = false; + +#define ERROUT(x) do { error = (x); goto DIOCGETRULENV_error; } while (0) + + if (nv->len > pf_ioctl_maxcount) + ERROUT(ENOMEM); + + /* Copy the request in */ + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + error = copyin(nv->data, nvlpacked, nv->len); + if (error) + ERROUT(error); + + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) + ERROUT(EBADMSG); + + if (! nvlist_exists_string(nvl, "anchor")) + ERROUT(EBADMSG); + if (! nvlist_exists_number(nvl, "ruleset")) + ERROUT(EBADMSG); + if (! nvlist_exists_number(nvl, "ticket")) + ERROUT(EBADMSG); + if (! nvlist_exists_number(nvl, "nr")) + ERROUT(EBADMSG); + + if (nvlist_exists_bool(nvl, "clear_counter")) + clear_counter = nvlist_get_bool(nvl, "clear_counter"); + + if (clear_counter && !(flags & FWRITE)) + ERROUT(EACCES); + + nr = nvlist_get_number(nvl, "nr"); + + PF_RULES_WLOCK(); + ruleset = pf_find_kruleset(nvlist_get_string(nvl, "anchor")); + if (ruleset == NULL) { + PF_RULES_WUNLOCK(); + ERROUT(ENOENT); + } + + rs_num = pf_get_ruleset_number(nvlist_get_number(nvl, "ruleset")); + if (rs_num >= PF_RULESET_MAX) { + PF_RULES_WUNLOCK(); + ERROUT(EINVAL); + } + + if (nvlist_get_number(nvl, "ticket") != + ruleset->rules[rs_num].active.ticket) { + PF_RULES_WUNLOCK(); + ERROUT(EBUSY); + break; + } + + if ((error = nvlist_error(nvl))) { + PF_RULES_WUNLOCK(); + ERROUT(error); + } + + rule = TAILQ_FIRST(ruleset->rules[rs_num].active.ptr); + while ((rule != NULL) && (rule->nr != nr)) + rule = TAILQ_NEXT(rule, entries); + if (rule == NULL) { + PF_RULES_WUNLOCK(); + ERROUT(EBUSY); + break; + } + + nvrule = pf_krule_to_nvrule(rule); + + nvlist_destroy(nvl); + nvl = nvlist_create(0); + if (nvl == NULL) { + PF_RULES_WUNLOCK(); + ERROUT(ENOMEM); + } + nvlist_add_number(nvl, "nr", nr); + nvlist_add_nvlist(nvl, "rule", nvrule); + nvrule = NULL; + if (pf_kanchor_nvcopyout(ruleset, rule, nvl)) { + PF_RULES_WUNLOCK(); + ERROUT(EBUSY); + } + + free(nvlpacked, M_TEMP); + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) { + PF_RULES_WUNLOCK(); + ERROUT(ENOMEM); + } + + if (nv->size == 0) { + PF_RULES_WUNLOCK(); + ERROUT(0); + } + else if (nv->size < nv->len) { + PF_RULES_WUNLOCK(); + ERROUT(ENOSPC); + } + + error = copyout(nvlpacked, nv->data, nv->len); + + if (clear_counter) { + counter_u64_zero(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_zero(rule->packets[i]); + counter_u64_zero(rule->bytes[i]); + } + counter_u64_zero(rule->states_tot); + } + PF_RULES_WUNLOCK(); + +#undef ERROUT +DIOCGETRULENV_error: + free(nvlpacked, M_TEMP); + nvlist_destroy(nvrule); + nvlist_destroy(nvl); + + break; + } + case DIOCCHANGERULE: { struct pfioc_rule *pcr = (struct pfioc_rule *)addr; struct pf_kruleset *ruleset; diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index d583844c4086..d88c0b14e435 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #define PV_NV_IMPL_UINT(fnname, type, max) \ int \ - fnname(const nvlist_t *nvl, const char *name, type *val) \ + pf_nv ## fnname(const nvlist_t *nvl, const char *name, type *val) \ { \ uint64_t raw; \ if (! nvlist_exists_number(nvl, name)) \ @@ -49,8 +49,8 @@ __FBSDID("$FreeBSD$"); return (0); \ } \ int \ - fnname ## _array(const nvlist_t *nvl, const char *name, type *array, \ - size_t maxelems, size_t *nelems) \ + pf_nv ## fnname ## _array(const nvlist_t *nvl, const char *name, \ + type *array, size_t maxelems, size_t *nelems) \ { \ const uint64_t *n; \ size_t nitems; \ @@ -68,7 +68,18 @@ __FBSDID("$FreeBSD$"); array[i] = (type)n[i]; \ } \ return (0); \ + } \ + void \ + pf_ ## fnname ## _array_nv(nvlist_t *nvl, const char *name, \ + const type *numbers, size_t count) \ + { \ + uint64_t tmp; \ + for (size_t i = 0; i < count; i++) { \ + tmp = numbers[i]; \ + nvlist_append_number_array(nvl, name, tmp); \ + } \ } + int pf_nvbinary(const nvlist_t *nvl, const char *name, void *data, size_t expected_size) @@ -90,9 +101,9 @@ pf_nvbinary(const nvlist_t *nvl, const char *name, void *data, return (0); } -PV_NV_IMPL_UINT(pf_nvuint8, uint8_t, UINT8_MAX) -PV_NV_IMPL_UINT(pf_nvuint16, uint16_t, UINT16_MAX); -PV_NV_IMPL_UINT(pf_nvuint32, uint32_t, UINT32_MAX) +PV_NV_IMPL_UINT(uint8, uint8_t, UINT8_MAX) +PV_NV_IMPL_UINT(uint16, uint16_t, UINT16_MAX); +PV_NV_IMPL_UINT(uint32, uint32_t, UINT32_MAX) int pf_nvint(const nvlist_t *nvl, const char *name, int *val) diff --git a/sys/netpfil/pf/pf_nv.h b/sys/netpfil/pf/pf_nv.h index f0db1e880e9e..0a0f9beeef40 100644 --- a/sys/netpfil/pf/pf_nv.h +++ b/sys/netpfil/pf/pf_nv.h @@ -36,12 +36,19 @@ int pf_nvint(const nvlist_t *, const char *, int *); int pf_nvuint8(const nvlist_t *, const char *, uint8_t *); int pf_nvuint8_array(const nvlist_t *, const char *, uint8_t *, size_t, size_t *); +void pf_uint8_array_nv(nvlist_t *, const char *, const uint8_t *, + size_t); int pf_nvuint16(const nvlist_t *, const char *, uint16_t *); int pf_nvuint16_array(const nvlist_t *, const char *, uint16_t *, size_t, size_t *); +void pf_uint16_array_nv(nvlist_t *, const char *, const uint16_t *, + size_t); int pf_nvuint32(const nvlist_t *, const char *, uint32_t *); int pf_nvuint32_array(const nvlist_t *, const char *, uint32_t *, size_t, size_t *); +void pf_uint32_array_nv(nvlist_t *, const char *, const uint32_t *, + size_t); + int pf_nvstring(const nvlist_t *, const char *, char *, size_t); #define PFNV_CHK(x) do { \ diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index 31a4ed879937..227157c2876d 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -336,6 +336,53 @@ pf_kanchor_setup(struct pf_krule *r, const struct pf_kruleset *s, return (0); } +int +pf_kanchor_nvcopyout(const struct pf_kruleset *rs, const struct pf_krule *r, + nvlist_t *nvl) +{ + char anchor_call[MAXPATHLEN] = { 0 }; + + if (r->anchor == NULL) + goto done; + if (!r->anchor_relative) { + strlcpy(anchor_call, "/", sizeof(anchor_call)); + strlcat(anchor_call, r->anchor->path, + sizeof(anchor_call)); + } else { + char a[MAXPATHLEN]; + char *p; + int i; + if (rs->anchor == NULL) + a[0] = 0; + else + strlcpy(a, rs->anchor->path, MAXPATHLEN); + for (i = 1; i < r->anchor_relative; ++i) { + if ((p = strrchr(a, '/')) == NULL) + p = a; + *p = 0; + strlcat(anchor_call, "../", + sizeof(anchor_call)); + } + if (strncmp(a, r->anchor->path, strlen(a))) { + printf("pf_anchor_copyout: '%s' '%s'\n", a, + r->anchor->path); + return (1); + } + if (strlen(r->anchor->path) > strlen(a)) + strlcat(anchor_call, r->anchor->path + (a[0] ? + strlen(a) + 1 : 0), sizeof(anchor_call)); + + } + if (r->anchor_wildcard) + strlcat(anchor_call, anchor_call[0] ? "/*" : "*", + sizeof(anchor_call)); + +done: + nvlist_add_string(nvl, "anchor_call", anchor_call); + + return (0); +} + int pf_kanchor_copyout(const struct pf_kruleset *rs, const struct pf_krule *r, struct pfioc_rule *pr) From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BDF86310CF; Fri, 7 May 2021 15:25:44 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmR3C5cz4jdl; Fri, 7 May 2021 15:25:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 162DD58EF; Fri, 7 May 2021 15:25:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPgdZ026219; Fri, 7 May 2021 15:25:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPgMm026218; Fri, 7 May 2021 15:25:42 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:42 GMT Message-Id: <202105071525.147FPgMm026218@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 3711a144935f - stable/13 - (t)ftp-proxy: use libpfctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3711a144935f2eee0819dc45e1840ca6737c7b4a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:44 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3711a144935f2eee0819dc45e1840ca6737c7b4a commit 3711a144935f2eee0819dc45e1840ca6737c7b4a Author: Kristof Provost AuthorDate: 2021-03-29 12:03:39 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:42 +0000 (t)ftp-proxy: use libpfctl Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29641 (cherry picked from commit 95be9288f01f30a50440ea56d11468a2c6e18fed) --- contrib/pf/ftp-proxy/filter.c | 16 +++++++++++----- contrib/pf/tftp-proxy/filter.c | 10 +++++++--- libexec/tftp-proxy/Makefile | 3 +++ usr.sbin/ftp-proxy/Makefile | 3 ++- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/contrib/pf/ftp-proxy/filter.c b/contrib/pf/ftp-proxy/filter.c index f575db1c69cc..db3735565dac 100644 --- a/contrib/pf/ftp-proxy/filter.c +++ b/contrib/pf/ftp-proxy/filter.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -68,7 +69,8 @@ add_filter(u_int32_t id, u_int8_t dir, struct sockaddr *src, return (-1); pfr.rule.direction = dir; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); @@ -97,12 +99,14 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(nat)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (ioctl(dev, DIOCADDADDR, &pfp) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); pfr.rule.rpool.proxy_port[0] = nat_range_low; pfr.rule.rpool.proxy_port[1] = nat_range_high; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); @@ -130,11 +134,13 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(rdr)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (ioctl(dev, DIOCADDADDR, &pfp) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); pfr.rule.rpool.proxy_port[0] = rdr_port; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); diff --git a/contrib/pf/tftp-proxy/filter.c b/contrib/pf/tftp-proxy/filter.c index e5a769a62a54..0b87d568809f 100644 --- a/contrib/pf/tftp-proxy/filter.c +++ b/contrib/pf/tftp-proxy/filter.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -72,7 +73,8 @@ add_filter(u_int32_t id, u_int8_t dir, struct sockaddr *src, return (-1); pfr.rule.direction = dir; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); @@ -106,7 +108,8 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, pfr.rule.rpool.proxy_port[0] = nat_range_low; pfr.rule.rpool.proxy_port[1] = nat_range_high; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); @@ -138,7 +141,8 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, return (-1); pfr.rule.rpool.proxy_port[0] = rdr_port; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); diff --git a/libexec/tftp-proxy/Makefile b/libexec/tftp-proxy/Makefile index 596ca26cb61c..353e72007734 100644 --- a/libexec/tftp-proxy/Makefile +++ b/libexec/tftp-proxy/Makefile @@ -6,6 +6,9 @@ PROG= tftp-proxy SRCS= tftp-proxy.c filter.c MAN= tftp-proxy.8 +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl +LIBADD= pfctl + WARNS?= 3 .include diff --git a/usr.sbin/ftp-proxy/Makefile b/usr.sbin/ftp-proxy/Makefile index 7d05aa9bf624..768901f99131 100644 --- a/usr.sbin/ftp-proxy/Makefile +++ b/usr.sbin/ftp-proxy/Makefile @@ -8,8 +8,9 @@ MAN= ftp-proxy.8 SRCS= ftp-proxy.c filter.c CFLAGS+=-I${SRCTOP}/contrib/pf/libevent +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl -LIBADD= event1 +LIBADD= event1 pfctl WARNS?= 3 From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20167631398; Fri, 7 May 2021 15:25:44 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmQ5lXBz4jxP; Fri, 7 May 2021 15:25:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6564558EE; Fri, 7 May 2021 15:25:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPgoS026192; Fri, 7 May 2021 15:25:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPg7j026191; Fri, 7 May 2021 15:25:42 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:42 GMT Message-Id: <202105071525.147FPg7j026191@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: b5a4314fb312 - stable/12 - libnv: Build PIC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b5a4314fb3128c7fad26325e31c1a35b6d0a9e6b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:44 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b5a4314fb3128c7fad26325e31c1a35b6d0a9e6b commit b5a4314fb3128c7fad26325e31c1a35b6d0a9e6b Author: Kristof Provost AuthorDate: 2021-04-02 15:06:02 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:00 +0000 libnv: Build PIC Build libnv as position independent code so we can use it from shared libraries. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29561 (cherry picked from commit 0dd13c77432ade1ae94c9661cbad5537e3e6ab1d) --- lib/libnv/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile index bf92041d4c87..63e7a274f578 100644 --- a/lib/libnv/Makefile +++ b/lib/libnv/Makefile @@ -10,6 +10,7 @@ SHLIB_MAJOR= 0 .PATH: ${SRCTOP}/sys/contrib/libnv ${SRCTOP}/sys/sys CFLAGS+=-I${.CURDIR} +CFLAGS+=-fPIC SRCS= cnvlist.c SRCS+= dnvlist.c From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5397C6310DC; Fri, 7 May 2021 15:25:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmS5rWnz4jf0; Fri, 7 May 2021 15:25:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 76CD758F0; Fri, 7 May 2021 15:25:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPh91026240; Fri, 7 May 2021 15:25:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPhBm026239; Fri, 7 May 2021 15:25:43 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:43 GMT Message-Id: <202105071525.147FPhBm026239@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: b42eb4ffe5ea - stable/12 - pfctl: Move ioctl abstraction functions into libpfctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b42eb4ffe5ea7323872dbda1e711a65cd30340bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:46 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b42eb4ffe5ea7323872dbda1e711a65cd30340bb commit b42eb4ffe5ea7323872dbda1e711a65cd30340bb Author: Kristof Provost AuthorDate: 2021-03-26 10:38:58 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:01 +0000 pfctl: Move ioctl abstraction functions into libpfctl Introduce a library to wrap the pf ioctl interface. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29562 (cherry picked from commit 0d71f9f36e6c1849fdaf6c1edc1178be07357034) --- lib/Makefile | 1 + lib/libpfctl/Makefile | 12 ++ .../pfctl/pfctl_ioctl.c => lib/libpfctl/libpfctl.c | 199 ++++++++++++++++++- lib/libpfctl/libpfctl.h | 45 +++++ sbin/pfctl/Makefile | 5 +- sbin/pfctl/parse.y | 6 +- sbin/pfctl/pfctl.c | 212 +-------------------- sbin/pfctl/pfctl_ioctl.h | 43 ----- sbin/pfctl/pfctl_optimize.c | 2 +- sbin/pfctl/pfctl_parser.h | 2 +- share/mk/src.libnames.mk | 5 + 11 files changed, 276 insertions(+), 256 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 1026760335d1..d797701de6b7 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -210,6 +210,7 @@ _libdl= libdl SUBDIR.${MK_OPENMP}+= libomp .endif SUBDIR.${MK_OPENSSL}+= libmp +SUBDIR.${MK_PF}+= libpfctl SUBDIR.${MK_PMC}+= libpmc libpmcstat SUBDIR.${MK_RADIUS_SUPPORT}+= libradius SUBDIR.${MK_SENDMAIL}+= libmilter libsm libsmdb libsmutil diff --git a/lib/libpfctl/Makefile b/lib/libpfctl/Makefile new file mode 100644 index 000000000000..d7a00a94b349 --- /dev/null +++ b/lib/libpfctl/Makefile @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PACKAGE= lib${LIB} +LIB= pfctl +INTERNALLIB= true + +SRCS= libpfctl.c +INCS= libpfctl.h + +CFLAGS+= -fPIC + +.include diff --git a/sbin/pfctl/pfctl_ioctl.c b/lib/libpfctl/libpfctl.c similarity index 62% rename from sbin/pfctl/pfctl_ioctl.c rename to lib/libpfctl/libpfctl.c index 878a57de0fe4..e0d429112f5b 100644 --- a/sbin/pfctl/pfctl_ioctl.c +++ b/lib/libpfctl/libpfctl.c @@ -48,7 +48,7 @@ #include #include -#include "pfctl_ioctl.h" +#include "libpfctl.h" static void pf_nvuint_8_array(const nvlist_t *nvl, const char *name, size_t maxelems, @@ -118,6 +118,17 @@ pf_nvuint_64_array(const nvlist_t *nvl, const char *name, size_t maxelems, *nelems = elems; } +static void +pfctl_nv_add_addr(nvlist_t *nvparent, const char *name, + const struct pf_addr *addr) +{ + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_binary(nvl, "addr", addr, sizeof(*addr)); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *addr) { @@ -129,6 +140,22 @@ pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *addr) memcpy(addr, data, len); } +static void +pfctl_nv_add_addr_wrap(nvlist_t *nvparent, const char *name, + const struct pf_addr_wrap *addr) +{ + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_number(nvl, "type", addr->type); + nvlist_add_number(nvl, "iflags", addr->iflags); + nvlist_add_string(nvl, "ifname", addr->v.ifname); + nvlist_add_string(nvl, "tblname", addr->v.tblname); + pfctl_nv_add_addr(nvl, "addr", &addr->v.a.addr); + pfctl_nv_add_addr(nvl, "mask", &addr->v.a.mask); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) { @@ -142,6 +169,23 @@ pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "mask"), &addr->v.a.mask); } +static void +pfctl_nv_add_rule_addr(nvlist_t *nvparent, const char *name, + const struct pf_rule_addr *addr) +{ + u_int64_t ports[2]; + nvlist_t *nvl = nvlist_create(0); + + pfctl_nv_add_addr_wrap(nvl, "addr", &addr->addr); + ports[0] = addr->port[0]; + ports[1] = addr->port[1]; + nvlist_add_number_array(nvl, "port", ports, 2); + nvlist_add_number(nvl, "neg", addr->neg); + nvlist_add_number(nvl, "port_op", addr->port_op); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) { @@ -152,6 +196,25 @@ pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) addr->port_op = nvlist_get_number(nvl, "port_op"); } +static void +pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, + const struct pf_pool *pool) +{ + u_int64_t ports[2]; + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); + pfctl_nv_add_addr(nvl, "counter", &pool->counter); + nvlist_add_number(nvl, "tblidx", pool->tblidx); + + ports[0] = pool->proxy_port[0]; + ports[1] = pool->proxy_port[1]; + nvlist_add_number_array(nvl, "proxy_port", ports, 2); + nvlist_add_number(nvl, "opts", pool->opts); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_pool *pool) { @@ -169,6 +232,21 @@ pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_pool *pool) pool->opts = nvlist_get_number(nvl, "opts"); } +static void +pfctl_nv_add_uid(nvlist_t *nvparent, const char *name, + const struct pf_rule_uid *uid) +{ + u_int64_t uids[2]; + nvlist_t *nvl = nvlist_create(0); + + uids[0] = uid->uid[0]; + uids[1] = uid->uid[1]; + nvlist_add_number_array(nvl, "uid", uids, 2); + nvlist_add_number(nvl, "op", uid->op); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) { @@ -176,6 +254,18 @@ pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) uid->op = nvlist_get_number(nvl, "op"); } +static void +pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, + const struct pf_rule *r) +{ + nvlist_t *nvl = nvlist_create(0); + + pfctl_nv_add_addr(nvl, "addr", &r->divert.addr); + nvlist_add_number(nvl, "port", r->divert.port); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvdivert_to_divert(const nvlist_t *nvl, struct pf_rule *rule) { @@ -282,6 +372,113 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pf_rule *rule) rule->u_src_nodes = nvlist_get_number(nvl, "src_nodes"); } +int +pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, + const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) +{ + struct pfioc_nv nv; + u_int64_t timeouts[PFTM_MAX]; + u_int64_t set_prio[2]; + nvlist_t *nvl, *nvlr; + int ret; + + nvl = nvlist_create(0); + nvlr = nvlist_create(0); + + nvlist_add_number(nvl, "ticket", ticket); + nvlist_add_number(nvl, "pool_ticket", pool_ticket); + nvlist_add_string(nvl, "anchor", anchor); + nvlist_add_string(nvl, "anchor_call", anchor_call); + + nvlist_add_number(nvlr, "nr", r->nr); + pfctl_nv_add_rule_addr(nvlr, "src", &r->src); + pfctl_nv_add_rule_addr(nvlr, "dst", &r->dst); + + nvlist_add_string(nvlr, "label", r->label); + nvlist_add_string(nvlr, "ifname", r->ifname); + nvlist_add_string(nvlr, "qname", r->qname); + nvlist_add_string(nvlr, "pqname", r->pqname); + nvlist_add_string(nvlr, "tagname", r->tagname); + nvlist_add_string(nvlr, "match_tagname", r->match_tagname); + nvlist_add_string(nvlr, "overload_tblname", r->overload_tblname); + + pfctl_nv_add_pool(nvlr, "rpool", &r->rpool); + + nvlist_add_number(nvlr, "os_fingerprint", r->os_fingerprint); + + nvlist_add_number(nvlr, "rtableid", r->rtableid); + for (int i = 0; i < PFTM_MAX; i++) + timeouts[i] = r->timeout[i]; + nvlist_add_number_array(nvlr, "timeout", timeouts, PFTM_MAX); + nvlist_add_number(nvlr, "max_states", r->max_states); + nvlist_add_number(nvlr, "max_src_nodes", r->max_src_nodes); + nvlist_add_number(nvlr, "max_src_states", r->max_src_states); + nvlist_add_number(nvlr, "max_src_conn", r->max_src_conn); + nvlist_add_number(nvlr, "max_src_conn_rate.limit", + r->max_src_conn_rate.limit); + nvlist_add_number(nvlr, "max_src_conn_rate.seconds", + r->max_src_conn_rate.seconds); + nvlist_add_number(nvlr, "prob", r->prob); + nvlist_add_number(nvlr, "cuid", r->cuid); + nvlist_add_number(nvlr, "cpid", r->cpid); + + nvlist_add_number(nvlr, "return_icmp", r->return_icmp); + nvlist_add_number(nvlr, "return_icmp6", r->return_icmp6); + + nvlist_add_number(nvlr, "max_mss", r->max_mss); + nvlist_add_number(nvlr, "scrub_flags", r->scrub_flags); + + pfctl_nv_add_uid(nvlr, "uid", &r->uid); + pfctl_nv_add_uid(nvlr, "gid", (const struct pf_rule_uid *)&r->gid); + + nvlist_add_number(nvlr, "rule_flag", r->rule_flag); + nvlist_add_number(nvlr, "action", r->action); + nvlist_add_number(nvlr, "direction", r->direction); + nvlist_add_number(nvlr, "log", r->log); + nvlist_add_number(nvlr, "logif", r->logif); + nvlist_add_number(nvlr, "quick", r->quick); + nvlist_add_number(nvlr, "ifnot", r->ifnot); + nvlist_add_number(nvlr, "match_tag_not", r->match_tag_not); + nvlist_add_number(nvlr, "natpass", r->natpass); + + nvlist_add_number(nvlr, "keep_state", r->keep_state); + nvlist_add_number(nvlr, "af", r->af); + nvlist_add_number(nvlr, "proto", r->proto); + nvlist_add_number(nvlr, "type", r->type); + nvlist_add_number(nvlr, "code", r->code); + nvlist_add_number(nvlr, "flags", r->flags); + nvlist_add_number(nvlr, "flagset", r->flagset); + nvlist_add_number(nvlr, "min_ttl", r->min_ttl); + nvlist_add_number(nvlr, "allow_opts", r->allow_opts); + nvlist_add_number(nvlr, "rt", r->rt); + nvlist_add_number(nvlr, "return_ttl", r->return_ttl); + nvlist_add_number(nvlr, "tos", r->tos); + nvlist_add_number(nvlr, "set_tos", r->set_tos); + nvlist_add_number(nvlr, "anchor_relative", r->anchor_relative); + nvlist_add_number(nvlr, "anchor_wildcard", r->anchor_wildcard); + + nvlist_add_number(nvlr, "flush", r->flush); + + nvlist_add_number(nvlr, "prio", r->prio); + set_prio[0] = r->set_prio[0]; + set_prio[1] = r->set_prio[1]; + nvlist_add_number_array(nvlr, "set_prio", set_prio, 2); + + pfctl_nv_add_divert(nvlr, "divert", r); + + nvlist_add_nvlist(nvl, "rule", nvlr); + + /* Now do the call. */ + nv.data = nvlist_pack(nvl, &nv.len); + nv.size = nv.len; + + ret = ioctl(dev, DIOCADDRULENV, &nv); + + free(nv.data); + nvlist_destroy(nvl); + + return (ret); +} int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h new file mode 100644 index 000000000000..65ff2179f23d --- /dev/null +++ b/lib/libpfctl/libpfctl.h @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _PFCTL_IOCTL_H_ +#define _PFCTL_IOCTL_H_ + +#include + +int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, + const char *anchor, u_int32_t ruleset, struct pf_rule *rule, + char *anchor_call); +int pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, + const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket); + +#endif diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile index c84d558c989d..49bdfb9e3733 100644 --- a/sbin/pfctl/Makefile +++ b/sbin/pfctl/Makefile @@ -9,13 +9,14 @@ MAN= pfctl.8 SRCS = pfctl.c parse.y pfctl_parser.c pf_print_state.c pfctl_altq.c SRCS+= pfctl_osfp.c pfctl_radix.c pfctl_table.c pfctl_qstats.c -SRCS+= pfctl_optimize.c pfctl_ioctl.c +SRCS+= pfctl_optimize.c SRCS+= pf_ruleset.c WARNS?= 2 CFLAGS+= -Wall -Wmissing-prototypes -Wno-uninitialized CFLAGS+= -Wstrict-prototypes CFLAGS+= -DENABLE_ALTQ -I${.CURDIR} +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl # Need to use "WITH_" prefix to not conflict with the l/y INET/INET6 keywords .if ${MK_INET6_SUPPORT} != "no" @@ -27,7 +28,7 @@ CFLAGS+= -DWITH_INET YFLAGS= -LIBADD= m md nv +LIBADD= m md pfctl HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index ed4a09c0d14c..56c1f82e39a0 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1032,7 +1032,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto decide_address_family($6.src.host, &r.af); decide_address_family($6.dst.host, &r.af); - pfctl_add_rule(pf, &r, $2); + pfctl_append_rule(pf, &r, $2); free($2); } ; @@ -4382,7 +4382,7 @@ binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag free($13); } - pfctl_add_rule(pf, &binat, ""); + pfctl_append_rule(pf, &binat, ""); } ; @@ -5399,7 +5399,7 @@ expand_rule(struct pf_rule *r, yyerror("skipping rule due to errors"); else { r->nr = pf->astack[pf->asd]->match++; - pfctl_add_rule(pf, r, anchor_call); + pfctl_append_rule(pf, r, anchor_call); added++; } diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 1aa17065597b..fde9d61260ef 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -63,7 +64,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "pfctl_ioctl.h" #include "pfctl_parser.h" #include "pfctl.h" @@ -1291,7 +1291,7 @@ pfctl_add_pool(struct pfctl *pf, struct pf_pool *p, sa_family_t af) } int -pfctl_add_rule(struct pfctl *pf, struct pf_rule *r, const char *anchor_call) +pfctl_append_rule(struct pfctl *pf, struct pf_rule *r, const char *anchor_call) { u_int8_t rs_num; struct pf_rule *rule; @@ -1309,22 +1309,22 @@ pfctl_add_rule(struct pfctl *pf, struct pf_rule *r, const char *anchor_call) * Don't make non-brace anchors part of the main anchor pool. */ if ((r->anchor = calloc(1, sizeof(*r->anchor))) == NULL) - err(1, "pfctl_add_rule: calloc"); + err(1, "pfctl_append_rule: calloc"); pf_init_ruleset(&r->anchor->ruleset); r->anchor->ruleset.anchor = r->anchor; if (strlcpy(r->anchor->path, anchor_call, sizeof(rule->anchor->path)) >= sizeof(rule->anchor->path)) - errx(1, "pfctl_add_rule: strlcpy"); + errx(1, "pfctl_append_rule: strlcpy"); if ((p = strrchr(anchor_call, '/')) != NULL) { if (!strlen(p)) - err(1, "pfctl_add_rule: bad anchor name %s", + err(1, "pfctl_append_rule: bad anchor name %s", anchor_call); } else p = (char *)anchor_call; if (strlcpy(r->anchor->name, p, sizeof(rule->anchor->name)) >= sizeof(rule->anchor->name)) - errx(1, "pfctl_add_rule: strlcpy"); + errx(1, "pfctl_append_rule: strlcpy"); } if ((rule = calloc(1, sizeof(*rule))) == NULL) @@ -1427,204 +1427,6 @@ pfctl_load_ruleset(struct pfctl *pf, char *path, struct pf_ruleset *rs, } -static void -pfctl_nv_add_addr(nvlist_t *nvparent, const char *name, - const struct pf_addr *addr) -{ - nvlist_t *nvl = nvlist_create(0); - - nvlist_add_binary(nvl, "addr", addr, sizeof(*addr)); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_addr_wrap(nvlist_t *nvparent, const char *name, - const struct pf_addr_wrap *addr) -{ - nvlist_t *nvl = nvlist_create(0); - - nvlist_add_number(nvl, "type", addr->type); - nvlist_add_number(nvl, "iflags", addr->iflags); - nvlist_add_string(nvl, "ifname", addr->v.ifname); - nvlist_add_string(nvl, "tblname", addr->v.tblname); - pfctl_nv_add_addr(nvl, "addr", &addr->v.a.addr); - pfctl_nv_add_addr(nvl, "mask", &addr->v.a.mask); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_rule_addr(nvlist_t *nvparent, const char *name, - const struct pf_rule_addr *addr) -{ - u_int64_t ports[2]; - nvlist_t *nvl = nvlist_create(0); - - pfctl_nv_add_addr_wrap(nvl, "addr", &addr->addr); - ports[0] = addr->port[0]; - ports[1] = addr->port[1]; - nvlist_add_number_array(nvl, "port", ports, 2); - nvlist_add_number(nvl, "neg", addr->neg); - nvlist_add_number(nvl, "port_op", addr->port_op); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, - const struct pf_pool *pool) -{ - u_int64_t ports[2]; - nvlist_t *nvl = nvlist_create(0); - - nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); - pfctl_nv_add_addr(nvl, "counter", &pool->counter); - nvlist_add_number(nvl, "tblidx", pool->tblidx); - - ports[0] = pool->proxy_port[0]; - ports[1] = pool->proxy_port[1]; - nvlist_add_number_array(nvl, "proxy_port", ports, 2); - nvlist_add_number(nvl, "opts", pool->opts); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_uid(nvlist_t *nvparent, const char *name, - const struct pf_rule_uid *uid) -{ - u_int64_t uids[2]; - nvlist_t *nvl = nvlist_create(0); - - uids[0] = uid->uid[0]; - uids[1] = uid->uid[1]; - nvlist_add_number_array(nvl, "uid", uids, 2); - nvlist_add_number(nvl, "op", uid->op); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, - const struct pf_rule *r) -{ - nvlist_t *nvl = nvlist_create(0); - - pfctl_nv_add_addr(nvl, "addr", &r->divert.addr); - nvlist_add_number(nvl, "port", r->divert.port); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static int -pfctl_addrule(struct pfctl *pf, const struct pf_rule *r, const char *anchor, - const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) -{ - struct pfioc_nv nv; - u_int64_t timeouts[PFTM_MAX]; - u_int64_t set_prio[2]; - nvlist_t *nvl, *nvlr; - int ret; - - nvl = nvlist_create(0); - nvlr = nvlist_create(0); - - nvlist_add_number(nvl, "ticket", ticket); - nvlist_add_number(nvl, "pool_ticket", pool_ticket); - nvlist_add_string(nvl, "anchor", anchor); - nvlist_add_string(nvl, "anchor_call", anchor_call); - - nvlist_add_number(nvlr, "nr", r->nr); - pfctl_nv_add_rule_addr(nvlr, "src", &r->src); - pfctl_nv_add_rule_addr(nvlr, "dst", &r->dst); - - nvlist_add_string(nvlr, "label", r->label); - nvlist_add_string(nvlr, "ifname", r->ifname); - nvlist_add_string(nvlr, "qname", r->qname); - nvlist_add_string(nvlr, "pqname", r->pqname); - nvlist_add_string(nvlr, "tagname", r->tagname); - nvlist_add_string(nvlr, "match_tagname", r->match_tagname); - nvlist_add_string(nvlr, "overload_tblname", r->overload_tblname); - - pfctl_nv_add_pool(nvlr, "rpool", &r->rpool); - - nvlist_add_number(nvlr, "os_fingerprint", r->os_fingerprint); - - nvlist_add_number(nvlr, "rtableid", r->rtableid); - for (int i = 0; i < PFTM_MAX; i++) - timeouts[i] = r->timeout[i]; - nvlist_add_number_array(nvlr, "timeout", timeouts, PFTM_MAX); - nvlist_add_number(nvlr, "max_states", r->max_states); - nvlist_add_number(nvlr, "max_src_nodes", r->max_src_nodes); - nvlist_add_number(nvlr, "max_src_states", r->max_src_states); - nvlist_add_number(nvlr, "max_src_conn", r->max_src_conn); - nvlist_add_number(nvlr, "max_src_conn_rate.limit", - r->max_src_conn_rate.limit); - nvlist_add_number(nvlr, "max_src_conn_rate.seconds", - r->max_src_conn_rate.seconds); - nvlist_add_number(nvlr, "prob", r->prob); - nvlist_add_number(nvlr, "cuid", r->cuid); - nvlist_add_number(nvlr, "cpid", r->cpid); - - nvlist_add_number(nvlr, "return_icmp", r->return_icmp); - nvlist_add_number(nvlr, "return_icmp6", r->return_icmp6); - - nvlist_add_number(nvlr, "max_mss", r->max_mss); - nvlist_add_number(nvlr, "scrub_flags", r->scrub_flags); - - pfctl_nv_add_uid(nvlr, "uid", &r->uid); - pfctl_nv_add_uid(nvlr, "gid", (struct pf_rule_uid *)&r->gid); - - nvlist_add_number(nvlr, "rule_flag", r->rule_flag); - nvlist_add_number(nvlr, "action", r->action); - nvlist_add_number(nvlr, "direction", r->direction); - nvlist_add_number(nvlr, "log", r->log); - nvlist_add_number(nvlr, "logif", r->logif); - nvlist_add_number(nvlr, "quick", r->quick); - nvlist_add_number(nvlr, "ifnot", r->ifnot); - nvlist_add_number(nvlr, "match_tag_not", r->match_tag_not); - nvlist_add_number(nvlr, "natpass", r->natpass); - - nvlist_add_number(nvlr, "keep_state", r->keep_state); - nvlist_add_number(nvlr, "af", r->af); - nvlist_add_number(nvlr, "proto", r->proto); - nvlist_add_number(nvlr, "type", r->type); - nvlist_add_number(nvlr, "code", r->code); - nvlist_add_number(nvlr, "flags", r->flags); - nvlist_add_number(nvlr, "flagset", r->flagset); - nvlist_add_number(nvlr, "min_ttl", r->min_ttl); - nvlist_add_number(nvlr, "allow_opts", r->allow_opts); - nvlist_add_number(nvlr, "rt", r->rt); - nvlist_add_number(nvlr, "return_ttl", r->return_ttl); - nvlist_add_number(nvlr, "tos", r->tos); - nvlist_add_number(nvlr, "set_tos", r->set_tos); - nvlist_add_number(nvlr, "anchor_relative", r->anchor_relative); - nvlist_add_number(nvlr, "anchor_wildcard", r->anchor_wildcard); - - nvlist_add_number(nvlr, "flush", r->flush); - - nvlist_add_number(nvlr, "prio", r->prio); - set_prio[0] = r->set_prio[0]; - set_prio[1] = r->set_prio[1]; - nvlist_add_number_array(nvlr, "set_prio", set_prio, 2); - - pfctl_nv_add_divert(nvlr, "divert", r); - - nvlist_add_nvlist(nvl, "rule", nvlr); - - /* Now do the call. */ - nv.data = nvlist_pack(nvl, &nv.len); - nv.size = nv.len; - - ret = ioctl(pf->dev, DIOCADDRULENV, &nv); - - free(nv.data); - nvlist_destroy(nvl); - - return (ret); -} - int pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth) { @@ -1657,7 +1459,7 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth) if ((pf->opts & PF_OPT_NOACTION) == 0) { if (pfctl_add_pool(pf, &r->rpool, r->af)) return (1); - if (pfctl_addrule(pf, r, anchor, name, ticket, + if (pfctl_add_rule(pf->dev, r, anchor, name, ticket, pf->paddr.ticket)) err(1, "DIOCADDRULENV"); } diff --git a/sbin/pfctl/pfctl_ioctl.h b/sbin/pfctl/pfctl_ioctl.h index 41dd0776854a..e69de29bb2d1 100644 --- a/sbin/pfctl/pfctl_ioctl.h +++ b/sbin/pfctl/pfctl_ioctl.h @@ -1,43 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _PFCTL_IOCTL_H_ -#define _PFCTL_IOCTL_H_ - -#include - -int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, - const char *anchor, u_int32_t ruleset, struct pf_rule *rule, - char *anchor_call); - -#endif diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index d3f0aa1bf3a4..821a528932f3 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -33,12 +33,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include -#include "pfctl_ioctl.h" #include "pfctl_parser.h" #include "pfctl.h" diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index aa6d98d7cf91..2547caa1a8ce 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -252,7 +252,7 @@ TAILQ_HEAD(pf_opt_queue, pf_opt_rule); int pfctl_rules(int, char *, int, int, char *, struct pfr_buffer *); int pfctl_optimize_ruleset(struct pfctl *, struct pf_ruleset *); -int pfctl_add_rule(struct pfctl *, struct pf_rule *, const char *); +int pfctl_append_rule(struct pfctl *, struct pf_rule *, const char *); int pfctl_add_altq(struct pfctl *, struct pf_altq *); int pfctl_add_pool(struct pfctl *, struct pf_pool *, sa_family_t); void pfctl_move_pool(struct pf_pool *, struct pf_pool *); diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 27e5cdaf2736..f293d8cb3f5f 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -49,6 +49,7 @@ _INTERNALLIBS= \ opts \ parse \ pe \ + pfctl \ pmcstat \ sl \ sm \ @@ -365,6 +366,7 @@ _DP_zfs_core= nvpair _DP_zpool= md pthread z nvpair avl umem _DP_be= zfs nvpair _DP_netmap= +_DP_pfctl= nv # OFED support .if ${MK_OFED} != "no" @@ -517,6 +519,9 @@ LIBOPTS?= ${LIBOPTSDIR}/libopts${PIE_SUFFIX}.a LIBPARSEDIR= ${OBJTOP}/usr.sbin/ntp/libparse LIBPARSE?= ${LIBPARSEDIR}/libparse${PIE_SUFFIX}.a +LIBPFCTL= ${_LIB_OBJTOP}/lib/libpfctl +LIBPFCTL?= ${LIBPFCTLDIR}/libpfctl${PIE_SUFFIX}.a + LIBLPRDIR= ${OBJTOP}/usr.sbin/lpr/common_source LIBLPR?= ${LIBLPRDIR}/liblpr${PIE_SUFFIX}.a From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18989631450; Fri, 7 May 2021 15:25:47 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmT2PrJz4k41; Fri, 7 May 2021 15:25:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9A2355B3C; Fri, 7 May 2021 15:25:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPi8e026282; Fri, 7 May 2021 15:25:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPiZ2026281; Fri, 7 May 2021 15:25:44 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:44 GMT Message-Id: <202105071525.147FPiZ2026281@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: c1526a55d363 - stable/12 - (t)ftp-proxy: use libpfctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c1526a55d363f451e3579581c9be94ab859312c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:47 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c1526a55d363f451e3579581c9be94ab859312c6 commit c1526a55d363f451e3579581c9be94ab859312c6 Author: Kristof Provost AuthorDate: 2021-03-29 12:03:39 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:01 +0000 (t)ftp-proxy: use libpfctl Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29641 (cherry picked from commit 95be9288f01f30a50440ea56d11468a2c6e18fed) --- contrib/pf/ftp-proxy/filter.c | 16 +++++++++++----- contrib/pf/tftp-proxy/filter.c | 10 +++++++--- libexec/tftp-proxy/Makefile | 3 +++ usr.sbin/ftp-proxy/Makefile | 3 ++- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/contrib/pf/ftp-proxy/filter.c b/contrib/pf/ftp-proxy/filter.c index f575db1c69cc..db3735565dac 100644 --- a/contrib/pf/ftp-proxy/filter.c +++ b/contrib/pf/ftp-proxy/filter.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -68,7 +69,8 @@ add_filter(u_int32_t id, u_int8_t dir, struct sockaddr *src, return (-1); pfr.rule.direction = dir; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); @@ -97,12 +99,14 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(nat)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (ioctl(dev, DIOCADDADDR, &pfp) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); pfr.rule.rpool.proxy_port[0] = nat_range_low; pfr.rule.rpool.proxy_port[1] = nat_range_high; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); @@ -130,11 +134,13 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(rdr)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (ioctl(dev, DIOCADDADDR, &pfp) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); pfr.rule.rpool.proxy_port[0] = rdr_port; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); diff --git a/contrib/pf/tftp-proxy/filter.c b/contrib/pf/tftp-proxy/filter.c index e5a769a62a54..0b87d568809f 100644 --- a/contrib/pf/tftp-proxy/filter.c +++ b/contrib/pf/tftp-proxy/filter.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -72,7 +73,8 @@ add_filter(u_int32_t id, u_int8_t dir, struct sockaddr *src, return (-1); pfr.rule.direction = dir; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); @@ -106,7 +108,8 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, pfr.rule.rpool.proxy_port[0] = nat_range_low; pfr.rule.rpool.proxy_port[1] = nat_range_high; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); @@ -138,7 +141,8 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, return (-1); pfr.rule.rpool.proxy_port[0] = rdr_port; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); diff --git a/libexec/tftp-proxy/Makefile b/libexec/tftp-proxy/Makefile index 596ca26cb61c..353e72007734 100644 --- a/libexec/tftp-proxy/Makefile +++ b/libexec/tftp-proxy/Makefile @@ -6,6 +6,9 @@ PROG= tftp-proxy SRCS= tftp-proxy.c filter.c MAN= tftp-proxy.8 +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl +LIBADD= pfctl + WARNS?= 3 .include diff --git a/usr.sbin/ftp-proxy/Makefile b/usr.sbin/ftp-proxy/Makefile index 443db1c00a2d..a7b2ba6b43d5 100644 --- a/usr.sbin/ftp-proxy/Makefile +++ b/usr.sbin/ftp-proxy/Makefile @@ -8,8 +8,9 @@ MAN= ftp-proxy.8 SRCS= ftp-proxy.c filter.c CFLAGS+=-I${SRCTOP}/contrib/pf/libevent +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl -LIBADD= event +LIBADD= event pfctl WARNS?= 3 From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DDFA631581; Fri, 7 May 2021 15:25:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmS5y0wz4jf2; Fri, 7 May 2021 15:25:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 27C355B3B; Fri, 7 May 2021 15:25:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPiL7026261; Fri, 7 May 2021 15:25:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPivq026260; Fri, 7 May 2021 15:25:44 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:44 GMT Message-Id: <202105071525.147FPivq026260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 5268c55fa5d5 - stable/13 - bsnmp: Use libpfctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5268c55fa5d55e15657f1dcf05db1e286122fa91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:46 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5268c55fa5d55e15657f1dcf05db1e286122fa91 commit 5268c55fa5d55e15657f1dcf05db1e286122fa91 Author: Kristof Provost AuthorDate: 2021-03-29 15:43:25 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:42 +0000 bsnmp: Use libpfctl Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29642 (cherry picked from commit 956e7d232549ce4b17f5b1a079e5b51229479dda) --- usr.sbin/bsnmpd/modules/snmp_pf/Makefile | 3 +++ usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bsnmpd/modules/snmp_pf/Makefile b/usr.sbin/bsnmpd/modules/snmp_pf/Makefile index fdf77191f706..3ab6e436aa75 100644 --- a/usr.sbin/bsnmpd/modules/snmp_pf/Makefile +++ b/usr.sbin/bsnmpd/modules/snmp_pf/Makefile @@ -9,4 +9,7 @@ XSYM= begemotPf DEFS= ${MOD}_tree.def BMIBS= BEGEMOT-PF-MIB.txt +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl +LIBADD+= pfctl + .include diff --git a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c index a14ab5841dfa..dc55c730bc5f 100644 --- a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c +++ b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -1528,7 +1529,8 @@ pfl_scan_ruleset(const char *path) for (nr = pr.nr, i = 0; i < nr; i++) { pr.nr = i; - if (ioctl(dev, DIOCGETRULE, &pr)) { + if (pfctl_add_rule(dev, &pr.rule, pr.anchor, pr.anchor_call, + pr.ticket, pr.pool_ticket)) { syslog(LOG_ERR, "pfl_scan_ruleset: ioctl(DIOCGETRULE):" " %s", strerror(errno)); goto err; From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48F77631605; Fri, 7 May 2021 15:25:47 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmV17CTz4jxf; Fri, 7 May 2021 15:25:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4887A5C3F; Fri, 7 May 2021 15:25:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPjhA026303; Fri, 7 May 2021 15:25:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPjor026302; Fri, 7 May 2021 15:25:45 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:45 GMT Message-Id: <202105071525.147FPjor026302@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: c3f3f537715c - stable/13 - pf: Move prototypes for userspace functions to userspace header MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c3f3f537715c918bdf50f7ec8548ba7ad2778036 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:47 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c3f3f537715c918bdf50f7ec8548ba7ad2778036 commit c3f3f537715c918bdf50f7ec8548ba7ad2778036 Author: Kristof Provost AuthorDate: 2021-04-07 17:49:51 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:42 +0000 pf: Move prototypes for userspace functions to userspace header These functions no longer exist in the kernel, so there's no reason to keep the prototypes in a kernel header. Move them to pfctl where they're actually implemented. Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29643 (cherry picked from commit a9b338b260be39cc74dddb599d6c95b8794ca98b) --- sbin/pfctl/pf_ruleset.c | 2 ++ sbin/pfctl/pfctl.h | 8 ++++++++ sys/netpfil/pf/pf.h | 9 +-------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c index 7c337d7a2da7..baac1deb4fa7 100644 --- a/sbin/pfctl/pf_ruleset.c +++ b/sbin/pfctl/pf_ruleset.c @@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$"); #define rs_malloc(x) calloc(1, x) #define rs_free(x) free(x) +#include "pfctl.h" + #ifdef PFDEBUG #include #define DPFPRINTF(format, x...) fprintf(stderr, format , ##x) diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index f43b71e19fec..5aa94b2bb0c8 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -128,4 +128,12 @@ u_int32_t pfctl_get_ticket(struct pfr_buffer *, int, const char *); int pfctl_trans(int, struct pfr_buffer *, u_long, int); +int pf_get_ruleset_number(u_int8_t); +void pf_init_ruleset(struct pf_ruleset *); +int pf_anchor_setup(struct pf_rule *, + const struct pf_ruleset *, const char *); +void pf_remove_if_empty_ruleset(struct pf_ruleset *); +struct pf_ruleset *pf_find_ruleset(const char *); +struct pf_ruleset *pf_find_or_create_ruleset(const char *); + #endif /* _PFCTL_H_ */ diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index bc6cd92ae7b8..3e358de8aba5 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -637,13 +637,6 @@ struct pf_anchor { RB_PROTOTYPE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); RB_PROTOTYPE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); -/* these ruleset functions can be linked into userland programs (pfctl) */ -int pf_get_ruleset_number(u_int8_t); -void pf_init_ruleset(struct pf_ruleset *); -int pf_anchor_setup(struct pf_rule *, - const struct pf_ruleset *, const char *); -void pf_remove_if_empty_ruleset(struct pf_ruleset *); -struct pf_ruleset *pf_find_ruleset(const char *); -struct pf_ruleset *pf_find_or_create_ruleset(const char *); +int pf_get_ruleset_number(u_int8_t); #endif /* _NET_PF_H_ */ From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 287E063145E; Fri, 7 May 2021 15:25:48 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmW3yhmz4k6G; Fri, 7 May 2021 15:25:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C0ACE5DBC; Fri, 7 May 2021 15:25:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPkMP026366; Fri, 7 May 2021 15:25:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPkpA026365; Fri, 7 May 2021 15:25:46 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:46 GMT Message-Id: <202105071525.147FPkpA026365@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 7d9af27cd6f5 - stable/12 - pf: Move prototypes for userspace functions to userspace header MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7d9af27cd6f5fd583636c8d3b9107021f0f16e1c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:48 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7d9af27cd6f5fd583636c8d3b9107021f0f16e1c commit 7d9af27cd6f5fd583636c8d3b9107021f0f16e1c Author: Kristof Provost AuthorDate: 2021-04-07 17:49:51 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:01 +0000 pf: Move prototypes for userspace functions to userspace header These functions no longer exist in the kernel, so there's no reason to keep the prototypes in a kernel header. Move them to pfctl where they're actually implemented. Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29643 (cherry picked from commit a9b338b260be39cc74dddb599d6c95b8794ca98b) --- sbin/pfctl/pf_ruleset.c | 2 ++ sbin/pfctl/pfctl.h | 8 ++++++++ sys/netpfil/pf/pf.h | 9 +-------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c index 7c337d7a2da7..baac1deb4fa7 100644 --- a/sbin/pfctl/pf_ruleset.c +++ b/sbin/pfctl/pf_ruleset.c @@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$"); #define rs_malloc(x) calloc(1, x) #define rs_free(x) free(x) +#include "pfctl.h" + #ifdef PFDEBUG #include #define DPFPRINTF(format, x...) fprintf(stderr, format , ##x) diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index f43b71e19fec..5aa94b2bb0c8 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -128,4 +128,12 @@ u_int32_t pfctl_get_ticket(struct pfr_buffer *, int, const char *); int pfctl_trans(int, struct pfr_buffer *, u_long, int); +int pf_get_ruleset_number(u_int8_t); +void pf_init_ruleset(struct pf_ruleset *); +int pf_anchor_setup(struct pf_rule *, + const struct pf_ruleset *, const char *); +void pf_remove_if_empty_ruleset(struct pf_ruleset *); +struct pf_ruleset *pf_find_ruleset(const char *); +struct pf_ruleset *pf_find_or_create_ruleset(const char *); + #endif /* _PFCTL_H_ */ diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index bc6cd92ae7b8..3e358de8aba5 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -637,13 +637,6 @@ struct pf_anchor { RB_PROTOTYPE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); RB_PROTOTYPE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); -/* these ruleset functions can be linked into userland programs (pfctl) */ -int pf_get_ruleset_number(u_int8_t); -void pf_init_ruleset(struct pf_ruleset *); -int pf_anchor_setup(struct pf_rule *, - const struct pf_ruleset *, const char *); -void pf_remove_if_empty_ruleset(struct pf_ruleset *); -struct pf_ruleset *pf_find_ruleset(const char *); -struct pf_ruleset *pf_find_or_create_ruleset(const char *); +int pf_get_ruleset_number(u_int8_t); #endif /* _NET_PF_H_ */ From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 319C9631683; Fri, 7 May 2021 15:25:49 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmX1Ytsz4jmm; Fri, 7 May 2021 15:25:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 89B2C55E4; Fri, 7 May 2021 15:25:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPltW026387; Fri, 7 May 2021 15:25:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPl8A026386; Fri, 7 May 2021 15:25:47 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:47 GMT Message-Id: <202105071525.147FPl8A026386@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 1398367b3a89 - stable/13 - libpfctl: Fix u_* counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1398367b3a89ce2bf882ecbd181d08cfd044a7dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:49 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1398367b3a89ce2bf882ecbd181d08cfd044a7dc commit 1398367b3a89ce2bf882ecbd181d08cfd044a7dc Author: Kristof Provost AuthorDate: 2021-04-08 08:36:18 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:42 +0000 libpfctl: Fix u_* counters struct pf_rule had a few counter_u64_t counters. Those couldn't be usefully comminicated with userspace, so the fields were doubled up in uint64_t u_* versions. Now that we use struct pfctl_rule (i.e. a fully userspace version) we can safely change the structure and remove this wart. Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29645 (cherry picked from commit ab5707a5cf86ed66dbd11e03ad9676766da9a47b) --- lib/libpfctl/libpfctl.c | 6 +++--- lib/libpfctl/libpfctl.h | 10 +++------- sbin/pfctl/pfctl.c | 6 +++--- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index dc174d8d5b72..2a7b64f1cbc8 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -367,9 +367,9 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pfctl_rule *rule) pf_nvdivert_to_divert(nvlist_get_nvlist(nvl, "divert"), rule); - rule->u_states_cur = nvlist_get_number(nvl, "states_cur"); - rule->u_states_tot = nvlist_get_number(nvl, "states_tot"); - rule->u_src_nodes = nvlist_get_number(nvl, "src_nodes"); + rule->states_cur = nvlist_get_number(nvl, "states_cur"); + rule->states_tot = nvlist_get_number(nvl, "states_tot"); + rule->src_nodes = nvlist_get_number(nvl, "src_nodes"); } int diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 996830619489..95f6d4e3c77f 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -81,9 +81,9 @@ struct pfctl_rule { uid_t cuid; pid_t cpid; - counter_u64_t states_cur; - counter_u64_t states_tot; - counter_u64_t src_nodes; + uint64_t states_cur; + uint64_t states_tot; + uint64_t src_nodes; u_int16_t return_icmp; u_int16_t return_icmp6; @@ -129,10 +129,6 @@ struct pfctl_rule { struct pf_addr addr; u_int16_t port; } divert; - - uint64_t u_states_cur; - uint64_t u_states_tot; - uint64_t u_src_nodes; }; TAILQ_HEAD(pfctl_rulequeue, pfctl_rule); diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 548aab0f839e..bc646ab335e1 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -891,12 +891,12 @@ pfctl_print_rule_counters(struct pfctl_rule *rule, int opts) (unsigned long long)(rule->packets[0] + rule->packets[1]), (unsigned long long)(rule->bytes[0] + - rule->bytes[1]), (uintmax_t)rule->u_states_cur); + rule->bytes[1]), (uintmax_t)rule->states_cur); if (!(opts & PF_OPT_DEBUG)) printf(" [ Inserted: uid %u pid %u " "State Creations: %-6ju]\n", (unsigned)rule->cuid, (unsigned)rule->cpid, - (uintmax_t)rule->u_states_tot); + (uintmax_t)rule->states_tot); } } @@ -1012,7 +1012,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, (unsigned long long)rule.bytes[0], (unsigned long long)rule.packets[1], (unsigned long long)rule.bytes[1], - (uintmax_t)rule.u_states_tot); + (uintmax_t)rule.states_tot); } break; case PFCTL_SHOW_RULES: From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2BAC6311FB; Fri, 7 May 2021 15:25:47 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmW01pzz4k46; Fri, 7 May 2021 15:25:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AE56258F1; Fri, 7 May 2021 15:25:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPjxn026324; Fri, 7 May 2021 15:25:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPj3n026323; Fri, 7 May 2021 15:25:45 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:45 GMT Message-Id: <202105071525.147FPj3n026323@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: aa1d70283bee - stable/12 - bsnmp: Use libpfctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: aa1d70283bee4a679ff816357867a36152bd7293 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:48 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=aa1d70283bee4a679ff816357867a36152bd7293 commit aa1d70283bee4a679ff816357867a36152bd7293 Author: Kristof Provost AuthorDate: 2021-03-29 15:43:25 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:01 +0000 bsnmp: Use libpfctl Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29642 (cherry picked from commit 956e7d232549ce4b17f5b1a079e5b51229479dda) --- usr.sbin/bsnmpd/modules/snmp_pf/Makefile | 3 +++ usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bsnmpd/modules/snmp_pf/Makefile b/usr.sbin/bsnmpd/modules/snmp_pf/Makefile index fdf77191f706..3ab6e436aa75 100644 --- a/usr.sbin/bsnmpd/modules/snmp_pf/Makefile +++ b/usr.sbin/bsnmpd/modules/snmp_pf/Makefile @@ -9,4 +9,7 @@ XSYM= begemotPf DEFS= ${MOD}_tree.def BMIBS= BEGEMOT-PF-MIB.txt +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl +LIBADD+= pfctl + .include diff --git a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c index a14ab5841dfa..dc55c730bc5f 100644 --- a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c +++ b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -1528,7 +1529,8 @@ pfl_scan_ruleset(const char *path) for (nr = pr.nr, i = 0; i < nr; i++) { pr.nr = i; - if (ioctl(dev, DIOCGETRULE, &pr)) { + if (pfctl_add_rule(dev, &pr.rule, pr.anchor, pr.anchor_call, + pr.ticket, pr.pool_ticket)) { syslog(LOG_ERR, "pfl_scan_ruleset: ioctl(DIOCGETRULE):" " %s", strerror(errno)); goto err; From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20B2763145D; Fri, 7 May 2021 15:25:48 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmW4442z4k2B; Fri, 7 May 2021 15:25:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 62A625AD0; Fri, 7 May 2021 15:25:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPkS5026345; Fri, 7 May 2021 15:25:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPkXB026344; Fri, 7 May 2021 15:25:46 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:46 GMT Message-Id: <202105071525.147FPkXB026344@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 6fd48efd8d6d - stable/13 - libpfctl: Switch to pfctl_rule MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6fd48efd8d6d4a6fc12e60baf9ea717034b40eca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:48 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6fd48efd8d6d4a6fc12e60baf9ea717034b40eca commit 6fd48efd8d6d4a6fc12e60baf9ea717034b40eca Author: Kristof Provost AuthorDate: 2021-04-08 08:31:46 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:42 +0000 libpfctl: Switch to pfctl_rule Stop using the kernel's struct pf_rule, switch to libpfctl's pfctl_rule. Now that we use nvlists to communicate with the kernel these structures can be fully decoupled. Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29644 (cherry picked from commit e9eb09414a8de8f3329f51b48c90a5e5ac8f09cf) --- contrib/pf/ftp-proxy/filter.c | 100 +++++++++++---------- contrib/pf/tftp-proxy/filter.c | 90 ++++++++++--------- lib/libpfctl/libpfctl.c | 10 +-- lib/libpfctl/libpfctl.h | 143 +++++++++++++++++++++++++++++- sbin/pfctl/parse.y | 52 +++++------ sbin/pfctl/pf_ruleset.c | 63 ++++++------- sbin/pfctl/pfctl.c | 91 ++++++++++--------- sbin/pfctl/pfctl.h | 14 +-- sbin/pfctl/pfctl_optimize.c | 82 ++++++++--------- sbin/pfctl/pfctl_parser.c | 2 +- sbin/pfctl/pfctl_parser.h | 14 +-- usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c | 17 ++-- 12 files changed, 416 insertions(+), 262 deletions(-) diff --git a/contrib/pf/ftp-proxy/filter.c b/contrib/pf/ftp-proxy/filter.c index db3735565dac..dad6324808bc 100644 --- a/contrib/pf/ftp-proxy/filter.c +++ b/contrib/pf/ftp-proxy/filter.c @@ -50,7 +50,11 @@ int server_lookup6(struct sockaddr_in6 *, struct sockaddr_in6 *, struct sockaddr_in6 *); static struct pfioc_pooladdr pfp; -static struct pfioc_rule pfr; +static struct pfctl_rule pfrule; +static char pfanchor[PF_ANCHOR_NAME_SIZE]; +static char pfanchor_call[PF_ANCHOR_NAME_SIZE]; +static uint32_t pfticket; +static uint32_t pfpool_ticket; static struct pfioc_trans pft; static struct pfioc_trans_e pfte[TRANS_SIZE]; static int dev, rule_log; @@ -68,9 +72,9 @@ add_filter(u_int32_t id, u_int8_t dir, struct sockaddr *src, if (prepare_rule(id, PF_RULESET_FILTER, src, dst, d_port) == -1) return (-1); - pfr.rule.direction = dir; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.direction = dir; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -99,14 +103,14 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(nat)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); - pfr.rule.rpool.proxy_port[0] = nat_range_low; - pfr.rule.rpool.proxy_port[1] = nat_range_high; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.rpool.proxy_port[0] = nat_range_low; + pfrule.rpool.proxy_port[1] = nat_range_high; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -134,13 +138,13 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(rdr)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); - pfr.rule.rpool.proxy_port[0] = rdr_port; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.rpool.proxy_port[0] = rdr_port; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -237,21 +241,21 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, } memset(&pfp, 0, sizeof pfp); - memset(&pfr, 0, sizeof pfr); + memset(&pfrule, 0, sizeof pfrule); snprintf(an, PF_ANCHOR_NAME_SIZE, "%s/%d.%d", FTP_PROXY_ANCHOR, getpid(), id); strlcpy(pfp.anchor, an, PF_ANCHOR_NAME_SIZE); - strlcpy(pfr.anchor, an, PF_ANCHOR_NAME_SIZE); + strlcpy(pfanchor, an, PF_ANCHOR_NAME_SIZE); switch (rs_num) { case PF_RULESET_FILTER: - pfr.ticket = pfte[TRANS_FILTER].ticket; + pfticket = pfte[TRANS_FILTER].ticket; break; case PF_RULESET_NAT: - pfr.ticket = pfte[TRANS_NAT].ticket; + pfticket = pfte[TRANS_NAT].ticket; break; case PF_RULESET_RDR: - pfr.ticket = pfte[TRANS_RDR].ticket; + pfticket = pfte[TRANS_RDR].ticket; break; default: errno = EINVAL; @@ -259,30 +263,30 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, } if (ioctl(dev, DIOCBEGINADDRS, &pfp) == -1) return (-1); - pfr.pool_ticket = pfp.ticket; + pfpool_ticket = pfp.ticket; /* Generic for all rule types. */ - pfr.rule.af = src->sa_family; - pfr.rule.proto = IPPROTO_TCP; - pfr.rule.src.addr.type = PF_ADDR_ADDRMASK; - pfr.rule.dst.addr.type = PF_ADDR_ADDRMASK; + pfrule.af = src->sa_family; + pfrule.proto = IPPROTO_TCP; + pfrule.src.addr.type = PF_ADDR_ADDRMASK; + pfrule.dst.addr.type = PF_ADDR_ADDRMASK; if (src->sa_family == AF_INET) { - memcpy(&pfr.rule.src.addr.v.a.addr.v4, + memcpy(&pfrule.src.addr.v.a.addr.v4, &satosin(src)->sin_addr.s_addr, 4); - memset(&pfr.rule.src.addr.v.a.mask.addr8, 255, 4); - memcpy(&pfr.rule.dst.addr.v.a.addr.v4, + memset(&pfrule.src.addr.v.a.mask.addr8, 255, 4); + memcpy(&pfrule.dst.addr.v.a.addr.v4, &satosin(dst)->sin_addr.s_addr, 4); - memset(&pfr.rule.dst.addr.v.a.mask.addr8, 255, 4); + memset(&pfrule.dst.addr.v.a.mask.addr8, 255, 4); } else { - memcpy(&pfr.rule.src.addr.v.a.addr.v6, + memcpy(&pfrule.src.addr.v.a.addr.v6, &satosin6(src)->sin6_addr.s6_addr, 16); - memset(&pfr.rule.src.addr.v.a.mask.addr8, 255, 16); - memcpy(&pfr.rule.dst.addr.v.a.addr.v6, + memset(&pfrule.src.addr.v.a.mask.addr8, 255, 16); + memcpy(&pfrule.dst.addr.v.a.addr.v6, &satosin6(dst)->sin6_addr.s6_addr, 16); - memset(&pfr.rule.dst.addr.v.a.mask.addr8, 255, 16); + memset(&pfrule.dst.addr.v.a.mask.addr8, 255, 16); } - pfr.rule.dst.port_op = PF_OP_EQ; - pfr.rule.dst.port[0] = htons(d_port); + pfrule.dst.port_op = PF_OP_EQ; + pfrule.dst.port[0] = htons(d_port); switch (rs_num) { case PF_RULESET_FILTER: @@ -291,32 +295,32 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, * from $src to $dst port = $d_port flags S/SA keep state * (max 1) [queue qname] [tag tagname] */ - pfr.rule.action = PF_PASS; - pfr.rule.quick = 1; - pfr.rule.log = rule_log; - pfr.rule.keep_state = 1; - pfr.rule.flags = TH_SYN; - pfr.rule.flagset = (TH_SYN|TH_ACK); - pfr.rule.max_states = 1; + pfrule.action = PF_PASS; + pfrule.quick = 1; + pfrule.log = rule_log; + pfrule.keep_state = 1; + pfrule.flags = TH_SYN; + pfrule.flagset = (TH_SYN|TH_ACK); + pfrule.max_states = 1; if (qname != NULL) - strlcpy(pfr.rule.qname, qname, sizeof pfr.rule.qname); + strlcpy(pfrule.qname, qname, sizeof pfrule.qname); if (tagname != NULL) { - pfr.rule.quick = 0; - strlcpy(pfr.rule.tagname, tagname, - sizeof pfr.rule.tagname); + pfrule.quick = 0; + strlcpy(pfrule.tagname, tagname, + sizeof pfrule.tagname); } break; case PF_RULESET_NAT: /* * nat inet[6] proto tcp from $src to $dst port $d_port -> $nat */ - pfr.rule.action = PF_NAT; + pfrule.action = PF_NAT; break; case PF_RULESET_RDR: /* * rdr inet[6] proto tcp from $src to $dst port $d_port -> $rdr */ - pfr.rule.action = PF_RDR; + pfrule.action = PF_RDR; break; default: errno = EINVAL; diff --git a/contrib/pf/tftp-proxy/filter.c b/contrib/pf/tftp-proxy/filter.c index 0b87d568809f..1689d3465fd3 100644 --- a/contrib/pf/tftp-proxy/filter.c +++ b/contrib/pf/tftp-proxy/filter.c @@ -54,7 +54,11 @@ int server_lookup6(struct sockaddr_in6 *, struct sockaddr_in6 *, struct sockaddr_in6 *, u_int8_t); static struct pfioc_pooladdr pfp; -static struct pfioc_rule pfr; +static struct pfctl_rule pfrule; +static uint32_t pfticket; +static uint32_t pfpool_ticket; +static char pfanchor[PF_ANCHOR_NAME_SIZE]; +static char pfanchor_call[PF_ANCHOR_NAME_SIZE]; static struct pfioc_trans pft; static struct pfioc_trans_e pfte[TRANS_SIZE]; static int dev, rule_log; @@ -72,9 +76,9 @@ add_filter(u_int32_t id, u_int8_t dir, struct sockaddr *src, if (prepare_rule(id, PF_RULESET_FILTER, src, dst, d_port, proto) == -1) return (-1); - pfr.rule.direction = dir; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.direction = dir; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -106,10 +110,10 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, if (ioctl(dev, DIOCADDADDR, &pfp) == -1) return (-1); - pfr.rule.rpool.proxy_port[0] = nat_range_low; - pfr.rule.rpool.proxy_port[1] = nat_range_high; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.rpool.proxy_port[0] = nat_range_low; + pfrule.rpool.proxy_port[1] = nat_range_high; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -140,9 +144,9 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, if (ioctl(dev, DIOCADDADDR, &pfp) == -1) return (-1); - pfr.rule.rpool.proxy_port[0] = rdr_port; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.rpool.proxy_port[0] = rdr_port; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -244,21 +248,21 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, } memset(&pfp, 0, sizeof pfp); - memset(&pfr, 0, sizeof pfr); + memset(&pfrule, 0, sizeof pfrule); snprintf(an, PF_ANCHOR_NAME_SIZE, "%s/%d.%d", FTP_PROXY_ANCHOR, getpid(), id); strlcpy(pfp.anchor, an, PF_ANCHOR_NAME_SIZE); - strlcpy(pfr.anchor, an, PF_ANCHOR_NAME_SIZE); + strlcpy(pfanchor, an, PF_ANCHOR_NAME_SIZE); switch (rs_num) { case PF_RULESET_FILTER: - pfr.ticket = pfte[TRANS_FILTER].ticket; + pfticket = pfte[TRANS_FILTER].ticket; break; case PF_RULESET_NAT: - pfr.ticket = pfte[TRANS_NAT].ticket; + pfticket = pfte[TRANS_NAT].ticket; break; case PF_RULESET_RDR: - pfr.ticket = pfte[TRANS_RDR].ticket; + pfticket = pfte[TRANS_RDR].ticket; break; default: errno = EINVAL; @@ -266,30 +270,30 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, } if (ioctl(dev, DIOCBEGINADDRS, &pfp) == -1) return (-1); - pfr.pool_ticket = pfp.ticket; + pfpool_ticket = pfp.ticket; /* Generic for all rule types. */ - pfr.rule.af = src->sa_family; - pfr.rule.proto = proto; - pfr.rule.src.addr.type = PF_ADDR_ADDRMASK; - pfr.rule.dst.addr.type = PF_ADDR_ADDRMASK; + pfrule.af = src->sa_family; + pfrule.proto = proto; + pfrule.src.addr.type = PF_ADDR_ADDRMASK; + pfrule.dst.addr.type = PF_ADDR_ADDRMASK; if (src->sa_family == AF_INET) { - memcpy(&pfr.rule.src.addr.v.a.addr.v4, + memcpy(&pfrule.src.addr.v.a.addr.v4, &satosin(src)->sin_addr.s_addr, 4); - memset(&pfr.rule.src.addr.v.a.mask.addr8, 255, 4); - memcpy(&pfr.rule.dst.addr.v.a.addr.v4, + memset(&pfrule.src.addr.v.a.mask.addr8, 255, 4); + memcpy(&pfrule.dst.addr.v.a.addr.v4, &satosin(dst)->sin_addr.s_addr, 4); - memset(&pfr.rule.dst.addr.v.a.mask.addr8, 255, 4); + memset(&pfrule.dst.addr.v.a.mask.addr8, 255, 4); } else { - memcpy(&pfr.rule.src.addr.v.a.addr.v6, + memcpy(&pfrule.src.addr.v.a.addr.v6, &satosin6(src)->sin6_addr.s6_addr, 16); - memset(&pfr.rule.src.addr.v.a.mask.addr8, 255, 16); - memcpy(&pfr.rule.dst.addr.v.a.addr.v6, + memset(&pfrule.src.addr.v.a.mask.addr8, 255, 16); + memcpy(&pfrule.dst.addr.v.a.addr.v6, &satosin6(dst)->sin6_addr.s6_addr, 16); - memset(&pfr.rule.dst.addr.v.a.mask.addr8, 255, 16); + memset(&pfrule.dst.addr.v.a.mask.addr8, 255, 16); } - pfr.rule.dst.port_op = PF_OP_EQ; - pfr.rule.dst.port[0] = htons(d_port); + pfrule.dst.port_op = PF_OP_EQ; + pfrule.dst.port[0] = htons(d_port); switch (rs_num) { case PF_RULESET_FILTER: @@ -298,34 +302,34 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, * from $src to $dst port = $d_port flags S/SAFR keep state * (max 1) [queue qname] */ - pfr.rule.action = PF_PASS; - pfr.rule.quick = 1; - pfr.rule.log = rule_log; - pfr.rule.keep_state = 1; + pfrule.action = PF_PASS; + pfrule.quick = 1; + pfrule.log = rule_log; + pfrule.keep_state = 1; #ifdef __FreeBSD__ - pfr.rule.flags = (proto == IPPROTO_TCP ? TH_SYN : 0); - pfr.rule.flagset = (proto == IPPROTO_TCP ? + pfrule.flags = (proto == IPPROTO_TCP ? TH_SYN : 0); + pfrule.flagset = (proto == IPPROTO_TCP ? (TH_SYN|TH_ACK|TH_FIN|TH_RST) : 0); #else - pfr.rule.flags = (proto == IPPROTO_TCP ? TH_SYN : NULL); - pfr.rule.flagset = (proto == IPPROTO_TCP ? + pfrule.flags = (proto == IPPROTO_TCP ? TH_SYN : NULL); + pfrule.flagset = (proto == IPPROTO_TCP ? (TH_SYN|TH_ACK|TH_FIN|TH_RST) : NULL); #endif - pfr.rule.max_states = 1; + pfrule.max_states = 1; if (qname != NULL) - strlcpy(pfr.rule.qname, qname, sizeof pfr.rule.qname); + strlcpy(pfrule.qname, qname, sizeof pfrule.qname); break; case PF_RULESET_NAT: /* * nat inet[6] proto tcp from $src to $dst port $d_port -> $nat */ - pfr.rule.action = PF_NAT; + pfrule.action = PF_NAT; break; case PF_RULESET_RDR: /* * rdr inet[6] proto tcp from $src to $dst port $d_port -> $rdr */ - pfr.rule.action = PF_RDR; + pfrule.action = PF_RDR; break; default: errno = EINVAL; diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index e0d429112f5b..dc174d8d5b72 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -256,7 +256,7 @@ pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) static void pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, - const struct pf_rule *r) + const struct pfctl_rule *r) { nvlist_t *nvl = nvlist_create(0); @@ -267,14 +267,14 @@ pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, } static void -pf_nvdivert_to_divert(const nvlist_t *nvl, struct pf_rule *rule) +pf_nvdivert_to_divert(const nvlist_t *nvl, struct pfctl_rule *rule) { pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), &rule->divert.addr); rule->divert.port = nvlist_get_number(nvl, "port"); } static void -pf_nvrule_to_rule(const nvlist_t *nvl, struct pf_rule *rule) +pf_nvrule_to_rule(const nvlist_t *nvl, struct pfctl_rule *rule) { const uint64_t *skip; size_t skipcount; @@ -373,7 +373,7 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pf_rule *rule) } int -pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, +pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) { struct pfioc_nv nv; @@ -482,7 +482,7 @@ pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, - u_int32_t ruleset, struct pf_rule *rule, char *anchor_call) + u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call) { struct pfioc_nv nv; nvlist_t *nvl; diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 65ff2179f23d..996830619489 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -36,10 +36,147 @@ #include +struct pfctl_anchor; + +struct pfctl_rule { + struct pf_rule_addr src; + struct pf_rule_addr dst; + union pf_rule_ptr skip[PF_SKIP_COUNT]; + char label[PF_RULE_LABEL_SIZE]; + char ifname[IFNAMSIZ]; + char qname[PF_QNAME_SIZE]; + char pqname[PF_QNAME_SIZE]; + char tagname[PF_TAG_NAME_SIZE]; + char match_tagname[PF_TAG_NAME_SIZE]; + + char overload_tblname[PF_TABLE_NAME_SIZE]; + + TAILQ_ENTRY(pfctl_rule) entries; + struct pf_pool rpool; + + u_int64_t evaluations; + u_int64_t packets[2]; + u_int64_t bytes[2]; + + struct pfi_kif *kif; + struct pfctl_anchor *anchor; + struct pfr_ktable *overload_tbl; + + pf_osfp_t os_fingerprint; + + int rtableid; + u_int32_t timeout[PFTM_MAX]; + u_int32_t max_states; + u_int32_t max_src_nodes; + u_int32_t max_src_states; + u_int32_t max_src_conn; + struct { + u_int32_t limit; + u_int32_t seconds; + } max_src_conn_rate; + u_int32_t qid; + u_int32_t pqid; + u_int32_t nr; + u_int32_t prob; + uid_t cuid; + pid_t cpid; + + counter_u64_t states_cur; + counter_u64_t states_tot; + counter_u64_t src_nodes; + + u_int16_t return_icmp; + u_int16_t return_icmp6; + u_int16_t max_mss; + u_int16_t tag; + u_int16_t match_tag; + u_int16_t scrub_flags; + + struct pf_rule_uid uid; + struct pf_rule_gid gid; + + u_int32_t rule_flag; + u_int8_t action; + u_int8_t direction; + u_int8_t log; + u_int8_t logif; + u_int8_t quick; + u_int8_t ifnot; + u_int8_t match_tag_not; + u_int8_t natpass; + + u_int8_t keep_state; + sa_family_t af; + u_int8_t proto; + u_int8_t type; + u_int8_t code; + u_int8_t flags; + u_int8_t flagset; + u_int8_t min_ttl; + u_int8_t allow_opts; + u_int8_t rt; + u_int8_t return_ttl; + u_int8_t tos; + u_int8_t set_tos; + u_int8_t anchor_relative; + u_int8_t anchor_wildcard; + + u_int8_t flush; + u_int8_t prio; + u_int8_t set_prio[2]; + + struct { + struct pf_addr addr; + u_int16_t port; + } divert; + + uint64_t u_states_cur; + uint64_t u_states_tot; + uint64_t u_src_nodes; +}; + +TAILQ_HEAD(pfctl_rulequeue, pfctl_rule); + +struct pfctl_ruleset { + struct { + struct pfctl_rulequeue queues[2]; + struct { + struct pfctl_rulequeue *ptr; + struct pfctl_rule **ptr_array; + u_int32_t rcount; + u_int32_t ticket; + int open; + } active, inactive; + } rules[PF_RULESET_MAX]; + struct pfctl_anchor *anchor; + u_int32_t tticket; + int tables; + int topen; +}; + +RB_HEAD(pfctl_anchor_global, pfctl_anchor); +RB_HEAD(pfctl_anchor_node, pfctl_anchor); +struct pfctl_anchor { + RB_ENTRY(pfctl_anchor) entry_global; + RB_ENTRY(pfctl_anchor) entry_node; + struct pfctl_anchor *parent; + struct pfctl_anchor_node children; + char name[PF_ANCHOR_NAME_SIZE]; + char path[MAXPATHLEN]; + struct pfctl_ruleset ruleset; + int refcnt; /* anchor rules */ + int match; /* XXX: used for pfctl black magic */ +}; +RB_PROTOTYPE(pfctl_anchor_global, pfctl_anchor, entry_global, + pf_anchor_compare); +RB_PROTOTYPE(pfctl_anchor_node, pfctl_anchor, entry_node, + pf_anchor_compare); + int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, - const char *anchor, u_int32_t ruleset, struct pf_rule *rule, + const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); -int pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, - const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket); +int pfctl_add_rule(int dev, const struct pfctl_rule *r, + const char *anchor, const char *anchor_call, u_int32_t ticket, + u_int32_t pool_ticket); #endif diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 89e421e6b5ad..08da7e6bddd6 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -317,10 +317,10 @@ static struct node_state_opt *keep_state_defaults = NULL; int disallow_table(struct node_host *, const char *); int disallow_urpf_failed(struct node_host *, const char *); int disallow_alias(struct node_host *, const char *); -int rule_consistent(struct pf_rule *, int); -int filter_consistent(struct pf_rule *, int); -int nat_consistent(struct pf_rule *); -int rdr_consistent(struct pf_rule *); +int rule_consistent(struct pfctl_rule *, int); +int filter_consistent(struct pfctl_rule *, int); +int nat_consistent(struct pfctl_rule *); +int rdr_consistent(struct pfctl_rule *); int process_tabledef(char *, struct table_opts *); void expand_label_str(char *, size_t, const char *, const char *); void expand_label_if(const char *, char *, size_t, const char *); @@ -333,7 +333,7 @@ void expand_label_nr(const char *, char *, size_t); void expand_label(char *, size_t, const char *, u_int8_t, struct node_host *, struct node_port *, struct node_host *, struct node_port *, u_int8_t); -void expand_rule(struct pf_rule *, struct node_if *, +void expand_rule(struct pfctl_rule *, struct node_if *, struct node_host *, struct node_proto *, struct node_os *, struct node_host *, struct node_port *, struct node_host *, struct node_port *, struct node_uid *, struct node_gid *, @@ -348,10 +348,10 @@ int expand_skip_interface(struct node_if *); int check_rulestate(int); int getservice(char *); -int rule_label(struct pf_rule *, char *); +int rule_label(struct pfctl_rule *, char *); int rt_tableid_max(void); -void mv_rules(struct pf_ruleset *, struct pf_ruleset *); +void mv_rules(struct pfctl_ruleset *, struct pfctl_ruleset *); void decide_address_family(struct node_host *, sa_family_t *); void remove_invalid_hosts(struct node_host **, sa_family_t *); int invalid_redirect(struct node_host *, sa_family_t); @@ -788,7 +788,7 @@ pfa_anchorlist : /* empty */ pfa_anchor : '{' { char ta[PF_ANCHOR_NAME_SIZE]; - struct pf_ruleset *rs; + struct pfctl_ruleset *rs; /* steping into a brace anchor */ pf->asd++; @@ -814,7 +814,7 @@ pfa_anchor : '{' anchorrule : ANCHOR anchorname dir quick interface af proto fromto filter_opts pfa_anchor { - struct pf_rule r; + struct pfctl_rule r; struct node_proto *proto; if (check_rulestate(PFCTL_STATE_FILTER)) { @@ -833,7 +833,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto memset(&r, 0, sizeof(r)); if (pf->astack[pf->asd + 1]) { /* move inline rules into relative location */ - pf_anchor_setup(&r, + pfctl_anchor_setup(&r, &pf->astack[pf->asd]->ruleset, $2 ? $2 : pf->alast->name); @@ -946,7 +946,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto pf->astack[pf->asd + 1] = NULL; } | NATANCHOR string interface af proto fromto rtable { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_NAT)) { free($2); @@ -967,7 +967,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto free($2); } | RDRANCHOR string interface af proto fromto rtable { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_NAT)) { free($2); @@ -1009,7 +1009,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto free($2); } | BINATANCHOR string interface af proto fromto rtable { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_NAT)) { free($2); @@ -1087,7 +1087,7 @@ scrubaction : no SCRUB { scrubrule : scrubaction dir logquick interface af proto fromto scrub_opts { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_SCRUB)) YYERROR; @@ -1247,7 +1247,7 @@ fragcache : FRAGMENT REASSEMBLE { $$ = 0; /* default */ } ; antispoof : ANTISPOOF logquick antispoof_ifspc af antispoof_opts { - struct pf_rule r; + struct pfctl_rule r; struct node_host *h = NULL, *hh; struct node_if *i, *j; @@ -2022,7 +2022,7 @@ qassign_item : STRING { pfrule : action dir logquick interface route af proto fromto filter_opts { - struct pf_rule r; + struct pfctl_rule r; struct node_state_opt *o; struct node_proto *proto; int srctrack = 0; @@ -4071,7 +4071,7 @@ nataction : no NAT natpasslog { natrule : nataction interface af proto fromto tag tagged rtable redirpool pool_opts { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_NAT)) YYERROR; @@ -4230,7 +4230,7 @@ natrule : nataction interface af proto fromto tag tagged rtable binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag tagged rtable redirection { - struct pf_rule binat; + struct pfctl_rule binat; struct pf_pooladdr *pa; if (check_rulestate(PFCTL_STATE_NAT)) @@ -4615,7 +4615,7 @@ disallow_alias(struct node_host *h, const char *fmt) } int -rule_consistent(struct pf_rule *r, int anchor_call) +rule_consistent(struct pfctl_rule *r, int anchor_call) { int problems = 0; @@ -4643,7 +4643,7 @@ rule_consistent(struct pf_rule *r, int anchor_call) } int -filter_consistent(struct pf_rule *r, int anchor_call) +filter_consistent(struct pfctl_rule *r, int anchor_call) { int problems = 0; @@ -4706,13 +4706,13 @@ filter_consistent(struct pf_rule *r, int anchor_call) } int -nat_consistent(struct pf_rule *r) +nat_consistent(struct pfctl_rule *r) { return (0); /* yeah! */ } int -rdr_consistent(struct pf_rule *r) +rdr_consistent(struct pfctl_rule *r) { int problems = 0; @@ -5248,7 +5248,7 @@ expand_queue(struct pf_altq *a, struct node_if *interfaces, } void -expand_rule(struct pf_rule *r, +expand_rule(struct pfctl_rule *r, struct node_if *interfaces, struct node_host *rpool_hosts, struct node_proto *protos, struct node_os *src_oses, struct node_host *src_hosts, struct node_port *src_ports, @@ -6080,10 +6080,10 @@ symget(const char *nam) } void -mv_rules(struct pf_ruleset *src, struct pf_ruleset *dst) +mv_rules(struct pfctl_ruleset *src, struct pfctl_ruleset *dst) { int i; - struct pf_rule *r; + struct pfctl_rule *r; for (i = 0; i < PF_RULESET_MAX; ++i) { while ((r = TAILQ_FIRST(src->rules[i].active.ptr)) @@ -6214,7 +6214,7 @@ getservice(char *n) } int -rule_label(struct pf_rule *r, char *s) +rule_label(struct pfctl_rule *r, char *s) { if (s) { if (strlcpy(r->label, s, sizeof(r->label)) >= diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c index baac1deb4fa7..f5cddf481871 100644 --- a/sbin/pfctl/pf_ruleset.c +++ b/sbin/pfctl/pf_ruleset.c @@ -73,22 +73,23 @@ __FBSDID("$FreeBSD$"); #define DPFPRINTF(format, x...) ((void)0) #endif /* PFDEBUG */ -struct pf_anchor_global pf_anchors; -struct pf_anchor pf_main_anchor; +struct pfctl_anchor_global pf_anchors; +struct pfctl_anchor pf_main_anchor; #undef V_pf_anchors #define V_pf_anchors pf_anchors #undef pf_main_ruleset #define pf_main_ruleset pf_main_anchor.ruleset -static __inline int pf_anchor_compare(struct pf_anchor *, - struct pf_anchor *); -static struct pf_anchor *pf_find_anchor(const char *); +static __inline int pf_anchor_compare(struct pfctl_anchor *, + struct pfctl_anchor *); +static struct pfctl_anchor *pf_find_anchor(const char *); -RB_GENERATE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); -RB_GENERATE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); +RB_GENERATE(pfctl_anchor_global, pfctl_anchor, entry_global, + pf_anchor_compare); +RB_GENERATE(pfctl_anchor_node, pfctl_anchor, entry_node, pf_anchor_compare); static __inline int -pf_anchor_compare(struct pf_anchor *a, struct pf_anchor *b) +pf_anchor_compare(struct pfctl_anchor *a, struct pfctl_anchor *b) { int c = strcmp(a->path, b->path); @@ -126,11 +127,11 @@ pf_get_ruleset_number(u_int8_t action) } void -pf_init_ruleset(struct pf_ruleset *ruleset) +pf_init_ruleset(struct pfctl_ruleset *ruleset) { int i; - memset(ruleset, 0, sizeof(struct pf_ruleset)); + memset(ruleset, 0, sizeof(struct pfctl_ruleset)); for (i = 0; i < PF_RULESET_MAX; i++) { TAILQ_INIT(&ruleset->rules[i].queues[0]); TAILQ_INIT(&ruleset->rules[i].queues[1]); @@ -139,24 +140,24 @@ pf_init_ruleset(struct pf_ruleset *ruleset) } } -static struct pf_anchor * +static struct pfctl_anchor * pf_find_anchor(const char *path) { - struct pf_anchor *key, *found; + struct pfctl_anchor *key, *found; - key = (struct pf_anchor *)rs_malloc(sizeof(*key)); + key = (struct pfctl_anchor *)rs_malloc(sizeof(*key)); if (key == NULL) return (NULL); strlcpy(key->path, path, sizeof(key->path)); - found = RB_FIND(pf_anchor_global, &V_pf_anchors, key); + found = RB_FIND(pfctl_anchor_global, &V_pf_anchors, key); rs_free(key); return (found); } -struct pf_ruleset * +struct pfctl_ruleset * pf_find_ruleset(const char *path) { - struct pf_anchor *anchor; + struct pfctl_anchor *anchor; while (*path == '/') path++; @@ -169,12 +170,12 @@ pf_find_ruleset(const char *path) return (&anchor->ruleset); } -struct pf_ruleset * +struct pfctl_ruleset * pf_find_or_create_ruleset(const char *path) { char *p, *q, *r; - struct pf_ruleset *ruleset; - struct pf_anchor *anchor = NULL, *dup, *parent = NULL; + struct pfctl_ruleset *ruleset; + struct pfctl_anchor *anchor = NULL, *dup, *parent = NULL; if (path[0] == 0) return (&pf_main_ruleset); @@ -212,7 +213,7 @@ pf_find_or_create_ruleset(const char *path) rs_free(p); return (NULL); } - anchor = (struct pf_anchor *)rs_malloc(sizeof(*anchor)); + anchor = (struct pfctl_anchor *)rs_malloc(sizeof(*anchor)); if (anchor == NULL) { rs_free(p); return (NULL); @@ -225,7 +226,7 @@ pf_find_or_create_ruleset(const char *path) strlcat(anchor->path, "/", sizeof(anchor->path)); } strlcat(anchor->path, anchor->name, sizeof(anchor->path)); - if ((dup = RB_INSERT(pf_anchor_global, &V_pf_anchors, anchor)) != + if ((dup = RB_INSERT(pfctl_anchor_global, &V_pf_anchors, anchor)) != NULL) { printf("pf_find_or_create_ruleset: RB_INSERT1 " "'%s' '%s' collides with '%s' '%s'\n", @@ -236,13 +237,13 @@ pf_find_or_create_ruleset(const char *path) } if (parent != NULL) { anchor->parent = parent; - if ((dup = RB_INSERT(pf_anchor_node, &parent->children, + if ((dup = RB_INSERT(pfctl_anchor_node, &parent->children, anchor)) != NULL) { printf("pf_find_or_create_ruleset: " "RB_INSERT2 '%s' '%s' collides with " "'%s' '%s'\n", anchor->path, anchor->name, dup->path, dup->name); - RB_REMOVE(pf_anchor_global, &V_pf_anchors, + RB_REMOVE(pfctl_anchor_global, &V_pf_anchors, anchor); rs_free(anchor); rs_free(p); @@ -262,9 +263,9 @@ pf_find_or_create_ruleset(const char *path) } void -pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) +pf_remove_if_empty_ruleset(struct pfctl_ruleset *ruleset) { - struct pf_anchor *parent; + struct pfctl_anchor *parent; int i; while (ruleset != NULL) { @@ -278,9 +279,9 @@ pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) !TAILQ_EMPTY(ruleset->rules[i].inactive.ptr) || ruleset->rules[i].inactive.open) return; - RB_REMOVE(pf_anchor_global, &V_pf_anchors, ruleset->anchor); + RB_REMOVE(pfctl_anchor_global, &V_pf_anchors, ruleset->anchor); if ((parent = ruleset->anchor->parent) != NULL) - RB_REMOVE(pf_anchor_node, &parent->children, + RB_REMOVE(pfctl_anchor_node, &parent->children, ruleset->anchor); rs_free(ruleset->anchor); if (parent == NULL) @@ -289,11 +290,11 @@ pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) } } int -pf_anchor_setup(struct pf_rule *r, const struct pf_ruleset *s, +pfctl_anchor_setup(struct pfctl_rule *r, const struct pfctl_ruleset *s, const char *name) { char *p, *path; - struct pf_ruleset *ruleset; + struct pfctl_ruleset *ruleset; r->anchor = NULL; r->anchor_relative = 0; @@ -314,7 +315,7 @@ pf_anchor_setup(struct pf_rule *r, const struct pf_ruleset *s, strlcpy(path, s->anchor->path, MAXPATHLEN); while (name[0] == '.' && name[1] == '.' && name[2] == '/') { if (!path[0]) { - printf("pf_anchor_setup: .. beyond root\n"); + printf("pfctl_anchor_setup: .. beyond root\n"); *** 690 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44B09631700; Fri, 7 May 2021 15:25:52 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmZ1YnQz4jn2; Fri, 7 May 2021 15:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 14A9E55E5; Fri, 7 May 2021 15:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPmvH026456; Fri, 7 May 2021 15:25:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPmhe026455; Fri, 7 May 2021 15:25:48 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:48 GMT Message-Id: <202105071525.147FPmhe026455@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 75ca6ff7d687 - stable/12 - libpfctl: Fix u_* counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 75ca6ff7d68753f8c21244c2fdf1d13cb8fb09e1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:52 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=75ca6ff7d68753f8c21244c2fdf1d13cb8fb09e1 commit 75ca6ff7d68753f8c21244c2fdf1d13cb8fb09e1 Author: Kristof Provost AuthorDate: 2021-04-08 08:36:18 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:02 +0000 libpfctl: Fix u_* counters struct pf_rule had a few counter_u64_t counters. Those couldn't be usefully comminicated with userspace, so the fields were doubled up in uint64_t u_* versions. Now that we use struct pfctl_rule (i.e. a fully userspace version) we can safely change the structure and remove this wart. Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29645 (cherry picked from commit ab5707a5cf86ed66dbd11e03ad9676766da9a47b) --- lib/libpfctl/libpfctl.c | 6 +++--- lib/libpfctl/libpfctl.h | 10 +++------- sbin/pfctl/pfctl.c | 6 +++--- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index dc174d8d5b72..2a7b64f1cbc8 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -367,9 +367,9 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pfctl_rule *rule) pf_nvdivert_to_divert(nvlist_get_nvlist(nvl, "divert"), rule); - rule->u_states_cur = nvlist_get_number(nvl, "states_cur"); - rule->u_states_tot = nvlist_get_number(nvl, "states_tot"); - rule->u_src_nodes = nvlist_get_number(nvl, "src_nodes"); + rule->states_cur = nvlist_get_number(nvl, "states_cur"); + rule->states_tot = nvlist_get_number(nvl, "states_tot"); + rule->src_nodes = nvlist_get_number(nvl, "src_nodes"); } int diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 996830619489..95f6d4e3c77f 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -81,9 +81,9 @@ struct pfctl_rule { uid_t cuid; pid_t cpid; - counter_u64_t states_cur; - counter_u64_t states_tot; - counter_u64_t src_nodes; + uint64_t states_cur; + uint64_t states_tot; + uint64_t src_nodes; u_int16_t return_icmp; u_int16_t return_icmp6; @@ -129,10 +129,6 @@ struct pfctl_rule { struct pf_addr addr; u_int16_t port; } divert; - - uint64_t u_states_cur; - uint64_t u_states_tot; - uint64_t u_src_nodes; }; TAILQ_HEAD(pfctl_rulequeue, pfctl_rule); diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 548aab0f839e..bc646ab335e1 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -891,12 +891,12 @@ pfctl_print_rule_counters(struct pfctl_rule *rule, int opts) (unsigned long long)(rule->packets[0] + rule->packets[1]), (unsigned long long)(rule->bytes[0] + - rule->bytes[1]), (uintmax_t)rule->u_states_cur); + rule->bytes[1]), (uintmax_t)rule->states_cur); if (!(opts & PF_OPT_DEBUG)) printf(" [ Inserted: uid %u pid %u " "State Creations: %-6ju]\n", (unsigned)rule->cuid, (unsigned)rule->cpid, - (uintmax_t)rule->u_states_tot); + (uintmax_t)rule->states_tot); } } @@ -1012,7 +1012,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, (unsigned long long)rule.bytes[0], (unsigned long long)rule.packets[1], (unsigned long long)rule.bytes[1], - (uintmax_t)rule.u_states_tot); + (uintmax_t)rule.states_tot); } break; case PFCTL_SHOW_RULES: From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4396E6314A8; Fri, 7 May 2021 15:25:53 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmc4kYhz4k2V; Fri, 7 May 2021 15:25:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B107358F2; Fri, 7 May 2021 15:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPnd5026477; Fri, 7 May 2021 15:25:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPnRl026476; Fri, 7 May 2021 15:25:49 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:49 GMT Message-Id: <202105071525.147FPnRl026476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 7b15ca116c1d - stable/13 - pf: Ensure that we don't use kif passed to pfi_kkif_attach() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7b15ca116c1d257f5c734b1c6f3b9c10ad80e7a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:53 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7b15ca116c1d257f5c734b1c6f3b9c10ad80e7a8 commit 7b15ca116c1d257f5c734b1c6f3b9c10ad80e7a8 Author: Kristof Provost AuthorDate: 2021-04-12 09:45:48 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:42 +0000 pf: Ensure that we don't use kif passed to pfi_kkif_attach() Once a kif is passed to pfi_kkif_attach() we must ensure we never re-use it for anything else. Set the kif to NULL afterwards to guarantee this. Reported-by: syzbot+be5d4f4a7a4c295e659a@syzkaller.appspotmail.com MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 5e98cae661f3a7e85df7f277660765b823454073) --- sys/netpfil/pf/pf_if.c | 1 + sys/netpfil/pf/pf_ioctl.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index be290a1e1f2e..4630098221c8 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -486,6 +486,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) dyn->pfid_kif = pfi_kkif_attach(kif, IFG_ALL); else dyn->pfid_kif = pfi_kkif_attach(kif, aw->v.ifname); + kif = NULL; pfi_kkif_ref(dyn->pfid_kif); dyn->pfid_net = pfi_unmask(&aw->v.a.mask); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index cdff32916953..e6ab3ab5e91f 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2411,6 +2411,7 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, rule->nr = 0; if (rule->ifname[0]) { rule->kif = pfi_kkif_attach(kif, rule->ifname); + kif = NULL; pfi_kkif_ref(rule->kif); } else rule->kif = NULL; @@ -3028,6 +3029,7 @@ DIOCGETRULENV_error: if (newrule->ifname[0]) { newrule->kif = pfi_kkif_attach(kif, newrule->ifname); + kif = NULL; pfi_kkif_ref(newrule->kif); } else newrule->kif = NULL; @@ -3761,6 +3763,7 @@ DIOCGETSTATES_full: } if (pa->ifname[0]) { pa->kif = pfi_kkif_attach(kif, pa->ifname); + kif = NULL; pfi_kkif_ref(pa->kif); } else pa->kif = NULL; From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62E04631708; Fri, 7 May 2021 15:25:53 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmd0vR9z4k2W; Fri, 7 May 2021 15:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3A15D5AD1; Fri, 7 May 2021 15:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPo2m026498; Fri, 7 May 2021 15:25:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPoB0026497; Fri, 7 May 2021 15:25:50 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:50 GMT Message-Id: <202105071525.147FPoB0026497@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e3859eb57651 - stable/12 - libnv: Use PICFLAG rather than -fPIC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e3859eb576517e88c287dd86e9d6da32b9620d61 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:53 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e3859eb576517e88c287dd86e9d6da32b9620d61 commit e3859eb576517e88c287dd86e9d6da32b9620d61 Author: Kristof Provost AuthorDate: 2021-04-10 09:23:57 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:02 +0000 libnv: Use PICFLAG rather than -fPIC Suggested by: andrew MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 15ca66220874c177602c13a114b2f3d17773b788) --- lib/libnv/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile index 63e7a274f578..2e227cbc0b04 100644 --- a/lib/libnv/Makefile +++ b/lib/libnv/Makefile @@ -10,7 +10,7 @@ SHLIB_MAJOR= 0 .PATH: ${SRCTOP}/sys/contrib/libnv ${SRCTOP}/sys/sys CFLAGS+=-I${.CURDIR} -CFLAGS+=-fPIC +CFLAGS+=${PICFLAG} SRCS= cnvlist.c SRCS+= dnvlist.c From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A229863160A; Fri, 7 May 2021 15:25:49 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmY18P8z4k6J; Fri, 7 May 2021 15:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EA6A45C40; Fri, 7 May 2021 15:25:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPluK026408; Fri, 7 May 2021 15:25:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPl0Y026407; Fri, 7 May 2021 15:25:47 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:47 GMT Message-Id: <202105071525.147FPl0Y026407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e055cd8e7a2c - stable/12 - libpfctl: Switch to pfctl_rule MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e055cd8e7a2c6ba5a96ec095290ad4893bb38f88 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:50 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e055cd8e7a2c6ba5a96ec095290ad4893bb38f88 commit e055cd8e7a2c6ba5a96ec095290ad4893bb38f88 Author: Kristof Provost AuthorDate: 2021-04-08 08:31:46 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:01 +0000 libpfctl: Switch to pfctl_rule Stop using the kernel's struct pf_rule, switch to libpfctl's pfctl_rule. Now that we use nvlists to communicate with the kernel these structures can be fully decoupled. Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29644 (cherry picked from commit e9eb09414a8de8f3329f51b48c90a5e5ac8f09cf) --- contrib/pf/ftp-proxy/filter.c | 100 +++++++++++---------- contrib/pf/tftp-proxy/filter.c | 90 ++++++++++--------- lib/libpfctl/libpfctl.c | 10 +-- lib/libpfctl/libpfctl.h | 143 +++++++++++++++++++++++++++++- sbin/pfctl/parse.y | 52 +++++------ sbin/pfctl/pf_ruleset.c | 63 ++++++------- sbin/pfctl/pfctl.c | 91 ++++++++++--------- sbin/pfctl/pfctl.h | 14 +-- sbin/pfctl/pfctl_optimize.c | 82 ++++++++--------- sbin/pfctl/pfctl_parser.c | 2 +- sbin/pfctl/pfctl_parser.h | 14 +-- usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c | 17 ++-- 12 files changed, 416 insertions(+), 262 deletions(-) diff --git a/contrib/pf/ftp-proxy/filter.c b/contrib/pf/ftp-proxy/filter.c index db3735565dac..dad6324808bc 100644 --- a/contrib/pf/ftp-proxy/filter.c +++ b/contrib/pf/ftp-proxy/filter.c @@ -50,7 +50,11 @@ int server_lookup6(struct sockaddr_in6 *, struct sockaddr_in6 *, struct sockaddr_in6 *); static struct pfioc_pooladdr pfp; -static struct pfioc_rule pfr; +static struct pfctl_rule pfrule; +static char pfanchor[PF_ANCHOR_NAME_SIZE]; +static char pfanchor_call[PF_ANCHOR_NAME_SIZE]; +static uint32_t pfticket; +static uint32_t pfpool_ticket; static struct pfioc_trans pft; static struct pfioc_trans_e pfte[TRANS_SIZE]; static int dev, rule_log; @@ -68,9 +72,9 @@ add_filter(u_int32_t id, u_int8_t dir, struct sockaddr *src, if (prepare_rule(id, PF_RULESET_FILTER, src, dst, d_port) == -1) return (-1); - pfr.rule.direction = dir; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.direction = dir; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -99,14 +103,14 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(nat)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); - pfr.rule.rpool.proxy_port[0] = nat_range_low; - pfr.rule.rpool.proxy_port[1] = nat_range_high; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.rpool.proxy_port[0] = nat_range_low; + pfrule.rpool.proxy_port[1] = nat_range_high; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -134,13 +138,13 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(rdr)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); - pfr.rule.rpool.proxy_port[0] = rdr_port; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.rpool.proxy_port[0] = rdr_port; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -237,21 +241,21 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, } memset(&pfp, 0, sizeof pfp); - memset(&pfr, 0, sizeof pfr); + memset(&pfrule, 0, sizeof pfrule); snprintf(an, PF_ANCHOR_NAME_SIZE, "%s/%d.%d", FTP_PROXY_ANCHOR, getpid(), id); strlcpy(pfp.anchor, an, PF_ANCHOR_NAME_SIZE); - strlcpy(pfr.anchor, an, PF_ANCHOR_NAME_SIZE); + strlcpy(pfanchor, an, PF_ANCHOR_NAME_SIZE); switch (rs_num) { case PF_RULESET_FILTER: - pfr.ticket = pfte[TRANS_FILTER].ticket; + pfticket = pfte[TRANS_FILTER].ticket; break; case PF_RULESET_NAT: - pfr.ticket = pfte[TRANS_NAT].ticket; + pfticket = pfte[TRANS_NAT].ticket; break; case PF_RULESET_RDR: - pfr.ticket = pfte[TRANS_RDR].ticket; + pfticket = pfte[TRANS_RDR].ticket; break; default: errno = EINVAL; @@ -259,30 +263,30 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, } if (ioctl(dev, DIOCBEGINADDRS, &pfp) == -1) return (-1); - pfr.pool_ticket = pfp.ticket; + pfpool_ticket = pfp.ticket; /* Generic for all rule types. */ - pfr.rule.af = src->sa_family; - pfr.rule.proto = IPPROTO_TCP; - pfr.rule.src.addr.type = PF_ADDR_ADDRMASK; - pfr.rule.dst.addr.type = PF_ADDR_ADDRMASK; + pfrule.af = src->sa_family; + pfrule.proto = IPPROTO_TCP; + pfrule.src.addr.type = PF_ADDR_ADDRMASK; + pfrule.dst.addr.type = PF_ADDR_ADDRMASK; if (src->sa_family == AF_INET) { - memcpy(&pfr.rule.src.addr.v.a.addr.v4, + memcpy(&pfrule.src.addr.v.a.addr.v4, &satosin(src)->sin_addr.s_addr, 4); - memset(&pfr.rule.src.addr.v.a.mask.addr8, 255, 4); - memcpy(&pfr.rule.dst.addr.v.a.addr.v4, + memset(&pfrule.src.addr.v.a.mask.addr8, 255, 4); + memcpy(&pfrule.dst.addr.v.a.addr.v4, &satosin(dst)->sin_addr.s_addr, 4); - memset(&pfr.rule.dst.addr.v.a.mask.addr8, 255, 4); + memset(&pfrule.dst.addr.v.a.mask.addr8, 255, 4); } else { - memcpy(&pfr.rule.src.addr.v.a.addr.v6, + memcpy(&pfrule.src.addr.v.a.addr.v6, &satosin6(src)->sin6_addr.s6_addr, 16); - memset(&pfr.rule.src.addr.v.a.mask.addr8, 255, 16); - memcpy(&pfr.rule.dst.addr.v.a.addr.v6, + memset(&pfrule.src.addr.v.a.mask.addr8, 255, 16); + memcpy(&pfrule.dst.addr.v.a.addr.v6, &satosin6(dst)->sin6_addr.s6_addr, 16); - memset(&pfr.rule.dst.addr.v.a.mask.addr8, 255, 16); + memset(&pfrule.dst.addr.v.a.mask.addr8, 255, 16); } - pfr.rule.dst.port_op = PF_OP_EQ; - pfr.rule.dst.port[0] = htons(d_port); + pfrule.dst.port_op = PF_OP_EQ; + pfrule.dst.port[0] = htons(d_port); switch (rs_num) { case PF_RULESET_FILTER: @@ -291,32 +295,32 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, * from $src to $dst port = $d_port flags S/SA keep state * (max 1) [queue qname] [tag tagname] */ - pfr.rule.action = PF_PASS; - pfr.rule.quick = 1; - pfr.rule.log = rule_log; - pfr.rule.keep_state = 1; - pfr.rule.flags = TH_SYN; - pfr.rule.flagset = (TH_SYN|TH_ACK); - pfr.rule.max_states = 1; + pfrule.action = PF_PASS; + pfrule.quick = 1; + pfrule.log = rule_log; + pfrule.keep_state = 1; + pfrule.flags = TH_SYN; + pfrule.flagset = (TH_SYN|TH_ACK); + pfrule.max_states = 1; if (qname != NULL) - strlcpy(pfr.rule.qname, qname, sizeof pfr.rule.qname); + strlcpy(pfrule.qname, qname, sizeof pfrule.qname); if (tagname != NULL) { - pfr.rule.quick = 0; - strlcpy(pfr.rule.tagname, tagname, - sizeof pfr.rule.tagname); + pfrule.quick = 0; + strlcpy(pfrule.tagname, tagname, + sizeof pfrule.tagname); } break; case PF_RULESET_NAT: /* * nat inet[6] proto tcp from $src to $dst port $d_port -> $nat */ - pfr.rule.action = PF_NAT; + pfrule.action = PF_NAT; break; case PF_RULESET_RDR: /* * rdr inet[6] proto tcp from $src to $dst port $d_port -> $rdr */ - pfr.rule.action = PF_RDR; + pfrule.action = PF_RDR; break; default: errno = EINVAL; diff --git a/contrib/pf/tftp-proxy/filter.c b/contrib/pf/tftp-proxy/filter.c index 0b87d568809f..1689d3465fd3 100644 --- a/contrib/pf/tftp-proxy/filter.c +++ b/contrib/pf/tftp-proxy/filter.c @@ -54,7 +54,11 @@ int server_lookup6(struct sockaddr_in6 *, struct sockaddr_in6 *, struct sockaddr_in6 *, u_int8_t); static struct pfioc_pooladdr pfp; -static struct pfioc_rule pfr; +static struct pfctl_rule pfrule; +static uint32_t pfticket; +static uint32_t pfpool_ticket; +static char pfanchor[PF_ANCHOR_NAME_SIZE]; +static char pfanchor_call[PF_ANCHOR_NAME_SIZE]; static struct pfioc_trans pft; static struct pfioc_trans_e pfte[TRANS_SIZE]; static int dev, rule_log; @@ -72,9 +76,9 @@ add_filter(u_int32_t id, u_int8_t dir, struct sockaddr *src, if (prepare_rule(id, PF_RULESET_FILTER, src, dst, d_port, proto) == -1) return (-1); - pfr.rule.direction = dir; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.direction = dir; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -106,10 +110,10 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, if (ioctl(dev, DIOCADDADDR, &pfp) == -1) return (-1); - pfr.rule.rpool.proxy_port[0] = nat_range_low; - pfr.rule.rpool.proxy_port[1] = nat_range_high; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.rpool.proxy_port[0] = nat_range_low; + pfrule.rpool.proxy_port[1] = nat_range_high; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -140,9 +144,9 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, if (ioctl(dev, DIOCADDADDR, &pfp) == -1) return (-1); - pfr.rule.rpool.proxy_port[0] = rdr_port; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.rpool.proxy_port[0] = rdr_port; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -244,21 +248,21 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, } memset(&pfp, 0, sizeof pfp); - memset(&pfr, 0, sizeof pfr); + memset(&pfrule, 0, sizeof pfrule); snprintf(an, PF_ANCHOR_NAME_SIZE, "%s/%d.%d", FTP_PROXY_ANCHOR, getpid(), id); strlcpy(pfp.anchor, an, PF_ANCHOR_NAME_SIZE); - strlcpy(pfr.anchor, an, PF_ANCHOR_NAME_SIZE); + strlcpy(pfanchor, an, PF_ANCHOR_NAME_SIZE); switch (rs_num) { case PF_RULESET_FILTER: - pfr.ticket = pfte[TRANS_FILTER].ticket; + pfticket = pfte[TRANS_FILTER].ticket; break; case PF_RULESET_NAT: - pfr.ticket = pfte[TRANS_NAT].ticket; + pfticket = pfte[TRANS_NAT].ticket; break; case PF_RULESET_RDR: - pfr.ticket = pfte[TRANS_RDR].ticket; + pfticket = pfte[TRANS_RDR].ticket; break; default: errno = EINVAL; @@ -266,30 +270,30 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, } if (ioctl(dev, DIOCBEGINADDRS, &pfp) == -1) return (-1); - pfr.pool_ticket = pfp.ticket; + pfpool_ticket = pfp.ticket; /* Generic for all rule types. */ - pfr.rule.af = src->sa_family; - pfr.rule.proto = proto; - pfr.rule.src.addr.type = PF_ADDR_ADDRMASK; - pfr.rule.dst.addr.type = PF_ADDR_ADDRMASK; + pfrule.af = src->sa_family; + pfrule.proto = proto; + pfrule.src.addr.type = PF_ADDR_ADDRMASK; + pfrule.dst.addr.type = PF_ADDR_ADDRMASK; if (src->sa_family == AF_INET) { - memcpy(&pfr.rule.src.addr.v.a.addr.v4, + memcpy(&pfrule.src.addr.v.a.addr.v4, &satosin(src)->sin_addr.s_addr, 4); - memset(&pfr.rule.src.addr.v.a.mask.addr8, 255, 4); - memcpy(&pfr.rule.dst.addr.v.a.addr.v4, + memset(&pfrule.src.addr.v.a.mask.addr8, 255, 4); + memcpy(&pfrule.dst.addr.v.a.addr.v4, &satosin(dst)->sin_addr.s_addr, 4); - memset(&pfr.rule.dst.addr.v.a.mask.addr8, 255, 4); + memset(&pfrule.dst.addr.v.a.mask.addr8, 255, 4); } else { - memcpy(&pfr.rule.src.addr.v.a.addr.v6, + memcpy(&pfrule.src.addr.v.a.addr.v6, &satosin6(src)->sin6_addr.s6_addr, 16); - memset(&pfr.rule.src.addr.v.a.mask.addr8, 255, 16); - memcpy(&pfr.rule.dst.addr.v.a.addr.v6, + memset(&pfrule.src.addr.v.a.mask.addr8, 255, 16); + memcpy(&pfrule.dst.addr.v.a.addr.v6, &satosin6(dst)->sin6_addr.s6_addr, 16); - memset(&pfr.rule.dst.addr.v.a.mask.addr8, 255, 16); + memset(&pfrule.dst.addr.v.a.mask.addr8, 255, 16); } - pfr.rule.dst.port_op = PF_OP_EQ; - pfr.rule.dst.port[0] = htons(d_port); + pfrule.dst.port_op = PF_OP_EQ; + pfrule.dst.port[0] = htons(d_port); switch (rs_num) { case PF_RULESET_FILTER: @@ -298,34 +302,34 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, * from $src to $dst port = $d_port flags S/SAFR keep state * (max 1) [queue qname] */ - pfr.rule.action = PF_PASS; - pfr.rule.quick = 1; - pfr.rule.log = rule_log; - pfr.rule.keep_state = 1; + pfrule.action = PF_PASS; + pfrule.quick = 1; + pfrule.log = rule_log; + pfrule.keep_state = 1; #ifdef __FreeBSD__ - pfr.rule.flags = (proto == IPPROTO_TCP ? TH_SYN : 0); - pfr.rule.flagset = (proto == IPPROTO_TCP ? + pfrule.flags = (proto == IPPROTO_TCP ? TH_SYN : 0); + pfrule.flagset = (proto == IPPROTO_TCP ? (TH_SYN|TH_ACK|TH_FIN|TH_RST) : 0); #else - pfr.rule.flags = (proto == IPPROTO_TCP ? TH_SYN : NULL); - pfr.rule.flagset = (proto == IPPROTO_TCP ? + pfrule.flags = (proto == IPPROTO_TCP ? TH_SYN : NULL); + pfrule.flagset = (proto == IPPROTO_TCP ? (TH_SYN|TH_ACK|TH_FIN|TH_RST) : NULL); #endif - pfr.rule.max_states = 1; + pfrule.max_states = 1; if (qname != NULL) - strlcpy(pfr.rule.qname, qname, sizeof pfr.rule.qname); + strlcpy(pfrule.qname, qname, sizeof pfrule.qname); break; case PF_RULESET_NAT: /* * nat inet[6] proto tcp from $src to $dst port $d_port -> $nat */ - pfr.rule.action = PF_NAT; + pfrule.action = PF_NAT; break; case PF_RULESET_RDR: /* * rdr inet[6] proto tcp from $src to $dst port $d_port -> $rdr */ - pfr.rule.action = PF_RDR; + pfrule.action = PF_RDR; break; default: errno = EINVAL; diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index e0d429112f5b..dc174d8d5b72 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -256,7 +256,7 @@ pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) static void pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, - const struct pf_rule *r) + const struct pfctl_rule *r) { nvlist_t *nvl = nvlist_create(0); @@ -267,14 +267,14 @@ pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, } static void -pf_nvdivert_to_divert(const nvlist_t *nvl, struct pf_rule *rule) +pf_nvdivert_to_divert(const nvlist_t *nvl, struct pfctl_rule *rule) { pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), &rule->divert.addr); rule->divert.port = nvlist_get_number(nvl, "port"); } static void -pf_nvrule_to_rule(const nvlist_t *nvl, struct pf_rule *rule) +pf_nvrule_to_rule(const nvlist_t *nvl, struct pfctl_rule *rule) { const uint64_t *skip; size_t skipcount; @@ -373,7 +373,7 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pf_rule *rule) } int -pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, +pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) { struct pfioc_nv nv; @@ -482,7 +482,7 @@ pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, - u_int32_t ruleset, struct pf_rule *rule, char *anchor_call) + u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call) { struct pfioc_nv nv; nvlist_t *nvl; diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 65ff2179f23d..996830619489 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -36,10 +36,147 @@ #include +struct pfctl_anchor; + +struct pfctl_rule { + struct pf_rule_addr src; + struct pf_rule_addr dst; + union pf_rule_ptr skip[PF_SKIP_COUNT]; + char label[PF_RULE_LABEL_SIZE]; + char ifname[IFNAMSIZ]; + char qname[PF_QNAME_SIZE]; + char pqname[PF_QNAME_SIZE]; + char tagname[PF_TAG_NAME_SIZE]; + char match_tagname[PF_TAG_NAME_SIZE]; + + char overload_tblname[PF_TABLE_NAME_SIZE]; + + TAILQ_ENTRY(pfctl_rule) entries; + struct pf_pool rpool; + + u_int64_t evaluations; + u_int64_t packets[2]; + u_int64_t bytes[2]; + + struct pfi_kif *kif; + struct pfctl_anchor *anchor; + struct pfr_ktable *overload_tbl; + + pf_osfp_t os_fingerprint; + + int rtableid; + u_int32_t timeout[PFTM_MAX]; + u_int32_t max_states; + u_int32_t max_src_nodes; + u_int32_t max_src_states; + u_int32_t max_src_conn; + struct { + u_int32_t limit; + u_int32_t seconds; + } max_src_conn_rate; + u_int32_t qid; + u_int32_t pqid; + u_int32_t nr; + u_int32_t prob; + uid_t cuid; + pid_t cpid; + + counter_u64_t states_cur; + counter_u64_t states_tot; + counter_u64_t src_nodes; + + u_int16_t return_icmp; + u_int16_t return_icmp6; + u_int16_t max_mss; + u_int16_t tag; + u_int16_t match_tag; + u_int16_t scrub_flags; + + struct pf_rule_uid uid; + struct pf_rule_gid gid; + + u_int32_t rule_flag; + u_int8_t action; + u_int8_t direction; + u_int8_t log; + u_int8_t logif; + u_int8_t quick; + u_int8_t ifnot; + u_int8_t match_tag_not; + u_int8_t natpass; + + u_int8_t keep_state; + sa_family_t af; + u_int8_t proto; + u_int8_t type; + u_int8_t code; + u_int8_t flags; + u_int8_t flagset; + u_int8_t min_ttl; + u_int8_t allow_opts; + u_int8_t rt; + u_int8_t return_ttl; + u_int8_t tos; + u_int8_t set_tos; + u_int8_t anchor_relative; + u_int8_t anchor_wildcard; + + u_int8_t flush; + u_int8_t prio; + u_int8_t set_prio[2]; + + struct { + struct pf_addr addr; + u_int16_t port; + } divert; + + uint64_t u_states_cur; + uint64_t u_states_tot; + uint64_t u_src_nodes; +}; + +TAILQ_HEAD(pfctl_rulequeue, pfctl_rule); + +struct pfctl_ruleset { + struct { + struct pfctl_rulequeue queues[2]; + struct { + struct pfctl_rulequeue *ptr; + struct pfctl_rule **ptr_array; + u_int32_t rcount; + u_int32_t ticket; + int open; + } active, inactive; + } rules[PF_RULESET_MAX]; + struct pfctl_anchor *anchor; + u_int32_t tticket; + int tables; + int topen; +}; + +RB_HEAD(pfctl_anchor_global, pfctl_anchor); +RB_HEAD(pfctl_anchor_node, pfctl_anchor); +struct pfctl_anchor { + RB_ENTRY(pfctl_anchor) entry_global; + RB_ENTRY(pfctl_anchor) entry_node; + struct pfctl_anchor *parent; + struct pfctl_anchor_node children; + char name[PF_ANCHOR_NAME_SIZE]; + char path[MAXPATHLEN]; + struct pfctl_ruleset ruleset; + int refcnt; /* anchor rules */ + int match; /* XXX: used for pfctl black magic */ +}; +RB_PROTOTYPE(pfctl_anchor_global, pfctl_anchor, entry_global, + pf_anchor_compare); +RB_PROTOTYPE(pfctl_anchor_node, pfctl_anchor, entry_node, + pf_anchor_compare); + int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, - const char *anchor, u_int32_t ruleset, struct pf_rule *rule, + const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); -int pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, - const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket); +int pfctl_add_rule(int dev, const struct pfctl_rule *r, + const char *anchor, const char *anchor_call, u_int32_t ticket, + u_int32_t pool_ticket); #endif diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 56c1f82e39a0..ff4eca03f4cf 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -317,10 +317,10 @@ static struct node_state_opt *keep_state_defaults = NULL; int disallow_table(struct node_host *, const char *); int disallow_urpf_failed(struct node_host *, const char *); int disallow_alias(struct node_host *, const char *); -int rule_consistent(struct pf_rule *, int); -int filter_consistent(struct pf_rule *, int); -int nat_consistent(struct pf_rule *); -int rdr_consistent(struct pf_rule *); +int rule_consistent(struct pfctl_rule *, int); +int filter_consistent(struct pfctl_rule *, int); +int nat_consistent(struct pfctl_rule *); +int rdr_consistent(struct pfctl_rule *); int process_tabledef(char *, struct table_opts *); void expand_label_str(char *, size_t, const char *, const char *); void expand_label_if(const char *, char *, size_t, const char *); @@ -333,7 +333,7 @@ void expand_label_nr(const char *, char *, size_t); void expand_label(char *, size_t, const char *, u_int8_t, struct node_host *, struct node_port *, struct node_host *, struct node_port *, u_int8_t); -void expand_rule(struct pf_rule *, struct node_if *, +void expand_rule(struct pfctl_rule *, struct node_if *, struct node_host *, struct node_proto *, struct node_os *, struct node_host *, struct node_port *, struct node_host *, struct node_port *, struct node_uid *, struct node_gid *, @@ -348,10 +348,10 @@ int expand_skip_interface(struct node_if *); int check_rulestate(int); int getservice(char *); -int rule_label(struct pf_rule *, char *); +int rule_label(struct pfctl_rule *, char *); int rt_tableid_max(void); -void mv_rules(struct pf_ruleset *, struct pf_ruleset *); +void mv_rules(struct pfctl_ruleset *, struct pfctl_ruleset *); void decide_address_family(struct node_host *, sa_family_t *); void remove_invalid_hosts(struct node_host **, sa_family_t *); int invalid_redirect(struct node_host *, sa_family_t); @@ -780,7 +780,7 @@ pfa_anchorlist : /* empty */ pfa_anchor : '{' { char ta[PF_ANCHOR_NAME_SIZE]; - struct pf_ruleset *rs; + struct pfctl_ruleset *rs; /* steping into a brace anchor */ pf->asd++; @@ -806,7 +806,7 @@ pfa_anchor : '{' anchorrule : ANCHOR anchorname dir quick interface af proto fromto filter_opts pfa_anchor { - struct pf_rule r; + struct pfctl_rule r; struct node_proto *proto; if (check_rulestate(PFCTL_STATE_FILTER)) { @@ -825,7 +825,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto memset(&r, 0, sizeof(r)); if (pf->astack[pf->asd + 1]) { /* move inline rules into relative location */ - pf_anchor_setup(&r, + pfctl_anchor_setup(&r, &pf->astack[pf->asd]->ruleset, $2 ? $2 : pf->alast->name); @@ -938,7 +938,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto pf->astack[pf->asd + 1] = NULL; } | NATANCHOR string interface af proto fromto rtable { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_NAT)) { free($2); @@ -959,7 +959,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto free($2); } | RDRANCHOR string interface af proto fromto rtable { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_NAT)) { free($2); @@ -1001,7 +1001,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto free($2); } | BINATANCHOR string interface af proto fromto rtable { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_NAT)) { free($2); @@ -1079,7 +1079,7 @@ scrubaction : no SCRUB { scrubrule : scrubaction dir logquick interface af proto fromto scrub_opts { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_SCRUB)) YYERROR; @@ -1239,7 +1239,7 @@ fragcache : FRAGMENT REASSEMBLE { $$ = 0; /* default */ } ; antispoof : ANTISPOOF logquick antispoof_ifspc af antispoof_opts { - struct pf_rule r; + struct pfctl_rule r; struct node_host *h = NULL, *hh; struct node_if *i, *j; @@ -2014,7 +2014,7 @@ qassign_item : STRING { pfrule : action dir logquick interface route af proto fromto filter_opts { - struct pf_rule r; + struct pfctl_rule r; struct node_state_opt *o; struct node_proto *proto; int srctrack = 0; @@ -4063,7 +4063,7 @@ nataction : no NAT natpasslog { natrule : nataction interface af proto fromto tag tagged rtable redirpool pool_opts { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_NAT)) YYERROR; @@ -4222,7 +4222,7 @@ natrule : nataction interface af proto fromto tag tagged rtable binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag tagged rtable redirection { - struct pf_rule binat; + struct pfctl_rule binat; struct pf_pooladdr *pa; if (check_rulestate(PFCTL_STATE_NAT)) @@ -4607,7 +4607,7 @@ disallow_alias(struct node_host *h, const char *fmt) } int -rule_consistent(struct pf_rule *r, int anchor_call) +rule_consistent(struct pfctl_rule *r, int anchor_call) { int problems = 0; @@ -4635,7 +4635,7 @@ rule_consistent(struct pf_rule *r, int anchor_call) } int -filter_consistent(struct pf_rule *r, int anchor_call) +filter_consistent(struct pfctl_rule *r, int anchor_call) { int problems = 0; @@ -4698,13 +4698,13 @@ filter_consistent(struct pf_rule *r, int anchor_call) } int -nat_consistent(struct pf_rule *r) +nat_consistent(struct pfctl_rule *r) { return (0); /* yeah! */ } int -rdr_consistent(struct pf_rule *r) +rdr_consistent(struct pfctl_rule *r) { int problems = 0; @@ -5240,7 +5240,7 @@ expand_queue(struct pf_altq *a, struct node_if *interfaces, } void -expand_rule(struct pf_rule *r, +expand_rule(struct pfctl_rule *r, struct node_if *interfaces, struct node_host *rpool_hosts, struct node_proto *protos, struct node_os *src_oses, struct node_host *src_hosts, struct node_port *src_ports, @@ -6072,10 +6072,10 @@ symget(const char *nam) } void -mv_rules(struct pf_ruleset *src, struct pf_ruleset *dst) +mv_rules(struct pfctl_ruleset *src, struct pfctl_ruleset *dst) { int i; - struct pf_rule *r; + struct pfctl_rule *r; for (i = 0; i < PF_RULESET_MAX; ++i) { while ((r = TAILQ_FIRST(src->rules[i].active.ptr)) @@ -6206,7 +6206,7 @@ getservice(char *n) } int -rule_label(struct pf_rule *r, char *s) +rule_label(struct pfctl_rule *r, char *s) { if (s) { if (strlcpy(r->label, s, sizeof(r->label)) >= diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c index baac1deb4fa7..f5cddf481871 100644 --- a/sbin/pfctl/pf_ruleset.c +++ b/sbin/pfctl/pf_ruleset.c @@ -73,22 +73,23 @@ __FBSDID("$FreeBSD$"); #define DPFPRINTF(format, x...) ((void)0) #endif /* PFDEBUG */ -struct pf_anchor_global pf_anchors; -struct pf_anchor pf_main_anchor; +struct pfctl_anchor_global pf_anchors; +struct pfctl_anchor pf_main_anchor; #undef V_pf_anchors #define V_pf_anchors pf_anchors #undef pf_main_ruleset #define pf_main_ruleset pf_main_anchor.ruleset -static __inline int pf_anchor_compare(struct pf_anchor *, - struct pf_anchor *); -static struct pf_anchor *pf_find_anchor(const char *); +static __inline int pf_anchor_compare(struct pfctl_anchor *, + struct pfctl_anchor *); +static struct pfctl_anchor *pf_find_anchor(const char *); -RB_GENERATE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); -RB_GENERATE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); +RB_GENERATE(pfctl_anchor_global, pfctl_anchor, entry_global, + pf_anchor_compare); +RB_GENERATE(pfctl_anchor_node, pfctl_anchor, entry_node, pf_anchor_compare); static __inline int -pf_anchor_compare(struct pf_anchor *a, struct pf_anchor *b) +pf_anchor_compare(struct pfctl_anchor *a, struct pfctl_anchor *b) { int c = strcmp(a->path, b->path); @@ -126,11 +127,11 @@ pf_get_ruleset_number(u_int8_t action) } void -pf_init_ruleset(struct pf_ruleset *ruleset) +pf_init_ruleset(struct pfctl_ruleset *ruleset) { int i; - memset(ruleset, 0, sizeof(struct pf_ruleset)); + memset(ruleset, 0, sizeof(struct pfctl_ruleset)); for (i = 0; i < PF_RULESET_MAX; i++) { TAILQ_INIT(&ruleset->rules[i].queues[0]); TAILQ_INIT(&ruleset->rules[i].queues[1]); @@ -139,24 +140,24 @@ pf_init_ruleset(struct pf_ruleset *ruleset) } } -static struct pf_anchor * +static struct pfctl_anchor * pf_find_anchor(const char *path) { - struct pf_anchor *key, *found; + struct pfctl_anchor *key, *found; - key = (struct pf_anchor *)rs_malloc(sizeof(*key)); + key = (struct pfctl_anchor *)rs_malloc(sizeof(*key)); if (key == NULL) return (NULL); strlcpy(key->path, path, sizeof(key->path)); - found = RB_FIND(pf_anchor_global, &V_pf_anchors, key); + found = RB_FIND(pfctl_anchor_global, &V_pf_anchors, key); rs_free(key); return (found); } -struct pf_ruleset * +struct pfctl_ruleset * pf_find_ruleset(const char *path) { - struct pf_anchor *anchor; + struct pfctl_anchor *anchor; while (*path == '/') path++; @@ -169,12 +170,12 @@ pf_find_ruleset(const char *path) return (&anchor->ruleset); } -struct pf_ruleset * +struct pfctl_ruleset * pf_find_or_create_ruleset(const char *path) { char *p, *q, *r; - struct pf_ruleset *ruleset; - struct pf_anchor *anchor = NULL, *dup, *parent = NULL; + struct pfctl_ruleset *ruleset; + struct pfctl_anchor *anchor = NULL, *dup, *parent = NULL; if (path[0] == 0) return (&pf_main_ruleset); @@ -212,7 +213,7 @@ pf_find_or_create_ruleset(const char *path) rs_free(p); return (NULL); } - anchor = (struct pf_anchor *)rs_malloc(sizeof(*anchor)); + anchor = (struct pfctl_anchor *)rs_malloc(sizeof(*anchor)); if (anchor == NULL) { rs_free(p); return (NULL); @@ -225,7 +226,7 @@ pf_find_or_create_ruleset(const char *path) strlcat(anchor->path, "/", sizeof(anchor->path)); } strlcat(anchor->path, anchor->name, sizeof(anchor->path)); - if ((dup = RB_INSERT(pf_anchor_global, &V_pf_anchors, anchor)) != + if ((dup = RB_INSERT(pfctl_anchor_global, &V_pf_anchors, anchor)) != NULL) { printf("pf_find_or_create_ruleset: RB_INSERT1 " "'%s' '%s' collides with '%s' '%s'\n", @@ -236,13 +237,13 @@ pf_find_or_create_ruleset(const char *path) } if (parent != NULL) { anchor->parent = parent; - if ((dup = RB_INSERT(pf_anchor_node, &parent->children, + if ((dup = RB_INSERT(pfctl_anchor_node, &parent->children, anchor)) != NULL) { printf("pf_find_or_create_ruleset: " "RB_INSERT2 '%s' '%s' collides with " "'%s' '%s'\n", anchor->path, anchor->name, dup->path, dup->name); - RB_REMOVE(pf_anchor_global, &V_pf_anchors, + RB_REMOVE(pfctl_anchor_global, &V_pf_anchors, anchor); rs_free(anchor); rs_free(p); @@ -262,9 +263,9 @@ pf_find_or_create_ruleset(const char *path) } void -pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) +pf_remove_if_empty_ruleset(struct pfctl_ruleset *ruleset) { - struct pf_anchor *parent; + struct pfctl_anchor *parent; int i; while (ruleset != NULL) { @@ -278,9 +279,9 @@ pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) !TAILQ_EMPTY(ruleset->rules[i].inactive.ptr) || ruleset->rules[i].inactive.open) return; - RB_REMOVE(pf_anchor_global, &V_pf_anchors, ruleset->anchor); + RB_REMOVE(pfctl_anchor_global, &V_pf_anchors, ruleset->anchor); if ((parent = ruleset->anchor->parent) != NULL) - RB_REMOVE(pf_anchor_node, &parent->children, + RB_REMOVE(pfctl_anchor_node, &parent->children, ruleset->anchor); rs_free(ruleset->anchor); if (parent == NULL) @@ -289,11 +290,11 @@ pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) } } int -pf_anchor_setup(struct pf_rule *r, const struct pf_ruleset *s, +pfctl_anchor_setup(struct pfctl_rule *r, const struct pfctl_ruleset *s, const char *name) { char *p, *path; - struct pf_ruleset *ruleset; + struct pfctl_ruleset *ruleset; r->anchor = NULL; r->anchor_relative = 0; @@ -314,7 +315,7 @@ pf_anchor_setup(struct pf_rule *r, const struct pf_ruleset *s, strlcpy(path, s->anchor->path, MAXPATHLEN); while (name[0] == '.' && name[1] == '.' && name[2] == '/') { if (!path[0]) { - printf("pf_anchor_setup: .. beyond root\n"); + printf("pfctl_anchor_setup: .. beyond root\n"); *** 690 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21EE463153C; Fri, 7 May 2021 15:25:52 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmZ2LQLz4jkV; Fri, 7 May 2021 15:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 93D605C8A; Fri, 7 May 2021 15:25:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPmUI026433; Fri, 7 May 2021 15:25:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPmtE026432; Fri, 7 May 2021 15:25:48 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:48 GMT Message-Id: <202105071525.147FPmtE026432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: b77243fe044f - stable/13 - libnv: Use PICFLAG rather than -fPIC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b77243fe044ff488e9eb6aa1199b447b90a0fe01 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:52 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b77243fe044ff488e9eb6aa1199b447b90a0fe01 commit b77243fe044ff488e9eb6aa1199b447b90a0fe01 Author: Kristof Provost AuthorDate: 2021-04-10 09:23:57 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:42 +0000 libnv: Use PICFLAG rather than -fPIC Suggested by: andrew MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 15ca66220874c177602c13a114b2f3d17773b788) --- lib/libnv/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile index 854cd2c7f3f3..6105f6244fce 100644 --- a/lib/libnv/Makefile +++ b/lib/libnv/Makefile @@ -10,7 +10,7 @@ SHLIB_MAJOR= 0 .PATH: ${SRCTOP}/sys/contrib/libnv ${SRCTOP}/sys/sys CFLAGS+=-I${.CURDIR} -CFLAGS+=-fPIC +CFLAGS+=${PICFLAG} SRCS= cnvlist.c SRCS+= dnvlist.c From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C6B8631789; Fri, 7 May 2021 15:25:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmh3v8pz4jkt; Fri, 7 May 2021 15:25:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 96C815AD2; Fri, 7 May 2021 15:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPrsm026624; Fri, 7 May 2021 15:25:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPrhh026623; Fri, 7 May 2021 15:25:53 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:53 GMT Message-Id: <202105071525.147FPrhh026623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 9f283b1ca6df - stable/12 - pfctl: Fix clearing rules counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9f283b1ca6df02e798f51d4d891b0d34446d2fcc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:57 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9f283b1ca6df02e798f51d4d891b0d34446d2fcc commit 9f283b1ca6df02e798f51d4d891b0d34446d2fcc Author: Kristof Provost AuthorDate: 2021-04-12 15:23:33 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:02 +0000 pfctl: Fix clearing rules counters After the migration to libpfctl for rule retrieval we accidentally lost support for clearing the rules counters. Introduce a get_clear variant of pfctl_get_rule() which allows rules counters to be cleared. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29727 (cherry picked from commit 4eabfe468b6e80a0823523d83dc908c27ec823c7) --- lib/libpfctl/libpfctl.c | 11 +++++++++++ lib/libpfctl/libpfctl.h | 3 +++ sbin/pfctl/pfctl.c | 10 ++++------ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index a487e5a20018..6d5397cb64b2 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -483,6 +483,14 @@ pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call) +{ + return (pfctl_get_clear_rule(dev, nr, ticket, anchor, ruleset, rule, + anchor_call, false)); +} + +int pfctl_get_clear_rule(int dev, u_int32_t nr, u_int32_t ticket, + const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, + char *anchor_call, bool clear) { struct pfioc_nv nv; nvlist_t *nvl; @@ -498,6 +506,9 @@ pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, nvlist_add_string(nvl, "anchor", anchor); nvlist_add_number(nvl, "ruleset", ruleset); + if (clear) + nvlist_add_bool(nvl, "clear_counter", true); + nvlpacked = nvlist_pack(nvl, &nv.len); if (nvlpacked == NULL) { nvlist_destroy(nvl); diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index bc27c18cfbb6..38108de769f4 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -181,6 +181,9 @@ RB_PROTOTYPE(pfctl_anchor_node, pfctl_anchor, entry_node, int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); +int pfctl_get_clear_rule(int dev, u_int32_t nr, u_int32_t ticket, + const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, + char *anchor_call, bool clear); int pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket); diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 879fc876826c..9f6b3d2e36ea 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -949,13 +949,11 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, pfctl_print_title("LABEL COUNTERS:"); } mnr = pr.nr; - if (opts & PF_OPT_CLRRULECTRS) - pr.action = PF_GET_CLR_CNTR; for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (pfctl_get_rule(dev, nr, pr.ticket, path, PF_SCRUB, - &rule, pr.anchor_call)) { + if (pfctl_get_clear_rule(dev, nr, pr.ticket, path, PF_SCRUB, + &rule, pr.anchor_call, opts & PF_OPT_CLRRULECTRS)) { warn("DIOCGETRULENV"); goto error; } @@ -987,8 +985,8 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, mnr = pr.nr; for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (pfctl_get_rule(dev, nr, pr.ticket, path, PF_PASS, - &rule, pr.anchor_call)) { + if (pfctl_get_clear_rule(dev, nr, pr.ticket, path, PF_PASS, + &rule, pr.anchor_call, opts & PF_OPT_CLRRULECTRS)) { warn("DIOCGETRULE"); goto error; } From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D086263171F; Fri, 7 May 2021 15:25:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmj41qGz4k6v; Fri, 7 May 2021 15:25:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 394475DBE; Fri, 7 May 2021 15:25:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPsRt026647; Fri, 7 May 2021 15:25:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPsRo026646; Fri, 7 May 2021 15:25:54 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:54 GMT Message-Id: <202105071525.147FPsRo026646@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 9c238775a80d - stable/13 - libpfct: Fix PIC flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9c238775a80d8fbaa61e72c8f08122be47481501 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:58 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9c238775a80d8fbaa61e72c8f08122be47481501 commit 9c238775a80d8fbaa61e72c8f08122be47481501 Author: Kristof Provost AuthorDate: 2021-04-16 19:00:51 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:43 +0000 libpfct: Fix PIC flag Use ${PICFLAG} rather than hard-adding -fPIC, which removes the requirement for libnv to be built PIC. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 8403170b3d39326f836bc999534fe8c4d41cda11) --- lib/libnv/Makefile | 1 - lib/libpfctl/Makefile | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile index 6105f6244fce..b13758931c4e 100644 --- a/lib/libnv/Makefile +++ b/lib/libnv/Makefile @@ -10,7 +10,6 @@ SHLIB_MAJOR= 0 .PATH: ${SRCTOP}/sys/contrib/libnv ${SRCTOP}/sys/sys CFLAGS+=-I${.CURDIR} -CFLAGS+=${PICFLAG} SRCS= cnvlist.c SRCS+= dnvlist.c diff --git a/lib/libpfctl/Makefile b/lib/libpfctl/Makefile index d7a00a94b349..69500ae496f4 100644 --- a/lib/libpfctl/Makefile +++ b/lib/libpfctl/Makefile @@ -7,6 +7,6 @@ INTERNALLIB= true SRCS= libpfctl.c INCS= libpfctl.h -CFLAGS+= -fPIC +CFLAGS+=${PICFLAG} .include From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62A596315A0; Fri, 7 May 2021 15:25:53 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmd0lWMz4jqZ; Fri, 7 May 2021 15:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B7DB958F3; Fri, 7 May 2021 15:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPonm026519; Fri, 7 May 2021 15:25:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPoDZ026518; Fri, 7 May 2021 15:25:50 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:50 GMT Message-Id: <202105071525.147FPoDZ026518@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 55059f90750d - stable/13 - pfctl, libpfctl: introduce pfctl_pool MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 55059f90750dcba322e10b6221fd4823d849085b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:54 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=55059f90750dcba322e10b6221fd4823d849085b commit 55059f90750dcba322e10b6221fd4823d849085b Author: Kurosawa Takahiro AuthorDate: 2021-04-12 14:03:40 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:42 +0000 pfctl, libpfctl: introduce pfctl_pool Introduce pfctl_pool to be able to extend the pool part of the pf rule without breaking the ABI. Reviewed by: kp MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D29721 (cherry picked from commit 600bd6ce0639c84b763516477250df5964e8edf6) --- lib/libpfctl/libpfctl.c | 4 ++-- lib/libpfctl/libpfctl.h | 12 +++++++++++- sbin/pfctl/pfctl.c | 10 +++++----- sbin/pfctl/pfctl_parser.c | 2 +- sbin/pfctl/pfctl_parser.h | 8 ++++---- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 2a7b64f1cbc8..a487e5a20018 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -198,7 +198,7 @@ pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) static void pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, - const struct pf_pool *pool) + const struct pfctl_pool *pool) { u_int64_t ports[2]; nvlist_t *nvl = nvlist_create(0); @@ -216,7 +216,7 @@ pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, } static void -pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_pool *pool) +pf_nvpool_to_pool(const nvlist_t *nvl, struct pfctl_pool *pool) { size_t len; const void *data; diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 95f6d4e3c77f..bc27c18cfbb6 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -38,6 +38,16 @@ struct pfctl_anchor; +struct pfctl_pool { + struct pf_palist list; + struct pf_pooladdr *cur; + struct pf_poolhashkey key; + struct pf_addr counter; + int tblidx; + u_int16_t proxy_port[2]; + u_int8_t opts; +}; + struct pfctl_rule { struct pf_rule_addr src; struct pf_rule_addr dst; @@ -52,7 +62,7 @@ struct pfctl_rule { char overload_tblname[PF_TABLE_NAME_SIZE]; TAILQ_ENTRY(pfctl_rule) entries; - struct pf_pool rpool; + struct pfctl_pool rpool; u_int64_t evaluations; u_int64_t packets[2]; diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index bc646ab335e1..879fc876826c 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -92,7 +92,7 @@ int pfctl_load_timeout(struct pfctl *, unsigned int, unsigned int); int pfctl_load_debug(struct pfctl *, unsigned int); int pfctl_load_logif(struct pfctl *, char *); int pfctl_load_hostid(struct pfctl *, u_int32_t); -int pfctl_get_pool(int, struct pf_pool *, u_int32_t, u_int32_t, int, +int pfctl_get_pool(int, struct pfctl_pool *, u_int32_t, u_int32_t, int, char *); void pfctl_print_rule_counters(struct pfctl_rule *, int); int pfctl_show_rules(int, char *, int, enum pfctl_show, char *, int); @@ -805,7 +805,7 @@ pfctl_id_kill_states(int dev, const char *iface, int opts) } int -pfctl_get_pool(int dev, struct pf_pool *pool, u_int32_t nr, +pfctl_get_pool(int dev, struct pfctl_pool *pool, u_int32_t nr, u_int32_t ticket, int r_action, char *anchorname) { struct pfioc_pooladdr pp; @@ -840,7 +840,7 @@ pfctl_get_pool(int dev, struct pf_pool *pool, u_int32_t nr, } void -pfctl_move_pool(struct pf_pool *src, struct pf_pool *dst) +pfctl_move_pool(struct pfctl_pool *src, struct pfctl_pool *dst) { struct pf_pooladdr *pa; @@ -851,7 +851,7 @@ pfctl_move_pool(struct pf_pool *src, struct pf_pool *dst) } void -pfctl_clear_pool(struct pf_pool *pool) +pfctl_clear_pool(struct pfctl_pool *pool) { struct pf_pooladdr *pa; @@ -1272,7 +1272,7 @@ pfctl_show_limits(int dev, int opts) /* callbacks for rule/nat/rdr/addr */ int -pfctl_add_pool(struct pfctl *pf, struct pf_pool *p, sa_family_t af) +pfctl_add_pool(struct pfctl *pf, struct pfctl_pool *p, sa_family_t af) { struct pf_pooladdr *pa; diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index e75ef514d14a..bc06ac46787c 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -412,7 +412,7 @@ print_fromto(struct pf_rule_addr *src, pf_osfp_t osfp, struct pf_rule_addr *dst, } void -print_pool(struct pf_pool *pool, u_int16_t p1, u_int16_t p2, +print_pool(struct pfctl_pool *pool, u_int16_t p1, u_int16_t p2, sa_family_t af, int id) { struct pf_pooladdr *pooladdr; diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index f36e8f1d4ac8..43d8488dcab8 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -256,9 +256,9 @@ int pfctl_optimize_ruleset(struct pfctl *, struct pfctl_ruleset *); int pfctl_append_rule(struct pfctl *, struct pfctl_rule *, const char *); int pfctl_add_altq(struct pfctl *, struct pf_altq *); -int pfctl_add_pool(struct pfctl *, struct pf_pool *, sa_family_t); -void pfctl_move_pool(struct pf_pool *, struct pf_pool *); -void pfctl_clear_pool(struct pf_pool *); +int pfctl_add_pool(struct pfctl *, struct pfctl_pool *, sa_family_t); +void pfctl_move_pool(struct pfctl_pool *, struct pfctl_pool *); +void pfctl_clear_pool(struct pfctl_pool *); int pfctl_set_timeout(struct pfctl *, const char *, int, int); int pfctl_set_optimization(struct pfctl *, const char *); @@ -272,7 +272,7 @@ int parse_config(char *, struct pfctl *); int parse_flags(char *); int pfctl_load_anchors(int, struct pfctl *, struct pfr_buffer *); -void print_pool(struct pf_pool *, u_int16_t, u_int16_t, sa_family_t, int); +void print_pool(struct pfctl_pool *, u_int16_t, u_int16_t, sa_family_t, int); void print_src_node(struct pf_src_node *, int); void print_rule(struct pfctl_rule *, const char *, int, int); void print_tabledef(const char *, int, int, struct node_tinithead *); From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FAD463169C; Fri, 7 May 2021 15:25:53 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmd18gDz4jfQ; Fri, 7 May 2021 15:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4F25758F4; Fri, 7 May 2021 15:25:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPpUw026540; Fri, 7 May 2021 15:25:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPpvB026539; Fri, 7 May 2021 15:25:51 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:51 GMT Message-Id: <202105071525.147FPpvB026539@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 2c3c6531bc85 - stable/12 - pf: Ensure that we don't use kif passed to pfi_kkif_attach() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2c3c6531bc85c55fd48bde5fc8233b70e86ac814 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:53 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2c3c6531bc85c55fd48bde5fc8233b70e86ac814 commit 2c3c6531bc85c55fd48bde5fc8233b70e86ac814 Author: Kristof Provost AuthorDate: 2021-04-12 09:45:48 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:02 +0000 pf: Ensure that we don't use kif passed to pfi_kkif_attach() Once a kif is passed to pfi_kkif_attach() we must ensure we never re-use it for anything else. Set the kif to NULL afterwards to guarantee this. Reported-by: syzbot+be5d4f4a7a4c295e659a@syzkaller.appspotmail.com MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 5e98cae661f3a7e85df7f277660765b823454073) --- sys/netpfil/pf/pf_if.c | 1 + sys/netpfil/pf/pf_ioctl.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 7e4d8033da0d..656cdfab6018 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -474,6 +474,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) dyn->pfid_kif = pfi_kkif_attach(kif, IFG_ALL); else dyn->pfid_kif = pfi_kkif_attach(kif, aw->v.ifname); + kif = NULL; pfi_kkif_ref(dyn->pfid_kif); dyn->pfid_net = pfi_unmask(&aw->v.a.mask); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 7310fa18410b..edc87cf7983a 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2412,6 +2412,7 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, rule->nr = 0; if (rule->ifname[0]) { rule->kif = pfi_kkif_attach(kif, rule->ifname); + kif = NULL; pfi_kkif_ref(rule->kif); } else rule->kif = NULL; @@ -3040,6 +3041,7 @@ DIOCGETRULENV_error: if (newrule->ifname[0]) { newrule->kif = pfi_kkif_attach(kif, newrule->ifname); + kif = NULL; pfi_kkif_ref(newrule->kif); } else newrule->kif = NULL; @@ -3774,6 +3776,7 @@ DIOCGETSTATES_full: } if (pa->ifname[0]) { pa->kif = pfi_kkif_attach(kif, pa->ifname); + kif = NULL; pfi_kkif_ref(pa->kif); } else pa->kif = NULL; From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2464D631788; Fri, 7 May 2021 15:25:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmg53yRz4k8k; Fri, 7 May 2021 15:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E8B7B5B3D; Fri, 7 May 2021 15:25:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPpWY026561; Fri, 7 May 2021 15:25:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPprB026560; Fri, 7 May 2021 15:25:51 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:51 GMT Message-Id: <202105071525.147FPprB026560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 65dd1a98de78 - stable/13 - pfctl: Fix clearing rules counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 65dd1a98de786afdf44e55534d9f09b6a97e9383 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:57 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=65dd1a98de786afdf44e55534d9f09b6a97e9383 commit 65dd1a98de786afdf44e55534d9f09b6a97e9383 Author: Kristof Provost AuthorDate: 2021-04-12 15:23:33 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:43 +0000 pfctl: Fix clearing rules counters After the migration to libpfctl for rule retrieval we accidentally lost support for clearing the rules counters. Introduce a get_clear variant of pfctl_get_rule() which allows rules counters to be cleared. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29727 (cherry picked from commit 4eabfe468b6e80a0823523d83dc908c27ec823c7) --- lib/libpfctl/libpfctl.c | 11 +++++++++++ lib/libpfctl/libpfctl.h | 3 +++ sbin/pfctl/pfctl.c | 10 ++++------ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index a487e5a20018..6d5397cb64b2 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -483,6 +483,14 @@ pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call) +{ + return (pfctl_get_clear_rule(dev, nr, ticket, anchor, ruleset, rule, + anchor_call, false)); +} + +int pfctl_get_clear_rule(int dev, u_int32_t nr, u_int32_t ticket, + const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, + char *anchor_call, bool clear) { struct pfioc_nv nv; nvlist_t *nvl; @@ -498,6 +506,9 @@ pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, nvlist_add_string(nvl, "anchor", anchor); nvlist_add_number(nvl, "ruleset", ruleset); + if (clear) + nvlist_add_bool(nvl, "clear_counter", true); + nvlpacked = nvlist_pack(nvl, &nv.len); if (nvlpacked == NULL) { nvlist_destroy(nvl); diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index bc27c18cfbb6..38108de769f4 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -181,6 +181,9 @@ RB_PROTOTYPE(pfctl_anchor_node, pfctl_anchor, entry_node, int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); +int pfctl_get_clear_rule(int dev, u_int32_t nr, u_int32_t ticket, + const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, + char *anchor_call, bool clear); int pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket); diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 879fc876826c..9f6b3d2e36ea 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -949,13 +949,11 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, pfctl_print_title("LABEL COUNTERS:"); } mnr = pr.nr; - if (opts & PF_OPT_CLRRULECTRS) - pr.action = PF_GET_CLR_CNTR; for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (pfctl_get_rule(dev, nr, pr.ticket, path, PF_SCRUB, - &rule, pr.anchor_call)) { + if (pfctl_get_clear_rule(dev, nr, pr.ticket, path, PF_SCRUB, + &rule, pr.anchor_call, opts & PF_OPT_CLRRULECTRS)) { warn("DIOCGETRULENV"); goto error; } @@ -987,8 +985,8 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, mnr = pr.nr; for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (pfctl_get_rule(dev, nr, pr.ticket, path, PF_PASS, - &rule, pr.anchor_call)) { + if (pfctl_get_clear_rule(dev, nr, pr.ticket, path, PF_PASS, + &rule, pr.anchor_call, opts & PF_OPT_CLRRULECTRS)) { warn("DIOCGETRULE"); goto error; } From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36B0063171B; Fri, 7 May 2021 15:25:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmf2Vfbz4jfZ; Fri, 7 May 2021 15:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 177025DBD; Fri, 7 May 2021 15:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPqum026603; Fri, 7 May 2021 15:25:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPql2026602; Fri, 7 May 2021 15:25:52 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:52 GMT Message-Id: <202105071525.147FPql2026602@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 07baf5f27e52 - stable/13 - pf tests: Test clearing rules counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 07baf5f27e527e4e74b106cb966a61cf63a895ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:57 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=07baf5f27e527e4e74b106cb966a61cf63a895ef commit 07baf5f27e527e4e74b106cb966a61cf63a895ef Author: Kristof Provost AuthorDate: 2021-04-12 15:29:19 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:43 +0000 pf tests: Test clearing rules counters This was briefly broken, so ensure that we can read and clear rules counters. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29728 (cherry picked from commit 112f007e12818ba3d54869b331139090e69dbc74) --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/rules_counter.sh | 79 +++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index ea9d71610c77..e422da3b9e3d 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -18,6 +18,7 @@ ATF_TESTS_SH+= anchor \ pfsync \ rdr \ route_to \ + rules_counter \ set_skip \ set_tos \ src_track \ diff --git a/tests/sys/netpfil/pf/rules_counter.sh b/tests/sys/netpfil/pf/rules_counter.sh new file mode 100644 index 000000000000..56dc159f49c8 --- /dev/null +++ b/tests/sys/netpfil/pf/rules_counter.sh @@ -0,0 +1,79 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "get_clear" "cleanup" +get_clear_head() +{ + atf_set descr 'Test clearing rules counters on get rules' + atf_set require.user root +} + +get_clear_body() +{ + pft_init + + epair_send=$(vnet_mkepair) + ifconfig ${epair_send}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair_send}b + jexec alcatraz ifconfig ${epair_send}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz \ + "pass all" + + # Ensure the rule matched packets, so we can verify non-zero counters + atf_check -s exit:0 -o ignore ping -c 3 192.0.2.2 + + # Expect non-zero counters + atf_check -s exit:0 -e ignore \ + -o match:'Evaluations: [1-9][0-9]*[[:space:]]*Packets: [1-9][0-9]*[[:space:]]*Bytes: [1-9][0-9]*[[:space:]]*' \ + jexec alcatraz pfctl -s r -v + + # We should still see non-zero because we didn't clear on the last + # pfctl, but are going to clear now + atf_check -s exit:0 -e ignore \ + -o match:'Evaluations: [1-9][0-9]*[[:space:]]*Packets: [1-9][0-9]*[[:space:]]*Bytes: [1-9][0-9]*[[:space:]]*' \ + jexec alcatraz pfctl -s r -v -z + + # Expect zero counters + atf_check -s exit:0 -e ignore \ + -o match:'Evaluations: 0[[:space:]]*Packets: 0*[[:space:]]*Bytes: 0*[[:space:]]*' \ + jexec alcatraz pfctl -s r -v +} + +get_clear_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "get_clear" +} From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D7A3631616; Fri, 7 May 2021 15:25:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmg4cwqz4k04; Fri, 7 May 2021 15:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7992F55E6; Fri, 7 May 2021 15:25:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPqmN026582; Fri, 7 May 2021 15:25:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPqUD026581; Fri, 7 May 2021 15:25:52 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:52 GMT Message-Id: <202105071525.147FPqUD026581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 4649dfb184cb - stable/12 - pfctl, libpfctl: introduce pfctl_pool MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4649dfb184cb7855624fb2ffbb3f81008d5911ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:57 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4649dfb184cb7855624fb2ffbb3f81008d5911ef commit 4649dfb184cb7855624fb2ffbb3f81008d5911ef Author: Kurosawa Takahiro AuthorDate: 2021-04-12 14:03:40 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:02 +0000 pfctl, libpfctl: introduce pfctl_pool Introduce pfctl_pool to be able to extend the pool part of the pf rule without breaking the ABI. Reviewed by: kp MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D29721 (cherry picked from commit 600bd6ce0639c84b763516477250df5964e8edf6) --- lib/libpfctl/libpfctl.c | 4 ++-- lib/libpfctl/libpfctl.h | 12 +++++++++++- sbin/pfctl/pfctl.c | 10 +++++----- sbin/pfctl/pfctl_parser.c | 2 +- sbin/pfctl/pfctl_parser.h | 8 ++++---- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 2a7b64f1cbc8..a487e5a20018 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -198,7 +198,7 @@ pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) static void pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, - const struct pf_pool *pool) + const struct pfctl_pool *pool) { u_int64_t ports[2]; nvlist_t *nvl = nvlist_create(0); @@ -216,7 +216,7 @@ pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, } static void -pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_pool *pool) +pf_nvpool_to_pool(const nvlist_t *nvl, struct pfctl_pool *pool) { size_t len; const void *data; diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 95f6d4e3c77f..bc27c18cfbb6 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -38,6 +38,16 @@ struct pfctl_anchor; +struct pfctl_pool { + struct pf_palist list; + struct pf_pooladdr *cur; + struct pf_poolhashkey key; + struct pf_addr counter; + int tblidx; + u_int16_t proxy_port[2]; + u_int8_t opts; +}; + struct pfctl_rule { struct pf_rule_addr src; struct pf_rule_addr dst; @@ -52,7 +62,7 @@ struct pfctl_rule { char overload_tblname[PF_TABLE_NAME_SIZE]; TAILQ_ENTRY(pfctl_rule) entries; - struct pf_pool rpool; + struct pfctl_pool rpool; u_int64_t evaluations; u_int64_t packets[2]; diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index bc646ab335e1..879fc876826c 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -92,7 +92,7 @@ int pfctl_load_timeout(struct pfctl *, unsigned int, unsigned int); int pfctl_load_debug(struct pfctl *, unsigned int); int pfctl_load_logif(struct pfctl *, char *); int pfctl_load_hostid(struct pfctl *, u_int32_t); -int pfctl_get_pool(int, struct pf_pool *, u_int32_t, u_int32_t, int, +int pfctl_get_pool(int, struct pfctl_pool *, u_int32_t, u_int32_t, int, char *); void pfctl_print_rule_counters(struct pfctl_rule *, int); int pfctl_show_rules(int, char *, int, enum pfctl_show, char *, int); @@ -805,7 +805,7 @@ pfctl_id_kill_states(int dev, const char *iface, int opts) } int -pfctl_get_pool(int dev, struct pf_pool *pool, u_int32_t nr, +pfctl_get_pool(int dev, struct pfctl_pool *pool, u_int32_t nr, u_int32_t ticket, int r_action, char *anchorname) { struct pfioc_pooladdr pp; @@ -840,7 +840,7 @@ pfctl_get_pool(int dev, struct pf_pool *pool, u_int32_t nr, } void -pfctl_move_pool(struct pf_pool *src, struct pf_pool *dst) +pfctl_move_pool(struct pfctl_pool *src, struct pfctl_pool *dst) { struct pf_pooladdr *pa; @@ -851,7 +851,7 @@ pfctl_move_pool(struct pf_pool *src, struct pf_pool *dst) } void -pfctl_clear_pool(struct pf_pool *pool) +pfctl_clear_pool(struct pfctl_pool *pool) { struct pf_pooladdr *pa; @@ -1272,7 +1272,7 @@ pfctl_show_limits(int dev, int opts) /* callbacks for rule/nat/rdr/addr */ int -pfctl_add_pool(struct pfctl *pf, struct pf_pool *p, sa_family_t af) +pfctl_add_pool(struct pfctl *pf, struct pfctl_pool *p, sa_family_t af) { struct pf_pooladdr *pa; diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index b7ac9527db69..b2300df880ca 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -412,7 +412,7 @@ print_fromto(struct pf_rule_addr *src, pf_osfp_t osfp, struct pf_rule_addr *dst, } void -print_pool(struct pf_pool *pool, u_int16_t p1, u_int16_t p2, +print_pool(struct pfctl_pool *pool, u_int16_t p1, u_int16_t p2, sa_family_t af, int id) { struct pf_pooladdr *pooladdr; diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index f36e8f1d4ac8..43d8488dcab8 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -256,9 +256,9 @@ int pfctl_optimize_ruleset(struct pfctl *, struct pfctl_ruleset *); int pfctl_append_rule(struct pfctl *, struct pfctl_rule *, const char *); int pfctl_add_altq(struct pfctl *, struct pf_altq *); -int pfctl_add_pool(struct pfctl *, struct pf_pool *, sa_family_t); -void pfctl_move_pool(struct pf_pool *, struct pf_pool *); -void pfctl_clear_pool(struct pf_pool *); +int pfctl_add_pool(struct pfctl *, struct pfctl_pool *, sa_family_t); +void pfctl_move_pool(struct pfctl_pool *, struct pfctl_pool *); +void pfctl_clear_pool(struct pfctl_pool *); int pfctl_set_timeout(struct pfctl *, const char *, int, int); int pfctl_set_optimization(struct pfctl *, const char *); @@ -272,7 +272,7 @@ int parse_config(char *, struct pfctl *); int parse_flags(char *); int pfctl_load_anchors(int, struct pfctl *, struct pfr_buffer *); -void print_pool(struct pf_pool *, u_int16_t, u_int16_t, sa_family_t, int); +void print_pool(struct pfctl_pool *, u_int16_t, u_int16_t, sa_family_t, int); void print_src_node(struct pf_src_node *, int); void print_rule(struct pfctl_rule *, const char *, int, int); void print_tabledef(const char *, int, int, struct node_tinithead *); From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55AF36313E5; Fri, 7 May 2021 15:25:58 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmj65R7z4jqk; Fri, 7 May 2021 15:25:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D4D855C42; Fri, 7 May 2021 15:25:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPt1p026714; Fri, 7 May 2021 15:25:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPtHA026713; Fri, 7 May 2021 15:25:55 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:55 GMT Message-Id: <202105071525.147FPtHA026713@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: db3ccc52a6a3 - stable/12 - libpfct: Fix PIC flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: db3ccc52a6a3204291d5e69b037004fb29149015 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:58 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=db3ccc52a6a3204291d5e69b037004fb29149015 commit db3ccc52a6a3204291d5e69b037004fb29149015 Author: Kristof Provost AuthorDate: 2021-04-16 19:00:51 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:03 +0000 libpfct: Fix PIC flag Use ${PICFLAG} rather than hard-adding -fPIC, which removes the requirement for libnv to be built PIC. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 8403170b3d39326f836bc999534fe8c4d41cda11) --- lib/libnv/Makefile | 1 - lib/libpfctl/Makefile | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile index 2e227cbc0b04..bf92041d4c87 100644 --- a/lib/libnv/Makefile +++ b/lib/libnv/Makefile @@ -10,7 +10,6 @@ SHLIB_MAJOR= 0 .PATH: ${SRCTOP}/sys/contrib/libnv ${SRCTOP}/sys/sys CFLAGS+=-I${.CURDIR} -CFLAGS+=${PICFLAG} SRCS= cnvlist.c SRCS+= dnvlist.c diff --git a/lib/libpfctl/Makefile b/lib/libpfctl/Makefile index d7a00a94b349..69500ae496f4 100644 --- a/lib/libpfctl/Makefile +++ b/lib/libpfctl/Makefile @@ -7,6 +7,6 @@ INTERNALLIB= true SRCS= libpfctl.c INCS= libpfctl.h -CFLAGS+= -fPIC +CFLAGS+=${PICFLAG} .include From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C15C6314BF; Fri, 7 May 2021 15:25:58 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmj5qgFz4k2q; Fri, 7 May 2021 15:25:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BD3C558F5; Fri, 7 May 2021 15:25:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPsEK026672; Fri, 7 May 2021 15:25:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPsb8026671; Fri, 7 May 2021 15:25:54 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:54 GMT Message-Id: <202105071525.147FPsb8026671@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 8a6337a79d73 - stable/12 - pf tests: Test clearing rules counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8a6337a79d73237b090b0a85df204da4b12bb039 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:58 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8a6337a79d73237b090b0a85df204da4b12bb039 commit 8a6337a79d73237b090b0a85df204da4b12bb039 Author: Kristof Provost AuthorDate: 2021-04-12 15:29:19 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:02 +0000 pf tests: Test clearing rules counters This was briefly broken, so ensure that we can read and clear rules counters. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29728 (cherry picked from commit 112f007e12818ba3d54869b331139090e69dbc74) --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/rules_counter.sh | 79 +++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 951a1392ae1f..b4f2a5a988f9 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -14,6 +14,7 @@ ATF_TESTS_SH+= anchor \ killstate \ names \ nat \ + rules_counter \ set_tos \ src_track \ rdr \ diff --git a/tests/sys/netpfil/pf/rules_counter.sh b/tests/sys/netpfil/pf/rules_counter.sh new file mode 100644 index 000000000000..56dc159f49c8 --- /dev/null +++ b/tests/sys/netpfil/pf/rules_counter.sh @@ -0,0 +1,79 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "get_clear" "cleanup" +get_clear_head() +{ + atf_set descr 'Test clearing rules counters on get rules' + atf_set require.user root +} + +get_clear_body() +{ + pft_init + + epair_send=$(vnet_mkepair) + ifconfig ${epair_send}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair_send}b + jexec alcatraz ifconfig ${epair_send}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz \ + "pass all" + + # Ensure the rule matched packets, so we can verify non-zero counters + atf_check -s exit:0 -o ignore ping -c 3 192.0.2.2 + + # Expect non-zero counters + atf_check -s exit:0 -e ignore \ + -o match:'Evaluations: [1-9][0-9]*[[:space:]]*Packets: [1-9][0-9]*[[:space:]]*Bytes: [1-9][0-9]*[[:space:]]*' \ + jexec alcatraz pfctl -s r -v + + # We should still see non-zero because we didn't clear on the last + # pfctl, but are going to clear now + atf_check -s exit:0 -e ignore \ + -o match:'Evaluations: [1-9][0-9]*[[:space:]]*Packets: [1-9][0-9]*[[:space:]]*Bytes: [1-9][0-9]*[[:space:]]*' \ + jexec alcatraz pfctl -s r -v -z + + # Expect zero counters + atf_check -s exit:0 -e ignore \ + -o match:'Evaluations: 0[[:space:]]*Packets: 0*[[:space:]]*Bytes: 0*[[:space:]]*' \ + jexec alcatraz pfctl -s r -v +} + +get_clear_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "get_clear" +} From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A6686313F7; Fri, 7 May 2021 15:25:59 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmk11W3z4jkx; Fri, 7 May 2021 15:25:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 512275772; Fri, 7 May 2021 15:25:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPuJ5026735; Fri, 7 May 2021 15:25:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPuRC026734; Fri, 7 May 2021 15:25:56 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:56 GMT Message-Id: <202105071525.147FPuRC026734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 70e8fe5eee7c - stable/13 - pf: Fix IP checksum on reassembly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 70e8fe5eee7c35a2c7ce988d402d84a7a9901818 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:59 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=70e8fe5eee7c35a2c7ce988d402d84a7a9901818 commit 70e8fe5eee7c35a2c7ce988d402d84a7a9901818 Author: Kristof Provost AuthorDate: 2021-04-28 10:56:06 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:02 +0000 pf: Fix IP checksum on reassembly If we reassemble a packet we modify the IP header (to set the length and remove the fragment offset information), but we failed to update the checksum. On certain setups (mostly where we did not re-fragment again afterwards) this could lead to us sending out packets with incorrect checksums. PR: 255432 MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30026 (cherry picked from commit 055c55abefbe19fe46a56894595af9c9dad7678c) --- sys/netpfil/pf/pf_norm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index d7310c7bccb4..6de1efa8ff84 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -794,7 +794,11 @@ pf_reassemble(struct mbuf **m0, struct ip *ip, int dir, u_short *reason) } ip = mtod(m, struct ip *); + ip->ip_sum = pf_cksum_fixup(ip->ip_sum, ip->ip_len, + htons(hdrlen + total), 0); ip->ip_len = htons(hdrlen + total); + ip->ip_sum = pf_cksum_fixup(ip->ip_sum, ip->ip_off, + ip->ip_off & ~(IP_MF|IP_OFFMASK), 0); ip->ip_off &= ~(IP_MF|IP_OFFMASK); if (hdrlen + total > IP_MAXPACKET) { From owner-dev-commits-src-all@freebsd.org Fri May 7 15:26:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5305C6317A9; Fri, 7 May 2021 15:26:04 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmq6Lmnz4jl6; Fri, 7 May 2021 15:26:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3D2DD5AD4; Fri, 7 May 2021 15:25:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPxhV026956; Fri, 7 May 2021 15:25:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPxqp026955; Fri, 7 May 2021 15:25:59 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:59 GMT Message-Id: <202105071525.147FPxqp026955@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: becdc0c0dc76 - stable/12 - pf tests: Test scrub fragment reassemble on interfaces with different MTU MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: becdc0c0dc7604389dd06b682ab11ed4dc43afea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:26:04 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=becdc0c0dc7604389dd06b682ab11ed4dc43afea commit becdc0c0dc7604389dd06b682ab11ed4dc43afea Author: Kristof Provost AuthorDate: 2021-04-27 16:46:03 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:19:05 +0000 pf tests: Test scrub fragment reassemble on interfaces with different MTU There's a problem with pf's reassembly code where it produces incorrect checksums when reassembling across interfaces with different MTUs. Test this. PR: 255432 Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30013 (cherry picked from commit 388c0cde10293d9a3434e99146bf391aec6878a3) --- tests/sys/netpfil/pf/fragmentation.sh | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/sys/netpfil/pf/fragmentation.sh b/tests/sys/netpfil/pf/fragmentation.sh index 943c76e478f3..1be6a3bc17cd 100755 --- a/tests/sys/netpfil/pf/fragmentation.sh +++ b/tests/sys/netpfil/pf/fragmentation.sh @@ -116,8 +116,57 @@ v6_cleanup() pft_cleanup } +atf_test_case "mtu_diff" "cleanup" +mtu_diff_head() +{ + atf_set descr 'Test reassembly across different MTUs, PR #255432' + atf_set require.user root +} + +mtu_diff_body() +{ + pft_init + + epair_small=$(vnet_mkepair) + epair_large=$(vnet_mkepair) + + vnet_mkjail first ${epair_small}b ${epair_large}a + vnet_mkjail second ${epair_large}b + + ifconfig ${epair_small}a 192.0.2.1/25 up + jexec first ifconfig ${epair_small}b 192.0.2.2/25 up + + jexec first sysctl net.inet.ip.forwarding=1 + jexec first ifconfig ${epair_large}a 192.0.2.130/25 up + jexec first ifconfig ${epair_large}a mtu 9000 + jexec second ifconfig ${epair_large}b 192.0.2.131/25 up + jexec second ifconfig ${epair_large}b mtu 9000 + jexec second route add default 192.0.2.130 + + route add 192.0.2.128/25 192.0.2.2 + + jexec first pfctl -e + pft_set_rules first \ + "scrub all fragment reassemble" + + # Sanity checks + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.130 + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.131 + + # Large packet that'll get reassembled and sent out in one on the large + # epair + atf_check -s exit:0 -o ignore ping -c 1 -s 8000 192.0.2.131 +} + +mtu_diff_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "too_many_fragments" atf_add_test_case "v6" + atf_add_test_case "mtu_diff" } From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 928C3631726; Fri, 7 May 2021 15:25:59 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDml0TXzz4k4j; Fri, 7 May 2021 15:25:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 090545C8B; Fri, 7 May 2021 15:25:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPu7Y026756; Fri, 7 May 2021 15:25:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPuHp026755; Fri, 7 May 2021 15:25:56 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:56 GMT Message-Id: <202105071525.147FPuHp026755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: dc202b6e0fb5 - stable/12 - pf: PFRULE_REFS should not be user-visible MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: dc202b6e0fb5848a1b38fe490b89ee5e2d2fbded Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:59 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dc202b6e0fb5848a1b38fe490b89ee5e2d2fbded commit dc202b6e0fb5848a1b38fe490b89ee5e2d2fbded Author: Kristof Provost AuthorDate: 2021-04-15 11:38:56 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:03 +0000 pf: PFRULE_REFS should not be user-visible Split the PFRULE_REFS flag from the rule_flag field. PFRULE_REFS is a kernel-internal flag and should not be exposed to or read from userspace. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29778 (cherry picked from commit 4f1f67e88853ac9e3c2d8897cf6dab6cfda8d16e) --- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf.c | 12 ++++++------ sys/netpfil/pf/pf_ioctl.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index e6e011d6ef99..1c0359fcbfbf 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -377,6 +377,7 @@ struct pf_krule { struct pf_rule_gid gid; u_int32_t rule_flag; + uint32_t rule_ref; u_int8_t action; u_int8_t direction; u_int8_t log; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index a02c9254c714..736d41203874 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1639,7 +1639,7 @@ pf_purge_expired_src_nodes() pf_unlink_src_node(cur); LIST_INSERT_HEAD(&freelist, cur, entry); } else if (cur->rule.ptr != NULL) - cur->rule.ptr->rule_flag |= PFRULE_REFS; + cur->rule.ptr->rule_ref |= PFRULE_REFS; PF_HASHROW_UNLOCK(sh); } @@ -1782,11 +1782,11 @@ relock: pf_unlink_state(s, PF_ENTER_LOCKED); goto relock; } - s->rule.ptr->rule_flag |= PFRULE_REFS; + s->rule.ptr->rule_ref |= PFRULE_REFS; if (s->nat_rule.ptr != NULL) - s->nat_rule.ptr->rule_flag |= PFRULE_REFS; + s->nat_rule.ptr->rule_ref |= PFRULE_REFS; if (s->anchor.ptr != NULL) - s->anchor.ptr->rule_flag |= PFRULE_REFS; + s->anchor.ptr->rule_ref |= PFRULE_REFS; s->kif->pfik_flags |= PFI_IFLAG_REFS; if (s->rt_kif) s->rt_kif->pfik_flags |= PFI_IFLAG_REFS; @@ -1838,11 +1838,11 @@ pf_purge_unlinked_rules() TAILQ_INIT(&tmpq); PF_UNLNKDRULES_LOCK(); TAILQ_FOREACH_SAFE(r, &V_pf_unlinked_rules, entries, r1) { - if (!(r->rule_flag & PFRULE_REFS)) { + if (!(r->rule_ref & PFRULE_REFS)) { TAILQ_REMOVE(&V_pf_unlinked_rules, r, entries); TAILQ_INSERT_TAIL(&tmpq, r, entries); } else - r->rule_flag &= ~PFRULE_REFS; + r->rule_ref &= ~PFRULE_REFS; } PF_UNLNKDRULES_UNLOCK(); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index edc87cf7983a..99bf8efcca1a 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -426,7 +426,7 @@ pf_unlink_rule(struct pf_krulequeue *rulequeue, struct pf_krule *rule) TAILQ_REMOVE(rulequeue, rule, entries); PF_UNLNKDRULES_LOCK(); - rule->rule_flag |= PFRULE_REFS; + rule->rule_ref |= PFRULE_REFS; TAILQ_INSERT_TAIL(&V_pf_unlinked_rules, rule, entries); PF_UNLNKDRULES_UNLOCK(); } From owner-dev-commits-src-all@freebsd.org Fri May 7 15:26:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CF1E63180B; Fri, 7 May 2021 15:26:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmp0H17z4k51; Fri, 7 May 2021 15:26:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7D4F05B3E; Fri, 7 May 2021 15:25:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPvmL026777; Fri, 7 May 2021 15:25:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPvq6026776; Fri, 7 May 2021 15:25:57 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:57 GMT Message-Id: <202105071525.147FPvq6026776@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 3f9591da1863 - stable/13 - pf tests: Test scrub fragment reassemble on interfaces with different MTU MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3f9591da1863acb55d3b11b7d0619a3aa70fcb7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:26:03 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3f9591da1863acb55d3b11b7d0619a3aa70fcb7c commit 3f9591da1863acb55d3b11b7d0619a3aa70fcb7c Author: Kristof Provost AuthorDate: 2021-04-27 16:46:03 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:16:23 +0000 pf tests: Test scrub fragment reassemble on interfaces with different MTU There's a problem with pf's reassembly code where it produces incorrect checksums when reassembling across interfaces with different MTUs. Test this. PR: 255432 Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30013 (cherry picked from commit 388c0cde10293d9a3434e99146bf391aec6878a3) --- tests/sys/netpfil/pf/fragmentation.sh | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/sys/netpfil/pf/fragmentation.sh b/tests/sys/netpfil/pf/fragmentation.sh index e697281b0826..8b57bcf11487 100644 --- a/tests/sys/netpfil/pf/fragmentation.sh +++ b/tests/sys/netpfil/pf/fragmentation.sh @@ -141,8 +141,57 @@ v6_cleanup() pft_cleanup } +atf_test_case "mtu_diff" "cleanup" +mtu_diff_head() +{ + atf_set descr 'Test reassembly across different MTUs, PR #255432' + atf_set require.user root +} + +mtu_diff_body() +{ + pft_init + + epair_small=$(vnet_mkepair) + epair_large=$(vnet_mkepair) + + vnet_mkjail first ${epair_small}b ${epair_large}a + vnet_mkjail second ${epair_large}b + + ifconfig ${epair_small}a 192.0.2.1/25 up + jexec first ifconfig ${epair_small}b 192.0.2.2/25 up + + jexec first sysctl net.inet.ip.forwarding=1 + jexec first ifconfig ${epair_large}a 192.0.2.130/25 up + jexec first ifconfig ${epair_large}a mtu 9000 + jexec second ifconfig ${epair_large}b 192.0.2.131/25 up + jexec second ifconfig ${epair_large}b mtu 9000 + jexec second route add default 192.0.2.130 + + route add 192.0.2.128/25 192.0.2.2 + + jexec first pfctl -e + pft_set_rules first \ + "scrub all fragment reassemble" + + # Sanity checks + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.130 + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.131 + + # Large packet that'll get reassembled and sent out in one on the large + # epair + atf_check -s exit:0 -o ignore ping -c 1 -s 8000 192.0.2.131 +} + +mtu_diff_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "too_many_fragments" atf_add_test_case "v6" + atf_add_test_case "mtu_diff" } From owner-dev-commits-src-all@freebsd.org Fri May 7 15:25:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 536EF6314BE; Fri, 7 May 2021 15:25:58 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmj5bqDz4k2p; Fri, 7 May 2021 15:25:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4979858F6; Fri, 7 May 2021 15:25:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPtE4026693; Fri, 7 May 2021 15:25:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPt87026692; Fri, 7 May 2021 15:25:55 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:55 GMT Message-Id: <202105071525.147FPt87026692@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 326f189d5b0e - stable/13 - pf: PFRULE_REFS should not be user-visible MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 326f189d5b0e8d4feaf147a2d5340f0391e90fc9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:25:58 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=326f189d5b0e8d4feaf147a2d5340f0391e90fc9 commit 326f189d5b0e8d4feaf147a2d5340f0391e90fc9 Author: Kristof Provost AuthorDate: 2021-04-15 11:38:56 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:15:43 +0000 pf: PFRULE_REFS should not be user-visible Split the PFRULE_REFS flag from the rule_flag field. PFRULE_REFS is a kernel-internal flag and should not be exposed to or read from userspace. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29778 (cherry picked from commit 4f1f67e88853ac9e3c2d8897cf6dab6cfda8d16e) --- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf.c | 12 ++++++------ sys/netpfil/pf/pf_ioctl.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 0ca46bb8048a..a6510560bb0e 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -377,6 +377,7 @@ struct pf_krule { struct pf_rule_gid gid; u_int32_t rule_flag; + uint32_t rule_ref; u_int8_t action; u_int8_t direction; u_int8_t log; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index ca8adeba52c3..20c3d160188f 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1641,7 +1641,7 @@ pf_purge_expired_src_nodes() pf_unlink_src_node(cur); LIST_INSERT_HEAD(&freelist, cur, entry); } else if (cur->rule.ptr != NULL) - cur->rule.ptr->rule_flag |= PFRULE_REFS; + cur->rule.ptr->rule_ref |= PFRULE_REFS; PF_HASHROW_UNLOCK(sh); } @@ -1783,11 +1783,11 @@ relock: pf_unlink_state(s, PF_ENTER_LOCKED); goto relock; } - s->rule.ptr->rule_flag |= PFRULE_REFS; + s->rule.ptr->rule_ref |= PFRULE_REFS; if (s->nat_rule.ptr != NULL) - s->nat_rule.ptr->rule_flag |= PFRULE_REFS; + s->nat_rule.ptr->rule_ref |= PFRULE_REFS; if (s->anchor.ptr != NULL) - s->anchor.ptr->rule_flag |= PFRULE_REFS; + s->anchor.ptr->rule_ref |= PFRULE_REFS; s->kif->pfik_flags |= PFI_IFLAG_REFS; if (s->rt_kif) s->rt_kif->pfik_flags |= PFI_IFLAG_REFS; @@ -1839,11 +1839,11 @@ pf_purge_unlinked_rules() TAILQ_INIT(&tmpq); PF_UNLNKDRULES_LOCK(); TAILQ_FOREACH_SAFE(r, &V_pf_unlinked_rules, entries, r1) { - if (!(r->rule_flag & PFRULE_REFS)) { + if (!(r->rule_ref & PFRULE_REFS)) { TAILQ_REMOVE(&V_pf_unlinked_rules, r, entries); TAILQ_INSERT_TAIL(&tmpq, r, entries); } else - r->rule_flag &= ~PFRULE_REFS; + r->rule_ref &= ~PFRULE_REFS; } PF_UNLNKDRULES_UNLOCK(); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index e6ab3ab5e91f..522f6a6a8f54 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -426,7 +426,7 @@ pf_unlink_rule(struct pf_krulequeue *rulequeue, struct pf_krule *rule) TAILQ_REMOVE(rulequeue, rule, entries); PF_UNLNKDRULES_LOCK(); - rule->rule_flag |= PFRULE_REFS; + rule->rule_ref |= PFRULE_REFS; TAILQ_INSERT_TAIL(&V_pf_unlinked_rules, rule, entries); PF_UNLNKDRULES_UNLOCK(); } From owner-dev-commits-src-all@freebsd.org Fri May 7 15:26:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A90B6315D4; Fri, 7 May 2021 15:26:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDmm6X8jz4jr1; Fri, 7 May 2021 15:26:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 18D295AD3; Fri, 7 May 2021 15:25:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FPvr3026798; Fri, 7 May 2021 15:25:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FPvsa026797; Fri, 7 May 2021 15:25:57 GMT (envelope-from git) Date: Fri, 7 May 2021 15:25:57 GMT Message-Id: <202105071525.147FPvsa026797@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: af1b05bb32b5 - stable/12 - pf: Fix IP checksum on reassembly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: af1b05bb32b5440dd999853bd7c01a5b8c0d73f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:26:03 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=af1b05bb32b5440dd999853bd7c01a5b8c0d73f4 commit af1b05bb32b5440dd999853bd7c01a5b8c0d73f4 Author: Kristof Provost AuthorDate: 2021-04-28 10:56:06 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 08:17:50 +0000 pf: Fix IP checksum on reassembly If we reassemble a packet we modify the IP header (to set the length and remove the fragment offset information), but we failed to update the checksum. On certain setups (mostly where we did not re-fragment again afterwards) this could lead to us sending out packets with incorrect checksums. PR: 255432 MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30026 (cherry picked from commit 055c55abefbe19fe46a56894595af9c9dad7678c) --- sys/netpfil/pf/pf_norm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index 2a3c1d442fd4..8f970b68373b 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -790,7 +790,11 @@ pf_reassemble(struct mbuf **m0, struct ip *ip, int dir, u_short *reason) } ip = mtod(m, struct ip *); + ip->ip_sum = pf_cksum_fixup(ip->ip_sum, ip->ip_len, + htons(hdrlen + total), 0); ip->ip_len = htons(hdrlen + total); + ip->ip_sum = pf_cksum_fixup(ip->ip_sum, ip->ip_off, + ip->ip_off & ~(IP_MF|IP_OFFMASK), 0); ip->ip_off &= ~(IP_MF|IP_OFFMASK); if (hdrlen + total > IP_MAXPACKET) { From owner-dev-commits-src-all@freebsd.org Fri May 7 15:33:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A93BC632B1F; Fri, 7 May 2021 15:33:40 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcDxc4SYpz4llB; Fri, 7 May 2021 15:33:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8C2435B5D; Fri, 7 May 2021 15:33:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147FXef4039914; Fri, 7 May 2021 15:33:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147FXe8w039913; Fri, 7 May 2021 15:33:40 GMT (envelope-from git) Date: Fri, 7 May 2021 15:33:40 GMT Message-Id: <202105071533.147FXe8w039913@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Maxim Konovalov Subject: git: 34abb05be77a - main - qat.4: the Authors section prettification MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: maxim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 34abb05be77a32a2b2673fb4b85eaa53a3d1446e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 15:33:40 -0000 The branch main has been updated by maxim: URL: https://cgit.FreeBSD.org/src/commit/?id=34abb05be77a32a2b2673fb4b85eaa53a3d1446e commit 34abb05be77a32a2b2673fb4b85eaa53a3d1446e Author: Maxim Konovalov AuthorDate: 2021-05-07 15:33:01 +0000 Commit: Maxim Konovalov CommitDate: 2021-05-07 15:33:01 +0000 qat.4: the Authors section prettification Rewording the Authors section in way that allows to remove a hard break before Mark's name. Reviewed by: markj --- share/man/man4/qat.4 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/share/man/man4/qat.4 b/share/man/man4/qat.4 index 6aa8343aa309..bd021304dc4d 100644 --- a/share/man/man4/qat.4 +++ b/share/man/man4/qat.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 27, 2021 +.Dd May 7, 2021 .Dt QAT 4 .Os .Sh NAME @@ -98,11 +98,10 @@ The driver was written for .Nx by -.An Hikaru Abe Aq Mt hikaru@iij.ad.jp -and ported to -.Fx -by -.An Mark Johnston Aq Mt markj@FreeBSD.org . +.An Hikaru Abe Aq Mt hikaru@iij.ad.jp . +.An Mark Johnston Aq Mt markj@FreeBSD.org +ported the driver to +.Fx . .Sh BUGS Some Atom C2000 QAT devices have two acceleration engines instead of one. The From owner-dev-commits-src-all@freebsd.org Fri May 7 16:11:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96760633FA4 for ; Fri, 7 May 2021 16:11:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcFnW3FyBz4nrk for ; Fri, 7 May 2021 16:11:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x736.google.com with SMTP id i17so8959952qki.3 for ; Fri, 07 May 2021 09:11:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yYOON+gx0kLhuwQABdXXzEwnzw4kClxxGf4BIbWPRB0=; b=elyi50PbYfOxMK6RUsk4mwyswOEkbtk8Nn7HxP2xp3dq+Gw+dMHygSjGTC2uoHr28x M4DVWepnNQ+IQN3AlWpL0iniH4LpkAtPE+e8RLHzhAWJoaf8Mb916BKEBxVb8cv0m6X9 pqoOclNVmrG1Kr3eALaWQWnlXnjabzv4I2DFPgNNhf7e24jpY0upcZf70KMeuDPvOqa4 b1VsWyE8bCHDIdOXD43xQ6GZRtiiTk5l5fsB+4CG0+1rNqGmN2Lna9mWww9hL2RVqwq3 n9JXBMTv7VYnFqWclFlGqZv0UDzljV+ll9d7rHXQZkwHHEqM6sCEYPaGIbYB8r2SZHfD pbbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yYOON+gx0kLhuwQABdXXzEwnzw4kClxxGf4BIbWPRB0=; b=o0CHLsnIoMVdlsv7LSiGrmSh7ctK3t+TLj/pjkjKWjR7FBaNexad4ZIE8D9mKHvpbs naWt2uEMmzTTVPMhWKe6VkkGT89kGcsp8g8iUAOpVHtIxFJJ900m0w3Ix/6BT4jZiHVn nrKxqhICddlDLBUhge6sPlKXe+aP7yX3d0ZMk7r46E7dA3dgXQgFLSOQM8M78DQw9hwo E1KryvDJkq4qMiYN9lst6AkwNOQVMykjNhhtNaGwk2ZPf+8c998e7mTBQriI1+65EzdB uge1mCQLV11kKa7CFht6IFaSC+FkigeRkuex6NKEqBZG+uREMS5R2TtD7IDHsNnAfF7x asRQ== X-Gm-Message-State: AOAM533dyP7WVY9GvdswmiqkbLMxSSQIWglwCGs8eZLKCCMsUQPKnsME dNnUy/1PxwF0UGjv5s7NeN4wWeo14p76n24WYE/tLg== X-Google-Smtp-Source: ABdhPJwGb567mle9BBtrNmsduTo9FXlkjKoVXHI7zlOfgUQzlAVtI1P/bnPfWSiFK7w5BM65+wZfVjfySTMuAX02Tus= X-Received: by 2002:a05:620a:24c5:: with SMTP id m5mr10380213qkn.195.1620403902423; Fri, 07 May 2021 09:11:42 -0700 (PDT) MIME-Version: 1.0 References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> In-Reply-To: From: Warner Losh Date: Fri, 7 May 2021 10:11:31 -0600 Message-ID: Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. To: Michael Tuexen Cc: Li-Wen Hsu , Randall Stewart , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4FcFnW3FyBz4nrk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 16:11:43 -0000 On Fri, May 7, 2021 at 5:10 AM Michael Tuexen < michael.tuexen@macmic.franken.de> wrote: > > On 7. May 2021, at 11:39, Li-Wen Hsu wrote: > > > > On Thu, May 6, 2021 at 11:26 PM Randall Stewart wrote: > >> > >> The branch main has been updated by rrs: > >> > >> URL: > https://cgit.FreeBSD.org/src/commit/?id=5d8fd932e418f03e98b3469c4088a36f0ef34ffe > >> > >> commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe > >> Author: Randall Stewart > >> AuthorDate: 2021-05-06 15:22:26 +0000 > >> Commit: Randall Stewart > >> CommitDate: 2021-05-06 15:22:26 +0000 > >> > >> This brings into sync FreeBSD with the netflix versions of rack and > bbr. > >> This fixes several breakages (panics) since the tcp_lro code was > >> committed that have been reported. Quite a few new features are > >> now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the > >> largest). There is also support for ack-war prevention. Documents > >> comming soon on rack.. > >> > >> Sponsored by: Netflix > >> Reviewed by: rscheff, mtuexen > >> Differential Revision: https://reviews.freebsd.org/D30036 > > > > This seems braking LINT kernel build of powerpc: > > > > https://ci.freebsd.org/job/FreeBSD-main-powerpc-LINT/6082/console > > > > Searching "error:" leads to: > > > > 00:08:15.153 > /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2143:16: > > error: implicit declaration of function 'tcp_hw_highest_rate' is > > invalid in C99 [-Werror,-Wimplicit-function-declaration] > > 00:08:15.153 high_rate = > > tcp_hw_highest_rate(rack->r_ctl.crte); > > 00:08:15.153 ^ > > > > and > > > > 00:08:15.163 > /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2165:16: > > error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is > > invalid in C99 [-Werror,-Wimplicit-function-declaration] > > 00:08:15.163 high_rate = > > tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > > rack->rc_inp); > > 00:08:15.163 ^ > > > > I suspect this is because RATELIMIT is not defined in default powerpc > > build? Is it safe to enable it? > If you are building TCP stacks, you need RATELIMIT. You can enable it. It > is enabled on > other platforms, too. > Yea. If we can't enable it on powerpc, I have some ideas on how to keep these modules from building when RATELIMIT isn't enabled. Warner From owner-dev-commits-src-all@freebsd.org Fri May 7 16:15:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18901634057 for ; Fri, 7 May 2021 16:15:38 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcFt16S09z4nqk for ; Fri, 7 May 2021 16:15:37 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-qt1-x830.google.com with SMTP id p6so6960863qtk.13 for ; Fri, 07 May 2021 09:15:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=hEfmu+L2ScybVLkkZMBru71ORVLkfj3oOBzO5vXCi+M=; b=mC/eE14QJ+JzLGNZMg2OFUb06qXAxHdBiI5DbCsyPQTDcijHfj2KC920L4ISbKIDWe 6FSuKNNkVsaEbV/a9nSg/vb3Jozbp1Hw/Fe1G4H0d4ewKC7R5o29VC1r+rv1pNxVfVFR FrCaG5cuLYhl8BkXLB/N2hPn++TGsGdLrLygmkLtE1ldRnTXM85Z6+keIq6MBoFbkFXX SAdasD/RcJMiGPrZu6zHLKKzV27GOUUqIIdMQhBfTDfMPoAxYZCpGrFpQeuHaEQ9OlSJ gpxKlDnX6J/lV8FEOhbNx8c/mKpQYFlznAeTmMNtXRUdTca3EGxY4m+OFVOgiefHZBp/ jAkw== X-Gm-Message-State: AOAM5337Bv80Ko1w8ukJT4hn3DJ9z+qTMrn9fwr5kqcZufLYPU5RhHOa 66K9w/ho74KR00+Lkjn14Hn1FQ== X-Google-Smtp-Source: ABdhPJzPxlh2Kw4zYokIq2PeSv34wtsSnC4JCi4phXsNjIzFmCohUEBhcaSgsolyQADBdnsEC0TqSw== X-Received: by 2002:a05:622a:342:: with SMTP id r2mr10045722qtw.232.1620404135043; Fri, 07 May 2021 09:15:35 -0700 (PDT) Received: from smtpclient.apple ([2607:fb10:7061:101::a]) by smtp.gmail.com with ESMTPSA id m4sm5644028qtg.21.2021.05.07.09.15.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 May 2021 09:15:31 -0700 (PDT) From: Randall Stewart Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_10B982D7-AFF2-4A02-8E26-E97DEEEEB8F0"; protocol="application/pkcs7-signature"; micalg=sha-256 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. Date: Fri, 7 May 2021 12:15:28 -0400 In-Reply-To: Cc: Michael Tuexen , Li-Wen Hsu , Randall Ray Stewart , src-committers , "" , dev-commits-src-main@freebsd.org To: "M. Warner Losh" References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> X-Mailer: Apple Mail (2.3654.80.0.2.43) X-Rspamd-Queue-Id: 4FcFt16S09z4nqk X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 16:15:38 -0000 --Apple-Mail=_10B982D7-AFF2-4A02-8E26-E97DEEEEB8F0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Yep We either need to change it and add ifdefs=E2=80=A6 or make it a requirement like TCP_HTPS Let me go look at what makes sense R > On May 7, 2021, at 12:11 PM, Warner Losh wrote: >=20 >=20 >=20 > On Fri, May 7, 2021 at 5:10 AM Michael Tuexen = wrote: > > On 7. May 2021, at 11:39, Li-Wen Hsu wrote: > >=20 > > On Thu, May 6, 2021 at 11:26 PM Randall Stewart = wrote: > >>=20 > >> The branch main has been updated by rrs: > >>=20 > >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D5d8fd932e418f03e98b3469c4088a36f= 0ef34ffe > >>=20 > >> commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe > >> Author: Randall Stewart > >> AuthorDate: 2021-05-06 15:22:26 +0000 > >> Commit: Randall Stewart > >> CommitDate: 2021-05-06 15:22:26 +0000 > >>=20 > >> This brings into sync FreeBSD with the netflix versions of rack = and bbr. > >> This fixes several breakages (panics) since the tcp_lro code was > >> committed that have been reported. Quite a few new features are > >> now in rack (prefecting of DGP -- Dynamic Goodput Pacing among = the > >> largest). There is also support for ack-war prevention. = Documents > >> comming soon on rack.. > >>=20 > >> Sponsored by: Netflix > >> Reviewed by: rscheff, mtuexen > >> Differential Revision: https://reviews.freebsd.org/D30036 > >=20 > > This seems braking LINT kernel build of powerpc: > >=20 > > https://ci.freebsd.org/job/FreeBSD-main-powerpc-LINT/6082/console > >=20 > > Searching "error:" leads to: > >=20 > > 00:08:15.153 = /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:214= 3:16: > > error: implicit declaration of function 'tcp_hw_highest_rate' is > > invalid in C99 [-Werror,-Wimplicit-function-declaration] > > 00:08:15.153 high_rate =3D > > tcp_hw_highest_rate(rack->r_ctl.crte); > > 00:08:15.153 ^ > >=20 > > and > >=20 > > 00:08:15.163 = /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:216= 5:16: > > error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is > > invalid in C99 [-Werror,-Wimplicit-function-declaration] > > 00:08:15.163 high_rate =3D > > tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > > rack->rc_inp); > > 00:08:15.163 ^ > >=20 > > I suspect this is because RATELIMIT is not defined in default = powerpc > > build? Is it safe to enable it? > If you are building TCP stacks, you need RATELIMIT. You can enable it. = It is enabled on > other platforms, too. >=20 > Yea. If we can't enable it on powerpc, I have some ideas on how to = keep these modules > from building when RATELIMIT isn't enabled. >=20 > Warner=20 ------ Randall Stewart rrs@netflix.com --Apple-Mail=_10B982D7-AFF2-4A02-8E26-E97DEEEEB8F0 Content-Disposition: attachment; filename=smime.p7s Content-Type: application/pkcs7-signature; name=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCCAzYw ggMyMIICGqADAgECAgqxywKqrHPB2ybTMA0GCSqGSIb3DQEBCwUAMEcxGDAWBgNVBAMTD1JhbmRh bGwgU3Rld2FydDEeMBwGCSqGSIb3DQEJARYPcnJzQG5ldGZsaXguY29tMQswCQYDVQQGEwJVUzAe Fw0yMTAxMjQxMjIwMTRaFw0yNjAxMjQxMjIwMTRaMEcxGDAWBgNVBAMTD1JhbmRhbGwgU3Rld2Fy dDEeMBwGCSqGSIb3DQEJARYPcnJzQG5ldGZsaXguY29tMQswCQYDVQQGEwJVUzCCASIwDQYJKoZI hvcNAQEBBQADggEPADCCAQoCggEBAMUAht2nr/NFlK+tmmN9PdO3DBPfeYh9fLcbVihR+/dipO41 AsFy9y+2uDVaFhTEvp406P0o9PQQTuYXqrCr76eWQIj3V787e1WKjTup1mIyQeWHGf1gvb/7vmI2 zHg6QZEIC4W8xeO8SLKyHiwlFHZn8Rn1HxtB7Ge+NulygkgUgJYhXD5E29jVGXAc6Qn9Vr9AexPf KaOhHCaNB/Twcinayz6D8CO/Ym1LOs3+ceSOa4cB07fepmbqDSXDkOeA3U7KLaluHrRTlj6DO+JU nqKXX7jJ68KTYSZ0qH4fZsk8cxFkwYI/3HDJi+oF+FDkf7SRo1Q2w+e3M/5MReLIQ7sCAwEAAaMg MB4wDwYJKoZIhvcvAQEKBAIFADALBgNVHQ8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBAHJfum1j 1WIVFjOJT/hqMIN751aXkablmwesW94lNJKjslPULbbcP5nZGg2lGpHcZ+0I5F/1TTiEsT2H2rhA uAnSsUxTpxRA+aoe+xtJOa5vle3CprhFkHAvB7EIoLiNaPd0DNK6kKYsbvr5Z5Eq7TF3SIO77Qh9 /8VgUfOb0ARDgix59Q6MM0NmIabEwh0cDWQYlGgDDtN9DNk5PGM4pjs48suwEdLmFTMOmGTkCp7I Vq6iHDNinBiB6+BB4VYMAO1o9qS+0pnfdmPJybt0zVGrhm/c1Fmm3Jec7NEuiKeXmhPIwdwMkKyp AsX0sHuFCYwioBTHHZpvnir+H2rRakgxggHrMIIB5wIBATBVMEcxGDAWBgNVBAMTD1JhbmRhbGwg U3Rld2FydDEeMBwGCSqGSIb3DQEJARYPcnJzQG5ldGZsaXguY29tMQswCQYDVQQGEwJVUwIKscsC qqxzwdsm0zANBglghkgBZQMEAgEFAKBpMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZI hvcNAQkFMQ8XDTIxMDUwNzE2MTUyOFowLwYJKoZIhvcNAQkEMSIEIJoXMYeXpEDo2wtKN4VfON1Q 5mHKFPN8O+2H/qvYCTx5MA0GCSqGSIb3DQEBCwUABIIBAJWQ+z8w+1LVgYj7+Q+OtEZBbLLfM/R3 t9uSKBdZBTIdCAYPHZXGN64K8GPWjkFrWY5IsmKB3xfplBzRysU14mvbwmRoYPU6n7raSbmSdIF3 9RzmPTinzFSaPwo9UDnE0acC0ovL38Sf5fXEeCEqoW3sNOL8LYdFDDbyx5Jl4srqiQEAT2yRPfGj lfszMPXHjTwxkUnSkieJBuCW96Vf2O22sYAAoZZNAGGDhrjhg134bSzP79g+55X8bZxRgU611hc1 WVTqCSvmlCLV8k9BcwQ+JhhUWIwFWUmRlxrlvLtJXiKrWkh+tXIYjgGzJQ9WFbMGYD1PuDdBiGpb vT3AHCEAAAAAAAA= --Apple-Mail=_10B982D7-AFF2-4A02-8E26-E97DEEEEB8F0-- From owner-dev-commits-src-all@freebsd.org Fri May 7 16:30:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E84F3634777; Fri, 7 May 2021 16:30:16 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcGBw554Xz4pkk; Fri, 7 May 2021 16:30:16 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from smtpclient.apple (unknown [IPv6:2a02:8109:1140:c3d:7c86:1978:3046:7dff]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 3C98771939090; Fri, 7 May 2021 18:30:06 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. From: Michael Tuexen In-Reply-To: Date: Fri, 7 May 2021 18:30:05 +0200 Cc: Li-Wen Hsu , Randall Stewart , src-committers , "" , dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <454D2A05-9CE3-4E60-80FD-0C5D97093A3B@macmic.franken.de> References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> To: Warner Losh X-Mailer: Apple Mail (2.3654.80.0.2.43) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4FcGBw554Xz4pkk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 16:30:17 -0000 > On 7. May 2021, at 18:11, Warner Losh wrote: >=20 >=20 >=20 > On Fri, May 7, 2021 at 5:10 AM Michael Tuexen = wrote: > > On 7. May 2021, at 11:39, Li-Wen Hsu wrote: > >=20 > > On Thu, May 6, 2021 at 11:26 PM Randall Stewart = wrote: > >>=20 > >> The branch main has been updated by rrs: > >>=20 > >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D5d8fd932e418f03e98b3469c4088a36f= 0ef34ffe > >>=20 > >> commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe > >> Author: Randall Stewart > >> AuthorDate: 2021-05-06 15:22:26 +0000 > >> Commit: Randall Stewart > >> CommitDate: 2021-05-06 15:22:26 +0000 > >>=20 > >> This brings into sync FreeBSD with the netflix versions of rack = and bbr. > >> This fixes several breakages (panics) since the tcp_lro code was > >> committed that have been reported. Quite a few new features are > >> now in rack (prefecting of DGP -- Dynamic Goodput Pacing among = the > >> largest). There is also support for ack-war prevention. = Documents > >> comming soon on rack.. > >>=20 > >> Sponsored by: Netflix > >> Reviewed by: rscheff, mtuexen > >> Differential Revision: https://reviews.freebsd.org/D30036 > >=20 > > This seems braking LINT kernel build of powerpc: > >=20 > > https://ci.freebsd.org/job/FreeBSD-main-powerpc-LINT/6082/console > >=20 > > Searching "error:" leads to: > >=20 > > 00:08:15.153 = /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:214= 3:16: > > error: implicit declaration of function 'tcp_hw_highest_rate' is > > invalid in C99 [-Werror,-Wimplicit-function-declaration] > > 00:08:15.153 high_rate =3D > > tcp_hw_highest_rate(rack->r_ctl.crte); > > 00:08:15.153 ^ > >=20 > > and > >=20 > > 00:08:15.163 = /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:216= 5:16: > > error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is > > invalid in C99 [-Werror,-Wimplicit-function-declaration] > > 00:08:15.163 high_rate =3D > > tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > > rack->rc_inp); > > 00:08:15.163 ^ > >=20 > > I suspect this is because RATELIMIT is not defined in default = powerpc > > build? Is it safe to enable it? > If you are building TCP stacks, you need RATELIMIT. You can enable it. = It is enabled on > other platforms, too. >=20 > Yea. If we can't enable it on powerpc, I have some ideas on how to = keep these modules > from building when RATELIMIT isn't enabled. What is the problem on 32-bit PPC? Unfortunately, my G4 MacMini died = last year, but it is fine on 64-bit PPC. Can test it on a POWER9 system. Best regards Michael >=20 > Warner=20 From owner-dev-commits-src-all@freebsd.org Fri May 7 16:51:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 770E763572A; Fri, 7 May 2021 16:51:28 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcGgN2bWHz4r4Y; Fri, 7 May 2021 16:51:28 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com [66.111.4.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bdragon/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 3F30E7340; Fri, 7 May 2021 16:51:28 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id E6AC827C0054; Fri, 7 May 2021 12:51:27 -0400 (EDT) Received: from imap38 ([10.202.2.88]) by compute3.internal (MEProxy); Fri, 07 May 2021 12:51:27 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdegvddguddtiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculddutddmnecujfgurhepofgfggfkjghffffhvffutgesthdtredt reerjeenucfhrhhomhepfdeurhgrnhguohhnuceuvghrghhrvghnfdcuoegsughrrghgoh hnsefhrhgvvgeuufffrdhorhhgqeenucggtffrrghtthgvrhhnpeejhfeftddutdelgeek gedtgeejkeffvdejtddthefggfevuefggfefledvgefhgfenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsughrrghgohhnodhmvghsmhhtphgr uhhthhhpvghrshhonhgrlhhithihqddutdegvdefheekieegqddukedutdekheduqdgsug hrrghgohhnpeephfhrvggvuefuffdrohhrghesihhmrghprdgttg X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 0971BCA005E; Fri, 7 May 2021 12:51:26 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-448-gae190416c7-fm-20210505.004-gae190416 Mime-Version: 1.0 Message-Id: <66dab209-3419-4c82-b5de-398b463610d0@www.fastmail.com> In-Reply-To: <454D2A05-9CE3-4E60-80FD-0C5D97093A3B@macmic.franken.de> References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> <454D2A05-9CE3-4E60-80FD-0C5D97093A3B@macmic.franken.de> Date: Fri, 07 May 2021 11:51:06 -0500 From: "Brandon Bergren" To: "Michael Tuexen" , "Warner Losh" Cc: "Li-Wen Hsu" , "Randall Stewart" , src-committers , "" , dev-commits-src-main@freebsd.org Subject: =?UTF-8?Q?Re:_git:_5d8fd932e418_-_main_-_This_brings_into_sync_FreeBSD_w?= =?UTF-8?Q?ith_the_netflix_versions_of_rack_and_bbr._This_fixes_several_?= =?UTF-8?Q?breakages_(panics)_since_the_tcp=5Flro_code_was_committed_tha?= =?UTF-8?Q?t_have_been_reported._Quite_a_few_new_features_are_now_in_rac?= =?UTF-8?Q?k_(prefecting_of_DGP_--_Dynamic_Goodput_Pacing_among_the_larg?= =?UTF-8?Q?est)._There_is_also_support_for_ack-war_prevention._Documents?= =?UTF-8?Q?_comming_soon_on_rack..?= Content-Type: text/plain X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 16:51:28 -0000 On Fri, May 7, 2021, at 11:30 AM, Michael Tuexen wrote: > > On 7. May 2021, at 18:11, Warner Losh wrote: > > > > Yea. If we can't enable it on powerpc, I have some ideas on how to keep these modules > > from building when RATELIMIT isn't enabled. > What is the problem on 32-bit PPC? Unfortunately, my G4 MacMini died > last year, but it > is fine on 64-bit PPC. Can test it on a POWER9 system. The powerpc LINT config explicitly disables RATELIMIT. I'm not sure why though, it looks like it was part of the conversion from automatically generated LINT to the manually curated one. -- Brandon Bergren bdragon@FreeBSD.org From owner-dev-commits-src-all@freebsd.org Fri May 7 16:59:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9F316356DC; Fri, 7 May 2021 16:59:12 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcGrJ5kz4z4rMM; Fri, 7 May 2021 16:59:12 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p200300d5d70db088d961eb679867db66.dip0.t-ipconnect.de [IPv6:2003:d5:d70d:b088:d961:eb67:9867:db66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id 5544E6A6C; Fri, 7 May 2021 16:59:12 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Fri, 7 May 2021 18:59:11 +0200 From: Gordon Bergling To: Brandon Bergren Cc: Michael Tuexen , Warner Losh , Li-Wen Hsu , Randall Stewart , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. Message-ID: References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> <454D2A05-9CE3-4E60-80FD-0C5D97093A3B@macmic.franken.de> <66dab209-3419-4c82-b5de-398b463610d0@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <66dab209-3419-4c82-b5de-398b463610d0@www.fastmail.com> X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 6:55PM up 6:08, 4 users, load averages: 1.01, 0.72, 0.56 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 16:59:12 -0000 On Fri, May 07, 2021 at 11:51:06AM -0500, Brandon Bergren wrote: > On Fri, May 7, 2021, at 11:30 AM, Michael Tuexen wrote: > > > On 7. May 2021, at 18:11, Warner Losh wrote: > > > > > > Yea. If we can't enable it on powerpc, I have some ideas on how to keep these modules > > > from building when RATELIMIT isn't enabled. > > What is the problem on 32-bit PPC? Unfortunately, my G4 MacMini died > > last year, but it > > is fine on 64-bit PPC. Can test it on a POWER9 system. > > The powerpc LINT config explicitly disables RATELIMIT. I'm not sure why though, it looks like it was part of the conversion from automatically generated LINT to the manually curated one. Besides LINT build issues, it would maybe a good idea to enable the build of the extra TCP stacks by default to get further adaption of them. That could also minimize build problems. --Gordon From owner-dev-commits-src-all@freebsd.org Fri May 7 17:12:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF3B263633D; Fri, 7 May 2021 17:12:36 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcH7m3ZsGz4sLw; Fri, 7 May 2021 17:12:36 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from smtpclient.apple (unknown [IPv6:2a02:8109:1140:c3d:7c86:1978:3046:7dff]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id ECA19721E2807; Fri, 7 May 2021 19:12:32 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. From: Michael Tuexen In-Reply-To: <66dab209-3419-4c82-b5de-398b463610d0@www.fastmail.com> Date: Fri, 7 May 2021 19:12:32 +0200 Cc: Warner Losh , Li-Wen Hsu , Randall Stewart , src-committers , "" , dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <31408BB3-ADBD-47D7-89B2-C151FD4649A4@macmic.franken.de> References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> <454D2A05-9CE3-4E60-80FD-0C5D97093A3B@macmic.franken.de> <66dab209-3419-4c82-b5de-398b463610d0@www.fastmail.com> To: Brandon Bergren X-Mailer: Apple Mail (2.3654.80.0.2.43) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4FcH7m3ZsGz4sLw X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 17:12:36 -0000 > On 7. May 2021, at 18:51, Brandon Bergren wrote: >=20 >=20 >=20 > On Fri, May 7, 2021, at 11:30 AM, Michael Tuexen wrote: >>> On 7. May 2021, at 18:11, Warner Losh wrote: >>>=20 >>> Yea. If we can't enable it on powerpc, I have some ideas on how to = keep these modules >>> from building when RATELIMIT isn't enabled. >> What is the problem on 32-bit PPC? Unfortunately, my G4 MacMini died=20= >> last year, but it >> is fine on 64-bit PPC. Can test it on a POWER9 system. >=20 > The powerpc LINT config explicitly disables RATELIMIT. I'm not sure = why though, it looks like it was part of the conversion from = automatically=20 I know that LINT explicitly disables RATELIMIT, but I'm wondering why. Best regards Michael > generated LINT to the manually curated one. >=20 > --=20 > Brandon Bergren > bdragon@FreeBSD.org From owner-dev-commits-src-all@freebsd.org Fri May 7 17:15:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFA28635FEE; Fri, 7 May 2021 17:15:15 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcHBq4Bxsz4sMY; Fri, 7 May 2021 17:15:15 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from smtpclient.apple (unknown [IPv6:2a02:8109:1140:c3d:7c86:1978:3046:7dff]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 1356A721E2807; Fri, 7 May 2021 19:15:12 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. From: Michael Tuexen In-Reply-To: Date: Fri, 7 May 2021 19:15:11 +0200 Cc: Brandon Bergren , Warner Losh , Li-Wen Hsu , Randall Stewart , src-committers , "" , dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <72392D50-5388-488A-AB1A-0A242D54E8A8@macmic.franken.de> References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> <454D2A05-9CE3-4E60-80FD-0C5D97093A3B@macmic.franken.de> <66dab209-3419-4c82-b5de-398b463610d0@www.fastmail.com> To: Gordon Bergling X-Mailer: Apple Mail (2.3654.80.0.2.43) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4FcHBq4Bxsz4sMY X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 17:15:15 -0000 > On 7. May 2021, at 18:59, Gordon Bergling wrote: >=20 > On Fri, May 07, 2021 at 11:51:06AM -0500, Brandon Bergren wrote: >> On Fri, May 7, 2021, at 11:30 AM, Michael Tuexen wrote: >>>> On 7. May 2021, at 18:11, Warner Losh wrote: >>>>=20 >>>> Yea. If we can't enable it on powerpc, I have some ideas on how to = keep these modules >>>> from building when RATELIMIT isn't enabled. >>> What is the problem on 32-bit PPC? Unfortunately, my G4 MacMini died=20= >>> last year, but it >>> is fine on 64-bit PPC. Can test it on a POWER9 system. >>=20 >> The powerpc LINT config explicitly disables RATELIMIT. I'm not sure = why though, it looks like it was part of the conversion from = automatically generated LINT to the manually curated one. >=20 > Besides LINT build issues, it would maybe a good idea to enable the = build > of the extra TCP stacks by default to get further adaption of them. They are not build by default on purpose... That might change possibly = for RACK in the future... >=20 > That could also minimize build problems. Sure. But they have been sort of experimental up to now. Best regards Michael >=20 > --Gordon From owner-dev-commits-src-all@freebsd.org Fri May 7 17:47:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D804A636F72; Fri, 7 May 2021 17:47:07 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcHvb5fVbz4tcB; Fri, 7 May 2021 17:47:07 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p200300d5d70db088d961eb679867db66.dip0.t-ipconnect.de [IPv6:2003:d5:d70d:b088:d961:eb67:9867:db66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id 47B3A7C07; Fri, 7 May 2021 17:47:07 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Fri, 7 May 2021 19:47:06 +0200 From: Gordon Bergling To: Li-Wen Hsu Cc: Randall Stewart , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. Message-ID: References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 7:42PM up 6:55, 4 users, load averages: 0.30, 0.36, 0.41 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 17:47:07 -0000 On Fri, May 07, 2021 at 05:39:37PM +0800, Li-Wen Hsu wrote: > On Thu, May 6, 2021 at 11:26 PM Randall Stewart wrote: > > > > The branch main has been updated by rrs: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=5d8fd932e418f03e98b3469c4088a36f0ef34ffe > > > > commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe > > Author: Randall Stewart > > AuthorDate: 2021-05-06 15:22:26 +0000 > > Commit: Randall Stewart > > CommitDate: 2021-05-06 15:22:26 +0000 > > > > This brings into sync FreeBSD with the netflix versions of rack and bbr. > > This fixes several breakages (panics) since the tcp_lro code was > > committed that have been reported. Quite a few new features are > > now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the > > largest). There is also support for ack-war prevention. Documents > > comming soon on rack.. > > > > Sponsored by: Netflix > > Reviewed by: rscheff, mtuexen > > Differential Revision: https://reviews.freebsd.org/D30036 > > This seems braking LINT kernel build of powerpc: > > https://ci.freebsd.org/job/FreeBSD-main-powerpc-LINT/6082/console > > Searching "error:" leads to: > > 00:08:15.153 /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2143:16: > error: implicit declaration of function 'tcp_hw_highest_rate' is > invalid in C99 [-Werror,-Wimplicit-function-declaration] > 00:08:15.153 high_rate = > tcp_hw_highest_rate(rack->r_ctl.crte); > 00:08:15.153 ^ > > and > > 00:08:15.163 /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2165:16: > error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is > invalid in C99 [-Werror,-Wimplicit-function-declaration] > 00:08:15.163 high_rate = > tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > rack->rc_inp); > 00:08:15.163 ^ > > I suspect this is because RATELIMIT is not defined in default powerpc > build? Is it safe to enable it? > > Best, > Li-Wen That should not be something RATELIMT related. I regular test 14-CURRENT on a RPi4B and the build today fails with -------------------------------------------------------------- >>> stage 3.1: building everything -------------------------------------------------------------- /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2143:16: error: implicit declaration of function 'tcp_hw_highest_rate' is invalid in C99 [-Werror,-Wimplicit-function-declaration] high_rate = tcp_hw_highest_rate(rack->r_ctl.crte); ^ /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2165:16: error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is invalid in C99 [-Werror,-Wimplicit-function-declaration] high_rate = tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, rack->rc_inp); ^ /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:14166:15: error: implicit declaration of function 'tcp_hw_highest_rate' is invalid in C99 [-Werror,-Wimplicit-function-declaration] high_rate = tcp_hw_highest_rate(rack->r_ctl.crte); ^ /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:14193:15: error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is invalid in C99 [-Werror,-Wimplicit-function-declaration] high_rate = tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, rack->rc_inp); ^ 4 errors generated. --- rack.o --- *** [rack.o] Error code 1 RATELIMIT is included in my KERNCONF since I use tcp_bbr(4) for a while on the RPi4B now. --Gordon From owner-dev-commits-src-all@freebsd.org Fri May 7 18:03:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8156637854; Fri, 7 May 2021 18:03:36 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from drew.franken.de (mail-n.franken.de [193.175.24.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcJGc3Y36z4vfr; Fri, 7 May 2021 18:03:36 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from smtpclient.apple (unknown [IPv6:2a02:8109:1140:c3d:7c86:1978:3046:7dff]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id E4ADF71E3FEFE; Fri, 7 May 2021 20:03:32 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. From: Michael Tuexen In-Reply-To: Date: Fri, 7 May 2021 20:03:32 +0200 Cc: Li-Wen Hsu , Randall Stewart , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <78FF7B31-B84D-4D97-9E57-D000A6B09D7D@macmic.franken.de> References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> To: Gordon Bergling X-Mailer: Apple Mail (2.3654.80.0.2.43) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4FcJGc3Y36z4vfr X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 18:03:36 -0000 > On 7. May 2021, at 19:47, Gordon Bergling wrote: >=20 > On Fri, May 07, 2021 at 05:39:37PM +0800, Li-Wen Hsu wrote: >> On Thu, May 6, 2021 at 11:26 PM Randall Stewart = wrote: >>>=20 >>> The branch main has been updated by rrs: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D5d8fd932e418f03e98b3469c4088a36f= 0ef34ffe >>>=20 >>> commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe >>> Author: Randall Stewart >>> AuthorDate: 2021-05-06 15:22:26 +0000 >>> Commit: Randall Stewart >>> CommitDate: 2021-05-06 15:22:26 +0000 >>>=20 >>> This brings into sync FreeBSD with the netflix versions of rack = and bbr. >>> This fixes several breakages (panics) since the tcp_lro code was >>> committed that have been reported. Quite a few new features are >>> now in rack (prefecting of DGP -- Dynamic Goodput Pacing among = the >>> largest). There is also support for ack-war prevention. Documents >>> comming soon on rack.. >>>=20 >>> Sponsored by: Netflix >>> Reviewed by: rscheff, mtuexen >>> Differential Revision: https://reviews.freebsd.org/D30036 >>=20 >> This seems braking LINT kernel build of powerpc: >>=20 >> https://ci.freebsd.org/job/FreeBSD-main-powerpc-LINT/6082/console >>=20 >> Searching "error:" leads to: >>=20 >> 00:08:15.153 = /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:214= 3:16: >> error: implicit declaration of function 'tcp_hw_highest_rate' is >> invalid in C99 [-Werror,-Wimplicit-function-declaration] >> 00:08:15.153 high_rate =3D >> tcp_hw_highest_rate(rack->r_ctl.crte); >> 00:08:15.153 ^ >>=20 >> and >>=20 >> 00:08:15.163 = /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:216= 5:16: >> error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is >> invalid in C99 [-Werror,-Wimplicit-function-declaration] >> 00:08:15.163 high_rate =3D >> tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, >> rack->rc_inp); >> 00:08:15.163 ^ >>=20 >> I suspect this is because RATELIMIT is not defined in default powerpc >> build? Is it safe to enable it? >>=20 >> Best, >> Li-Wen >=20 > That should not be something RATELIMT related. I regular test = 14-CURRENT on a > RPi4B and the build today fails with >=20 > -------------------------------------------------------------- >>>> stage 3.1: building everything > -------------------------------------------------------------- > = /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks= /rack.c:2143:16: error: implicit declaration of function = 'tcp_hw_highest_rate' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > high_rate =3D = tcp_hw_highest_rate(rack->r_ctl.crte); > ^ > = /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks= /rack.c:2165:16: error: implicit declaration of function = 'tcp_hw_highest_rate_ifp' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > high_rate =3D = tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, = rack->rc_inp); > ^ > = /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks= /rack.c:14166:15: error: implicit declaration of function = 'tcp_hw_highest_rate' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > high_rate =3D tcp_hw_highest_rate(rack->r_ctl.crte); > ^ > = /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks= /rack.c:14193:15: error: implicit declaration of function = 'tcp_hw_highest_rate_ifp' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > high_rate =3D = tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, = rack->rc_inp); > ^ > 4 errors generated. > --- rack.o --- > *** [rack.o] Error code 1 >=20 >=20 > RATELIMIT is included in my KERNCONF since I use tcp_bbr(4) for a > while on the RPi4B now. Can you post the kernel config you are using? I'm building the kernel on = an arm64 platform by using tuexen@parallels:~/freebsd-src/sys/arm64/conf % cat SCTP=20 include GENERIC ident SCTP=09 makeoptions WITH_EXTRA_TCP_STACKS=3D1 options SCTP options SCTP_DEBUG options TCPHPTS options TCP_BLACKBOX options RATELIMIT options DEBUG_REDZONE options IPFIREWALL options IPFIREWALL_VERBOSE options IPFIREWALL_VERBOSE_LIMIT=3D5 options IPFIREWALL_DEFAULT_TO_ACCEPT It looks like RATELIMIT is not defined, when tcp_ratelimit.h is = included... Best regards Michael > --Gordon From owner-dev-commits-src-all@freebsd.org Fri May 7 18:11:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16AA4638226; Fri, 7 May 2021 18:11:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcJRz06hLz3C4f; Fri, 7 May 2021 18:11:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EB72F10408; Fri, 7 May 2021 18:11:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147IBggH050281; Fri, 7 May 2021 18:11:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147IBgHZ050280; Fri, 7 May 2021 18:11:42 GMT (envelope-from git) Date: Fri, 7 May 2021 18:11:42 GMT Message-Id: <202105071811.147IBgHZ050280@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: a16cee021865 - main - Fix a UDP tunneling issue with rack. Basically there are two issues. A) Not enough hdrlen was being calculated when a UDP tunnel is in place. and B) Not enough memory is allocated in racks fsb. We need to overbook the fsb to include a udphdr just in case. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a16cee0218652230d94a73690201e76baab0bba1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 18:11:43 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=a16cee0218652230d94a73690201e76baab0bba1 commit a16cee0218652230d94a73690201e76baab0bba1 Author: Randall Stewart AuthorDate: 2021-05-07 18:06:43 +0000 Commit: Randall Stewart CommitDate: 2021-05-07 18:06:43 +0000 Fix a UDP tunneling issue with rack. Basically there are two issues. A) Not enough hdrlen was being calculated when a UDP tunnel is in place. and B) Not enough memory is allocated in racks fsb. We need to overbook the fsb to include a udphdr just in case. Submitted by: Peter Lei Reviewed by: Michael Tuexen Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30157 --- sys/netinet/tcp_stacks/rack.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 64180125658f..7c59d8097e22 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -11875,6 +11875,7 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) rack->r_ctl.fsb.tcp_ip_hdr_len = sizeof(struct ip6_hdr) + sizeof(struct tcphdr); ip6 = (struct ip6_hdr *)rack->r_ctl.fsb.tcp_ip_hdr; if (tp->t_port) { + rack->r_ctl.fsb.tcp_ip_hdr_len += sizeof(struct udphdr); udp = (struct udphdr *)((caddr_t)ip6 + sizeof(struct ip6_hdr)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; @@ -11894,6 +11895,7 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) rack->r_ctl.fsb.tcp_ip_hdr_len = sizeof(struct tcpiphdr); ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr; if (tp->t_port) { + rack->r_ctl.fsb.tcp_ip_hdr_len += sizeof(struct udphdr); udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; @@ -11914,10 +11916,14 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) static int rack_init_fsb(struct tcpcb *tp, struct tcp_rack *rack) { - /* Allocate the larger of spaces V6 if available else just V4 */ - rack->r_ctl.fsb.tcp_ip_hdr_len = sizeof(struct tcpiphdr); + /* + * Allocate the larger of spaces V6 if available else just + * V4 and include udphdr (overbook) + */ #ifdef INET6 - rack->r_ctl.fsb.tcp_ip_hdr_len = sizeof(struct ip6_hdr) + sizeof(struct tcphdr); + rack->r_ctl.fsb.tcp_ip_hdr_len = sizeof(struct ip6_hdr) + sizeof(struct tcphdr) + sizeof(struct udphdr); +#else + rack->r_ctl.fsb.tcp_ip_hdr_len = sizeof(struct tcpiphdr) + sizeof(struct udphdr); #endif rack->r_ctl.fsb.tcp_ip_hdr = malloc(rack->r_ctl.fsb.tcp_ip_hdr_len, M_TCPFSB, M_NOWAIT|M_ZERO); @@ -15078,6 +15084,8 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma optlen = tcp_addoptions(&to, opt); hdrlen += optlen; udp = rack->r_ctl.fsb.udp; + if (udp) + hdrlen += sizeof(struct udphdr); if (rack->r_ctl.rc_pace_max_segs) max_val = rack->r_ctl.rc_pace_max_segs; else if (rack->rc_user_set_max_segs) @@ -15530,6 +15538,8 @@ rack_fast_output(struct tcpcb *tp, struct tcp_rack *rack, uint64_t ts_val, optlen = tcp_addoptions(&to, opt); hdrlen += optlen; udp = rack->r_ctl.fsb.udp; + if (udp) + hdrlen += sizeof(struct udphdr); if (rack->r_ctl.rc_pace_max_segs) max_val = rack->r_ctl.rc_pace_max_segs; else if (rack->rc_user_set_max_segs) From owner-dev-commits-src-all@freebsd.org Fri May 7 18:26:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54510637EF1 for ; Fri, 7 May 2021 18:26:50 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcJnQ1RzBz3CZ2 for ; Fri, 7 May 2021 18:26:50 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72d.google.com with SMTP id o27so9425597qkj.9 for ; Fri, 07 May 2021 11:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Wx2J9lZbvyil11aXmUljDYAfXeC7cjj8whhiKZL9dzQ=; b=yvr8Y6zMqAdMVhRO9Astbi9P6Fvz57IF3AZDyuROLzcn3yhzXfnI1D9s9aBXZD0PcN XwwM9GOUFbtpFSLWn16BmxdxGT0r5YIiS5JzhB/s4+6nJy309oObejDyZrFdbNxVthky lBGDGIkd6M1s2LUVSYV+xxw47hDdHvzCy84+KMVdjND4eJg9HsXv5sh9KZ6fdzq60rbJ w7xoq5wmginZ//5s/cpFNxbvhLVywS8uBIUmafEBpVfzkbsuSyUP29pAY+UCv2mj2u8D 6zvJTGjn6KYGH5RhSZJZytPeU6dL6cIBndukxBlC5QzI6scYWqKjT+Vk/yodYaCNquHr b80A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Wx2J9lZbvyil11aXmUljDYAfXeC7cjj8whhiKZL9dzQ=; b=Uv9Q22ERBlz8Rp/+lFBbfhkJiOZs5hpQ8CKK2C+FjPa5bUuOn6FMc8e3rJIYSNoZ0m HQJSROjBYCOy/ar4i1tobeHkAHJmr4GQx6sh7IzBntJEq8DU07yoTKpfqCclB1Sb7okr EigX0UnTeaO/uAdl/WX9vLG0JMJdiZeUoOUD+RzSl0Lwht1KC39FOe+h7p786OeeQpGY Kak4GFtvc0jIiRvFN3QB0yuP9vKidbgL92YxOtZZv4uW4hUHMWGmPf3bXxjPZRb8qEdg CNuxfh/5uKhZu/1wiQ5i6sTSr9GaHGRsrGloQos1n1EkLpk9jyPYYtdX7m6iFdXtuTSR 1lBA== X-Gm-Message-State: AOAM532P8OjRLy6dQVIOX7NnQ1nUNVUSsAteMwbAXFtnH9C722yjpWx/ 0RfAFiXfHWI6DPZ9rOVrUbbLRncuK+s0r+xcMa1+4Q== X-Google-Smtp-Source: ABdhPJxojc4lHIhtsqS5CP0vImWjKzNS72dGiW1RFG1gWMNKxSpSJ2qn6g4YHChmpGK3W4nz6WvZ/lGkCSs10Y7u1sw= X-Received: by 2002:a37:c444:: with SMTP id h4mr8411376qkm.206.1620412009164; Fri, 07 May 2021 11:26:49 -0700 (PDT) MIME-Version: 1.0 References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> <78FF7B31-B84D-4D97-9E57-D000A6B09D7D@macmic.franken.de> In-Reply-To: <78FF7B31-B84D-4D97-9E57-D000A6B09D7D@macmic.franken.de> From: Warner Losh Date: Fri, 7 May 2021 12:26:37 -0600 Message-ID: Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. To: Michael Tuexen Cc: Gordon Bergling , Li-Wen Hsu , Randall Stewart , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4FcJnQ1RzBz3CZ2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 18:26:50 -0000 https://reviews.freebsd.org/D30163 May be the ticket to solve this... Warner On Fri, May 7, 2021, 12:03 PM Michael Tuexen < michael.tuexen@macmic.franken.de> wrote: > > On 7. May 2021, at 19:47, Gordon Bergling wrote: > > > > On Fri, May 07, 2021 at 05:39:37PM +0800, Li-Wen Hsu wrote: > >> On Thu, May 6, 2021 at 11:26 PM Randall Stewart > wrote: > >>> > >>> The branch main has been updated by rrs: > >>> > >>> URL: > https://cgit.FreeBSD.org/src/commit/?id=5d8fd932e418f03e98b3469c4088a36f0ef34ffe > >>> > >>> commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe > >>> Author: Randall Stewart > >>> AuthorDate: 2021-05-06 15:22:26 +0000 > >>> Commit: Randall Stewart > >>> CommitDate: 2021-05-06 15:22:26 +0000 > >>> > >>> This brings into sync FreeBSD with the netflix versions of rack and > bbr. > >>> This fixes several breakages (panics) since the tcp_lro code was > >>> committed that have been reported. Quite a few new features are > >>> now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the > >>> largest). There is also support for ack-war prevention. Documents > >>> comming soon on rack.. > >>> > >>> Sponsored by: Netflix > >>> Reviewed by: rscheff, mtuexen > >>> Differential Revision: https://reviews.freebsd.org/D30036 > >> > >> This seems braking LINT kernel build of powerpc: > >> > >> https://ci.freebsd.org/job/FreeBSD-main-powerpc-LINT/6082/console > >> > >> Searching "error:" leads to: > >> > >> 00:08:15.153 > /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2143:16: > >> error: implicit declaration of function 'tcp_hw_highest_rate' is > >> invalid in C99 [-Werror,-Wimplicit-function-declaration] > >> 00:08:15.153 high_rate = > >> tcp_hw_highest_rate(rack->r_ctl.crte); > >> 00:08:15.153 ^ > >> > >> and > >> > >> 00:08:15.163 > /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2165:16: > >> error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is > >> invalid in C99 [-Werror,-Wimplicit-function-declaration] > >> 00:08:15.163 high_rate = > >> tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > >> rack->rc_inp); > >> 00:08:15.163 ^ > >> > >> I suspect this is because RATELIMIT is not defined in default powerpc > >> build? Is it safe to enable it? > >> > >> Best, > >> Li-Wen > > > > That should not be something RATELIMT related. I regular test 14-CURRENT > on a > > RPi4B and the build today fails with > > > > -------------------------------------------------------------- > >>>> stage 3.1: building everything > > -------------------------------------------------------------- > > > /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2143:16: > error: implicit declaration of function 'tcp_hw_highest_rate' is invalid in > C99 [-Werror,-Wimplicit-function-declaration] > > high_rate = tcp_hw_highest_rate(rack->r_ctl.crte); > > ^ > > > /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2165:16: > error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is > invalid in C99 [-Werror,-Wimplicit-function-declaration] > > high_rate = > tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > rack->rc_inp); > > ^ > > > /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:14166:15: > error: implicit declaration of function 'tcp_hw_highest_rate' is invalid in > C99 [-Werror,-Wimplicit-function-declaration] > > high_rate = tcp_hw_highest_rate(rack->r_ctl.crte); > > ^ > > > /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:14193:15: > error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is > invalid in C99 [-Werror,-Wimplicit-function-declaration] > > high_rate = > tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > rack->rc_inp); > > ^ > > 4 errors generated. > > --- rack.o --- > > *** [rack.o] Error code 1 > > > > > > RATELIMIT is included in my KERNCONF since I use tcp_bbr(4) for a > > while on the RPi4B now. > Can you post the kernel config you are using? I'm building the kernel on > an arm64 platform by using > > tuexen@parallels:~/freebsd-src/sys/arm64/conf % cat SCTP > include GENERIC > ident SCTP > > makeoptions WITH_EXTRA_TCP_STACKS=1 > options SCTP > options SCTP_DEBUG > options TCPHPTS > options TCP_BLACKBOX > options RATELIMIT > options DEBUG_REDZONE > options IPFIREWALL > options IPFIREWALL_VERBOSE > options IPFIREWALL_VERBOSE_LIMIT=5 > options IPFIREWALL_DEFAULT_TO_ACCEPT > > It looks like RATELIMIT is not defined, when tcp_ratelimit.h is included... > > Best regards > Michael > > > --Gordon > > From owner-dev-commits-src-all@freebsd.org Fri May 7 18:33:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CD91638816; Fri, 7 May 2021 18:33:37 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcJxF44cKz3D8W; Fri, 7 May 2021 18:33:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7F4E1106BD; Fri, 7 May 2021 18:33:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147IXb2A079014; Fri, 7 May 2021 18:33:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147IXb5s079013; Fri, 7 May 2021 18:33:37 GMT (envelope-from git) Date: Fri, 7 May 2021 18:33:37 GMT Message-Id: <202105071833.147IXb5s079013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 6a8ed85f487c - main - devd.conf: Typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6a8ed85f487c6fd109897235c60f710948bd5150 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 18:33:37 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6a8ed85f487c6fd109897235c60f710948bd5150 commit 6a8ed85f487c6fd109897235c60f710948bd5150 Author: Ceri Davies AuthorDate: 2021-05-07 18:31:02 +0000 Commit: Mark Johnston CommitDate: 2021-05-07 18:31:02 +0000 devd.conf: Typo PR: 255051 MFC after: 3 days --- sbin/devd/devd.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/devd/devd.conf b/sbin/devd/devd.conf index dba7d41402d7..db459a7b6e50 100644 --- a/sbin/devd/devd.conf +++ b/sbin/devd/devd.conf @@ -33,7 +33,7 @@ options { # # Configure the interface on attach. Due to a historical accident, this # script is called pccard_ether. We omit the usbus devices because those -# devices are assocaited with the USB Bus and provide an ifnet device to +# devices are associated with the USB Bus and provide an ifnet device to # allow usb traffic to be captured with usbdump(8). # # NB: DETACH events are ignored; the kernel should handle all cleanup From owner-dev-commits-src-all@freebsd.org Fri May 7 18:33:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF022638644; Fri, 7 May 2021 18:33:38 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcJxG54ctz3CxM; Fri, 7 May 2021 18:33:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A1961106BE; Fri, 7 May 2021 18:33:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147IXc6v079042; Fri, 7 May 2021 18:33:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147IXcpx079041; Fri, 7 May 2021 18:33:38 GMT (envelope-from git) Date: Fri, 7 May 2021 18:33:38 GMT Message-Id: <202105071833.147IXcpx079041@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 1a212abd54c0 - main - devd.conf: Remove support for coldsync MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a212abd54c0e4323f11e3bc2fd94ca26f7e5329 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 18:33:38 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1a212abd54c0e4323f11e3bc2fd94ca26f7e5329 commit 1a212abd54c0e4323f11e3bc2fd94ca26f7e5329 Author: Ceri Davies AuthorDate: 2021-05-07 18:19:34 +0000 Commit: Mark Johnston CommitDate: 2021-05-07 18:31:08 +0000 devd.conf: Remove support for coldsync The coldsync port was removed in 2012. The last stable release of coldsync was issued in 2002. Let's get rid of it. PR: 255051 Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30100 --- sbin/devd/devd.conf | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/sbin/devd/devd.conf b/sbin/devd/devd.conf index db459a7b6e50..9d23b77fe96a 100644 --- a/sbin/devd/devd.conf +++ b/sbin/devd/devd.conf @@ -155,19 +155,6 @@ notify 100 { action "service moused stop $cdev"; }; -# This entry starts the ColdSync tool in daemon mode. Make sure you have an up -# to date /usr/local/etc/palms. We override the 'listen' settings for port and -# type in /usr/local/etc/coldsync.conf. -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x082d"; - match "product" "0x0100"; - match "release" "0x0100"; - action "/usr/local/bin/coldsync -md -p /dev/$cdev -t usb"; -}; - # # Rescan SCSI device-names on attach, but not detach. However, it is # disabled by default due to reports of problems. From owner-dev-commits-src-all@freebsd.org Fri May 7 18:33:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BD46638647; Fri, 7 May 2021 18:33:40 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcJxH755rz3Ckh; Fri, 7 May 2021 18:33:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C632E10897; Fri, 7 May 2021 18:33:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147IXd6j079063; Fri, 7 May 2021 18:33:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147IXdYx079062; Fri, 7 May 2021 18:33:39 GMT (envelope-from git) Date: Fri, 7 May 2021 18:33:39 GMT Message-Id: <202105071833.147IXdYx079062@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 2d499d505262 - main - linker_set: Disable ASAN only in userspace MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d499d505262c9c965fc5f4fd36afdd2bb7cad3d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 18:33:40 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2d499d505262c9c965fc5f4fd36afdd2bb7cad3d commit 2d499d505262c9c965fc5f4fd36afdd2bb7cad3d Author: Mark Johnston AuthorDate: 2021-05-07 18:24:37 +0000 Commit: Mark Johnston CommitDate: 2021-05-07 18:31:08 +0000 linker_set: Disable ASAN only in userspace KASAN does not insert redzones around global variables and so is not susceptible to the problem that led to us disabling ASAN for linker set elements in the first place (see commit fe3d8086fb6f). Reviewed by: andrew, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30126 --- sys/sys/linker_set.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/sys/linker_set.h b/sys/sys/linker_set.h index f957858ada04..7c12ae215018 100644 --- a/sys/sys/linker_set.h +++ b/sys/sys/linker_set.h @@ -59,12 +59,23 @@ * Private macros, not to be used outside this header file. */ #ifdef __GNUCLIKE___SECTION + +/* + * The userspace address sanitizer inserts redzones around global variables, + * violating the assumption that linker set elements are packed. + */ +#ifdef _KERNEL +#define __NOASAN +#else +#define __NOASAN __nosanitizeaddress +#endif + #define __MAKE_SET_QV(set, sym, qv) \ __WEAK(__CONCAT(__start_set_,set)); \ __WEAK(__CONCAT(__stop_set_,set)); \ static void const * qv \ + __NOASAN \ __set_##set##_sym_##sym __section("set_" #set) \ - __nosanitizeaddress \ __used = &(sym) #define __MAKE_SET(set, sym) __MAKE_SET_QV(set, sym, __MAKE_SET_CONST) #else /* !__GNUCLIKE___SECTION */ From owner-dev-commits-src-all@freebsd.org Fri May 7 18:33:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F6186386AE; Fri, 7 May 2021 18:33:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcJxK0dnKz3CxT; Fri, 7 May 2021 18:33:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DEF8010912; Fri, 7 May 2021 18:33:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147IXeqU079084; Fri, 7 May 2021 18:33:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147IXeZi079083; Fri, 7 May 2021 18:33:40 GMT (envelope-from git) Date: Fri, 7 May 2021 18:33:40 GMT Message-Id: <202105071833.147IXeZi079083@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: cfad8bd24f03 - main - cdefs: Make __nosanitizeaddress work for KASAN as well MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cfad8bd24f038e4779e937f48b05511f2dd4a5a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 18:33:41 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cfad8bd24f038e4779e937f48b05511f2dd4a5a8 commit cfad8bd24f038e4779e937f48b05511f2dd4a5a8 Author: Mark Johnston AuthorDate: 2021-05-07 18:26:28 +0000 Commit: Mark Johnston CommitDate: 2021-05-07 18:31:08 +0000 cdefs: Make __nosanitizeaddress work for KASAN as well Add __nosanitizememory while I'm here. Reviewed by: andrew, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30126 --- sys/sys/cdefs.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index f8e31c25bdb5..6c9d219a7885 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -873,12 +873,18 @@ #define __no_lock_analysis __lock_annotate(no_thread_safety_analysis) /* - * Function or variable should not be sanitized, i.e. by AddressSanitizer. + * Function or variable should not be sanitized, e.g., by AddressSanitizer. * GCC has the nosanitize attribute, but as a function attribute only, and * warns on use as a variable attribute. */ #if __has_attribute(no_sanitize) && defined(__clang__) +#ifdef _KERNEL +#define __nosanitizeaddress __attribute__((no_sanitize("kernel-address"))) +#define __nosanitizememory __attribute__((no_sanitize("kernel-memory"))) +#else #define __nosanitizeaddress __attribute__((no_sanitize("address"))) +#define __nosanitizememory __attribute__((no_sanitize("memory"))) +#endif #define __nosanitizethread __attribute__((no_sanitize("thread"))) #else #define __nosanitizeaddress From owner-dev-commits-src-all@freebsd.org Fri May 7 18:33:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CDE56384CB; Fri, 7 May 2021 18:33:42 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcJxL15rgz3D7H; Fri, 7 May 2021 18:33:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 13F14106BF; Fri, 7 May 2021 18:33:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147IXfG6079105; Fri, 7 May 2021 18:33:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147IXfBQ079104; Fri, 7 May 2021 18:33:41 GMT (envelope-from git) Date: Fri, 7 May 2021 18:33:41 GMT Message-Id: <202105071833.147IXfBQ079104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 831850d8b087 - main - stack(9): Disable KASAN in stack_capture() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 831850d8b0870c75c21d2e01527af1e55fe2fec8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 18:33:42 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=831850d8b0870c75c21d2e01527af1e55fe2fec8 commit 831850d8b0870c75c21d2e01527af1e55fe2fec8 Author: Mark Johnston AuthorDate: 2021-05-07 18:20:53 +0000 Commit: Mark Johnston CommitDate: 2021-05-07 18:31:08 +0000 stack(9): Disable KASAN in stack_capture() When unwinding the stack, we may encounter a stack frame in a poisoned region of the stack, triggering a false positive. Reviewed by: andrew, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30126 --- sys/x86/x86/stack_machdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/x86/x86/stack_machdep.c b/sys/x86/x86/stack_machdep.c index 6e16fc1669ff..0e4bf1bf2930 100644 --- a/sys/x86/x86/stack_machdep.c +++ b/sys/x86/x86/stack_machdep.c @@ -70,7 +70,7 @@ static struct mtx intr_lock; MTX_SYSINIT(intr_lock, &intr_lock, "stack intr", MTX_DEF); #endif -static void +static void __nosanitizeaddress stack_capture(struct thread *td, struct stack *st, register_t fp) { x86_frame_t frame; From owner-dev-commits-src-all@freebsd.org Fri May 7 18:33:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BD0863864C; Fri, 7 May 2021 18:33:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcJxM2ynYz3DCd; Fri, 7 May 2021 18:33:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3E580104DD; Fri, 7 May 2021 18:33:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147IXhjK079126; Fri, 7 May 2021 18:33:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147IXhFV079125; Fri, 7 May 2021 18:33:43 GMT (envelope-from git) Date: Fri, 7 May 2021 18:33:43 GMT Message-Id: <202105071833.147IXhFV079125@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a1fadf7de25b - main - divert: Fix mbuf ownership confusion in div_output() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1fadf7de25b973a308b86d04c4ada4fa8be193f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 18:33:43 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a1fadf7de25b973a308b86d04c4ada4fa8be193f commit a1fadf7de25b973a308b86d04c4ada4fa8be193f Author: Mark Johnston AuthorDate: 2021-05-07 18:27:58 +0000 Commit: Mark Johnston CommitDate: 2021-05-07 18:31:08 +0000 divert: Fix mbuf ownership confusion in div_output() div_output_outbound() and div_output_inbound() relied on the caller to free the mbuf if an error occurred. However, this is contrary to the semantics of their callees, ip_output(), ip6_output() and netisr_queue_src(), which always consume the mbuf. So, if one of these functions returned an error, that would get propagated up to div_output(), resulting in a double free. Fix the problem by making div_output_outbound() and div_output_inbound() responsible for freeing the mbuf in all cases. Reported by: Michael Schmiedgen Tested by: Michael Schmiedgen Reviewed by: donner MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30129 --- sys/netinet/ip_divert.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 65974051ad1f..f83a42cb36c9 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -415,17 +415,13 @@ div_output(struct socket *so, struct mbuf *m, struct sockaddr_in *sin, } NET_EPOCH_EXIT(et); - if (error != 0) - m_freem(m); - return (error); } /* * Sends mbuf @m to the wire via ip[6]_output(). * - * Returns 0 on success, @m is consumed. - * On failure, returns error code. It is caller responsibility to free @m. + * Returns 0 on success or an errno value on failure. @m is always consumed. */ static int div_output_outbound(int family, struct socket *so, struct mbuf *m) @@ -448,6 +444,7 @@ div_output_outbound(int family, struct socket *so, struct mbuf *m) inp->inp_options != NULL) || ((u_short)ntohs(ip->ip_len) > m->m_pkthdr.len)) { INP_RUNLOCK(inp); + m_freem(m); return (EINVAL); } break; @@ -459,6 +456,7 @@ div_output_outbound(int family, struct socket *so, struct mbuf *m) /* Don't allow packet length sizes that will crash */ if (((u_short)ntohs(ip6->ip6_plen) > m->m_pkthdr.len)) { INP_RUNLOCK(inp); + m_freem(m); return (EINVAL); } break; @@ -498,6 +496,7 @@ div_output_outbound(int family, struct socket *so, struct mbuf *m) options = m_dup(inp->inp_options, M_NOWAIT); if (options == NULL) { INP_RUNLOCK(inp); + m_freem(m); return (ENOBUFS); } } @@ -525,8 +524,7 @@ div_output_outbound(int family, struct socket *so, struct mbuf *m) /* * Schedules mbuf @m for local processing via IPv4/IPv6 netisr queue. * - * Returns 0 on success, @m is consumed. - * Returns error code on failure. It is caller responsibility to free @m. + * Returns 0 on success or an errno value on failure. @m is always consumed. */ static int div_output_inbound(int family, struct socket *so, struct mbuf *m, @@ -546,8 +544,10 @@ div_output_inbound(int family, struct socket *so, struct mbuf *m, bzero(sin->sin_zero, sizeof(sin->sin_zero)); sin->sin_port = 0; ifa = ifa_ifwithaddr((struct sockaddr *) sin); - if (ifa == NULL) + if (ifa == NULL) { + m_freem(m); return (EADDRNOTAVAIL); + } m->m_pkthdr.rcvif = ifa->ifa_ifp; } #ifdef MAC @@ -573,6 +573,7 @@ div_output_inbound(int family, struct socket *so, struct mbuf *m, break; #endif default: + m_freem(m); return (EINVAL); } From owner-dev-commits-src-all@freebsd.org Fri May 7 18:38:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43160638C76; Fri, 7 May 2021 18:38:28 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcK2r0bCBz3DMV; Fri, 7 May 2021 18:38:27 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from smtpclient.apple (unknown [IPv6:2a02:8109:1140:c3d:7c86:1978:3046:7dff]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id AA60171E3FEFE; Fri, 7 May 2021 20:38:24 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. From: Michael Tuexen In-Reply-To: Date: Fri, 7 May 2021 20:38:24 +0200 Cc: Gordon Bergling , Li-Wen Hsu , Randall Stewart , src-committers , "" , dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <504C85E6-8967-40CC-8E12-F20F78B3226F@macmic.franken.de> References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> <78FF7B31-B84D-4D97-9E57-D000A6B09D7D@macmic.franken.de> To: Warner Losh X-Mailer: Apple Mail (2.3654.80.0.2.43) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4FcK2r0bCBz3DMV X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 18:38:28 -0000 > On 7. May 2021, at 20:26, Warner Losh wrote: >=20 > https://reviews.freebsd.org/D30163 >=20 > May be the ticket to solve this... I don't understand that. RACK should just compile fine when RATELIMIT is = defined in the kernel config. Gordon states that this is the case for him. Whu do you think that D30163 is needed to compile RACK on a platform = where RATELIMIT is in the kernel config? Best regards Michael >=20 > Warner=20 >=20 > On Fri, May 7, 2021, 12:03 PM Michael Tuexen = wrote: > > On 7. May 2021, at 19:47, Gordon Bergling wrote: > >=20 > > On Fri, May 07, 2021 at 05:39:37PM +0800, Li-Wen Hsu wrote: > >> On Thu, May 6, 2021 at 11:26 PM Randall Stewart = wrote: > >>>=20 > >>> The branch main has been updated by rrs: > >>>=20 > >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D5d8fd932e418f03e98b3469c4088a36f= 0ef34ffe > >>>=20 > >>> commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe > >>> Author: Randall Stewart > >>> AuthorDate: 2021-05-06 15:22:26 +0000 > >>> Commit: Randall Stewart > >>> CommitDate: 2021-05-06 15:22:26 +0000 > >>>=20 > >>> This brings into sync FreeBSD with the netflix versions of rack = and bbr. > >>> This fixes several breakages (panics) since the tcp_lro code = was > >>> committed that have been reported. Quite a few new features are > >>> now in rack (prefecting of DGP -- Dynamic Goodput Pacing among = the > >>> largest). There is also support for ack-war prevention. = Documents > >>> comming soon on rack.. > >>>=20 > >>> Sponsored by: Netflix > >>> Reviewed by: rscheff, mtuexen > >>> Differential Revision: https://reviews.freebsd.org/D30036 > >>=20 > >> This seems braking LINT kernel build of powerpc: > >>=20 > >> https://ci.freebsd.org/job/FreeBSD-main-powerpc-LINT/6082/console > >>=20 > >> Searching "error:" leads to: > >>=20 > >> 00:08:15.153 = /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:214= 3:16: > >> error: implicit declaration of function 'tcp_hw_highest_rate' is > >> invalid in C99 [-Werror,-Wimplicit-function-declaration] > >> 00:08:15.153 high_rate =3D > >> tcp_hw_highest_rate(rack->r_ctl.crte); > >> 00:08:15.153 ^ > >>=20 > >> and > >>=20 > >> 00:08:15.163 = /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:216= 5:16: > >> error: implicit declaration of function 'tcp_hw_highest_rate_ifp' = is > >> invalid in C99 [-Werror,-Wimplicit-function-declaration] > >> 00:08:15.163 high_rate =3D > >> tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > >> rack->rc_inp); > >> 00:08:15.163 ^ > >>=20 > >> I suspect this is because RATELIMIT is not defined in default = powerpc > >> build? Is it safe to enable it? > >>=20 > >> Best, > >> Li-Wen > >=20 > > That should not be something RATELIMT related. I regular test = 14-CURRENT on a > > RPi4B and the build today fails with > >=20 > > -------------------------------------------------------------- > >>>> stage 3.1: building everything > > -------------------------------------------------------------- > > = /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks= /rack.c:2143:16: error: implicit declaration of function = 'tcp_hw_highest_rate' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > > high_rate =3D = tcp_hw_highest_rate(rack->r_ctl.crte); > > ^ > > = /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks= /rack.c:2165:16: error: implicit declaration of function = 'tcp_hw_highest_rate_ifp' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > > high_rate =3D = tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, = rack->rc_inp); > > ^ > > = /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks= /rack.c:14166:15: error: implicit declaration of function = 'tcp_hw_highest_rate' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > > high_rate =3D tcp_hw_highest_rate(rack->r_ctl.crte); > > ^ > > = /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks= /rack.c:14193:15: error: implicit declaration of function = 'tcp_hw_highest_rate_ifp' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > > high_rate =3D = tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, = rack->rc_inp); > > ^ > > 4 errors generated. > > --- rack.o --- > > *** [rack.o] Error code 1 > >=20 > >=20 > > RATELIMIT is included in my KERNCONF since I use tcp_bbr(4) for a > > while on the RPi4B now. > Can you post the kernel config you are using? I'm building the kernel = on an arm64 platform by using >=20 > tuexen@parallels:~/freebsd-src/sys/arm64/conf % cat SCTP=20 > include GENERIC > ident SCTP =20 >=20 > makeoptions WITH_EXTRA_TCP_STACKS=3D1 > options SCTP > options SCTP_DEBUG > options TCPHPTS > options TCP_BLACKBOX > options RATELIMIT > options DEBUG_REDZONE > options IPFIREWALL > options IPFIREWALL_VERBOSE > options IPFIREWALL_VERBOSE_LIMIT=3D5 > options IPFIREWALL_DEFAULT_TO_ACCEPT >=20 > It looks like RATELIMIT is not defined, when tcp_ratelimit.h is = included... >=20 > Best regards > Michael >=20 > > --Gordon >=20 From owner-dev-commits-src-all@freebsd.org Fri May 7 19:50:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 139B863A4B3; Fri, 7 May 2021 19:50:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcLfC02Psz3HX9; Fri, 7 May 2021 19:50:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E828D1188D; Fri, 7 May 2021 19:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147Jogsl080913; Fri, 7 May 2021 19:50:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147Jogv4080912; Fri, 7 May 2021 19:50:42 GMT (envelope-from git) Date: Fri, 7 May 2021 19:50:42 GMT Message-Id: <202105071950.147Jogv4080912@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Maxim Konovalov Subject: git: f0c914baacc7 - main - Releases history update MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: maxim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0c914baacc7f0eefe9ff47ed04aeb500b7bdcd5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 19:50:43 -0000 The branch main has been updated by maxim: URL: https://cgit.FreeBSD.org/src/commit/?id=f0c914baacc7f0eefe9ff47ed04aeb500b7bdcd5 commit f0c914baacc7f0eefe9ff47ed04aeb500b7bdcd5 Author: Maxim Konovalov AuthorDate: 2021-05-07 19:50:10 +0000 Commit: Maxim Konovalov CommitDate: 2021-05-07 19:50:10 +0000 Releases history update Add DragonFly 5.8.1, OpenBSD 6.7, FreeBSD 11.4, DragonFly 5.8.2, DragonFly 5.8.3, OpenBSD 6.8, NetBSD 9.1, FreeBSD 13.0, OpenBSD 6.9. --- share/misc/bsd-family-tree | 47 +++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/share/misc/bsd-family-tree b/share/misc/bsd-family-tree index 8131ad9c6db7..e9eeae85f6bf 100644 --- a/share/misc/bsd-family-tree +++ b/share/misc/bsd-family-tree @@ -266,7 +266,7 @@ FreeBSD 5.2 | | | | | | | Mac OS X | `--------. | | | | | 10.8 | | | | | | | | *--NetBSD | | | - | | | | | 6.0 | | | + | | | | | 6.0 | | | | | | | | | | | OpenBSD 5.2 DragonFly 3.2.1 | FreeBSD | | | | | NetBSD | | | 9.1 | | | | | 5.2 | | @@ -402,19 +402,31 @@ FreeBSD 5.2 | | | | | | | | | | | DragonFly 5.6.1 | | FreeBSD macOS | | | | | | 11.3 10.15 | | | | - | FreeBSD | | | OpenBSD 6.6 | - | 12.1 macOS | `-------. | | - | | 10.15.1 | | | DragonFly 5.6.2 - | | | *--NetBSD | | | - | v | | 9.0 | | | - | FreeBSD | | | | | - | 12.2 | | | | DragonFly 5.8 - | | | | | | | - | | | | | | DragonFly 5.6.3 - | v | | NetBSD | | - | | | 8.2 | | + | FreeBSD | | | | OpenBSD 6.6 | + | 12.1 | macOS | `-------. | | + | | | 10.15.1 | | | DragonFly 5.6.2 + | | | | *--NetBSD | | | + | | | | | 9.0 | | | + | | | | | | | | | + | | | | | | | | DragonFly 5.8 + | | | | | | | | | + | | | | | | | | DragonFly 5.6.3 + | | | | | | NetBSD | | + | | | | | | 8.2 | | + | | | | | | | DragonFly 5.8.1 + | | | | | | OpenBSD 6.7 | + | | FreeBSD | | | | | + | | 11.4 | | | | | + | | | | | | DragonFly 5.8.2 + | | | | | | DragonFly 5.8.3 + | | | | NetBSD 9.1 OpenBSD 6.8 | + | FreeBSD | | | | + | 12.2 | | | | | | | | | -FreeBSD 13 -current | NetBSD -current OpenBSD -current DragonFly -current + *--FreeBSD | | | | + | 13.0 | | OpenBSD 6.9 | + | | | | | +FreeBSD 14 -current | NetBSD -current OpenBSD -current DragonFly -current | | | | | v v v v v @@ -810,7 +822,16 @@ NetBSD 9.0 2020-02-14 [NBD] DragonFly 5.8 2020-03-03 [DFB] DragonFly 5.6.3 2020-03-11 [DFB] NetBSD 8.2 2020-03-31 [NBD] +DragonFly 5.8.1 2020-05-06 [DFB] +OpenBSD 6.7 2020-05-19 [OBD] +FreeBSD 11.4 2020-06-16 [FBD] +DragonFly 5.8.2 2020-09-23 [DFB] +DragonFly 5.8.3 2020-09-24 [DFB] +OpenBSD 6.8 2020-10-18 [OBD] +NetBSD 9.1 2020-10-18 [NBD] FreeBSD 12.2 2020-10-27 [FBD] +FreeBSD 13.0 2021-04-13 [FBD] +OpenBSD 6.9 2021-05-01 [OBD] Bibliography ------------------------ From owner-dev-commits-src-all@freebsd.org Fri May 7 20:13:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8552F63AEE3; Fri, 7 May 2021 20:13:54 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcM8y3Qqkz3J9X; Fri, 7 May 2021 20:13:54 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 689AB11D28; Fri, 7 May 2021 20:13:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147KDsEB012682; Fri, 7 May 2021 20:13:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147KDssT012681; Fri, 7 May 2021 20:13:54 GMT (envelope-from git) Date: Fri, 7 May 2021 20:13:54 GMT Message-Id: <202105072013.147KDssT012681@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: cc948296e632 - main - pfctl: Optionally show gateway information for states MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc948296e632e023f9374ccee68b5710f2ad54a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 20:13:54 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=cc948296e632e023f9374ccee68b5710f2ad54a9 commit cc948296e632e023f9374ccee68b5710f2ad54a9 Author: Kristof Provost AuthorDate: 2021-04-28 16:17:40 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 20:13:30 +0000 pfctl: Optionally show gateway information for states When showing the states, in very verbose mode, also display the gateway (i.e. the target for route-to/reply-to). Submitted by: Steven Brown Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30051 --- sbin/pfctl/pf_print_state.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index 810c773f1019..e2f9d6efe609 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -354,6 +354,8 @@ print_state(struct pfsync_state *s, int opts) bcopy(&s->id, &id, sizeof(u_int64_t)); printf(" id: %016jx creatorid: %08x", (uintmax_t )be64toh(id), ntohl(s->creatorid)); + printf(" gateway: "); + print_host(&s->rt_addr, 0, s->af, opts); printf("\n"); } } From owner-dev-commits-src-all@freebsd.org Fri May 7 20:13:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3D3763AF03; Fri, 7 May 2021 20:13:55 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcM8z4Bj9z3JZb; Fri, 7 May 2021 20:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8199F11AFD; Fri, 7 May 2021 20:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147KDtkw012703; Fri, 7 May 2021 20:13:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147KDt8p012702; Fri, 7 May 2021 20:13:55 GMT (envelope-from git) Date: Fri, 7 May 2021 20:13:55 GMT Message-Id: <202105072013.147KDt8p012702@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 7606a45dcc87 - main - pf: Introduce DIOCCLRSTATESNV MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7606a45dcc87cb6b222af929dad37b615cb925cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 20:13:55 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7606a45dcc87cb6b222af929dad37b615cb925cf commit 7606a45dcc87cb6b222af929dad37b615cb925cf Author: Kristof Provost AuthorDate: 2021-04-29 09:07:02 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 20:13:30 +0000 pf: Introduce DIOCCLRSTATESNV Introduce an nvlist variant of DIOCCLRSTATES. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30052 --- sys/net/pfvar.h | 14 ++++ sys/netpfil/pf/pf_ioctl.c | 199 +++++++++++++++++++++++++++++++++++++++------- sys/netpfil/pf/pf_nv.c | 1 + sys/netpfil/pf/pf_nv.h | 5 ++ 4 files changed, 192 insertions(+), 27 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 5261bfe3bfb1..5e36c4bad624 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1074,6 +1074,19 @@ struct pfioc_src_node_kill { u_int psnk_killed; }; +#ifdef _KERNEL +struct pf_kstate_kill { + struct pf_state_cmp psk_pfcmp; + sa_family_t psk_af; + int psk_proto; + struct pf_rule_addr psk_src; + struct pf_rule_addr psk_dst; + char psk_ifname[IFNAMSIZ]; + char psk_label[PF_RULE_LABEL_SIZE]; + u_int psk_killed; +}; +#endif + struct pfioc_state_kill { struct pf_state_cmp psk_pfcmp; sa_family_t psk_af; @@ -1240,6 +1253,7 @@ struct pfioc_iface { #define DIOCGETRULENV _IOWR('D', 7, struct pfioc_nv) /* XXX cut 8 - 17 */ #define DIOCCLRSTATES _IOWR('D', 18, struct pfioc_state_kill) +#define DIOCCLRSTATESNV _IOWR('D', 18, struct pfioc_nv) #define DIOCGETSTATE _IOWR('D', 19, struct pfioc_state) #define DIOCSETSTATUSIF _IOWR('D', 20, struct pfioc_if) #define DIOCGETSTATUS _IOWR('D', 21, struct pf_status) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 4e4f726a5614..77918414df9b 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -200,7 +200,9 @@ struct cdev *pf_dev; /* * XXX - These are new and need to be checked when moveing to a new version */ -static void pf_clear_states(void); +static void pf_clear_all_states(void); +static unsigned int pf_clear_states(const struct pf_kstate_kill *); +static int pf_clearstates_nv(struct pfioc_nv *); static int pf_clear_tables(void); static void pf_clear_srcnodes(struct pf_ksrc_node *); static void pf_kill_srcnodes(struct pfioc_src_node_kill *); @@ -2395,6 +2397,72 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) return (0); } +static int +pf_state_kill_to_kstate_kill(const struct pfioc_state_kill *psk, + struct pf_kstate_kill *kill) +{ + bzero(kill, sizeof(*kill)); + + bcopy(&psk->psk_pfcmp, &kill->psk_pfcmp, sizeof(kill->psk_pfcmp)); + kill->psk_af = psk->psk_af; + kill->psk_proto = psk->psk_proto; + bcopy(&psk->psk_src, &kill->psk_src, sizeof(kill->psk_src)); + bcopy(&psk->psk_dst, &kill->psk_dst, sizeof(kill->psk_dst)); + strlcpy(kill->psk_ifname, psk->psk_ifname, sizeof(kill->psk_ifname)); + strlcpy(kill->psk_label, psk->psk_label, sizeof(kill->psk_label)); + + return (0); +} + +static int +pf_nvstate_cmp_to_state_cmp(const nvlist_t *nvl, struct pf_state_cmp *cmp) +{ + int error = 0; + + bzero(cmp, sizeof(*cmp)); + + PFNV_CHK(pf_nvuint64(nvl, "id", &cmp->id)); + PFNV_CHK(pf_nvuint32(nvl, "creatorid", &cmp->creatorid)); + PFNV_CHK(pf_nvuint8(nvl, "direction", &cmp->direction)); + +errout: + return (error); +} + +static int +pf_nvstate_kill_to_kstate_kill(const nvlist_t *nvl, + struct pf_kstate_kill *kill) +{ + int error = 0; + + bzero(kill, sizeof(*kill)); + + if (! nvlist_exists_nvlist(nvl, "cmp")) + return (EINVAL); + + PFNV_CHK(pf_nvstate_cmp_to_state_cmp(nvlist_get_nvlist(nvl, "cmp"), + &kill->psk_pfcmp)); + PFNV_CHK(pf_nvuint8(nvl, "af", &kill->psk_af)); + PFNV_CHK(pf_nvint(nvl, "proto", &kill->psk_proto)); + + if (! nvlist_exists_nvlist(nvl, "src")) + return (EINVAL); + PFNV_CHK(pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "src"), + &kill->psk_src)); + if (! nvlist_exists_nvlist(nvl, "dst")) + return (EINVAL); + PFNV_CHK(pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "dst"), + &kill->psk_dst)); + + PFNV_CHK(pf_nvstring(nvl, "ifname", kill->psk_ifname, + sizeof(kill->psk_ifname))); + PFNV_CHK(pf_nvstring(nvl, "label", kill->psk_label, + sizeof(kill->psk_label))); + +errout: + return (error); +} + static int pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, uint32_t pool_ticket, const char *anchor, const char *anchor_call, @@ -3305,33 +3373,19 @@ DIOCCHANGERULE_error: } case DIOCCLRSTATES: { - struct pf_state *s; struct pfioc_state_kill *psk = (struct pfioc_state_kill *)addr; - u_int i, killed = 0; + struct pf_kstate_kill kill; - for (i = 0; i <= pf_hashmask; i++) { - struct pf_idhash *ih = &V_pf_idhash[i]; + error = pf_state_kill_to_kstate_kill(psk, &kill); + if (error) + break; -relock_DIOCCLRSTATES: - PF_HASHROW_LOCK(ih); - LIST_FOREACH(s, &ih->states, entry) - if (!psk->psk_ifname[0] || - !strcmp(psk->psk_ifname, - s->kif->pfik_name)) { - /* - * Don't send out individual - * delete messages. - */ - s->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(s, PF_ENTER_LOCKED); - killed++; - goto relock_DIOCCLRSTATES; - } - PF_HASHROW_UNLOCK(ih); - } - psk->psk_killed = killed; - if (V_pfsync_clear_states_ptr != NULL) - V_pfsync_clear_states_ptr(V_pf_status.hostid, psk->psk_ifname); + psk->psk_killed = pf_clear_states(&kill); + break; + } + + case DIOCCLRSTATESNV: { + error = pf_clearstates_nv((struct pfioc_nv *)addr); break; } @@ -5224,7 +5278,7 @@ pf_tbladdr_copyout(struct pf_addr_wrap *aw) * XXX - Check for version missmatch!!! */ static void -pf_clear_states(void) +pf_clear_all_states(void) { struct pf_state *s; u_int i; @@ -5375,6 +5429,97 @@ on_error: return (error); } +static unsigned int +pf_clear_states(const struct pf_kstate_kill *kill) +{ + struct pf_state *s; + unsigned int killed = 0; + + for (unsigned int i = 0; i <= pf_hashmask; i++) { + struct pf_idhash *ih = &V_pf_idhash[i]; + +relock_DIOCCLRSTATES: + PF_HASHROW_LOCK(ih); + LIST_FOREACH(s, &ih->states, entry) + if (!kill->psk_ifname[0] || + !strcmp(kill->psk_ifname, + s->kif->pfik_name)) { + /* + * Don't send out individual + * delete messages. + */ + s->state_flags |= PFSTATE_NOSYNC; + pf_unlink_state(s, PF_ENTER_LOCKED); + killed++; + goto relock_DIOCCLRSTATES; + } + PF_HASHROW_UNLOCK(ih); + } + + if (V_pfsync_clear_states_ptr != NULL) + V_pfsync_clear_states_ptr(V_pf_status.hostid, kill->psk_ifname); + + return (killed); +} + +static int +pf_clearstates_nv(struct pfioc_nv *nv) +{ + struct pf_kstate_kill kill; + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + int error = 0; + unsigned int killed; + +#define ERROUT(x) ERROUT_FUNCTION(on_error, x) + + if (nv->len > pf_ioctl_maxcount) + ERROUT(ENOMEM); + + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + error = copyin(nv->data, nvlpacked, nv->len); + if (error) + ERROUT(error); + + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) + ERROUT(EBADMSG); + + error = pf_nvstate_kill_to_kstate_kill(nvl, &kill); + if (error) + ERROUT(error); + + killed = pf_clear_states(&kill); + + free(nvlpacked, M_TEMP); + nvlpacked = NULL; + nvlist_destroy(nvl); + nvl = nvlist_create(0); + if (nvl == NULL) + ERROUT(ENOMEM); + + nvlist_add_number(nvl, "killed", killed); + + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + if (nv->size == 0) + ERROUT(0); + else if (nv->size < nv->len) + ERROUT(ENOSPC); + + error = copyout(nvlpacked, nv->data, nv->len); + +on_error: + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (error); +} + /* * XXX - Check for version missmatch!!! */ @@ -5434,7 +5579,7 @@ shutdown_pf(void) pf_commit_altq(t[0]); #endif - pf_clear_states(); + pf_clear_all_states(); pf_clear_srcnodes(NULL); diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index 8a2082d3e0bb..1fdb52e5fad0 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -104,6 +104,7 @@ pf_nvbinary(const nvlist_t *nvl, const char *name, void *data, PF_NV_IMPL_UINT(uint8, uint8_t, UINT8_MAX); PF_NV_IMPL_UINT(uint16, uint16_t, UINT16_MAX); PF_NV_IMPL_UINT(uint32, uint32_t, UINT32_MAX); +PF_NV_IMPL_UINT(uint64, uint64_t, UINT64_MAX); int pf_nvint(const nvlist_t *nvl, const char *name, int *val) diff --git a/sys/netpfil/pf/pf_nv.h b/sys/netpfil/pf/pf_nv.h index d50f46a1f5cd..589a1972fa43 100644 --- a/sys/netpfil/pf/pf_nv.h +++ b/sys/netpfil/pf/pf_nv.h @@ -48,6 +48,11 @@ int pf_nvuint32_array(const nvlist_t *, const char *, uint32_t *, size_t, size_t *); void pf_uint32_array_nv(nvlist_t *, const char *, const uint32_t *, size_t); +int pf_nvuint64(const nvlist_t *, const char *, uint64_t *); +int pf_nvuint64_array(const nvlist_t *, const char *, uint64_t *, + size_t, size_t *); +void pf_uint64_array_nv(nvlist_t *, const char *, const uint64_t *, + size_t); int pf_nvstring(const nvlist_t *, const char *, char *, size_t); From owner-dev-commits-src-all@freebsd.org Fri May 7 20:13:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1EDD63AD2A; Fri, 7 May 2021 20:13:56 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcM905fsWz3J9c; Fri, 7 May 2021 20:13:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A91F211A45; Fri, 7 May 2021 20:13:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147KDu01012724; Fri, 7 May 2021 20:13:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147KDuT8012723; Fri, 7 May 2021 20:13:56 GMT (envelope-from git) Date: Fri, 7 May 2021 20:13:56 GMT Message-Id: <202105072013.147KDuT8012723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 53714a586133 - main - pfctl: Start using DIOCCLRSTATESNV MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53714a586133fd8ae662427007f84ec663cd83ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 20:13:57 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=53714a586133fd8ae662427007f84ec663cd83ef commit 53714a586133fd8ae662427007f84ec663cd83ef Author: Kristof Provost AuthorDate: 2021-04-29 13:10:50 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 20:13:30 +0000 pfctl: Start using DIOCCLRSTATESNV MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30053 --- lib/libpfctl/libpfctl.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/libpfctl/libpfctl.h | 18 +++++++++++++++ sbin/pfctl/pfctl.c | 21 +++++++++--------- 3 files changed, 88 insertions(+), 10 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index b07fcda9bd5a..8c8b21d22a46 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -608,3 +608,62 @@ pfctl_set_keepcounters(int dev, bool keep) free(nv.data); return (ret); } + +static void +pfctl_nv_add_state_cmp(nvlist_t *nvl, const char *name, + const struct pfctl_state_cmp *cmp) +{ + nvlist_t *nv; + + nv = nvlist_create(0); + + nvlist_add_number(nv, "id", cmp->id); + nvlist_add_number(nv, "creatorid", cmp->creatorid); + nvlist_add_number(nv, "direction", cmp->direction); + + nvlist_add_nvlist(nvl, name, nv); +} + +int +pfctl_clear_states(int dev, const struct pfctl_kill *kill, + unsigned int *killed) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + int ret; + + nvl = nvlist_create(0); + + pfctl_nv_add_state_cmp(nvl, "cmp", &kill->cmp); + nvlist_add_number(nvl, "af", kill->af); + nvlist_add_number(nvl, "proto", kill->proto); + pfctl_nv_add_rule_addr(nvl, "src", &kill->src); + pfctl_nv_add_rule_addr(nvl, "dst", &kill->dst); + nvlist_add_string(nvl, "ifname", kill->ifname); + nvlist_add_string(nvl, "label", kill->label); + + nv.data = nvlist_pack(nvl, &nv.len); + nv.size = nv.len; + nvlist_destroy(nvl); + nvl = NULL; + + ret = ioctl(dev, DIOCCLRSTATESNV, &nv); + if (ret != 0) { + free(nv.data); + return (ret); + } + + nvl = nvlist_unpack(nv.data, nv.len, 0); + if (nvl == NULL) { + free(nv.data); + return (EIO); + } + + if (killed) + *killed = nvlist_get_number(nvl, "killed"); + + nvlist_destroy(nvl); + free(nv.data); + + return (ret); +} diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index e19187fc2526..3ec2a7fa535f 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -179,6 +179,22 @@ RB_PROTOTYPE(pfctl_anchor_global, pfctl_anchor, entry_global, RB_PROTOTYPE(pfctl_anchor_node, pfctl_anchor, entry_node, pf_anchor_compare); +struct pfctl_state_cmp { + uint64_t id; + uint32_t creatorid; + uint8_t direction; +}; + +struct pfctl_kill { + struct pfctl_state_cmp cmp; + sa_family_t af; + int proto; + struct pf_rule_addr src; + struct pf_rule_addr dst; + char ifname[IFNAMSIZ]; + char label[PF_RULE_LABEL_SIZE]; +}; + int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); @@ -189,5 +205,7 @@ int pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket); int pfctl_set_keepcounters(int dev, bool keep); +int pfctl_clear_states(int dev, const struct pfctl_kill *kill, + unsigned int *killed); #endif diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index af2ae6fe3bf0..2cfca24c0cfa 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -79,7 +79,7 @@ int pfctl_clear_rules(int, int, char *); int pfctl_clear_nat(int, int, char *); int pfctl_clear_altq(int, int); int pfctl_clear_src_nodes(int, int); -int pfctl_clear_states(int, const char *, int); +int pfctl_clear_iface_states(int, const char *, int); void pfctl_addrprefix(char *, struct pf_addr *); int pfctl_kill_src_nodes(int, const char *, int); int pfctl_net_kill_states(int, const char *, int); @@ -467,19 +467,20 @@ pfctl_clear_src_nodes(int dev, int opts) } int -pfctl_clear_states(int dev, const char *iface, int opts) +pfctl_clear_iface_states(int dev, const char *iface, int opts) { - struct pfioc_state_kill psk; + struct pfctl_kill kill; + unsigned int killed; - memset(&psk, 0, sizeof(psk)); - if (iface != NULL && strlcpy(psk.psk_ifname, iface, - sizeof(psk.psk_ifname)) >= sizeof(psk.psk_ifname)) + memset(&kill, 0, sizeof(kill)); + if (iface != NULL && strlcpy(kill.ifname, iface, + sizeof(kill.ifname)) >= sizeof(kill.ifname)) errx(1, "invalid interface: %s", iface); - if (ioctl(dev, DIOCCLRSTATES, &psk)) + if (pfctl_clear_states(dev, &kill, &killed)) err(1, "DIOCCLRSTATES"); if ((opts & PF_OPT_QUIET) == 0) - fprintf(stderr, "%d states cleared\n", psk.psk_killed); + fprintf(stderr, "%d states cleared\n", killed); return (0); } @@ -2417,7 +2418,7 @@ main(int argc, char *argv[]) pfctl_clear_altq(dev, opts); break; case 's': - pfctl_clear_states(dev, ifaceopt, opts); + pfctl_clear_iface_states(dev, ifaceopt, opts); break; case 'S': pfctl_clear_src_nodes(dev, opts); @@ -2431,7 +2432,7 @@ main(int argc, char *argv[]) pfctl_clear_tables(anchorname, opts); if (!*anchorname) { pfctl_clear_altq(dev, opts); - pfctl_clear_states(dev, ifaceopt, opts); + pfctl_clear_iface_states(dev, ifaceopt, opts); pfctl_clear_src_nodes(dev, opts); pfctl_clear_stats(dev, opts); pfctl_clear_fingerprints(dev, opts); From owner-dev-commits-src-all@freebsd.org Fri May 7 20:13:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7979663ACB4; Fri, 7 May 2021 20:13:58 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcM920mfvz3Jjb; Fri, 7 May 2021 20:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D6F6B11DA3; Fri, 7 May 2021 20:13:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147KDvL8012745; Fri, 7 May 2021 20:13:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147KDvuJ012744; Fri, 7 May 2021 20:13:57 GMT (envelope-from git) Date: Fri, 7 May 2021 20:13:57 GMT Message-Id: <202105072013.147KDvuJ012744@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: e989530a09b6 - main - pf: Introduce DIOCKILLSTATESNV MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e989530a09b6e9f77b89c950ecf32f1b4fa709da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 20:13:58 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e989530a09b6e9f77b89c950ecf32f1b4fa709da commit e989530a09b6e9f77b89c950ecf32f1b4fa709da Author: Kristof Provost AuthorDate: 2021-04-29 15:20:36 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 20:13:30 +0000 pf: Introduce DIOCKILLSTATESNV Introduce an nvlist based alternative to DIOCKILLSTATES. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30054 --- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf_ioctl.c | 110 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 96 insertions(+), 15 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 5e36c4bad624..6c044fa8b449 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1270,6 +1270,7 @@ struct pfioc_iface { #define DIOCGETLIMIT _IOWR('D', 39, struct pfioc_limit) #define DIOCSETLIMIT _IOWR('D', 40, struct pfioc_limit) #define DIOCKILLSTATES _IOWR('D', 41, struct pfioc_state_kill) +#define DIOCKILLSTATESNV _IOWR('D', 41, struct pfioc_nv) #define DIOCSTARTALTQ _IO ('D', 42) #define DIOCSTOPALTQ _IO ('D', 43) #define DIOCADDALTQV0 _IOWR('D', 45, struct pfioc_altq_v0) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 77918414df9b..1340d9eec008 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -202,6 +202,11 @@ struct cdev *pf_dev; */ static void pf_clear_all_states(void); static unsigned int pf_clear_states(const struct pf_kstate_kill *); +static int pf_killstates(struct pf_kstate_kill *, + unsigned int *); +static int pf_killstates_row(struct pf_kstate_kill *, + struct pf_idhash *); +static int pf_killstates_nv(struct pfioc_nv *); static int pf_clearstates_nv(struct pfioc_nv *); static int pf_clear_tables(void); static void pf_clear_srcnodes(struct pf_ksrc_node *); @@ -2636,7 +2641,7 @@ pf_label_match(const struct pf_krule *rule, const char *label) } static int -pf_killstates_row(struct pfioc_state_kill *psk, struct pf_idhash *ih) +pf_killstates_row(struct pf_kstate_kill *psk, struct pf_idhash *ih) { struct pf_state *s; struct pf_state_key *sk; @@ -3390,25 +3395,20 @@ DIOCCHANGERULE_error: } case DIOCKILLSTATES: { - struct pf_state *s; struct pfioc_state_kill *psk = (struct pfioc_state_kill *)addr; - u_int i, killed = 0; + struct pf_kstate_kill kill; - if (psk->psk_pfcmp.id) { - if (psk->psk_pfcmp.creatorid == 0) - psk->psk_pfcmp.creatorid = V_pf_status.hostid; - if ((s = pf_find_state_byid(psk->psk_pfcmp.id, - psk->psk_pfcmp.creatorid))) { - pf_unlink_state(s, PF_ENTER_LOCKED); - psk->psk_killed = 1; - } + error = pf_state_kill_to_kstate_kill(psk, &kill); + if (error) break; - } - for (i = 0; i <= pf_hashmask; i++) - killed += pf_killstates_row(psk, &V_pf_idhash[i]); + psk->psk_killed = 0; + error = pf_killstates(&kill, &psk->psk_killed); + break; + } - psk->psk_killed = killed; + case DIOCKILLSTATESNV: { + error = pf_killstates_nv((struct pfioc_nv *)addr); break; } @@ -5462,6 +5462,86 @@ relock_DIOCCLRSTATES: return (killed); } +static int +pf_killstates(struct pf_kstate_kill *kill, unsigned int *killed) +{ + struct pf_state *s; + + if (kill->psk_pfcmp.id) { + if (kill->psk_pfcmp.creatorid == 0) + kill->psk_pfcmp.creatorid = V_pf_status.hostid; + if ((s = pf_find_state_byid(kill->psk_pfcmp.id, + kill->psk_pfcmp.creatorid))) { + pf_unlink_state(s, PF_ENTER_LOCKED); + *killed = 1; + } + return (0); + } + + for (unsigned int i = 0; i <= pf_hashmask; i++) + *killed += pf_killstates_row(kill, &V_pf_idhash[i]); + + return (0); +} + +static int +pf_killstates_nv(struct pfioc_nv *nv) +{ + struct pf_kstate_kill kill; + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + int error = 0; + unsigned int killed = 0; + +#define ERROUT(x) ERROUT_FUNCTION(on_error, x) + + if (nv->len > pf_ioctl_maxcount) + ERROUT(ENOMEM); + + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + error = copyin(nv->data, nvlpacked, nv->len); + if (error) + ERROUT(error); + + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) + ERROUT(EBADMSG); + + error = pf_nvstate_kill_to_kstate_kill(nvl, &kill); + if (error) + ERROUT(error); + + error = pf_killstates(&kill, &killed); + + free(nvlpacked, M_TEMP); + nvlpacked = NULL; + nvlist_destroy(nvl); + nvl = nvlist_create(0); + if (nvl == NULL) + ERROUT(ENOMEM); + + nvlist_add_number(nvl, "killed", killed); + + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + if (nv->size == 0) + ERROUT(0); + else if (nv->size < nv->len) + ERROUT(ENOSPC); + + error = copyout(nvlpacked, nv->data, nv->len); + +on_error: + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (error); +} + static int pf_clearstates_nv(struct pfioc_nv *nv) { From owner-dev-commits-src-all@freebsd.org Fri May 7 20:13:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43CDA63AF81; Fri, 7 May 2021 20:13:59 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcM930j6rz3JpL; Fri, 7 May 2021 20:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F153711BC8; Fri, 7 May 2021 20:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147KDwdZ012766; Fri, 7 May 2021 20:13:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147KDwn2012765; Fri, 7 May 2021 20:13:58 GMT (envelope-from git) Date: Fri, 7 May 2021 20:13:58 GMT Message-Id: <202105072013.147KDwn2012765@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 2a00c4db93b8 - main - pfctl: Start using DIOCKILLSTATESNV MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2a00c4db93b8db0c326a57363ca8a690ef6ab082 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 20:13:59 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2a00c4db93b8db0c326a57363ca8a690ef6ab082 commit 2a00c4db93b8db0c326a57363ca8a690ef6ab082 Author: Kristof Provost AuthorDate: 2021-04-29 19:24:56 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 20:13:31 +0000 pfctl: Start using DIOCKILLSTATESNV MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30055 --- lib/libpfctl/libpfctl.c | 24 ++++++++++--- lib/libpfctl/libpfctl.h | 2 ++ sbin/pfctl/pfctl.c | 91 +++++++++++++++++++++++++------------------------ 3 files changed, 69 insertions(+), 48 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 8c8b21d22a46..9f504237b4ee 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -50,6 +50,9 @@ #include "libpfctl.h" +static int _pfctl_clear_states(int , const struct pfctl_kill *, + unsigned int *, uint64_t); + static void pf_nvuint_8_array(const nvlist_t *nvl, const char *name, size_t maxelems, u_int8_t *numbers, size_t *nelems) @@ -624,9 +627,9 @@ pfctl_nv_add_state_cmp(nvlist_t *nvl, const char *name, nvlist_add_nvlist(nvl, name, nv); } -int -pfctl_clear_states(int dev, const struct pfctl_kill *kill, - unsigned int *killed) +static int +_pfctl_clear_states(int dev, const struct pfctl_kill *kill, + unsigned int *killed, uint64_t ioctlval) { struct pfioc_nv nv; nvlist_t *nvl; @@ -647,7 +650,7 @@ pfctl_clear_states(int dev, const struct pfctl_kill *kill, nvlist_destroy(nvl); nvl = NULL; - ret = ioctl(dev, DIOCCLRSTATESNV, &nv); + ret = ioctl(dev, ioctlval, &nv); if (ret != 0) { free(nv.data); return (ret); @@ -667,3 +670,16 @@ pfctl_clear_states(int dev, const struct pfctl_kill *kill, return (ret); } + +int +pfctl_clear_states(int dev, const struct pfctl_kill *kill, + unsigned int *killed) +{ + return (_pfctl_clear_states(dev, kill, killed, DIOCCLRSTATESNV)); +} + +int +pfctl_kill_states(int dev, const struct pfctl_kill *kill, unsigned int *killed) +{ + return (_pfctl_clear_states(dev, kill, killed, DIOCKILLSTATESNV)); +} diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 3ec2a7fa535f..aa7f0ffd8fad 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -207,5 +207,7 @@ int pfctl_add_rule(int dev, const struct pfctl_rule *r, int pfctl_set_keepcounters(int dev, bool keep); int pfctl_clear_states(int dev, const struct pfctl_kill *kill, unsigned int *killed); +int pfctl_kill_states(int dev, const struct pfctl_kill *kill, + unsigned int *killed); #endif diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 2cfca24c0cfa..487dfb480cdc 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -640,24 +640,25 @@ pfctl_kill_src_nodes(int dev, const char *iface, int opts) int pfctl_net_kill_states(int dev, const char *iface, int opts) { - struct pfioc_state_kill psk; + struct pfctl_kill kill; struct addrinfo *res[2], *resp[2]; struct sockaddr last_src, last_dst; + unsigned int newkilled; int killed, sources, dests; int ret_ga; killed = sources = dests = 0; - memset(&psk, 0, sizeof(psk)); - memset(&psk.psk_src.addr.v.a.mask, 0xff, - sizeof(psk.psk_src.addr.v.a.mask)); + memset(&kill, 0, sizeof(kill)); + memset(&kill.src.addr.v.a.mask, 0xff, + sizeof(kill.src.addr.v.a.mask)); memset(&last_src, 0xff, sizeof(last_src)); memset(&last_dst, 0xff, sizeof(last_dst)); - if (iface != NULL && strlcpy(psk.psk_ifname, iface, - sizeof(psk.psk_ifname)) >= sizeof(psk.psk_ifname)) + if (iface != NULL && strlcpy(kill.ifname, iface, + sizeof(kill.ifname)) >= sizeof(kill.ifname)) errx(1, "invalid interface: %s", iface); - pfctl_addrprefix(state_kill[0], &psk.psk_src.addr.v.a.mask); + pfctl_addrprefix(state_kill[0], &kill.src.addr.v.a.mask); if ((ret_ga = getaddrinfo(state_kill[0], NULL, NULL, &res[0]))) { errx(1, "getaddrinfo: %s", gai_strerror(ret_ga)); @@ -671,26 +672,26 @@ pfctl_net_kill_states(int dev, const char *iface, int opts) continue; last_src = *(struct sockaddr *)resp[0]->ai_addr; - psk.psk_af = resp[0]->ai_family; + kill.af = resp[0]->ai_family; sources++; - if (psk.psk_af == AF_INET) - psk.psk_src.addr.v.a.addr.v4 = + if (kill.af == AF_INET) + kill.src.addr.v.a.addr.v4 = ((struct sockaddr_in *)resp[0]->ai_addr)->sin_addr; - else if (psk.psk_af == AF_INET6) - psk.psk_src.addr.v.a.addr.v6 = + else if (kill.af == AF_INET6) + kill.src.addr.v.a.addr.v6 = ((struct sockaddr_in6 *)resp[0]->ai_addr)-> sin6_addr; else - errx(1, "Unknown address family %d", psk.psk_af); + errx(1, "Unknown address family %d", kill.af); if (state_killers > 1) { dests = 0; - memset(&psk.psk_dst.addr.v.a.mask, 0xff, - sizeof(psk.psk_dst.addr.v.a.mask)); + memset(&kill.dst.addr.v.a.mask, 0xff, + sizeof(kill.dst.addr.v.a.mask)); memset(&last_dst, 0xff, sizeof(last_dst)); pfctl_addrprefix(state_kill[1], - &psk.psk_dst.addr.v.a.mask); + &kill.dst.addr.v.a.mask); if ((ret_ga = getaddrinfo(state_kill[1], NULL, NULL, &res[1]))) { errx(1, "getaddrinfo: %s", @@ -701,7 +702,7 @@ pfctl_net_kill_states(int dev, const char *iface, int opts) resp[1] = resp[1]->ai_next) { if (resp[1]->ai_addr == NULL) continue; - if (psk.psk_af != resp[1]->ai_family) + if (kill.af != resp[1]->ai_family) continue; if (memcmp(&last_dst, resp[1]->ai_addr, @@ -711,27 +712,27 @@ pfctl_net_kill_states(int dev, const char *iface, int opts) dests++; - if (psk.psk_af == AF_INET) - psk.psk_dst.addr.v.a.addr.v4 = + if (kill.af == AF_INET) + kill.dst.addr.v.a.addr.v4 = ((struct sockaddr_in *)resp[1]-> ai_addr)->sin_addr; - else if (psk.psk_af == AF_INET6) - psk.psk_dst.addr.v.a.addr.v6 = + else if (kill.af == AF_INET6) + kill.dst.addr.v.a.addr.v6 = ((struct sockaddr_in6 *)resp[1]-> ai_addr)->sin6_addr; else errx(1, "Unknown address family %d", - psk.psk_af); + kill.af); - if (ioctl(dev, DIOCKILLSTATES, &psk)) + if (pfctl_kill_states(dev, &kill, &newkilled)) err(1, "DIOCKILLSTATES"); - killed += psk.psk_killed; + killed += newkilled; } freeaddrinfo(res[1]); } else { - if (ioctl(dev, DIOCKILLSTATES, &psk)) + if (pfctl_kill_states(dev, &kill, &newkilled)) err(1, "DIOCKILLSTATES"); - killed += psk.psk_killed; + killed += newkilled; } } @@ -746,26 +747,27 @@ pfctl_net_kill_states(int dev, const char *iface, int opts) int pfctl_label_kill_states(int dev, const char *iface, int opts) { - struct pfioc_state_kill psk; + struct pfctl_kill kill; + unsigned int killed; if (state_killers != 2 || (strlen(state_kill[1]) == 0)) { warnx("no label specified"); usage(); } - memset(&psk, 0, sizeof(psk)); - if (iface != NULL && strlcpy(psk.psk_ifname, iface, - sizeof(psk.psk_ifname)) >= sizeof(psk.psk_ifname)) + memset(&kill, 0, sizeof(kill)); + if (iface != NULL && strlcpy(kill.ifname, iface, + sizeof(kill.ifname)) >= sizeof(kill.ifname)) errx(1, "invalid interface: %s", iface); - if (strlcpy(psk.psk_label, state_kill[1], sizeof(psk.psk_label)) >= - sizeof(psk.psk_label)) + if (strlcpy(kill.label, state_kill[1], sizeof(kill.label)) >= + sizeof(kill.label)) errx(1, "label too long: %s", state_kill[1]); - if (ioctl(dev, DIOCKILLSTATES, &psk)) + if (pfctl_kill_states(dev, &kill, &killed)) err(1, "DIOCKILLSTATES"); if ((opts & PF_OPT_QUIET) == 0) - fprintf(stderr, "killed %d states\n", psk.psk_killed); + fprintf(stderr, "killed %d states\n", killed); return (0); } @@ -773,34 +775,35 @@ pfctl_label_kill_states(int dev, const char *iface, int opts) int pfctl_id_kill_states(int dev, const char *iface, int opts) { - struct pfioc_state_kill psk; + struct pfctl_kill kill; + unsigned int killed; if (state_killers != 2 || (strlen(state_kill[1]) == 0)) { warnx("no id specified"); usage(); } - memset(&psk, 0, sizeof(psk)); + memset(&kill, 0, sizeof(kill)); if ((sscanf(state_kill[1], "%jx/%x", - &psk.psk_pfcmp.id, &psk.psk_pfcmp.creatorid)) == 2) - HTONL(psk.psk_pfcmp.creatorid); - else if ((sscanf(state_kill[1], "%jx", &psk.psk_pfcmp.id)) == 1) { - psk.psk_pfcmp.creatorid = 0; + &kill.cmp.id, &kill.cmp.creatorid)) == 2) + HTONL(kill.cmp.creatorid); + else if ((sscanf(state_kill[1], "%jx", &kill.cmp.id)) == 1) { + kill.cmp.creatorid = 0; } else { warnx("wrong id format specified"); usage(); } - if (psk.psk_pfcmp.id == 0) { + if (kill.cmp.id == 0) { warnx("cannot kill id 0"); usage(); } - psk.psk_pfcmp.id = htobe64(psk.psk_pfcmp.id); - if (ioctl(dev, DIOCKILLSTATES, &psk)) + kill.cmp.id = htobe64(kill.cmp.id); + if (pfctl_kill_states(dev, &kill, &killed)) err(1, "DIOCKILLSTATES"); if ((opts & PF_OPT_QUIET) == 0) - fprintf(stderr, "killed %d states\n", psk.psk_killed); + fprintf(stderr, "killed %d states\n", killed); return (0); } From owner-dev-commits-src-all@freebsd.org Fri May 7 20:14:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F1BA63AD3D; Fri, 7 May 2021 20:14:00 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcM941FtHz3Jd6; Fri, 7 May 2021 20:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1259411AFE; Fri, 7 May 2021 20:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147KDxcN012794; Fri, 7 May 2021 20:13:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147KDxZg012793; Fri, 7 May 2021 20:13:59 GMT (envelope-from git) Date: Fri, 7 May 2021 20:13:59 GMT Message-Id: <202105072013.147KDxZg012793@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 2b2ed4a69730 - main - authpf: Start using libpfctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b2ed4a69730be72f792179d57dedf2945b3d1aa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 20:14:00 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2b2ed4a69730be72f792179d57dedf2945b3d1aa commit 2b2ed4a69730be72f792179d57dedf2945b3d1aa Author: Kristof Provost AuthorDate: 2021-04-30 08:26:52 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 20:13:31 +0000 authpf: Start using libpfctl Use pfctl_kill_states() rather than the DIOCKILLSTATES ioctl directly. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30057 --- contrib/pf/authpf/authpf.c | 35 ++++++++++++++++++----------------- usr.sbin/authpf/Makefile | 3 ++- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/contrib/pf/authpf/authpf.c b/contrib/pf/authpf/authpf.c index ac5d85b21cbc..4032efb27895 100644 --- a/contrib/pf/authpf/authpf.c +++ b/contrib/pf/authpf/authpf.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #ifdef __FreeBSD__ #include #endif +#include #include #include #include @@ -889,37 +890,37 @@ change_table(int add, const char *ip_src) static void authpf_kill_states(void) { - struct pfioc_state_kill psk; + struct pfctl_kill kill; struct pf_addr target; - memset(&psk, 0, sizeof(psk)); + memset(&kill, 0, sizeof(kill)); memset(&target, 0, sizeof(target)); if (inet_pton(AF_INET, ipsrc, &target.v4) == 1) - psk.psk_af = AF_INET; + kill.af = AF_INET; else if (inet_pton(AF_INET6, ipsrc, &target.v6) == 1) - psk.psk_af = AF_INET6; + kill.af = AF_INET6; else { syslog(LOG_ERR, "inet_pton(%s) failed", ipsrc); return; } /* Kill all states from ipsrc */ - memcpy(&psk.psk_src.addr.v.a.addr, &target, - sizeof(psk.psk_src.addr.v.a.addr)); - memset(&psk.psk_src.addr.v.a.mask, 0xff, - sizeof(psk.psk_src.addr.v.a.mask)); - if (ioctl(dev, DIOCKILLSTATES, &psk)) - syslog(LOG_ERR, "DIOCKILLSTATES failed (%m)"); + memcpy(&kill.src.addr.v.a.addr, &target, + sizeof(kill.src.addr.v.a.addr)); + memset(&kill.src.addr.v.a.mask, 0xff, + sizeof(kill.src.addr.v.a.mask)); + if (pfctl_kill_states(dev, &kill, NULL)) + syslog(LOG_ERR, "pfctl_kill_states() failed (%m)"); /* Kill all states to ipsrc */ - memset(&psk.psk_src, 0, sizeof(psk.psk_src)); - memcpy(&psk.psk_dst.addr.v.a.addr, &target, - sizeof(psk.psk_dst.addr.v.a.addr)); - memset(&psk.psk_dst.addr.v.a.mask, 0xff, - sizeof(psk.psk_dst.addr.v.a.mask)); - if (ioctl(dev, DIOCKILLSTATES, &psk)) - syslog(LOG_ERR, "DIOCKILLSTATES failed (%m)"); + memset(&kill.src, 0, sizeof(kill.src)); + memcpy(&kill.dst.addr.v.a.addr, &target, + sizeof(kill.dst.addr.v.a.addr)); + memset(&kill.dst.addr.v.a.mask, 0xff, + sizeof(kill.dst.addr.v.a.mask)); + if (pfctl_kill_states(dev, &kill, NULL)) + syslog(LOG_ERR, "pfctl_kill_states() failed (%m)"); } /* signal handler that makes us go away properly */ diff --git a/usr.sbin/authpf/Makefile b/usr.sbin/authpf/Makefile index 19fd66b47b3d..62fe84086c16 100644 --- a/usr.sbin/authpf/Makefile +++ b/usr.sbin/authpf/Makefile @@ -12,8 +12,9 @@ SRCS= authpf.c # XXX ALTQ: CFLAGS+= -DENABLE_ALTQ +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl -LIBADD= m util +LIBADD= m util pfctl WARNS?= 3 From owner-dev-commits-src-all@freebsd.org Fri May 7 20:14:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B268F63ADCA; Fri, 7 May 2021 20:14:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcM9524vxz3JpT; Fri, 7 May 2021 20:14:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 35A7711DA4; Fri, 7 May 2021 20:14:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147KE1bF012815; Fri, 7 May 2021 20:14:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147KE13D012814; Fri, 7 May 2021 20:14:01 GMT (envelope-from git) Date: Fri, 7 May 2021 20:14:01 GMT Message-Id: <202105072014.147KE13D012814@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: abbcba9cf5b1 - main - pf: Allow states to by killed per 'gateway' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: abbcba9cf5b1c26e837f00e0fbc205652cb05e51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 20:14:01 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=abbcba9cf5b1c26e837f00e0fbc205652cb05e51 commit abbcba9cf5b1c26e837f00e0fbc205652cb05e51 Author: Kristof Provost AuthorDate: 2021-04-30 13:15:05 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 20:13:31 +0000 pf: Allow states to by killed per 'gateway' This allows us to kill states created from a rule with route-to/reply-to set. This is particularly useful in multi-wan setups, where one of the WAN links goes down. Submitted by: Steven Brown Obtained from: https://github.com/pfsense/FreeBSD-src/pull/11/ MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30058 --- lib/libpfctl/libpfctl.c | 1 + lib/libpfctl/libpfctl.h | 1 + sbin/pfctl/pfctl.8 | 20 +++++++++++--- sbin/pfctl/pfctl.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++- share/man/man4/pf.4 | 2 +- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf_ioctl.c | 10 +++++++ 7 files changed, 96 insertions(+), 5 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 9f504237b4ee..f50afa7c78ef 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -642,6 +642,7 @@ _pfctl_clear_states(int dev, const struct pfctl_kill *kill, nvlist_add_number(nvl, "proto", kill->proto); pfctl_nv_add_rule_addr(nvl, "src", &kill->src); pfctl_nv_add_rule_addr(nvl, "dst", &kill->dst); + pfctl_nv_add_rule_addr(nvl, "rt_addr", &kill->rt_addr); nvlist_add_string(nvl, "ifname", kill->ifname); nvlist_add_string(nvl, "label", kill->label); diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index aa7f0ffd8fad..5c8b2108d937 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -191,6 +191,7 @@ struct pfctl_kill { int proto; struct pf_rule_addr src; struct pf_rule_addr dst; + struct pf_rule_addr rt_addr; char ifname[IFNAMSIZ]; char label[PF_RULE_LABEL_SIZE]; }; diff --git a/sbin/pfctl/pfctl.8 b/sbin/pfctl/pfctl.8 index f12489d9493a..f3905f850c5a 100644 --- a/sbin/pfctl/pfctl.8 +++ b/sbin/pfctl/pfctl.8 @@ -45,7 +45,7 @@ .Op Fl K Ar host | network .Xo .Oo Fl k -.Ar host | network | label | id +.Ar host | network | label | id | gateway .Oc Xc .Op Fl o Ar level .Op Fl p Ar device @@ -256,14 +256,15 @@ option may be specified, which will kill all the source tracking entries from the first host/network to the second. .It Xo .Fl k -.Ar host | network | label | id +.Ar host | network | label | id | gateway .Xc Kill all of the state entries matching the specified .Ar host , .Ar network , .Ar label , +.Ar id , or -.Ar id . +.Ar gateway. .Pp For example, to kill all of the state entries originating from .Dq host : @@ -317,6 +318,19 @@ To kill a state with ID 4823e84500000018 created from a backup firewall with hostid 00000002 use: .Pp .Dl # pfctl -k id -k 4823e84500000018/2 +.Pp +It is also possible to kill states created from a rule with the route-to/reply-to +parameter set to route the connection through a particular gateway. +Note that rules routing via the default routing table (not via a route-to +rule) will have their rt_addr set as 0.0.0.0 or ::. +To kill all states using a gateway of 192.168.0.1 use: +.Pp +.Dl # pfctl -k gateway -k 192.168.0.1 +.Pp +A network prefix length can also be specified. +To kill all states using a gateway in 192.168.0.0/24: +.Pp +.Dl # pfctl -k gateway -k 192.168.0.0/24 .It Fl m Merge in explicitly given options without resetting those which are omitted. diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 487dfb480cdc..96f3b4740d90 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -83,6 +83,7 @@ int pfctl_clear_iface_states(int, const char *, int); void pfctl_addrprefix(char *, struct pf_addr *); int pfctl_kill_src_nodes(int, const char *, int); int pfctl_net_kill_states(int, const char *, int); +int pfctl_gateway_kill_states(int, const char *, int); int pfctl_label_kill_states(int, const char *, int); int pfctl_id_kill_states(int, const char *, int); void pfctl_init_options(struct pfctl *); @@ -246,7 +247,7 @@ usage(void) fprintf(stderr, "usage: %s [-AdeghmNnOPqRrvz] [-a anchor] [-D macro=value] [-F modifier]\n" "\t[-f file] [-i interface] [-K host | network]\n" - "\t[-k host | network | label | id] [-o level] [-p device]\n" + "\t[-k host | network | gateway | label | id] [-o level] [-p device]\n" "\t[-s modifier] [-t table -T command [address ...]] [-x level]\n", __progname); @@ -744,6 +745,67 @@ pfctl_net_kill_states(int dev, const char *iface, int opts) return (0); } +int +pfctl_gateway_kill_states(int dev, const char *iface, int opts) +{ + struct pfctl_kill kill; + struct addrinfo *res, *resp; + struct sockaddr last_src; + unsigned int newkilled; + int killed = 0; + int ret_ga; + + if (state_killers != 2 || (strlen(state_kill[1]) == 0)) { + warnx("no gateway specified"); + usage(); + } + + memset(&kill, 0, sizeof(kill)); + memset(&kill.rt_addr.addr.v.a.mask, 0xff, + sizeof(kill.rt_addr.addr.v.a.mask)); + memset(&last_src, 0xff, sizeof(last_src)); + if (iface != NULL && strlcpy(kill.ifname, iface, + sizeof(kill.ifname)) >= sizeof(kill.ifname)) + errx(1, "invalid interface: %s", iface); + + pfctl_addrprefix(state_kill[1], &kill.rt_addr.addr.v.a.mask); + + if ((ret_ga = getaddrinfo(state_kill[1], NULL, NULL, &res))) { + errx(1, "getaddrinfo: %s", gai_strerror(ret_ga)); + /* NOTREACHED */ + } + for (resp = res; resp; resp = resp->ai_next) { + if (resp->ai_addr == NULL) + continue; + /* We get lots of duplicates. Catch the easy ones */ + if (memcmp(&last_src, resp->ai_addr, sizeof(last_src)) == 0) + continue; + last_src = *(struct sockaddr *)resp->ai_addr; + + kill.af = resp->ai_family; + + if (kill.af == AF_INET) + kill.rt_addr.addr.v.a.addr.v4 = + ((struct sockaddr_in *)resp->ai_addr)->sin_addr; + else if (kill.af == AF_INET6) + kill.rt_addr.addr.v.a.addr.v6 = + ((struct sockaddr_in6 *)resp->ai_addr)-> + sin6_addr; + else + errx(1, "Unknown address family %d", kill.af); + + if (pfctl_kill_states(dev, &kill, &newkilled)) + err(1, "DIOCKILLSTATES"); + killed += newkilled; + } + + freeaddrinfo(res); + + if ((opts & PF_OPT_QUIET) == 0) + fprintf(stderr, "killed %d states\n", killed); + return (0); +} + int pfctl_label_kill_states(int dev, const char *iface, int opts) { @@ -2455,6 +2517,8 @@ main(int argc, char *argv[]) pfctl_label_kill_states(dev, ifaceopt, opts); else if (!strcmp(state_kill[0], "id")) pfctl_id_kill_states(dev, ifaceopt, opts); + else if (!strcmp(state_kill[0], "gateway")) + pfctl_gateway_kill_states(dev, ifaceopt, opts); else pfctl_net_kill_states(dev, ifaceopt, opts); } diff --git a/share/man/man4/pf.4 b/share/man/man4/pf.4 index e71ef8f426e4..2fb132203908 100644 --- a/share/man/man4/pf.4 +++ b/share/man/man4/pf.4 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 5, 2018 +.Dd May 7, 2021 .Dt PF 4 .Os .Sh NAME diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 6c044fa8b449..b010f0fb3d80 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1081,6 +1081,7 @@ struct pf_kstate_kill { int psk_proto; struct pf_rule_addr psk_src; struct pf_rule_addr psk_dst; + struct pf_rule_addr psk_rt_addr; char psk_ifname[IFNAMSIZ]; char psk_label[PF_RULE_LABEL_SIZE]; u_int psk_killed; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 1340d9eec008..27ed468497da 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2458,6 +2458,10 @@ pf_nvstate_kill_to_kstate_kill(const nvlist_t *nvl, return (EINVAL); PFNV_CHK(pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "dst"), &kill->psk_dst)); + if (nvlist_exists_nvlist(nvl, "rt_addr")) { + PFNV_CHK(pf_nvrule_addr_to_rule_addr( + nvlist_get_nvlist(nvl, "rt_addr"), &kill->psk_rt_addr)); + } PFNV_CHK(pf_nvstring(nvl, "ifname", kill->psk_ifname, sizeof(kill->psk_ifname))); @@ -2679,6 +2683,12 @@ relock_DIOCKILLSTATES: &psk->psk_dst.addr.v.a.mask, dstaddr, sk->af)) continue; + if (! PF_MATCHA(psk->psk_rt_addr.neg, + &psk->psk_rt_addr.addr.v.a.addr, + &psk->psk_rt_addr.addr.v.a.mask, + &s->rt_addr, sk->af)) + continue; + if (psk->psk_src.port_op != 0 && ! pf_match_port(psk->psk_src.port_op, psk->psk_src.port[0], psk->psk_src.port[1], srcport)) From owner-dev-commits-src-all@freebsd.org Fri May 7 20:14:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10E2863AD56; Fri, 7 May 2021 20:14:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcM963kNSz3Jjt; Fri, 7 May 2021 20:14:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 589BD11DA5; Fri, 7 May 2021 20:14:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147KE2Ot012836; Fri, 7 May 2021 20:14:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147KE262012835; Fri, 7 May 2021 20:14:02 GMT (envelope-from git) Date: Fri, 7 May 2021 20:14:02 GMT Message-Id: <202105072014.147KE262012835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c2e11d81d295 - main - pf tests: Test killing states by gateway MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c2e11d81d295f7d55ac8b6858b09d8fa123cbfe8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 20:14:03 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c2e11d81d295f7d55ac8b6858b09d8fa123cbfe8 commit c2e11d81d295f7d55ac8b6858b09d8fa123cbfe8 Author: Kristof Provost AuthorDate: 2021-04-30 15:07:23 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 20:13:31 +0000 pf tests: Test killing states by gateway MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30059 --- tests/sys/netpfil/pf/killstate.sh | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh index dddf844e6231..4ec1adf0d051 100644 --- a/tests/sys/netpfil/pf/killstate.sh +++ b/tests/sys/netpfil/pf/killstate.sh @@ -318,10 +318,70 @@ multilabel_cleanup() pft_cleanup } +atf_test_case "gateway" "cleanup" +gateway_head() +{ + atf_set descr 'Test killing states by route-to/reply-to address' + atf_set require.user root + atf_set require.progs scapy +} + +gateway_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz "block all" \ + "pass in reply-to (${epair}b 192.0.2.1) proto icmp" + + # Sanity check & establish state + # Note: use pft_ping so we always use the same ID, so pf considers all + # echo requests part of the same flow. + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Change rules to now deny the ICMP traffic + pft_set_rules noflush alcatraz "block all" + + # Established state means we can still ping alcatraz + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Killing with a different gateway does not affect our state + jexec alcatraz pfctl -k gateway -k 192.0.2.2 + atf_check -s exit:0 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a + + # Killing states with the relevant gateway does terminate our state + jexec alcatraz pfctl -k gateway -k 192.0.2.1 + atf_check -s exit:1 -o ignore ${common_dir}/pft_ping.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --replyif ${epair}a +} + +gateway_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" atf_add_test_case "v6" atf_add_test_case "label" atf_add_test_case "multilabel" + atf_add_test_case "gateway" } From owner-dev-commits-src-all@freebsd.org Fri May 7 20:14:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE60B63AEF5; Fri, 7 May 2021 20:14:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcM974bQgz3Jh8; Fri, 7 May 2021 20:14:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 811DA11EAE; Fri, 7 May 2021 20:14:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147KE3mS012857; Fri, 7 May 2021 20:14:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147KE33n012856; Fri, 7 May 2021 20:14:03 GMT (envelope-from git) Date: Fri, 7 May 2021 20:14:03 GMT Message-Id: <202105072014.147KE33n012856@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 93abcf17e6cf - main - pf: Support killing 'matching' states MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 93abcf17e6cf3c1cd8511c8ff7a8bf20b2d76367 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 20:14:04 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=93abcf17e6cf3c1cd8511c8ff7a8bf20b2d76367 commit 93abcf17e6cf3c1cd8511c8ff7a8bf20b2d76367 Author: Kristof Provost AuthorDate: 2021-05-03 13:35:50 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 20:13:31 +0000 pf: Support killing 'matching' states Optionally also kill states that match (i.e. are the NATed state or opposite direction state entry for) the state we're killing. See also https://redmine.pfsense.org/issues/8555 Submitted by: Steven Brown Reviewed by: bcr (man page) Obtained from: https://github.com/pfsense/FreeBSD-src/pull/11/ MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30092 --- lib/libpfctl/libpfctl.c | 1 + lib/libpfctl/libpfctl.h | 1 + sbin/pfctl/pfctl.8 | 13 +++++- sbin/pfctl/pfctl.c | 23 +++++++++- sbin/pfctl/pfctl_parser.h | 1 + sys/net/pfvar.h | 1 + sys/netpfil/pf/pf_ioctl.c | 108 ++++++++++++++++++++++++++++++++++++++++------ 7 files changed, 131 insertions(+), 17 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index f50afa7c78ef..8271d9bab3df 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -645,6 +645,7 @@ _pfctl_clear_states(int dev, const struct pfctl_kill *kill, pfctl_nv_add_rule_addr(nvl, "rt_addr", &kill->rt_addr); nvlist_add_string(nvl, "ifname", kill->ifname); nvlist_add_string(nvl, "label", kill->label); + nvlist_add_bool(nvl, "kill_match", kill->kill_match); nv.data = nvlist_pack(nvl, &nv.len); nv.size = nv.len; diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 5c8b2108d937..7a1e02f3d01b 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -194,6 +194,7 @@ struct pfctl_kill { struct pf_rule_addr rt_addr; char ifname[IFNAMSIZ]; char label[PF_RULE_LABEL_SIZE]; + bool kill_match; }; int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, diff --git a/sbin/pfctl/pfctl.8 b/sbin/pfctl/pfctl.8 index f3905f850c5a..ad0d1ba34769 100644 --- a/sbin/pfctl/pfctl.8 +++ b/sbin/pfctl/pfctl.8 @@ -35,7 +35,7 @@ .Sh SYNOPSIS .Nm pfctl .Bk -words -.Op Fl AdeghmNnOPqRrvz +.Op Fl AdeghMmNnOPqRrvz .Op Fl a Ar anchor .Oo Fl D Ar macro Ns = .Ar value Oc @@ -331,6 +331,17 @@ A network prefix length can also be specified. To kill all states using a gateway in 192.168.0.0/24: .Pp .Dl # pfctl -k gateway -k 192.168.0.0/24 +.Pp +.It Fl M +Kill matching states in the opposite direction (on other interfaces) when +killing states. +This applies to states killed using the -k option and also will apply to the +flush command when flushing states. +This is useful when an interface is specified when flushing states. +Example: +.Pp +.Dl # pfctl -M -i interface -Fs +.Pp .It Fl m Merge in explicitly given options without resetting those which are omitted. diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 96f3b4740d90..fd937cac9f63 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -245,7 +245,7 @@ usage(void) extern char *__progname; fprintf(stderr, -"usage: %s [-AdeghmNnOPqRrvz] [-a anchor] [-D macro=value] [-F modifier]\n" +"usage: %s [-AdeghMmNnOPqRrvz] [-a anchor] [-D macro=value] [-F modifier]\n" "\t[-f file] [-i interface] [-K host | network]\n" "\t[-k host | network | gateway | label | id] [-o level] [-p device]\n" "\t[-s modifier] [-t table -T command [address ...]] [-x level]\n", @@ -478,6 +478,9 @@ pfctl_clear_iface_states(int dev, const char *iface, int opts) sizeof(kill.ifname)) >= sizeof(kill.ifname)) errx(1, "invalid interface: %s", iface); + if (opts & PF_OPT_KILLMATCH) + kill.kill_match = true; + if (pfctl_clear_states(dev, &kill, &killed)) err(1, "DIOCCLRSTATES"); if ((opts & PF_OPT_QUIET) == 0) @@ -661,6 +664,9 @@ pfctl_net_kill_states(int dev, const char *iface, int opts) pfctl_addrprefix(state_kill[0], &kill.src.addr.v.a.mask); + if (opts & PF_OPT_KILLMATCH) + kill.kill_match = true; + if ((ret_ga = getaddrinfo(state_kill[0], NULL, NULL, &res[0]))) { errx(1, "getaddrinfo: %s", gai_strerror(ret_ga)); /* NOTREACHED */ @@ -768,6 +774,9 @@ pfctl_gateway_kill_states(int dev, const char *iface, int opts) sizeof(kill.ifname)) >= sizeof(kill.ifname)) errx(1, "invalid interface: %s", iface); + if (opts & PF_OPT_KILLMATCH) + kill.kill_match = true; + pfctl_addrprefix(state_kill[1], &kill.rt_addr.addr.v.a.mask); if ((ret_ga = getaddrinfo(state_kill[1], NULL, NULL, &res))) { @@ -821,6 +830,9 @@ pfctl_label_kill_states(int dev, const char *iface, int opts) sizeof(kill.ifname)) >= sizeof(kill.ifname)) errx(1, "invalid interface: %s", iface); + if (opts & PF_OPT_KILLMATCH) + kill.kill_match = true; + if (strlcpy(kill.label, state_kill[1], sizeof(kill.label)) >= sizeof(kill.label)) errx(1, "label too long: %s", state_kill[1]); @@ -846,6 +858,10 @@ pfctl_id_kill_states(int dev, const char *iface, int opts) } memset(&kill, 0, sizeof(kill)); + + if (opts & PF_OPT_KILLMATCH) + kill.kill_match = true; + if ((sscanf(state_kill[1], "%jx/%x", &kill.cmp.id, &kill.cmp.creatorid)) == 2) HTONL(kill.cmp.creatorid); @@ -2199,7 +2215,7 @@ main(int argc, char *argv[]) usage(); while ((ch = getopt(argc, argv, - "a:AdD:eqf:F:ghi:k:K:mnNOo:Pp:rRs:t:T:vx:z")) != -1) { + "a:AdD:eqf:F:ghi:k:K:mMnNOo:Pp:rRs:t:T:vx:z")) != -1) { switch (ch) { case 'a': anchoropt = optarg; @@ -2252,6 +2268,9 @@ main(int argc, char *argv[]) case 'm': opts |= PF_OPT_MERGE; break; + case 'M': + opts |= PF_OPT_KILLMATCH; + break; case 'n': opts |= PF_OPT_NOACTION; break; diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 0c66d5dda97a..5353900b380a 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -55,6 +55,7 @@ #define PF_OPT_NUMERIC 0x1000 #define PF_OPT_MERGE 0x2000 #define PF_OPT_RECURSE 0x4000 +#define PF_OPT_KILLMATCH 0x8000 #define PF_TH_ALL 0xFF diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index b010f0fb3d80..51c51a82b36d 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1085,6 +1085,7 @@ struct pf_kstate_kill { char psk_ifname[IFNAMSIZ]; char psk_label[PF_RULE_LABEL_SIZE]; u_int psk_killed; + bool psk_kill_match; }; #endif diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 27ed468497da..2d13ddf1ac61 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2467,6 +2467,8 @@ pf_nvstate_kill_to_kstate_kill(const nvlist_t *nvl, sizeof(kill->psk_ifname))); PFNV_CHK(pf_nvstring(nvl, "label", kill->psk_label, sizeof(kill->psk_label))); + if (nvlist_exists_bool(nvl, "kill_match")) + kill->psk_kill_match = nvlist_get_bool(nvl, "kill_match"); errout: return (error); @@ -2644,13 +2646,33 @@ pf_label_match(const struct pf_krule *rule, const char *label) return (false); } +static unsigned int +pf_kill_matching_state(struct pf_state_key_cmp *key, int dir) +{ + struct pf_state *match; + int more = 0; + unsigned int killed = 0; + + /* Call with unlocked hashrow */ + + match = pf_find_state_all(key, dir, &more); + if (match && !more) { + pf_unlink_state(match, 0); + killed++; + } + + return (killed); +} + static int pf_killstates_row(struct pf_kstate_kill *psk, struct pf_idhash *ih) { struct pf_state *s; struct pf_state_key *sk; struct pf_addr *srcaddr, *dstaddr; - int killed = 0; + struct pf_state_key_cmp match_key; + int idx, killed = 0; + unsigned int dir; u_int16_t srcport, dstport; relock_DIOCKILLSTATES: @@ -2707,8 +2729,36 @@ relock_DIOCKILLSTATES: s->kif->pfik_name)) continue; + if (psk->psk_kill_match) { + /* Create the key to find matching states, with lock + * held. */ + + bzero(&match_key, sizeof(match_key)); + + if (s->direction == PF_OUT) { + dir = PF_IN; + idx = PF_SK_STACK; + } else { + dir = PF_OUT; + idx = PF_SK_WIRE; + } + + match_key.af = s->key[idx]->af; + match_key.proto = s->key[idx]->proto; + PF_ACPY(&match_key.addr[0], + &s->key[idx]->addr[1], match_key.af); + match_key.port[0] = s->key[idx]->port[1]; + PF_ACPY(&match_key.addr[1], + &s->key[idx]->addr[0], match_key.af); + match_key.port[1] = s->key[idx]->port[0]; + } + pf_unlink_state(s, PF_ENTER_LOCKED); killed++; + + if (psk->psk_kill_match) + killed += pf_kill_matching_state(&match_key, dir); + goto relock_DIOCKILLSTATES; } PF_HASHROW_UNLOCK(ih); @@ -5442,27 +5492,57 @@ on_error: static unsigned int pf_clear_states(const struct pf_kstate_kill *kill) { + struct pf_state_key_cmp match_key; struct pf_state *s; - unsigned int killed = 0; + int idx; + unsigned int killed = 0, dir; for (unsigned int i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; relock_DIOCCLRSTATES: PF_HASHROW_LOCK(ih); - LIST_FOREACH(s, &ih->states, entry) - if (!kill->psk_ifname[0] || - !strcmp(kill->psk_ifname, - s->kif->pfik_name)) { - /* - * Don't send out individual - * delete messages. - */ - s->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(s, PF_ENTER_LOCKED); - killed++; - goto relock_DIOCCLRSTATES; + LIST_FOREACH(s, &ih->states, entry) { + if (kill->psk_ifname[0] && + strcmp(kill->psk_ifname, + s->kif->pfik_name)) + continue; + + if (kill->psk_kill_match) { + bzero(&match_key, sizeof(match_key)); + + if (s->direction == PF_OUT) { + dir = PF_IN; + idx = PF_SK_STACK; + } else { + dir = PF_OUT; + idx = PF_SK_WIRE; + } + + match_key.af = s->key[idx]->af; + match_key.proto = s->key[idx]->proto; + PF_ACPY(&match_key.addr[0], + &s->key[idx]->addr[1], match_key.af); + match_key.port[0] = s->key[idx]->port[1]; + PF_ACPY(&match_key.addr[1], + &s->key[idx]->addr[0], match_key.af); + match_key.port[1] = s->key[idx]->port[0]; } + + /* + * Don't send out individual + * delete messages. + */ + s->state_flags |= PFSTATE_NOSYNC; + pf_unlink_state(s, PF_ENTER_LOCKED); + killed++; + + if (kill->psk_kill_match) + killed += pf_kill_matching_state(&match_key, + dir); + + goto relock_DIOCCLRSTATES; + } PF_HASHROW_UNLOCK(ih); } From owner-dev-commits-src-all@freebsd.org Fri May 7 20:14:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DABE263AD5A; Fri, 7 May 2021 20:14:04 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcM985Gbgz3Jpd; Fri, 7 May 2021 20:14:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9FD0311DA6; Fri, 7 May 2021 20:14:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147KE4UZ012878; Fri, 7 May 2021 20:14:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147KE4xp012877; Fri, 7 May 2021 20:14:04 GMT (envelope-from git) Date: Fri, 7 May 2021 20:14:04 GMT Message-Id: <202105072014.147KE4xp012877@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: ac200a9c3847 - main - pf tests: Test killing matching states MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac200a9c3847d3a92c347de60e32a7af430dede6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 20:14:05 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ac200a9c3847d3a92c347de60e32a7af430dede6 commit ac200a9c3847d3a92c347de60e32a7af430dede6 Author: Kristof Provost AuthorDate: 2021-05-03 13:31:03 +0000 Commit: Kristof Provost CommitDate: 2021-05-07 20:13:31 +0000 pf tests: Test killing matching states MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30093 --- tests/sys/netpfil/pf/killstate.sh | 71 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh index 4ec1adf0d051..ec01910f0867 100644 --- a/tests/sys/netpfil/pf/killstate.sh +++ b/tests/sys/netpfil/pf/killstate.sh @@ -377,6 +377,76 @@ gateway_cleanup() pft_cleanup } +atf_test_case "match" "cleanup" +match_head() +{ + atf_set descr 'Test killing matching states' + atf_set require.user root +} + +match_body() +{ + pft_init + + epair_one=$(vnet_mkepair) + ifconfig ${epair_one}a 192.0.2.1/24 up + + epair_two=$(vnet_mkepair) + + vnet_mkjail alcatraz ${epair_one}b ${epair_two}a + jexec alcatraz ifconfig ${epair_one}b 192.0.2.2/24 up + jexec alcatraz ifconfig ${epair_two}a 198.51.100.1/24 up + jexec alcatraz sysctl net.inet.ip.forwarding=1 + jexec alcatraz pfctl -e + + vnet_mkjail singsing ${epair_two}b + jexec singsing ifconfig ${epair_two}b 198.51.100.2/24 up + jexec singsing route add default 198.51.100.1 + jexec singsing /usr/sbin/inetd -p inetd-echo.pid \ + $(atf_get_srcdir)/echo_inetd.conf + + route add 198.51.100.0/24 192.0.2.2 + + pft_set_rules alcatraz \ + "nat on ${epair_two}a from 192.0.2.0/24 -> (${epair_two}a)" \ + "pass all" + + nc 198.51.100.2 7 & + + # Expect two states + states=$(jexec alcatraz pfctl -s s | wc -l) + if [ $states -ne 2 ] ; + then + atf_fail "Expected two states, found $states" + fi + + # If we don't kill the matching NAT state one should be left + jexec alcatraz pfctl -k 192.0.2.1 + states=$(jexec alcatraz pfctl -s s | wc -l) + if [ $states -ne 1 ] ; + then + atf_fail "Expected one states, found $states" + fi + + # Flush + jexec alcatraz pfctl -F states + + nc 198.51.100.2 7 & + + # Kill matching states, expect all of them to be gone + jexec alcatraz pfctl -M -k 192.0.2.1 + states=$(jexec alcatraz pfctl -s s | wc -l) + if [ $states -ne 0 ] ; + then + atf_fail "Expected zero states, found $states" + fi +} + +match_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" @@ -384,4 +454,5 @@ atf_init_test_cases() atf_add_test_case "label" atf_add_test_case "multilabel" atf_add_test_case "gateway" + atf_add_test_case "match" } From owner-dev-commits-src-all@freebsd.org Fri May 7 20:49:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD6AF63C32D; Fri, 7 May 2021 20:49:52 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcMyS4wGdz3M7L; Fri, 7 May 2021 20:49:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9C07C12541; Fri, 7 May 2021 20:49:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147KnqP5052497; Fri, 7 May 2021 20:49:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147KnqXw052496; Fri, 7 May 2021 20:49:52 GMT (envelope-from git) Date: Fri, 7 May 2021 20:49:52 GMT Message-Id: <202105072049.147KnqXw052496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: aad59c79f5f2 - main - Fix panic when trying to delete non-existent gateway in multipath route. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aad59c79f5f2b1881c6613b1b0b6ac7be8eb474b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 20:49:52 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=aad59c79f5f2b1881c6613b1b0b6ac7be8eb474b commit aad59c79f5f2b1881c6613b1b0b6ac7be8eb474b Author: Alexander V. Chernikov AuthorDate: 2021-05-07 20:36:50 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-05-07 20:41:31 +0000 Fix panic when trying to delete non-existent gateway in multipath route. IF non-existend gateway was specified, the code responsible for calculating an updated nexthop group, returned the same already-used nexthop group. After the route table update, the operation result contained the same old & new nexthop groups. Thus, the code responsible for decomposing the notification to the list of simple nexthop-level notifications, was not able to find any differences. As a result, it hasn't updated any of the "simple" notification fields, resulting in empty rtentry pointer. This empty pointer was the direct reason of a panic. Fix the problem by returning ESRCH when the new nexthop group is the same as the old one after applying gateway filter. Reported by: Michael PR: 255665 MFC after: 3 days --- sys/net/route/mpath_ctl.c | 11 ++++++++--- sys/net/route/nhgrp_ctl.c | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/net/route/mpath_ctl.c b/sys/net/route/mpath_ctl.c index 5632750f466d..8351437e34c6 100644 --- a/sys/net/route/mpath_ctl.c +++ b/sys/net/route/mpath_ctl.c @@ -181,10 +181,15 @@ del_route_mpath(struct rib_head *rh, struct rt_addrinfo *info, if ((info->rti_info[RTAX_GATEWAY] == NULL) && (info->rti_filter == NULL)) return (ESRCH); - error = nhgrp_get_filtered_group(rh, nhg, gw_filter_func, (void *)&ri, - &rnd); - if (error == 0) + error = nhgrp_get_filtered_group(rh, nhg, gw_filter_func, (void *)&ri, &rnd); + if (error == 0) { + if (rnd.rnd_nhgrp == nhg) { + /* No gateway match, unreference new group and return. */ + nhop_free_any(rnd.rnd_nhop); + return (ESRCH); + } error = change_route_nhop(rh, rt, info, &rnd, rc); + } return (error); } diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index 49866499ac86..9f1f3a5b4bc4 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -578,9 +578,9 @@ nhgrp_get_group(struct rib_head *rh, struct weightened_nhop *wn, int num_nhops, } /* - * Creates new nexthop group based on @src group with the nexthops defined in bitmask - * @nhop_mask removed. - * Returns referenced nexthop group or NULL on failure. + * Creates new nexthop group based on @src group without the nexthops + * chosen by @flt_func. + * Returns 0 on success, storring the reference nhop group/object in @rnd. */ int nhgrp_get_filtered_group(struct rib_head *rh, const struct nhgrp_object *src, From owner-dev-commits-src-all@freebsd.org Fri May 7 21:34:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB97163D90E; Fri, 7 May 2021 21:34:45 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcNyF5P5Nz3PPN; Fri, 7 May 2021 21:34:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A80CD13286; Fri, 7 May 2021 21:34:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 147LYj0b018825; Fri, 7 May 2021 21:34:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 147LYjPn018824; Fri, 7 May 2021 21:34:45 GMT (envelope-from git) Date: Fri, 7 May 2021 21:34:45 GMT Message-Id: <202105072134.147LYjPn018824@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 5a4333a5378f - main - This takes Warners suggested approach to making it so that platforms that for whatever reason cannot include the RATELIMIT option can still work with rack. It adds two dummy functions that rack will call and find out that the highest hw supported b/w is 0 (which kinda makes sense and rack is already prepared to handle). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a4333a5378f7afe4f8cab293a987865ae0c32c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 21:34:45 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=5a4333a5378f7afe4f8cab293a987865ae0c32c4 commit 5a4333a5378f7afe4f8cab293a987865ae0c32c4 Author: Randall Stewart AuthorDate: 2021-05-07 21:32:32 +0000 Commit: Randall Stewart CommitDate: 2021-05-07 21:32:32 +0000 This takes Warners suggested approach to making it so that platforms that for whatever reason cannot include the RATELIMIT option can still work with rack. It adds two dummy functions that rack will call and find out that the highest hw supported b/w is 0 (which kinda makes sense and rack is already prepared to handle). Reviewed by: Michael Tuexen, Warner Losh Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30163 --- sys/netinet/tcp_ratelimit.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/netinet/tcp_ratelimit.h b/sys/netinet/tcp_ratelimit.h index 8747708e8b5e..b689c9127493 100644 --- a/sys/netinet/tcp_ratelimit.h +++ b/sys/netinet/tcp_ratelimit.h @@ -147,6 +147,20 @@ tcp_rel_pacing_rate(const struct tcp_hwrate_limit_table *crte, { return; } + +static uint64_t inline +tcp_hw_highest_rate(const struct tcp_hwrate_limit_table *rle) +{ + return (0); +} + +static uint64_t inline +tcp_hw_highest_rate_ifp(struct ifnet *ifp, struct inpcb *inp) +{ + return (0); +} + + #endif /* * Given a b/w and a segsiz, and optional hardware From owner-dev-commits-src-all@freebsd.org Fri May 7 21:37:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 653F063D675 for ; Fri, 7 May 2021 21:37:45 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcP1j2CG9z3PdS for ; Fri, 7 May 2021 21:37:45 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f50.google.com with SMTP id y124-20020a1c32820000b029010c93864955so7897443wmy.5 for ; Fri, 07 May 2021 14:37:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=7I+tT0ObTRfCPNzy6CuPectpNvKohDduINusX2IPzy4=; b=GxwKj0vapO7LLd/DRACUh/khXHrgm+1JIOdUEB4jSh6J8iO7SdfRROks1/L9By+1NK m8kZx4txei0b13CX5Fv3QakuUj7orfpfpjvT+ZwzwpUlfbJGso1P6rOMH1qS7udne+9E Z+KwVddALU8RnKgHTjQMIEMDRX49RfKrNc6kFi8yy5g4ThMzk1YNWACvw4Bz0eKNlTIA TEWYd+uQxtHXTHEfCQ7hAsLwJXjRKrEmU5k9VqlJ4dgOWlBpDA+Doj1UsqbQfs8Lw010 xJqbQm/KLRprH5Ly7e/57eFxB2uqfsQj4mMDW1Ldw3RrzixODGkijZPLX5pSzzW0vH2L 5j8g== X-Gm-Message-State: AOAM530ic8+rNYzMd9AcaHNsTyaOaZuyRDeGMVopfshVQqbkGmDcamFy 064FKamBmV4bjslaMiFFT1z3Wg== X-Google-Smtp-Source: ABdhPJwnGR3QSRck19O3EGLhTMDyqSbJvKUyJypd1flEuM1qRb4+BulO0sINRRkPD79pQWUbLoaYzw== X-Received: by 2002:a05:600c:230f:: with SMTP id 15mr11599077wmo.19.1620423463903; Fri, 07 May 2021 14:37:43 -0700 (PDT) Received: from [192.168.150.48] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id k15sm9877962wro.87.2021.05.07.14.37.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 May 2021 14:37:43 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 5a4333a5378f - main - This takes Warners suggested approach to making it so that platforms that for whatever reason cannot include the RATELIMIT option can still work with rack. It adds two dummy functions that rack will call and find out that the highest hw supported b/w is 0 (which kinda makes sense and rack is already prepared to handle). From: Jessica Clarke In-Reply-To: <202105072134.147LYjPn018824@gitrepo.freebsd.org> Date: Fri, 7 May 2021 22:37:42 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202105072134.147LYjPn018824@gitrepo.freebsd.org> To: Randall Stewart X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FcP1j2CG9z3PdS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 21:37:45 -0000 On 7 May 2021, at 22:34, Randall Stewart wrote: >=20 > The branch main has been updated by rrs: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D5a4333a5378f7afe4f8cab293a987865= ae0c32c4 >=20 > commit 5a4333a5378f7afe4f8cab293a987865ae0c32c4 > Author: Randall Stewart > AuthorDate: 2021-05-07 21:32:32 +0000 > Commit: Randall Stewart > CommitDate: 2021-05-07 21:32:32 +0000 >=20 > This takes Warners suggested approach to making it so that > platforms that for whatever reason cannot include the RATELIMIT = option > can still work with rack. It adds two dummy functions that rack = will > call and find out that the highest hw supported b/w is 0 (which > kinda makes sense and rack is already prepared to handle). Hi Randall, Could you please start writing a proper separate subject line for your = git commits? This is not best practice, and many tools behave poorly in the presence of one big paragraph at the start rather than a separate = subject line, including the email hook here. See [1] for FreeBSD=E2=80=99s own guide = on the matter. Jess [1] = https://docs.freebsd.org/en/articles/committers-guide/#commit-log-message From owner-dev-commits-src-all@freebsd.org Sat May 8 00:04:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FAD4640DF0 for ; Sat, 8 May 2021 00:04:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcSH51T88z3mLR for ; Sat, 8 May 2021 00:04:32 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x736.google.com with SMTP id l129so10276916qke.8 for ; Fri, 07 May 2021 17:04:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BlBLYj/QMb5uDGfLaOpMe1nz32IEcqltH416lfud9Nw=; b=qqofcFErcWJ3HwgkJuqgPQ/VkUfvBmlTSmA2sU/9Y11a4FKs/x9iM1QzGFxMTyjDdD 6zyIhjxYYdZJrLCXJi36W2U5AE7BRGSIVLrG7Bps9/d7GIRKI+XJ3ocDH/BPWYgID4+q IsnWRKMWERi6k5vcisa07TAnO2naCa0I9yRyDIfezMNvyO40D8jexAEhcewppuCD2zTL EbFQBBrMbVfGnWBS2AT8R6qE088gILSxGcmubV39uh141Xm93g/D4hnUhwX3ZndeKjEM JQr/lI2TN0AZDHmzpxVLTQ47GtiZyP9of+2zRj8w6HPMdiMjmudKm3Juouuu3d0wrHFw owTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BlBLYj/QMb5uDGfLaOpMe1nz32IEcqltH416lfud9Nw=; b=oN3G/mwb9HNZoBcKSF5MWgo18mmGe2dmF1sEdXMubmCKzrDxuJgxKBDfx1eVtiPJvN nIM7qRhAwGOiDlwpXpip2kqSNAYWkOUueMEACgXyCPqr0RJV77jjd04rg++oPNHittCD nCtQ6LFQGVPzSaZOBxDQpI/h+rK/u1IWJPCu59ysGONPOEHgpkgfT9ZEQrD6vC3I5k5h HNIzE7k0WSGZZRMDu83HQILg68Yxx9EFXua893DAQV22SWjmUElM7dJtJh2NxxzcV8xE Ccom0FE7di+YT86TUEI4F9H8hv1MRDAEJBT4Oq3pLjLLLjVSC8n/VWUkkGvEJsbGDRyT yY5w== X-Gm-Message-State: AOAM531lEb/OUPbeAuoNRjeaZDGVoVIWlfiQYjmAYxuywlqKf4Lk1H7X OqEDf0ZOdupR2TCSSBRE/FXLANadUrKRxoOMitTnAy8xPjAonQ== X-Google-Smtp-Source: ABdhPJxRdvnr8oVekwU4EbiUT/2DVzX4yP24juKn2wzP0HM8p5QeiAttoVLFtnPIUTgFxME9A1uyBJsZdTtlMypidOA= X-Received: by 2002:a37:c444:: with SMTP id h4mr9727283qkm.206.1620432271472; Fri, 07 May 2021 17:04:31 -0700 (PDT) MIME-Version: 1.0 References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> <78FF7B31-B84D-4D97-9E57-D000A6B09D7D@macmic.franken.de> <504C85E6-8967-40CC-8E12-F20F78B3226F@macmic.franken.de> In-Reply-To: <504C85E6-8967-40CC-8E12-F20F78B3226F@macmic.franken.de> From: Warner Losh Date: Fri, 7 May 2021 18:04:19 -0600 Message-ID: Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. To: Michael Tuexen Cc: Gordon Bergling , Li-Wen Hsu , Randall Stewart , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4FcSH51T88z3mLR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2021 00:04:33 -0000 On Fri, May 7, 2021, 12:38 PM Michael Tuexen < michael.tuexen@macmic.franken.de> wrote: > > On 7. May 2021, at 20:26, Warner Losh wrote: > > > > https://reviews.freebsd.org/D30163 > > > > May be the ticket to solve this... > I don't understand that. RACK should just compile fine when RATELIMIT is > defined > in the kernel config. Gordon states that this is the case for him. > Whu do you think that D30163 is needed to compile RACK on a platform where > RATELIMIT is in the kernel config? > We need ot to compile the module when it isn't in the kernel. Modules have to compile, even for illegal combinations of options or be omitted from building... Warner Best regards > Michael > > > > Warner > > > > On Fri, May 7, 2021, 12:03 PM Michael Tuexen < > michael.tuexen@macmic.franken.de> wrote: > > > On 7. May 2021, at 19:47, Gordon Bergling wrote: > > > > > > On Fri, May 07, 2021 at 05:39:37PM +0800, Li-Wen Hsu wrote: > > >> On Thu, May 6, 2021 at 11:26 PM Randall Stewart > wrote: > > >>> > > >>> The branch main has been updated by rrs: > > >>> > > >>> URL: > https://cgit.FreeBSD.org/src/commit/?id=5d8fd932e418f03e98b3469c4088a36f0ef34ffe > > >>> > > >>> commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe > > >>> Author: Randall Stewart > > >>> AuthorDate: 2021-05-06 15:22:26 +0000 > > >>> Commit: Randall Stewart > > >>> CommitDate: 2021-05-06 15:22:26 +0000 > > >>> > > >>> This brings into sync FreeBSD with the netflix versions of rack > and bbr. > > >>> This fixes several breakages (panics) since the tcp_lro code was > > >>> committed that have been reported. Quite a few new features are > > >>> now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the > > >>> largest). There is also support for ack-war prevention. Documents > > >>> comming soon on rack.. > > >>> > > >>> Sponsored by: Netflix > > >>> Reviewed by: rscheff, mtuexen > > >>> Differential Revision: https://reviews.freebsd.org/D30036 > > >> > > >> This seems braking LINT kernel build of powerpc: > > >> > > >> https://ci.freebsd.org/job/FreeBSD-main-powerpc-LINT/6082/console > > >> > > >> Searching "error:" leads to: > > >> > > >> 00:08:15.153 > /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2143:16: > > >> error: implicit declaration of function 'tcp_hw_highest_rate' is > > >> invalid in C99 [-Werror,-Wimplicit-function-declaration] > > >> 00:08:15.153 high_rate = > > >> tcp_hw_highest_rate(rack->r_ctl.crte); > > >> 00:08:15.153 ^ > > >> > > >> and > > >> > > >> 00:08:15.163 > /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2165:16: > > >> error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is > > >> invalid in C99 [-Werror,-Wimplicit-function-declaration] > > >> 00:08:15.163 high_rate = > > >> tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > > >> rack->rc_inp); > > >> 00:08:15.163 ^ > > >> > > >> I suspect this is because RATELIMIT is not defined in default powerpc > > >> build? Is it safe to enable it? > > >> > > >> Best, > > >> Li-Wen > > > > > > That should not be something RATELIMT related. I regular test > 14-CURRENT on a > > > RPi4B and the build today fails with > > > > > > -------------------------------------------------------------- > > >>>> stage 3.1: building everything > > > -------------------------------------------------------------- > > > > /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2143:16: > error: implicit declaration of function 'tcp_hw_highest_rate' is invalid in > C99 [-Werror,-Wimplicit-function-declaration] > > > high_rate = > tcp_hw_highest_rate(rack->r_ctl.crte); > > > ^ > > > > /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:2165:16: > error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is > invalid in C99 [-Werror,-Wimplicit-function-declaration] > > > high_rate = > tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > rack->rc_inp); > > > ^ > > > > /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:14166:15: > error: implicit declaration of function 'tcp_hw_highest_rate' is invalid in > C99 [-Werror,-Wimplicit-function-declaration] > > > high_rate = tcp_hw_highest_rate(rack->r_ctl.crte); > > > ^ > > > > /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:14193:15: > error: implicit declaration of function 'tcp_hw_highest_rate_ifp' is > invalid in C99 [-Werror,-Wimplicit-function-declaration] > > > high_rate = > tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > rack->rc_inp); > > > ^ > > > 4 errors generated. > > > --- rack.o --- > > > *** [rack.o] Error code 1 > > > > > > > > > RATELIMIT is included in my KERNCONF since I use tcp_bbr(4) for a > > > while on the RPi4B now. > > Can you post the kernel config you are using? I'm building the kernel on > an arm64 platform by using > > > > tuexen@parallels:~/freebsd-src/sys/arm64/conf % cat SCTP > > include GENERIC > > ident SCTP > > > > makeoptions WITH_EXTRA_TCP_STACKS=1 > > options SCTP > > options SCTP_DEBUG > > options TCPHPTS > > options TCP_BLACKBOX > > options RATELIMIT > > options DEBUG_REDZONE > > options IPFIREWALL > > options IPFIREWALL_VERBOSE > > options IPFIREWALL_VERBOSE_LIMIT=5 > > options IPFIREWALL_DEFAULT_TO_ACCEPT > > > > It looks like RATELIMIT is not defined, when tcp_ratelimit.h is > included... > > > > Best regards > > Michael > > > > > --Gordon > > > > From owner-dev-commits-src-all@freebsd.org Sat May 8 00:35:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB5BF641853; Sat, 8 May 2021 00:35:28 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcSym5tFxz3nT0; Sat, 8 May 2021 00:35:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BC54B14E7B; Sat, 8 May 2021 00:35:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1480ZS2B056584; Sat, 8 May 2021 00:35:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1480ZSDO056583; Sat, 8 May 2021 00:35:28 GMT (envelope-from git) Date: Sat, 8 May 2021 00:35:28 GMT Message-Id: <202105080035.1480ZSDO056583@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: dd02d9d605b6 - main - nfscl: Add support for va_birthtime to NFSv4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dd02d9d605b6d8849e858d7644bb84b45c606b46 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2021 00:35:28 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=dd02d9d605b6d8849e858d7644bb84b45c606b46 commit dd02d9d605b6d8849e858d7644bb84b45c606b46 Author: Rick Macklem AuthorDate: 2021-05-08 00:30:56 +0000 Commit: Rick Macklem CommitDate: 2021-05-08 00:30:56 +0000 nfscl: Add support for va_birthtime to NFSv4 There is a NFSv4 file attribute called TimeCreate that can be used for va_birthtime. r362175 added some support for use of TimeCreate. This patch completes support of va_birthtime by adding support for setting this attribute to the server. It also eanbles the client to acquire and set the attribute for a NFSv4 server that supports the attribute. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30156 --- sys/fs/nfs/nfs_commonsubs.c | 2 ++ sys/fs/nfs/nfsproto.h | 2 ++ sys/fs/nfsclient/nfs_clcomsubs.c | 4 ++++ sys/fs/nfsclient/nfs_clport.c | 2 ++ sys/fs/nfsclient/nfs_clrpcops.c | 3 +++ sys/fs/nfsclient/nfs_clvnops.c | 5 ++++- sys/fs/nfsserver/nfs_nfsdserv.c | 9 +++++++++ 7 files changed, 26 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 539cbbbde7d2..7ddef0f19ddc 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -1248,6 +1248,8 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, nap->na_rdev = (NFSDEV_T)0; nap->na_mtime.tv_sec = 0; nap->na_mtime.tv_nsec = 0; + nap->na_btime.tv_sec = -1; + nap->na_btime.tv_nsec = 0; nap->na_gen = 0; nap->na_flags = 0; nap->na_blocksize = NFS_FABLKSIZE; diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h index 236d8c14ff24..a1a992d14cdb 100644 --- a/sys/fs/nfs/nfsproto.h +++ b/sys/fs/nfs/nfsproto.h @@ -1227,6 +1227,7 @@ struct nfsv3_sattr { NFSATTRBM_RAWDEV | \ NFSATTRBM_SPACEUSED | \ NFSATTRBM_TIMEACCESS | \ + NFSATTRBM_TIMECREATE | \ NFSATTRBM_TIMEMETADATA | \ NFSATTRBM_TIMEMODIFY) @@ -1258,6 +1259,7 @@ struct nfsv3_sattr { NFSATTRBM_RAWDEV | \ NFSATTRBM_SPACEUSED | \ NFSATTRBM_TIMEACCESS | \ + NFSATTRBM_TIMECREATE | \ NFSATTRBM_TIMEMETADATA | \ NFSATTRBM_TIMEMODIFY) diff --git a/sys/fs/nfsclient/nfs_clcomsubs.c b/sys/fs/nfsclient/nfs_clcomsubs.c index 8a51d51f093f..554f5e820f54 100644 --- a/sys/fs/nfsclient/nfs_clcomsubs.c +++ b/sys/fs/nfsclient/nfs_clcomsubs.c @@ -284,6 +284,8 @@ nfsm_loadattr(struct nfsrv_descript *nd, struct nfsvattr *nap) fxdr_nfsv3time(&fp->fa3_atime, &nap->na_atime); fxdr_nfsv3time(&fp->fa3_ctime, &nap->na_ctime); fxdr_nfsv3time(&fp->fa3_mtime, &nap->na_mtime); + nap->na_btime.tv_sec = -1; + nap->na_btime.tv_nsec = 0; nap->na_flags = 0; nap->na_gen = 0; nap->na_filerev = 0; @@ -315,6 +317,8 @@ nfsm_loadattr(struct nfsrv_descript *nd, struct nfsvattr *nap) nap->na_ctime.tv_sec = fxdr_unsigned(u_int32_t, fp->fa2_ctime.nfsv2_sec); nap->na_ctime.tv_nsec = 0; + nap->na_btime.tv_sec = -1; + nap->na_btime.tv_nsec = 0; nap->na_gen = fxdr_unsigned(u_int32_t,fp->fa2_ctime.nfsv2_usec); nap->na_filerev = 0; } diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index 64820cd11f1c..492b93340e4e 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -415,6 +415,7 @@ ncl_copy_vattr(struct vattr *dst, struct vattr *src) dst->va_atime = src->va_atime; dst->va_mtime = src->va_mtime; dst->va_ctime = src->va_ctime; + dst->va_birthtime = src->va_birthtime; dst->va_gen = src->va_gen; dst->va_flags = src->va_flags; dst->va_rdev = src->va_rdev; @@ -466,6 +467,7 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvattr *nap, void *nvaper, np->n_vattr.na_size = nap->na_size; np->n_vattr.na_mtime = nap->na_mtime; np->n_vattr.na_ctime = nap->na_ctime; + np->n_vattr.na_btime = nap->na_btime; np->n_vattr.na_fsid = nap->na_fsid; np->n_vattr.na_mode = nap->na_mode; } else { diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 4ce871e810fe..8cb1a2d81ff5 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -3548,6 +3548,9 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, if (gotmnton) NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_MOUNTEDONFILEID); + if (!NFSISSET_ATTRBIT(&dnp->n_vattr.na_suppattr, + NFSATTRBIT_TIMECREATE)) + NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMECREATE); } /* diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 5f81bb5b42a4..2311ea099042 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1024,7 +1024,9 @@ nfs_setattr(struct vop_setattr_args *ap) */ if ((vap->va_flags != VNOVAL || vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL || - vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL) && + vap->va_mtime.tv_sec != VNOVAL || + vap->va_birthtime.tv_sec != VNOVAL || + vap->va_mode != (mode_t)VNOVAL) && (vp->v_mount->mnt_flag & MNT_RDONLY)) return (EROFS); if (vap->va_size != VNOVAL) { @@ -1037,6 +1039,7 @@ nfs_setattr(struct vop_setattr_args *ap) case VFIFO: if (vap->va_mtime.tv_sec == VNOVAL && vap->va_atime.tv_sec == VNOVAL && + vap->va_birthtime.tv_sec == VNOVAL && vap->va_mode == (mode_t)VNOVAL && vap->va_uid == (uid_t)VNOVAL && vap->va_gid == (gid_t)VNOVAL) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 0c4fcebb8e05..8aa39e5018d9 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -491,6 +491,15 @@ nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram, NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_TIMEMODIFYSET); } } + if (!nd->nd_repstat && + NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_TIMECREATE)) { + NFSVNO_ATTRINIT(&nva2); + NFSVNO_SETATTRVAL(&nva2, btime, nva.na_btime); + nd->nd_repstat = nfsvno_setattr(vp, &nva2, nd->nd_cred, p, + exp); + if (!nd->nd_repstat) + NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_TIMECREATE); + } if (!nd->nd_repstat && (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_MODE) || NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_MODESETMASKED))) { From owner-dev-commits-src-all@freebsd.org Sat May 8 03:43:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A614647A2D; Sat, 8 May 2021 03:43:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcY7z036tz4S15; Sat, 8 May 2021 03:43:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E8A5D17CDD; Sat, 8 May 2021 03:43:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1483hg6K008018; Sat, 8 May 2021 03:43:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1483hg63008017; Sat, 8 May 2021 03:43:42 GMT (envelope-from git) Date: Sat, 8 May 2021 03:43:42 GMT Message-Id: <202105080343.1483hg63008017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fedor Uporov Subject: git: 2a984c2b4982 - main - Make encode/decode extra time functions inline. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2a984c2b49822bb4a31aeb6a050d746aef73162f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2021 03:43:43 -0000 The branch main has been updated by fsu: URL: https://cgit.FreeBSD.org/src/commit/?id=2a984c2b49822bb4a31aeb6a050d746aef73162f commit 2a984c2b49822bb4a31aeb6a050d746aef73162f Author: Fedor Uporov AuthorDate: 2021-05-08 03:42:20 +0000 Commit: Fedor Uporov CommitDate: 2021-05-08 03:42:20 +0000 Make encode/decode extra time functions inline. Mentioned by: pfg MFC after: 2 weeks --- sys/fs/ext2fs/ext2_inode_cnv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/ext2fs/ext2_inode_cnv.c b/sys/fs/ext2fs/ext2_inode_cnv.c index 5ca00f3be050..181ea3e04622 100644 --- a/sys/fs/ext2fs/ext2_inode_cnv.c +++ b/sys/fs/ext2fs/ext2_inode_cnv.c @@ -130,7 +130,7 @@ ext2_new_decode_dev(uint32_t dev) return (makedev(maj, min)); } -static void +static inline void ext2_decode_extra_time(ext_time_t *sec, int32_t *nsec, uint32_t extra) { if (extra & htole32(EXT3_EPOCH_MASK)) @@ -237,7 +237,7 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) return (ext2_ei_csum_verify(ip, ei)); } -static uint32_t +static inline uint32_t ext2_encode_extra_time(int64_t sec, int32_t nsec) { uint32_t extra; From owner-dev-commits-src-all@freebsd.org Sat May 8 04:49:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1EFB0628B3B; Sat, 8 May 2021 04:49:04 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcZbN0M6Bz4Tsk; Sat, 8 May 2021 04:49:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F351818CA4; Sat, 8 May 2021 04:49:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1484n3oX090519; Sat, 8 May 2021 04:49:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1484n3ik090518; Sat, 8 May 2021 04:49:03 GMT (envelope-from git) Date: Sat, 8 May 2021 04:49:03 GMT Message-Id: <202105080449.1484n3ik090518@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 0da5e909e9c9 - stable/12 - release.7: update for current context MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0da5e909e9c97c8937fec68888eea674fd59a081 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2021 04:49:04 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0da5e909e9c97c8937fec68888eea674fd59a081 commit 0da5e909e9c97c8937fec68888eea674fd59a081 Author: Ed Maste AuthorDate: 2020-09-01 15:30:40 +0000 Commit: Gordon Bergling CommitDate: 2021-05-08 04:47:16 +0000 release.7: update for current context It's no longer unusual to be able to build a release with a single command, so drop "actually" that hints at a surprise. Also just use "network install directory" instead of referencing FTP; it's more likely to be HTTP now. Reviewed by: gjb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26260 (cherry picked from commit 55c9a224e2a9c01d461003837ff6563803b63210) --- share/man/man7/release.7 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/man/man7/release.7 b/share/man/man7/release.7 index cd25a86c985e..02ee2dfc0e5e 100644 --- a/share/man/man7/release.7 +++ b/share/man/man7/release.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 16, 2020 +.Dd September 1, 2020 .Dt RELEASE 7 .Os .Sh NAME @@ -40,9 +40,9 @@ All of the tools necessary to build a release are available from the .Fx source code repository in .Pa src/release . -A complete release can actually be built with only a single command, +A complete release can be built with only a single command, including the creation of ISO images suitable for burning to CD-ROM, -memory stick images, and an FTP install directory. +memory stick images, and a network install directory. This command is aptly named .Dq Li "make release" . .Pp @@ -96,7 +96,7 @@ assurance, or other aspects of the release engineering process. .Sh CLEAN RELEASE GENERATION Official releases of .Fx -are produced in a totally clean environment to +are produced in a clean environment to ensure consistency between the versions of the src, ports, and doc trees and to avoid contamination from the host system .Po such as local patches, changes From owner-dev-commits-src-all@freebsd.org Sat May 8 04:56:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D7677628B61; Sat, 8 May 2021 04:56:40 +0000 (UTC) (envelope-from Michael.Tuexen@macmic.franken.de) Received: from drew.franken.de (mail-n.franken.de [193.175.24.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcZm84vBVz4Vl0; Sat, 8 May 2021 04:56:40 +0000 (UTC) (envelope-from Michael.Tuexen@macmic.franken.de) Received: from smtpclient.apple (unknown [IPv6:2a02:8109:1140:c3d:3c9c:d798:46ee:1549]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id C879E721E2806; Sat, 8 May 2021 06:56:36 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Subject: Re: git: 5d8fd932e418 - main - This brings into sync FreeBSD with the netflix versions of rack and bbr. This fixes several breakages (panics) since the tcp_lro code was committed that have been reported. Quite a few new features are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the largest). There is also support for ack-war prevention. Documents comming soon on rack.. From: Michael Tuexen In-Reply-To: Date: Sat, 8 May 2021 06:56:35 +0200 Cc: Gordon Bergling , Li-Wen Hsu , Randall Stewart , src-committers , "" , dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <202105061526.146FQS0E008755@gitrepo.freebsd.org> <78FF7B31-B84D-4D97-9E57-D000A6B09D7D@macmic.franken.de> <504C85E6-8967-40CC-8E12-F20F78B3226F@macmic.franken.de> To: Warner Losh X-Mailer: Apple Mail (2.3654.80.0.2.43) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4FcZm84vBVz4Vl0 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2021 04:56:40 -0000 > On 8. May 2021, at 02:04, Warner Losh wrote: >=20 >=20 >=20 > On Fri, May 7, 2021, 12:38 PM Michael Tuexen = wrote: > > On 7. May 2021, at 20:26, Warner Losh wrote: > >=20 > > https://reviews.freebsd.org/D30163 > >=20 > > May be the ticket to solve this... > I don't understand that. RACK should just compile fine when RATELIMIT = is defined > in the kernel config. Gordon states that this is the case for him. > Whu do you think that D30163 is needed to compile RACK on a platform = where > RATELIMIT is in the kernel config? >=20 > We need ot to compile the module when it isn't in the kernel. Modules = have to compile, even for illegal combinations of options or be omitted = from building... Understood. But Gordon stated that he has RATELIMIT defined in his kernel config. So I guess he is experiencing a different issue, which I would like to = understand the root cause for. Best regards Michael >=20 > Warner=20 >=20 > Best regards > Michael > >=20 > > Warner=20 > >=20 > > On Fri, May 7, 2021, 12:03 PM Michael Tuexen = wrote: > > > On 7. May 2021, at 19:47, Gordon Bergling wrote: > > >=20 > > > On Fri, May 07, 2021 at 05:39:37PM +0800, Li-Wen Hsu wrote: > > >> On Thu, May 6, 2021 at 11:26 PM Randall Stewart = wrote: > > >>>=20 > > >>> The branch main has been updated by rrs: > > >>>=20 > > >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D5d8fd932e418f03e98b3469c4088a36f= 0ef34ffe > > >>>=20 > > >>> commit 5d8fd932e418f03e98b3469c4088a36f0ef34ffe > > >>> Author: Randall Stewart > > >>> AuthorDate: 2021-05-06 15:22:26 +0000 > > >>> Commit: Randall Stewart > > >>> CommitDate: 2021-05-06 15:22:26 +0000 > > >>>=20 > > >>> This brings into sync FreeBSD with the netflix versions of = rack and bbr. > > >>> This fixes several breakages (panics) since the tcp_lro code = was > > >>> committed that have been reported. Quite a few new features = are > > >>> now in rack (prefecting of DGP -- Dynamic Goodput Pacing = among the > > >>> largest). There is also support for ack-war prevention. = Documents > > >>> comming soon on rack.. > > >>>=20 > > >>> Sponsored by: Netflix > > >>> Reviewed by: rscheff, mtuexen > > >>> Differential Revision: https://reviews.freebsd.org/D30036 > > >>=20 > > >> This seems braking LINT kernel build of powerpc: > > >>=20 > > >> https://ci.freebsd.org/job/FreeBSD-main-powerpc-LINT/6082/console > > >>=20 > > >> Searching "error:" leads to: > > >>=20 > > >> 00:08:15.153 = /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:214= 3:16: > > >> error: implicit declaration of function 'tcp_hw_highest_rate' is > > >> invalid in C99 [-Werror,-Wimplicit-function-declaration] > > >> 00:08:15.153 high_rate =3D > > >> tcp_hw_highest_rate(rack->r_ctl.crte); > > >> 00:08:15.153 ^ > > >>=20 > > >> and > > >>=20 > > >> 00:08:15.163 = /workspace/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks/rack.c:216= 5:16: > > >> error: implicit declaration of function 'tcp_hw_highest_rate_ifp' = is > > >> invalid in C99 [-Werror,-Wimplicit-function-declaration] > > >> 00:08:15.163 high_rate =3D > > >> tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, > > >> rack->rc_inp); > > >> 00:08:15.163 ^ > > >>=20 > > >> I suspect this is because RATELIMIT is not defined in default = powerpc > > >> build? Is it safe to enable it? > > >>=20 > > >> Best, > > >> Li-Wen > > >=20 > > > That should not be something RATELIMT related. I regular test = 14-CURRENT on a > > > RPi4B and the build today fails with > > >=20 > > > -------------------------------------------------------------- > > >>>> stage 3.1: building everything > > > -------------------------------------------------------------- > > > = /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks= /rack.c:2143:16: error: implicit declaration of function = 'tcp_hw_highest_rate' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > > > high_rate =3D = tcp_hw_highest_rate(rack->r_ctl.crte); > > > ^ > > > = /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks= /rack.c:2165:16: error: implicit declaration of function = 'tcp_hw_highest_rate_ifp' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > > > high_rate =3D = tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, = rack->rc_inp); > > > ^ > > > = /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks= /rack.c:14166:15: error: implicit declaration of function = 'tcp_hw_highest_rate' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > > > high_rate =3D = tcp_hw_highest_rate(rack->r_ctl.crte); > > > ^ > > > = /tank/nfs_public/tiny/src/sys/modules/tcp/rack/../../../netinet/tcp_stacks= /rack.c:14193:15: error: implicit declaration of function = 'tcp_hw_highest_rate_ifp' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > > > high_rate =3D = tcp_hw_highest_rate_ifp(rack->rc_inp->inp_route.ro_nh->nh_ifp, = rack->rc_inp); > > > ^ > > > 4 errors generated. > > > --- rack.o --- > > > *** [rack.o] Error code 1 > > >=20 > > >=20 > > > RATELIMIT is included in my KERNCONF since I use tcp_bbr(4) for a > > > while on the RPi4B now. > > Can you post the kernel config you are using? I'm building the = kernel on an arm64 platform by using > >=20 > > tuexen@parallels:~/freebsd-src/sys/arm64/conf % cat SCTP=20 > > include GENERIC > > ident SCTP =20 > >=20 > > makeoptions WITH_EXTRA_TCP_STACKS=3D1 > > options SCTP > > options SCTP_DEBUG > > options TCPHPTS > > options TCP_BLACKBOX > > options RATELIMIT > > options DEBUG_REDZONE > > options IPFIREWALL > > options IPFIREWALL_VERBOSE > > options IPFIREWALL_VERBOSE_LIMIT=3D5 > > options IPFIREWALL_DEFAULT_TO_ACCEPT > >=20 > > It looks like RATELIMIT is not defined, when tcp_ratelimit.h is = included... > >=20 > > Best regards > > Michael > >=20 > > > --Gordon > >=20 >=20 From owner-dev-commits-src-all@freebsd.org Sat May 8 05:22:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65AA16291C2; Sat, 8 May 2021 05:22:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcbKt27y6z4WPr; Sat, 8 May 2021 05:22:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.12] (unknown [181.51.107.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id C990FD424; Sat, 8 May 2021 05:22:25 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: git: 5a4333a5378f - main - This takes Warners suggested approach to making it so that platforms that for whatever reason cannot include the RATELIMIT option can still work with rack. It adds two dummy functions that rack will call and find out that the highest hw supported b/w is 0 (which kinda makes sense and rack is already prepared to handle). To: Randall Stewart Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202105072134.147LYjPn018824@gitrepo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Message-ID: <4b297976-4b06-33a8-b390-18c01561b463@FreeBSD.org> Date: Sat, 8 May 2021 00:22:24 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2021 05:22:26 -0000 On 07/05/2021 16:37, Jessica Clarke wrote: > On 7 May 2021, at 22:34, Randall Stewart wrote: >> The branch main has been updated by rrs: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=5a4333a5378f7afe4f8cab293a987865ae0c32c4 >> >> commit 5a4333a5378f7afe4f8cab293a987865ae0c32c4 >> Author: Randall Stewart >> AuthorDate: 2021-05-07 21:32:32 +0000 >> Commit: Randall Stewart >> CommitDate: 2021-05-07 21:32:32 +0000 >> >> This takes Warners suggested approach to making it so that >> platforms that for whatever reason cannot include the RATELIMIT option >> can still work with rack. It adds two dummy functions that rack will >> call and find out that the highest hw supported b/w is 0 (which >> kinda makes sense and rack is already prepared to handle). > Hi Randall, > Could you please start writing a proper separate subject line for your git > commits? This is not best practice, and many tools behave poorly in the > presence of one big paragraph at the start rather than a separate subject line, > including the email hook here. See [1] for FreeBSD’s own guide on the matter. > > Jess > > [1] https://docs.freebsd.org/en/articles/committers-guide/#commit-log-message > +1 even in git this breaks the shortlog in ugly ways. From owner-dev-commits-src-all@freebsd.org Sat May 8 06:25:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7C7662A84D; Sat, 8 May 2021 06:25:34 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fcckk4LNJz4Ycb; Sat, 8 May 2021 06:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 881FD1A21C; Sat, 8 May 2021 06:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1486PY7C022465; Sat, 8 May 2021 06:25:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1486PYS0022464; Sat, 8 May 2021 06:25:34 GMT (envelope-from git) Date: Sat, 8 May 2021 06:25:34 GMT Message-Id: <202105080625.1486PYS0022464@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 2018d4886281 - main - stress2: Added two new syzkaller reproducers. Update the exclude list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2018d4886281275b4222c860545fa97ab97029e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2021 06:25:34 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=2018d4886281275b4222c860545fa97ab97029e3 commit 2018d4886281275b4222c860545fa97ab97029e3 Author: Peter Holm AuthorDate: 2021-05-08 06:24:42 +0000 Commit: Peter Holm CommitDate: 2021-05-08 06:24:42 +0000 stress2: Added two new syzkaller reproducers. Update the exclude list --- tools/test/stress2/misc/all.exclude | 4 +- tools/test/stress2/misc/syzkaller35.sh | 101 +++++++++++++++++++++++++++++++++ tools/test/stress2/misc/syzkaller36.sh | 98 ++++++++++++++++++++++++++++++++ 3 files changed, 201 insertions(+), 2 deletions(-) diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index 50e4d0ecc77b..e388fa8957d9 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -48,8 +48,6 @@ quota10.sh people.freebsd.org/~pho/stress/log/quota10-2.txt 20200525 quota2.sh panic: dqflush: stray dquot 20120221 quota3.sh panic: softdep_deallocate_dependencies: unrecovered ... 20111222 quota7.sh panic: dqflush: stray dquot 20120221 -sctp.sh panic: Queues are not empty when handling ... i386 20201104 -sctp2.sh panic: soclose: SS_NOFDREF on enter 20200307 sctp3.sh panic: Queues are not empty when handling SHUTDOWN-COMPLETE 20210211 sendfile25.sh WiP 20200611 signal.sh Timing issues. Needs fixing 20171116 @@ -72,6 +70,8 @@ syzkaller30.sh May change policy for random threads to to domainset_fixed 20210 syzkaller31.sh panic: Bad tailq NEXT(0xfffffe0079608f00->tqh_last) != NULL 20210322 syzkaller32.sh Fatal trap 18: integer divide fault while in kernel mode 20210322 syzkaller33.sh Fatal trap 18: integer divide fault while in kernel mode 20210418 +syzkaller35.sh panic: AEAD without a separate IV 20210508 +syzkaller36.sh panic: IV outside buffer length 20210508 truss3.sh WiP 20200915 unionfs.sh insmntque: non-locked vp: xx is not exclusive locked... 20130909 unionfs2.sh insmntque: mp-safe fs and non-locked vp is not ... 20111219 diff --git a/tools/test/stress2/misc/syzkaller35.sh b/tools/test/stress2/misc/syzkaller35.sh new file mode 100755 index 000000000000..14619c24ab9c --- /dev/null +++ b/tools/test/stress2/misc/syzkaller35.sh @@ -0,0 +1,101 @@ +#!/bin/sh + +# panic: AEAD without a separate IV +# cpuid = 18 +# time = 1620305816 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe01aeea25d0 +# vpanic() at vpanic+0x181/frame 0xfffffe01aeea2620 +# panic() at panic+0x43/frame 0xfffffe01aeea2680 +# crp_sanity() at crp_sanity+0x4e9/frame 0xfffffe01aeea26b0 +# crypto_dispatch() at crypto_dispatch+0xf/frame 0xfffffe01aeea26d0 +# crypto_ioctl() at crypto_ioctl+0x1e33/frame 0xfffffe01aeea27e0 +# devfs_ioctl() at devfs_ioctl+0xcd/frame 0xfffffe01aeea2830 +# VOP_IOCTL_APV() at VOP_IOCTL_APV+0x59/frame 0xfffffe01aeea2850 +# vn_ioctl() at vn_ioctl+0x133/frame 0xfffffe01aeea2960 +# devfs_ioctl_f() at devfs_ioctl_f+0x1e/frame 0xfffffe01aeea2980 +# kern_ioctl() at kern_ioctl+0x289/frame 0xfffffe01aeea29f0 +# sys_ioctl() at sys_ioctl+0x12a/frame 0xfffffe01aeea2ac0 +# amd64_syscall() at amd64_syscall+0x147/frame 0xfffffe01aeea2bf0 +# fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe01aeea2bf0 +# --- syscall (0, FreeBSD ELF64, nosys), rip = 0x8003827da, rsp = 0x7fffffffe848, rbp = 0x7fffffffe890 --- +# KDB: enter: panic +# [ thread pid 4018 tid 100350 ] +# Stopped at kdb_enter+0x37: movq $0,0x1282a9e(%rip) +# db> x/s version +# version: FreeBSD 14.0-CURRENT #0 main-n246502-49c894ddced: Thu May 6 09:17:33 CEST 2021 +# pho@t2.osted.lan:/usr/src/sys/amd64/compile/PHO +# db> + +[ `uname -p` != "amd64" ] && exit 0 +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg +cat > /tmp/syzkaller35.c < +#include +#include +#include +#include +#include +#include +#include +#include +#include + +uint64_t r[1] = {0xffffffffffffffff}; + +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); + intptr_t res = 0; + memcpy((void*)0x20000340, "/dev/crypto\000", 12); + res = syscall(SYS_openat, 0xffffffffffffff9cul, 0x20000340ul, 0ul, 0ul); + if (res != -1) + r[0] = res; + *(uint32_t*)0x20000440 = 0x28; + *(uint32_t*)0x20000444 = 0; + *(uint32_t*)0x20000448 = 0x10; + *(uint64_t*)0x20000450 = 0x20000380; + memcpy((void*)0x20000380, + "\x3c\x02\x2e\x61\x79\x2e\xec\xb0\x7f\x8a\xee\x18\xe5\xaa\x35\x05", + 16); + *(uint32_t*)0x20000458 = 0; + *(uint64_t*)0x20000460 = 0; + *(uint32_t*)0x20000468 = 0; + *(uint32_t*)0x2000046c = 0xfdffffff; + *(uint32_t*)0x20000470 = 0; + *(uint32_t*)0x20000474 = 0; + *(uint32_t*)0x20000478 = 0; + *(uint32_t*)0x2000047c = 0; + syscall(SYS_ioctl, r[0], 0xc040636aul, 0x20000440ul); + *(uint32_t*)0x20000280 = 0; + *(uint16_t*)0x20000284 = 1; + *(uint16_t*)0x20000286 = 0; + *(uint32_t*)0x20000288 = 0xf0a; + *(uint32_t*)0x2000028c = 0; + *(uint32_t*)0x20000290 = 0; + *(uint64_t*)0x20000298 = 0x20000480; + *(uint64_t*)0x200002a0 = 0; + *(uint64_t*)0x200002a8 = 0; + *(uint64_t*)0x200002b0 = 0x20000680; + *(uint64_t*)0x200002b8 = 0; + syscall(SYS_ioctl, r[0], 0xc040636dul, 0x20000280ul); + return 0; +} +EOF +mycc -o /tmp/syzkaller35 -Wall -Wextra -O0 /tmp/syzkaller35.c || + exit 1 + +kldload cryptodev.ko && loaded=1 +(cd /tmp; timeout 3m ./syzkaller35) +[ $loaded ] && kldunload cryptodev.ko + +rm -rf /tmp/syzkaller35 syzkaller35.c /tmp/syzkaller.* +exit 0 diff --git a/tools/test/stress2/misc/syzkaller36.sh b/tools/test/stress2/misc/syzkaller36.sh new file mode 100755 index 000000000000..ca4678408a25 --- /dev/null +++ b/tools/test/stress2/misc/syzkaller36.sh @@ -0,0 +1,98 @@ +#!/bin/sh + +# panic: IV outside buffer length +# cpuid = 22 +# time = 1620355853 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe01af19d5d0 +# vpanic() at vpanic+0x181/frame 0xfffffe01af19d620 +# panic() at panic+0x43/frame 0xfffffe01af19d680 +# crp_sanity() at crp_sanity+0x212/frame 0xfffffe01af19d6b0 +# crypto_dispatch() at crypto_dispatch+0xf/frame 0xfffffe01af19d6d0 +# crypto_ioctl() at crypto_ioctl+0x18a9/frame 0xfffffe01af19d7e0 +# devfs_ioctl() at devfs_ioctl+0xcd/frame 0xfffffe01af19d830 +# VOP_IOCTL_APV() at VOP_IOCTL_APV+0x59/frame 0xfffffe01af19d850 +# vn_ioctl() at vn_ioctl+0x133/frame 0xfffffe01af19d960 +# devfs_ioctl_f() at devfs_ioctl_f+0x1e/frame 0xfffffe01af19d980 +# kern_ioctl() at kern_ioctl+0x289/frame 0xfffffe01af19d9f0 +# sys_ioctl() at sys_ioctl+0x12a/frame 0xfffffe01af19dac0 +# amd64_syscall() at amd64_syscall+0x147/frame 0xfffffe01af19dbf0 +# fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe01af19dbf0 +# --- syscall (0, FreeBSD ELF64, nosys), rip = 0x8003827da, rsp = 0x7fffffffe4f8, rbp = 0x7fffffffe540 --- +# KDB: enter: panic +# [ thread pid 2908 tid 100493 ] +# Stopped at kdb_enter+0x37: movq $0,0x1282a9e(%rip) +# db> x/s version +# version: FreeBSD 14.0-CURRENT #1 main-n246506-be578b67b5a: Thu May 6 19:40:29 CEST 2021 +# pho@t2.osted.lan:/usr/src/sys/amd64/compile/PHO +# db> + +[ `uname -p` != "amd64" ] && exit 0 +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg +cat > /tmp/syzkaller36.c < +#include +#include +#include +#include +#include +#include +#include +#include +#include + +uint64_t r[1] = {0xffffffffffffffff}; + +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); + intptr_t res = 0; + memcpy((void*)0x20000000, "/dev/crypto\000", 12); + res = syscall(SYS_openat, 0xffffffffffffff9cul, 0x20000000ul, 0ul, 0ul); + if (res != -1) + r[0] = res; + *(uint32_t*)0x20000440 = 0x17; + *(uint32_t*)0x20000444 = 0; + *(uint32_t*)0x20000448 = 0x10; + *(uint64_t*)0x20000450 = 0x200001c0; + memcpy((void*)0x200001c0, + "\x3c\x02\x2e\x61\x79\x2e\xec\xb0\x7f\x8a\xee\x18\xe5\xaa\x35\x05", + 16); + *(uint32_t*)0x20000458 = 0; + *(uint64_t*)0x20000460 = 0; + *(uint32_t*)0x20000468 = 0; + *(uint32_t*)0x2000046c = 0xfdffffff; + *(uint32_t*)0x20000470 = 0; + *(uint32_t*)0x20000474 = 0; + *(uint32_t*)0x20000478 = 0; + *(uint32_t*)0x2000047c = 0; + syscall(SYS_ioctl, r[0], 0xc040636aul, 0x20000440ul); + *(uint32_t*)0x20000180 = 0; + *(uint16_t*)0x20000184 = 1; + *(uint16_t*)0x20000186 = 0; + *(uint32_t*)0x20000188 = 7; + *(uint64_t*)0x20000190 = 0x20000200; + *(uint64_t*)0x20000198 = 0; + *(uint64_t*)0x200001a0 = 0; + *(uint64_t*)0x200001a8 = 0; + syscall(SYS_ioctl, r[0], 0xc0306367ul, 0x20000180ul); + return 0; +} +EOF +mycc -o /tmp/syzkaller36 -Wall -Wextra -O0 /tmp/syzkaller36.c || + exit 1 + +kldload cryptodev.ko && loaded=1 +(cd /tmp; timeout 3m ./syzkaller36) +[ $loaded ] && kldunload cryptodev.ko + +rm -rf /tmp/syzkaller36 syzkaller36.c /tmp/syzkaller.* +exit 0 From owner-dev-commits-src-all@freebsd.org Sat May 8 07:05:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8E7562B2A7; Sat, 8 May 2021 07:05:16 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (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 "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcdcX4Klsz4ZcH; Sat, 8 May 2021 07:05:16 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1620457516; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=T6gE3sJvYXNI3WSpoUS8/xNLRw7oNb3aMmQO6dmjHzs=; b=uAOLmbnamBQanWF04QevGr2N8suxl3ngMxlS6cvPs03tIyew4KSMc7Het0zVtbXD2kekQR tQJtTzY9/9YIT+Nk4icqPblrcEeZ4vMKrVHNGeyyaqmJDvr2mtf+aEBSVxy69FVImzhqOQ P0OlsV0q0HGjrIXZ54JkrYYl+jF2Rl2nDpYC1GKuj6QH+4I+nl/xpDnFxUFFYEn1Zo68xf okodv589/l9xvOks/ioubZIBOlrs+HhgbWWN7ly0JZaJ739z9zlouqEBDKLUDYHfDoHdHU mJLTgq72NetrJq/8OoUuwWQhE0slASGjrkVXfRiO7v7F+Ts+EhgLCE1C5eqo7g== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 78FF8789C; Sat, 8 May 2021 07:05:16 +0000 (UTC) Date: Sat, 8 May 2021 07:05:16 +0000 From: Alexey Dokuchaev To: Pedro Giffuni Cc: Randall Stewart , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 5a4333a5378f - main - This takes Warners suggested approach to making it so that platforms that for whatever reason cannot include the RATELIMIT option can still work with rack. It adds two dummy functions that rack will call and find out that the highest hw supported b/w is 0 (which kinda makes sense and rack is already prepared to handle). Message-ID: References: <202105072134.147LYjPn018824@gitrepo.freebsd.org> <4b297976-4b06-33a8-b390-18c01561b463@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4b297976-4b06-33a8-b390-18c01561b463@FreeBSD.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1620457516; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=T6gE3sJvYXNI3WSpoUS8/xNLRw7oNb3aMmQO6dmjHzs=; b=vZe9pE4rvdtLcpMqiNMgqz+H9L4F8gDYes2F/CXdNGmCR9hYkUhuASIsxweb74UmxaiRZ5 g9Qt22ts8i6yshBsPe2DfLPEQAsX44qmyIJq5oLWQJPjJQjhLot0kl+m0qyjFwXjV4qhko lQO8CbqZU5EPqKFyOiPJK3ilKdmHq+mnuMCYjVGuOs4/kUms1AzrQdjPjsMXn4geAGJs8j 6LhQBYWQGtSMlv3DUsk7SnDNqJO2H4K3fLMmi8d0ni1xgTdbScw1c7F+7q4f0sUqeyKEkR ZaL05zweJjdLjHLDt7VkfsBT8bB1HIPZSY3IhULDtSjW4GRQuzuXbXPqM0CL7A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1620457516; a=rsa-sha256; cv=none; b=G6MwBpXl2eYp2ErpiXq9VsphjPxVu3J6D/BGqLQ0Y20Zz4gQ2gGWkqueGEJFWd48AOehYm AhwCmMRRU8gHXDaOnzsMFK2aMBiaSYzLnL6UOLmT6AKB+6gIiQuemGC6M6DspSTyyAG6ak eVfFXCkvXNBMfm8GF66TuGxY46MQZW+Lyd60PBGqUrVMtQBk52ZuVZd+wIEqU/SoLLDF4F sN/IKUp22EOQrBl7PAMXCeUI9xdrjESfIkPMpSvgyyRtmyvyXvUeDgVuSCHXdsaex3D3bY LEKM8yBB2hcEuYRVHIUXGKk+KVClJv2M+gAzoW7Gj5wt5k7sERCfkRbFHFamhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2021 07:05:16 -0000 On Sat, May 08, 2021 at 12:22:24AM -0500, Pedro Giffuni wrote: > ... > +1 even in git this breaks the shortlog in ugly ways. Someone(tm) should probably file an issue at their upstream, as ignoring \n and only stopping at \n\n for short log definitely looks like a bug to me. ./danfe From owner-dev-commits-src-all@freebsd.org Sat May 8 14:47:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD1B2636DF8; Sat, 8 May 2021 14:47:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fcqt55Ry0z3CHd; Sat, 8 May 2021 14:47:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AE307207B5; Sat, 8 May 2021 14:47:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 148ElfLg087473; Sat, 8 May 2021 14:47:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 148ElfvN087472; Sat, 8 May 2021 14:47:41 GMT (envelope-from git) Date: Sat, 8 May 2021 14:47:41 GMT Message-Id: <202105081447.148ElfvN087472@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ruslan Bukin Subject: git: 9146c6240d14 - main - ofw: support for a single 'port' DTS property. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: br X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9146c6240d14df78e2cb3397b3ba33eb587e7972 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2021 14:47:41 -0000 The branch main has been updated by br: URL: https://cgit.FreeBSD.org/src/commit/?id=9146c6240d14df78e2cb3397b3ba33eb587e7972 commit 9146c6240d14df78e2cb3397b3ba33eb587e7972 Author: Ruslan Bukin AuthorDate: 2021-05-08 14:41:57 +0000 Commit: Ruslan Bukin CommitDate: 2021-05-08 14:41:57 +0000 ofw: support for a single 'port' DTS property. On rk3399 the VOP-little node has a single 'port' property (not a collection of 'ports' or indexed ports). Reviewed by: manu Sponsored by: UKRI Differential Revision: https://reviews.freebsd.org/D30165 --- sys/dev/ofw/ofw_graph.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/ofw/ofw_graph.c b/sys/dev/ofw/ofw_graph.c index 0ef53486804d..3f7ddb004eb0 100644 --- a/sys/dev/ofw/ofw_graph.c +++ b/sys/dev/ofw/ofw_graph.c @@ -60,6 +60,14 @@ ofw_graph_get_port_by_idx(phandle_t node, uint32_t idx) if (child != 0) return (child); + /* Now check for 'port' without explicit index. */ + if (idx == 0) { + snprintf(portnode, sizeof(portnode), "port"); + child = ofw_bus_find_child(node, portnode); + if (child != 0) + return (child); + } + /* Next try to look under ports */ ports = ofw_bus_find_child(node, "ports"); if (ports == 0) From owner-dev-commits-src-all@freebsd.org Sat May 8 20:53:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B34763F7A7; Sat, 8 May 2021 20:53:08 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fczzm2f5dz3lBb; Sat, 8 May 2021 20:53:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4DB052565A; Sat, 8 May 2021 20:53:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 148Kr8so079053; Sat, 8 May 2021 20:53:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 148Kr8j9079052; Sat, 8 May 2021 20:53:08 GMT (envelope-from git) Date: Sat, 8 May 2021 20:53:08 GMT Message-Id: <202105082053.148Kr8j9079052@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 6cb13813caa0 - main - sbin/ipfw: Fix parsing error in table based forward MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6cb13813caa09305046e0cecad8bba3ae2287b0d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2021 20:53:08 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=6cb13813caa09305046e0cecad8bba3ae2287b0d commit 6cb13813caa09305046e0cecad8bba3ae2287b0d Author: Lutz Donnerhacke AuthorDate: 2021-05-07 18:59:34 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-08 20:52:17 +0000 sbin/ipfw: Fix parsing error in table based forward The argument parser does not recognise the optional port for an "tablearg" argument. Fix simplifies the code by make the internal representation expicit for the parser. PR: 252744 MFC: 1 week Reported by: Approved by: nc Tested by: Differential Revision: https://reviews.freebsd.org/D30164 --- sbin/ipfw/ipfw2.c | 87 +++++++++++++++++++++++++++---------------------------- 1 file changed, 42 insertions(+), 45 deletions(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index c17fbbca7dfa..498da22e6599 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -4021,57 +4021,54 @@ chkarg: NEED1("missing forward address[:port]"); - if (_substrcmp(*av, "tablearg") == 0) { - family = PF_INET; - ((struct sockaddr_in*)&result)->sin_addr.s_addr = - INADDR_ANY; - } else { - /* - * Are we an bracket-enclosed IPv6 address? - */ - if (strchr(*av, '[')) - (*av)++; + if (strncmp(*av, "tablearg", 8) == 0) + memcpy(++(*av), "0.0.0.0", 7); - /* - * locate the address-port separator (':' or ',') - */ - s = strchr(*av, ','); - if (s == NULL) { - s = strchr(*av, ']'); - /* Prevent erroneous parsing on brackets. */ - if (s != NULL) - *(s++) = '\0'; - else - s = *av; - - /* Distinguish between IPv4:port and IPv6 cases. */ - s = strchr(s, ':'); - if (s && strchr(s+1, ':')) - s = NULL; /* no port */ - } + /* + * Are we an bracket-enclosed IPv6 address? + */ + if (strchr(*av, '[')) + (*av)++; - if (s != NULL) { - /* Terminate host portion and set s to start of port. */ + /* + * locate the address-port separator (':' or ',') + */ + s = strchr(*av, ','); + if (s == NULL) { + s = strchr(*av, ']'); + /* Prevent erroneous parsing on brackets. */ + if (s != NULL) *(s++) = '\0'; - i = strtoport(s, &end, 0 /* base */, 0 /* proto */); - if (s == end) - errx(EX_DATAERR, - "illegal forwarding port ``%s''", s); - port_number = (u_short)i; - } + else + s = *av; - /* - * Resolve the host name or address to a family and a - * network representation of the address. - */ - if (getaddrinfo(*av, NULL, NULL, &res)) - errx(EX_DATAERR, NULL); - /* Just use the first host in the answer. */ - family = res->ai_family; - memcpy(&result, res->ai_addr, res->ai_addrlen); - freeaddrinfo(res); + /* Distinguish between IPv4:port and IPv6 cases. */ + s = strchr(s, ':'); + if (s && strchr(s+1, ':')) + s = NULL; /* no port */ } + if (s != NULL) { + /* Terminate host portion and set s to start of port. */ + *(s++) = '\0'; + i = strtoport(s, &end, 0 /* base */, 0 /* proto */); + if (s == end) + errx(EX_DATAERR, + "illegal forwarding port ``%s''", s); + port_number = (u_short)i; + } + + /* + * Resolve the host name or address to a family and a + * network representation of the address. + */ + if (getaddrinfo(*av, NULL, NULL, &res)) + errx(EX_DATAERR, NULL); + /* Just use the first host in the answer. */ + family = res->ai_family; + memcpy(&result, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); + if (family == PF_INET) { ipfw_insn_sa *p = (ipfw_insn_sa *)action; From owner-dev-commits-src-all@freebsd.org Sun May 9 01:46:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B41164584D; Sun, 9 May 2021 01:46:45 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fd6VY1rXbz4T2R; Sun, 9 May 2021 01:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 324A2F62; Sun, 9 May 2021 01:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1491kjFb062074; Sun, 9 May 2021 01:46:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1491kjXo062073; Sun, 9 May 2021 01:46:45 GMT (envelope-from git) Date: Sun, 9 May 2021 01:46:45 GMT Message-Id: <202105090146.1491kjXo062073@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 6fd4891545c2 - stable/13 - Revert "Add workaround for a QoS-related bug in VMWare Workstation." MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6fd4891545c2a6d06dbc1927b2e0b375cd2b0b17 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 01:46:45 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=6fd4891545c2a6d06dbc1927b2e0b375cd2b0b17 commit 6fd4891545c2a6d06dbc1927b2e0b375cd2b0b17 Author: Ed Maste AuthorDate: 2021-04-25 21:14:23 +0000 Commit: Ed Maste CommitDate: 2021-05-09 01:45:55 +0000 Revert "Add workaround for a QoS-related bug in VMWare Workstation." This reverts commit 77c2fe20df6a9a7c1a353e1a4ab2ba80fefab881. The VMware Workstation issue was fixed in 2019[1], and we'd rather not carry unnecessary local changes in OpenSSH. [1] https://communities.vmware.com/t5/VMware-Workstation-Pro/Regression-ssh-results-in-broken-pipe-upon-connecting-in-Vmware/m-p/486105/highlight/true#M25470 PR: 234426 Discussed with: yuripv Approved by: des MFC after: 2 weeks Sponsored by: The FreeBSD Foundation (cherry picked from commit d55bf492f8f587e4a99f4dcb39a96159b4431782) --- crypto/openssh/readconf.c | 22 ---------------------- secure/usr.bin/ssh/Makefile | 3 --- 2 files changed, 25 deletions(-) diff --git a/crypto/openssh/readconf.c b/crypto/openssh/readconf.c index 75fbd4ca222f..c1147a9e2e5f 100644 --- a/crypto/openssh/readconf.c +++ b/crypto/openssh/readconf.c @@ -16,9 +16,6 @@ __RCSID("$FreeBSD$"); #include -#ifdef VMWARE_GUEST_WORKAROUND -#include -#endif #include #include #include @@ -1983,15 +1980,6 @@ fill_default_options(Options * options) { char *all_cipher, *all_mac, *all_kex, *all_key, *all_sig; int r; -#ifdef VMWARE_GUEST_WORKAROUND - char scval[7]; /* "vmware\0" */ - size_t scsiz = sizeof(scval); - int vmwguest = 0; - - if (sysctlbyname("kern.vm_guest", scval, &scsiz, NULL, 0) == 0 && - strcmp(scval, "vmware") == 0) - vmwguest = 1; -#endif if (options->forward_agent == -1) options->forward_agent = 0; @@ -2126,18 +2114,8 @@ fill_default_options(Options * options) if (options->visual_host_key == -1) options->visual_host_key = 0; if (options->ip_qos_interactive == -1) -#ifdef VMWARE_GUEST_WORKAROUND - if (vmwguest) - options->ip_qos_interactive = IPTOS_LOWDELAY; - else -#endif options->ip_qos_interactive = IPTOS_DSCP_AF21; if (options->ip_qos_bulk == -1) -#ifdef VMWARE_GUEST_WORKAROUND - if (vmwguest) - options->ip_qos_bulk = IPTOS_THROUGHPUT; - else -#endif options->ip_qos_bulk = IPTOS_DSCP_CS1; if (options->request_tty == -1) options->request_tty = REQUEST_TTY_AUTO; diff --git a/secure/usr.bin/ssh/Makefile b/secure/usr.bin/ssh/Makefile index 023fa4a55be9..614cc7627fc5 100644 --- a/secure/usr.bin/ssh/Makefile +++ b/secure/usr.bin/ssh/Makefile @@ -37,9 +37,6 @@ LIBADD+= crypto CFLAGS+= -DXAUTH_PATH=\"${LOCALBASE}/bin/xauth\" .endif -# Workaround VMware Workstation NAT bug -CFLAGS+=-DVMWARE_GUEST_WORKAROUND - .include .PATH: ${SSHDIR} From owner-dev-commits-src-all@freebsd.org Sun May 9 02:31:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04908646C6E; Sun, 9 May 2021 02:31:39 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fd7VL6jGhz4WDg; Sun, 9 May 2021 02:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D96AE1A3A; Sun, 9 May 2021 02:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1492Vcj2027194; Sun, 9 May 2021 02:31:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1492VcEV027193; Sun, 9 May 2021 02:31:38 GMT (envelope-from git) Date: Sun, 9 May 2021 02:31:38 GMT Message-Id: <202105090231.1492VcEV027193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 8c10d2979c55 - stable/13 - less: upgrade to v581.2. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8c10d2979c55c1856ea997dc4fae59256ec0ba31 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 02:31:39 -0000 The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=8c10d2979c55c1856ea997dc4fae59256ec0ba31 commit 8c10d2979c55c1856ea997dc4fae59256ec0ba31 Author: Xin LI AuthorDate: 2021-04-19 02:46:19 +0000 Commit: Xin LI CommitDate: 2021-05-09 02:31:02 +0000 less: upgrade to v581.2. (cherry picked from commit 50d31dbc6e2bc3aa6007edb8cdecbcb84e85d6c0) less: upgrade to v581. (cherry picked from commit 2235c7feac959bcc9ddfd6a2bc6be32102b1f84c) --- contrib/less/INSTALL | 10 +- contrib/less/NEWS | 50 ++- contrib/less/README | 38 +- contrib/less/brac.c | 2 +- contrib/less/ch.c | 54 ++- contrib/less/charset.c | 154 ++++---- contrib/less/charset.h | 2 +- contrib/less/cmd.h | 20 +- contrib/less/cmdbuf.c | 87 ++--- contrib/less/command.c | 189 +++++++--- contrib/less/cvt.c | 12 +- contrib/less/decode.c | 367 ++++++++++--------- contrib/less/edit.c | 33 +- contrib/less/filename.c | 29 +- contrib/less/forwback.c | 11 +- contrib/less/funcs.h | 35 +- contrib/less/help.c | 24 +- contrib/less/ifile.c | 39 +- contrib/less/input.c | 45 ++- contrib/less/jump.c | 2 +- contrib/less/less.h | 419 +++++++++++---------- contrib/less/less.hlp | 22 +- contrib/less/less.nro | 204 +++++++++-- contrib/less/lessecho.c | 14 +- contrib/less/lessecho.nro | 8 +- contrib/less/lesskey.c | 163 ++++----- contrib/less/lesskey.h | 38 +- contrib/less/lesskey.nro | 25 +- contrib/less/lglob.h | 110 +++--- contrib/less/line.c | 905 ++++++++++++++++++++++++++-------------------- contrib/less/linenum.c | 31 +- contrib/less/lsystem.c | 44 +-- contrib/less/main.c | 85 +++-- contrib/less/mark.c | 26 +- contrib/less/optfunc.c | 309 ++++++++++++---- contrib/less/option.c | 25 +- contrib/less/option.h | 62 ++-- contrib/less/opttbl.c | 154 +++++--- contrib/less/os.c | 94 ++++- contrib/less/output.c | 612 ++++++++++++++++--------------- contrib/less/pattern.c | 11 +- contrib/less/pattern.h | 18 +- contrib/less/pckeys.h | 38 +- contrib/less/position.c | 12 +- contrib/less/position.h | 12 +- contrib/less/prompt.c | 88 ++--- contrib/less/regexp.h | 14 +- contrib/less/screen.c | 796 ++++++++++++++++++++++++++++------------ contrib/less/scrsize.c | 2 +- contrib/less/search.c | 359 +++++++++++++----- contrib/less/signal.c | 14 +- contrib/less/tags.c | 77 ++-- contrib/less/ttyin.c | 51 ++- contrib/less/version.c | 30 +- usr.bin/less/defines.h | 13 +- 55 files changed, 3782 insertions(+), 2306 deletions(-) diff --git a/contrib/less/INSTALL b/contrib/less/INSTALL index c2ab230e4470..78ae93246d88 100644 --- a/contrib/less/INSTALL +++ b/contrib/less/INSTALL @@ -1,6 +1,6 @@ - This file describes how to build and install less using -the "configure" script. This only works on Unix systems. -To install on other systems, read the README file. +This file contains generic instructions on how to build and +install software using autoconf. For specific instructions +on how to build "less", see the README or README.VER file. Basic Installation @@ -24,8 +24,8 @@ diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change + The file `configure.ac' is used to create `configure' by a program +called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: diff --git a/contrib/less/NEWS b/contrib/less/NEWS index b0644fd2e0de..bc5afd655ddc 100644 --- a/contrib/less/NEWS +++ b/contrib/less/NEWS @@ -4,10 +4,56 @@ ====================================================================== For the latest news about less, see the "less" Web page: - http://www.greenwoodsoftware.com/less + https://greenwoodsoftware.com/less You can also download the latest version of less from there. - To report bugs, suggestions or comments, send email to bug-less@gnu.org + Report bugs, suggestions or comments at + https://github.com/gwsw/less/issues. + +====================================================================== + + Major changes between "less" versions 563 and 581.2 + +* Change ESC-u command to toggle, not disable, highlighting per man page. + +* Add ESC-U command. + +* Add ctrl-W search modifier for wrapping search. + +* F command can be interrupted by ^X. + +* Support OSC 8 hyperlinks when -R is in effect. + +* g command with no number will ignore -j and put first line at top of screen. + +* Multiple + or -p command line options are handled better. + +* Add the --incsearch option. + +* Add the --line-num-width option. + +* Add the --status-col-width option. + +* Add the --use-color and --color options. + +* Display -w highlight even if highlighted line is empty. + +* If search result is in a long line, scroll to ensure it is visible. + +* Editing the same file under different names now creates only + one entry in the file list. + +* Make visual bell more visible on some terminals. + +* Ring end-of-file bell no more than once per second. + +* Build can use either Python or Perl for Makefile.aut operations. + +* Fix crash when using the @ search modifier. + +* Fix crash in the 's' command due to duplicate free. + +* Fix realpath crash on Darwin. ====================================================================== diff --git a/contrib/less/README b/contrib/less/README index 81cb7e091296..2acbd00d762a 100644 --- a/contrib/less/README +++ b/contrib/less/README @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 563 + Less, version 581.2 - This is the distribution of less, version 563, released 13 Jun 2020. + This is the distribution of less, version 581.2, released 28 Apr 2021. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -21,33 +21,29 @@ or 2. The Less License, in the file LICENSE. - Please report any problems to bug-less@gnu.org. - See http://www.greenwoodsoftware.com/less for the latest info. + Please report any problems at https://github.com/gwsw/less/issues. + See https://greenwoodsoftware.com/less for the latest info. Source repository is at https://github.com/gwsw/less.git. ========================================================================= -This is the distribution of "less", a paginator similar to "more" or "pg". - The formatted manual page is in less.man. The manual page nroff source is in less.nro. Major changes made since the last posted version are in NEWS. ======================================================================= -PRE-INSTALLATION (when using git) - -If you are building from a clone of a git repository, -type "make -f Makefile.aut". -If you are building from a numbered release package (a tar or zip file -with a name like less-999.tar.gz or less-999.zip), you should skip this step. - -======================================================================= -INSTALLATION (Unix systems only): +INSTALLATION (Unix & Linux systems only): 1. Move the distributed source to its own directory and unpack it, if you have not already done so. -2. Type "sh configure". +2. If you are building from a clone of a git repository, + type "make -f Makefile.aut". + If you are building from a numbered release package (a tar or + zip file with a name like less-999.tar.gz or less-999.zip downloaded + from greenwoodsoftware.com, not from github), you should skip this step. + +3. Type "sh configure". This will generate a Makefile and a defines.h. Warning: if you have a GNU sed, make sure it is version 2.05 or later. @@ -79,7 +75,7 @@ INSTALLATION (Unix systems only): commands, etc. -3. It is a good idea to look over the generated Makefile and defines.h +4. It is a good idea to look over the generated Makefile and defines.h and make sure they look ok. If you know of any peculiarities of your system that configure might not have detected, you may fix the Makefile now. Take particular notice of the list of "terminal" @@ -93,13 +89,13 @@ INSTALLATION (Unix systems only): to remove the descriptions of the features which you are removing. If you edit less.hlp, you should run "make -f Makefile.aut help.c". -4. Type "make" and watch the fun. +5. Type "make" and watch the fun. -5. If the make succeeds, it will generate the programs "less", +6. If the make succeeds, it will generate the programs "less", "lesskey" and "lessecho" in your current directory. Test the generated programs. -6. When satisfied that it works, if you wish to install it +7. When satisfied that it works, if you wish to install it in a public place, type "make install". The default install destinations are: @@ -108,8 +104,6 @@ INSTALLATION (Unix systems only): If you want to install any of these files elsewhere, define bindir and/or mandir to the appropriate directories. -If you have any problems building or running "less", suggestions, -complaints, etc., you may mail to bug-less@gnu.org. Note to hackers: comments noting possible improvements are enclosed in double curly brackets {{ like this }}. diff --git a/contrib/less/brac.c b/contrib/less/brac.c index db3a2951db08..53ada50aab56 100644 --- a/contrib/less/brac.c +++ b/contrib/less/brac.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/ch.c b/contrib/less/ch.c index 70fad1002dbf..bab0692f7437 100644 --- a/contrib/less/ch.c +++ b/contrib/less/ch.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -41,7 +41,7 @@ struct bufnode { struct bufnode *hnext, *hprev; }; -#define LBUFSIZE 8192 +#define LBUFSIZE 8192 struct buf { struct bufnode node; BLOCKNUM block; @@ -54,7 +54,7 @@ struct buf { * The file state is maintained in a filestate structure. * A pointer to the filestate is kept in the ifile structure. */ -#define BUFHASH_SIZE 1024 +#define BUFHASH_SIZE 1024 struct filestate { struct bufnode buflist; struct bufnode hashtbl[BUFHASH_SIZE]; @@ -67,24 +67,24 @@ struct filestate { POSITION fsize; }; -#define ch_bufhead thisfile->buflist.next -#define ch_buftail thisfile->buflist.prev -#define ch_nbufs thisfile->nbufs -#define ch_block thisfile->block -#define ch_offset thisfile->offset -#define ch_fpos thisfile->fpos -#define ch_fsize thisfile->fsize -#define ch_flags thisfile->flags -#define ch_file thisfile->file +#define ch_bufhead thisfile->buflist.next +#define ch_buftail thisfile->buflist.prev +#define ch_nbufs thisfile->nbufs +#define ch_block thisfile->block +#define ch_offset thisfile->offset +#define ch_fpos thisfile->fpos +#define ch_fsize thisfile->fsize +#define ch_flags thisfile->flags +#define ch_file thisfile->file -#define END_OF_CHAIN (&thisfile->buflist) -#define END_OF_HCHAIN(h) (&thisfile->hashtbl[h]) -#define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1)) +#define END_OF_CHAIN (&thisfile->buflist) +#define END_OF_HCHAIN(h) (&thisfile->hashtbl[h]) +#define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1)) /* * Macros to manipulate the list of buffers in thisfile->buflist. */ -#define FOR_BUFS(bn) \ +#define FOR_BUFS(bn) \ for (bn = ch_bufhead; bn != END_OF_CHAIN; bn = bn->next) #define BUF_RM(bn) \ @@ -106,15 +106,15 @@ struct filestate { /* * Macros to manipulate the list of buffers in thisfile->hashtbl[n]. */ -#define FOR_BUFS_IN_CHAIN(h,bn) \ +#define FOR_BUFS_IN_CHAIN(h,bn) \ for (bn = thisfile->hashtbl[h].hnext; \ bn != END_OF_HCHAIN(h); bn = bn->hnext) -#define BUF_HASH_RM(bn) \ +#define BUF_HASH_RM(bn) \ (bn)->hnext->hprev = (bn)->hprev; \ (bn)->hprev->hnext = (bn)->hnext; -#define BUF_HASH_INS(bn,h) \ +#define BUF_HASH_INS(bn,h) \ (bn)->hnext = thisfile->hashtbl[h].hnext; \ (bn)->hprev = END_OF_HCHAIN(h); \ thisfile->hashtbl[h].hnext->hprev = (bn); \ @@ -240,12 +240,12 @@ ch_get(VOID_PARAM) return ('?'); if (lseek(ch_file, (off_t)pos, SEEK_SET) == BAD_LSEEK) { - error("seek error", NULL_PARG); + error("seek error", NULL_PARG); clear_eol(); return (EOI); - } - ch_fpos = pos; - } + } + ch_fpos = pos; + } /* * Read the block. @@ -311,13 +311,7 @@ ch_get(VOID_PARAM) parg.p_string = wait_message(); ierror("%s", &parg); } -#if !MSDOS_COMPILER - sleep(1); -#else -#if MSDOS_COMPILER==WIN32C - Sleep(1000); -#endif -#endif + sleep_ms(2); /* Reduce system load */ slept = TRUE; #if HAVE_STAT_INO diff --git a/contrib/less/charset.c b/contrib/less/charset.c index 4897cbaf6adc..b37c8a29cbd9 100644 --- a/contrib/less/charset.c +++ b/contrib/less/charset.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -40,27 +40,27 @@ struct charset { int *p_flag; char *desc; } charsets[] = { - { "ascii", NULL, "8bcccbcc18b95.b" }, - { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, - { "iso8859", NULL, "8bcccbcc18b95.33b." }, - { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, - { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, - { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, - { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, - { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, - { "koi8-r", NULL, "8bcccbcc18b95.b." }, - { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, - { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, - { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, - { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, - { "next", NULL, "8bcccbcc18b95.bb125.bb" }, - { "dos", NULL, "8bcccbcc12bc5b95.b." }, - { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, - { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, - { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, - { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, - { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, - { NULL, NULL, NULL } + { "ascii", NULL, "8bcccbcc18b95.b" }, + { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, + { "iso8859", NULL, "8bcccbcc18b95.33b." }, + { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, + { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, + { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, + { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, + { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, + { "koi8-r", NULL, "8bcccbcc18b95.b." }, + { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, + { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, + { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, + { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, + { "next", NULL, "8bcccbcc18b95.bb125.bb" }, + { "dos", NULL, "8bcccbcc12bc5b95.b." }, + { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, + { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, + { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, + { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, + { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, + { NULL, NULL, NULL } }; /* @@ -70,58 +70,58 @@ struct cs_alias { char *name; char *oname; } cs_aliases[] = { - { "UTF-8", "utf-8" }, - { "utf8", "utf-8" }, - { "UTF8", "utf-8" }, - { "ANSI_X3.4-1968", "ascii" }, - { "US-ASCII", "ascii" }, - { "latin1", "iso8859" }, - { "ISO-8859-1", "iso8859" }, - { "latin9", "iso8859" }, - { "ISO-8859-15", "iso8859" }, - { "latin2", "iso8859" }, - { "ISO-8859-2", "iso8859" }, - { "ISO-8859-3", "latin3" }, - { "latin4", "iso8859" }, - { "ISO-8859-4", "iso8859" }, - { "cyrillic", "iso8859" }, - { "ISO-8859-5", "iso8859" }, - { "ISO-8859-6", "arabic" }, - { "ISO-8859-7", "greek" }, - { "IBM9005", "greek2005" }, - { "ISO-8859-8", "hebrew" }, - { "latin5", "iso8859" }, - { "ISO-8859-9", "iso8859" }, - { "latin6", "iso8859" }, - { "ISO-8859-10", "iso8859" }, - { "latin7", "iso8859" }, - { "ISO-8859-13", "iso8859" }, - { "latin8", "iso8859" }, - { "ISO-8859-14", "iso8859" }, - { "latin10", "iso8859" }, - { "ISO-8859-16", "iso8859" }, - { "IBM437", "dos" }, - { "EBCDIC-US", "ebcdic" }, - { "IBM1047", "IBM-1047" }, - { "KOI8-R", "koi8-r" }, - { "KOI8-U", "koi8-r" }, - { "GEORGIAN-PS", "georgianps" }, - { "TCVN5712-1", "tcvn" }, - { "NEXTSTEP", "next" }, - { "windows", "windows-1252" }, /* backward compatibility */ - { "CP1251", "windows-1251" }, - { "CP1252", "windows-1252" }, - { "CP1255", "windows-1255" }, + { "UTF-8", "utf-8" }, + { "utf8", "utf-8" }, + { "UTF8", "utf-8" }, + { "ANSI_X3.4-1968", "ascii" }, + { "US-ASCII", "ascii" }, + { "latin1", "iso8859" }, + { "ISO-8859-1", "iso8859" }, + { "latin9", "iso8859" }, + { "ISO-8859-15", "iso8859" }, + { "latin2", "iso8859" }, + { "ISO-8859-2", "iso8859" }, + { "ISO-8859-3", "latin3" }, + { "latin4", "iso8859" }, + { "ISO-8859-4", "iso8859" }, + { "cyrillic", "iso8859" }, + { "ISO-8859-5", "iso8859" }, + { "ISO-8859-6", "arabic" }, + { "ISO-8859-7", "greek" }, + { "IBM9005", "greek2005" }, + { "ISO-8859-8", "hebrew" }, + { "latin5", "iso8859" }, + { "ISO-8859-9", "iso8859" }, + { "latin6", "iso8859" }, + { "ISO-8859-10", "iso8859" }, + { "latin7", "iso8859" }, + { "ISO-8859-13", "iso8859" }, + { "latin8", "iso8859" }, + { "ISO-8859-14", "iso8859" }, + { "latin10", "iso8859" }, + { "ISO-8859-16", "iso8859" }, + { "IBM437", "dos" }, + { "EBCDIC-US", "ebcdic" }, + { "IBM1047", "IBM-1047" }, + { "KOI8-R", "koi8-r" }, + { "KOI8-U", "koi8-r" }, + { "GEORGIAN-PS", "georgianps" }, + { "TCVN5712-1", "tcvn" }, + { "NEXTSTEP", "next" }, + { "windows", "windows-1252" }, /* backward compatibility */ + { "CP1251", "windows-1251" }, + { "CP1252", "windows-1252" }, + { "CP1255", "windows-1255" }, { NULL, NULL } }; -#define IS_BINARY_CHAR 01 -#define IS_CONTROL_CHAR 02 +#define IS_BINARY_CHAR 01 +#define IS_CONTROL_CHAR 02 static char chardef[256]; static char *binfmt = NULL; static char *utfbinfmt = NULL; -public int binattr = AT_STANDOUT; +public int binattr = AT_STANDOUT|AT_COLOR_BIN; /* @@ -134,9 +134,9 @@ public int binattr = AT_STANDOUT; * repetition of the letter. * * Each letter is one of: - * . normal character - * b binary character - * c control character + * . normal character + * b binary character + * c control character */ static void ichardef(s) @@ -457,16 +457,16 @@ prchar(c) SNPRINTF1(buf, sizeof(buf), "^%c", /* * This array roughly inverts CONTROL() #defined in less.h, - * and should be kept in sync with CONTROL() and IBM-1047. - */ + * and should be kept in sync with CONTROL() and IBM-1047. + */ "@ABC.I.?...KLMNO" "PQRS.JH.XY.." "\\]^_" "......W[.....EFG" "..V....D....TU.Z"[c]); #else - else if (c < 128 && !control_char(c ^ 0100)) - SNPRINTF1(buf, sizeof(buf), "^%c", (int) (c ^ 0100)); + else if (c < 128 && !control_char(c ^ 0100)) + SNPRINTF1(buf, sizeof(buf), "^%c", (int) (c ^ 0100)); #endif else SNPRINTF1(buf, sizeof(buf), binfmt, c); @@ -484,7 +484,7 @@ prutfchar(ch) if (ch == ESC) strcpy(buf, "ESC"); - else if (ch < 128 && control_char(ch)) + else if (ch < 128 && control_char(ch)) { if (!control_char(ch ^ 0100)) SNPRINTF1(buf, sizeof(buf), "^%c", ((char) ch) ^ 0100); @@ -732,9 +732,9 @@ step_char(pp, dir, limit) */ #define DECLARE_RANGE_TABLE_START(name) \ - static struct wchar_range name##_array[] = { + static struct wchar_range name##_array[] = { #define DECLARE_RANGE_TABLE_END(name) \ - }; struct wchar_range_table name##_table = { name##_array, sizeof(name##_array)/sizeof(*name##_array) }; + }; struct wchar_range_table name##_table = { name##_array, sizeof(name##_array)/sizeof(*name##_array) }; DECLARE_RANGE_TABLE_START(compose) #include "compose.uni" diff --git a/contrib/less/charset.h b/contrib/less/charset.h index cc0c3af59e89..3e7ecf73db94 100644 --- a/contrib/less/charset.h +++ b/contrib/less/charset.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/cmd.h b/contrib/less/cmd.h index 95a2e5801717..c51f0bc5c4f3 100644 --- a/contrib/less/cmd.h +++ b/contrib/less/cmd.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -31,7 +31,6 @@ #define A_HELP 19 #define A_NEXT_FILE 20 #define A_PERCENT 21 -#define A_PREFIX 22 #define A_PREV_FILE 23 #define A_QUIT 24 #define A_REPAINT 25 @@ -72,19 +71,19 @@ #define A_CLRMARK 62 #define A_SETMARKBOT 63 #define A_X11MOUSE_IN 64 -#define A_X11MOUSE_IGNORE 65 #define A_F_MOUSE 66 #define A_B_MOUSE 67 /* Note "X116" refers to extended (1006) X11 mouse reporting. */ #define A_X116MOUSE_IN 68 -#define A_X116MOUSE_IGNORE 69 +#define A_CLR_SEARCH 70 +/* These values must not conflict with any A_* or EC_* value. */ #define A_INVALID 100 #define A_NOACTION 101 #define A_UINVALID 102 #define A_END_LIST 103 #define A_SPECIAL_KEY 104 - +#define A_PREFIX 105 #define A_SKIP 127 #define A_EXTRA 0200 @@ -111,15 +110,16 @@ #define EC_B_COMPLETE 18 #define EC_LITERAL 19 #define EC_ABORT 20 +#define EC_X11MOUSE 21 +#define EC_X116MOUSE 22 -#define EC_NOACTION 101 #define EC_UINVALID 102 /* Flags for editchar() */ -#define EC_PEEK 01 -#define EC_NOHISTORY 02 -#define EC_NOCOMPLETE 04 -#define EC_NORIGHTLEFT 010 +#define ECF_PEEK 01 +#define ECF_NOHISTORY 02 +#define ECF_NOCOMPLETE 04 +#define ECF_NORIGHTLEFT 010 /* Environment variable stuff */ #define EV_OK 01 diff --git a/contrib/less/cmdbuf.c b/contrib/less/cmdbuf.c index ed78ded00307..9cc1f3e94977 100644 --- a/contrib/less/cmdbuf.c +++ b/contrib/less/cmdbuf.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -26,12 +26,12 @@ extern int no_hist_dups; extern int marks_modified; static char cmdbuf[CMDBUF_SIZE]; /* Buffer for holding a multi-char command */ -static int cmd_col; /* Current column of the cursor */ -static int prompt_col; /* Column of cursor just after prompt */ -static char *cp; /* Pointer into cmdbuf */ -static int cmd_offset; /* Index into cmdbuf of first displayed char */ -static int literal; /* Next input char should not be interpreted */ -static int updown_match = -1; /* Prefix length in up/down movement */ +static int cmd_col; /* Current column of the cursor */ +static int prompt_col; /* Column of cursor just after prompt */ +static char *cp; /* Pointer into cmdbuf */ +static int cmd_offset; /* Index into cmdbuf of first displayed char */ +static int literal; /* Next input char should not be interpreted */ +static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME static int cmd_complete LESSPARAMS((int action)); @@ -223,7 +223,7 @@ cmd_step_common(p, ch, len, pwidth, bswidth) } } if (pwidth != NULL) - *pwidth = width; + *pwidth = width; if (bswidth != NULL) *bswidth = width; return (pr); @@ -259,17 +259,42 @@ cmd_step_left(pp, pwidth, bswidth) return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth); } +/* + * Put the cursor at "home" (just after the prompt), + * and set cp to the corresponding char in cmdbuf. + */ + static void +cmd_home(VOID_PARAM) +{ + while (cmd_col > prompt_col) + { + int width, bswidth; + + cmd_step_left(&cp, &width, &bswidth); + while (bswidth-- > 0) + putbs(); + cmd_col -= width; + } + + cp = &cmdbuf[cmd_offset]; +} + /* * Repaint the line from cp onwards. * Then position the cursor just after the char old_cp (a pointer into cmdbuf). */ - static void + public void cmd_repaint(old_cp) constant char *old_cp; { /* * Repaint the line from the current position. */ + if (old_cp == NULL) + { + old_cp = cp; + cmd_home(); + } clear_eol(); while (*cp != '\0') { @@ -300,26 +325,6 @@ cmd_repaint(old_cp) cmd_left(); } -/* - * Put the cursor at "home" (just after the prompt), - * and set cp to the corresponding char in cmdbuf. - */ - static void -cmd_home(VOID_PARAM) -{ - while (cmd_col > prompt_col) - { - int width, bswidth; - - cmd_step_left(&cp, &width, &bswidth); - while (bswidth-- > 0) - putbs(); - cmd_col -= width; - } - - cp = &cmdbuf[cmd_offset]; -} - /* * Shift the cmdbuf display left a half-screen. */ @@ -826,9 +831,9 @@ cmd_accept(VOID_PARAM) * Try to perform a line-edit function on the command buffer, * using a specified char as a line-editing command. * Returns: - * CC_PASS The char does not invoke a line edit function. - * CC_OK Line edit function done. - * CC_QUIT The char requests the current command to be aborted. + * CC_PASS The char does not invoke a line edit function. + * CC_OK Line edit function done. + * CC_QUIT The char requests the current command to be aborted. */ static int cmd_edit(c) @@ -838,9 +843,9 @@ cmd_edit(c) int flags; #if TAB_COMPLETE_FILENAME -#define not_in_completion() in_completion = 0 +#define not_in_completion() in_completion = 0 #else -#define not_in_completion(VOID_PARAM) +#define not_in_completion(VOID_PARAM) #endif /* @@ -852,20 +857,22 @@ cmd_edit(c) /* * No current history; don't accept history manipulation cmds. */ - flags |= EC_NOHISTORY; + flags |= ECF_NOHISTORY; #endif #if TAB_COMPLETE_FILENAME if (curr_mlist == ml_search) /* * In a search command; don't accept file-completion cmds. */ - flags |= EC_NOCOMPLETE; + flags |= ECF_NOCOMPLETE; #endif action = editchar(c, flags); switch (action) { + case A_NOACTION: + return (CC_OK); case EC_RIGHT: not_in_completion(); return (cmd_right()); @@ -934,8 +941,6 @@ cmd_edit(c) case EC_EXPAND: return (cmd_complete(action)); #endif - case EC_NOACTION: - return (CC_OK); default: not_in_completion(); return (CC_PASS); @@ -1237,9 +1242,9 @@ fail: * Process a single character of a multi-character command, such as * a number, or the pattern of a search command. * Returns: - * CC_OK The char was accepted. - * CC_QUIT The char requests the command to be aborted. - * CC_ERROR The char could not be accepted due to an error. + * CC_OK The char was accepted. + * CC_QUIT The char requests the command to be aborted. + * CC_ERROR The char could not be accepted due to an error. */ public int cmd_char(c) diff --git a/contrib/less/command.c b/contrib/less/command.c index 8e0ae4b34d67..ae59181c2827 100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -57,21 +57,22 @@ extern void *ml_shell; extern char *editor; extern char *editproto; #endif -extern int screen_trashed; /* The screen has been overwritten */ +extern int screen_trashed; /* The screen has been overwritten */ extern int shift_count; extern int oldbot; extern int forw_prompt; +extern int incr_search; #if MSDOS_COMPILER==WIN32C extern int utf_mode; #endif #if SHELL_ESCAPE -static char *shellcmd = NULL; /* For holding last shell command for "!!" */ +static char *shellcmd = NULL; /* For holding last shell command for "!!" */ #endif -static int mca; /* The multicharacter command (action) */ -static int search_type; /* The previous type of search */ -static LINENUM number; /* The number typed by the user */ -static long fraction; /* The fractional part of the number */ +static int mca; /* The multicharacter command (action) */ +static int search_type; /* The previous type of search */ +static LINENUM number; /* The number typed by the user */ +static long fraction; /* The fractional part of the number */ static struct loption *curropt; static int opt_lower; static int optflag; @@ -113,7 +114,6 @@ set_mca(action) int action; { mca = action; - deinit_mouse(); /* we don't want mouse events while entering a cmd */ clear_bot(); clear_cmd(); } @@ -127,7 +127,6 @@ clear_mca(VOID_PARAM) if (mca == 0) return; mca = 0; - init_mouse(); } /* @@ -177,6 +176,8 @@ mca_search(VOID_PARAM) cmd_putstr("Keep-pos "); if (search_type & SRCH_NO_REGEX) cmd_putstr("Regex-off "); + if (search_type & SRCH_WRAP) + cmd_putstr("Wrap "); #if HILITE_SEARCH if (search_type & SRCH_FILTER) @@ -520,9 +521,9 @@ mca_search_char(c) /* * Certain characters as the first char of * the pattern have special meaning: - * ! Toggle the NO_MATCH flag - * * Toggle the PAST_EOF flag - * @ Toggle the FIRST_FILE flag + * ! Toggle the NO_MATCH flag + * * Toggle the PAST_EOF flag + * @ Toggle the FIRST_FILE flag */ if (len_cmdbuf() > 0) return (NO_MCA); @@ -547,6 +548,10 @@ mca_search_char(c) if (mca != A_FILTER) flag = SRCH_NO_MOVE; break; + case CONTROL('W'): /* WRAP around */ + if (mca != A_FILTER) + flag = SRCH_WRAP; + break; case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */ flag = SRCH_NO_REGEX; break; @@ -558,7 +563,8 @@ mca_search_char(c) if (flag != 0) { - search_type ^= flag; + /* Toggle flag, but keep PAST_EOF and WRAP mutually exclusive. */ + search_type ^= flag | (search_type & (SRCH_PAST_EOF|SRCH_WRAP)); mca_search(); return (MCA_MORE); } @@ -596,9 +602,16 @@ mca_char(c) * Entering digits of a number. * Terminated by a non-digit. */ - if (!((c >= '0' && c <= '9') || c == '.') && - editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID) + if ((c >= '0' && c <= '9') || c == '.') + break; + switch (editchar(c, ECF_PEEK|ECF_NOHISTORY|ECF_NOCOMPLETE|ECF_NORIGHTLEFT)) { + case A_NOACTION: + /* + * Ignore this char and get another one. + */ + return (MCA_MORE); + case A_INVALID: /* * Not part of the number. * End the number and treat this char @@ -651,15 +664,44 @@ mca_char(c) */ return (MCA_DONE); - if ((mca == A_F_BRACKET || mca == A_B_BRACKET) && len_cmdbuf() >= 2) *** 9553 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun May 9 02:31:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F24D5646E8D; Sun, 9 May 2021 02:31:59 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fd7Vl6S9jz4W19; Sun, 9 May 2021 02:31:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D04A719AF; Sun, 9 May 2021 02:31:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1492VxpK028180; Sun, 9 May 2021 02:31:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1492VxqD028179; Sun, 9 May 2021 02:31:59 GMT (envelope-from git) Date: Sun, 9 May 2021 02:31:59 GMT Message-Id: <202105090231.1492VxqD028179@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 3c540c328d56 - stable/12 - less: upgrade to v581.2. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3c540c328d566fc6e60e489d0ed3aa4e50cd4e33 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 02:32:00 -0000 The branch stable/12 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=3c540c328d566fc6e60e489d0ed3aa4e50cd4e33 commit 3c540c328d566fc6e60e489d0ed3aa4e50cd4e33 Author: Xin LI AuthorDate: 2021-04-19 02:46:19 +0000 Commit: Xin LI CommitDate: 2021-05-09 02:31:53 +0000 less: upgrade to v581.2. (cherry picked from commit 50d31dbc6e2bc3aa6007edb8cdecbcb84e85d6c0) less: upgrade to v581. (cherry picked from commit 2235c7feac959bcc9ddfd6a2bc6be32102b1f84c) --- contrib/less/INSTALL | 10 +- contrib/less/NEWS | 50 ++- contrib/less/README | 38 +- contrib/less/brac.c | 2 +- contrib/less/ch.c | 54 ++- contrib/less/charset.c | 154 ++++---- contrib/less/charset.h | 2 +- contrib/less/cmd.h | 20 +- contrib/less/cmdbuf.c | 87 ++--- contrib/less/command.c | 189 +++++++--- contrib/less/cvt.c | 12 +- contrib/less/decode.c | 367 ++++++++++--------- contrib/less/edit.c | 33 +- contrib/less/filename.c | 29 +- contrib/less/forwback.c | 11 +- contrib/less/funcs.h | 35 +- contrib/less/help.c | 24 +- contrib/less/ifile.c | 39 +- contrib/less/input.c | 45 ++- contrib/less/jump.c | 2 +- contrib/less/less.h | 419 +++++++++++---------- contrib/less/less.hlp | 22 +- contrib/less/less.nro | 204 +++++++++-- contrib/less/lessecho.c | 14 +- contrib/less/lessecho.nro | 8 +- contrib/less/lesskey.c | 163 ++++----- contrib/less/lesskey.h | 38 +- contrib/less/lesskey.nro | 25 +- contrib/less/lglob.h | 110 +++--- contrib/less/line.c | 905 ++++++++++++++++++++++++++-------------------- contrib/less/linenum.c | 31 +- contrib/less/lsystem.c | 44 +-- contrib/less/main.c | 85 +++-- contrib/less/mark.c | 26 +- contrib/less/optfunc.c | 309 ++++++++++++---- contrib/less/option.c | 25 +- contrib/less/option.h | 62 ++-- contrib/less/opttbl.c | 154 +++++--- contrib/less/os.c | 94 ++++- contrib/less/output.c | 612 ++++++++++++++++--------------- contrib/less/pattern.c | 11 +- contrib/less/pattern.h | 18 +- contrib/less/pckeys.h | 38 +- contrib/less/position.c | 12 +- contrib/less/position.h | 12 +- contrib/less/prompt.c | 88 ++--- contrib/less/regexp.h | 14 +- contrib/less/screen.c | 796 ++++++++++++++++++++++++++++------------ contrib/less/scrsize.c | 2 +- contrib/less/search.c | 359 +++++++++++++----- contrib/less/signal.c | 14 +- contrib/less/tags.c | 77 ++-- contrib/less/ttyin.c | 51 ++- contrib/less/version.c | 30 +- usr.bin/less/defines.h | 13 +- 55 files changed, 3782 insertions(+), 2306 deletions(-) diff --git a/contrib/less/INSTALL b/contrib/less/INSTALL index c2ab230e4470..78ae93246d88 100644 --- a/contrib/less/INSTALL +++ b/contrib/less/INSTALL @@ -1,6 +1,6 @@ - This file describes how to build and install less using -the "configure" script. This only works on Unix systems. -To install on other systems, read the README file. +This file contains generic instructions on how to build and +install software using autoconf. For specific instructions +on how to build "less", see the README or README.VER file. Basic Installation @@ -24,8 +24,8 @@ diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change + The file `configure.ac' is used to create `configure' by a program +called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: diff --git a/contrib/less/NEWS b/contrib/less/NEWS index b0644fd2e0de..bc5afd655ddc 100644 --- a/contrib/less/NEWS +++ b/contrib/less/NEWS @@ -4,10 +4,56 @@ ====================================================================== For the latest news about less, see the "less" Web page: - http://www.greenwoodsoftware.com/less + https://greenwoodsoftware.com/less You can also download the latest version of less from there. - To report bugs, suggestions or comments, send email to bug-less@gnu.org + Report bugs, suggestions or comments at + https://github.com/gwsw/less/issues. + +====================================================================== + + Major changes between "less" versions 563 and 581.2 + +* Change ESC-u command to toggle, not disable, highlighting per man page. + +* Add ESC-U command. + +* Add ctrl-W search modifier for wrapping search. + +* F command can be interrupted by ^X. + +* Support OSC 8 hyperlinks when -R is in effect. + +* g command with no number will ignore -j and put first line at top of screen. + +* Multiple + or -p command line options are handled better. + +* Add the --incsearch option. + +* Add the --line-num-width option. + +* Add the --status-col-width option. + +* Add the --use-color and --color options. + +* Display -w highlight even if highlighted line is empty. + +* If search result is in a long line, scroll to ensure it is visible. + +* Editing the same file under different names now creates only + one entry in the file list. + +* Make visual bell more visible on some terminals. + +* Ring end-of-file bell no more than once per second. + +* Build can use either Python or Perl for Makefile.aut operations. + +* Fix crash when using the @ search modifier. + +* Fix crash in the 's' command due to duplicate free. + +* Fix realpath crash on Darwin. ====================================================================== diff --git a/contrib/less/README b/contrib/less/README index 81cb7e091296..2acbd00d762a 100644 --- a/contrib/less/README +++ b/contrib/less/README @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 563 + Less, version 581.2 - This is the distribution of less, version 563, released 13 Jun 2020. + This is the distribution of less, version 581.2, released 28 Apr 2021. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -21,33 +21,29 @@ or 2. The Less License, in the file LICENSE. - Please report any problems to bug-less@gnu.org. - See http://www.greenwoodsoftware.com/less for the latest info. + Please report any problems at https://github.com/gwsw/less/issues. + See https://greenwoodsoftware.com/less for the latest info. Source repository is at https://github.com/gwsw/less.git. ========================================================================= -This is the distribution of "less", a paginator similar to "more" or "pg". - The formatted manual page is in less.man. The manual page nroff source is in less.nro. Major changes made since the last posted version are in NEWS. ======================================================================= -PRE-INSTALLATION (when using git) - -If you are building from a clone of a git repository, -type "make -f Makefile.aut". -If you are building from a numbered release package (a tar or zip file -with a name like less-999.tar.gz or less-999.zip), you should skip this step. - -======================================================================= -INSTALLATION (Unix systems only): +INSTALLATION (Unix & Linux systems only): 1. Move the distributed source to its own directory and unpack it, if you have not already done so. -2. Type "sh configure". +2. If you are building from a clone of a git repository, + type "make -f Makefile.aut". + If you are building from a numbered release package (a tar or + zip file with a name like less-999.tar.gz or less-999.zip downloaded + from greenwoodsoftware.com, not from github), you should skip this step. + +3. Type "sh configure". This will generate a Makefile and a defines.h. Warning: if you have a GNU sed, make sure it is version 2.05 or later. @@ -79,7 +75,7 @@ INSTALLATION (Unix systems only): commands, etc. -3. It is a good idea to look over the generated Makefile and defines.h +4. It is a good idea to look over the generated Makefile and defines.h and make sure they look ok. If you know of any peculiarities of your system that configure might not have detected, you may fix the Makefile now. Take particular notice of the list of "terminal" @@ -93,13 +89,13 @@ INSTALLATION (Unix systems only): to remove the descriptions of the features which you are removing. If you edit less.hlp, you should run "make -f Makefile.aut help.c". -4. Type "make" and watch the fun. +5. Type "make" and watch the fun. -5. If the make succeeds, it will generate the programs "less", +6. If the make succeeds, it will generate the programs "less", "lesskey" and "lessecho" in your current directory. Test the generated programs. -6. When satisfied that it works, if you wish to install it +7. When satisfied that it works, if you wish to install it in a public place, type "make install". The default install destinations are: @@ -108,8 +104,6 @@ INSTALLATION (Unix systems only): If you want to install any of these files elsewhere, define bindir and/or mandir to the appropriate directories. -If you have any problems building or running "less", suggestions, -complaints, etc., you may mail to bug-less@gnu.org. Note to hackers: comments noting possible improvements are enclosed in double curly brackets {{ like this }}. diff --git a/contrib/less/brac.c b/contrib/less/brac.c index db3a2951db08..53ada50aab56 100644 --- a/contrib/less/brac.c +++ b/contrib/less/brac.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/ch.c b/contrib/less/ch.c index 70fad1002dbf..bab0692f7437 100644 --- a/contrib/less/ch.c +++ b/contrib/less/ch.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -41,7 +41,7 @@ struct bufnode { struct bufnode *hnext, *hprev; }; -#define LBUFSIZE 8192 +#define LBUFSIZE 8192 struct buf { struct bufnode node; BLOCKNUM block; @@ -54,7 +54,7 @@ struct buf { * The file state is maintained in a filestate structure. * A pointer to the filestate is kept in the ifile structure. */ -#define BUFHASH_SIZE 1024 +#define BUFHASH_SIZE 1024 struct filestate { struct bufnode buflist; struct bufnode hashtbl[BUFHASH_SIZE]; @@ -67,24 +67,24 @@ struct filestate { POSITION fsize; }; -#define ch_bufhead thisfile->buflist.next -#define ch_buftail thisfile->buflist.prev -#define ch_nbufs thisfile->nbufs -#define ch_block thisfile->block -#define ch_offset thisfile->offset -#define ch_fpos thisfile->fpos -#define ch_fsize thisfile->fsize -#define ch_flags thisfile->flags -#define ch_file thisfile->file +#define ch_bufhead thisfile->buflist.next +#define ch_buftail thisfile->buflist.prev +#define ch_nbufs thisfile->nbufs +#define ch_block thisfile->block +#define ch_offset thisfile->offset +#define ch_fpos thisfile->fpos +#define ch_fsize thisfile->fsize +#define ch_flags thisfile->flags +#define ch_file thisfile->file -#define END_OF_CHAIN (&thisfile->buflist) -#define END_OF_HCHAIN(h) (&thisfile->hashtbl[h]) -#define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1)) +#define END_OF_CHAIN (&thisfile->buflist) +#define END_OF_HCHAIN(h) (&thisfile->hashtbl[h]) +#define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1)) /* * Macros to manipulate the list of buffers in thisfile->buflist. */ -#define FOR_BUFS(bn) \ +#define FOR_BUFS(bn) \ for (bn = ch_bufhead; bn != END_OF_CHAIN; bn = bn->next) #define BUF_RM(bn) \ @@ -106,15 +106,15 @@ struct filestate { /* * Macros to manipulate the list of buffers in thisfile->hashtbl[n]. */ -#define FOR_BUFS_IN_CHAIN(h,bn) \ +#define FOR_BUFS_IN_CHAIN(h,bn) \ for (bn = thisfile->hashtbl[h].hnext; \ bn != END_OF_HCHAIN(h); bn = bn->hnext) -#define BUF_HASH_RM(bn) \ +#define BUF_HASH_RM(bn) \ (bn)->hnext->hprev = (bn)->hprev; \ (bn)->hprev->hnext = (bn)->hnext; -#define BUF_HASH_INS(bn,h) \ +#define BUF_HASH_INS(bn,h) \ (bn)->hnext = thisfile->hashtbl[h].hnext; \ (bn)->hprev = END_OF_HCHAIN(h); \ thisfile->hashtbl[h].hnext->hprev = (bn); \ @@ -240,12 +240,12 @@ ch_get(VOID_PARAM) return ('?'); if (lseek(ch_file, (off_t)pos, SEEK_SET) == BAD_LSEEK) { - error("seek error", NULL_PARG); + error("seek error", NULL_PARG); clear_eol(); return (EOI); - } - ch_fpos = pos; - } + } + ch_fpos = pos; + } /* * Read the block. @@ -311,13 +311,7 @@ ch_get(VOID_PARAM) parg.p_string = wait_message(); ierror("%s", &parg); } -#if !MSDOS_COMPILER - sleep(1); -#else -#if MSDOS_COMPILER==WIN32C - Sleep(1000); -#endif -#endif + sleep_ms(2); /* Reduce system load */ slept = TRUE; #if HAVE_STAT_INO diff --git a/contrib/less/charset.c b/contrib/less/charset.c index 4897cbaf6adc..b37c8a29cbd9 100644 --- a/contrib/less/charset.c +++ b/contrib/less/charset.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -40,27 +40,27 @@ struct charset { int *p_flag; char *desc; } charsets[] = { - { "ascii", NULL, "8bcccbcc18b95.b" }, - { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, - { "iso8859", NULL, "8bcccbcc18b95.33b." }, - { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, - { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, - { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, - { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, - { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, - { "koi8-r", NULL, "8bcccbcc18b95.b." }, - { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, - { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, - { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, - { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, - { "next", NULL, "8bcccbcc18b95.bb125.bb" }, - { "dos", NULL, "8bcccbcc12bc5b95.b." }, - { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, - { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, - { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, - { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, - { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, - { NULL, NULL, NULL } + { "ascii", NULL, "8bcccbcc18b95.b" }, + { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, + { "iso8859", NULL, "8bcccbcc18b95.33b." }, + { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, + { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, + { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, + { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, + { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, + { "koi8-r", NULL, "8bcccbcc18b95.b." }, + { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, + { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, + { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, + { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, + { "next", NULL, "8bcccbcc18b95.bb125.bb" }, + { "dos", NULL, "8bcccbcc12bc5b95.b." }, + { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, + { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, + { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, + { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, + { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, + { NULL, NULL, NULL } }; /* @@ -70,58 +70,58 @@ struct cs_alias { char *name; char *oname; } cs_aliases[] = { - { "UTF-8", "utf-8" }, - { "utf8", "utf-8" }, - { "UTF8", "utf-8" }, - { "ANSI_X3.4-1968", "ascii" }, - { "US-ASCII", "ascii" }, - { "latin1", "iso8859" }, - { "ISO-8859-1", "iso8859" }, - { "latin9", "iso8859" }, - { "ISO-8859-15", "iso8859" }, - { "latin2", "iso8859" }, - { "ISO-8859-2", "iso8859" }, - { "ISO-8859-3", "latin3" }, - { "latin4", "iso8859" }, - { "ISO-8859-4", "iso8859" }, - { "cyrillic", "iso8859" }, - { "ISO-8859-5", "iso8859" }, - { "ISO-8859-6", "arabic" }, - { "ISO-8859-7", "greek" }, - { "IBM9005", "greek2005" }, - { "ISO-8859-8", "hebrew" }, - { "latin5", "iso8859" }, - { "ISO-8859-9", "iso8859" }, - { "latin6", "iso8859" }, - { "ISO-8859-10", "iso8859" }, - { "latin7", "iso8859" }, - { "ISO-8859-13", "iso8859" }, - { "latin8", "iso8859" }, - { "ISO-8859-14", "iso8859" }, - { "latin10", "iso8859" }, - { "ISO-8859-16", "iso8859" }, - { "IBM437", "dos" }, - { "EBCDIC-US", "ebcdic" }, - { "IBM1047", "IBM-1047" }, - { "KOI8-R", "koi8-r" }, - { "KOI8-U", "koi8-r" }, - { "GEORGIAN-PS", "georgianps" }, - { "TCVN5712-1", "tcvn" }, - { "NEXTSTEP", "next" }, - { "windows", "windows-1252" }, /* backward compatibility */ - { "CP1251", "windows-1251" }, - { "CP1252", "windows-1252" }, - { "CP1255", "windows-1255" }, + { "UTF-8", "utf-8" }, + { "utf8", "utf-8" }, + { "UTF8", "utf-8" }, + { "ANSI_X3.4-1968", "ascii" }, + { "US-ASCII", "ascii" }, + { "latin1", "iso8859" }, + { "ISO-8859-1", "iso8859" }, + { "latin9", "iso8859" }, + { "ISO-8859-15", "iso8859" }, + { "latin2", "iso8859" }, + { "ISO-8859-2", "iso8859" }, + { "ISO-8859-3", "latin3" }, + { "latin4", "iso8859" }, + { "ISO-8859-4", "iso8859" }, + { "cyrillic", "iso8859" }, + { "ISO-8859-5", "iso8859" }, + { "ISO-8859-6", "arabic" }, + { "ISO-8859-7", "greek" }, + { "IBM9005", "greek2005" }, + { "ISO-8859-8", "hebrew" }, + { "latin5", "iso8859" }, + { "ISO-8859-9", "iso8859" }, + { "latin6", "iso8859" }, + { "ISO-8859-10", "iso8859" }, + { "latin7", "iso8859" }, + { "ISO-8859-13", "iso8859" }, + { "latin8", "iso8859" }, + { "ISO-8859-14", "iso8859" }, + { "latin10", "iso8859" }, + { "ISO-8859-16", "iso8859" }, + { "IBM437", "dos" }, + { "EBCDIC-US", "ebcdic" }, + { "IBM1047", "IBM-1047" }, + { "KOI8-R", "koi8-r" }, + { "KOI8-U", "koi8-r" }, + { "GEORGIAN-PS", "georgianps" }, + { "TCVN5712-1", "tcvn" }, + { "NEXTSTEP", "next" }, + { "windows", "windows-1252" }, /* backward compatibility */ + { "CP1251", "windows-1251" }, + { "CP1252", "windows-1252" }, + { "CP1255", "windows-1255" }, { NULL, NULL } }; -#define IS_BINARY_CHAR 01 -#define IS_CONTROL_CHAR 02 +#define IS_BINARY_CHAR 01 +#define IS_CONTROL_CHAR 02 static char chardef[256]; static char *binfmt = NULL; static char *utfbinfmt = NULL; -public int binattr = AT_STANDOUT; +public int binattr = AT_STANDOUT|AT_COLOR_BIN; /* @@ -134,9 +134,9 @@ public int binattr = AT_STANDOUT; * repetition of the letter. * * Each letter is one of: - * . normal character - * b binary character - * c control character + * . normal character + * b binary character + * c control character */ static void ichardef(s) @@ -457,16 +457,16 @@ prchar(c) SNPRINTF1(buf, sizeof(buf), "^%c", /* * This array roughly inverts CONTROL() #defined in less.h, - * and should be kept in sync with CONTROL() and IBM-1047. - */ + * and should be kept in sync with CONTROL() and IBM-1047. + */ "@ABC.I.?...KLMNO" "PQRS.JH.XY.." "\\]^_" "......W[.....EFG" "..V....D....TU.Z"[c]); #else - else if (c < 128 && !control_char(c ^ 0100)) - SNPRINTF1(buf, sizeof(buf), "^%c", (int) (c ^ 0100)); + else if (c < 128 && !control_char(c ^ 0100)) + SNPRINTF1(buf, sizeof(buf), "^%c", (int) (c ^ 0100)); #endif else SNPRINTF1(buf, sizeof(buf), binfmt, c); @@ -484,7 +484,7 @@ prutfchar(ch) if (ch == ESC) strcpy(buf, "ESC"); - else if (ch < 128 && control_char(ch)) + else if (ch < 128 && control_char(ch)) { if (!control_char(ch ^ 0100)) SNPRINTF1(buf, sizeof(buf), "^%c", ((char) ch) ^ 0100); @@ -732,9 +732,9 @@ step_char(pp, dir, limit) */ #define DECLARE_RANGE_TABLE_START(name) \ - static struct wchar_range name##_array[] = { + static struct wchar_range name##_array[] = { #define DECLARE_RANGE_TABLE_END(name) \ - }; struct wchar_range_table name##_table = { name##_array, sizeof(name##_array)/sizeof(*name##_array) }; + }; struct wchar_range_table name##_table = { name##_array, sizeof(name##_array)/sizeof(*name##_array) }; DECLARE_RANGE_TABLE_START(compose) #include "compose.uni" diff --git a/contrib/less/charset.h b/contrib/less/charset.h index cc0c3af59e89..3e7ecf73db94 100644 --- a/contrib/less/charset.h +++ b/contrib/less/charset.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/cmd.h b/contrib/less/cmd.h index 95a2e5801717..c51f0bc5c4f3 100644 --- a/contrib/less/cmd.h +++ b/contrib/less/cmd.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -31,7 +31,6 @@ #define A_HELP 19 #define A_NEXT_FILE 20 #define A_PERCENT 21 -#define A_PREFIX 22 #define A_PREV_FILE 23 #define A_QUIT 24 #define A_REPAINT 25 @@ -72,19 +71,19 @@ #define A_CLRMARK 62 #define A_SETMARKBOT 63 #define A_X11MOUSE_IN 64 -#define A_X11MOUSE_IGNORE 65 #define A_F_MOUSE 66 #define A_B_MOUSE 67 /* Note "X116" refers to extended (1006) X11 mouse reporting. */ #define A_X116MOUSE_IN 68 -#define A_X116MOUSE_IGNORE 69 +#define A_CLR_SEARCH 70 +/* These values must not conflict with any A_* or EC_* value. */ #define A_INVALID 100 #define A_NOACTION 101 #define A_UINVALID 102 #define A_END_LIST 103 #define A_SPECIAL_KEY 104 - +#define A_PREFIX 105 #define A_SKIP 127 #define A_EXTRA 0200 @@ -111,15 +110,16 @@ #define EC_B_COMPLETE 18 #define EC_LITERAL 19 #define EC_ABORT 20 +#define EC_X11MOUSE 21 +#define EC_X116MOUSE 22 -#define EC_NOACTION 101 #define EC_UINVALID 102 /* Flags for editchar() */ -#define EC_PEEK 01 -#define EC_NOHISTORY 02 -#define EC_NOCOMPLETE 04 -#define EC_NORIGHTLEFT 010 +#define ECF_PEEK 01 +#define ECF_NOHISTORY 02 +#define ECF_NOCOMPLETE 04 +#define ECF_NORIGHTLEFT 010 /* Environment variable stuff */ #define EV_OK 01 diff --git a/contrib/less/cmdbuf.c b/contrib/less/cmdbuf.c index ed78ded00307..9cc1f3e94977 100644 --- a/contrib/less/cmdbuf.c +++ b/contrib/less/cmdbuf.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -26,12 +26,12 @@ extern int no_hist_dups; extern int marks_modified; static char cmdbuf[CMDBUF_SIZE]; /* Buffer for holding a multi-char command */ -static int cmd_col; /* Current column of the cursor */ -static int prompt_col; /* Column of cursor just after prompt */ -static char *cp; /* Pointer into cmdbuf */ -static int cmd_offset; /* Index into cmdbuf of first displayed char */ -static int literal; /* Next input char should not be interpreted */ -static int updown_match = -1; /* Prefix length in up/down movement */ +static int cmd_col; /* Current column of the cursor */ +static int prompt_col; /* Column of cursor just after prompt */ +static char *cp; /* Pointer into cmdbuf */ +static int cmd_offset; /* Index into cmdbuf of first displayed char */ +static int literal; /* Next input char should not be interpreted */ +static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME static int cmd_complete LESSPARAMS((int action)); @@ -223,7 +223,7 @@ cmd_step_common(p, ch, len, pwidth, bswidth) } } if (pwidth != NULL) - *pwidth = width; + *pwidth = width; if (bswidth != NULL) *bswidth = width; return (pr); @@ -259,17 +259,42 @@ cmd_step_left(pp, pwidth, bswidth) return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth); } +/* + * Put the cursor at "home" (just after the prompt), + * and set cp to the corresponding char in cmdbuf. + */ + static void +cmd_home(VOID_PARAM) +{ + while (cmd_col > prompt_col) + { + int width, bswidth; + + cmd_step_left(&cp, &width, &bswidth); + while (bswidth-- > 0) + putbs(); + cmd_col -= width; + } + + cp = &cmdbuf[cmd_offset]; +} + /* * Repaint the line from cp onwards. * Then position the cursor just after the char old_cp (a pointer into cmdbuf). */ - static void + public void cmd_repaint(old_cp) constant char *old_cp; { /* * Repaint the line from the current position. */ + if (old_cp == NULL) + { + old_cp = cp; + cmd_home(); + } clear_eol(); while (*cp != '\0') { @@ -300,26 +325,6 @@ cmd_repaint(old_cp) cmd_left(); } -/* - * Put the cursor at "home" (just after the prompt), - * and set cp to the corresponding char in cmdbuf. - */ - static void -cmd_home(VOID_PARAM) -{ - while (cmd_col > prompt_col) - { - int width, bswidth; - - cmd_step_left(&cp, &width, &bswidth); - while (bswidth-- > 0) - putbs(); - cmd_col -= width; - } - - cp = &cmdbuf[cmd_offset]; -} - /* * Shift the cmdbuf display left a half-screen. */ @@ -826,9 +831,9 @@ cmd_accept(VOID_PARAM) * Try to perform a line-edit function on the command buffer, * using a specified char as a line-editing command. * Returns: - * CC_PASS The char does not invoke a line edit function. - * CC_OK Line edit function done. - * CC_QUIT The char requests the current command to be aborted. + * CC_PASS The char does not invoke a line edit function. + * CC_OK Line edit function done. + * CC_QUIT The char requests the current command to be aborted. */ static int cmd_edit(c) @@ -838,9 +843,9 @@ cmd_edit(c) int flags; #if TAB_COMPLETE_FILENAME -#define not_in_completion() in_completion = 0 +#define not_in_completion() in_completion = 0 #else -#define not_in_completion(VOID_PARAM) +#define not_in_completion(VOID_PARAM) #endif /* @@ -852,20 +857,22 @@ cmd_edit(c) /* * No current history; don't accept history manipulation cmds. */ - flags |= EC_NOHISTORY; + flags |= ECF_NOHISTORY; #endif #if TAB_COMPLETE_FILENAME if (curr_mlist == ml_search) /* * In a search command; don't accept file-completion cmds. */ - flags |= EC_NOCOMPLETE; + flags |= ECF_NOCOMPLETE; #endif action = editchar(c, flags); switch (action) { + case A_NOACTION: + return (CC_OK); case EC_RIGHT: not_in_completion(); return (cmd_right()); @@ -934,8 +941,6 @@ cmd_edit(c) case EC_EXPAND: return (cmd_complete(action)); #endif - case EC_NOACTION: - return (CC_OK); default: not_in_completion(); return (CC_PASS); @@ -1237,9 +1242,9 @@ fail: * Process a single character of a multi-character command, such as * a number, or the pattern of a search command. * Returns: - * CC_OK The char was accepted. - * CC_QUIT The char requests the command to be aborted. - * CC_ERROR The char could not be accepted due to an error. + * CC_OK The char was accepted. + * CC_QUIT The char requests the command to be aborted. + * CC_ERROR The char could not be accepted due to an error. */ public int cmd_char(c) diff --git a/contrib/less/command.c b/contrib/less/command.c index 8e0ae4b34d67..ae59181c2827 100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -57,21 +57,22 @@ extern void *ml_shell; extern char *editor; extern char *editproto; #endif -extern int screen_trashed; /* The screen has been overwritten */ +extern int screen_trashed; /* The screen has been overwritten */ extern int shift_count; extern int oldbot; extern int forw_prompt; +extern int incr_search; #if MSDOS_COMPILER==WIN32C extern int utf_mode; #endif #if SHELL_ESCAPE -static char *shellcmd = NULL; /* For holding last shell command for "!!" */ +static char *shellcmd = NULL; /* For holding last shell command for "!!" */ #endif -static int mca; /* The multicharacter command (action) */ -static int search_type; /* The previous type of search */ -static LINENUM number; /* The number typed by the user */ -static long fraction; /* The fractional part of the number */ +static int mca; /* The multicharacter command (action) */ +static int search_type; /* The previous type of search */ +static LINENUM number; /* The number typed by the user */ +static long fraction; /* The fractional part of the number */ static struct loption *curropt; static int opt_lower; static int optflag; @@ -113,7 +114,6 @@ set_mca(action) int action; { mca = action; - deinit_mouse(); /* we don't want mouse events while entering a cmd */ clear_bot(); clear_cmd(); } @@ -127,7 +127,6 @@ clear_mca(VOID_PARAM) if (mca == 0) return; mca = 0; - init_mouse(); } /* @@ -177,6 +176,8 @@ mca_search(VOID_PARAM) cmd_putstr("Keep-pos "); if (search_type & SRCH_NO_REGEX) cmd_putstr("Regex-off "); + if (search_type & SRCH_WRAP) + cmd_putstr("Wrap "); #if HILITE_SEARCH if (search_type & SRCH_FILTER) @@ -520,9 +521,9 @@ mca_search_char(c) /* * Certain characters as the first char of * the pattern have special meaning: - * ! Toggle the NO_MATCH flag - * * Toggle the PAST_EOF flag - * @ Toggle the FIRST_FILE flag + * ! Toggle the NO_MATCH flag + * * Toggle the PAST_EOF flag + * @ Toggle the FIRST_FILE flag */ if (len_cmdbuf() > 0) return (NO_MCA); @@ -547,6 +548,10 @@ mca_search_char(c) if (mca != A_FILTER) flag = SRCH_NO_MOVE; break; + case CONTROL('W'): /* WRAP around */ + if (mca != A_FILTER) + flag = SRCH_WRAP; + break; case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */ flag = SRCH_NO_REGEX; break; @@ -558,7 +563,8 @@ mca_search_char(c) if (flag != 0) { - search_type ^= flag; + /* Toggle flag, but keep PAST_EOF and WRAP mutually exclusive. */ + search_type ^= flag | (search_type & (SRCH_PAST_EOF|SRCH_WRAP)); mca_search(); return (MCA_MORE); } @@ -596,9 +602,16 @@ mca_char(c) * Entering digits of a number. * Terminated by a non-digit. */ - if (!((c >= '0' && c <= '9') || c == '.') && - editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID) + if ((c >= '0' && c <= '9') || c == '.') + break; + switch (editchar(c, ECF_PEEK|ECF_NOHISTORY|ECF_NOCOMPLETE|ECF_NORIGHTLEFT)) { + case A_NOACTION: + /* + * Ignore this char and get another one. + */ + return (MCA_MORE); + case A_INVALID: /* * Not part of the number. * End the number and treat this char @@ -651,15 +664,44 @@ mca_char(c) */ return (MCA_DONE); - if ((mca == A_F_BRACKET || mca == A_B_BRACKET) && len_cmdbuf() >= 2) *** 9553 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun May 9 02:32:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59C73646F19; Sun, 9 May 2021 02:32:16 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fd7W426dFz4W1T; Sun, 9 May 2021 02:32:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3B6A419B6; Sun, 9 May 2021 02:32:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1492WGxw028304; Sun, 9 May 2021 02:32:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1492WG4C028303; Sun, 9 May 2021 02:32:16 GMT (envelope-from git) Date: Sun, 9 May 2021 02:32:16 GMT Message-Id: <202105090232.1492WG4C028303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: c5c5683eb6c4 - stable/11 - less: upgrade to v581.2. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: c5c5683eb6c4e1d80e02e1e23e5c9bfc8f83c80b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 02:32:16 -0000 The branch stable/11 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=c5c5683eb6c4e1d80e02e1e23e5c9bfc8f83c80b commit c5c5683eb6c4e1d80e02e1e23e5c9bfc8f83c80b Author: Xin LI AuthorDate: 2021-04-19 02:46:19 +0000 Commit: Xin LI CommitDate: 2021-05-09 02:32:08 +0000 less: upgrade to v581.2. (cherry picked from commit 50d31dbc6e2bc3aa6007edb8cdecbcb84e85d6c0) less: upgrade to v581. (cherry picked from commit 2235c7feac959bcc9ddfd6a2bc6be32102b1f84c) --- contrib/less/INSTALL | 10 +- contrib/less/NEWS | 50 ++- contrib/less/README | 38 +- contrib/less/brac.c | 2 +- contrib/less/ch.c | 54 ++- contrib/less/charset.c | 154 ++++---- contrib/less/charset.h | 2 +- contrib/less/cmd.h | 20 +- contrib/less/cmdbuf.c | 87 ++--- contrib/less/command.c | 189 +++++++--- contrib/less/cvt.c | 12 +- contrib/less/decode.c | 367 ++++++++++--------- contrib/less/edit.c | 33 +- contrib/less/filename.c | 29 +- contrib/less/forwback.c | 11 +- contrib/less/funcs.h | 35 +- contrib/less/help.c | 24 +- contrib/less/ifile.c | 39 +- contrib/less/input.c | 45 ++- contrib/less/jump.c | 2 +- contrib/less/less.h | 419 +++++++++++---------- contrib/less/less.hlp | 22 +- contrib/less/less.nro | 204 +++++++++-- contrib/less/lessecho.c | 14 +- contrib/less/lessecho.nro | 8 +- contrib/less/lesskey.c | 163 ++++----- contrib/less/lesskey.h | 38 +- contrib/less/lesskey.nro | 25 +- contrib/less/lglob.h | 110 +++--- contrib/less/line.c | 905 ++++++++++++++++++++++++++-------------------- contrib/less/linenum.c | 31 +- contrib/less/lsystem.c | 44 +-- contrib/less/main.c | 85 +++-- contrib/less/mark.c | 26 +- contrib/less/optfunc.c | 309 ++++++++++++---- contrib/less/option.c | 25 +- contrib/less/option.h | 62 ++-- contrib/less/opttbl.c | 154 +++++--- contrib/less/os.c | 94 ++++- contrib/less/output.c | 612 ++++++++++++++++--------------- contrib/less/pattern.c | 11 +- contrib/less/pattern.h | 18 +- contrib/less/pckeys.h | 38 +- contrib/less/position.c | 12 +- contrib/less/position.h | 12 +- contrib/less/prompt.c | 88 ++--- contrib/less/regexp.h | 14 +- contrib/less/screen.c | 796 ++++++++++++++++++++++++++++------------ contrib/less/scrsize.c | 2 +- contrib/less/search.c | 359 +++++++++++++----- contrib/less/signal.c | 14 +- contrib/less/tags.c | 77 ++-- contrib/less/ttyin.c | 51 ++- contrib/less/version.c | 30 +- usr.bin/less/defines.h | 13 +- 55 files changed, 3782 insertions(+), 2306 deletions(-) diff --git a/contrib/less/INSTALL b/contrib/less/INSTALL index c2ab230e4470..78ae93246d88 100644 --- a/contrib/less/INSTALL +++ b/contrib/less/INSTALL @@ -1,6 +1,6 @@ - This file describes how to build and install less using -the "configure" script. This only works on Unix systems. -To install on other systems, read the README file. +This file contains generic instructions on how to build and +install software using autoconf. For specific instructions +on how to build "less", see the README or README.VER file. Basic Installation @@ -24,8 +24,8 @@ diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change + The file `configure.ac' is used to create `configure' by a program +called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: diff --git a/contrib/less/NEWS b/contrib/less/NEWS index b0644fd2e0de..bc5afd655ddc 100644 --- a/contrib/less/NEWS +++ b/contrib/less/NEWS @@ -4,10 +4,56 @@ ====================================================================== For the latest news about less, see the "less" Web page: - http://www.greenwoodsoftware.com/less + https://greenwoodsoftware.com/less You can also download the latest version of less from there. - To report bugs, suggestions or comments, send email to bug-less@gnu.org + Report bugs, suggestions or comments at + https://github.com/gwsw/less/issues. + +====================================================================== + + Major changes between "less" versions 563 and 581.2 + +* Change ESC-u command to toggle, not disable, highlighting per man page. + +* Add ESC-U command. + +* Add ctrl-W search modifier for wrapping search. + +* F command can be interrupted by ^X. + +* Support OSC 8 hyperlinks when -R is in effect. + +* g command with no number will ignore -j and put first line at top of screen. + +* Multiple + or -p command line options are handled better. + +* Add the --incsearch option. + +* Add the --line-num-width option. + +* Add the --status-col-width option. + +* Add the --use-color and --color options. + +* Display -w highlight even if highlighted line is empty. + +* If search result is in a long line, scroll to ensure it is visible. + +* Editing the same file under different names now creates only + one entry in the file list. + +* Make visual bell more visible on some terminals. + +* Ring end-of-file bell no more than once per second. + +* Build can use either Python or Perl for Makefile.aut operations. + +* Fix crash when using the @ search modifier. + +* Fix crash in the 's' command due to duplicate free. + +* Fix realpath crash on Darwin. ====================================================================== diff --git a/contrib/less/README b/contrib/less/README index 81cb7e091296..2acbd00d762a 100644 --- a/contrib/less/README +++ b/contrib/less/README @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 563 + Less, version 581.2 - This is the distribution of less, version 563, released 13 Jun 2020. + This is the distribution of less, version 581.2, released 28 Apr 2021. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -21,33 +21,29 @@ or 2. The Less License, in the file LICENSE. - Please report any problems to bug-less@gnu.org. - See http://www.greenwoodsoftware.com/less for the latest info. + Please report any problems at https://github.com/gwsw/less/issues. + See https://greenwoodsoftware.com/less for the latest info. Source repository is at https://github.com/gwsw/less.git. ========================================================================= -This is the distribution of "less", a paginator similar to "more" or "pg". - The formatted manual page is in less.man. The manual page nroff source is in less.nro. Major changes made since the last posted version are in NEWS. ======================================================================= -PRE-INSTALLATION (when using git) - -If you are building from a clone of a git repository, -type "make -f Makefile.aut". -If you are building from a numbered release package (a tar or zip file -with a name like less-999.tar.gz or less-999.zip), you should skip this step. - -======================================================================= -INSTALLATION (Unix systems only): +INSTALLATION (Unix & Linux systems only): 1. Move the distributed source to its own directory and unpack it, if you have not already done so. -2. Type "sh configure". +2. If you are building from a clone of a git repository, + type "make -f Makefile.aut". + If you are building from a numbered release package (a tar or + zip file with a name like less-999.tar.gz or less-999.zip downloaded + from greenwoodsoftware.com, not from github), you should skip this step. + +3. Type "sh configure". This will generate a Makefile and a defines.h. Warning: if you have a GNU sed, make sure it is version 2.05 or later. @@ -79,7 +75,7 @@ INSTALLATION (Unix systems only): commands, etc. -3. It is a good idea to look over the generated Makefile and defines.h +4. It is a good idea to look over the generated Makefile and defines.h and make sure they look ok. If you know of any peculiarities of your system that configure might not have detected, you may fix the Makefile now. Take particular notice of the list of "terminal" @@ -93,13 +89,13 @@ INSTALLATION (Unix systems only): to remove the descriptions of the features which you are removing. If you edit less.hlp, you should run "make -f Makefile.aut help.c". -4. Type "make" and watch the fun. +5. Type "make" and watch the fun. -5. If the make succeeds, it will generate the programs "less", +6. If the make succeeds, it will generate the programs "less", "lesskey" and "lessecho" in your current directory. Test the generated programs. -6. When satisfied that it works, if you wish to install it +7. When satisfied that it works, if you wish to install it in a public place, type "make install". The default install destinations are: @@ -108,8 +104,6 @@ INSTALLATION (Unix systems only): If you want to install any of these files elsewhere, define bindir and/or mandir to the appropriate directories. -If you have any problems building or running "less", suggestions, -complaints, etc., you may mail to bug-less@gnu.org. Note to hackers: comments noting possible improvements are enclosed in double curly brackets {{ like this }}. diff --git a/contrib/less/brac.c b/contrib/less/brac.c index db3a2951db08..53ada50aab56 100644 --- a/contrib/less/brac.c +++ b/contrib/less/brac.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/ch.c b/contrib/less/ch.c index 70fad1002dbf..bab0692f7437 100644 --- a/contrib/less/ch.c +++ b/contrib/less/ch.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -41,7 +41,7 @@ struct bufnode { struct bufnode *hnext, *hprev; }; -#define LBUFSIZE 8192 +#define LBUFSIZE 8192 struct buf { struct bufnode node; BLOCKNUM block; @@ -54,7 +54,7 @@ struct buf { * The file state is maintained in a filestate structure. * A pointer to the filestate is kept in the ifile structure. */ -#define BUFHASH_SIZE 1024 +#define BUFHASH_SIZE 1024 struct filestate { struct bufnode buflist; struct bufnode hashtbl[BUFHASH_SIZE]; @@ -67,24 +67,24 @@ struct filestate { POSITION fsize; }; -#define ch_bufhead thisfile->buflist.next -#define ch_buftail thisfile->buflist.prev -#define ch_nbufs thisfile->nbufs -#define ch_block thisfile->block -#define ch_offset thisfile->offset -#define ch_fpos thisfile->fpos -#define ch_fsize thisfile->fsize -#define ch_flags thisfile->flags -#define ch_file thisfile->file +#define ch_bufhead thisfile->buflist.next +#define ch_buftail thisfile->buflist.prev +#define ch_nbufs thisfile->nbufs +#define ch_block thisfile->block +#define ch_offset thisfile->offset +#define ch_fpos thisfile->fpos +#define ch_fsize thisfile->fsize +#define ch_flags thisfile->flags +#define ch_file thisfile->file -#define END_OF_CHAIN (&thisfile->buflist) -#define END_OF_HCHAIN(h) (&thisfile->hashtbl[h]) -#define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1)) +#define END_OF_CHAIN (&thisfile->buflist) +#define END_OF_HCHAIN(h) (&thisfile->hashtbl[h]) +#define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1)) /* * Macros to manipulate the list of buffers in thisfile->buflist. */ -#define FOR_BUFS(bn) \ +#define FOR_BUFS(bn) \ for (bn = ch_bufhead; bn != END_OF_CHAIN; bn = bn->next) #define BUF_RM(bn) \ @@ -106,15 +106,15 @@ struct filestate { /* * Macros to manipulate the list of buffers in thisfile->hashtbl[n]. */ -#define FOR_BUFS_IN_CHAIN(h,bn) \ +#define FOR_BUFS_IN_CHAIN(h,bn) \ for (bn = thisfile->hashtbl[h].hnext; \ bn != END_OF_HCHAIN(h); bn = bn->hnext) -#define BUF_HASH_RM(bn) \ +#define BUF_HASH_RM(bn) \ (bn)->hnext->hprev = (bn)->hprev; \ (bn)->hprev->hnext = (bn)->hnext; -#define BUF_HASH_INS(bn,h) \ +#define BUF_HASH_INS(bn,h) \ (bn)->hnext = thisfile->hashtbl[h].hnext; \ (bn)->hprev = END_OF_HCHAIN(h); \ thisfile->hashtbl[h].hnext->hprev = (bn); \ @@ -240,12 +240,12 @@ ch_get(VOID_PARAM) return ('?'); if (lseek(ch_file, (off_t)pos, SEEK_SET) == BAD_LSEEK) { - error("seek error", NULL_PARG); + error("seek error", NULL_PARG); clear_eol(); return (EOI); - } - ch_fpos = pos; - } + } + ch_fpos = pos; + } /* * Read the block. @@ -311,13 +311,7 @@ ch_get(VOID_PARAM) parg.p_string = wait_message(); ierror("%s", &parg); } -#if !MSDOS_COMPILER - sleep(1); -#else -#if MSDOS_COMPILER==WIN32C - Sleep(1000); -#endif -#endif + sleep_ms(2); /* Reduce system load */ slept = TRUE; #if HAVE_STAT_INO diff --git a/contrib/less/charset.c b/contrib/less/charset.c index 4897cbaf6adc..b37c8a29cbd9 100644 --- a/contrib/less/charset.c +++ b/contrib/less/charset.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -40,27 +40,27 @@ struct charset { int *p_flag; char *desc; } charsets[] = { - { "ascii", NULL, "8bcccbcc18b95.b" }, - { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, - { "iso8859", NULL, "8bcccbcc18b95.33b." }, - { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, - { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, - { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, - { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, - { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, - { "koi8-r", NULL, "8bcccbcc18b95.b." }, - { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, - { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, - { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, - { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, - { "next", NULL, "8bcccbcc18b95.bb125.bb" }, - { "dos", NULL, "8bcccbcc12bc5b95.b." }, - { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, - { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, - { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, - { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, - { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, - { NULL, NULL, NULL } + { "ascii", NULL, "8bcccbcc18b95.b" }, + { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, + { "iso8859", NULL, "8bcccbcc18b95.33b." }, + { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, + { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, + { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, + { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, + { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, + { "koi8-r", NULL, "8bcccbcc18b95.b." }, + { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, + { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, + { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, + { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, + { "next", NULL, "8bcccbcc18b95.bb125.bb" }, + { "dos", NULL, "8bcccbcc12bc5b95.b." }, + { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, + { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, + { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, + { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, + { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, + { NULL, NULL, NULL } }; /* @@ -70,58 +70,58 @@ struct cs_alias { char *name; char *oname; } cs_aliases[] = { - { "UTF-8", "utf-8" }, - { "utf8", "utf-8" }, - { "UTF8", "utf-8" }, - { "ANSI_X3.4-1968", "ascii" }, - { "US-ASCII", "ascii" }, - { "latin1", "iso8859" }, - { "ISO-8859-1", "iso8859" }, - { "latin9", "iso8859" }, - { "ISO-8859-15", "iso8859" }, - { "latin2", "iso8859" }, - { "ISO-8859-2", "iso8859" }, - { "ISO-8859-3", "latin3" }, - { "latin4", "iso8859" }, - { "ISO-8859-4", "iso8859" }, - { "cyrillic", "iso8859" }, - { "ISO-8859-5", "iso8859" }, - { "ISO-8859-6", "arabic" }, - { "ISO-8859-7", "greek" }, - { "IBM9005", "greek2005" }, - { "ISO-8859-8", "hebrew" }, - { "latin5", "iso8859" }, - { "ISO-8859-9", "iso8859" }, - { "latin6", "iso8859" }, - { "ISO-8859-10", "iso8859" }, - { "latin7", "iso8859" }, - { "ISO-8859-13", "iso8859" }, - { "latin8", "iso8859" }, - { "ISO-8859-14", "iso8859" }, - { "latin10", "iso8859" }, - { "ISO-8859-16", "iso8859" }, - { "IBM437", "dos" }, - { "EBCDIC-US", "ebcdic" }, - { "IBM1047", "IBM-1047" }, - { "KOI8-R", "koi8-r" }, - { "KOI8-U", "koi8-r" }, - { "GEORGIAN-PS", "georgianps" }, - { "TCVN5712-1", "tcvn" }, - { "NEXTSTEP", "next" }, - { "windows", "windows-1252" }, /* backward compatibility */ - { "CP1251", "windows-1251" }, - { "CP1252", "windows-1252" }, - { "CP1255", "windows-1255" }, + { "UTF-8", "utf-8" }, + { "utf8", "utf-8" }, + { "UTF8", "utf-8" }, + { "ANSI_X3.4-1968", "ascii" }, + { "US-ASCII", "ascii" }, + { "latin1", "iso8859" }, + { "ISO-8859-1", "iso8859" }, + { "latin9", "iso8859" }, + { "ISO-8859-15", "iso8859" }, + { "latin2", "iso8859" }, + { "ISO-8859-2", "iso8859" }, + { "ISO-8859-3", "latin3" }, + { "latin4", "iso8859" }, + { "ISO-8859-4", "iso8859" }, + { "cyrillic", "iso8859" }, + { "ISO-8859-5", "iso8859" }, + { "ISO-8859-6", "arabic" }, + { "ISO-8859-7", "greek" }, + { "IBM9005", "greek2005" }, + { "ISO-8859-8", "hebrew" }, + { "latin5", "iso8859" }, + { "ISO-8859-9", "iso8859" }, + { "latin6", "iso8859" }, + { "ISO-8859-10", "iso8859" }, + { "latin7", "iso8859" }, + { "ISO-8859-13", "iso8859" }, + { "latin8", "iso8859" }, + { "ISO-8859-14", "iso8859" }, + { "latin10", "iso8859" }, + { "ISO-8859-16", "iso8859" }, + { "IBM437", "dos" }, + { "EBCDIC-US", "ebcdic" }, + { "IBM1047", "IBM-1047" }, + { "KOI8-R", "koi8-r" }, + { "KOI8-U", "koi8-r" }, + { "GEORGIAN-PS", "georgianps" }, + { "TCVN5712-1", "tcvn" }, + { "NEXTSTEP", "next" }, + { "windows", "windows-1252" }, /* backward compatibility */ + { "CP1251", "windows-1251" }, + { "CP1252", "windows-1252" }, + { "CP1255", "windows-1255" }, { NULL, NULL } }; -#define IS_BINARY_CHAR 01 -#define IS_CONTROL_CHAR 02 +#define IS_BINARY_CHAR 01 +#define IS_CONTROL_CHAR 02 static char chardef[256]; static char *binfmt = NULL; static char *utfbinfmt = NULL; -public int binattr = AT_STANDOUT; +public int binattr = AT_STANDOUT|AT_COLOR_BIN; /* @@ -134,9 +134,9 @@ public int binattr = AT_STANDOUT; * repetition of the letter. * * Each letter is one of: - * . normal character - * b binary character - * c control character + * . normal character + * b binary character + * c control character */ static void ichardef(s) @@ -457,16 +457,16 @@ prchar(c) SNPRINTF1(buf, sizeof(buf), "^%c", /* * This array roughly inverts CONTROL() #defined in less.h, - * and should be kept in sync with CONTROL() and IBM-1047. - */ + * and should be kept in sync with CONTROL() and IBM-1047. + */ "@ABC.I.?...KLMNO" "PQRS.JH.XY.." "\\]^_" "......W[.....EFG" "..V....D....TU.Z"[c]); #else - else if (c < 128 && !control_char(c ^ 0100)) - SNPRINTF1(buf, sizeof(buf), "^%c", (int) (c ^ 0100)); + else if (c < 128 && !control_char(c ^ 0100)) + SNPRINTF1(buf, sizeof(buf), "^%c", (int) (c ^ 0100)); #endif else SNPRINTF1(buf, sizeof(buf), binfmt, c); @@ -484,7 +484,7 @@ prutfchar(ch) if (ch == ESC) strcpy(buf, "ESC"); - else if (ch < 128 && control_char(ch)) + else if (ch < 128 && control_char(ch)) { if (!control_char(ch ^ 0100)) SNPRINTF1(buf, sizeof(buf), "^%c", ((char) ch) ^ 0100); @@ -732,9 +732,9 @@ step_char(pp, dir, limit) */ #define DECLARE_RANGE_TABLE_START(name) \ - static struct wchar_range name##_array[] = { + static struct wchar_range name##_array[] = { #define DECLARE_RANGE_TABLE_END(name) \ - }; struct wchar_range_table name##_table = { name##_array, sizeof(name##_array)/sizeof(*name##_array) }; + }; struct wchar_range_table name##_table = { name##_array, sizeof(name##_array)/sizeof(*name##_array) }; DECLARE_RANGE_TABLE_START(compose) #include "compose.uni" diff --git a/contrib/less/charset.h b/contrib/less/charset.h index cc0c3af59e89..3e7ecf73db94 100644 --- a/contrib/less/charset.h +++ b/contrib/less/charset.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/cmd.h b/contrib/less/cmd.h index 95a2e5801717..c51f0bc5c4f3 100644 --- a/contrib/less/cmd.h +++ b/contrib/less/cmd.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -31,7 +31,6 @@ #define A_HELP 19 #define A_NEXT_FILE 20 #define A_PERCENT 21 -#define A_PREFIX 22 #define A_PREV_FILE 23 #define A_QUIT 24 #define A_REPAINT 25 @@ -72,19 +71,19 @@ #define A_CLRMARK 62 #define A_SETMARKBOT 63 #define A_X11MOUSE_IN 64 -#define A_X11MOUSE_IGNORE 65 #define A_F_MOUSE 66 #define A_B_MOUSE 67 /* Note "X116" refers to extended (1006) X11 mouse reporting. */ #define A_X116MOUSE_IN 68 -#define A_X116MOUSE_IGNORE 69 +#define A_CLR_SEARCH 70 +/* These values must not conflict with any A_* or EC_* value. */ #define A_INVALID 100 #define A_NOACTION 101 #define A_UINVALID 102 #define A_END_LIST 103 #define A_SPECIAL_KEY 104 - +#define A_PREFIX 105 #define A_SKIP 127 #define A_EXTRA 0200 @@ -111,15 +110,16 @@ #define EC_B_COMPLETE 18 #define EC_LITERAL 19 #define EC_ABORT 20 +#define EC_X11MOUSE 21 +#define EC_X116MOUSE 22 -#define EC_NOACTION 101 #define EC_UINVALID 102 /* Flags for editchar() */ -#define EC_PEEK 01 -#define EC_NOHISTORY 02 -#define EC_NOCOMPLETE 04 -#define EC_NORIGHTLEFT 010 +#define ECF_PEEK 01 +#define ECF_NOHISTORY 02 +#define ECF_NOCOMPLETE 04 +#define ECF_NORIGHTLEFT 010 /* Environment variable stuff */ #define EV_OK 01 diff --git a/contrib/less/cmdbuf.c b/contrib/less/cmdbuf.c index ed78ded00307..9cc1f3e94977 100644 --- a/contrib/less/cmdbuf.c +++ b/contrib/less/cmdbuf.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -26,12 +26,12 @@ extern int no_hist_dups; extern int marks_modified; static char cmdbuf[CMDBUF_SIZE]; /* Buffer for holding a multi-char command */ -static int cmd_col; /* Current column of the cursor */ -static int prompt_col; /* Column of cursor just after prompt */ -static char *cp; /* Pointer into cmdbuf */ -static int cmd_offset; /* Index into cmdbuf of first displayed char */ -static int literal; /* Next input char should not be interpreted */ -static int updown_match = -1; /* Prefix length in up/down movement */ +static int cmd_col; /* Current column of the cursor */ +static int prompt_col; /* Column of cursor just after prompt */ +static char *cp; /* Pointer into cmdbuf */ +static int cmd_offset; /* Index into cmdbuf of first displayed char */ +static int literal; /* Next input char should not be interpreted */ +static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME static int cmd_complete LESSPARAMS((int action)); @@ -223,7 +223,7 @@ cmd_step_common(p, ch, len, pwidth, bswidth) } } if (pwidth != NULL) - *pwidth = width; + *pwidth = width; if (bswidth != NULL) *bswidth = width; return (pr); @@ -259,17 +259,42 @@ cmd_step_left(pp, pwidth, bswidth) return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth); } +/* + * Put the cursor at "home" (just after the prompt), + * and set cp to the corresponding char in cmdbuf. + */ + static void +cmd_home(VOID_PARAM) +{ + while (cmd_col > prompt_col) + { + int width, bswidth; + + cmd_step_left(&cp, &width, &bswidth); + while (bswidth-- > 0) + putbs(); + cmd_col -= width; + } + + cp = &cmdbuf[cmd_offset]; +} + /* * Repaint the line from cp onwards. * Then position the cursor just after the char old_cp (a pointer into cmdbuf). */ - static void + public void cmd_repaint(old_cp) constant char *old_cp; { /* * Repaint the line from the current position. */ + if (old_cp == NULL) + { + old_cp = cp; + cmd_home(); + } clear_eol(); while (*cp != '\0') { @@ -300,26 +325,6 @@ cmd_repaint(old_cp) cmd_left(); } -/* - * Put the cursor at "home" (just after the prompt), - * and set cp to the corresponding char in cmdbuf. - */ - static void -cmd_home(VOID_PARAM) -{ - while (cmd_col > prompt_col) - { - int width, bswidth; - - cmd_step_left(&cp, &width, &bswidth); - while (bswidth-- > 0) - putbs(); - cmd_col -= width; - } - - cp = &cmdbuf[cmd_offset]; -} - /* * Shift the cmdbuf display left a half-screen. */ @@ -826,9 +831,9 @@ cmd_accept(VOID_PARAM) * Try to perform a line-edit function on the command buffer, * using a specified char as a line-editing command. * Returns: - * CC_PASS The char does not invoke a line edit function. - * CC_OK Line edit function done. - * CC_QUIT The char requests the current command to be aborted. + * CC_PASS The char does not invoke a line edit function. + * CC_OK Line edit function done. + * CC_QUIT The char requests the current command to be aborted. */ static int cmd_edit(c) @@ -838,9 +843,9 @@ cmd_edit(c) int flags; #if TAB_COMPLETE_FILENAME -#define not_in_completion() in_completion = 0 +#define not_in_completion() in_completion = 0 #else -#define not_in_completion(VOID_PARAM) +#define not_in_completion(VOID_PARAM) #endif /* @@ -852,20 +857,22 @@ cmd_edit(c) /* * No current history; don't accept history manipulation cmds. */ - flags |= EC_NOHISTORY; + flags |= ECF_NOHISTORY; #endif #if TAB_COMPLETE_FILENAME if (curr_mlist == ml_search) /* * In a search command; don't accept file-completion cmds. */ - flags |= EC_NOCOMPLETE; + flags |= ECF_NOCOMPLETE; #endif action = editchar(c, flags); switch (action) { + case A_NOACTION: + return (CC_OK); case EC_RIGHT: not_in_completion(); return (cmd_right()); @@ -934,8 +941,6 @@ cmd_edit(c) case EC_EXPAND: return (cmd_complete(action)); #endif - case EC_NOACTION: - return (CC_OK); default: not_in_completion(); return (CC_PASS); @@ -1237,9 +1242,9 @@ fail: * Process a single character of a multi-character command, such as * a number, or the pattern of a search command. * Returns: - * CC_OK The char was accepted. - * CC_QUIT The char requests the command to be aborted. - * CC_ERROR The char could not be accepted due to an error. + * CC_OK The char was accepted. + * CC_QUIT The char requests the command to be aborted. + * CC_ERROR The char could not be accepted due to an error. */ public int cmd_char(c) diff --git a/contrib/less/command.c b/contrib/less/command.c index 8e0ae4b34d67..ae59181c2827 100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -57,21 +57,22 @@ extern void *ml_shell; extern char *editor; extern char *editproto; #endif -extern int screen_trashed; /* The screen has been overwritten */ +extern int screen_trashed; /* The screen has been overwritten */ extern int shift_count; extern int oldbot; extern int forw_prompt; +extern int incr_search; #if MSDOS_COMPILER==WIN32C extern int utf_mode; #endif #if SHELL_ESCAPE -static char *shellcmd = NULL; /* For holding last shell command for "!!" */ +static char *shellcmd = NULL; /* For holding last shell command for "!!" */ #endif -static int mca; /* The multicharacter command (action) */ -static int search_type; /* The previous type of search */ -static LINENUM number; /* The number typed by the user */ -static long fraction; /* The fractional part of the number */ +static int mca; /* The multicharacter command (action) */ +static int search_type; /* The previous type of search */ +static LINENUM number; /* The number typed by the user */ +static long fraction; /* The fractional part of the number */ static struct loption *curropt; static int opt_lower; static int optflag; @@ -113,7 +114,6 @@ set_mca(action) int action; { mca = action; - deinit_mouse(); /* we don't want mouse events while entering a cmd */ clear_bot(); clear_cmd(); } @@ -127,7 +127,6 @@ clear_mca(VOID_PARAM) if (mca == 0) return; mca = 0; - init_mouse(); } /* @@ -177,6 +176,8 @@ mca_search(VOID_PARAM) cmd_putstr("Keep-pos "); if (search_type & SRCH_NO_REGEX) cmd_putstr("Regex-off "); + if (search_type & SRCH_WRAP) + cmd_putstr("Wrap "); #if HILITE_SEARCH if (search_type & SRCH_FILTER) @@ -520,9 +521,9 @@ mca_search_char(c) /* * Certain characters as the first char of * the pattern have special meaning: - * ! Toggle the NO_MATCH flag - * * Toggle the PAST_EOF flag - * @ Toggle the FIRST_FILE flag + * ! Toggle the NO_MATCH flag + * * Toggle the PAST_EOF flag + * @ Toggle the FIRST_FILE flag */ if (len_cmdbuf() > 0) return (NO_MCA); @@ -547,6 +548,10 @@ mca_search_char(c) if (mca != A_FILTER) flag = SRCH_NO_MOVE; break; + case CONTROL('W'): /* WRAP around */ + if (mca != A_FILTER) + flag = SRCH_WRAP; + break; case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */ flag = SRCH_NO_REGEX; break; @@ -558,7 +563,8 @@ mca_search_char(c) if (flag != 0) { - search_type ^= flag; + /* Toggle flag, but keep PAST_EOF and WRAP mutually exclusive. */ + search_type ^= flag | (search_type & (SRCH_PAST_EOF|SRCH_WRAP)); mca_search(); return (MCA_MORE); } @@ -596,9 +602,16 @@ mca_char(c) * Entering digits of a number. * Terminated by a non-digit. */ - if (!((c >= '0' && c <= '9') || c == '.') && - editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID) + if ((c >= '0' && c <= '9') || c == '.') + break; + switch (editchar(c, ECF_PEEK|ECF_NOHISTORY|ECF_NOCOMPLETE|ECF_NORIGHTLEFT)) { + case A_NOACTION: + /* + * Ignore this char and get another one. + */ + return (MCA_MORE); + case A_INVALID: /* * Not part of the number. * End the number and treat this char @@ -651,15 +664,44 @@ mca_char(c) */ return (MCA_DONE); - if ((mca == A_F_BRACKET || mca == A_B_BRACKET) && len_cmdbuf() >= 2) *** 9553 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun May 9 02:58:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABF636471F0; Sun, 9 May 2021 02:58:47 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fd85g4Vnvz4X6n; Sun, 9 May 2021 02:58:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8D6181FA0; Sun, 9 May 2021 02:58:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1492wlfS054645; Sun, 9 May 2021 02:58:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1492wlK8054644; Sun, 9 May 2021 02:58:47 GMT (envelope-from git) Date: Sun, 9 May 2021 02:58:47 GMT Message-Id: <202105090258.1492wlK8054644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 69aed9987e27 - stable/13 - nfscl: fix delegation recall when the file is not open MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 69aed9987e2790b24cfff6284e75fbad46172729 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 02:58:47 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=69aed9987e2790b24cfff6284e75fbad46172729 commit 69aed9987e2790b24cfff6284e75fbad46172729 Author: Rick Macklem AuthorDate: 2021-04-25 19:52:48 +0000 Commit: Rick Macklem CommitDate: 2021-05-09 02:55:16 +0000 nfscl: fix delegation recall when the file is not open Without this patch, if a NFSv4 server recalled a delegation when the file is not open, the renew thread would block in the NFS VOP_INACTIVE() trying to acquire the client state lock that it already holds. This patch fixes the problem by delaying the vrele() call until after the client state lock is released. This bug has been in the NFSv4 client for a long time, but since it only affects delegation when recalled due to another client opening the file, it got missed during previous testing. Until you have this patch in your client, you should avoid the use of delegations. (cherry picked from commit 02695ea8909d818ceaa726f90f889889dfd39fac) --- sys/fs/nfsclient/nfs_clstate.c | 53 ++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index e310deff6cf9..6cff58331c97 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -156,7 +156,8 @@ static void nfscl_freedeleg(struct nfscldeleghead *, struct nfscldeleg *); static int nfscl_errmap(struct nfsrv_descript *, u_int32_t); static void nfscl_cleanup_common(struct nfsclclient *, u_int8_t *); static int nfscl_recalldeleg(struct nfsclclient *, struct nfsmount *, - struct nfscldeleg *, vnode_t, struct ucred *, NFSPROC_T *, int); + struct nfscldeleg *, vnode_t, struct ucred *, NFSPROC_T *, int, + vnode_t *); static void nfscl_freeopenowner(struct nfsclowner *, int); static void nfscl_cleandeleg(struct nfscldeleg *); static int nfscl_trydelegreturn(struct nfscldeleg *, struct ucred *, @@ -2562,6 +2563,7 @@ nfscl_renewthread(struct nfsclclient *clp, NFSPROC_T *p) struct nfsclds *dsp; bool retok; struct mount *mp; + vnode_t vp; cred = newnfs_getcred(); NFSLOCKCLSTATE(); @@ -2683,7 +2685,7 @@ tryagain: NFSUNLOCKCLSTATE(); newnfs_copycred(&dp->nfsdl_cred, cred); ret = nfscl_recalldeleg(clp, clp->nfsc_nmp, dp, - NULL, cred, p, 1); + NULL, cred, p, 1, &vp); if (!ret) { nfscl_cleandeleg(dp); TAILQ_REMOVE(&clp->nfsc_deleg, dp, @@ -2694,6 +2696,22 @@ tryagain: nfsstatsv1.cldelegates--; } NFSLOCKCLSTATE(); + /* + * The nfsc_lock must be released before doing + * vrele(), since it might call nfs_inactive(). + * For the unlikely case where the vnode failed + * to be acquired by nfscl_recalldeleg(), a + * VOP_RECLAIM() should be in progress and it + * will return the delegation. + */ + nfsv4_unlock(&clp->nfsc_lock, 0); + igotlock = 0; + if (vp != NULL) { + NFSUNLOCKCLSTATE(); + vrele(vp); + NFSLOCKCLSTATE(); + } + goto tryagain; } dp = ndp; } @@ -3943,16 +3961,18 @@ nfscl_lockt(vnode_t vp, struct nfsclclient *clp, u_int64_t off, static int nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, struct nfscldeleg *dp, vnode_t vp, struct ucred *cred, NFSPROC_T *p, - int called_from_renewthread) + int called_from_renewthread, vnode_t *vpp) { struct nfsclowner *owp, *lowp, *nowp; struct nfsclopen *op, *lop; struct nfscllockowner *lp; struct nfscllock *lckp; struct nfsnode *np; - int error = 0, ret, gotvp = 0; + int error = 0, ret; if (vp == NULL) { + KASSERT(vpp != NULL, ("nfscl_recalldeleg: vpp NULL")); + *vpp = NULL; /* * First, get a vnode for the file. This is needed to do RPCs. */ @@ -3966,7 +3986,7 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, return (0); } vp = NFSTOV(np); - gotvp = 1; + *vpp = vp; } else { np = VTONFS(vp); } @@ -3993,8 +4013,6 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, * return now, so that the dirty buffer will be flushed * later. */ - if (gotvp != 0) - vrele(vp); return (ret); } @@ -4018,11 +4036,8 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, owp, dp, cred, p); if (ret == NFSERR_STALECLIENTID || ret == NFSERR_STALEDONTRECOVER || - ret == NFSERR_BADSESSION) { - if (gotvp) - vrele(vp); + ret == NFSERR_BADSESSION) return (ret); - } if (ret) { nfscl_freeopen(lop, 1); if (!error) @@ -4050,11 +4065,8 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, nfscl_freeopenowner(owp, 0); if (ret == NFSERR_STALECLIENTID || ret == NFSERR_STALEDONTRECOVER || - ret == NFSERR_BADSESSION) { - if (gotvp) - vrele(vp); + ret == NFSERR_BADSESSION) return (ret); - } if (ret) { nfscl_freeopen(lop, 1); if (!error) @@ -4075,17 +4087,12 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, if (ret == NFSERR_STALESTATEID || ret == NFSERR_STALEDONTRECOVER || ret == NFSERR_STALECLIENTID || - ret == NFSERR_BADSESSION) { - if (gotvp) - vrele(vp); + ret == NFSERR_BADSESSION) return (ret); - } if (ret && !error) error = ret; } } - if (gotvp) - vrele(vp); return (error); } @@ -4497,7 +4504,7 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T *p, nfsv4stateid_t *stp) NFSUNLOCKCLSTATE(); cred = newnfs_getcred(); newnfs_copycred(&dp->nfsdl_cred, cred); - (void) nfscl_recalldeleg(clp, nmp, dp, vp, cred, p, 0); + nfscl_recalldeleg(clp, nmp, dp, vp, cred, p, 0, NULL); NFSFREECRED(cred); triedrecall = 1; NFSLOCKCLSTATE(); @@ -4596,7 +4603,7 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp, NFSUNLOCKCLSTATE(); cred = newnfs_getcred(); newnfs_copycred(&dp->nfsdl_cred, cred); - (void) nfscl_recalldeleg(clp, nmp, dp, fvp, cred, p, 0); + nfscl_recalldeleg(clp, nmp, dp, fvp, cred, p, 0, NULL); NFSFREECRED(cred); triedrecall = 1; NFSLOCKCLSTATE(); From owner-dev-commits-src-all@freebsd.org Sun May 9 03:04:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99316647D9D; Sun, 9 May 2021 03:04:04 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fd8Cm3zrRz4XdF; Sun, 9 May 2021 03:04:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7B93F1C78; Sun, 9 May 2021 03:04:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149344Xd069143; Sun, 9 May 2021 03:04:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149344dX069142; Sun, 9 May 2021 03:04:04 GMT (envelope-from git) Date: Sun, 9 May 2021 03:04:04 GMT Message-Id: <202105090304.149344dX069142@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 9223cea0795f - stable/12 - nfscl: fix delegation recall when the file is not open MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9223cea0795f1ef2a5bb856908acc78416bbc966 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 03:04:04 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=9223cea0795f1ef2a5bb856908acc78416bbc966 commit 9223cea0795f1ef2a5bb856908acc78416bbc966 Author: Rick Macklem AuthorDate: 2021-04-25 19:52:48 +0000 Commit: Rick Macklem CommitDate: 2021-05-09 03:00:38 +0000 nfscl: fix delegation recall when the file is not open Without this patch, if a NFSv4 server recalled a delegation when the file is not open, the renew thread would block in the NFS VOP_INACTIVE() trying to acquire the client state lock that it already holds. This patch fixes the problem by delaying the vrele() call until after the client state lock is released. This bug has been in the NFSv4 client for a long time, but since it only affects delegation when recalled due to another client opening the file, it got missed during previous testing. Until you have this patch in your client, you should avoid the use of delegations. (cherry picked from commit 02695ea8909d818ceaa726f90f889889dfd39fac) --- sys/fs/nfsclient/nfs_clstate.c | 53 ++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 0cade3e4178a..03c046c36ccc 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -152,7 +152,8 @@ static void nfscl_freedeleg(struct nfscldeleghead *, struct nfscldeleg *); static int nfscl_errmap(struct nfsrv_descript *, u_int32_t); static void nfscl_cleanup_common(struct nfsclclient *, u_int8_t *); static int nfscl_recalldeleg(struct nfsclclient *, struct nfsmount *, - struct nfscldeleg *, vnode_t, struct ucred *, NFSPROC_T *, int); + struct nfscldeleg *, vnode_t, struct ucred *, NFSPROC_T *, int, + vnode_t *); static void nfscl_freeopenowner(struct nfsclowner *, int); static void nfscl_cleandeleg(struct nfscldeleg *); static int nfscl_trydelegreturn(struct nfscldeleg *, struct ucred *, @@ -2532,6 +2533,7 @@ nfscl_renewthread(struct nfsclclient *clp, NFSPROC_T *p) struct nfsclrecalllayout *recallp; struct nfsclds *dsp; struct mount *mp; + vnode_t vp; cred = newnfs_getcred(); NFSLOCKCLSTATE(); @@ -2651,7 +2653,7 @@ tryagain: NFSUNLOCKCLSTATE(); newnfs_copycred(&dp->nfsdl_cred, cred); ret = nfscl_recalldeleg(clp, clp->nfsc_nmp, dp, - NULL, cred, p, 1); + NULL, cred, p, 1, &vp); if (!ret) { nfscl_cleandeleg(dp); TAILQ_REMOVE(&clp->nfsc_deleg, dp, @@ -2662,6 +2664,22 @@ tryagain: nfsstatsv1.cldelegates--; } NFSLOCKCLSTATE(); + /* + * The nfsc_lock must be released before doing + * vrele(), since it might call nfs_inactive(). + * For the unlikely case where the vnode failed + * to be acquired by nfscl_recalldeleg(), a + * VOP_RECLAIM() should be in progress and it + * will return the delegation. + */ + nfsv4_unlock(&clp->nfsc_lock, 0); + igotlock = 0; + if (vp != NULL) { + NFSUNLOCKCLSTATE(); + vrele(vp); + NFSLOCKCLSTATE(); + } + goto tryagain; } dp = ndp; } @@ -3906,16 +3924,18 @@ nfscl_lockt(vnode_t vp, struct nfsclclient *clp, u_int64_t off, static int nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, struct nfscldeleg *dp, vnode_t vp, struct ucred *cred, NFSPROC_T *p, - int called_from_renewthread) + int called_from_renewthread, vnode_t *vpp) { struct nfsclowner *owp, *lowp, *nowp; struct nfsclopen *op, *lop; struct nfscllockowner *lp; struct nfscllock *lckp; struct nfsnode *np; - int error = 0, ret, gotvp = 0; + int error = 0, ret; if (vp == NULL) { + KASSERT(vpp != NULL, ("nfscl_recalldeleg: vpp NULL")); + *vpp = NULL; /* * First, get a vnode for the file. This is needed to do RPCs. */ @@ -3929,7 +3949,7 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, return (0); } vp = NFSTOV(np); - gotvp = 1; + *vpp = vp; } else { np = VTONFS(vp); } @@ -3956,8 +3976,6 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, * return now, so that the dirty buffer will be flushed * later. */ - if (gotvp != 0) - vrele(vp); return (ret); } @@ -3981,11 +3999,8 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, owp, dp, cred, p); if (ret == NFSERR_STALECLIENTID || ret == NFSERR_STALEDONTRECOVER || - ret == NFSERR_BADSESSION) { - if (gotvp) - vrele(vp); + ret == NFSERR_BADSESSION) return (ret); - } if (ret) { nfscl_freeopen(lop, 1); if (!error) @@ -4013,11 +4028,8 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, nfscl_freeopenowner(owp, 0); if (ret == NFSERR_STALECLIENTID || ret == NFSERR_STALEDONTRECOVER || - ret == NFSERR_BADSESSION) { - if (gotvp) - vrele(vp); + ret == NFSERR_BADSESSION) return (ret); - } if (ret) { nfscl_freeopen(lop, 1); if (!error) @@ -4038,17 +4050,12 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, if (ret == NFSERR_STALESTATEID || ret == NFSERR_STALEDONTRECOVER || ret == NFSERR_STALECLIENTID || - ret == NFSERR_BADSESSION) { - if (gotvp) - vrele(vp); + ret == NFSERR_BADSESSION) return (ret); - } if (ret && !error) error = ret; } } - if (gotvp) - vrele(vp); return (error); } @@ -4460,7 +4467,7 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T *p, nfsv4stateid_t *stp) NFSUNLOCKCLSTATE(); cred = newnfs_getcred(); newnfs_copycred(&dp->nfsdl_cred, cred); - (void) nfscl_recalldeleg(clp, nmp, dp, vp, cred, p, 0); + nfscl_recalldeleg(clp, nmp, dp, vp, cred, p, 0, NULL); NFSFREECRED(cred); triedrecall = 1; NFSLOCKCLSTATE(); @@ -4559,7 +4566,7 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp, NFSUNLOCKCLSTATE(); cred = newnfs_getcred(); newnfs_copycred(&dp->nfsdl_cred, cred); - (void) nfscl_recalldeleg(clp, nmp, dp, fvp, cred, p, 0); + nfscl_recalldeleg(clp, nmp, dp, fvp, cred, p, 0, NULL); NFSFREECRED(cred); triedrecall = 1; NFSLOCKCLSTATE(); From owner-dev-commits-src-all@freebsd.org Sun May 9 04:54:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A759A62B28C; Sun, 9 May 2021 04:54:20 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdBg04PSvz4dHW; Sun, 9 May 2021 04:54:20 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8A02B3AE8; Sun, 9 May 2021 04:54:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1494sKtp015154; Sun, 9 May 2021 04:54:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1494sK1n015153; Sun, 9 May 2021 04:54:20 GMT (envelope-from git) Date: Sun, 9 May 2021 04:54:20 GMT Message-Id: <202105090454.1494sK1n015153@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 5927c1bb31a4 - main - getty: const'ify search pointer. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5927c1bb31a419a6a91ee7bba519f9288eeecc9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 04:54:20 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=5927c1bb31a419a6a91ee7bba519f9288eeecc9b commit 5927c1bb31a419a6a91ee7bba519f9288eeecc9b Author: Xin LI AuthorDate: 2021-05-09 04:52:41 +0000 Commit: Xin LI CommitDate: 2021-05-09 04:53:29 +0000 getty: const'ify search pointer. No functional change. MFC after: 2 weeks --- libexec/getty/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libexec/getty/main.c b/libexec/getty/main.c index 743a0508c561..e1420586679b 100644 --- a/libexec/getty/main.c +++ b/libexec/getty/main.c @@ -735,7 +735,8 @@ static void putf(const char *cp) { time_t t; - char *slash, db[100]; + char db[100]; + const char *slash; static struct utsname kerninfo; From owner-dev-commits-src-all@freebsd.org Sun May 9 04:54:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BB4262B22D; Sun, 9 May 2021 04:54:22 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdBg15z2mz4dBc; Sun, 9 May 2021 04:54:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AC79538F4; Sun, 9 May 2021 04:54:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1494sLDZ015175; Sun, 9 May 2021 04:54:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1494sLUl015174; Sun, 9 May 2021 04:54:21 GMT (envelope-from git) Date: Sun, 9 May 2021 04:54:21 GMT Message-Id: <202105090454.1494sLUl015174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: c7b8bc367f18 - main - getty: push assignment to inner block. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c7b8bc367f18210d233b0e2185b5ce0d55c9ccaa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 04:54:22 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=c7b8bc367f18210d233b0e2185b5ce0d55c9ccaa commit c7b8bc367f18210d233b0e2185b5ce0d55c9ccaa Author: Xin LI AuthorDate: 2021-05-09 04:53:58 +0000 Commit: Xin LI CommitDate: 2021-05-09 04:53:58 +0000 getty: push assignment to inner block. No functional change. MFC after: 2 weeks --- libexec/getty/subr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/getty/subr.c b/libexec/getty/subr.c index 9958d193aa60..b8f359355afc 100644 --- a/libexec/getty/subr.c +++ b/libexec/getty/subr.c @@ -564,8 +564,8 @@ makeenv(char *env[]) strlcat(termbuf, TT, sizeof(termbuf)); *ep++ = termbuf; } - if ((p = EV)) { - q = p; + if (EV) { + p = EV; while ((q = strchr(q, ','))) { *q++ = '\0'; *ep++ = p; From owner-dev-commits-src-all@freebsd.org Sun May 9 10:14:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B371B632E0C; Sun, 9 May 2021 10:14:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdKmC4k86z4rQn; Sun, 9 May 2021 10:14:19 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 94EEC7B5F; Sun, 9 May 2021 10:14:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149AEJx3037863; Sun, 9 May 2021 10:14:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149AEJCT037862; Sun, 9 May 2021 10:14:19 GMT (envelope-from git) Date: Sun, 9 May 2021 10:14:19 GMT Message-Id: <202105091014.149AEJCT037862@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Juraj Lutter Subject: git: c2c9ef3cedf6 - main - rpi_ft5406: Recognize raspberrypi, firmware-ts touchscreen MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: otis X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c2c9ef3cedf6d83bdf27308e9e022658cc9b2a08 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 10:14:19 -0000 The branch main has been updated by otis (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c2c9ef3cedf6d83bdf27308e9e022658cc9b2a08 commit c2c9ef3cedf6d83bdf27308e9e022658cc9b2a08 Author: Juraj Lutter AuthorDate: 2021-05-07 21:48:21 +0000 Commit: Juraj Lutter CommitDate: 2021-05-09 10:13:19 +0000 rpi_ft5406: Recognize raspberrypi,firmware-ts touchscreen - Recognize raspberrypi,firmware-ts touchscreen - Move the driver from ofwbus to simplebus Reviewed by: manu MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30169 --- sys/arm/broadcom/bcm2835/bcm2835_ft5406.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c b/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c index d9a01b4a929a..24396b1bd90b 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c @@ -270,7 +270,7 @@ static int ft5406ts_probe(device_t dev) { - if (!ofw_bus_is_compatible(dev, "rpi,rpi-ft5406")) + if (!ofw_bus_is_compatible(dev, "raspberrypi,firmware-ts")) return (ENXIO); device_set_desc(dev, "FT5406 touchscreen (VC memory interface)"); @@ -332,5 +332,5 @@ static driver_t ft5406ts_driver = { sizeof(struct ft5406ts_softc), }; -DRIVER_MODULE(ft5406ts, ofwbus, ft5406ts_driver, ft5406ts_devclass, 0, 0); +DRIVER_MODULE(ft5406ts, simplebus, ft5406ts_driver, ft5406ts_devclass, 0, 0); MODULE_DEPEND(ft5406ts, evdev, 1, 1, 1); From owner-dev-commits-src-all@freebsd.org Sun May 9 10:24:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 327B1632F3B; Sun, 9 May 2021 10:24:55 +0000 (UTC) (envelope-from rene@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (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 "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdL0R0twNz4rmy; Sun, 9 May 2021 10:24:55 +0000 (UTC) (envelope-from rene@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1620555895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h65VuM1BgIK/+MD1R+Z5HcUHVmD+RaS/oLDfION3t4c=; b=fPgoblBs85MR/0WqMEnYZdY/YOszeAPTlg/XI+BfJLunxi8z7fZGvu2/R7OlWXxc3rTW8V 0QM//loagCJxEeRT6SJTuoIsZ0nWTSAMbzmfBxZIVkwgjijBNiNvPTBc908jHeZSprFyx1 kKH1AaY7Jdzss9thU8RjRWQJD+jTBNG/riMlIZlq42dAlBGTaTeBFLk4SU2JF/RqjwDxYX cs+8n0OeORegIYhy++WqhVQVJDdPEujDjJOe0atf69VpsuqAJgdcbo/H0NNXdXm2duIG4p dP/5/cFEuMw8vza0dvSQ6dRaEzd1vPMB6/Q36vzwKGod192tZMyryG1VpW4ngA== Received: by freefall.freebsd.org (Postfix, from userid 1185) id F109BAD7A; Sun, 9 May 2021 10:24:54 +0000 (UTC) Date: Sun, 9 May 2021 10:24:54 +0000 From: Rene Ladan To: Alexey Dokuchaev Cc: Pedro Giffuni , Randall Stewart , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 5a4333a5378f - main - This takes Warners suggested approach to making it so that platforms that for whatever reason cannot include the RATELIMIT option can still work with rack. It adds two dummy functions that rack will call and find out that the highest hw supported b/w is 0 (which kinda makes sense and rack is already prepared to handle). Message-ID: References: <202105072134.147LYjPn018824@gitrepo.freebsd.org> <4b297976-4b06-33a8-b390-18c01561b463@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1620555895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h65VuM1BgIK/+MD1R+Z5HcUHVmD+RaS/oLDfION3t4c=; b=hexIy5WipFgKUPIHZBQD+YGF7vugeOZCLKGts/+7Q2Bv9IjlVypGi4mdNyw8PTOmgebDMB Yb5qqFlDFmeRAL3ua/pkWVpcKkq3T28qiYJqkksySyNcJG7iOCDihUxUuc+GveoChvkaZh fc3LAehTll4azDy9lMxuDd9w5qQ1uGUJmvqcL3wfCYfVv8sBAP1PSskwqrOeef3opEMmKl 7Tgurymxb+wSIKbp9T6Q6z7y0bvsJd60vpRX3d0YVuzOYdINZJ+Yh/ITLNtTiAzvFAm2Fr ghCza9n1sLRB4ZcsBtVZcKuklcjPoHrnzoP+R+k5jk6xq0Xu0FXzUXoZS1xyfw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1620555895; a=rsa-sha256; cv=none; b=bjhlv/6n1R2R4FYn0Map4lTiJ0I3pdOemZKMo6Rhb/Bgj5hYc88SWR7DdeykC+O//thT/6 5mB5m2LLKzkT7CZw7gQOztWXl3fGMc1A0D/aEIoe5VicYWx2qtpanhbZsnT08wYd5X8cQM Ge7kpQW1XWHm2ze5k5QF24Pvihtb3Nqt1kHAiVGqtKN0RRFt1jEZIXDBIwFOYdYaZHKJPu ToOHuZCW6ugLLIfUo0Zvl4S/ZoFKYJPllNw9xSKmVpeRx8oxmof8zqLszgj3qrySdN6PpX /BgPvirthHLb3a66p76anAolWAL5n7DqWfw8R5diAlPaNaJHo+3n0vJzdkIntA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 10:24:55 -0000 On Sat, May 08, 2021 at 07:05:16AM +0000, Alexey Dokuchaev wrote: > On Sat, May 08, 2021 at 12:22:24AM -0500, Pedro Giffuni wrote: > > ... > > +1 even in git this breaks the shortlog in ugly ways. > > Someone(tm) should probably file an issue at their upstream, as ignoring \n > and only stopping at \n\n for short log definitely looks like a bug to me. > No, because shortlog looks at the first paragraph, not the first sentence. René From owner-dev-commits-src-all@freebsd.org Sun May 9 10:30:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9457F633472; Sun, 9 May 2021 10:30:52 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (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 "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdL7J3qcyz4sFP; Sun, 9 May 2021 10:30:52 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1620556252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oPuF2n8S1bcl5ia8ifgU24PMQwdHpKvkHWvL7f486sA=; b=HRDaMCPO9tPDi4/NZzZWcQ5lZqYo9KjazdqsXXuDee3BI5aEbdzHqOzPHrGx8grsL5l91F kszHQS2iQug/OXzTXMnyOMuiJd0XOiuJt9TZ33fIPCQXlkPHdgbm4aeWp4v5E2bLiTbqFF RuYKodwhgpcatLsHQcv2ZTcmf8QQgomzYN7JtuTDpOMu5EDsY2NWn5+FpdyXJp5Wmxp+kn 7Ub/JVm1cKZzCAMHHhZpOgmAp9clHiqbu4j9Ar5zd8JsNnwlFeVtwxCQHBSwLjyIia7BKR nA9ZIpiMJCpc1QWwtxVpJhk5eTM/CRPeDfm51NrI+qAUR8uBJnj2se3H9gEJ2g== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 5DA26AF1C; Sun, 9 May 2021 10:30:52 +0000 (UTC) Date: Sun, 9 May 2021 10:30:52 +0000 From: Alexey Dokuchaev To: Rene Ladan Cc: Pedro Giffuni , Randall Stewart , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 5a4333a5378f - main - This takes Warners suggested approach to making it so that platforms that for whatever reason cannot include the RATELIMIT option can still work with rack. It adds two dummy functions that rack will call and find out that the highest hw supported b/w is 0 (which kinda makes sense and rack is already prepared to handle). Message-ID: References: <202105072134.147LYjPn018824@gitrepo.freebsd.org> <4b297976-4b06-33a8-b390-18c01561b463@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1620556252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oPuF2n8S1bcl5ia8ifgU24PMQwdHpKvkHWvL7f486sA=; b=Mo24tD4JkLygDLTo4VCQh7M7o8G928NVteO1/doVspbvt1JwwEDMNU4jy2EM5ht2oJztFc s/Fa87wYAbSSGtATjfklWFdFAeRarxuZe6zPneQJWNidhCJ2FYu05+PklERqt5Ls1ROtcc Amo5dbgzLBNrwZ9tEgILkFNY7tNE8b/BMGwRMqiIPV61ahC1PMRiKxwUMqGRId5Dpvy87z rCK49Ltfl3yIAQ9DFDW8Ewd1rZZtVXMIXy4fgBLg6ESVYhPSfV4LH0HqxRbL1dOU8/WXri jzm1jrA782exOjNHux7N3jBcAW82HzbvdDkolKyveKkbv0m5GHXz1Vpqmux7nw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1620556252; a=rsa-sha256; cv=none; b=iOWTogWP53OXOIWNY870xtpyiTrsPoAdX5OiAEaUbYzuFm8qmbsSp+E8FLoZ5fhb44pTCF qvTErN87HaG11Vy5ZjvkVtAwl7SzV6J27tdHNR6mloeB++FZcsO9CF6OEHxRm4FF4VgWJ+ Hio5OYP2Iwg9gRB+vIL/rI9AVgvMwW4+pGSQ+zuzwUJRfvSNPAW3/q47DEkzfD87bhkv5a j5BBOQtYJLwy4zQVhqUMXB9uXLrTtUNPZF8D+lK6VFJANjH5Cgkg7q0tixGAWypkjM4SOS 9j7KLJ+sQXsfymGk3NTT74jIgR0UOP/4p3xMFqC7ms7cLaZzM4hnQXfskVHjcA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 10:30:52 -0000 On Sun, May 09, 2021 at 10:24:54AM +0000, Rene Ladan wrote: > On Sat, May 08, 2021 at 07:05:16AM +0000, Alexey Dokuchaev wrote: > > On Sat, May 08, 2021 at 12:22:24AM -0500, Pedro Giffuni wrote: > > > ... > > > +1 even in git this breaks the shortlog in ugly ways. > > > > Someone(tm) should probably file an issue at their upstream, as ignoring \n > > and only stopping at \n\n for short log definitely looks like a bug to me. > > No, because shortlog looks at the first paragraph, not the first sentence. Which is a bug, as it conflicts with the meaning of the word "short" and just makes no sense. ./danfe From owner-dev-commits-src-all@freebsd.org Sun May 9 12:35:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E05963681A; Sun, 9 May 2021 12:35:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdNtt71xRz3F54; Sun, 9 May 2021 12:35:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E392011EF8; Sun, 9 May 2021 12:35:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149CZI2V022750; Sun, 9 May 2021 12:35:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149CZIKn022749; Sun, 9 May 2021 12:35:18 GMT (envelope-from git) Date: Sun, 9 May 2021 12:35:18 GMT Message-Id: <202105091235.149CZIKn022749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 80b22e631506 - stable/13 - sbin/ipfw: Fix null pointer deference when printing counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 80b22e631506a3d6d783fa42424502d32d1f417f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 12:35:19 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=80b22e631506a3d6d783fa42424502d32d1f417f commit 80b22e631506a3d6d783fa42424502d32d1f417f Author: Lutz Donnerhacke AuthorDate: 2021-04-30 14:12:47 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-09 12:33:28 +0000 sbin/ipfw: Fix null pointer deference when printing counters ipfw -[tT] prints statistics of the last access. If the rule was never used, the counter might be not exist. This happens unconditionally on inserting a new rule. Avoid printing statistics in this case. PR: 255491 Reported by: Haisheng Zhouz Reviewed by: ae Differential Revision: https://reviews.freebsd.org/D30046 (cherry picked from commit bf7cc0f9cb6603a6bdd6131c8d1939724ce6e62d) --- sbin/ipfw/ipfw2.c | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 19f7f331091d..c17fbbca7dfa 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -2174,32 +2174,35 @@ show_static_rule(struct cmdline_opts *co, struct format_opts *fo, } bprintf(bp, "%05u ", rule->rulenum); - /* Print counters if enabled */ - if (fo->pcwidth > 0 || fo->bcwidth > 0) { - pr_u64(bp, &cntr->pcnt, fo->pcwidth); - pr_u64(bp, &cntr->bcnt, fo->bcwidth); - } - - /* Print timestamp */ - if (co->do_time == TIMESTAMP_NUMERIC) - bprintf(bp, "%10u ", cntr->timestamp); - else if (co->do_time == TIMESTAMP_STRING) { - char timestr[30]; - time_t t = (time_t)0; - - if (twidth == 0) { - strcpy(timestr, ctime(&t)); - *strchr(timestr, '\n') = '\0'; - twidth = strlen(timestr); + /* only if counters are available */ + if (cntr != NULL) { + /* Print counters if enabled */ + if (fo->pcwidth > 0 || fo->bcwidth > 0) { + pr_u64(bp, &cntr->pcnt, fo->pcwidth); + pr_u64(bp, &cntr->bcnt, fo->bcwidth); } - if (cntr->timestamp > 0) { - t = _long_to_time(cntr->timestamp); - strcpy(timestr, ctime(&t)); - *strchr(timestr, '\n') = '\0'; - bprintf(bp, "%s ", timestr); - } else { - bprintf(bp, "%*s ", twidth, ""); + /* Print timestamp */ + if (co->do_time == TIMESTAMP_NUMERIC) + bprintf(bp, "%10u ", cntr->timestamp); + else if (co->do_time == TIMESTAMP_STRING) { + char timestr[30]; + time_t t = (time_t)0; + + if (twidth == 0) { + strcpy(timestr, ctime(&t)); + *strchr(timestr, '\n') = '\0'; + twidth = strlen(timestr); + } + if (cntr->timestamp > 0) { + t = _long_to_time(cntr->timestamp); + + strcpy(timestr, ctime(&t)); + *strchr(timestr, '\n') = '\0'; + bprintf(bp, "%s ", timestr); + } else { + bprintf(bp, "%*s ", twidth, ""); + } } } From owner-dev-commits-src-all@freebsd.org Sun May 9 12:51:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52148636BC8; Sun, 9 May 2021 12:51:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdPF31wN1z3FYs; Sun, 9 May 2021 12:51:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 34FBF11DE8; Sun, 9 May 2021 12:51:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149Cp3UN045086; Sun, 9 May 2021 12:51:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149Cp3R3045085; Sun, 9 May 2021 12:51:03 GMT (envelope-from git) Date: Sun, 9 May 2021 12:51:03 GMT Message-Id: <202105091251.149Cp3R3045085@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: b1902474a7c5 - stable/12 - sbin/ipfw: Fix null pointer deference when printing counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b1902474a7c51e025d734e8233f0e850291b92e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 12:51:03 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=b1902474a7c51e025d734e8233f0e850291b92e7 commit b1902474a7c51e025d734e8233f0e850291b92e7 Author: Lutz Donnerhacke AuthorDate: 2021-05-09 12:48:47 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-09 12:48:47 +0000 sbin/ipfw: Fix null pointer deference when printing counters ipfw -[tT] prints statistics of the last access. If the rule was never used, the counter might be not exist. This happens unconditionally on inserting a new rule. Avoid printing statistics in this case. PR: 255491 Reported by: Haisheng Zhouz Reviewed by: ae Differential Revision: https://reviews.freebsd.org/D30046 (cherry picked from commit bf7cc0f9cb6603a6bdd6131c8d1939724ce6e62d) --- sbin/ipfw/ipfw2.c | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 30a4da92343f..efb29403b6c9 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -2174,32 +2174,35 @@ show_static_rule(struct cmdline_opts *co, struct format_opts *fo, } bprintf(bp, "%05u ", rule->rulenum); - /* Print counters if enabled */ - if (fo->pcwidth > 0 || fo->bcwidth > 0) { - pr_u64(bp, &cntr->pcnt, fo->pcwidth); - pr_u64(bp, &cntr->bcnt, fo->bcwidth); - } - - /* Print timestamp */ - if (co->do_time == TIMESTAMP_NUMERIC) - bprintf(bp, "%10u ", cntr->timestamp); - else if (co->do_time == TIMESTAMP_STRING) { - char timestr[30]; - time_t t = (time_t)0; - - if (twidth == 0) { - strcpy(timestr, ctime(&t)); - *strchr(timestr, '\n') = '\0'; - twidth = strlen(timestr); + /* only if counters are available */ + if (cntr != NULL) { + /* Print counters if enabled */ + if (fo->pcwidth > 0 || fo->bcwidth > 0) { + pr_u64(bp, &cntr->pcnt, fo->pcwidth); + pr_u64(bp, &cntr->bcnt, fo->bcwidth); } - if (cntr->timestamp > 0) { - t = _long_to_time(cntr->timestamp); - strcpy(timestr, ctime(&t)); - *strchr(timestr, '\n') = '\0'; - bprintf(bp, "%s ", timestr); - } else { - bprintf(bp, "%*s", twidth + 1, " "); + /* Print timestamp */ + if (co->do_time == TIMESTAMP_NUMERIC) + bprintf(bp, "%10u ", cntr->timestamp); + else if (co->do_time == TIMESTAMP_STRING) { + char timestr[30]; + time_t t = (time_t)0; + + if (twidth == 0) { + strcpy(timestr, ctime(&t)); + *strchr(timestr, '\n') = '\0'; + twidth = strlen(timestr); + } + if (cntr->timestamp > 0) { + t = _long_to_time(cntr->timestamp); + + strcpy(timestr, ctime(&t)); + *strchr(timestr, '\n') = '\0'; + bprintf(bp, "%s ", timestr); + } else { + bprintf(bp, "%*s", twidth + 1, " "); + } } } From owner-dev-commits-src-all@freebsd.org Sun May 9 12:58:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9B0D637084; Sun, 9 May 2021 12:58:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdPPs4PvHz3FVq; Sun, 9 May 2021 12:58:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7B58B12063; Sun, 9 May 2021 12:58:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149CwfJH048937; Sun, 9 May 2021 12:58:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149CwfB2048936; Sun, 9 May 2021 12:58:41 GMT (envelope-from git) Date: Sun, 9 May 2021 12:58:41 GMT Message-Id: <202105091258.149CwfB2048936@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 552885bde600 - stable/11 - ^sbin/ipfw: Fix null pointer deference when printing counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 552885bde60021ed6f1db46a95f9fb2557cbe1b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 12:58:41 -0000 The branch stable/11 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=552885bde60021ed6f1db46a95f9fb2557cbe1b6 commit 552885bde60021ed6f1db46a95f9fb2557cbe1b6 Author: Lutz Donnerhacke AuthorDate: 2021-05-09 12:56:40 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-09 12:56:40 +0000 ^sbin/ipfw: Fix null pointer deference when printing counters ipfw -[tT] prints statistics of the last access. If the rule was never used, the counter might be not exist. This happens unconditionally on inserting a new rule. Avoid printing statistics in this case. PR: 255491 Reported by: Haisheng Zhouz Reviewed by: ae Differential Revision: https://reviews.freebsd.org/D30046 (cherry picked from commit bf7cc0f9cb6603a6bdd6131c8d1939724ce6e62d) --- sbin/ipfw/ipfw2.c | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 700b64f9c2bb..f451f8bedcaf 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -2157,32 +2157,35 @@ show_static_rule(struct cmdline_opts *co, struct format_opts *fo, } bprintf(bp, "%05u ", rule->rulenum); - /* Print counters if enabled */ - if (fo->pcwidth > 0 || fo->bcwidth > 0) { - pr_u64(bp, &cntr->pcnt, fo->pcwidth); - pr_u64(bp, &cntr->bcnt, fo->bcwidth); - } - - /* Print timestamp */ - if (co->do_time == TIMESTAMP_NUMERIC) - bprintf(bp, "%10u ", cntr->timestamp); - else if (co->do_time == TIMESTAMP_STRING) { - char timestr[30]; - time_t t = (time_t)0; - - if (twidth == 0) { - strcpy(timestr, ctime(&t)); - *strchr(timestr, '\n') = '\0'; - twidth = strlen(timestr); + /* only if counters are available */ + if (cntr != NULL) { + /* Print counters if enabled */ + if (fo->pcwidth > 0 || fo->bcwidth > 0) { + pr_u64(bp, &cntr->pcnt, fo->pcwidth); + pr_u64(bp, &cntr->bcnt, fo->bcwidth); } - if (cntr->timestamp > 0) { - t = _long_to_time(cntr->timestamp); - strcpy(timestr, ctime(&t)); - *strchr(timestr, '\n') = '\0'; - bprintf(bp, "%s ", timestr); - } else { - bprintf(bp, "%*s", twidth, " "); + /* Print timestamp */ + if (co->do_time == TIMESTAMP_NUMERIC) + bprintf(bp, "%10u ", cntr->timestamp); + else if (co->do_time == TIMESTAMP_STRING) { + char timestr[30]; + time_t t = (time_t)0; + + if (twidth == 0) { + strcpy(timestr, ctime(&t)); + *strchr(timestr, '\n') = '\0'; + twidth = strlen(timestr); + } + if (cntr->timestamp > 0) { + t = _long_to_time(cntr->timestamp); + + strcpy(timestr, ctime(&t)); + *strchr(timestr, '\n') = '\0'; + bprintf(bp, "%s ", timestr); + } else { + bprintf(bp, "%*s", twidth, " "); + } } } From owner-dev-commits-src-all@freebsd.org Sun May 9 13:22:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A252263745A; Sun, 9 May 2021 13:22:13 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdPx14GYQz3GdM; Sun, 9 May 2021 13:22:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8518C12839; Sun, 9 May 2021 13:22:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149DMDfF088526; Sun, 9 May 2021 13:22:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149DMDxO088525; Sun, 9 May 2021 13:22:13 GMT (envelope-from git) Date: Sun, 9 May 2021 13:22:13 GMT Message-Id: <202105091322.149DMDxO088525@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 0d8ba15a0e9d - stable/11 - netgraph/ng_base: Allow larger BINARY2ASCII conversions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 0d8ba15a0e9dbb5928d0fd89011417b707f7a366 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 13:22:13 -0000 The branch stable/11 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=0d8ba15a0e9dbb5928d0fd89011417b707f7a366 commit 0d8ba15a0e9dbb5928d0fd89011417b707f7a366 Author: Lutz Donnerhacke AuthorDate: 2021-02-07 21:07:34 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-09 13:20:48 +0000 netgraph/ng_base: Allow larger BINARY2ASCII conversions Allocate the necessary memory for the conversion dynamically starting with a value which is sufficient for almost all normal cases. PR: 187835 Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D23840 (cherry picked from commit 45d75e3ac3fb5bf8230ca28dc09b48c6e5ed7a4f) --- sys/netgraph/ng_base.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 15a78119eccb..065a539a7eec 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -2771,7 +2771,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) case NGM_BINARY2ASCII: { - int bufSize = 20 * 1024; /* XXX hard coded constant */ + int bufSize = 1024; const struct ng_parse_type *argstype; const struct ng_cmdlist *c; struct ng_mesg *binary, *ascii; @@ -2785,7 +2785,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) error = EINVAL; break; } - +retry_b2a: /* Get a response message with lots of room */ NG_MKRESPONSE(resp, msg, sizeof(*ascii) + bufSize, M_NOWAIT); if (resp == NULL) { @@ -2827,9 +2827,13 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) if (argstype == NULL) { *ascii->data = '\0'; } else { - if ((error = ng_unparse(argstype, - (u_char *)binary->data, - ascii->data, bufSize)) != 0) { + error = ng_unparse(argstype, (u_char *)binary->data, + ascii->data, bufSize); + if (error == ERANGE) { + NG_FREE_MSG(resp); + bufSize *= 2; + goto retry_b2a; + } else if (error) { NG_FREE_MSG(resp); break; } From owner-dev-commits-src-all@freebsd.org Sun May 9 13:23:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CF89637860; Sun, 9 May 2021 13:23:54 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdPyy2Bq8z3H3L; Sun, 9 May 2021 13:23:54 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3E6F7127E9; Sun, 9 May 2021 13:23:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149DNsN2088747; Sun, 9 May 2021 13:23:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149DNsGJ088746; Sun, 9 May 2021 13:23:54 GMT (envelope-from git) Date: Sun, 9 May 2021 13:23:54 GMT Message-Id: <202105091323.149DNsGJ088746@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: e1caa707fee0 - stable/12 - netgraph/ng_base: Allow larger BINARY2ASCII conversions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e1caa707fee06d00a0e6ba0445d734e748721d77 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 13:23:54 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=e1caa707fee06d00a0e6ba0445d734e748721d77 commit e1caa707fee06d00a0e6ba0445d734e748721d77 Author: Lutz Donnerhacke AuthorDate: 2021-02-07 21:07:34 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-09 13:23:19 +0000 netgraph/ng_base: Allow larger BINARY2ASCII conversions Allocate the necessary memory for the conversion dynamically starting with a value which is sufficient for almost all normal cases. PR: 187835 Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D23840 (cherry picked from commit 45d75e3ac3fb5bf8230ca28dc09b48c6e5ed7a4f) --- sys/netgraph/ng_base.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 271397f669be..4c6a2f606119 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -2771,7 +2771,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) case NGM_BINARY2ASCII: { - int bufSize = 20 * 1024; /* XXX hard coded constant */ + int bufSize = 1024; const struct ng_parse_type *argstype; const struct ng_cmdlist *c; struct ng_mesg *binary, *ascii; @@ -2785,7 +2785,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) error = EINVAL; break; } - +retry_b2a: /* Get a response message with lots of room */ NG_MKRESPONSE(resp, msg, sizeof(*ascii) + bufSize, M_NOWAIT); if (resp == NULL) { @@ -2827,9 +2827,13 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) if (argstype == NULL) { *ascii->data = '\0'; } else { - if ((error = ng_unparse(argstype, - (u_char *)binary->data, - ascii->data, bufSize)) != 0) { + error = ng_unparse(argstype, (u_char *)binary->data, + ascii->data, bufSize); + if (error == ERANGE) { + NG_FREE_MSG(resp); + bufSize *= 2; + goto retry_b2a; + } else if (error) { NG_FREE_MSG(resp); break; } From owner-dev-commits-src-all@freebsd.org Sun May 9 13:25:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B88FC637C1D; Sun, 9 May 2021 13:25:35 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdQ0v4vJjz3H46; Sun, 9 May 2021 13:25:35 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9A81412986; Sun, 9 May 2021 13:25:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149DPZYu088980; Sun, 9 May 2021 13:25:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149DPZ09088979; Sun, 9 May 2021 13:25:35 GMT (envelope-from git) Date: Sun, 9 May 2021 13:25:35 GMT Message-Id: <202105091325.149DPZ09088979@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 2b3074de3353 - stable/13 - netgraph/ng_base: Allow larger BINARY2ASCII conversions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2b3074de33533f2703707c9b1c5e50a98621fdd1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 13:25:35 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=2b3074de33533f2703707c9b1c5e50a98621fdd1 commit 2b3074de33533f2703707c9b1c5e50a98621fdd1 Author: Lutz Donnerhacke AuthorDate: 2021-02-07 21:07:34 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-09 13:25:05 +0000 netgraph/ng_base: Allow larger BINARY2ASCII conversions Allocate the necessary memory for the conversion dynamically starting with a value which is sufficient for almost all normal cases. PR: 187835 Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D23840 (cherry picked from commit 45d75e3ac3fb5bf8230ca28dc09b48c6e5ed7a4f) --- sys/netgraph/ng_base.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 6ab39421b255..63bc251f52f9 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -2771,7 +2771,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) case NGM_BINARY2ASCII: { - int bufSize = 20 * 1024; /* XXX hard coded constant */ + int bufSize = 1024; const struct ng_parse_type *argstype; const struct ng_cmdlist *c; struct ng_mesg *binary, *ascii; @@ -2785,7 +2785,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) error = EINVAL; break; } - +retry_b2a: /* Get a response message with lots of room */ NG_MKRESPONSE(resp, msg, sizeof(*ascii) + bufSize, M_NOWAIT); if (resp == NULL) { @@ -2827,9 +2827,13 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) if (argstype == NULL) { *ascii->data = '\0'; } else { - if ((error = ng_unparse(argstype, - (u_char *)binary->data, - ascii->data, bufSize)) != 0) { + error = ng_unparse(argstype, (u_char *)binary->data, + ascii->data, bufSize); + if (error == ERANGE) { + NG_FREE_MSG(resp); + bufSize *= 2; + goto retry_b2a; + } else if (error) { NG_FREE_MSG(resp); break; } From owner-dev-commits-src-all@freebsd.org Sun May 9 13:43:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3927A638712; Sun, 9 May 2021 13:43:18 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdQPL18lHz3J6l; Sun, 9 May 2021 13:43:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1A98C12BD1; Sun, 9 May 2021 13:43:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149DhIVB014801; Sun, 9 May 2021 13:43:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149DhHGq014800; Sun, 9 May 2021 13:43:17 GMT (envelope-from git) Date: Sun, 9 May 2021 13:43:17 GMT Message-Id: <202105091343.149DhHGq014800@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 16ed32cc4b02 - stable/12 - netgraph/ng_source: If queue is full, don't enqueue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 16ed32cc4b021e0a80635efe7cb617c9a538cff1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 13:43:18 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=16ed32cc4b021e0a80635efe7cb617c9a538cff1 commit 16ed32cc4b021e0a80635efe7cb617c9a538cff1 Author: Lutz Donnerhacke AuthorDate: 2021-01-23 17:54:47 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-09 13:42:39 +0000 netgraph/ng_source: If queue is full, don't enqueue Submitted by: nc Reviewed by: donner, kp Differential Revision: https://reviews.freebsd.org/D23477 (cherry picked from commit d7dd28bb09fa51b9958a5dc288d2aeef56a67491) --- sys/netgraph/ng_source.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/ng_source.c b/sys/netgraph/ng_source.c index 401548da65d0..4bde62e5898a 100644 --- a/sys/netgraph/ng_source.c +++ b/sys/netgraph/ng_source.c @@ -284,7 +284,7 @@ ng_source_constructor(node_p node) NG_NODE_SET_PRIVATE(node, sc); sc->node = node; - sc->snd_queue.ifq_maxlen = 2048; /* XXX not checked */ + sc->snd_queue.ifq_maxlen = 2048; ng_callout_init(&sc->intr_ch); return (0); @@ -567,8 +567,11 @@ ng_source_rcvdata(hook_p hook, item_p item) } KASSERT(hook == sc->input, ("%s: no hook!", __func__)); - /* Enqueue packet. */ - /* XXX should we check IF_QFULL() ? */ + /* Enqueue packet if the queue isn't full. */ + if (_IF_QFULL(&sc->snd_queue)) { + NG_FREE_M(m); + return (ENOBUFS); + } _IF_ENQUEUE(&sc->snd_queue, m); sc->queueOctets += m->m_pkthdr.len; sc->last_packet = m; From owner-dev-commits-src-all@freebsd.org Sun May 9 13:43:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65E0C6386AE; Sun, 9 May 2021 13:43:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdQPM2LqBz3J37; Sun, 9 May 2021 13:43:19 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3785612D6E; Sun, 9 May 2021 13:43:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149DhJES014831; Sun, 9 May 2021 13:43:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149DhJ3s014830; Sun, 9 May 2021 13:43:19 GMT (envelope-from git) Date: Sun, 9 May 2021 13:43:19 GMT Message-Id: <202105091343.149DhJ3s014830@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 44483189cb49 - stable/12 - netgraph/ng_source: Switch queuing framework MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 44483189cb499029bee5f5560f0bf654e0c14ad7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 13:43:19 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=44483189cb499029bee5f5560f0bf654e0c14ad7 commit 44483189cb499029bee5f5560f0bf654e0c14ad7 Author: Lutz Donnerhacke AuthorDate: 2021-01-29 11:03:17 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-09 13:42:49 +0000 netgraph/ng_source: Switch queuing framework Change the queuing framework from ifq to mbufq. Reported by: glebius Reviewed by: glebius, kp Differential Revision: https://reviews.freebsd.org/D28407 (cherry picked from commit ebc61c86b5567f2e5a3c5f452e86879b558b376b) --- sys/netgraph/ng_source.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/sys/netgraph/ng_source.c b/sys/netgraph/ng_source.c index 4bde62e5898a..0eee9ceb25c5 100644 --- a/sys/netgraph/ng_source.c +++ b/sys/netgraph/ng_source.c @@ -85,7 +85,7 @@ struct privdata { hook_p input; hook_p output; struct ng_source_stats stats; - struct ifqueue snd_queue; /* packets to send */ + struct mbufq snd_queue; /* packets to send */ struct mbuf *last_packet; /* last pkt in queue */ struct ifnet *output_ifp; struct callout intr_ch; @@ -284,7 +284,7 @@ ng_source_constructor(node_p node) NG_NODE_SET_PRIVATE(node, sc); sc->node = node; - sc->snd_queue.ifq_maxlen = 2048; + mbufq_init(&sc->snd_queue, 2048); ng_callout_init(&sc->intr_ch); return (0); @@ -374,7 +374,7 @@ ng_source_rcvmsg(node_p node, item_p item, hook_p lasthook) goto done; } sc->stats.queueOctets = sc->queueOctets; - sc->stats.queueFrames = sc->snd_queue.ifq_len; + sc->stats.queueFrames = mbufq_len(&sc->snd_queue); if ((sc->node->nd_flags & NG_SOURCE_ACTIVE) && !timevalisset(&sc->stats.endTime)) { getmicrotime(&sc->stats.elapsedTime); @@ -568,11 +568,11 @@ ng_source_rcvdata(hook_p hook, item_p item) KASSERT(hook == sc->input, ("%s: no hook!", __func__)); /* Enqueue packet if the queue isn't full. */ - if (_IF_QFULL(&sc->snd_queue)) { + error = mbufq_enqueue(&sc->snd_queue, m); + if (error) { NG_FREE_M(m); - return (ENOBUFS); + return (error); } - _IF_ENQUEUE(&sc->snd_queue, m); sc->queueOctets += m->m_pkthdr.len; sc->last_packet = m; @@ -671,7 +671,7 @@ ng_source_clr_data (sc_p sc) struct mbuf *m; for (;;) { - _IF_DEQUEUE(&sc->snd_queue, m); + m = mbufq_dequeue(&sc->snd_queue); if (m == NULL) break; NG_FREE_M(m); @@ -744,7 +744,7 @@ ng_source_intr(node_p node, hook_p hook, void *arg1, int arg2) ifq = (struct ifqueue *)&sc->output_ifp->if_snd; packets = ifq->ifq_maxlen - ifq->ifq_len; } else - packets = sc->snd_queue.ifq_len; + packets = mbufq_len(&sc->snd_queue); if (sc->stats.maxPps != 0) { struct timeval now, elapsed; @@ -788,7 +788,7 @@ ng_source_send(sc_p sc, int tosend, int *sent_p) /* Go through the queue sending packets one by one. */ for (sent = 0; error == 0 && sent < tosend; ++sent) { - _IF_DEQUEUE(&sc->snd_queue, m); + m = mbufq_dequeue(&sc->snd_queue); if (m == NULL) break; @@ -796,14 +796,20 @@ ng_source_send(sc_p sc, int tosend, int *sent_p) error = ng_source_dup_mod(sc, m, &m2); if (error) { if (error == ENOBUFS) - _IF_PREPEND(&sc->snd_queue, m); + mbufq_prepend(&sc->snd_queue, m); else - _IF_ENQUEUE(&sc->snd_queue, m); + (void)mbufq_enqueue(&sc->snd_queue, m); break; } - /* Re-enqueue the original packet for us. */ - _IF_ENQUEUE(&sc->snd_queue, m); + /* + * Re-enqueue the original packet for us. The queue + * has a free slot, because we dequeued the packet + * above and this callout function runs under WRITER + * lock. + */ + error = mbufq_enqueue(&sc->snd_queue, m); + KASSERT(error == 0, ("%s: re-enqueue packet failed", __func__)); sc->stats.outFrames++; sc->stats.outOctets += m2->m_pkthdr.len; From owner-dev-commits-src-all@freebsd.org Sun May 9 13:46:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E17A5638822; Sun, 9 May 2021 13:46:14 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdQSk635Rz3JB6; Sun, 9 May 2021 13:46:14 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C1A1112CB1; Sun, 9 May 2021 13:46:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149DkEaA015310; Sun, 9 May 2021 13:46:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149DkE6l015309; Sun, 9 May 2021 13:46:14 GMT (envelope-from git) Date: Sun, 9 May 2021 13:46:14 GMT Message-Id: <202105091346.149DkE6l015309@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 3da0d11afe08 - stable/11 - netgraph/ng_source: If queue is full, don't enqueue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 3da0d11afe0807ccbbb9f447e6c814dce654d71d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 13:46:14 -0000 The branch stable/11 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=3da0d11afe0807ccbbb9f447e6c814dce654d71d commit 3da0d11afe0807ccbbb9f447e6c814dce654d71d Author: Lutz Donnerhacke AuthorDate: 2021-01-23 17:54:47 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-09 13:45:07 +0000 netgraph/ng_source: If queue is full, don't enqueue Submitted by: nc Reviewed by: donner, kp Differential Revision: https://reviews.freebsd.org/D23477 (cherry picked from commit d7dd28bb09fa51b9958a5dc288d2aeef56a67491) --- sys/netgraph/ng_source.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/ng_source.c b/sys/netgraph/ng_source.c index da8f42381ac3..8d1d05b5673f 100644 --- a/sys/netgraph/ng_source.c +++ b/sys/netgraph/ng_source.c @@ -284,7 +284,7 @@ ng_source_constructor(node_p node) NG_NODE_SET_PRIVATE(node, sc); sc->node = node; - sc->snd_queue.ifq_maxlen = 2048; /* XXX not checked */ + sc->snd_queue.ifq_maxlen = 2048; ng_callout_init(&sc->intr_ch); return (0); @@ -567,8 +567,11 @@ ng_source_rcvdata(hook_p hook, item_p item) } KASSERT(hook == sc->input, ("%s: no hook!", __func__)); - /* Enqueue packet. */ - /* XXX should we check IF_QFULL() ? */ + /* Enqueue packet if the queue isn't full. */ + if (_IF_QFULL(&sc->snd_queue)) { + NG_FREE_M(m); + return (ENOBUFS); + } _IF_ENQUEUE(&sc->snd_queue, m); sc->queueOctets += m->m_pkthdr.len; sc->last_packet = m; From owner-dev-commits-src-all@freebsd.org Sun May 9 13:46:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CE666386D6; Sun, 9 May 2021 13:46:16 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdQSm0jfNz3Hvw; Sun, 9 May 2021 13:46:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 06AC112BD2; Sun, 9 May 2021 13:46:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149DkFIs015331; Sun, 9 May 2021 13:46:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149DkFmI015330; Sun, 9 May 2021 13:46:15 GMT (envelope-from git) Date: Sun, 9 May 2021 13:46:15 GMT Message-Id: <202105091346.149DkFmI015330@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: bfb3c2b8b991 - stable/11 - netgraph/ng_source: Switch queuing framework MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: bfb3c2b8b991eda618f22efbff2f046d572c2d3e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 13:46:16 -0000 The branch stable/11 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=bfb3c2b8b991eda618f22efbff2f046d572c2d3e commit bfb3c2b8b991eda618f22efbff2f046d572c2d3e Author: Lutz Donnerhacke AuthorDate: 2021-01-29 11:03:17 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-09 13:45:28 +0000 netgraph/ng_source: Switch queuing framework Change the queuing framework from ifq to mbufq. Reported by: glebius Reviewed by: glebius, kp Differential Revision: https://reviews.freebsd.org/D28407 (cherry picked from commit ebc61c86b5567f2e5a3c5f452e86879b558b376b) --- sys/netgraph/ng_source.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/sys/netgraph/ng_source.c b/sys/netgraph/ng_source.c index 8d1d05b5673f..b7415f8e4bb8 100644 --- a/sys/netgraph/ng_source.c +++ b/sys/netgraph/ng_source.c @@ -85,7 +85,7 @@ struct privdata { hook_p input; hook_p output; struct ng_source_stats stats; - struct ifqueue snd_queue; /* packets to send */ + struct mbufq snd_queue; /* packets to send */ struct mbuf *last_packet; /* last pkt in queue */ struct ifnet *output_ifp; struct callout intr_ch; @@ -284,7 +284,7 @@ ng_source_constructor(node_p node) NG_NODE_SET_PRIVATE(node, sc); sc->node = node; - sc->snd_queue.ifq_maxlen = 2048; + mbufq_init(&sc->snd_queue, 2048); ng_callout_init(&sc->intr_ch); return (0); @@ -374,7 +374,7 @@ ng_source_rcvmsg(node_p node, item_p item, hook_p lasthook) goto done; } sc->stats.queueOctets = sc->queueOctets; - sc->stats.queueFrames = sc->snd_queue.ifq_len; + sc->stats.queueFrames = mbufq_len(&sc->snd_queue); if ((sc->node->nd_flags & NG_SOURCE_ACTIVE) && !timevalisset(&sc->stats.endTime)) { getmicrotime(&sc->stats.elapsedTime); @@ -568,11 +568,11 @@ ng_source_rcvdata(hook_p hook, item_p item) KASSERT(hook == sc->input, ("%s: no hook!", __func__)); /* Enqueue packet if the queue isn't full. */ - if (_IF_QFULL(&sc->snd_queue)) { + error = mbufq_enqueue(&sc->snd_queue, m); + if (error) { NG_FREE_M(m); - return (ENOBUFS); + return (error); } - _IF_ENQUEUE(&sc->snd_queue, m); sc->queueOctets += m->m_pkthdr.len; sc->last_packet = m; @@ -671,7 +671,7 @@ ng_source_clr_data (sc_p sc) struct mbuf *m; for (;;) { - _IF_DEQUEUE(&sc->snd_queue, m); + m = mbufq_dequeue(&sc->snd_queue); if (m == NULL) break; NG_FREE_M(m); @@ -744,7 +744,7 @@ ng_source_intr(node_p node, hook_p hook, void *arg1, int arg2) ifq = (struct ifqueue *)&sc->output_ifp->if_snd; packets = ifq->ifq_maxlen - ifq->ifq_len; } else - packets = sc->snd_queue.ifq_len; + packets = mbufq_len(&sc->snd_queue); if (sc->stats.maxPps != 0) { struct timeval now, elapsed; @@ -788,7 +788,7 @@ ng_source_send(sc_p sc, int tosend, int *sent_p) /* Go through the queue sending packets one by one. */ for (sent = 0; error == 0 && sent < tosend; ++sent) { - _IF_DEQUEUE(&sc->snd_queue, m); + m = mbufq_dequeue(&sc->snd_queue); if (m == NULL) break; @@ -796,14 +796,20 @@ ng_source_send(sc_p sc, int tosend, int *sent_p) error = ng_source_dup_mod(sc, m, &m2); if (error) { if (error == ENOBUFS) - _IF_PREPEND(&sc->snd_queue, m); + mbufq_prepend(&sc->snd_queue, m); else - _IF_ENQUEUE(&sc->snd_queue, m); + (void)mbufq_enqueue(&sc->snd_queue, m); break; } - /* Re-enqueue the original packet for us. */ - _IF_ENQUEUE(&sc->snd_queue, m); + /* + * Re-enqueue the original packet for us. The queue + * has a free slot, because we dequeued the packet + * above and this callout function runs under WRITER + * lock. + */ + error = mbufq_enqueue(&sc->snd_queue, m); + KASSERT(error == 0, ("%s: re-enqueue packet failed", __func__)); sc->stats.outFrames++; sc->stats.outOctets += m2->m_pkthdr.len; From owner-dev-commits-src-all@freebsd.org Sun May 9 15:34:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D2B6863ACDE; Sun, 9 May 2021 15:34:25 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdSsY5bkVz3NFH; Sun, 9 May 2021 15:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B31A2143BD; Sun, 9 May 2021 15:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149FYPGs061364; Sun, 9 May 2021 15:34:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149FYPHb061363; Sun, 9 May 2021 15:34:25 GMT (envelope-from git) Date: Sun, 9 May 2021 15:34:25 GMT Message-Id: <202105091534.149FYPHb061363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 416051f5818e - main - full(4): Use correct section name for AUTHORS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 416051f5818e3270e019ef8978e2f1168f2628fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 15:34:25 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=416051f5818e3270e019ef8978e2f1168f2628fc commit 416051f5818e3270e019ef8978e2f1168f2628fc Author: Gordon Bergling AuthorDate: 2021-05-09 15:31:52 +0000 Commit: Gordon Bergling CommitDate: 2021-05-09 15:31:52 +0000 full(4): Use correct section name for AUTHORS PR: 255715 Reported by: Christos Margiolis MFC after: 3 days --- share/man/man4/full.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man4/full.4 b/share/man/man4/full.4 index 5265e2ab2612..6f1b3606258d 100644 --- a/share/man/man4/full.4 +++ b/share/man/man4/full.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 29, 2014 +.Dd May 9, 2021 .Dt FULL 4 .Os .Sh NAME @@ -42,6 +42,6 @@ However, it will always be full when writing to it. .Sh SEE ALSO .Xr null 4 , .Xr zero 4 -.Sh Author +.Sh AUTHORS This device and man page was written by .An Eitan Adler Aq Mt eadler@FreeBSD.org . From owner-dev-commits-src-all@freebsd.org Sun May 9 16:06:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E65763BB54; Sun, 9 May 2021 16:06:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdTZM2flbz3Pxc; Sun, 9 May 2021 16:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4E719147C1; Sun, 9 May 2021 16:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149G6JqW002332; Sun, 9 May 2021 16:06:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149G6Jdh002331; Sun, 9 May 2021 16:06:19 GMT (envelope-from git) Date: Sun, 9 May 2021 16:06:19 GMT Message-Id: <202105091606.149G6Jdh002331@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 8725f0b9dbd2 - main - Revert "getty: push assignment to inner block." MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8725f0b9dbd296ca93f0f19c51940a46a98dcb2d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 16:06:19 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=8725f0b9dbd296ca93f0f19c51940a46a98dcb2d commit 8725f0b9dbd296ca93f0f19c51940a46a98dcb2d Author: Xin LI AuthorDate: 2021-05-09 16:05:52 +0000 Commit: Xin LI CommitDate: 2021-05-09 16:05:52 +0000 Revert "getty: push assignment to inner block." This reverts commit c7b8bc367f18210d233b0e2185b5ce0d55c9ccaa. Pointed out by: trasz --- libexec/getty/subr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/getty/subr.c b/libexec/getty/subr.c index b8f359355afc..9958d193aa60 100644 --- a/libexec/getty/subr.c +++ b/libexec/getty/subr.c @@ -564,8 +564,8 @@ makeenv(char *env[]) strlcat(termbuf, TT, sizeof(termbuf)); *ep++ = termbuf; } - if (EV) { - p = EV; + if ((p = EV)) { + q = p; while ((q = strchr(q, ','))) { *q++ = '\0'; *ep++ = p;