diff mbox

[PULL,0/5] ipv4-only and ipv6-only support

Message ID 20160331144941.GT2636@var.bordeaux.inria.fr
State New
Headers show

Commit Message

Samuel Thibault March 31, 2016, 2:49 p.m. UTC
Peter Maydell, on Thu 31 Mar 2016 15:44:13 +0100, wrote:
>                  if (get_dns6_addr(&sin6->sin6_addr,
> &sin6->sin6_scope_id) < 0) {
>                  ^
> In file included from /home/petmay01/linaro/qemu-for-merges/slirp/slirp.h:99:0,
>                  from /home/petmay01/linaro/qemu-for-merges/slirp/socket.c:10:
> /home/petmay01/linaro/qemu-for-merges/slirp/libslirp.h:10:5: note:
> expected ‘uint32_t *’ but argument is of type ‘u_long *’

Urgl, so Windows is again not posix-compliant here... I guess the least
ugly workaround is as below.

Samuel
diff mbox

Patch

diff --git a/slirp/socket.c b/slirp/socket.c
index 896c27e..3d3c72a 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -796,7 +796,10 @@  void sotranslate_out(struct socket *so, struct sockaddr_storage *addr)
         if (in6_equal_net(&so->so_faddr6, &slirp->vprefix_addr6,
                     slirp->vprefix_len)) {
             if (in6_equal(&so->so_faddr6, &slirp->vnameserver_addr6)) {
-                if (get_dns6_addr(&sin6->sin6_addr, &sin6->sin6_scope_id) < 0) {
+                uint32_t scope_id;
+                if (get_dns6_addr(&sin6->sin6_addr, &scope_id) >= 0) {
+                    sin6->sin6_scope_id = scope_id;
+                } else {
                     sin6->sin6_addr = in6addr_loopback;
                 }
             } else {