From bf26ec3253c4dfc883b9b05f6571a7a30f882d3e Mon Sep 17 00:00:00 2001 From: Kazuho Oku Date: Sun, 22 Dec 2024 17:24:46 +0900 Subject: [PATCH 1/5] update picotls --- deps/picotls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/picotls b/deps/picotls index 4ab6fda5..bbcdbe6d 160000 --- a/deps/picotls +++ b/deps/picotls @@ -1 +1 @@ -Subproject commit 4ab6fda556e21ef9ab7a51e48347b0289d5d5888 +Subproject commit bbcdbe6dc31ec5d4b72a7beece4daf58098bad42 From 994cd0d84da98643f03dd7fa06a7f108c1bb1f14 Mon Sep 17 00:00:00 2001 From: Kazuho Oku Date: Sun, 22 Dec 2024 17:25:23 +0900 Subject: [PATCH 2/5] perl might not exist in /usr/bin, follow what t/e2e.t does --- t/cplusplus.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/cplusplus.t b/t/cplusplus.t index a195da79..70e3423e 100755 --- a/t/cplusplus.t +++ b/t/cplusplus.t @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/bin/env perl use strict; use warnings; From a7b37b1f0c260d8b1e98e11acff578053ad927c4 Mon Sep 17 00:00:00 2001 From: Kazuho Oku Date: Sun, 22 Dec 2024 17:27:26 +0900 Subject: [PATCH 3/5] FreeBSD rejects IP_TOS other than 1 byte --- src/cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.c b/src/cli.c index 5f8b18c9..81ec02eb 100644 --- a/src/cli.c +++ b/src/cli.c @@ -534,7 +534,7 @@ static void set_srcaddr(struct msghdr *mess, quicly_address_t *addr) } } -static void set_ecn(struct msghdr *mess, int ecn) +static void set_ecn(struct msghdr *mess, uint8_t ecn) { if (ecn == 0) return; From d7ee77fb8637ca3cc3191d35fb0c51d3bf41535e Mon Sep 17 00:00:00 2001 From: Kazuho Oku Date: Sun, 22 Dec 2024 17:29:22 +0900 Subject: [PATCH 4/5] IP_SENDSRCADDR takes inaddr_t as input, not sockaddr_in --- src/cli.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cli.c b/src/cli.c index 81ec02eb..38419210 100644 --- a/src/cli.c +++ b/src/cli.c @@ -513,9 +513,9 @@ static void set_srcaddr(struct msghdr *mess, quicly_address_t *addr) #elif defined(IP_SENDSRCADDR) cmsg->cmsg_level = IPPROTO_IP; cmsg->cmsg_type = IP_SENDSRCADDR; - cmsg->cmsg_len = CMSG_LEN(sizeof(addr->sin)); - memcpy(CMSG_DATA(cmsg), &addr->sin, sizeof(addr->sin)); - mess->msg_controllen += CMSG_SPACE(sizeof(addr->sin)); + cmsg->cmsg_len = CMSG_LEN(sizeof(addr->sin.sin_addr)); + memcpy(CMSG_DATA(cmsg), &addr->sin.sin_addr, sizeof(addr->sin.sin_addr)); + mess->msg_controllen += CMSG_SPACE(sizeof(addr->sin.sin_addr)); #else assert(!"FIXME"); #endif From 922440d1e60d4c705f299185206bbb69e30579d6 Mon Sep 17 00:00:00 2001 From: Kazuho Oku Date: Sun, 22 Dec 2024 17:34:45 +0900 Subject: [PATCH 5/5] document the freebsd behavior --- src/cli.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cli.c b/src/cli.c index 38419210..15ff179c 100644 --- a/src/cli.c +++ b/src/cli.c @@ -511,6 +511,8 @@ static void set_srcaddr(struct msghdr *mess, quicly_address_t *addr) memcpy(CMSG_DATA(cmsg), &info, sizeof(info)); mess->msg_controllen += CMSG_SPACE(sizeof(info)); #elif defined(IP_SENDSRCADDR) + /* TODO FreeBSD: skip setting IP_SENDSRCADDR if the socket is not bound to INADDR_ANY, as doing so results in sendmsg + * generating an error */ cmsg->cmsg_level = IPPROTO_IP; cmsg->cmsg_type = IP_SENDSRCADDR; cmsg->cmsg_len = CMSG_LEN(sizeof(addr->sin.sin_addr));