Skip to content

Commit

Permalink
Merge pull request #190728 from Homebrew/tinc-sequoia
Browse files Browse the repository at this point in the history
tinc: add sequoia build patch
  • Loading branch information
BrewTestBot authored Sep 16, 2024
2 parents b0a4536 + 21db1e0 commit d6642bb
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions Formula/t/tinc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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;
}

0 comments on commit d6642bb

Please sign in to comment.