diff --git a/BasiliskII/src/slirp/if.c b/BasiliskII/src/slirp/if.c index 2ce9a642..94132ca8 100644 --- a/BasiliskII/src/slirp/if.c +++ b/BasiliskII/src/slirp/if.c @@ -52,8 +52,8 @@ if_init() if_maxlinkhdr = 40; #endif #else - /* 14 for ethernet + 40 */ - if_maxlinkhdr = 14 + 40; + /* 2 for alignment, 14 for ethernet, 40 for TCP/IP */ + if_maxlinkhdr = 2 + 14 + 40; #endif if_mtu = 1500; if_mru = 1500; diff --git a/BasiliskII/src/slirp/ip_input.c b/BasiliskII/src/slirp/ip_input.c index 74b92231..4f5bfd9a 100644 --- a/BasiliskII/src/slirp/ip_input.c +++ b/BasiliskII/src/slirp/ip_input.c @@ -344,8 +344,8 @@ insert: while (q != (struct ipasfrag *)fp) { struct mbuf *t; t = dtom(q); - m_cat(m, t); q = (struct ipasfrag *) q->ipf_next; + m_cat(m, t); } /* diff --git a/BasiliskII/src/slirp/slirp.c b/BasiliskII/src/slirp/slirp.c index dc8a566a..d95b3739 100644 --- a/BasiliskII/src/slirp/slirp.c +++ b/BasiliskII/src/slirp/slirp.c @@ -610,11 +610,12 @@ void slirp_input(const uint8_t *pkt, int pkt_len) m = m_get(); if (!m) return; - m->m_len = pkt_len; - memcpy(m->m_data, pkt, pkt_len); + /* Note: we add to align the IP header */ + m->m_len = pkt_len + 2; + memcpy(m->m_data + 2, pkt, pkt_len); - m->m_data += ETH_HLEN; - m->m_len -= ETH_HLEN; + m->m_data += 2 + ETH_HLEN; + m->m_len -= 2 + ETH_HLEN; ip_input(m); break;