|
Lines 835-841
void
Link Here
|
| 835 |
tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m, |
835 |
tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m, |
| 836 |
tcp_seq ack, tcp_seq seq, int flags) |
836 |
tcp_seq ack, tcp_seq seq, int flags) |
| 837 |
{ |
837 |
{ |
| 838 |
int tlen; |
838 |
int tlen, optlen = 0; |
| 839 |
int win = 0; |
839 |
int win = 0; |
| 840 |
struct ip *ip; |
840 |
struct ip *ip; |
| 841 |
struct tcphdr *nth; |
841 |
struct tcphdr *nth; |
|
Lines 845-850
tcp_respond(struct tcpcb *tp, void *ipgen, struct
Link Here
|
| 845 |
#endif /* INET6 */ |
845 |
#endif /* INET6 */ |
| 846 |
int ipflags = 0; |
846 |
int ipflags = 0; |
| 847 |
struct inpcb *inp; |
847 |
struct inpcb *inp; |
|
|
848 |
struct tcpopt to; |
| 848 |
|
849 |
|
| 849 |
KASSERT(tp != NULL || m != NULL, ("tcp_respond: tp and m both NULL")); |
850 |
KASSERT(tp != NULL || m != NULL, ("tcp_respond: tp and m both NULL")); |
| 850 |
|
851 |
|
|
Lines 943-948
tcp_respond(struct tcpcb *tp, void *ipgen, struct
Link Here
|
| 943 |
ip->ip_off |= htons(IP_DF); |
944 |
ip->ip_off |= htons(IP_DF); |
| 944 |
} |
945 |
} |
| 945 |
#endif |
946 |
#endif |
|
|
947 |
if (tp != NULL) { |
| 948 |
to.to_flags = 0; |
| 949 |
if ((tp->t_flags & (TF_REQ_TSTMP|TF_RCVD_TSTMP|TF_NOOPT)) == |
| 950 |
(TF_REQ_TSTMP|TF_RCVD_TSTMP)) { |
| 951 |
to.to_flags |= TOF_TS; |
| 952 |
to.to_tsval = tcp_ts_getticks() + tp->ts_offset; |
| 953 |
to.to_tsecr = tp->ts_recent; |
| 954 |
tlen += optlen = tcp_addoptions(&to, |
| 955 |
(u_char *)(nth + 1)); |
| 956 |
} |
| 957 |
} |
| 946 |
m->m_len = tlen; |
958 |
m->m_len = tlen; |
| 947 |
m->m_pkthdr.len = tlen; |
959 |
m->m_pkthdr.len = tlen; |
| 948 |
m->m_pkthdr.rcvif = NULL; |
960 |
m->m_pkthdr.rcvif = NULL; |
|
Lines 965-971
tcp_respond(struct tcpcb *tp, void *ipgen, struct
Link Here
|
| 965 |
nth->th_seq = htonl(seq); |
977 |
nth->th_seq = htonl(seq); |
| 966 |
nth->th_ack = htonl(ack); |
978 |
nth->th_ack = htonl(ack); |
| 967 |
nth->th_x2 = 0; |
979 |
nth->th_x2 = 0; |
| 968 |
nth->th_off = sizeof (struct tcphdr) >> 2; |
980 |
nth->th_off = (sizeof (struct tcphdr) + optlen) >> 2; |
| 969 |
nth->th_flags = flags; |
981 |
nth->th_flags = flags; |
| 970 |
if (tp != NULL) |
982 |
if (tp != NULL) |
| 971 |
nth->th_win = htons((u_short) (win >> tp->rcv_scale)); |
983 |
nth->th_win = htons((u_short) (win >> tp->rcv_scale)); |