Re: [PATCH] BSD: macOS Support
Hi Tom and Maria, I’ve managed to put together a macOS runner. It is functioning, although the script is a bit messy. https://github.com/myzhang1029/bird/blob/master/.github/workflows/ci.yml About testing on a Darwin kernel, I am not sure if that would be enough, because making bird compile on a Mac is also related to how Apple chooses to name constants like TCPOPT_SIGNATURE in the vendored header files. Kind regards, Maiyun Zhang (he/him) > Le 13 mars 2024 à 06:27, Tom Herbers a écrit : > > Hi, > > GitHub offers free macOS Runners via GitHub Actions for all public > repositories [1]. > > That would be a legal of testing on macOS. > > Now, of course, someone would have to put together a suitable workflow. > > > Kind regards, > Tom > > > [1] > https://docs.github.com/de/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories > > Am Mittwoch, dem 13.03.2024 um 11:11 +0100 schrieb Maria Matejka via > Bird-users: >> >> Hello Zhang, >> >> thank you for your contribution. This looks includable, however I'd >> like to ask you about maintainability of this patch. It may quite >> quickly rot away. Is there an easy (and legal) way to have automatic >> macOS build and basic run testing, without a need to maintain a >> physical Mac? >> >> >> Thanks, >> Maria >> >> >> On 2024-03-13 03:02, Zhang Maiyun via Bird-users wrote: >> >> >>> >>> Dear all, >>> >>> This patch makes bird build and run on macOS with `sysconfig=bsd`. >>> It is mainly modifying preprocessor directives. >>> >>> I have tested it on macOS 14.3.1 and it is able to establish BGP >>> sessions >>> and at least exchange IPv4 routes. >>> >>> Kind regards, >>> Maiyun Zhang >>> >>> Signed-off-by: Zhang Maiyun >>> --- >>> sysdep/bsd/krt-sock.c | 6 ++ >>> sysdep/bsd/sysio.h| 6 +- >>> sysdep/unix/io.c | 3 +++ >>> sysdep/unix/random.c | 2 +- >>> 4 files changed, 15 insertions(+), 2 deletions(-) >>> >>> diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c >>> index d13e20a3..afb66cb3 100644 >>> --- a/sysdep/bsd/krt-sock.c >>> +++ b/sysdep/bsd/krt-sock.c >>> @@ -635,6 +635,7 @@ krt_read_route(struct ks_msg *msg, struct >>> krt_proto *p, int scan) >>> krt_got_route_async(p, e, new, src); >>> } >>> >>> +#ifndef __APPLE__ >>> static void >>> krt_read_ifannounce(struct ks_msg *msg) >>> { >>> @@ -661,6 +662,7 @@ krt_read_ifannounce(struct ks_msg *msg) >>> >>>DBG("KRT: IFANNOUNCE what: %d index %d name %s\n", ifam- ifan_what, ifam->ifan_index, ifam->ifan_name); >>> } >>> +#endif >>> >>> static void >>> krt_read_ifinfo(struct ks_msg *msg, int scan) >>> @@ -725,7 +727,9 @@ krt_read_ifinfo(struct ks_msg *msg, int scan) >>> >>>if (fl & IFF_UP) >>> f.flags |= IF_ADMIN_UP; >>> +#ifndef __APPLE__ >>>if (ifm->ifm_data.ifi_link_state != LINK_STATE_DOWN) >>> +#endif >>> f.flags |= IF_LINK_UP; /* up or unknown */ >>>if (fl & IFF_LOOPBACK)/* Loopback */ >>> f.flags |= IF_MULTIACCESS | IF_LOOPBACK | IF_IGNORE; >>> @@ -873,9 +877,11 @@ krt_read_msg(struct proto *p, struct ks_msg >>> *msg, int scan) >>> case RTM_CHANGE: >>>krt_read_route(msg, (struct krt_proto *)p, scan); >>>break; >>> +#ifndef __APPLE__ >>> case RTM_IFANNOUNCE: >>>krt_read_ifannounce(msg); >>>break; >>> +#endif >>> case RTM_IFINFO: >>>krt_read_ifinfo(msg, scan); >>>break; >>> diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h >>> index b6b42b1e..85081c07 100644 >>> --- a/sysdep/bsd/sysio.h >>> +++ b/sysdep/bsd/sysio.h >>> @@ -32,7 +32,7 @@ >>> #endif >>> >>> >>> -#ifdef __NetBSD__ >>> +#if defined(__NetBSD__) || defined(__APPLE__) >>> >>> #ifndef IP_RECVTTL >>> #define IP_RECVTTL 23 >>> @@ -49,6 +49,10 @@ >>> #define TCP_MD5SIG TCP_SIGNATURE_ENABLE >>> #endif >>> >>> +#ifdef __APPLE__ >>> +#define TCP_MD5SIG TCPOPT_SIGNATURE >>> +#endif >>> + >>> >>> #undef SA_LEN >>> #define SA_LEN(x) (x).sa.sa_len >>> diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c >>> index 9b499020..81e09888 100644 >>> --- a/sysdep/unix/io.c >>> +++ b/sysdep/unix/io.c >>> @@ -12,6 +12,9 @@ >>> #ifndef _GNU_SOURCE >>> #define _GNU_SOURCE >>> #endif >>> +#ifdef __APPLE__ >>> +#define __APPLE_USE_RFC_3542 >>> +#endif >>> >>> #include >>> #include >>> diff --git a/sysdep/unix/random.c b/sysdep/unix/random.c >>> index 4e64e56b..7d68c482 100644 >>> --- a/sysdep/unix/random.c >>> +++ b/sysdep/unix/random.c >>> @@ -16,7 +16,7 @@ >>> #include "sysdep/config.h" >>> #include "nest/bird.h" >>> >>> -#ifdef HAVE_GETRANDOM >>> +#if defined(HAVE_GETRANDOM) || (defined(__APPLE__) && >>> defined(HAVE_GETENTROPY)) >>> #include >>> #endif >>> >>> >> > >
Re: [PATCH] BSD: macOS Support
Hey Maria, Zhang, Regarding CI/CD, perhaps I can have a chat with the folks of Flow who have exactly bare metal mac as a service including a tailored product for CI: https://flow.swiss/ci-engine If the expected lifetime of macOS support in Bird is unknown, and there is no vested interest in it, perhaps that would be less of an appealing situation. It kind of depends on the eventual use / longevity. If folks on this list are enthusiastic about macOS, and the maintainers are OK extending the builds to include it, I think it would definitely be possible to work with the flow.swiss team, and I can make introductions. groet, Pim On Wed, Mar 13, 2024 at 11:22 AM Maria Matejka via Bird-users < bird-users@network.cz> wrote: > Hello Zhang, > > thank you for your contribution. This looks includable, however I'd like > to ask you about maintainability of this patch. It may quite quickly rot > away. Is there an easy (and legal) way to have automatic macOS build and > basic run testing, without a need to maintain a physical Mac? > > Thanks, > Maria > On 2024-03-13 03:02, Zhang Maiyun via Bird-users wrote: > > Dear all, > > This patch makes bird build and run on macOS with `sysconfig=bsd`. > It is mainly modifying preprocessor directives. > > I have tested it on macOS 14.3.1 and it is able to establish BGP sessions > and at least exchange IPv4 routes. > > Kind regards, > Maiyun Zhang > > Signed-off-by: Zhang Maiyun > --- > sysdep/bsd/krt-sock.c | 6 ++ > sysdep/bsd/sysio.h| 6 +- > sysdep/unix/io.c | 3 +++ > sysdep/unix/random.c | 2 +- > 4 files changed, 15 insertions(+), 2 deletions(-) > > diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c > index d13e20a3..afb66cb3 100644 > --- a/sysdep/bsd/krt-sock.c > +++ b/sysdep/bsd/krt-sock.c > @@ -635,6 +635,7 @@ krt_read_route(struct ks_msg *msg, struct krt_proto *p, > int scan) > krt_got_route_async(p, e, new, src); > } > > +#ifndef __APPLE__ > static void > krt_read_ifannounce(struct ks_msg *msg) > { > @@ -661,6 +662,7 @@ krt_read_ifannounce(struct ks_msg *msg) > >DBG("KRT: IFANNOUNCE what: %d index %d name %s\n", ifam->ifan_what, > ifam->ifan_index, ifam->ifan_name); > } > +#endif > > static void > krt_read_ifinfo(struct ks_msg *msg, int scan) > @@ -725,7 +727,9 @@ krt_read_ifinfo(struct ks_msg *msg, int scan) > >if (fl & IFF_UP) > f.flags |= IF_ADMIN_UP; > +#ifndef __APPLE__ >if (ifm->ifm_data.ifi_link_state != LINK_STATE_DOWN) > +#endif > f.flags |= IF_LINK_UP; /* up or unknown */ >if (fl & IFF_LOOPBACK)/* Loopback */ > f.flags |= IF_MULTIACCESS | IF_LOOPBACK | IF_IGNORE; > @@ -873,9 +877,11 @@ krt_read_msg(struct proto *p, struct ks_msg *msg, int > scan) > case RTM_CHANGE: >krt_read_route(msg, (struct krt_proto *)p, scan); >break; > +#ifndef __APPLE__ > case RTM_IFANNOUNCE: >krt_read_ifannounce(msg); >break; > +#endif > case RTM_IFINFO: >krt_read_ifinfo(msg, scan); >break; > diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h > index b6b42b1e..85081c07 100644 > --- a/sysdep/bsd/sysio.h > +++ b/sysdep/bsd/sysio.h > @@ -32,7 +32,7 @@ > #endif > > > -#ifdef __NetBSD__ > +#if defined(__NetBSD__) || defined(__APPLE__) > > #ifndef IP_RECVTTL > #define IP_RECVTTL 23 > @@ -49,6 +49,10 @@ > #define TCP_MD5SIG TCP_SIGNATURE_ENABLE > #endif > > +#ifdef __APPLE__ > +#define TCP_MD5SIG TCPOPT_SIGNATURE > +#endif > + > > #undef SA_LEN > #define SA_LEN(x) (x).sa.sa_len > diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c > index 9b499020..81e09888 100644 > --- a/sysdep/unix/io.c > +++ b/sysdep/unix/io.c > @@ -12,6 +12,9 @@ > #ifndef _GNU_SOURCE > #define _GNU_SOURCE > #endif > +#ifdef __APPLE__ > +#define __APPLE_USE_RFC_3542 > +#endif > > #include > #include > diff --git a/sysdep/unix/random.c b/sysdep/unix/random.c > index 4e64e56b..7d68c482 100644 > --- a/sysdep/unix/random.c > +++ b/sysdep/unix/random.c > @@ -16,7 +16,7 @@ > #include "sysdep/config.h" > #include "nest/bird.h" > > -#ifdef HAVE_GETRANDOM > +#if defined(HAVE_GETRANDOM) || (defined(__APPLE__) && > defined(HAVE_GETENTROPY)) > #include > #endif > > > -- > Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o. > > -- Pim van Pelt PBVP1-RIPE - http://www.ipng.nl/
Re: [PATCH] BSD: macOS Support
Hi, Maybe Darwin would be enough for testing this? It seems to me, that is should contain all the necessary staff used by bird. Although, I do not have experience with Darwin. Regards, Alexander On Wed, Mar 13, 2024 at 2:34 PM Tom Herbers wrote: > > Hi, > > GitHub offers free macOS Runners via GitHub Actions for all public > repositories [1]. > > That would be a legal of testing on macOS. > > Now, of course, someone would have to put together a suitable workflow. > > > Kind regards, > Tom > > > [1] > https://docs.github.com/de/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories > > Am Mittwoch, dem 13.03.2024 um 11:11 +0100 schrieb Maria Matejka via > Bird-users: > > > > Hello Zhang, > > > > thank you for your contribution. This looks includable, however I'd > > like to ask you about maintainability of this patch. It may quite > > quickly rot away. Is there an easy (and legal) way to have automatic > > macOS build and basic run testing, without a need to maintain a > > physical Mac? > > > > > > Thanks, > > Maria > > > > > > On 2024-03-13 03:02, Zhang Maiyun via Bird-users wrote: > > > > > > > > > > Dear all, > > > > > > This patch makes bird build and run on macOS with `sysconfig=bsd`. > > > It is mainly modifying preprocessor directives. > > > > > > I have tested it on macOS 14.3.1 and it is able to establish BGP > > > sessions > > > and at least exchange IPv4 routes. > > > > > > Kind regards, > > > Maiyun Zhang > > > > > > Signed-off-by: Zhang Maiyun > > > --- > > > sysdep/bsd/krt-sock.c | 6 ++ > > > sysdep/bsd/sysio.h| 6 +- > > > sysdep/unix/io.c | 3 +++ > > > sysdep/unix/random.c | 2 +- > > > 4 files changed, 15 insertions(+), 2 deletions(-) > > > > > > diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c > > > index d13e20a3..afb66cb3 100644 > > > --- a/sysdep/bsd/krt-sock.c > > > +++ b/sysdep/bsd/krt-sock.c > > > @@ -635,6 +635,7 @@ krt_read_route(struct ks_msg *msg, struct > > > krt_proto *p, int scan) > > > krt_got_route_async(p, e, new, src); > > > } > > > > > > +#ifndef __APPLE__ > > > static void > > > krt_read_ifannounce(struct ks_msg *msg) > > > { > > > @@ -661,6 +662,7 @@ krt_read_ifannounce(struct ks_msg *msg) > > > > > >DBG("KRT: IFANNOUNCE what: %d index %d name %s\n", ifam- > > > >ifan_what, ifam->ifan_index, ifam->ifan_name); > > > } > > > +#endif > > > > > > static void > > > krt_read_ifinfo(struct ks_msg *msg, int scan) > > > @@ -725,7 +727,9 @@ krt_read_ifinfo(struct ks_msg *msg, int scan) > > > > > >if (fl & IFF_UP) > > > f.flags |= IF_ADMIN_UP; > > > +#ifndef __APPLE__ > > >if (ifm->ifm_data.ifi_link_state != LINK_STATE_DOWN) > > > +#endif > > > f.flags |= IF_LINK_UP; /* up or unknown */ > > >if (fl & IFF_LOOPBACK)/* Loopback */ > > > f.flags |= IF_MULTIACCESS | IF_LOOPBACK | IF_IGNORE; > > > @@ -873,9 +877,11 @@ krt_read_msg(struct proto *p, struct ks_msg > > > *msg, int scan) > > > case RTM_CHANGE: > > >krt_read_route(msg, (struct krt_proto *)p, scan); > > >break; > > > +#ifndef __APPLE__ > > > case RTM_IFANNOUNCE: > > >krt_read_ifannounce(msg); > > >break; > > > +#endif > > > case RTM_IFINFO: > > >krt_read_ifinfo(msg, scan); > > >break; > > > diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h > > > index b6b42b1e..85081c07 100644 > > > --- a/sysdep/bsd/sysio.h > > > +++ b/sysdep/bsd/sysio.h > > > @@ -32,7 +32,7 @@ > > > #endif > > > > > > > > > -#ifdef __NetBSD__ > > > +#if defined(__NetBSD__) || defined(__APPLE__) > > > > > > #ifndef IP_RECVTTL > > > #define IP_RECVTTL 23 > > > @@ -49,6 +49,10 @@ > > > #define TCP_MD5SIG TCP_SIGNATURE_ENABLE > > > #endif > > > > > > +#ifdef __APPLE__ > > > +#define TCP_MD5SIG TCPOPT_SIGNATURE > > > +#endif > > > + > > > > > > #undef SA_LEN > > > #define SA_LEN(x) (x).sa.sa_len > > > diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c > > > index 9b499020..81e09888 100644 > > > --- a/sysdep/unix/io.c > > > +++ b/sysdep/unix/io.c > > > @@ -12,6 +12,9 @@ > > > #ifndef _GNU_SOURCE > > > #define _GNU_SOURCE > > > #endif > > > +#ifdef __APPLE__ > > > +#define __APPLE_USE_RFC_3542 > > > +#endif > > > > > > #include > > > #include > > > diff --git a/sysdep/unix/random.c b/sysdep/unix/random.c > > > index 4e64e56b..7d68c482 100644 > > > --- a/sysdep/unix/random.c > > > +++ b/sysdep/unix/random.c > > > @@ -16,7 +16,7 @@ > > > #include "sysdep/config.h" > > > #include "nest/bird.h" > > > > > > -#ifdef HAVE_GETRANDOM > > > +#if defined(HAVE_GETRANDOM) || (defined(__APPLE__) && > > > defined(HAVE_GETENTROPY)) > > > #include > > > #endif > > > > > > > > > >
Re: [PATCH] BSD: macOS Support
Hi, GitHub offers free macOS Runners via GitHub Actions for all public repositories [1]. That would be a legal of testing on macOS. Now, of course, someone would have to put together a suitable workflow. Kind regards, Tom [1] https://docs.github.com/de/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories Am Mittwoch, dem 13.03.2024 um 11:11 +0100 schrieb Maria Matejka via Bird-users: > > Hello Zhang, > > thank you for your contribution. This looks includable, however I'd > like to ask you about maintainability of this patch. It may quite > quickly rot away. Is there an easy (and legal) way to have automatic > macOS build and basic run testing, without a need to maintain a > physical Mac? > > > Thanks, > Maria > > > On 2024-03-13 03:02, Zhang Maiyun via Bird-users wrote: > > > > > > Dear all, > > > > This patch makes bird build and run on macOS with `sysconfig=bsd`. > > It is mainly modifying preprocessor directives. > > > > I have tested it on macOS 14.3.1 and it is able to establish BGP > > sessions > > and at least exchange IPv4 routes. > > > > Kind regards, > > Maiyun Zhang > > > > Signed-off-by: Zhang Maiyun > > --- > > sysdep/bsd/krt-sock.c | 6 ++ > > sysdep/bsd/sysio.h| 6 +- > > sysdep/unix/io.c | 3 +++ > > sysdep/unix/random.c | 2 +- > > 4 files changed, 15 insertions(+), 2 deletions(-) > > > > diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c > > index d13e20a3..afb66cb3 100644 > > --- a/sysdep/bsd/krt-sock.c > > +++ b/sysdep/bsd/krt-sock.c > > @@ -635,6 +635,7 @@ krt_read_route(struct ks_msg *msg, struct > > krt_proto *p, int scan) > > krt_got_route_async(p, e, new, src); > > } > > > > +#ifndef __APPLE__ > > static void > > krt_read_ifannounce(struct ks_msg *msg) > > { > > @@ -661,6 +662,7 @@ krt_read_ifannounce(struct ks_msg *msg) > > > > DBG("KRT: IFANNOUNCE what: %d index %d name %s\n", ifam- > > >ifan_what, ifam->ifan_index, ifam->ifan_name); > > } > > +#endif > > > > static void > > krt_read_ifinfo(struct ks_msg *msg, int scan) > > @@ -725,7 +727,9 @@ krt_read_ifinfo(struct ks_msg *msg, int scan) > > > > if (fl & IFF_UP) > > f.flags |= IF_ADMIN_UP; > > +#ifndef __APPLE__ > > if (ifm->ifm_data.ifi_link_state != LINK_STATE_DOWN) > > +#endif > > f.flags |= IF_LINK_UP; /* up or unknown */ > > if (fl & IFF_LOOPBACK)/* Loopback */ > > f.flags |= IF_MULTIACCESS | IF_LOOPBACK | IF_IGNORE; > > @@ -873,9 +877,11 @@ krt_read_msg(struct proto *p, struct ks_msg > > *msg, int scan) > > case RTM_CHANGE: > > krt_read_route(msg, (struct krt_proto *)p, scan); > > break; > > +#ifndef __APPLE__ > > case RTM_IFANNOUNCE: > > krt_read_ifannounce(msg); > > break; > > +#endif > > case RTM_IFINFO: > > krt_read_ifinfo(msg, scan); > > break; > > diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h > > index b6b42b1e..85081c07 100644 > > --- a/sysdep/bsd/sysio.h > > +++ b/sysdep/bsd/sysio.h > > @@ -32,7 +32,7 @@ > > #endif > > > > > > -#ifdef __NetBSD__ > > +#if defined(__NetBSD__) || defined(__APPLE__) > > > > #ifndef IP_RECVTTL > > #define IP_RECVTTL 23 > > @@ -49,6 +49,10 @@ > > #define TCP_MD5SIG TCP_SIGNATURE_ENABLE > > #endif > > > > +#ifdef __APPLE__ > > +#define TCP_MD5SIG TCPOPT_SIGNATURE > > +#endif > > + > > > > #undef SA_LEN > > #define SA_LEN(x) (x).sa.sa_len > > diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c > > index 9b499020..81e09888 100644 > > --- a/sysdep/unix/io.c > > +++ b/sysdep/unix/io.c > > @@ -12,6 +12,9 @@ > > #ifndef _GNU_SOURCE > > #define _GNU_SOURCE > > #endif > > +#ifdef __APPLE__ > > +#define __APPLE_USE_RFC_3542 > > +#endif > > > > #include > > #include > > diff --git a/sysdep/unix/random.c b/sysdep/unix/random.c > > index 4e64e56b..7d68c482 100644 > > --- a/sysdep/unix/random.c > > +++ b/sysdep/unix/random.c > > @@ -16,7 +16,7 @@ > > #include "sysdep/config.h" > > #include "nest/bird.h" > > > > -#ifdef HAVE_GETRANDOM > > +#if defined(HAVE_GETRANDOM) || (defined(__APPLE__) && > > defined(HAVE_GETENTROPY)) > > #include > > #endif > > > > >
Re: [PATCH] BSD: macOS Support
Hello Zhang, thank you for your contribution. This looks includable, however I'd like to ask you about maintainability of this patch. It may quite quickly rot away. Is there an easy (and legal) way to have automatic macOS build and basic run testing, without a need to maintain a physical Mac? Thanks, Maria On 2024-03-13 03:02, Zhang Maiyun via Bird-users wrote: Dear all, This patch makes bird build and run on macOS with `sysconfig=bsd`. It is mainly modifying preprocessor directives. I have tested it on macOS 14.3.1 and it is able to establish BGP sessions and at least exchange IPv4 routes. Kind regards, Maiyun Zhang Signed-off-by: Zhang Maiyun --- sysdep/bsd/krt-sock.c | 6 ++ sysdep/bsd/sysio.h| 6 +- sysdep/unix/io.c | 3 +++ sysdep/unix/random.c | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index d13e20a3..afb66cb3 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -635,6 +635,7 @@ krt_read_route(struct ks_msg *msg, struct krt_proto *p, int scan) krt_got_route_async(p, e, new, src); } +#ifndef __APPLE__ static void krt_read_ifannounce(struct ks_msg *msg) { @@ -661,6 +662,7 @@ krt_read_ifannounce(struct ks_msg *msg) DBG("KRT: IFANNOUNCE what: %d index %d name %s\n", ifam->ifan_what, ifam->ifan_index, ifam->ifan_name); } +#endif static void krt_read_ifinfo(struct ks_msg *msg, int scan) @@ -725,7 +727,9 @@ krt_read_ifinfo(struct ks_msg *msg, int scan) if (fl & IFF_UP) f.flags |= IF_ADMIN_UP; +#ifndef __APPLE__ if (ifm->ifm_data.ifi_link_state != LINK_STATE_DOWN) +#endif f.flags |= IF_LINK_UP; /* up or unknown */ if (fl & IFF_LOOPBACK)/* Loopback */ f.flags |= IF_MULTIACCESS | IF_LOOPBACK | IF_IGNORE; @@ -873,9 +877,11 @@ krt_read_msg(struct proto *p, struct ks_msg *msg, int scan) case RTM_CHANGE: krt_read_route(msg, (struct krt_proto *)p, scan); break; +#ifndef __APPLE__ case RTM_IFANNOUNCE: krt_read_ifannounce(msg); break; +#endif case RTM_IFINFO: krt_read_ifinfo(msg, scan); break; diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h index b6b42b1e..85081c07 100644 --- a/sysdep/bsd/sysio.h +++ b/sysdep/bsd/sysio.h @@ -32,7 +32,7 @@ #endif -#ifdef __NetBSD__ +#if defined(__NetBSD__) || defined(__APPLE__) #ifndef IP_RECVTTL #define IP_RECVTTL 23 @@ -49,6 +49,10 @@ #define TCP_MD5SIGTCP_SIGNATURE_ENABLE #endif +#ifdef __APPLE__ +#define TCP_MD5SIG TCPOPT_SIGNATURE +#endif + #undef SA_LEN #define SA_LEN(x) (x).sa.sa_len diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index 9b499020..81e09888 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -12,6 +12,9 @@ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif +#ifdef __APPLE__ +#define __APPLE_USE_RFC_3542 +#endif #include #include diff --git a/sysdep/unix/random.c b/sysdep/unix/random.c index 4e64e56b..7d68c482 100644 --- a/sysdep/unix/random.c +++ b/sysdep/unix/random.c @@ -16,7 +16,7 @@ #include "sysdep/config.h" #include "nest/bird.h" -#ifdef HAVE_GETRANDOM +#if defined(HAVE_GETRANDOM) || (defined(__APPLE__) && defined(HAVE_GETENTROPY)) #include #endif -- Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.