MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tcp_fastopen_update_cache

Function tcp_fastopen_update_cache

freebsd/netinet/tcp_fastopen.c:982–1014  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

980}
981
982void
983tcp_fastopen_update_cache(struct tcpcb *tp, uint16_t mss,
984 uint8_t cookie_len, uint8_t *cookie)
985{
986 struct in_conninfo *inc = &tp->t_inpcb->inp_inc;
987 struct tcp_fastopen_ccache_bucket *ccb;
988 struct tcp_fastopen_ccache_entry *cce;
989
990 cce = tcp_fastopen_ccache_lookup(inc, &ccb);
991 if (cce) {
992 if ((cookie_len >= TCP_FASTOPEN_MIN_COOKIE_LEN) &&
993 (cookie_len <= TCP_FASTOPEN_MAX_COOKIE_LEN) &&
994 ((cookie_len & 0x1) == 0)) {
995 cce->server_mss = mss;
996 cce->cookie_len = cookie_len;
997 memcpy(cce->cookie, cookie, cookie_len);
998 cce->disable_time = 0;
999 } else {
1000 /* invalid cookie length, disable entry */
1001 cce->server_mss = 0;
1002 cce->cookie_len = 0;
1003 /*
1004 * Preserve the existing disable time if it is
1005 * already disabled.
1006 */
1007 if (cce->disable_time == 0)
1008 cce->disable_time = getsbinuptime();
1009 }
1010 } else
1011 tcp_fastopen_ccache_create(ccb, inc, mss, cookie_len, cookie);
1012
1013 CCB_UNLOCK(ccb);
1014}
1015
1016static struct tcp_fastopen_ccache_entry *
1017tcp_fastopen_ccache_lookup(struct in_conninfo *inc,

Callers 3

tcp_do_segmentFunction · 0.85
rack_do_segment_nounlockFunction · 0.85
bbr_do_segment_nounlockFunction · 0.85

Calls 4

getsbinuptimeFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected