From nobody Tue Oct 04 03:57:33 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MhP6j3dwwz4dl8Y; Tue, 4 Oct 2022 03:57:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MhP6j1ZwMz3s9f; Tue, 4 Oct 2022 03:57:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664855853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WcUirJ4LhfYfAZm1j3zjDe2c0qE8txgEEJ8Np56iH3c=; b=OooBCwe5EF+upJh1XbVNK3I3C26YBbCyV5CfHTJOVOO2voAdpRJfGbP9GL5gL/1BXAzc/C tY94VtpcexEBZ1DtHQbZgm2bUxUZ+MVm3ZWHAvyMrAxkIQWmFzCXBZ0wVUs+1ovVzQeLm/ 6KQ6UckAGgKtojg7wE3Le+UX1NF7H6smNj/Pikk9qs1X2peWAy58v7wxVqvSBtxN4bUY2p gkjIYly+b9gj7khpdCKA1Fxi4thhPkgxP7eOUZZQkARDvMjlNN6q0Le2p9XQ0/4yAUQBmb Z5rD3D/IeQDsUbTx40XglHBo3DzvuJhZdWdY5lOTmfdgFCS8+QBNt6cJM8w9PQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MhP6j0fwqzR50; Tue, 4 Oct 2022 03:57:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2943vX8x015330; Tue, 4 Oct 2022 03:57:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2943vXGF015329; Tue, 4 Oct 2022 03:57:33 GMT (envelope-from git) Date: Tue, 4 Oct 2022 03:57:33 GMT Message-Id: <202210040357.2943vXGF015329@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 53807a8a27dc - main - netinet*: use sparse C99 initializer for inetctlerrmap List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53807a8a27dc5e80d6564aee61b7fe2aeaf99768 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664855853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WcUirJ4LhfYfAZm1j3zjDe2c0qE8txgEEJ8Np56iH3c=; b=jvVvkTtLrO+9bsR7M3hW14+NOzjOhMuO6G5fbWfztDseET1w6a/tGEs03UtLVqduBE7rzE 3rwt7myZ4ZqiN68LMb3vbZfJnEYMHFCDrm/5maxWV9XexPO5zSOPPfEXY7RzeRFxKt+k3/ iTaRK+m+YwF+hsacP4Yh3mirgi+Kn3/9jG16Am7Dfxupjmy3+zrrKkKURcxfIh0G9LZZAX 4hYYoVoUKg+fotLI+VIcIPopuXwqv8v8vLbgXggXxteoqRzyC2E76ne2NX3aViNfkdci42 8QcLKdHqQvBEMkUyf6+S6BmBj9xC+LYSvsIIcCQ6L7N8u8tOnR27jg/xaiIb3A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664855853; a=rsa-sha256; cv=none; b=pbjBdbZm2Iu0+pURP5F5AUVp5yHVXT+6+xBS5DghpiQTkT+ErSM95FaOJvtsrOKOtQN+6P 22CFV05ZF7LNy1eBKLkFK6iTH2AcCIxc5iq/HMdzvZnSD3bEQq5MmHrstV29HHxOB9jQnb DF17fXbRr94HI78TS0W+hf0J3bSJj50BS38qZ6zIAOJA54w1dSxqbnLvMFX9L31V3N3TaM Vahu85vpba57MTy14CKuoANRJue1Qnn+sSd96kMlAklKlZ+l8+ZHveK/Osjfi8y9njPZCZ erWUujSV+xvc9cgptKxhwG2UfELmURCaHgj20OtLVrIYiDwS/tJGzIQJA3Dncg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=53807a8a27dc5e80d6564aee61b7fe2aeaf99768 commit 53807a8a27dc5e80d6564aee61b7fe2aeaf99768 Author: Gleb Smirnoff AuthorDate: 2022-10-04 03:53:04 +0000 Commit: Gleb Smirnoff CommitDate: 2022-10-04 03:53:04 +0000 netinet*: use sparse C99 initializer for inetctlerrmap and mark those PRC_* codes, that are used. The rest are dead code. This is not a functional change, but illustrative to make easier review of following changes. --- sys/netinet/ip_input.c | 20 ++++++++++++++------ sys/netinet6/ip6_input.c | 21 ++++++++++++++------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 952b14943780..145c4464b855 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -873,13 +873,21 @@ ipproto_unregister(uint8_t proto) return (ENOENT); } +/* (x) - issued by icmp_input() */ u_char inetctlerrmap[PRC_NCMDS] = { - 0, 0, 0, 0, - 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH, - EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED, - EMSGSIZE, EHOSTUNREACH, 0, 0, - 0, 0, EHOSTUNREACH, 0, - ENOPROTOOPT, ECONNREFUSED + [PRC_MSGSIZE] = EMSGSIZE, /* (x) */ + [PRC_HOSTDEAD] = EHOSTDOWN, + [PRC_HOSTUNREACH] = EHOSTUNREACH, + [PRC_UNREACH_NET] = EHOSTUNREACH, /* (x) */ + [PRC_UNREACH_HOST] = EHOSTUNREACH, + [PRC_UNREACH_PROTOCOL] = ECONNREFUSED, /* (x) */ + [PRC_UNREACH_PORT] = ECONNREFUSED, /* (x) */ + [12] = EMSGSIZE, + [PRC_UNREACH_SRCFAIL] = EHOSTUNREACH, + [PRC_TIMXCEED_INTRANS] = EHOSTUNREACH, /* (x) */ + [PRC_TIMXCEED_REASS] = 0, /* (x) */ + [PRC_PARAMPROB] = ENOPROTOOPT, /* (x) */ + [PRC_UNREACH_ADMIN_PROHIB] = ECONNREFUSED, /* (x) */ }; /* diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 31a3170475cb..7bee7425421f 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1710,13 +1710,20 @@ ip6_lasthdr(const struct mbuf *m, int off, int proto, int *nxtp) /* * System control for IP6 + * (x) - issued by icmp6_input() */ - u_char inet6ctlerrmap[PRC_NCMDS] = { - 0, 0, 0, 0, - 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH, - EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED, - EMSGSIZE, EHOSTUNREACH, 0, 0, - 0, 0, EHOSTUNREACH, 0, - ENOPROTOOPT, ECONNREFUSED + [PRC_MSGSIZE] = EMSGSIZE, /* (x) */ + [PRC_HOSTDEAD] = EHOSTDOWN, + [PRC_HOSTUNREACH] = EHOSTUNREACH, + [PRC_UNREACH_NET] = EHOSTUNREACH, /* (x) */ + [PRC_UNREACH_HOST] = EHOSTUNREACH, + [PRC_UNREACH_PROTOCOL] = ECONNREFUSED, /* (x) */ + [PRC_UNREACH_PORT] = ECONNREFUSED, /* (x) */ + [12] = EMSGSIZE, + [PRC_UNREACH_SRCFAIL] = EHOSTUNREACH, + [PRC_TIMXCEED_INTRANS] = EHOSTUNREACH, /* (x) */ + [PRC_TIMXCEED_REASS] = 0, /* (x) */ + [PRC_PARAMPROB] = ENOPROTOOPT, /* (x) */ + [PRC_UNREACH_ADMIN_PROHIB] = ECONNREFUSED, /* (x) */ };