Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/tcp_syncache.c
Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | |||||
static int syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch, | static int syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch, | ||||
struct syncache *sc, struct tcphdr *th, struct tcpopt *to, | struct syncache *sc, struct tcphdr *th, struct tcpopt *to, | ||||
struct socket *lso); | struct socket *lso); | ||||
#endif | #endif | ||||
/* | /* | ||||
* Transmit the SYN,ACK fewer times than TCP_MAXRXTSHIFT specifies. | * Transmit the SYN,ACK fewer times than TCP_MAXRXTSHIFT specifies. | ||||
* 3 retransmits corresponds to a timeout with default values of | * 3 retransmits corresponds to a timeout with default values of | ||||
* TCPTV_RTOBASE * ( 1 + | * TCPTV_RTOBASE * ( 1 + | ||||
* tcp_syn_backoff[1] + | * tcp_backoff[1] + | ||||
* tcp_syn_backoff[2] + | * tcp_backoff[2] + | ||||
* tcp_syn_backoff[3]) + 3 * tcp_rexmit_slop, | * tcp_backoff[3]) + 3 * tcp_rexmit_slop, | ||||
* 3000 ms * (1 + 1 + 1 + 1) + 3 * 200 ms = 12600 ms, | * 3000 ms * (1 + 2 + 4 + 8) + 3 * 200 ms = 45600 ms, | ||||
* the odds are that the user has given up attempting to connect by then. | * the odds are that the user has given up attempting to connect by then. | ||||
*/ | */ | ||||
#define SYNCACHE_MAXREXMTS 3 | #define SYNCACHE_MAXREXMTS 3 | ||||
/* Arbitrary values */ | /* Arbitrary values */ | ||||
#define TCP_SYNCACHE_HASHSIZE 512 | #define TCP_SYNCACHE_HASHSIZE 512 | ||||
#define TCP_SYNCACHE_BUCKETLIMIT 30 | #define TCP_SYNCACHE_BUCKETLIMIT 30 | ||||
▲ Show 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
syncache_timeout(struct syncache *sc, struct syncache_head *sch, int docallout) | syncache_timeout(struct syncache *sc, struct syncache_head *sch, int docallout) | ||||
{ | { | ||||
int rexmt; | int rexmt; | ||||
if (sc->sc_rxmits == 0) | if (sc->sc_rxmits == 0) | ||||
rexmt = TCPTV_RTOBASE; | rexmt = TCPTV_RTOBASE; | ||||
else | else | ||||
TCPT_RANGESET(rexmt, TCPTV_RTOBASE * tcp_syn_backoff[sc->sc_rxmits], | TCPT_RANGESET(rexmt, TCPTV_RTOBASE * tcp_backoff[sc->sc_rxmits], | ||||
tcp_rexmit_min, TCPTV_REXMTMAX); | tcp_rexmit_min, TCPTV_REXMTMAX); | ||||
sc->sc_rxttime = ticks + rexmt; | sc->sc_rxttime = ticks + rexmt; | ||||
sc->sc_rxmits++; | sc->sc_rxmits++; | ||||
if (TSTMP_LT(sc->sc_rxttime, sch->sch_nextc)) { | if (TSTMP_LT(sc->sc_rxttime, sch->sch_nextc)) { | ||||
sch->sch_nextc = sc->sc_rxttime; | sch->sch_nextc = sc->sc_rxttime; | ||||
if (docallout) | if (docallout) | ||||
callout_reset(&sch->sch_timer, sch->sch_nextc - ticks, | callout_reset(&sch->sch_timer, sch->sch_nextc - ticks, | ||||
syncache_timer, (void *)sch); | syncache_timer, (void *)sch); | ||||
▲ Show 20 Lines • Show All 1,859 Lines • Show Last 20 Lines |