On Thu, Feb 09, 2017 at 08:39:42PM +0100, Jeremie Courreges-Anglas wrote:
> Initial diff committed. The diff below should save a few bytes.
>
> ok?
OK bluhm@
> Index: icmp6.c
> ===================================================================
> RCS file: /d/cvs/src/sys/netinet6/icmp6.c,v
> retrieving revision 1.200
> diff -u -p -p -u -r1.200 icmp6.c
> --- icmp6.c 9 Feb 2017 15:23:35 -0000 1.200
> +++ icmp6.c 9 Feb 2017 18:55:52 -0000
> @@ -156,57 +156,60 @@ icmp6_init(void)
> void
> icmp6_errcount(int type, int code)
> {
> + enum icmp6stat_counters c = icp6s_ounknown;
> +
> switch (type) {
> case ICMP6_DST_UNREACH:
> switch (code) {
> case ICMP6_DST_UNREACH_NOROUTE:
> - icmp6stat_inc(icp6s_odst_unreach_noroute);
> - return;
> + c = icp6s_odst_unreach_noroute;
> + break;
> case ICMP6_DST_UNREACH_ADMIN:
> - icmp6stat_inc(icp6s_odst_unreach_admin);
> - return;
> + c = icp6s_odst_unreach_admin;
> + break;
> case ICMP6_DST_UNREACH_BEYONDSCOPE:
> - icmp6stat_inc(icp6s_odst_unreach_beyondscope);
> - return;
> + c = icp6s_odst_unreach_beyondscope;
> + break;
> case ICMP6_DST_UNREACH_ADDR:
> - icmp6stat_inc(icp6s_odst_unreach_addr);
> - return;
> + c = icp6s_odst_unreach_addr;
> + break;
> case ICMP6_DST_UNREACH_NOPORT:
> - icmp6stat_inc(icp6s_odst_unreach_noport);
> - return;
> + c = icp6s_odst_unreach_noport;
> + break;
> }
> break;
> case ICMP6_PACKET_TOO_BIG:
> - icmp6stat_inc(icp6s_opacket_too_big);
> - return;
> + c = icp6s_opacket_too_big;
> + break;
> case ICMP6_TIME_EXCEEDED:
> switch (code) {
> case ICMP6_TIME_EXCEED_TRANSIT:
> - icmp6stat_inc(icp6s_otime_exceed_transit);
> - return;
> + c = icp6s_otime_exceed_transit;
> + break;
> case ICMP6_TIME_EXCEED_REASSEMBLY:
> - icmp6stat_inc(icp6s_otime_exceed_reassembly);
> - return;
> + c = icp6s_otime_exceed_reassembly;
> + break;
> }
> break;
> case ICMP6_PARAM_PROB:
> switch (code) {
> case ICMP6_PARAMPROB_HEADER:
> - icmp6stat_inc(icp6s_oparamprob_header);
> - return;
> + c = icp6s_oparamprob_header;
> + break;
> case ICMP6_PARAMPROB_NEXTHEADER:
> - icmp6stat_inc(icp6s_oparamprob_nextheader);
> - return;
> + c = icp6s_oparamprob_nextheader;
> + break;
> case ICMP6_PARAMPROB_OPTION:
> - icmp6stat_inc(icp6s_oparamprob_option);
> - return;
> + c = icp6s_oparamprob_option;
> + break;
> }
> break;
> case ND_REDIRECT:
> - icmp6stat_inc(icp6s_oredirect);
> - return;
> + c = icp6s_oredirect;
> + break;
> }
> - icmp6stat_inc(icp6s_ounknown);
> +
> + icmp6stat_inc(c);
> }
>
> /*
>
> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE