Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 Replace



details:   https://anonhg.NetBSD.org/src/rev/af1f8793d57c
branches:  trunk
changeset: 318556:af1f8793d57c
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Apr 29 07:05:13 2018 +0000
description:
Replace
        m_copym(m, 0, M_COPYALL, M_DONTWAIT)
by
        m_copypacket(m, M_DONTWAIT)
when it is obvious that 'm' has M_PKTHDR set.

diffstat:

 sys/netinet6/icmp6.c      |  22 +++++++++++-----------
 sys/netinet6/ip6_mroute.c |  10 +++++-----
 sys/netinet6/raw_ip6.c    |   6 +++---
 3 files changed, 19 insertions(+), 19 deletions(-)

diffs (171 lines):

diff -r 87250a48eab2 -r af1f8793d57c sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c      Sun Apr 29 06:52:55 2018 +0000
+++ b/sys/netinet6/icmp6.c      Sun Apr 29 07:05:13 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icmp6.c,v 1.234 2018/04/28 13:26:57 maxv Exp $ */
+/*     $NetBSD: icmp6.c,v 1.235 2018/04/29 07:05:13 maxv Exp $ */
 /*     $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.234 2018/04/28 13:26:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.235 2018/04/29 07:05:13 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -637,7 +637,7 @@
                 * copy the first part of the data into a fresh mbuf.
                 * Otherwise, we will wrongly overwrite both copies.
                 */
-               if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+               if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
                        /* Give up local */
                        n = m;
                        m = NULL;
@@ -686,7 +686,7 @@
                        icmp6_ifstat_inc(rcvif, ifs6_in_mldquery);
                else
                        icmp6_ifstat_inc(rcvif, ifs6_in_mldreport);
-               if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+               if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
                        /* give up local */
                        mld_input(m, off);
                        m = NULL;
@@ -723,7 +723,7 @@
                        goto badlen;
 
                if (mode == FQDN) {
-                       n = m_copym(m, 0, M_COPYALL, M_DONTWAIT);
+                       n = m_copypacket(m, M_DONTWAIT);
                        if (n)
                                n = ni6_input(n, off);
                } else {
@@ -795,7 +795,7 @@
                        goto badcode;
                if (icmp6len < sizeof(struct nd_router_solicit))
                        goto badlen;
-               if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+               if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
                        /* give up local */
                        nd6_rs_input(m, off, icmp6len);
                        m = NULL;
@@ -811,7 +811,7 @@
                        goto badcode;
                if (icmp6len < sizeof(struct nd_router_advert))
                        goto badlen;
-               if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+               if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
                        /* give up local */
                        nd6_ra_input(m, off, icmp6len);
                        m = NULL;
@@ -827,7 +827,7 @@
                        goto badcode;
                if (icmp6len < sizeof(struct nd_neighbor_solicit))
                        goto badlen;
-               if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+               if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
                        /* give up local */
                        nd6_ns_input(m, off, icmp6len);
                        m = NULL;
@@ -843,7 +843,7 @@
                        goto badcode;
                if (icmp6len < sizeof(struct nd_neighbor_advert))
                        goto badlen;
-               if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+               if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
                        /* give up local */
                        nd6_na_input(m, off, icmp6len);
                        m = NULL;
@@ -859,7 +859,7 @@
                        goto badcode;
                if (icmp6len < sizeof(struct nd_redirect))
                        goto badlen;
-               if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+               if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
                        /* give up local */
                        icmp6_redirect_input(m, off);
                        m = NULL;
@@ -1966,7 +1966,7 @@
                        /* do not inject data into pcb */
                }
 #endif
-               else if ((n = m_copym(m, 0, (int)M_COPYALL, M_DONTWAIT)) != NULL) {
+               else if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) {
                        if (last->in6p_flags & IN6P_CONTROLOPTS)
                                ip6_savecontrol(last, &opts, ip6, n);
                        /* strip intermediate headers */
diff -r 87250a48eab2 -r af1f8793d57c sys/netinet6/ip6_mroute.c
--- a/sys/netinet6/ip6_mroute.c Sun Apr 29 06:52:55 2018 +0000
+++ b/sys/netinet6/ip6_mroute.c Sun Apr 29 07:05:13 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_mroute.c,v 1.125 2018/04/26 19:50:09 maxv Exp $    */
+/*     $NetBSD: ip6_mroute.c,v 1.126 2018/04/29 07:05:13 maxv Exp $    */
 /*     $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $     */
 
 /*
@@ -117,7 +117,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.125 2018/04/26 19:50:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.126 2018/04/29 07:05:13 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1125,7 +1125,7 @@
                        splx(s);
                        return ENOBUFS;
                }
-               mb0 = m_copym(m, 0, M_COPYALL, M_DONTWAIT);
+               mb0 = m_copypacket(m, M_DONTWAIT);
 
                /*
                 * Pullup packet header if needed before storing it,
@@ -1548,7 +1548,7 @@
         * the IPv6 header is actually copied, not just referenced,
         * so that ip6_output() only scribbles on the copy.
         */
-       mb_copy = m_copym(m, 0, M_COPYALL, M_DONTWAIT);
+       mb_copy = m_copypacket(m, M_DONTWAIT);
        if (mb_copy && M_UNWRITABLE(mb_copy, sizeof(struct ip6_hdr)))
                mb_copy = m_pullup(mb_copy, sizeof(struct ip6_hdr));
        if (mb_copy == NULL) {
@@ -1668,7 +1668,7 @@
        mm->m_data += max_linkhdr;
        mm->m_len = sizeof(struct ip6_hdr);
 
-       if ((mm->m_next = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+       if ((mm->m_next = m_copypacket(m, M_DONTWAIT)) == NULL) {
                m_freem(mm);
                return ENOBUFS;
        }
diff -r 87250a48eab2 -r af1f8793d57c sys/netinet6/raw_ip6.c
--- a/sys/netinet6/raw_ip6.c    Sun Apr 29 06:52:55 2018 +0000
+++ b/sys/netinet6/raw_ip6.c    Sun Apr 29 07:05:13 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: raw_ip6.c,v 1.170 2018/04/28 13:26:57 maxv Exp $       */
+/*     $NetBSD: raw_ip6.c,v 1.171 2018/04/29 07:05:13 maxv Exp $       */
 /*     $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $        */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.170 2018/04/28 13:26:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.171 2018/04/29 07:05:13 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -197,7 +197,7 @@
                        /* do not inject data into pcb */
                }
 #endif
-               else if ((n = m_copym(m, 0, (int)M_COPYALL, M_DONTWAIT)) != NULL) {
+               else if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) {
                        if (last->in6p_flags & IN6P_CONTROLOPTS)
                                ip6_savecontrol(last, &opts, ip6, n);
                        /* strip intermediate headers */



Home | Main Index | Thread Index | Old Index