aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSjors Gielen <sjors@sjorsgielen.nl>2017-05-24 17:51:12 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2017-05-27 23:35:00 +0200
commit8a85bd0548714df53145c91e94b68b31bcfaaf3d (patch)
tree513b263d1cdc98237b67728364394889f095320c
parent21494fca89c4ab6051ccd7a8abe5f611a6fb625f (diff)
downloadslirp-8a85bd0548714df53145c91e94b68b31bcfaaf3d.zip
slirp-8a85bd0548714df53145c91e94b68b31bcfaaf3d.tar.gz
slirp-8a85bd0548714df53145c91e94b68b31bcfaaf3d.tar.bz2
Fix total IP header length in forwarded TCP packets
When forwarding TCP packets, the internal tcpiphdr struct length was wrongly used inside the IP header. This commit changes the behaviour to what is used by tcp_output.c, using the correct full IP header + payload length. Signed-off-by: Sjors Gielen <sjors@sjorsgielen.nl> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
-rw-r--r--tcp_subr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tcp_subr.c b/tcp_subr.c
index 5fc6aa4..59f61fc 100644
--- a/tcp_subr.c
+++ b/tcp_subr.c
@@ -207,7 +207,7 @@ void tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
m->m_len -=
sizeof(struct tcpiphdr) - sizeof(struct tcphdr) - sizeof(struct ip);
ip = mtod(m, struct ip *);
- ip->ip_len = tlen;
+ 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;
@@ -227,7 +227,7 @@ void tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
m->m_len -= sizeof(struct tcpiphdr) - sizeof(struct tcphdr) -
sizeof(struct ip6);
ip6 = mtod(m, struct ip6 *);
- ip6->ip_pl = tlen;
+ ip6->ip_pl = tcpiph_save.ti_len;
ip6->ip_dst = tcpiph_save.ti_dst6;
ip6->ip_src = tcpiph_save.ti_src6;
ip6->ip_nh = tcpiph_save.ti_nh6;