Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 Reduce the number of return points of frag6_input



details:   https://anonhg.NetBSD.org/src/rev/885730cf17dd
branches:  trunk
changeset: 818950:885730cf17dd
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Nov 09 03:49:38 2016 +0000

description:
Reduce the number of return points of frag6_input

No functional change.

diffstat:

 sys/netinet6/frag6.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (77 lines):

diff -r 08b64f16f02e -r 885730cf17dd sys/netinet6/frag6.c
--- a/sys/netinet6/frag6.c      Wed Nov 09 03:33:30 2016 +0000
+++ b/sys/netinet6/frag6.c      Wed Nov 09 03:49:38 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: frag6.c,v 1.56 2014/09/05 05:33:06 matt Exp $  */
+/*     $NetBSD: frag6.c,v 1.57 2016/11/09 03:49:38 ozaki-r Exp $       */
 /*     $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $  */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.56 2014/09/05 05:33:06 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.57 2016/11/09 03:49:38 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -148,7 +148,7 @@
        if (ip6->ip6_plen == 0) {
                icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset);
                in6_ifstat_inc(dstifp, ifs6_reass_fail);
-               return IPPROTO_DONE;
+               goto done;
        }
 
        /*
@@ -162,7 +162,7 @@
                icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
                    offsetof(struct ip6_hdr, ip6_plen));
                in6_ifstat_inc(dstifp, ifs6_reass_fail);
-               return IPPROTO_DONE;
+               goto done;
        }
 
        IP6_STATINC(IP6_STAT_FRAGMENTS);
@@ -267,14 +267,14 @@
                        icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
                            offset - sizeof(struct ip6_frag) +
                            offsetof(struct ip6_frag, ip6f_offlg));
-                       return IPPROTO_DONE;
+                       goto done;
                }
        } else if (fragoff + frgpartlen > IPV6_MAXPACKET) {
                mutex_exit(&frag6_lock);
                icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
                            offset - sizeof(struct ip6_frag) +
                                offsetof(struct ip6_frag, ip6f_offlg));
-               return IPPROTO_DONE;
+               goto done;
        }
        /*
         * If it's the first fragment, do the above check for each
@@ -382,13 +382,13 @@
             af6 = af6->ip6af_down) {
                if (af6->ip6af_off != next) {
                        mutex_exit(&frag6_lock);
-                       return IPPROTO_DONE;
+                       goto done;
                }
                next += af6->ip6af_frglen;
        }
        if (af6->ip6af_up->ip6af_mff) {
                mutex_exit(&frag6_lock);
-               return IPPROTO_DONE;
+               goto done;
        }
 
        /*
@@ -479,6 +479,7 @@
        in6_ifstat_inc(dstifp, ifs6_reass_fail);
        IP6_STATINC(IP6_STAT_FRAGDROPPED);
        m_freem(m);
+ done:
        return IPPROTO_DONE;
 }
 



Home | Main Index | Thread Index | Old Index