diff options
Diffstat (limited to 'slirp/tcp_output.c')
-rw-r--r-- | slirp/tcp_output.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/slirp/tcp_output.c b/slirp/tcp_output.c index 34e4d2e5d4..7fc6a87397 100644 --- a/slirp/tcp_output.c +++ b/slirp/tcp_output.c @@ -448,15 +448,23 @@ send: */ m->m_len = hdrlen + len; /* XXX Needed? m_len should be correct */ - { + struct tcpiphdr tcpiph_save = *(mtod(m, struct tcpiphdr *)); + m->m_data += sizeof(struct tcpiphdr) - sizeof(struct tcphdr) + - sizeof(struct ip); + m->m_len -= sizeof(struct tcpiphdr) - sizeof(struct tcphdr) + - sizeof(struct ip); + struct ip *ip = mtod(m, struct ip *); - ((struct ip *)ti)->ip_len = m->m_len; + ip->ip_len = m->m_len; + ip->ip_dst = tcpiph_save.ti_dst; + ip->ip_src = tcpiph_save.ti_src; + ip->ip_p = tcpiph_save.ti_pr; - ((struct ip *)ti)->ip_ttl = IPDEFTTL; - ((struct ip *)ti)->ip_tos = so->so_iptos; + ip->ip_ttl = IPDEFTTL; + ip->ip_tos = so->so_iptos; error = ip_output(so, m); - } + if (error) { out: return (error); |