summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_syncache.c
diff options
context:
space:
mode:
authorzec <zec@FreeBSD.org>2008-11-26 22:32:07 +0000
committerzec <zec@FreeBSD.org>2008-11-26 22:32:07 +0000
commit95a15f5c8435d206ae030c1ed698f4fca6afdeae (patch)
tree92dfba43d59635c80de0299501512e8472dbe130 /sys/netinet/tcp_syncache.c
parent7beb3e535d23cc0fe9278167a9c3dc67220250fd (diff)
downloadFreeBSD-src-95a15f5c8435d206ae030c1ed698f4fca6afdeae.zip
FreeBSD-src-95a15f5c8435d206ae030c1ed698f4fca6afdeae.tar.gz
Merge more of currently non-functional (i.e. resolving to
whitespace) macros from p4/vimage branch. Do a better job at enclosing all instantiations of globals scheduled for virtualization in #ifdef VIMAGE_GLOBALS blocks. De-virtualize and mark as const saorder_state_alive and saorder_state_any arrays from ipsec code, given that they are never updated at runtime, so virtualizing them would be pointless. Reviewed by: bz, julian Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
Diffstat (limited to 'sys/netinet/tcp_syncache.c')
-rw-r--r--sys/netinet/tcp_syncache.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index a69b0b2..252fa1c 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -105,12 +105,12 @@ static int tcp_syncookiesonly;
int tcp_sc_rst_sock_fail;
#endif
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, syncookies, CTLFLAG_RW,
- &tcp_syncookies, 0,
+SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, syncookies,
+ CTLFLAG_RW, tcp_syncookies, 0,
"Use TCP SYN cookies if the syncache overflows");
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, syncookies_only, CTLFLAG_RW,
- &tcp_syncookiesonly, 0,
+SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, syncookies_only,
+ CTLFLAG_RW, tcp_syncookiesonly, 0,
"Use only TCP SYN cookies");
#ifdef TCP_OFFLOAD_DISABLE
@@ -359,11 +359,13 @@ static void
syncache_timer(void *xsch)
{
struct syncache_head *sch = (struct syncache_head *)xsch;
- INIT_VNET_INET(sch->sch_vnet);
struct syncache *sc, *nsc;
int tick = ticks;
char *s;
+ CURVNET_SET(sch->sch_vnet);
+ INIT_VNET_INET(sch->sch_vnet);
+
/* NB: syncache_head has already been locked by the callout. */
SCH_LOCK_ASSERT(sch);
@@ -412,6 +414,7 @@ syncache_timer(void *xsch)
if (!TAILQ_EMPTY(&(sch)->sch_bucket))
callout_reset(&(sch)->sch_timer, (sch)->sch_nextc - tick,
syncache_timer, (void *)(sch));
+ CURVNET_RESTORE();
}
/*
@@ -836,7 +839,7 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
* B. check that the syncookie is valid. If it is, then
* cobble up a fake syncache entry, and return.
*/
- if (!tcp_syncookies) {
+ if (!V_tcp_syncookies) {
SCH_UNLOCK(sch);
if ((s = tcp_log_addrs(inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Spurious ACK, "
@@ -929,6 +932,7 @@ int
tcp_offload_syncache_expand(struct in_conninfo *inc, struct tcpopt *to,
struct tcphdr *th, struct socket **lsop, struct mbuf *m)
{
+ INIT_VNET_INET(curvnet);
int rc;
INP_INFO_WLOCK(&V_tcbinfo);
@@ -1097,7 +1101,7 @@ _syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
syncache_drop(sc, sch);
sc = uma_zalloc(V_tcp_syncache.zone, M_NOWAIT | M_ZERO);
if (sc == NULL) {
- if (tcp_syncookies) {
+ if (V_tcp_syncookies) {
bzero(&scs, sizeof(scs));
sc = &scs;
} else {
@@ -1206,7 +1210,7 @@ _syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
if ((th->th_flags & (TH_ECE|TH_CWR)) && V_tcp_do_ecn)
sc->sc_flags |= SCF_ECN;
- if (tcp_syncookies) {
+ if (V_tcp_syncookies) {
syncookie_generate(sch, sc, &flowtmp);
#ifdef INET6
if (autoflowlabel)
@@ -1225,7 +1229,7 @@ _syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
* Do a standard 3-way handshake.
*/
if (TOEPCB_ISSET(sc) || syncache_respond(sc) == 0) {
- if (tcp_syncookies && tcp_syncookiesonly && sc != &scs)
+ if (V_tcp_syncookies && V_tcp_syncookiesonly && sc != &scs)
syncache_free(sc);
else if (sc != &scs)
syncache_insert(sc, sch); /* locks and unlocks sch */
OpenPOWER on IntegriCloud