Revision 0d62c4cf slirp/tcp_output.c
b/slirp/tcp_output.c | ||
---|---|---|
272 | 272 |
mss = htons((u_int16_t) tcp_mss(tp, 0)); |
273 | 273 |
memcpy((caddr_t)(opt + 2), (caddr_t)&mss, sizeof(mss)); |
274 | 274 |
optlen = 4; |
275 |
|
|
276 |
/* if ((tp->t_flags & TF_REQ_SCALE) && |
|
277 |
* ((flags & TH_ACK) == 0 || |
|
278 |
* (tp->t_flags & TF_RCVD_SCALE))) { |
|
279 |
* *((u_int32_t *) (opt + optlen)) = htonl( |
|
280 |
* TCPOPT_NOP << 24 | |
|
281 |
* TCPOPT_WINDOW << 16 | |
|
282 |
* TCPOLEN_WINDOW << 8 | |
|
283 |
* tp->request_r_scale); |
|
284 |
* optlen += 4; |
|
285 |
* } |
|
286 |
*/ |
|
287 | 275 |
} |
288 | 276 |
} |
289 | 277 |
|
290 |
/* |
|
291 |
* Send a timestamp and echo-reply if this is a SYN and our side |
|
292 |
* wants to use timestamps (TF_REQ_TSTMP is set) or both our side |
|
293 |
* and our peer have sent timestamps in our SYN's. |
|
294 |
*/ |
|
295 |
/* if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP && |
|
296 |
* (flags & TH_RST) == 0 && |
|
297 |
* ((flags & (TH_SYN|TH_ACK)) == TH_SYN || |
|
298 |
* (tp->t_flags & TF_RCVD_TSTMP))) { |
|
299 |
* u_int32_t *lp = (u_int32_t *)(opt + optlen); |
|
300 |
* |
|
301 |
* / * Form timestamp option as shown in appendix A of RFC 1323. * / |
|
302 |
* *lp++ = htonl(TCPOPT_TSTAMP_HDR); |
|
303 |
* *lp++ = htonl(tcp_now); |
|
304 |
* *lp = htonl(tp->ts_recent); |
|
305 |
* optlen += TCPOLEN_TSTAMP_APPA; |
|
306 |
* } |
|
307 |
*/ |
|
308 | 278 |
hdrlen += optlen; |
309 | 279 |
|
310 | 280 |
/* |
... | ... | |
334 | 304 |
|
335 | 305 |
m = m_get(); |
336 | 306 |
if (m == NULL) { |
337 |
/* error = ENOBUFS; */ |
|
338 | 307 |
error = 1; |
339 | 308 |
goto out; |
340 | 309 |
} |
341 | 310 |
m->m_data += IF_MAXLINKHDR; |
342 | 311 |
m->m_len = hdrlen; |
343 | 312 |
|
344 |
/* |
|
345 |
* This will always succeed, since we make sure our mbufs |
|
346 |
* are big enough to hold one MSS packet + header + ... etc. |
|
347 |
*/ |
|
348 |
/* if (len <= MHLEN - hdrlen - max_linkhdr) { */ |
|
349 |
|
|
350 |
sbcopy(&so->so_snd, off, (int) len, mtod(m, caddr_t) + hdrlen); |
|
351 |
m->m_len += len; |
|
313 |
sbcopy(&so->so_snd, off, (int) len, mtod(m, caddr_t) + hdrlen); |
|
314 |
m->m_len += len; |
|
352 | 315 |
|
353 |
/* } else { |
|
354 |
* m->m_next = m_copy(so->so_snd.sb_mb, off, (int) len); |
|
355 |
* if (m->m_next == 0) |
|
356 |
* len = 0; |
|
357 |
* } |
|
358 |
*/ |
|
359 | 316 |
/* |
360 | 317 |
* If we're sending everything we've got, set PUSH. |
361 | 318 |
* (This will keep happy those implementations which only |
... | ... | |
376 | 333 |
|
377 | 334 |
m = m_get(); |
378 | 335 |
if (m == NULL) { |
379 |
/* error = ENOBUFS; */ |
|
380 | 336 |
error = 1; |
381 | 337 |
goto out; |
382 | 338 |
} |
... | ... | |
433 | 389 |
|
434 | 390 |
if (SEQ_GT(tp->snd_up, tp->snd_una)) { |
435 | 391 |
ti->ti_urp = htons((u_int16_t)(tp->snd_up - ntohl(ti->ti_seq))); |
436 |
#ifdef notdef |
|
437 |
if (SEQ_GT(tp->snd_up, tp->snd_nxt)) { |
|
438 |
ti->ti_urp = htons((u_int16_t)(tp->snd_up - tp->snd_nxt)); |
|
439 |
#endif |
|
440 | 392 |
ti->ti_flags |= TH_URG; |
441 | 393 |
} else |
442 | 394 |
/* |
... | ... | |
523 | 475 |
((struct ip *)ti)->ip_ttl = IPDEFTTL; |
524 | 476 |
((struct ip *)ti)->ip_tos = so->so_iptos; |
525 | 477 |
|
526 |
/* #if BSD >= 43 */ |
|
527 |
/* Don't do IP options... */ |
|
528 |
/* error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route, |
|
529 |
* so->so_options & SO_DONTROUTE, 0); |
|
530 |
*/ |
|
531 | 478 |
error = ip_output(so, m); |
532 |
|
|
533 |
/* #else |
|
534 |
* error = ip_output(m, (struct mbuf *)0, &tp->t_inpcb->inp_route, |
|
535 |
* so->so_options & SO_DONTROUTE); |
|
536 |
* #endif |
|
537 |
*/ |
|
538 | 479 |
} |
539 | 480 |
if (error) { |
540 | 481 |
out: |
541 |
/* if (error == ENOBUFS) { |
|
542 |
* tcp_quench(tp->t_inpcb, 0); |
|
543 |
* return (0); |
|
544 |
* } |
|
545 |
*/ |
|
546 |
/* if ((error == EHOSTUNREACH || error == ENETDOWN) |
|
547 |
* && TCPS_HAVERCVDSYN(tp->t_state)) { |
|
548 |
* tp->t_softerror = error; |
|
549 |
* return (0); |
|
550 |
* } |
|
551 |
*/ |
|
552 | 482 |
return (error); |
553 | 483 |
} |
554 | 484 |
STAT(tcpstat.tcps_sndtotal++); |
... | ... | |
574 | 504 |
{ |
575 | 505 |
int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1; |
576 | 506 |
|
577 |
/* if (tp->t_timer[TCPT_REXMT]) |
|
578 |
* panic("tcp_output REXMT"); |
|
579 |
*/ |
|
580 | 507 |
/* |
581 | 508 |
* Start/restart persistence timer. |
582 | 509 |
*/ |
Also available in: Unified diff