diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2022-10-04 03:53:04 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2022-10-04 03:53:04 +0000 |
commit | 53807a8a27dc5e80d6564aee61b7fe2aeaf99768 (patch) | |
tree | 249c82e2a6233570094e46ef2e41e7df7e50078c | |
parent | 43d39ca7e5180d4a04ae50996a542f69b4609402 (diff) | |
download | src-53807a8a27dc5e80d6564aee61b7fe2aeaf99768.tar.gz src-53807a8a27dc5e80d6564aee61b7fe2aeaf99768.zip |
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.
-rw-r--r-- | sys/netinet/ip_input.c | 20 | ||||
-rw-r--r-- | 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) */ }; |