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>
This commit is contained in:
Guillaume Subiron 2016-03-15 10:31:21 +01:00 committed by Samuel Thibault
parent 1252cf40a8
commit 3feea4447f
6 changed files with 125 additions and 9 deletions

View file

@ -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();
}