diff options
| author | Jeffrey Hsu <hsu@FreeBSD.org> | 2002-12-20 11:24:02 +0000 |
|---|---|---|
| committer | Jeffrey Hsu <hsu@FreeBSD.org> | 2002-12-20 11:24:02 +0000 |
| commit | 9a39fc9d73446d222c1b4fa139d3fb06a7a4e2df (patch) | |
| tree | 2882af44c49079aa18d9aa127cbf83703f0db697 /sys/netinet | |
| parent | 12e552d69fb5d174c2b7092ea72b5948b5f3e598 (diff) | |
Notes
Diffstat (limited to 'sys/netinet')
| -rw-r--r-- | sys/netinet/tcp_syncache.c | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 5c647e307d07..0c52edb434c5 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1142,16 +1142,14 @@ syncache_respond(sc, m) ip->ip_tos = sc->sc_tp->t_inpcb->inp_ip_tos; /* XXX */ /* - * See if we should do MTU discovery. Route lookups are expensive, - * so we will only unset the DF bit if: + * See if we should do MTU discovery. Route lookups are + * expensive, so we will only unset the DF bit if: * * 1) path_mtu_discovery is disabled * 2) the SCF_UNREACH flag has been set */ - if (path_mtu_discovery - && ((sc->sc_flags & SCF_UNREACH) == 0)) { + if (path_mtu_discovery && ((sc->sc_flags & SCF_UNREACH) == 0)) ip->ip_off |= IP_DF; - } th = (struct tcphdr *)(ip + 1); } @@ -1167,44 +1165,43 @@ syncache_respond(sc, m) th->th_urp = 0; /* Tack on the TCP options. */ - if (optlen == 0) - goto no_options; - optp = (u_int8_t *)(th + 1); - *optp++ = TCPOPT_MAXSEG; - *optp++ = TCPOLEN_MAXSEG; - *optp++ = (mssopt >> 8) & 0xff; - *optp++ = mssopt & 0xff; + if (optlen != 0) { + optp = (u_int8_t *)(th + 1); + *optp++ = TCPOPT_MAXSEG; + *optp++ = TCPOLEN_MAXSEG; + *optp++ = (mssopt >> 8) & 0xff; + *optp++ = mssopt & 0xff; - if (sc->sc_flags & SCF_WINSCALE) { - *((u_int32_t *)optp) = htonl(TCPOPT_NOP << 24 | - TCPOPT_WINDOW << 16 | TCPOLEN_WINDOW << 8 | - sc->sc_request_r_scale); - optp += 4; - } + if (sc->sc_flags & SCF_WINSCALE) { + *((u_int32_t *)optp) = htonl(TCPOPT_NOP << 24 | + TCPOPT_WINDOW << 16 | TCPOLEN_WINDOW << 8 | + sc->sc_request_r_scale); + optp += 4; + } - if (sc->sc_flags & SCF_TIMESTAMP) { - u_int32_t *lp = (u_int32_t *)(optp); + if (sc->sc_flags & SCF_TIMESTAMP) { + u_int32_t *lp = (u_int32_t *)(optp); - /* Form timestamp option as shown in appendix A of RFC 1323. */ - *lp++ = htonl(TCPOPT_TSTAMP_HDR); - *lp++ = htonl(ticks); - *lp = htonl(sc->sc_tsrecent); - optp += TCPOLEN_TSTAMP_APPA; - } + /* Form timestamp option per appendix A of RFC 1323. */ + *lp++ = htonl(TCPOPT_TSTAMP_HDR); + *lp++ = htonl(ticks); + *lp = htonl(sc->sc_tsrecent); + optp += TCPOLEN_TSTAMP_APPA; + } - /* - * Send CC and CC.echo if we received CC from our peer. - */ - if (sc->sc_flags & SCF_CC) { - u_int32_t *lp = (u_int32_t *)(optp); + /* + * Send CC and CC.echo if we received CC from our peer. + */ + if (sc->sc_flags & SCF_CC) { + u_int32_t *lp = (u_int32_t *)(optp); - *lp++ = htonl(TCPOPT_CC_HDR(TCPOPT_CC)); - *lp++ = htonl(sc->sc_cc_send); - *lp++ = htonl(TCPOPT_CC_HDR(TCPOPT_CCECHO)); - *lp = htonl(sc->sc_cc_recv); - optp += TCPOLEN_CC_APPA * 2; + *lp++ = htonl(TCPOPT_CC_HDR(TCPOPT_CC)); + *lp++ = htonl(sc->sc_cc_send); + *lp++ = htonl(TCPOPT_CC_HDR(TCPOPT_CCECHO)); + *lp = htonl(sc->sc_cc_recv); + optp += TCPOLEN_CC_APPA * 2; + } } -no_options: #ifdef INET6 if (sc->sc_inc.inc_isipv6) { |
