Page MenuHomeFreeBSD

D11725.1774889144.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D11725.1774889144.diff

Index: sys/netinet/tcp_subr.c
===================================================================
--- sys/netinet/tcp_subr.c
+++ sys/netinet/tcp_subr.c
@@ -198,6 +198,16 @@
SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_debug, CTLFLAG_RW,
&tcp_log_debug, 0, "Log errors caused by incoming TCP segments");
+static int tcp_log_newconn_failed = 0;
+SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_newconn_failed, CTLFLAG_RW,
+ &tcp_log_newconn_failed, 0,
+ "Log addresses if creating a new connection from the syncache fails");
+
+static int tcp_log_newconn_failed_ratelimit = -1;
+SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_newconn_failed_ratelimit, CTLFLAG_RW,
+ &tcp_log_newconn_failed_ratelimit, 0,
+ "Per second limit for logging a failed new connection from the syncache");
+
static int tcp_tcbhashsize;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, tcbhashsize, CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
&tcp_tcbhashsize, 0, "Size of TCP control-block hashtable");
@@ -2726,6 +2736,20 @@
}
char *
+tcp_log_newconn(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr,
+ const void *ip6hdr)
+{
+ static struct timeval lasttime;
+ static int curpps;
+
+ if ((tcp_log_newconn_failed || tcp_log_debug) &&
+ ppsratecheck(&lasttime, &curpps, tcp_log_newconn_failed_ratelimit))
+ return (tcp_log_addr(inc, th, ip4hdr, ip6hdr));
+
+ return (NULL);
+}
+
+char *
tcp_log_addrs(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr,
const void *ip6hdr)
{
Index: sys/netinet/tcp_syncache.c
===================================================================
--- sys/netinet/tcp_syncache.c
+++ sys/netinet/tcp_syncache.c
@@ -665,7 +665,7 @@
* RTO and try again.
*/
TCPSTAT_INC(tcps_listendrop);
- if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
+ if ((s = tcp_log_newconn(&sc->sc_inc, NULL, NULL, NULL))) {
log(LOG_DEBUG, "%s; %s: Socket create failed "
"due to limits or memory shortage\n",
s, __func__);
Index: sys/netinet/tcp_var.h
===================================================================
--- sys/netinet/tcp_var.h
+++ sys/netinet/tcp_var.h
@@ -758,6 +758,8 @@
const void *);
char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *,
const void *);
+char *tcp_log_newconn(struct in_conninfo *, struct tcphdr *, void *,
+ const void *);
int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *);
void tcp_reass_global_init(void);
void tcp_reass_flush(struct tcpcb *);

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 30, 4:45 PM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28230922
Default Alt Text
D11725.1774889144.diff (2 KB)

Event Timeline