aboutsummaryrefslogtreecommitdiff
path: root/slirp/tcp_input.c
diff options
context:
space:
mode:
authorGuillaume Subiron <maethor@subiron.org>2015-12-19 22:25:00 +0100
committerJason Wang <jasowang@redhat.com>2016-02-04 13:22:06 +0800
commita5fd24aa6d0f26aeb9f15b24daa2d68427631c40 (patch)
tree83dcbdd530a4e23f3408bbc8ba60b54d78fa48dd /slirp/tcp_input.c
parent5379229a2708df3a1506113315214c3ce5325859 (diff)
slirp: Factorizing and cleaning solookup()
solookup() was only compatible with TCP. Having the socket list in argument, it is now compatible with UDP too. Some optimization code is factorized inside the function (the function look at the last returned result before browsing the complete socket list). This prepares for IPv6 support. Signed-off-by: Guillaume Subiron <maethor@subiron.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'slirp/tcp_input.c')
-rw-r--r--slirp/tcp_input.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c
index 4c3191d4fd..549206150c 100644
--- a/slirp/tcp_input.c
+++ b/slirp/tcp_input.c
@@ -320,16 +320,9 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso)
* Locate pcb for segment.
*/
findso:
- so = slirp->tcp_last_so;
- if (so->so_fport != ti->ti_dport ||
- so->so_lport != ti->ti_sport ||
- so->so_laddr.s_addr != ti->ti_src.s_addr ||
- so->so_faddr.s_addr != ti->ti_dst.s_addr) {
- so = solookup(&slirp->tcb, ti->ti_src, ti->ti_sport,
- ti->ti_dst, ti->ti_dport);
- if (so)
- slirp->tcp_last_so = so;
- }
+ so = solookup(&slirp->tcp_last_so, &slirp->tcb,
+ ti->ti_src, ti->ti_sport,
+ ti->ti_dst, ti->ti_dport);
/*
* If the state is CLOSED (i.e., TCB does not exist) then