[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, branch_release-1-8, updated. release_1
From: |
Neil Jerram |
Subject: |
[Guile-commits] GNU Guile branch, branch_release-1-8, updated. release_1-8-7-9-g84a54b2 |
Date: |
Thu, 01 Oct 2009 22:44:53 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=84a54b292d30e94c6980caf61bc0450ff4ba3ac8
The branch, branch_release-1-8 has been updated
via 84a54b292d30e94c6980caf61bc0450ff4ba3ac8 (commit)
via 451e15a06c744e49a1bdab6df6d86e0f96d3aa14 (commit)
from 7394551f61a87802dca01a29173c0b87a4b128e5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 84a54b292d30e94c6980caf61bc0450ff4ba3ac8
Author: Neil Jerram <address@hidden>
Date: Thu Oct 1 23:38:57 2009 +0100
Fix doc for inet-ntop: always produces a string
Thanks to Scott McPeak for reporting this.
* libguile/socket.c (scm_inet_ntop): In docstring, add quotes around
IPv6 address (+ reflow a bit).
* doc/ref/posix.texi (Network Address Conversion): Corresponding
change.
* doc/maint/guile.texi: Corresponding change.
commit 451e15a06c744e49a1bdab6df6d86e0f96d3aa14
Author: Neil Jerram <address@hidden>
Date: Thu Oct 1 23:43:54 2009 +0100
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.
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
doc/maint/guile.texi | 4 +-
doc/ref/posix.texi | 4 +-
libguile/socket.c | 9 ++--
test-suite/tests/socket.test | 85 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 95 insertions(+), 8 deletions(-)
diff --git a/NEWS b/NEWS
index 20c0f55..9d84e06 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Changes in 1.8.8 (since 1.8.7)
** Fix possible buffer overruns when parsing numbers
** Avoid clash with system setjmp/longjmp on IA64
** Don't dynamically link an extension that is already registered
+** Fix `wrong type arg' exceptions with IPv6 addresses
Changes in 1.8.7 (since 1.8.6)
diff --git a/doc/maint/guile.texi b/doc/maint/guile.texi
index 4ef4aab..3b5305e 100644
--- a/doc/maint/guile.texi
+++ b/doc/maint/guile.texi
@@ -10708,8 +10708,8 @@ the input is an integer with normal host byte ordering.
@lisp
(inet-ntop AF_INET 2130706433) @result{} "127.0.0.1"
-(inet-ntop AF_INET6 (- (expt 2 128) 1)) @result{}
-ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
+(inet-ntop AF_INET6 (- (expt 2 128) 1))
+ @result{} "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"
@end lisp
@end deffn
diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi
index 84ccd03..0a7e342 100644
--- a/doc/ref/posix.texi
+++ b/doc/ref/posix.texi
@@ -2310,8 +2310,8 @@ Convert a network address from an integer to a printable
string.
@lisp
(inet-ntop AF_INET 2130706433) @result{} "127.0.0.1"
-(inet-ntop AF_INET6 (- (expt 2 128) 1)) @result{}
-ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
+(inet-ntop AF_INET6 (- (expt 2 128) 1))
+ @result{} "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"
@end lisp
@end deffn
diff --git a/libguile/socket.c b/libguile/socket.c
index f34b6d4..cb954f4 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -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
@@ -397,8 +397,8 @@ SCM_DEFINE (scm_inet_ntop, "inet-ntop", 2, 0, 0,
"@var{family} can be @code{AF_INET} or @code{AF_INET6}. E.g.,\n\n"
"@lisp\n"
"(inet-ntop AF_INET 2130706433) @result{} \"127.0.0.1\"\n"
- "(inet-ntop AF_INET6 (- (expt 2 128) 1)) @result{}\n"
- "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff\n"
+ "(inet-ntop AF_INET6 (- (expt 2 128) 1))\n"
+ " @result{} \"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff\"\n"
"@end lisp")
#define FUNC_NAME s_scm_inet_ntop
{
@@ -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 =
diff --git a/test-suite/tests/socket.test b/test-suite/tests/socket.test
index 4bfc415..5b738fd 100644
--- a/test-suite/tests/socket.test
+++ b/test-suite/tests/socket.test
@@ -320,3 +320,88 @@
#t)))
+
+(if (defined? 'AF_INET6)
+ (with-test-prefix "AF_INET6/SOCK_STREAM"
+
+ ;; testing `bind', `listen' and `connect' on stream-oriented sockets
+
+ (let ((server-socket (socket AF_INET6 SOCK_STREAM 0))
+ (server-bound? #f)
+ (server-listening? #f)
+ (server-pid #f)
+ (ipv6-addr 1) ; ::1
+ (server-port 8889)
+ (client-port 9998))
+
+ (pass-if "bind"
+ (catch 'system-error
+ (lambda ()
+ (bind server-socket AF_INET6 ipv6-addr server-port)
+ (set! server-bound? #t)
+ #t)
+ (lambda args
+ (let ((errno (system-error-errno args)))
+ (cond ((= errno EADDRINUSE) (throw 'unresolved))
+ (else (apply throw args)))))))
+
+ (pass-if "bind/sockaddr"
+ (let* ((sock (socket AF_INET6 SOCK_STREAM 0))
+ (sockaddr (make-socket-address AF_INET6 ipv6-addr
client-port)))
+ (catch 'system-error
+ (lambda ()
+ (bind sock sockaddr)
+ #t)
+ (lambda args
+ (let ((errno (system-error-errno args)))
+ (cond ((= errno EADDRINUSE) (throw 'unresolved))
+ (else (apply throw args))))))))
+
+ (pass-if "listen"
+ (if (not server-bound?)
+ (throw 'unresolved)
+ (begin
+ (listen server-socket 123)
+ (set! server-listening? #t)
+ #t)))
+
+ (if server-listening?
+ (let ((pid (primitive-fork)))
+ ;; Spawn a server process.
+ (case pid
+ ((-1) (throw 'unresolved))
+ ((0) ;; the kid: serve two connections and exit
+ (let serve ((conn
+ (false-if-exception (accept server-socket)))
+ (count 1))
+ (if (not conn)
+ (exit 1)
+ (if (> count 0)
+ (serve (false-if-exception (accept server-socket))
+ (- count 1)))))
+ (exit 0))
+ (else ;; the parent
+ (set! server-pid pid)
+ #t))))
+
+ (pass-if "connect"
+ (if (not server-pid)
+ (throw 'unresolved)
+ (let ((s (socket AF_INET6 SOCK_STREAM 0)))
+ (connect s AF_INET6 ipv6-addr server-port)
+ #t)))
+
+ (pass-if "connect/sockaddr"
+ (if (not server-pid)
+ (throw 'unresolved)
+ (let ((s (socket AF_INET6 SOCK_STREAM 0)))
+ (connect s (make-socket-address AF_INET6 ipv6-addr server-port))
+ #t)))
+
+ (pass-if "accept"
+ (if (not server-pid)
+ (throw 'unresolved)
+ (let ((status (cdr (waitpid server-pid))))
+ (eq? 0 (status:exit-val status)))))
+
+ #t)))
\ No newline at end of file
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, branch_release-1-8, updated. release_1-8-7-9-g84a54b2,
Neil Jerram <=