aboutsummaryrefslogtreecommitdiff
path: root/slirp/udp6.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2016-03-15 10:31:23 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-03-15 17:05:34 +0100
commitfad7fb9ccd8013ea03c8c7a8f491c395e786dae6 (patch)
tree2efbcb62853bb497eae6a7782dd1e5cf6f2ed4fe /slirp/udp6.c
parent7aac531ef260e3176838f8089525f3e13e40b607 (diff)
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 <thuth@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/udp6.c')
-rw-r--r--slirp/udp6.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/slirp/udp6.c b/slirp/udp6.c
index a9a36716a0..60a91c9532 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);