summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2006-04-01 15:15:05 +0000
committerrwatson <rwatson@FreeBSD.org>2006-04-01 15:15:05 +0000
commit8622e776f910513e077d822efc579cdb9ba09316 (patch)
tree9714c8659826516cd802bd3b0a45d778b7ebb1a6 /sys/netinet
parent6b3805592d02e666e50f1d4473fb18c587d69a75 (diff)
downloadFreeBSD-src-8622e776f910513e077d822efc579cdb9ba09316.zip
FreeBSD-src-8622e776f910513e077d822efc579cdb9ba09316.tar.gz
Change protocol switch pru_abort() API so that it returns void rather
than an int, as an error here is not meaningful. Modify soabort() to unconditionally free the socket on the return of pru_abort(), and modify most protocols to no longer conditionally free the socket, since the caller will do this. This commit likely leaves parts of netinet and netinet6 in a situation where they may panic or leak memory, as they have not are not fully updated by this commit. This will be corrected shortly in followup commits to these components. MFC after: 3 months
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/raw_ip.c8
-rw-r--r--sys/netinet/tcp_usrreq.c18
-rw-r--r--sys/netinet/udp_usrreq.c5
3 files changed, 19 insertions, 12 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 33ecb98..b39e693 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -653,7 +653,7 @@ rip_detach(struct socket *so)
return 0;
}
-static int
+static void
rip_abort(struct socket *so)
{
struct inpcb *inp;
@@ -662,7 +662,7 @@ rip_abort(struct socket *so)
inp = sotoinpcb(so);
if (inp == 0) {
INP_INFO_WUNLOCK(&ripcbinfo);
- return EINVAL; /* ??? possible? panic instead? */
+ return; /* ??? possible? panic instead? */
}
INP_LOCK(inp);
soisdisconnected(so);
@@ -671,7 +671,6 @@ rip_abort(struct socket *so)
else
INP_UNLOCK(inp);
INP_INFO_WUNLOCK(&ripcbinfo);
- return 0;
}
static int
@@ -679,7 +678,8 @@ rip_disconnect(struct socket *so)
{
if ((so->so_state & SS_ISCONNECTED) == 0)
return ENOTCONN;
- return rip_abort(so);
+ rip_abort(so);
+ return 0;
}
static int
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 7647893..ff4bd47 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -755,17 +755,25 @@ out:
/*
* Abort the TCP.
*/
-static int
+static void
tcp_usr_abort(struct socket *so)
{
- int error = 0;
struct inpcb *inp;
struct tcpcb *tp;
- const int inirw = INI_WRITE;
+ TCPDEBUG0;
- COMMON_START();
+ INP_INFO_WLOCK(&tcbinfo);
+ inp = sotoinpcb(so);
+ if (inp == NULL)
+ return;
+ INP_LOCK(inp);
+ tp = intotcpcb(inp);
+ TCPDEBUG1();
tp = tcp_drop(tp, ECONNABORTED);
- COMMON_END(PRU_ABORT);
+ TCPDEBUG2(PRU_ABORT);
+ if (tp)
+ INP_UNLOCK(inp);
+ INP_INFO_WUNLOCK(&tcbinfo);
}
/*
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 993450b..69ba6fe 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -929,7 +929,7 @@ u_long udp_recvspace = 40 * (1024 +
SYSCTL_ULONG(_net_inet_udp, UDPCTL_RECVSPACE, recvspace, CTLFLAG_RW,
&udp_recvspace, 0, "Maximum space for incoming UDP datagrams");
-static int
+static void
udp_abort(struct socket *so)
{
struct inpcb *inp;
@@ -938,13 +938,12 @@ udp_abort(struct socket *so)
inp = sotoinpcb(so);
if (inp == 0) {
INP_INFO_WUNLOCK(&udbinfo);
- return EINVAL; /* ??? possible? panic instead? */
+ return; /* ??? possible? panic instead? */
}
INP_LOCK(inp);
soisdisconnected(so);
in_pcbdetach(inp);
INP_INFO_WUNLOCK(&udbinfo);
- return 0;
}
static int
OpenPOWER on IntegriCloud