I'm attempting to find a solution to allowing split-tunnelling with the Cisco AnyConnect client for OSX. I've found how it is modifying the firewall, and that's possible to fix. The issue is however the vpnagentd daemon keeps hijacking the routing table.
Sasha Pachev proposed an elegant solution for Linux (https://superuser.com/a/546668/568559), however I'm having challenges in adapting it to OSX.
The hack.c written for Linux references a linux/netlink.h, which isn't present on OSX. I think this is where the AF_NETLINK comes from.
#include <sys/socket.h>
#include <linux/netlink.h>
int __ZN25CInterfaceRouteMonitorMac20routeCallbackHandlerEv()
{
int fd=50; // max fd to try
char buf[8192];
struct sockaddr_nl sa;
socklen_t len = sizeof(sa);
while (fd) {
if (!getsockname(fd, (struct sockaddr *)&sa, &len)) {
if (sa.nl_family == AF_NETLINK) {
ssize_t n = recv(fd, buf, sizeof(buf), MSG_DONTWAIT);
}
}
fd--;
}
return 0;
}
I am not familiar with this language, so I'm not sure where to look. I can see others made reference in the original question to adapting this to OSX, but I don't see the results published anywhere.
Has anyone had any luck adapting this method to OSX? Any help greatly appreciated.
Once I get this aspect working, I'm more than happy to share the full solution.