From 21db1e061ff7c45765394e8b7d972e6b64c6fdba Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Sun, 15 Sep 2024 16:41:23 -0400 Subject: [PATCH] tinc: add sequoia build patch Signed-off-by: Rui Chen --- Formula/t/tinc.rb | 72 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/Formula/t/tinc.rb b/Formula/t/tinc.rb index a1a7408eab437..214c13a8824d1 100644 --- a/Formula/t/tinc.rb +++ b/Formula/t/tinc.rb @@ -29,6 +29,9 @@ class Tinc < Formula uses_from_macos "zlib" + # fix build errors, upstream pr ref, https://github.com/gsliepen/tinc/pull/464 + patch :DATA + def install system "./configure", "--prefix=#{prefix}", "--sysconfdir=#{etc}", "--with-openssl=#{Formula["openssl@3"].opt_prefix}" @@ -52,3 +55,72 @@ def post_install assert_match version.to_s, shell_output("#{sbin}/tincd --version") end end + +__END__ +diff --git a/src/net_socket.c b/src/net_socket.c +index 6195c16..e072970 100644 +--- a/src/net_socket.c ++++ b/src/net_socket.c +@@ -102,14 +102,14 @@ static bool bind_to_interface(int sd) { + + #if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) + memset(&ifr, 0, sizeof(ifr)); +- strncpy(ifr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ); +- ifr.ifr_ifrn.ifrn_name[IFNAMSIZ - 1] = 0; ++ strncpy(ifr.ifr_name, iface, IFNAMSIZ); ++ ifr.ifr_name[IFNAMSIZ - 1] = 0; + free(iface); + + status = setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, (void *)&ifr, sizeof(ifr)); + + if(status) { +- logger(LOG_ERR, "Can't bind to interface %s: %s", ifr.ifr_ifrn.ifrn_name, strerror(errno)); ++ logger(LOG_ERR, "Can't bind to interface %s: %s", ifr.ifr_name, strerror(errno)); + return false; + } + +@@ -157,13 +157,13 @@ int setup_listen_socket(const sockaddr_t *sa) { + struct ifreq ifr; + + memset(&ifr, 0, sizeof(ifr)); +- strncpy(ifr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ); +- ifr.ifr_ifrn.ifrn_name[IFNAMSIZ - 1] = 0; ++ strncpy(ifr.ifr_name, iface, IFNAMSIZ); ++ ifr.ifr_name[IFNAMSIZ - 1] = 0; + free(iface); + + if(setsockopt(nfd, SOL_SOCKET, SO_BINDTODEVICE, (void *)&ifr, sizeof(ifr))) { + closesocket(nfd); +- logger(LOG_ERR, "Can't bind to interface %s: %s", ifr.ifr_ifrn.ifrn_name, strerror(sockerrno)); ++ logger(LOG_ERR, "Can't bind to interface %s: %s", ifr.ifr_name, strerror(sockerrno)); + return -1; + } + +diff --git a/src/raw_socket_device.c b/src/raw_socket_device.c +index f4ed694..cf13fe9 100644 +--- a/src/raw_socket_device.c ++++ b/src/raw_socket_device.c +@@ -61,12 +61,12 @@ static bool setup_device(void) { + #endif + + memset(&ifr, 0, sizeof(ifr)); +- strncpy(ifr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ); +- ifr.ifr_ifrn.ifrn_name[IFNAMSIZ - 1] = 0; ++ strncpy(ifr.ifr_name, iface, IFNAMSIZ); ++ ifr.ifr_name[IFNAMSIZ - 1] = 0; + + if(ioctl(device_fd, SIOCGIFINDEX, &ifr)) { + close(device_fd); +- logger(LOG_ERR, "Can't find interface %s: %s", ifr.ifr_ifrn.ifrn_name, strerror(errno)); ++ logger(LOG_ERR, "Can't find interface %s: %s", ifr.ifr_name, strerror(errno)); + return false; + } + +@@ -76,7 +76,7 @@ static bool setup_device(void) { + sa.sll_ifindex = ifr.ifr_ifindex; + + if(bind(device_fd, (struct sockaddr *) &sa, (socklen_t) sizeof(sa))) { +- logger(LOG_ERR, "Could not bind %s to %s: %s", device, ifr.ifr_ifrn.ifrn_name, strerror(errno)); ++ logger(LOG_ERR, "Could not bind %s to %s: %s", device, ifr.ifr_name, strerror(errno)); + return false; + }