]> git.proxmox.com Git - mirror_qemu.git/blobdiff - slirp/udp.c
Fix some typos found by codespell
[mirror_qemu.git] / slirp / udp.c
index 92c48c491e8b5c287d4be3efa3c03fa84426e365..247024fd86a7558055e8d782aeb2ec79f2b1bee1 100644 (file)
@@ -38,6 +38,7 @@
  * terms and conditions of the copyright.
  */
 
+#include "qemu/osdep.h"
 #include <slirp.h>
 #include "ip_icmp.h"
 
@@ -127,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
          */
@@ -142,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;
         }
 
@@ -153,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) {
@@ -208,7 +213,8 @@ udp_input(register struct mbuf *m, int iphlen)
          m->m_data -= iphlen;
          *ip=save_ip;
          DEBUG_MISC((dfd,"udp tx errno = %d-%s\n",errno,strerror(errno)));
-         icmp_error(m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno));
+         icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0,
+                         strerror(errno));
          goto bad;
        }