aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorMarko Zec <zec@FreeBSD.org>2008-10-02 15:37:58 +0000
committerMarko Zec <zec@FreeBSD.org>2008-10-02 15:37:58 +0000
commit8b615593fc0d78ef8366c1328f5966256b82a9c0 (patch)
tree53fef93d1ff076abec439159e0a765427992dee1 /sys/netinet/tcp_usrreq.c
parent04ec403dd815bd3731dbf7da040759cd16271e3c (diff)
downloadsrc-8b615593fc0d78ef8366c1328f5966256b82a9c0.tar.gz
src-8b615593fc0d78ef8366c1328f5966256b82a9c0.zip
Step 1.5 of importing the network stack virtualization infrastructure
from the vimage project, as per plan established at devsummit 08/08: http://wiki.freebsd.org/Image/Notes200808DevSummit Introduce INIT_VNET_*() initializer macros, VNET_FOREACH() iterator macros, and CURVNET_SET() context setting macros, all currently resolving to NOPs. Prepare for virtualization of selected SYSCTL objects by introducing a family of SYSCTL_V_*() macros, currently resolving to their global counterparts, i.e. SYSCTL_V_INT() == SYSCTL_INT(). Move selected #defines from sys/sys/vimage.h to newly introduced header files specific to virtualized subsystems (sys/net/vnet.h, sys/netinet/vinet.h etc.). All the changes are verified to have zero functional impact at this point in time by doing MD5 comparision between pre- and post-change object files(*). (*) netipsec/keysock.c did not validate depending on compile time options. Implemented by: julian, bz, brooks, zec Reviewed by: julian, bz, brooks, kris, rwatson, ... Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
Notes
Notes: svn path=/head/; revision=183550
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 6a19ad03f700..856d3f05b323 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -159,6 +159,9 @@ tcp_detach(struct socket *so, struct inpcb *inp)
#ifdef INET6
int isipv6 = INP_CHECK_SOCKAF(so, AF_INET6) != 0;
#endif
+#ifdef INVARIANTS
+ INIT_VNET_INET(so->so_vnet);
+#endif
INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
INP_WLOCK_ASSERT(inp);
@@ -249,6 +252,7 @@ tcp_detach(struct socket *so, struct inpcb *inp)
static void
tcp_usr_detach(struct socket *so)
{
+ INIT_VNET_INET(so->so_vnet);
struct inpcb *inp;
inp = sotoinpcb(so);
@@ -267,6 +271,7 @@ tcp_usr_detach(struct socket *so)
static int
tcp_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
{
+ INIT_VNET_INET(so->so_vnet);
int error = 0;
struct inpcb *inp;
struct tcpcb *tp = NULL;
@@ -307,6 +312,7 @@ out:
static int
tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
{
+ INIT_VNET_INET(so->so_vnet);
int error = 0;
struct inpcb *inp;
struct tcpcb *tp = NULL;
@@ -365,6 +371,7 @@ out:
static int
tcp_usr_listen(struct socket *so, int backlog, struct thread *td)
{
+ INIT_VNET_INET(so->so_vnet);
int error = 0;
struct inpcb *inp;
struct tcpcb *tp = NULL;
@@ -402,6 +409,7 @@ out:
static int
tcp6_usr_listen(struct socket *so, int backlog, struct thread *td)
{
+ INIT_VNET_INET(so->so_vnet);
int error = 0;
struct inpcb *inp;
struct tcpcb *tp = NULL;
@@ -449,6 +457,7 @@ out:
static int
tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
{
+ INIT_VNET_INET(so->so_vnet);
int error = 0;
struct inpcb *inp;
struct tcpcb *tp = NULL;
@@ -491,6 +500,7 @@ out:
static int
tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
{
+ INIT_VNET_INET(so->so_vnet);
int error = 0;
struct inpcb *inp;
struct tcpcb *tp = NULL;
@@ -563,6 +573,7 @@ out:
static int
tcp_usr_disconnect(struct socket *so)
{
+ INIT_VNET_INET(so->so_vnet);
struct inpcb *inp;
struct tcpcb *tp = NULL;
int error = 0;
@@ -594,6 +605,7 @@ out:
static int
tcp_usr_accept(struct socket *so, struct sockaddr **nam)
{
+ INIT_VNET_INET(so->so_vnet);
int error = 0;
struct inpcb *inp = NULL;
struct tcpcb *tp = NULL;
@@ -691,6 +703,7 @@ out:
static int
tcp_usr_shutdown(struct socket *so)
{
+ INIT_VNET_INET(so->so_vnet);
int error = 0;
struct inpcb *inp;
struct tcpcb *tp = NULL;
@@ -757,6 +770,7 @@ static int
tcp_usr_send(struct socket *so, int flags, struct mbuf *m,
struct sockaddr *nam, struct mbuf *control, struct thread *td)
{
+ INIT_VNET_INET(so->so_vnet);
int error = 0;
struct inpcb *inp;
struct tcpcb *tp = NULL;
@@ -912,6 +926,7 @@ out:
static void
tcp_usr_abort(struct socket *so)
{
+ INIT_VNET_INET(so->so_vnet);
struct inpcb *inp;
struct tcpcb *tp = NULL;
TCPDEBUG0;
@@ -950,6 +965,7 @@ tcp_usr_abort(struct socket *so)
static void
tcp_usr_close(struct socket *so)
{
+ INIT_VNET_INET(so->so_vnet);
struct inpcb *inp;
struct tcpcb *tp = NULL;
TCPDEBUG0;
@@ -1082,6 +1098,7 @@ tcp_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td)
{
struct inpcb *inp = tp->t_inpcb, *oinp;
struct socket *so = inp->inp_socket;
+ INIT_VNET_INET(so->so_vnet);
struct in_addr laddr;
u_short lport;
int error;
@@ -1137,6 +1154,7 @@ tcp6_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td)
{
struct inpcb *inp = tp->t_inpcb, *oinp;
struct socket *so = inp->inp_socket;
+ INIT_VNET_INET(so->so_vnet);
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam;
struct in6_addr *addr6;
int error;
@@ -1258,6 +1276,7 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti)
int
tcp_ctloutput(struct socket *so, struct sockopt *sopt)
{
+ INIT_VNET_INET(so->so_vnet);
int error, opt, optval;
struct inpcb *inp;
struct tcpcb *tp;
@@ -1445,6 +1464,7 @@ SYSCTL_ULONG(_net_inet_tcp, TCPCTL_RECVSPACE, recvspace, CTLFLAG_RW,
static int
tcp_attach(struct socket *so)
{
+ INIT_VNET_INET(so->so_vnet);
struct tcpcb *tp;
struct inpcb *inp;
int error;
@@ -1509,6 +1529,9 @@ tcp_disconnect(struct tcpcb *tp)
{
struct inpcb *inp = tp->t_inpcb;
struct socket *so = inp->inp_socket;
+#ifdef INVARIANTS
+ INIT_VNET_INET(so->so_vnet);
+#endif
INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
INP_WLOCK_ASSERT(inp);
@@ -1547,6 +1570,9 @@ tcp_disconnect(struct tcpcb *tp)
static void
tcp_usrclosed(struct tcpcb *tp)
{
+#ifdef INVARIANTS
+ INIT_VNET_INET(tp->t_inpcb->inp_vnet);
+#endif
INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
INP_WLOCK_ASSERT(tp->t_inpcb);