summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoritojun <itojun@NetBSD.org>2003-08-22 21:53:01 +0000
committeritojun <itojun@NetBSD.org>2003-08-22 21:53:01 +0000
commit82eb4ce914f47a85eaecff7693f7dfded962a4f8 (patch)
treeb3954caff5b15332e3d6e4c1f05285d41beb63af
parent9329caaf20c16c7407404cfa9fd16bb7f449dc74 (diff)
change the additional arg to be passed to ip{,6}_output to struct socket *.
this fixes KAME policy lookup which was broken by the previous commit.
-rw-r--r--sys/net/if_gre.c6
-rw-r--r--sys/net/if_stf.c6
-rw-r--r--sys/netinet/igmp.c8
-rw-r--r--sys/netinet/in_gif.c6
-rw-r--r--sys/netinet/ip_auth.c6
-rw-r--r--sys/netinet/ip_icmp.c6
-rw-r--r--sys/netinet/ip_input.c6
-rw-r--r--sys/netinet/ip_mroute.c10
-rw-r--r--sys/netinet/ip_output.c19
-rw-r--r--sys/netinet/raw_ip.c6
-rw-r--r--sys/netinet/tcp_input.c15
-rw-r--r--sys/netinet/tcp_output.c9
-rw-r--r--sys/netinet/tcp_subr.c35
-rw-r--r--sys/netinet/udp_usrreq.c6
-rw-r--r--sys/netinet6/icmp6.c8
-rw-r--r--sys/netinet6/in6_gif.c8
-rw-r--r--sys/netinet6/ip6_mroute.c6
-rw-r--r--sys/netinet6/ip6_output.c10
-rw-r--r--sys/netinet6/ip6_var.h4
-rw-r--r--sys/netinet6/mld6.c6
-rw-r--r--sys/netinet6/nd6_nbr.c9
-rw-r--r--sys/netinet6/raw_ip6.c6
-rw-r--r--sys/netinet6/udp6_output.c11
-rw-r--r--sys/netipsec/ipsec_output.c6
-rw-r--r--sys/netiso/if_eon.c6
-rw-r--r--sys/netiso/tp_inet.c6
-rw-r--r--sys/netns/ns_ip.c6
27 files changed, 119 insertions, 117 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 8b80ef22ac5..25ea515746c 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gre.c,v 1.46 2003/08/15 03:42:00 jonathan Exp $ */
+/* $NetBSD: if_gre.c,v 1.47 2003/08/22 21:53:01 itojun Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.46 2003/08/15 03:42:00 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.47 2003/08/22 21:53:01 itojun Exp $");
#include "opt_inet.h"
#include "opt_ns.h"
@@ -337,7 +337,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
ifp->if_obytes += m->m_pkthdr.len;
/* send it off */
error = ip_output(m, NULL, &sc->route, 0,
- (struct ip_moptions *)0, (struct inpcb *)0);
+ (struct ip_moptions *)NULL, (struct socket *)NULL);
end:
if (error)
ifp->if_oerrors++;
diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c
index 095a55b34e6..28927294a67 100644
--- a/sys/net/if_stf.c
+++ b/sys/net/if_stf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_stf.c,v 1.34 2003/08/15 03:42:00 jonathan Exp $ */
+/* $NetBSD: if_stf.c,v 1.35 2003/08/22 21:53:02 itojun Exp $ */
/* $KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
/*
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.34 2003/08/15 03:42:00 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.35 2003/08/22 21:53:02 itojun Exp $");
#include "opt_inet.h"
@@ -466,7 +466,7 @@ stf_output(ifp, m, dst, rt)
ifp->if_opackets++;
return ip_output(m, NULL, &sc->sc_ro, 0,
- (struct ip_moptions *)0, (struct inpcb *)0);
+ (struct ip_moptions *)NULL, (struct socket *)NULL);
}
static int
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index d7196011ac8..99f35c6178d 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: igmp.c,v 1.35 2003/08/15 03:42:01 jonathan Exp $ */
+/* $NetBSD: igmp.c,v 1.36 2003/08/22 21:53:02 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.35 2003/08/15 03:42:01 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.36 2003/08/22 21:53:02 itojun Exp $");
#include "opt_mrouting.h"
@@ -584,8 +584,8 @@ igmp_sendpkt(inm, type)
imo.imo_multicast_loop = 0;
#endif /* MROUTING */
- ip_output(m, (struct mbuf *)0, (struct route *)0, IP_MULTICASTOPTS,
- &imo, (struct inpcb *)0);
+ ip_output(m, (struct mbuf *)NULL, (struct route *)NULL,
+ IP_MULTICASTOPTS, &imo, (struct socket *)NULL);
++igmpstat.igps_snd_reports;
}
diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c
index f48a72b304d..554463f7566 100644
--- a/sys/netinet/in_gif.c
+++ b/sys/netinet/in_gif.c
@@ -1,4 +1,4 @@
-/* $NetBSD: in_gif.c,v 1.32 2002/11/11 18:35:28 itojun Exp $ */
+/* $NetBSD: in_gif.c,v 1.33 2003/08/22 21:53:03 itojun Exp $ */
/* $KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.32 2002/11/11 18:35:28 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.33 2003/08/22 21:53:03 itojun Exp $");
#include "opt_inet.h"
#include "opt_iso.h"
@@ -208,7 +208,7 @@ in_gif_output(ifp, family, m)
}
}
- error = ip_output(m, NULL, &sc->gif_ro, 0, NULL);
+ error = ip_output(m, NULL, &sc->gif_ro, 0, NULL, NULL);
return (error);
}
diff --git a/sys/netinet/ip_auth.c b/sys/netinet/ip_auth.c
index f192bd882ca..9fedba2b91f 100644
--- a/sys/netinet/ip_auth.c
+++ b/sys/netinet/ip_auth.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_auth.c,v 1.31 2003/08/15 03:42:02 jonathan Exp $ */
+/* $NetBSD: ip_auth.c,v 1.32 2003/08/22 21:53:03 itojun Exp $ */
/*
* Copyright (C) 1998-2001 by Darren Reed & Guido van Rooij.
@@ -108,7 +108,7 @@ extern struct ifqueue ipintrq; /* ip packet input queue */
#if !defined(lint)
#if defined(__NetBSD__)
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_auth.c,v 1.31 2003/08/15 03:42:02 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_auth.c,v 1.32 2003/08/22 21:53:03 itojun Exp $");
#else
static const char rcsid[] = "@(#)Id: ip_auth.c,v 2.11.2.20 2002/06/04 14:40:42 darrenr Exp";
#endif
@@ -465,7 +465,7 @@ fr_authioctlloop:
NULL);
# else
error = ip_output(m, NULL, &ro, IP_FORWARDING,
- (struct ip_moptions *)0, (struct inpcb *)0);
+ (struct ip_moptions *)NULL, (struct socket *)NULL);
# endif
if (ro.ro_rt) {
RTFREE(ro.ro_rt);
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 5307b310140..470f0636b29 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_icmp.c,v 1.76 2003/08/15 03:42:02 jonathan Exp $ */
+/* $NetBSD: ip_icmp.c,v 1.77 2003/08/22 21:53:03 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -101,7 +101,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.76 2003/08/15 03:42:02 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.77 2003/08/22 21:53:03 itojun Exp $");
#include "opt_ipsec.h"
@@ -878,7 +878,7 @@ icmp_send(m, opts)
(void)ipsec_setsocket(m, NULL);
#endif
(void) ip_output(m, opts, NULL, 0,
- (struct ip_moptions *)0, (struct inpcb *)0);
+ (struct ip_moptions *)NULL, (struct socket *)NULL);
}
n_time
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 7835c52a847..1883b416e2e 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_input.c,v 1.173 2003/08/15 03:42:02 jonathan Exp $ */
+/* $NetBSD: ip_input.c,v 1.174 2003/08/22 21:53:03 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.173 2003/08/15 03:42:02 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.174 2003/08/22 21:53:03 itojun Exp $");
#include "opt_gateway.h"
#include "opt_pfil_hooks.h"
@@ -1742,7 +1742,7 @@ ip_forward(m, srcrt)
#endif
error = ip_output(m, (struct mbuf *)0, &ipforward_rt,
(IP_FORWARDING | (ip_directedbcast ? IP_ALLOWBROADCAST : 0)),
- (struct ip_moptions *)0, (struct inpcb *)0);
+ (struct ip_moptions *)NULL, (struct socket *)NULL);
if (error)
ipstat.ips_cantforward++;
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 1d6ff195032..4073dd64e17 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_mroute.c,v 1.77 2003/08/15 03:42:03 jonathan Exp $ */
+/* $NetBSD: ip_mroute.c,v 1.78 2003/08/22 21:53:04 itojun Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.77 2003/08/15 03:42:03 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.78 2003/08/22 21:53:04 itojun Exp $");
#include "opt_ipsec.h"
@@ -1852,7 +1852,8 @@ tbf_send_packet(vifp, m)
(void)ipsec_setsocket(m, NULL);
#endif
ip_output(m, (struct mbuf *)0, &vifp->v_route,
- IP_FORWARDING, (struct ip_moptions *)0, (struct inpcb *)0);
+ IP_FORWARDING, (struct ip_moptions *)NULL,
+ (struct socket *)NULL);
} else {
/* if physical interface option, extract the options and then send */
struct ip_moptions imo;
@@ -1869,7 +1870,8 @@ tbf_send_packet(vifp, m)
(void)ipsec_setsocket(m, NULL);
#endif
error = ip_output(m, (struct mbuf *)0, (struct route *)0,
- IP_FORWARDING|IP_MULTICASTOPTS, &imo, (struct inpcb *)0);
+ IP_FORWARDING|IP_MULTICASTOPTS, &imo,
+ (struct socket *)NULL);
if (mrtdebug & DEBUG_XMIT)
log(LOG_DEBUG, "phyint_send on vif %ld err %d\n",
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 2f477930f9c..e676569a63f 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_output.c,v 1.115 2003/08/22 20:29:00 jonathan Exp $ */
+/* $NetBSD: ip_output.c,v 1.116 2003/08/22 21:53:04 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.115 2003/08/22 20:29:00 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.116 2003/08/22 21:53:04 itojun Exp $");
#include "opt_pfil_hooks.h"
#include "opt_ipsec.h"
@@ -181,13 +181,13 @@ ip_output(m0, va_alist)
int *mtu_p;
u_long mtu;
struct ip_moptions *imo;
- struct inpcb *inp;
+ struct socket *so;
va_list ap;
#ifdef IPSEC
- struct socket *so;
struct secpolicy *sp = NULL;
#endif /*IPSEC*/
#ifdef FAST_IPSEC
+ struct inpcb *inp;
struct m_tag *mtag;
struct secpolicy *sp = NULL;
struct tdb_ident *tdbi;
@@ -201,7 +201,7 @@ ip_output(m0, va_alist)
ro = va_arg(ap, struct route *);
flags = va_arg(ap, int);
imo = va_arg(ap, struct ip_moptions *);
- inp = va_arg(ap, struct inpcb *);
+ so = va_arg(ap, struct socket *);
if (flags & IP_RETURNMTU)
mtu_p = va_arg(ap, int *);
else
@@ -209,11 +209,16 @@ ip_output(m0, va_alist)
va_end(ap);
MCLAIM(m, &ip_tx_mowner);
+#ifdef FAST_IPSEC
+ if (so->so_proto->pr_domain->dom_family == AF_INET)
+ inp = (struct inpcb *)so->so_pcb;
+ else
+ inp = NULL;
+#endif /*IPSEC*/
#ifdef IPSEC
/* so = ipsec_getsocket(m); */
- so = ((inp == NULL) ? NULL : inp->inp_socket;
(void)ipsec_setsocket(m, NULL);
-#endif /*IPSEC*/
+#endif
#ifdef DIAGNOSTIC
if ((m->m_flags & M_PKTHDR) == 0)
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 83105eabcfe..bec7335b9d4 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $NetBSD: raw_ip.c,v 1.72 2003/08/15 03:42:03 jonathan Exp $ */
+/* $NetBSD: raw_ip.c,v 1.73 2003/08/22 21:53:05 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.72 2003/08/15 03:42:03 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.73 2003/08/22 21:53:05 itojun Exp $");
#include "opt_ipsec.h"
#include "opt_mrouting.h"
@@ -386,7 +386,7 @@ rip_output(m, va_alist)
}
#endif /*IPSEC*/
return (ip_output(m, opts, &inp->inp_route, flags, inp->inp_moptions,
- inp, &inp->inp_errormtu));
+ inp->inp_socket, &inp->inp_errormtu));
}
/*
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 21cbeb792e7..ad906aebd93 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_input.c,v 1.177 2003/08/22 20:20:11 jonathan Exp $ */
+/* $NetBSD: tcp_input.c,v 1.178 2003/08/22 21:53:05 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.177 2003/08/22 20:20:11 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.178 2003/08/22 21:53:05 itojun Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -3641,6 +3641,7 @@ syn_cache_respond(sc, m)
struct tcpcb *tp;
struct tcphdr *th;
u_int hlen;
+ struct socket *so;
switch (sc->sc_src.sa.sa_family) {
case AF_INET:
@@ -3689,7 +3690,6 @@ syn_cache_respond(sc, m)
/* Fixup the mbuf. */
m->m_data += max_linkhdr;
m->m_len = m->m_pkthdr.len = tlen;
-#ifdef IPSEC
if (sc->sc_tp) {
struct socket *so;
@@ -3702,13 +3702,14 @@ syn_cache_respond(sc, m)
#endif
else
so = NULL;
+#ifdef IPSEC
/* use IPsec policy on listening socket, on SYN ACK */
if (ipsec_setsocket(m, so) != 0) {
m_freem(m);
return ENOBUFS;
}
- }
#endif
+ }
m->m_pkthdr.rcvif = NULL;
memset(mtod(m, u_char *), 0, tlen);
@@ -3816,8 +3817,7 @@ syn_cache_respond(sc, m)
case AF_INET:
error = ip_output(m, sc->sc_ipopts, ro,
(ip_mtudisc ? IP_MTUDISC : 0),
- (struct ip_moptions *)0,
- (struct inpcb *)0 /* XXX tp->t_in6pcb */);
+ (struct ip_moptions *)NULL, so);
break;
#endif
#ifdef INET6
@@ -3826,8 +3826,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,
- (tp == NULL ? NULL : tp->t_in6pcb), NULL);
+ (struct ip6_moptions *)0, so, NULL);
break;
#endif
default:
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 33bafcfb091..6ee1d292d72 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_output.c,v 1.99 2003/08/22 20:20:11 jonathan Exp $ */
+/* $NetBSD: tcp_output.c,v 1.100 2003/08/22 21:53:05 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -138,7 +138,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.99 2003/08/22 20:20:11 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.100 2003/08/22 21:53:05 itojun Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -1172,8 +1172,7 @@ send:
error = ip_output(m, opts, ro,
(tp->t_mtudisc ? IP_MTUDISC : 0) |
(so->so_options & SO_DONTROUTE),
- (struct ip_moptions *)0,
- (tp == NULL ? (struct inpcb *)0 : tp->t_inpcb));
+ (struct ip_moptions *)0, so);
break;
}
#endif
@@ -1188,7 +1187,7 @@ send:
opts = NULL;
error = ip6_output(m, opts, (struct route_in6 *)ro,
so->so_options & SO_DONTROUTE,
- (struct ip6_moptions *)0, sotoin6pcb(so), NULL);
+ (struct ip6_moptions *)0, so, NULL);
break;
}
#endif
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 79a221a8683..dc374be7085 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_subr.c,v 1.147 2003/08/22 20:20:11 jonathan Exp $ */
+/* $NetBSD: tcp_subr.c,v 1.148 2003/08/22 21:53:06 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.147 2003/08/22 20:20:11 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.148 2003/08/22 21:53:06 itojun Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -574,6 +574,7 @@ tcp_respond(tp, template, m, th0, ack, seq, flags)
#endif
int family; /* family on packet, not inpcb/in6pcb! */
struct tcphdr *th;
+ struct socket *so;
if (tp != NULL && (flags & TH_RST) == 0) {
#ifdef DIAGNOSTIC
@@ -816,18 +817,23 @@ tcp_respond(tp, template, m, th0, ack, seq, flags)
#endif
}
+ if (tp->t_inpcb)
+ so = tp->t_inpcb->inp_socket;
+#ifdef INET6
+ else if (tp->t_in6pcb)
+ so = tp->t_in6pcb->in6p_socket;
+#endif
+ else
+ so = NULL;
#ifdef IPSEC
- (void)ipsec_setsocket(m, NULL);
+ if (ipsec_setsocket(m, so) != 0) {
+ m_freem(m);
+ return ENOBUFS;
+ }
#endif /*IPSEC*/
if (tp != NULL && tp->t_inpcb != NULL) {
ro = &tp->t_inpcb->inp_route;
-#ifdef IPSEC
- if (ipsec_setsocket(m, tp->t_inpcb->inp_socket) != 0) {
- m_freem(m);
- return ENOBUFS;
- }
-#endif
#ifdef DIAGNOSTIC
if (family != AF_INET)
panic("tcp_respond: address family mismatch");
@@ -841,12 +847,6 @@ tcp_respond(tp, template, m, th0, ack, seq, flags)
#ifdef INET6
else if (tp != NULL && tp->t_in6pcb != NULL) {
ro = (struct route *)&tp->t_in6pcb->in6p_route;
-#ifdef IPSEC
- if (ipsec_setsocket(m, tp->t_in6pcb->in6p_socket) != 0) {
- m_freem(m);
- return ENOBUFS;
- }
-#endif
#ifdef DIAGNOSTIC
if (family == AF_INET) {
if (!IN6_IS_ADDR_V4MAPPED(&tp->t_in6pcb->in6p_faddr))
@@ -873,14 +873,13 @@ tcp_respond(tp, template, m, th0, ack, seq, flags)
case AF_INET:
error = ip_output(m, NULL, ro,
(tp && tp->t_mtudisc ? IP_MTUDISC : 0),
- (struct ip_moptions *)0,
- (tp == NULL ? (struct inpcb *)0 : tp->t_inpcb));
+ (struct ip_moptions *)0, so);
break;
#endif
#ifdef INET6
case AF_INET6:
error = ip6_output(m, NULL, (struct route_in6 *)ro, 0,
- (struct ip6_moptions *)0, (struct in6pcb *)0, NULL);
+ (struct ip6_moptions *)0, so, NULL);
break;
#endif
default:
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 01d7aef2a87..6f06a2ca6b7 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $NetBSD: udp_usrreq.c,v 1.106 2003/08/21 14:49:50 jonathan Exp $ */
+/* $NetBSD: udp_usrreq.c,v 1.107 2003/08/22 21:53:06 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.106 2003/08/21 14:49:50 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.107 2003/08/22 21:53:06 itojun Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -915,7 +915,7 @@ udp_output(m, va_alist)
return (ip_output(m, inp->inp_options, &inp->inp_route,
inp->inp_socket->so_options & (SO_DONTROUTE | SO_BROADCAST),
- inp->inp_moptions, inp));
+ inp->inp_moptions, inp->inp_socket));
release:
m_freem(m);
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 1f3c0ea657f..c193f41ab64 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: icmp6.c,v 1.97 2003/08/22 20:20:09 jonathan Exp $ */
+/* $NetBSD: icmp6.c,v 1.98 2003/08/22 21:53:07 itojun Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.97 2003/08/22 20:20:09 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.98 2003/08/22 21:53:07 itojun Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -2145,7 +2145,7 @@ icmp6_reflect(m, off)
* since the length of ICMP6 errors is limited to the minimum MTU.
*/
if (ip6_output(m, NULL, NULL, IPV6_MINMTU,
- (struct ip6_moptions *)0, (struct in6pcb *)0, &outif) != 0
+ (struct ip6_moptions *)NULL, (struct socket *)NULL, &outif) != 0
&& outif)
icmp6_ifstat_inc(outif, ifs6_out_error);
@@ -2655,7 +2655,7 @@ noredhdropt:
(void)ipsec_setsocket(m, NULL);
#endif /* IPSEC */
if (ip6_output(m, NULL, NULL, 0,
- (struct ip6_moptions *)0, (struct in6pcb *)0, NULL) != 0)
+ (struct ip6_moptions *)NULL, (struct socket *)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 e1d557e1838..132cc6ef7ca 100644
--- a/sys/netinet6/in6_gif.c
+++ b/sys/netinet6/in6_gif.c
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_gif.c,v 1.34 2003/08/22 20:20:09 jonathan Exp $ */
+/* $NetBSD: in6_gif.c,v 1.35 2003/08/22 21:53:08 itojun Exp $ */
/* $KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.34 2003/08/22 20:20:09 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.35 2003/08/22 21:53:08 itojun Exp $");
#include "opt_inet.h"
#include "opt_iso.h"
@@ -215,10 +215,10 @@ in6_gif_output(ifp, family, m)
* path MTU discovery for encapsulated packets.
*/
error = ip6_output(m, 0, &sc->gif_ro6, IPV6_MINMTU,
- (struct ip6_moptions *)0, (struct in6pcb *)0, NULL);
+ (struct ip6_moptions *)NULL, (struct socket *)NULL, NULL);
#else
error = ip6_output(m, 0, &sc->gif_ro6, 0,
- (struct ip6_moptions *)0, (struct in6pcb *)0, NULL);
+ (struct ip6_moptions *)NULL, (struct socket *)NULL, NULL);
#endif
return (error);
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 691800d7c8b..c2edb39cc4e 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_mroute.c,v 1.54 2003/08/22 20:20:09 jonathan Exp $ */
+/* $NetBSD: ip6_mroute.c,v 1.55 2003/08/22 21:53:08 itojun Exp $ */
/* $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $ */
/*
@@ -117,7 +117,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.54 2003/08/22 20:20:09 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.55 2003/08/22 21:53:08 itojun Exp $");
#include "opt_inet.h"
#include "opt_mrouting.h"
@@ -1549,7 +1549,7 @@ phyint_send(ip6, mifp, m)
im6o.im6o_multicast_hlim = ip6->ip6_hlim;
im6o.im6o_multicast_loop = 1;
error = ip6_output(mb_copy, NULL, &ro, IPV6_FORWARDING,
- &im6o, (struct in6pcb *)0, NULL);
+ &im6o, (struct socket *)0, NULL);
#ifdef MRT6DEBUG
if (mrt6debug & DEBUG_XMIT)
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index 4cef7b56493..eccb450213a 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_output.c,v 1.64 2003/08/22 20:29:01 jonathan Exp $ */
+/* $NetBSD: ip6_output.c,v 1.65 2003/08/22 21:53:08 itojun Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.64 2003/08/22 20:29:01 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.65 2003/08/22 21:53:08 itojun Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -139,13 +139,13 @@ extern struct ifnet loif[NLOOP];
* which is rt_rmx.rmx_mtu.
*/
int
-ip6_output(m0, opt, ro, flags, im6o, in6pcb, ifpp)
+ip6_output(m0, opt, ro, flags, im6o, so, ifpp)
struct mbuf *m0;
struct ip6_pktopts *opt;
struct route_in6 *ro;
int flags;
struct ip6_moptions *im6o;
- struct in6pcb *in6pcb;
+ struct socket *so;
struct ifnet **ifpp; /* XXX: just for statistics */
{
struct ip6_hdr *ip6, *mhip6;
@@ -165,12 +165,10 @@ ip6_output(m0, opt, ro, flags, im6o, in6pcb, ifpp)
int needipsec = 0;
#ifdef IPSEC
int needipsectun = 0;
- struct socket *so;
struct secpolicy *sp = NULL;
/* for AH processing. stupid to have "socket" variable in IP layer... */
/* so = ipsec_getsocket(m); */
- so = (in6pcb == NULL) ? NULL: in6pcb->in6p_socket;
(void)ipsec_setsocket(m, NULL);
ip6 = mtod(m, struct ip6_hdr *);
#endif /* IPSEC */
diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h
index 82350260cc5..86f35398c14 100644
--- a/sys/netinet6/ip6_var.h
+++ b/sys/netinet6/ip6_var.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_var.h,v 1.30 2003/08/22 20:49:03 jonathan Exp $ */
+/* $NetBSD: ip6_var.h,v 1.31 2003/08/22 21:53:09 itojun Exp $ */
/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
/*
@@ -266,7 +266,7 @@ void ip6_forward __P((struct mbuf *, int));
void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *));
int ip6_output __P((struct mbuf *, struct ip6_pktopts *,
struct route_in6 *, int,
- struct ip6_moptions *, struct in6pcb *,
+ struct ip6_moptions *, struct socket *,
struct ifnet **));
int ip6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
int ip6_raw_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c
index 01ec01823db..04793f5535a 100644
--- a/sys/netinet6/mld6.c
+++ b/sys/netinet6/mld6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mld6.c,v 1.24 2003/08/22 20:20:10 jonathan Exp $ */
+/* $NetBSD: mld6.c,v 1.25 2003/08/22 21:53:09 itojun Exp $ */
/* $KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $ */
/*
@@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.24 2003/08/22 20:20:10 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.25 2003/08/22 21:53:09 itojun Exp $");
#include "opt_inet.h"
@@ -509,5 +509,5 @@ mld6_sendpkt(in6m, type, dst)
}
ip6_output(mh, &ip6_opts, NULL, ia ? 0 : IPV6_UNSPECSRC,
- &im6o, (struct in6pcb *)0, NULL);
+ &im6o, (struct socket *)NULL, NULL);
}
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 6abd5853409..7de2dfd2d12 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6_nbr.c,v 1.48 2003/08/22 20:20:10 jonathan Exp $ */
+/* $NetBSD: nd6_nbr.c,v 1.49 2003/08/22 21:53:09 itojun Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.48 2003/08/22 20:20:10 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.49 2003/08/22 21:53:09 itojun Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -508,7 +508,7 @@ nd6_ns_output(ifp, daddr6, taddr6, ln, dad)
(void)ipsec_setsocket(m, NULL);
#endif
ip6_output(m, NULL, &ro, dad ? IPV6_UNSPECSRC : 0,
- &im6o, (struct in6pcb *)0, NULL);
+ &im6o, (struct socket *)NULL, NULL);
icmp6_ifstat_inc(ifp, ifs6_out_msg);
icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit);
icmp6stat.icp6s_outhist[ND_NEIGHBOR_SOLICIT]++;
@@ -976,8 +976,7 @@ nd6_na_output(ifp, daddr6, taddr6, flags, tlladdr, sdl0)
/* Don't lookup socket */
(void)ipsec_setsocket(m, NULL);
#endif
- ip6_output(m, NULL, NULL, 0,
- &im6o, (struct in6pcb *)0, NULL);
+ ip6_output(m, NULL, NULL, 0, &im6o, (struct socket *)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 d61babd6a15..5e2cd1cad99 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: raw_ip6.c,v 1.56 2003/08/22 20:20:10 jonathan Exp $ */
+/* $NetBSD: raw_ip6.c,v 1.57 2003/08/22 21:53:10 itojun Exp $ */
/* $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.56 2003/08/22 20:20:10 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.57 2003/08/22 21:53:10 itojun Exp $");
#include "opt_ipsec.h"
@@ -515,7 +515,7 @@ rip6_output(m, va_alist)
#endif
error = ip6_output(m, optp, &in6p->in6p_route, flags,
- in6p->in6p_moptions, in6p, &oifp);
+ in6p->in6p_moptions, so, &oifp);
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 a9a72f980ab..6aa968a2b4a 100644
--- a/sys/netinet6/udp6_output.c
+++ b/sys/netinet6/udp6_output.c
@@ -1,4 +1,4 @@
-/* $NetBSD: udp6_output.c,v 1.13 2003/08/22 20:20:10 jonathan Exp $ */
+/* $NetBSD: udp6_output.c,v 1.14 2003/08/22 21:53:10 itojun Exp $ */
/* $KAME: udp6_output.c,v 1.43 2001/10/15 09:19:52 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: udp6_output.c,v 1.13 2003/08/22 20:20:10 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udp6_output.c,v 1.14 2003/08/22 21:53:10 itojun Exp $");
#include "opt_ipsec.h"
#include "opt_inet.h"
@@ -353,7 +353,7 @@ udp6_output(in6p, m, addr6, control, p)
}
#endif /* IPSEC */
error = ip6_output(m, in6p->in6p_outputopts, &in6p->in6p_route,
- flags, in6p->in6p_moptions, in6p, NULL);
+ flags, in6p->in6p_moptions, in6p->in6p_socket, NULL);
break;
case AF_INET:
#ifdef INET
@@ -384,10 +384,11 @@ udp6_output(in6p, m, addr6, control, p)
udpstat.udps_opackets++;
#ifdef IPSEC
- (void)ipsec_setsocket(m, NULL); /* XXX */
+ (void)ipsec_setsocket(m, in6p->in6p_socket);
#endif /* IPSEC */
error = ip_output(m, NULL, &in6p->in6p_route, flags /* XXX */,
- (struct ip_moptions *)0, (struct inpcb *)0);
+ (struct ip_moptions *)NULL,
+ (struct socket *)in6p->in6p_socket);
break;
#else
error = EAFNOSUPPORT;
diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c
index 12ff7d94224..45e36dc23b2 100644
--- a/sys/netipsec/ipsec_output.c
+++ b/sys/netipsec/ipsec_output.c
@@ -1,9 +1,9 @@
-/* $NetBSD: ipsec_output.c,v 1.4 2003/08/20 22:33:40 jonathan Exp $ */
+/* $NetBSD: ipsec_output.c,v 1.5 2003/08/22 21:53:10 itojun Exp $ */
/* $FreeBSD: src/sys/netipsec/ipsec_output.c,v 1.3.2.1 2003/01/24 05:11:35 sam Exp $ */
/* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.4 2003/08/20 22:33:40 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.5 2003/08/22 21:53:10 itojun Exp $");
/*
* IPsec output processing.
@@ -154,7 +154,7 @@ ipsec_process_done(struct mbuf *m, struct ipsecrequest *isr)
ip->ip_off = ntohs(ip->ip_off);
#endif /* __FreeBSD_ */
return ip_output(m, NULL, NULL, IP_RAWOUTPUT,
- (struct ip_moptions *)0, (struct inpcb*)0);
+ (struct ip_moptions *)NULL, (struct socket *)NULL);
#endif /* INET */
#ifdef INET6
diff --git a/sys/netiso/if_eon.c b/sys/netiso/if_eon.c
index 1bd58be4c73..fb2bde6b89a 100644
--- a/sys/netiso/if_eon.c
+++ b/sys/netiso/if_eon.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_eon.c,v 1.40 2003/08/15 03:42:06 jonathan Exp $ */
+/* $NetBSD: if_eon.c,v 1.41 2003/08/22 21:53:11 itojun Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -67,7 +67,7 @@ SOFTWARE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_eon.c,v 1.40 2003/08/15 03:42:06 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eon.c,v 1.41 2003/08/22 21:53:11 itojun Exp $");
#include "opt_eon.h"
@@ -448,7 +448,7 @@ send:
#endif
error = ip_output(m, (struct mbuf *) 0, ro, 0,
- (struct ip_moptions *)0, (struct inpcb *)0);
+ (struct ip_moptions *)NULL, (struct socket *)NULL);
m = 0;
if (error) {
ifp->if_oerrors++;
diff --git a/sys/netiso/tp_inet.c b/sys/netiso/tp_inet.c
index c8b82ee3aee..2fe189417a5 100644
--- a/sys/netiso/tp_inet.c
+++ b/sys/netiso/tp_inet.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tp_inet.c,v 1.25 2003/08/15 03:42:06 jonathan Exp $ */
+/* $NetBSD: tp_inet.c,v 1.26 2003/08/22 21:53:11 itojun Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -73,7 +73,7 @@ SOFTWARE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tp_inet.c,v 1.25 2003/08/15 03:42:06 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tp_inet.c,v 1.26 2003/08/22 21:53:11 itojun Exp $");
#include "opt_inet.h"
#include "opt_iso.h"
@@ -486,7 +486,7 @@ tpip_output_dg(m0, va_alist)
#endif
error = ip_output(m, (struct mbuf *) 0, ro, IP_ALLOWBROADCAST,
- (struct ip_moptions *)0, (struct inpcb *)0);
+ (struct ip_moptions *)NULL, (struct socket *)NULL);
#ifdef ARGO_DEBUG
if (argo_debug[D_EMIT]) {
diff --git a/sys/netns/ns_ip.c b/sys/netns/ns_ip.c
index aabb647d898..c7669e0fb3f 100644
--- a/sys/netns/ns_ip.c
+++ b/sys/netns/ns_ip.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ns_ip.c,v 1.34 2003/08/15 03:42:07 jonathan Exp $ */
+/* $NetBSD: ns_ip.c,v 1.35 2003/08/22 21:53:12 itojun Exp $ */
/*
* Copyright (c) 1984, 1985, 1986, 1987, 1993
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ns_ip.c,v 1.34 2003/08/15 03:42:07 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ns_ip.c,v 1.35 2003/08/22 21:53:12 itojun Exp $");
#include "opt_ns.h" /* options NSIP, needed by ns_if.h */
@@ -330,7 +330,7 @@ nsipoutput(ifp, m, dst, rt)
* Output final datagram.
*/
error = ip_output(m, (struct mbuf *)0, ro, SO_BROADCAST,
- (struct ip_moptions *)0, (struct inpcb *)0);
+ (struct ip_moptions *)NULL, (struct socket *)NULL);
if (error) {
ifn->ifen_ifnet.if_oerrors++;
ifn->ifen_ifnet.if_ierrors = error;