Module Name: src Committed By: maxv Date: Sun Apr 29 07:05:13 UTC 2018
Modified Files: src/sys/netinet6: icmp6.c ip6_mroute.c raw_ip6.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.234 -r1.235 src/sys/netinet6/icmp6.c cvs rdiff -u -r1.125 -r1.126 src/sys/netinet6/ip6_mroute.c cvs rdiff -u -r1.170 -r1.171 src/sys/netinet6/raw_ip6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet6/icmp6.c diff -u src/sys/netinet6/icmp6.c:1.234 src/sys/netinet6/icmp6.c:1.235 --- src/sys/netinet6/icmp6.c:1.234 Sat Apr 28 13:26:57 2018 +++ src/sys/netinet6/icmp6.c Sun Apr 29 07:05:13 2018 @@ -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 @@ _icmp6_input(struct mbuf *m, int off, in * 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_input(struct mbuf *m, int off, in 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 @@ _icmp6_input(struct mbuf *m, int off, in 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 @@ _icmp6_input(struct mbuf *m, int off, in 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 @@ _icmp6_input(struct mbuf *m, int off, in 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 @@ _icmp6_input(struct mbuf *m, int off, in 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 @@ _icmp6_input(struct mbuf *m, int off, in 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 @@ _icmp6_input(struct mbuf *m, int off, in 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 @@ icmp6_rip6_input(struct mbuf **mp, int o /* 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 */ Index: src/sys/netinet6/ip6_mroute.c diff -u src/sys/netinet6/ip6_mroute.c:1.125 src/sys/netinet6/ip6_mroute.c:1.126 --- src/sys/netinet6/ip6_mroute.c:1.125 Thu Apr 26 19:50:09 2018 +++ src/sys/netinet6/ip6_mroute.c Sun Apr 29 07:05:13 2018 @@ -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 @@ ip6_mforward(struct ip6_hdr *ip6, struct 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 @@ phyint_send(struct ip6_hdr *ip6, struct * 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 @@ register_send(struct ip6_hdr *ip6, struc 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; } Index: src/sys/netinet6/raw_ip6.c diff -u src/sys/netinet6/raw_ip6.c:1.170 src/sys/netinet6/raw_ip6.c:1.171 --- src/sys/netinet6/raw_ip6.c:1.170 Sat Apr 28 13:26:57 2018 +++ src/sys/netinet6/raw_ip6.c Sun Apr 29 07:05:13 2018 @@ -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 @@ rip6_input(struct mbuf **mp, int *offp, /* 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 */