The branch stable/14 has been updated by cy:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=78c66b88cc919d7ccb84b1fc3a66768fb32d1812

commit 78c66b88cc919d7ccb84b1fc3a66768fb32d1812
Author:     Cy Schubert <c...@freebsd.org>
AuthorDate: 2024-08-16 16:45:39 +0000
Commit:     Cy Schubert <c...@freebsd.org>
CommitDate: 2024-08-23 19:29:42 +0000

    unbound: Vendor import 1.21.0
    
    Release notes at
            https://nlnetlabs.nl/news/2024/Aug/15/unbound-1.21.0-released/
    
    Merge commit '96ef46e5cff01648c80c09c4364d10bc6f58119d'
    
    (cherry picked from commit 5685098846d7f11ad642d9804d94dc7429a7b212)
---
 contrib/unbound/Makefile.in                        |    5 +-
 contrib/unbound/acx_python.m4                      |    2 +-
 contrib/unbound/cachedb/cachedb.c                  |   55 +-
 contrib/unbound/cachedb/cachedb.h                  |    8 +
 contrib/unbound/config.guess                       |   11 +-
 contrib/unbound/config.h.in                        |   15 +
 contrib/unbound/config.sub                         |  729 ++-
 contrib/unbound/configure                          |  290 +-
 contrib/unbound/configure.ac                       |   96 +-
 contrib/unbound/contrib/unbound.service.in         |    4 +-
 .../unbound/contrib/unbound_portable.service.in    |    4 +-
 contrib/unbound/daemon/daemon.c                    |   43 +-
 contrib/unbound/daemon/daemon.h                    |   14 +
 contrib/unbound/daemon/remote.c                    |  540 +-
 contrib/unbound/daemon/stats.c                     |    9 +-
 contrib/unbound/daemon/unbound.c                   |    6 +-
 contrib/unbound/daemon/worker.c                    |   11 +-
 contrib/unbound/dns64/dns64.c                      |    5 +-
 contrib/unbound/dnstap/dnstap.c                    |   45 +
 contrib/unbound/dnstap/dnstap.h                    |    8 +
 contrib/unbound/dnstap/dnstap.m4                   |   59 +-
 contrib/unbound/dnstap/dtstream.c                  |   53 +-
 contrib/unbound/dnstap/unbound-dnstap-socket.c     |  285 +-
 contrib/unbound/doc/Changelog                      |  267 +-
 contrib/unbound/doc/README                         |    2 +-
 contrib/unbound/doc/example.conf.in                |   14 +-
 contrib/unbound/doc/libunbound.3.in                |    4 +-
 contrib/unbound/doc/unbound-anchor.8.in            |    2 +-
 contrib/unbound/doc/unbound-checkconf.8.in         |    2 +-
 contrib/unbound/doc/unbound-control.8.in           |   66 +-
 contrib/unbound/doc/unbound-host.1.in              |    2 +-
 contrib/unbound/doc/unbound.8.in                   |    4 +-
 contrib/unbound/doc/unbound.conf.5.in              |   59 +-
 contrib/unbound/dynlibmod/dynlibmod.c              |    4 +-
 contrib/unbound/edns-subnet/subnetmod.c            |    3 +-
 contrib/unbound/ipsecmod/ipsecmod.c                |    2 +-
 contrib/unbound/ipset/ipset.c                      |  209 +-
 contrib/unbound/ipset/ipset.h                      |    6 +-
 contrib/unbound/iterator/iter_scrub.c              |   82 +
 contrib/unbound/iterator/iter_utils.c              |    3 +-
 contrib/unbound/iterator/iterator.c                |  124 +-
 contrib/unbound/iterator/iterator.h                |    6 +
 contrib/unbound/libunbound/context.c               |    4 +-
 contrib/unbound/libunbound/libunbound.c            |   19 +-
 contrib/unbound/libunbound/libworker.c             |    1 +
 contrib/unbound/respip/respip.c                    |    4 +-
 contrib/unbound/services/authzone.c                |   48 +-
 contrib/unbound/services/cache/dns.c               |   33 +-
 contrib/unbound/services/cache/infra.c             |   27 +-
 contrib/unbound/services/cache/infra.h             |    2 +-
 contrib/unbound/services/listen_dnsport.c          |    2 +-
 contrib/unbound/services/localzone.c               |   71 +-
 contrib/unbound/services/localzone.h               |   19 +
 contrib/unbound/services/mesh.c                    |   41 +-
 contrib/unbound/services/modstack.c                |   78 +-
 contrib/unbound/services/modstack.h                |   38 +-
 contrib/unbound/services/outside_network.c         |   20 +-
 contrib/unbound/services/rpz.c                     |   41 +-
 contrib/unbound/sldns/parse.h                      |    6 +-
 contrib/unbound/sldns/parseutil.c                  |    9 +
 contrib/unbound/sldns/rrdef.h                      |    5 +
 contrib/unbound/sldns/wire2str.c                   |    6 +
 contrib/unbound/smallapp/unbound-anchor.c          |   10 +-
 contrib/unbound/smallapp/unbound-checkconf.c       |    9 +-
 .../unbound/smallapp/unbound-control-setup.sh.in   |    4 +
 contrib/unbound/smallapp/unbound-control.c         |   29 +-
 contrib/unbound/systemd.m4                         |   14 +-
 .../09-unbound-control.tdir/view_local_data        |    4 +
 .../09-unbound-control.tdir/view_local_data_remove |    4 +
 .../testdata/acl_interface.tdir/rpz-nx.zone        |    3 +
 .../testdata/acl_interface.tdir/rpz-one.zone       |    3 +
 .../testdata/acl_interface.tdir/rpz-two.zone       |    3 +
 contrib/unbound/testdata/cachedb_val_expired.crpl  |  327 +
 .../testdata/cookie_file.tdir/cookie_file.conf     |   19 +
 .../testdata/cookie_file.tdir/cookie_file.dsc      |   16 +
 .../testdata/cookie_file.tdir/cookie_file.pre      |   24 +
 .../testdata/cookie_file.tdir/cookie_file.test     |  248 +
 contrib/unbound/testdata/fwd_name_lookup.rpl       |  152 +
 contrib/unbound/testdata/rpz_cname_tag.rpl         |  281 +
 contrib/unbound/testdata/val_dname_twice.rpl       |  226 +
 contrib/unbound/testdata/val_failure_dnskey.rpl    |  348 ++
 contrib/unbound/util/alloc.c                       |   21 +
 contrib/unbound/util/config_file.c                 |   82 +-
 contrib/unbound/util/config_file.h                 |    4 +
 contrib/unbound/util/configlexer.c                 | 6453 ++++++++++----------
 contrib/unbound/util/configlexer.lex               |    2 +
 contrib/unbound/util/configparser.c                | 4701 +++++++-------
 contrib/unbound/util/configparser.h                |  666 +-
 contrib/unbound/util/configparser.y                |  133 +-
 contrib/unbound/util/data/dname.h                  |    2 +-
 contrib/unbound/util/data/msgparse.c               |   50 +-
 contrib/unbound/util/data/msgparse.h               |    5 +-
 contrib/unbound/util/edns.c                        |  186 +
 contrib/unbound/util/edns.h                        |   85 +
 contrib/unbound/util/fptr_wlist.c                  |   26 +-
 contrib/unbound/util/fptr_wlist.h                  |   16 +
 contrib/unbound/util/module.h                      |   30 +-
 contrib/unbound/util/net_help.c                    |   56 +-
 contrib/unbound/util/net_help.h                    |   17 +
 contrib/unbound/util/netevent.c                    |   21 +-
 contrib/unbound/util/netevent.h                    |    3 +
 contrib/unbound/util/proxy_protocol.c              |    1 +
 contrib/unbound/util/siphash.c                     |    6 +
 contrib/unbound/util/storage/lookup3.c             |  227 +-
 contrib/unbound/validator/autotrust.c              |    3 +-
 contrib/unbound/validator/val_nsec.c               |   12 +-
 contrib/unbound/validator/val_nsec.h               |    4 +-
 contrib/unbound/validator/val_nsec3.c              |    9 +-
 contrib/unbound/validator/val_nsec3.h              |    4 +-
 contrib/unbound/validator/val_secalgo.c            |    8 +-
 contrib/unbound/validator/val_sigcrypt.c           |   19 +-
 contrib/unbound/validator/val_sigcrypt.h           |   12 +-
 contrib/unbound/validator/val_utils.c              |   82 +-
 contrib/unbound/validator/val_utils.h              |   26 +-
 contrib/unbound/validator/validator.c              |  129 +-
 lib/libunbound/config.h                            |   15 +-
 116 files changed, 11672 insertions(+), 6800 deletions(-)

diff --git a/contrib/unbound/Makefile.in b/contrib/unbound/Makefile.in
index f30ca81a84f8..672435e01e9f 100644
--- a/contrib/unbound/Makefile.in
+++ b/contrib/unbound/Makefile.in
@@ -439,7 +439,8 @@ unbound-control-setup:      
smallapp/unbound-control-setup.sh
 dnstap.lo dnstap.o: $(srcdir)/dnstap/dnstap.c config.h dnstap/dnstap_config.h \
        dnstap/dnstap.pb-c.c dnstap/dnstap.pb-c.h $(srcdir)/dnstap/dnstap.h \
        $(srcdir)/util/config_file.h $(srcdir)/util/log.h \
-       $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h
+       $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h \
+       $(srcdir)/util/locks.h
 
 dnstap/dnstap.pb-c.c dnstap/dnstap.pb-c.h: $(srcdir)/dnstap/dnstap.proto
        @-if test ! -d dnstap; then $(INSTALL) -d dnstap; fi
@@ -1297,7 +1298,7 @@ remote.lo remote.o: $(srcdir)/daemon/remote.c config.h 
$(srcdir)/daemon/remote.h
  $(srcdir)/validator/val_anchor.h $(srcdir)/iterator/iterator.h 
$(srcdir)/services/outbound_list.h \
  $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h 
$(srcdir)/iterator/iter_delegpt.h \
  $(srcdir)/services/outside_network.h $(srcdir)/sldns/str2wire.h 
$(srcdir)/sldns/parseutil.h \
- $(srcdir)/sldns/wire2str.h
+ $(srcdir)/sldns/wire2str.h $(srcdir)/util/edns.h
 stats.lo stats.o: $(srcdir)/daemon/stats.c config.h $(srcdir)/daemon/stats.h 
$(srcdir)/util/timehist.h \
  $(srcdir)/libunbound/unbound.h $(srcdir)/daemon/worker.h 
$(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \
  $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h 
$(srcdir)/util/locks.h $(srcdir)/util/log.h \
diff --git a/contrib/unbound/acx_python.m4 b/contrib/unbound/acx_python.m4
index c945d6c8989e..4ed298cf9ebd 100644
--- a/contrib/unbound/acx_python.m4
+++ b/contrib/unbound/acx_python.m4
@@ -9,7 +9,7 @@ AC_DEFUN([AC_PYTHON_DEVEL],[
 
         AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
         if test -z "$PYTHON"; then
-           AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system 
path])
+           AC_MSG_ERROR([Cannot find 'python$PYTHON_VERSION' in your system 
path. You can use the environment variable 'PYTHON_VERSION=version_number' for 
an explicit version.])
            PYTHON_VERSION=""
         fi
 
diff --git a/contrib/unbound/cachedb/cachedb.c 
b/contrib/unbound/cachedb/cachedb.c
index 95ac28904693..7a07b9976967 100644
--- a/contrib/unbound/cachedb/cachedb.c
+++ b/contrib/unbound/cachedb/cachedb.c
@@ -322,30 +322,30 @@ error_response(struct module_qstate* qstate, int id, int 
rcode)
 
 /**
  * Hash the query name, type, class and dbacess-secret into lookup buffer.
- * @param qstate: query state with query info
- *     and env->cfg with secret.
+ * @param qinfo: query info
+ * @param env: with env->cfg with secret.
  * @param buf: returned buffer with hash to lookup
  * @param len: length of the buffer.
  */
 static void
-calc_hash(struct module_qstate* qstate, char* buf, size_t len)
+calc_hash(struct query_info* qinfo, struct module_env* env, char* buf,
+       size_t len)
 {
        uint8_t clear[1024];
        size_t clen = 0;
        uint8_t hash[CACHEDB_HASHSIZE/8];
        const char* hex = "0123456789ABCDEF";
-       const char* secret = qstate->env->cfg->cachedb_secret;
+       const char* secret = env->cfg->cachedb_secret;
        size_t i;
 
        /* copy the hash info into the clear buffer */
-       if(clen + qstate->qinfo.qname_len < sizeof(clear)) {
-               memmove(clear+clen, qstate->qinfo.qname,
-                       qstate->qinfo.qname_len);
-               clen += qstate->qinfo.qname_len;
+       if(clen + qinfo->qname_len < sizeof(clear)) {
+               memmove(clear+clen, qinfo->qname, qinfo->qname_len);
+               clen += qinfo->qname_len;
        }
        if(clen + 4 < sizeof(clear)) {
-               uint16_t t = htons(qstate->qinfo.qtype);
-               uint16_t c = htons(qstate->qinfo.qclass);
+               uint16_t t = htons(qinfo->qtype);
+               uint16_t c = htons(qinfo->qclass);
                memmove(clear+clen, &t, 2);
                memmove(clear+clen+2, &c, 2);
                clen += 4;
@@ -645,7 +645,7 @@ cachedb_extcache_lookup(struct module_qstate* qstate, 
struct cachedb_env* ie,
        int* msg_expired)
 {
        char key[(CACHEDB_HASHSIZE/8)*2+1];
-       calc_hash(qstate, key, sizeof(key));
+       calc_hash(&qstate->qinfo, qstate->env, key, sizeof(key));
 
        /* call backend to fetch data for key into scratch buffer */
        if( !(*ie->backend->lookup)(qstate->env, ie, key,
@@ -672,7 +672,7 @@ static void
 cachedb_extcache_store(struct module_qstate* qstate, struct cachedb_env* ie)
 {
        char key[(CACHEDB_HASHSIZE/8)*2+1];
-       calc_hash(qstate, key, sizeof(key));
+       calc_hash(&qstate->qinfo, qstate->env, key, sizeof(key));
 
        /* prepare data in scratch buffer */
        if(!prep_data(qstate, qstate->env->scratch_buffer))
@@ -745,6 +745,10 @@ cachedb_intcache_store(struct module_qstate* qstate, int 
msg_expired)
                 * going to be now-3 seconds. Making it expired
                 * in the cache. */
                set_msg_ttl(qstate->return_msg, (time_t)-3);
+               /* The expired entry does not get checked by the validator
+                * and we need a validation value for it. */
+               if(qstate->env->cfg->cachedb_check_when_serve_expired)
+                       qstate->return_msg->rep->security = sec_status_insecure;
        }
        (void)dns_cache_store(qstate->env, &qstate->qinfo,
                qstate->return_msg->rep, 0, qstate->prefetch_leeway, 0,
@@ -979,7 +983,7 @@ cachedb_get_mem(struct module_env* env, int id)
  */
 static struct module_func_block cachedb_block = {
        "cachedb",
-       &cachedb_init, &cachedb_deinit, &cachedb_operate,
+       NULL, NULL, &cachedb_init, &cachedb_deinit, &cachedb_operate,
        &cachedb_inform_super, &cachedb_clear, &cachedb_get_mem
 };
 
@@ -1003,21 +1007,26 @@ cachedb_is_enabled(struct module_stack* mods, struct 
module_env* env)
 }
 
 void cachedb_msg_remove(struct module_qstate* qstate)
+{
+       cachedb_msg_remove_qinfo(qstate->env, &qstate->qinfo);
+}
+
+void cachedb_msg_remove_qinfo(struct module_env* env, struct query_info* qinfo)
 {
        char key[(CACHEDB_HASHSIZE/8)*2+1];
-       int id = modstack_find(qstate->env->modstack, "cachedb");
-       struct cachedb_env* ie = (struct cachedb_env*)qstate->env->modinfo[id];
+       int id = modstack_find(env->modstack, "cachedb");
+       struct cachedb_env* ie = (struct cachedb_env*)env->modinfo[id];
 
-       log_query_info(VERB_ALGO, "cachedb msg remove", &qstate->qinfo);
-       calc_hash(qstate, key, sizeof(key));
-       sldns_buffer_clear(qstate->env->scratch_buffer);
-       sldns_buffer_write_u32(qstate->env->scratch_buffer, 0);
-       sldns_buffer_flip(qstate->env->scratch_buffer);
+       log_query_info(VERB_ALGO, "cachedb msg remove", qinfo);
+       calc_hash(qinfo, env, key, sizeof(key));
+       sldns_buffer_clear(env->scratch_buffer);
+       sldns_buffer_write_u32(env->scratch_buffer, 0);
+       sldns_buffer_flip(env->scratch_buffer);
 
        /* call backend */
-       (*ie->backend->store)(qstate->env, ie, key,
-               sldns_buffer_begin(qstate->env->scratch_buffer),
-               sldns_buffer_limit(qstate->env->scratch_buffer),
+       (*ie->backend->store)(env, ie, key,
+               sldns_buffer_begin(env->scratch_buffer),
+               sldns_buffer_limit(env->scratch_buffer),
                0);
 }
 #endif /* USE_CACHEDB */
diff --git a/contrib/unbound/cachedb/cachedb.h 
b/contrib/unbound/cachedb/cachedb.h
index 2da8b5c71feb..482c5db6c063 100644
--- a/contrib/unbound/cachedb/cachedb.h
+++ b/contrib/unbound/cachedb/cachedb.h
@@ -126,3 +126,11 @@ int cachedb_is_enabled(struct module_stack* mods, struct 
module_env* env);
  * @param qstate: query state.
  */
 void cachedb_msg_remove(struct module_qstate* qstate);
+
+/**
+ * Remove message from the cachedb cache, by query info.
+ * @param env: module environment to look up cachedb state.
+ * @param qinfo: the message to remove.
+ */
+void cachedb_msg_remove_qinfo(struct module_env* env,
+       struct query_info* qinfo);
diff --git a/contrib/unbound/config.guess b/contrib/unbound/config.guess
index f6d217a49f8f..48a684601bd2 100755
--- a/contrib/unbound/config.guess
+++ b/contrib/unbound/config.guess
@@ -4,7 +4,7 @@
 
 # shellcheck disable=SC2006,SC2268 # see below for rationale
 
-timestamp='2024-01-01'
+timestamp='2024-07-27'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -123,7 +123,7 @@ set_cc_for_build() {
     dummy=$tmp/dummy
     case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
        ,,)    echo "int x;" > "$dummy.c"
-              for driver in cc gcc c89 c99 ; do
+              for driver in cc gcc c17 c99 c89 ; do
                   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; 
then
                       CC_FOR_BUILD=$driver
                       break
@@ -634,7 +634,8 @@ EOF
                sed 's/^                //' << EOF > "$dummy.c"
                #include <sys/systemcfg.h>
 
-               main()
+               int
+               main ()
                        {
                        if (!__power_pc())
                                exit(1);
@@ -718,7 +719,8 @@ EOF
                #include <stdlib.h>
                #include <unistd.h>
 
-               int main ()
+               int
+               main ()
                {
                #if defined(_SC_KERNEL_BITS)
                    long bits = sysconf(_SC_KERNEL_BITS);
@@ -1621,6 +1623,7 @@ cat > "$dummy.c" <<EOF
 #endif
 #endif
 #endif
+int
 main ()
 {
 #if defined (sony)
diff --git a/contrib/unbound/config.h.in b/contrib/unbound/config.h.in
index bc39544c4056..099206025a33 100644
--- a/contrib/unbound/config.h.in
+++ b/contrib/unbound/config.h.in
@@ -1,5 +1,8 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* apply the fallthrough attribute. */
+#undef ATTR_FALLTHROUGH
+
 /* apply the noreturn attribute to a function that exits the program */
 #undef ATTR_NORETURN
 
@@ -57,6 +60,9 @@
 /* Define to 1 if you have the <arpa/inet.h> header file. */
 #undef HAVE_ARPA_INET_H
 
+/* Whether the C compiler accepts the "fallthrough" attribute */
+#undef HAVE_ATTR_FALLTHROUGH
+
 /* Whether the C compiler accepts the "format" attribute */
 #undef HAVE_ATTR_FORMAT
 
@@ -406,6 +412,9 @@
 /* Define to 1 if you have the <net/if.h> header file. */
 #undef HAVE_NET_IF_H
 
+/* Define to 1 if you have the <net/pfvar.h> header file. */
+#undef HAVE_NET_PFVAR_H
+
 /* Define this to use nghttp2 client. */
 #undef HAVE_NGHTTP2
 
@@ -566,6 +575,9 @@
    function. */
 #undef HAVE_SSL_CTX_SET_TLSEXT_TICKET_KEY_EVP_CB
 
+/* Define to 1 if you have the `SSL_CTX_set_tmp_ecdh' function. */
+#undef HAVE_SSL_CTX_SET_TMP_ECDH
+
 /* Define to 1 if you have the `SSL_get0_alpn_selected' function. */
 #undef HAVE_SSL_GET0_ALPN_SELECTED
 
@@ -1484,6 +1496,7 @@ struct sockaddr_storage;
 #  define calloc(n,s) unbound_stat_calloc_log(n, s, __FILE__, __LINE__, 
__func__)
 #  define free(p) unbound_stat_free_log(p, __FILE__, __LINE__, __func__)
 #  define realloc(p,s) unbound_stat_realloc_log(p, s, __FILE__, __LINE__, 
__func__)
+#  define strdup(s) unbound_stat_strdup_log(s, __FILE__, __LINE__, __func__)
 void *unbound_stat_malloc(size_t size);
 void *unbound_stat_calloc(size_t nmemb, size_t size);
 void unbound_stat_free(void *ptr);
@@ -1496,6 +1509,8 @@ void unbound_stat_free_log(void *ptr, const char* file, 
int line,
        const char* func);
 void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
        int line, const char* func);
+char *unbound_stat_strdup_log(const char *s, const char* file, int line,
+       const char* func);
 #elif defined(UNBOUND_ALLOC_LITE)
 #  include "util/alloc.h"
 #endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */
diff --git a/contrib/unbound/config.sub b/contrib/unbound/config.sub
index 2c6a07ab3c34..4aaae46f6f74 100755
--- a/contrib/unbound/config.sub
+++ b/contrib/unbound/config.sub
@@ -2,9 +2,9 @@
 # Configuration validation subroutine script.
 #   Copyright 1992-2024 Free Software Foundation, Inc.
 
-# shellcheck disable=SC2006,SC2268 # see below for rationale
+# shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale
 
-timestamp='2024-01-01'
+timestamp='2024-05-27'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -120,7 +120,6 @@ case $# in
 esac
 
 # Split fields of configuration type
-# shellcheck disable=SC2162
 saved_IFS=$IFS
 IFS="-" read field1 field2 field3 field4 <<EOF
 $1
@@ -142,10 +141,20 @@ case $1 in
                # parts
                maybe_os=$field2-$field3
                case $maybe_os in
-                       nto-qnx* | linux-* | uclinux-uclibc* \
-                       | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | 
netbsd*-gnu* \
-                       | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
-                       | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \
+                         cloudabi*-eabi* \
+                       | kfreebsd*-gnu* \
+                       | knetbsd*-gnu* \
+                       | kopensolaris*-gnu* \
+                       | linux-* \
+                       | managarm-* \
+                       | netbsd*-eabi* \
+                       | netbsd*-gnu* \
+                       | nto-qnx* \
+                       | os2-emx* \
+                       | rtmk-nova* \
+                       | storm-chaos* \
+                       | uclinux-gnu* \
+                       | uclinux-uclibc* \
                        | windows-* )
                                basic_machine=$field1
                                basic_os=$maybe_os
@@ -161,8 +170,12 @@ case $1 in
                esac
                ;;
        *-*)
-               # A lone config we happen to match not fitting any pattern
                case $field1-$field2 in
+                       # Shorthands that happen to contain a single dash
+                       convex-c[12] | convex-c3[248])
+                               basic_machine=$field2-convex
+                               basic_os=
+                               ;;
                        decstation-3100)
                                basic_machine=mips-dec
                                basic_os=
@@ -170,28 +183,88 @@ case $1 in
                        *-*)
                                # Second component is usually, but not always 
the OS
                                case $field2 in
-                                       # Prevent following clause from 
handling this valid os
+                                       # Do not treat sunos as a manufacturer
                                        sun*os*)
                                                basic_machine=$field1
                                                basic_os=$field2
                                                ;;
-                                       zephyr*)
-                                               basic_machine=$field1-unknown
-                                               basic_os=$field2
-                                               ;;
                                        # Manufacturers
-                                       dec* | mips* | sequent* | encore* | 
pc533* | sgi* | sony* \
-                                       | att* | 7300* | 3300* | delta* | 
motorola* | sun[234]* \
-                                       | unicom* | ibm* | next | hp | isi* | 
apollo | altos* \
-                                       | convergent* | ncr* | news | 32* | 
3600* | 3100* \
-                                       | hitachi* | c[123]* | convex* | sun | 
crds | omron* | dg \
-                                       | ultra | tti* | harris | dolphin | 
highlevel | gould \
-                                       | cbm | ns | masscomp | apple | axis | 
knuth | cray \
-                                       | microblaze* | sim | cisco \
-                                       | oki | wec | wrs | winbond)
+                                         3100* \
+                                       | 32* \
+                                       | 3300* \
+                                       | 3600* \
+                                       | 7300* \
+                                       | acorn \
+                                       | altos* \
+                                       | apollo \
+                                       | apple \
+                                       | atari \
+                                       | att* \
+                                       | axis \
+                                       | be \
+                                       | bull \
+                                       | cbm \
+                                       | ccur \
+                                       | cisco \
+                                       | commodore \
+                                       | convergent* \
+                                       | convex* \
+                                       | cray \
+                                       | crds \
+                                       | dec* \
+                                       | delta* \
+                                       | dg \
+                                       | digital \
+                                       | dolphin \
+                                       | encore* \
+                                       | gould \
+                                       | harris \
+                                       | highlevel \
+                                       | hitachi* \
+                                       | hp \
+                                       | ibm* \
+                                       | intergraph \
+                                       | isi* \
+                                       | knuth \
+                                       | masscomp \
+                                       | microblaze* \
+                                       | mips* \
+                                       | motorola* \
+                                       | ncr* \
+                                       | news \
+                                       | next \
+                                       | ns \
+                                       | oki \
+                                       | omron* \
+                                       | pc533* \
+                                       | rebel \
+                                       | rom68k \
+                                       | rombug \
+                                       | semi \
+                                       | sequent* \
+                                       | siemens \
+                                       | sgi* \
+                                       | siemens \
+                                       | sim \
+                                       | sni \
+                                       | sony* \
+                                       | stratus \
+                                       | sun \
+                                       | sun[234]* \
+                                       | tektronix \
+                                       | tti* \
+                                       | ultra \
+                                       | unicom* \
+                                       | wec \
+                                       | winbond \
+                                       | wrs)
                                                basic_machine=$field1-$field2
                                                basic_os=
                                                ;;
+                                       zephyr*)
+                                               basic_machine=$field1-unknown
+                                               basic_os=$field2
+                                               ;;
                                        *)
                                                basic_machine=$field1
                                                basic_os=$field2
@@ -272,26 +345,6 @@ case $1 in
                                basic_machine=arm-unknown
                                basic_os=cegcc
                                ;;
-                       convex-c1)
-                               basic_machine=c1-convex
-                               basic_os=bsd
-                               ;;
-                       convex-c2)
-                               basic_machine=c2-convex
-                               basic_os=bsd
-                               ;;
-                       convex-c32)
-                               basic_machine=c32-convex
-                               basic_os=bsd
-                               ;;
-                       convex-c34)
-                               basic_machine=c34-convex
-                               basic_os=bsd
-                               ;;
-                       convex-c38)
-                               basic_machine=c38-convex
-                               basic_os=bsd
-                               ;;
                        cray)
                                basic_machine=j90-cray
                                basic_os=unicos
@@ -714,15 +767,26 @@ case $basic_machine in
                vendor=dec
                basic_os=tops20
                ;;
-       delta | 3300 | motorola-3300 | motorola-delta \
-             | 3300-motorola | delta-motorola)
+       delta | 3300 | delta-motorola | 3300-motorola | motorola-delta | 
motorola-3300)
                cpu=m68k
                vendor=motorola
                ;;
-       dpx2*)
+       # This used to be dpx2*, but that gets the RS6000-based
+       # DPX/20 and the x86-based DPX/2-100 wrong.  See
+       # https://oldskool.silicium.org/stations/bull_dpx20.htm
+       # https://www.feb-patrimoine.com/english/bull_dpx2.htm
+       # https://www.feb-patrimoine.com/english/unix_and_bull.htm
+       dpx2 | dpx2[23]00 | dpx2[23]xx)
                cpu=m68k
                vendor=bull
-               basic_os=sysv3
+               ;;
+       dpx2100 | dpx21xx)
+               cpu=i386
+               vendor=bull
+               ;;
+       dpx20)
+               cpu=rs6000
+               vendor=bull
                ;;
        encore | umax | mmax)
                cpu=ns32k
@@ -837,18 +901,6 @@ case $basic_machine in
        next | m*-next)
                cpu=m68k
                vendor=next
-               case $basic_os in
-                   openstep*)
-                       ;;
-                   nextstep*)
-                       ;;
-                   ns2*)
-                     basic_os=nextstep2
-                       ;;
-                   *)
-                     basic_os=nextstep3
-                       ;;
-               esac
                ;;
        np1)
                cpu=np1
@@ -937,7 +989,6 @@ case $basic_machine in
                ;;
 
        *-*)
-               # shellcheck disable=SC2162
                saved_IFS=$IFS
                IFS="-" read cpu vendor <<EOF
 $basic_machine
@@ -972,15 +1023,19 @@ unset -v basic_machine
 
 # Decode basic machines in the full and proper CPU-Company form.
 case $cpu-$vendor in
-       # Here we handle the default manufacturer of certain CPU types in 
canonical form. It is in
-       # some cases the only manufacturer, in others, it is the most popular.
+       # Here we handle the default manufacturer of certain CPU types in 
canonical form.
+       # It is in some cases the only manufacturer, in others, it is the most 
popular.
+       c[12]-convex | c[12]-unknown | c3[248]-convex | c3[248]-unknown)
+               vendor=convex
+               basic_os=${basic_os:-bsd}
+               ;;
        craynv-unknown)
                vendor=cray
                basic_os=${basic_os:-unicosmp}
                ;;
        c90-unknown | c90-cray)
                vendor=cray
-               basic_os=${Basic_os:-unicos}
+               basic_os=${basic_os:-unicos}
                ;;
        fx80-unknown)
                vendor=alliant
@@ -1026,11 +1081,29 @@ case $cpu-$vendor in
                vendor=alt
                basic_os=${basic_os:-linux-gnueabihf}
                ;;
-       dpx20-unknown | dpx20-bull)
-               cpu=rs6000
-               vendor=bull
+
+       # Normalized CPU+vendor pairs that imply an OS, if not otherwise 
specified
+       m68k-isi)
+               basic_os=${basic_os:-sysv}
+               ;;
+       m68k-sony)
+               basic_os=${basic_os:-newsos}
+               ;;
+       m68k-tektronix)
+               basic_os=${basic_os:-bsd}
+               ;;
+       m88k-harris)
+               basic_os=${basic_os:-sysv3}
+               ;;
+       i386-bull | m68k-bull)
+               basic_os=${basic_os:-sysv3}
+               ;;
+       rs6000-bull)
                basic_os=${basic_os:-bosx}
                ;;
+       mips-sni)
+               basic_os=${basic_os:-sysv4}
+               ;;
 
        # Here we normalize CPU types irrespective of the vendor
        amd64-*)
@@ -1038,7 +1111,7 @@ case $cpu-$vendor in
                ;;
        blackfin-*)
                cpu=bfin
-               basic_os=linux
+               basic_os=${basic_os:-linux}
                ;;
        c54x-*)
                cpu=tic54x
@@ -1061,7 +1134,7 @@ case $cpu-$vendor in
                ;;
        m68knommu-*)
                cpu=m68k
-               basic_os=linux
+               basic_os=${basic_os:-linux}
                ;;
        m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
                cpu=s12z
@@ -1071,7 +1144,7 @@ case $cpu-$vendor in
                ;;
        parisc-*)
                cpu=hppa
-               basic_os=linux
+               basic_os=${basic_os:-linux}
                ;;
        pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
                cpu=i586
@@ -1085,9 +1158,6 @@ case $cpu-$vendor in
        pentium4-*)
                cpu=i786
                ;;
-       pc98-*)
-               cpu=i386
-               ;;
        ppc-* | ppcbe-*)
                cpu=powerpc
                ;;
@@ -1121,9 +1191,6 @@ case $cpu-$vendor in
        tx39el-*)
                cpu=mipstx39el
                ;;
-       x64-*)
-               cpu=x86_64
-               ;;
        xscale-* | xscalee[bl]-*)
                cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
                ;;
@@ -1179,90 +1246,227 @@ case $cpu-$vendor in
                # Recognize the canonical CPU types that are allowed with any
                # company name.
                case $cpu in
-                       1750a | 580 \
+                         1750a \
+                       | 580 \
+                       | [cjt]90 \
                        | a29k \
-                       | aarch64 | aarch64_be | aarch64c | arm64ec \
+                       | aarch64 \
+                       | aarch64_be \
+                       | aarch64c \
                        | abacus \
-                       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
-                       | alpha64 | alpha64ev[4-8] | alpha64ev56 | 
alpha64ev6[78] \
-                       | alphapca5[67] | alpha64pca5[67] \
+                       | alpha \
+                       | alpha64 \
+                       | alpha64ev56 \
+                       | alpha64ev6[78] \
+                       | alpha64ev[4-8] \
+                       | alpha64pca5[67] \
+                       | alphaev56 \
+                       | alphaev6[78] \
+                       | alphaev[4-8] \
+                       | alphapca5[67] \
                        | am33_2.0 \
                        | amdgcn \
-                       | arc | arceb | arc32 | arc64 \
-                       | arm | arm[lb]e | arme[lb] | armv* \
-                       | avr | avr32 \
+                       | arc \
+                       | arc32 \
+                       | arc64 \
+                       | arceb \
+                       | arm \
+                       | arm64e \
+                       | arm64ec \
+                       | arm[lb]e \
+                       | arme[lb] \
+                       | armv* \
                        | asmjs \
+                       | avr \
+                       | avr32 \
                        | ba \
-                       | be32 | be64 \
-                       | bfin | bpf | bs2000 \
-                       | c[123]* | c30 | [cjt]90 | c4x \
-                       | c8051 | clipper | craynv | csky | cydra \
-                       | d10v | d30v | dlx | dsp16xx \
-                       | e2k | elxsi | epiphany \
-                       | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
-                       | javascript \
-                       | h8300 | h8500 \
-                       | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+                       | be32 \
+                       | be64 \
+                       | bfin \
+                       | bpf \
+                       | bs2000 \
+                       | c30 \
+                       | c4x \
+                       | c8051 \
+                       | c[123]* \
+                       | clipper \
+                       | craynv \
+                       | csky \
+                       | cydra \
+                       | d10v \
+                       | d30v \
+                       | dlx \
+                       | dsp16xx \
+                       | e2k \
+                       | elxsi \
+                       | epiphany \
+                       | f30[01] \
+                       | f700 \
+                       | fido \
+                       | fr30 \
+                       | frv \
+                       | ft32 \
+                       | fx80 \
+                       | h8300 \
+                       | h8500 \
                        | hexagon \
-                       | i370 | i*86 | i860 | i960 | ia16 | ia64 \
-                       | ip2k | iq2000 \
+                       | hppa \
+                       | hppa1.[01] \
+                       | hppa2.0 \
+                       | hppa2.0[nw] \
+                       | hppa64 \
+                       | i*86 \
+                       | i370 \
+                       | i860 \
+                       | i960 \
+                       | ia16 \
+                       | ia64 \
+                       | ip2k \
+                       | iq2000 \
+                       | javascript \
                        | k1om \
                        | kvx \
-                       | le32 | le64 \
+                       | le32 \
+                       | le64 \
                        | lm32 \
-                       | loongarch32 | loongarch64 \
-                       | m32c | m32r | m32rle \
-                       | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | 
m68k \
-                       | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
-                       | m88110 | m88k | maxq | mb | mcore | mep | metag \
-                       | microblaze | microblazeel \
+                       | loongarch32 \
+                       | loongarch64 \
+                       | m32c \
+                       | m32r \
+                       | m32rle \
+                       | m5200 \
+                       | m68000 \
+                       | m680[012346]0 \
+                       | m6811 \
+                       | m6812 \
+                       | m68360 \
+                       | m683?2 \
+                       | m68hc11 \
+                       | m68hc12 \
+                       | m68hcs12x \
+                       | m68k \
+                       | m88110 \
+                       | m88k \
+                       | maxq \
+                       | mb \
+                       | mcore \
+                       | mep \
+                       | metag \
+                       | microblaze \
+                       | microblazeel \
                        | mips* \
                        | mmix \
-                       | mn10200 | mn10300 \
+                       | mn10200 \
+                       | mn10300 \
                        | moxie \
-                       | mt \
                        | msp430 \
+                       | mt \
                        | nanomips* \
-                       | nds32 | nds32le | nds32be \
+                       | nds32 \
+                       | nds32be \
+                       | nds32le \
                        | nfp \
-                       | nios | nios2 | nios2eb | nios2el \
-                       | none | np1 | ns16k | ns32k | nvptx \
+                       | nios \
+                       | nios2 \
+                       | nios2eb \
+                       | nios2el \
+                       | none \
+                       | np1 \
+                       | ns16k \
+                       | ns32k \
+                       | nvptx \
                        | open8 \
                        | or1k* \
                        | or32 \
                        | orion \
+                       | pdp10 \
+                       | pdp11 \
                        | picochip \
-                       | pdp10 | pdp11 | pj | pjl | pn | power \
-                       | powerpc | powerpc64 | powerpc64le | powerpcle | 
powerpcspe \
+                       | pj \
+                       | pjl \
+                       | pn \
+                       | power \
+                       | powerpc \
+                       | powerpc64 \
+                       | powerpc64le \
+                       | powerpcle \
+                       | powerpcspe \
                        | pru \
                        | pyramid \
-                       | riscv | riscv32 | riscv32be | riscv64 | riscv64be \
-                       | rl78 | romp | rs6000 | rx \
-                       | s390 | s390x \
+                       | riscv \
+                       | riscv32 \
+                       | riscv32be \
+                       | riscv64 \
+                       | riscv64be \
+                       | rl78 \
+                       | romp \
+                       | rs6000 \
+                       | rx \
+                       | s390 \
+                       | s390x \
                        | score \
-                       | sh | shl \
-                       | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] 
| sh[lb]e \
-                       | sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | 
sh64le \
-                       | sparc | sparc64 | sparc64b | sparc64v | sparc86x | 
sparclet \
+                       | sh \
+                       | sh64 \
+                       | sh64le \
+                       | sh[12345][lb]e \
+                       | sh[1234] \
+                       | sh[1234]e[lb] \
+                       | sh[23]e \
+                       | sh[23]ele \
+                       | sh[24]a \
*** 26534 LINES SKIPPED ***

Reply via email to