svn commit: r362530 - head/sys/dev/ena

2020-06-22 Thread Andriy Gapon
Author: avg
Date: Tue Jun 23 04:58:36 2020
New Revision: 362530
URL: https://svnweb.freebsd.org/changeset/base/362530

Log:
  teach ena driver about RSS kernel option
  
  Networking is broken if the driver configures its (virtual) hardware to
  use a hash algorithm (or a key) different from the one that the network
  stack (software RSS) uses.  This can be seen with connections initiated
  from the host.  The PCB will be placed into the hash table based on the
  hash value calculated by the software.  The hardware-calculated hash
  value in reponse packets will be different, so the PCB won't be found.
  
  Tested with a kernel compiled with 'options RSS' on an instance with ena
  driver.
  
  Reviewed by:  mw, adrian
  MFC after:2 weeks
  Sponsored by: Panzura
  Differential Revision: https://reviews.freebsd.org/D24733

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena_datapath.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Tue Jun 23 03:32:58 2020(r362529)
+++ head/sys/dev/ena/ena.c  Tue Jun 23 04:58:36 2020(r362530)
@@ -30,6 +30,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_rss.h"
+
 #include 
 #include 
 #include 
@@ -61,6 +63,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef RSS
+#include 
+#endif
 
 #include 
 #include 
@@ -2700,6 +2705,16 @@ ena_rss_init_default(struct ena_adapter *adapter)
}
}
 
+#ifdef RSS
+   uint8_t rss_algo = rss_gethashalgo();
+   if (rss_algo == RSS_HASH_TOEPLITZ) {
+   uint8_t hash_key[RSS_KEYSIZE];
+
+   rss_getkey(hash_key);
+   rc = ena_com_fill_hash_function(ena_dev, ENA_ADMIN_TOEPLITZ,
+   hash_key, RSS_KEYSIZE, 0x);
+   } else
+#endif
rc = ena_com_fill_hash_function(ena_dev, ENA_ADMIN_CRC32, NULL,
ENA_HASH_KEY_SIZE, 0x);
if (unlikely((rc != 0) && (rc != EOPNOTSUPP))) {

Modified: head/sys/dev/ena/ena_datapath.c
==
--- head/sys/dev/ena/ena_datapath.c Tue Jun 23 03:32:58 2020
(r362529)
+++ head/sys/dev/ena/ena_datapath.c Tue Jun 23 04:58:36 2020
(r362530)
@@ -30,6 +30,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_rss.h"
 #include "ena.h"
 #include "ena_datapath.h"
 #ifdef DEV_NETMAP
@@ -335,6 +336,19 @@ ena_rx_hash_mbuf(struct ena_ring *rx_ring, struct ena_
 
if (likely(ENA_FLAG_ISSET(ENA_FLAG_RSS_ACTIVE, adapter))) {
mbuf->m_pkthdr.flowid = ena_rx_ctx->hash;
+
+#ifdef RSS
+   /*
+* Hardware and software RSS are in agreement only when both are
+* configured to Toeplitz algorithm.  This driver configures
+* that algorithm only when software RSS is enabled and uses it.
+*/
+   if (adapter->ena_dev->rss.hash_func != ENA_ADMIN_TOEPLITZ &&
+   ena_rx_ctx->l3_proto != ENA_ETH_IO_L3_PROTO_UNKNOWN) {
+   M_HASHTYPE_SET(mbuf, M_HASHTYPE_OPAQUE_HASH);
+   return;
+   }
+#endif
 
if (ena_rx_ctx->frag &&
(ena_rx_ctx->l3_proto != ENA_ETH_IO_L3_PROTO_UNKNOWN)) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362523 - head/sys/opencrypto

2020-06-22 Thread John Baldwin
Author: jhb
Date: Tue Jun 23 00:02:28 2020
New Revision: 362523
URL: https://svnweb.freebsd.org/changeset/base/362523

Log:
  Store the AAD in a separate buffer for KTLS.
  
  For TLS 1.2 this permits reusing one of the existing iovecs without
  always having to duplicate both.
  
  While here, only duplicate the output iovec for TLS 1.3 if it will be
  used.
  
  Reviewed by:  gallatin
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D25291

Modified:
  head/sys/opencrypto/ktls_ocf.c

Modified: head/sys/opencrypto/ktls_ocf.c
==
--- head/sys/opencrypto/ktls_ocf.c  Mon Jun 22 23:55:06 2020
(r362522)
+++ head/sys/opencrypto/ktls_ocf.c  Tue Jun 23 00:02:28 2020
(r362523)
@@ -112,25 +112,24 @@ ktls_ocf_tls12_gcm_encrypt(struct ktls_session *tls,
struct cryptop *crp;
struct ocf_session *os;
struct ocf_operation *oo;
-   struct iovec *iov, *out_iov;
int i, error;
uint16_t tls_comp_len;
bool inplace;
 
os = tls->cipher;
 
-   oo = malloc(sizeof(*oo) + (iovcnt + 2) * sizeof(*iov) * 2, M_KTLS_OCF,
-   M_WAITOK | M_ZERO);
+   oo = malloc(sizeof(*oo) + (iovcnt + 1) * sizeof(struct iovec),
+   M_KTLS_OCF, M_WAITOK | M_ZERO);
oo->os = os;
-   iov = oo->iov;
-   out_iov = iov + iovcnt + 2;
 
-   uio.uio_iov = iov;
+   uio.uio_iov = iniov;
+   uio.uio_iovcnt = iovcnt;
uio.uio_offset = 0;
uio.uio_segflg = UIO_SYSSPACE;
uio.uio_td = curthread;
 
-   out_uio.uio_iov = out_iov;
+   out_uio.uio_iov = outiov;
+   out_uio.uio_iovcnt = iovcnt;
out_uio.uio_offset = 0;
out_uio.uio_segflg = UIO_SYSSPACE;
out_uio.uio_td = curthread;
@@ -149,26 +148,18 @@ ktls_ocf_tls12_gcm_encrypt(struct ktls_session *tls,
ad.tls_vmajor = hdr->tls_vmajor;
ad.tls_vminor = hdr->tls_vminor;
ad.tls_length = htons(tls_comp_len);
-   iov[0].iov_base = 
-   iov[0].iov_len = sizeof(ad);
-   crp->crp_aad_start = 0;
+   crp->crp_aad = 
crp->crp_aad_length = sizeof(ad);
 
-   /* Copy iov's. */
-   memcpy(iov + 1, iniov, iovcnt * sizeof(*iov));
-   uio.uio_iovcnt = iovcnt + 1;
-   memcpy(out_iov, outiov, iovcnt * sizeof(*out_iov));
-   out_uio.uio_iovcnt = iovcnt;
-
/* Compute payload length and determine if encryption is in place. */
inplace = true;
-   crp->crp_payload_start = sizeof(ad);
+   crp->crp_payload_start = 0;
for (i = 0; i < iovcnt; i++) {
if (iniov[i].iov_base != outiov[i].iov_base)
inplace = false;
crp->crp_payload_length += iniov[i].iov_len;
}
-   uio.uio_resid = sizeof(ad) + crp->crp_payload_length;
+   uio.uio_resid = crp->crp_payload_length;
out_uio.uio_resid = crp->crp_payload_length;
 
if (inplace)
@@ -176,8 +167,11 @@ ktls_ocf_tls12_gcm_encrypt(struct ktls_session *tls,
else
tag_uio = _uio;
 
-   tag_uio->uio_iov[tag_uio->uio_iovcnt].iov_base = trailer;
-   tag_uio->uio_iov[tag_uio->uio_iovcnt].iov_len = AES_GMAC_HASH_LEN;
+   /* Duplicate iovec and append vector for tag. */
+   memcpy(oo->iov, tag_uio->uio_iov, iovcnt * sizeof(struct iovec));
+   tag_uio->uio_iov = oo->iov;
+   tag_uio->uio_iov[iovcnt].iov_base = trailer;
+   tag_uio->uio_iov[iovcnt].iov_len = AES_GMAC_HASH_LEN;
tag_uio->uio_iovcnt++;
crp->crp_digest_start = tag_uio->uio_resid;
tag_uio->uio_resid += AES_GMAC_HASH_LEN;
@@ -238,23 +232,12 @@ ktls_ocf_tls13_gcm_encrypt(struct ktls_session *tls,
 
os = tls->cipher;
 
-   oo = malloc(sizeof(*oo) + (iovcnt + 2) * sizeof(*iov) * 2, M_KTLS_OCF,
+   oo = malloc(sizeof(*oo) + (iovcnt + 1) * sizeof(*iov) * 2, M_KTLS_OCF,
M_WAITOK | M_ZERO);
oo->os = os;
iov = oo->iov;
-
out_iov = iov + iovcnt + 2;
 
-   uio.uio_iov = iov;
-   uio.uio_offset = 0;
-   uio.uio_segflg = UIO_SYSSPACE;
-   uio.uio_td = curthread;
-
-   out_uio.uio_iov = out_iov;
-   out_uio.uio_offset = 0;
-   out_uio.uio_segflg = UIO_SYSSPACE;
-   out_uio.uio_td = curthread;
-
crp = crypto_getreq(os->sid, M_WAITOK);
 
/* Setup the nonce. */
@@ -266,52 +249,56 @@ ktls_ocf_tls13_gcm_encrypt(struct ktls_session *tls,
ad.tls_vmajor = hdr->tls_vmajor;
ad.tls_vminor = hdr->tls_vminor;
ad.tls_length = hdr->tls_length;
-   iov[0].iov_base = 
-   iov[0].iov_len = sizeof(ad);
-   crp->crp_aad_start = 0;
+   crp->crp_aad = 
crp->crp_aad_length = sizeof(ad);
 
-   /* Copy iov's. */
-   memcpy(iov + 1, iniov, iovcnt * sizeof(*iov));
-   uio.uio_iovcnt = iovcnt + 1;
-   memcpy(out_iov, outiov, iovcnt * sizeof(*out_iov));
-   out_uio.uio_iovcnt 

svn commit: r362519 - head/sys/dev/cxgbe/crypto

2020-06-22 Thread John Baldwin
Author: jhb
Date: Mon Jun 22 23:41:33 2020
New Revision: 362519
URL: https://svnweb.freebsd.org/changeset/base/362519

Log:
  Add support for requests with separate AAD to ccr(4).
  
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D25290

Modified:
  head/sys/dev/cxgbe/crypto/t4_crypto.c

Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c
==
--- head/sys/dev/cxgbe/crypto/t4_crypto.c   Mon Jun 22 23:22:13 2020
(r362518)
+++ head/sys/dev/cxgbe/crypto/t4_crypto.c   Mon Jun 22 23:41:33 2020
(r362519)
@@ -387,7 +387,6 @@ ccr_write_ulptx_sgl(struct ccr_softc *sc, void *dst, i
usgl->sge[i / 2].addr[i & 1] = htobe64(ss->ss_paddr);
ss++;
}
-   
 }
 
 static bool
@@ -919,8 +918,13 @@ ccr_eta(struct ccr_softc *sc, struct ccr_session *s, s
imm_len = 0;
sglist_reset(sc->sg_ulptx);
if (crp->crp_aad_length != 0) {
-   error = sglist_append_sglist(sc->sg_ulptx, sc->sg_input,
-   crp->crp_aad_start, crp->crp_aad_length);
+   if (crp->crp_aad != NULL)
+   error = sglist_append(sc->sg_ulptx,
+   crp->crp_aad, crp->crp_aad_length);
+   else
+   error = sglist_append_sglist(sc->sg_ulptx,
+   sc->sg_input, crp->crp_aad_start,
+   crp->crp_aad_length);
if (error)
return (error);
}
@@ -938,11 +942,7 @@ ccr_eta(struct ccr_softc *sc, struct ccr_session *s, s
sgl_len = ccr_ulptx_sgl_len(sgl_nsegs);
}
 
-   /*
-* Any auth-only data before the cipher region is marked as AAD.
-* Auth-data that overlaps with the cipher region is placed in
-* the auth section.
-*/
+   /* Any AAD comes after the IV. */
if (crp->crp_aad_length != 0) {
aad_start = iv_len + 1;
aad_stop = aad_start + crp->crp_aad_length - 1;
@@ -1054,8 +1054,11 @@ ccr_eta(struct ccr_softc *sc, struct ccr_session *s, s
dst += iv_len;
if (imm_len != 0) {
if (crp->crp_aad_length != 0) {
-   crypto_copydata(crp, crp->crp_aad_start,
-   crp->crp_aad_length, dst);
+   if (crp->crp_aad != NULL)
+   memcpy(dst, crp->crp_aad, crp->crp_aad_length);
+   else
+   crypto_copydata(crp, crp->crp_aad_start,
+   crp->crp_aad_length, dst);
dst += crp->crp_aad_length;
}
crypto_copydata(crp, crp->crp_payload_start,
@@ -1224,8 +1227,13 @@ ccr_gcm(struct ccr_softc *sc, struct ccr_session *s, s
imm_len = 0;
sglist_reset(sc->sg_ulptx);
if (crp->crp_aad_length != 0) {
-   error = sglist_append_sglist(sc->sg_ulptx, sc->sg_input,
-   crp->crp_aad_start, crp->crp_aad_length);
+   if (crp->crp_aad != NULL)
+   error = sglist_append(sc->sg_ulptx,
+   crp->crp_aad, crp->crp_aad_length);
+   else
+   error = sglist_append_sglist(sc->sg_ulptx,
+   sc->sg_input, crp->crp_aad_start,
+   crp->crp_aad_length);
if (error)
return (error);
}
@@ -1337,8 +1345,11 @@ ccr_gcm(struct ccr_softc *sc, struct ccr_session *s, s
dst += iv_len;
if (imm_len != 0) {
if (crp->crp_aad_length != 0) {
-   crypto_copydata(crp, crp->crp_aad_start,
-   crp->crp_aad_length, dst);
+   if (crp->crp_aad != NULL)
+   memcpy(dst, crp->crp_aad, crp->crp_aad_length);
+   else
+   crypto_copydata(crp, crp->crp_aad_start,
+   crp->crp_aad_length, dst);
dst += crp->crp_aad_length;
}
crypto_copydata(crp, crp->crp_payload_start,
@@ -1438,11 +1449,24 @@ ccr_gcm_soft(struct ccr_session *s, struct cryptop *cr
axf->Reinit(auth_ctx, iv, sizeof(iv));
 
/* MAC the AAD. */
-   for (i = 0; i < crp->crp_aad_length; i += sizeof(block)) {
-   len = imin(crp->crp_aad_length - i, sizeof(block));
-   crypto_copydata(crp, crp->crp_aad_start + i, len, block);
-   bzero(block + len, sizeof(block) - len);
-   

svn commit: r362518 - head/sys/crypto/aesni

2020-06-22 Thread John Baldwin
Author: jhb
Date: Mon Jun 22 23:22:13 2020
New Revision: 362518
URL: https://svnweb.freebsd.org/changeset/base/362518

Log:
  Add support for requests with separate AAD to aesni(4).
  
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D25289

Modified:
  head/sys/crypto/aesni/aesni.c

Modified: head/sys/crypto/aesni/aesni.c
==
--- head/sys/crypto/aesni/aesni.c   Mon Jun 22 23:20:43 2020
(r362517)
+++ head/sys/crypto/aesni/aesni.c   Mon Jun 22 23:22:13 2020
(r362518)
@@ -254,7 +254,8 @@ aesni_probesession(device_t dev, const struct crypto_s
struct aesni_softc *sc;
 
sc = device_get_softc(dev);
-   if ((csp->csp_flags & ~(CSP_F_SEPARATE_OUTPUT)) != 0)
+   if ((csp->csp_flags & ~(CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD)) !=
+   0)
return (EINVAL);
switch (csp->csp_mode) {
case CSP_MODE_DIGEST:
@@ -697,8 +698,11 @@ aesni_cipher_crypt(struct aesni_session *ses, struct c
authbuf = NULL;
if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16 ||
csp->csp_cipher_alg == CRYPTO_AES_CCM_16) {
-   authbuf = aesni_cipher_alloc(crp, crp->crp_aad_start,
-   crp->crp_aad_length, );
+   if (crp->crp_aad != NULL)
+   authbuf = crp->crp_aad;
+   else
+   authbuf = aesni_cipher_alloc(crp, crp->crp_aad_start,
+   crp->crp_aad_length, );
if (authbuf == NULL) {
error = ENOMEM;
goto out;
@@ -850,8 +854,12 @@ aesni_cipher_mac(struct aesni_session *ses, struct cry
hmac_key[i] = 0 ^ HMAC_IPAD_VAL;
ses->hash_update(, hmac_key, sizeof(hmac_key));
 
-   crypto_apply(crp, crp->crp_aad_start, crp->crp_aad_length,
-   ses->hash_update, );
+   if (crp->crp_aad != NULL)
+   ses->hash_update(, crp->crp_aad,
+   crp->crp_aad_length);
+   else
+   crypto_apply(crp, crp->crp_aad_start,
+   crp->crp_aad_length, ses->hash_update, );
if (CRYPTO_HAS_OUTPUT_BUFFER(crp) &&
CRYPTO_OP_IS_ENCRYPT(crp->crp_op))
crypto_apply_buf(>crp_obuf,
@@ -876,8 +884,12 @@ aesni_cipher_mac(struct aesni_session *ses, struct cry
} else {
ses->hash_init();
 
-   crypto_apply(crp, crp->crp_aad_start, crp->crp_aad_length,
-   ses->hash_update, );
+   if (crp->crp_aad != NULL)
+   ses->hash_update(, crp->crp_aad,
+   crp->crp_aad_length);
+   else
+   crypto_apply(crp, crp->crp_aad_start,
+   crp->crp_aad_length, ses->hash_update, );
if (CRYPTO_HAS_OUTPUT_BUFFER(crp) &&
CRYPTO_OP_IS_ENCRYPT(crp->crp_op))
crypto_apply_buf(>crp_obuf,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362517 - in head: share/man/man9 sys/opencrypto

2020-06-22 Thread John Baldwin
Author: jhb
Date: Mon Jun 22 23:20:43 2020
New Revision: 362517
URL: https://svnweb.freebsd.org/changeset/base/362517

Log:
  Add support to the crypto framework for separate AAD buffers.
  
  This permits requests to provide the AAD in a separate side buffer
  instead of as a region in the crypto request input buffer.  This is
  useful when the main data buffer might not contain the full AAD
  (e.g. for TLS or IPsec with ESN).
  
  Unlike separate IVs which are constrained in size and stored in an
  array in struct cryptop, separate AAD is provided by the caller
  setting a new crp_aad pointer to the buffer.  The caller must ensure
  the pointer remains valid and the buffer contents static until the
  request is completed (e.g. when the callback routine is invoked).
  
  As with separate output buffers, not all drivers support this feature.
  Consumers must request use of this feature via a new session flag.
  
  To aid in driver testing, kern.crypto.cryptodev_separate_aad can be
  set to force /dev/crypto requests to use a separate AAD buffer.
  
  Discussed with:   cem
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D25288

Modified:
  head/share/man/man9/crypto_request.9
  head/share/man/man9/crypto_session.9
  head/sys/opencrypto/crypto.c
  head/sys/opencrypto/cryptodev.c
  head/sys/opencrypto/cryptodev.h
  head/sys/opencrypto/cryptosoft.c

Modified: head/share/man/man9/crypto_request.9
==
--- head/share/man/man9/crypto_request.9Mon Jun 22 23:13:14 2020
(r362516)
+++ head/share/man/man9/crypto_request.9Mon Jun 22 23:20:43 2020
(r362517)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 25, 2020
+.Dd June 22, 2020
 .Dt CRYPTO_REQUEST 9
 .Os
 .Sh NAME
@@ -181,7 +181,7 @@ The following regions are defined:
 .Bl -column "Payload Output" "Input/Output"
 .It Sy Region Ta Sy Buffer Ta Sy Description
 .It AAD Ta Input Ta
-Additional Authenticated Data
+Embedded Additional Authenticated Data
 .It IV Ta Input Ta
 Embedded IV or nonce
 .It Payload Ta Input Ta
@@ -256,6 +256,15 @@ If the digests do not match,
 fail the request with
 .Er EBADMSG .
 .El
+.Ss Request AAD
+AEAD and Encrypt-then-Authenticate requests may optionally include
+Additional Authenticated Data.
+AAD may either be supplied in the AAD region of the input buffer or
+as a single buffer pointed to by
+.Fa crp_aad .
+In either case,
+.Fa crp_aad_length
+always indicates the amount of AAD in bytes.
 .Ss Request IV and/or Nonce
 Some cryptographic operations require an IV or nonce as an input.
 An IV may be stored either in the IV region of the data buffer or in

Modified: head/share/man/man9/crypto_session.9
==
--- head/share/man/man9/crypto_session.9Mon Jun 22 23:13:14 2020
(r362516)
+++ head/share/man/man9/crypto_session.9Mon Jun 22 23:20:43 2020
(r362517)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 25, 2020
+.Dd June 22, 2020
 .Dt CRYPTO_SESSION 9
 .Os
 .Sh NAME
@@ -194,6 +194,13 @@ that is modified in-place, or requests with separate i
 buffers.
 Sessions without this flag only permit requests with a single buffer that
 is modified in-place.
+.It Dv CSP_F_SEPARATE_AAD
+Support requests that use a separate buffer for AAD rather than providing
+AAD as a region in the input buffer.
+Sessions with this flag set permit requests with AAD passed in either in
+a region of the input buffer or in a single, virtually-contiguous buffer.
+Sessions without this flag only permit requests with AAD passed in as
+a region in the input buffer.
 .El
 .It Fa csp_ivlen
 If either the cipher or authentication algorithms require an explicit

Modified: head/sys/opencrypto/crypto.c
==
--- head/sys/opencrypto/crypto.cMon Jun 22 23:13:14 2020
(r362516)
+++ head/sys/opencrypto/crypto.cMon Jun 22 23:20:43 2020
(r362517)
@@ -755,7 +755,8 @@ check_csp(const struct crypto_session_params *csp)
struct auth_hash *axf;
 
/* Mode-independent checks. */
-   if ((csp->csp_flags & ~CSP_F_SEPARATE_OUTPUT) != 0)
+   if ((csp->csp_flags & ~(CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD)) !=
+   0)
return (false);
if (csp->csp_ivlen < 0 || csp->csp_cipher_klen < 0 ||
csp->csp_auth_klen < 0 || csp->csp_auth_mlen < 0)
@@ -771,6 +772,8 @@ check_csp(const struct crypto_session_params *csp)
return (false);
if (csp->csp_flags & CSP_F_SEPARATE_OUTPUT)
return (false);
+   if (csp->csp_flags & CSP_F_SEPARATE_AAD)
+   return (false);
if (csp->csp_cipher_klen != 0 || csp->csp_ivlen != 0 ||
csp->csp_auth_alg != 0 || 

svn commit: r362516 - head/contrib/ldns/drill

2020-06-22 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jun 22 23:13:14 2020
New Revision: 362516
URL: https://svnweb.freebsd.org/changeset/base/362516

Log:
  Fix crash in drill(1) when IP has two subsequent dots
  
  Cherry-pick crash fix from the upstream repo
  
  PR:   226575
  Reported by:  Goran Mekić 
  Obtained from:https://git.nlnetlabs.nl/ldns/commit/?id=98291475
  MFC after:2 weeks

Modified:
  head/contrib/ldns/drill/drill.c

Modified: head/contrib/ldns/drill/drill.c
==
--- head/contrib/ldns/drill/drill.c Mon Jun 22 22:59:03 2020
(r362515)
+++ head/contrib/ldns/drill/drill.c Mon Jun 22 23:13:14 2020
(r362516)
@@ -787,15 +787,17 @@ main(int argc, char *argv[])
qname = ldns_dname_new_frm_str(ip6_arpa_str);
} else {
qname = ldns_dname_new_frm_str(name);
-   qname_tmp = ldns_dname_reverse(qname);
-   ldns_rdf_deep_free(qname);
-   qname = qname_tmp;
-   qname_tmp = 
ldns_dname_new_frm_str("in-addr.arpa.");
-   status = ldns_dname_cat(qname, qname_tmp);
-   if (status != LDNS_STATUS_OK) {
-   error("%s", "could not create reverse 
address for ip4: %s\n", ldns_get_errorstr_by_id(status));
+   if (qname) {
+   qname_tmp = ldns_dname_reverse(qname);
+   ldns_rdf_deep_free(qname);
+   qname = qname_tmp;
+   qname_tmp = 
ldns_dname_new_frm_str("in-addr.arpa.");
+   status = ldns_dname_cat(qname, 
qname_tmp);
+   if (status != LDNS_STATUS_OK) {
+   error("%s", "could not create 
reverse address for ip4: %s\n", ldns_get_errorstr_by_id(status));
+   }
+   ldns_rdf_deep_free(qname_tmp);
}
-   ldns_rdf_deep_free(qname_tmp);
}
if (!qname) {
error("%s", "-x implies an ip address");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362515 - head/contrib/nvi/common

2020-06-22 Thread Yuri Pankov
Author: yuripv
Date: Mon Jun 22 22:59:03 2020
New Revision: 362515
URL: https://svnweb.freebsd.org/changeset/base/362515

Log:
  Revert r362148.
  
  Breaks UTF-8 input for new or having only 7bit characters present files.
  
  Reported by:  glebius

Modified:
  head/contrib/nvi/common/exf.c

Modified: head/contrib/nvi/common/exf.c
==
--- head/contrib/nvi/common/exf.c   Mon Jun 22 22:43:09 2020
(r362514)
+++ head/contrib/nvi/common/exf.c   Mon Jun 22 22:59:03 2020
(r362515)
@@ -1237,10 +1237,7 @@ file_encinit(SCR *sp)
}
 
/*
-* 1. Check for valid UTF-8.
-* 2. Check if fallback fileencoding is set and is NOT UTF-8.
-* 3. Check if user locale's encoding is NOT UTF-8.
-* 4. Use ISO8859-1 as last resort.
+* Detect UTF-8 and fallback to the locale/preset encoding.
 *
 * XXX
 * A manually set O_FILEENCODING indicates the "fallback
@@ -1249,13 +1246,9 @@ file_encinit(SCR *sp)
 */
if (looks_utf8(buf, blen) > 1)
o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0);
-   else if (O_ISSET(sp, O_FILEENCODING) &&
-   strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8") != 0)
-   /* Use fileencoding as is */ ;
-   else if (strcasecmp(codeset(), "utf-8") != 0)
+   else if (!O_ISSET(sp, O_FILEENCODING) ||
+   !strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8"))
o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0);
-   else
-   o_set(sp, O_FILEENCODING, OS_STRDUP, "iso8859-1", 0);
 
conv_enc(sp, O_FILEENCODING, 0);
 #endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362148 - head/contrib/nvi/common

2020-06-22 Thread Yuri Pankov

Zhihao Yuan wrote:
On Mon, Jun 22, 2020 at 5:24 PM Gleb Smirnoff > wrote:



My first attempt was this fix:

--- common/exf.c        (revision 362200)
+++ common/exf.c        (working copy)
@@ -1252,7 +1252,8 @@ file_encinit(SCR *sp)
         else if (O_ISSET(sp, O_FILEENCODING) &&
             strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8") != 0)
                 /* Use fileencoding as is */ ;
-       else if (strcasecmp(codeset(), "utf-8") != 0)
+       else if (strncasecmp(codeset() + strlen(codeset()) - 5,
"utf-8", 5) !=
+           0)
                 o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0);
         else
                 o_set(sp, O_FILEENCODING, OS_STRDUP, "iso8859-1", 0);

But it appeared to be not the case. To my surprise, codeset()
which is wrapper around nl_langinfo() in my case returns US-ASCII.


That sounds strange.

   1. Can you set LC_CTYPE as well and see
     if anything changes?
   2. Can you revert to the previous version
     and see what nl_langinfo gives?

There is another issue... I'm sorry.  I totally forgot what
looks_utf8 actually does.

Here is its behavior (encoding.c):

  Returns
  -1: invalid UTF-8
   0: uses odd control characters, so doesn't look like text
   1: 7-bit text
   2: definitely UTF-8 text (valid high-bit set bytes)

So if looks_utf8() > 1, it means the file itself is UTF-8
for sure.  If you opened a file with 7-bit text or with
control characters, :set fileencoding should set
the encoding intended to write.  But the HEAD
behaviors is that you can't input Unicode.

I'm reverting upstream.


Yes, I will revert for now.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362148 - head/contrib/nvi/common

2020-06-22 Thread Zhihao Yuan
On Mon, Jun 22, 2020 at 5:24 PM Gleb Smirnoff  wrote:

>
> My first attempt was this fix:
>
> --- common/exf.c(revision 362200)
> +++ common/exf.c(working copy)
> @@ -1252,7 +1252,8 @@ file_encinit(SCR *sp)
> else if (O_ISSET(sp, O_FILEENCODING) &&
> strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8") != 0)
> /* Use fileencoding as is */ ;
> -   else if (strcasecmp(codeset(), "utf-8") != 0)
> +   else if (strncasecmp(codeset() + strlen(codeset()) - 5, "utf-8",
> 5) !=
> +   0)
> o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0);
> else
> o_set(sp, O_FILEENCODING, OS_STRDUP, "iso8859-1", 0);
>
> But it appeared to be not the case. To my surprise, codeset()
> which is wrapper around nl_langinfo() in my case returns US-ASCII.
>
>
That sounds strange.

  1. Can you set LC_CTYPE as well and see
if anything changes?
  2. Can you revert to the previous version
and see what nl_langinfo gives?

There is another issue... I'm sorry.  I totally forgot what
looks_utf8 actually does.

Here is its behavior (encoding.c):

 Returns
 -1: invalid UTF-8
  0: uses odd control characters, so doesn't look like text
  1: 7-bit text
  2: definitely UTF-8 text (valid high-bit set bytes)

So if looks_utf8() > 1, it means the file itself is UTF-8
for sure.  If you opened a file with 7-bit text or with
control characters, :set fileencoding should set
the encoding intended to write.  But the HEAD
behaviors is that you can't input Unicode.

I'm reverting upstream.

-- 
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362148 - head/contrib/nvi/common

2020-06-22 Thread Gleb Smirnoff
On Tue, Jun 23, 2020 at 01:20:01AM +0300, Yuri Pankov wrote:
Y> Gleb Smirnoff wrote:
Y> >Yuri, Zhihao,
Y> > 
Y> > this commit totally broke Russian input for me in nvi. After
Y> > exiting edit mode, nvi immediately converts all text to ???.
Y> > 
Y> > I don't have any special settings in my environment. All I have
Y> > is "russian" class for my user which yields in these environment
Y> > variables:
Y> > 
Y> > declare -x LANG="ru_RU.UTF-8"
Y> > declare -x MM_CHARSET="UTF-8"
Y> > declare -x XTERM_LOCALE="ru_RU.UTF-8"
Y> > 
Y> > I'm already digging into that problem, but may be you have
Y> > a clue immediately.
Y> 
Y> My bad, yes, I see the problem, looking into it.

My first attempt was this fix:

--- common/exf.c(revision 362200)
+++ common/exf.c(working copy)
@@ -1252,7 +1252,8 @@ file_encinit(SCR *sp)
else if (O_ISSET(sp, O_FILEENCODING) &&
strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8") != 0)
/* Use fileencoding as is */ ;
-   else if (strcasecmp(codeset(), "utf-8") != 0)
+   else if (strncasecmp(codeset() + strlen(codeset()) - 5, "utf-8", 5) !=
+   0)
o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0);
else
o_set(sp, O_FILEENCODING, OS_STRDUP, "iso8859-1", 0);

But it appeared to be not the case. To my surprise, codeset()
which is wrapper around nl_langinfo() in my case returns US-ASCII.

Y> > On Sat, Jun 13, 2020 at 02:11:02PM +, Yuri Pankov wrote:
Y> > Y> Author: yuripv
Y> > Y> Date: Sat Jun 13 14:11:02 2020
Y> > Y> New Revision: 362148
Y> > Y> URL: https://svnweb.freebsd.org/changeset/base/362148
Y> > Y>
Y> > Y> Log:
Y> > Y>   nvi: fallback to ISO8859-1 as last resort
Y> > Y>
Y> > Y>   Current logic of using user's locale encoding that is UTF-8 doesn't 
make
Y> > Y>   much sense if we already failed the looks_utf8() check and skipped
Y> > Y>   encoding set using "fileencoding" as being UTF-8 as well; fallback to
Y> > Y>   ISO8859-1 in that case.
Y> > Y>
Y> > Y>   Reviewed by:  Zhihao Yuan 
Y> > Y>   Differential Revision:https://reviews.freebsd.org/D24919
Y> > Y>
Y> > Y> Modified:
Y> > Y>   head/contrib/nvi/common/exf.c
Y> > Y>
Y> > Y> Modified: head/contrib/nvi/common/exf.c
Y> > Y> 
==
Y> > Y> --- head/contrib/nvi/common/exf.c   Sat Jun 13 09:16:07 2020
(r362147)
Y> > Y> +++ head/contrib/nvi/common/exf.c   Sat Jun 13 14:11:02 2020
(r362148)
Y> > Y> @@ -1237,7 +1237,10 @@ file_encinit(SCR *sp)
Y> > Y> }
Y> > Y>
Y> > Y> /*
Y> > Y> -* Detect UTF-8 and fallback to the locale/preset encoding.
Y> > Y> +* 1. Check for valid UTF-8.
Y> > Y> +* 2. Check if fallback fileencoding is set and is NOT UTF-8.
Y> > Y> +* 3. Check if user locale's encoding is NOT UTF-8.
Y> > Y> +* 4. Use ISO8859-1 as last resort.
Y> > Y>  *
Y> > Y>  * XXX
Y> > Y>  * A manually set O_FILEENCODING indicates the "fallback
Y> > Y> @@ -1246,9 +1249,13 @@ file_encinit(SCR *sp)
Y> > Y>  */
Y> > Y> if (looks_utf8(buf, blen) > 1)
Y> > Y> o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0);
Y> > Y> -   else if (!O_ISSET(sp, O_FILEENCODING) ||
Y> > Y> -   !strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8"))
Y> > Y> +   else if (O_ISSET(sp, O_FILEENCODING) &&
Y> > Y> +   strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8") != 0)
Y> > Y> +   /* Use fileencoding as is */ ;
Y> > Y> +   else if (strcasecmp(codeset(), "utf-8") != 0)
Y> > Y> o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0);
Y> > Y> +   else
Y> > Y> +   o_set(sp, O_FILEENCODING, OS_STRDUP, "iso8859-1", 0);
Y> > Y>
Y> > Y> conv_enc(sp, O_FILEENCODING, 0);
Y> > Y>  #endif

-- 
Gleb Smirnoff
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362338 - in head: share/man/man4 sys/conf sys/kern sys/netinet sys/netinet6 sys/netipsec sys/netpfil/pf

2020-06-22 Thread John Baldwin
On 6/22/20 3:07 PM, Mark Johnston wrote:
> On Mon, Jun 22, 2020 at 11:35:38AM -0700, John Baldwin wrote:
>> On 6/21/20 6:10 PM, Mark Johnston wrote:
>>> On Fri, Jun 19, 2020 at 08:33:35AM -0700, John Baldwin wrote:
 On 6/18/20 12:32 PM, Mark Johnston wrote:
> Author: markj
> Date: Thu Jun 18 19:32:34 2020
> New Revision: 362338
> URL: https://svnweb.freebsd.org/changeset/base/362338
>
> Log:
>   Add the SCTP_SUPPORT kernel option.
>   
>   This is in preparation for enabling a loadable SCTP stack.  Analogous to
>   IPSEC/IPSEC_SUPPORT, the SCTP_SUPPORT kernel option must be configured
>   in order to support a loadable SCTP implementation.
>   
>   Discussed with: tuexen
>   MFC after:  2 weeks
>   Sponsored by:   The FreeBSD Foundation

 Do you want to add similar handling to sys/conf/config.mk that we have
 for IPsec?  Also, do we want to avoid building sctp.ko if it is in the
 kernel like we do for ipsec.ko and/or only build it if the kernel contains
 SCTP_SUPPORT?  (For ipsec.ko we had to do that as it wouldn't compile, not
 sure if the same is true for sctp.ko)
>>>
>>> Sorry for the delay.
>>> I think we do indeed want similar handling in config.mk, I will work on
>>> it.  It is probably also reasonable to avoid compiling sctp.ko when
>>> SCTP_SUPPORT is not defined, though I can't see a reason that wouldn't
>>> work today since SCTP_SUPPORT is not used in any headers.
>>
>> Ok.  ipsec.ko mattered more when the build broke.  Whether or not we compile
>> "duplicate" modules for kernels is perhaps a larger question.  I think I
>> might favor that change, but it is a larger change that merits some thought.
>> In particular, you want good code coverage for things like LINT builds, so
>> maybe we really should still compile modules whenever possible.
> 
> I tend to assume that a buildkernel of GENERIC without any special flags
> will always build all modules (except those not available for the target
> platform of course), so I was a bit surprised to see that this isn't the
> case for ipsec.ko.  As Rodney pointed out it provides marginally better
> coverage against build breaks.  If you think we can restore the old
> behaviour for ipsec without too much work I think it'd be reasonable to
> change that and compile sctp.ko even when "options SCTP" is configured.
> I can't spot any similar cases in sys/modules/Makefile with a bit of
> skimming.

I don't think ipsec.ko is easily fixable when I looked at it.  I think it
is fine to leave sctp.ko building as part of GENERIC though.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362148 - head/contrib/nvi/common

2020-06-22 Thread Yuri Pankov

Gleb Smirnoff wrote:

   Yuri, Zhihao,

this commit totally broke Russian input for me in nvi. After
exiting edit mode, nvi immediately converts all text to ???.

I don't have any special settings in my environment. All I have
is "russian" class for my user which yields in these environment
variables:

declare -x LANG="ru_RU.UTF-8"
declare -x MM_CHARSET="UTF-8"
declare -x XTERM_LOCALE="ru_RU.UTF-8"

I'm already digging into that problem, but may be you have
a clue immediately.


My bad, yes, I see the problem, looking into it.


On Sat, Jun 13, 2020 at 02:11:02PM +, Yuri Pankov wrote:
Y> Author: yuripv
Y> Date: Sat Jun 13 14:11:02 2020
Y> New Revision: 362148
Y> URL: https://svnweb.freebsd.org/changeset/base/362148
Y>
Y> Log:
Y>   nvi: fallback to ISO8859-1 as last resort
Y>
Y>   Current logic of using user's locale encoding that is UTF-8 doesn't make
Y>   much sense if we already failed the looks_utf8() check and skipped
Y>   encoding set using "fileencoding" as being UTF-8 as well; fallback to
Y>   ISO8859-1 in that case.
Y>
Y>   Reviewed by:Zhihao Yuan 
Y>   Differential Revision:  https://reviews.freebsd.org/D24919
Y>
Y> Modified:
Y>   head/contrib/nvi/common/exf.c
Y>
Y> Modified: head/contrib/nvi/common/exf.c
Y> 
==
Y> --- head/contrib/nvi/common/exf.c Sat Jun 13 09:16:07 2020(r362147)
Y> +++ head/contrib/nvi/common/exf.c Sat Jun 13 14:11:02 2020(r362148)
Y> @@ -1237,7 +1237,10 @@ file_encinit(SCR *sp)
Y>   }
Y>
Y>   /*
Y> -  * Detect UTF-8 and fallback to the locale/preset encoding.
Y> +  * 1. Check for valid UTF-8.
Y> +  * 2. Check if fallback fileencoding is set and is NOT UTF-8.
Y> +  * 3. Check if user locale's encoding is NOT UTF-8.
Y> +  * 4. Use ISO8859-1 as last resort.
Y>*
Y>* XXX
Y>* A manually set O_FILEENCODING indicates the "fallback
Y> @@ -1246,9 +1249,13 @@ file_encinit(SCR *sp)
Y>*/
Y>   if (looks_utf8(buf, blen) > 1)
Y>   o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0);
Y> - else if (!O_ISSET(sp, O_FILEENCODING) ||
Y> - !strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8"))
Y> + else if (O_ISSET(sp, O_FILEENCODING) &&
Y> + strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8") != 0)
Y> + /* Use fileencoding as is */ ;
Y> + else if (strcasecmp(codeset(), "utf-8") != 0)
Y>   o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0);
Y> + else
Y> + o_set(sp, O_FILEENCODING, OS_STRDUP, "iso8859-1", 0);
Y>
Y>   conv_enc(sp, O_FILEENCODING, 0);
Y>  #endif

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362148 - head/contrib/nvi/common

2020-06-22 Thread Gleb Smirnoff
  Yuri, Zhihao,

this commit totally broke Russian input for me in nvi. After
exiting edit mode, nvi immediately converts all text to ???.

I don't have any special settings in my environment. All I have
is "russian" class for my user which yields in these environment
variables:

declare -x LANG="ru_RU.UTF-8"
declare -x MM_CHARSET="UTF-8"
declare -x XTERM_LOCALE="ru_RU.UTF-8"

I'm already digging into that problem, but may be you have
a clue immediately.

On Sat, Jun 13, 2020 at 02:11:02PM +, Yuri Pankov wrote:
Y> Author: yuripv
Y> Date: Sat Jun 13 14:11:02 2020
Y> New Revision: 362148
Y> URL: https://svnweb.freebsd.org/changeset/base/362148
Y> 
Y> Log:
Y>   nvi: fallback to ISO8859-1 as last resort
Y>   
Y>   Current logic of using user's locale encoding that is UTF-8 doesn't make
Y>   much sense if we already failed the looks_utf8() check and skipped
Y>   encoding set using "fileencoding" as being UTF-8 as well; fallback to
Y>   ISO8859-1 in that case.
Y>   
Y>   Reviewed by:   Zhihao Yuan 
Y>   Differential Revision: https://reviews.freebsd.org/D24919
Y> 
Y> Modified:
Y>   head/contrib/nvi/common/exf.c
Y> 
Y> Modified: head/contrib/nvi/common/exf.c
Y> 
==
Y> --- head/contrib/nvi/common/exf.cSat Jun 13 09:16:07 2020
(r362147)
Y> +++ head/contrib/nvi/common/exf.cSat Jun 13 14:11:02 2020
(r362148)
Y> @@ -1237,7 +1237,10 @@ file_encinit(SCR *sp)
Y>  }
Y>  
Y>  /*
Y> - * Detect UTF-8 and fallback to the locale/preset encoding.
Y> + * 1. Check for valid UTF-8.
Y> + * 2. Check if fallback fileencoding is set and is NOT UTF-8.
Y> + * 3. Check if user locale's encoding is NOT UTF-8.
Y> + * 4. Use ISO8859-1 as last resort.
Y>   *
Y>   * XXX
Y>   * A manually set O_FILEENCODING indicates the "fallback
Y> @@ -1246,9 +1249,13 @@ file_encinit(SCR *sp)
Y>   */
Y>  if (looks_utf8(buf, blen) > 1)
Y>  o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0);
Y> -else if (!O_ISSET(sp, O_FILEENCODING) ||
Y> -!strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8"))
Y> +else if (O_ISSET(sp, O_FILEENCODING) &&
Y> +strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8") != 0)
Y> +/* Use fileencoding as is */ ;
Y> +else if (strcasecmp(codeset(), "utf-8") != 0)
Y>  o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0);
Y> +else
Y> +o_set(sp, O_FILEENCODING, OS_STRDUP, "iso8859-1", 0);
Y>  
Y>  conv_enc(sp, O_FILEENCODING, 0);
Y>  #endif
Y> ___
Y> svn-src-...@freebsd.org mailing list
Y> https://lists.freebsd.org/mailman/listinfo/svn-src-all
Y> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

-- 
Gleb Smirnoff
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362338 - in head: share/man/man4 sys/conf sys/kern sys/netinet sys/netinet6 sys/netipsec sys/netpfil/pf

2020-06-22 Thread Mark Johnston
On Mon, Jun 22, 2020 at 11:35:38AM -0700, John Baldwin wrote:
> On 6/21/20 6:10 PM, Mark Johnston wrote:
> > On Fri, Jun 19, 2020 at 08:33:35AM -0700, John Baldwin wrote:
> >> On 6/18/20 12:32 PM, Mark Johnston wrote:
> >>> Author: markj
> >>> Date: Thu Jun 18 19:32:34 2020
> >>> New Revision: 362338
> >>> URL: https://svnweb.freebsd.org/changeset/base/362338
> >>>
> >>> Log:
> >>>   Add the SCTP_SUPPORT kernel option.
> >>>   
> >>>   This is in preparation for enabling a loadable SCTP stack.  Analogous to
> >>>   IPSEC/IPSEC_SUPPORT, the SCTP_SUPPORT kernel option must be configured
> >>>   in order to support a loadable SCTP implementation.
> >>>   
> >>>   Discussed with: tuexen
> >>>   MFC after:  2 weeks
> >>>   Sponsored by:   The FreeBSD Foundation
> >>
> >> Do you want to add similar handling to sys/conf/config.mk that we have
> >> for IPsec?  Also, do we want to avoid building sctp.ko if it is in the
> >> kernel like we do for ipsec.ko and/or only build it if the kernel contains
> >> SCTP_SUPPORT?  (For ipsec.ko we had to do that as it wouldn't compile, not
> >> sure if the same is true for sctp.ko)
> > 
> > Sorry for the delay.
> > I think we do indeed want similar handling in config.mk, I will work on
> > it.  It is probably also reasonable to avoid compiling sctp.ko when
> > SCTP_SUPPORT is not defined, though I can't see a reason that wouldn't
> > work today since SCTP_SUPPORT is not used in any headers.
> 
> Ok.  ipsec.ko mattered more when the build broke.  Whether or not we compile
> "duplicate" modules for kernels is perhaps a larger question.  I think I
> might favor that change, but it is a larger change that merits some thought.
> In particular, you want good code coverage for things like LINT builds, so
> maybe we really should still compile modules whenever possible.

I tend to assume that a buildkernel of GENERIC without any special flags
will always build all modules (except those not available for the target
platform of course), so I was a bit surprised to see that this isn't the
case for ipsec.ko.  As Rodney pointed out it provides marginally better
coverage against build breaks.  If you think we can restore the old
behaviour for ipsec without too much work I think it'd be reasonable to
change that and compile sctp.ko even when "options SCTP" is configured.
I can't spot any similar cases in sys/modules/Makefile with a bit of
skimming.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r358181 - head/usr.sbin/pstat

2020-06-22 Thread Piotr P. Stefaniak

On 2020-02-20 21:12:10, Christian S.J. Peron wrote:

Author: csjp
Date: Thu Feb 20 21:12:10 2020
New Revision: 358181
URL: https://svnweb.freebsd.org/changeset/base/358181

Log:
 - Implement -h (human readable) for the size of the underlying block disk.
   Currently, the size of the swap device is unconditionally reported using
   blocks, even if -h has been used.
 - While here, switch to CONVERT_BLOCKS() instead of CONVERT() which will
   avoid overflowing size counters (in human readable form see: r196244)
 - Update the column headers to reflect that a size is being reported instead
   of the block size units being used

 Before:

 $ swapinfo
 Device  1K-blocks UsedAvail Capacity
 /dev/gpt/swapfs   10485760  1048576 0%


In the above, the "1K-blocks" and "1048576" line up because both the
header and the value have field width of hlen which is always set by
getbsize(, ). In other words, the header name sets the
width for the column. It is especially apparent when you compare output
with BLOCKSIZE=10 and BLOCKSIZE=1K.


 After:

 $ swapinfo -h
 Device   Size UsedAvail Capacity
 /dev/gpt/swapfs1.0G   0B 1.0G 0%


Here the width for the header is sizeof "Size" and the width for values
of the size is 8, so the header and the values don't make up a column.

Since field width for all values of Size, Used, and Avail are hardcoded
to 8 as well as the column headers, I think the best suggestion I can
give is to change it like this:

@@ -475,7 +475,7 @@ print_swap_header(void)
 
if (humanflag) {

header = SIZEHDR;
-   hlen = sizeof(SIZEHDR);
+   hlen = 8; /* as the hardcoded field width of values */
} else {
header = getbsize(, );
}

Although 8 seems to me a bit high. And too bad that humanize_number() is
locale-agnostic. 


 Differential Revision: https://reviews.freebsd.org/D23758
 Reviewed by:   kevans
 MFC after: 3 weeks

Modified:
 head/usr.sbin/pstat/pstat.c

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362509 - head/sys/x86/x86

2020-06-22 Thread Jung-uk Kim
Author: jkim
Date: Mon Jun 22 20:42:58 2020
New Revision: 362509
URL: https://svnweb.freebsd.org/changeset/base/362509

Log:
  Assume all TSCs are synchronized for AMD Family 17h processors and later
  when it has passed the synchronization test.
  
  "Processor Programming Reference (PPR) for AMD Family 17h" states that
  the TSC uses a common reference for all sockets, cores and threads.
  
  MFC after:1 month

Modified:
  head/sys/x86/x86/tsc.c

Modified: head/sys/x86/x86/tsc.c
==
--- head/sys/x86/x86/tsc.c  Mon Jun 22 19:15:50 2020(r362508)
+++ head/sys/x86/x86/tsc.c  Mon Jun 22 20:42:58 2020(r362509)
@@ -526,6 +526,13 @@ retry:
case CPU_VENDOR_AMD:
case CPU_VENDOR_HYGON:
/*
+* Processor Programming Reference (PPR) for AMD
+* Family 17h states that the TSC uses a common
+* reference for all sockets, cores and threads.
+*/
+   if (CPUID_TO_FAMILY(cpu_id) >= 0x17)
+   return (1000);
+   /*
 * Starting with Family 15h processors, TSC clock
 * source is in the north bridge.  Check whether
 * we have a single-socket/multi-core platform.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362338 - in head: share/man/man4 sys/conf sys/kern sys/netinet sys/netinet6 sys/netipsec sys/netpfil/pf

2020-06-22 Thread Rodney W. Grimes
> On 6/21/20 6:10 PM, Mark Johnston wrote:
> > On Fri, Jun 19, 2020 at 08:33:35AM -0700, John Baldwin wrote:
> >> On 6/18/20 12:32 PM, Mark Johnston wrote:
> >>> Author: markj
> >>> Date: Thu Jun 18 19:32:34 2020
> >>> New Revision: 362338
> >>> URL: https://svnweb.freebsd.org/changeset/base/362338
> >>>
> >>> Log:
> >>>   Add the SCTP_SUPPORT kernel option.
> >>>   
> >>>   This is in preparation for enabling a loadable SCTP stack.  Analogous to
> >>>   IPSEC/IPSEC_SUPPORT, the SCTP_SUPPORT kernel option must be configured
> >>>   in order to support a loadable SCTP implementation.
> >>>   
> >>>   Discussed with: tuexen
> >>>   MFC after:  2 weeks
> >>>   Sponsored by:   The FreeBSD Foundation
> >>
> >> Do you want to add similar handling to sys/conf/config.mk that we have
> >> for IPsec?  Also, do we want to avoid building sctp.ko if it is in the
> >> kernel like we do for ipsec.ko and/or only build it if the kernel contains
> >> SCTP_SUPPORT?  (For ipsec.ko we had to do that as it wouldn't compile, not
> >> sure if the same is true for sctp.ko)
> > 
> > Sorry for the delay.
> > I think we do indeed want similar handling in config.mk, I will work on
> > it.  It is probably also reasonable to avoid compiling sctp.ko when
> > SCTP_SUPPORT is not defined, though I can't see a reason that wouldn't
> > work today since SCTP_SUPPORT is not used in any headers.
> 
> Ok.  ipsec.ko mattered more when the build broke.  Whether or not we compile
> "duplicate" modules for kernels is perhaps a larger question.  I think I
> might favor that change, but it is a larger change that merits some thought.
> In particular, you want good code coverage for things like LINT builds, so
> maybe we really should still compile modules whenever possible.

As a person that builds a lot of stuff into his kernel, aka I run
moduleless most of the time, I still would like the modules to build
so I know I have not busted that with other changes.  It is just too
easy to do, IMHO.

> -- 
> John Baldwin
-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362505 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-06-22 Thread Allan Jude
Author: allanjude
Date: Mon Jun 22 19:03:02 2020
New Revision: 362505
URL: https://svnweb.freebsd.org/changeset/base/362505

Log:
  MFOpenZFS: Add zio_ddt_free()+ddt_phys_decref() error handling
  
  The assumption in zio_ddt_free() is that ddt_phys_select() must
  always find a match.  However, if that fails due to a damaged
  DDT or some other reason the code will NULL dereference in
  ddt_phys_decref().
  
  While this should never happen it has been observed on various
  platforms.  The result is that unless your willing to patch the
  ZFS code the pool is inaccessible.  Therefore, we're choosing
  to more gracefully handle this case rather than leave it fatal.
  
  http://mail.opensolaris.org/pipermail/zfs-discuss/2012-February/050972.html
  
  https://github.com/openzfs/zfs/commit/5dc6af0eec29b119b731c793037fd77214fc9438
  
  Reported by:  Pierre Beyssac
  Obtained from:OpenZFS
  MFC after:2 weeks
  Sponsored by: Klara Inc.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c   Mon Jun 22 
17:57:49 2020(r362504)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c   Mon Jun 22 
19:03:02 2020(r362505)
@@ -325,8 +325,10 @@ ddt_phys_addref(ddt_phys_t *ddp)
 void
 ddt_phys_decref(ddt_phys_t *ddp)
 {
-   ASSERT((int64_t)ddp->ddp_refcnt > 0);
-   ddp->ddp_refcnt--;
+   if (ddp) {
+   ASSERT((int64_t)ddp->ddp_refcnt > 0);
+   ddp->ddp_refcnt--;
+   }
 }
 
 void

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon Jun 22 
17:57:49 2020(r362504)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon Jun 22 
19:03:02 2020(r362505)
@@ -2937,8 +2937,11 @@ zio_ddt_free(zio_t *zio)
 
ddt_enter(ddt);
freedde = dde = ddt_lookup(ddt, bp, B_TRUE);
-   ddp = ddt_phys_select(dde, bp);
-   ddt_phys_decref(ddp);
+   if (dde) {
+   ddp = ddt_phys_select(dde, bp);
+   if (ddp)
+   ddt_phys_decref(ddp);
+   }
ddt_exit(ddt);
 
return (zio);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362294 - head/sys/dev/sound/pci/hda

2020-06-22 Thread Konstantin Belousov
On Mon, Jun 22, 2020 at 09:37:15AM +0300, Andriy Gapon wrote:
> On 22/06/2020 00:59, Konstantin Belousov wrote:
> > This commit (or rather, a merge of this commit to stable/12) causes an issue
> > on my Apollo Lake machine.  Look:
> > hdac0@pci0:0:14:0:   class=0x040300 card=0xa1821458 chip=0x5a988086 
> > rev=0x0b hdr=0x00
> > vendor = 'Intel Corporation'
> > device = 'Celeron N3350/Pentium N4200/Atom E3900 Series Audio 
> > Cluster'
> > class  = multimedia
> > subclass   = HDA
> > bar   [10] = type Memory, range 64, base 0x9141, size 16384, enabled
> > bar   [20] = type Memory, range 64, base 0x9100, size 1048576, 
> > enabled
> > cap 01[50] = powerspec 3  supports D0 D3  current D0
> > cap 09[80] = vendor (length 20) Intel cap 15 version 0
> > cap 05[60] = MSI supports 1 message, 64 bit
> > 
> > DMAP base is 0xf800.
> > tom% sudo /usr/local/bin/kgdb 
> > ~/work/DEV/svn/RELENG_12/sys/amd64/compile/TOM/kernel.full /dev/mem
> > GNU gdb (GDB) 9.2 [GDB v9.2 for FreeBSD]
> > Reading symbols from 
> > /usr/home/kostik/work/DEV/svn/RELENG_12/sys/amd64/compile/TOM/kernel.full...
> > ...
> > sched_switch (td=0xf8029d516000, newtd=0xf800025f4000,
> > flags=) at ../../../kern/sched_ule.c:2143
> > 2143cpuid = PCPU_GET(cpuid);
> > (kgdb) p/x *(unsigned int *)(0xf800+0x9141+0x24) INTSTS
> > $1 = 0xc000
> > This causes the first interrupt handler to loop forever.
> > 
> > And this is why:
> > (kgdb) p/x *(unsigned char *)(0xf800+0x9141+0x5d) RIRBSTS
> > $3 = 0x0
> > (kgdb) p/x *(unsigned char *)(0xf800+0x9141+0x4d) CORBSTS
> > $4 = 0x0
> > (kgdb) p/x *(unsigned short *)(0xf800+0x9141+0xe) WAKESTS
> > $5 = 0x5
> > So the SDIN State Change status bit is set, and nothing in the driver
> > clears it, it seems.
> > 
> > More, the EDS specifies that another reason for INTSTS CIS bit set may
> > be the CORB Memory Error Indication (CMEI), and again it seems that driver
> > never clears the reason.
> > 
> > So as is the change perhaps helps for some situations, but also
> > practically makes some systems to loose core in tight loop with interrupt
> > priority, which causes weird machine misbehavior like unkillable processes
> > and never finishing epochs.
> 
> 
> Kostik,
> 
> thank you for the report and the debugging!
> 
> It seems that the driver currently does do not much with the register 0xe
> (referred to by you as WAKESTS, by the code and the HDA specification as 
> STATESTS).
> I think that we can just clear that register (documented as RW1C)
> More, I am surprised that the driver does not clear the register in
> hdac_attach2() when probing codecs.
> 
> So, maybe something like a quick patch below.
> 
> Also, I see that the driver never explicitly manages WAKEEN register.
> I think that it should.
> If we do not need or do not expect any wake events then we should clear the
> corresponding bits.
> So, maybe it would be better to just zero WAKEEN in attach and resume methods.
> Although, WAKEEN is documented as zero after reset, the specification has 
> this note:
>   These bits are only cleared by a power-on reset. Software must make no
>   assumptions about how these bits are set and set them appropriately.
> 
> 
> Regarding CMEI, we never enable it by setting CMEIE and it should be zero 
> after
> reset.  So, we should never get that interrupt.
> The same applies to another potential interrupt source, RIRBOIS / RIRBOIC.
> 
> Index: sys/dev/sound/pci/hda/hdac.c
> ===
> --- sys/dev/sound/pci/hda/hdac.c  (revision 362383)
> +++ sys/dev/sound/pci/hda/hdac.c  (working copy)
> @@ -312,6 +312,10 @@ hdac_one_intr(struct hdac_softc *sc, uint32_t ints
> 
>   /* Was this a controller interrupt? */
>   if (intsts & HDAC_INTSTS_CIS) {
> + /* XXX just clear SDIWAKE bits. */
> + HDAC_WRITE_2(>mem, HDAC_STATESTS,
> + HDAC_STATESTS_SDIWAKE_MASK);
> +
>   rirbsts = HDAC_READ_1(>mem, HDAC_RIRBSTS);
>   /* Get as many responses that we can */
>   while (rirbsts & HDAC_RIRBSTS_RINTFL) {
> @@ -1530,6 +1534,7 @@ hdac_attach2(void *arg)
>   device_printf(sc->dev, "Scanning HDA codecs ...\n");
>   );
>   statests = HDAC_READ_2(>mem, HDAC_STATESTS);
> + HDAC_WRITE_2(>mem, HDAC_STATESTS, statests);
>   hdac_unlock(sc);
>   for (i = 0; i < HDAC_CODEC_MAX; i++) {
>   if (HDAC_STATESTS_SDIWAKE(statests, i)) {
> 

The patch worked, thanks.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362338 - in head: share/man/man4 sys/conf sys/kern sys/netinet sys/netinet6 sys/netipsec sys/netpfil/pf

2020-06-22 Thread John Baldwin
On 6/21/20 6:10 PM, Mark Johnston wrote:
> On Fri, Jun 19, 2020 at 08:33:35AM -0700, John Baldwin wrote:
>> On 6/18/20 12:32 PM, Mark Johnston wrote:
>>> Author: markj
>>> Date: Thu Jun 18 19:32:34 2020
>>> New Revision: 362338
>>> URL: https://svnweb.freebsd.org/changeset/base/362338
>>>
>>> Log:
>>>   Add the SCTP_SUPPORT kernel option.
>>>   
>>>   This is in preparation for enabling a loadable SCTP stack.  Analogous to
>>>   IPSEC/IPSEC_SUPPORT, the SCTP_SUPPORT kernel option must be configured
>>>   in order to support a loadable SCTP implementation.
>>>   
>>>   Discussed with:   tuexen
>>>   MFC after:2 weeks
>>>   Sponsored by: The FreeBSD Foundation
>>
>> Do you want to add similar handling to sys/conf/config.mk that we have
>> for IPsec?  Also, do we want to avoid building sctp.ko if it is in the
>> kernel like we do for ipsec.ko and/or only build it if the kernel contains
>> SCTP_SUPPORT?  (For ipsec.ko we had to do that as it wouldn't compile, not
>> sure if the same is true for sctp.ko)
> 
> Sorry for the delay.
> I think we do indeed want similar handling in config.mk, I will work on
> it.  It is probably also reasonable to avoid compiling sctp.ko when
> SCTP_SUPPORT is not defined, though I can't see a reason that wouldn't
> work today since SCTP_SUPPORT is not used in any headers.

Ok.  ipsec.ko mattered more when the build broke.  Whether or not we compile
"duplicate" modules for kernels is perhaps a larger question.  I think I
might favor that change, but it is a larger change that merits some thought.
In particular, you want good code coverage for things like LINT builds, so
maybe we really should still compile modules whenever possible.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362503 - head/share/man/man5

2020-06-22 Thread Hiroki Sato
Eugene Grosbein  wrote
  in <202006221752.05mhqend013...@repo.freebsd.org>:

eu> Author: eugen
eu> Date: Mon Jun 22 17:52:13 2020
eu> New Revision: 362503
eu> URL: https://svnweb.freebsd.org/changeset/base/362503
eu>
eu> Log:
eu>   Followup to r362502: rc.conf(5): unobsolete gif_interfaces
eu>
eu>   There are cases when gif_interfaces cannot be replaced
eu>   with cloned_interfaces, such as tunnels with external IPv6 addresses
eu>   and internal IPv4 or vice versa. Such configuration requires
eu>   extra invocation of ifconfig(8) and supported with gif_interfaces only.
eu>
eu>   Fix manual page and provide some examples.
eu>
eu>   MFC after:1 week
eu>   X-MFC-With:   362502

(snip)

eu> +Additionally, this option ensures that each listed interface is created
eu> +via the
eu> +.Cm create
eu> +option to
eu> +.Xr ifconfig
eu> +before attempting to configure it.
eu> +.Pp
eu>  For example, configure two
eu>  .Xr gif
eu>  interfaces with:
eu> -.Bd -literal -offset indent
eu> +.Bd -literal
eu>  gif_interfaces="gif0 gif1"
eu> -ifconfig_gif0="tunnel src_addr0 dst_addr0"
eu> -ifconfig_gif1="tunnel src_addr1 dst_addr1"
eu> +gifconfig_gif0="100.64.0.1 100.64.0.2"
eu> +ifconfig_gif0="inet 10.0.0.1 10.0.0.2 netmask 255.255.255.252"
eu> +gifconfig_gif1="inet6 2a00::1 2a01::1"
eu> +ifconfig_gif1="inet 10.1.0.1 10.1.0.2 netmask 255.255.255.252"

 These cases should be able to express by the following:

  ifconfig_gif0="inet 10.0.0.1 10.0.0.2 netmask 255.255.255.252"
  ifconfig_gif0_alias0="inet tunnel 100.64.0.1 100.64.0.2"

 and

  ifconfig_gif1="inet 10.0.0.1 10.0.0.2 netmask 255.255.255.252"
  ifconfig_gif1_ipv6="inet6 auto_linklocal"
  ifconfig_gif1_alias0="inet6 tunnel 2a00::1 2a01::1"

 Could you show more examples which cannot be covered by
 cloned_interfaces + ifconfig_*?  I lost track of the discussions in
 the past (sorry) but want to revisit this to understand what was the
 limitation because it should also affect gre(8) and other tunnel
 pseudo-interfaces.

-- Hiroki


pgpDVykp1HDGZ.pgp
Description: PGP signature


svn commit: r362503 - head/share/man/man5

2020-06-22 Thread Eugene Grosbein
Author: eugen
Date: Mon Jun 22 17:52:13 2020
New Revision: 362503
URL: https://svnweb.freebsd.org/changeset/base/362503

Log:
  Followup to r362502: rc.conf(5): unobsolete gif_interfaces
  
  There are cases when gif_interfaces cannot be replaced
  with cloned_interfaces, such as tunnels with external IPv6 addresses
  and internal IPv4 or vice versa. Such configuration requires
  extra invocation of ifconfig(8) and supported with gif_interfaces only.
  
  Fix manual page and provide some examples.
  
  MFC after:1 week
  X-MFC-With:   362502

Modified:
  head/share/man/man5/rc.conf.5

Modified: head/share/man/man5/rc.conf.5
==
--- head/share/man/man5/rc.conf.5   Mon Jun 22 17:25:21 2020
(r362502)
+++ head/share/man/man5/rc.conf.5   Mon Jun 22 17:52:13 2020
(r362503)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 8, 2020
+.Dd June 23, 2020
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -1862,46 +1862,35 @@ Even if this variable is specified to
 .Dq :nosticky
 keyword can be used to override it on per interface basis.
 .It Va gif_interfaces
-.Pq Vt str
-This variable is deprecated in favor of
-.Va cloned_interfaces .
 Set to the list of
 .Xr gif 4
 tunnel interfaces to configure on this host.
-For each
-.Xr gif
-tunnel interface, set a variable named
-.Va ifconfig_ Ns Aq Ar interface
-with the parameters for the
-.Xr ifconfig 8
-command to configure the link level for
-.Ar interface
-with the
-.Cm tunnel
-option.
+A
+.Va gifconfig_ Ns Aq Ar interface
+variable is assumed to exist for each value of
+.Ar interface .
 The value of this variable is used to configure the link layer of the
 tunnel using the
 .Cm tunnel
 option to
 .Xr ifconfig .
+Additionally, this option ensures that each listed interface is created
+via the
+.Cm create
+option to
+.Xr ifconfig
+before attempting to configure it.
+.Pp
 For example, configure two
 .Xr gif
 interfaces with:
-.Bd -literal -offset indent
+.Bd -literal
 gif_interfaces="gif0 gif1"
-ifconfig_gif0="tunnel src_addr0 dst_addr0"
-ifconfig_gif1="tunnel src_addr1 dst_addr1"
+gifconfig_gif0="100.64.0.1 100.64.0.2"
+ifconfig_gif0="inet 10.0.0.1 10.0.0.2 netmask 255.255.255.252"
+gifconfig_gif1="inet6 2a00::1 2a01::1"
+ifconfig_gif1="inet 10.1.0.1 10.1.0.2 netmask 255.255.255.252"
 .Ed
-.Pp
-Additionally, this option ensures that each listed interface is created
-via the
-.Cm create
-option to
-.Xr ifconfig .
-This example also works with
-.Va cloned_interfaces
-instead of
-.Va gif_interfaces .
 .It Va sppp_interfaces
 .Pq Vt str
 Set to the list of
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362502 - head/libexec/rc

2020-06-22 Thread Eugene Grosbein
Author: eugen
Date: Mon Jun 22 17:25:21 2020
New Revision: 362502
URL: https://svnweb.freebsd.org/changeset/base/362502

Log:
  network.subr: unobsolete gif_interfaces
  
  There are cases when gif_interfaces cannot be replaced
  with cloned_interfaces, such as tunnels with external IPv6 addresses
  and internal IPv4 or vice versa. Such configuration requires
  extra invocation of ifconfig(8) and supported with gif_interfaces only.
  
  MFC after:1 week

Modified:
  head/libexec/rc/network.subr

Modified: head/libexec/rc/network.subr
==
--- head/libexec/rc/network.subrMon Jun 22 16:05:00 2020
(r362501)
+++ head/libexec/rc/network.subrMon Jun 22 17:25:21 2020
(r362502)
@@ -1369,9 +1369,6 @@ clone_up()
fi
esac
done
-   if [ -n "$gif_interfaces" ]; then
-   warn "\$gif_interfaces is obsolete.  Use \$cloned_interfaces 
instead."
-   fi
for ifn in ${gif_interfaces}; do
# Parse ifn:ifopt.
OIFS=$IFS; IFS=:; set -- $ifn; ifn=$1; ifopt=$2; IFS=$OIFS
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362488 - in head: contrib/file/magic/Magdir contrib/tcpdump lib/geom/part stand/efi/include stand/i386/boot0 sys/dev/hptmv sys/geom/part usr.bin/fortune/datfiles usr.bin/mkimg usr.sbi

2020-06-22 Thread Pedro Giffuni



On 22/06/2020 02:58, Alexey Dokuchaev wrote:

On Mon, Jun 22, 2020 at 07:46:25AM +, Baptiste Daroussin wrote:

New Revision: 362488
URL: https://svnweb.freebsd.org/changeset/base/362488

Log:
   Revert r362466
   
   Such change should not have happen without prior discussion and review.

Thank you Baptiste.

./danfe

+1 Thank you
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362498 - head/sys/netinet

2020-06-22 Thread Michael Tuexen
Author: tuexen
Date: Mon Jun 22 14:36:14 2020
New Revision: 362498
URL: https://svnweb.freebsd.org/changeset/base/362498

Log:
  No need to include netinet/sctp_crc32.h twice.

Modified:
  head/sys/netinet/sctp_crc32.c

Modified: head/sys/netinet/sctp_crc32.c
==
--- head/sys/netinet/sctp_crc32.c   Mon Jun 22 14:01:31 2020
(r362497)
+++ head/sys/netinet/sctp_crc32.c   Mon Jun 22 14:36:14 2020
(r362498)
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 #include 
-#include 
 #include 
 #endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362497 - head/sys/netinet

2020-06-22 Thread Mark Johnston
Author: markj
Date: Mon Jun 22 14:01:31 2020
New Revision: 362497
URL: https://svnweb.freebsd.org/changeset/base/362497

Log:
  Move the definition of SCTP's system_base_info into sctp_crc32.c.
  
  This file is the only SCTP source file compiled into the kernel when
  SCTP_SUPPORT is configured.  sctp_delayed_checksum() references a couple
  of counters defined in system_base_info, so the change allows these
  counters to be referenced in a kernel compiled without "options SCTP".
  
  Submitted by: tuexen
  MFC with: r362338

Modified:
  head/sys/netinet/sctp_crc32.c
  head/sys/netinet/sctp_pcb.c

Modified: head/sys/netinet/sctp_crc32.c
==
--- head/sys/netinet/sctp_crc32.c   Mon Jun 22 12:36:05 2020
(r362496)
+++ head/sys/netinet/sctp_crc32.c   Mon Jun 22 14:01:31 2020
(r362497)
@@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#ifdef SCTP
+#if defined(SCTP) || defined(SCTP_SUPPORT)
 #include 
 #include 
 #include 
@@ -117,6 +117,9 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset)
 }
 
 #if defined(SCTP) || defined(SCTP_SUPPORT)
+
+VNET_DEFINE(struct sctp_base_info, system_base_info);
+
 /*
  * Compute and insert the SCTP checksum in network byte order for a given
  * mbuf chain m which contains an SCTP packet starting at offset.
@@ -127,10 +130,8 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset)
uint32_t checksum;
 
checksum = sctp_calculate_cksum(m, offset);
-#ifdef SCTP
SCTP_STAT_DECR(sctps_sendhwcrc);
SCTP_STAT_INCR(sctps_sendswcrc);
-#endif
offset += offsetof(struct sctphdr, checksum);
 
if (offset + sizeof(uint32_t) > (uint32_t)(m->m_pkthdr.len)) {

Modified: head/sys/netinet/sctp_pcb.c
==
--- head/sys/netinet/sctp_pcb.c Mon Jun 22 12:36:05 2020(r362496)
+++ head/sys/netinet/sctp_pcb.c Mon Jun 22 14:01:31 2020(r362497)
@@ -57,8 +57,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-VNET_DEFINE(struct sctp_base_info, system_base_info);
-
 /* FIX: we don't handle multiple link local scopes */
 /* "scopeless" replacement IN6_ARE_ADDR_EQUAL */
 #ifdef INET6
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362496 - in head: share/man/man4 sys/dev/acpi_support

2020-06-22 Thread Mark Johnston
Author: markj
Date: Mon Jun 22 12:36:05 2020
New Revision: 362496
URL: https://svnweb.freebsd.org/changeset/base/362496

Log:
  acpi_ibm(4): Add support for putting fans in disengaged mode.
  
  PR:   247306
  Submitted by: Ali Abdallah 
  MFC after:2 weeks

Modified:
  head/share/man/man4/acpi_ibm.4
  head/sys/dev/acpi_support/acpi_ibm.c

Modified: head/share/man/man4/acpi_ibm.4
==
--- head/share/man/man4/acpi_ibm.4  Mon Jun 22 11:03:36 2020
(r362495)
+++ head/share/man/man4/acpi_ibm.4  Mon Jun 22 12:36:05 2020
(r362496)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 19, 2015
+.Dd June 19, 2020
 .Dt ACPI_IBM 4
 .Os
 .Sh NAME
@@ -292,7 +292,12 @@ fan control might overheat the ThinkPad and lead to pe
 is not set accordingly.
 .It Va dev.acpi_ibm.0.fan_level
 Indicates at what speed the fan should run when being in manual mode.
-Values are ranging from 0 (off) to 7 (max).
+Valid values range from 0 (off) to 7 (max) and 8.
+Level 8 is used by the driver to set the fan in disengaged mode.
+In this mode, the fan is set to spin freely and will quickly reach a very
+high speed.
+Use this mode only if absolutely necessary, e.g., if the system has reached its
+critical temperature and it is about to shut down.
 The resulting speed differs from model to model.
 On a T41p this is as follows:
 .Pp
@@ -305,6 +310,8 @@ off
 ~3600 RPM
 .It Li 6, 7
 ~4300 RPM
+.It Li 8
+~6400 RPM (Full-speed, disengaged)
 .El
 .It Va dev.acpi_ibm.0.fan_speed
 (read-only)

Modified: head/sys/dev/acpi_support/acpi_ibm.c
==
--- head/sys/dev/acpi_support/acpi_ibm.cMon Jun 22 11:03:36 2020
(r362495)
+++ head/sys/dev/acpi_support/acpi_ibm.cMon Jun 22 12:36:05 2020
(r362496)
@@ -2,6 +2,7 @@
  * Copyright (c) 2004 Takanori Watanabe
  * Copyright (c) 2005 Markus Brueffer 
  * All rights reserved.
+ * Copyright (c) 2020 Ali Abdallah 
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -263,7 +264,8 @@ static struct {
{
.name   = "fan_level",
.method = ACPI_IBM_METHOD_FANLEVEL,
-   .description= "Fan level",
+   .description= "Fan level, 0-7 (recommended max), "
+ "8 (disengaged, full-speed)",
},
{
.name   = "fan",
@@ -829,7 +831,10 @@ acpi_ibm_sysctl_get(struct acpi_ibm_softc *sc, int met
 */
if (!sc->fan_handle) {
ACPI_EC_READ(sc->ec_dev, IBM_EC_FANSTATUS, _ec, 1);
-   val = val_ec & IBM_EC_MASK_FANLEVEL;
+   if (val_ec & IBM_EC_MASK_FANDISENGAGED)
+   val = 8;
+   else
+   val = val_ec & IBM_EC_MASK_FANLEVEL;
}
break;
 
@@ -912,15 +917,23 @@ acpi_ibm_sysctl_set(struct acpi_ibm_softc *sc, int met
break;
 
case ACPI_IBM_METHOD_FANLEVEL:
-   if (arg < 0 || arg > 7)
+   if (arg < 0 || arg > 8)
return (EINVAL);
 
if (!sc->fan_handle) {
-   /* Read the current fanstatus */
+   /* Read the current fan status. */
ACPI_EC_READ(sc->ec_dev, IBM_EC_FANSTATUS, _ec, 1);
-   val = val_ec & (~IBM_EC_MASK_FANLEVEL);
+   val = val_ec & ~(IBM_EC_MASK_FANLEVEL |
+   IBM_EC_MASK_FANDISENGAGED);
 
-   return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_FANSTATUS, val 
| arg, 1);
+   if (arg == 8)
+   /* Full speed, set the disengaged bit. */
+   val |= 7 | IBM_EC_MASK_FANDISENGAGED;
+   else
+   val |= arg;
+
+   return (ACPI_EC_WRITE(sc->ec_dev, IBM_EC_FANSTATUS, val,
+   1));
}
break;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362495 - head/lib/libc/string

2020-06-22 Thread Piotr Pawel Stefaniak
Author: pstef
Date: Mon Jun 22 11:03:36 2020
New Revision: 362495
URL: https://svnweb.freebsd.org/changeset/base/362495

Log:
  strtok(3): make it easier to find the RETURN VALUES section
  
  MFC after:1 week

Modified:
  head/lib/libc/string/strtok.3

Modified: head/lib/libc/string/strtok.3
==
--- head/lib/libc/string/strtok.3   Mon Jun 22 10:52:30 2020
(r362494)
+++ head/lib/libc/string/strtok.3   Mon Jun 22 11:03:36 2020
(r362495)
@@ -97,7 +97,7 @@ The
 function
 may also be used to nest two parsing loops within one another, as
 long as separate context pointers are used.
-.Pp
+.Sh RETURN VALUES
 The
 .Fn strtok
 and
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362493 - head/sys/dev/pci

2020-06-22 Thread Andrew Turner
Author: andrew
Date: Mon Jun 22 10:49:50 2020
New Revision: 362493
URL: https://svnweb.freebsd.org/changeset/base/362493

Log:
  Translaate the PCI address when activating a resource
  
  When the PCI address != physical address we need to translate from the
  former to the latter before passing to the parent to map into the kernels
  virtual address space.
  
  Sponsored by: Innovate UK

Modified:
  head/sys/dev/pci/pci_host_generic.c

Modified: head/sys/dev/pci/pci_host_generic.c
==
--- head/sys/dev/pci/pci_host_generic.c Mon Jun 22 10:32:41 2020
(r362492)
+++ head/sys/dev/pci/pci_host_generic.c Mon Jun 22 10:49:50 2020
(r362493)
@@ -324,13 +324,11 @@ pci_host_generic_core_release_resource(device_t dev, d
return (bus_generic_release_resource(dev, child, type, rid, res));
 }
 
-struct resource *
-pci_host_generic_core_alloc_resource(device_t dev, device_t child, int type,
-int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
+static bool
+generic_pcie_translate_resource(device_t dev, int type, rman_res_t start,
+rman_res_t end, rman_res_t *new_start, rman_res_t *new_end)
 {
struct generic_pcie_core_softc *sc;
-   struct resource *res;
-   struct rman *rm;
uint64_t phys_base;
uint64_t pci_base;
uint64_t size;
@@ -338,19 +336,6 @@ pci_host_generic_core_alloc_resource(device_t dev, dev
bool found;
 
sc = device_get_softc(dev);
-
-#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
-   if (type == PCI_RES_BUS) {
-   return (pci_domain_alloc_bus(sc->ecam, child, rid, start, end,
-   count, flags));
-   }
-#endif
-
-   rm = generic_pcie_rman(sc, type, flags);
-   if (rm == NULL)
-   return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child,
-   type, rid, start, end, count, flags));
-
/* Translate the address from a PCI address to a physical address */
switch (type) {
case SYS_RES_IOPORT:
@@ -378,25 +363,57 @@ pci_host_generic_core_alloc_resource(device_t dev, dev
}
 
if (type == space) {
-   start = start - pci_base + phys_base;
-   end = end - pci_base + phys_base;
+   *new_start = start - pci_base + phys_base;
+   *new_end = end - pci_base + phys_base;
found = true;
break;
}
}
-   if (!found) {
-   device_printf(dev,
-   "Failed to allocate %s resource %jx-%jx for %s\n",
-   type == SYS_RES_IOPORT ? "IOPORT" : "MEMORY",
-   (uintmax_t)start, (uintmax_t)end,
-   device_get_nameunit(child));
-   return (NULL);
-   }
break;
default:
+   /* No translation for non-memory types */
+   *new_start = start;
+   *new_end = end;
+   found = true;
break;
}
 
+   return (found);
+}
+
+struct resource *
+pci_host_generic_core_alloc_resource(device_t dev, device_t child, int type,
+int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
+{
+   struct generic_pcie_core_softc *sc;
+   struct resource *res;
+   struct rman *rm;
+   rman_res_t phys_start, phys_end;
+
+   sc = device_get_softc(dev);
+
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   if (type == PCI_RES_BUS) {
+   return (pci_domain_alloc_bus(sc->ecam, child, rid, start, end,
+   count, flags));
+   }
+#endif
+
+   rm = generic_pcie_rman(sc, type, flags);
+   if (rm == NULL)
+   return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child,
+   type, rid, start, end, count, flags));
+
+   /* Translate the address from a PCI address to a physical address */
+   if (!generic_pcie_translate_resource(dev, type, start, end, _start,
+   _end)) {
+   device_printf(dev,
+   "Failed to translate resource %jx-%jx type %x for %s\n",
+   (uintmax_t)start, (uintmax_t)end, type,
+   device_get_nameunit(child));
+   return (NULL);
+   }
+
if (bootverbose) {
device_printf(dev,
"rman_reserve_resource: start=%#jx, end=%#jx, count=%#jx\n",
@@ -430,12 +447,21 @@ generic_pcie_activate_resource(device_t dev, device_t 
 int rid, struct resource *r)
 {
struct generic_pcie_core_softc *sc;
+   rman_res_t start, end;
int res;
 
sc = device_get_softc(dev);
 
if ((res = rman_activate_resource(r)) != 0)

svn commit: r362492 - head/sys/dev/gpio

2020-06-22 Thread Andriy Gapon
Author: avg
Date: Mon Jun 22 10:32:41 2020
New Revision: 362492
URL: https://svnweb.freebsd.org/changeset/base/362492

Log:
  gpiobus_release_pin: remove incorrect prefix from error messages
  
  It's interesting that similar messages from gpiobus_acquire_pin never
  had any prefix while gpiobus_release_pin messages were prefixed with
  "gpiobus_acquire_pin".
  Anyway, the prefix is not that useful and can be deduced from context.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/gpio/gpiobus.c

Modified: head/sys/dev/gpio/gpiobus.c
==
--- head/sys/dev/gpio/gpiobus.c Mon Jun 22 10:01:24 2020(r362491)
+++ head/sys/dev/gpio/gpiobus.c Mon Jun 22 10:32:41 2020(r362492)
@@ -421,13 +421,13 @@ gpiobus_release_pin(device_t bus, uint32_t pin)
/* Consistency check. */
if (pin >= sc->sc_npins) {
device_printf(bus,
-   "gpiobus_acquire_pin: invalid pin %d, max=%d\n",
+   "invalid pin %d, max=%d\n",
pin, sc->sc_npins - 1);
return (-1);
}
 
if (!sc->sc_pins[pin].mapped) {
-   device_printf(bus, "gpiobus_acquire_pin: pin %d is not 
mapped\n", pin);
+   device_printf(bus, "pin %d is not mapped\n", pin);
return (-1);
}
sc->sc_pins[pin].mapped = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362491 - head/sbin/rcorder

2020-06-22 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Mon Jun 22 10:01:24 2020
New Revision: 362491
URL: https://svnweb.freebsd.org/changeset/base/362491

Log:
  Improve the rcorder manual page
  
  - Fix formatting issues such as:
- Use Ql instead of Dq Li as Li is deprecated
- Address some mandoc warnings
  - Add arguments missing from the list of options (i.e., document "-k keep"
instead of just "-k").
  - Document that -k and -s can be specified multiple times
  - Use sshd instead of named for the example in the BUGS section, as named
is not in the base system. Also, use Nm instead of Xr there as it is not
the sshd binary that is required to be running, but the service.
  - Use Sy instead of Cm for KEYWORDS. Cm is reserved for command-line
modifiers of the CLI.
  - Add an EXAMPLES section
  - Cross-reference service(8).
  
  MFC after:2 weeks

Modified:
  head/sbin/rcorder/rcorder.8

Modified: head/sbin/rcorder/rcorder.8
==
--- head/sbin/rcorder/rcorder.8 Mon Jun 22 08:23:16 2020(r362490)
+++ head/sbin/rcorder/rcorder.8 Mon Jun 22 10:01:24 2020(r362491)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 27, 2018
+.Dd June 22, 2020
 .Dt RCORDER 8
 .Os
 .Sh NAME
@@ -62,30 +62,30 @@ and which indicate, for each file, which
 may be expected to be filled by that file.
 .Pp
 Within each file, a block containing a series of
-.Dq Li REQUIRE ,
-.Dq Li PROVIDE ,
-.Dq Li BEFORE
+.Ql REQUIRE ,
+.Ql PROVIDE ,
+.Ql BEFORE
 and
-.Dq Li KEYWORD
+.Ql KEYWORD
 lines must appear.
 The format of the lines is rigid.
 Each line must begin with a single
 .Ql # ,
 followed by a single space, followed by
-.Dq Li PROVIDE: ,
-.Dq Li REQUIRE: ,
-.Dq Li BEFORE: ,
+.Ql PROVIDE\&: ,
+.Ql REQUIRE\&: ,
+.Ql BEFORE\&: ,
 or
-.Dq Li KEYWORD: .
+.Ql KEYWORD\&: .
 No deviation is permitted.
 Each dependency line is then followed by a series of conditions,
 separated by whitespace.
 Multiple
-.Dq Li PROVIDE ,
-.Dq Li REQUIRE ,
-.Dq Li BEFORE
+.Ql PROVIDE ,
+.Ql REQUIRE ,
+.Ql BEFORE
 and
-.Dq Li KEYWORD
+.Ql KEYWORD
 lines may appear, but all such lines must appear in a sequence without
 any intervening lines, as once a line that does not follow the format
 is reached, parsing stops.
@@ -94,19 +94,21 @@ is reached, parsing stops.
 .\" that they can be deprecated at some point in the future.
 .Pp
 The options are as follows:
-.Bl -tag -width indent
-.It Fl k
+.Bl -tag -width "-k keep"
+.It Fl k Ar keep
 Add the specified keyword to the
 .Dq "keep list" .
 If any
 .Fl k
 option is given, only those files containing the matching keyword are listed.
-.It Fl s
+This option can be specified multiple times.
+.It Fl s Ar skip
 Add the specified keyword to the
 .Dq "skip list" .
 If any
 .Fl s
 option is given, files containing the matching keyword are not listed.
+This option can be specified multiple times.
 .El
 .Pp
 An example block follows:
@@ -117,20 +119,20 @@ An example block follows:
 .Ed
 .Pp
 This block states that the file in which it appears depends upon the
-.Dq Li networking ,
-.Dq Li syslog ,
+.Ql networking ,
+.Ql syslog ,
 and
-.Dq Li usr
+.Ql usr
 conditions, and provides the
-.Dq Li dns
+.Ql dns
 and
-.Dq Li nscd
+.Ql nscd
 conditions.
 .Pp
 A file may contain zero
-.Dq Li PROVIDE
+.Ql PROVIDE
 lines, in which case it provides no conditions, and may contain zero
-.Dq Li REQUIRE
+.Ql REQUIRE
 lines, in which case it has no dependencies.
 There must be at least one file with no dependencies in the set of
 arguments passed to
@@ -140,19 +142,36 @@ in order for it to find a starting place in the depend
 There are several
 .Em KEYWORDs
 in use:
-.Bl -tag -width ".Cm shutdown" -offset indent
-.It Cm firstboot, nojail, nojailvnet, nostart
+.Bl -tag -width "shutdown" -offset indent
+.It Sy firstboot , nojail , nojailvnet , nostart
 Used by
 .Xr rc 8 .
-.It Cm resume
+.It Sy resume
 Used by
 .Nm /etc/rc.resume
 (see
 .Xr acpiconf 8 )
-.It Cm shutdown
+.It Sy shutdown
 Used by
 .Xr rc.shutdown 8 .
 .El
+.Sh EXAMPLES
+Print the dependency ordering of the services from the base system and
+.Xr ports 7 :
+.Bd -literal -offset indent
+$ rcorder /etc/rc.d/* /usr/local/etc/rc.d/*
+.Ed
+.Pp
+Count the number of services in the base system, which specify the
+.Sy shutdown
+keyword, while skipping those with
+.Sy firstboot
+and
+.Sy nojailvnet :
+.Bd -literal -offset indent
+$ rcorder -k nostart -s firstboot -s nojailvnet /etc/rc.d/*  | wc -l
+   3
+.Ed
 .Sh DIAGNOSTICS
 The
 .Nm
@@ -161,9 +180,9 @@ status if it encounters an error while processing the 
 .Bl -diag
 .It "Requirement %s has no providers, aborting."
 No file has a
-.Dq Li PROVIDE
+.Ql PROVIDE
 line corresponding to a condition present in a
-.Dq Li REQUIRE
+.Ql REQUIRE
 line in another file.
 .It "Circular dependency on provision %s, aborting."
 A set of files has a circular dependency which was detected while
@@ -175,7 +194,8 @@ processing the stated file.
 .Sh SEE ALSO

Re: svn commit: r362452 - in head: contrib/xz/src/liblzma/check lib/liblzma share/mk

2020-06-22 Thread Yuri Pankov

Ruslan Garipov wrote:

On 6/21/2020 2:32 AM, Xin LI wrote:

Author: delphij
Date: Sat Jun 20 21:32:07 2020
New Revision: 362452
URL: https://svnweb.freebsd.org/changeset/base/362452

Log:
   liblzma: Make liblzma use libmd implementation of SHA256.

I'm trying to update from r362172 (GENERIC-NODEBUG) to r362468 (a custom
KERNCONF), and failing on buildworld:

[...]

I think kevans took care of it in r362478.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362452 - in head: contrib/xz/src/liblzma/check lib/liblzma share/mk

2020-06-22 Thread Ruslan Garipov
On 6/21/2020 2:32 AM, Xin LI wrote:
> Author: delphij
> Date: Sat Jun 20 21:32:07 2020
> New Revision: 362452
> URL: https://svnweb.freebsd.org/changeset/base/362452
> 
> Log:
>   liblzma: Make liblzma use libmd implementation of SHA256.
I'm trying to update from r362172 (GENERIC-NODEBUG) to r362468 (a custom
KERNCONF), and failing on buildworld:

===> lib/liblzma (obj,all,install)
make[4]: /usr/obj/usr/src/i386.i386/lib/liblzma/.depend, 1: ignoring
stale .depend for /usr/obj/usr/src/i386.i386/tmp/usr/lib/libmd.a
building shared library liblzma.so.5
cc -target i386-unknown-freebsd13.0
--sysroot=/usr/obj/usr/src/i386.i386/tmp ... tsort -q` -lmd -lpthread

ld: error: unable to find library -lmd
cc: error: linker command failed with exit code 1 (use -v to see
invocation)
*** Error code 1

Stop.
make[4]: stopped in /usr/src/lib/liblzma

As I've already mentioned I run FreeBSD 13.0-CURRENT x86 r362172
GENERIC-NODEBUG.  The kernel/user land were built with the default
kernel config and empty make.conf and src.conf.  Now I'm trying to
update to r362468 with custom kernel config, make.conf and src.conf.
What should I show you from those files in order you can help me to fix
the error?  I just don't understand why libmd isn't built.  Because the
library currently exists as /lib/libmd.so.6 (therefore, it was build on
the previous update to r362172), I believe I missed something in my
config files.

Thanks!

>   
>   MFC after:  2 weeks
>   PR: 200142
> 
> Deleted:
>   head/contrib/xz/src/liblzma/check/sha256.c
> Modified:
>   head/lib/liblzma/Makefile
>   head/lib/liblzma/Symbol.map
>   head/lib/liblzma/config.h
>   head/share/mk/src.libnames.mk
> 
> Modified: head/lib/liblzma/Makefile
> ==
> --- head/lib/liblzma/Makefile Sat Jun 20 21:06:02 2020(r362451)
> +++ head/lib/liblzma/Makefile Sat Jun 20 21:32:07 2020(r362452)
> @@ -78,8 +78,7 @@ SRCS+=  common.c \
>  .PATH: ${LZMADIR}/check
>  SRCS+=   check.c \
>   crc32_table.c \
> - crc64_table.c \
> - sha256.c
> + crc64_table.c
>  .if defined(MACHINE_ARCH) && ${MACHINE_ARCH} == "i386"
>  SRCS+=   crc32_x86.S \
>   crc64_x86.S
> @@ -125,11 +124,11 @@ SRCS+=  simple_coder.c \
>  
>  .PATH: ${LZMADIR}
>  
> -VERSION_MAJOR!=  awk '$$1 == "\#define" && $$2 == "LZMA_VERSION_MAJOR" 
> {print $$3 } ' \
> +VERSION_MAJOR!=  sed -n '/define.*LZMA_VERSION_MAJOR/{s,[^0-9.],,gp;q;}' 
> \
>   ${LZMADIR}/api/lzma/version.h
> -VERSION_MINOR!=  awk '$$1 == "\#define" && $$2 == "LZMA_VERSION_MINOR" 
> {print $$3 } ' \
> +VERSION_MINOR!=  sed -n '/define.*LZMA_VERSION_MINOR/{s,[^0-9.],,gp;q;}' 
> \
>   ${LZMADIR}/api/lzma/version.h
> -VERSION_PATCH!=  awk '$$1 == "\#define" && $$2 == "LZMA_VERSION_PATCH" 
> {print $$3 } ' \
> +VERSION_PATCH!=  sed -n '/define.*LZMA_VERSION_PATCH/{s,[^0-9.],,gp;q;}' 
> \
>   ${LZMADIR}/api/lzma/version.h
>  
>  WARNS?=  3
> @@ -147,7 +146,7 @@ CFLAGS+=  -DHAVE_CONFIG_H \
>   -I${LZMADIR}/simple \
>   -I${LZMADIR:H}/common
>  
> -LIBADD+= pthread
> +LIBADD+= md pthread
>  
>  VERSION_DEF= ${.CURDIR}/Versions.def
>  SYMBOL_MAPS= ${.CURDIR}/Symbol.map
> @@ -160,10 +159,11 @@ FILESDIR=   ${LIBDATADIR}/pkgconfig
>  
>  liblzma.pc: liblzma.pc.in
>   sed -e 's,@prefix@,/usr,g ; \
> - s,@exec_prefix@,/usr,g  ; \
> + s,@exec_prefix@,/usr,g ; \
>   s,@libdir@,/usr/lib,g ; \
>   s,@includedir@,/usr/include,g ; \
> - s,@PACKAGE_URL@,http://tukaani.org/xz/,g ; \
> + s,@LIBS@,-pthread -lmd,g ; \
> + s,@PACKAGE_URL@,https://tukaani.org/xz/,g ; \
>   
> s,@PACKAGE_VERSION@,${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH},g ; \
>   s,@PTHREAD_CFLAGS@,,g ; \
>   s,@PTHREAD_LIBS@,,g' ${.ALLSRC} > ${.TARGET}
> 
> Modified: head/lib/liblzma/Symbol.map
> ==
> --- head/lib/liblzma/Symbol.map   Sat Jun 20 21:06:02 2020
> (r362451)
> +++ head/lib/liblzma/Symbol.map   Sat Jun 20 21:32:07 2020
> (r362452)
> @@ -180,9 +180,6 @@ XZprivate_1.0 {
>   lzma_raw_coder_memusage;
>   lzma_raw_decoder_init;
>   lzma_raw_encoder_init;
> - lzma_sha256_finish;
> - lzma_sha256_init;
> - lzma_sha256_update;
>   lzma_simple_arm_decoder_init;
>   lzma_simple_arm_encoder_init;
>   lzma_simple_armthumb_decoder_init;
> 
> Modified: head/lib/liblzma/config.h
> ==
> --- head/lib/liblzma/config.h Sat Jun 20 21:06:02 2020(r362451)
> +++ head/lib/liblzma/config.h Sat Jun 20 21:32:07 2020(r362452)
> @@ -211,16 +211,13 @@
>  /* #undef HAVE_SHA256INIT */
>  
>  /* Define to 1 if the system has the type 

svn commit: r362490 - head/sys/fs/nfs

2020-06-22 Thread Doug Rabson
Author: dfr
Date: Mon Jun 22 08:23:16 2020
New Revision: 362490
URL: https://svnweb.freebsd.org/changeset/base/362490

Log:
  Add some missing parts for supporting va_birthtime.
  
  Reviewed by:  rmacklem

Modified:
  head/sys/fs/nfs/nfs_commonsubs.c
  head/sys/fs/nfs/nfsport.h
  head/sys/fs/nfs/nfsproto.h

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==
--- head/sys/fs/nfs/nfs_commonsubs.cMon Jun 22 08:12:21 2020
(r362489)
+++ head/sys/fs/nfs/nfs_commonsubs.cMon Jun 22 08:23:16 2020
(r362490)
@@ -594,6 +594,8 @@ nfscl_fillsattr(struct nfsrv_descript *nd, struct vatt
NFSSETBIT_ATTRBIT(, NFSATTRBIT_TIMEACCESSSET);
if (vap->va_mtime.tv_sec != VNOVAL)
NFSSETBIT_ATTRBIT(, NFSATTRBIT_TIMEMODIFYSET);
+   if (vap->va_birthtime.tv_sec != VNOVAL)
+   NFSSETBIT_ATTRBIT(, NFSATTRBIT_TIMECREATE);
(void) nfsv4_fillattr(nd, vp->v_mount, vp, NULL, vap, NULL, 0,
, NULL, NULL, 0, 0, 0, 0, (uint64_t)0, NULL);
break;
@@ -2043,8 +2045,15 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,
break;
case NFSATTRBIT_TIMECREATE:
NFSM_DISSECT(tl, u_int32_t *, NFSX_V4TIME);
-   if (compare && !(*retcmpp))
-   *retcmpp = NFSERR_ATTRNOTSUPP;
+   fxdr_nfsv4time(tl, );
+   if (compare) {
+   if (!(*retcmpp)) {
+   if (!NFS_CMPTIME(temptime, nap->na_btime))
+   *retcmpp = NFSERR_NOTSAME;
+   }
+   } else if (nap != NULL) {
+   nap->na_btime = temptime;
+   }
attrsum += NFSX_V4TIME;
break;
case NFSATTRBIT_TIMEDELTA:

Modified: head/sys/fs/nfs/nfsport.h
==
--- head/sys/fs/nfs/nfsport.h   Mon Jun 22 08:12:21 2020(r362489)
+++ head/sys/fs/nfs/nfsport.h   Mon Jun 22 08:23:16 2020(r362490)
@@ -649,6 +649,7 @@ struct nfsvattr {
 #definena_atimena_vattr.va_atime
 #definena_mtimena_vattr.va_mtime
 #definena_ctimena_vattr.va_ctime
+#definena_btimena_vattr.va_birthtime
 #definena_gen  na_vattr.va_gen
 #definena_flagsna_vattr.va_flags
 #definena_rdev na_vattr.va_rdev

Modified: head/sys/fs/nfs/nfsproto.h
==
--- head/sys/fs/nfs/nfsproto.h  Mon Jun 22 08:12:21 2020(r362489)
+++ head/sys/fs/nfs/nfsproto.h  Mon Jun 22 08:23:16 2020(r362490)
@@ -1127,6 +1127,7 @@ struct nfsv3_sattr {
NFSATTRBM_SPACETOTAL |  \
NFSATTRBM_SPACEUSED |   \
NFSATTRBM_TIMEACCESS |  \
+   NFSATTRBM_TIMECREATE |  \
NFSATTRBM_TIMEDELTA |   \
NFSATTRBM_TIMEMETADATA |\
NFSATTRBM_TIMEMODIFY |  \
@@ -1176,6 +1177,7 @@ struct nfsv3_sattr {
(NFSATTRBM_MODE |   \
NFSATTRBM_OWNER |   \
NFSATTRBM_OWNERGROUP |  \
+   NFSATTRBM_TIMECREATE |  \
NFSATTRBM_TIMEACCESSSET |   \
NFSATTRBM_TIMEMODIFYSET)
 #defineNFSATTRBIT_SETABLE2 
\
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362489 - head/sys/arm/broadcom/bcm2835

2020-06-22 Thread Andrew Turner
Author: andrew
Date: Mon Jun 22 08:12:21 2020
New Revision: 362489
URL: https://svnweb.freebsd.org/changeset/base/362489

Log:
  Fix reboot command on the Raspberry Pi series.
  
  The Raspbery Pi computers do not properly implement PSCI. The canonical
  way to reset them is to set a watchdog timer and allow it to expire.
  
  Submitted by: Robert Crowston 
  Differential Revision:https://reviews.freebsd.org/D25268

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_wdog.cMon Jun 22 07:46:24 
2020(r362488)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_wdog.cMon Jun 22 08:12:21 
2020(r362489)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -89,10 +90,12 @@ struct bcmwd_softc {
 static struct ofw_compat_data compat_data[] = {
{"broadcom,bcm2835-wdt",BSD_DTB},
{"brcm,bcm2835-pm-wdt", UPSTREAM_DTB},
+   {"brcm,bcm2835-pm", UPSTREAM_DTB},
{NULL,  0}
 };
 
 static void bcmwd_watchdog_fn(void *private, u_int cmd, int *error);
+static void bcmwd_reboot_system(void *, int);
 
 static int
 bcmwd_probe(device_t dev)
@@ -143,6 +146,15 @@ bcmwd_attach(device_t dev)
mtx_init(>mtx, "BCM2835 Watchdog", "bcmwd", MTX_DEF);
EVENTHANDLER_REGISTER(watchdog_list, bcmwd_watchdog_fn, sc, 0);
 
+   /*
+* Handle reboot events. This needs to happen with slightly greater
+* priority than the PSCI handler, since PSCI reset is not properly
+* implemented on the Pi and it just puts the Pi into a halt
+* state.
+*/
+   EVENTHANDLER_REGISTER(shutdown_final, bcmwd_reboot_system, sc,
+   SHUTDOWN_PRI_LAST-1);
+
return (0);
 }
 
@@ -161,16 +173,17 @@ bcmwd_watchdog_fn(void *private, u_int cmd, int *error
if (cmd > 0) {
sec = ((uint64_t)1 << (cmd & WD_INTERVAL)) / 10;
if (sec == 0 || sec > 15) {
-   /* 
+   /*
 * Can't arm
 * disable watchdog as watchdog(9) requires
 */
device_printf(sc->dev,
"Can't arm, timeout must be between 1-15 
seconds\n");
-   WRITE(sc, BCM2835_RSTC_REG, 
+   WRITE(sc, BCM2835_RSTC_REG,
(BCM2835_PASSWORD << BCM2835_PASSWORD_SHIFT) |
BCM2835_RSTC_RESET);
mtx_unlock(>mtx);
+   *error = EINVAL;
return;
}
 
@@ -187,7 +200,7 @@ bcmwd_watchdog_fn(void *private, u_int cmd, int *error
*error = 0;
}
else
-   WRITE(sc, BCM2835_RSTC_REG, 
+   WRITE(sc, BCM2835_RSTC_REG,
(BCM2835_PASSWORD << BCM2835_PASSWORD_SHIFT) |
BCM2835_RSTC_RESET);
 
@@ -208,6 +221,27 @@ bcmwd_watchdog_reset(void)
(READ(bcmwd_lsc, BCM2835_RSTC_REG) & BCM2835_RSTC_WRCFG_CLR) |
(BCM2835_PASSWORD << BCM2835_PASSWORD_SHIFT) |
BCM2835_RSTC_WRCFG_FULL_RESET);
+}
+
+static void
+bcmwd_reboot_system(void *sc, int howto)
+{
+   int cmd, error = 0;
+
+   /* Only handle reset. */
+   if (howto & RB_HALT || howto & RB_POWEROFF)
+   return;
+
+   printf("Resetting system ... ");
+
+   cmd = WD_TO_1SEC;
+   bcmwd_watchdog_fn(sc, cmd, );
+
+   /* Wait for watchdog timeout. */
+   DELAY(200);
+
+   /* Not reached ... one hopes. */
+   printf("failed to reset (errno %d).\n", error);
 }
 
 static device_method_t bcmwd_methods[] = {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362488 - in head: contrib/file/magic/Magdir contrib/tcpdump lib/geom/part stand/efi/include stand/i386/boot0 sys/dev/hptmv sys/geom/part usr.bin/fortune/datfiles usr.bin/mkimg usr.sbi

2020-06-22 Thread Alexey Dokuchaev
On Mon, Jun 22, 2020 at 07:46:25AM +, Baptiste Daroussin wrote:
> New Revision: 362488
> URL: https://svnweb.freebsd.org/changeset/base/362488
> 
> Log:
>   Revert r362466
>   
>   Such change should not have happen without prior discussion and review.

Thank you Baptiste.

./danfe
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362488 - in head: contrib/file/magic/Magdir contrib/tcpdump lib/geom/part stand/efi/include stand/i386/boot0 sys/dev/hptmv sys/geom/part usr.bin/fortune/datfiles usr.bin/mkimg usr.sbin...

2020-06-22 Thread Baptiste Daroussin
Author: bapt
Date: Mon Jun 22 07:46:24 2020
New Revision: 362488
URL: https://svnweb.freebsd.org/changeset/base/362488

Log:
  Revert r362466
  
  Such change should not have happen without prior discussion and review.
  
  With hat: transitioning core

Modified:
  head/contrib/file/magic/Magdir/filesystems
  head/contrib/tcpdump/smbutil.c
  head/lib/geom/part/gpart.8
  head/stand/efi/include/efipart.h
  head/stand/i386/boot0/boot0.S
  head/sys/dev/hptmv/vdevice.h
  head/sys/geom/part/g_part_mbr.c
  head/usr.bin/fortune/datfiles/freebsd-tips
  head/usr.bin/mkimg/mbr.c
  head/usr.sbin/boot0cfg/boot0cfg.8
  head/usr.sbin/boot0cfg/boot0cfg.c

Modified: head/contrib/file/magic/Magdir/filesystems
==
--- head/contrib/file/magic/Magdir/filesystems  Mon Jun 22 07:35:23 2020
(r362487)
+++ head/contrib/file/magic/Magdir/filesystems  Mon Jun 22 07:46:24 2020
(r362488)
@@ -269,8 +269,8 @@
 !:strength +65
 >2 string  OSBSOS/BS MBR
 # added by Joerg Jenderek at Feb 2013 according to 
https://thestarman.pcministry.com/asm/mbr/
-# and https://en.wikipedia.org/wiki/Main_Boot_Record
-# test for nearly all MS-DOS Main Boot Record initial program loader (IPL) is 
now done by
+# and https://en.wikipedia.org/wiki/Master_Boot_Record
+# test for nearly all MS-DOS Master Boot Record initial program loader (IPL) 
is now done by
 # characteristic assembler instructions: xor ax,ax;mov ss,ax;mov sp,7c00
 >0 search/2\x33\xc0\x8e\xd0\xbc\x00\x7cMS-MBR
 # Microsoft Windows 95A and early ( 
https://thestarman.pcministry.com/asm/mbr/STDMBR.htm )
@@ -436,7 +436,7 @@
 >>>387 string  Copyright\ (c)\ 1984,1998
 411string  Caldera\ Inc.\0 \b, DR-DOS MBR (IBMBIO.LDR)
 #
-# tests for different MS-DOS Main Boot Records (MBR) moved and merged
+# tests for different MS-DOS Master Boot Records (MBR) moved and merged
 #
 #>0x145string  Default:\ F \b, FREE-DOS MBR
 #>0x14Bstring  Default:\ F \b, FREE-DOS 
1.0 MBR
@@ -1087,7 +1087,7 @@
 >11ubyte   x   \b+
 >11use DOS-filename
 
-# https://en.wikipedia.org/wiki/Main_boot_record#PTE
+# https://en.wikipedia.org/wiki/Master_boot_record#PTE
 # display standard partition table
 0  namepartition-table
 #>0ubyte   x   PARTITION-TABLE

Modified: head/contrib/tcpdump/smbutil.c
==
--- head/contrib/tcpdump/smbutil.c  Mon Jun 22 07:35:23 2020
(r362487)
+++ head/contrib/tcpdump/smbutil.c  Mon Jun 22 07:46:24 2020
(r362488)
@@ -1339,7 +1339,7 @@ static const nt_err_code_struct nt_errors[] = {
   { 0xC0A6, "STATUS_CANT_OPEN_ANONYMOUS" },
   { 0xC0A7, "STATUS_BAD_VALIDATION_CLASS" },
   { 0xC0A8, "STATUS_BAD_TOKEN_TYPE" },
-  { 0xC0A9, "STATUS_BAD_MAIN_BOOT_RECORD" },
+  { 0xC0A9, "STATUS_BAD_MASTER_BOOT_RECORD" },
   { 0xC0AA, "STATUS_INSTRUCTION_MISALIGNMENT" },
   { 0xC0AB, "STATUS_INSTANCE_NOT_AVAILABLE" },
   { 0xC0AC, "STATUS_PIPE_NOT_AVAILABLE" },

Modified: head/lib/geom/part/gpart.8
==
--- head/lib/geom/part/gpart.8  Mon Jun 22 07:35:23 2020(r362487)
+++ head/lib/geom/part/gpart.8  Mon Jun 22 07:46:24 2020(r362488)
@@ -582,7 +582,7 @@ Requires the
 .Cm GEOM_PART_GPT
 kernel option.
 .It Cm MBR
-Main Boot Record is used on PCs and removable media.
+Master Boot Record is used on PCs and removable media.
 Requires the
 .Cm GEOM_PART_MBR
 kernel option.
@@ -852,7 +852,7 @@ for MBR and
 .Qq Li "!0657fd6d-a4ab-43c4-84e5-0933c84b4f4f"
 for GPT.
 .It Cm mbr
-A partition that is sub-partitioned by a Main Boot Record (MBR).
+A partition that is sub-partitioned by a Master Boot Record (MBR).
 This type is known as
 .Qq Li "!024dee41-33e7-11d3-9d69-0008c781f39f"
 by GPT.
@@ -1020,7 +1020,7 @@ option.
 The GEOM PART class knows how to safely embed bootstrap code into
 specific partitioning scheme metadata without causing any damage.
 .Pp
-The Main Boot Record (MBR) uses a 512-byte bootstrap code image, embedded
+The Master Boot Record (MBR) uses a 512-byte bootstrap code image, embedded
 into the partition table's metadata area.
 There are two variants of this bootstrap code:
 .Pa /boot/mbr
@@ -1256,7 +1256,7 @@ present as independent partition.
 .Em NOTE :
 This may break a mirrored volume and lead to data damage.
 .It Va kern.geom.part.mbr.enforce_chs : No 0
-Specify how the Main Boot Record (MBR) module does alignment.
+Specify how the Master Boot Record (MBR) module does alignment.
 If this variable is set to a non-zero value, the module will automatically
 recalculate the user-specified offset and size for alignment with the CHS
 

svn commit: r362487 - in head/sys/dev/cxgbe: iw_cxgbe tom

2020-06-22 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Jun 22 07:35:23 2020
New Revision: 362487
URL: https://svnweb.freebsd.org/changeset/base/362487

Log:
  Switch cxgbe interface lookup to use fibX_lookup() from older
   fibX_lookup_nh_ext().
  
  fibX_lookup_nh_ represents pre-epoch generation of fib kpi,
  providing less guarantees over pointer validness and requiring
  on-stack data copying.
  
  Reviewed by:  np
  Differential Revision:https://reviews.freebsd.org/D24975

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c
  head/sys/dev/cxgbe/tom/t4_listen.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cMon Jun 22 07:00:26 2020
(r362486)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cMon Jun 22 07:35:23 2020
(r362487)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -537,32 +538,29 @@ static int
 get_ifnet_from_raddr(struct sockaddr_storage *raddr, struct ifnet **ifp)
 {
int err = 0;
+   struct nhop_object *nh;
 
if (raddr->ss_family == AF_INET) {
struct sockaddr_in *raddr4 = (struct sockaddr_in *)raddr;
-   struct nhop4_extended nh4 = {0};
 
-   err = fib4_lookup_nh_ext(RT_DEFAULT_FIB, raddr4->sin_addr,
-   NHR_REF, 0, );
-   *ifp = nh4.nh_ifp;
-   if (err)
-   fib4_free_nh_ext(RT_DEFAULT_FIB, );
+   nh = fib4_lookup(RT_DEFAULT_FIB, raddr4->sin_addr, 0,
+   NHR_NONE, 0);
} else {
struct sockaddr_in6 *raddr6 = (struct sockaddr_in6 *)raddr;
-   struct nhop6_extended nh6 = {0};
struct in6_addr addr6;
uint32_t scopeid;
 
memset(, 0, sizeof(addr6));
in6_splitscope((struct in6_addr *)>sin6_addr,
, );
-   err = fib6_lookup_nh_ext(RT_DEFAULT_FIB, , scopeid,
-   NHR_REF, 0, );
-   *ifp = nh6.nh_ifp;
-   if (err)
-   fib6_free_nh_ext(RT_DEFAULT_FIB, );
+   nh = fib6_lookup(RT_DEFAULT_FIB, , scopeid,
+   NHR_NONE, 0);
}
 
+   if (nh == NULL)
+   err = EHOSTUNREACH;
+   else
+   *ifp = nh->nh_ifp;
CTR2(KTR_IW_CXGBE, "%s: return: %d", __func__, err);
return err;
 }
@@ -2589,6 +2587,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_
struct c4iw_dev *dev = to_c4iw_dev(cm_id->device);
struct c4iw_ep *ep = NULL;
struct ifnet*nh_ifp;/* Logical egress interface */
+   struct epoch_tracker et;
 #ifdef VIMAGE
struct rdma_cm_id *rdma_id = (struct rdma_cm_id*)cm_id->context;
struct vnet *vnet = rdma_id->route.addr.dev_addr.net;
@@ -2639,9 +2638,11 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_
ref_qp(ep);
ep->com.thread = curthread;
 
+   NET_EPOCH_ENTER(et);
CURVNET_SET(vnet);
err = get_ifnet_from_raddr(_id->remote_addr, _ifp);
CURVNET_RESTORE();
+   NET_EPOCH_EXIT(et);
 
if (err) {
 

Modified: head/sys/dev/cxgbe/tom/t4_listen.c
==
--- head/sys/dev/cxgbe/tom/t4_listen.c  Mon Jun 22 07:00:26 2020
(r362486)
+++ head/sys/dev/cxgbe/tom/t4_listen.c  Mon Jun 22 07:35:23 2020
(r362487)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1052,10 +1053,9 @@ get_l2te_for_nexthop(struct port_info *pi, struct ifne
struct l2t_entry *e;
struct sockaddr_in6 sin6;
struct sockaddr *dst = (void *)
+   struct nhop_object *nh;
 
if (inc->inc_flags & INC_ISIPV6) {
-   struct nhop6_basic nh6;
-
bzero(dst, sizeof(struct sockaddr_in6));
dst->sa_len = sizeof(struct sockaddr_in6);
dst->sa_family = AF_INET6;
@@ -1066,24 +1066,28 @@ get_l2te_for_nexthop(struct port_info *pi, struct ifne
return (e);
}
 
-   if (fib6_lookup_nh_basic(RT_DEFAULT_FIB, >inc6_faddr,
-   0, 0, 0, ) != 0)
+   nh = fib6_lookup(RT_DEFAULT_FIB, >inc6_faddr, 0, NHR_NONE, 
0);
+   if (nh == NULL)
return (NULL);
-   if (nh6.nh_ifp != ifp)
+   if (nh->nh_ifp != ifp)
return (NULL);
-   ((struct sockaddr_in6 *)dst)->sin6_addr = nh6.nh_addr;
+   if (nh->nh_flags & NHF_GATEWAY)
+   ((struct sockaddr_in6 *)dst)->sin6_addr = 
nh->gw6_sa.sin6_addr;
+   else
+   ((struct sockaddr_in6 *)dst)->sin6_addr = 
inc->inc6_faddr;
  

Re: svn commit: r362477 - in head: . libexec/flua tools/build

2020-06-22 Thread Mateusz Piotrowski
On 6/22/20 5:14 AM, Ryan Moeller wrote:
> Author: freqlabs
> Date: Mon Jun 22 03:14:43 2020
> New Revision: 362477
> URL: https://svnweb.freebsd.org/changeset/base/362477
> 
> Log:
>   flua: add ucl library
>   
>   libucl comes with a Lua library binding.  Build it into flua.
>   
>   This lets us parse/generate config files in the various formats supported by
>   libucl with flua.  For example, the following script will detect the format 
> of
>   an object written to stdin as one of UCL config, JSON, or YAML and write it 
> to
>   stdout as pretty-printed JSON:
>   
>   local ucl = require('ucl')
>   local parser = ucl.parser()
>   parser:parse_string(io.read('*a'))
>   local obj = parser:get_object()
>   print(ucl.to_format(obj, 'json'))
>   
>   Reviewed by:kevans, pstef
>   Approved by:mmacy (mentor)
>   Relnotes:   yes
>   Differential Revision:  https://reviews.freebsd.org/D25009

It sounds great!

BTW, Is flua to be used by end users directly, or it is just a tool
which should not be considered a public interface (like pjdlog.h)?

Cheers,
Mateusz
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362294 - head/sys/dev/sound/pci/hda

2020-06-22 Thread Andriy Gapon
On 22/06/2020 00:59, Konstantin Belousov wrote:
> This commit (or rather, a merge of this commit to stable/12) causes an issue
> on my Apollo Lake machine.  Look:
> hdac0@pci0:0:14:0:   class=0x040300 card=0xa1821458 chip=0x5a988086 rev=0x0b 
> hdr=0x00
> vendor = 'Intel Corporation'
> device = 'Celeron N3350/Pentium N4200/Atom E3900 Series Audio Cluster'
> class  = multimedia
> subclass   = HDA
> bar   [10] = type Memory, range 64, base 0x9141, size 16384, enabled
> bar   [20] = type Memory, range 64, base 0x9100, size 1048576, enabled
> cap 01[50] = powerspec 3  supports D0 D3  current D0
> cap 09[80] = vendor (length 20) Intel cap 15 version 0
> cap 05[60] = MSI supports 1 message, 64 bit
> 
> DMAP base is 0xf800.
> tom% sudo /usr/local/bin/kgdb 
> ~/work/DEV/svn/RELENG_12/sys/amd64/compile/TOM/kernel.full /dev/mem
> GNU gdb (GDB) 9.2 [GDB v9.2 for FreeBSD]
> Reading symbols from 
> /usr/home/kostik/work/DEV/svn/RELENG_12/sys/amd64/compile/TOM/kernel.full...
> ...
> sched_switch (td=0xf8029d516000, newtd=0xf800025f4000,
> flags=) at ../../../kern/sched_ule.c:2143
> 2143cpuid = PCPU_GET(cpuid);
> (kgdb) p/x *(unsigned int *)(0xf800+0x9141+0x24) INTSTS
> $1 = 0xc000
> This causes the first interrupt handler to loop forever.
> 
> And this is why:
> (kgdb) p/x *(unsigned char *)(0xf800+0x9141+0x5d) RIRBSTS
> $3 = 0x0
> (kgdb) p/x *(unsigned char *)(0xf800+0x9141+0x4d) CORBSTS
> $4 = 0x0
> (kgdb) p/x *(unsigned short *)(0xf800+0x9141+0xe) WAKESTS
> $5 = 0x5
> So the SDIN State Change status bit is set, and nothing in the driver
> clears it, it seems.
> 
> More, the EDS specifies that another reason for INTSTS CIS bit set may
> be the CORB Memory Error Indication (CMEI), and again it seems that driver
> never clears the reason.
> 
> So as is the change perhaps helps for some situations, but also
> practically makes some systems to loose core in tight loop with interrupt
> priority, which causes weird machine misbehavior like unkillable processes
> and never finishing epochs.


Kostik,

thank you for the report and the debugging!

It seems that the driver currently does do not much with the register 0xe
(referred to by you as WAKESTS, by the code and the HDA specification as 
STATESTS).
I think that we can just clear that register (documented as RW1C)
More, I am surprised that the driver does not clear the register in
hdac_attach2() when probing codecs.

So, maybe something like a quick patch below.

Also, I see that the driver never explicitly manages WAKEEN register.
I think that it should.
If we do not need or do not expect any wake events then we should clear the
corresponding bits.
So, maybe it would be better to just zero WAKEEN in attach and resume methods.
Although, WAKEEN is documented as zero after reset, the specification has this 
note:
  These bits are only cleared by a power-on reset. Software must make no
  assumptions about how these bits are set and set them appropriately.


Regarding CMEI, we never enable it by setting CMEIE and it should be zero after
reset.  So, we should never get that interrupt.
The same applies to another potential interrupt source, RIRBOIS / RIRBOIC.

Index: sys/dev/sound/pci/hda/hdac.c
===
--- sys/dev/sound/pci/hda/hdac.c(revision 362383)
+++ sys/dev/sound/pci/hda/hdac.c(working copy)
@@ -312,6 +312,10 @@ hdac_one_intr(struct hdac_softc *sc, uint32_t ints

/* Was this a controller interrupt? */
if (intsts & HDAC_INTSTS_CIS) {
+   /* XXX just clear SDIWAKE bits. */
+   HDAC_WRITE_2(>mem, HDAC_STATESTS,
+   HDAC_STATESTS_SDIWAKE_MASK);
+
rirbsts = HDAC_READ_1(>mem, HDAC_RIRBSTS);
/* Get as many responses that we can */
while (rirbsts & HDAC_RIRBSTS_RINTFL) {
@@ -1530,6 +1534,7 @@ hdac_attach2(void *arg)
device_printf(sc->dev, "Scanning HDA codecs ...\n");
);
statests = HDAC_READ_2(>mem, HDAC_STATESTS);
+   HDAC_WRITE_2(>mem, HDAC_STATESTS, statests);
hdac_unlock(sc);
for (i = 0; i < HDAC_CODEC_MAX; i++) {
if (HDAC_STATESTS_SDIWAKE(statests, i)) {


-- 
Andriy Gapon
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"