summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_syncache.c
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2010-08-15 09:30:13 +0000
committerandre <andre@FreeBSD.org>2010-08-15 09:30:13 +0000
commit0490dbf01d48c3a57ba6a5bdc740615939df59c4 (patch)
treef9a0fb7131b2e563af2ae51e908cf75635e40e3f /sys/netinet/tcp_syncache.c
parent7321910ddaa15655283f699645ba7c8aec64af4c (diff)
downloadFreeBSD-src-0490dbf01d48c3a57ba6a5bdc740615939df59c4.zip
FreeBSD-src-0490dbf01d48c3a57ba6a5bdc740615939df59c4.tar.gz
Add more logging points for failures in syncache_socket() to
report when a new socket couldn't be created because one of in_pcbinshash(), in6_pcbconnect() or in_pcbconnect() failed. Logging is conditional on net.inet.tcp.log_debug being enabled. MFC after: 1 week
Diffstat (limited to 'sys/netinet/tcp_syncache.c')
-rw-r--r--sys/netinet/tcp_syncache.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 2d05760..f237a0f 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -627,6 +627,7 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
struct inpcb *inp = NULL;
struct socket *so;
struct tcpcb *tp;
+ int error = 0;
char *s;
INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
@@ -675,7 +676,7 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
}
#endif
inp->inp_lport = sc->sc_inc.inc_lport;
- if (in_pcbinshash(inp) != 0) {
+ if ((error = in_pcbinshash(inp)) != 0) {
/*
* Undo the assignments above if we failed to
* put the PCB on the hash lists.
@@ -687,6 +688,12 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
#endif
inp->inp_laddr.s_addr = INADDR_ANY;
inp->inp_lport = 0;
+ if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
+ log(LOG_DEBUG, "%s; %s: in_pcbinshash failed "
+ "with error %i\n",
+ s, __func__, error);
+ free(s, M_TCPLOG);
+ }
goto abort;
}
#ifdef IPSEC
@@ -721,9 +728,15 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
laddr6 = inp->in6p_laddr;
if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
inp->in6p_laddr = sc->sc_inc.inc6_laddr;
- if (in6_pcbconnect(inp, (struct sockaddr *)&sin6,
- thread0.td_ucred)) {
+ if ((error = in6_pcbconnect(inp, (struct sockaddr *)&sin6,
+ thread0.td_ucred)) != 0) {
inp->in6p_laddr = laddr6;
+ if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
+ log(LOG_DEBUG, "%s; %s: in6_pcbconnect failed "
+ "with error %i\n",
+ s, __func__, error);
+ free(s, M_TCPLOG);
+ }
goto abort;
}
/* Override flowlabel from in6_pcbconnect. */
@@ -750,9 +763,15 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
laddr = inp->inp_laddr;
if (inp->inp_laddr.s_addr == INADDR_ANY)
inp->inp_laddr = sc->sc_inc.inc_laddr;
- if (in_pcbconnect(inp, (struct sockaddr *)&sin,
- thread0.td_ucred)) {
+ if ((error = in_pcbconnect(inp, (struct sockaddr *)&sin,
+ thread0.td_ucred)) != 0) {
inp->inp_laddr = laddr;
+ if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
+ log(LOG_DEBUG, "%s; %s: in_pcbconnect failed "
+ "with error %i\n",
+ s, __func__, error);
+ free(s, M_TCPLOG);
+ }
goto abort;
}
}
OpenPOWER on IntegriCloud