<div dir="auto">Kill yourself</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue., Aug. 11, 2020, 6:00 a.m. , <<a href="mailto:inn-committers-request@lists.isc.org">inn-committers-request@lists.isc.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send inn-committers mailing list submissions to<br>
<a href="mailto:inn-committers@lists.isc.org" target="_blank" rel="noreferrer">inn-committers@lists.isc.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://lists.isc.org/mailman/listinfo/inn-committers" rel="noreferrer noreferrer" target="_blank">https://lists.isc.org/mailman/listinfo/inn-committers</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:inn-committers-request@lists.isc.org" target="_blank" rel="noreferrer">inn-committers-request@lists.isc.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:inn-committers-owner@lists.isc.org" target="_blank" rel="noreferrer">inn-committers-owner@lists.isc.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of inn-committers digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. INN commit: trunk (5 files) (INN Commit)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Mon, 10 Aug 2020 11:29:31 -0700 (PDT)<br>
From: INN Commit <<a href="mailto:rra@isc.org" target="_blank" rel="noreferrer">rra@isc.org</a>><br>
To: <a href="mailto:inn-committers@isc.org" target="_blank" rel="noreferrer">inn-committers@isc.org</a><br>
Subject: INN commit: trunk (5 files)<br>
Message-ID: <<a href="mailto:20200810182931.6AC4C67E5F@hope.eyrie.org" target="_blank" rel="noreferrer">20200810182931.6AC4C67E5F@hope.eyrie.org</a>><br>
<br>
Date: Monday, August 10, 2020 @ 11:29:30<br>
Author: iulius<br>
Revision: 10388<br>
<br>
Update to latest rra-c-util upstream version<br>
<br>
Modified:<br>
trunk/lib/snprintf.c<br>
trunk/m4/snprintf.m4<br>
trunk/support/getrra-c-util<br>
trunk/tests/lib/network/server-t.c<br>
trunk/tests/lib/snprintf-t.c<br>
<br>
------------------------------+<br>
lib/snprintf.c | 5 +<br>
m4/snprintf.m4 | 5 +<br>
support/getrra-c-util | 14 +++-<br>
tests/lib/network/server-t.c | 115 ++++++++++++++++++++++++++++++-----------<br>
tests/lib/snprintf-t.c | 5 +<br>
5 files changed, 105 insertions(+), 39 deletions(-)<br>
<br>
Modified: lib/snprintf.c<br>
===================================================================<br>
--- lib/snprintf.c 2020-06-14 12:51:00 UTC (rev 10387)<br>
+++ lib/snprintf.c 2020-08-10 18:29:30 UTC (rev 10388)<br>
@@ -11,8 +11,9 @@<br>
* that later merges with the original source are easy. Bug fixes and<br>
* improvements should be sent back to the original author.<br>
*<br>
- * The canonical version of this file is maintained in the rra-c-util package,<br>
- * which can be found at <<a href="https://www.eyrie.org/~eagle/software/rra-c-util/" rel="noreferrer noreferrer" target="_blank">https://www.eyrie.org/~eagle/software/rra-c-util/</a>>.<br>
+ * The canonical version of this file was maintained (until 2020) in the<br>
+ * rra-c-util package, which can be found at<br>
+ * <<a href="https://www.eyrie.org/~eagle/software/rra-c-util/" rel="noreferrer noreferrer" target="_blank">https://www.eyrie.org/~eagle/software/rra-c-util/</a>>.<br>
*/<br>
<br>
/*<br>
<br>
Modified: m4/snprintf.m4<br>
===================================================================<br>
--- m4/snprintf.m4 2020-06-14 12:51:00 UTC (rev 10387)<br>
+++ m4/snprintf.m4 2020-08-10 18:29:30 UTC (rev 10388)<br>
@@ -10,8 +10,9 @@<br>
dnl Provides INN_FUNC_SNPRINTF, which adds snprintf.o to LIBOBJS unless a<br>
dnl fully working snprintf is found.<br>
dnl<br>
-dnl The canonical version of this file is maintained in the rra-c-util<br>
-dnl package, available at <<a href="https://www.eyrie.org/~eagle/software/rra-c-util/" rel="noreferrer noreferrer" target="_blank">https://www.eyrie.org/~eagle/software/rra-c-util/</a>>.<br>
+dnl The canonical version of this file was maintained (until 2020) in the<br>
+dnl rra-c-util package, available at<br>
+dnl <<a href="https://www.eyrie.org/~eagle/software/rra-c-util/" rel="noreferrer noreferrer" target="_blank">https://www.eyrie.org/~eagle/software/rra-c-util/</a>>.<br>
dnl<br>
dnl Written by Russ Allbery <<a href="mailto:eagle@eyrie.org" target="_blank" rel="noreferrer">eagle@eyrie.org</a>><br>
dnl Copyright 2006, 2008-2009<br>
<br>
Modified: support/getrra-c-util<br>
===================================================================<br>
--- support/getrra-c-util 2020-06-14 12:51:00 UTC (rev 10387)<br>
+++ support/getrra-c-util 2020-08-10 18:29:30 UTC (rev 10388)<br>
@@ -161,7 +161,16 @@<br>
extern int symlink(const char *, const char *);\\<br>
#endif\\<br>
" \<br>
- -e "172 i \\<br>
+ -e "147 i \\<br>
+#if !HAVE_DECL_SNPRINTF\\<br>
+extern int snprintf(char *, size_t, const char *, ...)\\<br>
+ __attribute__((__format__(printf, 3, 4)));\\<br>
+#endif\\<br>
+#if !HAVE_DECL_VSNPRINTF\\<br>
+extern int vsnprintf(char *, size_t, const char *, va_list)\\<br>
+ __attribute__((__format__(printf, 3, 0)));\\<br>
+#endif" \<br>
+ -e "164 i \\<br>
#if !HAVE_DECL_STRLCAT\\<br>
extern size_t strlcat(char *, const char *, size_t);\\<br>
#endif\\<br>
@@ -246,7 +255,6 @@<br>
download m4/perl.m4 m4 perl.m4<br>
download m4/python.m4 m4 python.m4<br>
download m4/sasl.m4 m4 sasl.m4<br>
-download m4/snprintf.m4 m4 snprintf.m4<br>
download m4/socket-unix.m4 m4 socket-unix.m4<br>
download m4/socket.m4 m4 socket.m4<br>
download m4/vamacros.m4 m4 vamacros.m4<br>
@@ -266,7 +274,6 @@<br>
download portable/reallocarray.c lib reallocarray.c<br>
download portable/setenv.c lib setenv.c<br>
download portable/seteuid.c lib seteuid.c<br>
-download portable/snprintf.c lib snprintf.c<br>
download portable/socket.h include/portable socket.h<br>
download portable/socket-unix.h include/portable socket-unix.h<br>
download portable/stdbool.h include/portable stdbool.h<br>
@@ -300,7 +307,6 @@<br>
download tests/portable/mkstemp-t.c tests/lib mkstemp-t.c<br>
download tests/portable/reallocarray-t.c tests/lib reallocarray-t.c<br>
download tests/portable/setenv-t.c tests/lib setenv-t.c<br>
-download tests/portable/snprintf-t.c tests/lib snprintf-t.c<br>
<br>
## Synchronize test suite files for utility functions from upstream.<br>
download tests/util/buffer-t.c tests/lib buffer-t.c<br>
<br>
Modified: tests/lib/network/server-t.c<br>
===================================================================<br>
--- tests/lib/network/server-t.c 2020-06-14 12:51:00 UTC (rev 10387)<br>
+++ tests/lib/network/server-t.c 2020-08-10 18:29:30 UTC (rev 10388)<br>
@@ -151,13 +151,13 @@<br>
* This also verifies that network_client_create works properly.<br>
*/<br>
__attribute__((__noreturn__)) static void<br>
-client_udp_writer(const char *source)<br>
+client_ipv4_udp_writer(const char *source)<br>
{<br>
socket_type fd;<br>
struct sockaddr_in sin;<br>
<br>
/* Create and bind the socket. */<br>
- fd = network_client_create(PF_INET, SOCK_DGRAM, source);<br>
+ fd = network_client_create(AF_INET, SOCK_DGRAM, source);<br>
if (fd == INVALID_SOCKET)<br>
_exit(1);<br>
<br>
@@ -177,6 +177,42 @@<br>
<br>
<br>
/*<br>
+ * The same as client_ipv4_udp_writer, but sents the packet via IPv6 instead.<br>
+ * If somehow this was called without IPv6 being available (which should be<br>
+ * impossible), do nothing and exit with a non-zero status.<br>
+ */<br>
+__attribute__((__noreturn__)) static void<br>
+client_ipv6_udp_writer(const char *source)<br>
+{<br>
+#ifdef HAVE_INET6<br>
+ socket_type fd;<br>
+ struct sockaddr_in6 sin6;<br>
+<br>
+ /* Create and bind the socket. */<br>
+ fd = network_client_create(AF_INET6, SOCK_DGRAM, source);<br>
+ if (fd == INVALID_SOCKET)<br>
+ _exit(1);<br>
+<br>
+ /* Connect to localhost port 11119. */<br>
+ memset(&sin6, 0, sizeof(sin6));<br>
+ sin6.sin6_family = AF_INET6;<br>
+ sin6.sin6_port = htons(11119);<br>
+ if (inet_pton(AF_INET6, "::1", &sin6.sin6_addr) < 1)<br>
+ sysbail("cannot convert ::1 to an in6_addr");<br>
+ if (connect(fd, (struct sockaddr *) &sin6, sizeof(sin6)) < 0)<br>
+ _exit(1);<br>
+<br>
+ /* Send our fixed UDP packet. */<br>
+ if (send(fd, "socket test\r\n", 13, 0) < 13)<br>
+ _exit(1);<br>
+ _exit(0);<br>
+#else<br>
+ _exit(1);<br>
+#endif<br>
+}<br>
+<br>
+<br>
+/*<br>
* When testing the bind (server) functions, we create listening sockets, fork<br>
* a child process to connect to it, and accept the connection and read the<br>
* data in the server. The test reporting is therefore done by the listener.<br>
@@ -239,13 +275,14 @@<br>
* A variant version of the server portion of the test. Takes an array of<br>
* sockets and the size of the sockets and accepts a connection on any of<br>
* those sockets. Ensures that the client address information is stored<br>
- * correctly by checking that it is an IPv4 address. For skipping purposes,<br>
- * this produces three tests.<br>
+ * correctly by checking that it is an IPv4 or IPv6 address. For skipping<br>
+ * purposes, this produces three tests.<br>
*<br>
* Normally, the client address should be 127.0.0.1, but hosts with odd local<br>
* networking setups may rewrite client IP addresses so that they appear to<br>
- * come from other addresses. Avoid checking if the client IP is 127.0.0.1<br>
- * for that reason. Hopefully this won't hide bugs.<br>
+ * come from other addresses. Hosts that only have IPv6 interfaces will see a<br>
+ * client connection on ::1 instead. Avoid checking if the client IP is<br>
+ * 127.0.0.1 for that reason. Hopefully this won't hide bugs.<br>
*<br>
* saddr is allocated from the heap instead of using a local struct<br>
* sockaddr_storage to work around a misdiagnosis of strict aliasing<br>
@@ -267,7 +304,10 @@<br>
saddr = bcalloc(1, slen);<br>
client = network_accept_any(fds, count, saddr, &slen);<br>
test_server_connection(client);<br>
- is_int(AF_INET, saddr->sa_family, "...address family is IPv4");<br>
+ if (saddr->sa_family == AF_INET)<br>
+ is_int(AF_INET, saddr->sa_family, "...address family is IPv4");<br>
+ else<br>
+ is_int(AF_INET6, saddr->sa_family, "...address family is IPv6");<br>
free(saddr);<br>
for (i = 0; i < count; i++)<br>
socket_close(fds[i]);<br>
@@ -465,20 +505,37 @@<br>
socket_type *fds;<br>
unsigned int count, i;<br>
pid_t child;<br>
- int status;<br>
+ int status, family;<br>
+ struct sockaddr *saddr;<br>
<br>
+ /* Bind our socket.<br>
+ *<br>
+ * If the host has no IPv4 addresses, we may have only an IPv6 socket and<br>
+ * thus can't us an IPv4 client. Determine the address family of the<br>
+ * first socket so that we can use an appropriate client.<br>
+ */<br>
if (!network_bind_all(SOCK_STREAM, 11119, &fds, &count))<br>
sysbail("cannot create or bind socket");<br>
+ saddr = get_sockaddr(fds[0]);<br>
+ family = saddr->sa_family;<br>
+ free(saddr);<br>
ok(1, "network_accept_any test");<br>
+<br>
+ /* Listen on all bound sockets. */<br>
for (i = 0; i < count; i++)<br>
if (listen(fds[i], 1) < 0)<br>
sysbail("cannot listen to socket %d", fds[i]);<br>
+<br>
+ /* Write a packet from a client and receive it on the server. */<br>
child = fork();<br>
if (child < 0)<br>
sysbail("cannot fork");<br>
- else if (child == 0)<br>
- client_writer("127.0.0.1", NULL, true);<br>
- else {<br>
+ else if (child == 0) {<br>
+ if (family == AF_INET)<br>
+ client_writer("127.0.0.1", NULL, true);<br>
+ else<br>
+ client_writer("::1", NULL, true);<br>
+ } else {<br>
test_server_accept_any(fds, count);<br>
waitpid(child, &status, 0);<br>
is_int(0, status, "client made correct connections");<br>
@@ -501,22 +558,34 @@<br>
pid_t child;<br>
char buffer[BUFSIZ];<br>
ssize_t length;<br>
- int status;<br>
+ int status, family;<br>
struct sockaddr_storage addr;<br>
struct sockaddr *saddr;<br>
- struct sockaddr_in sin;<br>
socklen_t addrlen;<br>
<br>
- /* Bind our UDP socket. */<br>
+ /*<br>
+ * Bind our UDP socket.<br>
+ *<br>
+ * If the host has no IPv4 addresses, we may have only an IPv6 socket and<br>
+ * thus can't us an IPv4 client. Determine the address family of the<br>
+ * first socket so that we can use an appropriate client.<br>
+ */<br>
if (!network_bind_all(SOCK_DGRAM, 11119, &fds, &count))<br>
sysbail("cannot create or bind socket");<br>
+ saddr = get_sockaddr(fds[0]);<br>
+ family = saddr->sa_family;<br>
+ free(saddr);<br>
<br>
/* Create a child that writes a single UDP packet to the server. */<br>
child = fork();<br>
if (child < 0)<br>
sysbail("cannot fork");<br>
- else if (child == 0)<br>
- client_udp_writer("127.0.0.1");<br>
+ else if (child == 0) {<br>
+ if (family == AF_INET)<br>
+ client_ipv4_udp_writer("127.0.0.1");<br>
+ else<br>
+ client_ipv6_udp_writer("::1");<br>
+ }<br>
<br>
/* Set an alarm, since if the client malfunctions, nothing happens. */<br>
alarm(5);<br>
@@ -531,19 +600,7 @@<br>
addrlen = sizeof(addr);<br>
length = recvfrom(fd, buffer, sizeof(buffer), 0, saddr, &addrlen);<br>
is_int(13, length, "...of correct length");<br>
- sin.sin_family = AF_INET;<br>
- sin.sin_port = htons(11119);<br>
-<br>
- /*<br>
- * We'd prefer to check that the client IP address is 127.0.0.1 here,<br>
- * but hosts with odd local networking setups may rewrite the client<br>
- * IP address to something else. To avoid false positives, just<br>
- * blindly trust the client IP address is correct, since it seems<br>
- * unlikely we'll have a server code bug here.<br>
- */<br>
- sin.sin_addr = ((struct sockaddr_in *) &addr)->sin_addr;<br>
- ok(network_sockaddr_equal((struct sockaddr *) &sin, saddr),<br>
- "...from correct family and port");<br>
+ is_int(family, saddr->sa_family, "...from correct family");<br>
buffer[13] = '\0';<br>
is_string("socket test\r\n", buffer, "...and correct contents");<br>
}<br>
<br>
Modified: tests/lib/snprintf-t.c<br>
===================================================================<br>
--- tests/lib/snprintf-t.c 2020-06-14 12:51:00 UTC (rev 10387)<br>
+++ tests/lib/snprintf-t.c 2020-08-10 18:29:30 UTC (rev 10388)<br>
@@ -2,8 +2,9 @@<br>
*<br>
* snprintf test suite.<br>
*<br>
- * The canonical version of this file is maintained in the rra-c-util package,<br>
- * which can be found at <<a href="https://www.eyrie.org/~eagle/software/rra-c-util/" rel="noreferrer noreferrer" target="_blank">https://www.eyrie.org/~eagle/software/rra-c-util/</a>>.<br>
+ * The canonical version of this file was maintained (until 2020) in the<br>
+ * rra-c-util package, which can be found at<br>
+ * <<a href="https://www.eyrie.org/~eagle/software/rra-c-util/" rel="noreferrer noreferrer" target="_blank">https://www.eyrie.org/~eagle/software/rra-c-util/</a>>.<br>
*<br>
* Written by Russ Allbery <<a href="mailto:eagle@eyrie.org" target="_blank" rel="noreferrer">eagle@eyrie.org</a>><br>
* Copyright 2000-2006, 2018-2020 Russ Allbery <<a href="mailto:eagle@eyrie.org" target="_blank" rel="noreferrer">eagle@eyrie.org</a>><br>
<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
inn-committers mailing list<br>
<a href="mailto:inn-committers@lists.isc.org" target="_blank" rel="noreferrer">inn-committers@lists.isc.org</a><br>
<a href="https://lists.isc.org/mailman/listinfo/inn-committers" rel="noreferrer noreferrer" target="_blank">https://lists.isc.org/mailman/listinfo/inn-committers</a><br>
<br>
<br>
------------------------------<br>
<br>
End of inn-committers Digest, Vol 123, Issue 1<br>
**********************************************<br>
</blockquote></div>