diff options
author | Thomas Huth <thuth@redhat.com> | 2016-03-15 10:31:23 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-03-15 17:05:34 +0100 |
commit | fad7fb9ccd8013ea03c8c7a8f491c395e786dae6 (patch) | |
tree | 2efbcb62853bb497eae6a7782dd1e5cf6f2ed4fe /slirp/udp.c | |
parent | 7aac531ef260e3176838f8089525f3e13e40b607 (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/udp.c')
-rw-r--r-- | slirp/udp.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/slirp/udp.c b/slirp/udp.c index be012fbfe1..247024fd86 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -128,6 +128,11 @@ udp_input(register struct mbuf *m, int iphlen) } } + lhost.ss_family = AF_INET; + lhost4 = (struct sockaddr_in *) &lhost; + lhost4->sin_addr = ip->ip_src; + lhost4->sin_port = uh->uh_sport; + /* * handle DHCP/BOOTP */ @@ -143,7 +148,11 @@ udp_input(register struct mbuf *m, int iphlen) */ if (ntohs(uh->uh_dport) == TFTP_SERVER && ip->ip_dst.s_addr == slirp->vhost_addr.s_addr) { - tftp_input(m); + m->m_data += iphlen; + m->m_len -= iphlen; + tftp_input(&lhost, m); + m->m_data -= iphlen; + m->m_len += iphlen; goto bad; } @@ -154,11 +163,6 @@ udp_input(register struct mbuf *m, int iphlen) /* * Locate pcb for datagram. */ - lhost.ss_family = AF_INET; - lhost4 = (struct sockaddr_in *) &lhost; - lhost4->sin_addr = ip->ip_src; - lhost4->sin_port = uh->uh_sport; - so = solookup(&slirp->udp_last_so, &slirp->udb, &lhost, NULL); if (so == NULL) { |