| 980 | } |
| 981 | |
| 982 | void |
| 983 | tcp_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 | |
| 1016 | static struct tcp_fastopen_ccache_entry * |
| 1017 | tcp_fastopen_ccache_lookup(struct in_conninfo *inc, |
no test coverage detected