Mon Apr 25 22:20:59 2011 UTC ()
undefer csum in looutput.
looutput is used by various code (ether_output, mcast) to loopback packets.


(yamt)
diff -r1.72 -r1.73 src/sys/net/if_loop.c
diff -r1.7 -r1.8 src/sys/netinet/in_offload.h
diff -r1.6 -r1.7 src/sys/netinet6/in6_offload.h
diff -r1.139 -r1.140 src/sys/netinet6/ip6_output.c

cvs diff -r1.72 -r1.73 src/sys/net/if_loop.c (expand / switch to unified diff)

--- src/sys/net/if_loop.c 2010/04/05 07:22:23 1.72
+++ src/sys/net/if_loop.c 2011/04/25 22:20:59 1.73
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_loop.c,v 1.72 2010/04/05 07:22:23 joerg Exp $ */ 1/* $NetBSD: if_loop.c,v 1.73 2011/04/25 22:20:59 yamt 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.
@@ -55,27 +55,27 @@ @@ -55,27 +55,27 @@
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE. 58 * SUCH DAMAGE.
59 * 59 *
60 * @(#)if_loop.c 8.2 (Berkeley) 1/9/95 60 * @(#)if_loop.c 8.2 (Berkeley) 1/9/95
61 */ 61 */
62 62
63/* 63/*
64 * Loopback interface driver for protocol testing and timing. 64 * Loopback interface driver for protocol testing and timing.
65 */ 65 */
66 66
67#include <sys/cdefs.h> 67#include <sys/cdefs.h>
68__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.72 2010/04/05 07:22:23 joerg Exp $"); 68__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.73 2011/04/25 22:20:59 yamt Exp $");
69 69
70#include "opt_inet.h" 70#include "opt_inet.h"
71#include "opt_atalk.h" 71#include "opt_atalk.h"
72#include "opt_iso.h" 72#include "opt_iso.h"
73#include "opt_ipx.h" 73#include "opt_ipx.h"
74#include "opt_mbuftrace.h" 74#include "opt_mbuftrace.h"
75 75
76 76
77#include <sys/param.h> 77#include <sys/param.h>
78#include <sys/systm.h> 78#include <sys/systm.h>
79#include <sys/kernel.h> 79#include <sys/kernel.h>
80#include <sys/mbuf.h> 80#include <sys/mbuf.h>
81#include <sys/socket.h> 81#include <sys/socket.h>
@@ -84,38 +84,39 @@ __KERNEL_RCSID(0, "$NetBSD: if_loop.c,v  @@ -84,38 +84,39 @@ __KERNEL_RCSID(0, "$NetBSD: if_loop.c,v
84#include <sys/time.h> 84#include <sys/time.h>
85 85
86#include <sys/cpu.h> 86#include <sys/cpu.h>
87 87
88#include <net/if.h> 88#include <net/if.h>
89#include <net/if_types.h> 89#include <net/if_types.h>
90#include <net/netisr.h> 90#include <net/netisr.h>
91#include <net/route.h> 91#include <net/route.h>
92 92
93#ifdef INET 93#ifdef INET
94#include <netinet/in.h> 94#include <netinet/in.h>
95#include <netinet/in_systm.h> 95#include <netinet/in_systm.h>
96#include <netinet/in_var.h> 96#include <netinet/in_var.h>
 97#include <netinet/in_offload.h>
97#include <netinet/ip.h> 98#include <netinet/ip.h>
98#endif 99#endif
99 100
100#ifdef INET6 101#ifdef INET6
101#ifndef INET 102#ifndef INET
102#include <netinet/in.h> 103#include <netinet/in.h>
103#endif 104#endif
104#include <netinet6/in6_var.h> 105#include <netinet6/in6_var.h>
 106#include <netinet6/in6_offload.h>
105#include <netinet/ip6.h> 107#include <netinet/ip6.h>
106#endif 108#endif
107 109
108 
109#ifdef IPX 110#ifdef IPX
110#include <netipx/ipx.h> 111#include <netipx/ipx.h>
111#include <netipx/ipx_if.h> 112#include <netipx/ipx_if.h>
112#endif 113#endif
113 114
114#ifdef ISO 115#ifdef ISO
115#include <netiso/iso.h> 116#include <netiso/iso.h>
116#include <netiso/iso_var.h> 117#include <netiso/iso_var.h>
117#endif 118#endif
118 119
119#ifdef NETATALK 120#ifdef NETATALK
120#include <netatalk/at.h> 121#include <netatalk/at.h>
121#include <netatalk/at_var.h> 122#include <netatalk/at_var.h>
@@ -202,26 +203,27 @@ loop_clone_destroy(struct ifnet *ifp) @@ -202,26 +203,27 @@ loop_clone_destroy(struct ifnet *ifp)
202 if_detach(ifp); 203 if_detach(ifp);
203 204
204 free(ifp, M_DEVBUF); 205 free(ifp, M_DEVBUF);
205 206
206 return (0); 207 return (0);
207} 208}
208 209
209int 210int
210looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, 211looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
211 struct rtentry *rt) 212 struct rtentry *rt)
212{ 213{
213 int s, isr; 214 int s, isr;
214 struct ifqueue *ifq = NULL; 215 struct ifqueue *ifq = NULL;
 216 int csum_flags;
215 217
216 MCLAIM(m, ifp->if_mowner); 218 MCLAIM(m, ifp->if_mowner);
217 if ((m->m_flags & M_PKTHDR) == 0) 219 if ((m->m_flags & M_PKTHDR) == 0)
218 panic("looutput: no header mbuf"); 220 panic("looutput: no header mbuf");
219 if (ifp->if_flags & IFF_LOOPBACK) 221 if (ifp->if_flags & IFF_LOOPBACK)
220 bpf_mtap_af(ifp, dst->sa_family, m); 222 bpf_mtap_af(ifp, dst->sa_family, m);
221 m->m_pkthdr.rcvif = ifp; 223 m->m_pkthdr.rcvif = ifp;
222 224
223 if (rt && rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) { 225 if (rt && rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) {
224 m_freem(m); 226 m_freem(m);
225 return (rt->rt_flags & RTF_BLACKHOLE ? 0 : 227 return (rt->rt_flags & RTF_BLACKHOLE ? 0 :
226 rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH); 228 rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH);
227 } 229 }
@@ -254,32 +256,45 @@ looutput(struct ifnet *ifp, struct mbuf  @@ -254,32 +256,45 @@ looutput(struct ifnet *ifp, struct mbuf
254 IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error); 256 IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error);
255 (*ifp->if_start)(ifp); 257 (*ifp->if_start)(ifp);
256 splx(s); 258 splx(s);
257 return (error); 259 return (error);
258 } 260 }
259#endif /* ALTQ */ 261#endif /* ALTQ */
260 262
261 m_tag_delete_nonpersistent(m); 263 m_tag_delete_nonpersistent(m);
262 264
263 switch (dst->sa_family) { 265 switch (dst->sa_family) {
264 266
265#ifdef INET 267#ifdef INET
266 case AF_INET: 268 case AF_INET:
 269 csum_flags = m->m_pkthdr.csum_flags;
 270 KASSERT((csum_flags & ~(M_CSUM_IPv4|M_CSUM_UDPv4)) == 0);
 271 if (csum_flags != 0 && IN_LOOPBACK_NEED_CHECKSUM(csum_flags)) {
 272 ip_undefer_csum(m, 0, csum_flags);
 273 }
 274 m->m_pkthdr.csum_flags = 0;
267 ifq = &ipintrq; 275 ifq = &ipintrq;
268 isr = NETISR_IP; 276 isr = NETISR_IP;
269 break; 277 break;
270#endif 278#endif
271#ifdef INET6 279#ifdef INET6
272 case AF_INET6: 280 case AF_INET6:
 281 csum_flags = m->m_pkthdr.csum_flags;
 282 KASSERT((csum_flags & ~M_CSUM_UDPv6) == 0);
 283 if (csum_flags != 0 &&
 284 IN6_LOOPBACK_NEED_CHECKSUM(csum_flags)) {
 285 ip6_undefer_csum(m, 0, csum_flags);
 286 }
 287 m->m_pkthdr.csum_flags = 0;
273 m->m_flags |= M_LOOP; 288 m->m_flags |= M_LOOP;
274 ifq = &ip6intrq; 289 ifq = &ip6intrq;
275 isr = NETISR_IPV6; 290 isr = NETISR_IPV6;
276 break; 291 break;
277#endif 292#endif
278#ifdef ISO 293#ifdef ISO
279 case AF_ISO: 294 case AF_ISO:
280 ifq = &clnlintrq; 295 ifq = &clnlintrq;
281 isr = NETISR_ISO; 296 isr = NETISR_ISO;
282 break; 297 break;
283#endif 298#endif
284#ifdef IPX 299#ifdef IPX
285 case AF_IPX: 300 case AF_IPX:

cvs diff -r1.7 -r1.8 src/sys/netinet/in_offload.h (expand / switch to unified diff)

--- src/sys/netinet/in_offload.h 2010/12/11 22:37:46 1.7
+++ src/sys/netinet/in_offload.h 2011/04/25 22:20:59 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: in_offload.h,v 1.7 2010/12/11 22:37:46 matt Exp $ */ 1/* $NetBSD: in_offload.h,v 1.8 2011/04/25 22:20:59 yamt Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c)2005, 2006 YAMAMOTO Takashi, 4 * Copyright (c)2005, 2006 YAMAMOTO Takashi,
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.
@@ -38,20 +38,23 @@ int ip_tso_output(struct ifnet *, struct @@ -38,20 +38,23 @@ int ip_tso_output(struct ifnet *, struct
38 struct rtentry *); 38 struct rtentry *);
39void ip_undefer_csum(struct mbuf *, size_t, int);  39void ip_undefer_csum(struct mbuf *, size_t, int);
40 40
41/* 41/*
42 * offloading related sysctl variables. 42 * offloading related sysctl variables.
43 * 43 *
44 * they are here because it violates protocol layering in unusual way. 44 * they are here because it violates protocol layering in unusual way.
45 * ie. while they are TCP/UDP sysctls, they are used by IP layer. 45 * ie. while they are TCP/UDP sysctls, they are used by IP layer.
46 */ 46 */
47 47
48extern int tcp_do_loopback_cksum; /* do TCP checksum on loopback? */ 48extern int tcp_do_loopback_cksum; /* do TCP checksum on loopback? */
49extern int udp_do_loopback_cksum; /* do UDP checksum on loopback? */ 49extern int udp_do_loopback_cksum; /* do UDP checksum on loopback? */
50 50
 51#define IN_LOOPBACK_NEED_CHECKSUM(csum_flags) \
 52 ((((csum_flags) & M_CSUM_UDPv4) != 0 && udp_do_loopback_cksum) || \
 53 (((csum_flags) & M_CSUM_TCPv4) != 0 && tcp_do_loopback_cksum) || \
 54 (((csum_flags) & M_CSUM_IPv4) != 0 && ip_do_loopback_cksum))
 55
51#define IN_NEED_CHECKSUM(ifp, csum_flags) \ 56#define IN_NEED_CHECKSUM(ifp, csum_flags) \
52 (__predict_true(((ifp)->if_flags & IFF_LOOPBACK) == 0 || \ 57 (__predict_true(((ifp)->if_flags & IFF_LOOPBACK) == 0 || \
53 (((csum_flags) & M_CSUM_UDPv4) != 0 && udp_do_loopback_cksum) || \ 58 IN_LOOPBACK_NEED_CHECKSUM(csum_flags)))
54 (((csum_flags) & M_CSUM_TCPv4) != 0 && tcp_do_loopback_cksum) || \ 
55 (((csum_flags) & M_CSUM_IPv4) != 0 && ip_do_loopback_cksum))) 
56 59
57#endif /* !_NETINET_IN_OFFLOAD_H_ */ 60#endif /* !_NETINET_IN_OFFLOAD_H_ */

cvs diff -r1.6 -r1.7 src/sys/netinet6/in6_offload.h (expand / switch to unified diff)

--- src/sys/netinet6/in6_offload.h 2010/12/11 22:37:47 1.6
+++ src/sys/netinet6/in6_offload.h 2011/04/25 22:20:59 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: in6_offload.h,v 1.6 2010/12/11 22:37:47 matt Exp $ */ 1/* $NetBSD: in6_offload.h,v 1.7 2011/04/25 22:20:59 yamt Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c)2005, 2006 YAMAMOTO Takashi, 4 * Copyright (c)2005, 2006 YAMAMOTO Takashi,
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.
@@ -28,14 +28,25 @@ @@ -28,14 +28,25 @@
28 28
29/* 29/*
30 * subroutines to do software-only equivalent of h/w offloading. 30 * subroutines to do software-only equivalent of h/w offloading.
31 */ 31 */
32 32
33#if !defined(_NETINET6_IN6_OFFLOAD_H_) 33#if !defined(_NETINET6_IN6_OFFLOAD_H_)
34#define _NETINET6_IN6_OFFLOAD_H_ 34#define _NETINET6_IN6_OFFLOAD_H_
35 35
36int tcp6_segment(struct mbuf *, int (*)(void *, struct mbuf *), void *); 36int tcp6_segment(struct mbuf *, int (*)(void *, struct mbuf *), void *);
37int ip6_tso_output(struct ifnet *, struct ifnet *, struct mbuf *, 37int ip6_tso_output(struct ifnet *, struct ifnet *, struct mbuf *,
38 const struct sockaddr_in6 *, struct rtentry *); 38 const struct sockaddr_in6 *, struct rtentry *);
39void ip6_undefer_csum(struct mbuf *, size_t, int); 39void ip6_undefer_csum(struct mbuf *, size_t, int);
40 40
 41extern int tcp_do_loopback_cksum; /* do TCP checksum on loopback? */
 42extern int udp_do_loopback_cksum; /* do UDP checksum on loopback? */
 43
 44#define IN6_LOOPBACK_NEED_CHECKSUM(csum_flags) \
 45 ((((csum_flags) & M_CSUM_UDPv6) != 0 && udp_do_loopback_cksum) || \
 46 (((csum_flags) & M_CSUM_TCPv6) != 0 && tcp_do_loopback_cksum))
 47
 48#define IN6_NEED_CHECKSUM(ifp, csum_flags) \
 49 (__predict_true(((ifp)->if_flags & IFF_LOOPBACK) == 0 || \
 50 IN6_LOOPBACK_NEED_CHECKSUM(csum_flags)))
 51
41#endif /* !defined(_NETINET6_IN6_OFFLOAD_H_) */ 52#endif /* !defined(_NETINET6_IN6_OFFLOAD_H_) */

cvs diff -r1.139 -r1.140 src/sys/netinet6/ip6_output.c (expand / switch to unified diff)

--- src/sys/netinet6/ip6_output.c 2009/05/07 21:51:47 1.139
+++ src/sys/netinet6/ip6_output.c 2011/04/25 22:20:59 1.140
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ip6_output.c,v 1.139 2009/05/07 21:51:47 elad Exp $ */ 1/* $NetBSD: ip6_output.c,v 1.140 2011/04/25 22:20:59 yamt 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.139 2009/05/07 21:51:47 elad Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.140 2011/04/25 22:20:59 yamt Exp $");
66 66
67#include "opt_inet.h" 67#include "opt_inet.h"
68#include "opt_inet6.h" 68#include "opt_inet6.h"
69#include "opt_ipsec.h" 69#include "opt_ipsec.h"
70#include "opt_pfil_hooks.h" 70#include "opt_pfil_hooks.h"
71 71
72#include <sys/param.h> 72#include <sys/param.h>
73#include <sys/malloc.h> 73#include <sys/malloc.h>
74#include <sys/mbuf.h> 74#include <sys/mbuf.h>
75#include <sys/errno.h> 75#include <sys/errno.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>
@@ -137,31 +137,26 @@ static int ip6_getmoptions(struct sockop @@ -137,31 +137,26 @@ static int ip6_getmoptions(struct sockop
137static int ip6_copyexthdr(struct mbuf **, void *, int); 137static int ip6_copyexthdr(struct mbuf **, void *, int);
138static int ip6_insertfraghdr(struct mbuf *, struct mbuf *, int, 138static int ip6_insertfraghdr(struct mbuf *, struct mbuf *, int,
139 struct ip6_frag **); 139 struct ip6_frag **);
140static int ip6_insert_jumboopt(struct ip6_exthdrs *, u_int32_t); 140static int ip6_insert_jumboopt(struct ip6_exthdrs *, u_int32_t);
141static int ip6_splithdr(struct mbuf *, struct ip6_exthdrs *); 141static int ip6_splithdr(struct mbuf *, struct ip6_exthdrs *);
142static int ip6_getpmtu(struct route *, struct route *, struct ifnet *, 142static int ip6_getpmtu(struct route *, struct route *, struct ifnet *,
143 const struct in6_addr *, u_long *, int *); 143 const struct in6_addr *, u_long *, int *);
144static int copypktopts(struct ip6_pktopts *, struct ip6_pktopts *, int); 144static int copypktopts(struct ip6_pktopts *, struct ip6_pktopts *, int);
145 145
146#ifdef RFC2292 146#ifdef RFC2292
147static int ip6_pcbopts(struct ip6_pktopts **, struct socket *, struct sockopt *); 147static int ip6_pcbopts(struct ip6_pktopts **, struct socket *, struct sockopt *);
148#endif 148#endif
149 149
150#define IN6_NEED_CHECKSUM(ifp, csum_flags) \ 
151 (__predict_true(((ifp)->if_flags & IFF_LOOPBACK) == 0 || \ 
152 (((csum_flags) & M_CSUM_UDPv6) != 0 && udp_do_loopback_cksum) || \ 
153 (((csum_flags) & M_CSUM_TCPv6) != 0 && tcp_do_loopback_cksum))) 
154 
155/* 150/*
156 * IP6 output. The packet in mbuf chain m contains a skeletal IP6 151 * IP6 output. The packet in mbuf chain m contains a skeletal IP6
157 * header (with pri, len, nxt, hlim, src, dst). 152 * header (with pri, len, nxt, hlim, src, dst).
158 * This function may modify ver and hlim only. 153 * This function may modify ver and hlim only.
159 * The mbuf chain containing the packet will be freed. 154 * The mbuf chain containing the packet will be freed.
160 * The mbuf opt, if present, will not be freed. 155 * The mbuf opt, if present, will not be freed.
161 * 156 *
162 * type of "mtu": rt_rmx.rmx_mtu is u_long, ifnet.ifr_mtu is int, and 157 * type of "mtu": rt_rmx.rmx_mtu is u_long, ifnet.ifr_mtu is int, and
163 * nd_ifinfo.linkmtu is u_int32_t. so we use u_long to hold largest one, 158 * nd_ifinfo.linkmtu is u_int32_t. so we use u_long to hold largest one,
164 * which is rt_rmx.rmx_mtu. 159 * which is rt_rmx.rmx_mtu.
165 */ 160 */
166int 161int
167ip6_output( 162ip6_output(