Replace: M_MOVE_PKTHDR -> m_move_pkthdr. No functional change, since the former is a macro to the latter.diff -r1.15 -r1.16 src/sys/arch/arm/imx/if_enet.c
(maxv)
--- src/sys/arch/arm/imx/if_enet.c 2018/09/03 16:29:23 1.15
+++ src/sys/arch/arm/imx/if_enet.c 2018/12/22 13:11:37 1.16
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_enet.c,v 1.15 2018/09/03 16:29:23 riastradh Exp $ */ | 1 | /* $NetBSD: if_enet.c,v 1.16 2018/12/22 13:11:37 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2014 Ryo Shimizu <ryo@nerv.org> | 4 | * Copyright (c) 2014 Ryo Shimizu <ryo@nerv.org> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | 26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | /* | 29 | /* | |
30 | * i.MX6,7 10/100/1000-Mbps ethernet MAC (ENET) | 30 | * i.MX6,7 10/100/1000-Mbps ethernet MAC (ENET) | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.15 2018/09/03 16:29:23 riastradh Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.16 2018/12/22 13:11:37 maxv Exp $"); | |
35 | 35 | |||
36 | #include "vlan.h" | 36 | #include "vlan.h" | |
37 | 37 | |||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/bus.h> | 39 | #include <sys/bus.h> | |
40 | #include <sys/mbuf.h> | 40 | #include <sys/mbuf.h> | |
41 | #include <sys/device.h> | 41 | #include <sys/device.h> | |
42 | #include <sys/sockio.h> | 42 | #include <sys/sockio.h> | |
43 | #include <sys/kernel.h> | 43 | #include <sys/kernel.h> | |
44 | #include <sys/rndsource.h> | 44 | #include <sys/rndsource.h> | |
45 | 45 | |||
46 | #include <lib/libkern/libkern.h> | 46 | #include <lib/libkern/libkern.h> | |
47 | 47 | |||
@@ -1495,27 +1495,27 @@ enet_encap_mbufalign(struct mbuf **mp) | @@ -1495,27 +1495,27 @@ enet_encap_mbufalign(struct mbuf **mp) | |||
1495 | } else { | 1495 | } else { | |
1496 | /* | 1496 | /* | |
1497 | * no space to align data. (M_READONLY?) | 1497 | * no space to align data. (M_READONLY?) | |
1498 | * allocate new mbuf aligned, | 1498 | * allocate new mbuf aligned, | |
1499 | * and copy to it. | 1499 | * and copy to it. | |
1500 | */ | 1500 | */ | |
1501 | MGET(x, M_DONTWAIT, m->m_type); | 1501 | MGET(x, M_DONTWAIT, m->m_type); | |
1502 | if (x == NULL) { | 1502 | if (x == NULL) { | |
1503 | m_freem(m); | 1503 | m_freem(m); | |
1504 | return ENOBUFS; | 1504 | return ENOBUFS; | |
1505 | } | 1505 | } | |
1506 | MCLAIM(x, m->m_owner); | 1506 | MCLAIM(x, m->m_owner); | |
1507 | if (m->m_flags & M_PKTHDR) | 1507 | if (m->m_flags & M_PKTHDR) | |
1508 | M_MOVE_PKTHDR(x, m); | 1508 | m_move_pkthdr(x, m); | |
1509 | x->m_len = m->m_len; | 1509 | x->m_len = m->m_len; | |
1510 | x->m_data = ALIGN_PTR(x->m_data, | 1510 | x->m_data = ALIGN_PTR(x->m_data, | |
1511 | ALIGNBYTE); | 1511 | ALIGNBYTE); | |
1512 | memcpy(mtod(x, void *), mtod(m, void *), | 1512 | memcpy(mtod(x, void *), mtod(m, void *), | |
1513 | m->m_len); | 1513 | m->m_len); | |
1514 | p->m_next = x; | 1514 | p->m_next = x; | |
1515 | x->m_next = m_free(m); | 1515 | x->m_next = m_free(m); | |
1516 | m = x; | 1516 | m = x; | |
1517 | } | 1517 | } | |
1518 | } | 1518 | } | |
1519 | 1519 | |||
1520 | /* | 1520 | /* | |
1521 | * fill 1st mbuf at least 10byte | 1521 | * fill 1st mbuf at least 10byte | |
@@ -1620,27 +1620,27 @@ enet_encap_mbufalign(struct mbuf **mp) | @@ -1620,27 +1620,27 @@ enet_encap_mbufalign(struct mbuf **mp) | |||
1620 | * | 1620 | * | |
1621 | */ | 1621 | */ | |
1622 | if (alignoff != 0) { | 1622 | if (alignoff != 0) { | |
1623 | /* at least ALIGNBYTE */ | 1623 | /* at least ALIGNBYTE */ | |
1624 | chiplen = ALIGNBYTE - alignoff + ALIGNBYTE; | 1624 | chiplen = ALIGNBYTE - alignoff + ALIGNBYTE; | |
1625 | 1625 | |||
1626 | MGET(x, M_DONTWAIT, m->m_type); | 1626 | MGET(x, M_DONTWAIT, m->m_type); | |
1627 | if (x == NULL) { | 1627 | if (x == NULL) { | |
1628 | m_freem(m); | 1628 | m_freem(m); | |
1629 | return ENOBUFS; | 1629 | return ENOBUFS; | |
1630 | } | 1630 | } | |
1631 | MCLAIM(x, m->m_owner); | 1631 | MCLAIM(x, m->m_owner); | |
1632 | if (m->m_flags & M_PKTHDR) | 1632 | if (m->m_flags & M_PKTHDR) | |
1633 | M_MOVE_PKTHDR(x, m); | 1633 | m_move_pkthdr(x, m); | |
1634 | x->m_data = ALIGN_PTR(x->m_data, ALIGNBYTE); | 1634 | x->m_data = ALIGN_PTR(x->m_data, ALIGNBYTE); | |
1635 | memcpy(mtod(x, void *), mtod(m, void *), | 1635 | memcpy(mtod(x, void *), mtod(m, void *), | |
1636 | chiplen); | 1636 | chiplen); | |
1637 | x->m_len = chiplen; | 1637 | x->m_len = chiplen; | |
1638 | x->m_next = m; | 1638 | x->m_next = m; | |
1639 | m_adj(m, chiplen); | 1639 | m_adj(m, chiplen); | |
1640 | 1640 | |||
1641 | if (p == NULL) | 1641 | if (p == NULL) | |
1642 | m0 = x; | 1642 | m0 = x; | |
1643 | else | 1643 | else | |
1644 | p->m_next = x; | 1644 | p->m_next = x; | |
1645 | } | 1645 | } | |
1646 | } | 1646 | } |
--- src/sys/arch/powerpc/booke/dev/pq3etsec.c 2018/09/03 16:29:26 1.37
+++ src/sys/arch/powerpc/booke/dev/pq3etsec.c 2018/12/22 13:11:37 1.38
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pq3etsec.c,v 1.37 2018/09/03 16:29:26 riastradh Exp $ */ | 1 | /* $NetBSD: pq3etsec.c,v 1.38 2018/12/22 13:11:37 maxv Exp $ */ | |
2 | /*- | 2 | /*- | |
3 | * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. | 3 | * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * This code is derived from software contributed to The NetBSD Foundation | 6 | * This code is derived from software contributed to The NetBSD Foundation | |
7 | * by Raytheon BBN Technologies Corp and Defense Advanced Research Projects | 7 | * by Raytheon BBN Technologies Corp and Defense Advanced Research Projects | |
8 | * Agency and which was developed by Matt Thomas of 3am Software Foundry. | 8 | * Agency and which was developed by Matt Thomas of 3am Software Foundry. | |
9 | * | 9 | * | |
10 | * This material is based upon work supported by the Defense Advanced Research | 10 | * This material is based upon work supported by the Defense Advanced Research | |
11 | * Projects Agency and Space and Naval Warfare Systems Center, Pacific, under | 11 | * Projects Agency and Space and Naval Warfare Systems Center, Pacific, under | |
12 | * Contract No. N66001-09-C-2073. | 12 | * Contract No. N66001-09-C-2073. | |
13 | * Approved for Public Release, Distribution Unlimited | 13 | * Approved for Public Release, Distribution Unlimited | |
14 | * | 14 | * | |
@@ -31,27 +31,27 @@ | @@ -31,27 +31,27 @@ | |||
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
34 | * POSSIBILITY OF SUCH DAMAGE. | 34 | * POSSIBILITY OF SUCH DAMAGE. | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #include "opt_inet.h" | 37 | #include "opt_inet.h" | |
38 | #include "opt_mpc85xx.h" | 38 | #include "opt_mpc85xx.h" | |
39 | #include "opt_multiprocessor.h" | 39 | #include "opt_multiprocessor.h" | |
40 | #include "opt_net_mpsafe.h" | 40 | #include "opt_net_mpsafe.h" | |
41 | 41 | |||
42 | #include <sys/cdefs.h> | 42 | #include <sys/cdefs.h> | |
43 | 43 | |||
44 | __KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.37 2018/09/03 16:29:26 riastradh Exp $"); | 44 | __KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.38 2018/12/22 13:11:37 maxv Exp $"); | |
45 | 45 | |||
46 | #include <sys/param.h> | 46 | #include <sys/param.h> | |
47 | #include <sys/cpu.h> | 47 | #include <sys/cpu.h> | |
48 | #include <sys/device.h> | 48 | #include <sys/device.h> | |
49 | #include <sys/mbuf.h> | 49 | #include <sys/mbuf.h> | |
50 | #include <sys/ioctl.h> | 50 | #include <sys/ioctl.h> | |
51 | #include <sys/intr.h> | 51 | #include <sys/intr.h> | |
52 | #include <sys/bus.h> | 52 | #include <sys/bus.h> | |
53 | #include <sys/kernel.h> | 53 | #include <sys/kernel.h> | |
54 | #include <sys/kmem.h> | 54 | #include <sys/kmem.h> | |
55 | #include <sys/proc.h> | 55 | #include <sys/proc.h> | |
56 | #include <sys/atomic.h> | 56 | #include <sys/atomic.h> | |
57 | #include <sys/callout.h> | 57 | #include <sys/callout.h> | |
@@ -2097,27 +2097,27 @@ pq3etsec_tx_offload( | @@ -2097,27 +2097,27 @@ pq3etsec_tx_offload( | |||
2097 | #ifdef INET6 | 2097 | #ifdef INET6 | |
2098 | in6_undefer_cksum(m, ETHER_HDR_LEN, | 2098 | in6_undefer_cksum(m, ETHER_HDR_LEN, | |
2099 | csum_flags & M_CSUM_IP6); | 2099 | csum_flags & M_CSUM_IP6); | |
2100 | #else | 2100 | #else | |
2101 | panic("%s: impossible M_CSUM flags %#x", | 2101 | panic("%s: impossible M_CSUM flags %#x", | |
2102 | device_xname(sc->sc_dev), csum_flags); | 2102 | device_xname(sc->sc_dev), csum_flags); | |
2103 | #endif | 2103 | #endif | |
2104 | } | 2104 | } | |
2105 | 2105 | |||
2106 | m->m_flags &= ~M_HASFCB; | 2106 | m->m_flags &= ~M_HASFCB; | |
2107 | return; | 2107 | return; | |
2108 | } | 2108 | } | |
2109 | 2109 | |||
2110 | M_MOVE_PKTHDR(mn, m); | 2110 | m_move_pkthdr(mn, m); | |
2111 | mn->m_next = m; | 2111 | mn->m_next = m; | |
2112 | m = mn; | 2112 | m = mn; | |
2113 | MH_ALIGN(m, sizeof(fcb)); | 2113 | MH_ALIGN(m, sizeof(fcb)); | |
2114 | m->m_len = sizeof(fcb); | 2114 | m->m_len = sizeof(fcb); | |
2115 | *mp = m; | 2115 | *mp = m; | |
2116 | } | 2116 | } | |
2117 | m->m_pkthdr.len += sizeof(fcb); | 2117 | m->m_pkthdr.len += sizeof(fcb); | |
2118 | m->m_flags |= M_HASFCB; | 2118 | m->m_flags |= M_HASFCB; | |
2119 | *mtod(m, struct txfcb *) = fcb; | 2119 | *mtod(m, struct txfcb *) = fcb; | |
2120 | return; | 2120 | return; | |
2121 | } | 2121 | } | |
2122 | 2122 | |||
2123 | static bool | 2123 | static bool |
--- src/sys/kern/uipc_mbuf.c 2018/11/15 10:56:30 1.225
+++ src/sys/kern/uipc_mbuf.c 2018/12/22 13:11:37 1.226
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uipc_mbuf.c,v 1.225 2018/11/15 10:56:30 maxv Exp $ */ | 1 | /* $NetBSD: uipc_mbuf.c,v 1.226 2018/12/22 13:11:37 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | |
9 | * NASA Ames Research Center. | 9 | * NASA Ames Research Center. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -52,27 +52,27 @@ | @@ -52,27 +52,27 @@ | |||
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
59 | * SUCH DAMAGE. | 59 | * SUCH DAMAGE. | |
60 | * | 60 | * | |
61 | * @(#)uipc_mbuf.c 8.4 (Berkeley) 2/14/95 | 61 | * @(#)uipc_mbuf.c 8.4 (Berkeley) 2/14/95 | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | #include <sys/cdefs.h> | 64 | #include <sys/cdefs.h> | |
65 | __KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.225 2018/11/15 10:56:30 maxv Exp $"); | 65 | __KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.226 2018/12/22 13:11:37 maxv Exp $"); | |
66 | 66 | |||
67 | #ifdef _KERNEL_OPT | 67 | #ifdef _KERNEL_OPT | |
68 | #include "opt_mbuftrace.h" | 68 | #include "opt_mbuftrace.h" | |
69 | #include "opt_nmbclusters.h" | 69 | #include "opt_nmbclusters.h" | |
70 | #include "opt_ddb.h" | 70 | #include "opt_ddb.h" | |
71 | #include "ether.h" | 71 | #include "ether.h" | |
72 | #endif | 72 | #endif | |
73 | 73 | |||
74 | #include <sys/param.h> | 74 | #include <sys/param.h> | |
75 | #include <sys/systm.h> | 75 | #include <sys/systm.h> | |
76 | #include <sys/atomic.h> | 76 | #include <sys/atomic.h> | |
77 | #include <sys/cpu.h> | 77 | #include <sys/cpu.h> | |
78 | #include <sys/proc.h> | 78 | #include <sys/proc.h> | |
@@ -627,27 +627,27 @@ m_prepend(struct mbuf *m, int len, int h | @@ -627,27 +627,27 @@ m_prepend(struct mbuf *m, int len, int h | |||
627 | 627 | |||
628 | if (__predict_false(len > MHLEN)) { | 628 | if (__predict_false(len > MHLEN)) { | |
629 | panic("%s: len > MHLEN", __func__); | 629 | panic("%s: len > MHLEN", __func__); | |
630 | } | 630 | } | |
631 | 631 | |||
632 | KASSERT(len != M_COPYALL); | 632 | KASSERT(len != M_COPYALL); | |
633 | mn = m_get(how, m->m_type); | 633 | mn = m_get(how, m->m_type); | |
634 | if (mn == NULL) { | 634 | if (mn == NULL) { | |
635 | m_freem(m); | 635 | m_freem(m); | |
636 | return NULL; | 636 | return NULL; | |
637 | } | 637 | } | |
638 | 638 | |||
639 | if (m->m_flags & M_PKTHDR) { | 639 | if (m->m_flags & M_PKTHDR) { | |
640 | M_MOVE_PKTHDR(mn, m); | 640 | m_move_pkthdr(mn, m); | |
641 | } else { | 641 | } else { | |
642 | MCLAIM(mn, m->m_owner); | 642 | MCLAIM(mn, m->m_owner); | |
643 | } | 643 | } | |
644 | mn->m_next = m; | 644 | mn->m_next = m; | |
645 | m = mn; | 645 | m = mn; | |
646 | 646 | |||
647 | if (m->m_flags & M_PKTHDR) { | 647 | if (m->m_flags & M_PKTHDR) { | |
648 | if (len < MHLEN) | 648 | if (len < MHLEN) | |
649 | MH_ALIGN(m, len); | 649 | MH_ALIGN(m, len); | |
650 | } else { | 650 | } else { | |
651 | if (len < MLEN) | 651 | if (len < MLEN) | |
652 | M_ALIGN(m, len); | 652 | M_ALIGN(m, len); | |
653 | } | 653 | } | |
@@ -985,27 +985,27 @@ m_ensure_contig(struct mbuf **m0, int le | @@ -985,27 +985,27 @@ m_ensure_contig(struct mbuf **m0, int le | |||
985 | m = n; | 985 | m = n; | |
986 | n = n->m_next; | 986 | n = n->m_next; | |
987 | len -= m->m_len; | 987 | len -= m->m_len; | |
988 | } else { | 988 | } else { | |
989 | if (len > MHLEN) { | 989 | if (len > MHLEN) { | |
990 | return false; | 990 | return false; | |
991 | } | 991 | } | |
992 | m = m_get(M_DONTWAIT, n->m_type); | 992 | m = m_get(M_DONTWAIT, n->m_type); | |
993 | if (m == NULL) { | 993 | if (m == NULL) { | |
994 | return false; | 994 | return false; | |
995 | } | 995 | } | |
996 | MCLAIM(m, n->m_owner); | 996 | MCLAIM(m, n->m_owner); | |
997 | if (n->m_flags & M_PKTHDR) { | 997 | if (n->m_flags & M_PKTHDR) { | |
998 | M_MOVE_PKTHDR(m, n); | 998 | m_move_pkthdr(m, n); | |
999 | } | 999 | } | |
1000 | } | 1000 | } | |
1001 | space = &m->m_dat[MLEN] - (m->m_data + m->m_len); | 1001 | space = &m->m_dat[MLEN] - (m->m_data + m->m_len); | |
1002 | do { | 1002 | do { | |
1003 | count = MIN(MIN(MAX(len, max_protohdr), space), n->m_len); | 1003 | count = MIN(MIN(MAX(len, max_protohdr), space), n->m_len); | |
1004 | memcpy(mtod(m, char *) + m->m_len, mtod(n, void *), | 1004 | memcpy(mtod(m, char *) + m->m_len, mtod(n, void *), | |
1005 | (unsigned)count); | 1005 | (unsigned)count); | |
1006 | len -= count; | 1006 | len -= count; | |
1007 | m->m_len += count; | 1007 | m->m_len += count; | |
1008 | n->m_len -= count; | 1008 | n->m_len -= count; | |
1009 | space -= count; | 1009 | space -= count; | |
1010 | if (n->m_len) | 1010 | if (n->m_len) | |
1011 | n->m_data += count; | 1011 | n->m_data += count; | |
@@ -1206,27 +1206,27 @@ struct mbuf * | @@ -1206,27 +1206,27 @@ struct mbuf * | |||
1206 | m_copyup(struct mbuf *n, int len, int dstoff) | 1206 | m_copyup(struct mbuf *n, int len, int dstoff) | |
1207 | { | 1207 | { | |
1208 | struct mbuf *m; | 1208 | struct mbuf *m; | |
1209 | int count, space; | 1209 | int count, space; | |
1210 | 1210 | |||
1211 | KASSERT(len != M_COPYALL); | 1211 | KASSERT(len != M_COPYALL); | |
1212 | if (len > ((int)MHLEN - dstoff)) | 1212 | if (len > ((int)MHLEN - dstoff)) | |
1213 | goto bad; | 1213 | goto bad; | |
1214 | m = m_get(M_DONTWAIT, n->m_type); | 1214 | m = m_get(M_DONTWAIT, n->m_type); | |
1215 | if (m == NULL) | 1215 | if (m == NULL) | |
1216 | goto bad; | 1216 | goto bad; | |
1217 | MCLAIM(m, n->m_owner); | 1217 | MCLAIM(m, n->m_owner); | |
1218 | if (n->m_flags & M_PKTHDR) { | 1218 | if (n->m_flags & M_PKTHDR) { | |
1219 | M_MOVE_PKTHDR(m, n); | 1219 | m_move_pkthdr(m, n); | |
1220 | } | 1220 | } | |
1221 | m->m_data += dstoff; | 1221 | m->m_data += dstoff; | |
1222 | space = &m->m_dat[MLEN] - (m->m_data + m->m_len); | 1222 | space = &m->m_dat[MLEN] - (m->m_data + m->m_len); | |
1223 | do { | 1223 | do { | |
1224 | count = uimin(uimin(uimax(len, max_protohdr), space), n->m_len); | 1224 | count = uimin(uimin(uimax(len, max_protohdr), space), n->m_len); | |
1225 | memcpy(mtod(m, char *) + m->m_len, mtod(n, void *), | 1225 | memcpy(mtod(m, char *) + m->m_len, mtod(n, void *), | |
1226 | (unsigned)count); | 1226 | (unsigned)count); | |
1227 | len -= count; | 1227 | len -= count; | |
1228 | m->m_len += count; | 1228 | m->m_len += count; | |
1229 | n->m_len -= count; | 1229 | n->m_len -= count; | |
1230 | space -= count; | 1230 | space -= count; | |
1231 | if (n->m_len) | 1231 | if (n->m_len) | |
1232 | n->m_data += count; | 1232 | n->m_data += count; | |
@@ -1574,27 +1574,27 @@ extend: | @@ -1574,27 +1574,27 @@ extend: | |||
1574 | /* | 1574 | /* | |
1575 | * XXX TODO coalesce into the trailingspace of | 1575 | * XXX TODO coalesce into the trailingspace of | |
1576 | * the previous mbuf when possible. | 1576 | * the previous mbuf when possible. | |
1577 | */ | 1577 | */ | |
1578 | 1578 | |||
1579 | /* | 1579 | /* | |
1580 | * allocate a new mbuf. copy packet header if needed. | 1580 | * allocate a new mbuf. copy packet header if needed. | |
1581 | */ | 1581 | */ | |
1582 | n = m_get(how, m->m_type); | 1582 | n = m_get(how, m->m_type); | |
1583 | if (n == NULL) | 1583 | if (n == NULL) | |
1584 | goto enobufs; | 1584 | goto enobufs; | |
1585 | MCLAIM(n, m->m_owner); | 1585 | MCLAIM(n, m->m_owner); | |
1586 | if (off == 0 && (m->m_flags & M_PKTHDR) != 0) { | 1586 | if (off == 0 && (m->m_flags & M_PKTHDR) != 0) { | |
1587 | M_MOVE_PKTHDR(n, m); | 1587 | m_move_pkthdr(n, m); | |
1588 | n->m_len = MHLEN; | 1588 | n->m_len = MHLEN; | |
1589 | } else { | 1589 | } else { | |
1590 | if (len >= MINCLSIZE) | 1590 | if (len >= MINCLSIZE) | |
1591 | MCLGET(n, M_DONTWAIT); | 1591 | MCLGET(n, M_DONTWAIT); | |
1592 | n->m_len = | 1592 | n->m_len = | |
1593 | (n->m_flags & M_EXT) ? MCLBYTES : MLEN; | 1593 | (n->m_flags & M_EXT) ? MCLBYTES : MLEN; | |
1594 | } | 1594 | } | |
1595 | if (n->m_len > len) | 1595 | if (n->m_len > len) | |
1596 | n->m_len = len; | 1596 | n->m_len = len; | |
1597 | 1597 | |||
1598 | /* | 1598 | /* | |
1599 | * free the region which has been overwritten. | 1599 | * free the region which has been overwritten. | |
1600 | * copying data from old mbufs if requested. | 1600 | * copying data from old mbufs if requested. |
--- src/sys/net/if_l2tp.c 2018/10/19 00:12:56 1.30
+++ src/sys/net/if_l2tp.c 2018/12/22 13:11:37 1.31
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_l2tp.c,v 1.30 2018/10/19 00:12:56 knakahara Exp $ */ | 1 | /* $NetBSD: if_l2tp.c,v 1.31 2018/12/22 13:11:37 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2017 Internet Initiative Japan Inc. | 4 | * Copyright (c) 2017 Internet Initiative Japan Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | 26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | /* | 29 | /* | |
30 | * L2TPv3 kernel interface | 30 | * L2TPv3 kernel interface | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.30 2018/10/19 00:12:56 knakahara Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.31 2018/12/22 13:11:37 maxv Exp $"); | |
35 | 35 | |||
36 | #ifdef _KERNEL_OPT | 36 | #ifdef _KERNEL_OPT | |
37 | #include "opt_inet.h" | 37 | #include "opt_inet.h" | |
38 | #include "opt_net_mpsafe.h" | 38 | #include "opt_net_mpsafe.h" | |
39 | #endif | 39 | #endif | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/systm.h> | 42 | #include <sys/systm.h> | |
43 | #include <sys/kernel.h> | 43 | #include <sys/kernel.h> | |
44 | #include <sys/mbuf.h> | 44 | #include <sys/mbuf.h> | |
45 | #include <sys/socket.h> | 45 | #include <sys/socket.h> | |
46 | #include <sys/sockio.h> | 46 | #include <sys/sockio.h> | |
47 | #include <sys/errno.h> | 47 | #include <sys/errno.h> | |
@@ -496,27 +496,27 @@ l2tp_input(struct mbuf *m, struct ifnet | @@ -496,27 +496,27 @@ l2tp_input(struct mbuf *m, struct ifnet | |||
496 | } | 496 | } | |
497 | 497 | |||
498 | if (m->m_len < copy_length) { | 498 | if (m->m_len < copy_length) { | |
499 | m = m_pullup(m, copy_length); | 499 | m = m_pullup(m, copy_length); | |
500 | if (m == NULL) | 500 | if (m == NULL) | |
501 | return; | 501 | return; | |
502 | } | 502 | } | |
503 | 503 | |||
504 | MGETHDR(m_head, M_DONTWAIT, MT_HEADER); | 504 | MGETHDR(m_head, M_DONTWAIT, MT_HEADER); | |
505 | if (m_head == NULL) { | 505 | if (m_head == NULL) { | |
506 | m_freem(m); | 506 | m_freem(m); | |
507 | return; | 507 | return; | |
508 | } | 508 | } | |
509 | M_MOVE_PKTHDR(m_head, m); | 509 | m_move_pkthdr(m_head, m); | |
510 | 510 | |||
511 | /* | 511 | /* | |
512 | * m_head should be: | 512 | * m_head should be: | |
513 | * L2TP_COPY_LENGTH | 513 | * L2TP_COPY_LENGTH | |
514 | * <- + roundup(pad, 4) - pad -> | 514 | * <- + roundup(pad, 4) - pad -> | |
515 | * +-------+--------+-----+--------------+-------------+ | 515 | * +-------+--------+-----+--------------+-------------+ | |
516 | * | m_hdr | pkthdr | ... | ether header | payload | | 516 | * | m_hdr | pkthdr | ... | ether header | payload | | |
517 | * +-------+--------+-----+--------------+-------------+ | 517 | * +-------+--------+-----+--------------+-------------+ | |
518 | * ^ ^ | 518 | * ^ ^ | |
519 | * m_data 4 byte aligned | 519 | * m_data 4 byte aligned | |
520 | */ | 520 | */ | |
521 | MH_ALIGN(m_head, L2TP_COPY_LENGTH + roundup(pad, 4)); | 521 | MH_ALIGN(m_head, L2TP_COPY_LENGTH + roundup(pad, 4)); | |
522 | m_head->m_data += pad; | 522 | m_head->m_data += pad; |
--- src/sys/net/if_sl.c 2018/04/20 09:56:22 1.129
+++ src/sys/net/if_sl.c 2018/12/22 13:11:37 1.130
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_sl.c,v 1.129 2018/04/20 09:56:22 knakahara Exp $ */ | 1 | /* $NetBSD: if_sl.c,v 1.130 2018/12/22 13:11:37 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1987, 1989, 1992, 1993 | 4 | * Copyright (c) 1987, 1989, 1992, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -50,27 +50,27 @@ | @@ -50,27 +50,27 @@ | |||
50 | * Converted to 4.3BSD Beta by Chris Torek. | 50 | * Converted to 4.3BSD Beta by Chris Torek. | |
51 | * Other changes made at Berkeley, based in part on code by Kirk Smith. | 51 | * Other changes made at Berkeley, based in part on code by Kirk Smith. | |
52 | * W. Jolitz added slip abort. | 52 | * W. Jolitz added slip abort. | |
53 | * | 53 | * | |
54 | * Hacked almost beyond recognition by Van Jacobson (van@helios.ee.lbl.gov). | 54 | * Hacked almost beyond recognition by Van Jacobson (van@helios.ee.lbl.gov). | |
55 | * Added priority queuing for "interactive" traffic; hooks for TCP | 55 | * Added priority queuing for "interactive" traffic; hooks for TCP | |
56 | * header compression; ICMP filtering (at 2400 baud, some cretin | 56 | * header compression; ICMP filtering (at 2400 baud, some cretin | |
57 | * pinging you can use up all your bandwidth). Made low clist behavior | 57 | * pinging you can use up all your bandwidth). Made low clist behavior | |
58 | * more robust and slightly less likely to hang serial line. | 58 | * more robust and slightly less likely to hang serial line. | |
59 | * Sped up a bunch of things. | 59 | * Sped up a bunch of things. | |
60 | */ | 60 | */ | |
61 | 61 | |||
62 | #include <sys/cdefs.h> | 62 | #include <sys/cdefs.h> | |
63 | __KERNEL_RCSID(0, "$NetBSD: if_sl.c,v 1.129 2018/04/20 09:56:22 knakahara Exp $"); | 63 | __KERNEL_RCSID(0, "$NetBSD: if_sl.c,v 1.130 2018/12/22 13:11:37 maxv Exp $"); | |
64 | 64 | |||
65 | #ifdef _KERNEL_OPT | 65 | #ifdef _KERNEL_OPT | |
66 | #include "opt_inet.h" | 66 | #include "opt_inet.h" | |
67 | #endif | 67 | #endif | |
68 | 68 | |||
69 | #include <sys/param.h> | 69 | #include <sys/param.h> | |
70 | #include <sys/proc.h> | 70 | #include <sys/proc.h> | |
71 | #include <sys/malloc.h> | 71 | #include <sys/malloc.h> | |
72 | #include <sys/mbuf.h> | 72 | #include <sys/mbuf.h> | |
73 | #include <sys/buf.h> | 73 | #include <sys/buf.h> | |
74 | #include <sys/dkstat.h> | 74 | #include <sys/dkstat.h> | |
75 | #include <sys/socket.h> | 75 | #include <sys/socket.h> | |
76 | #include <sys/ioctl.h> | 76 | #include <sys/ioctl.h> | |
@@ -936,27 +936,27 @@ slintr(void *arg) | @@ -936,27 +936,27 @@ slintr(void *arg) | |||
936 | if (m == NULL) | 936 | if (m == NULL) | |
937 | continue; | 937 | continue; | |
938 | } | 938 | } | |
939 | /* | 939 | /* | |
940 | * If the packet will fit into a single | 940 | * If the packet will fit into a single | |
941 | * header mbuf, try to copy it into one, | 941 | * header mbuf, try to copy it into one, | |
942 | * to save memory. | 942 | * to save memory. | |
943 | */ | 943 | */ | |
944 | if ((m->m_pkthdr.len < MHLEN) && | 944 | if ((m->m_pkthdr.len < MHLEN) && | |
945 | (n = m_gethdr(M_DONTWAIT, MT_DATA))) { | 945 | (n = m_gethdr(M_DONTWAIT, MT_DATA))) { | |
946 | int pktlen; | 946 | int pktlen; | |
947 | 947 | |||
948 | pktlen = m->m_pkthdr.len; | 948 | pktlen = m->m_pkthdr.len; | |
949 | M_MOVE_PKTHDR(n, m); | 949 | m_move_pkthdr(n, m); | |
950 | memcpy(mtod(n, void *), mtod(m, void *), pktlen); | 950 | memcpy(mtod(n, void *), mtod(m, void *), pktlen); | |
951 | n->m_len = m->m_len; | 951 | n->m_len = m->m_len; | |
952 | m_freem(m); | 952 | m_freem(m); | |
953 | m = n; | 953 | m = n; | |
954 | } | 954 | } | |
955 | 955 | |||
956 | sc->sc_if.if_ipackets++; | 956 | sc->sc_if.if_ipackets++; | |
957 | getbinuptime(&sc->sc_lastpacket); | 957 | getbinuptime(&sc->sc_lastpacket); | |
958 | 958 | |||
959 | #ifdef INET | 959 | #ifdef INET | |
960 | s = splnet(); | 960 | s = splnet(); | |
961 | if (__predict_false(!pktq_enqueue(ip_pktq, m, 0))) { | 961 | if (__predict_false(!pktq_enqueue(ip_pktq, m, 0))) { | |
962 | sc->sc_if.if_ierrors++; | 962 | sc->sc_if.if_ierrors++; |
--- src/sys/net/Attic/if_strip.c 2018/06/06 01:49:09 1.110
+++ src/sys/net/Attic/if_strip.c 2018/12/22 13:11:37 1.111
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_strip.c,v 1.110 2018/06/06 01:49:09 maya Exp $ */ | 1 | /* $NetBSD: if_strip.c,v 1.111 2018/12/22 13:11:37 maxv Exp $ */ | |
2 | /* from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */ | 2 | /* from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright 1996 The Board of Trustees of The Leland Stanford | 5 | * Copyright 1996 The Board of Trustees of The Leland Stanford | |
6 | * Junior University. All Rights Reserved. | 6 | * Junior University. All Rights Reserved. | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify, and distribute this | 8 | * Permission to use, copy, modify, and distribute this | |
9 | * software and its documentation for any purpose and without | 9 | * software and its documentation for any purpose and without | |
10 | * fee is hereby granted, provided that the above copyright | 10 | * fee is hereby granted, provided that the above copyright | |
11 | * notice appear in all copies. Stanford University | 11 | * notice appear in all copies. Stanford University | |
12 | * makes no representations about the suitability of this | 12 | * makes no representations about the suitability of this | |
13 | * software for any purpose. It is provided "as is" without | 13 | * software for any purpose. It is provided "as is" without | |
14 | * express or implied warranty. | 14 | * express or implied warranty. | |
@@ -77,27 +77,27 @@ | @@ -77,27 +77,27 @@ | |||
77 | * Converted to 4.3BSD Beta by Chris Torek. | 77 | * Converted to 4.3BSD Beta by Chris Torek. | |
78 | * Other changes made at Berkeley, based in part on code by Kirk Smith. | 78 | * Other changes made at Berkeley, based in part on code by Kirk Smith. | |
79 | * W. Jolitz added slip abort. | 79 | * W. Jolitz added slip abort. | |
80 | * | 80 | * | |
81 | * Hacked almost beyond recognition by Van Jacobson (van@helios.ee.lbl.gov). | 81 | * Hacked almost beyond recognition by Van Jacobson (van@helios.ee.lbl.gov). | |
82 | * Added priority queuing for "interactive" traffic; hooks for TCP | 82 | * Added priority queuing for "interactive" traffic; hooks for TCP | |
83 | * header compression; ICMP filtering (at 2400 baud, some cretin | 83 | * header compression; ICMP filtering (at 2400 baud, some cretin | |
84 | * pinging you can use up all your bandwidth). Made low clist behavior | 84 | * pinging you can use up all your bandwidth). Made low clist behavior | |
85 | * more robust and slightly less likely to hang serial line. | 85 | * more robust and slightly less likely to hang serial line. | |
86 | * Sped up a bunch of things. | 86 | * Sped up a bunch of things. | |
87 | */ | 87 | */ | |
88 | 88 | |||
89 | #include <sys/cdefs.h> | 89 | #include <sys/cdefs.h> | |
90 | __KERNEL_RCSID(0, "$NetBSD: if_strip.c,v 1.110 2018/06/06 01:49:09 maya Exp $"); | 90 | __KERNEL_RCSID(0, "$NetBSD: if_strip.c,v 1.111 2018/12/22 13:11:37 maxv Exp $"); | |
91 | 91 | |||
92 | #ifdef _KERNEL_OPT | 92 | #ifdef _KERNEL_OPT | |
93 | #include "opt_inet.h" | 93 | #include "opt_inet.h" | |
94 | #endif | 94 | #endif | |
95 | 95 | |||
96 | #include <sys/param.h> | 96 | #include <sys/param.h> | |
97 | #include <sys/proc.h> | 97 | #include <sys/proc.h> | |
98 | #include <sys/mbuf.h> | 98 | #include <sys/mbuf.h> | |
99 | #include <sys/buf.h> | 99 | #include <sys/buf.h> | |
100 | #include <sys/dkstat.h> | 100 | #include <sys/dkstat.h> | |
101 | #include <sys/socket.h> | 101 | #include <sys/socket.h> | |
102 | #include <sys/ioctl.h> | 102 | #include <sys/ioctl.h> | |
103 | #include <sys/file.h> | 103 | #include <sys/file.h> | |
@@ -1228,27 +1228,27 @@ stripintr(void *arg) | @@ -1228,27 +1228,27 @@ stripintr(void *arg) | |||
1228 | if (m == NULL) | 1228 | if (m == NULL) | |
1229 | continue; | 1229 | continue; | |
1230 | } | 1230 | } | |
1231 | /* | 1231 | /* | |
1232 | * If the packet will fit into a single | 1232 | * If the packet will fit into a single | |
1233 | * header mbuf, try to copy it into one, | 1233 | * header mbuf, try to copy it into one, | |
1234 | * to save memory. | 1234 | * to save memory. | |
1235 | */ | 1235 | */ | |
1236 | if ((m->m_pkthdr.len < MHLEN) && | 1236 | if ((m->m_pkthdr.len < MHLEN) && | |
1237 | (n = m_gethdr(M_DONTWAIT, MT_DATA))) { | 1237 | (n = m_gethdr(M_DONTWAIT, MT_DATA))) { | |
1238 | int pktlen; | 1238 | int pktlen; | |
1239 | 1239 | |||
1240 | pktlen = m->m_pkthdr.len; | 1240 | pktlen = m->m_pkthdr.len; | |
1241 | M_MOVE_PKTHDR(n, m); | 1241 | m_move_pkthdr(n, m); | |
1242 | memcpy(mtod(n, void *), mtod(m, void *), pktlen); | 1242 | memcpy(mtod(n, void *), mtod(m, void *), pktlen); | |
1243 | n->m_len = m->m_len; | 1243 | n->m_len = m->m_len; | |
1244 | m_freem(m); | 1244 | m_freem(m); | |
1245 | m = n; | 1245 | m = n; | |
1246 | } | 1246 | } | |
1247 | 1247 | |||
1248 | sc->sc_if.if_ipackets++; | 1248 | sc->sc_if.if_ipackets++; | |
1249 | getbinuptime(&sc->sc_lastpacket); | 1249 | getbinuptime(&sc->sc_lastpacket); | |
1250 | 1250 | |||
1251 | #ifdef INET | 1251 | #ifdef INET | |
1252 | s = splnet(); | 1252 | s = splnet(); | |
1253 | if (__predict_false(!pktq_enqueue(ip_pktq, m, 0))) { | 1253 | if (__predict_false(!pktq_enqueue(ip_pktq, m, 0))) { | |
1254 | sc->sc_if.if_ierrors++; | 1254 | sc->sc_if.if_ierrors++; |
--- src/sys/net80211/ieee80211_input.c 2018/06/26 06:48:03 1.114
+++ src/sys/net80211/ieee80211_input.c 2018/12/22 13:11:37 1.115
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ieee80211_input.c,v 1.114 2018/06/26 06:48:03 msaitoh Exp $ */ | 1 | /* $NetBSD: ieee80211_input.c,v 1.115 2018/12/22 13:11:37 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2001 Atsushi Onoe | 4 | * Copyright (c) 2001 Atsushi Onoe | |
5 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting | 5 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -27,27 +27,27 @@ | @@ -27,27 +27,27 @@ | |||
27 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 27 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
28 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 28 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | #ifdef __FreeBSD__ | 36 | #ifdef __FreeBSD__ | |
37 | __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); | 37 | __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); | |
38 | #endif | 38 | #endif | |
39 | #ifdef __NetBSD__ | 39 | #ifdef __NetBSD__ | |
40 | __KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.114 2018/06/26 06:48:03 msaitoh Exp $"); | 40 | __KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.115 2018/12/22 13:11:37 maxv Exp $"); | |
41 | #endif | 41 | #endif | |
42 | 42 | |||
43 | #ifdef _KERNEL_OPT | 43 | #ifdef _KERNEL_OPT | |
44 | #include "opt_inet.h" | 44 | #include "opt_inet.h" | |
45 | #endif | 45 | #endif | |
46 | 46 | |||
47 | #include <sys/param.h> | 47 | #include <sys/param.h> | |
48 | #include <sys/systm.h> | 48 | #include <sys/systm.h> | |
49 | #include <sys/mbuf.h> | 49 | #include <sys/mbuf.h> | |
50 | #include <sys/malloc.h> | 50 | #include <sys/malloc.h> | |
51 | #include <sys/endian.h> | 51 | #include <sys/endian.h> | |
52 | #include <sys/kernel.h> | 52 | #include <sys/kernel.h> | |
53 | 53 | |||
@@ -986,27 +986,27 @@ ieee80211_decap(struct mbuf *m, int hdrl | @@ -986,27 +986,27 @@ ieee80211_decap(struct mbuf *m, int hdrl | |||
986 | int off, pktlen; | 986 | int off, pktlen; | |
987 | 987 | |||
988 | n0 = NULL; | 988 | n0 = NULL; | |
989 | np = &n0; | 989 | np = &n0; | |
990 | off = 0; | 990 | off = 0; | |
991 | pktlen = m->m_pkthdr.len; | 991 | pktlen = m->m_pkthdr.len; | |
992 | while (pktlen > off) { | 992 | while (pktlen > off) { | |
993 | if (n0 == NULL) { | 993 | if (n0 == NULL) { | |
994 | MGETHDR(n, M_DONTWAIT, MT_DATA); | 994 | MGETHDR(n, M_DONTWAIT, MT_DATA); | |
995 | if (n == NULL) { | 995 | if (n == NULL) { | |
996 | m_freem(m); | 996 | m_freem(m); | |
997 | return NULL; | 997 | return NULL; | |
998 | } | 998 | } | |
999 | M_MOVE_PKTHDR(n, m); | 999 | m_move_pkthdr(n, m); | |
1000 | n->m_len = MHLEN; | 1000 | n->m_len = MHLEN; | |
1001 | } else { | 1001 | } else { | |
1002 | MGET(n, M_DONTWAIT, MT_DATA); | 1002 | MGET(n, M_DONTWAIT, MT_DATA); | |
1003 | if (n == NULL) { | 1003 | if (n == NULL) { | |
1004 | m_freem(m); | 1004 | m_freem(m); | |
1005 | m_freem(n0); | 1005 | m_freem(n0); | |
1006 | return NULL; | 1006 | return NULL; | |
1007 | } | 1007 | } | |
1008 | n->m_len = MLEN; | 1008 | n->m_len = MLEN; | |
1009 | } | 1009 | } | |
1010 | if (pktlen - off >= MINCLSIZE) { | 1010 | if (pktlen - off >= MINCLSIZE) { | |
1011 | MCLGET(n, M_DONTWAIT); | 1011 | MCLGET(n, M_DONTWAIT); | |
1012 | if (n->m_flags & M_EXT) | 1012 | if (n->m_flags & M_EXT) |
--- src/sys/net80211/ieee80211_output.c 2018/05/08 07:02:07 1.63
+++ src/sys/net80211/ieee80211_output.c 2018/12/22 13:11:37 1.64
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ieee80211_output.c,v 1.63 2018/05/08 07:02:07 maxv Exp $ */ | 1 | /* $NetBSD: ieee80211_output.c,v 1.64 2018/12/22 13:11:37 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2001 Atsushi Onoe | 4 | * Copyright (c) 2001 Atsushi Onoe | |
5 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting | 5 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -27,27 +27,27 @@ | @@ -27,27 +27,27 @@ | |||
27 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 27 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
28 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 28 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | #ifdef __FreeBSD__ | 36 | #ifdef __FreeBSD__ | |
37 | __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.34 2005/08/10 16:22:29 sam Exp $"); | 37 | __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.34 2005/08/10 16:22:29 sam Exp $"); | |
38 | #endif | 38 | #endif | |
39 | #ifdef __NetBSD__ | 39 | #ifdef __NetBSD__ | |
40 | __KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.63 2018/05/08 07:02:07 maxv Exp $"); | 40 | __KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.64 2018/12/22 13:11:37 maxv Exp $"); | |
41 | #endif | 41 | #endif | |
42 | 42 | |||
43 | #ifdef _KERNEL_OPT | 43 | #ifdef _KERNEL_OPT | |
44 | #include "opt_inet.h" | 44 | #include "opt_inet.h" | |
45 | #endif | 45 | #endif | |
46 | 46 | |||
47 | #include <sys/param.h> | 47 | #include <sys/param.h> | |
48 | #include <sys/systm.h> | 48 | #include <sys/systm.h> | |
49 | #include <sys/mbuf.h> | 49 | #include <sys/mbuf.h> | |
50 | #include <sys/kernel.h> | 50 | #include <sys/kernel.h> | |
51 | #include <sys/endian.h> | 51 | #include <sys/endian.h> | |
52 | #include <sys/errno.h> | 52 | #include <sys/errno.h> | |
53 | #include <sys/proc.h> | 53 | #include <sys/proc.h> | |
@@ -434,27 +434,27 @@ ieee80211_mbuf_adjust(struct ieee80211co | @@ -434,27 +434,27 @@ ieee80211_mbuf_adjust(struct ieee80211co | |||
434 | m_freem(m); | 434 | m_freem(m); | |
435 | return NULL; | 435 | return NULL; | |
436 | } | 436 | } | |
437 | 437 | |||
438 | IASSERT(needed_space <= MHLEN, | 438 | IASSERT(needed_space <= MHLEN, | |
439 | ("not enough room, need %u got %zu\n", needed_space, MHLEN)); | 439 | ("not enough room, need %u got %zu\n", needed_space, MHLEN)); | |
440 | 440 | |||
441 | /* | 441 | /* | |
442 | * Setup new mbuf to have leading space to prepend the | 442 | * Setup new mbuf to have leading space to prepend the | |
443 | * 802.11 header and any crypto header bits that are | 443 | * 802.11 header and any crypto header bits that are | |
444 | * required (the latter are added when the driver calls | 444 | * required (the latter are added when the driver calls | |
445 | * back to ieee80211_crypto_encap to do crypto encapsulation). | 445 | * back to ieee80211_crypto_encap to do crypto encapsulation). | |
446 | */ | 446 | */ | |
447 | M_MOVE_PKTHDR(n, m); | 447 | m_move_pkthdr(n, m); | |
448 | n->m_len = 0; | 448 | n->m_len = 0; | |
449 | n->m_data += needed_space; | 449 | n->m_data += needed_space; | |
450 | 450 | |||
451 | /* | 451 | /* | |
452 | * Pull up Ethernet header to create the expected layout. | 452 | * Pull up Ethernet header to create the expected layout. | |
453 | * We could use m_pullup but that's overkill (i.e. we don't | 453 | * We could use m_pullup but that's overkill (i.e. we don't | |
454 | * need the actual data) and it cannot fail so do it inline | 454 | * need the actual data) and it cannot fail so do it inline | |
455 | * for speed. | 455 | * for speed. | |
456 | */ | 456 | */ | |
457 | n->m_len += sizeof(struct ether_header); | 457 | n->m_len += sizeof(struct ether_header); | |
458 | m->m_len -= sizeof(struct ether_header); | 458 | m->m_len -= sizeof(struct ether_header); | |
459 | m->m_data += sizeof(struct ether_header); | 459 | m->m_data += sizeof(struct ether_header); | |
460 | 460 |
--- src/sys/netinet/ip_output.c 2018/12/12 01:53:52 1.308
+++ src/sys/netinet/ip_output.c 2018/12/22 13:11:38 1.309
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ip_output.c,v 1.308 2018/12/12 01:53:52 rin Exp $ */ | 1 | /* $NetBSD: ip_output.c,v 1.309 2018/12/22 13:11:38 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -81,27 +81,27 @@ | @@ -81,27 +81,27 @@ | |||
81 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 81 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
82 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 82 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
83 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 83 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
84 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 84 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
85 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 85 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
86 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 86 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
87 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 87 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
88 | * SUCH DAMAGE. | 88 | * SUCH DAMAGE. | |
89 | * | 89 | * | |
90 | * @(#)ip_output.c 8.3 (Berkeley) 1/21/94 | 90 | * @(#)ip_output.c 8.3 (Berkeley) 1/21/94 | |
91 | */ | 91 | */ | |
92 | 92 | |||
93 | #include <sys/cdefs.h> | 93 | #include <sys/cdefs.h> | |
94 | __KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.308 2018/12/12 01:53:52 rin Exp $"); | 94 | __KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.309 2018/12/22 13:11:38 maxv Exp $"); | |
95 | 95 | |||
96 | #ifdef _KERNEL_OPT | 96 | #ifdef _KERNEL_OPT | |
97 | #include "opt_inet.h" | 97 | #include "opt_inet.h" | |
98 | #include "opt_ipsec.h" | 98 | #include "opt_ipsec.h" | |
99 | #include "opt_mrouting.h" | 99 | #include "opt_mrouting.h" | |
100 | #include "opt_net_mpsafe.h" | 100 | #include "opt_net_mpsafe.h" | |
101 | #include "opt_mpls.h" | 101 | #include "opt_mpls.h" | |
102 | #endif | 102 | #endif | |
103 | 103 | |||
104 | #include "arp.h" | 104 | #include "arp.h" | |
105 | 105 | |||
106 | #include <sys/param.h> | 106 | #include <sys/param.h> | |
107 | #include <sys/kmem.h> | 107 | #include <sys/kmem.h> | |
@@ -989,27 +989,27 @@ ip_insertoptions(struct mbuf *m, struct | @@ -989,27 +989,27 @@ ip_insertoptions(struct mbuf *m, struct | |||
989 | unsigned optlen; | 989 | unsigned optlen; | |
990 | 990 | |||
991 | optlen = opt->m_len - sizeof(p->ipopt_dst); | 991 | optlen = opt->m_len - sizeof(p->ipopt_dst); | |
992 | KASSERT(optlen % 4 == 0); | 992 | KASSERT(optlen % 4 == 0); | |
993 | if (optlen + ntohs(ip->ip_len) > IP_MAXPACKET) | 993 | if (optlen + ntohs(ip->ip_len) > IP_MAXPACKET) | |
994 | return m; /* XXX should fail */ | 994 | return m; /* XXX should fail */ | |
995 | if (!in_nullhost(p->ipopt_dst)) | 995 | if (!in_nullhost(p->ipopt_dst)) | |
996 | ip->ip_dst = p->ipopt_dst; | 996 | ip->ip_dst = p->ipopt_dst; | |
997 | if (M_READONLY(m) || M_LEADINGSPACE(m) < optlen) { | 997 | if (M_READONLY(m) || M_LEADINGSPACE(m) < optlen) { | |
998 | MGETHDR(n, M_DONTWAIT, MT_HEADER); | 998 | MGETHDR(n, M_DONTWAIT, MT_HEADER); | |
999 | if (n == NULL) | 999 | if (n == NULL) | |
1000 | return m; | 1000 | return m; | |
1001 | MCLAIM(n, m->m_owner); | 1001 | MCLAIM(n, m->m_owner); | |
1002 | M_MOVE_PKTHDR(n, m); | 1002 | m_move_pkthdr(n, m); | |
1003 | m->m_len -= sizeof(struct ip); | 1003 | m->m_len -= sizeof(struct ip); | |
1004 | m->m_data += sizeof(struct ip); | 1004 | m->m_data += sizeof(struct ip); | |
1005 | n->m_next = m; | 1005 | n->m_next = m; | |
1006 | n->m_len = optlen + sizeof(struct ip); | 1006 | n->m_len = optlen + sizeof(struct ip); | |
1007 | n->m_data += max_linkhdr; | 1007 | n->m_data += max_linkhdr; | |
1008 | memcpy(mtod(n, void *), ip, sizeof(struct ip)); | 1008 | memcpy(mtod(n, void *), ip, sizeof(struct ip)); | |
1009 | m = n; | 1009 | m = n; | |
1010 | } else { | 1010 | } else { | |
1011 | m->m_data -= optlen; | 1011 | m->m_data -= optlen; | |
1012 | m->m_len += optlen; | 1012 | m->m_len += optlen; | |
1013 | memmove(mtod(m, void *), ip, sizeof(struct ip)); | 1013 | memmove(mtod(m, void *), ip, sizeof(struct ip)); | |
1014 | } | 1014 | } | |
1015 | m->m_pkthdr.len += optlen; | 1015 | m->m_pkthdr.len += optlen; |
--- src/sys/netinet/sctp_indata.c 2018/09/03 16:29:36 1.7
+++ src/sys/netinet/sctp_indata.c 2018/12/22 13:11:38 1.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sctp_indata.c,v 1.7 2018/09/03 16:29:36 riastradh Exp $ */ | 1 | /* $NetBSD: sctp_indata.c,v 1.8 2018/12/22 13:11:38 maxv Exp $ */ | |
2 | /* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */ | 2 | /* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 2002, 2003, 2004 Cisco Systems Inc, | 5 | * Copyright (C) 2002, 2003, 2004 Cisco Systems Inc, | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | * SUCH DAMAGE. | 30 | * SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: sctp_indata.c,v 1.7 2018/09/03 16:29:36 riastradh Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: sctp_indata.c,v 1.8 2018/12/22 13:11:38 maxv Exp $"); | |
35 | 35 | |||
36 | #ifdef _KERNEL_OPT | 36 | #ifdef _KERNEL_OPT | |
37 | #include "opt_ipsec.h" | 37 | #include "opt_ipsec.h" | |
38 | #include "opt_inet.h" | 38 | #include "opt_inet.h" | |
39 | #include "opt_sctp.h" | 39 | #include "opt_sctp.h" | |
40 | #endif /* _KERNEL_OPT */ | 40 | #endif /* _KERNEL_OPT */ | |
41 | 41 | |||
42 | #include <sys/param.h> | 42 | #include <sys/param.h> | |
43 | #include <sys/systm.h> | 43 | #include <sys/systm.h> | |
44 | #include <sys/mbuf.h> | 44 | #include <sys/mbuf.h> | |
45 | #include <sys/malloc.h> | 45 | #include <sys/malloc.h> | |
46 | #include <sys/socket.h> | 46 | #include <sys/socket.h> | |
47 | #include <sys/socketvar.h> | 47 | #include <sys/socketvar.h> | |
@@ -2540,27 +2540,27 @@ sctp_process_data(struct mbuf **mm, int | @@ -2540,27 +2540,27 @@ sctp_process_data(struct mbuf **mm, int | |||
2540 | */ | 2540 | */ | |
2541 | if (m->m_len < (long)MHLEN && m->m_next == NULL) { | 2541 | if (m->m_len < (long)MHLEN && m->m_next == NULL) { | |
2542 | /* we only handle mbufs that are singletons.. not chains */ | 2542 | /* we only handle mbufs that are singletons.. not chains */ | |
2543 | MGET(m, M_DONTWAIT, MT_DATA); | 2543 | MGET(m, M_DONTWAIT, MT_DATA); | |
2544 | if (m) { | 2544 | if (m) { | |
2545 | /* ok lets see if we can copy the data up */ | 2545 | /* ok lets see if we can copy the data up */ | |
2546 | vaddr_t *from, *to; | 2546 | vaddr_t *from, *to; | |
2547 | 2547 | |||
2548 | if ((*mm)->m_flags & M_PKTHDR) { | 2548 | if ((*mm)->m_flags & M_PKTHDR) { | |
2549 | /* got to copy the header first */ | 2549 | /* got to copy the header first */ | |
2550 | #ifdef __APPLE__ | 2550 | #ifdef __APPLE__ | |
2551 | M_COPY_PKTHDR(m, (*mm)); | 2551 | M_COPY_PKTHDR(m, (*mm)); | |
2552 | #else | 2552 | #else | |
2553 | M_MOVE_PKTHDR(m, (*mm)); | 2553 | m_move_pkthdr(m, (*mm)); | |
2554 | #endif | 2554 | #endif | |
2555 | } | 2555 | } | |
2556 | /* get the pointers and copy */ | 2556 | /* get the pointers and copy */ | |
2557 | to = mtod(m, vaddr_t *); | 2557 | to = mtod(m, vaddr_t *); | |
2558 | from = mtod((*mm), vaddr_t *); | 2558 | from = mtod((*mm), vaddr_t *); | |
2559 | memcpy(to, from, (*mm)->m_len); | 2559 | memcpy(to, from, (*mm)->m_len); | |
2560 | /* copy the length and free up the old */ | 2560 | /* copy the length and free up the old */ | |
2561 | m->m_len = (*mm)->m_len; | 2561 | m->m_len = (*mm)->m_len; | |
2562 | sctp_m_freem(*mm); | 2562 | sctp_m_freem(*mm); | |
2563 | /* sucess, back copy */ | 2563 | /* sucess, back copy */ | |
2564 | *mm = m; | 2564 | *mm = m; | |
2565 | } else { | 2565 | } else { | |
2566 | /* We are in trouble in the mbuf world .. yikes */ | 2566 | /* We are in trouble in the mbuf world .. yikes */ |
--- src/sys/netinet6/icmp6.c 2018/10/25 02:40:45 1.240
+++ src/sys/netinet6/icmp6.c 2018/12/22 13:11:38 1.241
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: icmp6.c,v 1.240 2018/10/25 02:40:45 ozaki-r Exp $ */ | 1 | /* $NetBSD: icmp6.c,v 1.241 2018/12/22 13:11:38 maxv Exp $ */ | |
2 | /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ | 2 | /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -52,27 +52,27 @@ | @@ -52,27 +52,27 @@ | |||
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
59 | * SUCH DAMAGE. | 59 | * SUCH DAMAGE. | |
60 | * | 60 | * | |
61 | * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94 | 61 | * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94 | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | #include <sys/cdefs.h> | 64 | #include <sys/cdefs.h> | |
65 | __KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.240 2018/10/25 02:40:45 ozaki-r Exp $"); | 65 | __KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.241 2018/12/22 13:11:38 maxv Exp $"); | |
66 | 66 | |||
67 | #ifdef _KERNEL_OPT | 67 | #ifdef _KERNEL_OPT | |
68 | #include "opt_inet.h" | 68 | #include "opt_inet.h" | |
69 | #include "opt_ipsec.h" | 69 | #include "opt_ipsec.h" | |
70 | #endif | 70 | #endif | |
71 | 71 | |||
72 | #include <sys/param.h> | 72 | #include <sys/param.h> | |
73 | #include <sys/systm.h> | 73 | #include <sys/systm.h> | |
74 | #include <sys/kmem.h> | 74 | #include <sys/kmem.h> | |
75 | #include <sys/mbuf.h> | 75 | #include <sys/mbuf.h> | |
76 | #include <sys/protosw.h> | 76 | #include <sys/protosw.h> | |
77 | #include <sys/socket.h> | 77 | #include <sys/socket.h> | |
78 | #include <sys/socketvar.h> | 78 | #include <sys/socketvar.h> | |
@@ -1397,27 +1397,27 @@ ni6_input(struct mbuf *m, int off) | @@ -1397,27 +1397,27 @@ ni6_input(struct mbuf *m, int off) | |||
1397 | */ | 1397 | */ | |
1398 | qtype = NI_QTYPE_FQDN; | 1398 | qtype = NI_QTYPE_FQDN; | |
1399 | /* will append an mbuf */ | 1399 | /* will append an mbuf */ | |
1400 | replylen += offsetof(struct ni_reply_fqdn, ni_fqdn_namelen); | 1400 | replylen += offsetof(struct ni_reply_fqdn, ni_fqdn_namelen); | |
1401 | oldfqdn++; | 1401 | oldfqdn++; | |
1402 | break; | 1402 | break; | |
1403 | } | 1403 | } | |
1404 | 1404 | |||
1405 | /* allocate an mbuf to reply. */ | 1405 | /* allocate an mbuf to reply. */ | |
1406 | MGETHDR(n, M_DONTWAIT, m->m_type); | 1406 | MGETHDR(n, M_DONTWAIT, m->m_type); | |
1407 | if (n == NULL) { | 1407 | if (n == NULL) { | |
1408 | goto bad; | 1408 | goto bad; | |
1409 | } | 1409 | } | |
1410 | M_MOVE_PKTHDR(n, m); | 1410 | m_move_pkthdr(n, m); | |
1411 | if (replylen > MHLEN) { | 1411 | if (replylen > MHLEN) { | |
1412 | if (replylen > MCLBYTES) { | 1412 | if (replylen > MCLBYTES) { | |
1413 | /* | 1413 | /* | |
1414 | * XXX: should we try to allocate more? But MCLBYTES | 1414 | * XXX: should we try to allocate more? But MCLBYTES | |
1415 | * is probably much larger than IPV6_MMTU... | 1415 | * is probably much larger than IPV6_MMTU... | |
1416 | */ | 1416 | */ | |
1417 | goto bad; | 1417 | goto bad; | |
1418 | } | 1418 | } | |
1419 | MCLGET(n, M_DONTWAIT); | 1419 | MCLGET(n, M_DONTWAIT); | |
1420 | if ((n->m_flags & M_EXT) == 0) { | 1420 | if ((n->m_flags & M_EXT) == 0) { | |
1421 | goto bad; | 1421 | goto bad; | |
1422 | } | 1422 | } | |
1423 | } | 1423 | } |
--- src/sys/netinet6/ip6_output.c 2018/12/12 01:53:52 1.214
+++ src/sys/netinet6/ip6_output.c 2018/12/22 13:11:38 1.215
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ip6_output.c,v 1.214 2018/12/12 01:53:52 rin Exp $ */ | 1 | /* $NetBSD: ip6_output.c,v 1.215 2018/12/22 13:11:38 maxv Exp $ */ | |
2 | /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ | 2 | /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -52,27 +52,27 @@ | @@ -52,27 +52,27 @@ | |||
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
59 | * SUCH DAMAGE. | 59 | * SUCH DAMAGE. | |
60 | * | 60 | * | |
61 | * @(#)ip_output.c 8.3 (Berkeley) 1/21/94 | 61 | * @(#)ip_output.c 8.3 (Berkeley) 1/21/94 | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | #include <sys/cdefs.h> | 64 | #include <sys/cdefs.h> | |
65 | __KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.214 2018/12/12 01:53:52 rin Exp $"); | 65 | __KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.215 2018/12/22 13:11:38 maxv Exp $"); | |
66 | 66 | |||
67 | #ifdef _KERNEL_OPT | 67 | #ifdef _KERNEL_OPT | |
68 | #include "opt_inet.h" | 68 | #include "opt_inet.h" | |
69 | #include "opt_inet6.h" | 69 | #include "opt_inet6.h" | |
70 | #include "opt_ipsec.h" | 70 | #include "opt_ipsec.h" | |
71 | #endif | 71 | #endif | |
72 | 72 | |||
73 | #include <sys/param.h> | 73 | #include <sys/param.h> | |
74 | #include <sys/malloc.h> | 74 | #include <sys/malloc.h> | |
75 | #include <sys/mbuf.h> | 75 | #include <sys/mbuf.h> | |
76 | #include <sys/errno.h> | 76 | #include <sys/errno.h> | |
77 | #include <sys/socket.h> | 77 | #include <sys/socket.h> | |
78 | #include <sys/socketvar.h> | 78 | #include <sys/socketvar.h> | |
@@ -3250,27 +3250,27 @@ ip6_mloopback(struct ifnet *ifp, struct | @@ -3250,27 +3250,27 @@ ip6_mloopback(struct ifnet *ifp, struct | |||
3250 | static int | 3250 | static int | |
3251 | ip6_splithdr(struct mbuf *m, struct ip6_exthdrs *exthdrs) | 3251 | ip6_splithdr(struct mbuf *m, struct ip6_exthdrs *exthdrs) | |
3252 | { | 3252 | { | |
3253 | struct mbuf *mh; | 3253 | struct mbuf *mh; | |
3254 | struct ip6_hdr *ip6; | 3254 | struct ip6_hdr *ip6; | |
3255 | 3255 | |||
3256 | ip6 = mtod(m, struct ip6_hdr *); | 3256 | ip6 = mtod(m, struct ip6_hdr *); | |
3257 | if (m->m_len > sizeof(*ip6)) { | 3257 | if (m->m_len > sizeof(*ip6)) { | |
3258 | MGETHDR(mh, M_DONTWAIT, MT_HEADER); | 3258 | MGETHDR(mh, M_DONTWAIT, MT_HEADER); | |
3259 | if (mh == NULL) { | 3259 | if (mh == NULL) { | |
3260 | m_freem(m); | 3260 | m_freem(m); | |
3261 | return ENOBUFS; | 3261 | return ENOBUFS; | |
3262 | } | 3262 | } | |
3263 | M_MOVE_PKTHDR(mh, m); | 3263 | m_move_pkthdr(mh, m); | |
3264 | MH_ALIGN(mh, sizeof(*ip6)); | 3264 | MH_ALIGN(mh, sizeof(*ip6)); | |
3265 | m->m_len -= sizeof(*ip6); | 3265 | m->m_len -= sizeof(*ip6); | |
3266 | m->m_data += sizeof(*ip6); | 3266 | m->m_data += sizeof(*ip6); | |
3267 | mh->m_next = m; | 3267 | mh->m_next = m; | |
3268 | mh->m_len = sizeof(*ip6); | 3268 | mh->m_len = sizeof(*ip6); | |
3269 | memcpy(mtod(mh, void *), (void *)ip6, sizeof(*ip6)); | 3269 | memcpy(mtod(mh, void *), (void *)ip6, sizeof(*ip6)); | |
3270 | m = mh; | 3270 | m = mh; | |
3271 | } | 3271 | } | |
3272 | exthdrs->ip6e_ip6 = m; | 3272 | exthdrs->ip6e_ip6 = m; | |
3273 | return 0; | 3273 | return 0; | |
3274 | } | 3274 | } | |
3275 | 3275 | |||
3276 | /* | 3276 | /* |
--- src/sys/netipsec/ipsec_mbuf.c 2018/09/03 16:29:36 1.29
+++ src/sys/netipsec/ipsec_mbuf.c 2018/12/22 13:11:38 1.30
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ipsec_mbuf.c,v 1.29 2018/09/03 16:29:36 riastradh Exp $ */ | 1 | /* $NetBSD: ipsec_mbuf.c,v 1.30 2018/12/22 13:11:38 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting | 4 | * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -19,27 +19,27 @@ | @@ -19,27 +19,27 @@ | |||
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | * | 27 | * | |
28 | * $FreeBSD: sys/netipsec/ipsec_mbuf.c,v 1.5.2.2 2003/03/28 20:32:53 sam Exp $ | 28 | * $FreeBSD: sys/netipsec/ipsec_mbuf.c,v 1.5.2.2 2003/03/28 20:32:53 sam Exp $ | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.29 2018/09/03 16:29:36 riastradh Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.30 2018/12/22 13:11:38 maxv Exp $"); | |
33 | 33 | |||
34 | /* | 34 | /* | |
35 | * IPsec-specific mbuf routines. | 35 | * IPsec-specific mbuf routines. | |
36 | */ | 36 | */ | |
37 | 37 | |||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/systm.h> | 39 | #include <sys/systm.h> | |
40 | #include <sys/mbuf.h> | 40 | #include <sys/mbuf.h> | |
41 | 41 | |||
42 | #include <netipsec/ipsec.h> | 42 | #include <netipsec/ipsec.h> | |
43 | #include <netipsec/ipsec_var.h> | 43 | #include <netipsec/ipsec_var.h> | |
44 | #include <netipsec/ipsec_private.h> | 44 | #include <netipsec/ipsec_private.h> | |
45 | 45 | |||
@@ -106,27 +106,27 @@ m_clone(struct mbuf *m0) | @@ -106,27 +106,27 @@ m_clone(struct mbuf *m0) | |||
106 | IPSEC_STATINC(IPSEC_STAT_CLCOALESCED); | 106 | IPSEC_STATINC(IPSEC_STAT_CLCOALESCED); | |
107 | continue; | 107 | continue; | |
108 | } | 108 | } | |
109 | 109 | |||
110 | /* | 110 | /* | |
111 | * Allocate new space to hold the copy... | 111 | * Allocate new space to hold the copy... | |
112 | */ | 112 | */ | |
113 | if (mprev == NULL && (m->m_flags & M_PKTHDR)) { | 113 | if (mprev == NULL && (m->m_flags & M_PKTHDR)) { | |
114 | MGETHDR(n, M_DONTWAIT, m->m_type); | 114 | MGETHDR(n, M_DONTWAIT, m->m_type); | |
115 | if (n == NULL) { | 115 | if (n == NULL) { | |
116 | m_freem(m0); | 116 | m_freem(m0); | |
117 | return NULL; | 117 | return NULL; | |
118 | } | 118 | } | |
119 | M_MOVE_PKTHDR(n, m); | 119 | m_move_pkthdr(n, m); | |
120 | MCLGET(n, M_DONTWAIT); | 120 | MCLGET(n, M_DONTWAIT); | |
121 | if ((n->m_flags & M_EXT) == 0) { | 121 | if ((n->m_flags & M_EXT) == 0) { | |
122 | m_free(n); | 122 | m_free(n); | |
123 | m_freem(m0); | 123 | m_freem(m0); | |
124 | return NULL; | 124 | return NULL; | |
125 | } | 125 | } | |
126 | } else { | 126 | } else { | |
127 | n = m_getcl(M_DONTWAIT, m->m_type, m->m_flags); | 127 | n = m_getcl(M_DONTWAIT, m->m_type, m->m_flags); | |
128 | if (n == NULL) { | 128 | if (n == NULL) { | |
129 | m_freem(m0); | 129 | m_freem(m0); | |
130 | return NULL; | 130 | return NULL; | |
131 | } | 131 | } | |
132 | } | 132 | } |
--- src/sys/nfs/nfs_subs.c 2018/09/03 16:29:36 1.233
+++ src/sys/nfs/nfs_subs.c 2018/12/22 13:11:38 1.234
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: nfs_subs.c,v 1.233 2018/09/03 16:29:36 riastradh Exp $ */ | 1 | /* $NetBSD: nfs_subs.c,v 1.234 2018/12/22 13:11:38 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1989, 1993 | 4 | * Copyright (c) 1989, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Rick Macklem at The University of Guelph. | 8 | * Rick Macklem at The University of Guelph. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -60,27 +60,27 @@ | @@ -60,27 +60,27 @@ | |||
60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
61 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 61 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
62 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC | 62 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC | |
63 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 63 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
64 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 64 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
65 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 65 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
66 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 66 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
67 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 67 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
68 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 68 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
69 | * POSSIBILITY OF SUCH DAMAGE. | 69 | * POSSIBILITY OF SUCH DAMAGE. | |
70 | */ | 70 | */ | |
71 | 71 | |||
72 | #include <sys/cdefs.h> | 72 | #include <sys/cdefs.h> | |
73 | __KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.233 2018/09/03 16:29:36 riastradh Exp $"); | 73 | __KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.234 2018/12/22 13:11:38 maxv Exp $"); | |
74 | 74 | |||
75 | #ifdef _KERNEL_OPT | 75 | #ifdef _KERNEL_OPT | |
76 | #include "opt_nfs.h" | 76 | #include "opt_nfs.h" | |
77 | #endif | 77 | #endif | |
78 | 78 | |||
79 | /* | 79 | /* | |
80 | * These functions support the macros and help fiddle mbuf chains for | 80 | * These functions support the macros and help fiddle mbuf chains for | |
81 | * the nfs op functions. They do things like create the rpc header and | 81 | * the nfs op functions. They do things like create the rpc header and | |
82 | * copy data between mbuf chains and uio lists. | 82 | * copy data between mbuf chains and uio lists. | |
83 | */ | 83 | */ | |
84 | #include <sys/param.h> | 84 | #include <sys/param.h> | |
85 | #include <sys/proc.h> | 85 | #include <sys/proc.h> | |
86 | #include <sys/systm.h> | 86 | #include <sys/systm.h> | |
@@ -932,27 +932,27 @@ nfsm_disct(struct mbuf **mdp, char **dpo | @@ -932,27 +932,27 @@ nfsm_disct(struct mbuf **mdp, char **dpo | |||
932 | *cp2 = mtod(m1, char *) + m1->m_len; | 932 | *cp2 = mtod(m1, char *) + m1->m_len; | |
933 | } else if (havebuf) { | 933 | } else if (havebuf) { | |
934 | /* | 934 | /* | |
935 | * If the first mbuf has a external data | 935 | * If the first mbuf has a external data | |
936 | * and there is no previous empty mbuf | 936 | * and there is no previous empty mbuf | |
937 | * allocate a new mbuf and move the external | 937 | * allocate a new mbuf and move the external | |
938 | * data to the new mbuf. Also make the first | 938 | * data to the new mbuf. Also make the first | |
939 | * mbuf look empty. | 939 | * mbuf look empty. | |
940 | */ | 940 | */ | |
941 | m2 = m1; | 941 | m2 = m1; | |
942 | *mdp = m1 = m_get(M_WAIT, MT_DATA); | 942 | *mdp = m1 = m_get(M_WAIT, MT_DATA); | |
943 | MCLAIM(m1, m2->m_owner); | 943 | MCLAIM(m1, m2->m_owner); | |
944 | if ((m2->m_flags & M_PKTHDR) != 0) { | 944 | if ((m2->m_flags & M_PKTHDR) != 0) { | |
945 | M_MOVE_PKTHDR(m1, m2); | 945 | m_move_pkthdr(m1, m2); | |
946 | } | 946 | } | |
947 | if (havebuf) { | 947 | if (havebuf) { | |
948 | havebuf->m_next = m1; | 948 | havebuf->m_next = m1; | |
949 | } | 949 | } | |
950 | m1->m_next = m2; | 950 | m1->m_next = m2; | |
951 | MRESETDATA(m1); | 951 | MRESETDATA(m1); | |
952 | m1->m_len = 0; | 952 | m1->m_len = 0; | |
953 | m2->m_data = src; | 953 | m2->m_data = src; | |
954 | m2->m_len = left; | 954 | m2->m_len = left; | |
955 | *cp2 = mtod(m1, char *); | 955 | *cp2 = mtod(m1, char *); | |
956 | } else { | 956 | } else { | |
957 | struct mbuf **nextp = &m1->m_next; | 957 | struct mbuf **nextp = &m1->m_next; | |
958 | 958 |