Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_syncache.c
Show First 20 Lines • Show All 1,629 Lines • ▼ Show 20 Lines | |||||
#ifdef INET6 | #ifdef INET6 | ||||
(sc->sc_inc.inc_flags & INC_ISIPV6) ? sizeof(struct ip6_hdr) : | (sc->sc_inc.inc_flags & INC_ISIPV6) ? sizeof(struct ip6_hdr) : | ||||
#endif | #endif | ||||
sizeof(struct ip); | sizeof(struct ip); | ||||
tlen = hlen + sizeof(struct tcphdr); | tlen = hlen + sizeof(struct tcphdr); | ||||
/* Determine MSS we advertize to other end of connection. */ | /* Determine MSS we advertize to other end of connection. */ | ||||
mssopt = tcp_mssopt(&sc->sc_inc); | mssopt = tcp_mssopt(&sc->sc_inc); | ||||
if (sc->sc_peer_mss) | mssopt = max(mssopt, V_tcp_minmss); | ||||
tuexen: I would prefer
```
mssopt = max(tcp_mssopt(&sc->sc_inc), V_tcp_minmss);
```
instead of the two… | |||||
sepherosa_gmail.comAuthorUnsubmitted Not Done Inline ActionsSure, I will regenerate the patch. sepherosa_gmail.com: Sure, I will regenerate the patch. | |||||
mssopt = max( min(sc->sc_peer_mss, mssopt), V_tcp_minmss); | |||||
/* XXX: Assume that the entire packet will fit in a header mbuf. */ | /* XXX: Assume that the entire packet will fit in a header mbuf. */ | ||||
KASSERT(max_linkhdr + tlen + TCP_MAXOLEN <= MHLEN, | KASSERT(max_linkhdr + tlen + TCP_MAXOLEN <= MHLEN, | ||||
("syncache: mbuf too small")); | ("syncache: mbuf too small")); | ||||
/* Create the IP+TCP header from scratch. */ | /* Create the IP+TCP header from scratch. */ | ||||
m = m_gethdr(M_NOWAIT, MT_DATA); | m = m_gethdr(M_NOWAIT, MT_DATA); | ||||
if (m == NULL) | if (m == NULL) | ||||
▲ Show 20 Lines • Show All 344 Lines • ▼ Show 20 Lines | syncookie_generate(struct syncache_head *sch, struct syncache *sc) | ||||
SCH_LOCK_ASSERT(sch); | SCH_LOCK_ASSERT(sch); | ||||
cookie.cookie = 0; | cookie.cookie = 0; | ||||
/* Map our computed MSS into the 3-bit index. */ | /* Map our computed MSS into the 3-bit index. */ | ||||
mss = min(tcp_mssopt(&sc->sc_inc), max(sc->sc_peer_mss, V_tcp_minmss)); | mss = min(tcp_mssopt(&sc->sc_inc), max(sc->sc_peer_mss, V_tcp_minmss)); | ||||
for (i = nitems(tcp_sc_msstab) - 1; tcp_sc_msstab[i] > mss && i > 0; | for (i = nitems(tcp_sc_msstab) - 1; tcp_sc_msstab[i] > mss && i > 0; | ||||
i--) | i--) | ||||
Not Done Inline ActionsWhy are we using sc_peer_mss here? I thought that was the term that was to be removed. karels: Why are we using sc_peer_mss here? I thought that was the term that was to be removed. | |||||
Not Done Inline ActionsSyn cookie encodes the MSS announcement from SYN sender that's why sc_peer_mss is used here. So it's correct to use sc_peer_mss here. sepherosa_gmail.com: Syn cookie encodes the MSS announcement from SYN sender that's why sc_peer_mss is used here. | |||||
Not Done Inline ActionsSorry, I got it backwards. This is correct for syncookie. karels: Sorry, I got it backwards. This is correct for syncookie. | |||||
; | ; | ||||
cookie.flags.mss_idx = i; | cookie.flags.mss_idx = i; | ||||
/* | /* | ||||
* Map the send window scale into the 3-bit index but only if | * Map the send window scale into the 3-bit index but only if | ||||
* the wscale option was received. | * the wscale option was received. | ||||
*/ | */ | ||||
if (sc->sc_flags & SCF_WINSCALE) { | if (sc->sc_flags & SCF_WINSCALE) { | ||||
▲ Show 20 Lines • Show All 249 Lines • Show Last 20 Lines |
I would prefer
instead of the two lines.