aboutsummaryrefslogtreecommitdiff
path: root/net/tinyproxy/patches/120-fix_INET6.patch
diff options
context:
space:
mode:
authorZhang Rui <rui.crater@gmail.com>2023-03-28 16:45:52 +0800
committerTianling Shen <cnsztl@gmail.com>2023-04-05 23:47:30 +0800
commit5c32126d39521efca1c3c5b836ca2d42edede6e0 (patch)
treea6c811a5070d34656c695b51fa8325fb865e4316 /net/tinyproxy/patches/120-fix_INET6.patch
parent1ee71d4a1a6321ff8d2c0fccd7e4486998c60d19 (diff)
tinyproxy: Update to 1.11.1
Signed-off-by: Zhang Rui <rui.crater@gmail.com>
Diffstat (limited to 'net/tinyproxy/patches/120-fix_INET6.patch')
-rw-r--r--net/tinyproxy/patches/120-fix_INET6.patch48
1 files changed, 36 insertions, 12 deletions
diff --git a/net/tinyproxy/patches/120-fix_INET6.patch b/net/tinyproxy/patches/120-fix_INET6.patch
index 3911c18f0..6281a4223 100644
--- a/net/tinyproxy/patches/120-fix_INET6.patch
+++ b/net/tinyproxy/patches/120-fix_INET6.patch
@@ -1,16 +1,15 @@
--- a/src/sock.c
+++ b/src/sock.c
-@@ -39,8 +39,7 @@
- * returned if the bind succeeded. Otherwise, -1 is returned
+@@ -63,7 +63,7 @@ static const char * family_string (int a
* to indicate an error.
*/
--static int
+ static int
-bind_socket (int sockfd, const char *addr, int family)
-+static int bind_socket (int sockfd, const char *addr)
++bind_socket (int sockfd, const char *addr)
{
struct addrinfo hints, *res, *ressave;
-
-@@ -48,7 +47,7 @@ bind_socket (int sockfd, const char *add
+ int n;
+@@ -72,14 +72,14 @@ bind_socket (int sockfd, const char *add
assert (addr != NULL && strlen (addr) != 0);
memset (&hints, 0, sizeof (struct addrinfo));
@@ -18,8 +17,33 @@
+ hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
- /* The local port it not important */
-@@ -112,14 +111,12 @@ int opensock (const char *host, int port
+ /* The local port is not important */
+ n = getaddrinfo (addr, NULL, &hints, &res);
+ if (n != 0) {
+ log_message (LOG_INFO,
+- "bind_socket: getaddrinfo failed for %s: %s (af: %s)", addr, get_gai_error (n), family_string(family));
++ "bind_socket: getaddrinfo failed for %s: %s", addr, get_gai_error (n));
+ return -1;
+ }
+
+@@ -102,14 +102,14 @@ bind_socket (int sockfd, const char *add
+ * Try binding the given socket to supplied addresses, stopping when one succeeds.
+ */
+ static int
+-bind_socket_list (int sockfd, sblist *addresses, int family)
++bind_socket_list (int sockfd, sblist *addresses)
+ {
+ size_t nb_addresses = sblist_getsize(addresses);
+ size_t i;
+
+ for (i = 0; i < nb_addresses; i++) {
+ const char *address = *(const char **)sblist_get(addresses, i);
+- if (bind_socket(sockfd, address, family) >= 0) {
++ if (bind_socket(sockfd, address) >= 0) {
+ log_message(LOG_INFO, "Bound to %s", address);
+ return 0;
+ }
+@@ -170,14 +170,12 @@ int opensock (const char *host, int port
/* Bind to the specified address */
if (bind_to) {
@@ -29,10 +53,10 @@
close (sockfd);
continue; /* can't bind, so try again */
}
- } else if (config.bind_address) {
-- if (bind_socket (sockfd, config.bind_address,
-- res->ai_family) < 0) {
-+ if (bind_socket (sockfd, config.bind_address) < 0) {
+ } else if (config->bind_addrs) {
+- if (bind_socket_list (sockfd, config->bind_addrs,
+- res->ai_family) < 0) {
++ if (bind_socket_list (sockfd, config->bind_addrs) < 0) {
close (sockfd);
continue; /* can't bind, so try again */
}