Search code examples
iosmacosmacos-sierranetlink

libnl on macOS and iOS


I'm trying to migrate a Linux/Android C app to macOS/iOS.

I have this problem, this app uses libnl library some times, in the source code you can see includes like:

#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/if_tun.h>

These files are from libnl library, you can find information about this library here:

https://www.infradead.org/~tgr/libnl/doc/core.html#_introduction

I don't know what it's the equivalent in macOS and iOS. Maybe is the same but in another path?

Also I tried to download libnl library and add it to /usr/local/include but it have other dependencies, this is why that I think that I'm in the wrong way...

I found this guide https://developer.apple.com/library/content/documentation/Darwin/Conceptual/NKEConceptual/intro/intro.html#//apple_ref/doc/uid/TP40001858-CH225-SW1

But this means that I need to rewrite all parts of the code that uses libnl?

Any ideas?

Thanks in advance!


Solution

  • You will probably need to do some changes to code. A quick glance at the libnl docs shows that you might be able to use GDAsyncSocket.

    https://github.com/robbiehanson/CocoaAsyncSocket

    But without seeing your code, it's not possible to be sure.