diff options
author | Tao Wu <lepton@google.com> | 2017-11-08 14:53:40 -0800 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2017-11-09 18:59:22 +0100 |
commit | aa0c5f6a3ce7a611413b0b61e0cc4044ccb5cc84 (patch) | |
tree | 388e9c41bbc2997bd5a49564d8386d071ab9adda | |
parent | 8466b7dbe5479728a6f7084677129f6fe53f365c (diff) | |
download | slirp-2.11.0-rc4.zip slirp-2.11.0-rc4.tar.gz slirp-2.11.0-rc4.tar.bz2 |
slirp: don't zero the whole ti_i when m == NULLv2.11.2v2.11.1v2.11.0-rc5v2.11.0-rc4v2.11.0-rc3v2.11.0-rc2v2.11.0-rc1v2.11.0
98c63057d2144fb81681580cd84c13c93794c96e ('slirp: Factorizing
tcpiphdr structure with an union') introduced a memset call to clear
possibly-undefined fields in ti. This however overwrites src/dst/pr which
are used below.
So let us clear only the unused fields.
This should fix some rare cases (some RST cases, keep alive probes)
where packets would be sent to 0.0.0.0.
Signed-off-by: Tao Wu <lepton@google.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
-rw-r--r-- | tcp_subr.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -145,7 +145,16 @@ void tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m, m->m_data += IF_MAXLINKHDR; *mtod(m, struct tcpiphdr *) = *ti; ti = mtod(m, struct tcpiphdr *); - memset(&ti->ti, 0, sizeof(ti->ti)); + switch (af) { + case AF_INET: + ti->ti.ti_i4.ih_x1 = 0; + break; + case AF_INET6: + ti->ti.ti_i6.ih_x1 = 0; + break; + default: + g_assert_not_reached(); + } flags = TH_ACK; } else { /* |