]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/qemu-xen.git/commitdiff
slirp: Make udp_attach IPv6 compatible
authorGuillaume Subiron <maethor@subiron.org>
Sat, 19 Dec 2015 21:25:02 +0000 (22:25 +0100)
committerJason Wang <jasowang@redhat.com>
Thu, 4 Feb 2016 06:13:11 +0000 (14:13 +0800)
A unsigned short is now passed in argument to udp_attach instead of using a
hardcoded "AF_INET" to call qemu_socket().

This prepares for IPv6 support.

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>
Signed-off-by: Jason Wang <jasowang@redhat.com>
slirp/ip_icmp.c
slirp/udp.c
slirp/udp.h

index 3a29847263352590f668cf095c78eca57cd312e1..592f33a82738215e92a1e47cd23961ba4d03c7a5 100644 (file)
@@ -162,7 +162,7 @@ icmp_input(struct mbuf *m, int hlen)
       if (icmp_send(so, m, hlen) == 0) {
         return;
       }
-      if(udp_attach(so) == -1) {
+      if (udp_attach(so, AF_INET) == -1) {
        DEBUG_MISC((dfd,"icmp_input udp_attach errno = %d-%s\n",
                    errno,strerror(errno)));
        sofree(so);
index 63776c007d115fca8bddaf5d44278e62c27ef931..92c48c491e8b5c287d4be3efa3c03fa84426e365 100644 (file)
@@ -169,7 +169,7 @@ udp_input(register struct mbuf *m, int iphlen)
          if (!so) {
              goto bad;
          }
-         if(udp_attach(so) == -1) {
+         if (udp_attach(so, AF_INET) == -1) {
            DEBUG_MISC((dfd," udp_attach errno = %d-%s\n",
                        errno,strerror(errno)));
            sofree(so);
@@ -277,9 +277,10 @@ int udp_output(struct socket *so, struct mbuf *m,
 }
 
 int
-udp_attach(struct socket *so)
+udp_attach(struct socket *so, unsigned short af)
 {
-  if((so->s = qemu_socket(AF_INET,SOCK_DGRAM,0)) != -1) {
+  so->s = qemu_socket(af, SOCK_DGRAM, 0);
+  if (so->s != -1) {
     so->so_expire = curtime + SO_EXPIRE;
     insque(so, &so->slirp->udb);
   }
index a04b8ce562770ca43cd16d2d41fb06c4dfee14fc..2f9de3886cf39c98f636e740c79d8532448fcd37 100644 (file)
@@ -76,7 +76,7 @@ struct mbuf;
 void udp_init(Slirp *);
 void udp_cleanup(Slirp *);
 void udp_input(register struct mbuf *, int);
-int udp_attach(struct socket *);
+int udp_attach(struct socket *, unsigned short af);
 void udp_detach(struct socket *);
 struct socket * udp_listen(Slirp *, uint32_t, u_int, uint32_t, u_int,
                            int);