1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-20 04:02:27 +00:00

net/tinyfugue: fix IPv6 on 64bit

This commit is contained in:
Dirk Meyer 2021-09-20 16:07:19 +02:00
parent 884bedb1ff
commit cd8a6ef592
3 changed files with 56 additions and 1 deletions

View File

@ -2,7 +2,7 @@
PORTNAME= tf
PORTVERSION= 5.0b8
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= net games
MASTER_SITES= SF/tinyfugue/tinyfugue/5.0%20beta%208
DISTNAME= ${PORTNAME}-${PORTVERSION:S/.//}

View File

@ -0,0 +1,10 @@
--- src/output.c.orig 2007-01-14 00:44:19 UTC
+++ src/output.c
@@ -2270,6 +2270,7 @@ static void ioutall(int kpos)
iendx = -kpos + 1;
kpos = 0;
}
+ if (keybuf->data == 0) return;
if (sockecho())
ioutputs(keybuf->data + kpos, keybuf->len - kpos);
}

View File

@ -0,0 +1,45 @@
--- src/socket.c.orig 2007-01-13 23:12:39 UTC
+++ src/socket.c
@@ -494,6 +494,8 @@ do { \
do_hook(H_DISCONNECT, "%% Connection to %s closed: %s: %s", "%s %s: %s", \
where, what, why)
+#define ROUND_UP_LENGTH(len) ((len + 7) & -8)
+
#if HAVE_SSL
static void ssl_err(const char *str)
{
@@ -1478,8 +1480,8 @@ static int openconn(Sock *sock)
for (ai = xsock->addrs; ai; ai = ai->ai_next) {
ai->ai_addr = (struct sockaddr*)((char*)ai + sizeof(*ai));
if (ai->ai_next != 0) {
- ai->ai_next =
- (struct addrinfo*)((char*)ai->ai_addr + ai->ai_addrlen);
+ ai->ai_next =
+ (struct addrinfo*)((char*)ai->ai_addr + ROUND_UP_LENGTH(ai->ai_addrlen));
}
}
xsock->addr = xsock->addrs;
@@ -1783,13 +1785,21 @@ static void waitforhostname(int fd, const char *name,
iov[0].iov_len = sizeof(hdr);
niov = 1;
for (ai = res; ai && niov < NIOV; ai = ai->ai_next) {
- hdr.size += sizeof(*ai) + ai->ai_addrlen;
+ static const char zeros[ 8 ] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ size_t padded = ROUND_UP_LENGTH(ai->ai_addrlen);
+ hdr.size += sizeof(*ai) + padded;
iov[niov].iov_base = (char*)ai;
iov[niov].iov_len = sizeof(*ai);
niov++;
iov[niov].iov_base = (char*)ai->ai_addr;
iov[niov].iov_len = ai->ai_addrlen;
niov++;
+ if (padded != ai->ai_addrlen) {
+ /* padding */
+ iov[niov].iov_base = (char*)zeros;
+ iov[niov].iov_len = padded - ai->ai_addrlen;
+ niov++;
+ }
}
writev(fd, iov, niov);
if (res) freeaddrinfo(res);