summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2007-06-01 00:52:40 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2007-06-01 00:52:40 +0000
commit078e3b8342fd27a3f38f7aa29dbbde3c07273337 (patch)
tree4a5ad6410095ab27fe1e6014e3797bfe206f2d42
parent0ac0ef2090fda4d15062e512580f65fa7d930e93 (diff)
apply the "skip ipsec if there are no flows" speedup diff to IPv6 too.
we need a pointer to the inpcb to decide, which was not previously passed to ip6_output, so this diff is a little bigger. from itojun, ok ryan
-rw-r--r--sys/net/pf.c6
-rw-r--r--sys/netinet/ip_carp.c4
-rw-r--r--sys/netinet/ipsec_output.c4
-rw-r--r--sys/netinet/tcp_input.c4
-rw-r--r--sys/netinet/tcp_output.c5
-rw-r--r--sys/netinet/tcp_subr.c5
-rw-r--r--sys/netinet6/icmp6.c7
-rw-r--r--sys/netinet6/in6_gif.c4
-rw-r--r--sys/netinet6/ip6_forward.c5
-rw-r--r--sys/netinet6/ip6_mroute.c4
-rw-r--r--sys/netinet6/ip6_output.c10
-rw-r--r--sys/netinet6/ip6_var.h4
-rw-r--r--sys/netinet6/mld6.c5
-rw-r--r--sys/netinet6/nd6_nbr.c6
-rw-r--r--sys/netinet6/raw_ip6.c4
-rw-r--r--sys/netinet6/udp6_output.c4
16 files changed, 45 insertions, 36 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index b63b7041468..fab142dfee6 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.537 2007/05/31 18:48:05 mcbride Exp $ */
+/* $OpenBSD: pf.c,v 1.538 2007/06/01 00:52:38 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1717,7 +1717,7 @@ pf_send_tcp(const struct pf_rule *r, sa_family_t af,
h6->ip6_vfc |= IPV6_VERSION;
h6->ip6_hlim = IPV6_DEFHLIM;
- ip6_output(m, NULL, NULL, 0, NULL, NULL);
+ ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL);
break;
#endif /* INET6 */
}
@@ -5795,7 +5795,7 @@ pf_route6(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
/* Cheat. XXX why only in the v6 case??? */
if (r->rt == PF_FASTROUTE) {
m0->m_pkthdr.pf.flags |= PF_TAG_GENERATED;
- ip6_output(m0, NULL, NULL, 0, NULL, NULL);
+ ip6_output(m0, NULL, NULL, 0, NULL, NULL, NULL);
return;
}
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 75ffd7d15c6..d475d90ac18 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.142 2007/06/01 00:07:13 mpf Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.143 2007/06/01 00:52:38 henning Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -1150,7 +1150,7 @@ carp_send_ad(void *v)
sc->sc_if.if_obytes += len;
carpstats.carps_opackets6++;
- error = ip6_output(m, NULL, NULL, 0, &sc->sc_im6o, NULL);
+ error = ip6_output(m, NULL, NULL, 0, &sc->sc_im6o, NULL, NULL);
if (error) {
if (error == ENOBUFS)
carpstats.carps_onomem++;
diff --git a/sys/netinet/ipsec_output.c b/sys/netinet/ipsec_output.c
index bdb15200674..6ac50774761 100644
--- a/sys/netinet/ipsec_output.c
+++ b/sys/netinet/ipsec_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsec_output.c,v 1.38 2007/05/28 17:16:39 henning Exp $ */
+/* $OpenBSD: ipsec_output.c,v 1.39 2007/06/01 00:52:38 henning Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -518,7 +518,7 @@ ipsp_process_done(struct mbuf *m, struct tdb *tdb)
* We don't need massage, IPv6 header fields are always in
* net endian.
*/
- return ip6_output(m, NULL, NULL, 0, NULL, NULL);
+ return ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL);
#endif /* INET6 */
}
return EINVAL; /* Not reached. */
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 1b5fdcebbc3..b2716805f7c 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.204 2007/05/27 21:37:53 deraadt Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.205 2007/06/01 00:52:38 henning Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -4376,7 +4376,7 @@ syn_cache_respond(sc, m)
ro->ro_rt ? ro->ro_rt->rt_ifp : NULL);
error = ip6_output(m, NULL /*XXX*/, (struct route_in6 *)ro, 0,
- (struct ip6_moptions *)0, NULL);
+ (struct ip6_moptions *)0, NULL, NULL);
break;
#endif
default:
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index d36f60dac3c..8d1414a117a 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_output.c,v 1.79 2005/06/30 08:51:31 markus Exp $ */
+/* $OpenBSD: tcp_output.c,v 1.80 2007/06/01 00:52:38 henning Exp $ */
/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */
/*
@@ -1106,7 +1106,8 @@ send:
}
error = ip6_output(m, tp->t_inpcb->inp_outputopts6,
&tp->t_inpcb->inp_route6,
- (so->so_options & SO_DONTROUTE), NULL, NULL);
+ (so->so_options & SO_DONTROUTE), NULL, NULL,
+ tp->t_inpcb);
break;
#endif /* INET6 */
}
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 5693e4a1545..013efcdf795 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_subr.c,v 1.95 2007/05/09 14:28:47 deraadt Exp $ */
+/* $OpenBSD: tcp_subr.c,v 1.96 2007/06/01 00:52:38 henning Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
@@ -443,7 +443,8 @@ tcp_respond(tp, template, m, ack, seq, flags)
sizeof(struct ip6_hdr), ((struct ip6_hdr *)ti)->ip6_plen);
HTONS(((struct ip6_hdr *)ti)->ip6_plen);
ip6_output(m, tp ? tp->t_inpcb->inp_outputopts6 : NULL,
- (struct route_in6 *)ro, 0, NULL, NULL);
+ (struct route_in6 *)ro, 0, NULL, NULL,
+ tp ? tp->t_inpcb : NULL);
break;
#endif /* INET6 */
case AF_INET:
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index aaa3c57f5f1..4a0e360a936 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.93 2007/03/18 23:23:17 mpf Exp $ */
+/* $OpenBSD: icmp6.c,v 1.94 2007/06/01 00:52:38 henning Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -2134,7 +2134,8 @@ icmp6_reflect(m, off)
* Note that only echo and node information replies are affected,
* since the length of ICMP6 errors is limited to the minimum MTU.
*/
- if (ip6_output(m, NULL, NULL, IPV6_MINMTU, NULL, &outif) != 0 && outif)
+ if (ip6_output(m, NULL, NULL, IPV6_MINMTU, NULL, &outif, NULL) != 0 &&
+ outif)
icmp6_ifstat_inc(outif, ifs6_out_error);
if (outif)
@@ -2634,7 +2635,7 @@ noredhdropt:
= in6_cksum(m, IPPROTO_ICMPV6, sizeof(*ip6), ntohs(ip6->ip6_plen));
/* send the packet to outside... */
- if (ip6_output(m, NULL, NULL, 0, NULL, NULL) != 0)
+ if (ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL) != 0)
icmp6_ifstat_inc(ifp, ifs6_out_error);
icmp6_ifstat_inc(ifp, ifs6_out_msg);
diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c
index 4e273aa3136..886b4f4d881 100644
--- a/sys/netinet6/in6_gif.c
+++ b/sys/netinet6/in6_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_gif.c,v 1.24 2007/02/15 22:45:09 claudio Exp $ */
+/* $OpenBSD: in6_gif.c,v 1.25 2007/06/01 00:52:38 henning Exp $ */
/* $KAME: in6_gif.c,v 1.43 2001/01/22 07:27:17 itojun Exp $ */
/*
@@ -166,7 +166,7 @@ in6_gif_output(ifp, family, m)
* it is too painful to ask for resend of inner packet, to achieve
* path MTU discovery for encapsulated packets.
*/
- error = ip6_output(m, 0, &sc->gif_ro6, IPV6_MINMTU, 0, NULL);
+ error = ip6_output(m, 0, &sc->gif_ro6, IPV6_MINMTU, 0, NULL, NULL);
return error;
}
diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c
index c481e36c7a8..3a215794d73 100644
--- a/sys/netinet6/ip6_forward.c
+++ b/sys/netinet6/ip6_forward.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_forward.c,v 1.38 2007/05/28 17:16:39 henning Exp $ */
+/* $OpenBSD: ip6_forward.c,v 1.39 2007/06/01 00:52:38 henning Exp $ */
/* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */
/*
@@ -140,6 +140,9 @@ ip6_forward(m, srcrt)
ip6->ip6_hlim -= IPV6_HLIMDEC;
#ifdef IPSEC
+ if (!ipsec_in_use)
+ goto done_spd;
+
s = splnet();
/*
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 81f049e213b..c9d2e7ebbae 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -1548,8 +1548,8 @@ phyint_send(ip6, mifp, m)
/* XXX: ip6_output will override ip6->ip6_hlim */
im6o.im6o_multicast_hlim = ip6->ip6_hlim;
im6o.im6o_multicast_loop = 1;
- error = ip6_output(mb_copy, NULL, &ro,
- IPV6_FORWARDING, &im6o, NULL);
+ error = ip6_output(mb_copy, NULL, &ro, IPV6_FORWARDING, &im6o,
+ NULL, NULL);
#ifdef MRT6DEBUG
if (mrt6debug & DEBUG_XMIT)
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index 04152b61c1b..896edec236f 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_output.c,v 1.98 2007/02/08 15:25:30 itojun Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.99 2007/06/01 00:52:38 henning Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -144,13 +144,14 @@ static int copypktopts(struct ip6_pktopts *, struct ip6_pktopts *, int);
* which is rt_rmx.rmx_mtu.
*/
int
-ip6_output(m0, opt, ro, flags, im6o, ifpp)
+ip6_output(m0, opt, ro, flags, im6o, ifpp, inp)
struct mbuf *m0;
struct ip6_pktopts *opt;
struct route_in6 *ro;
int flags;
struct ip6_moptions *im6o;
struct ifnet **ifpp; /* XXX: just for statistics */
+ struct inpcb *inp;
{
struct ip6_hdr *ip6, *mhip6;
struct ifnet *ifp, *origifp = NULL;
@@ -174,13 +175,11 @@ ip6_output(m0, opt, ro, flags, im6o, ifpp)
union sockaddr_union sdst;
struct tdb_ident *tdbi;
u_int32_t sspi;
- struct inpcb *inp;
struct tdb *tdb;
int s;
#endif /* IPSEC */
#ifdef IPSEC
- inp = NULL; /*XXX*/
if (inp && (inp->inp_flags & INP_IPV6) == 0)
panic("ip6_output: IPv4 pcb is passed");
#endif /* IPSEC */
@@ -213,6 +212,9 @@ ip6_output(m0, opt, ro, flags, im6o, ifpp)
}
#ifdef IPSEC
+ if (!ipsec_in_use && !inp)
+ goto done_spd;
+
/*
* splnet is chosen over spltdb because we are not allowed to
* lower the level, and udp6_output calls us in splnet(). XXX check
diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h
index 93e3fa41db9..b3be6fc3628 100644
--- a/sys/netinet6/ip6_var.h
+++ b/sys/netinet6/ip6_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_var.h,v 1.30 2006/12/09 01:12:28 itojun Exp $ */
+/* $OpenBSD: ip6_var.h,v 1.31 2007/06/01 00:52:38 henning Exp $ */
/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
/*
@@ -288,7 +288,7 @@ void ip6_forward(struct mbuf *, int);
void ip6_mloopback(struct ifnet *, struct mbuf *, struct sockaddr_in6 *);
int ip6_output(struct mbuf *, struct ip6_pktopts *, struct route_in6 *, int,
- struct ip6_moptions *, struct ifnet **);
+ struct ip6_moptions *, struct ifnet **, struct inpcb *);
int ip6_ctloutput(int, struct socket *, int, int, struct mbuf **);
int ip6_raw_ctloutput(int, struct socket *, int, int, struct mbuf **);
void ip6_initpktopts(struct ip6_pktopts *);
diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c
index 148135d968f..5f8a130db23 100644
--- a/sys/netinet6/mld6.c
+++ b/sys/netinet6/mld6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mld6.c,v 1.23 2006/12/09 01:12:28 itojun Exp $ */
+/* $OpenBSD: mld6.c,v 1.24 2007/06/01 00:52:38 henning Exp $ */
/* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */
/*
@@ -462,5 +462,6 @@ mld6_sendpkt(in6m, type, dst)
break;
}
- ip6_output(mh, &ip6_opts, NULL, ia ? 0 : IPV6_UNSPECSRC, &im6o, NULL);
+ ip6_output(mh, &ip6_opts, NULL, ia ? 0 : IPV6_UNSPECSRC, &im6o, NULL,
+ NULL);
}
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index a5f425eef0b..d56c86376c3 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_nbr.c,v 1.43 2007/03/18 23:23:17 mpf Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.44 2007/06/01 00:52:38 henning Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -508,7 +508,7 @@ nd6_ns_output(ifp, daddr6, taddr6, ln, dad)
nd_ns->nd_ns_cksum =
in6_cksum(m, IPPROTO_ICMPV6, sizeof(*ip6), icmp6len);
- ip6_output(m, NULL, &ro, dad ? IPV6_UNSPECSRC : 0, &im6o, NULL);
+ ip6_output(m, NULL, &ro, dad ? IPV6_UNSPECSRC : 0, &im6o, NULL, NULL);
icmp6_ifstat_inc(ifp, ifs6_out_msg);
icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit);
icmp6stat.icp6s_outhist[ND_NEIGHBOR_SOLICIT]++;
@@ -972,7 +972,7 @@ nd6_na_output(ifp, daddr6, taddr6, flags, tlladdr, sdl0)
nd_na->nd_na_cksum =
in6_cksum(m, IPPROTO_ICMPV6, sizeof(struct ip6_hdr), icmp6len);
- ip6_output(m, NULL, &ro, 0, &im6o, NULL);
+ ip6_output(m, NULL, &ro, 0, &im6o, NULL, NULL);
icmp6_ifstat_inc(ifp, ifs6_out_msg);
icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert);
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index 5a861e6bdc9..e02ff40213d 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip6.c,v 1.32 2007/02/14 00:53:48 jsg Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.33 2007/06/01 00:52:39 henning Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@@ -495,7 +495,7 @@ rip6_output(struct mbuf *m, ...)
flags |= IPV6_MINMTU;
error = ip6_output(m, optp, &in6p->in6p_route, flags,
- in6p->in6p_moptions, &oifp);
+ in6p->in6p_moptions, &oifp, in6p);
if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) {
if (oifp)
icmp6_ifoutstat_inc(oifp, type, code);
diff --git a/sys/netinet6/udp6_output.c b/sys/netinet6/udp6_output.c
index 0eb12815e31..f0062c6a58e 100644
--- a/sys/netinet6/udp6_output.c
+++ b/sys/netinet6/udp6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp6_output.c,v 1.13 2006/12/09 01:12:28 itojun Exp $ */
+/* $OpenBSD: udp6_output.c,v 1.14 2007/06/01 00:52:39 henning Exp $ */
/* $KAME: udp6_output.c,v 1.21 2001/02/07 11:51:54 itojun Exp $ */
/*
@@ -268,7 +268,7 @@ udp6_output(in6p, m, addr6, control)
udp6stat.udp6s_opackets++;
error = ip6_output(m, optp, &in6p->in6p_route,
- flags, in6p->in6p_moptions, NULL);
+ flags, in6p->in6p_moptions, NULL, in6p);
break;
case AF_INET:
error = EAFNOSUPPORT;