Commit 38f3e7c2f526fb70d7bc52ed62910fea506dc84f

Authored by bellard
1 parent 73540ca9

suppressed unaligned accesses


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1911 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 7 additions and 6 deletions
slirp/if.c
... ... @@ -52,8 +52,8 @@ if_init()
52 52 if_maxlinkhdr = 40;
53 53 #endif
54 54 #else
55   - /* 14 for ethernet + 40 */
56   - if_maxlinkhdr = 14 + 40;
  55 + /* 2 for alignment, 14 for ethernet, 40 for TCP/IP */
  56 + if_maxlinkhdr = 2 + 14 + 40;
57 57 #endif
58 58 if_mtu = 1500;
59 59 if_mru = 1500;
... ...
slirp/slirp.c
... ... @@ -610,11 +610,12 @@ void slirp_input(const uint8_t *pkt, int pkt_len)
610 610 m = m_get();
611 611 if (!m)
612 612 return;
613   - m->m_len = pkt_len;
614   - memcpy(m->m_data, pkt, pkt_len);
  613 + /* Note: we add to align the IP header */
  614 + m->m_len = pkt_len + 2;
  615 + memcpy(m->m_data + 2, pkt, pkt_len);
615 616  
616   - m->m_data += ETH_HLEN;
617   - m->m_len -= ETH_HLEN;
  617 + m->m_data += 2 + ETH_HLEN;
  618 + m->m_len -= 2 + ETH_HLEN;
618 619  
619 620 ip_input(m);
620 621 break;
... ...