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