diff options
author | Guillaume Subiron <maethor@subiron.org> | 2016-03-15 10:31:21 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-03-15 10:35:19 +0100 |
commit | 3feea4447f1b9b04816ee6977b5ecc0eb704e07a (patch) | |
tree | fc7a5cb36318171ffd51c4698a5517429b9a9e55 /slirp/tcp_output.c | |
parent | 1252cf40a83ed91e0ee30cc5f206ce9372c640d8 (diff) |
slirp: Handle IPv6 in TCP functions
This patch adds IPv6 case in TCP functions refactored by the last
patches.
This also adds IPv6 pseudo-header in tcpiphdr structure.
Finally, tcp_input() is called by ip6_input().
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>
Diffstat (limited to 'slirp/tcp_output.c')
-rw-r--r-- | slirp/tcp_output.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/slirp/tcp_output.c b/slirp/tcp_output.c index eec8902466..99b0a9b1cb 100644 --- a/slirp/tcp_output.c +++ b/slirp/tcp_output.c @@ -63,6 +63,7 @@ tcp_output(struct tcpcb *tp) register struct mbuf *m; register struct tcpiphdr *ti, tcpiph_save; struct ip *ip; + struct ip6 *ip6; u_char opt[MAX_TCPOPTLEN]; unsigned optlen, hdrlen; int idle, sendalot; @@ -468,6 +469,21 @@ send: error = ip_output(so, m); break; + case AF_INET6: + m->m_data += sizeof(struct tcpiphdr) - sizeof(struct tcphdr) + - sizeof(struct ip6); + m->m_len -= sizeof(struct tcpiphdr) - sizeof(struct tcphdr) + - sizeof(struct ip6); + ip6 = mtod(m, struct ip6 *); + + 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; + + error = ip6_output(so, m, 0); + break; + default: g_assert_not_reached(); } |