Changeset 22896 in vbox
- Timestamp:
- Sep 10, 2009 6:19:59 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/tcp_output.c
r22664 r22896 76 76 register long len, win; 77 77 int off, flags, error; 78 register struct mbuf *m ;78 register struct mbuf *m = NULL; 79 79 register struct tcpiphdr *ti; 80 80 u_char opt[MAX_TCPOPTLEN]; … … 371 371 } 372 372 373 #ifndef VBOX_WITH_SLIRP_BSD_MBUF 373 374 m = m_get(pData); 375 #else 376 m = m_gethdr(pData, M_NOWAIT, MT_HEADER); 377 /* @todo (r=vvl) should we append other bufs here ???*/ 378 #endif 374 379 if (m == NULL) 375 380 { … … 378 383 goto out; 379 384 } 385 #ifndef VBOX_WITH_SLIRP_BSD_MBUF 380 386 m->m_data += if_maxlinkhdr; 381 387 m->m_len = hdrlen; 388 #endif 382 389 383 390 /* … … 389 396 { 390 397 #endif 398 #ifndef VBOX_WITH_SLIRP_BSD_MBUF 391 399 sbcopy(&so->so_snd, off, (int) len, mtod(m, caddr_t) + hdrlen); 392 400 m->m_len += len; 401 #else 402 sbcopy(pData, &so->so_snd, off, (int) len, m); 403 m = m_prepend(pData, m, sizeof (struct tcpiphdr), M_DONTWAIT); 404 #endif 393 405 #if 0 394 406 } … … 420 432 tcpstat.tcps_sndwinup++; 421 433 434 #ifndef VBOX_WITH_SLIRP_BSD_MBUF 422 435 m = m_get(pData); 423 436 if (m == NULL) … … 429 442 m->m_data += if_maxlinkhdr; 430 443 m->m_len = hdrlen; 431 } 432 444 #else 445 m = m_gethdr(pData, M_NOWAIT, MT_HEADER); 446 if (m == NULL) 447 { 448 /* error = ENOBUFS; */ 449 error = 1; 450 goto out; 451 } 452 #endif 453 } 454 455 #ifndef VBOX_WITH_SLIRP_BSD_MBUF 433 456 ti = mtod(m, struct tcpiphdr *); 434 457 435 458 memcpy((caddr_t)ti, &tp->t_template, sizeof (struct tcpiphdr)); 459 #else 460 /*already copied header from template */ 461 462 m_copyback(pData, m, 0, sizeof (struct tcpiphdr), &tp->t_template); 463 ti = mtod(m, struct tcpiphdr *); 464 #endif 436 465 437 466 /* … … 464 493 if (optlen) 465 494 { 495 #ifndef VBOX_WITH_SLIRP_BSD_MBUF 466 496 memcpy((caddr_t)(ti + 1), (caddr_t)opt, optlen); 497 #else 498 m_append(pData, m, optlen, opt); 499 #endif 467 500 ti->ti_off = (sizeof (struct tcphdr) + optlen) >> 2; 468 501 } … … 575 608 * the template, but need a way to checksum without them. 576 609 */ 610 #ifndef VBOX_WITH_SLIRP_BSD_MBUF 577 611 Assert(m->m_len == (hdrlen + len)); 578 612 m->m_len = hdrlen + len; /* XXX Needed? m_len should be correct */ 579 580 { 613 #else 614 M_ASSERTPKTHDR(m); 615 m->m_pkthdr.header = mtod(m, void *); 616 #endif 617 618 { 619 #ifndef VBOX_WITH_SLIRP_BSD_MBUF 581 620 ((struct ip *)ti)->ip_len = m->m_len; 621 #else 622 ((struct ip *)ti)->ip_len = m_length(m, NULL); 623 #endif 582 624 ((struct ip *)ti)->ip_ttl = ip_defttl; 583 625 ((struct ip *)ti)->ip_tos = so->so_iptos; 584 626 585 627 /* #if BSD >= 43 */ … … 589 631 so->so_options & SO_DONTROUTE, 0); 590 632 #endif 633 #ifndef VBOX_WITH_SLIRP_BSD_MBUF 591 634 if(so->so_la != NULL) 592 635 m->m_la = so->so_la; 636 #endif 593 637 error = ip_output(pData, so, m); 594 638
Note:
See TracChangeset
for help on using the changeset viewer.