summaryrefslogtreecommitdiff
path: root/slirp/tcp_input.c
diff options
context:
space:
mode:
authorGuillaume Subiron <maethor@subiron.org>2015-12-19 22:24:58 +0100
committerJason Wang <jasowang@redhat.com>2016-02-04 13:22:06 +0800
commiteae303ff23f51259eddc8856c71453d887ffe51a (patch)
treee6ebb289e43d60bb5687264b5fc88dae2a595b03 /slirp/tcp_input.c
parent18137fba35980de428664fca3576b5d187e96fef (diff)
downloadqemu-eae303ff23f51259eddc8856c71453d887ffe51a.tar.gz
qemu-eae303ff23f51259eddc8856c71453d887ffe51a.tar.bz2
qemu-eae303ff23f51259eddc8856c71453d887ffe51a.zip
slirp: Make Socket structure IPv6 compatible
This patch replaces foreign and local address/port couples in Socket structure by 2 sockaddr_storage which can be casted in sockaddr_in. Direct access to address and port is still possible thanks to some \#define, so retrocompatibility of the existing code is assured. The ss_family field of sockaddr_storage is declared after each socket creation. The whole structure is also saved/restored when a Qemu session is saved/restored. 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.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c
index 6b096ecb3c..4c3191d4fd 100644
--- a/slirp/tcp_input.c
+++ b/slirp/tcp_input.c
@@ -374,8 +374,10 @@ findso:
sbreserve(&so->so_snd, TCP_SNDSPACE);
sbreserve(&so->so_rcv, TCP_RCVSPACE);
+ so->so_lfamily = AF_INET;
so->so_laddr = ti->ti_src;
so->so_lport = ti->ti_sport;
+ so->so_ffamily = AF_INET;
so->so_faddr = ti->ti_dst;
so->so_fport = ti->ti_dport;