Skip to content

Instantly share code, notes, and snippets.

@Yawning
Created November 19, 2018 22:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yawning/3f1919a30b2c9bb92d678ff28492f8d4 to your computer and use it in GitHub Desktop.
Save Yawning/3f1919a30b2c9bb92d678ff28492f8d4 to your computer and use it in GitHub Desktop.
BIRD OSX patches.
From 117b56d5315287bb15948f448229431101d48380 Mon Sep 17 00:00:00 2001
From: Yawning Angel <yawning@schwanenlied.me>
Date: Mon, 19 Nov 2018 22:52:41 +0000
Subject: [PATCH] BSD: OSX portability fixes
* RFC 3542 constants require `__APPLE_USE_RFC_3542` to be defined.
* TCP MD5 signatures are not supported by the kernel at all.
---
sysdep/bsd/sysio.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h
index 545276a3..3e4115a9 100644
--- a/sysdep/bsd/sysio.h
+++ b/sysdep/bsd/sysio.h
@@ -33,6 +33,10 @@
#define TCP_MD5SIG TCP_SIGNATURE_ENABLE
#endif
+#if (defined __APPLE__) && (defined __MACH__)
+#define __APPLE_USE_RFC_3542
+#endif
+
#undef SA_LEN
#define SA_LEN(x) (x).sa.sa_len
@@ -209,6 +213,16 @@ sk_prepare_ip_header(sock *s, void *hdr, int dlen)
#include "lib/setkey.h"
#endif
+#if (defined __APPLE__) && (defined __MACH__)
+int
+sk_set_md5_auth(sock *s, ip_addr local UNUSED, ip_addr remote UNUSED, struct iface *ifa UNUSED, char *passwd, int setkey UNUSED)
+{
+ ERR_MSG("OSX does not support TCP MD5 signatures");
+
+ errno = ENOPROTOOPT;
+ return -1;
+}
+#else
int
sk_set_md5_auth(sock *s, ip_addr local UNUSED, ip_addr remote UNUSED, struct iface *ifa UNUSED, char *passwd, int setkey UNUSED)
{
@@ -229,6 +243,7 @@ sk_set_md5_auth(sock *s, ip_addr local UNUSED, ip_addr remote UNUSED, struct ifa
return 0;
}
+#endif
static inline int
sk_set_min_ttl4(sock *s, int ttl)
--
2.19.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment