1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-13 17:20:21 +02:00

Fix handling of IPv6 addresses

Thanks to Scott McPeak for reporting this and providing a patch.

* libguile/socket.c (scm_to_ipv6): When address is the wrong type,
  provide more information in the exception message.

  (scm_to_sockaddr): scm_to_ipv6 expects just an address, not the
  whole vector.

* test-suite/tests/socket.test ("AF_INET6/SOCK_STREAM"): New set of
  tests.
This commit is contained in:
Neil Jerram 2009-10-01 23:43:54 +01:00
parent 7394551f61
commit 451e15a06c
3 changed files with 89 additions and 2 deletions

View file

@ -347,7 +347,7 @@ scm_to_ipv6 (scm_t_uint8 dst[16], SCM src)
scm_remember_upto_here_1 (src);
}
else
scm_wrong_type_arg (NULL, 0, src);
scm_wrong_type_arg_msg ("scm_to_ipv6", 0, src, "integer");
}
#ifdef HAVE_INET_PTON
@ -1167,7 +1167,8 @@ scm_to_sockaddr (SCM address, size_t *address_size)
{
struct sockaddr_in6 c_inet6;
scm_to_ipv6 (c_inet6.sin6_addr.s6_addr, address);
scm_to_ipv6 (c_inet6.sin6_addr.s6_addr,
SCM_SIMPLE_VECTOR_REF (address, 1));
c_inet6.sin6_port =
htons (scm_to_ushort (SCM_SIMPLE_VECTOR_REF (address, 2)));
c_inet6.sin6_flowinfo =