slirp: Small fixes
The following changes since commit 46f3069cba94aab44b3b4f87bc270759b4a700fa:
PPC: use memory API to construct the PCI hole (2011-09-27 19:16:46 +0000)
are available in the git repository at:
git://git.kiszka.org/qemu.git queues/slirp
Jan Kiszka (1):
slirp: Fix use after release on tcp_input
Thomas Huth (1):
slirp: Fix packet expiration
slirp/mbuf.h | 5 +++-- slirp/tcp_input.c | 22 ++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-)
Signature · 1 line
1.7.3.4
PATCH 1/2 slirp: Fix use after release on tcp_input
ti points into the m buffer. But the latter may already be released right after the dodata: label. Move the test before the potential release.
--- slirp/tcp_input.c | 22 ++++++++++------------ 1 files changed, 10 insertions(+), 12 deletions(-)
slirp/tcp_input.c +10 -12
@@ -1157,6 +1157,16 @@ step6: dodata:/* +* If this is a small packet, then ACK now - with Nagel +* congestion avoidance sender won't send more until +* he gets an ACK. +*/ +if (ti->ti_len && (unsigned )ti->ti_len <=5 && + ((struct tcpiphdr_2 *)ti)->first_char == (char )27 ) { + tp->t_flags |=TF_ACKNOW ; + } + +/* * Process the segment text, merging it into the TCP sequencing queue, * and arranging for acknowledgment of receipt if necessary. * This process logically involves adjusting tp->rcv_wnd as data
@@ -1235,18 +1245,6 @@ dodata: }/* -* If this is a small packet, then ACK now - with Nagel -* congestion avoidance sender won't send more until -* he gets an ACK. -* -* See above. -*/ -if (ti->ti_len && (unsigned )ti->ti_len <=5 && - ((struct tcpiphdr_2 *)ti)->first_char == (char )27 ) { - tp->t_flags |=TF_ACKNOW ; - } - -/* * Return any desired output. */ if (needoutput || (tp->t_flags &TF_ACKNOW )) {
Signature · 1 line
1.7.3.4
PATCH 2/2 slirp: Fix packet expiration
In reply to Jan KiszkaFrom: Thomas Huth <[email protected]>
The two new variables "arp_requested" and "expiration_date" in the mbuf structure have been added after the variable-sized "m_dat_" array. The variables have to be added before the m_dat_ array instead. Without this patch, the expiration_date gets clobbered by code that accesses the m_dat_ array.
I experienced this problem with the code in slirp/tftp.c: The tftp_send_data() function created a new packet with the m_get() function (which fills-in a default expiration_date value). Then the TFTP code cleared the data section of the packet, which accidentially also cleared the expiration_date. This zeroed expiration_date then finally causes the packet to be discarded during if_start(), so that TFTP packets were not transmitted anymore.
[Jan: added comment as suggested by Fabien ]
--- slirp/mbuf.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
slirp/mbuf.h +3 -2
@@ -82,12 +82,13 @@ struct m_hdr {struct mbuf {struct m_hdr m_hdr;Slirp *slirp; +bool arp_requested; +uint64_t expiration_date; +/* start of dynamic buffer area, must be last element */ union M_dat {char m_dat_[1 ];/* ANSI don't like 0 sized arrays */ char *m_ext_; } M_dat; -bool arp_requested; -uint64_t expiration_date; };#define m_next m_hdr.mh_next
Signature · 1 line
1.7.3.4
Quoted 6 lines · Jan Kiszka
The following changes since commit
46f3069cba94aab44b3b4f87bc270759b4a700fa:PPC: use memory API to construct the PCI hole (2011-09-27 19:16:46 +0000)
are available in the git repository at:
git://git.kiszka.org/qemu.gitqueues/slirp
Pulled. Thanks.
Regards,
Anthony Liguori
Quoted 14 lines
CC Fabien Chouteau<[email protected]>CC Thomas Huth<[email protected]>Jan Kiszka (1):
slirp: Fix use after release ontcp_inputThomas Huth (1):
slirp: Fix packet expirationslirp/mbuf.h | 5 +++-- slirp/tcp_input.c | 22 ++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-)