svn commit: r283136 - head/sys/netinet
Hiren Panchasara
hiren at FreeBSD.org
Wed May 20 01:08:02 UTC 2015
Author: hiren
Date: Wed May 20 01:08:01 2015
New Revision: 283136
URL: https://svnweb.freebsd.org/changeset/base/283136
Log:
Add a new sysctl net.inet.tcp.hostcache.purgenow=1 to expire and purge all
entries in hostcache immediately.
In collaboration with: bz, rwatson
MFC after: 1 week
Relnotes: yes
Sponsored by: Limelight Networks
Modified:
head/sys/netinet/tcp_hostcache.c
Modified: head/sys/netinet/tcp_hostcache.c
==============================================================================
--- head/sys/netinet/tcp_hostcache.c Tue May 19 23:53:25 2015 (r283135)
+++ head/sys/netinet/tcp_hostcache.c Wed May 20 01:08:01 2015 (r283136)
@@ -117,6 +117,7 @@ static VNET_DEFINE(struct callout, tcp_h
static struct hc_metrics *tcp_hc_lookup(struct in_conninfo *);
static struct hc_metrics *tcp_hc_insert(struct in_conninfo *);
static int sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS);
+static int sysctl_tcp_hc_purgenow(SYSCTL_HANDLER_ARGS);
static void tcp_hc_purge_internal(int);
static void tcp_hc_purge(void *);
@@ -155,6 +156,9 @@ SYSCTL_PROC(_net_inet_tcp_hostcache, OID
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_SKIP, 0, 0,
sysctl_tcp_hc_list, "A", "List of all hostcache entries");
+SYSCTL_PROC(_net_inet_tcp_hostcache, OID_AUTO, purgenow,
+ CTLTYPE_INT | CTLFLAG_RW, NULL, 0,
+ sysctl_tcp_hc_purgenow, "I", "Immediately purge all entries");
static MALLOC_DEFINE(M_HOSTCACHE, "hostcache", "TCP hostcache");
@@ -696,3 +700,24 @@ tcp_hc_purge(void *arg)
tcp_hc_purge, arg);
CURVNET_RESTORE();
}
+
+/*
+ * Expire and purge all entries in hostcache immediately.
+ */
+static int
+sysctl_tcp_hc_purgenow(SYSCTL_HANDLER_ARGS)
+{
+ int error, val;
+
+ val = 0;
+ error = sysctl_handle_int(oidp, &val, 0, req);
+ if (error || !req->newptr)
+ return (error);
+
+ tcp_hc_purge_internal(1);
+
+ callout_reset(&V_tcp_hc_callout, V_tcp_hostcache.prune * hz,
+ tcp_hc_purge, curvnet);
+
+ return (0);
+}
More information about the svn-src-head
mailing list