From fad7fb9ccd8013ea03c8c7a8f491c395e786dae6 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Tue, 15 Mar 2016 10:31:23 +0100 Subject: slirp: Add IPv6 support to the TFTP code Add the handler code for incoming TFTP packets to udp6_input(), and make sure that the TFTP code can send packets with both, udp_output() and udp6_output() by introducing a wrapper function called tftp_udp_output(). Signed-off-by: Thomas Huth Signed-off-by: Samuel Thibault --- slirp/udp6.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'slirp/udp6.c') diff --git a/slirp/udp6.c b/slirp/udp6.c index a9a3671..60a91c9 100644 --- a/slirp/udp6.c +++ b/slirp/udp6.c @@ -57,14 +57,24 @@ void udp6_input(struct mbuf *m) */ save_ip = *ip; - /* TODO handle DHCP/BOOTP */ - /* TODO handle TFTP */ - /* Locate pcb for datagram. */ lhost.sin6_family = AF_INET6; lhost.sin6_addr = ip->ip_src; lhost.sin6_port = uh->uh_sport; + /* TODO handle DHCP/BOOTP */ + + /* handle TFTP */ + if (ntohs(uh->uh_dport) == TFTP_SERVER && + !memcmp(ip->ip_dst.s6_addr, slirp->vhost_addr6.s6_addr, 16)) { + m->m_data += iphlen; + m->m_len -= iphlen; + tftp_input((struct sockaddr_storage *)&lhost, m); + m->m_data -= iphlen; + m->m_len += iphlen; + goto bad; + } + so = solookup(&slirp->udp_last_so, &slirp->udb, (struct sockaddr_storage *) &lhost, NULL); -- cgit v1.1